Help
RSS
API
Feed
Maltego
Contact
Domain > output-kxakhvahwc.now.sh
×
Welcome!
Right click nodes and scroll the mouse to navigate the graph.
×
More information on this domain is in
AlienVault OTX
Is this malicious?
Yes
No
DNS Resolutions
Date
IP Address
2017-11-07
54.153.55.116
(
ClassC
)
2024-08-25
76.76.21.9
(
ClassC
)
2024-09-09
76.76.21.241
(
ClassC
)
Port 443
HTTP/1.1 200 OKAccept-Ranges: bytesAccess-Control-Allow-Origin: *Age: 0Cache-Control: public, max-age0, must-revalidateContent-Disposition: inline; filenameindexContent-Length: 8929914Content-Type: text/html; charsetutf-8Date: Mon, 09 Sep 2024 11:29:36 GMTEtag: W/45b2b47746153916658aba9da1e9e95d0c693564Server: VercelStrict-Transport-Security: max-age63072000; includeSubDomains; preloadX-Robots-Tag: noindexX-Vercel-Cache: MISSX-Vercel-Id: pdx1::sb2cs-1725881375143-a5eeea04fd92 !DOCTYPE html>html langen-US-x-hixie>meta charsetutf-8>meta contentwidthdevice-width, initial-scale1, shrink-to-fitno nameviewport>title>HTML Standard/title>meta content#3c790a nametheme-color>link relstylesheet hrefhttps://resources.whatwg.org/standard.css>link relicon hrefhttps://resources.whatwg.org/logo.svg>script> function toggleStatus(div) { div.parentNode.classList.toggle(wrapped); } /script>style> .status { min-height: 0.6em; font: 1em sans-serif; width: 9em; padding: 0.3em; position: absolute; z-index: 8; right: 0.3em; background: #EEE; color: black; box-shadow: 0 0 3px #999; overflow: hidden; margin: -2em 0 0 0; border-collapse: initial; border-spacing: initial; } .status:hover { z-index: 9; } .status:focus-within { z-index: 9; } .status.wrapped > :not(input) { display: none; } .status > input { position: absolute; left: 0; top: 0; width: 1em; height: 1em; border: none; background: transparent; padding: 0; margin: 0; } .status > p { font-size: 0.6em; margin: 0; padding: 0; } .status > p + p { padding-top: 0.5em; } .status > p > strong { margin-left: 1.5em; } .status > .support { display: block; } .status > .support > span { padding: 0.2em 0; display: block; display: table; } .status > .support > span.partial { color: #666666; filter: grayscale(50%); } .status > .support > span.no { color: #CCCCCC; filter: grayscale(100%); } .status > .support > span.no::before { opacity: 0.5; } .status > .support > span:first-of-type { padding-top: 0.5em; } .status > .support > span > span { padding: 0 0.5em; display: table-cell; vertical-align: top; } .status > .support > span > span:first-child { width: 100%; } .status > .support > span > span:last-child { width: 100%; white-space: pre; padding: 0; } .status > .support > span::before { content: ; display: table-cell; min-width: 1.5em; height: 1.5em; background: no-repeat center center; background-size: contain; text-align: right; font-size: 0.75em; font-weight: bold; } .status > .support > .and_chr::before { background-image: url(https://resources.whatwg.org/browser-logos/chrome.svg); } .status > .support > .and_ff::before { background-image: url(https://resources.whatwg.org/browser-logos/firefox.png); } .status > .support > .and_uc::before { background-image: url(https://resources.whatwg.org/browser-logos/uc.png); } /* UC Browser for Android */ .status > .support > .android::before { background-image: url(https://resources.whatwg.org/browser-logos/android.svg); } .status > .support > .bb::before { background-image: url(https://resources.whatwg.org/browser-logos/bb.jpg); } /* Blackberry Browser */ .status > .support > .chrome::before { background-image: url(https://resources.whatwg.org/browser-logos/chrome.svg); } .status > .support > .edge::before { background-image: url(https://resources.whatwg.org/browser-logos/edge.svg); } .status > .support > .firefox::before { background-image: url(https://resources.whatwg.org/browser-logos/firefox.png); } .status > .support > .ie::before { background-image: url(https://resources.whatwg.org/browser-logos/ie.png); } .status > .support > .ie_mob::before { background-image: url(https://resources.whatwg.org/browser-logos/ie-mobile.svg); } .status > .support > .ios_saf::before { background-image: url(https://resources.whatwg.org/browser-logos/safari-ios.svg); } .status > .support > .op_mini::before { background-image: url(https://resources.whatwg.org/browser-logos/opera-mini.png); } .status > .support > .op_mob::before { background-image: url(https://resources.whatwg.org/browser-logos/opera.png); } .status > .support > .opera::before { background-image: url(https://resources.whatwg.org/browser-logos/opera.png); } .status > .support > .safari::before { background-image: url(https://resources.whatwg.org/browser-logos/safari.png); } .status > .support > .samsung::before { background-image: url(https://resources.whatwg.org/browser-logos/samsung.png); } .status > .caniuse { text-align: right; font-style: italic; width: 100%; } .status > .caniuse + p { margin-top: 0.5em; border-top: 1px solid silver; } @media (max-width: 767px) { .status { right: -9em; } } /style>style> hidden { display: none; } .bad, .bad *:not(.X\58X) { color: gray; border-color: gray; background: transparent; } .fingerprint { position: absolute; right: 0; z-index: 5; } @media (max-width: 767px) { .fingerprint { max-width: 35px; } } .applies .yes, .yesno .yes { background: yellow; } .yesno .yes, .yesno .no { text-align: center; } .applies thead th > * { display: block; } .applies thead code { display: block; } .applies td { text-align: center; } .matrix, .matrix td { border: hidden; text-align: right; } .matrix { margin-left: 2em; } .vertical-summary-table tr > throwspan2:first-child + th, .vertical-summary-table tr > tdrowspan2:first-child + td { border-bottom: hidden; } .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; } .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; } .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; } td.eg { border-width: thin; text-align: center; } #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; } #table-example-1 caption { padding-bottom: 0.5em; } #table-example-1 thead, #table-example-1 tbody { border: none; } #table-example-1 th, #table-example-1 td { border: solid thin; } #table-example-1 th { font-weight: normal; } #table-example-1 td { border-style: none solid; vertical-align: top; } #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; } #table-example-1 tbody tr:first-child td { padding-top: 0.5em; } #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; } #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; } #table-example-1 tbody td:first-child::after { content: leader(. ); } #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; } #table-example-1 tbody td:first-child + td { width: 10em; } #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; } #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; } .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; } .apple-table-examples * { font-family: Times, serif; } .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; } .apple-table-examples tbody th:first-child { border-left: none; width: 100%; } .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; } .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(. ) } .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; } .apple-table-examples td { text-align: right; vertical-align: top; } .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; } .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; } .apple-table-examples.e2 thscoperow { padding-left: 1em; } .apple-table-examples sup { line-height: 0; } .three-column-nowrap tr > td:first-child, .three-column-nowrap tr > td:first-child + td, .three-column-nowrap tr > td:first-child + td + td { white-space: nowrap; } .details-example img { vertical-align: top; } .parse-error-table td > p:first-child { margin-top: 0; } #named-character-references-table { white-space: nowrap; font-size: 0.6em; column-width: 30em; column-gap: 1em; -moz-column-width: 30em; -moz-column-gap: 1em; -webkit-column-width: 30em; -webkit-column-gap: 1em; } #named-character-references-table > table > tbody > tr > td:first-child + td, #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; } #named-character-references-table > table > tbody > tr > td:last-child:hover > span { position: absolute; top: auto; left: auto; margin-left: 0.5em; line-height: 1.2; font-size: 5em; border: outset; padding: 0.25em 0.5em; background: white; width: 1.25em; height: auto; text-align: center; } #named-character-references-table > table > tbody > tr#entity-CounterClockwiseContourIntegral > td:first-child { font-size: 0.5em; } .glyph.control { color: red; } #table-example-1 * { font-family: Essays1743, serif; line-height: 1.01em; } @font-face { font-family: Essays1743; src: url(/fonts/Essays1743.ttf); } @font-face { font-family: Essays1743; font-weight: bold; src: url(/fonts/Essays1743-Bold.ttf); } @font-face { font-family: Essays1743; font-style: italic; src: url(/fonts/Essays1743-Italic.ttf); } @font-face { font-family: Essays1743; font-style: italic; font-weight: bold; src: url(/fonts/Essays1743-BoldItalic.ttf); } @media (max-width: 767px) { #abstractimg { width: 100%; } } #abstractimg, #abstractimg text { font: inherit; } #abstractimg rect { fill: #424242; } #abstractimg text { fill: #ffffff; font-size: 18px } #abstractimg .top { word-spacing: 50px; text-anchor: middle; } #abstractimg .left, #abstractimg .bottom { word-spacing: 12px; } #abstractimg .right { font-size: 25px; } /style>body> script async src/html-dfn.js>/script> script data-file-issue-urlhttps://github.com/whatwg/html/issues/new async srchttps://resources.whatwg.org/file-issue.js>/script> header idhead classhead with-buttons> a hrefhttps://whatwg.org/ classlogo>img srchttps://resources.whatwg.org/logo.svg width100 altWHATWG height100>/a> hgroup>h1 classallcaps>HTML/h1>h2 idliving-standard classno-num no-toc>Living Standard — Last Updated span classpubdate>7 November 2017/span>/h2>/hgroup> nav> div> a href/>span>strong>One-Page Version/strong> code>html.spec.whatwg.org/code>/span>/a> a idmultipage-link href/multipage/>span>strong>Multipage Version/strong> code>/multipage/code>/span>/a> a href/dev/>span>strong>Developer Version/strong> code>/dev/code>/span>/a> a href/print.pdf>span>strong>PDF Version/strong> code>/print.pdf/code>/span>/a> a hrefhttps://github.com/whatwg/html/wiki/Translations>span>strong>Translations/strong> code>日本語 • 简体中文/code>/span>/a> /div> div> a hrefhttps://github.com/whatwg/html/blob/master/FAQ.md classmisc>span>strong>FAQ/strong> code>on GitHub/code>/span>/a> a hrefhttps://wiki.whatwg.org/wiki/IRC classcomms>span>strong>Join us on IRC/strong> code>#whatwg on Freenode/code>/span>/a> /div> div> a hrefhttps://github.com/whatwg/html classchanges>span>strong>Contribute on GitHub/strong> code>whatwg/html repository/code>/span>/a> a hrefhttps://github.com/whatwg/html/commits classchanges>span>strong>Commits/strong> code>on GitHub/code>/span>/a> a hrefhttps://twitter.com/htmlstandard classchanges>span>strong>Twitter Updates/strong> code>@htmlstandard/code>/span>/a> /div> div> a hrefhttps://github.com/whatwg/html/issues classfeedback>span>strong>Open Issues/strong> code>filed on GitHub/code>/span>/a> a hrefhttps://whatwg.org/newbug classfeedback>span>strong>Open an Issue/strong> code>whatwg.org/newbug/code>/span>/a> /div> /nav> /header> hr> h2 idtable-of-contents classno-num no-toc>Table of contents/h2> ol classbrief toc>li>a href#toc-introduction>span classsecno>1/span> Introduction/a>li>a href#toc-infrastructure>span classsecno>2/span> Common infrastructure/a>li>a href#toc-dom>span classsecno>3/span> Semantics, structure, and APIs of HTML documents/a>li>a href#toc-semantics>span classsecno>4/span> The elements of HTML/a>li>a href#toc-microdata>span classsecno>5/span> Microdata/a>li>a href#toc-editing>span classsecno>6/span> User interaction/a>li>a href#toc-browsers>span classsecno>7/span> Loading Web pages/a>li>a href#toc-webappapis>span classsecno>8/span> Web application APIs/a>li>a href#toc-comms>span classsecno>9/span> Communication/a>li>a href#toc-workers>span classsecno>10/span> Web workers/a>li>a href#toc-webstorage>span classsecno>11/span> Web storage/a>li>a href#toc-syntax>span classsecno>12/span> The HTML syntax/a>li>a href#toc-the-xhtml-syntax>span classsecno>13/span> The XML syntax/a>li>a href#toc-rendering>span classsecno>14/span> Rendering/a>li>a href#toc-obsolete>span classsecno>15/span> Obsolete features/a>li>a href#toc-iana>span classsecno>16/span> IANA considerations/a>li>a href#toc-index>Index/a>li>a href#toc-references>References/a>li>a href#toc-acknowledgments>Acknowledgments/a>/ol> h2 idcontents classno-num no-toc>Full table of contents/h2> ol classtoc>li idtoc-introduction>a href#introduction>span classsecno>1/span> Introduction/a>ol>li>a href#abstract>span classsecno>1.1/span> Where does this specification fit?/a>li>a href#is-this-html5?>span classsecno>1.2/span> Is this HTML5?/a>li>a href#background>span classsecno>1.3/span> Background/a>li>a href#audience>span classsecno>1.4/span> Audience/a>li>a href#scope>span classsecno>1.5/span> Scope/a>li>a href#history-2>span classsecno>1.6/span> History/a>li>a href#design-notes>span classsecno>1.7/span> Design notes/a>ol>li>a href#serialisability-of-script-execution>span classsecno>1.7.1/span> Serializability of script execution/a>li>a href#compliance-with-other-specifications>span classsecno>1.7.2/span> Compliance with other specifications/a>li>a href#extensibility>span classsecno>1.7.3/span> Extensibility/a>/ol>li>a href#html-vs-xhtml>span classsecno>1.8/span> HTML vs XML syntax/a>li>a href#structure-of-this-specification>span classsecno>1.9/span> Structure of this specification/a>ol>li>a href#how-to-read-this-specification>span classsecno>1.9.1/span> How to read this specification/a>li>a href#typographic-conventions>span classsecno>1.9.2/span> Typographic conventions/a>/ol>li>a href#fingerprint>span classsecno>1.10/span> Privacy concerns/a>ol>li>a href#fingerprint-postMessage>span classsecno>1.10.1/span> Cross-site communication/a>/ol>li>a href#a-quick-introduction-to-html>span classsecno>1.11/span> A quick introduction to HTML/a>ol>li>a href#writing-secure-applications-with-html>span classsecno>1.11.1/span> Writing secure applications with HTML/a>li>a href#common-pitfalls-to-avoid-when-using-the-scripting-apis>span classsecno>1.11.2/span> Common pitfalls to avoid when using the scripting APIs/a>li>a href#how-to-catch-mistakes-when-writing-html:-validators-and-conformance-checkers>span classsecno>1.11.3/span> How to catch mistakes when writing HTML: validators and conformance checkers/a>/ol>li>a href#conformance-requirements-for-authors>span classsecno>1.12/span> Conformance requirements for authors/a>ol>li>a href#presentational-markup>span classsecno>1.12.1/span> Presentational markup/a>li>a href#syntax-errors>span classsecno>1.12.2/span> Syntax errors/a>li>a href#restrictions-on-content-models-and-on-attribute-values>span classsecno>1.12.3/span> Restrictions on content models and on attribute values/a>/ol>li>a href#suggested-reading>span classsecno>1.13/span> Suggested reading/a>/ol>li idtoc-infrastructure>a href#infrastructure>span classsecno>2/span> Common infrastructure/a>ol>li>a href#terminology>span classsecno>2.1/span> Terminology/a>ol>li>a href#parallelism>span classsecno>2.1.1/span> Parallelism/a>li>a href#resources>span classsecno>2.1.2/span> Resources/a>li>a href#xml>span classsecno>2.1.3/span> XML compatibility/a>li>a href#dom-trees>span classsecno>2.1.4/span> DOM trees/a>li>a href#scripting-2>span classsecno>2.1.5/span> Scripting/a>li>a href#plugins>span classsecno>2.1.6/span> Plugins/a>li>a href#encoding-terminology>span classsecno>2.1.7/span> Character encodings/a>li>a href#conformance-classes>span classsecno>2.1.8/span> Conformance classes/a>li>a href#dependencies>span classsecno>2.1.9/span> Dependencies/a>li>a href#extensibility-2>span classsecno>2.1.10/span> Extensibility/a>li>a href#interactions-with-xpath-and-xslt>span classsecno>2.1.11/span> Interactions with XPath and XSLT/a>/ol>li>a href#case-sensitivity-and-string-comparison>span classsecno>2.2/span> Case-sensitivity and string comparison/a>li>a href#common-microsyntaxes>span classsecno>2.3/span> Common microsyntaxes/a>ol>li>a href#common-parser-idioms>span classsecno>2.3.1/span> Common parser idioms/a>li>a href#boolean-attributes>span classsecno>2.3.2/span> Boolean attributes/a>li>a href#keywords-and-enumerated-attributes>span classsecno>2.3.3/span> Keywords and enumerated attributes/a>li>a href#numbers>span classsecno>2.3.4/span> Numbers/a>ol>li>a href#signed-integers>span classsecno>2.3.4.1/span> Signed integers/a>li>a href#non-negative-integers>span classsecno>2.3.4.2/span> Non-negative integers/a>li>a href#floating-point-numbers>span classsecno>2.3.4.3/span> Floating-point numbers/a>li>a href#percentages-and-dimensions>span classsecno>2.3.4.4/span> Percentages and lengths/a>li>a href#non-zero-percentages-and-lengths>span classsecno>2.3.4.5/span> Non-zero percentages and lengths/a>li>a href#lists-of-floating-point-numbers>span classsecno>2.3.4.6/span> Lists of floating-point numbers/a>li>a href#lists-of-dimensions>span classsecno>2.3.4.7/span> Lists of dimensions/a>/ol>li>a href#dates-and-times>span classsecno>2.3.5/span> Dates and times/a>ol>li>a href#months>span classsecno>2.3.5.1/span> Months/a>li>a href#dates>span classsecno>2.3.5.2/span> Dates/a>li>a href#yearless-dates>span classsecno>2.3.5.3/span> Yearless dates/a>li>a href#times>span classsecno>2.3.5.4/span> Times/a>li>a href#local-dates-and-times>span classsecno>2.3.5.5/span> Local dates and times/a>li>a href#time-zones>span classsecno>2.3.5.6/span> Time zones/a>li>a href#global-dates-and-times>span classsecno>2.3.5.7/span> Global dates and times/a>li>a href#weeks>span classsecno>2.3.5.8/span> Weeks/a>li>a href#durations>span classsecno>2.3.5.9/span> Durations/a>li>a href#vaguer-moments-in-time>span classsecno>2.3.5.10/span> Vaguer moments in time/a>/ol>li>a href#colours>span classsecno>2.3.6/span> Colors/a>li>a href#space-separated-tokens>span classsecno>2.3.7/span> Space-separated tokens/a>li>a href#comma-separated-tokens>span classsecno>2.3.8/span> Comma-separated tokens/a>li>a href#syntax-references>span classsecno>2.3.9/span> References/a>li>a href#mq>span classsecno>2.3.10/span> Media queries/a>/ol>li>a href#urls>span classsecno>2.4/span> URLs/a>ol>li>a href#terminology-2>span classsecno>2.4.1/span> Terminology/a>li>a href#resolving-urls>span classsecno>2.4.2/span> Parsing URLs/a>li>a href#dynamic-changes-to-base-urls>span classsecno>2.4.3/span> Dynamic changes to base URLs/a>/ol>li>a href#fetching-resources>span classsecno>2.5/span> Fetching resources/a>ol>li>a href#terminology-3>span classsecno>2.5.1/span> Terminology/a>li>a href#content-type-sniffing>span classsecno>2.5.2/span> Determining the type of a resource/a>li>a href#extracting-character-encodings-from-meta-elements>span classsecno>2.5.3/span> Extracting character encodings from code>meta/code> elements/a>li>a href#cors-settings-attributes>span classsecno>2.5.4/span> CORS settings attributes/a>li>a href#referrer-policy-attributes>span classsecno>2.5.5/span> Referrer policy attributes/a>/ol>li>a href#common-dom-interfaces>span classsecno>2.6/span> Common DOM interfaces/a>ol>li>a href#reflecting-content-attributes-in-idl-attributes>span classsecno>2.6.1/span> Reflecting content attributes in IDL attributes/a>li>a href#collections>span classsecno>2.6.2/span> Collections/a>ol>li>a href#the-htmlallcollection-interface>span classsecno>2.6.2.1/span> The code>HTMLAllCollection/code> interface/a>ol>li>a href#HTMLAllCollection-call>span classsecno>2.6.2.1.1/span> Call ( var>thisArgument/var>, var>argumentsList/var> )/a>/ol>li>a href#the-htmlformcontrolscollection-interface>span classsecno>2.6.2.2/span> The code>HTMLFormControlsCollection/code> interface/a>li>a href#the-htmloptionscollection-interface>span classsecno>2.6.2.3/span> The code>HTMLOptionsCollection/code> interface/a>/ol>li>a href#the-domstringlist-interface>span classsecno>2.6.3/span> The code>DOMStringList/code> interface/a>li>a href#garbage-collection>span classsecno>2.6.4/span> Garbage collection/a>/ol>li>a href#safe-passing-of-structured-data>span classsecno>2.7/span> Safe passing of structured data/a>ol>li>a href#serializable-objects>span classsecno>2.7.1/span> Serializable objects/a>li>a href#transferable-objects>span classsecno>2.7.2/span> Transferable objects/a>li>a href#structuredserializeinternal>span classsecno>2.7.3/span> StructuredSerializeInternal ( var>value/var>, var>forStorage/var> , var>memory/var> )/a>li>a href#structuredserialize>span classsecno>2.7.4/span> StructuredSerialize ( var>value/var> )/a>li>a href#structuredserializeforstorage>span classsecno>2.7.5/span> StructuredSerializeForStorage ( var>value/var> )/a>li>a href#structureddeserialize>span classsecno>2.7.6/span> StructuredDeserialize ( var>serialized/var>, var>targetRealm/var> , var>memory/var> )/a>li>a href#structuredserializewithtransfer>span classsecno>2.7.7/span> StructuredSerializeWithTransfer ( var>value/var>, var>transferList/var> )/a>li>a href#structureddeserializewithtransfer>span classsecno>2.7.8/span> StructuredDeserializeWithTransfer ( var>serializeWithTransferResult/var>, var>targetRealm/var> )/a>li>a href#performing-structured-clones-from-other-specifications>span classsecno>2.7.9/span> Performing serialization and transferring from other specifications/a>/ol>/ol>li idtoc-dom>a href#dom>span classsecno>3/span> Semantics, structure, and APIs of HTML documents/a>ol>li>a href#documents>span classsecno>3.1/span> Documents/a>ol>li>a href#the-document-object>span classsecno>3.1.1/span> The code>Document/code> object/a>li>a href#resource-metadata-management>span classsecno>3.1.2/span> Resource metadata management/a>li>a href#dom-tree-accessors>span classsecno>3.1.3/span> DOM tree accessors/a>/ol>li>a href#elements>span classsecno>3.2/span> Elements/a>ol>li>a href#semantics-2>span classsecno>3.2.1/span> Semantics/a>li>a href#elements-in-the-dom>span classsecno>3.2.2/span> Elements in the DOM/a>li>a href#html-element-constructors>span classsecno>3.2.3/span> HTML element constructors/a>li>a href#element-definitions>span classsecno>3.2.4/span> Element definitions/a>ol>li>a href#attributes>span classsecno>3.2.4.1/span> Attributes/a>/ol>li>a href#content-models>span classsecno>3.2.5/span> Content models/a>ol>li>a href#the-nothing-content-model>span classsecno>3.2.5.1/span> The nothing content model/a>li>a href#kinds-of-content>span classsecno>3.2.5.2/span> Kinds of content/a>ol>li>a href#metadata-content>span classsecno>3.2.5.2.1/span> Metadata content/a>li>a href#flow-content>span classsecno>3.2.5.2.2/span> Flow content/a>li>a href#sectioning-content>span classsecno>3.2.5.2.3/span> Sectioning content/a>li>a href#heading-content>span classsecno>3.2.5.2.4/span> Heading content/a>li>a href#phrasing-content>span classsecno>3.2.5.2.5/span> Phrasing content/a>li>a href#embedded-content-2>span classsecno>3.2.5.2.6/span> Embedded content/a>li>a href#interactive-content>span classsecno>3.2.5.2.7/span> Interactive content/a>li>a href#palpable-content>span classsecno>3.2.5.2.8/span> Palpable content/a>li>a href#script-supporting-elements>span classsecno>3.2.5.2.9/span> Script-supporting elements/a>/ol>li>a href#transparent-content-models>span classsecno>3.2.5.3/span> Transparent content models/a>li>a href#paragraphs>span classsecno>3.2.5.4/span> Paragraphs/a>/ol>li>a href#global-attributes>span classsecno>3.2.6/span> Global attributes/a>ol>li>a href#the-title-attribute>span classsecno>3.2.6.1/span> The code>title/code> attribute/a>li>a href#the-lang-and-xml:lang-attributes>span classsecno>3.2.6.2/span> The code>lang/code> and code>xml:lang/code> attributes/a>li>a href#the-translate-attribute>span classsecno>3.2.6.3/span> The code>translate/code> attribute/a>li>a href#the-dir-attribute>span classsecno>3.2.6.4/span> The code>dir/code> attribute/a>li>a href#the-style-attribute>span classsecno>3.2.6.5/span> The code>style/code> attribute/a>li>a href#embedding-custom-non-visible-data-with-the-data-*-attributes>span classsecno>3.2.6.6/span> Embedding custom non-visible data with the code>data-*/code> attributes/a>/ol>li>a href#the-innertext-idl-attribute>span classsecno>3.2.7/span> The code>innerText/code> IDL attribute/a>li>a href#requirements-relating-to-the-bidirectional-algorithm>span classsecno>3.2.8/span> Requirements relating to the bidirectional algorithm/a>ol>li>a href#authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters>span classsecno>3.2.8.1/span> Authoring conformance criteria for bidirectional-algorithm formatting characters/a>li>a href#user-agent-conformance-criteria>span classsecno>3.2.8.2/span> User agent conformance criteria/a>/ol>li>a href#wai-aria>span classsecno>3.2.9/span> Requirements related to ARIA and to platform accessibility APIs/a>/ol>/ol>li idtoc-semantics>a href#semantics>span classsecno>4/span> The elements of HTML/a>ol>li>a href#the-root-element>span classsecno>4.1/span> The document element/a>ol>li>a href#the-html-element>span classsecno>4.1.1/span> The code>html/code> element/a>/ol>li>a href#document-metadata>span classsecno>4.2/span> Document metadata/a>ol>li>a href#the-head-element>span classsecno>4.2.1/span> The code>head/code> element/a>li>a href#the-title-element>span classsecno>4.2.2/span> The code>title/code> element/a>li>a href#the-base-element>span classsecno>4.2.3/span> The code>base/code> element/a>li>a href#the-link-element>span classsecno>4.2.4/span> The code>link/code> element/a>ol>li>a href#processing-the-media-attribute>span classsecno>4.2.4.1/span> Processing the code>media/code> attribute/a>li>a href#processing-the-type-attribute>span classsecno>4.2.4.2/span> Processing the code>type/code> attribute/a>li>a href#obtaining-a-resource-from-a-link-element>span classsecno>4.2.4.3/span> Obtaining a resource from a code>link/code> element/a>li>a href#processing-link-headers>span classsecno>4.2.4.4/span> Processing `code>Link/code>` headers/a>li>a href#providing-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element>span classsecno>4.2.4.5/span> Providing users with a means to follow hyperlinks created using the code>link/code> element/a>/ol>li>a href#the-meta-element>span classsecno>4.2.5/span> The code>meta/code> element/a>ol>li>a href#standard-metadata-names>span classsecno>4.2.5.1/span> Standard metadata names/a>li>a href#other-metadata-names>span classsecno>4.2.5.2/span> Other metadata names/a>li>a href#pragma-directives>span classsecno>4.2.5.3/span> Pragma directives/a>li>a href#other-pragma-directives>span classsecno>4.2.5.4/span> Other pragma directives/a>li>a href#charset>span classsecno>4.2.5.5/span> Specifying the documents character encoding/a>/ol>li>a href#the-style-element>span classsecno>4.2.6/span> The code>style/code> element/a>li>a href#interactions-of-styling-and-scripting>span classsecno>4.2.7/span> Interactions of styling and scripting/a>/ol>li>a href#sections>span classsecno>4.3/span> Sections/a>ol>li>a href#the-body-element>span classsecno>4.3.1/span> The code>body/code> element/a>li>a href#the-article-element>span classsecno>4.3.2/span> The code>article/code> element/a>li>a href#the-section-element>span classsecno>4.3.3/span> The code>section/code> element/a>li>a href#the-nav-element>span classsecno>4.3.4/span> The code>nav/code> element/a>li>a href#the-aside-element>span classsecno>4.3.5/span> The code>aside/code> element/a>li>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>span classsecno>4.3.6/span> The code>h1/code>, code>h2/code>, code>h3/code>, code>h4/code>, code>h5/code>, and code>h6/code> elements/a>li>a href#the-hgroup-element>span classsecno>4.3.7/span> The code>hgroup/code> element/a>li>a href#the-header-element>span classsecno>4.3.8/span> The code>header/code> element/a>li>a href#the-footer-element>span classsecno>4.3.9/span> The code>footer/code> element/a>li>a href#the-address-element>span classsecno>4.3.10/span> The code>address/code> element/a>li>a href#headings-and-sections>span classsecno>4.3.11/span> Headings and sections/a>ol>li>a href#outlines>span classsecno>4.3.11.1/span> Creating an outline/a>li>a href#sample-outlines>span classsecno>4.3.11.2/span> Sample outlines/a>li>a href#exposing-outlines-to-users>span classsecno>4.3.11.3/span> Exposing outlines to users/a>/ol>li>a href#usage-summary-2>span classsecno>4.3.12/span> Usage summary/a>ol>li>a href#article-or-section>span classsecno>4.3.12.1/span> Article or section?/a>/ol>/ol>li>a href#grouping-content>span classsecno>4.4/span> Grouping content/a>ol>li>a href#the-p-element>span classsecno>4.4.1/span> The code>p/code> element/a>li>a href#the-hr-element>span classsecno>4.4.2/span> The code>hr/code> element/a>li>a href#the-pre-element>span classsecno>4.4.3/span> The code>pre/code> element/a>li>a href#the-blockquote-element>span classsecno>4.4.4/span> The code>blockquote/code> element/a>li>a href#the-ol-element>span classsecno>4.4.5/span> The code>ol/code> element/a>li>a href#the-ul-element>span classsecno>4.4.6/span> The code>ul/code> element/a>li>a href#the-menu-element>span classsecno>4.4.7/span> The code>menu/code> element/a>li>a href#the-li-element>span classsecno>4.4.8/span> The code>li/code> element/a>li>a href#the-dl-element>span classsecno>4.4.9/span> The code>dl/code> element/a>li>a href#the-dt-element>span classsecno>4.4.10/span> The code>dt/code> element/a>li>a href#the-dd-element>span classsecno>4.4.11/span> The code>dd/code> element/a>li>a href#the-figure-element>span classsecno>4.4.12/span> The code>figure/code> element/a>li>a href#the-figcaption-element>span classsecno>4.4.13/span> The code>figcaption/code> element/a>li>a href#the-main-element>span classsecno>4.4.14/span> The code>main/code> element/a>li>a href#the-div-element>span classsecno>4.4.15/span> The code>div/code> element/a>/ol>li>a href#text-level-semantics>span classsecno>4.5/span> Text-level semantics/a>ol>li>a href#the-a-element>span classsecno>4.5.1/span> The code>a/code> element/a>li>a href#the-em-element>span classsecno>4.5.2/span> The code>em/code> element/a>li>a href#the-strong-element>span classsecno>4.5.3/span> The code>strong/code> element/a>li>a href#the-small-element>span classsecno>4.5.4/span> The code>small/code> element/a>li>a href#the-s-element>span classsecno>4.5.5/span> The code>s/code> element/a>li>a href#the-cite-element>span classsecno>4.5.6/span> The code>cite/code> element/a>li>a href#the-q-element>span classsecno>4.5.7/span> The code>q/code> element/a>li>a href#the-dfn-element>span classsecno>4.5.8/span> The code>dfn/code> element/a>li>a href#the-abbr-element>span classsecno>4.5.9/span> The code>abbr/code> element/a>li>a href#the-ruby-element>span classsecno>4.5.10/span> The code>ruby/code> element/a>li>a href#the-rt-element>span classsecno>4.5.11/span> The code>rt/code> element/a>li>a href#the-rp-element>span classsecno>4.5.12/span> The code>rp/code> element/a>li>a href#the-data-element>span classsecno>4.5.13/span> The code>data/code> element/a>li>a href#the-time-element>span classsecno>4.5.14/span> The code>time/code> element/a>li>a href#the-code-element>span classsecno>4.5.15/span> The code>code/code> element/a>li>a href#the-var-element>span classsecno>4.5.16/span> The code>var/code> element/a>li>a href#the-samp-element>span classsecno>4.5.17/span> The code>samp/code> element/a>li>a href#the-kbd-element>span classsecno>4.5.18/span> The code>kbd/code> element/a>li>a href#the-sub-and-sup-elements>span classsecno>4.5.19/span> The code>sub/code> and code>sup/code> elements/a>li>a href#the-i-element>span classsecno>4.5.20/span> The code>i/code> element/a>li>a href#the-b-element>span classsecno>4.5.21/span> The code>b/code> element/a>li>a href#the-u-element>span classsecno>4.5.22/span> The code>u/code> element/a>li>a href#the-mark-element>span classsecno>4.5.23/span> The code>mark/code> element/a>li>a href#the-bdi-element>span classsecno>4.5.24/span> The code>bdi/code> element/a>li>a href#the-bdo-element>span classsecno>4.5.25/span> The code>bdo/code> element/a>li>a href#the-span-element>span classsecno>4.5.26/span> The code>span/code> element/a>li>a href#the-br-element>span classsecno>4.5.27/span> The code>br/code> element/a>li>a href#the-wbr-element>span classsecno>4.5.28/span> The code>wbr/code> element/a>li>a href#usage-summary>span classsecno>4.5.29/span> Usage summary/a>/ol>li>a href#links>span classsecno>4.6/span> Links/a>ol>li>a href#introduction-2>span classsecno>4.6.1/span> Introduction/a>li>a href#links-created-by-a-and-area-elements>span classsecno>4.6.2/span> Links created by code>a/code> and code>area/code> elements/a>li>a href#api-for-a-and-area-elements>span classsecno>4.6.3/span> API for code>a/code> and code>area/code> elements/a>li>a href#following-hyperlinks>span classsecno>4.6.4/span> Following hyperlinks/a>li>a href#downloading-resources>span classsecno>4.6.5/span> Downloading resources/a>ol>li>a href#hyperlink-auditing>span classsecno>4.6.5.1/span> Hyperlink auditing/a>/ol>li>a href#linkTypes>span classsecno>4.6.6/span> Link types/a>ol>li>a href#rel-alternate>span classsecno>4.6.6.1/span> Link type code>alternate/code>/a>li>a href#link-type-author>span classsecno>4.6.6.2/span> Link type code>author/code>/a>li>a href#link-type-bookmark>span classsecno>4.6.6.3/span> Link type code>bookmark/code>/a>li>a href#link-type-canonical>span classsecno>4.6.6.4/span> Link type code>canonical/code>/a>li>a href#link-type-dns-prefetch>span classsecno>4.6.6.5/span> Link type code>dns-prefetch/code>/a>li>a href#link-type-external>span classsecno>4.6.6.6/span> Link type code>external/code>/a>li>a href#link-type-help>span classsecno>4.6.6.7/span> Link type code>help/code>/a>li>a href#rel-icon>span classsecno>4.6.6.8/span> Link type code>icon/code>/a>li>a href#link-type-license>span classsecno>4.6.6.9/span> Link type code>license/code>/a>li>a href#link-type-modulepreload>span classsecno>4.6.6.10/span> Link type code>modulepreload/code>/a>li>a href#link-type-nofollow>span classsecno>4.6.6.11/span> Link type code>nofollow/code>/a>li>a href#link-type-noopener>span classsecno>4.6.6.12/span> Link type code>noopener/code>/a>li>a href#link-type-noreferrer>span classsecno>4.6.6.13/span> Link type code>noreferrer/code>/a>li>a href#link-type-pingback>span classsecno>4.6.6.14/span> Link type code>pingback/code>/a>li>a href#link-type-preconnect>span classsecno>4.6.6.15/span> Link type code>preconnect/code>/a>li>a href#link-type-prefetch>span classsecno>4.6.6.16/span> Link type code>prefetch/code>/a>li>a href#link-type-preload>span classsecno>4.6.6.17/span> Link type code>preload/code>/a>li>a href#link-type-prerender>span classsecno>4.6.6.18/span> Link type code>prerender/code>/a>li>a href#link-type-search>span classsecno>4.6.6.19/span> Link type code>search/code>/a>li>a href#link-type-serviceworker>span classsecno>4.6.6.20/span> Link type code>serviceworker/code>/a>li>a href#link-type-stylesheet>span classsecno>4.6.6.21/span> Link type code>stylesheet/code>/a>li>a href#link-type-tag>span classsecno>4.6.6.22/span> Link type code>tag/code>/a>li>a href#sequential-link-types>span classsecno>4.6.6.23/span> Sequential link types/a>ol>li>a href#link-type-next>span classsecno>4.6.6.23.1/span> Link type code>next/code>/a>li>a href#link-type-prev>span classsecno>4.6.6.23.2/span> Link type code>prev/code>/a>/ol>li>a href#other-link-types>span classsecno>4.6.6.24/span> Other link types/a>/ol>/ol>li>a href#edits>span classsecno>4.7/span> Edits/a>ol>li>a href#the-ins-element>span classsecno>4.7.1/span> The code>ins/code> element/a>li>a href#the-del-element>span classsecno>4.7.2/span> The code>del/code> element/a>li>a href#attributes-common-to-ins-and-del-elements>span classsecno>4.7.3/span> Attributes common to code>ins/code> and code>del/code> elements/a>li>a href#edits-and-paragraphs>span classsecno>4.7.4/span> Edits and paragraphs/a>li>a href#edits-and-lists>span classsecno>4.7.5/span> Edits and lists/a>li>a href#edits-and-tables>span classsecno>4.7.6/span> Edits and tables/a>/ol>li>a href#embedded-content>span classsecno>4.8/span> Embedded content/a>ol>li>a href#the-picture-element>span classsecno>4.8.1/span> The code>picture/code> element/a>li>a href#the-source-element>span classsecno>4.8.2/span> The code>source/code> element/a>li>a href#the-img-element>span classsecno>4.8.3/span> The code>img/code> element/a>li>a href#images>span classsecno>4.8.4/span> Images/a>ol>li>a href#introduction-3>span classsecno>4.8.4.1/span> Introduction/a>ol>li>a href#adaptive-images>span classsecno>4.8.4.1.1/span> Adaptive images/a>/ol>li>a href#attributes-common-to-source-and-img-elements>span classsecno>4.8.4.2/span> Attributes common to code>source/code> and code>img/code> elements/a>ol>li>a href#srcset-attributes>span classsecno>4.8.4.2.1/span> Srcset attributes/a>li>a href#sizes-attributes>span classsecno>4.8.4.2.2/span> Sizes attributes/a>/ol>li>a href#images-processing-model>span classsecno>4.8.4.3/span> Processing model/a>ol>li>a href#when-to-obtain-images>span classsecno>4.8.4.3.1/span> When to obtain images/a>li>a href#reacting-to-dom-mutations>span classsecno>4.8.4.3.2/span> Reacting to DOM mutations/a>li>a href#the-list-of-available-images>span classsecno>4.8.4.3.3/span> The list of available images/a>li>a href#updating-the-image-data>span classsecno>4.8.4.3.4/span> Updating the image data/a>li>a href#selecting-an-image-source>span classsecno>4.8.4.3.5/span> Selecting an image source/a>li>a href#updating-the-source-set>span classsecno>4.8.4.3.6/span> Updating the source set/a>li>a href#parsing-a-srcset-attribute>span classsecno>4.8.4.3.7/span> Parsing a srcset attribute/a>li>a href#parsing-a-sizes-attribute>span classsecno>4.8.4.3.8/span> Parsing a sizes attribute/a>li>a href#normalizing-the-source-densities>span classsecno>4.8.4.3.9/span> Normalizing the source densities/a>li>a href#reacting-to-environment-changes>span classsecno>4.8.4.3.10/span> Reacting to environment changes/a>/ol>li>a href#alt>span classsecno>4.8.4.4/span> Requirements for providing text to act as an alternative for images/a>ol>li>a href#general-guidelines>span classsecno>4.8.4.4.1/span> General guidelines/a>li>a href#a-link-or-button-containing-nothing-but-the-image>span classsecno>4.8.4.4.2/span> 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>span classsecno>4.8.4.4.3/span> 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>span classsecno>4.8.4.4.4/span> 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>span classsecno>4.8.4.4.5/span> Text that has been rendered to a graphic for typographical effect/a>li>a href#a-graphical-representation-of-some-of-the-surrounding-text>span classsecno>4.8.4.4.6/span> A graphical representation of some of the surrounding text/a>li>a href#ancillary-images>span classsecno>4.8.4.4.7/span> Ancillary images/a>li>a href#a-purely-decorative-image-that-doesnt-add-any-information>span classsecno>4.8.4.4.8/span> A purely decorative image that doesnt add any information/a>li>a href#a-group-of-images-that-form-a-single-larger-picture-with-no-links>span classsecno>4.8.4.4.9/span> 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>span classsecno>4.8.4.4.10/span> A group of images that form a single larger picture with links/a>li>a href#a-key-part-of-the-content>span classsecno>4.8.4.4.11/span> A key part of the content/a>li>a href#an-image-not-intended-for-the-user>span classsecno>4.8.4.4.12/span> 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>span classsecno>4.8.4.4.13/span> 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>span classsecno>4.8.4.4.14/span> Guidance for markup generators/a>li>a href#guidance-for-conformance-checkers>span classsecno>4.8.4.4.15/span> Guidance for conformance checkers/a>/ol>/ol>li>a href#the-iframe-element>span classsecno>4.8.5/span> The code>iframe/code> element/a>li>a href#the-embed-element>span classsecno>4.8.6/span> The code>embed/code> element/a>li>a href#the-object-element>span classsecno>4.8.7/span> The code>object/code> element/a>li>a href#the-param-element>span classsecno>4.8.8/span> The code>param/code> element/a>li>a href#the-video-element>span classsecno>4.8.9/span> The code>video/code> element/a>li>a href#the-audio-element>span classsecno>4.8.10/span> The code>audio/code> element/a>li>a href#the-track-element>span classsecno>4.8.11/span> The code>track/code> element/a>li>a href#media-elements>span classsecno>4.8.12/span> Media elements/a>ol>li>a href#error-codes>span classsecno>4.8.12.1/span> Error codes/a>li>a href#location-of-the-media-resource>span classsecno>4.8.12.2/span> Location of the media resource/a>li>a href#mime-types>span classsecno>4.8.12.3/span> MIME types/a>li>a href#network-states>span classsecno>4.8.12.4/span> Network states/a>li>a href#loading-the-media-resource>span classsecno>4.8.12.5/span> Loading the media resource/a>li>a href#offsets-into-the-media-resource>span classsecno>4.8.12.6/span> Offsets into the media resource/a>li>a href#ready-states>span classsecno>4.8.12.7/span> Ready states/a>li>a href#playing-the-media-resource>span classsecno>4.8.12.8/span> Playing the media resource/a>li>a href#seeking>span classsecno>4.8.12.9/span> Seeking/a>li>a href#media-resources-with-multiple-media-tracks>span classsecno>4.8.12.10/span> Media resources with multiple media tracks/a>ol>li>a href#audiotracklist-and-videotracklist-objects>span classsecno>4.8.12.10.1/span> code>AudioTrackList/code> and code>VideoTrackList/code> objects/a>li>a href#selecting-specific-audio-and-video-tracks-declaratively>span classsecno>4.8.12.10.2/span> Selecting specific audio and video tracks declaratively/a>/ol>li>a href#timed-text-tracks>span classsecno>4.8.12.11/span> Timed text tracks/a>ol>li>a href#text-track-model>span classsecno>4.8.12.11.1/span> Text track model/a>li>a href#sourcing-in-band-text-tracks>span classsecno>4.8.12.11.2/span> Sourcing in-band text tracks/a>li>a href#sourcing-out-of-band-text-tracks>span classsecno>4.8.12.11.3/span> Sourcing out-of-band text tracks/a>li>a href#guidelines-for-exposing-cues-in-various-formats-as-text-track-cues>span classsecno>4.8.12.11.4/span> Guidelines for exposing cues in various formats as text track cues/a>li>a href#text-track-api>span classsecno>4.8.12.11.5/span> Text track API/a>li>a href#cue-events>span classsecno>4.8.12.11.6/span> Event handlers for objects of the text track APIs/a>li>a href#best-practices-for-metadata-text-tracks>span classsecno>4.8.12.11.7/span> Best practices for metadata text tracks/a>/ol>li>a href#identifying-a-track-kind-through-a-url>span classsecno>4.8.12.12/span> Identifying a track kind through a URL/a>li>a href#user-interface>span classsecno>4.8.12.13/span> User interface/a>li>a href#time-ranges>span classsecno>4.8.12.14/span> Time ranges/a>li>a href#the-trackevent-interface>span classsecno>4.8.12.15/span> The code>TrackEvent/code> interface/a>li>a href#mediaevents>span classsecno>4.8.12.16/span> Event summary/a>li>a href#security-and-privacy-considerations>span classsecno>4.8.12.17/span> Security and privacy considerations/a>li>a href#best-practices-for-authors-using-media-elements>span classsecno>4.8.12.18/span> Best practices for authors using media elements/a>li>a href#best-practices-for-implementors-of-media-elements>span classsecno>4.8.12.19/span> Best practices for implementors of media elements/a>/ol>li>a href#the-map-element>span classsecno>4.8.13/span> The code>map/code> element/a>li>a href#the-area-element>span classsecno>4.8.14/span> The code>area/code> element/a>li>a href#image-maps>span classsecno>4.8.15/span> Image maps/a>ol>li>a href#authoring>span classsecno>4.8.15.1/span> Authoring/a>li>a href#image-map-processing-model>span classsecno>4.8.15.2/span> Processing model/a>/ol>li>a href#mathml>span classsecno>4.8.16/span> MathML/a>li>a href#svg-0>span classsecno>4.8.17/span> SVG/a>li>a href#dimension-attributes>span classsecno>4.8.18/span> Dimension attributes/a>/ol>li>a href#tables>span classsecno>4.9/span> Tabular data/a>ol>li>a href#the-table-element>span classsecno>4.9.1/span> The code>table/code> element/a>ol>li>a href#table-descriptions-techniques>span classsecno>4.9.1.1/span> Techniques for describing tables/a>li>a href#table-layout-techniques>span classsecno>4.9.1.2/span> Techniques for table design/a>/ol>li>a href#the-caption-element>span classsecno>4.9.2/span> The code>caption/code> element/a>li>a href#the-colgroup-element>span classsecno>4.9.3/span> The code>colgroup/code> element/a>li>a href#the-col-element>span classsecno>4.9.4/span> The code>col/code> element/a>li>a href#the-tbody-element>span classsecno>4.9.5/span> The code>tbody/code> element/a>li>a href#the-thead-element>span classsecno>4.9.6/span> The code>thead/code> element/a>li>a href#the-tfoot-element>span classsecno>4.9.7/span> The code>tfoot/code> element/a>li>a href#the-tr-element>span classsecno>4.9.8/span> The code>tr/code> element/a>li>a href#the-td-element>span classsecno>4.9.9/span> The code>td/code> element/a>li>a href#the-th-element>span classsecno>4.9.10/span> The code>th/code> element/a>li>a href#attributes-common-to-td-and-th-elements>span classsecno>4.9.11/span> Attributes common to code>td/code> and code>th/code> elements/a>li>a href#table-processing-model>span classsecno>4.9.12/span> Processing model/a>ol>li>a href#forming-a-table>span classsecno>4.9.12.1/span> Forming a table/a>li>a href#header-and-data-cell-semantics>span classsecno>4.9.12.2/span> Forming relationships between data cells and header cells/a>/ol>li>a href#table-examples>span classsecno>4.9.13/span> Examples/a>/ol>li>a href#forms>span classsecno>4.10/span> Forms/a>ol>li>a href#introduction-4>span classsecno>4.10.1/span> Introduction/a>ol>li>a href#writing-a-forms-user-interface>span classsecno>4.10.1.1/span> Writing a forms user interface/a>li>a href#implementing-the-server-side-processing-for-a-form>span classsecno>4.10.1.2/span> Implementing the server-side processing for a form/a>li>a href#configuring-a-form-to-communicate-with-a-server>span classsecno>4.10.1.3/span> Configuring a form to communicate with a server/a>li>a href#client-side-form-validation>span classsecno>4.10.1.4/span> Client-side form validation/a>li>a href#enabling-client-side-automatic-filling-of-form-controls>span classsecno>4.10.1.5/span> Enabling client-side automatic filling of form controls/a>li>a href#improving-the-user-experience-on-mobile-devices>span classsecno>4.10.1.6/span> 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>span classsecno>4.10.1.7/span> The difference between the field type, the autofill field name, and the input modality/a>li>a href#input-author-notes>span classsecno>4.10.1.8/span> Date, time, and number formats/a>/ol>li>a href#categories>span classsecno>4.10.2/span> Categories/a>li>a href#the-form-element>span classsecno>4.10.3/span> The code>form/code> element/a>li>a href#the-label-element>span classsecno>4.10.4/span> The code>label/code> element/a>li>a href#the-input-element>span classsecno>4.10.5/span> The code>input/code> element/a>ol>li>a href#states-of-the-type-attribute>span classsecno>4.10.5.1/span> States of the code>type/code> attribute/a>ol>li>a href#hidden-state-(typehidden)>span classsecno>4.10.5.1.1/span> Hidden state (code>typehidden/code>)/a>li>a href#text-(typetext)-state-and-search-state-(typesearch)>span classsecno>4.10.5.1.2/span> Text (code>typetext/code>) state and Search state (code>typesearch/code>)/a>li>a href#telephone-state-(typetel)>span classsecno>4.10.5.1.3/span> Telephone state (code>typetel/code>)/a>li>a href#url-state-(typeurl)>span classsecno>4.10.5.1.4/span> URL state (code>typeurl/code>)/a>li>a href#e-mail-state-(typeemail)>span classsecno>4.10.5.1.5/span> E-mail state (code>typeemail/code>)/a>li>a href#password-state-(typepassword)>span classsecno>4.10.5.1.6/span> Password state (code>typepassword/code>)/a>li>a href#date-state-(typedate)>span classsecno>4.10.5.1.7/span> Date state (code>typedate/code>)/a>li>a href#month-state-(typemonth)>span classsecno>4.10.5.1.8/span> Month state (code>typemonth/code>)/a>li>a href#week-state-(typeweek)>span classsecno>4.10.5.1.9/span> Week state (code>typeweek/code>)/a>li>a href#time-state-(typetime)>span classsecno>4.10.5.1.10/span> Time state (code>typetime/code>)/a>li>a href#local-date-and-time-state-(typedatetime-local)>span classsecno>4.10.5.1.11/span> Local Date and Time state (code>typedatetime-local/code>)/a>li>a href#number-state-(typenumber)>span classsecno>4.10.5.1.12/span> Number state (code>typenumber/code>)/a>li>a href#range-state-(typerange)>span classsecno>4.10.5.1.13/span> Range state (code>typerange/code>)/a>li>a href#color-state-(typecolor)>span classsecno>4.10.5.1.14/span> Color state (code>typecolor/code>)/a>li>a href#checkbox-state-(typecheckbox)>span classsecno>4.10.5.1.15/span> Checkbox state (code>typecheckbox/code>)/a>li>a href#radio-button-state-(typeradio)>span classsecno>4.10.5.1.16/span> Radio Button state (code>typeradio/code>)/a>li>a href#file-upload-state-(typefile)>span classsecno>4.10.5.1.17/span> File Upload state (code>typefile/code>)/a>li>a href#submit-button-state-(typesubmit)>span classsecno>4.10.5.1.18/span> Submit Button state (code>typesubmit/code>)/a>li>a href#image-button-state-(typeimage)>span classsecno>4.10.5.1.19/span> Image Button state (code>typeimage/code>)/a>li>a href#reset-button-state-(typereset)>span classsecno>4.10.5.1.20/span> Reset Button state (code>typereset/code>)/a>li>a href#button-state-(typebutton)>span classsecno>4.10.5.1.21/span> Button state (code>typebutton/code>)/a>/ol>li>a href#input-impl-notes>span classsecno>4.10.5.2/span> Implementation notes regarding localization of form controls/a>li>a href#common-input-element-attributes>span classsecno>4.10.5.3/span> Common code>input/code> element attributes/a>ol>li>a href#the-maxlength-and-minlength-attributes>span classsecno>4.10.5.3.1/span> The code>maxlength/code> and code>minlength/code> attributes/a>li>a href#the-size-attribute>span classsecno>4.10.5.3.2/span> The code>size/code> attribute/a>li>a href#the-readonly-attribute>span classsecno>4.10.5.3.3/span> The code>readonly/code> attribute/a>li>a href#the-required-attribute>span classsecno>4.10.5.3.4/span> The code>required/code> attribute/a>li>a href#the-multiple-attribute>span classsecno>4.10.5.3.5/span> The code>multiple/code> attribute/a>li>a href#the-pattern-attribute>span classsecno>4.10.5.3.6/span> The code>pattern/code> attribute/a>li>a href#the-min-and-max-attributes>span classsecno>4.10.5.3.7/span> The code>min/code> and code>max/code> attributes/a>li>a href#the-step-attribute>span classsecno>4.10.5.3.8/span> The code>step/code> attribute/a>li>a href#the-list-attribute>span classsecno>4.10.5.3.9/span> The code>list/code> attribute/a>li>a href#the-placeholder-attribute>span classsecno>4.10.5.3.10/span> The code>placeholder/code> attribute/a>/ol>li>a href#common-input-element-apis>span classsecno>4.10.5.4/span> Common code>input/code> element APIs/a>li>a href#common-input-element-events>span classsecno>4.10.5.5/span> Common event behaviors/a>/ol>li>a href#the-button-element>span classsecno>4.10.6/span> The code>button/code> element/a>li>a href#the-select-element>span classsecno>4.10.7/span> The code>select/code> element/a>li>a href#the-datalist-element>span classsecno>4.10.8/span> The code>datalist/code> element/a>li>a href#the-optgroup-element>span classsecno>4.10.9/span> The code>optgroup/code> element/a>li>a href#the-option-element>span classsecno>4.10.10/span> The code>option/code> element/a>li>a href#the-textarea-element>span classsecno>4.10.11/span> The code>textarea/code> element/a>li>a href#the-output-element>span classsecno>4.10.12/span> The code>output/code> element/a>li>a href#the-progress-element>span classsecno>4.10.13/span> The code>progress/code> element/a>li>a href#the-meter-element>span classsecno>4.10.14/span> The code>meter/code> element/a>li>a href#the-fieldset-element>span classsecno>4.10.15/span> The code>fieldset/code> element/a>li>a href#the-legend-element>span classsecno>4.10.16/span> The code>legend/code> element/a>li>a href#form-control-infrastructure>span classsecno>4.10.17/span> Form control infrastructure/a>ol>li>a href#a-form-controls-value>span classsecno>4.10.17.1/span> A form controls value/a>li>a href#mutability>span classsecno>4.10.17.2/span> Mutability/a>li>a href#association-of-controls-and-forms>span classsecno>4.10.17.3/span> Association of controls and forms/a>/ol>li>a href#attributes-common-to-form-controls>span classsecno>4.10.18/span> Attributes common to form controls/a>ol>li>a href#naming-form-controls:-the-name-attribute>span classsecno>4.10.18.1/span> Naming form controls: the code>name/code> attribute/a>li>a href#submitting-element-directionality:-the-dirname-attribute>span classsecno>4.10.18.2/span> Submitting element directionality: the code>dirname/code> attribute/a>li>a href#limiting-user-input-length:-the-maxlength-attribute>span classsecno>4.10.18.3/span> Limiting user input length: the code>maxlength/code> attribute/a>li>a href#setting-minimum-input-length-requirements:-the-minlength-attribute>span classsecno>4.10.18.4/span> Setting minimum input length requirements: the code>minlength/code> attribute/a>li>a href#enabling-and-disabling-form-controls:-the-disabled-attribute>span classsecno>4.10.18.5/span> Enabling and disabling form controls: the code>disabled/code> attribute/a>li>a href#form-submission>span classsecno>4.10.18.6/span> Form submission/a>ol>li>a href#autofocusing-a-form-control:-the-autofocus-attribute>span classsecno>4.10.18.6.1/span> Autofocusing a form control: the code>autofocus/code> attribute/a>/ol>li>a href#input-modalities:-the-inputmode-attribute>span classsecno>4.10.18.7/span> Input modalities: the code>inputmode/code> attribute/a>li>a href#autofill>span classsecno>4.10.18.8/span> Autofill/a>ol>li>a href#autofilling-form-controls:-the-autocomplete-attribute>span classsecno>4.10.18.8.1/span> Autofilling form controls: the code>autocomplete/code> attribute/a>li>a href#autofill-processing-model>span classsecno>4.10.18.8.2/span> Processing model/a>/ol>/ol>li>a href#textFieldSelection>span classsecno>4.10.19/span> APIs for the text control selections/a>li>a href#constraints>span classsecno>4.10.20/span> Constraints/a>ol>li>a href#definitions>span classsecno>4.10.20.1/span> Definitions/a>li>a href#constraint-validation>span classsecno>4.10.20.2/span> Constraint validation/a>li>a href#the-constraint-validation-api>span classsecno>4.10.20.3/span> The constraint validation API/a>li>a href#security-forms>span classsecno>4.10.20.4/span> Security/a>/ol>li>a href#form-submission-2>span classsecno>4.10.21/span> Form submission/a>ol>li>a href#introduction-5>span classsecno>4.10.21.1/span> Introduction/a>li>a href#implicit-submission>span classsecno>4.10.21.2/span> Implicit submission/a>li>a href#form-submission-algorithm>span classsecno>4.10.21.3/span> Form submission algorithm/a>li>a href#constructing-form-data-set>span classsecno>4.10.21.4/span> Constructing the form data set/a>li>a href#selecting-a-form-submission-encoding>span classsecno>4.10.21.5/span> Selecting a form submission encoding/a>li>a href#url-encoded-form-data>span classsecno>4.10.21.6/span> URL-encoded form data/a>li>a href#multipart-form-data>span classsecno>4.10.21.7/span> Multipart form data/a>li>a href#plain-text-form-data>span classsecno>4.10.21.8/span> Plain text form data/a>/ol>li>a href#resetting-a-form>span classsecno>4.10.22/span> Resetting a form/a>/ol>li>a href#interactive-elements>span classsecno>4.11/span> Interactive elements/a>ol>li>a href#the-details-element>span classsecno>4.11.1/span> The code>details/code> element/a>li>a href#the-summary-element>span classsecno>4.11.2/span> The code>summary/code> element/a>li>a href#commands>span classsecno>4.11.3/span> Commands/a>ol>li>a href#facets-2>span classsecno>4.11.3.1/span> Facets/a>li>a href#using-the-a-element-to-define-a-command>span classsecno>4.11.3.2/span> Using the code>a/code> element to define a command/a>li>a href#using-the-button-element-to-define-a-command>span classsecno>4.11.3.3/span> Using the code>button/code> element to define a command/a>li>a href#using-the-input-element-to-define-a-command>span classsecno>4.11.3.4/span> Using the code>input/code> element to define a command/a>li>a href#using-the-option-element-to-define-a-command>span classsecno>4.11.3.5/span> Using the code>option/code> element to define a command/a>li>a href#using-the-accesskey-attribute-on-a-legend-element-to-define-a-command>span classsecno>4.11.3.6/span> Using the code>accesskey/code> attribute on a code>legend/code> element to define a command/a>li>a href#using-the-accesskey-attribute-to-define-a-command-on-other-elements>span classsecno>4.11.3.7/span> Using the code>accesskey/code> attribute to define a command on other elements/a>/ol>li>a href#the-dialog-element>span classsecno>4.11.4/span> The code>dialog/code> element/a>/ol>li>a href#scripting-3>span classsecno>4.12/span> Scripting/a>ol>li>a href#the-script-element>span classsecno>4.12.1/span> The code>script/code> element/a>ol>li>a href#script-processing-model>span classsecno>4.12.1.1/span> Processing model/a>li>a href#scriptingLanguages>span classsecno>4.12.1.2/span> Scripting languages/a>li>a href#restrictions-for-contents-of-script-elements>span classsecno>4.12.1.3/span> Restrictions for contents of code>script/code> elements/a>li>a href#inline-documentation-for-external-scripts>span classsecno>4.12.1.4/span> Inline documentation for external scripts/a>li>a href#scriptTagXSLT>span classsecno>4.12.1.5/span> Interaction of code>script/code> elements and XSLT/a>/ol>li>a href#the-noscript-element>span classsecno>4.12.2/span> The code>noscript/code> element/a>li>a href#the-template-element>span classsecno>4.12.3/span> The code>template/code> element/a>ol>li>a href#template-XSLT-XPath>span classsecno>4.12.3.1/span> Interaction of code>template/code> elements with XSLT and XPath/a>/ol>li>a href#the-slot-element>span classsecno>4.12.4/span> The code>slot/code> element/a>li>a href#the-canvas-element>span classsecno>4.12.5/span> The code>canvas/code> element/a>ol>li>a href#2dcontext>span classsecno>4.12.5.1/span> The 2D rendering context/a>ol>li>a href#implementation-notes>span classsecno>4.12.5.1.1/span> Implementation notes/a>li>a href#the-canvas-state>span classsecno>4.12.5.1.2/span> The canvas state/a>li>a href#line-styles>span classsecno>4.12.5.1.3/span> Line styles/a>li>a href#text-styles>span classsecno>4.12.5.1.4/span> Text styles/a>li>a href#building-paths>span classsecno>4.12.5.1.5/span> Building paths/a>li>a href#path2d-objects>span classsecno>4.12.5.1.6/span> code>Path2D/code> objects/a>li>a href#transformations>span classsecno>4.12.5.1.7/span> Transformations/a>li>a href#image-sources-for-2d-rendering-contexts>span classsecno>4.12.5.1.8/span> Image sources for 2D rendering contexts/a>li>a href#fill-and-stroke-styles>span classsecno>4.12.5.1.9/span> Fill and stroke styles/a>li>a href#drawing-rectangles-to-the-bitmap>span classsecno>4.12.5.1.10/span> Drawing rectangles to the bitmap/a>li>a href#drawing-text-to-the-bitmap>span classsecno>4.12.5.1.11/span> Drawing text to the bitmap/a>li>a href#drawing-paths-to-the-canvas>span classsecno>4.12.5.1.12/span> Drawing paths to the canvas/a>li>a href#drawing-focus-rings-and-scrolling-paths-into-view>span classsecno>4.12.5.1.13/span> Drawing focus rings and scrolling paths into view/a>li>a href#drawing-images>span classsecno>4.12.5.1.14/span> Drawing images/a>li>a href#pixel-manipulation>span classsecno>4.12.5.1.15/span> Pixel manipulation/a>li>a href#compositing>span classsecno>4.12.5.1.16/span> Compositing/a>li>a href#image-smoothing>span classsecno>4.12.5.1.17/span> Image smoothing/a>li>a href#shadows>span classsecno>4.12.5.1.18/span> Shadows/a>li>a href#filters>span classsecno>4.12.5.1.19/span> Filters/a>li>a href#working-with-externally-defined-svg-filters>span classsecno>4.12.5.1.20/span> Working with externally-defined SVG filters/a>li>a href#drawing-model>span classsecno>4.12.5.1.21/span> Drawing model/a>li>a href#best-practices>span classsecno>4.12.5.1.22/span> Best practices/a>li>a href#examples>span classsecno>4.12.5.1.23/span> Examples/a>/ol>li>a href#the-imagebitmap-rendering-context>span classsecno>4.12.5.2/span> The code>ImageBitmap/code> rendering context/a>ol>li>a href#introduction-6>span classsecno>4.12.5.2.1/span> Introduction/a>li>a href#the-imagebitmaprenderingcontext-interface>span classsecno>4.12.5.2.2/span> The code>ImageBitmapRenderingContext/code> interface/a>/ol>li>a href#the-offscreencanvas-interface>span classsecno>4.12.5.3/span> The code>OffscreenCanvas/code> interface/a>ol>li>a href#the-offscreen-2d-rendering-context>span classsecno>4.12.5.3.1/span> The offscreen 2D rendering context/a>/ol>li>a href#colour-spaces-and-colour-correction>span classsecno>4.12.5.4/span> Color spaces and color correction/a>li>a href#serialising-bitmaps-to-a-file>span classsecno>4.12.5.5/span> Serializing bitmaps to a file/a>li>a href#security-with-canvas-elements>span classsecno>4.12.5.6/span> Security with code>canvas/code> elements/a>/ol>/ol>li>a href#custom-elements>span classsecno>4.13/span> Custom elements/a>ol>li>a href#custom-elements-intro>span classsecno>4.13.1/span> Introduction/a>ol>li>a href#custom-elements-autonomous-example>span classsecno>4.13.1.1/span> Creating an autonomous custom element/a>li>a href#custom-elements-customized-builtin-example>span classsecno>4.13.1.2/span> Creating a customized built-in element/a>li>a href#custom-elements-autonomous-drawbacks>span classsecno>4.13.1.3/span> Drawbacks of autonomous custom elements/a>li>a href#custom-elements-upgrades-examples>span classsecno>4.13.1.4/span> Upgrading elements after their creation/a>/ol>li>a href#custom-element-conformance>span classsecno>4.13.2/span> Requirements for custom element constructors/a>li>a href#custom-elements-core-concepts>span classsecno>4.13.3/span> Core concepts/a>li>a href#custom-elements-api>span classsecno>4.13.4/span> The code>CustomElementRegistry/code> interface/a>li>a href#upgrades>span classsecno>4.13.5/span> Upgrades/a>li>a href#custom-element-reactions>span classsecno>4.13.6/span> Custom element reactions/a>/ol>li>a href#common-idioms>span classsecno>4.14/span> Common idioms without dedicated elements/a>ol>li>a href#the-main-part-of-the-content>span classsecno>4.14.1/span> The main part of the content/a>li>a href#rel-up>span classsecno>4.14.2/span> Bread crumb navigation/a>li>a href#tag-clouds>span classsecno>4.14.3/span> Tag clouds/a>li>a href#conversations>span classsecno>4.14.4/span> Conversations/a>li>a href#footnotes>span classsecno>4.14.5/span> Footnotes/a>/ol>li>a href#disabled-elements>span classsecno>4.15/span> Disabled elements/a>li>a href#selectors>span classsecno>4.16/span> Matching HTML elements using selectors and CSS/a>ol>li>a href#case-sensitivity-of-the-css-attr()-function>span classsecno>4.16.1/span> Case-sensitivity of the CSS attr() function/a>li>a href#case-sensitivity-of-selectors>span classsecno>4.16.2/span> Case-sensitivity of selectors/a>li>a href#pseudo-classes>span classsecno>4.16.3/span> Pseudo-classes/a>/ol>/ol>li idtoc-microdata>a href#microdata>span classsecno>5/span> Microdata/a>ol>li>a href#introduction-7>span classsecno>5.1/span> Introduction/a>ol>li>a href#overview>span classsecno>5.1.1/span> Overview/a>li>a href#the-basic-syntax>span classsecno>5.1.2/span> The basic syntax/a>li>a href#typed-items>span classsecno>5.1.3/span> Typed items/a>li>a href#global-identifiers-for-items>span classsecno>5.1.4/span> Global identifiers for items/a>li>a href#selecting-names-when-defining-vocabularies>span classsecno>5.1.5/span> Selecting names when defining vocabularies/a>/ol>li>a href#encoding-microdata>span classsecno>5.2/span> Encoding microdata/a>ol>li>a href#the-microdata-model>span classsecno>5.2.1/span> The microdata model/a>li>a href#items>span classsecno>5.2.2/span> Items/a>li>a href#names:-the-itemprop-attribute>span classsecno>5.2.3/span> Names: the code>itemprop/code> attribute/a>li>a href#values>span classsecno>5.2.4/span> Values/a>li>a href#associating-names-with-items>span classsecno>5.2.5/span> Associating names with items/a>li>a href#microdata-and-other-namespaces>span classsecno>5.2.6/span> Microdata and other namespaces/a>/ol>li>a href#mdvocabs>span classsecno>5.3/span> Sample microdata vocabularies/a>ol>li>a href#vcard>span classsecno>5.3.1/span> vCard/a>ol>li>a href#conversion-to-vcard>span classsecno>5.3.1.1/span> Conversion to vCard/a>li>a href#examples-2>span classsecno>5.3.1.2/span> Examples/a>/ol>li>a href#vevent>span classsecno>5.3.2/span> vEvent/a>ol>li>a href#conversion-to-icalendar>span classsecno>5.3.2.1/span> Conversion to iCalendar/a>li>a href#examples-3>span classsecno>5.3.2.2/span> Examples/a>/ol>li>a href#licensing-works>span classsecno>5.3.3/span> Licensing works/a>ol>li>a href#examples-4>span classsecno>5.3.3.1/span> Examples/a>/ol>/ol>li>a href#converting-html-to-other-formats>span classsecno>5.4/span> Converting HTML to other formats/a>ol>li>a href#json>span classsecno>5.4.1/span> JSON/a>/ol>/ol>li idtoc-editing>a href#editing>span classsecno>6/span> User interaction/a>ol>li>a href#the-hidden-attribute>span classsecno>6.1/span> The code>hidden/code> attribute/a>li>a href#inert-subtrees>span classsecno>6.2/span> Inert subtrees/a>li>a href#activation>span classsecno>6.3/span> Activation/a>li>a href#focus>span classsecno>6.4/span> Focus/a>ol>li>a href#introduction-8>span classsecno>6.4.1/span> Introduction/a>li>a href#data-model>span classsecno>6.4.2/span> Data model/a>li>a href#the-tabindex-attribute>span classsecno>6.4.3/span> The code>tabindex/code> attribute/a>li>a href#focus-processing-model>span classsecno>6.4.4/span> Processing model/a>li>a href#sequential-focus-navigation>span classsecno>6.4.5/span> Sequential focus navigation/a>li>a href#focus-management-apis>span classsecno>6.4.6/span> Focus management APIs/a>/ol>li>a href#assigning-keyboard-shortcuts>span classsecno>6.5/span> Assigning keyboard shortcuts/a>ol>li>a href#introduction-9>span classsecno>6.5.1/span> Introduction/a>li>a href#the-accesskey-attribute>span classsecno>6.5.2/span> The code>accesskey/code> attribute/a>li>a href#keyboard-shortcuts-processing-model>span classsecno>6.5.3/span> Processing model/a>/ol>li>a href#editing-2>span classsecno>6.6/span> Editing/a>ol>li>a href#contenteditable>span classsecno>6.6.1/span> Making document regions editable: The code>contenteditable/code> content attribute/a>li>a href#making-entire-documents-editable:-the-designmode-idl-attribute>span classsecno>6.6.2/span> Making entire documents editable: the code>designMode/code> IDL attribute/a>li>a href#best-practices-for-in-page-editors>span classsecno>6.6.3/span> Best practices for in-page editors/a>li>a href#editing-apis>span classsecno>6.6.4/span> Editing APIs/a>li>a href#spelling-and-grammar-checking>span classsecno>6.6.5/span> Spelling and grammar checking/a>/ol>li>a href#dnd>span classsecno>6.7/span> Drag and drop/a>ol>li>a href#event-drag>span classsecno>6.7.1/span> Introduction/a>li>a href#the-drag-data-store>span classsecno>6.7.2/span> The drag data store/a>li>a href#the-datatransfer-interface>span classsecno>6.7.3/span> The code>DataTransfer/code> interface/a>ol>li>a href#the-datatransferitemlist-interface>span classsecno>6.7.3.1/span> The code>DataTransferItemList/code> interface/a>li>a href#the-datatransferitem-interface>span classsecno>6.7.3.2/span> The code>DataTransferItem/code> interface/a>/ol>li>a href#the-dragevent-interface>span classsecno>6.7.4/span> The code>DragEvent/code> interface/a>li>a href#drag-and-drop-processing-model>span classsecno>6.7.5/span> Processing model/a>li>a href#dndevents>span classsecno>6.7.6/span> Events summary/a>li>a href#the-draggable-attribute>span classsecno>6.7.7/span> The code>draggable/code> attribute/a>li>a href#security-risks-in-the-drag-and-drop-model>span classsecno>6.7.8/span> Security risks in the drag-and-drop model/a>/ol>/ol>li idtoc-browsers>a href#browsers>span classsecno>7/span> Loading Web pages/a>ol>li>a href#windows>span classsecno>7.1/span> Browsing contexts/a>ol>li>a href#nested-browsing-contexts>span classsecno>7.1.1/span> Nested browsing contexts/a>ol>li>a href#navigating-nested-browsing-contexts-in-the-dom>span classsecno>7.1.1.1/span> Navigating nested browsing contexts in the DOM/a>/ol>li>a href#auxiliary-browsing-contexts>span classsecno>7.1.2/span> Auxiliary browsing contexts/a>ol>li>a href#navigating-auxiliary-browsing-contexts-in-the-dom>span classsecno>7.1.2.1/span> Navigating auxiliary browsing contexts in the DOM/a>/ol>li>a href#security-nav>span classsecno>7.1.3/span> Security/a>li>a href#groupings-of-browsing-contexts>span classsecno>7.1.4/span> Groupings of browsing contexts/a>li>a href#browsing-context-names>span classsecno>7.1.5/span> Browsing context names/a>/ol>li>a href#cross-origin-objects>span classsecno>7.2/span> Security infrastructure for code>Window/code>, code>WindowProxy/code>, and code>Location/code> objects/a>ol>li>a href#integration-with-idl>span classsecno>7.2.1/span> Integration with IDL/a>li>a href#shared-internal-slot:-crossoriginpropertydescriptormap>span classsecno>7.2.2/span> Shared internal slot: CrossOriginPropertyDescriptorMap/a>li>a href#shared-abstract-operations>span classsecno>7.2.3/span> Shared abstract operations/a>ol>li>a href#crossoriginproperties-(-o-)>span classsecno>7.2.3.1/span> CrossOriginProperties ( var>O/var> )/a>li>a href#isplatformobjectsameorigin-(-o-)>span classsecno>7.2.3.2/span> IsPlatformObjectSameOrigin ( var>O/var> )/a>li>a href#crossorigingetownpropertyhelper-(-o,-p-)>span classsecno>7.2.3.3/span> CrossOriginGetOwnPropertyHelper ( var>O/var>, var>P/var> )/a>li>a href#crossoriginget-(-o,-p,-receiver-)>span classsecno>7.2.3.4/span> CrossOriginGet ( var>O/var>, var>P/var>, var>Receiver/var> )/a>li>a href#crossoriginset-(-o,-p,-v,-receiver-)>span classsecno>7.2.3.5/span> CrossOriginSet ( var>O/var>, var>P/var>, var>V/var>, var>Receiver/var> )/a>li>a href#crossoriginownpropertykeys-(-o-)>span classsecno>7.2.3.6/span> CrossOriginOwnPropertyKeys ( var>O/var> )/a>/ol>/ol>li>a href#the-window-object>span classsecno>7.3/span> The code>Window/code> object/a>ol>li>a href#apis-for-creating-and-navigating-browsing-contexts-by-name>span classsecno>7.3.1/span> APIs for creating and navigating browsing contexts by name/a>li>a href#accessing-other-browsing-contexts>span classsecno>7.3.2/span> Accessing other browsing contexts/a>li>a href#named-access-on-the-window-object>span classsecno>7.3.3/span> Named access on the code>Window/code> object/a>li>a href#garbage-collection-and-browsing-contexts>span classsecno>7.3.4/span> Garbage collection and browsing contexts/a>li>a href#closing-browsing-contexts>span classsecno>7.3.5/span> Closing browsing contexts/a>li>a href#browser-interface-elements>span classsecno>7.3.6/span> Browser interface elements/a>li>a href#script-settings-for-window-objects>span classsecno>7.3.7/span> Script settings for code>Window/code> objects/a>/ol>li>a href#the-windowproxy-exotic-object>span classsecno>7.4/span> The code>WindowProxy/code> exotic object/a>ol>li>a href#windowproxy-getprototypeof>span classsecno>7.4.1/span> GetPrototypeOf ( )/a>li>a href#windowproxy-setprototypeof>span classsecno>7.4.2/span> SetPrototypeOf ( var>V/var> )/a>li>a href#windowproxy-isextensible>span classsecno>7.4.3/span> IsExtensible ( )/a>li>a href#windowproxy-preventextensions>span classsecno>7.4.4/span> PreventExtensions ( )/a>li>a href#windowproxy-getownproperty>span classsecno>7.4.5/span> GetOwnProperty ( var>P/var> )/a>li>a href#windowproxy-defineownproperty>span classsecno>7.4.6/span> DefineOwnProperty ( var>P/var>, var>Desc/var> )/a>li>a href#windowproxy-get>span classsecno>7.4.7/span> Get ( var>P/var>, var>Receiver/var> )/a>li>a href#windowproxy-set>span classsecno>7.4.8/span> Set ( var>P/var>, var>V/var>, var>Receiver/var> )/a>li>a href#windowproxy-delete>span classsecno>7.4.9/span> Delete ( var>P/var> )/a>li>a href#windowproxy-ownpropertykeys>span classsecno>7.4.10/span> OwnPropertyKeys ( )/a>/ol>li>a href#origin>span classsecno>7.5/span> Origin/a>ol>li>a href#relaxing-the-same-origin-restriction>span classsecno>7.5.1/span> Relaxing the same-origin restriction/a>/ol>li>a href#sandboxing>span classsecno>7.6/span> Sandboxing/a>li>a href#history>span classsecno>7.7/span> Session history and navigation/a>ol>li>a href#the-session-history-of-browsing-contexts>span classsecno>7.7.1/span> The session history of browsing contexts/a>li>a href#the-history-interface>span classsecno>7.7.2/span> The code>History/code> interface/a>li>a href#history-notes>span classsecno>7.7.3/span> Implementation notes for session history/a>li>a href#the-location-interface>span classsecno>7.7.4/span> The code>Location/code> interface/a>ol>li>a href#location-getprototypeof>span classsecno>7.7.4.1/span> GetPrototypeOf ( )/a>li>a href#location-setprototypeof>span classsecno>7.7.4.2/span> SetPrototypeOf ( var>V/var> )/a>li>a href#location-isextensible>span classsecno>7.7.4.3/span> IsExtensible ( )/a>li>a href#location-preventextensions>span classsecno>7.7.4.4/span> PreventExtensions ( )/a>li>a href#location-getownproperty>span classsecno>7.7.4.5/span> GetOwnProperty ( var>P/var> )/a>li>a href#location-defineownproperty>span classsecno>7.7.4.6/span> DefineOwnProperty ( var>P/var>, var>Desc/var> )/a>li>a href#location-get>span classsecno>7.7.4.7/span> Get ( var>P/var>, var>Receiver/var> )/a>li>a href#location-set>span classsecno>7.7.4.8/span> Set ( var>P/var>, var>V/var>, var>Receiver/var> )/a>li>a href#location-delete>span classsecno>7.7.4.9/span> Delete ( var>P/var> )/a>li>a href#location-ownpropertykeys>span classsecno>7.7.4.10/span> OwnPropertyKeys ( )/a>/ol>/ol>li>a href#browsing-the-web>span classsecno>7.8/span> Browsing the Web/a>ol>li>a href#navigating-across-documents>span classsecno>7.8.1/span> Navigating across documents/a>li>a href#read-html>span classsecno>7.8.2/span> Page load processing model for HTML files/a>li>a href#read-xml>span classsecno>7.8.3/span> Page load processing model for XML files/a>li>a href#read-text>span classsecno>7.8.4/span> Page load processing model for text files/a>li>a href#read-multipart-x-mixed-replace>span classsecno>7.8.5/span> Page load processing model for code>multipart/x-mixed-replace/code> resources/a>li>a href#read-media>span classsecno>7.8.6/span> Page load processing model for media/a>li>a href#read-plugin>span classsecno>7.8.7/span> Page load processing model for content that uses plugins/a>li>a href#read-ua-inline>span classsecno>7.8.8/span> Page load processing model for inline content that doesnt have a DOM/a>li>a href#scroll-to-fragid>span classsecno>7.8.9/span> Navigating to a fragment/a>li>a href#history-traversal>span classsecno>7.8.10/span> History traversal/a>ol>li>a href#persisted-user-state-restoration>span classsecno>7.8.10.1/span> Persisted user state restoration/a>li>a href#the-popstateevent-interface>span classsecno>7.8.10.2/span> The code>PopStateEvent/code> interface/a>li>a href#the-hashchangeevent-interface>span classsecno>7.8.10.3/span> The code>HashChangeEvent/code> interface/a>li>a href#the-pagetransitionevent-interface>span classsecno>7.8.10.4/span> The code>PageTransitionEvent/code> interface/a>/ol>li>a href#unloading-documents>span classsecno>7.8.11/span> Unloading documents/a>ol>li>a href#the-beforeunloadevent-interface>span classsecno>7.8.11.1/span> The code>BeforeUnloadEvent/code> interface/a>/ol>li>a href#aborting-a-document-load>span classsecno>7.8.12/span> Aborting a document load/a>/ol>li>a href#offline>span classsecno>7.9/span> Offline Web applications/a>ol>li>a href#introduction-10>span classsecno>7.9.1/span> Introduction/a>ol>li>a href#supporting-offline-caching-for-legacy-applications>span classsecno>7.9.1.1/span> Supporting offline caching for legacy applications/a>li>a href#appcacheevents>span classsecno>7.9.1.2/span> Event summary/a>/ol>li>a href#appcache>span classsecno>7.9.2/span> Application caches/a>li>a href#manifests>span classsecno>7.9.3/span> The cache manifest syntax/a>ol>li>a href#some-sample-manifests>span classsecno>7.9.3.1/span> Some sample manifests/a>li>a href#writing-cache-manifests>span classsecno>7.9.3.2/span> Writing cache manifests/a>li>a href#parsing-cache-manifests>span classsecno>7.9.3.3/span> Parsing cache manifests/a>/ol>li>a href#downloading-or-updating-an-application-cache>span classsecno>7.9.4/span> Downloading or updating an application cache/a>li>a href#the-application-cache-selection-algorithm>span classsecno>7.9.5/span> The application cache selection algorithm/a>li>a href#changesToNetworkingModel>span classsecno>7.9.6/span> Changes to the networking model/a>li>a href#expiring-application-caches>span classsecno>7.9.7/span> Expiring application caches/a>li>a href#disk-space>span classsecno>7.9.8/span> Disk space/a>li>a href#security-concerns-with-offline-applications-caches>span classsecno>7.9.9/span> Security concerns with offline applications caches/a>li>a href#application-cache-api>span classsecno>7.9.10/span> Application cache API/a>li>a href#navigator.online>span classsecno>7.9.11/span> Browser state/a>/ol>/ol>li idtoc-webappapis>a href#webappapis>span classsecno>8/span> Web application APIs/a>ol>li>a href#scripting>span classsecno>8.1/span> Scripting/a>ol>li>a href#introduction-11>span classsecno>8.1.1/span> Introduction/a>li>a href#enabling-and-disabling-scripting>span classsecno>8.1.2/span> Enabling and disabling scripting/a>li>a href#scripting-processing-model>span classsecno>8.1.3/span> Processing model/a>ol>li>a href#definitions-2>span classsecno>8.1.3.1/span> Definitions/a>li>a href#fetching-scripts>span classsecno>8.1.3.2/span> Fetching scripts/a>li>a href#creating-scripts>span classsecno>8.1.3.3/span> Creating scripts/a>li>a href#calling-scripts>span classsecno>8.1.3.4/span> Calling scripts/a>li>a href#realms-settings-objects-global-objects>span classsecno>8.1.3.5/span> Realms, settings objects, and global objects/a>ol>li>a href#entry>span classsecno>8.1.3.5.1/span> Entry/a>li>a href#incumbent>span classsecno>8.1.3.5.2/span> Incumbent/a>li>a href#current>span classsecno>8.1.3.5.3/span> Current/a>li>a href#relevant>span classsecno>8.1.3.5.4/span> Relevant/a>/ol>li>a href#killing-scripts>span classsecno>8.1.3.6/span> Killing scripts/a>li>a href#integration-with-the-javascript-job-queue>span classsecno>8.1.3.7/span> Integration with the JavaScript job queue/a>ol>li>a href#enqueuejob(queuename,-job,-arguments)>span classsecno>8.1.3.7.1/span> EnqueueJob(var>queueName/var>, var>job/var>, var>arguments/var>)/a>/ol>li>a href#integration-with-the-javascript-module-system>span classsecno>8.1.3.8/span> Integration with the JavaScript module system/a>ol>li>a href#hostresolveimportedmodule(referencingscriptormodule,-specifier)>span classsecno>8.1.3.8.1/span> HostResolveImportedModule(var>referencingScriptOrModule/var>, var>specifier/var>)/a>li>a href#hostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability)>span classsecno>8.1.3.8.2/span> HostImportModuleDynamically(var>referencingScriptOrModule/var>, var>specifier/var>, var>promiseCapability/var>)/a>/ol>li>a href#integration-with-the-javascript-agent-formalism>span classsecno>8.1.3.9/span> Integration with the JavaScript agent formalism/a>li>a href#integration-with-the-javascript-agent-cluster-formalism>span classsecno>8.1.3.10/span> Integration with the JavaScript agent cluster formalism/a>li>a href#runtime-script-errors>span classsecno>8.1.3.11/span> Runtime script errors/a>ol>li>a href#runtime-script-errors-in-documents>span classsecno>8.1.3.11.1/span> Runtime script errors in documents/a>li>a href#the-errorevent-interface>span classsecno>8.1.3.11.2/span> The code>ErrorEvent/code> interface/a>/ol>li>a href#unhandled-promise-rejections>span classsecno>8.1.3.12/span> Unhandled promise rejections/a>ol>li>a href#the-hostpromiserejectiontracker-implementation>span classsecno>8.1.3.12.1/span> HostPromiseRejectionTracker(var>promise/var>, var>operation/var>)/a>li>a href#the-promiserejectionevent-interface>span classsecno>8.1.3.12.2/span> The code>PromiseRejectionEvent/code> interface/a>/ol>li>a href#hostensurecancompilestrings(callerrealm,-calleerealm)>span classsecno>8.1.3.13/span> HostEnsureCanCompileStrings(var>callerRealm/var>, var>calleeRealm/var>)/a>/ol>li>a href#event-loops>span classsecno>8.1.4/span> Event loops/a>ol>li>a href#definitions-3>span classsecno>8.1.4.1/span> Definitions/a>li>a href#event-loop-processing-model>span classsecno>8.1.4.2/span> Processing model/a>li>a href#generic-task-sources>span classsecno>8.1.4.3/span> Generic task sources/a>li>a href#event-loop-for-spec-authors>span classsecno>8.1.4.4/span> Dealing with the event loop from other specifications/a>/ol>li>a href#events>span classsecno>8.1.5/span> Events/a>ol>li>a href#event-handler-attributes>span classsecno>8.1.5.1/span> Event handlers/a>li>a href#event-handlers-on-elements,-document-objects,-and-window-objects>span classsecno>8.1.5.2/span> Event handlers on elements, code>Document/code> objects, and code>Window/code> objects/a>ol>li>a href#idl-definitions>span classsecno>8.1.5.2.1/span> IDL definitions/a>/ol>li>a href#event-firing>span classsecno>8.1.5.3/span> Event firing/a>/ol>/ol>li>a href#windoworworkerglobalscope-mixin>span classsecno>8.2/span> The code>WindowOrWorkerGlobalScope/code> mixin/a>li>a href#atob>span classsecno>8.3/span> Base64 utility methods/a>li>a href#dynamic-markup-insertion>span classsecno>8.4/span> Dynamic markup insertion/a>ol>li>a href#opening-the-input-stream>span classsecno>8.4.1/span> Opening the input stream/a>li>a href#closing-the-input-stream>span classsecno>8.4.2/span> Closing the input stream/a>li>a href#document.write()>span classsecno>8.4.3/span> code>document.write()/code>/a>li>a href#document.writeln()>span classsecno>8.4.4/span> code>document.writeln()/code>/a>/ol>li>a href#timers>span classsecno>8.5/span> Timers/a>li>a href#user-prompts>span classsecno>8.6/span> User prompts/a>ol>li>a href#simple-dialogs>span classsecno>8.6.1/span> Simple dialogs/a>li>a href#printing>span classsecno>8.6.2/span> Printing/a>/ol>li>a href#system-state-and-capabilities>span classsecno>8.7/span> System state and capabilities/a>ol>li>a href#the-navigator-object>span classsecno>8.7.1/span> The code>Navigator/code> object/a>ol>li>a href#client-identification>span classsecno>8.7.1.1/span> Client identification/a>li>a href#language-preferences>span classsecno>8.7.1.2/span> Language preferences/a>li>a href#custom-handlers>span classsecno>8.7.1.3/span> Custom scheme handlers: the code>registerProtocolHandler()/code> method/a>ol>li>a href#security-and-privacy>span classsecno>8.7.1.3.1/span> Security and privacy/a>/ol>li>a href#cookies>span classsecno>8.7.1.4/span> Cookies/a>li>a href#plugins-2>span classsecno>8.7.1.5/span> Plugins/a>/ol>/ol>li>a href#images-2>span classsecno>8.8/span> Images/a>li>a href#animation-frames>span classsecno>8.9/span> Animation frames/a>/ol>li idtoc-comms>a href#comms>span classsecno>9/span> Communication/a>ol>li>a href#the-messageevent-interface>span classsecno>9.1/span> The code>MessageEvent/code> interface/a>li>a href#server-sent-events>span classsecno>9.2/span> Server-sent events/a>ol>li>a href#server-sent-events-intro>span classsecno>9.2.1/span> Introduction/a>li>a href#the-eventsource-interface>span classsecno>9.2.2/span> The code>EventSource/code> interface/a>li>a href#sse-processing-model>span classsecno>9.2.3/span> Processing model/a>li>a href#parsing-an-event-stream>span classsecno>9.2.4/span> Parsing an event stream/a>li>a href#event-stream-interpretation>span classsecno>9.2.5/span> Interpreting an event stream/a>li>a href#authoring-notes>span classsecno>9.2.6/span> Authoring notes/a>li>a href#eventsource-push>span classsecno>9.2.7/span> Connectionless push and other features/a>li>a href#garbage-collection-2>span classsecno>9.2.8/span> Garbage collection/a>li>a href#implementation-advice>span classsecno>9.2.9/span> Implementation advice/a>/ol>li>a href#network>span classsecno>9.3/span> Web sockets/a>ol>li>a href#network-intro>span classsecno>9.3.1/span> Introduction/a>li>a href#the-websocket-interface>span classsecno>9.3.2/span> The code>WebSocket/code> interface/a>li>a href#feedback-from-the-protocol>span classsecno>9.3.3/span> Feedback from the protocol/a>li>a href#ping-and-pong-frames>span classsecno>9.3.4/span> Ping and Pong frames/a>li>a href#the-closeevent-interface>span classsecno>9.3.5/span> The code>CloseEvent/code> interface/a>li>a href#garbage-collection-3>span classsecno>9.3.6/span> Garbage collection/a>/ol>li>a href#web-messaging>span classsecno>9.4/span> Cross-document messaging/a>ol>li>a href#introduction-12>span classsecno>9.4.1/span> Introduction/a>li>a href#security-postmsg>span classsecno>9.4.2/span> Security/a>ol>li>a href#authors>span classsecno>9.4.2.1/span> Authors/a>li>a href#user-agents>span classsecno>9.4.2.2/span> User agents/a>/ol>li>a href#posting-messages>span classsecno>9.4.3/span> Posting messages/a>/ol>li>a href#channel-messaging>span classsecno>9.5/span> Channel messaging/a>ol>li>a href#introduction-13>span classsecno>9.5.1/span> Introduction/a>ol>li>a href#examples-5>span classsecno>9.5.1.1/span> Examples/a>li>a href#ports-as-the-basis-of-an-object-capability-model-on-the-web>span classsecno>9.5.1.2/span> 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>span classsecno>9.5.1.3/span> Ports as the basis of abstracting out service implementations/a>/ol>li>a href#message-channels>span classsecno>9.5.2/span> Message channels/a>li>a href#message-ports>span classsecno>9.5.3/span> Message ports/a>li>a href#broadcasting-to-many-ports>span classsecno>9.5.4/span> Broadcasting to many ports/a>li>a href#ports-and-garbage-collection>span classsecno>9.5.5/span> Ports and garbage collection/a>/ol>li>a href#broadcasting-to-other-browsing-contexts>span classsecno>9.6/span> Broadcasting to other browsing contexts/a>/ol>li idtoc-workers>a href#workers>span classsecno>10/span> Web workers/a>ol>li>a href#introduction-14>span classsecno>10.1/span> Introduction/a>ol>li>a href#scope-2>span classsecno>10.1.1/span> Scope/a>li>a href#examples-6>span classsecno>10.1.2/span> Examples/a>ol>li>a href#a-background-number-crunching-worker>span classsecno>10.1.2.1/span> A background number-crunching worker/a>li>a href#worker-used-for-background-i/o>span classsecno>10.1.2.2/span> Worker used for background I/O/a>li>a href#module-worker-example>span classsecno>10.1.2.3/span> Using a JavaScript module as a worker/a>li>a href#shared-workers-introduction>span classsecno>10.1.2.4/span> Shared workers introduction/a>li>a href#shared-state-using-a-shared-worker>span classsecno>10.1.2.5/span> Shared state using a shared worker/a>li>a href#delegation>span classsecno>10.1.2.6/span> Delegation/a>li>a href#providing-libraries>span classsecno>10.1.2.7/span> Providing libraries/a>/ol>li>a href#tutorials>span classsecno>10.1.3/span> Tutorials/a>ol>li>a href#creating-a-dedicated-worker>span classsecno>10.1.3.1/span> Creating a dedicated worker/a>li>a href#communicating-with-a-dedicated-worker>span classsecno>10.1.3.2/span> Communicating with a dedicated worker/a>li>a href#shared-workers>span classsecno>10.1.3.3/span> Shared workers/a>/ol>/ol>li>a href#infrastructure-2>span classsecno>10.2/span> Infrastructure/a>ol>li>a href#the-global-scope>span classsecno>10.2.1/span> The global scope/a>ol>li>a href#the-workerglobalscope-common-interface>span classsecno>10.2.1.1/span> The code>WorkerGlobalScope/code> common interface/a>li>a href#dedicated-workers-and-the-dedicatedworkerglobalscope-interface>span classsecno>10.2.1.2/span> Dedicated workers and the code>DedicatedWorkerGlobalScope/code> interface/a>li>a href#shared-workers-and-the-sharedworkerglobalscope-interface>span classsecno>10.2.1.3/span> Shared workers and the code>SharedWorkerGlobalScope/code> interface/a>/ol>li>a href#worker-event-loop>span classsecno>10.2.2/span> The event loop/a>li>a href#the-workers-lifetime>span classsecno>10.2.3/span> The workers lifetime/a>li>a href#worker-processing-model>span classsecno>10.2.4/span> Processing model/a>li>a href#runtime-script-errors-2>span classsecno>10.2.5/span> Runtime script errors/a>li>a href#creating-workers>span classsecno>10.2.6/span> Creating workers/a>ol>li>a href#the-abstractworker-abstract-interface>span classsecno>10.2.6.1/span> The code>AbstractWorker/code> abstract interface/a>li>a href#script-settings-for-workers>span classsecno>10.2.6.2/span> Script settings for workers/a>li>a href#dedicated-workers-and-the-worker-interface>span classsecno>10.2.6.3/span> Dedicated workers and the code>Worker/code> interface/a>li>a href#shared-workers-and-the-sharedworker-interface>span classsecno>10.2.6.4/span> Shared workers and the code>SharedWorker/code> interface/a>/ol>li>a href#navigator.hardwareconcurrency>span classsecno>10.2.7/span> Concurrent hardware capabilities/a>/ol>li>a href#apis-available-to-workers>span classsecno>10.3/span> APIs available to workers/a>ol>li>a href#importing-scripts-and-libraries>span classsecno>10.3.1/span> Importing scripts and libraries/a>li>a href#the-workernavigator-object>span classsecno>10.3.2/span> The code>WorkerNavigator/code> interface/a>li>a href#worker-locations>span classsecno>10.3.3/span> The code>WorkerLocation/code> interface/a>/ol>/ol>li idtoc-webstorage>a href#webstorage>span classsecno>11/span> Web storage/a>ol>li>a href#introduction-15>span classsecno>11.1/span> Introduction/a>li>a href#storage>span classsecno>11.2/span> The API/a>ol>li>a href#the-storage-interface>span classsecno>11.2.1/span> The code>Storage/code> interface/a>li>a href#the-sessionstorage-attribute>span classsecno>11.2.2/span> The code>sessionStorage/code> attribute/a>li>a href#the-localstorage-attribute>span classsecno>11.2.3/span> The code>localStorage/code> attribute/a>li>a href#the-storage-event>span classsecno>11.2.4/span> The code>storage/code> event/a>ol>li>a href#the-storageevent-interface>span classsecno>11.2.4.1/span> The code>StorageEvent/code> interface/a>/ol>/ol>li>a href#disk-space-2>span classsecno>11.3/span> Disk space/a>li>a href#privacy>span classsecno>11.4/span> Privacy/a>ol>li>a href#user-tracking>span classsecno>11.4.1/span> User tracking/a>li>a href#sensitivity-of-data>span classsecno>11.4.2/span> Sensitivity of data/a>/ol>li>a href#security-storage>span classsecno>11.5/span> Security/a>ol>li>a href#dns-spoofing-attacks>span classsecno>11.5.1/span> DNS spoofing attacks/a>li>a href#cross-directory-attacks>span classsecno>11.5.2/span> Cross-directory attacks/a>li>a href#implementation-risks>span classsecno>11.5.3/span> Implementation risks/a>/ol>/ol>li idtoc-syntax>a href#syntax>span classsecno>12/span> The HTML syntax/a>ol>li>a href#writing>span classsecno>12.1/span> Writing HTML documents/a>ol>li>a href#the-doctype>span classsecno>12.1.1/span> The DOCTYPE/a>li>a href#elements-2>span classsecno>12.1.2/span> Elements/a>ol>li>a href#start-tags>span classsecno>12.1.2.1/span> Start tags/a>li>a href#end-tags>span classsecno>12.1.2.2/span> End tags/a>li>a href#attributes-2>span classsecno>12.1.2.3/span> Attributes/a>li>a href#optional-tags>span classsecno>12.1.2.4/span> Optional tags/a>li>a href#element-restrictions>span classsecno>12.1.2.5/span> Restrictions on content models/a>li>a href#cdata-rcdata-restrictions>span classsecno>12.1.2.6/span> Restrictions on the contents of raw text and escapable raw text elements/a>/ol>li>a href#text-2>span classsecno>12.1.3/span> Text/a>ol>li>a href#newlines>span classsecno>12.1.3.1/span> Newlines/a>/ol>li>a href#character-references>span classsecno>12.1.4/span> Character references/a>li>a href#cdata-sections>span classsecno>12.1.5/span> CDATA sections/a>li>a href#comments>span classsecno>12.1.6/span> Comments/a>/ol>li>a href#parsing>span classsecno>12.2/span> Parsing HTML documents/a>ol>li>a href#overview-of-the-parsing-model>span classsecno>12.2.1/span> Overview of the parsing model/a>li>a href#parse-errors>span classsecno>12.2.2/span> Parse errors/a>li>a href#the-input-byte-stream>span classsecno>12.2.3/span> The input byte stream/a>ol>li>a href#parsing-with-a-known-character-encoding>span classsecno>12.2.3.1/span> Parsing with a known character encoding/a>li>a href#determining-the-character-encoding>span classsecno>12.2.3.2/span> Determining the character encoding/a>li>a href#character-encodings>span classsecno>12.2.3.3/span> Character encodings/a>li>a href#changing-the-encoding-while-parsing>span classsecno>12.2.3.4/span> Changing the encoding while parsing/a>li>a href#preprocessing-the-input-stream>span classsecno>12.2.3.5/span> Preprocessing the input stream/a>/ol>li>a href#parse-state>span classsecno>12.2.4/span> Parse state/a>ol>li>a href#the-insertion-mode>span classsecno>12.2.4.1/span> The insertion mode/a>li>a href#the-stack-of-open-elements>span classsecno>12.2.4.2/span> The stack of open elements/a>li>a href#the-list-of-active-formatting-elements>span classsecno>12.2.4.3/span> The list of active formatting elements/a>li>a href#the-element-pointers>span classsecno>12.2.4.4/span> The element pointers/a>li>a href#other-parsing-state-flags>span classsecno>12.2.4.5/span> Other parsing state flags/a>/ol>li>a href#tokenization>span classsecno>12.2.5/span> Tokenization/a>ol>li>a href#data-state>span classsecno>12.2.5.1/span> Data state/a>li>a href#rcdata-state>span classsecno>12.2.5.2/span> RCDATA state/a>li>a href#rawtext-state>span classsecno>12.2.5.3/span> RAWTEXT state/a>li>a href#script-data-state>span classsecno>12.2.5.4/span> Script data state/a>li>a href#plaintext-state>span classsecno>12.2.5.5/span> PLAINTEXT state/a>li>a href#tag-open-state>span classsecno>12.2.5.6/span> Tag open state/a>li>a href#end-tag-open-state>span classsecno>12.2.5.7/span> End tag open state/a>li>a href#tag-name-state>span classsecno>12.2.5.8/span> Tag name state/a>li>a href#rcdata-less-than-sign-state>span classsecno>12.2.5.9/span> RCDATA less-than sign state/a>li>a href#rcdata-end-tag-open-state>span classsecno>12.2.5.10/span> RCDATA end tag open state/a>li>a href#rcdata-end-tag-name-state>span classsecno>12.2.5.11/span> RCDATA end tag name state/a>li>a href#rawtext-less-than-sign-state>span classsecno>12.2.5.12/span> RAWTEXT less-than sign state/a>li>a href#rawtext-end-tag-open-state>span classsecno>12.2.5.13/span> RAWTEXT end tag open state/a>li>a href#rawtext-end-tag-name-state>span classsecno>12.2.5.14/span> RAWTEXT end tag name state/a>li>a href#script-data-less-than-sign-state>span classsecno>12.2.5.15/span> Script data less-than sign state/a>li>a href#script-data-end-tag-open-state>span classsecno>12.2.5.16/span> Script data end tag open state/a>li>a href#script-data-end-tag-name-state>span classsecno>12.2.5.17/span> Script data end tag name state/a>li>a href#script-data-escape-start-state>span classsecno>12.2.5.18/span> Script data escape start state/a>li>a href#script-data-escape-start-dash-state>span classsecno>12.2.5.19/span> Script data escape start dash state/a>li>a href#script-data-escaped-state>span classsecno>12.2.5.20/span> Script data escaped state/a>li>a href#script-data-escaped-dash-state>span classsecno>12.2.5.21/span> Script data escaped dash state/a>li>a href#script-data-escaped-dash-dash-state>span classsecno>12.2.5.22/span> Script data escaped dash dash state/a>li>a href#script-data-escaped-less-than-sign-state>span classsecno>12.2.5.23/span> Script data escaped less-than sign state/a>li>a href#script-data-escaped-end-tag-open-state>span classsecno>12.2.5.24/span> Script data escaped end tag open state/a>li>a href#script-data-escaped-end-tag-name-state>span classsecno>12.2.5.25/span> Script data escaped end tag name state/a>li>a href#script-data-double-escape-start-state>span classsecno>12.2.5.26/span> Script data double escape start state/a>li>a href#script-data-double-escaped-state>span classsecno>12.2.5.27/span> Script data double escaped state/a>li>a href#script-data-double-escaped-dash-state>span classsecno>12.2.5.28/span> Script data double escaped dash state/a>li>a href#script-data-double-escaped-dash-dash-state>span classsecno>12.2.5.29/span> Script data double escaped dash dash state/a>li>a href#script-data-double-escaped-less-than-sign-state>span classsecno>12.2.5.30/span> Script data double escaped less-than sign state/a>li>a href#script-data-double-escape-end-state>span classsecno>12.2.5.31/span> Script data double escape end state/a>li>a href#before-attribute-name-state>span classsecno>12.2.5.32/span> Before attribute name state/a>li>a href#attribute-name-state>span classsecno>12.2.5.33/span> Attribute name state/a>li>a href#after-attribute-name-state>span classsecno>12.2.5.34/span> After attribute name state/a>li>a href#before-attribute-value-state>span classsecno>12.2.5.35/span> Before attribute value state/a>li>a href#attribute-value-(double-quoted)-state>span classsecno>12.2.5.36/span> Attribute value (double-quoted) state/a>li>a href#attribute-value-(single-quoted)-state>span classsecno>12.2.5.37/span> Attribute value (single-quoted) state/a>li>a href#attribute-value-(unquoted)-state>span classsecno>12.2.5.38/span> Attribute value (unquoted) state/a>li>a href#after-attribute-value-(quoted)-state>span classsecno>12.2.5.39/span> After attribute value (quoted) state/a>li>a href#self-closing-start-tag-state>span classsecno>12.2.5.40/span> Self-closing start tag state/a>li>a href#bogus-comment-state>span classsecno>12.2.5.41/span> Bogus comment state/a>li>a href#markup-declaration-open-state>span classsecno>12.2.5.42/span> Markup declaration open state/a>li>a href#comment-start-state>span classsecno>12.2.5.43/span> Comment start state/a>li>a href#comment-start-dash-state>span classsecno>12.2.5.44/span> Comment start dash state/a>li>a href#comment-state>span classsecno>12.2.5.45/span> Comment state/a>li>a href#comment-less-than-sign-state>span classsecno>12.2.5.46/span> Comment less-than sign state/a>li>a href#comment-less-than-sign-bang-state>span classsecno>12.2.5.47/span> Comment less-than sign bang state/a>li>a href#comment-less-than-sign-bang-dash-state>span classsecno>12.2.5.48/span> Comment less-than sign bang dash state/a>li>a href#comment-less-than-sign-bang-dash-dash-state>span classsecno>12.2.5.49/span> Comment less-than sign bang dash dash state/a>li>a href#comment-end-dash-state>span classsecno>12.2.5.50/span> Comment end dash state/a>li>a href#comment-end-state>span classsecno>12.2.5.51/span> Comment end state/a>li>a href#comment-end-bang-state>span classsecno>12.2.5.52/span> Comment end bang state/a>li>a href#doctype-state>span classsecno>12.2.5.53/span> DOCTYPE state/a>li>a href#before-doctype-name-state>span classsecno>12.2.5.54/span> Before DOCTYPE name state/a>li>a href#doctype-name-state>span classsecno>12.2.5.55/span> DOCTYPE name state/a>li>a href#after-doctype-name-state>span classsecno>12.2.5.56/span> After DOCTYPE name state/a>li>a href#after-doctype-public-keyword-state>span classsecno>12.2.5.57/span> After DOCTYPE public keyword state/a>li>a href#before-doctype-public-identifier-state>span classsecno>12.2.5.58/span> Before DOCTYPE public identifier state/a>li>a href#doctype-public-identifier-(double-quoted)-state>span classsecno>12.2.5.59/span> DOCTYPE public identifier (double-quoted) state/a>li>a href#doctype-public-identifier-(single-quoted)-state>span classsecno>12.2.5.60/span> DOCTYPE public identifier (single-quoted) state/a>li>a href#after-doctype-public-identifier-state>span classsecno>12.2.5.61/span> After DOCTYPE public identifier state/a>li>a href#between-doctype-public-and-system-identifiers-state>span classsecno>12.2.5.62/span> Between DOCTYPE public and system identifiers state/a>li>a href#after-doctype-system-keyword-state>span classsecno>12.2.5.63/span> After DOCTYPE system keyword state/a>li>a href#before-doctype-system-identifier-state>span classsecno>12.2.5.64/span> Before DOCTYPE system identifier state/a>li>a href#doctype-system-identifier-(double-quoted)-state>span classsecno>12.2.5.65/span> DOCTYPE system identifier (double-quoted) state/a>li>a href#doctype-system-identifier-(single-quoted)-state>span classsecno>12.2.5.66/span> DOCTYPE system identifier (single-quoted) state/a>li>a href#after-doctype-system-identifier-state>span classsecno>12.2.5.67/span> After DOCTYPE system identifier state/a>li>a href#bogus-doctype-state>span classsecno>12.2.5.68/span> Bogus DOCTYPE state/a>li>a href#cdata-section-state>span classsecno>12.2.5.69/span> CDATA section state/a>li>a href#cdata-section-bracket-state>span classsecno>12.2.5.70/span> CDATA section bracket state/a>li>a href#cdata-section-end-state>span classsecno>12.2.5.71/span> CDATA section end state/a>li>a href#character-reference-state>span classsecno>12.2.5.72/span> Character reference state/a>li>a href#named-character-reference-state>span classsecno>12.2.5.73/span> Named character reference state/a>li>a href#ambiguous-ampersand-state>span classsecno>12.2.5.74/span> Ambiguous ampersand state/a>li>a href#numeric-character-reference-state>span classsecno>12.2.5.75/span> Numeric character reference state/a>li>a href#hexademical-character-reference-start-state>span classsecno>12.2.5.76/span> Hexademical character reference start state/a>li>a href#decimal-character-reference-start-state>span classsecno>12.2.5.77/span> Decimal character reference start state/a>li>a href#hexademical-character-reference-state>span classsecno>12.2.5.78/span> Hexademical character reference state/a>li>a href#decimal-character-reference-state>span classsecno>12.2.5.79/span> Decimal character reference state/a>li>a href#numeric-character-reference-end-state>span classsecno>12.2.5.80/span> Numeric character reference end state/a>/ol>li>a href#tree-construction>span classsecno>12.2.6/span> Tree construction/a>ol>li>a href#creating-and-inserting-nodes>span classsecno>12.2.6.1/span> Creating and inserting nodes/a>li>a href#parsing-elements-that-contain-only-text>span classsecno>12.2.6.2/span> Parsing elements that contain only text/a>li>a href#closing-elements-that-have-implied-end-tags>span classsecno>12.2.6.3/span> Closing elements that have implied end tags/a>li>a href#parsing-main-inhtml>span classsecno>12.2.6.4/span> The rules for parsing tokens in HTML content/a>ol>li>a href#the-initial-insertion-mode>span classsecno>12.2.6.4.1/span> The initial insertion mode/a>li>a href#the-before-html-insertion-mode>span classsecno>12.2.6.4.2/span> The before html insertion mode/a>li>a href#the-before-head-insertion-mode>span classsecno>12.2.6.4.3/span> The before head insertion mode/a>li>a href#parsing-main-inhead>span classsecno>12.2.6.4.4/span> The in head insertion mode/a>li>a href#parsing-main-inheadnoscript>span classsecno>12.2.6.4.5/span> The in head noscript insertion mode/a>li>a href#the-after-head-insertion-mode>span classsecno>12.2.6.4.6/span> The after head insertion mode/a>li>a href#parsing-main-inbody>span classsecno>12.2.6.4.7/span> The in body insertion mode/a>li>a href#parsing-main-incdata>span classsecno>12.2.6.4.8/span> The text insertion mode/a>li>a href#parsing-main-intable>span classsecno>12.2.6.4.9/span> The in table insertion mode/a>li>a href#parsing-main-intabletext>span classsecno>12.2.6.4.10/span> The in table text insertion mode/a>li>a href#parsing-main-incaption>span classsecno>12.2.6.4.11/span> The in caption insertion mode/a>li>a href#parsing-main-incolgroup>span classsecno>12.2.6.4.12/span> The in column group insertion mode/a>li>a href#parsing-main-intbody>span classsecno>12.2.6.4.13/span> The in table body insertion mode/a>li>a href#parsing-main-intr>span classsecno>12.2.6.4.14/span> The in row insertion mode/a>li>a href#parsing-main-intd>span classsecno>12.2.6.4.15/span> The in cell insertion mode/a>li>a href#parsing-main-inselect>span classsecno>12.2.6.4.16/span> The in select insertion mode/a>li>a href#parsing-main-inselectintable>span classsecno>12.2.6.4.17/span> The in select in table insertion mode/a>li>a href#parsing-main-intemplate>span classsecno>12.2.6.4.18/span> The in template insertion mode/a>li>a href#parsing-main-afterbody>span classsecno>12.2.6.4.19/span> The after body insertion mode/a>li>a href#parsing-main-inframeset>span classsecno>12.2.6.4.20/span> The in frameset insertion mode/a>li>a href#parsing-main-afterframeset>span classsecno>12.2.6.4.21/span> The after frameset insertion mode/a>li>a href#the-after-after-body-insertion-mode>span classsecno>12.2.6.4.22/span> The after after body insertion mode/a>li>a href#the-after-after-frameset-insertion-mode>span classsecno>12.2.6.4.23/span> The after after frameset insertion mode/a>/ol>li>a href#parsing-main-inforeign>span classsecno>12.2.6.5/span> The rules for parsing tokens in foreign content/a>/ol>li>a href#the-end>span classsecno>12.2.7/span> The end/a>li>a href#coercing-an-html-dom-into-an-infoset>span classsecno>12.2.8/span> Coercing an HTML DOM into an infoset/a>li>a href#an-introduction-to-error-handling-and-strange-cases-in-the-parser>span classsecno>12.2.9/span> An introduction to error handling and strange cases in the parser/a>ol>li>a href#misnested-tags:-b-i-/b-/i>span classsecno>12.2.9.1/span> Misnested tags: <b><i></b></i>/a>li>a href#misnested-tags:-b-p-/b-/p>span classsecno>12.2.9.2/span> Misnested tags: <b><p></b></p>/a>li>a href#unexpected-markup-in-tables>span classsecno>12.2.9.3/span> Unexpected markup in tables/a>li>a href#scripts-that-modify-the-page-as-it-is-being-parsed>span classsecno>12.2.9.4/span> Scripts that modify the page as it is being parsed/a>li>a href#the-execution-of-scripts-that-are-moving-across-multiple-documents>span classsecno>12.2.9.5/span> The execution of scripts that are moving across multiple documents/a>li>a href#unclosed-formatting-elements>span classsecno>12.2.9.6/span> Unclosed formatting elements/a>/ol>/ol>li>a href#serialising-html-fragments>span classsecno>12.3/span> Serializing HTML fragments/a>li>a href#parsing-html-fragments>span classsecno>12.4/span> Parsing HTML fragments/a>li>a href#named-character-references>span classsecno>12.5/span> Named character references/a>/ol>li idtoc-the-xhtml-syntax>a href#the-xhtml-syntax>span classsecno>13/span> The XML syntax/a>ol>li>a href#writing-xhtml-documents>span classsecno>13.1/span> Writing documents in the XML syntax/a>li>a href#parsing-xhtml-documents>span classsecno>13.2/span> Parsing XML documents/a>li>a href#serialising-xhtml-fragments>span classsecno>13.3/span> Serializing XML fragments/a>li>a href#parsing-xhtml-fragments>span classsecno>13.4/span> Parsing XML fragments/a>/ol>li idtoc-rendering>a href#rendering>span classsecno>14/span> Rendering/a>ol>li>a href#introduction-16>span classsecno>14.1/span> Introduction/a>li>a href#the-css-user-agent-style-sheet-and-presentational-hints>span classsecno>14.2/span> The CSS user agent style sheet and presentational hints/a>li>a href#non-replaced-elements>span classsecno>14.3/span> Non-replaced elements/a>ol>li>a href#hidden-elements>span classsecno>14.3.1/span> Hidden elements/a>li>a href#the-page>span classsecno>14.3.2/span> The page/a>li>a href#flow-content-3>span classsecno>14.3.3/span> Flow content/a>li>a href#phrasing-content-3>span classsecno>14.3.4/span> Phrasing content/a>li>a href#bidi-rendering>span classsecno>14.3.5/span> Bidirectional text/a>li>a href#quotes>span classsecno>14.3.6/span> Quotes/a>li>a href#sections-and-headings>span classsecno>14.3.7/span> Sections and headings/a>li>a href#lists>span classsecno>14.3.8/span> Lists/a>li>a href#tables-2>span classsecno>14.3.9/span> Tables/a>li>a href#margin-collapsing-quirks>span classsecno>14.3.10/span> Margin collapsing quirks/a>li>a href#form-controls>span classsecno>14.3.11/span> Form controls/a>li>a href#the-hr-element-2>span classsecno>14.3.12/span> The code>hr/code> element/a>li>a href#the-fieldset-and-legend-elements>span classsecno>14.3.13/span> The code>fieldset/code> and code>legend/code> elements/a>/ol>li>a href#replaced-elements>span classsecno>14.4/span> Replaced elements/a>ol>li>a href#embedded-content-rendering-rules>span classsecno>14.4.1/span> Embedded content/a>li>a href#images-3>span classsecno>14.4.2/span> Images/a>li>a href#attributes-for-embedded-content-and-images>span classsecno>14.4.3/span> Attributes for embedded content and images/a>li>a href#image-maps-2>span classsecno>14.4.4/span> Image maps/a>/ol>li>a href#widgets>span classsecno>14.5/span> Widgets/a>ol>li>a href#introduction-17>span classsecno>14.5.1/span> Introduction/a>li>a href#the-button-element-2>span classsecno>14.5.2/span> The code>button/code> element/a>li>a href#the-details-and-summary-elements>span classsecno>14.5.3/span> The code>details/code> and code>summary/code> elements/a>li>a href#the-input-element-as-a-text-entry-widget>span classsecno>14.5.4/span> The code>input/code> element as a text entry widget/a>li>a href#the-input-element-as-domain-specific-widgets>span classsecno>14.5.5/span> The code>input/code> element as domain-specific widgets/a>li>a href#the-input-element-as-a-range-control>span classsecno>14.5.6/span> The code>input/code> element as a range control/a>li>a href#the-input-element-as-a-colour-well>span classsecno>14.5.7/span> The code>input/code> element as a color well/a>li>a href#the-input-element-as-a-checkbox-and-radio-button-widgets>span classsecno>14.5.8/span> The code>input/code> element as a checkbox and radio button widgets/a>li>a href#the-input-element-as-a-file-upload-control>span classsecno>14.5.9/span> The code>input/code> element as a file upload control/a>li>a href#the-input-element-as-a-button>span classsecno>14.5.10/span> The code>input/code> element as a button/a>li>a href#the-marquee-element-2>span classsecno>14.5.11/span> The code>marquee/code> element/a>li>a href#the-meter-element-2>span classsecno>14.5.12/span> The code>meter/code> element/a>li>a href#the-progress-element-2>span classsecno>14.5.13/span> The code>progress/code> element/a>li>a href#the-select-element-2>span classsecno>14.5.14/span> The code>select/code> element/a>li>a href#the-textarea-element-2>span classsecno>14.5.15/span> The code>textarea/code> element/a>/ol>li>a href#frames-and-framesets>span classsecno>14.6/span> Frames and framesets/a>li>a href#interactive-media>span classsecno>14.7/span> Interactive media/a>ol>li>a href#links,-forms,-and-navigation>span classsecno>14.7.1/span> Links, forms, and navigation/a>li>a href#the-title-attribute-2>span classsecno>14.7.2/span> The code>title/code> attribute/a>li>a href#editing-hosts>span classsecno>14.7.3/span> Editing hosts/a>li>a href#text-rendered-in-native-user-interfaces>span classsecno>14.7.4/span> Text rendered in native user interfaces/a>/ol>li>a href#print-media>span classsecno>14.8/span> Print media/a>li>a href#unstyled-xml-documents>span classsecno>14.9/span> Unstyled XML documents/a>/ol>li idtoc-obsolete>a href#obsolete>span classsecno>15/span> Obsolete features/a>ol>li>a href#obsolete-but-conforming-features>span classsecno>15.1/span> Obsolete but conforming features/a>ol>li>a href#warnings-for-obsolete-but-conforming-features>span classsecno>15.1.1/span> Warnings for obsolete but conforming features/a>/ol>li>a href#non-conforming-features>span classsecno>15.2/span> Non-conforming features/a>li>a href#requirements-for-implementations>span classsecno>15.3/span> Requirements for implementations/a>ol>li>a href#the-marquee-element>span classsecno>15.3.1/span> The code>marquee/code> element/a>li>a href#frames>span classsecno>15.3.2/span> Frames/a>li>a href#other-elements,-attributes-and-apis>span classsecno>15.3.3/span> Other elements, attributes and APIs/a>/ol>/ol>li idtoc-iana>a href#iana>span classsecno>16/span> IANA considerations/a>ol>li>a href#text/html>span classsecno>16.1/span> code>text/html/code>/a>li>a href#multipart/x-mixed-replace>span classsecno>16.2/span> code>multipart/x-mixed-replace/code>/a>li>a href#application/xhtml+xml>span classsecno>16.3/span> code>application/xhtml+xml/code>/a>li>a href#text/cache-manifest>span classsecno>16.4/span> code>text/cache-manifest/code>/a>li>a href#text/ping>span classsecno>16.5/span> code>text/ping/code>/a>li>a href#application/microdata+json>span classsecno>16.6/span> code>application/microdata+json/code>/a>li>a href#text/event-stream>span classsecno>16.7/span> code>text/event-stream/code>/a>li>a href#ping-from>span classsecno>16.8/span> `code>Ping-From/code>`/a>li>a href#ping-to>span classsecno>16.9/span> `code>Ping-To/code>`/a>li>a href#refresh>span classsecno>16.10/span> `code>Refresh/code>`/a>li>a href#last-event-id>span classsecno>16.11/span> `code>Last-Event-ID/code>`/a>li>a href#web+-scheme-prefix>span classsecno>16.12/span> code>web+/code> scheme prefix/a>/ol>li idtoc-index>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 idtoc-references>a href#references>References/a>li idtoc-acknowledgments>a href#acknowledgments>Acknowledgments/a>/ol> h2 idintroduction>span classsecno>1/span> Introductiona href#introduction classself-link>/a>/h2>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id23036 titleEither drop all mention of mutation events, or specify them in full detail>23036/a>/div> h3 idabstract>span classsecno>1.1/span> Where does this specification fit?a href#abstract classself-link>/a>/h3> p>This specification defines a big part of the Web platform, in lots of detail. Its place in the Web platform specification stack relative to other specifications can be best summed up as follows:/p> svg idabstractimg width398 roleimg viewBox0 0 398 359 height359 aria-labelIt consists of everything else, above such core technologies as HTTP, TLS, MQ, DOM, Unicode, Web IDL, MIME, URL, XML, JavaScript, and Encodings; below presentation-layer technologies like CSS, SVG, MathML, and NPAPI; and to the side of technologies like Geo, Fetch, CSP, JPEG, GIF, and PNG.> rect width398 height80>/rect> text classtop x199 y45>CSS SVG MathML NPAPI/text> rect width67 y85 height177>/rect> text transformtranslate(25 251) rotate(-90) classleft>Geo Fetch CSP/text> text transformtranslate(50 250) rotate(-90) classleft>JPEG GIF PNG/text> image xlink:hrefimages/abstract.jpeg width326 x72 y85 height177>/image> text classright x130 y250>THIS SPECIFICATION/text> rect width398 y267 height92>/rect> text classbottom x15 y300>HTTP TLS MQ DOM Unicode Web IDL/text> text classbottom x18 y330>MIME URL XML JavaScript Encodings/text> /svg> h3 idis-this-html5?>span classsecno>1.2/span> Is this HTML5?a href#is-this-html5? classself-link>/a>/h3> p>i>This section is non-normative./i>/p> p>In short: Yes./p> p>In more length: the term HTML5 is widely used as a buzzword to refer to modern Web technologies, many of which (though by no means all) are developed at the WHATWG. This document is one such; others are available from a hrefhttps://spec.whatwg.org/>the WHATWG specification index/a>./p> p classnote>Although we have asked them to stop doing so, the W3C also republishes some parts of this specification as separate documents./p> h3 idbackground>span classsecno>1.3/span> Backgrounda href#background classself-link>/a>/h3> p>i>This section is non-normative./i>/p> p>HTML is the World Wide Webs core markup language. Originally, HTML was primarily designed as a language for semantically describing scientific documents. Its general design, however, has enabled it to be adapted, over the subsequent years, to describe a number of other types of documents and even applications./p> h3 idaudience>span classsecno>1.4/span> Audiencea href#audience classself-link>/a>/h3> p>i>This section is non-normative./i>/p> p>This specification is intended for authors of documents and scripts that use the features defined in this specification, implementors of tools that operate on pages that use the features defined in this specification, and individuals wishing to establish the correctness of documents or implementations with respect to the requirements of this specification./p> p>This document is probably not suited to readers who do not already have at least a passing familiarity with Web technologies, as in places it sacrifices clarity for precision, and brevity for completeness. More approachable tutorials and authoring guides can provide a gentler introduction to the topic./p> p>In particular, familiarity with the basics of DOM is necessary for a complete understanding of some of the more technical parts of this specification. An understanding of Web IDL, HTTP, XML, Unicode, character encodings, JavaScript, and CSS will also be helpful in places but is not essential./p> h3 idscope>span classsecno>1.5/span> Scopea href#scope classself-link>/a>/h3> p>i>This section is non-normative./i>/p> p>This specification is limited to providing a semantic-level markup language and associated semantic-level scripting APIs for authoring accessible pages on the Web ranging from static documents to dynamic applications./p> p>The scope of this specification does not include providing mechanisms for media-specific customization of presentation (although default rendering rules for Web browsers are included at the end of this specification, and several mechanisms for hooking into CSS are provided as part of the language)./p> p>The scope of this specification is not to describe an entire operating system. In particular, hardware configuration software, image manipulation tools, and applications that users would be expected to use with high-end workstations on a daily basis are out of scope. In terms of applications, this specification is targeted specifically at applications that would be expected to be used by users on an occasional basis, or regularly but from disparate locations, with low CPU requirements. Examples of such applications include online purchasing systems, searching systems, games (especially multiplayer online games), public telephone books or address books, communications software (e-mail clients, instant messaging clients, discussion software), document editing software, etc./p> h3 idhistory-2>span classsecno>1.6/span> Historya href#history-2 classself-link>/a>/h3> p>i>This section is non-normative./i>/p> p>For its first five years (1990-1995), HTML went through a number of revisions and experienced a number of extensions, primarily hosted first at CERN, and then at the IETF./p> p>With the creation of the W3C, HTMLs development changed venue again. A first abortive attempt at extending HTML in 1995 known as HTML 3.0 then made way to a more pragmatic approach known as HTML 3.2, which was completed in 1997. HTML4 quickly followed later that same year./p> p>The following year, the W3C membership decided to stop evolving HTML and instead begin work on an XML-based equivalent, called XHTML. This effort started with a reformulation of HTML4 in XML, known as XHTML 1.0, which added no new features except the new serialization, and which was completed in 2000. After XHTML 1.0, the W3Cs focus turned to making it easier for other working groups to extend XHTML, under the banner of XHTML Modularization. In parallel with this, the W3C also worked on a new language that was not compatible with the earlier HTML and XHTML languages, calling it XHTML2./p> p>Around the time that HTMLs evolution was stopped in 1998, parts of the API for HTML developed by browser vendors were specified and published under the name DOM Level 1 (in 1998) and DOM Level 2 Core and DOM Level 2 HTML (starting in 2000 and culminating in 2003). These efforts then petered out, with some DOM Level 3 specifications published in 2004 but the working group being closed before all the Level 3 drafts were completed./p> p>In 2003, the publication of XForms, a technology which was positioned as the next generation of Web forms, sparked a renewed interest in evolving HTML itself, rather than finding replacements for it. This interest was borne from the realization that XMLs deployment as a Web technology was limited to entirely new technologies (like RSS and later Atom), rather than as a replacement for existing deployed technologies (like HTML)./p> p>A proof of concept to show that it was possible to extend HTML4s forms to provide many of the features that XForms 1.0 introduced, without requiring browsers to implement rendering engines that were incompatible with existing HTML Web pages, was the first result of this renewed interest. At this early stage, while the draft was already publicly available, and input was already being solicited from all sources, the specification was only under Opera Softwares copyright./p> p>The idea that HTMLs evolution should be reopened was tested at a W3C workshop in 2004, where some of the principles that underlie the HTML5 work (described below), as well as the aforementioned early draft proposal covering just forms-related features, were presented to the W3C jointly by Mozilla and Opera. The proposal was rejected on the grounds that the proposal conflicted with the previously chosen direction for the Webs evolution; the W3C staff and membership voted to continue developing XML-based replacements instead./p> p>Shortly thereafter, Apple, Mozilla, and Opera jointly announced their intent to continue working on the effort under the umbrella of a new venue called the WHATWG. A public mailing list was created, and the draft was moved to the WHATWG site. The copyright was subsequently amended to be jointly owned by all three vendors, and to allow reuse of the specification./p> p>The WHATWG was based on several core principles, in particular that technologies need to be backwards compatible, that specifications and implementations need to match even if this means changing the specification rather than the implementations, and that specifications need to be detailed enough that implementations can achieve complete interoperability without reverse-engineering each other./p> p>The latter requirement in particular required that the scope of the HTML5 specification include what had previously been specified in three separate documents: HTML4, XHTML1, and DOM2 HTML. It also meant including significantly more detail than had previously been considered the norm./p> p>In 2006, the W3C indicated an interest to participate in the development of HTML5 after all, and in 2007 formed a working group chartered to work with the WHATWG on the development of the HTML5 specification. Apple, Mozilla, and Opera allowed the W3C to publish the specification under the W3C copyright, while keeping a version with the less restrictive license on the WHATWG site./p> p>For a number of years, both groups then worked together. In 2011, however, the groups came to the conclusion that they had different goals: the W3C wanted to publish a finished version of HTML5, while the WHATWG wanted to continue working on a Living Standard for HTML, continuously maintaining the specification rather than freezing it in a state with known problems, and adding new features as needed to evolve the platform./p> p>Since then, the WHATWG has been working on this specification (amongst others), and the W3C has been copying fixes made by the WHATWG into their fork of the document (which also has other changes)./p> h3 iddesign-notes>span classsecno>1.7/span> Design notesa href#design-notes classself-link>/a>/h3> p>i>This section is non-normative./i>/p> p>It must be admitted that many aspects of HTML appear at first glance to be nonsensical and inconsistent./p> p>HTML, its supporting DOM APIs, as well as many of its supporting technologies, have been developed over a period of several decades by a wide array of people with different priorities who, in many cases, did not know of each others existence./p> p>Features have thus arisen from many sources, and have not always been designed in especially consistent ways. Furthermore, because of the unique characteristics of the Web, implementation bugs have often become de-facto, and now de-jure, standards, as content is often unintentionally written in ways that rely on them before they can be fixed./p> p>Despite all this, efforts have been made to adhere to certain design goals. These are described in the next few subsections./p> h4 idserialisability-of-script-execution>span classsecno>1.7.1/span> Serializability of script executiona href#serialisability-of-script-execution classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>To avoid exposing Web authors to the complexities of multithreading, the HTML and DOM APIs are designed such that no script can ever detect the simultaneous execution of other scripts. Even with a href#worker idserialisability-of-script-execution:worker>workers/a>, the intent is that the behavior of implementations can be thought of as completely serializing the execution of all scripts in all a href#browsing-context idserialisability-of-script-execution:browsing-context>browsing contexts/a>./p> p>The exception to this general design principle is the JavaScript code idserialisability-of-script-execution:sharedarraybuffer>a data-x-internalsharedarraybuffer hrefhttps://tc39.github.io/ecma262/#sec-sharedarraybuffer-objects>SharedArrayBuffer/a>/code> class. Using code idserialisability-of-script-execution:sharedarraybuffer-2>a data-x-internalsharedarraybuffer hrefhttps://tc39.github.io/ecma262/#sec-sharedarraybuffer-objects>SharedArrayBuffer/a>/code> objects, it can in fact be observed that scripts in other a hrefhttps://tc39.github.io/ecma262/#sec-agents idserialisability-of-script-execution:agent data-x-internalagent>agents/a> are executing simultaneously. Furthermore, due to the JavaScript memory model, there are situations which not only are un-representable via serialized em>script/em> execution, but also un-representable via serialized em>statement/em> execution among those scripts./p> h4 idcompliance-with-other-specifications>span classsecno>1.7.2/span> Compliance with other specificationsa href#compliance-with-other-specifications classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>This specification interacts with and relies on a wide variety of other specifications. In certain circumstances, unfortunately, conflicting needs have led to this specification violating the requirements of these other specifications. Whenever this has occurred, the transgressions have each been noted as a dfn idwillful-violation>willful violation/dfn>, and the reason for the violation has been noted./p> h4 idextensibility>span classsecno>1.7.3/span> Extensibilitya href#extensibility classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>HTML has a wide array of extensibility mechanisms that can be used for adding semantics in a safe manner:/p> ul>li>p>Authors can use the code idextensibility:classes>a href#classes>class/a>/code> attribute to extend elements, effectively creating their own elements, while using the most applicable existing real HTML element, so that browsers and other tools that dont know of the extension can still support it somewhat well. This is the tack used by microformats, for example.li>p>Authors can include data for inline client-side scripts or server-side site-wide scripts to process using the code idextensibility:attr-data-*>a href#attr-data-*>data-*/a>/code> attributes. These are guaranteed to never be touched by browsers, and allow scripts to include data on HTML elements that scripts can then look for and process.li>p>Authors can use the code idextensibility:the-meta-element>a href#the-meta-element><meta name content>/a>/code> mechanism to include page-wide metadata.li>p>Authors can use the code idextensibility:attr-hyperlink-rel>a href#attr-hyperlink-rel>rel/a>/code> mechanism to annotate links with specific meanings by registering a href#concept-rel-extensions idextensibility:concept-rel-extensions>extensions to the predefined set of link types/a>. This is also used by microformats.li>p>Authors can embed raw data using the code idextensibility:the-script-element>a href#the-script-element><script type>/a>/code> mechanism with a custom type, for further handling by inline or server-side scripts.li>p>Authors can create a href#plugin idextensibility:plugin>plugins/a> and invoke them using the code idextensibility:the-embed-element>a href#the-embed-element>embed/a>/code> element. This is how Flash works.li>p>Authors can extend APIs using the JavaScript prototyping mechanism. This is widely used by script libraries, for instance.li>p>Authors can use the microdata feature (the code idextensibility:attr-itemscope>a href#attr-itemscope>itemscope/a>/code> and code idextensibility:names:-the-itemprop-attribute>a href#names:-the-itemprop-attribute>itemprop/a>/code> attributes) to embed nested name-value pairs of data to be shared with other applications and sites./ul> h3 idhtml-vs-xhtml>span classsecno>1.8/span> HTML vs XML syntaxa href#html-vs-xhtml classself-link>/a>/h3> p>i>This section is non-normative./i>/p> p>This specification defines an abstract language for describing documents and applications, and some APIs for interacting with in-memory representations of resources that use this language./p> p>The in-memory representation is known as DOM HTML, or the DOM for short./p> p>There are various concrete syntaxes that can be used to transmit resources that use this abstract language, two of which are defined in this specification./p> p>The first such concrete syntax is the HTML syntax. This is the format suggested for most authors. It is compatible with most legacy Web browsers. If a document is transmitted with the code idhtml-vs-xhtml:text/html>a href#text/html>text/html/a>/code> a idhtml-vs-xhtml:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a>, then it will be processed as an HTML document by Web browsers. This specification defines the latest HTML syntax, known simply as HTML./p> p>The second concrete syntax is XML. When a document is transmitted with an a idhtml-vs-xhtml:xml-mime-type hrefhttps://mimesniff.spec.whatwg.org/#xml-mime-type data-x-internalxml-mime-type>XML MIME type/a>, such as code idhtml-vs-xhtml:application/xhtml+xml>a href#application/xhtml+xml>application/xhtml+xml/a>/code>, then it is treated as an XML document by Web browsers, to be parsed by an XML processor. Authors are reminded that the processing for XML and HTML differs; in particular, even minor syntax errors will prevent a document labeled as XML from being rendered fully, whereas they would be ignored in the HTML syntax./p> p classnote>The XML syntax for HTML was formerly referred to as XHTML, but this specification does not use that term (among other reasons, because no such term is used for the HTML syntaxes of MathML and SVG)./p> p>The DOM, the HTML syntax, and the XML syntax cannot all represent the same content. For example, namespaces cannot be represented using the HTML syntax, but they are supported in the DOM and in the XML syntax. Similarly, documents that use the code idhtml-vs-xhtml:the-noscript-element>a href#the-noscript-element>noscript/a>/code> feature can be represented using the HTML syntax, but cannot be represented with the DOM or in the XML syntax. Comments that contain the string code>-->/code> can only be represented in the DOM, not in the HTML and XML syntaxes./p> h3 idstructure-of-this-specification>span classsecno>1.9/span> Structure of this specificationa href#structure-of-this-specification classself-link>/a>/h3> p>i>This section is non-normative./i>/p> p>This specification is divided into the following major sections:/p> dl>dt>a href#introduction>Introduction/a>dd>Non-normative materials providing a context for the HTML standard.dt>a href#infrastructure>Common infrastructure/a>dd>The conformance classes, algorithms, definitions, and the common underpinnings of the rest of the specification.dt>a href#dom>Semantics, structure, and APIs of HTML documents/a>dd>Documents are built from elements. These elements form a tree using the DOM. This section defines the features of this DOM, as well as introducing the features common to all elements, and the concepts used in defining elements.dt>a href#semantics>The elements of HTML/a>dd>Each element has a predefined meaning, which is explained in this section. Rules for authors on how to use the element, along with user agent requirements for how to handle each element, are also given. This includes large signature features of HTML such as video playback and subtitles, form controls and form submission, and a 2D graphics API known as the HTML canvas.dt>a href#microdata>Microdata/a>dd>This specification introduces a mechanism for adding machine-readable annotations to documents, so that tools can extract trees of name-value pairs from the document. This section describes this mechanism and some algorithms that can be used to convert HTML documents into other formats. This section also defines some sample Microdata vocabularies for contact information, calendar events, and licensing works.dt>a href#editing>User interaction/a>dd>HTML documents can provide a number of mechanisms for users to interact with and modify content, which are described in this section, such as how focus works, and drag-and-drop.dt>a href#browsers>Loading Web pages/a>dd>HTML documents do not exist in a vacuum — this section defines many of the features that affect environments that deal with multiple pages, such as Web browsers and offline caching of Web applications.dt>a href#webappapis>Web application APIs/a>dd>This section introduces basic features for scripting of applications in HTML.dt>a href#workers>Web workers/a>dd>This section defines an API for background threads in JavaScript.dt>a href#comms>The communication APIs/a>dd>This section describes some mechanisms that applications written in HTML can use to communicate with other applications from different domains running on the same client. It also introduces a server-push event stream mechanism known as Server Sent Events or code idstructure-of-this-specification:eventsource>a href#eventsource>EventSource/a>/code>, and a two-way full-duplex socket protocol for scripts known as Web Sockets. dt>a href#webstorage>Web storage/a>dd>This section defines a client-side storage mechanism based on name-value pairs.dt>a href#syntax>The HTML syntax/a>dt>a href#xhtml>The XML syntax/a>dd>All of these features would be for naught if they couldnt be represented in a serialized form and sent to other people, and so these sections define the syntaxes of HTML and XML, along with rules for how to parse content using those syntaxes.dt>a href#rendering>Rendering/a>dd>This section defines the default rendering rules for Web browsers./dl> p>There are also some appendices, listing a href#obsolete>obsolete features/a> and a href#iana>IANA considerations/a>, and several indices./p> h4 idhow-to-read-this-specification>span classsecno>1.9.1/span> How to read this specificationa href#how-to-read-this-specification classself-link>/a>/h4> p>This specification should be read like all other specifications. First, it should be read cover-to-cover, multiple times. Then, it should be read backwards at least once. Then it should be read by picking random sections from the contents list and following all the cross-references./p> p>As described in the conformance requirements section below, this specification describes conformance criteria for a variety of conformance classes. In particular, there are conformance requirements that apply to em>producers/em>, for example authors and the documents they create, and there are conformance requirements that apply to em>consumers/em>, for example Web browsers. They can be distinguished by what they are requiring: a requirement on a producer states what is allowed, while a requirement on a consumer states how software is to act./p> div classexample> p>For example, the code>foo/code> attributes value must be a a href#valid-integer idhow-to-read-this-specification:valid-integer>valid integer/a> is a requirement on producers, as it lays out the allowed values; in contrast, the requirement the code>foo/code> attributes value must be parsed using the a href#rules-for-parsing-integers idhow-to-read-this-specification:rules-for-parsing-integers>rules for parsing integers/a> is a requirement on consumers, as it describes how to process the content./p> /div> p>strong>Requirements on producers have no bearing whatsoever on consumers./strong>/p> div classexample> p>Continuing the above example, a requirement stating that a particular attributes value is constrained to being a a href#valid-integer idhow-to-read-this-specification:valid-integer-2>valid integer/a> emphatically does em>not/em> imply anything about the requirements on consumers. It might be that the consumers are in fact required to treat the attribute as an opaque string, completely unaffected by whether the value conforms to the requirements or not. It might be (as in the previous example) that the consumers are required to parse the value using specific rules that define how invalid (non-numeric in this case) values are to be processed./p> /div> h4 idtypographic-conventions>span classsecno>1.9.2/span> Typographic conventionsa href#typographic-conventions classself-link>/a>/h4> p>This is a definition, requirement, or explanation./p> p classnote>This is a note./p> p classexample>This is an example./p> p classXXX>This is an open issue./p> p classwarning>This is a warning./p> pre classidl extract>ExposedWindowinterface dfn>Example/dfn> { // this is an IDL definition};/pre> dl classdomintro>dt>var>variable/var> var>object/var> . code idtypographic-conventions:x-that>a href#x-that>method/a>/code>( var>optionalArgument/var> )dd> p>This is a note to authors describing the usage of an interface./p> /dl> pre classcss>/* this is a CSS fragment *//pre> p>The defining instance of a term is marked up like dfn idx-this>this/dfn>. Uses of that term are marked up like a href#x-this idtypographic-conventions:x-this>this/a> or like i idtypographic-conventions:x-this-2>a href#x-this>this/a>/i>./p> p>The defining instance of an element, attribute, or API is marked up like dfn idx-that>code>this/code>/dfn>. References to that element, attribute, or API are marked up like code idtypographic-conventions:x-that-2>a href#x-that>this/a>/code>./p> p>Other code fragments are marked up code>like this/code>./p> p>Variables are marked up like var>this/var>./p> p>In an algorithm, steps in a href#synchronous-section idtypographic-conventions:synchronous-section>synchronous sections/a> are marked with ⌛./p> p>In some cases, requirements are given in the form of lists with conditions and corresponding requirements. In such cases, the requirements that apply to a condition are always the first set of requirements that follow the condition, even in the case of there being multiple sets of conditions for those requirements. Such cases are presented as follows:/p> dl classswitch>dt>This is a condition dt>This is another condition dd>This is the requirement that applies to the conditions above. dt>This is a third condition dd>This is the requirement that applies to the third condition. /dl> h3 idfingerprint>span classsecno>1.10/span> Privacy concernsa href#fingerprint classself-link>/a>/h3> p>i>This section is non-normative./i>/p> p>Some features of HTML trade user convenience for a measure of user privacy./p> p>In general, due to the Internets architecture, a user can be distinguished from another by the users IP address. IP addresses do not perfectly match to a user; as a user moves from device to device, or from network to network, their IP address will change; similarly, NAT routing, proxy servers, and shared computers enable packets that appear to all come from a single IP address to actually map to multiple users. Technologies such as onion routing can be used to further anonymize requests so that requests from a single user at one node on the Internet appear to come from many disparate parts of the network./p> p>However, the IP address used for a users requests is not the only mechanism by which a users requests could be related to each other. Cookies, for example, are designed specifically to enable this, and are the basis of most of the Webs session features that enable you to log into a site with which you have an account./p> p>There are other mechanisms that are more subtle. Certain characteristics of a users system can be used to distinguish groups of users from each other; by collecting enough such information, an individual users browsers digital fingerprint can be computed, which can be as good, if not better, as an IP address in ascertaining which requests are from the same user./p> p>Grouping requests in this manner, especially across multiple sites, can be used for both benign (and even arguably positive) purposes, as well as for malevolent purposes. An example of a reasonably benign purpose would be determining whether a particular person seems to prefer sites with dog illustrations as opposed to sites with cat illustrations (based on how often they visit the sites in question) and then automatically using the preferred illustrations on subsequent visits to participating sites. Malevolent purposes, however, could include governments combining information such as the persons home address (determined from the addresses they use when getting driving directions on one site) with their apparent political affiliations (determined by examining the forum sites that they participate in) to determine whether the person should be prevented from voting in an election./p> p>Since the malevolent purposes can be remarkably evil, user agent implementors are encouraged to consider how to provide their users with tools to minimize leaking information that could be used to fingerprint a user./p> p>Unfortunately, as the first paragraph in this section implies, sometimes there is great benefit to be derived from exposing the very information that can also be used for fingerprinting purposes, so its not as easy as simply blocking all possible leaks. For instance, the ability to log into a site to post under a specific identity requires that the users requests be identifiable as all being from the same user, more or less by definition. More subtly, though, information such as how wide text is, which is necessary for many effects that involve drawing text onto a canvas (e.g. any effect that involves drawing a border around the text) also leaks information that can be used to group a users requests. (In this case, by potentially exposing, via a brute force search, which fonts a user has installed, information which can vary considerably from user to user.)/p> p>Features in this specification which can be dfn idfingerprinting-vector>used to fingerprint the user/dfn> are marked as this paragraph is. a href#fingerprinting-vector idfingerprint:fingerprinting-vector classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> p>Other features in the platform can be used for the same purpose, though, including, though not limited to:/p> ul>li>The exact list of which features a user agents supports.li>The maximum allowed stack depth for recursion in script.li>Features that describe the users environment, like Media Queries and the code idfingerprint:screen>a data-x-internalscreen hrefhttps://drafts.csswg.org/cssom-view/#the-screen-interface>Screen/a>/code> object. a href#refsMQ>MQ/a> a href#refsCSSOMVIEW>CSSOMVIEW/a>li>The users time zone./ul> h4 idfingerprint-postMessage>span classsecno>1.10.1/span> Cross-site communicationa href#fingerprint-postMessage classself-link>/a>/h4> p>The code idfingerprint-postMessage:dom-window-postmessage>a href#dom-window-postmessage>postMessage()/a>/code> API provides a mechanism by which two sites can communicate directly. At first glance, this might appear to open a new way by which the problems described above can occur. However, in practice, multiple mechanisms exist by which two sites can communicate that predate this API: a site embedding another can send data via an code idfingerprint-postMessage:the-iframe-element>a href#the-iframe-element>iframe/a>/code> elements dimensions; a site can use a cross-site image request with a unique identifier known to the server to initiate a server-side data exchange; or indeed the fingerprinting techniques described above can be used by two sites to uniquely identify a visitor such that information can then be exchanged on the server side./p> p>Fundamentally, users that do not trust a site to treat their information with respect have to avoid visiting that site at all./p> h3 ida-quick-introduction-to-html>span classsecno>1.11/span> A quick introduction to HTMLa href#a-quick-introduction-to-html classself-link>/a>/h3> p>i>This section is non-normative./i>/p> p>A basic HTML document looks like this:/p> pre idintro-early-example><!DOCTYPE html><html langen> <head> <title>Sample page</title> </head> <body> <h1>Sample page</h1> <p>This is a <a hrefdemo.html>simple</a> sample.</p> <!-- this is a comment --> </body></html>/pre> p>HTML documents consist of a tree of elements and text. Each element is denoted in the source by a a href#syntax-start-tag ida-quick-introduction-to-html:syntax-start-tag>start tag/a>, such as code><body>/code>, and an a href#syntax-end-tag ida-quick-introduction-to-html:syntax-end-tag>end tag/a>, such as code></body>/code>. (Certain start tags and end tags can in certain cases be a href#syntax-tag-omission ida-quick-introduction-to-html:syntax-tag-omission>omitted/a> and are implied by other tags.)/p> p>Tags have to be nested such that elements are all completely within each other, without overlapping:/p> pre classbad><p>This is <em>very <strong>wrong</em>!</strong></p>/pre> pre><p>This <em>is <strong>correct</strong>.</em></p>/pre> p>This specification defines a set of elements that can be used in HTML, along with rules about the ways in which the elements can be nested./p> p>Elements can have attributes, which control how the elements work. In the example below, there is a a href#hyperlink ida-quick-introduction-to-html:hyperlink>hyperlink/a>, formed using the code ida-quick-introduction-to-html:the-a-element>a href#the-a-element>a/a>/code> element and its code ida-quick-introduction-to-html:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute:/p> pre><a hrefdemo.html>simple</a>/pre> p>a href#syntax-attributes ida-quick-introduction-to-html:syntax-attributes>Attributes/a> are placed inside the start tag, and consist of a a href#syntax-attribute-name ida-quick-introduction-to-html:syntax-attribute-name>name/a> and a a href#syntax-attribute-value ida-quick-introduction-to-html:syntax-attribute-value>value/a>, separated by an code>/code> character. The attribute value can remain a href#unquoted>unquoted/a> if it doesnt contain a ida-quick-introduction-to-html:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> or any of code>/code> code>/code> code>`/code> code>/code> code></code> or code>>/code>. Otherwise, it has to be quoted using either single or double quotes. The value, along with the code>/code> character, can be omitted altogether if the value is the empty string./p> pre><!-- empty attributes --><input nameaddress disabled><input nameaddress disabled><!-- attributes with a value --><input nameaddress maxlength200><input nameaddress maxlength200><input nameaddress maxlength200>/pre> p>HTML user agents (e.g. Web browsers) then i>parse/i> this markup, turning it into a DOM (Document Object Model) tree. A DOM tree is an in-memory representation of a document./p> p>DOM trees contain several kinds of nodes, in particular a code ida-quick-introduction-to-html:documenttype>a data-x-internaldocumenttype hrefhttps://dom.spec.whatwg.org/#interface-documenttype>DocumentType/a>/code> node, code ida-quick-introduction-to-html:element>a data-x-internalelement hrefhttps://dom.spec.whatwg.org/#interface-element>Element/a>/code> nodes, code ida-quick-introduction-to-html:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes, code ida-quick-introduction-to-html:comment-2>a data-x-internalcomment-2 hrefhttps://dom.spec.whatwg.org/#interface-comment>Comment/a>/code> nodes, and in some cases code ida-quick-introduction-to-html:processinginstruction>a data-x-internalprocessinginstruction hrefhttps://dom.spec.whatwg.org/#interface-processinginstruction>ProcessingInstruction/a>/code> nodes./p> p>The a href#intro-early-example>markup snippet at the top of this section/a> would be turned into the following DOM tree:/p> ul classdomTree>li classt10>DOCTYPE: code>html/code>li classt1>code ida-quick-introduction-to-html:the-html-element>a href#the-html-element>html/a>/code> span classt2>code ida-quick-introduction-to-html:attr-lang classattribute name>a href#attr-lang>lang/a>/code>code classattribute value>en/code>/span>ul>li classt1>code ida-quick-introduction-to-html:the-head-element>a href#the-head-element>head/a>/code>ul>li classt3>code ida-quick-introduction-to-html:text-2>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>⏎␣␣/span>li classt1>code ida-quick-introduction-to-html:the-title-element>a href#the-title-element>title/a>/code>ul>li classt3>code ida-quick-introduction-to-html:text-3>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>Sample page/span>/ul>li classt3>code ida-quick-introduction-to-html:text-4>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>⏎␣/span>/ul>li classt3>code ida-quick-introduction-to-html:text-5>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>⏎␣/span>li classt1>code ida-quick-introduction-to-html:the-body-element>a href#the-body-element>body/a>/code>ul>li classt3>code ida-quick-introduction-to-html:text-6>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>⏎␣␣/span>li classt1>code ida-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 classt3>code ida-quick-introduction-to-html:text-7>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>Sample page/span>/ul>li classt3>code ida-quick-introduction-to-html:text-8>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>⏎␣␣/span>li classt1>code ida-quick-introduction-to-html:the-p-element>a href#the-p-element>p/a>/code>ul>li classt3>code ida-quick-introduction-to-html:text-9>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>This is a /span>li classt1>code ida-quick-introduction-to-html:the-a-element-2>a href#the-a-element>a/a>/code> span classt2>code ida-quick-introduction-to-html:attr-hyperlink-href-2 classattribute name>a href#attr-hyperlink-href>href/a>/code>code classattribute value>demo.html/code>/span>ul>li classt3>code ida-quick-introduction-to-html:text-10>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>simple/span>/ul>li classt3>code ida-quick-introduction-to-html:text-11>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span> sample./span>/ul>li classt3>code ida-quick-introduction-to-html:text-12>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>⏎␣␣/span>li classt8>code ida-quick-introduction-to-html:comment-2-2>a data-x-internalcomment-2 hrefhttps://dom.spec.whatwg.org/#interface-comment>#comment/a>/code>: span> this is a comment /span>li classt3>code ida-quick-introduction-to-html:text-13>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>⏎␣⏎/span>/ul>/ul>/ul> p>The a ida-quick-introduction-to-html:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> of this tree is the code ida-quick-introduction-to-html:the-html-element-2>a href#the-html-element>html/a>/code> element, which is the element always found in that position in HTML documents. It contains two elements, code ida-quick-introduction-to-html:the-head-element-2>a href#the-head-element>head/a>/code> and code ida-quick-introduction-to-html:the-body-element-2>a href#the-body-element>body/a>/code>, as well as a code ida-quick-introduction-to-html:text-14>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node between them./p> p>There are many more code ida-quick-introduction-to-html:text-15>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes in the DOM tree than one would initially expect, because the source contains a number of spaces (represented here by ␣) and line breaks (⏎) that all end up as code ida-quick-introduction-to-html:text-16>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes in the DOM. However, for historical reasons not all of the spaces and line breaks in the original markup appear in the DOM. In particular, all the whitespace before code ida-quick-introduction-to-html:the-head-element-3>a href#the-head-element>head/a>/code> start tag ends up being dropped silently, and all the whitespace after the code ida-quick-introduction-to-html:the-body-element-3>a href#the-body-element>body/a>/code> end tag ends up placed at the end of the code ida-quick-introduction-to-html:the-body-element-4>a href#the-body-element>body/a>/code>./p> p>The code ida-quick-introduction-to-html:the-head-element-4>a href#the-head-element>head/a>/code> element contains a code ida-quick-introduction-to-html:the-title-element-2>a href#the-title-element>title/a>/code> element, which itself contains a code ida-quick-introduction-to-html:text-17>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node with the text Sample page. Similarly, the code ida-quick-introduction-to-html:the-body-element-5>a href#the-body-element>body/a>/code> element contains an code ida-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 ida-quick-introduction-to-html:the-p-element-2>a href#the-p-element>p/a>/code> element, and a comment./p> hr> p>This DOM tree can be manipulated from scripts in the page. Scripts (typically in JavaScript) are small programs that can be embedded using the code ida-quick-introduction-to-html:the-script-element>a href#the-script-element>script/a>/code> element or using a href#event-handler-content-attributes ida-quick-introduction-to-html:event-handler-content-attributes>event handler content attributes/a>. For example, here is a form with a script that sets the value of the forms code ida-quick-introduction-to-html:the-output-element>a href#the-output-element>output/a>/code> element to say Hello World:/p> pre><a href#the-form-element ida-quick-introduction-to-html:the-form-element>form/a> a href#attr-form-name ida-quick-introduction-to-html:attr-form-name>name/a>main> Result: <a href#the-output-element ida-quick-introduction-to-html:the-output-element-2>output/a> a href#attr-fe-name ida-quick-introduction-to-html:attr-fe-name>name/a>result></output> <a href#the-script-element ida-quick-introduction-to-html:the-script-element-2>script/a>> a href#document ida-quick-introduction-to-html:document>document/a>.a href#dom-document-forms ida-quick-introduction-to-html:dom-document-forms>forms/a>.main.a href#dom-form-elements ida-quick-introduction-to-html:dom-form-elements>elements/a>.result.a href#dom-output-value ida-quick-introduction-to-html:dom-output-value>value/a> Hello World; </script></form>/pre> p>Each element in the DOM tree is represented by an object, and these objects have APIs so that they can be manipulated. For instance, a link (e.g. the code ida-quick-introduction-to-html:the-a-element-3>a href#the-a-element>a/a>/code> element in the tree above) can have its code ida-quick-introduction-to-html:attr-hyperlink-href-3>a href#attr-hyperlink-href>href/a>/code> attribute changed in several ways:/p> pre>var a a href#document ida-quick-introduction-to-html:document-2>document/a>.a href#dom-document-links ida-quick-introduction-to-html:dom-document-links>links/a>0; // obtain the first link in the documenta.a href#dom-hyperlink-href ida-quick-introduction-to-html:dom-hyperlink-href>href/a> sample.html; // change the destination URL of the linka.a href#dom-hyperlink-protocol ida-quick-introduction-to-html:dom-hyperlink-protocol>protocol/a> https; // change just the scheme part of the URLa.setAttribute(href, https://example.com/); // change the content attribute directly/pre> p>Since DOM trees are used as the way to represent HTML documents when they are processed and presented by implementations (especially interactive implementations like Web browsers), this specification is mostly phrased in terms of DOM trees, instead of the markup described above./p> hr> p>HTML documents represent a media-independent description of interactive content. HTML documents might be rendered to a screen, or through a speech synthesizer, or on a braille display. To influence exactly how such rendering takes place, authors can use a styling language such as CSS./p> p>In the following example, the page has been made yellow-on-blue using CSS./p> pre><!DOCTYPE html><html langen> <head> <title>Sample styled page</title> <style> body { background: navy; color: yellow; } </style> </head> <body> <h1>Sample styled page</h1> <p>This page is just a demo.</p> </body></html>/pre> p>For more details on how to use HTML, authors are encouraged to consult tutorials and guides. Some of the examples included in this specification might also be of use, but the novice author is cautioned that this specification, by necessity, defines the language with a level of detail that might be difficult to understand at first./p> h4 idwriting-secure-applications-with-html>span classsecno>1.11.1/span> Writing secure applications with HTMLa href#writing-secure-applications-with-html classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>When HTML is used to create interactive sites, care needs to be taken to avoid introducing vulnerabilities through which attackers can compromise the integrity of the site itself or of the sites users./p> p>A comprehensive study of this matter is beyond the scope of this document, and authors are strongly encouraged to study the matter in more detail. However, this section attempts to provide a quick introduction to some common pitfalls in HTML application development./p> p>The security model of the Web is based on the concept of origins, and correspondingly many of the potential attacks on the Web involve cross-origin actions. a href#refsORIGIN>ORIGIN/a>/p> dl>dt>Not validating user inputdt>Cross-site scripting (XSS)dt>SQL injectiondd> p>When accepting untrusted input, e.g. user-generated content such as text comments, values in URL parameters, messages from third-party sites, etc, it is imperative that the data be validated before use, and properly escaped when displayed. Failing to do this can allow a hostile user to perform a variety of attacks, ranging from the potentially benign, such as providing bogus user information like a negative age, to the serious, such as running scripts every time a user looks at a page that includes the information, potentially propagating the attack in the process, to the catastrophic, such as deleting all data in the server./p> p>When writing filters to validate user input, it is imperative that filters always be safelist-based, allowing known-safe constructs and disallowing all other input. Blocklist-based filters that disallow known-bad inputs and allow everything else are not secure, as not everything that is bad is yet known (for example, because it might be invented in the future)./p> div classexample> p>For example, suppose a page looked at its URLs query string to determine what to display, and the site then redirected the user to that page to display a message, as in:/p> pre><ul> <li><a hrefmessage.cgi?sayHello>Say Hello</a> <li><a hrefmessage.cgi?sayWelcome>Say Welcome</a> <li><a hrefmessage.cgi?sayKittens>Say Kittens</a></ul>/pre> p>If the message was just displayed to the user without escaping, a hostile attacker could then craft a URL that contained a script element:/p> pre>https://example.com/message.cgi?say%3Cscript%3Ealert%28%27Oh%20no%21%27%29%3C/script%3E/pre> p>If the attacker then convinced a victim user to visit this page, a script of the attackers choosing would run on the page. Such a script could do any number of hostile actions, limited only by what the site offers: if the site is an e-commerce shop, for instance, such a script could cause the user to unknowingly make arbitrarily many unwanted purchases./p> p>This is called a cross-site scripting attack./p> /div> p>There are many constructs that can be used to try to trick a site into executing code. Here are some that authors are encouraged to consider when writing safelist filters:/p> ul>li>When allowing harmless-seeming elements like code idwriting-secure-applications-with-html:the-img-element>a href#the-img-element>img/a>/code>, it is important to safelist any provided attributes as well. If one allowed all attributes then an attacker could, for instance, use the code idwriting-secure-applications-with-html:handler-onload>a href#handler-onload>onload/a>/code> attribute to run arbitrary script.li>When allowing URLs to be provided (e.g. for links), the scheme of each URL also needs to be explicitly safelisted, as there are many schemes that can be abused. The most prominent example is code idwriting-secure-applications-with-html:javascript-protocol>a href#javascript-protocol>javascript:/a>/code>, but user agents can implement (and indeed, have historically implemented) others.li>Allowing a code idwriting-secure-applications-with-html:the-base-element>a href#the-base-element>base/a>/code> element to be inserted means any code idwriting-secure-applications-with-html:the-script-element>a href#the-script-element>script/a>/code> elements in the page with relative links can be hijacked, and similarly that any form submissions can get redirected to a hostile site./ul> dt>Cross-site request forgery (CSRF)dd> p>If a site allows a user to make form submissions with user-specific side-effects, for example posting messages on a forum under the users name, making purchases, or applying for a passport, it is important to verify that the request was made by the user intentionally, rather than by another site tricking the user into making the request unknowingly./p> p>This problem exists because HTML forms can be submitted to other origins./p> p>Sites can prevent such attacks by populating forms with user-specific hidden tokens, or by checking `code idwriting-secure-applications-with-html:http-origin>a data-x-internalhttp-origin hrefhttps://fetch.spec.whatwg.org/#http-origin>Origin/a>/code>` headers on all requests./p> dt>Clickjackingdd> p>A page that provides users with an interface to perform actions that the user might not wish to perform needs to be designed so as to avoid the possibility that users can be tricked into activating the interface./p> p>One way that a user could be so tricked is if a hostile site places the victim site in a small code idwriting-secure-applications-with-html:the-iframe-element>a href#the-iframe-element>iframe/a>/code> and then convinces the user to click, for instance by having the user play a reaction game. Once the user is playing the game, the hostile site can quickly position the iframe under the mouse cursor just as the user is about to click, thus tricking the user into clicking the victim sites interface./p> p>To avoid this, sites that do not expect to be used in frames are encouraged to only enable their interface if they detect that they are not in a frame (e.g. by comparing the code idwriting-secure-applications-with-html:dom-window>a href#dom-window>window/a>/code> object to the value of the code idwriting-secure-applications-with-html:dom-top>a href#dom-top>top/a>/code> attribute)./p> /dl> h4 idcommon-pitfalls-to-avoid-when-using-the-scripting-apis>span classsecno>1.11.2/span> Common pitfalls to avoid when using the scripting APIsa href#common-pitfalls-to-avoid-when-using-the-scripting-apis classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>Scripts in HTML have run-to-completion semantics, meaning that the browser will generally run the script uninterrupted before doing anything else, such as firing further events or continuing to parse the document./p> p>On the other hand, parsing of HTML files happens incrementally, meaning that the parser can pause at any point to let scripts run. This is generally a good thing, but it does mean that authors need to be careful to avoid hooking event handlers after the events could have possibly fired./p> p>There are two techniques for doing this reliably: use a href#event-handler-content-attributes idcommon-pitfalls-to-avoid-when-using-the-scripting-apis:event-handler-content-attributes>event handler content attributes/a>, or create the element and add the event handlers in the same script. The latter is safe because, as mentioned earlier, scripts are run to completion before further events can fire./p> div classexample> p>One way this could manifest itself is with code idcommon-pitfalls-to-avoid-when-using-the-scripting-apis:the-img-element>a href#the-img-element>img/a>/code> elements and the code idcommon-pitfalls-to-avoid-when-using-the-scripting-apis:event-load>a href#event-load>load/a>/code> event. The event could fire as soon as the element has been parsed, especially if the image has already been cached (which is common)./p> p>Here, the author uses the code idcommon-pitfalls-to-avoid-when-using-the-scripting-apis:handler-onload>a href#handler-onload>onload/a>/code> handler on an code idcommon-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 idcommon-pitfalls-to-avoid-when-using-the-scripting-apis:event-load-2>a href#event-load>load/a>/code> event:/p> pre><img srcgames.png altGames onloadgamesLogoHasLoaded(event)>/pre> p>If the element is being added by script, then so long as the event handlers are added in the same script, the event will still not be missed:/p> pre><script> var img new Image(); img.src games.png; img.alt Games; img.onload gamesLogoHasLoaded; // img.addEventListener(load, gamesLogoHasLoaded, false); // would work also</script>/pre> p>However, if the author first created the code idcommon-pitfalls-to-avoid-when-using-the-scripting-apis:the-img-element-3>a href#the-img-element>img/a>/code> element and then in a separate script added the event listeners, theres a chance that the code idcommon-pitfalls-to-avoid-when-using-the-scripting-apis:event-load-3>a href#event-load>load/a>/code> event would be fired in between, leading it to be missed:/p> pre classbad><!-- Do not use this style, it has a race condition! --> <img idgames srcgames.png altGames> <!-- the load event might fire here while the parser is taking a break, in which case you will not see it! --> <script> var img document.getElementById(games); img.onload gamesLogoHasLoaded; // might never fire! </script>/pre> /div> h4 idhow-to-catch-mistakes-when-writing-html:-validators-and-conformance-checkers>span classsecno>1.11.3/span> How to catch mistakes when writing HTML: validators and conformance checkersa href#how-to-catch-mistakes-when-writing-html:-validators-and-conformance-checkers classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>Authors are encouraged to make use of conformance checkers (also known as i>validators/i>) to catch common mistakes. The WHATWG maintains a list of such tools at: a hrefhttps://whatwg.org/validator/>https://whatwg.org/validator//a>/p> h3 idconformance-requirements-for-authors>span classsecno>1.12/span> Conformance requirements for authorsa href#conformance-requirements-for-authors classself-link>/a>/h3> p>i>This section is non-normative./i>/p> p>Unlike previous versions of the HTML specification, this specification defines in some detail the required processing for invalid documents as well as valid documents./p> p>However, even though the processing of invalid content is in most cases well-defined, conformance requirements for documents are still important: in practice, interoperability (the situation in which all implementations process particular content in a reliable and identical or equivalent way) is not the only goal of document conformance requirements. This section details some of the more common reasons for still distinguishing between a conforming document and one with errors./p> h4 idpresentational-markup>span classsecno>1.12.1/span> Presentational markupa href#presentational-markup classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>The majority of presentational features from previous versions of HTML are no longer allowed. Presentational markup in general has been found to have a number of problems:/p> dl>dt>The use of presentational elements leads to poorer accessibilitydd> p>While it is possible to use presentational markup in a way that provides users of assistive technologies (ATs) with an acceptable experience (e.g. using ARIA), doing so is significantly more difficult than doing so when using semantically-appropriate markup. Furthermore, even using such techniques doesnt help make pages accessible for non-AT non-graphical users, such as users of text-mode browsers./p> p>Using media-independent markup, on the other hand, provides an easy way for documents to be authored in such a way that they work for more users (e.g. users of text browsers)./p> dt>Higher cost of maintenancedd> p>It is significantly easier to maintain a site written in such a way that the markup is style-independent. For example, changing the color of a site that uses code><font color>/code> throughout requires changes across the entire site, whereas a similar change to a site based on CSS can be done by changing a single file./p> dt>Larger document sizesdd> p>Presentational markup tends to be much more redundant, and thus results in larger document sizes./p> /dl> p>For those reasons, presentational markup has been removed from HTML in this version. This change should not come as a surprise; HTML4 deprecated presentational markup many years ago and provided a mode (HTML4 Transitional) to help authors move away from presentational markup; later, XHTML 1.1 went further and obsoleted those features altogether./p> p>The only remaining presentational markup features in HTML are the code idpresentational-markup:the-style-attribute>a href#the-style-attribute>style/a>/code> attribute and the code idpresentational-markup:the-style-element>a href#the-style-element>style/a>/code> element. Use of the code idpresentational-markup:the-style-attribute-2>a href#the-style-attribute>style/a>/code> attribute is somewhat discouraged in production environments, but it can be useful for rapid prototyping (where its rules can be directly moved into a separate style sheet later) and for providing specific styles in unusual cases where a separate style sheet would be inconvenient. Similarly, the code idpresentational-markup:the-style-element-2>a href#the-style-element>style/a>/code> element can be useful in syndication or for page-specific styles, but in general an external style sheet is likely to be more convenient when the styles apply to multiple pages./p> p>It is also worth noting that some elements that were previously presentational have been redefined in this specification to be media-independent: code idpresentational-markup:the-b-element>a href#the-b-element>b/a>/code>, code idpresentational-markup:the-i-element>a href#the-i-element>i/a>/code>, code idpresentational-markup:the-hr-element>a href#the-hr-element>hr/a>/code>, code idpresentational-markup:the-s-element>a href#the-s-element>s/a>/code>, code idpresentational-markup:the-small-element>a href#the-small-element>small/a>/code>, and code idpresentational-markup:the-u-element>a href#the-u-element>u/a>/code>./p> h4 idsyntax-errors>span classsecno>1.12.2/span> Syntax errorsa href#syntax-errors classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>The syntax of HTML is constrained to avoid a wide variety of problems./p> dl>dt>Unintuitive error-handling behaviordd> p>Certain invalid syntax constructs, when parsed, result in DOM trees that are highly unintuitive./p> div classexample> p>For example, the following markup fragment results in a DOM with an code idsyntax-errors:the-hr-element>a href#the-hr-element>hr/a>/code> element that is an em>earlier/em> sibling of the corresponding code idsyntax-errors:the-table-element>a href#the-table-element>table/a>/code> element:/p> pre classbad><table><hr>.../pre> /div> dt>Errors with optional error recoverydd> p>To allow user agents to be used in controlled environments without having to implement the more bizarre and convoluted error handling rules, user agents are permitted to fail whenever encountering a a href#parse-errors idsyntax-errors:parse-errors>parse error/a>./p> dt>Errors where the error-handling behavior is not compatible with streaming user agentsdd> p>Some error-handling behavior, such as the behavior for the code><table><hr>.../code> example mentioned above, are incompatible with streaming user agents (user agents that process HTML files in one pass, without storing state). To avoid interoperability problems with such user agents, any syntax resulting in such behavior is considered invalid./p> dt>Errors that can result in infoset coerciondd> p>When a user agent based on XML is connected to an HTML parser, it is possible that certain invariants that XML enforces, such as element or attribute names never contain multiple colons, will be violated by an HTML file. Handling this can require that the parser coerce the HTML DOM into an XML-compatible infoset. Most syntax constructs that require such handling are considered invalid. (Comments containing two consecutive hyphens, or ending with a hyphen, are exceptions that are allowed in the HTML syntax.)/p> dt>Errors that result in disproportionately poor performancedd> p>Certain syntax constructs can result in disproportionately poor performance. To discourage the use of such constructs, they are typically made non-conforming./p> div classexample> p>For example, the following markup results in poor performance, since all the unclosed code idsyntax-errors:the-i-element>a href#the-i-element>i/a>/code> elements have to be reconstructed in each paragraph, resulting in progressively more elements in each paragraph:/p> pre classbad><p><i>She dreamt.<p><i>She dreamt that she ate breakfast.<p><i>Then lunch.<p><i>And finally dinner./pre> p>The resulting DOM for this fragment would be:/p> ul classdomTree>li classt1>code idsyntax-errors:the-p-element>a href#the-p-element>p/a>/code>ul>li classt1>code idsyntax-errors:the-i-element-2>a href#the-i-element>i/a>/code>ul>li classt3>code idsyntax-errors:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>She dreamt./span>/ul>/ul>li classt1>code idsyntax-errors:the-p-element-2>a href#the-p-element>p/a>/code>ul>li classt1>code idsyntax-errors:the-i-element-3>a href#the-i-element>i/a>/code>ul>li classt1>code idsyntax-errors:the-i-element-4>a href#the-i-element>i/a>/code>ul>li classt3>code idsyntax-errors:text-2>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>She dreamt that she ate breakfast./span>/ul>/ul>/ul>li classt1>code idsyntax-errors:the-p-element-3>a href#the-p-element>p/a>/code>ul>li classt1>code idsyntax-errors:the-i-element-5>a href#the-i-element>i/a>/code>ul>li classt1>code idsyntax-errors:the-i-element-6>a href#the-i-element>i/a>/code>ul>li classt1>code idsyntax-errors:the-i-element-7>a href#the-i-element>i/a>/code>ul>li classt3>code idsyntax-errors:text-3>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>Then lunch./span>/ul>/ul>/ul>/ul>li classt1>code idsyntax-errors:the-p-element-4>a href#the-p-element>p/a>/code>ul>li classt1>code idsyntax-errors:the-i-element-8>a href#the-i-element>i/a>/code>ul>li classt1>code idsyntax-errors:the-i-element-9>a href#the-i-element>i/a>/code>ul>li classt1>code idsyntax-errors:the-i-element-10>a href#the-i-element>i/a>/code>ul>li classt1>code idsyntax-errors:the-i-element-11>a href#the-i-element>i/a>/code>ul>li classt3>code idsyntax-errors:text-4>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>And finally dinner./span>/ul>/ul>/ul>/ul>/ul>/ul> /div> dt>Errors involving fragile syntax constructsdd> p>There are syntax constructs that, for historical reasons, are relatively fragile. To help reduce the number of users who accidentally run into such problems, they are made non-conforming./p> div classexample> p>For example, the parsing of certain named character references in attributes happens even with the closing semicolon being omitted. It is safe to include an ampersand followed by letters that do not form a named character reference, but if the letters are changed to a string that em>does/em> form a named character reference, they will be interpreted as that character instead./p> p>In this fragment, the attributes value is code>?bill&ted/code>:/p> pre classbad><a href?bill&ted>Bill and Ted</a>/pre> p>In the following fragment, however, the attributes value is actually code>?art©/code>, em>not/em> the intended code>?art©/code>, because even without the final semicolon, code>©/code> is handled the same as code>©/code> and thus gets interpreted as code>©/code>:/p> pre classbad><a href?art©>Art and Copy</a>/pre> p>To avoid this problem, all named character references are required to end with a semicolon, and uses of named character references without a semicolon are flagged as errors./p> p>Thus, the correct way to express the above cases is as follows:/p> pre><a href?bill&ted>Bill and Ted</a> <!-- &ted is ok, since its not a named character reference -->/pre> pre><a href?art&copy>Art and Copy</a> <!-- the & has to be escaped, since © em>is/em> a named character reference -->/pre> /div> dt>Errors involving known interoperability problems in legacy user agentsdd> p>Certain syntax constructs are known to cause especially subtle or serious problems in legacy user agents, and are therefore marked as non-conforming to help authors avoid them./p> div classexample> p>For example, this is why the U+0060 GRAVE ACCENT character (`) is not allowed in unquoted attributes. In certain legacy user agents, it is sometimes treated as a quote character./p> /div> div classexample> p>Another example of this is the DOCTYPE, which is required to trigger a idsyntax-errors:no-quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-no-quirks data-x-internalno-quirks-mode>no-quirks mode/a>, because the behavior of legacy user agents in a idsyntax-errors:quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a> is often largely undocumented./p> /div> dt>Errors that risk exposing authors to security attacksdd> p>Certain restrictions exist purely to avoid known security problems./p> div classexample> p>For example, the restriction on using UTF-7 exists purely to avoid authors falling prey to a known cross-site-scripting attack using UTF-7. a href#refsUTF7>UTF7/a>/p> /div> dt>Cases where the authors intent is uncleardd> p>Markup where the authors intent is very unclear is often made non-conforming. Correcting these errors early makes later maintenance easier./p> div classexample> p>For example, it is unclear whether the author intended the following to be an code idsyntax-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 idsyntax-errors:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2/a>/code> heading:/p> pre classbad><h1>Contact details</h2>/pre> /div> dt>Cases that are likely to be typosdd> p>When a user makes a simple typo, it is helpful if the error can be caught early, as this can save the author a lot of debugging time. This specification therefore usually considers it an error to use element names, attribute names, and so forth, that do not match the names defined in this specification./p> div classexample> p>For example, if the author typed code><capton>/code> instead of code><caption>/code>, this would be flagged as an error and the author could correct the typo immediately./p> /div> dt>Errors that could interfere with new syntax in the futuredd> p>In order to allow the language syntax to be extended in the future, certain otherwise harmless features are disallowed./p> div classexample> p>For example, attributes in end tags are ignored currently, but they are invalid, in case a future change to the language makes use of that syntax feature without conflicting with already-deployed (and valid!) content./p> /div> /dl> p>Some authors find it helpful to be in the practice of always quoting all attributes and always including all optional tags, preferring the consistency derived from such custom over the minor benefits of terseness afforded by making use of the flexibility of the HTML syntax. To aid such authors, conformance checkers can provide modes of operation wherein such conventions are enforced./p> h4 idrestrictions-on-content-models-and-on-attribute-values>span classsecno>1.12.3/span> Restrictions on content models and on attribute valuesa href#restrictions-on-content-models-and-on-attribute-values classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>Beyond the syntax of the language, this specification also places restrictions on how elements and attributes can be specified. These restrictions are present for similar reasons:/p> dl>dt>Errors involving content with dubious semanticsdd> p>To avoid misuse of elements with defined meanings, content models are defined that restrict how elements can be nested when such nestings would be of dubious value./p> p classexample>For example, this specification disallows nesting a code idrestrictions-on-content-models-and-on-attribute-values:the-section-element>a href#the-section-element>section/a>/code> element inside a code idrestrictions-on-content-models-and-on-attribute-values:the-kbd-element>a href#the-kbd-element>kbd/a>/code> element, since it is highly unlikely for an author to indicate that an entire section should be keyed in./p> dt>Errors that involve a conflict in expressed semanticsdd> p>Similarly, to draw the authors attention to mistakes in the use of elements, clear contradictions in the semantics expressed are also considered conformance errors./p> div classexample> p>In the fragments below, for example, the semantics are nonsensical: a separator cannot simultaneously be a cell, nor can a radio button be a progress bar./p> pre classbad><hr rolecell>/pre> pre classbad><input typeradio roleprogressbar>/pre> /div> p classexample>Another example is the restrictions on the content models of the code idrestrictions-on-content-models-and-on-attribute-values:the-ul-element>a href#the-ul-element>ul/a>/code> element, which only allows code idrestrictions-on-content-models-and-on-attribute-values:the-li-element>a href#the-li-element>li/a>/code> element children. Lists by definition consist just of zero or more list items, so if a code idrestrictions-on-content-models-and-on-attribute-values:the-ul-element-2>a href#the-ul-element>ul/a>/code> element contains something other than an code idrestrictions-on-content-models-and-on-attribute-values:the-li-element-2>a href#the-li-element>li/a>/code> element, its not clear what was meant./p> dt>Cases where the default styles are likely to lead to confusiondd> p>Certain elements have default styles or behaviors that make certain combinations likely to lead to confusion. Where these have equivalent alternatives without this problem, the confusing combinations are disallowed./p> p classexample>For example, code idrestrictions-on-content-models-and-on-attribute-values:the-div-element>a href#the-div-element>div/a>/code> elements are rendered as a hrefhttps://drafts.csswg.org/css2/visuren.html#x9 idrestrictions-on-content-models-and-on-attribute-values:block-box data-x-internalblock-box>block boxes/a>, and code idrestrictions-on-content-models-and-on-attribute-values:the-span-element>a href#the-span-element>span/a>/code> elements as a hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box idrestrictions-on-content-models-and-on-attribute-values:inline-box data-x-internalinline-box>inline boxes/a>. Putting a a idrestrictions-on-content-models-and-on-attribute-values:block-box-2 hrefhttps://drafts.csswg.org/css2/visuren.html#x9 data-x-internalblock-box>block box/a> in an a idrestrictions-on-content-models-and-on-attribute-values:inline-box-2 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a> is unnecessarily confusing; since either nesting just code idrestrictions-on-content-models-and-on-attribute-values:the-div-element-2>a href#the-div-element>div/a>/code> elements, or nesting just code idrestrictions-on-content-models-and-on-attribute-values:the-span-element-2>a href#the-span-element>span/a>/code> elements, or nesting code idrestrictions-on-content-models-and-on-attribute-values:the-span-element-3>a href#the-span-element>span/a>/code> elements inside code idrestrictions-on-content-models-and-on-attribute-values:the-div-element-3>a href#the-div-element>div/a>/code> elements all serve the same purpose as nesting a code idrestrictions-on-content-models-and-on-attribute-values:the-div-element-4>a href#the-div-element>div/a>/code> element in a code idrestrictions-on-content-models-and-on-attribute-values:the-span-element-4>a href#the-span-element>span/a>/code> element, but only the latter involves a a idrestrictions-on-content-models-and-on-attribute-values:block-box-3 hrefhttps://drafts.csswg.org/css2/visuren.html#x9 data-x-internalblock-box>block box/a> in an a idrestrictions-on-content-models-and-on-attribute-values:inline-box-3 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a>, the latter combination is disallowed./p> p classexample>Another example would be the way a href#interactive-content-2 idrestrictions-on-content-models-and-on-attribute-values:interactive-content-2>interactive content/a> cannot be nested. For example, a code idrestrictions-on-content-models-and-on-attribute-values:the-button-element>a href#the-button-element>button/a>/code> element cannot contain a code idrestrictions-on-content-models-and-on-attribute-values:the-textarea-element>a href#the-textarea-element>textarea/a>/code> element. This is because the default behavior of such nesting interactive elements would be highly confusing to users. Instead of nesting these elements, they can be placed side by side./p> dt>Errors that indicate a likely misunderstanding of the specificationdd> p>Sometimes, something is disallowed because allowing it would likely cause author confusion./p> p classexample>For example, setting the code idrestrictions-on-content-models-and-on-attribute-values:attr-fe-disabled>a href#attr-fe-disabled>disabled/a>/code> attribute to the value code>false/code> is disallowed, because despite the appearance of meaning that the element is enabled, it in fact means that the element is em>disabled/em> (what matters for implementations is the presence of the attribute, not its value)./p> dt>Errors involving limits that have been imposed merely to simplify the languagedd> p>Some conformance errors simplify the language that authors need to learn./p> p classexample>For example, the code idrestrictions-on-content-models-and-on-attribute-values:the-area-element>a href#the-area-element>area/a>/code> elements code idrestrictions-on-content-models-and-on-attribute-values:attr-area-shape>a href#attr-area-shape>shape/a>/code> attribute, despite accepting both code idrestrictions-on-content-models-and-on-attribute-values:attr-area-shape-keyword-circ>a href#attr-area-shape-keyword-circ>circ/a>/code> and code idrestrictions-on-content-models-and-on-attribute-values:attr-area-shape-keyword-circle>a href#attr-area-shape-keyword-circle>circle/a>/code> values in practice as synonyms, disallows the use of the code idrestrictions-on-content-models-and-on-attribute-values:attr-area-shape-keyword-circ-2>a href#attr-area-shape-keyword-circ>circ/a>/code> value, so as to simplify tutorials and other learning aids. There would be no benefit to allowing both, but it would cause extra confusion when teaching the language./p> dt>Errors that involve peculiarities of the parserdd> p>Certain elements are parsed in somewhat eccentric ways (typically for historical reasons), and their content model restrictions are intended to avoid exposing the author to these issues./p> div classexample> p>For example, a code idrestrictions-on-content-models-and-on-attribute-values:the-form-element>a href#the-form-element>form/a>/code> element isnt allowed inside a href#phrasing-content-2 idrestrictions-on-content-models-and-on-attribute-values:phrasing-content-2>phrasing content/a>, because when parsed as HTML, a code idrestrictions-on-content-models-and-on-attribute-values:the-form-element-2>a href#the-form-element>form/a>/code> elements start tag will imply a code idrestrictions-on-content-models-and-on-attribute-values:the-p-element>a href#the-p-element>p/a>/code> elements end tag. Thus, the following markup results in two a href#paragraph idrestrictions-on-content-models-and-on-attribute-values:paragraph>paragraphs/a>, not one:/p> pre><p>Welcome. <form><label>Name:</label> <input></form>/pre> p>It is parsed exactly like the following:/p> pre><p>Welcome. </p><form><label>Name:</label> <input></form>/pre> /div> dt>Errors that would likely result in scripts failing in hard-to-debug waysdd> p>Some errors are intended to help prevent script problems that would be hard to debug./p> p classexample>This is why, for instance, it is non-conforming to have two code idrestrictions-on-content-models-and-on-attribute-values:the-id-attribute>a href#the-id-attribute>id/a>/code> attributes with the same value. Duplicate IDs lead to the wrong element being selected, with sometimes disastrous effects whose cause is hard to determine./p> dt>Errors that waste authoring timedd> p>Some constructs are disallowed because historically they have been the cause of a lot of wasted authoring time, and by encouraging authors to avoid making them, authors can save time in future efforts./p> p classexample>For example, a code idrestrictions-on-content-models-and-on-attribute-values:the-script-element>a href#the-script-element>script/a>/code> elements code idrestrictions-on-content-models-and-on-attribute-values:attr-script-src>a href#attr-script-src>src/a>/code> attribute causes the elements contents to be ignored. However, this isnt obvious, especially if the elements contents appear to be executable script — which can lead to authors spending a lot of time trying to debug the inline script without realizing that it is not executing. To reduce this problem, this specification makes it non-conforming to have executable script in a code idrestrictions-on-content-models-and-on-attribute-values:the-script-element-2>a href#the-script-element>script/a>/code> element when the code idrestrictions-on-content-models-and-on-attribute-values:attr-script-src-2>a href#attr-script-src>src/a>/code> attribute is present. This means that authors who are validating their documents are less likely to waste time with this kind of mistake./p> dt>Errors that involve areas that affect authors migrating between the HTML and XML syntaxesdd> p>Some authors like to write files that can be interpreted as both XML and HTML with similar results. Though this practice is discouraged in general due to the myriad of subtle complications involved (especially when involving scripting, styling, or any kind of automated serialization), this specification has a few restrictions intended to at least somewhat mitigate the difficulties. This makes it easier for authors to use this as a transitionary step when migrating between the HTML and XML syntaxes./p> p classexample>For example, there are somewhat complicated rules surrounding the code idrestrictions-on-content-models-and-on-attribute-values:attr-lang>a href#attr-lang>lang/a>/code> and code idrestrictions-on-content-models-and-on-attribute-values:attr-xml-lang>a href#attr-xml-lang>xml:lang/a>/code> attributes intended to keep the two synchronized./p> p classexample>Another example would be the restrictions on the values of code>xmlns/code> attributes in the HTML serialization, which are intended to ensure that elements in conforming documents end up in the same namespaces whether processed as HTML or XML./p> dt>Errors that involve areas reserved for future expansiondd> p>As with the restrictions on the syntax intended to allow for new syntax in future revisions of the language, some restrictions on the content models of elements and values of attributes are intended to allow for future expansion of the HTML vocabulary./p> p classexample>For example, limiting the values of the code idrestrictions-on-content-models-and-on-attribute-values:attr-hyperlink-target>a href#attr-hyperlink-target>target/a>/code> attribute that start with an U+005F LOW LINE character (_) to only specific predefined values allows new predefined values to be introduced at a future time without conflicting with author-defined values./p> dt>Errors that indicate a mis-use of other specificationsdd> p>Certain restrictions are intended to support the restrictions made by other specifications./p> p classexample>For example, requiring that attributes that take media query lists use only em>valid/em> media query lists reinforces the importance of following the conformance rules of that specification./p> /dl> h3 idsuggested-reading>span classsecno>1.13/span> Suggested readinga href#suggested-reading classself-link>/a>/h3> p>i>This section is non-normative./i>/p> p>The following documents might be of interest to readers of this specification./p> dl>dt>cite>Character Model for the World Wide Web 1.0: Fundamentals/cite> a href#refsCHARMOD>CHARMOD/a>dd>blockquote>p>This Architectural Specification provides authors of specifications, software developers, and content developers with a common reference for interoperable text manipulation on the World Wide Web, building on the Universal Character Set, defined jointly by the Unicode Standard and ISO/IEC 10646. Topics addressed include use of the terms character, encoding and string, a reference processing model, choice and identification of character encodings, character escaping, and string indexing./blockquote>dt>cite>Unicode Security Considerations/cite> a href#refsUTR36>UTR36/a>dd>blockquote>p>Because Unicode contains such a large number of characters and incorporates the varied writing systems of the world, incorrect usage can expose programs or systems to possible security attacks. This is especially important as more and more products are internationalized. This document describes some of the security considerations that programmers, system analysts, standards developers, and users should take into account, and provides specific recommendations to reduce the risk of problems./blockquote>dt>cite>Web Content Accessibility Guidelines (WCAG) 2.0/cite> a href#refsWCAG>WCAG/a>dd>blockquote>p>Web Content Accessibility Guidelines (WCAG) 2.0 covers a wide range of recommendations for making Web content more accessible. Following these guidelines will make content accessible to a wider range of people with disabilities, including blindness and low vision, deafness and hearing loss, learning disabilities, cognitive limitations, limited movement, speech disabilities, photosensitivity and combinations of these. Following these guidelines will also often make your Web content more usable to users in general./blockquote>dt>cite>Authoring Tool Accessibility Guidelines (ATAG) 2.0/cite> a href#refsATAG>ATAG/a>dd>blockquote>p>This specification provides guidelines for designing Web content authoring tools that are more accessible for people with disabilities. An authoring tool that conforms to these guidelines will promote accessibility by providing an accessible user interface to authors with disabilities as well as by enabling, supporting, and promoting the production of accessible Web content by all authors./blockquote>dt>cite>User Agent Accessibility Guidelines (UAAG) 2.0/cite> a href#refsUAAG>UAAG/a>dd>blockquote>p>This document provides guidelines for designing user agents that lower barriers to Web accessibility for people with disabilities. User agents include browsers and other types of software that retrieve and render Web content. A user agent that conforms to these guidelines will promote accessibility through its own user interface and through other internal facilities, including its ability to communicate with other technologies (especially assistive technologies). Furthermore, all users, not just users with disabilities, should find conforming user agents to be more usable./blockquote>/dl> h2 idinfrastructure>span classsecno>2/span> Common infrastructurea href#infrastructure classself-link>/a>/h2> p>This specification depends on the WHATWG Infra standard. a href#refsINFRA>INFRA/a>/p> h3 idterminology>span classsecno>2.1/span> Terminologya href#terminology classself-link>/a>/h3> p>This specification refers to both HTML and XML attributes and IDL attributes, often in the same context. When it is not clear which is being referred to, they are referred to as dfn>content attributes/dfn> for HTML and XML attributes, and dfn>IDL attributes/dfn> for those defined on IDL interfaces. Similarly, the term properties is used for both JavaScript object properties and CSS properties. When these are ambiguous they are qualified as dfn>object properties/dfn> and dfn>CSS properties/dfn> respectively./p> p>Generally, when the specification states that a feature applies to a href#syntax idterminology:syntax>the HTML syntax/a> or a href#the-xhtml-syntax idterminology:the-xhtml-syntax>the XML syntax/a>, it also includes the other. When a feature specifically only applies to one of the two languages, it is called out by explicitly stating that it does not apply to the other format, as in for HTML, ... (this does not apply to XML)./p> p>This specification uses the term dfn>document/dfn> to refer to any use of HTML, ranging from short static documents to long essays or reports with rich multimedia, as well as to fully-fledged interactive applications. The term is used to refer both to code idterminology:document>a href#document>Document/a>/code> objects and their descendant DOM trees, and to serialized byte streams using the a href#syntax idterminology:syntax-2>HTML syntax/a> or the a href#the-xhtml-syntax idterminology:the-xhtml-syntax-2>XML syntax/a>, depending on context./p> p>In the context of the DOM structures, the terms a hrefhttps://dom.spec.whatwg.org/#html-document idterminology:html-documents data-x-internalhtml-documents>HTML document/a> and a hrefhttps://dom.spec.whatwg.org/#xml-document idterminology:xml-documents data-x-internalxml-documents>XML document/a> are used as defined in the DOM specification, and refer specifically to two different modes that code idterminology:document-2>a href#document>Document/a>/code> objects can find themselves in. a href#refsDOM>DOM/a> (Such uses are always hyperlinked to their definition.)/p> p>In the context of byte streams, the term HTML document refers to resources labeled as code idterminology:text/html>a href#text/html>text/html/a>/code>, and the term XML document refers to resources labeled with an a idterminology:xml-mime-type hrefhttps://mimesniff.spec.whatwg.org/#xml-mime-type data-x-internalxml-mime-type>XML MIME type/a>./p> hr> p>For simplicity, terms such as dfn>shown/dfn>, dfn>displayed/dfn>, and dfn>visible/dfn> might sometimes be used when referring to the way a document is rendered to the user. These terms are not meant to imply a visual medium; they must be considered to apply to other media in equivalent ways./p> p>dfn idtransparent-black>Transparent black/dfn> refers to the color with red, green, blue, and alpha channels all set to zero./p> h4 idparallelism>span classsecno>2.1.1/span> Parallelisma href#parallelism classself-link>/a>/h4> p>To run steps dfn idin-parallel data-export>in parallel/dfn> means those steps are to be run, one after another, at the same time as other logic in the standard (e.g., at the same time as the a href#event-loop idparallelism:event-loop>event loop/a>). This standard does not define the precise mechanism by which this is achieved, be it time-sharing cooperative multitasking, fibers, threads, processes, using different hyperthreads, cores, CPUs, machines, etc. By contrast, an operation that is to run dfn idimmediately>immediately/dfn> must interrupt the currently running task, run itself, and then resume the previously running task./p> p>To avoid race conditions between different a href#in-parallel idparallelism:in-parallel>in parallel/a> algorithms that operate on the same data, a a href#parallel-queue idparallelism:parallel-queue>parallel queue/a> can be used./p> p>A dfn idparallel-queue data-export>parallel queue/dfn> represents a queue of algorithm steps that must be run in series./p> p>A a href#parallel-queue idparallelism:parallel-queue-2>parallel queue/a> has an dfn idalgorithm-queue>algorithm queue/dfn> (a a idparallelism:queue hrefhttps://infra.spec.whatwg.org/#queue data-x-internalqueue>queue/a>), initially empty./p> p>To dfn data-dfn-forparallel queue idenqueue-the-following-steps data-ltenqueue steps|enqueue the following steps data-export>enqueue steps/dfn> to a a href#parallel-queue idparallelism:parallel-queue-3>parallel queue/a>, a idparallelism:enqueue hrefhttps://infra.spec.whatwg.org/#queue-enqueue data-x-internalenqueue>enqueue/a> the algorithm steps to the a href#parallel-queue idparallelism:parallel-queue-4>parallel queue/a>s a href#algorithm-queue idparallelism:algorithm-queue>algorithm queue/a>./p> p>To dfn idstarting-a-new-parallel-queue data-ltstart a new parallel queue|starting a new parallel queue data-export>start a new parallel queue/dfn>, run the following steps:/p> ol>li>p>Let var>parallelQueue/var> be a new a href#parallel-queue idparallelism:parallel-queue-5>parallel queue/a>.li> p>Run the following steps a href#in-parallel idparallelism:in-parallel-2>in parallel/a>:/p> ol>li> p>While true:/p> ol>li>p>Let var>steps/var> be the result of a hrefhttps://infra.spec.whatwg.org/#queue-dequeue idparallelism:dequeue data-x-internaldequeue>dequeueing/a> from var>parallelQueue/var>s a href#algorithm-queue idparallelism:algorithm-queue-2>algorithm queue/a>.li>p>If var>steps/var> is not nothing, then run var>steps/var>.li>p>Assert: running var>steps/var> did not throw an exception, as steps running a href#in-parallel idparallelism:in-parallel-3>in parallel/a> are not allowed to throw./ol> p classnote>Implementations are not expected to implement this as a continuously running loop. Algorithms in standards are to be easy to understand and are not necessarily great for battery life or performance./p> /ol> li>p>Return var>parallelQueue/var>./ol> p classnote>Steps running a href#in-parallel idparallelism:in-parallel-4>in parallel/a> can themselves run other steps in a href#in-parallel idparallelism:in-parallel-5>in parallel/a>. E.g., inside a a href#parallel-queue idparallelism:parallel-queue-6>parallel queue/a> it can be useful to run a series of steps in parallel with the queue./p> div classexample> p>Imagine a standard defined var>nameList/var> (a a idparallelism:list hrefhttps://infra.spec.whatwg.org/#list data-x-internallist>list/a>), along with a method to add a var>name/var> to var>nameList/var>, unless var>nameList/var> already a hrefhttps://infra.spec.whatwg.org/#list-contain idparallelism:list-contains data-x-internallist-contains>contains/a> var>name/var>, in which case it rejects./p> p>The following solution suffers from race conditions:/p> ol>li>p>Let var>p/var> be a new promise.li> p>Run the following steps a href#in-parallel idparallelism:in-parallel-6>in parallel/a>:/p> ol>li>p>If var>nameList/var> a hrefhttps://infra.spec.whatwg.org/#list-contain idparallelism:list-contains-2 data-x-internallist-contains>contains/a> var>name/var>, reject var>p/var> with a code idparallelism:typeerror>a data-x-internaltypeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror>TypeError/a>/code> and abort these steps.li>p>Do some potentially lengthy work.li>p>a hrefhttps://infra.spec.whatwg.org/#list-append idparallelism:list-append data-x-internallist-append>Append/a> var>name/var> to var>nameList/var>.li>p>Resolve var>p/var> with undefined./ol> li>p>Return var>p/var>./ol> p>Two invocations of the above could run simultaneously, meaning var>name/var> isnt in var>nameList/var> during step 2.1, but it em>might be added/em> before step 2.3 runs, meaning var>name/var> ends up in var>nameList/var> twice./p> p>Parallel queues solve this. The standard would let var>nameListQueue/var> be the result of a href#starting-a-new-parallel-queue idparallelism:starting-a-new-parallel-queue>starting a new parallel queue/a>, then:/p> ol>li>p>Let var>p/var> be a new promise.li> p>mark>a href#enqueue-the-following-steps idparallelism:enqueue-the-following-steps>Enqueue the following steps/a> to var>nameListQueue/var>:/mark>/p> ol>li>p>If var>nameList/var> a hrefhttps://infra.spec.whatwg.org/#list-contain idparallelism:list-contains-3 data-x-internallist-contains>contains/a> var>name/var>, reject var>p/var> with a code idparallelism:typeerror-2>a data-x-internaltypeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror>TypeError/a>/code> and abort these steps.li>p>Do some potentially lengthy work.li>p>a hrefhttps://infra.spec.whatwg.org/#list-append idparallelism:list-append-2 data-x-internallist-append>Append/a> var>name/var> to var>nameList/var>.li>p>Resolve var>p/var> with undefined./ol> li>p>Return var>p/var>./ol> p>The steps would now queue and the race is avoided./p> /div> h4 idresources>span classsecno>2.1.2/span> Resourcesa href#resources classself-link>/a>/h4> p>The specification uses the term dfn>supported/dfn> when referring to whether a user agent has an implementation capable of decoding the semantics of an external resource. A format or type is said to be i>supported/i> if the implementation can process an external resource of that format or type without critical aspects of the resource being ignored. Whether a specific resource is i>supported/i> can depend on what features of the resources format are in use./p> p classexample>For example, a PNG image would be considered to be in a supported format if its pixel data could be decoded and rendered, even if, unbeknownst to the implementation, the image also contained animation data./p> p classexample>An MPEG-4 video file would not be considered to be in a supported format if the compression format used was not supported, even if the implementation could determine the dimensions of the movie from the files metadata./p> p>What some specifications, in particular the HTTP specification, refer to as a i>representation/i> is referred to in this specification as a dfn>resource/dfn>. a href#refsHTTP>HTTP/a>/p> p>A resources dfn idcritical-subresources>critical subresources/dfn> are those that the resource needs to have available to be correctly processed. Which resources are considered critical or not is defined by the specification that defines the resources format./p> h4 idxml>span classsecno>2.1.3/span> XML compatibilitya href#xml classself-link>/a>/h4> p idhtml-namespace>To ease migration from HTML to XML, UAs conforming to this specification will place elements in HTML in the code idxml:html-namespace-2>a data-x-internalhtml-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace>http://www.w3.org/1999/xhtml/a>/code> namespace, at least for the purposes of the DOM and CSS. The term dfn idhtml-elements data-export>HTML elements/dfn> refers to any element in that namespace, even in XML documents./p> p>Except where otherwise stated, all elements defined or mentioned in this specification are in the a idxml:html-namespace-2-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a> (code>http://www.w3.org/1999/xhtml/code>), and all attributes defined or mentioned in this specification have no namespace./p> p>The term dfn idelement-type>element type/dfn> is used to refer to the set of elements that have a given local name and namespace. For example, code idxml:the-button-element>a href#the-button-element>button/a>/code> elements are elements with the element type code idxml:the-button-element-2>a href#the-button-element>button/a>/code>, meaning they have the local name code>button/code> and (implicitly as defined above) the a idxml:html-namespace-2-3 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>./p> p>Attribute names are said to be dfn idxml-compatible>XML-compatible/dfn> if they match the code idxml:xml-name>a data-x-internalxml-name hrefhttps://www.w3.org/TR/xml/#NT-Name>Name/a>/code> production defined in XML and they contain no U+003A COLON characters (:). a href#refsXML>XML/a>/p> h4 iddom-trees>span classsecno>2.1.4/span> DOM treesa href#dom-trees classself-link>/a>/h4> p>When it is stated that some element or attribute is dfn idignore>ignored/dfn>, or treated as some other value, or handled as if it was something else, this refers only to the processing of the node after it is in the DOM. A user agent must not mutate the DOM in such situations./p> p>A content attribute is said to dfn>change/dfn> value only if its new value is different than its previous value; setting an attribute to a value it already has does not change it./p> p>The term dfn>empty/dfn>, when used for an attribute value, code iddom-trees:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node, or string, means that the length of the text is zero (i.e., not even containing a hrefhttps://infra.spec.whatwg.org/#control iddom-trees:control data-x-internalcontrol>controls/a> or U+0020 SPACE)./p> p>A dfn idnodes-are-inserted>node var>A/var> is inserted/dfn> into a node var>B/var> when the a hrefhttps://dom.spec.whatwg.org/#concept-node-insert-ext iddom-trees:concept-node-insert-ext data-x-internalconcept-node-insert-ext>insertion steps/a> are invoked with var>A/var> as the argument and var>A/var>s new parent is var>B/var>. Similarly, a dfn idnodes-are-removed>node var>A/var> is removed/dfn> from a node var>B/var> when the a hrefhttps://dom.spec.whatwg.org/#concept-node-remove-ext iddom-trees:concept-node-remove-ext data-x-internalconcept-node-remove-ext>removing steps/a> are invoked with var>A/var> as the var>removedNode/var> argument and var>B/var> as the var>oldParent/var> argument./p> p>A dfn idinsert-an-element-into-a-document data-ltinserted into a document|node is inserted into a document data-export>node is inserted into a document/dfn> when the a hrefhttps://dom.spec.whatwg.org/#concept-node-insert-ext iddom-trees:concept-node-insert-ext-2 data-x-internalconcept-node-insert-ext>insertion steps/a> are invoked with it as the argument and it is now a iddom-trees:in-a-document-tree hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a>. Analogously, a dfn idremove-an-element-from-a-document data-ltremoved from a document|node is removed from a document data-export>node is removed from a document/dfn> when the a hrefhttps://dom.spec.whatwg.org/#concept-node-remove-ext iddom-trees:concept-node-remove-ext-2 data-x-internalconcept-node-remove-ext>removing steps/a> are invoked with it as the argument and it is now no longer a iddom-trees:in-a-document-tree-2 hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a>./p> p>A node dfn idbecomes-connected data-export>becomes connected/dfn> when the a hrefhttps://dom.spec.whatwg.org/#concept-node-insert-ext iddom-trees:concept-node-insert-ext-3 data-x-internalconcept-node-insert-ext>insertion steps/a> are invoked with it as the argument and it is now a iddom-trees:connected hrefhttps://dom.spec.whatwg.org/#connected data-x-internalconnected>connected/a>. Analogously, a node dfn idbecomes-disconnected data-ltbecome disconnected data-export>becomes disconnected/dfn> when the a hrefhttps://dom.spec.whatwg.org/#concept-node-remove-ext iddom-trees:concept-node-remove-ext-3 data-x-internalconcept-node-remove-ext>removing steps/a> are invoked with it as the argument and it is now no longer a iddom-trees:connected-2 hrefhttps://dom.spec.whatwg.org/#connected data-x-internalconnected>connected/a>./p> p>A node is dfn idbrowsing-context-connected data-export>browsing-context connected/dfn> when it is a iddom-trees:connected-3 hrefhttps://dom.spec.whatwg.org/#connected data-x-internalconnected>connected/a> and its a hrefhttps://dom.spec.whatwg.org/#concept-shadow-including-root iddom-trees:shadow-including-root data-x-internalshadow-including-root>shadow-including root/a> has a a href#concept-document-bc iddom-trees:concept-document-bc>browsing context/a>. A node dfn idbecomes-browsing-context-connected data-ltbecome browsing-context connected data-export>becomes browsing-context connected/dfn> when the a hrefhttps://dom.spec.whatwg.org/#concept-node-insert-ext iddom-trees:concept-node-insert-ext-4 data-x-internalconcept-node-insert-ext>insertion steps/a> are invoked with it as the argument and it is now a href#browsing-context-connected iddom-trees:browsing-context-connected>browsing-context connected/a>. A node dfn idbecomes-browsing-context-disconnected data-ltbecome browsing-context disconnected data-export>becomes browsing-context disconnected/dfn> either when the a hrefhttps://dom.spec.whatwg.org/#concept-node-remove-ext iddom-trees:concept-node-remove-ext-4 data-x-internalconcept-node-remove-ext>removing steps/a> are invoked with it as the argument and it is now no longer a href#browsing-context-connected iddom-trees:browsing-context-connected-2>browsing-context connected/a>, or when its a iddom-trees:shadow-including-root-2 hrefhttps://dom.spec.whatwg.org/#concept-shadow-including-root data-x-internalshadow-including-root>shadow-including root/a> no longer has a a href#concept-document-bc iddom-trees:concept-document-bc-2>browsing context/a>. h4 idscripting-2>span classsecno>2.1.5/span> Scriptinga href#scripting-2 classself-link>/a>/h4> p>The construction a code>Foo/code> object, where code>Foo/code> is actually an interface, is sometimes used instead of the more accurate an object implementing the interface code>Foo/code>./p> p>An IDL attribute is said to be dfn>getting/dfn> when its value is being retrieved (e.g. by author script), and is said to be dfn>setting/dfn> when a new value is assigned to it./p> p>If a DOM object is said to be dfn idlive>live/dfn>, then the attributes and methods on that object must operate on the actual underlying data, not a snapshot of the data./p> h4 idplugins>span classsecno>2.1.6/span> Pluginsa href#plugins classself-link>/a>/h4> p>The term dfn idplugin>plugin/dfn> refers to a user-agent defined set of content handlers used by the user agent that can take part in the user agents rendering of a code idplugins:document>a href#document>Document/a>/code> object, but that neither act as a href#child-browsing-context idplugins:child-browsing-context>child browsing contexts/a> of the code idplugins:document-2>a href#document>Document/a>/code> nor introduce any code idplugins:node>a data-x-internalnode hrefhttps://dom.spec.whatwg.org/#interface-node>Node/a>/code> objects to the code idplugins:document-3>a href#document>Document/a>/code>s DOM./p> p>Typically such content handlers are provided by third parties, though a user agent can also designate built-in content handlers as plugins./p> p>A user agent must not consider the types code idplugins:text/plain>a data-x-internaltext/plain hrefhttps://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain/a>/code> and code idplugins:application/octet-stream>a data-x-internalapplication/octet-stream hrefhttps://tools.ietf.org/html/rfc2046#section-4.5.1>application/octet-stream/a>/code> as having a registered a href#plugin idplugins:plugin>plugin/a>./p> p classexample>One example of a plugin would be a PDF viewer that is instantiated in a a href#browsing-context idplugins:browsing-context>browsing context/a> when the user navigates to a PDF file. This would count as a plugin regardless of whether the party that implemented the PDF viewer component was the same as that which implemented the user agent itself. However, a PDF viewer application that launches separate from the user agent (as opposed to using the same interface) is not a plugin by this definition./p> p classnote>This specification does not define a mechanism for interacting with plugins, as it is expected to be user-agent- and platform-specific. Some UAs might opt to support a plugin mechanism such as the Netscape Plugin API; others might use remote content converters or have built-in support for certain types. Indeed, this specification doesnt require user agents to support plugins at all. a href#refsNPAPI>NPAPI/a>/p> p>A plugin can be dfn idconcept-plugin-secure>secured/dfn> if it honors the semantics of the code idplugins:attr-iframe-sandbox>a href#attr-iframe-sandbox>sandbox/a>/code> attribute./p> p classexample>For example, a secured plugin would prevent its contents from creating pop-up windows when the plugin is instantiated inside a sandboxed code idplugins:the-iframe-element>a href#the-iframe-element>iframe/a>/code>./p> p classwarning>Browsers should take extreme care when interacting with external content intended for a href#plugin idplugins:plugin-2>plugins/a>. When third-party software is run with the same privileges as the user agent itself, vulnerabilities in the third-party software become as dangerous as those in the user agent./p> p>Since different users having different sets of a href#plugin idplugins:plugin-3>plugins/a> provides a fingerprinting vector that increases the chances of users being uniquely identified, user agents are encouraged to support the exact same set of a href#plugin idplugins:plugin-4>plugins/a> for each user. a href#fingerprinting-vector idplugins:fingerprinting-vector classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> h4 idencoding-terminology>span classsecno>2.1.7/span> Character encodingsa href#encoding-terminology classself-link>/a>/h4> p>A dfn idencoding>a hrefhttps://encoding.spec.whatwg.org/#encoding>character encoding/a>/dfn>, or just i>encoding/i> where that is not ambiguous, is a defined way to convert between byte streams and Unicode strings, as defined in the WHATWG Encoding standard. An a idencoding-terminology:encoding hrefhttps://encoding.spec.whatwg.org/#encoding data-x-internalencoding>encoding/a> has an dfn idencoding-name>a hrefhttps://encoding.spec.whatwg.org/#name>encoding name/a>/dfn> and one or more dfn idencoding-label>a hrefhttps://encoding.spec.whatwg.org/#label>encoding labels/a>/dfn>, referred to as the encodings i>name/i> and i>labels/i> in the Encoding standard. a href#refsENCODING>ENCODING/a>/p> p>A dfn idutf-16-encoding>UTF-16 encoding/dfn> is a idencoding-terminology:utf-16be hrefhttps://encoding.spec.whatwg.org/#utf-16be data-x-internalutf-16be>UTF-16BE/a> or a idencoding-terminology:utf-16le hrefhttps://encoding.spec.whatwg.org/#utf-16le data-x-internalutf-16le>UTF-16LE/a>. a href#refsENCODING>ENCODING/a>/p> p>An dfn idascii-compatible-encoding>ASCII-compatible encoding/dfn> is any a idencoding-terminology:encoding-2 hrefhttps://encoding.spec.whatwg.org/#encoding data-x-internalencoding>encoding/a> that is not a a href#utf-16-encoding idencoding-terminology:utf-16-encoding>UTF-16 encoding/a>. a href#refsENCODING>ENCODING/a>/p> p classnote>Since support for encodings that are not defined in the WHATWG Encoding standard is prohibited, a href#utf-16-encoding idencoding-terminology:utf-16-encoding-2>UTF-16 encodings/a> are the only encodings that this specification needs to treat as not being a href#ascii-compatible-encoding idencoding-terminology:ascii-compatible-encoding>ASCII-compatible encodings/a>. /p> h4 idconformance-classes>span classsecno>2.1.8/span> Conformance classesa href#conformance-classes classself-link>/a>/h4> p>This specification describes the conformance criteria for user agents (relevant to implementors) and documents (relevant to authors and authoring tool implementors)./p> p>dfn idconforming-documents>Conforming documents/dfn> are those that comply with all the conformance criteria for documents. For readability, some of these conformance requirements are phrased as conformance requirements on authors; such requirements are implicitly requirements on documents: by definition, all documents are assumed to have had an author. (In some cases, that author may itself be a user agent — such user agents are subject to additional rules, as explained below.)/p> p classexample>For example, if a requirement states that authors must not use the code>foobar/code> element, it would imply that documents are not allowed to contain elements named code>foobar/code>./p> p classnote impl>There is no implied relationship between document conformance requirements and implementation conformance requirements. User agents are not free to handle non-conformant documents as they please; the processing model described in this specification applies to implementations regardless of the conformity of the input documents./p> p>User agents fall into several (overlapping) categories with different conformance requirements./p> dl>dt idinteractive>Web browsers and other interactive user agentsdd> p>Web browsers that support a href#the-xhtml-syntax idconformance-classes:the-xhtml-syntax>the XML syntax/a> must process elements and attributes from the a idconformance-classes:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a> found in XML documents as described in this specification, so that users can interact with them, unless the semantics of those elements have been overridden by other specifications./p> p classexample>A conforming Web browser would, upon finding a code idconformance-classes:the-script-element>a href#the-script-element>script/a>/code> element in an XML document, execute the script contained in that element. However, if the element is found within a transformation expressed in XSLT (assuming the user agent also supports XSLT), then the processor would instead treat the code idconformance-classes:the-script-element-2>a href#the-script-element>script/a>/code> element as an opaque element that forms part of the transform./p> p>Web browsers that support a href#syntax idconformance-classes:syntax>the HTML syntax/a> must process documents labeled with an a idconformance-classes:html-mime-type hrefhttps://mimesniff.spec.whatwg.org/#html-mime-type data-x-internalhtml-mime-type>HTML MIME type/a> as described in this specification, so that users can interact with them./p> p>User agents that support scripting must also be conforming implementations of the IDL fragments in this specification, as described in the Web IDL specification. a href#refsWEBIDL>WEBIDL/a>/p> p classnote>Unless explicitly stated, specifications that override the semantics of HTML elements do not override the requirements on DOM objects representing those elements. For example, the code idconformance-classes:the-script-element-3>a href#the-script-element>script/a>/code> element in the example above would still implement the code idconformance-classes:htmlscriptelement>a href#htmlscriptelement>HTMLScriptElement/a>/code> interface./p> dt idnon-interactive>Non-interactive presentation user agentsdd> p>User agents that process HTML and XML documents purely to render non-interactive versions of them must comply to the same conformance criteria as Web browsers, except that they are exempt from requirements regarding user interaction./p> p classnote>Typical examples of non-interactive presentation user agents are printers (static UAs) and overhead displays (dynamic UAs). It is expected that most static non-interactive presentation user agents will also opt to a href#non-scripted>lack scripting support/a>./p> p classexample>A non-interactive but dynamic presentation UA would still execute scripts, allowing forms to be dynamically submitted, and so forth. However, since the concept of focus is irrelevant when the user cannot interact with the document, the UA would not need to support any of the focus-related DOM APIs./p> dt idrenderingUA>Visual user agents that support the suggested default renderingdd> p>User agents, whether interactive or not, may be designated (possibly as a user option) as supporting the suggested default rendering defined by this specification./p> p>This is not required. In particular, even user agents that do implement the suggested default rendering are encouraged to offer settings that override this default to improve the experience for the user, e.g. changing the color contrast, using different focus styles, or otherwise making the experience more accessible and usable to the user./p> p>User agents that are designated as supporting the suggested default rendering must, while so designated, implement the rules a href#rendering>the rendering section/a> defines as the behavior that user agents are em>expected/em> to implement./p> dt idnon-scripted>User agents with no scripting supportdd> p>Implementations that do not support scripting (or which have their scripting features disabled entirely) are exempt from supporting the events and DOM interfaces mentioned in this specification. For the parts of this specification that are defined in terms of an events model or in terms of the DOM, such user agents must still act as if events and the DOM were supported./p> p classnote>Scripting can form an integral part of an application. Web browsers that do not support scripting, or that have scripting disabled, might be unable to fully convey the authors intent./p> dt>Conformance checkersdd idconformance-checkers> p>Conformance checkers must verify that a document conforms to the applicable conformance criteria described in this specification. Automated conformance checkers are exempt from detecting errors that require interpretation of the authors intent (for example, while a document is non-conforming if the content of a code idconformance-classes:the-blockquote-element>a href#the-blockquote-element>blockquote/a>/code> element is not a quote, conformance checkers running without the input of human judgement do not have to check that code idconformance-classes:the-blockquote-element-2>a href#the-blockquote-element>blockquote/a>/code> elements only contain quoted material)./p> p>Conformance checkers must check that the input document conforms when parsed without a a href#concept-document-bc idconformance-classes:concept-document-bc>browsing context/a> (meaning that no scripts are run, and that the parsers a href#scripting-flag idconformance-classes:scripting-flag>scripting flag/a> is disabled), and should also check that the input document conforms when parsed with a a href#concept-document-bc idconformance-classes:concept-document-bc-2>browsing context/a> in which scripts execute, and that the scripts never cause non-conforming states to occur other than transiently during script execution itself. (This is only a SHOULD and not a MUST requirement because it has been proven to be impossible. a href#refsCOMPUTABLE>COMPUTABLE/a>)/p> p>The term HTML validator can be used to refer to a conformance checker that itself conforms to the applicable requirements of this specification./p> div classnote> p>XML DTDs cannot express all the conformance requirements of this specification. Therefore, a validating XML processor and a DTD cannot constitute a conformance checker. Also, since neither of the two authoring formats defined in this specification are applications of SGML, a validating SGML system cannot constitute a conformance checker either./p> p>To put it another way, there are three types of conformance criteria:/p> ol>li>Criteria that can be expressed in a DTD.li>Criteria that cannot be expressed by a DTD, but can still be checked by a machine.li>Criteria that can only be checked by a human./ol> p>A conformance checker must check for the first two. A simple DTD-based validator only checks for the first class of errors and is therefore not a conforming conformance checker according to this specification./p> /div> dt>Data mining toolsdd iddata-mining> p>Applications and tools that process HTML and XML documents for reasons other than to either render the documents or check them for conformance should act in accordance with the semantics of the documents that they process./p> p classexample>A tool that generates a href#outline idconformance-classes:outline>document outlines/a> but increases the nesting level for each paragraph and does not increase the nesting level for each section would not be conforming./p> dt ideditors>Authoring tools and markup generatorsdd> p>Authoring tools and markup generators must generate a href#conforming-documents idconformance-classes:conforming-documents>conforming documents/a>. Conformance criteria that apply to authors also apply to authoring tools, where appropriate./p> p>Authoring tools are exempt from the strict requirements of using elements only for their specified purpose, but only to the extent that authoring tools are not yet able to determine author intent. However, authoring tools must not automatically misuse elements or encourage their users to do so./p> p classexample>For example, it is not conforming to use an code idconformance-classes:the-address-element>a href#the-address-element>address/a>/code> element for arbitrary contact information; that element can only be used for marking up contact information for the author of the document or section. However, since an authoring tool is likely unable to determine the difference, an authoring tool is exempt from that requirement. This does not mean, though, that authoring tools can use code idconformance-classes:the-address-element-2>a href#the-address-element>address/a>/code> elements for any block of italics text (for instance); it just means that the authoring tool doesnt have to verify that when the user uses a tool for inserting contact information for a section, that the user really is doing that and not inserting something else instead./p> p classnote>In terms of conformance checking, an editor has to output documents that conform to the same extent that a conformance checker will verify./p> p>When an authoring tool is used to edit a non-conforming document, it may preserve the conformance errors in sections of the document that were not edited during the editing session (i.e. an editing tool is allowed to round-trip erroneous content). However, an authoring tool must not claim that the output is conformant if errors have been so preserved./p> p>Authoring tools are expected to come in two broad varieties: tools that work from structure or semantic data, and tools that work on a What-You-See-Is-What-You-Get media-specific editing basis (WYSIWYG)./p> p>The former is the preferred mechanism for tools that author HTML, since the structure in the source information can be used to make informed choices regarding which HTML elements and attributes are most appropriate./p> p>However, WYSIWYG tools are legitimate. WYSIWYG tools should use elements they know are appropriate, and should not use elements that they do not know to be appropriate. This might in certain extreme cases mean limiting the use of flow elements to just a few elements, like code idconformance-classes:the-div-element>a href#the-div-element>div/a>/code>, code idconformance-classes:the-b-element>a href#the-b-element>b/a>/code>, code idconformance-classes:the-i-element>a href#the-i-element>i/a>/code>, and code idconformance-classes:the-span-element>a href#the-span-element>span/a>/code> and making liberal use of the code idconformance-classes:the-style-attribute>a href#the-style-attribute>style/a>/code> attribute./p> p>All authoring tools, whether WYSIWYG or not, should make a best effort attempt at enabling users to create well-structured, semantically rich, media-independent content./p> /dl> p idhardwareLimitations>User agents may impose implementation-specific limits on otherwise unconstrained inputs, e.g. to prevent denial of service attacks, to guard against running out of memory, or to work around platform-specific limitations. a href#fingerprinting-vector idconformance-classes:fingerprinting-vector classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> p>For compatibility with existing content and prior specifications, this specification describes two authoring formats: one based on a href#the-xhtml-syntax idconformance-classes:the-xhtml-syntax-2>XML/a>, and one using a a href#writing>custom format/a> inspired by SGML (referred to as a href#syntax idconformance-classes:syntax-2>the HTML syntax/a>). Implementations must support at least one of these two formats, although supporting both is encouraged./p> p>Some conformance requirements are phrased as requirements on elements, attributes, methods or objects. Such requirements fall into two categories: those describing content model restrictions, and those describing implementation behavior. Those in the former category are requirements on documents and authoring tools. Those in the second category are requirements on user agents. Similarly, some conformance requirements are phrased as requirements on authors; such requirements are to be interpreted as conformance requirements on the documents that authors produce. (In other words, this specification does not distinguish between conformance criteria on authors and conformance criteria on documents.)/p> h4 iddependencies>span classsecno>2.1.9/span> Dependenciesa href#dependencies classself-link>/a>/h4> div data-noexport> p>This specification relies on several other underlying specifications./p> dl>dt>Infradd> p>The following terms are defined in the WHATWG Infra standard: a href#refsINFRA>INFRA/a>/p> ul classbrief>li>The general iteration terms dfn idwhile>a hrefhttps://infra.spec.whatwg.org/#iteration-while>while/a>/dfn>, dfn idcontinue>a hrefhttps://infra.spec.whatwg.org/#iteration-continue>continue/a>/dfn>, and dfn idbreak>a hrefhttps://infra.spec.whatwg.org/#iteration-break>break/a>/dfn>.li>dfn idcode-point>a hrefhttps://infra.spec.whatwg.org/#code-point>code point/a>/dfn> and its synonym dfn idcharacter>a hrefhttps://infra.spec.whatwg.org/#code-point>character/a>/dfn>li>dfn idsurrogate>a hrefhttps://infra.spec.whatwg.org/#surrogate>surrogate/a>/dfn>li>dfn idscalar-value>a hrefhttps://infra.spec.whatwg.org/#scalar-value>scalar value/a>/dfn>li>dfn idnoncharacter>a hrefhttps://infra.spec.whatwg.org/#noncharacter>noncharacter/a>/dfn>li>dfn idjavascript-string>a hrefhttps://infra.spec.whatwg.org/#javascript-string>JavaScript string/a>/dfn>, dfn idcode-unit>a hrefhttps://infra.spec.whatwg.org/#code-unit>code unit/a>/dfn>, and dfn idjavascript-string-length>a hrefhttps://infra.spec.whatwg.org/#javascript-string-length>JavaScript string length/a>/dfn>li>dfn idscalar-value-string>a hrefhttps://infra.spec.whatwg.org/#scalar-value-string>scalar value string/a>/dfn>li>dfn idstring-length>a hrefhttps://infra.spec.whatwg.org/#string-length>string length/a>/dfn>li>dfn idspace-characters>a hrefhttps://infra.spec.whatwg.org/#ascii-whitespace>ASCII whitespace/a>/dfn>li>dfn idcontrol>a hrefhttps://infra.spec.whatwg.org/#control>control/a>/dfn>li>dfn idascii-digits>a hrefhttps://infra.spec.whatwg.org/#ascii-digit>ASCII digit/a>/dfn>li>dfn iduppercase-ascii-hex-digits>a hrefhttps://infra.spec.whatwg.org/#ascii-upper-hex-digit>ASCII upper hex digit/a>/dfn>li>dfn idlowercase-ascii-hex-digits>a hrefhttps://infra.spec.whatwg.org/#ascii-lower-hex-digit>ASCII lower hex digit/a>/dfn>li>dfn idascii-hex-digits>a hrefhttps://infra.spec.whatwg.org/#ascii-hex-digit>ASCII hex digit/a>/dfn>li>dfn iduppercase-ascii-letters>a hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha>ASCII upper alpha/a>/dfn>li>dfn idlowercase-ascii-letters>a hrefhttps://infra.spec.whatwg.org/#ascii-lower-alpha>ASCII lower alpha/a>/dfn>li>dfn idascii-letters>a hrefhttps://infra.spec.whatwg.org/#ascii-alpha>ASCII alpha/a>/dfn>li>dfn idalphanumeric-ascii-characters>a hrefhttps://infra.spec.whatwg.org/#ascii-alphanumeric>ASCII alphanumeric/a>/dfn>li>dfn idconverted-to-ascii-lowercase>a hrefhttps://infra.spec.whatwg.org/#ascii-lowercase>ASCII lowercase/a>/dfn>li>dfn idconverted-to-ascii-uppercase>a hrefhttps://infra.spec.whatwg.org/#ascii-uppercase>ASCII uppercase/a>/dfn>li>dfn idascii-case-insensitive>a hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive>ASCII case-insensitive/a>/dfn>li>dfn idstrip-newlines>a hrefhttps://infra.spec.whatwg.org/#strip-newlines>strip newlines/a>/dfn>li>dfn idstrip-leading-and-trailing-ascii-whitespace>a hrefhttps://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace>strip leading and trailing ASCII whitespace/a>/dfn>li>dfn idstrip-and-collapse-ascii-whitespace>a hrefhttps://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace>strip and collapse ASCII whitespace/a>/dfn>li>dfn idsplit-a-string-on-spaces>a hrefhttps://infra.spec.whatwg.org/#split-on-ascii-whitespace>split a string on ASCII whitespace/a>/dfn>li>dfn idsplit-a-string-on-commas>a hrefhttps://infra.spec.whatwg.org/#split-on-commas>split a string on commas/a>/dfn>li>dfn idcollect-a-sequence-of-code-points>a hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points>collect a sequence of code points/a>/dfn> and its associated dfn idposition-variable>a hrefhttps://infra.spec.whatwg.org/#string-position-variable>position variable/a>/dfn>li>dfn idskip-ascii-whitespace>a hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace>skip ASCII whitespace/a>/dfn>li>The dfn idordered-map>a hrefhttps://infra.spec.whatwg.org/#ordered-map>ordered map/a>/dfn> data structure and the associated definitions for dfn idmap-exists>a hrefhttps://infra.spec.whatwg.org/#map-exists>exists/a>/dfn>, dfn idmap-get>a hrefhttps://infra.spec.whatwg.org/#map-get>getting the value of an entry/a>/dfn>, and dfn idmap-set>a hrefhttps://infra.spec.whatwg.org/#map-set>setting the value of an entry/a>/dfn>li>The dfn idlist>a hrefhttps://infra.spec.whatwg.org/#list>list/a>/dfn> data structure and the associated definitions for dfn idlist-append>a hrefhttps://infra.spec.whatwg.org/#list-append>append/a>/dfn>, dfn idlist-replace>a hrefhttps://infra.spec.whatwg.org/#list-remove>replace/a>/dfn>, dfn idlist-remove>a hrefhttps://infra.spec.whatwg.org/#list-remove>remove/a>/dfn>, dfn idlist-empty>a hrefhttps://infra.spec.whatwg.org/#list-empty>empty/a>/dfn>, dfn idlist-contains>a hrefhttps://infra.spec.whatwg.org/#list-contain>contains/a>/dfn>, dfn idlist-size>a hrefhttps://infra.spec.whatwg.org/#list-size>size/a>/dfn>, dfn idlist-is-empty>a hrefhttps://infra.spec.whatwg.org/#list-is-empty>is empty/a>/dfn>, and dfn idlist-iterate>a hrefhttps://infra.spec.whatwg.org/#list-iterate>iterate/a>/dfn>li>The dfn idstack>a hrefhttps://infra.spec.whatwg.org/#stack>stack/a>/dfn> data structure and the associated definitions for dfn idstack-push>a hrefhttps://infra.spec.whatwg.org/#stack-push>push/a>/dfn> and dfn idstack-pop>a hrefhttps://infra.spec.whatwg.org/#stack-pop>pop/a>/dfn>li>The dfn idqueue>a hrefhttps://infra.spec.whatwg.org/#queue>queue/a>/dfn> data structure and the associated definitions for dfn idenqueue>a hrefhttps://infra.spec.whatwg.org/#queue-enqueue>enqueue/a>/dfn> and dfn iddequeue>a hrefhttps://infra.spec.whatwg.org/#queue-dequeue>dequeue/a>/dfn>li>The dfn idset>a hrefhttps://infra.spec.whatwg.org/#ordered-set>ordered set/a>/dfn> data structure and the associated definition for dfn idset-append>a hrefhttps://infra.spec.whatwg.org/#set-append>append/a>/dfn>li>The dfn idstruct>a hrefhttps://infra.spec.whatwg.org/#struct>struct/a>/dfn> specification type and the associated definition for dfn idstruct-item>a hrefhttps://infra.spec.whatwg.org/#struct-item>item/a>/dfn>li>The dfn idforgiving-base64-encode>a hrefhttps://infra.spec.whatwg.org/#forgiving-base64-encode>forgiving-base64 encode/a>/dfn> and dfn idforgiving-base64-decode>a hrefhttps://infra.spec.whatwg.org/#forgiving-base64-decode>forgiving-base64 decode/a>/dfn> algorithmsli>dfn idhtml-namespace-2>a hrefhttps://infra.spec.whatwg.org/#html-namespace>HTML namespace/a>/dfn>li>dfn idmathml-namespace>a hrefhttps://infra.spec.whatwg.org/#mathml-namespace>MathML namespace/a>/dfn>li>dfn idsvg-namespace>a hrefhttps://infra.spec.whatwg.org/#svg-namespace>SVG namespace/a>/dfn>li>dfn idxlink-namespace>a hrefhttps://infra.spec.whatwg.org/#xlink-namespace>XLink namespace/a>/dfn>li>dfn idxml-namespace>a hrefhttps://infra.spec.whatwg.org/#xml-namespace>XML namespace/a>/dfn>li>dfn idxmlns-namespace>a hrefhttps://infra.spec.whatwg.org/#xmlns-namespace>XMLNS namespace/a>/dfn>/ul> dt>Unicode and Encodingdd> p>The Unicode character set is used to represent textual data, and the WHATWG Encoding standard defines requirements around a hrefhttps://encoding.spec.whatwg.org/#encoding iddependencies:encoding data-x-internalencoding>character encodings/a>. a href#refsUNICODE>UNICODE/a>/p> p classnote>This specification a href#encoding-terminology>introduces terminology/a> based on the terms defined in those specifications, as described earlier./p> p>The following terms are used as defined in the WHATWG Encoding standard: a href#refsENCODING>ENCODING/a>/p> ul classbrief>li>dfn idgetting-an-encoding>a hrefhttps://encoding.spec.whatwg.org/#concept-encoding-get>Getting an encoding/a>/dfn>li>dfn idget-an-output-encoding>a hrefhttps://encoding.spec.whatwg.org/#get-an-output-encoding>Get an output encoding/a>/dfn>li>The generic dfn iddecode>a hrefhttps://encoding.spec.whatwg.org/#decode>decode/a>/dfn> algorithm which takes a byte stream and an encoding and returns a character streamli>The dfn idutf-8-decode>a hrefhttps://encoding.spec.whatwg.org/#utf-8-decode>UTF-8 decode/a>/dfn> algorithm which takes a byte stream and returns a character stream, additionally stripping one leading UTF-8 Byte Order Mark (BOM), if anyli>The dfn idutf-8-decode-without-bom>a hrefhttps://encoding.spec.whatwg.org/#utf-8-decode-without-bom>UTF-8 decode without BOM/a>/dfn> algorithm which is identical to a iddependencies:utf-8-decode hrefhttps://encoding.spec.whatwg.org/#utf-8-decode data-x-internalutf-8-decode>UTF-8 decode/a> except that it does not strip one leading UTF-8 Byte Order Mark (BOM)li>The dfn idutf-8-decode-without-bom-or-fail>a hrefhttps://encoding.spec.whatwg.org/#utf-8-decode-without-bom-or-fail>UTF-8 decode without BOM or fail/a>/dfn> algorithm which is identical to a iddependencies:utf-8-decode-without-bom hrefhttps://encoding.spec.whatwg.org/#utf-8-decode-without-bom data-x-internalutf-8-decode-without-bom>UTF-8 decode without BOM/a> except that it returns failure upon encountering an errorli>The dfn idencode>a hrefhttps://encoding.spec.whatwg.org/#encode>encode/a>/dfn> algorithm which takes a character stream and an encoding and returns a byte streamli>The dfn idutf-8-encode>a hrefhttps://encoding.spec.whatwg.org/#utf-8-encode>UTF-8 encode/a>/dfn> algorithm which takes a character stream and returns a byte stream/ul> dt>XML and related specificationsdd> p>Implementations that support a href#the-xhtml-syntax iddependencies:the-xhtml-syntax>the XML syntax/a> for HTML must support some version of XML, as well as its corresponding namespaces specification, because that syntax uses an XML serialization with namespaces. a href#refsXML>XML/a> a href#refsXMLNS>XMLNS/a>/p> p>Data mining tools and other user agents that perform operations on content without running scripts, evaluating CSS or XPath expressions, or otherwise exposing the resulting DOM to arbitrary content, may support namespaces by just asserting that their DOM node analogues are in certain namespaces, without actually exposing the namespace strings./p> p classnote>In a href#syntax iddependencies:syntax>the HTML syntax/a>, namespace prefixes and namespace declarations do not have the same effect as in XML. For instance, the colon has no special meaning in HTML element names./p> hr> p>The attribute with the tag name dfn idattr-xml-space>code>xml:space/code>/dfn> in the a iddependencies:xml-namespace hrefhttps://infra.spec.whatwg.org/#xml-namespace data-x-internalxml-namespace>XML namespace/a> is defined by the XML specification. a href#refsXML>XML/a>/p> p>The dfn idxml-name>a hrefhttps://www.w3.org/TR/xml/#NT-Name>code>Name/code>/a>/dfn> production is defined in the XML specification. a href#refsXML>XML/a>/p> p>This specification also references the dfn idxml-stylesheet>a hrefhttps://www.w3.org/TR/xml-stylesheet/#the-xml-stylesheet-processing-instruction>code><?xml-stylesheet?>/code>/a>/dfn> processing instruction, defined in the cite>Associating Style Sheets with XML documents/cite> specification. a href#refsXMLSSPI>XMLSSPI/a>/p> p>This specification also non-normatively mentions the dfn idxsltprocessor>code>XSLTProcessor/code>/dfn> interface and its dfn iddom-xsltprocessor-transformtofragment>code>transformToFragment()/code>/dfn> and dfn iddom-xsltprocessor-transformtodocument>code>transformToDocument()/code>/dfn> methods. a href#refsXSLTP>XSLTP/a>/p> dt>URLsdd> p>The following terms are defined in the WHATWG URL standard: a href#refsURL>URL/a>/p> ul classbrief>li>dfn idconcept-host>a hrefhttps://url.spec.whatwg.org/#concept-host>host/a>/dfn>li>dfn idconcept-domain>a hrefhttps://url.spec.whatwg.org/#concept-domain>domain/a>/dfn>li>dfn idipv4-address>a hrefhttps://url.spec.whatwg.org/#concept-ipv4>IPv4 address/a>/dfn>li>dfn idipv6-address>a hrefhttps://url.spec.whatwg.org/#concept-ipv6>IPv6 address/a>/dfn>li>dfn idurl>a hrefhttps://url.spec.whatwg.org/#concept-url>URL/a>/dfn>li>dfn data-dfn-forurl idconcept-url-origin>a hrefhttps://url.spec.whatwg.org/#concept-url-origin>Origin/a>/dfn> of URLsli>dfn idabsolute-url>a hrefhttps://url.spec.whatwg.org/#syntax-url-absolute>Absolute URL/a>/dfn>li>dfn idrelative-url>a hrefhttps://url.spec.whatwg.org/#syntax-url-relative>Relative URL/a>/dfn>li> The dfn idurl-parser>a hrefhttps://url.spec.whatwg.org/#concept-url-parser>URL parser/a>/dfn> and dfn idbasic-url-parser>a hrefhttps://url.spec.whatwg.org/#concept-basic-url-parser>basic URL parser/a>/dfn> as well as these parser states: ul classbrief>li>dfn idscheme-start-state>a hrefhttps://url.spec.whatwg.org/#scheme-start-state>scheme start state/a>/dfn>li>dfn idhost-state>a hrefhttps://url.spec.whatwg.org/#host-state>host state/a>/dfn>li>dfn idhostname-state>a hrefhttps://url.spec.whatwg.org/#hostname-state>hostname state/a>/dfn>li>dfn idport-state>a hrefhttps://url.spec.whatwg.org/#port-state>port state/a>/dfn>li>dfn idpath-start-state>a hrefhttps://url.spec.whatwg.org/#path-start-state>path start state/a>/dfn>li>dfn idquery-state>a hrefhttps://url.spec.whatwg.org/#query-state>query state/a>/dfn>li>dfn idfragment-state>a hrefhttps://url.spec.whatwg.org/#fragment-state>fragment state/a>/dfn>/ul> li> dfn idurl-record>a hrefhttps://url.spec.whatwg.org/#concept-url>URL record/a>/dfn>, as well as its individual components: ul classbrief>li>dfn idconcept-url-scheme>a hrefhttps://url.spec.whatwg.org/#concept-url-scheme>scheme/a>/dfn>li>dfn idconcept-url-username>a hrefhttps://url.spec.whatwg.org/#concept-url-username>username/a>/dfn>li>dfn idconcept-url-password>a hrefhttps://url.spec.whatwg.org/#concept-url-password>password/a>/dfn>li>dfn idconcept-url-host>a hrefhttps://url.spec.whatwg.org/#concept-url-host>host/a>/dfn>li>dfn idconcept-url-port>a hrefhttps://url.spec.whatwg.org/#concept-url-port>port/a>/dfn>li>dfn idconcept-url-path>a hrefhttps://url.spec.whatwg.org/#concept-url-path>path/a>/dfn>li>dfn idconcept-url-query>a hrefhttps://url.spec.whatwg.org/#concept-url-query>query/a>/dfn>li>dfn idconcept-url-fragment>a hrefhttps://url.spec.whatwg.org/#concept-url-fragment>fragment/a>/dfn>li>dfn idcannot-be-a-base-url-flag>a hrefhttps://url.spec.whatwg.org/#url-cannot-be-a-base-url-flag>cannot-be-a-base-URL flag/a>/dfn>li>dfn idconcept-url-object>a hrefhttps://url.spec.whatwg.org/#concept-url-object>object/a>/dfn>/ul> li>dfn idvalid-url-string>a hrefhttps://url.spec.whatwg.org/#valid-url-string>valid URL string/a>/dfn>li>The dfn idcannot-have-a-username/password/port>a hrefhttps://url.spec.whatwg.org/#cannot-have-a-username-password-port>cannot have a username/password/port/a>/dfn> conceptli>The dfn idconcept-url-serializer>a hrefhttps://url.spec.whatwg.org/#concept-url-serializer>URL serializer/a>/dfn>li>The dfn idhost-parser>a hrefhttps://url.spec.whatwg.org/#concept-host-parser>host parser/a>/dfn>li>The dfn idhost-serializer>a hrefhttps://url.spec.whatwg.org/#concept-host-serializer>host serializer/a>/dfn>li>dfn idhost-equals>a hrefhttps://url.spec.whatwg.org/#concept-host-equals>Host equals/a>/dfn>li>dfn idconcept-url-equals>a hrefhttps://url.spec.whatwg.org/#concept-url-equals>URL equals/a>/dfn>li>dfn idserialize-an-integer>a hrefhttps://url.spec.whatwg.org/#serialize-an-integer>serialize an integer/a>/dfn>li>dfn iddefault-encode-set>a hrefhttps://url.spec.whatwg.org/#default-encode-set>Default encode set/a>/dfn>li>dfn idutf-8-percent-encode>a hrefhttps://url.spec.whatwg.org/#utf-8-percent-encode>UTF-8 percent encode/a>/dfn>li>dfn idpercent-decode>a hrefhttps://url.spec.whatwg.org/#percent-decode>Percent decode/a>/dfn>li>dfn idset-the-username>a hrefhttps://url.spec.whatwg.org/#set-the-username>set the username/a>/dfn>li>dfn idset-the-password>a hrefhttps://url.spec.whatwg.org/#set-the-password>set the password/a>/dfn>li>The dfn idapplication/x-www-form-urlencoded>a hrefhttps://url.spec.whatwg.org/#concept-urlencoded>code>application/x-www-form-urlencoded/code>/a>/dfn> formatli>The dfn idapplication/x-www-form-urlencoded-serializer>a hrefhttps://url.spec.whatwg.org/#concept-urlencoded-serializer>code>application/x-www-form-urlencoded/code> serializer/a>/dfn>/ul> p>A number of schemes and protocols are referenced by this specification also:/p> ul classbrief>li>The dfn idabout-protocol>a hrefhttps://tools.ietf.org/html/rfc6694#section-2>code>about:/code>/a>/dfn> scheme a href#refsABOUT>ABOUT/a>li>The dfn idblob-protocol>a hrefhttps://w3c.github.io/FileAPI/#DefinitionOfScheme>code>blob:/code>/a>/dfn> scheme a href#refsFILEAPI>FILEAPI/a>li>The dfn iddata-protocol>a hrefhttps://tools.ietf.org/html/rfc2397#section-2>code>data:/code>/a>/dfn> scheme a href#refsRFC2397>RFC2397/a>li>The dfn idhttp-protocol>a hrefhttps://tools.ietf.org/html/rfc7230#section-2.7.1>code>http:/code>/a>/dfn> scheme a href#refsHTTP>HTTP/a>li>The dfn idhttps-protocol>a hrefhttps://tools.ietf.org/html/rfc7230#section-2.7.2>code>https:/code>/a>/dfn> scheme a href#refsHTTP>HTTP/a>li>The dfn idmailto-protocol>a hrefhttps://tools.ietf.org/html/rfc6068#section-2>code>mailto:/code>/a>/dfn> scheme a href#refsMAILTO>MAILTO/a>li>The dfn idsms-protocol>a hrefhttps://tools.ietf.org/html/rfc5724#section-2>code>sms:/code>/a>/dfn> scheme a href#refsSMS>SMS/a>li>The dfn idurn-protocol>a hrefhttps://tools.ietf.org/html/rfc2141#section-2>code>urn:/code>/a>/dfn> scheme a href#refsURN>URN/a>/ul> p>dfn idmedia-fragment-syntax>a hrefhttps://www.w3.org/TR/media-frags/#media-fragment-syntax>Media fragment syntax/a>/dfn> is defined in the cite>Media Fragments URI/cite> specification. a href#refsMEDIAFRAG>MEDIAFRAG/a>/p> dt>HTTP and related specificationsdd> p>The following terms are defined in the HTTP specifications: a href#refsHTTP>HTTP/a>/p> ul classbrief>li>`dfn idhttp-accept>a hrefhttps://tools.ietf.org/html/rfc7231#section-5.3.2>code>Accept/code>/a>/dfn>` headerli>`dfn idhttp-accept-language>a hrefhttps://tools.ietf.org/html/rfc7231#section-5.3.5>code>Accept-Language/code>/a>/dfn>` headerli>`dfn idhttp-cache-control>a hrefhttps://tools.ietf.org/html/rfc7234#section-5.2>code>Cache-Control/code>/a>/dfn>` headerli>`dfn idhttp-content-disposition>a hrefhttps://tools.ietf.org/html/rfc6266>code>Content-Disposition/code>/a>/dfn>` headerli>`dfn idhttp-content-language>a hrefhttps://tools.ietf.org/html/rfc7231#section-3.1.3.2>code>Content-Language/code>/a>/dfn>` headerli>`dfn idhttp-last-modified>a hrefhttps://tools.ietf.org/html/rfc7232#section-2.2>code>Last-Modified/code>/a>/dfn>` headerli>`dfn idhttp-referer>a hrefhttps://tools.ietf.org/html/rfc7231#section-5.5.2>code>Referer/code>/a>/dfn>` header/ul> p>The following terms are defined in the Cookie specification: a href#refsCOOKIES>COOKIES/a>/p> ul classbrief>li>dfn idcookie-string>cookie-string/dfn>li>dfn idreceives-a-set-cookie-string>receives a set-cookie-string/dfn>li>`dfn idhttp-cookie>code>Cookie/code>/dfn>` header/ul> p>The following term is defined in the Web Linking specification: a href#refsWEBLINK>WEBLINK/a>/p> ul classbrief>li>`dfn idhttp-link>a hrefhttps://tools.ietf.org/html/rfc5988#section-5>code>Link/code>/a>/dfn>` header/ul> p>The following terms are defined in the WHATWG MIME Sniffing standard: a href#refsMIMESNIFF>MIMESNIFF/a>/p> ul classbrief>li>dfn idmime-type>a hrefhttps://mimesniff.spec.whatwg.org/#mime-type>MIME type/a>/dfn>li>dfn idvalid-mime-type>a hrefhttps://mimesniff.spec.whatwg.org/#valid-mime-type>valid MIME type/a>/dfn>li>dfn idvalid-mime-type-with-no-parameters>a hrefhttps://mimesniff.spec.whatwg.org/#valid-mime-type-with-no-parameters>valid MIME type with no parameters/a>/dfn>li>dfn idxml-mime-type>a hrefhttps://mimesniff.spec.whatwg.org/#xml-mime-type>XML MIME type/a>/dfn>li>dfn idhtml-mime-type>a hrefhttps://mimesniff.spec.whatwg.org/#html-mime-type>HTML MIME type/a>/dfn>/ul> dt>Fetchdd> p>The following terms are defined in the WHATWG Fetch standard: a href#refsFETCH>FETCH/a>/p> ul classbrief>li>dfn idabout:blank>code>about:blank/code>/dfn>li>An dfn idhttp(s)-scheme>a hrefhttps://fetch.spec.whatwg.org/#http-scheme>HTTP(S) scheme/a>/dfn>li>A dfn idnetwork-scheme>a hrefhttps://fetch.spec.whatwg.org/#network-scheme>network scheme/a>/dfn>li>A dfn idfetch-scheme>a hrefhttps://fetch.spec.whatwg.org/#fetch-scheme>fetch scheme/a>/dfn>li>dfn idhttps-state-value>a hrefhttps://fetch.spec.whatwg.org/#concept-https-state-value>HTTPS state value/a>/dfn>li>dfn idcors-protocol>a hrefhttps://fetch.spec.whatwg.org/#http-cors-protocol>CORS protocol/a>/dfn>li>dfn iddefault-user-agent-value>a hrefhttps://fetch.spec.whatwg.org/#default-user-agent-value>default `code>User-Agent/code>` value/a>/dfn>li>dfn idextract-a-mime-type>a hrefhttps://fetch.spec.whatwg.org/#concept-header-extract-mime-type>extract a MIME type/a>/dfn>li>dfn idconcept-fetch>a hrefhttps://fetch.spec.whatwg.org/#concept-fetch>fetch/a>/dfn>li>dfn idhttp-redirect-fetch>a hrefhttps://fetch.spec.whatwg.org/#concept-http-redirect-fetch>HTTP-redirect fetch/a>/dfn>li>dfn idok-status>a hrefhttps://fetch.spec.whatwg.org/#ok-status>ok status/a>/dfn>li>dfn idnavigation-request>a hrefhttps://fetch.spec.whatwg.org/#navigation-request>navigation request/a>/dfn>li>dfn idnetwork-error>a hrefhttps://fetch.spec.whatwg.org/#concept-network-error>network error/a>/dfn>li>`dfn idhttp-origin data-dfn-typehttp-header>a hrefhttps://fetch.spec.whatwg.org/#http-origin>code>Origin/code>/a>/dfn>` headerli>dfn idprocess-response>a hrefhttps://fetch.spec.whatwg.org/#process-response>process response/a>/dfn>li>dfn idconcept-header-list-set>a hrefhttps://fetch.spec.whatwg.org/#concept-header-list-set>set/a>/dfn>li>dfn idconcept-fetch-terminate>a hrefhttps://fetch.spec.whatwg.org/#concept-fetch-terminate>terminate/a>/dfn>li>the dfn idrequestcredentials>a hrefhttps://fetch.spec.whatwg.org/#requestcredentials>code>RequestCredentials/code>/a>/dfn> enumerationli>the dfn idrequestdestination>a hrefhttps://fetch.spec.whatwg.org/#requestdestination>code>RequestDestination/code>/a>/dfn> enumerationli> dfn idconcept-response>a hrefhttps://fetch.spec.whatwg.org/#concept-response>response/a>/dfn> and its associated: ul classbrief>li>dfn idconcept-response-type>a hrefhttps://fetch.spec.whatwg.org/#concept-response-type>type/a>/dfn>li>dfn idconcept-response-url>a hrefhttps://fetch.spec.whatwg.org/#concept-response-url>url/a>/dfn>li>dfn idconcept-response-url-list>a hrefhttps://fetch.spec.whatwg.org/#concept-response-url-list>url list/a>/dfn>li>dfn idconcept-response-status>a hrefhttps://fetch.spec.whatwg.org/#concept-response-status>status/a>/dfn>li>dfn idconcept-response-header-list>a hrefhttps://fetch.spec.whatwg.org/#concept-response-header-list>header list/a>/dfn>li>dfn idconcept-response-body>a hrefhttps://fetch.spec.whatwg.org/#concept-response-body>body/a>/dfn>li>dfn idconcept-internal-response>a hrefhttps://fetch.spec.whatwg.org/#concept-internal-response>internal response/a>/dfn>li>dfn idconcept-response-csp-list>a hrefhttps://fetch.spec.whatwg.org/#concept-response-csp-list>CSP list/a>/dfn>li>dfn idconcept-response-https-state>a hrefhttps://fetch.spec.whatwg.org/#concept-response-https-state>HTTPS state/a>/dfn>li>dfn idconcept-response-location-url>a hrefhttps://fetch.spec.whatwg.org/#concept-response-location-url>location URL/a>/dfn>/ul> li> dfn idconcept-request>a hrefhttps://fetch.spec.whatwg.org/#concept-request>request/a>/dfn> and its associated: ul classbrief>li>dfn idconcept-request-url>a hrefhttps://fetch.spec.whatwg.org/#concept-request-url>url/a>/dfn>li>dfn idconcept-request-method>a hrefhttps://fetch.spec.whatwg.org/#concept-request-method>method/a>/dfn>li>dfn idconcept-request-header-list>a hrefhttps://fetch.spec.whatwg.org/#concept-request-header-list>header list/a>/dfn>li>dfn idconcept-request-body>a hrefhttps://fetch.spec.whatwg.org/#concept-request-body>body/a>/dfn>li>dfn idconcept-request-client>a hrefhttps://fetch.spec.whatwg.org/#concept-request-client>client/a>/dfn>li>dfn idconcept-request-reserved-client>a hrefhttps://fetch.spec.whatwg.org/#concept-request-reserved-client>reserved client/a>/dfn>li>dfn idconcept-request-target-client-id>a hrefhttps://fetch.spec.whatwg.org/#concept-request-target-client-id>target client id/a>/dfn>li>dfn idconcept-request-initiator>a hrefhttps://fetch.spec.whatwg.org/#concept-request-initiator>initiator/a>/dfn>li>dfn idconcept-request-destination>a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination>destination/a>/dfn>li>dfn idconcept-potential-destination>a hrefhttps://fetch.spec.whatwg.org/#concept-potential-destination>potential destination/a>/dfn>li>dfn idconcept-potential-destination-translate>a hrefhttps://fetch.spec.whatwg.org/#concept-potential-destination-translate>translating/a>/dfn> a a hrefhttps://fetch.spec.whatwg.org/#concept-potential-destination iddependencies:concept-potential-destination data-x-internalconcept-potential-destination>potential destination/a>li>dfn idconcept-script-like-destination>a hrefhttps://fetch.spec.whatwg.org/#request-destination-script-like>script-like/a>/dfn> a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination iddependencies:concept-request-destination data-x-internalconcept-request-destination>destinations/a>li>dfn idconcept-request-priority>a hrefhttps://fetch.spec.whatwg.org/#concept-request-priority>priority/a>/dfn>li>dfn data-dfn-forrequest idconcept-request-origin>a hrefhttps://fetch.spec.whatwg.org/#concept-request-origin>origin/a>/dfn>li>dfn idconcept-request-referrer>a hrefhttps://fetch.spec.whatwg.org/#concept-request-referrer>referrer/a>/dfn>li>dfn idsynchronous-flag>a hrefhttps://fetch.spec.whatwg.org/#synchronous-flag>synchronous flag/a>/dfn>li>dfn idconcept-request-mode>a hrefhttps://fetch.spec.whatwg.org/#concept-request-mode>mode/a>/dfn>li>dfn idconcept-request-credentials-mode>a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode>credentials mode/a>/dfn>li>dfn iduse-url-credentials-flag>a hrefhttps://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag>use-URL-credentials flag/a>/dfn>li>dfn idunsafe-request-flag>a hrefhttps://fetch.spec.whatwg.org/#unsafe-request-flag>unsafe-request flag/a>/dfn>li>dfn idconcept-request-cache-mode>a hrefhttps://fetch.spec.whatwg.org/#concept-request-cache-mode>cache mode/a>/dfn>li>dfn idconcept-request-redirect-mode>a hrefhttps://fetch.spec.whatwg.org/#concept-request-redirect-mode>redirect mode/a>/dfn>li>dfn idconcept-request-referrer-policy>a hrefhttps://fetch.spec.whatwg.org/#concept-request-referrer-policy>referrer policy/a>/dfn>li>dfn idconcept-request-nonce-metadata>a hrefhttps://fetch.spec.whatwg.org/#concept-request-nonce-metadata>cryptographic nonce metadata/a>/dfn>li>dfn idconcept-request-integrity-metadata>a hrefhttps://fetch.spec.whatwg.org/#concept-request-integrity-metadata>integrity metadata/a>/dfn>li>dfn idconcept-request-parser-metadata>a hrefhttps://fetch.spec.whatwg.org/#concept-request-parser-metadata>parser metadata/a>/dfn>/ul> /ul> p>The following terms are defined in cite>Referrer Policy/cite>: a href#refsREFERRERPOLICY>REFERRERPOLICY/a>/p> ul classbrief>li>dfn idreferrer-policy>a hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy>referrer policy/a>/dfn>li>The `dfn idhttp-referrer-policy>a hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy-header-dfn>code>Referrer-Policy/code>/a>/dfn>` HTTP headerli>The dfn idparse-referrer-policy-header>a hrefhttps://w3c.github.io/webappsec-referrer-policy/#parse-referrer-policy-from-header>parse a referrer policy from a `code>Referrer-Policy/code>` header/a>/dfn> algorithmli>The dfn idreferrer-policy-no-referrer>a hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy-no-referrer>code>no-referrer/code>/a>/dfn>, dfn idreferrer-policy-no-referrer-when-downgrade>a hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy-no-referrer-when-downgrade>code>no-referrer-when-downgrade/code>/a>/dfn>, dfn idreferrer-policy-origin-when-cross-origin>a hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy-origin-when-cross-origin>code>no-referrer-when-downgrade/code>/a>/dfn>, and dfn idreferrer-policy-unsafe-url>a hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy-unsafe-url>code>unsafe-url/code>/a>/dfn> referrer policies/ul> p>The following terms are defined in cite>Mixed Content/cite>: a href#refsMIX>MIX/a>/p> ul classbrief>li>dfn ida-priori-authenticated-url>a hrefhttps://w3c.github.io/webappsec-mixed-content/#a-priori-authenticated-url>i>a priori/i> authenticated URL/a>/dfn>/ul> dt>Web IDLdd> p>The IDL fragments in this specification must be interpreted as required for conforming IDL fragments, as described in the Web IDL specification. a href#refsWEBIDL>WEBIDL/a>/p> p>The following terms are defined in the Web IDL specification:/p> ul classbrief>li>dfn idextended-attribute>a hrefhttps://heycam.github.io/webidl/#dfn-extended-attribute>extended attribute/a>/dfn>li>dfn idnamed-constructor>a hrefhttps://heycam.github.io/webidl/#dfn-named-constructor>named constructor/a>/dfn>li>dfn idarray-index-property-name>a hrefhttps://heycam.github.io/webidl/#dfn-array-index-property-name>array index property name/a>/dfn>li>dfn idsupported-property-indices>a hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices>supported property indices/a>/dfn>li>dfn iddetermine-the-value-of-an-indexed-property>a hrefhttps://heycam.github.io/webidl/#dfn-determine-the-value-of-an-indexed-property>determine the value of an indexed property/a>/dfn>li>dfn idset-the-value-of-an-existing-indexed-property>a hrefhttps://heycam.github.io/webidl/#dfn-set-the-value-of-an-existing-indexed-property>set the value of an existing indexed property/a>/dfn>li>dfn idset-the-value-of-a-new-indexed-property>a hrefhttps://heycam.github.io/webidl/#dfn-set-the-value-of-a-new-indexed-property>set the value of a new indexed property/a>/dfn>li>dfn idsupport-named-properties>a hrefhttps://heycam.github.io/webidl/#dfn-support-named-properties>support named properties/a>/dfn>li>dfn idsupported-property-names>a hrefhttps://heycam.github.io/webidl/#dfn-supported-property-names>supported property names/a>/dfn>li>dfn iddetermine-the-value-of-a-named-property>a hrefhttps://heycam.github.io/webidl/#dfn-determine-the-value-of-a-named-property>determine the value of a named property/a>/dfn>li>dfn idset-the-value-of-an-existing-named-property>a hrefhttps://heycam.github.io/webidl/#dfn-set-the-value-of-an-existing-named-property>set the value of an existing named property/a>/dfn>li>dfn idset-the-value-of-a-new-named-property>a hrefhttps://heycam.github.io/webidl/#dfn-set-the-value-of-a-new-named-property>set the value of a new named property/a>/dfn>li>dfn iddelete-an-existing-named-property>a hrefhttps://heycam.github.io/webidl/#dfn-delete-an-existing-named-property>delete an existing named property/a>/dfn>li>dfn idperform-a-security-check>a hrefhttps://heycam.github.io/webidl/#dfn-perform-a-security-check>perform a security check/a>/dfn>li>dfn idplatform-object>a hrefhttps://heycam.github.io/webidl/#dfn-platform-object>platform object/a>/dfn>li>dfn idlegacy-platform-object>a hrefhttps://heycam.github.io/webidl/#dfn-legacy-platform-object>legacy platform object/a>/dfn>li>dfn idprimary-interface>a hrefhttps://heycam.github.io/webidl/#dfn-primary-interface>primary interface/a>/dfn>li>dfn idinterface-object>a hrefhttps://heycam.github.io/webidl/#dfn-interface-object>interface object/a>/dfn>li>dfn idinterface-prototype-object>a hrefhttps://heycam.github.io/webidl/#dfn-interface-prototype-object>interface prototype object/a>/dfn>li>dfn idglobal-environment-associated-with>a hrefhttps://heycam.github.io/webidl/#es-platform-objects>global environment associated with/a>/dfn> a platform objectli>dfn idcallback-context>a hrefhttps://heycam.github.io/webidl/#dfn-callback-context>callback context/a>/dfn>li>dfn idfrozen-array>a hrefhttps://heycam.github.io/webidl/#dfn-frozen-array-type>frozen array/a>/dfn> and dfn idcreating-a-frozen-array>a hrefhttps://heycam.github.io/webidl/#dfn-create-frozen-array>creating a frozen array/a>/dfn>li>dfn iddfn-callback-this-value>a hrefhttps://heycam.github.io/webidl/#dfn-callback-this-value>callback this value/a>/dfn>li>dfn idconcept-idl-convert>a hrefhttps://heycam.github.io/webidl/#es-type-mapping>converting/a>/dfn> between Web IDL types and JS typesli>dfn ides-invoking-callback-functions>a hrefhttps://heycam.github.io/webidl/#invoke-a-callback-function>invoking/a>/dfn> and dfn ides-constructing-callback-functions>a hrefhttps://heycam.github.io/webidl/#construct-a-callback-function>constructing/a>/dfn> callback functionsli>dfn idconverting-to-a-sequence-of-unicode-scalar-values>a hrefhttps://heycam.github.io/webidl/#dfn-obtain-unicode>converting to a sequence of Unicode scalar values/a>/dfn>/ul> p>The Web IDL specification also defines the following types that are used in Web IDL fragments in this specification:/p> ul classbrief>li>dfn ididl-arraybuffer>a hrefhttps://heycam.github.io/webidl/#idl-ArrayBuffer>code>ArrayBuffer/code>/a>/dfn>li>dfn ididl-arraybufferview>a hrefhttps://heycam.github.io/webidl/#common-ArrayBufferView>code>ArrayBufferView/code>/a>/dfn>li>dfn ididl-boolean>a hrefhttps://heycam.github.io/webidl/#idl-boolean>code>boolean/code>/a>/dfn>li>dfn ididl-domstring>a hrefhttps://heycam.github.io/webidl/#idl-DOMString>code>DOMString/code>/a>/dfn>li>dfn ididl-double>a hrefhttps://heycam.github.io/webidl/#idl-double>code>double/code>/a>/dfn>li>dfn ididl-enumeration>a hrefhttps://heycam.github.io/webidl/#idl-enums>enumeration/a>/dfn>li>dfn ididl-error>a hrefhttps://heycam.github.io/webidl/#idl-Error>code>Error/code>/a>/dfn>li>dfn ididl-function>a hrefhttps://heycam.github.io/webidl/#common-Function>code>Function/code>/a>/dfn>li>dfn ididl-long>a hrefhttps://heycam.github.io/webidl/#idl-long>code>long/code>/a>/dfn>li>dfn ididl-object>a hrefhttps://heycam.github.io/webidl/#idl-object>code>object/code>/a>/dfn>li>dfn ididl-uint8clampedarray>a hrefhttps://heycam.github.io/webidl/#idl-Uint8ClampedArray>code>Uint8ClampedArray/code>/a>/dfn>li>dfn ididl-unrestricted-double>a hrefhttps://heycam.github.io/webidl/#idl-unrestricted-double>code>unrestricted double/code>/a>/dfn>li>dfn ididl-unsigned-long>a hrefhttps://heycam.github.io/webidl/#idl-unsigned-long>code>unsigned long/code>/a>/dfn>li>dfn ididl-usvstring>a hrefhttps://heycam.github.io/webidl/#idl-USVString>code>USVString/code>/a>/dfn>/ul> p>The term dfn idthrow>a hrefhttps://heycam.github.io/webidl/#dfn-throw>throw/a>/dfn> in this specification is used as defined in the Web IDL specification. The dfn iddomexception>a hrefhttps://heycam.github.io/webidl/#dfn-DOMException>code>DOMException/code>/a>/dfn> type and the following exception names are defined by Web IDL and used by this specification:/p> ul classbrief>li>dfn idindexsizeerror>a hrefhttps://heycam.github.io/webidl/#indexsizeerror>code>IndexSizeError/code>/a>/dfn>li>dfn idhierarchyrequesterror>a hrefhttps://heycam.github.io/webidl/#hierarchyrequesterror>code>HierarchyRequestError/code>/a>/dfn>li>dfn idinvalidcharactererror>a hrefhttps://heycam.github.io/webidl/#invalidcharactererror>code>InvalidCharacterError/code>/a>/dfn>li>dfn idnotfounderror>a hrefhttps://heycam.github.io/webidl/#notfounderror>code>NotFoundError/code>/a>/dfn>li>dfn idnotsupportederror>a hrefhttps://heycam.github.io/webidl/#notsupportederror>code>NotSupportedError/code>/a>/dfn>li>dfn idinvalidstateerror>a hrefhttps://heycam.github.io/webidl/#invalidstateerror>code>InvalidStateError/code>/a>/dfn>li>dfn idsyntaxerror>a hrefhttps://heycam.github.io/webidl/#syntaxerror>code>SyntaxError/code>/a>/dfn>li>dfn idinvalidaccesserror>a hrefhttps://heycam.github.io/webidl/#invalidaccesserror>code>InvalidAccessError/code>/a>/dfn>li>dfn idsecurityerror>a hrefhttps://heycam.github.io/webidl/#securityerror>code>SecurityError/code>/a>/dfn>li>dfn idnetworkerror>a hrefhttps://heycam.github.io/webidl/#networkerror>code>NetworkError/code>/a>/dfn>li>dfn idaborterror>a hrefhttps://heycam.github.io/webidl/#aborterror>code>AbortError/code>/a>/dfn>li>dfn idquotaexceedederror>a hrefhttps://heycam.github.io/webidl/#quotaexceedederror>code>QuotaExceededError/code>/a>/dfn>li>dfn iddatacloneerror>a hrefhttps://heycam.github.io/webidl/#datacloneerror>code>DataCloneError/code>/a>/dfn>li>dfn idencodingerror>a hrefhttps://heycam.github.io/webidl/#encodingerror>code>EncodingError/code>/a>/dfn>li>dfn idnotallowederror>a hrefhttps://heycam.github.io/webidl/#notallowederror>code>NotAllowedError/code>/a>/dfn>/ul> p>When this specification requires a user agent to dfn idcreate-a-date-object>create a code>Date/code> object/dfn> representing a particular time (which could be the special value Not-a-Number), the milliseconds component of that time, if any, must be truncated to an integer, and the time value of the newly created code iddependencies:date>a data-x-internaldate hrefhttps://tc39.github.io/ecma262/#sec-date-objects>Date/a>/code> object must represent the resulting truncated time./p> p classexample>For instance, given the time 23045 millionths of a second after 01:00 UTC on January 1st 2000, i.e. the time 2000-01-01T00:00:00.023045Z, then the code iddependencies:date-2>a data-x-internaldate hrefhttps://tc39.github.io/ecma262/#sec-date-objects>Date/a>/code> object created representing that time would represent the same time as that created representing the time 2000-01-01T00:00:00.023Z, 45 millionths earlier. If the given time is NaN, then the result is a code iddependencies:date-3>a data-x-internaldate hrefhttps://tc39.github.io/ecma262/#sec-date-objects>Date/a>/code> object that represents a time value NaN (indicating that the object does not represent a specific instant of time)./p> dt>JavaScriptdd> p>Some parts of the language described by this specification only support JavaScript as the underlying scripting language. a href#refsJAVASCRIPT>JAVASCRIPT/a>/p> p>Users agents that support JavaScript must also implement the cite>ECMAScript Internationalization API Specification/cite>. a href#refsJSINTL>JSINTL/a>/p> p classnote>The term JavaScript is used to refer to ECMA-262, rather than the official term ECMAScript, since the term JavaScript is more widely known. Similarly, the a iddependencies:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> used to refer to JavaScript in this specification is code>text/javascript/code>, since that is the most commonly used type, a href#willful-violation iddependencies:willful-violation>despite it being an officially obsoleted type/a> according to RFC 4329. a href#refsRFC4329>RFC4329/a>/p> p>The following terms are defined in the JavaScript specification and used in this specification:/p> ul classbrief>li>dfn idactive-function-object>a hrefhttps://tc39.github.io/ecma262/#active-function-object>active function object/a>/dfn>li>dfn idagent>a hrefhttps://tc39.github.io/ecma262/#sec-agents>agent/a>/dfn> and dfn idagent-cluster>a hrefhttps://tc39.github.io/ecma262/#sec-agent-clusters>agent cluster/a>/dfn>li>dfn idautomatic-semicolon-insertion>a hrefhttps://tc39.github.io/ecma262/#sec-automatic-semicolon-insertion>automatic semicolon insertion/a>/dfn>li>The dfn idcurrent-realm-record>a hrefhttps://tc39.github.io/ecma262/#current-realm>current Realm Record/a>/dfn>li>dfn idearly-error>a hrefhttps://tc39.github.io/ecma262/#early-error-rule>early error/a>/dfn>li>dfn iddirective-prologue>a hrefhttps://tc39.github.io/ecma262/#directive-prologue>Directive Prologue/a>/dfn>li>dfn idinvariants-of-the-essential-internal-methods>a hrefhttps://tc39.github.io/ecma262/#sec-invariants-of-the-essential-internal-methods>invariants of the essential internal methods/a>/dfn>li>dfn idjavascript-execution-context>a hrefhttps://tc39.github.io/ecma262/#sec-execution-contexts>JavaScript execution context/a>/dfn>li>dfn idjavascript-execution-context-stack>a hrefhttps://tc39.github.io/ecma262/#execution-context-stack>JavaScript execution context stack/a>/dfn>li>dfn idjavascript-realm>a hrefhttps://tc39.github.io/ecma262/#sec-code-realms>JavaScript realm/a>/dfn>li>dfn idrunning-javascript-execution-context>a hrefhttps://tc39.github.io/ecma262/#running-execution-context>running JavaScript execution context/a>/dfn>li>dfn iduse-strict-directive>a hrefhttps://tc39.github.io/ecma262/#use-strict-directive>Use Strict Directive/a>/dfn>li>dfn idwell-known-symbols>a hrefhttps://tc39.github.io/ecma262/#sec-well-known-symbols>Well-Known Symbols/a>/dfn>, including dfn id@@hasinstance>@@hasInstance/dfn>, dfn id@@isconcatspreadable>@@isConcatSpreadable/dfn>, dfn id@@toprimitive>@@toPrimitive/dfn>, and dfn id@@tostringtag>@@toStringTag/dfn>li>dfn idwell-known-intrinsic-objects>a hrefhttps://tc39.github.io/ecma262/#sec-well-known-intrinsic-objects>Well-Known Intrinsic Objects/a>/dfn>, including dfn idarraybuffer>a hrefhttps://tc39.github.io/ecma262/#sec-arraybuffer-constructor>%ArrayBuffer%/a>/dfn>, dfn idarrayprototype>a hrefhttps://tc39.github.io/ecma262/#sec-properties-of-the-array-prototype-object>%ArrayPrototype%/a>/dfn>, and dfn idobjproto_valueof>a hrefhttps://tc39.github.io/ecma262/#sec-object.prototype.valueof>%ObjProto_valueOf%/a>/dfn>li>The dfn idjs-prod-functionbody>a hrefhttps://tc39.github.io/ecma262/#prod-FunctionBody>i>FunctionBody/i>/a>/dfn> productionli>The dfn idjs-prod-module>a hrefhttps://tc39.github.io/ecma262/#prod-Module>i>Module/i>/a>/dfn> productionli>The dfn idjs-prod-pattern>a hrefhttps://tc39.github.io/ecma262/#prod-Pattern>i>Pattern/i>/a>/dfn> productionli>The dfn idjs-prod-script>a hrefhttps://tc39.github.io/ecma262/#prod-Script>i>Script/i>/a>/dfn> productionli>The dfn idjs-type>a hrefhttps://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values>Type/a>/dfn> notationli>The dfn idjs-list>a hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type>List/a>/dfn> and dfn idrecord>a hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type>Record/a>/dfn> specification typesli>The dfn idpropertydescriptor>a hrefhttps://tc39.github.io/ecma262/#sec-property-descriptor-specification-type>Property Descriptor/a>/dfn> specification typeli>The dfn idscript-record>a hrefhttps://tc39.github.io/ecma262/#sec-script-records>Script Record/a>/dfn> specification typeli>The dfn idsource-text-module-record>a hrefhttps://tc39.github.io/ecma262/#sec-source-text-module-records>Source Text Module Record/a>/dfn> specification type and its dfn idjs-evaluate>a hrefhttps://tc39.github.io/ecma262/#sec-moduleevaluation>Evaluate/a>/dfn> and dfn idjs-instantiate>a hrefhttps://tc39.github.io/ecma262/#sec-moduledeclarationinstantiation>Instantiate/a>/dfn> methodsli>The dfn idarraycreate>a hrefhttps://tc39.github.io/ecma262/#sec-arraycreate>ArrayCreate/a>/dfn> abstract operationli>The dfn idcall>a hrefhttps://tc39.github.io/ecma262/#sec-call>Call/a>/dfn> abstract operationli>The dfn idconstruct>a hrefhttps://tc39.github.io/ecma262/#sec-construct>Construct/a>/dfn> abstract operationli>The dfn idcopydatablockbytes>a hrefhttps://tc39.github.io/ecma262/#sec-copydatablockbytes>CopyDataBlockBytes/a>/dfn> abstract operationli>The dfn idcreatebytedatablock>a hrefhttps://tc39.github.io/ecma262/#sec-createbytedatablock>CreateByteDataBlock/a>/dfn> abstract operationli>The dfn idcreatedataproperty>a hrefhttps://tc39.github.io/ecma262/#sec-createdataproperty>CreateDataProperty/a>/dfn> abstract operationli>The dfn iddetacharraybuffer>a hrefhttps://tc39.github.io/ecma262/#sec-detacharraybuffer>DetachArrayBuffer/a>/dfn> abstract operationli>The dfn idjs-enqueuejob>a hrefhttps://tc39.github.io/ecma262/#sec-enqueuejob>EnqueueJob/a>/dfn> abstract operationli>The dfn idenumerableownproperties>a hrefhttps://tc39.github.io/ecma262/#sec-enumerableownproperties>EnumerableOwnProperties/a>/dfn> abstract operationli>The dfn idjs-functioncreate>a hrefhttps://tc39.github.io/ecma262/#sec-functioncreate>FunctionCreate/a>/dfn> abstract operationli>The dfn idjs-get>a hrefhttps://tc39.github.io/ecma262/#sec-get-o-p>Get/a>/dfn> abstract operationli>The dfn idgetfunctionrealm>a hrefhttps://tc39.github.io/ecma262/#sec-getfunctionrealm>GetFunctionRealm/a>/dfn> abstract operationli>The dfn idhasownproperty>a hrefhttps://tc39.github.io/ecma262/#sec-hasownproperty>HasOwnProperty/a>/dfn> abstract operationli>The dfn idjs-hostensurecancompilestrings>a hrefhttps://tc39.github.io/ecma262/#sec-hostensurecancompilestrings>HostEnsureCanCompileStrings/a>/dfn> abstract operationli>The dfn idjs-hostpromiserejectiontracker>a hrefhttps://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker>HostPromiseRejectionTracker/a>/dfn> abstract operationli>The dfn idjs-hostresolveimportedmodule>a hrefhttps://tc39.github.io/ecma262/#sec-hostresolveimportedmodule>HostResolveImportedModule/a>/dfn> abstract operationli>The dfn idjs-initializehostdefinedrealm>a hrefhttps://tc39.github.io/ecma262/#sec-initializehostdefinedrealm>InitializeHostDefinedRealm/a>/dfn> abstract operationli>The dfn idisaccessordescriptor>a hrefhttps://tc39.github.io/ecma262/#sec-isaccessordescriptor>IsAccessorDescriptor/a>/dfn> abstract operationli>The dfn idiscallable>a hrefhttps://tc39.github.io/ecma262/#sec-iscallable>IsCallable/a>/dfn> abstract operationli>The dfn idisconstructor>a hrefhttps://tc39.github.io/ecma262/#sec-isconstructor>IsConstructor/a>/dfn> abstract operationli>The dfn idisdatadescriptor>a hrefhttps://tc39.github.io/ecma262/#sec-isdatadescriptor>IsDataDescriptor/a>/dfn> abstract operationli>The dfn idisdetachedbuffer>a hrefhttps://tc39.github.io/ecma262/#sec-isdetachedbuffer>IsDetachedBuffer/a>/dfn> abstract operationli>The dfn idissharedarraybuffer>a hrefhttps://tc39.github.io/ecma262/#sec-issharedarraybuffer>IsSharedArrayBuffer/a>/dfn> abstract operationli>The dfn idjs-newobjectenvironment>a hrefhttps://tc39.github.io/ecma262/#sec-newobjectenvironment>NewObjectEnvironment/a>/dfn> abstract operationli>The dfn idnormalcompletion>a hrefhttps://tc39.github.io/ecma262/#sec-normalcompletion>NormalCompletion/a>/dfn> abstract operationli>The dfn idordinarygetprototypeof>a hrefhttps://tc39.github.io/ecma262/#sec-ordinarygetprototypeof>OrdinaryGetPrototypeOf/a>/dfn> abstract operationli>The dfn idordinarysetprototypeof>a hrefhttps://tc39.github.io/ecma262/#sec-ordinarysetprototypeof>OrdinarySetPrototypeOf/a>/dfn> abstract operationli>The dfn idordinaryisextensible>a hrefhttps://tc39.github.io/ecma262/#sec-ordinaryisextensible>OrdinaryIsExtensible/a>/dfn> abstract operationli>The dfn idordinarypreventextensions>a hrefhttps://tc39.github.io/ecma262/#sec-ordinarypreventextensions>OrdinaryPreventExtensions/a>/dfn> abstract operationli>The dfn idordinarygetownproperty>a hrefhttps://tc39.github.io/ecma262/#sec-ordinarygetownproperty>OrdinaryGetOwnProperty/a>/dfn> abstract operationli>The dfn idordinarydefineownproperty>a hrefhttps://tc39.github.io/ecma262/#sec-ordinarydefineownproperty>OrdinaryDefineOwnProperty/a>/dfn> abstract operationli>The dfn idordinaryget>a hrefhttps://tc39.github.io/ecma262/#sec-ordinaryget>OrdinaryGet/a>/dfn> abstract operationli>The dfn idordinaryset>a hrefhttps://tc39.github.io/ecma262/#sec-ordinaryset>OrdinarySet/a>/dfn> abstract operationli>The dfn idordinarydelete>a hrefhttps://tc39.github.io/ecma262/#sec-ordinarydelete>OrdinaryDelete/a>/dfn> abstract operationli>The dfn idordinaryownpropertykeys>a hrefhttps://tc39.github.io/ecma262/#sec-ordinaryownpropertykeys>OrdinaryOwnPropertyKeys/a>/dfn> abstract operationli>The dfn idjs-parsemodule>a hrefhttps://tc39.github.io/ecma262/#sec-parsemodule>ParseModule/a>/dfn> abstract operationli>The dfn idjs-parsescript>a hrefhttps://tc39.github.io/ecma262/#sec-parse-script>ParseScript/a>/dfn> abstract operationli>The dfn idrunjobs>a hrefhttps://tc39.github.io/ecma262/#sec-runjobs>RunJobs/a>/dfn> abstract operationli>The dfn idsamevalue>a hrefhttps://tc39.github.io/ecma262/#sec-samevalue>SameValue/a>/dfn> abstract operationli>The dfn idjs-scriptevaluation>a hrefhttps://tc39.github.io/ecma262/#sec-runtime-semantics-scriptevaluation>ScriptEvaluation/a>/dfn> abstract operationli>The dfn idsetimmutableprototype>a hrefhttps://tc39.github.io/ecma262/#sec-set-immutable-prototype>SetImmutablePrototype/a>/dfn> abstract operationli>The dfn idjs-toboolean>a hrefhttps://tc39.github.io/ecma262/#sec-toboolean>ToBoolean/a>/dfn> abstract operationli>The dfn idtostring>a hrefhttps://tc39.github.io/ecma262/#sec-tostring>ToString/a>/dfn> abstract operationli>The dfn idtouint32>a hrefhttps://tc39.github.io/ecma262/#sec-touint32>ToUint32/a>/dfn> abstract operationli>The dfn idtypedarraycreate>a hrefhttps://tc39.github.io/ecma262/#typedarray-create>TypedArrayCreate/a>/dfn> abstract operationli>The dfn idjs-abstract-equality>a hrefhttps://tc39.github.io/ecma262/#sec-abstract-equality-comparison>Abstract Equality Comparison/a>/dfn> algorithmli>The dfn idjs-strict-equality>a hrefhttps://tc39.github.io/ecma262/#sec-strict-equality-comparison>Strict Equality Comparison/a>/dfn> algorithmli>The dfn iddate>a hrefhttps://tc39.github.io/ecma262/#sec-date-objects>code>Date/code>/a>/dfn> classli>The dfn idsharedarraybuffer>a hrefhttps://tc39.github.io/ecma262/#sec-sharedarraybuffer-objects>code>SharedArrayBuffer/code>/a>/dfn> classli>The dfn idtypeerror>a hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror>code>TypeError/code>/a>/dfn> classli>The dfn idjs-rangeerror>a hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-rangeerror>code>RangeError/code>/a>/dfn> classli>The dfn idishtmldda>a hrefhttps://tc39.github.io/ecma262/#sec-IsHTMLDDA-internal-slot>IsHTMLDDA/a>/dfn> internal slotli>The dfn idjs-typeof>a hrefhttps://tc39.github.io/ecma262/#sec-typeof-operator>code>typeof/code>/a>/dfn> operatorli>dfn idthe-typedarray-constructors>a hrefhttps://tc39.github.io/ecma262/#table-49>The var>TypedArray/var> Constructors/a>/dfn> table/ul> p>Users agents that support JavaScript must also implement the cite>import()/cite> proposal. The following terms are defined there, and used in this specification: a href#refsJSIMPORT>JSIMPORT/a>/p> ul classbrief>li>dfn idimport()>a hrefhttps://tc39.github.io/proposal-dynamic-import/#sec-import-calls>code>import()/code>/a>/dfn>li>The dfn idjs-hostimportmoduledynamically>a hrefhttps://tc39.github.io/proposal-dynamic-import/#sec-hostimportmoduledynamically>HostImportModuleDynamically/a>/dfn> abstract operationli>The dfn idfinishdynamicimport>a hrefhttps://tc39.github.io/proposal-dynamic-import/#sec-finishdynamicimport>FinishDynamicImport/a>/dfn> abstract operation/ul> dt>DOMdd> p>The Document Object Model (DOM) is a representation — a model — of a document and its content. The DOM is not just an API; the conformance criteria of HTML implementations are defined, in this specification, in terms of operations on the DOM. a href#refsDOM>DOM/a>/p> p>Implementations must support DOM and the events defined in UI Events, because this specification is defined in terms of the DOM, and some of the features are defined as extensions to the DOM interfaces. a href#refsDOM>DOM/a> a href#refsUIEVENTS>UIEVENTS/a>/p> p>In particular, the following features are defined in the WHATWG DOM standard: a href#refsDOM>DOM/a>/p> ul classbrief>li>dfn idattr>a hrefhttps://dom.spec.whatwg.org/#interface-attr>code>Attr/code>/a>/dfn> interfaceli>dfn idcomment-2>a hrefhttps://dom.spec.whatwg.org/#interface-comment>code>Comment/code>/a>/dfn> interfaceli>dfn iddomimplementation>a hrefhttps://dom.spec.whatwg.org/#interface-domimplementation>code>DOMImplementation/code>/a>/dfn> interfaceli>dfn iddom-document>a hrefhttps://dom.spec.whatwg.org/#interface-document>code>Document/code>/a>/dfn> interfaceli>dfn iddocumentfragment>a hrefhttps://dom.spec.whatwg.org/#interface-documentfragment>code>DocumentFragment/code>/a>/dfn> interfaceli>dfn iddocumenttype>a hrefhttps://dom.spec.whatwg.org/#interface-documenttype>code>DocumentType/code>/a>/dfn> interfaceli>dfn idchildnode>a hrefhttps://dom.spec.whatwg.org/#interface-childnode>code>ChildNode/code>/a>/dfn> interfaceli>dfn idelement>a hrefhttps://dom.spec.whatwg.org/#interface-element>code>Element/code>/a>/dfn> interfaceli>dfn idnode>a hrefhttps://dom.spec.whatwg.org/#interface-node>code>Node/code>/a>/dfn> interfaceli>dfn idnodelist>a hrefhttps://dom.spec.whatwg.org/#interface-nodelist>code>NodeList/code>/a>/dfn> interfaceli>dfn idprocessinginstruction>a hrefhttps://dom.spec.whatwg.org/#interface-processinginstruction>code>ProcessingInstruction/code>/a>/dfn> interfaceli>dfn idshadowroot>a hrefhttps://dom.spec.whatwg.org/#interface-shadowroot>code>ShadowRoot/code>/a>/dfn> interfaceli>dfn idtext>a hrefhttps://dom.spec.whatwg.org/#interface-text>code>Text/code>/a>/dfn> interfaceli>dfn idnode-document>a hrefhttps://dom.spec.whatwg.org/#concept-node-document>node document/a>/dfn> conceptli>dfn idconcept-documentfragment-host>a hrefhttps://dom.spec.whatwg.org/#concept-documentfragment-host>host/a>/dfn> conceptli>dfn idshadow-root>a hrefhttps://dom.spec.whatwg.org/#concept-shadow-root>shadow root/a>/dfn> conceptli>dfn idhtmlcollection>a hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>code>HTMLCollection/code>/a>/dfn> interfaceli>dfn iddom-htmlcollection-length>a hrefhttps://dom.spec.whatwg.org/#dom-htmlcollection-length>code>HTMLCollection.length/code>/a>/dfn> attributeli>dfn iddom-htmlcollection-item>a hrefhttps://dom.spec.whatwg.org/#dom-htmlcollection-item>code>HTMLCollection.item()/code>/a>/dfn> methodli>dfn iddom-htmlcollection-nameditem>a hrefhttps://dom.spec.whatwg.org/#dom-htmlcollection-nameditem>code>HTMLCollection.namedItem()/code>/a>/dfn> methodli>The terms dfn idconcept-collection>a hrefhttps://dom.spec.whatwg.org/#concept-collection>collection/a>/dfn> and dfn idrepresented-by-the-collection>a hrefhttps://dom.spec.whatwg.org/#represented-by-the-collection>represented by the collection/a>/dfn>li>dfn iddomtokenlist>a hrefhttps://dom.spec.whatwg.org/#interface-domtokenlist>code>DOMTokenList/code>/a>/dfn> interfaceli>dfn iddom-domtokenlist-value>a hrefhttps://dom.spec.whatwg.org/#dom-domtokenlist-value>code>DOMTokenList.value/code>/a>/dfn> attributeli>dfn iddom-domimplementation-createdocument>a hrefhttps://dom.spec.whatwg.org/#dom-domimplementation-createdocument>code>createDocument()/code>/a>/dfn> methodli>dfn iddom-domimplementation-createhtmldocument>a hrefhttps://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument>code>createHTMLDocument()/code>/a>/dfn> methodli>dfn iddom-document-createelement>a hrefhttps://dom.spec.whatwg.org/#dom-document-createelement>code>createElement()/code>/a>/dfn> methodli>dfn iddom-document-createelementns>a hrefhttps://dom.spec.whatwg.org/#dom-document-createelementns>code>createElementNS()/code>/a>/dfn> methodli>dfn iddom-document-getelementbyid>a hrefhttps://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid>code>getElementById()/code>/a>/dfn> methodli>dfn iddom-document-getelementsbyclassname>a hrefhttps://dom.spec.whatwg.org/#dom-document-getelementsbyclassname>code>getElementsByClassName()/code>/a>/dfn> methodli>dfn iddom-node-appendchild>a hrefhttps://dom.spec.whatwg.org/#dom-node-appendchild>code>appendChild()/code>/a>/dfn> methodli>dfn iddom-node-clonenode>a hrefhttps://dom.spec.whatwg.org/#dom-node-clonenode>code>cloneNode()/code>/a>/dfn> methodli>dfn iddom-document-importnode>a hrefhttps://dom.spec.whatwg.org/#dom-document-importnode>code>importNode()/code>/a>/dfn> methodli>dfn iddom-event-preventdefault>a hrefhttps://dom.spec.whatwg.org/#dom-event-preventdefault>code>preventDefault()/code>/a>/dfn> methodli>dfn iddom-element-id>a hrefhttps://dom.spec.whatwg.org/#dom-element-id>code>id/code>/a>/dfn> attributeli>dfn idtextcontent>a hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>code>textContent/code>/a>/dfn> attributeli>The dfn idtree>a hrefhttps://dom.spec.whatwg.org/#concept-tree>tree/a>/dfn> and dfn idshadow-tree>a hrefhttps://dom.spec.whatwg.org/#concept-shadow-tree>shadow tree/a>/dfn> conceptsli>The dfn idtree-order>a hrefhttps://dom.spec.whatwg.org/#concept-tree-order>tree order/a>/dfn> and dfn idshadow-including-tree-order>a hrefhttps://dom.spec.whatwg.org/#concept-shadow-including-tree-order>shadow-including tree order/a>/dfn> conceptsli>The dfn idconcept-tree-child>a hrefhttps://dom.spec.whatwg.org/#concept-tree-child>child/a>/dfn> conceptli>The dfn idroot>a hrefhttps://dom.spec.whatwg.org/#concept-tree-root>root/a>/dfn> and dfn idshadow-including-root>a hrefhttps://dom.spec.whatwg.org/#concept-shadow-including-root>shadow-including root/a>/dfn> conceptsli>The dfn idinclusive-ancestor>a hrefhttps://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor>inclusive ancestor/a>/dfn> and dfn idshadow-including-descendant>a hrefhttps://dom.spec.whatwg.org/#concept-shadow-including-descendant>shadow-including descendant/a>/dfn> conceptsli>The dfn idfirst-child>a hrefhttps://dom.spec.whatwg.org/#concept-tree-first-child>first child/a>/dfn> and dfn idnext-sibling>a hrefhttps://dom.spec.whatwg.org/#concept-tree-next-sibling>next sibling/a>/dfn> conceptsli>The dfn iddocument-element>a hrefhttps://dom.spec.whatwg.org/#document-element>document element/a>/dfn> conceptli>The dfn idin-a-document-tree>a hrefhttps://dom.spec.whatwg.org/#in-a-document-tree>in a document tree/a>/dfn>, dfn idin-a-document>a hrefhttps://dom.spec.whatwg.org/#in-a-document>in a document/a>/dfn> (legacy), and dfn idconnected>a hrefhttps://dom.spec.whatwg.org/#connected>connected/a>/dfn> conceptsli>The dfn idconcept-slot>a hrefhttps://dom.spec.whatwg.org/#concept-slot>slot/a>/dfn> concept, and its dfn idslot-name>a hrefhttps://dom.spec.whatwg.org/#slot-name>name/a>/dfn> and dfn idassigned-nodes>a hrefhttps://dom.spec.whatwg.org/#slot-assigned-nodes>assigned nodes/a>/dfn>li>The dfn idfinding-flattened-slotables>a hrefhttps://dom.spec.whatwg.org/#find-flattened-slotables>find flattened slotables/a>/dfn> algorithmli>The dfn idassign-a-slot>a hrefhttps://dom.spec.whatwg.org/#assign-a-slot>assign a slot/a>/dfn> algorithmli>The dfn idpre-insert>a hrefhttps://dom.spec.whatwg.org/#concept-node-pre-insert>pre-insert/a>/dfn>, dfn idconcept-node-insert>a hrefhttps://dom.spec.whatwg.org/#concept-node-insert>insert/a>/dfn>, dfn idconcept-node-append>a hrefhttps://dom.spec.whatwg.org/#concept-node-append>append/a>/dfn>, dfn idconcept-node-replace>a hrefhttps://dom.spec.whatwg.org/#concept-node-replace>replace/a>/dfn>, dfn idconcept-node-replace-all>a hrefhttps://dom.spec.whatwg.org/#concept-node-replace-all>replace all/a>/dfn>, dfn idconcept-node-remove>a hrefhttps://dom.spec.whatwg.org/#concept-node-remove>remove/a>/dfn>, and dfn idconcept-node-adopt>a hrefhttps://dom.spec.whatwg.org/#concept-node-adopt>adopt/a>/dfn> algorithms for nodesli>The dfn idconcept-element-attributes-change>a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-change>change/a>/dfn>, dfn idconcept-element-attributes-append>a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-append>append/a>/dfn>, dfn idconcept-element-attributes-remove>a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-remove>remove/a>/dfn>, dfn idconcept-element-attributes-replace>a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-replace>replace/a>/dfn>, and dfn idconcept-element-attributes-set-value>a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-set-value>set value/a>/dfn> algorithms for attributesli>The dfn idconcept-node-insert-ext>a hrefhttps://dom.spec.whatwg.org/#concept-node-insert-ext>insertion steps/a>/dfn>, dfn idconcept-node-remove-ext>a hrefhttps://dom.spec.whatwg.org/#concept-node-remove-ext>removing steps/a>/dfn>, dfn idconcept-node-adopt-ext>a hrefhttps://dom.spec.whatwg.org/#concept-node-adopt-ext>adopting steps/a>/dfn>, and dfn idchild-text-content-change-steps>a hrefhttps://dom.spec.whatwg.org/#concept-node-adopt-ext>child text content change steps/a>/dfn> hooksli>The dfn idattribute-list>a hrefhttps://dom.spec.whatwg.org/#concept-element-attribute>attribute list/a>/dfn> conceptli>The dfn idconcept-cd-data>a hrefhttps://dom.spec.whatwg.org/#concept-cd-data>data/a>/dfn> of a text nodeli>The dfn idchild-text-content>a hrefhttps://dom.spec.whatwg.org/#concept-child-text-content>child text content/a>/dfn> of a nodeli>dfn idevent>a hrefhttps://dom.spec.whatwg.org/#interface-event>code>Event/code>/a>/dfn> interfaceli>dfn ideventtarget>a hrefhttps://dom.spec.whatwg.org/#interface-eventtarget>code>EventTarget/code>/a>/dfn> interfaceli>The dfn idactivation-behaviour>a hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior>activation behavior/a>/dfn> hookli>The dfn idlegacy-pre-activation-behavior>a hrefhttps://dom.spec.whatwg.org/#eventtarget-legacy-pre-activation-behavior>legacy-pre-activation behavior/a>/dfn> hookli>The dfn idlegacy-canceled-activation-behavior>a hrefhttps://dom.spec.whatwg.org/#eventtarget-legacy-canceled-activation-behavior>legacy-canceled-activation behavior/a>/dfn> hookli>The dfn idcreating-an-event>a hrefhttps://dom.spec.whatwg.org/#concept-event-create>create an event/a>/dfn> algorithmli>The dfn idconcept-event-fire>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire>fire an event/a>/dfn> algorithmli>The dfn idcanceled-flag>a hrefhttps://dom.spec.whatwg.org/#canceled-flag>canceled flag/a>/dfn>li>The dfn idconcept-event-dispatch>a hrefhttps://dom.spec.whatwg.org/#concept-event-dispatch>dispatch/a>/dfn> algorithmli>dfn ideventinit>a hrefhttps://dom.spec.whatwg.org/#dictdef-eventinit>code>EventInit/code>/a>/dfn> dictionary typeli>dfn iddom-event-type>a hrefhttps://dom.spec.whatwg.org/#dom-event-type>code>type/code>/a>/dfn> attributeli>dfn iddom-event-target>a hrefhttps://dom.spec.whatwg.org/#dom-event-target>code>target/code>/a>/dfn> attributeli>dfn iddom-event-currenttarget>a hrefhttps://dom.spec.whatwg.org/#dom-event-currenttarget>code>currentTarget/code>/a>/dfn> attributeli>dfn iddom-event-bubbles>a hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>code>bubbles/code>/a>/dfn> attributeli>dfn iddom-event-cancelable>a hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>code>cancelable/code>/a>/dfn> attributeli>dfn idcomposed-flag>a hrefhttps://dom.spec.whatwg.org/#composed-flag>composed flag/a>/dfn>li>dfn iddom-event-istrusted>a hrefhttps://dom.spec.whatwg.org/#dom-event-istrusted>code>isTrusted/code>/a>/dfn> attributeli>dfn iddom-event-initevent>a hrefhttps://dom.spec.whatwg.org/#dom-event-initevent>code>initEvent()/code>/a>/dfn> methodli>dfn iddom-eventtarget-addeventlistener>a hrefhttps://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener>code>addEventListener()/code>/a>/dfn> methodli>dfn iddom-eventlistener>a hrefhttps://dom.spec.whatwg.org/#callbackdef-eventlistener>code>EventListener/code>/a>/dfn> callback interfaceli>The dfn idconcept-event-type>a hrefhttps://dom.spec.whatwg.org/#dom-event-type>type/a>/dfn> of an eventli>The concept of an dfn idconcept-event-listener>a hrefhttps://dom.spec.whatwg.org/#concept-event-listener>event listener/a>/dfn> and the a hrefhttps://dom.spec.whatwg.org/#concept-event-listener iddependencies:concept-event-listener data-x-internalconcept-event-listener>event listeners/a> associated with an code iddependencies:eventtarget>a data-x-internaleventtarget hrefhttps://dom.spec.whatwg.org/#interface-eventtarget>EventTarget/a>/code>li>The dfn iddocuments-character-encoding>a hrefhttps://dom.spec.whatwg.org/#concept-document-encoding>encoding/a>/dfn> (herein the i>character encoding/i>) and dfn idconcept-document-content-type>a hrefhttps://dom.spec.whatwg.org/#concept-document-content-type>content type/a>/dfn> of a code iddependencies:document>a href#document>Document/a>/code>li>The distinction between dfn idxml-documents>a hrefhttps://dom.spec.whatwg.org/#xml-document>XML documents/a>/dfn> and dfn idhtml-documents>a hrefhttps://dom.spec.whatwg.org/#html-document>HTML documents/a>/dfn>li>The terms dfn idquirks-mode>a hrefhttps://dom.spec.whatwg.org/#concept-document-quirks>quirks mode/a>/dfn>, dfn idlimited-quirks-mode>a hrefhttps://dom.spec.whatwg.org/#concept-document-limited-quirks>limited-quirks mode/a>/dfn>, and dfn idno-quirks-mode>a hrefhttps://dom.spec.whatwg.org/#concept-document-no-quirks>no-quirks mode/a>/dfn>li>The algorithm to dfn idconcept-node-clone>a hrefhttps://dom.spec.whatwg.org/#concept-node-clone>clone/a>/dfn> a code iddependencies:node>a data-x-internalnode hrefhttps://dom.spec.whatwg.org/#interface-node>Node/a>/code>, and the concept of dfn idconcept-node-clone-ext>a hrefhttps://dom.spec.whatwg.org/#concept-node-clone-ext>cloning steps/a>/dfn> used by that algorithmli>The concept of dfn idbase-url-change-steps>base URL change steps/dfn> and the definition of what happens when an element is dfn idaffected-by-a-base-url-change>affected by a base URL change/dfn>li>The concept of an elements dfn idconcept-id>a hrefhttps://dom.spec.whatwg.org/#concept-id>unique identifier (ID)/a>/dfn>li>The concept of an elements dfn idconcept-class>a hrefhttps://dom.spec.whatwg.org/#concept-class>classes/a>/dfn>li>The term dfn idconcept-supported-tokens>a hrefhttps://dom.spec.whatwg.org/#concept-supported-tokens>supported tokens/a>/dfn>li>The concept of a DOM dfn idconcept-range>a hrefhttps://dom.spec.whatwg.org/#concept-range>range/a>/dfn>, and the terms dfn idconcept-range-start>a hrefhttps://dom.spec.whatwg.org/#concept-range-start>start/a>/dfn>, dfn idconcept-range-end>a hrefhttps://dom.spec.whatwg.org/#concept-range-end>end/a>/dfn>, and dfn idconcept-range-bp>a hrefhttps://dom.spec.whatwg.org/#concept-range-bp>boundary point/a>/dfn> as applied to ranges.li>The dfn idcreate-an-element>a hrefhttps://dom.spec.whatwg.org/#concept-create-element>create an element/a>/dfn> algorithmli>The dfn idelement-interface>a hrefhttps://dom.spec.whatwg.org/#concept-element-interface>element interface/a>/dfn> conceptli>The concepts of dfn idcustom-element-state>a hrefhttps://dom.spec.whatwg.org/#concept-element-custom-element-state>custom element state/a>/dfn>, and of dfn idconcept-element-defined>a hrefhttps://dom.spec.whatwg.org/#concept-element-defined>defined/a>/dfn> and dfn idconcept-element-custom>a hrefhttps://dom.spec.whatwg.org/#concept-element-custom>custom/a>/dfn> elementsli>An elements dfn idconcept-element-custom-element-definition>a hrefhttps://dom.spec.whatwg.org/#concept-element-custom-element-definition>custom element definition/a>/dfn>li>An elements dfn idconcept-element-is-value>a hrefhttps://dom.spec.whatwg.org/#concept-element-is-value>code>is/code> value/a>/dfn>li>dfn idmutationobserver>a hrefhttps://dom.spec.whatwg.org/#mutationobserver>code>MutationObserver/code>/a>/dfn> interface and dfn idmutation-observers>a hrefhttps://dom.spec.whatwg.org/#mutation-observers>mutation observers/a>/dfn> in general/ul> p>The following features are defined in the UI Events specification: a href#refsUIEVENTS>UIEVENTS/a>/p> ul classbrief>li>The dfn idmouseevent>a hrefhttps://w3c.github.io/uievents/#mouseevent>code>MouseEvent/code>/a>/dfn> interfaceli>The code iddependencies:mouseevent>a data-x-internalmouseevent hrefhttps://w3c.github.io/uievents/#mouseevent>MouseEvent/a>/code> interfaces dfn iddom-mouseevent-relatedtarget>a hrefhttps://w3c.github.io/uievents/#dom-mouseevent-relatedtarget>code>relatedTarget/code>/a>/dfn> attributeli>dfn idmouseeventinit>a hrefhttps://w3c.github.io/uievents/#dictdef-mouseeventinit>code>MouseEventInit/code>/a>/dfn> dictionary typeli>The dfn idfocusevent>a hrefhttps://w3c.github.io/uievents/#focusevent>code>FocusEvent/code>/a>/dfn> interfaceli>The code iddependencies:focusevent>a data-x-internalfocusevent hrefhttps://w3c.github.io/uievents/#focusevent>FocusEvent/a>/code> interfaces dfn iddom-focusevent-relatedtarget>a hrefhttps://w3c.github.io/uievents/#dom-focusevent-relatedtarget>code>relatedTarget/code>/a>/dfn> attributeli>The dfn iduievent>a hrefhttps://w3c.github.io/uievents/#uievent>code>UIEvent/code>/a>/dfn> interfaceli>The code iddependencies:uievent>a data-x-internaluievent hrefhttps://w3c.github.io/uievents/#uievent>UIEvent/a>/code> interfaces dfn iddom-uievent-view>a hrefhttps://w3c.github.io/uievents/#dom-uievent-view>code>view/code>/a>/dfn> attributeli>dfn idevent-auxclick>a hrefhttps://w3c.github.io/uievents/#event-type-auxclick>code>auxclick/code>/a>/dfn> eventli>dfn idevent-click>a hrefhttps://w3c.github.io/uievents/#event-type-click>code>click/code>/a>/dfn> eventli>dfn idevent-dblclick>a hrefhttps://w3c.github.io/uievents/#event-type-dblclick>code>dblclick/code>/a>/dfn> eventli>dfn idevent-mousedown>a hrefhttps://w3c.github.io/uievents/#event-type-mousedown>code>mousedown/code>/a>/dfn> eventli>dfn idevent-mouseenter>a hrefhttps://w3c.github.io/uievents/#event-type-mouseenter>code>mouseenter/code>/a>/dfn> eventli>dfn idevent-mouseleave>a hrefhttps://w3c.github.io/uievents/#event-type-mouseleave>code>mouseleave/code>/a>/dfn> eventli>dfn idevent-mousemove>a hrefhttps://w3c.github.io/uievents/#event-type-mousemove>code>mousemove/code>/a>/dfn> eventli>dfn idevent-mouseout>a hrefhttps://w3c.github.io/uievents/#event-type-mouseout>code>mouseout/code>/a>/dfn> eventli>dfn idevent-mouseover>a hrefhttps://w3c.github.io/uievents/#event-type-mouseover>code>mouseover/code>/a>/dfn> eventli>dfn idevent-mouseup>a hrefhttps://w3c.github.io/uievents/#event-type-mouseup>code>mouseup/code>/a>/dfn> eventli>dfn idevent-wheel>a hrefhttps://w3c.github.io/uievents/#event-type-wheel>code>wheel/code>/a>/dfn> eventli>dfn idevent-keydown>a hrefhttps://w3c.github.io/uievents/#event-type-keydown>code>keydown/code>/a>/dfn> eventli>dfn idevent-keypress>a hrefhttps://w3c.github.io/uievents/#event-type-keypress>code>keypress/code>/a>/dfn> eventli>dfn idevent-keyup>a hrefhttps://w3c.github.io/uievents/#event-type-keyup>code>keyup/code>/a>/dfn> event/ul> p>The following features are defined in the Touch Events specification: a href#refsTOUCH>TOUCH/a>/p> ul classbrief>li>dfn idtouch>a hrefhttps://w3c.github.io/touch-events/#touch-interface>code>Touch/code>/a>/dfn> interfaceli>dfn idtouch-point>a hrefhttps://w3c.github.io/touch-events/#dfn-touch-point>Touch point/a>/dfn> conceptli>dfn idevent-touchend>a hrefhttps://w3c.github.io/touch-events/#event-touchend>code>touchend/code>/a>/dfn> event/ul> p>The following features are defined in the Pointer Events specification: a href#refsPOINTEREVENTS>POINTEREVENTS/a>/p> ul classbrief>li>dfn idevent-pointerup>a hrefhttps://w3c.github.io/pointerevents/#the-pointerup-event>code>pointerup/code>/a>/dfn> event/ul> p>This specification sometimes uses the term dfn>name/dfn> to refer to the events a hrefhttps://dom.spec.whatwg.org/#dom-event-type iddependencies:concept-event-type data-x-internalconcept-event-type>type/a>; as in, an event named code>click/code> or if the event name is code>keypress/code>. The terms name and type for events are synonymous./p> p>The following features are defined in the cite>DOM Parsing and Serialization/cite> specification: a href#refsDOMPARSING>DOMPARSING/a>/p> ul classbrief>li>dfn iddomparser>a hrefhttps://w3c.github.io/DOM-Parsing/#the-domparser-interface>code>DOMParser/code>/a>/dfn>li>dfn iddom-innerhtml>a hrefhttps://w3c.github.io/DOM-Parsing/#dom-element-innerhtml>code>innerHTML/code>/a>/dfn>li>dfn iddom-outerhtml>a hrefhttps://w3c.github.io/DOM-Parsing/#dom-element-outerhtml>code>outerHTML/code>/a>/dfn>/ul> p>The dfn idselection>a hrefhttps://w3c.github.io/selection-api/#selection-interface>code>Selection/code>/a>/dfn> interface is defined in the cite>Selection API/cite> specification. a href#refsSELECTION>SELECTION/a>/p> p classnote>User agents are encouraged to implement the features described in the cite>execCommand/cite> specification. a href#refsEXECCOMMAND>EXECCOMMAND/a>/p> p>The following parts of the WHATWG Fullscreen API standard are referenced from this specification, in part to define the rendering of code iddependencies:the-dialog-element>a href#the-dialog-element>dialog/a>/code> elements, and also to define how the Fullscreen API interacts with HTML: a href#refsFULLSCREEN>FULLSCREEN/a>/p> ul classbrief>li>dfn idtop-layer>a hrefhttps://fullscreen.spec.whatwg.org/#top-layer>top layer/a>/dfn> (an a hrefhttps://infra.spec.whatwg.org/#ordered-set iddependencies:set data-x-internalset>ordered set/a>) and its dfn idtop-layer-add>a hrefhttps://fullscreen.spec.whatwg.org/#top-layer-add>add/a>/dfn> operationli>dfn iddom-element-requestfullscreen>a hrefhttps://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen>code>requestFullscreen()/code>/a>/dfn>li>dfn idrun-the-fullscreen-steps>a hrefhttps://fullscreen.spec.whatwg.org/#run-the-fullscreen-steps>run the fullscreen steps/a>/dfn>/ul> p>The cite>High Resolution Time/cite> specification provides the dfn iddomhighrestimestamp>a hrefhttps://w3c.github.io/hr-time/#dom-domhighrestimestamp>code>DOMHighResTimeStamp/code>/a>/dfn> typedef and the dfn idperformance>a hrefhttps://w3c.github.io/hr-time/#the-performance-interface>code>Performance/code>/a>/dfn> interfaces dfn iddom-performance-now>a hrefhttps://w3c.github.io/hr-time/#dom-performance-now()>code>now()/code>/a>/dfn> method. a href#refsHRT>HRT/a>/p> dt>File APIdd> p>This specification uses the following features defined in the File API specification: a href#refsFILEAPI>FILEAPI/a>/p> ul classbrief>li>The dfn idblob>a hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>code>Blob/code>/a>/dfn> interface and its dfn iddom-blob-type>a hrefhttps://w3c.github.io/FileAPI/#dfn-type>code>type/code>/a>/dfn> attributeli>The dfn idfile>a hrefhttps://w3c.github.io/FileAPI/#dfn-file>code>File/code>/a>/dfn> interface and its dfn iddom-file-name>a hrefhttps://w3c.github.io/FileAPI/#dfn-name>code>name/code>/a>/dfn> and dfn iddom-file-lastmodified>a hrefhttps://w3c.github.io/FileAPI/#dfn-lastModified>code>lastModified/code>/a>/dfn> attributesli>The dfn idfilelist>a hrefhttps://w3c.github.io/FileAPI/#filelist-section>code>FileList/code>/a>/dfn> interfaceli>The concept of a code iddependencies:blob>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code>s dfn idsnapshot-state>a hrefhttps://w3c.github.io/FileAPI/#snapshot-state>snapshot state/a>/dfn>li>The concept of dfn idfile-error-read>read errors/dfn>li>dfn idblob-url-store>a hrefhttps://w3c.github.io/FileAPI/#BlobURLStore>Blob URL Store/a>/dfn>/ul> dt>Indexed Database APIdd>p>This specification uses dfn idcleanup-indexed-database-transactions>a hrefhttps://w3c.github.io/IndexedDB/#cleanup-indexed-database-transactions>cleanup Indexed Database transactions/a>/dfn> defined by the Indexed Database API specification. a href#refsINDEXEDDB>INDEXEDDB/a>/p> dt>Media Source Extensionsdd> p>The following terms are defined in the Media Source Extensions specification: a href#refsMEDIASOURCE>MEDIASOURCE/a>/p> ul classbrief>li>dfn idmediasource>a hrefhttps://w3c.github.io/media-source/#idl-def-mediasource>code>MediaSource/code>/a>/dfn> interfaceli>dfn iddetaching-from-a-media-element>a hrefhttps://w3c.github.io/media-source/#mediasource-detach>detaching from a media element/a>/dfn>/ul> dt>Media Capture and Streamsdd> p>The following terms are defined in the Media Capture and Streams specification: a href#refsMEDIASTREAM>MEDIASTREAM/a>/p> ul classbrief>li>dfn idmediastream>a hrefhttps://w3c.github.io/mediacapture-main/getusermedia.html#idl-def-mediastream>code>MediaStream/code>/a>/dfn> interfaceli>dfn iddom-mediadevices-getusermedia>a hrefhttps://w3c.github.io/mediacapture-main/#dom-mediadevices-getusermedia>code>getUserMedia()/code>/a>/dfn> method/ul> dt>XMLHttpRequestdd> p>This specification references the XMLHttpRequest specification to describe how the two specifications interact and to use its code iddependencies:progressevent>a data-x-internalprogressevent hrefhttps://xhr.spec.whatwg.org/#interface-progressevent>ProgressEvent/a>/code> features. The following features and terms are defined in the XMLHttpRequest specification: a href#refsXHR>XHR/a>/p> ul classbrief>li>dfn idxmlhttprequest>a hrefhttps://xhr.spec.whatwg.org/#xmlhttprequest>code>XMLHttpRequest/code>/a>/dfn> interfaceli>dfn iddom-xmlhttprequest-responsexml>a hrefhttps://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml>code>XMLHttpRequest.responseXML/code>/a>/dfn> attributeli>dfn idprogressevent>a hrefhttps://xhr.spec.whatwg.org/#interface-progressevent>code>ProgressEvent/code>/a>/dfn> interfaceli>dfn iddom-progressevent-lengthcomputable>a hrefhttps://xhr.spec.whatwg.org/#dom-progressevent-lengthcomputable>code>ProgressEvent.lengthComputable/code>/a>/dfn> attributeli>dfn iddom-progressevent-loaded>a hrefhttps://xhr.spec.whatwg.org/#dom-progressevent-loaded>code>ProgressEvent.loaded/code>/a>/dfn> attributeli>dfn iddom-progressevent-total>a hrefhttps://xhr.spec.whatwg.org/#dom-progressevent-total>code>ProgressEvent.total/code>/a>/dfn> attributeli>dfn idfire-a-progress-event>a hrefhttps://xhr.spec.whatwg.org/#concept-event-fire-progress>Fire a progress event named var>e/var>/a>/dfn>/ul> dt>Battery Statusdd> p>The following features are defined in the cite>Battery Status API/cite> specification: a href#refsBATTERY>BATTERY/a>/p> ul classbrief>li>dfn iddom-navigator-getbattery>a hrefhttps://w3c.github.io/battery/#widl-Navigator-getBattery-Promise-BatteryManager>code>getBattery()/code>/a>/dfn> method/ul> dt>Media Queriesdd> p>Implementations must support cite>Media Queries/cite>. The dfn idmedia-condition>a hrefhttps://drafts.csswg.org/mediaqueries/#typedef-media-condition><media-condition>/a>/dfn> feature is defined therein. a href#refsMQ>MQ/a>/p> dt>CSS modulesdd> p>While support for CSS as a whole is not required of implementations of this specification (though it is encouraged, at least for Web browsers), some features are defined in terms of specific CSS requirements./p> p>When this specification requires that something be dfn idparse-something-according-to-a-css-grammar>a hrefhttps://drafts.csswg.org/css-syntax/#parse-grammar>parsed according to a particular CSS grammar/a>/dfn>, the relevant algorithm in the CSS Syntax specification must be followed. a href#refsCSSSYNTAX>CSSSYNTAX/a>/p> p>In particular, some features require that a string be dfn idparsed-as-a-css-color-value>parsed as a CSS <color> value/dfn>. When parsing a CSS value, user agents are required by the CSS specifications to apply some error handling rules. These apply to this specification also. a href#refsCSSCOLOR>CSSCOLOR/a> a href#refsCSS>CSS/a>/p> p classexample>For example, user agents are required to close all open constructs upon finding the end of a style sheet unexpectedly. Thus, when parsing the string code>rgb(0,0,0/code> (with a missing close-parenthesis) for a color value, the close parenthesis is implied by this error handling rule, and a value is obtained (the color black). However, the similar construct code>rgb(0,0,/code> (with both a missing parenthesis and a missing blue value) cannot be parsed, as closing the open construct does not result in a viable value./p> p>The following terms and features are defined in the CSS specification: a href#refsCSS>CSS/a>/p> ul classbrief>li>dfn idviewport>a hrefhttps://drafts.csswg.org/css2/visuren.html#viewport>viewport/a>/dfn>li>dfn idline-box>a hrefhttps://drafts.csswg.org/css2/visuren.html#line-box>line box/a>/dfn>li>dfn idout-of-flow>a hrefhttps://drafts.csswg.org/css2/visuren.html#x24>out-of-flow/a>/dfn>li>dfn idin-flow>a hrefhttps://drafts.csswg.org/css2/visuren.html#x25>in-flow/a>/dfn>li>dfn idreplaced-element>a hrefhttps://drafts.csswg.org/css2/conform.html#replaced-element>replaced element/a>/dfn>li>dfn idintrinsic-dimensions>a hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic>intrinsic dimensions/a>/dfn>li>dfn idcontent-area>a hrefhttps://drafts.csswg.org/css2/box.html#box-content-area>content area/a>/dfn>li>dfn idcontent-box>a hrefhttps://drafts.csswg.org/css2/box.html#x10>content box/a>/dfn>li>dfn idborder-box>a hrefhttps://drafts.csswg.org/css2/box.html#x14>border box/a>/dfn>li>dfn idmargin-box>a hrefhttps://drafts.csswg.org/css2/box.html#x17>margin box/a>/dfn>li>dfn idborder-edge>a hrefhttps://drafts.csswg.org/css2/box.html#border-edge>border edge/a>/dfn>li>dfn idmargin-edge>a hrefhttps://drafts.csswg.org/css2/box.html#margin-edge>margin edge/a>/dfn>li>dfn idcollapsing-margins>a hrefhttps://drafts.csswg.org/css2/box.html#collapsing-margins>collapsing margins/a>/dfn>li>dfn idcontaining-block>a hrefhttps://drafts.csswg.org/css2/visudet.html#containing-block-details>containing block/a>/dfn>li>dfn idinline-box>a hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box>inline box/a>/dfn>li>dfn idblock-box>a hrefhttps://drafts.csswg.org/css2/visuren.html#x9>block box/a>/dfn>li>The dfn idmargin-top>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-margin-top>margin-top/a>/dfn>, dfn idmargin-bottom>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-margin-bottom>margin-bottom/a>/dfn>, dfn idmargin-left>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-margin-left>margin-left/a>/dfn>, and dfn idmargin-right>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-margin-right>margin-right/a>/dfn> propertiesli>The dfn idpadding-top>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-padding-top>padding-top/a>/dfn>, dfn idpadding-bottom>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-padding-bottom>padding-bottom/a>/dfn>, dfn idpadding-left>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-padding-left>padding-left/a>/dfn>, and dfn idpadding-right>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-padding-right>padding-right/a>/dfn> propertiesli>The dfn idtop>a hrefhttps://drafts.csswg.org/css2/visuren.html#propdef-top>top/a>/dfn>, dfn idbottom>a hrefhttps://drafts.csswg.org/css2/visuren.html#propdef-bottom>bottom/a>/dfn>, dfn idleft>a hrefhttps://drafts.csswg.org/css2/visuren.html#propdef-left>left/a>/dfn>, and dfn idright>a hrefhttps://drafts.csswg.org/css2/visuren.html#propdef-right>right/a>/dfn> propertiesli>The dfn idfloat>a hrefhttps://drafts.csswg.org/css2/visuren.html#float-position>float/a>/dfn> propertyli>The dfn idclear>a hrefhttps://drafts.csswg.org/css2/visuren.html#flow-control>clear/a>/dfn> propertyli>The dfn idwidth>a hrefhttps://drafts.csswg.org/css2/visudet.html#the-width-property>width/a>/dfn> propertyli>The dfn idheight>a hrefhttps://drafts.csswg.org/css2/visudet.html#the-height-property>height/a>/dfn> propertyli>The dfn idline-height>a hrefhttps://drafts.csswg.org/css2/visudet.html#propdef-line-height>line-height/a>/dfn> propertyli>The dfn idvertical-align>a hrefhttps://drafts.csswg.org/css2/visudet.html#propdef-vertical-align>vertical-align/a>/dfn> propertyli>The dfn idcontent>a hrefhttps://drafts.csswg.org/css2/generate.html#content>content/a>/dfn> propertyli>The dfn idinline-block>a hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block>inline-block/a>/dfn> value of the a iddependencies:display hrefhttps://drafts.csswg.org/css2/visuren.html#display-prop data-x-internaldisplay>display/a> propertyli>The dfn idvisibility>a hrefhttps://drafts.csswg.org/css2/visufx.html#propdef-visibility>visibility/a>/dfn> property/ul> p>The CSS specification also defines the following border properties: a href#refsCSS>CSS/a>/p> table>caption>Border properties /caption>tr>td> th>Top th>Bottom th>Left th>Right tr>th>Width td>dfn idborder-top-width>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-top-width>border-top-width/a>/dfn> td>dfn idborder-bottom-width>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-bottom-width>border-bottom-width/a>/dfn> td>dfn idborder-left-width>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-left-width>border-left-width/a>/dfn> td>dfn idborder-right-width>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-right-width>border-right-width/a>/dfn> tr>th>Style td>dfn idborder-top-style>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-top-style>border-top-style/a>/dfn> td>dfn idborder-bottom-style>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-bottom-style>border-bottom-style/a>/dfn> td>dfn idborder-left-style>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-left-style>border-left-style/a>/dfn> td>dfn idborder-right-style>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-right-style>border-right-style/a>/dfn> tr>th>Color td>dfn idborder-top-color>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-top-color>border-top-color/a>/dfn> td>dfn idborder-bottom-color>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-bottom-color>border-bottom-color/a>/dfn> td>dfn idborder-left-color>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-left-color>border-left-color/a>/dfn> td>dfn idborder-right-color>a hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-right-color>border-right-color/a>/dfn> /table> p>The terms dfn idintrinsic-width>intrinsic width/dfn> and dfn idintrinsic-height>intrinsic height/dfn> refer to the width dimension and the height dimension, respectively, of a iddependencies:intrinsic-dimensions hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic data-x-internalintrinsic-dimensions>intrinsic dimensions/a>./p> p>The basic version of the dfn iddisplay>a hrefhttps://drafts.csswg.org/css2/visuren.html#display-prop>display/a>/dfn> property is defined in the cite>CSS/cite> specification, and the property is extended by other CSS modules. a href#refsCSS>CSS/a> a href#refsCSSRUBY>CSSRUBY/a> a href#refsCSSTABLE>CSSTABLE/a>/p> p>The following terms and features are defined in the cite>CSS Logical Properties/cite> specification: a href#refsCSSLOGICAL>CSSLOGICAL/a>/p> ul classbrief>li>The dfn idmargin-block-start>a hrefhttps://drafts.csswg.org/css-logical/#propdef-margin-block-start>margin-block-start/a>/dfn>, dfn idmargin-block-end>a hrefhttps://drafts.csswg.org/css-logical/#propdef-margin-block-end>margin-block-end/a>/dfn>, dfn idmargin-inline-start>a hrefhttps://drafts.csswg.org/css-logical/#propdef-margin-inline-start>margin-inline-start/a>/dfn>, and dfn idmargin-inline-end>a hrefhttps://drafts.csswg.org/css-logical/#propdef-margin-inline-end>margin-inline-end/a>/dfn> propertiesli>The dfn idpadding-block-start>a hrefhttps://drafts.csswg.org/css-logical/#propdef-padding-block-start>padding-block-start/a>/dfn>, dfn idpadding-block-end>a hrefhttps://drafts.csswg.org/css-logical/#propdef-padding-block-end>padding-block-end/a>/dfn>, dfn idpadding-inline-start>a hrefhttps://drafts.csswg.org/css-logical/#propdef-padding-inline-start>padding-inline-start/a>/dfn>, and dfn idpadding-inline-end>a hrefhttps://drafts.csswg.org/css-logical/#propdef-padding-inline-end>padding-inline-end/a>/dfn> properties/ul> p>The following terms and features are defined in the cite>CSS Color/cite> specification: a href#refsCSSCOLOR>CSSCOLOR/a>/p> ul classbrief>li>dfn idnamed-color>a hrefhttps://drafts.csswg.org/css-color/#named-color>named color/a>/dfn>li>dfn idcolor>a hrefhttps://drafts.csswg.org/css-color/#typedef-color><color>/a>/dfn>li>The dfn idcolor>a hrefhttps://drafts.csswg.org/css-color/#the-color-property>color/a>/dfn> property/ul> p>The term dfn idpaint-source>a hrefhttps://drafts.csswg.org/css-images-4/#paint-source>paint source/a>/dfn> is used as defined in the cite>CSS Image Values and Replaced Content/cite> specification to define the interaction of certain HTML elements with the CSS element() function. a href#refsCSSIMAGES>CSSIMAGES/a>/p> p>The term dfn iddefault-object-size>a hrefhttps://drafts.csswg.org/css-images/#default-object-size>default object size/a>/dfn> and the dfn idobject-fit>a hrefhttps://drafts.csswg.org/css-images/#the-object-fit>object-fit/a>/dfn> property are also defined in the cite>CSS Image Values and Replaced Content/cite> specification. a href#refsCSSIMAGES>CSSIMAGES/a>/p> p>The following features are defined in the cite>CSS Backgrounds and Borders/cite> specification: a href#refsCSSBG>CSSBG/a>/p> ul classbrief>li>The dfn idbackground-color>a hrefhttps://drafts.csswg.org/css-backgrounds/#the-background-color>background-color/a>/dfn> propertyli>The dfn idbackground-image>a hrefhttps://drafts.csswg.org/css-backgrounds/#the-background-image>background-image/a>/dfn> property/ul> p>The term dfn idblock-level>a hrefhttps://drafts.csswg.org/css-display/#block-level>block-level/a>/dfn> is defined in the cite>CSS Display/cite> specification. a href#refsCSSDISPLAY>CSSDISPLAY/a>/p> p>The following features are defined in the cite>CSS Fonts/cite> specification: a href#refsCSSFONTS>CSSFONTS/a>/p> ul classbrief>li>The dfn idfont-family>a hrefhttps://drafts.csswg.org/css-fonts/#font-family-prop>font-family/a>/dfn> propertyli>The dfn idfont-weight>a hrefhttps://drafts.csswg.org/css-fonts/#font-weight-prop>font-weight/a>/dfn> propertyli>The dfn idfont-size>a hrefhttps://drafts.csswg.org/css-fonts/#font-size-prop>font-size/a>/dfn> propertyli>The dfn idfont>a hrefhttps://drafts.csswg.org/css-fonts/#font-prop>font/a>/dfn> property/ul> p>The dfn idlist-style-type>a hrefhttps://drafts.csswg.org/css-lists/#propdef-list-style-type>list-style-type/a>/dfn> property is defined in the cite>CSS Lists and Counters/cite> specification. a href#refsCSSLISTS>CSSLISTS/a>/p> p>The dfn idoverflow>a hrefhttps://drafts.csswg.org/css-overflow-3/#propdef-overflow>overflow/a>/dfn> property and its dfn idhidden>a hrefhttps://drafts.csswg.org/css-overflow-3/#valdef-overflow-hidden>hidden/a>/dfn> value are defined in the cite>CSS Overflow/cite> specification. a href#refsCSSOVERFLOW>CSSOVERFLOW/a>/p> p>The following features are defined in the cite>CSS Positioned Layout/cite> specification: a href#refsCSSPOSITION>CSSPOSITION/a>/p> ul classbrief>li>The dfn idposition>a hrefhttps://drafts.csswg.org/css-position/#position-property>position/a>/dfn> property and its dfn idstatic>a hrefhttps://drafts.csswg.org/css-position/#valdef-position-static>static/a>/dfn> value/ul> p>The dfn idruby-base>a hrefhttps://drafts.csswg.org/css-ruby/#valdef-display-ruby-base>ruby-base/a>/dfn> value of the a iddependencies:display-2 hrefhttps://drafts.csswg.org/css2/visuren.html#display-prop data-x-internaldisplay>display/a> property is defined in the cite>CSS Ruby Layout/cite> specification. a href#refsCSSRUBY>CSSRUBY/a>/p> p>The following features are defined in the cite>CSS Table/cite> specification: a href#refsCSSTABLE>CSSTABLE/a>/p> ul classbrief>li>The dfn idborder-spacing>a hrefhttps://drafts.csswg.org/css-tables/#propdef-border-spacing>border-spacing/a>/dfn> propertyli>The dfn idborder-collapse>a hrefhttps://drafts.csswg.org/css-tables/#border-collapse-property>border-collapse/a>/dfn> propertyli>The dfn idtable-cell>a hrefhttps://drafts.csswg.org/css-tables/#table-cell>table-cell/a>/dfn>, dfn idtable-row>a hrefhttps://drafts.csswg.org/css-tables/#table-row>table-row/a>/dfn>, dfn idtable-caption>a hrefhttps://drafts.csswg.org/css-tables/#table-caption>table-caption/a>/dfn>, and dfn idtable>a hrefhttps://drafts.csswg.org/css-tables/#table>table/a>/dfn> values of the a iddependencies:display-3 hrefhttps://drafts.csswg.org/css2/visuren.html#display-prop data-x-internaldisplay>display/a> property/ul> p>The following features are defined in the cite>CSS Text/cite> specification: a href#refsCSSTEXT>CSSTEXT/a>/p> ul classbrief>li>The dfn idtext-transform>a hrefhttps://drafts.csswg.org/css-text/#text-transform-property>text-transform/a>/dfn> propertyli>The dfn idwhite-space>a hrefhttps://drafts.csswg.org/css-text/#white-space-property>white-space/a>/dfn> propertyli>The dfn idtext-align>a hrefhttps://drafts.csswg.org/css-text/#text-align-property>text-align/a>/dfn> propertyli>The dfn idletter-spacing>a hrefhttps://drafts.csswg.org/css-text/#letter-spacing-property>letter-spacing/a>/dfn> property/ul> p>The following features are defined in the cite>CSS Writing Modes/cite> specification: a href#refsCSSWM>CSSWM/a>/p> ul classbrief>li>The dfn iddirection>a hrefhttps://drafts.csswg.org/css-writing-modes/#direction>direction/a>/dfn> propertyli>The dfn idunicode-bidi>a hrefhttps://drafts.csswg.org/css-writing-modes/#unicode-bidi>unicode-bidi/a>/dfn> propertyli>The dfn idblock-flow-direction>a hrefhttps://drafts.csswg.org/css-writing-modes/#block-flow-direction>block flow direction/a>/dfn>, dfn idblock-size>a hrefhttps://drafts.csswg.org/css-writing-modes/#block-size>block size/a>/dfn>, dfn idinline-size>a hrefhttps://drafts.csswg.org/css-writing-modes/#inline-size>inline size/a>/dfn>, dfn idblock-start>a hrefhttps://drafts.csswg.org/css-writing-modes/#block-start>block-start/a>/dfn>, dfn idblock-end>a hrefhttps://drafts.csswg.org/css-writing-modes/#block-end>block-end/a>/dfn>, dfn idinline-start>a hrefhttps://drafts.csswg.org/css-writing-modes/#inline-start>inline-start/a>/dfn>, dfn idinline-end>a hrefhttps://drafts.csswg.org/css-writing-modes/#inline-end>inline-end/a>/dfn>, dfn idline-left>a hrefhttps://drafts.csswg.org/css-writing-modes/#line-left>line-left/a>/dfn>, and dfn idline-right>a hrefhttps://drafts.csswg.org/css-writing-modes/#line-right>line-right/a>/dfn> concepts/ul> p>The following features are defined in the cite>CSS Basic User Interface/cite> specification: a href#refsCSSUI>CSSUI/a>/p> ul classbrief>li>The dfn idoutline>a hrefhttps://drafts.csswg.org/css-ui/#outline>outline/a>/dfn> propertyli>The dfn idcursor>a hrefhttps://drafts.csswg.org/css-ui/#cursor>cursor/a>/dfn> propertyli>The dfn idappearance>a hrefhttps://drafts.csswg.org/css-ui-4/#appearance-switching>appearance/a>/dfn> property/ul> p>Implementations that support scripting must support the CSS Object Model. The following features and terms are defined in the CSSOM specifications: a href#refsCSSOM>CSSOM/a> a href#refsCSSOMVIEW>CSSOMVIEW/a> ul classbrief>li>dfn idscreen>a hrefhttps://drafts.csswg.org/cssom-view/#the-screen-interface>code>Screen/code>/a>/dfn> interfaceli>dfn idlinkstyle>a hrefhttps://drafts.csswg.org/cssom/#the-linkstyle-interface>code>LinkStyle/code>/a>/dfn> interfaceli>dfn idcssstyledeclaration>a hrefhttps://drafts.csswg.org/cssom/#the-cssstyledeclaration-interface>code>CSSStyleDeclaration/code>/a>/dfn> interfaceli>dfn iddom-cssstyledeclaration-csstext>a hrefhttps://drafts.csswg.org/cssom/#dom-cssstyledeclaration-csstext>code>cssText/code>/a>/dfn> attribute of code iddependencies:cssstyledeclaration>a data-x-internalcssstyledeclaration hrefhttps://drafts.csswg.org/cssom/#the-cssstyledeclaration-interface>CSSStyleDeclaration/a>/code>li>dfn idstylesheet>a hrefhttps://drafts.csswg.org/cssom/#the-stylesheet-interface>code>StyleSheet/code>/a>/dfn> interfaceli>dfn idcreate-a-css-style-sheet>a hrefhttps://drafts.csswg.org/cssom/#create-a-css-style-sheet>create a CSS style sheet/a>/dfn>li>dfn idremove-a-css-style-sheet>a hrefhttps://drafts.csswg.org/cssom/#remove-a-css-style-sheet>remove a CSS style sheet/a>/dfn>li>dfn idassociated-css-style-sheet>a hrefhttps://drafts.csswg.org/cssom/#associated-css-style-sheet>associated CSS style sheet/a>/dfn>li> dfn idcss-style-sheet>a hrefhttps://drafts.csswg.org/cssom/#css-style-sheet>CSS style sheets/a>/dfn> and their properties: ul classbrief>li>dfn idconcept-css-style-sheet-type>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-type>type/a>/dfn>li>dfn idconcept-css-style-sheet-location>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-location>location/a>/dfn>li>dfn idconcept-css-style-sheet-parent-css-style-sheet>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-parent-css-style-sheet>parent CSS style sheet/a>/dfn>li>dfn idconcept-css-style-sheet-owner-node>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-owner-node>owner node/a>/dfn>li>dfn idconcept-css-style-sheet-owner-css-rule>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-owner-css-rule>owner CSS rule/a>/dfn>li>dfn idconcept-css-style-sheet-media>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-media>media/a>/dfn>li>dfn idconcept-css-style-sheet-title>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-title>title/a>/dfn>li>dfn idconcept-css-style-sheet-alternate-flag>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-alternate-flag>alternate flag/a>/dfn>li>dfn idconcept-css-style-sheet-disabeld-flag>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-disabled-flag>disabled flag/a>/dfn>li>dfn idconcept-css-style-sheet-css-rules>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-css-rules>CSS rules/a>/dfn>li>dfn idconcept-css-style-sheet-origin-clean-flag>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-origin-clean-flag>origin-clean flag/a>/dfn>/ul> li>dfn idcss-style-sheet-set>a hrefhttps://drafts.csswg.org/cssom/#css-style-sheet-set>CSS style sheet set/a>/dfn>li>dfn idcss-style-sheet-set-name>a hrefhttps://drafts.csswg.org/cssom/#css-style-sheet-set-name>CSS style sheet set name/a>/dfn>li>dfn idpreferred-css-style-sheet-set-name>a hrefhttps://drafts.csswg.org/cssom/#preferred-css-style-sheet-set-name>preferred CSS style sheet set name/a>/dfn>li>dfn idchange-the-preferred-css-style-sheet-set-name>a hrefhttps://drafts.csswg.org/cssom/#change-the-preferred-css-style-sheet-set-name>change the preferred CSS style sheet set name/a>/dfn>li>dfn idserializing-a-css-value>a hrefhttps://drafts.csswg.org/cssom/#serialize-a-css-value>Serializing a CSS value/a>/dfn>li>dfn idrun-the-resize-steps>a hrefhttps://drafts.csswg.org/cssom-view/#run-the-resize-steps>run the resize steps/a>/dfn>li>dfn idrun-the-scroll-steps>a hrefhttps://drafts.csswg.org/cssom-view/#run-the-scroll-steps>run the scroll steps/a>/dfn>li>dfn idevaluate-media-queries-and-report-changes>a hrefhttps://drafts.csswg.org/cssom-view/#evaluate-media-queries-and-report-changes>evaluate media queries and report changes/a>/dfn>li>dfn idscroll-an-element-into-view>a hrefhttps://drafts.csswg.org/cssom-view/#scroll-an-element-into-view>Scroll an element into view/a>/dfn>li>dfn idscroll-to-the-beginning-of-the-document>a hrefhttps://drafts.csswg.org/cssom-view/#scroll-to-the-beginning-of-the-document>Scroll to the beginning of the document/a>/dfn>li>The dfn idevent-resize>a hrefhttps://drafts.csswg.org/cssom-view/#eventdef-window-resize>code>resize/code>/a>/dfn> eventli>The dfn idevent-scroll>a hrefhttps://drafts.csswg.org/cssom-view/#eventdef-document-scroll>code>scroll/code>/a>/dfn> eventli>dfn idset-up-browsing-context-features>a hrefhttps://drafts.csswg.org/cssom-view/#set-up-browsing-context-features>set up browsing context features/a>/dfn>/ul> p>The following features and terms are defined in the cite>CSS Syntax/cite> specifications: a href#refsCSSSYNTAX>CSSSYNTAX/a>/p> ul classbrief>li>dfn idconformant-style-sheet>a hrefhttps://drafts.csswg.org/css-syntax/#conform-classes>conformant style sheet/a>/dfn>li>dfn idparse-a-comma-separated-list-of-component-values>a hrefhttps://drafts.csswg.org/css-syntax/#parse-a-comma-separated-list-of-component-values>parse a comma-separated list of component values/a>/dfn>li>dfn idcomponent-value>a hrefhttps://drafts.csswg.org/css-syntax/#component-value>component value/a>/dfn>li>dfn idenvironment-encoding>a hrefhttps://drafts.csswg.org/css-syntax/#environment-encoding>environment encoding/a>/dfn>li>dfn idwhitespace-token>a hrefhttps://drafts.csswg.org/css-syntax/#typedef-whitespace-token><whitespace-token>/a>/dfn>/ul> p>The following terms are defined in the cite>Selectors/cite> specification: a href#refsSELECTORS>SELECTORS/a>/p> ul classbrief>li>dfn idtype-selector>a hrefhttps://drafts.csswg.org/selectors/#type-selector>type selector/a>/dfn>li>dfn idattribute-selector>a hrefhttps://drafts.csswg.org/selectors/#attribute-selector>attribute selector/a>/dfn>li>dfn idpseudo-class>a hrefhttps://drafts.csswg.org/selectors/#pseudo-class>pseudo-class/a>/dfn>/ul> p>The following features are defined in the cite>CSS Values and Units/cite> specification: a href#refsCSSVALUES>CSSVALUES/a>/p> ul classbrief>li>dfn idlength>a hrefhttps://drafts.csswg.org/css-values/#lengths><length>/a>/dfn>li>The dfn idem>a hrefhttps://drafts.csswg.org/css-values/#em>em/a>/dfn> unitli>The dfn idex>a hrefhttps://drafts.csswg.org/css-values/#ex>ex/a>/dfn> unitli>The dfn idvw>a hrefhttps://drafts.csswg.org/css-values/#vw>vw/a>/dfn> unitli>The dfn idin>a hrefhttps://drafts.csswg.org/css-values/#in>in/a>/dfn> unitli>The dfn idpx>a hrefhttps://drafts.csswg.org/css-values/#px>px/a>/dfn> unitli>The dfn idattr()>a hrefhttps://drafts.csswg.org/css-values/#funcdef-attr>attr()/a>/dfn> functionli>The dfn idcalc()>a hrefhttps://drafts.csswg.org/css-values/#funcdef-calc>calc()/a>/dfn> function/ul> p>The term dfn idcss-styling-attribute>a hrefhttps://drafts.csswg.org/css-style-attr/#style-attribute>style attribute/a>/dfn> is defined in the cite>CSS Style Attributes/cite> specification. a href#refsCSSATTR>CSSATTR/a>/p> p>The following terms are defined in the cite>CSS Cascading and Inheritance/cite> specification: a href#refsCSSCASCADE>CSSCASCADE/a>/p> ul classbrief>li>dfn idspecified-value>a hrefhttps://drafts.csswg.org/css-cascade/#specified-value>specified value/a>/dfn>li>dfn idcomputed-value>a hrefhttps://drafts.csswg.org/css-cascade/#computed-value>computed value/a>/dfn>li>dfn idused-value>a hrefhttps://drafts.csswg.org/css-cascade/#used-value>used value/a>/dfn>/ul> p>The code iddependencies:canvasrenderingcontext2d>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> objects use of fonts depends on the features described in the CSS cite>Fonts/cite> and cite>Font Loading/cite> specifications, including in particular dfn idfontface>code>FontFace/code>/dfn> objects and the dfn idfont-source>a hrefhttps://drafts.csswg.org/css-font-loading/#font-source>font source/a>/dfn> concept. a href#refsCSSFONTS>CSSFONTS/a> a href#refsCSSFONTLOAD>CSSFONTLOAD/a>/p> p>The following interfaces and terms are defined in the Geometry Interfaces Module specification: a href#refsGEOMETRY>GEOMETRY/a>/p> ul classbrief>li>dfn iddommatrix>a hrefhttps://drafts.fxtf.org/geometry/#dommatrix>code>DOMMatrix/code>/a>/dfn> interface, and associated dfn idm11-element>a hrefhttps://drafts.fxtf.org/geometry/#matrix-m11-element>m11 element/a>/dfn>, dfn idm12-element>a hrefhttps://drafts.fxtf.org/geometry/#matrix-m12-element>m12 element/a>/dfn>, dfn idm21-element>a hrefhttps://drafts.fxtf.org/geometry/#matrix-m21-element>m21 element/a>/dfn>, dfn idm22-element>a hrefhttps://drafts.fxtf.org/geometry/#matrix-m22-element>m22 element/a>/dfn>, dfn idm41-element>a hrefhttps://drafts.fxtf.org/geometry/#matrix-m41-element>m41 element/a>/dfn>, and dfn idm42-element>a hrefhttps://drafts.fxtf.org/geometry/#matrix-m42-element>m42 element/a>/dfn>li>dfn iddommatrix2dinit>a hrefhttps://drafts.fxtf.org/geometry/#dictdef-dommatrix2dinit>code>DOMMatrix2DInit/code>/a>/dfn> and dfn iddommatrixinit>a hrefhttps://drafts.fxtf.org/geometry/#dictdef-dommatrixinit>code>DOMMatrixInit/code>/a>/dfn> dictionariesli>The dfn idcreate-a-dommatrix-from-a-dictionary>a hrefhttps://drafts.fxtf.org/geometry/#create-a-dommatrix-from-the-dictionary>create a code>DOMMatrix/code> from a dictionary/a>/dfn> algorithm for code iddependencies:dommatrix2dinit>a data-x-internaldommatrix2dinit hrefhttps://drafts.fxtf.org/geometry/#dictdef-dommatrix2dinit>DOMMatrix2DInit/a>/code> or code iddependencies:dommatrixinit>a data-x-internaldommatrixinit hrefhttps://drafts.fxtf.org/geometry/#dictdef-dommatrixinit>DOMMatrixInit/a>/code>/ul> dt>Intersection Observerdd> p>The following term is defined in the Intersection Observer specification: a href#refsINTERSECTIONOBSERVER>INTERSECTIONOBSERVER/a>/p> ul classbrief>li>dfn idrun-the-update-intersection-observations-steps>a hrefhttps://w3c.github.io/IntersectionObserver/#run-the-update-intersection-observations-steps>run the update intersection observations steps/a>/dfn>/ul> dt>WebGLdd> p>The following interface is defined in the WebGL specification: a href#refsWEBGL>WEBGL/a>/p> ul classbrief>li>dfn idwebglrenderingcontext>a hrefhttps://www.khronos.org/registry/webgl/specs/latest/1.0/#WebGLRenderingContext>code>WebGLRenderingContext/code>/a>/dfn> interface/ul> dt>WebVTTdd> p>Implementations may support WebVTT as a text track format for subtitles, captions, metadata, etc., for media resources. a href#refsWEBVTT>WEBVTT/a>/p> p>The following terms, used in this specification, are defined in the WebVTT specification:/p> ul classbrief>li>dfn idwebvtt-file>a hrefhttps://w3c.github.io/webvtt/#webvtt-file>WebVTT file/a>/dfn>li>dfn idwebvtt-file-using-cue-text>a hrefhttps://w3c.github.io/webvtt/#webvtt-file-using-cue-text>WebVTT file using cue text/a>/dfn>li>dfn idwebvtt-file-using-only-nested-cues>a hrefhttps://w3c.github.io/webvtt/#webvtt-file-using-only-nested-cues>WebVTT file using only nested cues/a>/dfn>li>dfn idwebvtt-parser>a hrefhttps://w3c.github.io/webvtt/#webvtt-parser>WebVTT parser/a>/dfn>li>The dfn idrules-for-updating-the-display-of-webvtt-text-tracks>a hrefhttps://w3c.github.io/webvtt/#rules-for-updating-the-display-of-webvtt-text-tracks>rules for updating the display of WebVTT text tracks/a>/dfn>li>The WebVTT dfn idtext-track-cue-writing-direction>a hrefhttps://w3c.github.io/webvtt/#webvtt-cue-writing-direction>text track cue writing direction/a>/dfn>li>dfn idvttcue>a hrefhttps://w3c.github.io/webvtt/#vttcue>code>VTTCue/code>/a>/dfn> interface/ul> dt>The WebSocket protocoldd> p>The following terms are defined in the WHATWG Fetch standard: a href#refsFETCH>FETCH/a>/p> ul classbrief>li>dfn idconcept-websocket-establish>a hrefhttps://fetch.spec.whatwg.org/#concept-websocket-establish>establish a WebSocket connection/a>/dfn>/ul> p>The following terms are defined in the WebSocket protocol specification: a href#refsWSP>WSP/a>/p> ul classbrief>li>dfn idconcept-websocket-established>the WebSocket connection is established/dfn>li>dfn idconcept-websockets-active-extensions>extensions in use/dfn>li>dfn idconcept-websocket-subprotocol>subprotocol in use/dfn>li>dfn idconcept-websocket-message-received>a WebSocket message has been received/dfn>li>dfn idconcept-websocket-send>send a WebSocket Message/dfn>li>dfn idconcept-websocket-fail>fail the WebSocket connection/dfn>li>dfn idconcept-websocket-close>close the WebSocket connection/dfn>li>dfn idconcept-websocket-start-closing-handshake>start the WebSocket closing handshake/dfn>li>dfn idconcept-websocket-closing-handshake>the WebSocket closing handshake is started/dfn>li>dfn idconcept-websocket-closed>the WebSocket connection is closed/dfn> (possibly i>cleanly/i>)li>dfn idconcept-websocket-close-code>the WebSocket connection close code/dfn>li>dfn idconcept-websocket-close-reason>the WebSocket connection close reason/dfn>li>dfn idhttp-sec-websocket-protocol>code>Sec-WebSocket-Protocol/code>/dfn> field/ul> dt>ARIAdd> p>The dfn idattr-aria-role>code>role/code>/dfn> attribute is defined in the ARIA specification, as are the following roles: a href#refsARIA>ARIA/a>/p> ul classbrief>li>dfn idattr-aria-role-button>a hrefhttps://w3c.github.io/aria/aria/aria.html#button>code>button/code>/a>/dfn>li>dfn idattr-aria-role-presentation>a hrefhttps://w3c.github.io/aria/aria/aria.html#presentation>code>presentation/code>/a>/dfn>/ul> p>In addition, the following dfn idattr-aria-*>code>aria-*/code>/dfn> content attributes are defined in the ARIA specification: a href#refsARIA>ARIA/a>/p> ul classbrief>li>dfn idattr-aria-describedby>a hrefhttps://w3c.github.io/aria/aria/aria.html#aria-describedby>code>aria-describedby/code>/a>/dfn>li>dfn idattr-aria-disabled>a hrefhttps://w3c.github.io/aria/aria/aria.html#aria-disabled>code>aria-disabled/code>/a>/dfn>li>dfn idattr-aria-label>a hrefhttps://w3c.github.io/aria/aria/aria.html#aria-label>code>aria-label/code>/a>/dfn>/ul> p>Finally, the following terms are defined in the ARIA specification: a href#refsARIA>ARIA/a>/p> ul classbrief>li>dfn idconcept-accessible-name>a hrefhttps://w3c.github.io/aria/aria/aria.html#dfn-accessible-name>accessible name/a>/dfn>/ul> dt>Content Security Policydd> p>The following terms are defined in cite>Content Security Policy/cite>: a href#refsCSP>CSP/a>/p> ul classbrief>li>dfn idcontent-security-policy>a hrefhttps://w3c.github.io/webappsec-csp/#content-security-policy-object>Content Security Policy/a>/dfn>li>dfn idcontent-security-policy-directive>a hrefhttps://w3c.github.io/webappsec-csp/#directives>Content Security Policy directive/a>/dfn>li>The dfn idcontent-security-policy-syntax>a hrefhttps://w3c.github.io/webappsec-csp/#grammardef-serialized-policy>Content Security Policy syntax/a>/dfn>li>dfn idenforce-the-policy>a hrefhttps://w3c.github.io/webappsec-csp/#enforced>enforce the policy/a>/dfn>li>The dfn idparse-a-serialized-content-security-policy>a hrefhttps://w3c.github.io/webappsec-csp/#parse-serialized-policy>parse a serialized Content Security Policy/a>/dfn> algorithmli>The dfn idinitialize-a-global-objects-csp-list>a hrefhttps://w3c.github.io/webappsec-csp/#initialize-global-object-csp>Initialize a global objects CSP list/a>/dfn> algorithmli>The dfn idinitialize-a-documents-csp-list>a hrefhttps://w3c.github.io/webappsec-csp/#initialize-document-csp>Initialize a Documents CSP list/a>/dfn> algorithmli>The dfn idshould-elements-inline-behavior-be-blocked-by-content-security-policy>a hrefhttps://w3c.github.io/webappsec-csp/#should-block-inline>Should elements inline behavior be blocked by Content Security Policy?/a>/dfn> algorithmli>The dfn idshould-navigation-request-of-type-from-source-in-target-be-blocked-by-content-security-policy>a hrefhttps://w3c.github.io/webappsec-csp/#should-block-navigation-request>Should navigation request of type from source in target be blocked by Content Security Policy?/a>/dfn> algorithmli>The dfn idshould-navigation-response-to-navigation-request-of-type-from-source-in-target-be-blocked-by-content-security-policy>a hrefhttps://w3c.github.io/webappsec-csp/#should-block-navigation-response>Should navigation response to navigation request of type from source in target be blocked by Content Security Policy?/a>/dfn> algorithmli>The dfn idreport-uri-directive>a hrefhttps://w3c.github.io/webappsec-csp/#report-uri>code>report-uri/code> directive/a>/dfn>li>The dfn idcsp-ensurecspdoesnotblockstringcompilation>a hrefhttps://w3c.github.io/webappsec-csp/#can-compile-strings>EnsureCSPDoesNotBlockStringCompilation/a>/dfn> abstract operationli>The dfn idis-base-allowed-for-document>a hrefhttps://w3c.github.io/webappsec-csp/#allow-base-for-document>Is base allowed for Document?/a>/dfn> algorithmli>The dfn idframe-ancestors-directive>a hrefhttps://w3c.github.io/webappsec-csp/#frame-ancestors>code>frame-ancestors/code> directive/a>/dfn>li>The dfn idsandbox-directive>a hrefhttps://w3c.github.io/webappsec-csp/#sandbox>code>sandbox/code> directive/a>/dfn>li>The dfn idshould-element-be-blocked-a-priori-by-content-security-policy>a hrefhttps://w3c.github.io/webappsec-csp/#should-plugin-element-be-blocked-a-priori-by-content-security-policy>Should element be blocked i langla>a priori/i> by Content Security Policy?/a>/dfn> algorithm/ul> dt>Service Workersdd> p>The following terms are defined in cite>Service Workers/cite>: a href#refsSW>SW/a>/p> ul classbrief>li>dfn iddfn-active-worker>a hrefhttps://w3c.github.io/ServiceWorker/#dfn-active-worker>active worker/a>/dfn>li>dfn iddfn-client-message-queue>a hrefhttps://w3c.github.io/ServiceWorker/#dfn-client-message-queue>client message queue/a>/dfn>li>dfn iddfn-control>a hrefhttps://w3c.github.io/ServiceWorker/#dfn-control>control/a>/dfn>li>dfn idon-fetch-request-algorithm>a hrefhttps://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm>handle fetch/a>/dfn>li>dfn idscope-match-algorithm>a hrefhttps://w3c.github.io/ServiceWorker/#scope-match-algorithm>match service worker registration/a>/dfn>li>dfn idscope-url>a hrefhttps://w3c.github.io/ServiceWorker/#dfn-scope-url>scope url/a>/dfn>li>dfn idscript-url>a hrefhttps://w3c.github.io/ServiceWorker/#dfn-script-url>script url/a>/dfn>li>dfn iddfn-service-worker>a hrefhttps://w3c.github.io/ServiceWorker/#dfn-service-worker>service worker/a>/dfn>li>dfn idserviceworkercontainer-service-worker-client>a hrefhttps://w3c.github.io/ServiceWorker/#serviceworkercontainer-service-worker-client>service worker client/a>/dfn>li>dfn idservice-worker-registration>a hrefhttps://w3c.github.io/ServiceWorker/#dfn-service-worker-registration>service worker registration/a>/dfn>li>dfn idservice-worker-type>a hrefhttps://w3c.github.io/ServiceWorker/#dfn-type>service worker type/a>/dfn>li>dfn idserviceworker-link>a hrefhttps://w3c.github.io/ServiceWorker/#dfn-serviceworker-link>serviceworker link/a>/dfn>li>dfn idserviceworker>a hrefhttps://w3c.github.io/ServiceWorker/#serviceworker>code>ServiceWorker/code>/a>/dfn> interfaceli>dfn idserviceworkercontainer>a hrefhttps://w3c.github.io/ServiceWorker/#serviceworkercontainer>code>ServiceWorkerContainer/code>/a>/dfn> interfaceli>dfn idserviceworkerglobalscope>a hrefhttps://w3c.github.io/ServiceWorker/#serviceworkerglobalscope>code>ServiceWorkerGlobalScope/code>/a>/dfn> interfaceli>dfn idupdate-via-cache-mode>a hrefhttps://w3c.github.io/ServiceWorker/#dfn-update-via-cache>update via cache mode/a>/dfn>/ul> dt>Secure Contextsdd> p>The following terms are defined in cite>Secure Contexts/cite>: a href#refsSECURE-CONTEXTS>SECURE-CONTEXTS/a>/p> ul classbrief>li>dfn idis-environment-settings-object-a-secure-context>a hrefhttps://w3c.github.io/webappsec-secure-contexts/#settings-object>Is environment settings object a secure context?/a>/dfn>li>dfn idnon-secure-context>a hrefhttps://w3c.github.io/webappsec-secure-contexts/#non-secure-context>non-secure context/a>/dfn>li>dfn idsecure-context>a hrefhttps://w3c.github.io/webappsec-secure-contexts/#secure-context>secure context/a>/dfn>/ul> dt>Payment Request APIdd> p>The following feature is defined in the cite>Payment Request API/cite> specification: a href#refsPAYMENTREQUEST>PAYMENTREQUEST/a>/p> ul classbrief>li>dfn idpaymentrequest>a hrefhttps://w3c.github.io/payment-request/#dom-paymentrequest>code>PaymentRequest/code>/a>/dfn> interface/ul> dt>MathMLdd> p>While support for MathML as a whole is not required by this specification (though it is encouraged, at least for Web browsers), certain features depend upon small parts of MathML being implemented. a href#refsMATHML>MATHML/a>/p> p>The following features are defined in the MathML specification:/p> ul classbrief>li>dfn idmathml-annotation-xml>a hrefhttps://www.w3.org/Math/draft-spec/chapter5.html#mixing.elements.annotation.xml>MathML code>annotation-xml/code>/a>/dfn> elementli>dfn idmathml-math>a hrefhttps://www.w3.org/Math/draft-spec/chapter2.html#interf.toplevel>MathML code>math/code>/a>/dfn> elementli>dfn idmathml-merror>a hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.merror>MathML code>merror/code>/a>/dfn> elementli>dfn idmathml-mi>a hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mi>MathML code>mi/code>/a>/dfn> elementli>dfn idmathml-mn>a hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mn>MathML code>mn/code>/a>/dfn> elementli>dfn idmathml-mo>a hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mo>MathML code>mo/code>/a>/dfn> elementli>dfn idmathml-ms>a hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.ms>MathML code>ms/code>/a>/dfn> elementli>dfn idmathml-mtext>a hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mtext>MathML code>mtext/code>/a>/dfn> element/ul> dt>SVGdd> p>While support for SVG as a whole is not required by this specification (though it is encouraged, at least for Web browsers), certain features depend upon parts of SVG being implemented./p> p>Also, the SVG specifications do not reflect implementation reality. Implementations implement subsets of SVG 1.1 and SVG Tiny 1.2. Although it is hoped that the in-progress SVG 2 specification is a more realistic target for implementations, until that specification is ready, user agents that implement SVG must do so with the following a href#willful-violation iddependencies:willful-violation-2>willful violations/a> and additions. a href#refsSVG>SVG/a> a href#refsSVGTINY12>SVGTINY12/a> a href#refsSVG2>SVG2/a>/p> p>User agents that implement SVG must not implement the following features from SVG 1.1:/p> ul classbrief>li>The code>tref/code> elementli>The code>cursor/code> element (use CSSs code>cursor/code> property instead)li>The font-defining SVG elements: code>font/code>, code>glyph/code>, code>missing-glyph/code>, code>hkern/code>, code>vkern/code>, code>font-face/code>, code>font-face-src/code>, code>font-face-uri/code>, code>font-face-format/code>, and code>font-face-name/code> (use CSSs code>@font-face/code> instead)li>The code>externalResourcesRequired/code> attributeli>The code>enable-background/code> propertyli>The code>contentScriptType/code> and code>contentStyleType/code> attributes (use the code>type/code> attribute on the a iddependencies:svg-script hrefhttps://www.w3.org/TR/SVG11/script.html#ScriptElement data-x-internalsvg-script>SVG code>script/code>/a> and code>style/code> elements instead)/ul> p>User agents that implement SVG must implement the following features from SVG Tiny 1.2:/p> ul classbrief>li>The code>non-scaling-stroke/code> value for the code>vector-effect/code> propertyli>The code>class/code> attribute is allowed on all SVG elementsli>The code>tabindex/code> attribute is allowed on visible SVG elementsli>The ARIA accessibility attributes are allowed on all SVG elements/ul> p>The following features are defined in the SVG specifications:/p> ul classbrief>li>dfn idsvgimageelement>a hrefhttps://www.w3.org/TR/SVG11/struct.html#InterfaceSVGImageElement>code>SVGImageElement/code>/a>/dfn> interfaceli>dfn idsvgscriptelement>a hrefhttps://www.w3.org/TR/SVG11/script.html#InterfaceSVGScriptElement>code>SVGScriptElement/code>/a>/dfn> interfaceli>dfn idsvgsvgelement>a hrefhttps://www.w3.org/TR/SVG11/struct.html#InterfaceSVGSVGElement>code>SVGSVGElement/code>/a>/dfn> interfaceli>dfn idsvg-desc>a hrefhttps://www.w3.org/TR/SVG11/struct.html#DescElement>SVG code>desc/code>/a>/dfn> elementli>dfn idsvg-foreignobject>a hrefhttps://www.w3.org/TR/SVG11/extend.html#ForeignObjectElement>SVG code>foreignObject/code>/a>/dfn> elementli>dfn idsvg-image>a hrefhttps://www.w3.org/TR/SVG11/struct.html#ImageElement>SVG code>image/code>/a>/dfn> elementli>dfn idsvg-script>a hrefhttps://www.w3.org/TR/SVG11/script.html#ScriptElement>SVG code>script/code>/a>/dfn> elementli>dfn idsvg-svg>a hrefhttps://www.w3.org/TR/SVG11/struct.html#SVGElement>SVG code>svg/code>/a>/dfn> elementli>dfn idsvg-title>a hrefhttps://www.w3.org/TR/SVG11/struct.html#TitleElement>SVG code>title/code>/a>/dfn> elementli>dfn idsvg-use>a hrefhttps://www.w3.org/TR/SVG11/struct.html#UseElement>SVG code>use/code>/a>/dfn> element/ul> dt>Filter Effectsdd> p>The following feature is defined in the cite>Filter Effects/cite> specification: a href#refsFILTERS>FILTERS/a>/p> ul classbrief>li>dfn idfilter-function-list>a hrefhttps://drafts.fxtf.org/filter-effects/#typedef-filter-function-list><filter-function-list>/a>/dfn>/ul> dt>Workletsdd> p>The following feature is defined in the cite>Worklets/cite> specification: a href#refsWORKLETS>WORKLETS/a>/p> ul classbrief>li>dfn idworkletglobalscope>a hrefhttps://drafts.css-houdini.org/worklets/#workletglobalscope>code>WorkletGlobalScope/code>/a>/dfn>/ul> /dl> hr> p>This specification does not em>require/em> support of any particular network protocol, style sheet language, scripting language, or any of the DOM specifications beyond those required in the list above. However, the language described by this specification is biased towards CSS as the styling language, JavaScript as the scripting language, and HTTP as the network protocol, and several features assume that those languages and protocols are in use./p> p>A user agent that implements the HTTP protocol must implement cite>HTTP State Management Mechanism/cite> (Cookies) as well. a href#refsHTTP>HTTP/a> a href#refsCOOKIES>COOKIES/a>/p> p classnote>This specification might have certain additional requirements on character encodings, image formats, audio formats, and video formats in the respective sections./p> /div> h4 idextensibility-2>span classsecno>2.1.10/span> Extensibilitya href#extensibility-2 classself-link>/a>/h4> p>Vendor-specific proprietary user agent extensions to this specification are strongly discouraged. Documents must not use such extensions, as doing so reduces interoperability and fragments the user base, allowing only users of specific user agents to access the content in question./p> p>All extensions must be defined so that the use of extensions neither contradicts nor causes the non-conformance of functionality defined in the specification./p> div classexample> p>For example, while strongly discouraged from doing so, an implementation could add a new IDL attribute code>typeTime/code> to a control that returned the time it took the user to select the current value of a control (say). On the other hand, defining a new control that appears in a forms code idextensibility-2:dom-form-elements>a href#dom-form-elements>elements/a>/code> array would be in violation of the above requirement, as it would violate the definition of code idextensibility-2:dom-form-elements-2>a href#dom-form-elements>elements/a>/code> given in this specification./p> /div> hr> p>When vendor-neutral extensions to this specification are needed, either this specification can be updated accordingly, or an extension specification can be written that overrides the requirements in this specification. When someone applying this specification to their activities decides that they will recognize the requirements of such an extension specification, it becomes an dfn idother-applicable-specifications>applicable specification/dfn> for the purposes of conformance requirements in this specification./p> p classnote>Someone could write a specification that defines any arbitrary byte stream as conforming, and then claim that their random junk is conforming. However, that does not mean that their random junk actually is conforming for everyones purposes: if someone else decides that that specification does not apply to their work, then they can quite legitimately say that the aforementioned random junk is just that, junk, and not conforming at all. As far as conformance goes, what matters in a particular community is what that community em>agrees/em> is applicable./p> hr> p>User agents must treat elements and attributes that they do not understand as semantically neutral; leaving them in the DOM (for DOM processors), and styling them according to CSS (for CSS processors), but not inferring any meaning from them./p> p>When support for a feature is disabled (e.g. as an emergency measure to mitigate a security problem, or to aid in development, or for performance reasons), user agents must act as if they had no support for the feature whatsoever, and as if the feature was not mentioned in this specification. For example, if a particular feature is accessed via an attribute in a Web IDL interface, the attribute itself would be omitted from the objects that implement that interface — leaving the attribute on the object but making it return null or throw an exception is insufficient./p> h4 idinteractions-with-xpath-and-xslt>span classsecno>2.1.11/span> Interactions with XPath and XSLTa href#interactions-with-xpath-and-xslt classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id18460 titleNeed to violate XSLT spec to correctly produce br>>18460/a>/div> p idxpath-1.0-processors>Implementations of XPath 1.0 that operate on a idinteractions-with-xpath-and-xslt:html-documents hrefhttps://dom.spec.whatwg.org/#html-document data-x-internalhtml-documents>HTML documents/a> parsed or created in the manners described in this specification (e.g. as part of the code>document.evaluate()/code> API) must act as if the following edit was applied to the XPath 1.0 specification./p> p>First, remove this paragraph:/p> blockquote citehttps://www.w3.org/TR/1999/REC-xpath-19991116/#node-tests> p>A a hrefhttps://www.w3.org/TR/REC-xml-names/#NT-QName>QName/a> in the node test is expanded into an a hrefhttps://www.w3.org/TR/1999/REC-xpath-19991116/#dt-expanded-name>expanded-name/a> using the namespace declarations from the expression context. This is the same way expansion is done for element type names in start and end-tags except that the default namespace declared with code>xmlns/code> is not used: if the a hrefhttps://www.w3.org/TR/REC-xml-names/#NT-QName>QName/a> does not have a prefix, then the namespace URI is null (this is the same way attribute names are expanded). It is an error if the a hrefhttps://www.w3.org/TR/REC-xml-names/#NT-QName>QName/a> has a prefix for which there is no namespace declaration in the expression context./p> /blockquote> p>Then, insert in its place the following:/p> blockquote citehttps://www.w3.org/Bugs/Public/show_bug.cgi?id7059#c37> p>A QName in the node test is expanded into an expanded-name using the namespace declarations from the expression context. If the QName has a prefix, then there must be a namespace declaration for this prefix in the expression context, and the corresponding namespace URI is the one that is associated with this prefix. It is an error if the QName has a prefix for which there is no namespace declaration in the expression context. /p> p>If the QName has no prefix and the principal node type of the axis is element, then the default element namespace is used. Otherwise if the QName has no prefix, the namespace URI is null. The default element namespace is a member of the context for the XPath expression. The value of the default element namespace when executing an XPath expression through the DOM3 XPath API is determined in the following way:/p> ol>li>If the context node is from an HTML DOM, the default element namespace is http://www.w3.org/1999/xhtml.li>Otherwise, the default element namespace URI is null./ol> p classnote>This is equivalent to adding the default element namespace feature of XPath 2.0 to XPath 1.0, and using the HTML namespace as the default element namespace for HTML documents. It is motivated by the desire to have implementations be compatible with legacy HTML content while still supporting the changes that this specification introduces to HTML regarding the namespace used for HTML elements, and by the desire to use XPath 1.0 rather than XPath 2.0./p> /blockquote> p classnote>This change is a a href#willful-violation idinteractions-with-xpath-and-xslt:willful-violation>willful violation/a> of the XPath 1.0 specification, motivated by desire to have implementations be compatible with legacy content while still supporting the changes that this specification introduces to HTML regarding which namespace is used for HTML elements. a href#refsXPATH10>XPATH10/a>/p> hr> p iddom-based-xslt-1.0-processors>XSLT 1.0 processors outputting to a DOM when the output method is html (either explicitly or via the defaulting rule in XSLT 1.0) are affected as follows:/p> p>If the transformation program outputs an element in no namespace, the processor must, prior to constructing the corresponding DOM element node, change the namespace of the element to the a idinteractions-with-xpath-and-xslt:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>, a hrefhttps://infra.spec.whatwg.org/#ascii-lowercase idinteractions-with-xpath-and-xslt:converted-to-ascii-lowercase data-x-internalconverted-to-ascii-lowercase>ASCII-lowercase/a> the elements local name, and a hrefhttps://infra.spec.whatwg.org/#ascii-lowercase idinteractions-with-xpath-and-xslt:converted-to-ascii-lowercase-2 data-x-internalconverted-to-ascii-lowercase>ASCII-lowercase/a> the names of any non-namespaced attributes on the element./p> p classnote>This requirement is a a href#willful-violation idinteractions-with-xpath-and-xslt:willful-violation-2>willful violation/a> of the XSLT 1.0 specification, required because this specification changes the namespaces and case-sensitivity rules of HTML in a manner that would otherwise be incompatible with DOM-based XSLT transformations. (Processors that serialize the output are unaffected.) a href#refsXSLT10>XSLT10/a>/p> hr> p>This specification does not specify precisely how XSLT processing interacts with the a href#html-parser idinteractions-with-xpath-and-xslt:html-parser>HTML parser/a> infrastructure (for example, whether an XSLT processor acts as if it puts any elements into a a href#stack-of-open-elements idinteractions-with-xpath-and-xslt:stack-of-open-elements>stack of open elements/a>). However, XSLT processors must a href#stop-parsing idinteractions-with-xpath-and-xslt:stop-parsing>stop parsing/a> if they successfully complete, and must set the a href#current-document-readiness idinteractions-with-xpath-and-xslt:current-document-readiness>current document readiness/a> first to code>interactive/code> and then to code>complete/code> if they are aborted./p> hr> p>This specification does not specify how XSLT interacts with the a href#navigate idinteractions-with-xpath-and-xslt:navigate>navigation/a> algorithm, how it fits in with the a href#event-loop idinteractions-with-xpath-and-xslt:event-loop>event loop/a>, nor how error pages are to be handled (e.g. whether XSLT errors are to replace an incremental XSLT output, or are rendered inline, etc)./p> p classnote>There are also additional non-normative comments regarding the interaction of XSLT and HTML a href#scriptTagXSLT>in the code>script/code> element section/a>, and of XSLT, XPath, and HTML a href#template-XSLT-XPath>in the code>template/code> element section/a>./p> h3 idcase-sensitivity-and-string-comparison>span classsecno>2.2/span> Case-sensitivity and string comparisona href#case-sensitivity-and-string-comparison classself-link>/a>/h3> p>Comparing two strings in a dfn idcase-sensitive data-export>case-sensitive/dfn> manner means comparing them exactly, code point for code point./p> p>Except where otherwise stated, string comparisons must be performed in a a href#case-sensitive idcase-sensitivity-and-string-comparison:case-sensitive>case-sensitive/a> manner./p> p>A string var>pattern/var> is a dfn idprefix-match>prefix match/dfn> for a string var>s/var> when var>pattern/var> is not longer than var>s/var> and truncating var>s/var> to var>pattern/var>s length leaves the two strings as matches of each other./p> h3 idcommon-microsyntaxes>span classsecno>2.3/span> Common microsyntaxesa href#common-microsyntaxes classself-link>/a>/h3> p>There are various places in HTML that accept particular data types, such as dates or numbers. This section describes what the conformance criteria for content in those formats is, and how to parse them./p> p classnote>Implementors are strongly urged to carefully examine any third-party libraries they might consider using to implement the parsing of syntaxes described below. For example, date libraries are likely to implement error handling behavior that differs from what is required in this specification, since error-handling behavior is often not defined in specifications that describe date syntaxes similar to those used in this specification, and thus implementations tend to vary greatly in how they handle errors./p> h4 idcommon-parser-idioms>span classsecno>2.3.1/span> Common parser idiomsa href#common-parser-idioms classself-link>/a>/h4> p>The dfn idwhite_space>White_Space characters/dfn> are those that have the Unicode property White_Space in the Unicode code>PropList.txt/code> data file. a href#refsUNICODE>UNICODE/a>/p> p classnote>This is not to be confused with the White_Space value (abbreviated WS) of the Bidi_Class property in the code>Unicode.txt/code> data file./p> p>Some of the micro-parsers described below follow the pattern of having an var>input/var> variable that holds the string being parsed, and having a var>position/var> variable pointing at the next character to parse in var>input/var>./p> h4 idboolean-attributes>span classsecno>2.3.2/span> Boolean attributesa href#boolean-attributes classself-link>/a>/h4> p>A number of attributes are dfn idboolean-attribute>boolean attributes/dfn>. The presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value./p> p>If the attribute is present, its value must either be the empty string or a value that is an a idboolean-attributes:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the attributes canonical name, with no leading or trailing whitespace./p> p classnote>The values true and false are not allowed on boolean attributes. To represent a false value, the attribute has to be omitted altogether./p> div classexample> p>Here is an example of a checkbox that is checked and disabled. The code idboolean-attributes:attr-input-checked>a href#attr-input-checked>checked/a>/code> and code idboolean-attributes:attr-fe-disabled>a href#attr-fe-disabled>disabled/a>/code> attributes are the boolean attributes./p> pre><label><input typecheckbox checked namecheese disabled> Cheese</label>/pre> p>This could be equivalently written as this: pre><label><input typecheckbox checkedchecked namecheese disableddisabled> Cheese</label>/pre> p>You can also mix styles; the following is still equivalent:/p> pre><label><input typecheckbox checked namecheese disabled> Cheese</label>/pre> /div> h4 idkeywords-and-enumerated-attributes>span classsecno>2.3.3/span> Keywords and enumerated attributesa href#keywords-and-enumerated-attributes classself-link>/a>/h4> p>Some attributes are defined as taking one of a finite set of keywords. Such attributes are called dfn idenumerated-attribute>enumerated attributes/dfn>. The keywords are each defined to map to a particular em>state/em> (several keywords might map to the same state, in which case some of the keywords are synonyms of each other; additionally, some of the keywords can be said to be non-conforming, and are only in the specification for historical reasons). In addition, two default states can be given. The first is the dfn idinvalid-value-default>i>invalid value default/i>/dfn>, the second is the dfn idmissing-value-default>i>missing value default/i>/dfn>./p> p>If an enumerated attribute is specified, the attributes value must be an a idkeywords-and-enumerated-attributes:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for one of the given keywords that are not said to be non-conforming, with no leading or trailing whitespace./p> p>When the attribute is specified, if its value is an a idkeywords-and-enumerated-attributes:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for one of the given keywords then that keywords state is the state that the attribute represents. If the attribute value matches none of the given keywords, but the attribute has an i idkeywords-and-enumerated-attributes:invalid-value-default>a href#invalid-value-default>invalid value default/a>/i>, then the attribute represents that state. Otherwise, if the attribute value matches none of the keywords but there is a i idkeywords-and-enumerated-attributes:missing-value-default>a href#missing-value-default>missing value default/a>/i> state defined, then em>that/em> is the state represented by the attribute. Otherwise, there is no default, and invalid values mean that there is no state represented./p> p>When the attribute is em>not/em> specified, if there is a i idkeywords-and-enumerated-attributes:missing-value-default-2>a href#missing-value-default>missing value default/a>/i> state defined, then that is the state represented by the (missing) attribute. Otherwise, the absence of the attribute means that there is no state represented./p> p classnote>The empty string can be a valid keyword./p> h4 idnumbers>span classsecno>2.3.4/span> Numbersa href#numbers classself-link>/a>/h4> h5 idsigned-integers>span classsecno>2.3.4.1/span> Signed integersa href#signed-integers classself-link>/a>/h5> p>A string is a dfn idvalid-integer>valid integer/dfn> if it consists of one or more a idsigned-integers:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, optionally prefixed with a U+002D HYPHEN-MINUS character (-)./p> p>A a href#valid-integer idsigned-integers:valid-integer>valid integer/a> without a U+002D HYPHEN-MINUS (-) prefix represents the number that is represented in base ten by that string of digits. A a href#valid-integer idsigned-integers:valid-integer-2>valid integer/a> em>with/em> a U+002D HYPHEN-MINUS (-) prefix represents the number represented in base ten by the string of digits that follows the U+002D HYPHEN-MINUS, subtracted from zero./p> p>The dfn idrules-for-parsing-integers>rules for parsing integers/dfn> are as given in the following algorithm. When invoked, the steps must be followed in the order given, aborting at the first step that returns a value. This algorithm will return either an integer or an error./p> ol>li>p>Let var>input/var> be the string being parsed.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the start of the string.li>p>Let var>sign/var> have the value positive.li>p>a idsigned-integers:skip-ascii-whitespace hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace data-x-internalskip-ascii-whitespace>Skip ASCII whitespace/a> within var>input/var> given var>position/var>.li>p>If var>position/var> is past the end of var>input/var>, return an error.li> p>If the character indicated by var>position/var> (the first character) is a U+002D HYPHEN-MINUS character (-):/p> ol>li>Let var>sign/var> be negative.li>Advance var>position/var> to the next character.li>If var>position/var> is past the end of var>input/var>, return an error./ol> p>Otherwise, if the character indicated by var>position/var> (the first character) is a U+002B PLUS SIGN character (+):/p> ol>li>Advance var>position/var> to the next character. (The code>+/code> is ignored, but it is not conforming.)li>If var>position/var> is past the end of var>input/var>, return an error./ol> li>p>If the character indicated by var>position/var> is not an a hrefhttps://infra.spec.whatwg.org/#ascii-digit idsigned-integers:ascii-digits-2 data-x-internalascii-digits>ASCII digit/a>, then return an error.li>p>a idsigned-integers:collect-a-sequence-of-code-points hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idsigned-integers:ascii-digits-3 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>, and interpret the resulting sequence as a base-ten integer. Let var>value/var> be that integer.li>p>If var>sign/var> is positive, return var>value/var>, otherwise return the result of subtracting var>value/var> from zero./ol> h5 idnon-negative-integers>span classsecno>2.3.4.2/span> Non-negative integersa href#non-negative-integers classself-link>/a>/h5> p>A string is a dfn idvalid-non-negative-integer>valid non-negative integer/dfn> if it consists of one or more a idnon-negative-integers:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>./p> p>A a href#valid-non-negative-integer idnon-negative-integers:valid-non-negative-integer>valid non-negative integer/a> represents the number that is represented in base ten by that string of digits./p> p>The dfn idrules-for-parsing-non-negative-integers>rules for parsing non-negative integers/dfn> are as given in the following algorithm. When invoked, the steps must be followed in the order given, aborting at the first step that returns a value. This algorithm will return either zero, a positive integer, or an error./p> ol>li>p>Let var>input/var> be the string being parsed.li>p>Let var>value/var> be the result of parsing var>input/var> using the a href#rules-for-parsing-integers idnon-negative-integers:rules-for-parsing-integers>rules for parsing integers/a>.li>p>If var>value/var> is an error, return an error.li>p>If var>value/var> is less than zero, return an error.li>p>Return var>value/var>./ol> h5 idfloating-point-numbers>span classsecno>2.3.4.3/span> Floating-point numbersa href#floating-point-numbers classself-link>/a>/h5> p>A string is a dfn idvalid-floating-point-number>valid floating-point number/dfn> if it consists of:/p> ol classbrief>li>Optionally, a U+002D HYPHEN-MINUS character (-).li>One or both of the following, in the given order: ol>li>A series of one or more a idfloating-point-numbers:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>.li>Both of the following, in the given order: ol>li>A single U+002E FULL STOP character (.).li>A series of one or more a idfloating-point-numbers:ascii-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>./ol> /ol> li>Optionally: ol>li>Either a U+0065 LATIN SMALL LETTER E character (e) or a U+0045 LATIN CAPITAL LETTER E character (E).li>Optionally, a U+002D HYPHEN-MINUS character (-) or U+002B PLUS SIGN character (+).li>A series of one or more a idfloating-point-numbers:ascii-digits-3 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>./ol> /ol> p>A a href#valid-floating-point-number idfloating-point-numbers:valid-floating-point-number>valid floating-point number/a> represents the number obtained by multiplying the significand by ten raised to the power of the exponent, where the significand is the first number, interpreted as base ten (including the decimal point and the number after the decimal point, if any, and interpreting the significand as a negative number if the whole string starts with a U+002D HYPHEN-MINUS character (-) and the number is not zero), and where the exponent is the number after the E, if any (interpreted as a negative number if there is a U+002D HYPHEN-MINUS character (-) between the E and the number and the number is not zero, or else ignoring a U+002B PLUS SIGN character (+) between the E and the number if there is one). If there is no E, then the exponent is treated as zero./p> p classnote>The Infinity and Not-a-Number (NaN) values are not a href#valid-floating-point-number idfloating-point-numbers:valid-floating-point-number-2>valid floating-point numbers/a>./p> p classnote>The a href#valid-floating-point-number idfloating-point-numbers:valid-floating-point-number-3>valid floating-point number/a> concept is typically only used to restrict what is allowed for authors, while the user agent requirements use the a href#rules-for-parsing-floating-point-number-values idfloating-point-numbers:rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values/a> below (e.g., the code idfloating-point-numbers:attr-progress-max>a href#attr-progress-max>max/a>/code> attribute of the code idfloating-point-numbers:the-progress-element>a href#the-progress-element>progress/a>/code> element). However, in some cases the user agent requirements include checking if a string is a a href#valid-floating-point-number idfloating-point-numbers:valid-floating-point-number-4>valid floating-point number/a> (e.g., the a href#value-sanitization-algorithm idfloating-point-numbers:value-sanitization-algorithm>value sanitization algorithm/a> for the a href#number-state-(typenumber) idfloating-point-numbers:number-state-(typenumber)>Number/a> state of the code idfloating-point-numbers:the-input-element>a href#the-input-element>input/a>/code> element, or the a href#parse-a-srcset-attribute idfloating-point-numbers:parse-a-srcset-attribute>parse a srcset attribute/a> algorithm)./p> p>The dfn idbest-representation-of-the-number-as-a-floating-point-number>best representation of the number var>n/var> as a floating-point number/dfn> is the string obtained from running a idfloating-point-numbers:tostring hrefhttps://tc39.github.io/ecma262/#sec-tostring data-x-internaltostring>ToString/a>(var>n/var>). The abstract operation a idfloating-point-numbers:tostring-2 hrefhttps://tc39.github.io/ecma262/#sec-tostring data-x-internaltostring>ToString/a> is not uniquely determined. When there are multiple possible strings that could be obtained from a idfloating-point-numbers:tostring-3 hrefhttps://tc39.github.io/ecma262/#sec-tostring data-x-internaltostring>ToString/a> for a particular value, the user agent must always return the same string for that value (though it may differ from the value used by other user agents)./p> p>The dfn idrules-for-parsing-floating-point-number-values data-export>rules for parsing floating-point number values/dfn> are as given in the following algorithm. This algorithm must be aborted at the first step that returns something. This algorithm will return either a number or an error./p> ol>li>p>Let var>input/var> be the string being parsed.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the start of the string.li>p>Let var>value/var> have the value 1.li>p>Let var>divisor/var> have the value 1.li>p>Let var>exponent/var> have the value 1.li>p>a idfloating-point-numbers:skip-ascii-whitespace hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace data-x-internalskip-ascii-whitespace>Skip ASCII whitespace/a> within var>input/var> given var>position/var>.li>p>If var>position/var> is past the end of var>input/var>, return an error.li> p>If the character indicated by var>position/var> is a U+002D HYPHEN-MINUS character (-):/p> ol>li>Change var>value/var> and var>divisor/var> to −1.li>Advance var>position/var> to the next character.li>If var>position/var> is past the end of var>input/var>, return an error./ol> p>Otherwise, if the character indicated by var>position/var> (the first character) is a U+002B PLUS SIGN character (+):/p> ol>li>Advance var>position/var> to the next character. (The code>+/code> is ignored, but it is not conforming.)li>If var>position/var> is past the end of var>input/var>, return an error./ol> li>p>If the character indicated by var>position/var> is a U+002E FULL STOP (.), and that is not the last character in var>input/var>, and the character after the character indicated by var>position/var> is an a hrefhttps://infra.spec.whatwg.org/#ascii-digit idfloating-point-numbers:ascii-digits-4 data-x-internalascii-digits>ASCII digit/a>, then set var>value/var> to zero and jump to the step labeled i>fraction/i>./p> li>p>If the character indicated by var>position/var> is not an a hrefhttps://infra.spec.whatwg.org/#ascii-digit idfloating-point-numbers:ascii-digits-5 data-x-internalascii-digits>ASCII digit/a>, then return an error.li>p>a idfloating-point-numbers:collect-a-sequence-of-code-points hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idfloating-point-numbers:ascii-digits-6 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>, and interpret the resulting sequence as a base-ten integer. Multiply var>value/var> by that integer.li>If var>position/var> is past the end of var>input/var>, jump to the step labeled i>conversion/i>.li>p>i>Fraction/i>: If the character indicated by var>position/var> is a U+002E FULL STOP (.), run these substeps:/p> ol>li>p>Advance var>position/var> to the next character.li>p>If var>position/var> is past the end of var>input/var>, or if the character indicated by var>position/var> is not an a hrefhttps://infra.spec.whatwg.org/#ascii-digit idfloating-point-numbers:ascii-digits-7 data-x-internalascii-digits>ASCII digit/a>, U+0065 LATIN SMALL LETTER E (e), or U+0045 LATIN CAPITAL LETTER E (E), then jump to the step labeled i>conversion/i>.li>p>If the character indicated by var>position/var> is a U+0065 LATIN SMALL LETTER E character (e) or a U+0045 LATIN CAPITAL LETTER E character (E), skip the remainder of these substeps./p> li>p>i>Fraction loop/i>: Multiply var>divisor/var> by ten.li>Add the value of the character indicated by var>position/var>, interpreted as a base-ten digit (0..9) and divided by var>divisor/var>, to var>value/var>.li>p>Advance var>position/var> to the next character.li>p>If var>position/var> is past the end of var>input/var>, then jump to the step labeled i>conversion/i>.li>p>If the character indicated by var>position/var> is an a hrefhttps://infra.spec.whatwg.org/#ascii-digit idfloating-point-numbers:ascii-digits-8 data-x-internalascii-digits>ASCII digit/a>, jump back to the step labeled i>fraction loop/i> in these substeps./ol> li>p>If the character indicated by var>position/var> is U+0065 (e) or a U+0045 (E), then:/p> ol>li>p>Advance var>position/var> to the next character.li>p>If var>position/var> is past the end of var>input/var>, then jump to the step labeled i>conversion/i>.li> p>If the character indicated by var>position/var> is a U+002D HYPHEN-MINUS character (-):/p> ol>li>Change var>exponent/var> to −1.li>Advance var>position/var> to the next character.li>p>If var>position/var> is past the end of var>input/var>, then jump to the step labeled i>conversion/i>./ol> p>Otherwise, if the character indicated by var>position/var> is a U+002B PLUS SIGN character (+):/p> ol>li>Advance var>position/var> to the next character.li>p>If var>position/var> is past the end of var>input/var>, then jump to the step labeled i>conversion/i>./ol> li>p>If the character indicated by var>position/var> is not an a hrefhttps://infra.spec.whatwg.org/#ascii-digit idfloating-point-numbers:ascii-digits-9 data-x-internalascii-digits>ASCII digit/a>, then jump to the step labeled i>conversion/i>.li>p>a idfloating-point-numbers:collect-a-sequence-of-code-points-2 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idfloating-point-numbers:ascii-digits-10 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>, and interpret the resulting sequence as a base-ten integer. Multiply var>exponent/var> by that integer.li>p>Multiply var>value/var> by ten raised to the var>exponent/var>th power./ol> li>p>i>Conversion/i>: Let var>S/var> be the set of finite IEEE 754 double-precision floating-point values except −0, but with two special values added: 2sup>1024/sup> and −2sup>1024/sup>.li>p>Let var>rounded-value/var> be the number in var>S/var> that is closest to var>value/var>, selecting the number with an even significand if there are two equally close values. (The two special values 2sup>1024/sup> and −2sup>1024/sup> are considered to have even significands for this purpose.)li>p>If var>rounded-value/var> is 2sup>1024/sup> or −2sup>1024/sup>, return an error.li>p>Return var>rounded-value/var>./ol> h5 idpercentages-and-dimensions>span classsecno>2.3.4.4/span> Percentages and lengthsa href#percentages-and-dimensions classself-link>/a>/h5> p>The dfn idrules-for-parsing-dimension-values>rules for parsing dimension values/dfn> are as given in the following algorithm. When invoked, the steps must be followed in the order given, aborting at the first step that returns a value. This algorithm will return either a number greater than or equal to 0.0, or an error; if a number is returned, then it is further categorized as either a percentage or a length./p> ol>li>p>Let var>input/var> be the string being parsed.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the start of the string.li>p>a idpercentages-and-dimensions:skip-ascii-whitespace hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace data-x-internalskip-ascii-whitespace>Skip ASCII whitespace/a> within var>input/var> given var>position/var>.li>p>If var>position/var> is past the end of var>input/var>, return an error.li>p>If the character indicated by var>position/var> is a U+002B PLUS SIGN character (+), advance var>position/var> to the next character.li>p>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 an a hrefhttps://infra.spec.whatwg.org/#ascii-digit idpercentages-and-dimensions:ascii-digits data-x-internalascii-digits>ASCII digit/a>, then return an error.li>p>a idpercentages-and-dimensions:collect-a-sequence-of-code-points hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idpercentages-and-dimensions:ascii-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>, and interpret the resulting sequence as a base-ten integer. Let var>value/var> be that number.li>p>If var>position/var> is past the end of var>input/var>, return var>value/var> as a length.li> p>If the character indicated by var>position/var> is a U+002E FULL STOP character (.):/p> ol>li>p>Advance var>position/var> to the next character.li>p>If var>position/var> is past the end of var>input/var>, or if the character indicated by var>position/var> is not an a hrefhttps://infra.spec.whatwg.org/#ascii-digit idpercentages-and-dimensions:ascii-digits-3 data-x-internalascii-digits>ASCII digit/a>, then return var>value/var> as a length.li>p>Let var>divisor/var> have the value 1.li>p>i>Fraction loop/i>: Multiply var>divisor/var> by ten.li>Add the value of the character indicated by var>position/var>, interpreted as a base-ten digit (0..9) and divided by var>divisor/var>, to var>value/var>.li>p>Advance var>position/var> to the next character.li>p>If var>position/var> is past the end of var>input/var>, then return var>value/var> as a length.li>p>If the character indicated by var>position/var> is an a hrefhttps://infra.spec.whatwg.org/#ascii-digit idpercentages-and-dimensions:ascii-digits-4 data-x-internalascii-digits>ASCII digit/a>, return to the step labeled i>fraction loop/i> in these substeps./ol> li>p>If var>position/var> is past the end of var>input/var>, return var>value/var> as a length.li>p>If the character indicated by var>position/var> is a U+0025 PERCENT SIGN character (%), return var>value/var> as a percentage.li>p>Return var>value/var> as a length./ol> h5 idnon-zero-percentages-and-lengths>span classsecno>2.3.4.5/span> Non-zero percentages and lengthsa href#non-zero-percentages-and-lengths classself-link>/a>/h5> p>The dfn idrules-for-parsing-non-zero-dimension-values>rules for parsing nonzero dimension values/dfn> are as given in the following algorithm. When invoked, the steps must be followed in the order given, aborting at the first step that returns a value. This algorithm will return either a number greater than 0.0, or an error; if a number is returned, then it is further categorized as either a percentage or a length./p> ol>li>p>Let var>input/var> be the string being parsed.li>p>Let var>value/var> be the result of parsing var>input/var> using the a href#rules-for-parsing-dimension-values idnon-zero-percentages-and-lengths:rules-for-parsing-dimension-values>rules for parsing dimension values/a>.li>p>If var>value/var> is an error, return an error.li>p>If var>value/var> is zero, return an error.li>p>If var>value/var> is a percentage, return var>value/var> as a percentage.li>p>Return var>value/var> as a length./ol> h5 idlists-of-floating-point-numbers>span classsecno>2.3.4.6/span> Lists of floating-point numbersa href#lists-of-floating-point-numbers classself-link>/a>/h5> p>A dfn idvalid-list-of-floating-point-numbers>valid list of floating-point numbers/dfn> is a number of a href#valid-floating-point-number idlists-of-floating-point-numbers:valid-floating-point-number>valid floating-point numbers/a> separated by U+002C COMMA characters, with no other characters (e.g. no a idlists-of-floating-point-numbers:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>). In addition, there might be restrictions on the number of floating-point numbers that can be given, or on the range of values allowed./p> p>The dfn idrules-for-parsing-a-list-of-floating-point-numbers>rules for parsing a list of floating-point numbers/dfn> are as follows:/p> ol>li>p>Let var>input/var> be the string being parsed.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the start of the string.li>p>Let var>numbers/var> be an initially empty list of floating-point numbers. This list will be the result of this algorithm.li>p>a idlists-of-floating-point-numbers:collect-a-sequence-of-code-points hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idlists-of-floating-point-numbers:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, U+002C COMMA, or U+003B SEMICOLON characters from var>input/var> given var>position/var>. This skips past any leading delimiters.li>p>While var>position/var> is not past the end of var>input/var>:/p> ol>li>p>a idlists-of-floating-point-numbers:collect-a-sequence-of-code-points-2 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are not a idlists-of-floating-point-numbers:space-characters-3 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, U+002C COMMA, U+003B SEMICOLON, a idlists-of-floating-point-numbers:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, U+002E FULL STOP, or U+002D HYPHEN-MINUS characters from var>input/var> given var>position/var>. This skips past leading garbage.li>p>a idlists-of-floating-point-numbers:collect-a-sequence-of-code-points-3 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are not a idlists-of-floating-point-numbers:space-characters-4 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, U+002C COMMA, or U+003B SEMICOLON characters from var>input/var> given var>position/var>, and let var>unparsed number/var> be the result.li>p>Let var>number/var> be the result of parsing var>unparsed number/var> using the a href#rules-for-parsing-floating-point-number-values idlists-of-floating-point-numbers:rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values/a>.li>p>If var>number/var> is an error, set var>number/var> to zero.li>p>Append var>number/var> to var>numbers/var>.li>p>a idlists-of-floating-point-numbers:collect-a-sequence-of-code-points-4 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idlists-of-floating-point-numbers:space-characters-5 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, U+002C COMMA, or U+003B SEMICOLON characters from var>input/var> given var>position/var>. This skips past the delimiter./ol> li>p>Return var>numbers/var>./ol> h5 idlists-of-dimensions>span classsecno>2.3.4.7/span> Lists of dimensionsa href#lists-of-dimensions classself-link>/a>/h5> p>The dfn idrules-for-parsing-a-list-of-dimensions>rules for parsing a list of dimensions/dfn> are as follows. These rules return a list of zero or more pairs consisting of a number and a unit, the unit being one of i>percentage/i>, i>relative/i>, and i>absolute/i>./p> ol>li>p>Let var>raw input/var> be the string being parsed.li>p>If the last character in var>raw input/var> is a U+002C COMMA character (,), then remove that character from var>raw input/var>.li>p>a hrefhttps://infra.spec.whatwg.org/#split-on-commas idlists-of-dimensions:split-a-string-on-commas data-x-internalsplit-a-string-on-commas>Split the string var>raw input/var> on commas/a>. Let var>raw tokens/var> be the resulting list of tokens.li>p>Let var>result/var> be an empty list of number/unit pairs.li> p>For each token in var>raw tokens/var>, run the following substeps:/p> ol>li>p>Let var>input/var> be the token.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the start of the string.li>p>Let var>value/var> be the number 0.li>p>Let var>unit/var> be i>absolute/i>.li>p>If var>position/var> is past the end of var>input/var>, set var>unit/var> to i>relative/i> and jump to the last substep.li>p>If the character at var>position/var> is an a hrefhttps://infra.spec.whatwg.org/#ascii-digit idlists-of-dimensions:ascii-digits data-x-internalascii-digits>ASCII digit/a>, a idlists-of-dimensions:collect-a-sequence-of-code-points hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>collect a sequence of code points/a> that are a idlists-of-dimensions:ascii-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>, interpret the resulting sequence as an integer in base ten, and increment var>value/var> by that integer.li> p>If the character at var>position/var> is U+002E (.), then:/p> ol>li>p>a idlists-of-dimensions:collect-a-sequence-of-code-points-2 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> consisting of a idlists-of-dimensions:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> and a idlists-of-dimensions:ascii-digits-3 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>. Let var>s/var> be the resulting sequence.li>p>Remove all a idlists-of-dimensions:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> in var>s/var>.li> p>If var>s/var> is not the empty string, then:/p> ol>li>p>Let var>length/var> be the number of characters in var>s/var> (after the spaces were removed).li>p>Let var>fraction/var> be the result of interpreting var>s/var> as a base-ten integer, and then dividing that number by span>10sup>var>length/var>/sup>/span>.li>p>Increment var>value/var> by var>fraction/var>./ol> /ol> li>p>a idlists-of-dimensions:skip-ascii-whitespace hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace data-x-internalskip-ascii-whitespace>Skip ASCII whitespace/a> within var>input/var> given var>position/var>.li> p>If the character at var>position/var> is a U+0025 PERCENT SIGN character (%), then set var>unit/var> to i>percentage/i>./p> p>Otherwise, if the character at var>position/var> is a U+002A ASTERISK character (*), then set var>unit/var> to i>relative/i>./p> li>p>Add an entry to var>result/var> consisting of the number given by var>value/var> and the unit given by var>unit/var>./ol> li>p>Return the list var>result/var>./ol> h4 iddates-and-times>span classsecno>2.3.5/span> Dates and timesa href#dates-and-times classself-link>/a>/h4> p>In the algorithms below, the dfn idnumber-of-days-in-month-month-of-year-year>number of days in month var>month/var> of year var>year/var>/dfn> is: em>31/em> if var>month/var> is 1, 3, 5, 7, 8, 10, or 12; em>30/em> if var>month/var> is 4, 6, 9, or 11; em>29/em> if var>month/var> is 2 and var>year/var> is a number divisible by 400, or if var>year/var> is a number divisible by 4 but not by 100; and em>28/em> otherwise. This takes into account leap years in the Gregorian calendar. a href#refsGREGORIAN>GREGORIAN/a>/p> p>When a iddates-and-times:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> are used in the date and time syntaxes defined in this section, they express numbers in base ten./p> p classnote>While the formats described here are intended to be subsets of the corresponding ISO8601 formats, this specification defines parsing rules in much more detail than ISO8601. Implementors are therefore encouraged to carefully examine any date parsing libraries before using them to implement the parsing rules described below; ISO8601 libraries might not parse dates and times in exactly the same manner. a href#refsISO8601>ISO8601/a>/p> p>Where this specification refers to the dfn idproleptic-gregorian-calendar>proleptic Gregorian calendar/dfn>, it means the modern Gregorian calendar, extrapolated backwards to year 1. A date in the a href#proleptic-gregorian-calendar iddates-and-times:proleptic-gregorian-calendar>proleptic Gregorian calendar/a>, sometimes explicitly referred to as a dfn idproleptic-gregorian-date>proleptic-Gregorian date/dfn>, is one that is described using that calendar even if that calendar was not in use at the time (or place) in question. a href#refsGREGORIAN>GREGORIAN/a>/p> p classnote>The use of the Gregorian calendar as the wire format in this specification is an arbitrary choice resulting from the cultural biases of those involved in the decision. See also the section discussing a href#input-author-notes>date, time, and number formats/a> in forms (for authors), a href#input-impl-notes>implementation notes regarding localization of form controls/a>, and the code iddates-and-times:the-time-element>a href#the-time-element>time/a>/code> element./p> h5 idmonths>span classsecno>2.3.5.1/span> Monthsa href#months classself-link>/a>/h5> p>A dfn idconcept-month>month/dfn> consists of a specific a href#proleptic-gregorian-date idmonths:proleptic-gregorian-date>proleptic-Gregorian date/a> with no time-zone information and no date information beyond a year and a month. a href#refsGREGORIAN>GREGORIAN/a>/p> p>A string is a dfn idvalid-month-string>valid month string/dfn> representing a year var>year/var> and month var>month/var> if it consists of the following components in the given order:/p> ol>li>Four or more a idmonths:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, representing var>year/var>, where var>year/var> > 0li>A U+002D HYPHEN-MINUS character (-)li>Two a idmonths:ascii-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, representing the month var>month/var>, in the range 1 ≤ var>month/var> ≤ 12/ol> p>The rules to dfn idparse-a-month-string>parse a month string/dfn> are as follows. This will return either a year and month, or nothing. If at any point the algorithm says that it fails, this means that it is aborted at that point and returns nothing./p> ol>li>p>Let var>input/var> be the string being parsed.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the start of the string.li>p>a href#parse-a-month-component idmonths:parse-a-month-component>Parse a month component/a> to obtain var>year/var> and var>month/var>. If this returns nothing, then fail./p> li>p>If var>position/var> is em>not/em> beyond the end of var>input/var>, then fail.li>p>Return var>year/var> and var>month/var>./ol> p>The rules to dfn idparse-a-month-component>parse a month component/dfn>, given an var>input/var> string and a var>position/var>, are as follows. This will return either a year and a month, or nothing. If at any point the algorithm says that it fails, this means that it is aborted at that point and returns nothing./p> ol>li>p>a idmonths:collect-a-sequence-of-code-points hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idmonths:ascii-digits-3 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>. If the collected sequence is not at least four characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the var>year/var>.li>p>If var>year/var> is not a number greater than zero, then fail.li>p>If var>position/var> is beyond the end of var>input/var> or if the character at var>position/var> is not a U+002D HYPHEN-MINUS character, then fail. Otherwise, move var>position/var> forwards one character.li>p>a idmonths:collect-a-sequence-of-code-points-2 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idmonths:ascii-digits-4 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>. If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the var>month/var>.li>p>If var>month/var> is not a number in the range 1 ≤ var>month/var> ≤ 12, then fail.li>p>Return var>year/var> and var>month/var>./ol> h5 iddates>span classsecno>2.3.5.2/span> Datesa href#dates classself-link>/a>/h5> p>A dfn idconcept-date>date/dfn> consists of a specific a href#proleptic-gregorian-date iddates:proleptic-gregorian-date>proleptic-Gregorian date/a> with no time-zone information, consisting of a year, a month, and a day. a href#refsGREGORIAN>GREGORIAN/a>/p> p>A string is a dfn idvalid-date-string>valid date string/dfn> representing a year var>year/var>, month var>month/var>, and day var>day/var> if it consists of the following components in the given order:/p> ol>li>A a href#valid-month-string iddates: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 iddates:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, representing var>day/var>, in the range 1 ≤ var>day/var> ≤ var>maxday/var> where var>maxday/var> is the a href#number-of-days-in-month-month-of-year-year iddates:number-of-days-in-month-month-of-year-year>number of days in the month var>month/var> and year var>year/var>/a>/ol> p>The rules to dfn idparse-a-date-string>parse a date string/dfn> are as follows. This will return either a date, or nothing. If at any point the algorithm says that it fails, this means that it is aborted at that point and returns nothing./p> ol>li>p>Let var>input/var> be the string being parsed.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the start of the string.li>p>a href#parse-a-date-component iddates:parse-a-date-component>Parse a date component/a> to obtain var>year/var>, var>month/var>, and var>day/var>. If this returns nothing, then fail./p> li>p>If var>position/var> is em>not/em> beyond the end of var>input/var>, then fail.li>p>Let var>date/var> be the date with year var>year/var>, month var>month/var>, and day var>day/var>.li>p>Return var>date/var>./ol> p>The rules to dfn idparse-a-date-component>parse a date component/dfn>, given an var>input/var> string and a var>position/var>, are as follows. This will return either a year, a month, and a day, or nothing. If at any point the algorithm says that it fails, this means that it is aborted at that point and returns nothing./p> ol>li>p>a href#parse-a-month-component iddates: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 iddates:number-of-days-in-month-month-of-year-year-2>number of days in month var>month/var> of year var>year/var>/a>.li>p>If var>position/var> is beyond the end of var>input/var> or if the character at var>position/var> is not a U+002D HYPHEN-MINUS character, then fail. Otherwise, move var>position/var> forwards one character.li>p>a iddates:collect-a-sequence-of-code-points hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a iddates:ascii-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>. If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the var>day/var>.li>p>If var>day/var> is not a number in the range 1 ≤ var>day/var> ≤ var>maxday/var>, then fail.li>p>Return var>year/var>, var>month/var>, and var>day/var>./ol> h5 idyearless-dates>span classsecno>2.3.5.3/span> Yearless datesa href#yearless-dates classself-link>/a>/h5> p>A dfn idconcept-yearless-date>yearless date/dfn> consists of a Gregorian month and a day within that month, but with no associated year. a href#refsGREGORIAN>GREGORIAN/a>/p> p>A string is a dfn idvalid-yearless-date-string>valid yearless date string/dfn> representing a month var>month/var> and a day var>day/var> if it consists of the following components in the given order:/p> ol>li>Optionally, two U+002D HYPHEN-MINUS characters (-)li>Two a idyearless-dates:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, representing the month var>month/var>, in the range 1 ≤ var>month/var> ≤ 12li>A U+002D HYPHEN-MINUS character (-)li>Two a idyearless-dates:ascii-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, representing var>day/var>, in the range 1 ≤ var>day/var> ≤ var>maxday/var> where var>maxday/var> is the a href#number-of-days-in-month-month-of-year-year idyearless-dates:number-of-days-in-month-month-of-year-year>number of days/a> in the month var>month/var> and any arbitrary leap year (e.g. 4 or 2000)/ol> p classnote>In other words, if the var>month/var> is code>02/code>, meaning February, then the day can be 29, as if the year was a leap year./p> p>The rules to dfn idparse-a-yearless-date-string>parse a yearless date string/dfn> are as follows. This will return either a month and a day, or nothing. If at any point the algorithm says that it fails, this means that it is aborted at that point and returns nothing./p> ol>li>p>Let var>input/var> be the string being parsed.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the start of the string.li>p>a href#parse-a-yearless-date-component idyearless-dates:parse-a-yearless-date-component>Parse a yearless date component/a> to obtain var>month/var> and var>day/var>. If this returns nothing, then fail./p> li>p>If var>position/var> is em>not/em> beyond the end of var>input/var>, then fail.li>p>Return var>month/var> and var>day/var>./ol> p>The rules to dfn idparse-a-yearless-date-component>parse a yearless date component/dfn>, given an var>input/var> string and a var>position/var>, are as follows. This will return either a month and a day, or nothing. If at any point the algorithm says that it fails, this means that it is aborted at that point and returns nothing./p> ol>li>p>a idyearless-dates:collect-a-sequence-of-code-points hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are U+002D HYPHEN-MINUS characters (-) from var>input/var> given var>position/var>. If the collected sequence is not exactly zero or two characters long, then fail.li>p>a idyearless-dates:collect-a-sequence-of-code-points-2 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idyearless-dates:ascii-digits-3 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>. If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the var>month/var>.li>p>If var>month/var> is not a number in the range 1 ≤ var>month/var> ≤ 12, then fail.li>p>Let var>maxday/var> be the a href#number-of-days-in-month-month-of-year-year idyearless-dates:number-of-days-in-month-month-of-year-year-2>number of days/a> in month var>month/var> of any arbitrary leap year (e.g. 4 or 2000).li>p>If var>position/var> is beyond the end of var>input/var> or if the character at var>position/var> is not a U+002D HYPHEN-MINUS character, then fail. Otherwise, move var>position/var> forwards one character.li>p>a idyearless-dates:collect-a-sequence-of-code-points-3 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idyearless-dates:ascii-digits-4 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>. If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the var>day/var>.li>p>If var>day/var> is not a number in the range 1 ≤ var>day/var> ≤ var>maxday/var>, then fail.li>p>Return var>month/var> and var>day/var>./ol> h5 idtimes>span classsecno>2.3.5.4/span> Timesa href#times classself-link>/a>/h5> p>A dfn idconcept-time>time/dfn> consists of a specific time with no time-zone information, consisting of an hour, a minute, a second, and a fraction of a second./p> p>A string is a dfn idvalid-time-string>valid time string/dfn> representing an hour var>hour/var>, a minute var>minute/var>, and a second var>second/var> if it consists of the following components in the given order:/p> ol>li>Two a idtimes:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, representing var>hour/var>, in the range 0 ≤ var>hour/var> ≤ 23li>A U+003A COLON character (:)li>Two a idtimes:ascii-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, representing var>minute/var>, in the range 0 ≤ var>minute/var> ≤ 59li>If var>second/var> is nonzero, or optionally if var>second/var> is zero: ol>li>A U+003A COLON character (:)li>Two a idtimes:ascii-digits-3 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, representing the integer part of var>second/var>, in the range 0 ≤ var>s/var> ≤ 59li>If var>second/var> is not an integer, or optionally if var>second/var> is an integer: ol>li>A U+002E FULL STOP character (.)li>One, two, or three a idtimes:ascii-digits-4 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, representing the fractional part of var>second/var>/ol> /ol> /ol> p classnote>The var>second/var> component cannot be 60 or 61; leap seconds cannot be represented./p> p>The rules to dfn idparse-a-time-string>parse a time string/dfn> are as follows. This will return either a time, or nothing. If at any point the algorithm says that it fails, this means that it is aborted at that point and returns nothing./p> ol>li>p>Let var>input/var> be the string being parsed.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the start of the string.li>p>a href#parse-a-time-component idtimes:parse-a-time-component>Parse a time component/a> to obtain var>hour/var>, var>minute/var>, and var>second/var>. If this returns nothing, then fail./p> li>p>If var>position/var> is em>not/em> beyond the end of var>input/var>, then fail.li>p>Let var>time/var> be the time with hour var>hour/var>, minute var>minute/var>, and second var>second/var>.li>p>Return var>time/var>./ol> p>The rules to dfn idparse-a-time-component>parse a time component/dfn>, given an var>input/var> string and a var>position/var>, are as follows. This will return either an hour, a minute, and a second, or nothing. If at any point the algorithm says that it fails, this means that it is aborted at that point and returns nothing./p> ol>li>p>a idtimes:collect-a-sequence-of-code-points hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idtimes:ascii-digits-5 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>. If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the var>hour/var>.li>If var>hour/var> is not a number in the range 0 ≤ var>hour/var> ≤ 23, then fail.li>p>If var>position/var> is beyond the end of var>input/var> or if the character at var>position/var> is not a U+003A COLON character, then fail. Otherwise, move var>position/var> forwards one character.li>p>a idtimes:collect-a-sequence-of-code-points-2 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idtimes:ascii-digits-6 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>. If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the var>minute/var>.li>If var>minute/var> is not a number in the range 0 ≤ var>minute/var> ≤ 59, then fail.li>p>Let var>second/var> be 0.li> p>If var>position/var> is not beyond the end of var>input/var> and the character at var>position/var> is U+003A (:), then:/p> ol>li>p>Advance var>position/var> to the next character in var>input/var>.li>p>If var>position/var> is beyond the end of var>input/var>, or at the last character in var>input/var>, or if the next em>two/em> characters in var>input/var> starting at var>position/var> are not both a idtimes:ascii-digits-7 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, then fail.li>p>a idtimes:collect-a-sequence-of-code-points-3 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are either a idtimes:ascii-digits-8 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> or U+002E FULL STOP characters from var>input/var> given var>position/var>. If the collected sequence is three characters long, or if it is longer than three characters long and the third character is not a U+002E FULL STOP character, or if it has more than one U+002E FULL STOP character, then fail. Otherwise, interpret the resulting sequence as a base-ten number (possibly with a fractional part). Set var>second/var> to that number.li>p>If var>second/var> is not a number in the range 0 ≤ var>second/var> < 60, then fail./ol> li>p>Return var>hour/var>, var>minute/var>, and var>second/var>./ol> h5 idlocal-dates-and-times>span classsecno>2.3.5.5/span> Local dates and timesa href#local-dates-and-times classself-link>/a>/h5> p>A dfn idconcept-datetime-local>local date and time/dfn> consists of a specific a href#proleptic-gregorian-date idlocal-dates-and-times:proleptic-gregorian-date>proleptic-Gregorian date/a>, consisting of a year, a month, and a day, and a time, consisting of an hour, a minute, a second, and a fraction of a second, but expressed without a time zone. a href#refsGREGORIAN>GREGORIAN/a>/p> p>A string is a dfn idvalid-local-date-and-time-string>valid local date and time string/dfn> representing a date and time if it consists of the following components in the given order:/p> ol>li>A a href#valid-date-string idlocal-dates-and-times:valid-date-string>valid date string/a> representing the dateli>A U+0054 LATIN CAPITAL LETTER T character (T) or a U+0020 SPACE characterli>A a href#valid-time-string idlocal-dates-and-times:valid-time-string>valid time string/a> representing the time/ol> p>A string is a dfn idvalid-normalised-local-date-and-time-string>valid normalized local date and time string/dfn> representing a date and time if it consists of the following components in the given order:/p> ol>li>A a href#valid-date-string idlocal-dates-and-times:valid-date-string-2>valid date string/a> representing the dateli>A U+0054 LATIN CAPITAL LETTER T character (T)li>A a href#valid-time-string idlocal-dates-and-times:valid-time-string-2>valid time string/a> representing the time, expressed as the shortest possible string for the given time (e.g. omitting the seconds component entirely if the given time is zero seconds past the minute)/ol> p>The rules to dfn idparse-a-local-date-and-time-string>parse a local date and time string/dfn> are as follows. This will return either a date and time, or nothing. If at any point the algorithm says that it fails, this means that it is aborted at that point and returns nothing./p> ol>li>p>Let var>input/var> be the string being parsed.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the start of the string.li>p>a href#parse-a-date-component idlocal-dates-and-times:parse-a-date-component>Parse a date component/a> to obtain var>year/var>, var>month/var>, and var>day/var>. If this returns nothing, then fail./p> li>p>If var>position/var> is beyond the end of var>input/var> or if the character at var>position/var> is neither a U+0054 LATIN CAPITAL LETTER T character (T) nor a U+0020 SPACE character, then fail. Otherwise, move var>position/var> forwards one character.li>p>a href#parse-a-time-component idlocal-dates-and-times:parse-a-time-component>Parse a time component/a> to obtain var>hour/var>, var>minute/var>, and var>second/var>. If this returns nothing, then fail./p> li>p>If var>position/var> is em>not/em> beyond the end of var>input/var>, then fail.li>p>Let var>date/var> be the date with year var>year/var>, month var>month/var>, and day var>day/var>.li>p>Let var>time/var> be the time with hour var>hour/var>, minute var>minute/var>, and second var>second/var>.li>p>Return var>date/var> and var>time/var>./ol> h5 idtime-zones>span classsecno>2.3.5.6/span> Time zonesa href#time-zones classself-link>/a>/h5> p>A dfn idconcept-timezone>time-zone offset/dfn> consists of a signed number of hours and minutes./p> p>A string is a dfn idvalid-time-zone-offset-string>valid time-zone offset string/dfn> representing a time-zone offset if it consists of either:/p> ul>li>p>A U+005A LATIN CAPITAL LETTER Z character (Z), allowed only if the time zone is UTCli> p>Or, the following components, in the given order:/p> ol>li>Either a U+002B PLUS SIGN character (+) or, if the time-zone offset is not zero, a U+002D HYPHEN-MINUS character (-), representing the sign of the time-zone offsetli>Two a idtime-zones:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, representing the hours component var>hour/var> of the time-zone offset, in the range 0 ≤ var>hour/var> ≤ 23li>Optionally, a U+003A COLON character (:)li>Two a idtime-zones:ascii-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, representing the minutes component var>minute/var> of the time-zone offset, in the range 0 ≤ var>minute/var> ≤ 59/ol> /ul> p classnote>This format allows for time-zone offsets from -23:59 to +23:59. Right now, in practice, the range of offsets of actual time zones is -12:00 to +14:00, and the minutes component of offsets of actual time zones is always either 00, 30, or 45. There is no guarantee that this will remain so forever, however, since time zones are used as political footballs and are thus subject to very whimsical policy decisions./p> p classnote>See also the usage notes and examples in the a href#concept-datetime idtime-zones:concept-datetime>global date and time/a> section below for details on using time-zone offsets with historical times that predate the formation of formal time zones./p> p>The rules to dfn idparse-a-time-zone-offset-string>parse a time-zone offset string/dfn> are as follows. This will return either a time-zone offset, or nothing. If at any point the algorithm says that it fails, this means that it is aborted at that point and returns nothing./p> ol>li>p>Let var>input/var> be the string being parsed.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the start of the string.li>p>a href#parse-a-time-zone-offset-component idtime-zones:parse-a-time-zone-offset-component>Parse a time-zone offset component/a> to obtain var>timezonesub>hours/sub>/var> and var>timezonesub>minutes/sub>/var>. If this returns nothing, then fail./p> li>p>If var>position/var> is em>not/em> beyond the end of var>input/var>, then fail.li>p>Return the time-zone offset that is var>timezonesub>hours/sub>/var> hours and var>timezonesub>minutes/sub>/var> minutes from UTC./ol> p>The rules to dfn idparse-a-time-zone-offset-component>parse a time-zone offset component/dfn>, given an var>input/var> string and a var>position/var>, are as follows. This will return either time-zone hours and time-zone minutes, or nothing. If at any point the algorithm says that it fails, this means that it is aborted at that point and returns nothing./p> ol>li> p>If the character at var>position/var> is a U+005A LATIN CAPITAL LETTER Z character (Z), then:/p> ol>li>p>Let var>timezonesub>hours/sub>/var> be 0.li>p>Let var>timezonesub>minutes/sub>/var> be 0.li>p>Advance var>position/var> to the next character in var>input/var>./ol> p>Otherwise, if the character at var>position/var> is either a U+002B PLUS SIGN (+) or a U+002D HYPHEN-MINUS (-), then:/p> ol>li>p>If the character at var>position/var> is a U+002B PLUS SIGN (+), let var>sign/var> be positive. Otherwise, its 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 idtime-zones:collect-a-sequence-of-code-points hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idtime-zones:ascii-digits-3 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>. Let var>s/var> be the collected sequence.li> p>If var>s/var> is exactly two characters long, then:/p> ol>li>p>Interpret var>s/var> as a base-ten integer. Let that number be the var>timezonesub>hours/sub>/var>.li>p>If var>position/var> is beyond the end of var>input/var> or if the character at var>position/var> is not a U+003A COLON character, then fail. Otherwise, move var>position/var> forwards one character.li>p>a idtime-zones:collect-a-sequence-of-code-points-2 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idtime-zones:ascii-digits-4 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>. If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the var>timezonesub>minutes/sub>/var>./ol> p>If var>s/var> is exactly four characters long, then:/p> ol>li>p>Interpret the first two characters of var>s/var> as a base-ten integer. Let that number be the var>timezonesub>hours/sub>/var>.li>p>Interpret the last two characters of var>s/var> as a base-ten integer. Let that number be the var>timezonesub>minutes/sub>/var>./ol> p>Otherwise, fail./p> li>If var>timezonesub>hours/sub>/var> is not a number in the range 0 ≤ var>timezonesub>hours/sub>/var> ≤ 23, then fail.li>If var>sign/var> is negative, then negate var>timezonesub>hours/sub>/var>.li>If var>timezonesub>minutes/sub>/var> is not a number in the range 0 ≤ var>timezonesub>minutes/sub>/var> ≤ 59, then fail.li>If var>sign/var> is negative, then negate var>timezonesub>minutes/sub>/var>./ol> p>Otherwise, fail./p> li>p>Return var>timezonesub>hours/sub>/var> and var>timezonesub>minutes/sub>/var>./ol> h5 idglobal-dates-and-times>span classsecno>2.3.5.7/span> Global dates and timesa href#global-dates-and-times classself-link>/a>/h5> p>A dfn idconcept-datetime>global date and time/dfn> consists of a specific a href#proleptic-gregorian-date idglobal-dates-and-times:proleptic-gregorian-date>proleptic-Gregorian date/a>, consisting of a year, a month, and a day, and a time, consisting of an hour, a minute, a second, and a fraction of a second, expressed with a time-zone offset, consisting of a signed number of hours and minutes. a href#refsGREGORIAN>GREGORIAN/a>/p> p>A string is a dfn idvalid-global-date-and-time-string>valid global date and time string/dfn> representing a date, time, and a time-zone offset if it consists of the following components in the given order:/p> ol>li>A a href#valid-date-string idglobal-dates-and-times:valid-date-string>valid date string/a> representing the dateli>A U+0054 LATIN CAPITAL LETTER T character (T) or a U+0020 SPACE characterli>A a href#valid-time-string idglobal-dates-and-times:valid-time-string>valid time string/a> representing the timeli>A a href#valid-time-zone-offset-string idglobal-dates-and-times:valid-time-zone-offset-string>valid time-zone offset string/a> representing the time-zone offset/ol> p>Times in dates before the formation of UTC in the mid twentieth century must be expressed and interpreted in terms of UT1 (contemporary Earth solar time at the 0° longitude), not UTC (the approximation of UT1 that ticks in SI seconds). Time before the formation of time zones must be expressed and interpreted as UT1 times with explicit time zones that approximate the contemporary difference between the appropriate local time and the time observed at the location of Greenwich, London./p> div classexample> p>The following are some examples of dates written as a href#valid-global-date-and-time-string idglobal-dates-and-times:valid-global-date-and-time-string>valid global date and time strings/a>./p> dl>dt>code>0037-12-13 00:00Z/code>dd>Midnight in areas using London time on the birthday of Nero (the Roman Emperor). See below for further discussion on which date this actually corresponds to.dt>code>1979-10-14T12:00:00.001-04:00/code>dd>One millisecond after noon on October 14th 1979, in the time zone in use on the east coast of the USA during daylight saving time.dt>code>8592-01-01T02:09+02:09/code>dd>Midnight UTC on the 1st of January, 8592. The time zone associated with that time is two hours and nine minutes ahead of UTC, which is not currently a real time zone, but is nonetheless allowed./dl> p>Several things are notable about these dates:/p> ul>li>Years with fewer than four digits have to be zero-padded. The date 37-12-13 would not be a valid date.li>If the code>T/code> is replaced by a space, it must be a single space character. The string code>2001-12-21 12:00Z/code> (with two spaces between the components) would not be parsed successfully.li>To unambiguously identify a moment in time prior to the introduction of the Gregorian calendar (insofar as moments in time before the formation of UTC can be unambiguously identified), the date has to be first converted to the Gregorian calendar from the calendar in use at the time (e.g. from the Julian calendar). The date of Neros birth is the 15th of December 37, in the Julian Calendar, which is the 13th of December 37 in the a href#proleptic-gregorian-calendar idglobal-dates-and-times:proleptic-gregorian-calendar>proleptic Gregorian calendar/a>.li>The time and time-zone offset components are not optional.li>Dates before the year one cant be represented as a datetime in this version of HTML.li>Times of specific events in ancient times are, at best, approximations, since time was not well coordinated or measured until relatively recent decades.li>Time-zone offsets differ based on daylight saving time./ul> /div> p>The rules to dfn idparse-a-global-date-and-time-string>parse a global date and time string/dfn> are as follows. This will return either a time in UTC, with associated time-zone offset information for round-tripping or display purposes, or nothing. If at any point the algorithm says that it fails, this means that it is aborted at that point and returns nothing./p> ol>li>p>Let var>input/var> be the string being parsed.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the start of the string.li>p>a href#parse-a-date-component idglobal-dates-and-times:parse-a-date-component>Parse a date component/a> to obtain var>year/var>, var>month/var>, and var>day/var>. If this returns nothing, then fail./p> li>p>If var>position/var> is beyond the end of var>input/var> or if the character at var>position/var> is neither a U+0054 LATIN CAPITAL LETTER T character (T) nor a U+0020 SPACE character, then fail. Otherwise, move var>position/var> forwards one character.li>p>a href#parse-a-time-component idglobal-dates-and-times:parse-a-time-component>Parse a time component/a> to obtain var>hour/var>, var>minute/var>, and var>second/var>. If this returns nothing, then fail./p> li>p>If var>position/var> is beyond the end of var>input/var>, then fail.li>p>a href#parse-a-time-zone-offset-component idglobal-dates-and-times:parse-a-time-zone-offset-component>Parse a time-zone offset component/a> to obtain var>timezonesub>hours/sub>/var> and var>timezonesub>minutes/sub>/var>. If this returns nothing, then fail./p> li>p>If var>position/var> is em>not/em> beyond the end of var>input/var>, then fail.li>p>Let var>time/var> be the moment in time at year var>year/var>, month var>month/var>, day var>day/var>, hours var>hour/var>, minute var>minute/var>, second var>second/var>, subtracting var>timezonesub>hours/sub>/var> hours and var>timezonesub>minutes/sub>/var> minutes. That moment in time is a moment in the UTC time zone.li>p>Let var>timezone/var> be var>timezonesub>hours/sub>/var> hours and var>timezonesub>minutes/sub>/var> minutes from UTC.li>p>Return var>time/var> and var>timezone/var>./ol> h5 idweeks>span classsecno>2.3.5.8/span> Weeksa href#weeks classself-link>/a>/h5> p>A dfn idconcept-week>week/dfn> consists of a week-year number and a week number representing a seven-day period starting on a Monday. Each week-year in this calendaring system has either 52 or 53 such seven-day periods, as defined below. The seven-day period starting on the Gregorian date Monday December 29th 1969 (1969-12-29) is defined as week number 1 in week-year 1970. Consecutive weeks are numbered sequentially. The week before the number 1 week in a week-year is the last week in the previous week-year, and vice versa. a href#refsGREGORIAN>GREGORIAN/a>/p> p>A week-year with a number var>year/var> has 53 weeks if it corresponds to either a year var>year/var> in the a href#proleptic-gregorian-calendar idweeks:proleptic-gregorian-calendar>proleptic Gregorian calendar/a> that has a Thursday as its first day (January 1st), or a year var>year/var> in the a href#proleptic-gregorian-calendar idweeks:proleptic-gregorian-calendar-2>proleptic Gregorian calendar/a> that has a Wednesday as its first day (January 1st) and where var>year/var> is a number divisible by 400, or a number divisible by 4 but not by 100. All other week-years have 52 weeks./p> p>The dfn idweek-number-of-the-last-day>week number of the last day/dfn> of a week-year with 53 weeks is 53; the week number of the last day of a week-year with 52 weeks is 52./p> p classnote>The week-year number of a particular day can be different than the number of the year that contains that day in the a href#proleptic-gregorian-calendar idweeks:proleptic-gregorian-calendar-3>proleptic Gregorian calendar/a>. The first week in a week-year var>y/var> is the week that contains the first Thursday of the Gregorian year var>y/var>./p> p classnote>For modern purposes, a a href#concept-week idweeks:concept-week>week/a> as defined here is equivalent to ISO weeks as defined in ISO 8601. a href#refsISO8601>ISO8601/a>/p> p>A string is a dfn idvalid-week-string>valid week string/dfn> representing a week-year var>year/var> and week var>week/var> if it consists of the following components in the given order:/p> ol>li>Four or more a idweeks:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, representing var>year/var>, where var>year/var> > 0li>A U+002D HYPHEN-MINUS character (-)li>A U+0057 LATIN CAPITAL LETTER W character (W)li>Two a idweeks:ascii-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, representing the week var>week/var>, in the range 1 ≤ var>week/var> ≤ var>maxweek/var>, where var>maxweek/var> is the a href#week-number-of-the-last-day idweeks:week-number-of-the-last-day>week number of the last day/a> of week-year var>year/var>/ol> p>The rules to dfn idparse-a-week-string>parse a week string/dfn> are as follows. This will return either a week-year number and week number, or nothing. If at any point the algorithm says that it fails, this means that it is aborted at that point and returns nothing./p> ol>li>p>Let var>input/var> be the string being parsed.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the start of the string.li>p>a idweeks:collect-a-sequence-of-code-points hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idweeks:ascii-digits-3 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>. If the collected sequence is not at least four characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the var>year/var>.li>p>If var>year/var> is not a number greater than zero, then fail.li>p>If var>position/var> is beyond the end of var>input/var> or if the character at var>position/var> is not a U+002D HYPHEN-MINUS character, then fail. Otherwise, move var>position/var> forwards one character.li>p>If var>position/var> is beyond the end of var>input/var> or if the character at var>position/var> is not a U+0057 LATIN CAPITAL LETTER W character (W), then fail. Otherwise, move var>position/var> forwards one character.li>p>a idweeks:collect-a-sequence-of-code-points-2 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idweeks:ascii-digits-4 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>. If the collected sequence is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that number be the var>week/var>.li>p>Let var>maxweek/var> be the a href#week-number-of-the-last-day idweeks:week-number-of-the-last-day-2>week number of the last day/a> of year var>year/var>.li>p>If var>week/var> is not a number in the range 1 ≤ var>week/var> ≤ var>maxweek/var>, then fail.li>p>If var>position/var> is em>not/em> beyond the end of var>input/var>, then fail.li>p>Return the week-year number var>year/var> and the week number var>week/var>./ol> h5 iddurations>span classsecno>2.3.5.9/span> Durationsa href#durations classself-link>/a>/h5> p>A dfn idconcept-duration>duration/dfn> consists of a number of seconds./p> p classnote>Since months and seconds are not comparable (a month is not a precise number of seconds, but is instead a period whose exact length depends on the precise day from which it is measured) a a href#concept-duration iddurations:concept-duration>duration/a> as defined in this specification cannot include months (or years, which are equivalent to twelve months). Only durations that describe a specific number of seconds can be described./p> p>A string is a dfn idvalid-duration-string>valid duration string/dfn> representing a a href#concept-duration iddurations:concept-duration-2>duration/a> var>t/var> if it consists of either of the following:/p> ul>li> p>A literal U+0050 LATIN CAPITAL LETTER P character followed by one or more of the following subcomponents, in the order given, where the number of days, hours, minutes, and seconds corresponds to the same number of seconds as in var>t/var>:/p> ol>li>p>One or more a iddurations:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> followed by a U+0044 LATIN CAPITAL LETTER D character, representing a number of days.li> p>A U+0054 LATIN CAPITAL LETTER T character followed by one or more of the following subcomponents, in the order given:/p> ol>li>p>One or more a iddurations:ascii-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> followed by a U+0048 LATIN CAPITAL LETTER H character, representing a number of hours.li>p>One or more a iddurations:ascii-digits-3 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> followed by a U+004D LATIN CAPITAL LETTER M character, representing a number of minutes.li> p>The following components:/p> ol>li>p>One or more a iddurations:ascii-digits-4 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, representing a number of seconds.li>p>Optionally, a U+002E FULL STOP character (.) followed by one, two, or three a iddurations:ascii-digits-5 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, representing a fraction of a second.li>p>A U+0053 LATIN CAPITAL LETTER S character./ol> /ol> /ol> p classnote>This, as with a number of other date- and time-related microsyntaxes defined in this specification, is based on one of the formats defined in ISO 8601. a href#refsISO8601>ISO8601/a>/p> li> p>One or more a href#duration-time-component iddurations:duration-time-component>duration time components/a>, each with a different a href#duration-time-component-scale iddurations:duration-time-component-scale>duration time component scale/a>, in any order; the sum of the represented seconds being equal to the number of seconds in var>t/var>./p> p>A dfn idduration-time-component>duration time component/dfn> is a string consisting of the following components:/p> ol>li>p>Zero or more a iddurations:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>.li>p>One or more a iddurations:ascii-digits-6 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, representing a number of time units, scaled by the a href#duration-time-component-scale iddurations:duration-time-component-scale-2>duration time component scale/a> specified (see below) to represent a number of seconds.li>p>If the a href#duration-time-component-scale iddurations:duration-time-component-scale-3>duration time component scale/a> specified is 1 (i.e. the units are seconds), then, optionally, a U+002E FULL STOP character (.) followed by one, two, or three a iddurations:ascii-digits-7 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, representing a fraction of a second.li>p>Zero or more a iddurations:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>.li> p>One of the following characters, representing the dfn idduration-time-component-scale>duration time component scale/dfn> of the time unit used in the numeric part of the a href#duration-time-component iddurations:duration-time-component-2>duration time component/a>:/p> dl>dt>U+0057 LATIN CAPITAL LETTER W characterdt>U+0077 LATIN SMALL LETTER W characterdd>Weeks. The scale is 604800.dt>U+0044 LATIN CAPITAL LETTER D characterdt>U+0064 LATIN SMALL LETTER D characterdd>Days. The scale is 86400.dt>U+0048 LATIN CAPITAL LETTER H characterdt>U+0068 LATIN SMALL LETTER H characterdd>Hours. The scale is 3600.dt>U+004D LATIN CAPITAL LETTER M characterdt>U+006D LATIN SMALL LETTER M characterdd>Minutes. The scale is 60.dt>U+0053 LATIN CAPITAL LETTER S characterdt>U+0073 LATIN SMALL LETTER S characterdd>Seconds. The scale is 1./dl> li>p>Zero or more a iddurations:space-characters-3 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>./ol> p classnote>This is not based on any of the formats in ISO 8601. It is intended to be a more human-readable alternative to the ISO 8601 duration format./p> /ul> p>The rules to dfn idparse-a-duration-string>parse a duration string/dfn> are as follows. This will return either a a href#concept-duration iddurations:concept-duration-3>duration/a> or nothing. If at any point the algorithm says that it fails, this means that it is aborted at that point and returns nothing./p> ol>li>p>Let var>input/var> be the string being parsed.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the start of the string.li>p>Let var>months/var>, var>seconds/var>, and var>component count/var> all be zero.li> p>Let var>M-disambiguator/var> be i>minutes/i>./p> p classnote>This flags other value is i>months/i>. It is used to disambiguate the M unit in ISO8601 durations, which use the same unit for months and minutes. Months are not allowed, but are parsed for future compatibility and to avoid misinterpreting ISO8601 durations that would be valid in other contexts./p> li>p>a iddurations:skip-ascii-whitespace hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace data-x-internalskip-ascii-whitespace>Skip ASCII whitespace/a> within var>input/var> given var>position/var>.li>p>If var>position/var> is past the end of var>input/var>, then fail.li>p>If the character in var>input/var> pointed to by var>position/var> is a U+0050 LATIN CAPITAL LETTER P character, then advance var>position/var> to the next character, set var>M-disambiguator/var> to i>months/i>, and a iddurations:skip-ascii-whitespace-2 hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace data-x-internalskip-ascii-whitespace>skip ASCII whitespace/a> within var>input/var> given var>position/var>.li> p>While true:/p> ol>li>p>Let var>units/var> be undefined. It will be assigned one of the following values: i>years/i>, i>months/i>, i>weeks/i>, i>days/i>, i>hours/i>, i>minutes/i>, and i>seconds/i>.li>p>Let var>next character/var> be undefined. It is used to process characters from the var>input/var>.li>p>If var>position/var> is past the end of var>input/var>, then break.li>p>If the character in var>input/var> pointed to by var>position/var> is a U+0054 LATIN CAPITAL LETTER T character, then advance var>position/var> to the next character, set var>M-disambiguator/var> to i>minutes/i>, a iddurations:skip-ascii-whitespace-3 hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace data-x-internalskip-ascii-whitespace>skip ASCII whitespace/a> within var>input/var> given var>position/var>, and continue.li>p>Set var>next character/var> to the character in var>input/var> pointed to by var>position/var>.li> p>If var>next character/var> is a U+002E FULL STOP character (.), then let var>N/var> equal zero. (Do not advance var>position/var>. That is taken care of below.)/p> p>Otherwise, if var>next character/var> is an a hrefhttps://infra.spec.whatwg.org/#ascii-digit iddurations:ascii-digits-8 data-x-internalascii-digits>ASCII digit/a>, then a iddurations:collect-a-sequence-of-code-points hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>collect a sequence of code points/a> that are a iddurations:ascii-digits-9 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>, interpret the resulting sequence as a base-ten integer, and let var>N/var> be that number./p> p>Otherwise var>next character/var> is not part of a number; fail./p> li>p>If var>position/var> is past the end of var>input/var>, then fail.li>p>Set var>next character/var> to the character in var>input/var> pointed to by var>position/var>, and this time advance var>position/var> to the next character. (If var>next character/var> was a U+002E FULL STOP character (.) before, it will still be that character this time.)li> p>If var>next character/var> is U+002E (.), then:/p> ol>li>p>a iddurations:collect-a-sequence-of-code-points-2 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a iddurations:ascii-digits-10 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>. Let var>s/var> be the resulting sequence.li>p>If var>s/var> is the empty string, then fail.li>p>Let var>length/var> be the number of characters in var>s/var>.li>p>Let var>fraction/var> be the result of interpreting var>s/var> as a base-ten integer, and then dividing that number by span>10sup>var>length/var>/sup>/span>.li>p>Increment var>N/var> by var>fraction/var>.li>p>a iddurations:skip-ascii-whitespace-4 hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace data-x-internalskip-ascii-whitespace>Skip ASCII whitespace/a> within var>input/var> given var>position/var>.li>p>If var>position/var> is past the end of var>input/var>, then fail.li>p>Set var>next character/var> to the character in var>input/var> pointed to by var>position/var>, and advance var>position/var> to the next character.li>p>If var>next character/var> is neither a U+0053 LATIN CAPITAL LETTER S character nor a U+0073 LATIN SMALL LETTER S character, then fail.li>p>Set var>units/var> to i>seconds/i>./ol> p>Otherwise:/p> ol>li>p>If var>next character/var> is a iddurations:space-characters-4 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, then a iddurations:skip-ascii-whitespace-5 hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace data-x-internalskip-ascii-whitespace>skip ASCII whitespace/a> within var>input/var> given var>position/var>, set var>next character/var> to the character in var>input/var> pointed to by var>position/var>, and advance var>position/var> to the next character.li> p>If var>next character/var> is a U+0059 LATIN CAPITAL LETTER Y character, or a U+0079 LATIN SMALL LETTER Y character, set var>units/var> to i>years/i> and set var>M-disambiguator/var> to i>months/i>./p> p>If var>next character/var> is a U+004D LATIN CAPITAL LETTER M character or a U+006D LATIN SMALL LETTER M character, and var>M-disambiguator/var> is i>months/i>, then set var>units/var> to i>months/i>./p> p>If var>next character/var> is a U+0057 LATIN CAPITAL LETTER W character or a U+0077 LATIN SMALL LETTER W character, set var>units/var> to i>weeks/i> and set var>M-disambiguator/var> to i>minutes/i>./p> p>If var>next character/var> is a U+0044 LATIN CAPITAL LETTER D character or a U+0064 LATIN SMALL LETTER D character, set var>units/var> to i>days/i> and set var>M-disambiguator/var> to i>minutes/i>./p> p>If var>next character/var> is a U+0048 LATIN CAPITAL LETTER H character or a U+0068 LATIN SMALL LETTER H character, set var>units/var> to i>hours/i> and set var>M-disambiguator/var> to i>minutes/i>./p> p>If var>next character/var> is a U+004D LATIN CAPITAL LETTER M character or a U+006D LATIN SMALL LETTER M character, and var>M-disambiguator/var> is i>minutes/i>, then set var>units/var> to i>minutes/i>./p> p>If var>next character/var> is a U+0053 LATIN CAPITAL LETTER S character or a U+0073 LATIN SMALL LETTER S character, set var>units/var> to i>seconds/i> and set var>M-disambiguator/var> to i>minutes/i>./p> p>Otherwise if var>next character/var> is none of the above characters, then fail./p> /ol> li>p>Increment var>component count/var>.li>p>Let var>multiplier/var> be 1.li>p>If var>units/var> is i>years/i>, multiply var>multiplier/var> by 12 and set var>units/var> to i>months/i>.li> p>If var>units/var> is i>months/i>, add the product of var>N/var> and var>multiplier/var> to var>months/var>./p> p>Otherwise:/p> ol>li>p>If var>units/var> is i>weeks/i>, multiply var>multiplier/var> by 7 and set var>units/var> to i>days/i>.li>p>If var>units/var> is i>days/i>, multiply var>multiplier/var> by 24 and set var>units/var> to i>hours/i>.li>p>If var>units/var> is i>hours/i>, multiply var>multiplier/var> by 60 and set var>units/var> to i>minutes/i>.li>p>If var>units/var> is i>minutes/i>, multiply var>multiplier/var> by 60 and set var>units/var> to i>seconds/i>.li>p>Forcibly, var>units/var> is now i>seconds/i>. Add the product of var>N/var> and var>multiplier/var> to var>seconds/var>./ol> li>p>a iddurations:skip-ascii-whitespace-6 hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace data-x-internalskip-ascii-whitespace>Skip ASCII whitespace/a> within var>input/var> given var>position/var>./ol> li>p>If var>component count/var> is zero, fail.li>p>If var>months/var> is not zero, fail.li>p>Return the a href#concept-duration iddurations:concept-duration-4>duration/a> consisting of var>seconds/var> seconds./ol> h5 idvaguer-moments-in-time>span classsecno>2.3.5.10/span> Vaguer moments in timea href#vaguer-moments-in-time classself-link>/a>/h5> p>A string is a dfn idvalid-date-string-with-optional-time>valid date string with optional time/dfn> if it is also one of the following:/p> ul>li>A a href#valid-date-string idvaguer-moments-in-time:valid-date-string>valid date string/a>li>A a href#valid-global-date-and-time-string idvaguer-moments-in-time:valid-global-date-and-time-string>valid global date and time string/a>/ul> hr> p>The rules to dfn idparse-a-date-or-time-string>parse a date or time string/dfn> are as follows. The algorithm will return either a a href#concept-date idvaguer-moments-in-time:concept-date>date/a>, a a href#concept-time idvaguer-moments-in-time:concept-time>time/a>, a a href#concept-datetime idvaguer-moments-in-time:concept-datetime>global date and time/a>, or nothing. If at any point the algorithm says that it fails, this means that it is aborted at that point and returns nothing./p> ol>li>p>Let var>input/var> be the string being parsed.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the start of the string.li>p>Set var>start position/var> to the same position as var>position/var>.li>p>Set the var>date present/var> and var>time present/var> flags to true.li>p>a href#parse-a-date-component idvaguer-moments-in-time:parse-a-date-component>Parse a date component/a> to obtain var>year/var>, var>month/var>, and var>day/var>. If this fails, then set the var>date present/var> flag to false./p> li> p>If var>date present/var> is true, and var>position/var> is not beyond the end of var>input/var>, and the character at var>position/var> is either a U+0054 LATIN CAPITAL LETTER T character (T) or a U+0020 SPACE character, then advance var>position/var> to the next character in var>input/var>./p> p>Otherwise, if var>date present/var> is true, and either var>position/var> is beyond the end of var>input/var> or the character at var>position/var> is neither a U+0054 LATIN CAPITAL LETTER T character (T) nor a U+0020 SPACE character, then set var>time present/var> to false./p> p>Otherwise, if var>date present/var> is false, set var>position/var> back to the same position as var>start position/var>./p> li>p>If the var>time present/var> flag is true, then a href#parse-a-time-component idvaguer-moments-in-time:parse-a-time-component>parse a time component/a> to obtain var>hour/var>, var>minute/var>, and var>second/var>. If this returns nothing, then fail.li>p>If the var>date present/var> and var>time present/var> flags are both true, but var>position/var> is beyond the end of var>input/var>, then fail.li>p>If the var>date present/var> and var>time present/var> flags are both true, a href#parse-a-time-zone-offset-component idvaguer-moments-in-time:parse-a-time-zone-offset-component>parse a time-zone offset component/a> to obtain var>timezonesub>hours/sub>/var> and var>timezonesub>minutes/sub>/var>. If this returns nothing, then fail./p> li>p>If var>position/var> is em>not/em> beyond the end of var>input/var>, then fail.li> p>If the var>date present/var> flag is true and the var>time present/var> flag is false, then let var>date/var> be the date with year var>year/var>, month var>month/var>, and day var>day/var>, and return var>date/var>./p> p>Otherwise, if the var>time present/var> flag is true and the var>date present/var> flag is false, then let var>time/var> be the time with hour var>hour/var>, minute var>minute/var>, and second var>second/var>, and return var>time/var>./p> p>Otherwise, let var>time/var> be the moment in time at year var>year/var>, month var>month/var>, day var>day/var>, hours var>hour/var>, minute var>minute/var>, second var>second/var>, subtracting var>timezonesub>hours/sub>/var> hours and var>timezonesub>minutes/sub>/var> minutes, that moment in time being a moment in the UTC time zone; let var>timezone/var> be var>timezonesub>hours/sub>/var> hours and var>timezonesub>minutes/sub>/var> minutes from UTC; and return var>time/var> and var>timezone/var>./p> /ol> h4 idcolours>span classsecno>2.3.6/span> Colorsa href#colours classself-link>/a>/h4> p>A dfn idsimple-colour>simple color/dfn> consists of three 8-bit numbers in the range 0..255, representing the red, green, and blue components of the color respectively, in the sRGB color space. a href#refsSRGB>SRGB/a>/p> p>A string is a dfn idvalid-simple-colour>valid simple color/dfn> if it is exactly seven characters long, and the first character is a U+0023 NUMBER SIGN character (#), and the remaining six characters are all a idcolours:ascii-hex-digits hrefhttps://infra.spec.whatwg.org/#ascii-hex-digit data-x-internalascii-hex-digits>ASCII hex digits/a>, with the first two digits representing the red component, the middle two digits representing the green component, and the last two digits representing the blue component, in hexadecimal./p> p>A string is a dfn idvalid-lowercase-simple-colour>valid lowercase simple color/dfn> if it is a a href#valid-simple-colour idcolours:valid-simple-colour>valid simple color/a> and doesnt use any characters in the range U+0041 LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F./p> p>The dfn idrules-for-parsing-simple-colour-values>rules for parsing simple color values/dfn> are as given in the following algorithm. When invoked, the steps must be followed in the order given, aborting at the first step that returns a value. This algorithm will return either a a href#simple-colour idcolours:simple-colour>simple color/a> or an error./p> ol>li>p>Let var>input/var> be the string being parsed.li>p>If var>input/var> is not exactly seven characters long, then return an error.li>p>If the first character in var>input/var> is not a U+0023 NUMBER SIGN character (#), then return an error.li>p>If the last six characters of var>input/var> are not all a idcolours:ascii-hex-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-hex-digit data-x-internalascii-hex-digits>ASCII hex digits/a>, then return an error.li>p>Let var>result/var> be a a href#simple-colour idcolours:simple-colour-2>simple color/a>./p> li>p>Interpret the second and third characters as a hexadecimal number and let the result be the red component of var>result/var>./p> li>p>Interpret the fourth and fifth characters as a hexadecimal number and let the result be the green component of var>result/var>./p> li>p>Interpret the sixth and seventh characters as a hexadecimal number and let the result be the blue component of var>result/var>./p> li>p>Return var>result/var>./p> /ol> p>The dfn idrules-for-serialising-simple-colour-values>rules for serializing simple color values/dfn> given a a href#simple-colour idcolours:simple-colour-3>simple color/a> are as given in the following algorithm:/p> ol>li>p>Let var>result/var> be a string consisting of a single U+0023 NUMBER SIGN character (#).li>p>Convert the red, green, and blue components in turn to two-digit hexadecimal numbers using a hrefhttps://infra.spec.whatwg.org/#ascii-lower-hex-digit idcolours:lowercase-ascii-hex-digits data-x-internallowercase-ascii-hex-digits>ASCII lower hex digits/a>, zero-padding if necessary, and append these numbers to var>result/var>, in the order red, green, blue./p> li>p>Return var>result/var>, which will be a a href#valid-lowercase-simple-colour idcolours:valid-lowercase-simple-colour>valid lowercase simple color/a>./ol> hr> p>Some obsolete legacy attributes parse colors in a more complicated manner, using the dfn idrules-for-parsing-a-legacy-colour-value>rules for parsing a legacy color value/dfn>, which are given in the following algorithm. When invoked, the steps must be followed in the order given, aborting at the first step that returns a value. This algorithm will return either a a href#simple-colour idcolours:simple-colour-4>simple color/a> or an error./p> ol>li>p>Let var>input/var> be the string being parsed.li>p>If var>input/var> is the empty string, then return an error.li>p>a idcolours:strip-leading-and-trailing-ascii-whitespace hrefhttps://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace data-x-internalstrip-leading-and-trailing-ascii-whitespace>Strip leading and trailing ASCII whitespace/a> from var>input/var>.li>p>If var>input/var> is an a idcolours:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>transparent/code>, then return an error.li> p>If var>input/var> is an a idcolours:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for one of the a hrefhttps://drafts.csswg.org/css-color/#named-color idcolours:named-color data-x-internalnamed-color>named colors/a>, then return the a href#simple-colour idcolours:simple-colour-5>simple color/a> corresponding to that keyword. a href#refsCSSCOLOR>CSSCOLOR/a>/p> p classnote>a hrefhttps://www.w3.org/TR/css3-color/#css2-system>CSS2 System Colors/a> are not recognized./p> li> p>If var>input/var> is four characters long, and the first character in var>input/var> is U+0023 (#), and the last three characters of var>input/var> are all a idcolours:ascii-hex-digits-3 hrefhttps://infra.spec.whatwg.org/#ascii-hex-digit data-x-internalascii-hex-digits>ASCII hex digits/a>, then:/p> ol>li>p>Let var>result/var> be a a href#simple-colour idcolours:simple-colour-6>simple color/a>./p> li>p>Interpret the second character of var>input/var> as a hexadecimal digit; let the red component of var>result/var> be the resulting number multiplied by 17./p> li>p>Interpret the third character of var>input/var> as a hexadecimal digit; let the green component of var>result/var> be the resulting number multiplied by 17./p> li>p>Interpret the fourth character of var>input/var> as a hexadecimal digit; let the blue component of var>result/var> be the resulting number multiplied by 17./p> li>p>Return var>result/var>./p> /ol> li>p>Replace any characters in var>input/var> that have a code point greater than U+FFFF (i.e., any characters that are not in the basic multilingual plane) with the two-character string code>00/code>.li>p>If var>input/var> is longer than 128 characters, truncate var>input/var>, leaving only the first 128 characters.li>p>If the first character in var>input/var> is a U+0023 NUMBER SIGN character (#), remove it.li>p>Replace any character in var>input/var> that is not an a hrefhttps://infra.spec.whatwg.org/#ascii-hex-digit idcolours:ascii-hex-digits-4 data-x-internalascii-hex-digits>ASCII hex digit/a> with the character U+0030 DIGIT ZERO (0).li>p>While var>input/var>s length is zero or not a multiple of three, append a U+0030 DIGIT ZERO (0) character to var>input/var>.li>p>Split var>input/var> into three strings of equal length, to obtain three components. Let var>length/var> be the length of those components (one third the length of var>input/var>).li>p>If var>length/var> is greater than 8, then remove the leading span>var>length/var>-8/span> characters in each component, and let var>length/var> be 8.li>p>While var>length/var> is greater than two and the first character in each component is a U+0030 DIGIT ZERO (0) character, remove that character and reduce var>length/var> by one.li>p>If var>length/var> is em>still/em> greater than two, truncate each component, leaving only the first two characters in each.li>p>Let var>result/var> be a a href#simple-colour idcolours:simple-colour-7>simple color/a>./p> li>p>Interpret the first component as a hexadecimal number; let the red component of var>result/var> be the resulting number.li>p>Interpret the second component as a hexadecimal number; let the green component of var>result/var> be the resulting number.li>p>Interpret the third component as a hexadecimal number; let the blue component of var>result/var> be the resulting number.li>p>Return var>result/var>./p> /ol> hr> p classnote>The a href#canvas-context-2d idcolours:canvas-context-2d>2D graphics context/a> has a separate color syntax that also handles opacity./p> h4 idspace-separated-tokens>span classsecno>2.3.7/span> Space-separated tokensa href#space-separated-tokens classself-link>/a>/h4> p>A dfn idset-of-space-separated-tokens>set of space-separated tokens/dfn> is a string containing zero or more words (known as tokens) separated by one or more a idspace-separated-tokens:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, where words consist of any string of one or more characters, none of which are a idspace-separated-tokens:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>./p> p>A string containing a a href#set-of-space-separated-tokens idspace-separated-tokens:set-of-space-separated-tokens>set of space-separated tokens/a> may have leading or trailing a idspace-separated-tokens:space-characters-3 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>./p> p>An dfn idunordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens/dfn> is a a href#set-of-space-separated-tokens idspace-separated-tokens:set-of-space-separated-tokens-2>set of space-separated tokens/a> where none of the tokens are duplicated./p> p>An dfn idordered-set-of-unique-space-separated-tokens>ordered set of unique space-separated tokens/dfn> is a a href#set-of-space-separated-tokens idspace-separated-tokens:set-of-space-separated-tokens-3>set of space-separated tokens/a> where none of the tokens are duplicated but where the order of the tokens is meaningful./p> p>a href#set-of-space-separated-tokens idspace-separated-tokens:set-of-space-separated-tokens-4>Sets of space-separated tokens/a> sometimes have a defined set of allowed values. When a set of allowed values is defined, the tokens must all be from that list of allowed values; other values are non-conforming. If no such set of allowed values is provided, then all values are conforming./p> p classnote>How tokens in a a href#set-of-space-separated-tokens idspace-separated-tokens:set-of-space-separated-tokens-5>set of space-separated tokens/a> are to be compared (e.g. case-sensitively or not) is defined on a per-set basis./p> h4 idcomma-separated-tokens>span classsecno>2.3.8/span> Comma-separated tokensa href#comma-separated-tokens classself-link>/a>/h4> p>A dfn idset-of-comma-separated-tokens>set of comma-separated tokens/dfn> is a string containing zero or more tokens each separated from the next by a single U+002C COMMA character (,), where tokens consist of any string of zero or more characters, neither beginning nor ending with a idcomma-separated-tokens:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, nor containing any U+002C COMMA characters (,), and optionally surrounded by a idcomma-separated-tokens:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>./p> p classexample>For instance, the string code> a ,b,,d d /code> consists of four tokens: a, b, the empty string, and d d. Leading and trailing whitespace around each token doesnt count as part of the token, and the empty string can be a token./p> p>a href#set-of-comma-separated-tokens idcomma-separated-tokens:set-of-comma-separated-tokens>Sets of comma-separated tokens/a> sometimes have further restrictions on what consists a valid token. When such restrictions are defined, the tokens must all fit within those restrictions; other values are non-conforming. If no such restrictions are specified, then all values are conforming./p> h4 idsyntax-references>span classsecno>2.3.9/span> Referencesa href#syntax-references classself-link>/a>/h4> p>A dfn idvalid-hash-name-reference>valid hash-name reference/dfn> to an element of type var>type/var> is a string consisting of a U+0023 NUMBER SIGN character (#) followed by a string which exactly matches the value of the code>name/code> attribute of an element with type var>type/var> in the same a idsyntax-references:tree hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a>./p> p>The dfn idrules-for-parsing-a-hash-name-reference>rules for parsing a hash-name reference/dfn> to an element of type var>type/var>, given a context node var>scope/var>, are as follows:/p> ol>li>p>If the string being parsed does not contain a U+0023 NUMBER SIGN character, or if the first such character in the string is the last character in the string, then return null and abort these steps.li>p>Let var>s/var> be the string from the character immediately after the first U+0023 NUMBER SIGN character in the string being parsed up to the end of that string.li> p>Return the first element of type var>type/var> in var>scope/var>s a idsyntax-references:tree-2 hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a>, in a idsyntax-references:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>, that has an code idsyntax-references:the-id-attribute>a href#the-id-attribute>id/a>/code> or code>name/code> attribute whose value is var>s/var>, or null if there is no such element./p> p classnote>Although code idsyntax-references:the-id-attribute-2>a href#the-id-attribute>id/a>/code> attributes are accounted for when parsing, they are not used in determining whether a value is a a href#valid-hash-name-reference idsyntax-references:valid-hash-name-reference>em>valid/em> hash-name reference/a>. That is, a hash-name reference that refers to an element based on code idsyntax-references:the-id-attribute-3>a href#the-id-attribute>id/a>/code> is a conformance error (unless that element also has a code>name/code> attribute with the same value)./p> /ol> h4 idmq>span classsecno>2.3.10/span> Media queriesa href#mq classself-link>/a>/h4> p>A string is a dfn idvalid-media-query-list>valid media query list/dfn> if it matches the code><media-query-list>/code> production of the Media Queries specification. a href#refsMQ>MQ/a>/p> p>A string dfn idmatches-the-environment>matches the environment/dfn> of the user if it is the empty string, a string consisting of only a idmq:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, or is a media query list that matches the users environment according to the definitions given in the Media Queries specification. a href#refsMQ>MQ/a>/p> h3 idurls>span classsecno>2.4/span> URLsa href#urls classself-link>/a>/h3> h4 idterminology-2>span classsecno>2.4.1/span> Terminologya href#terminology-2 classself-link>/a>/h4> p>A string is a dfn idvalid-non-empty-url>valid non-empty URL/dfn> if it is a a idterminology-2:valid-url-string hrefhttps://url.spec.whatwg.org/#valid-url-string data-x-internalvalid-url-string>valid URL string/a> but it is not the empty string./p> p>A string is a dfn idvalid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by spaces/dfn> if, after a hrefhttps://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace idterminology-2:strip-leading-and-trailing-ascii-whitespace data-x-internalstrip-leading-and-trailing-ascii-whitespace>stripping leading and trailing ASCII whitespace/a> from it, it is a a idterminology-2:valid-url-string-2 hrefhttps://url.spec.whatwg.org/#valid-url-string data-x-internalvalid-url-string>valid URL string/a>./p> p>A string is a dfn idvalid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces/dfn> if, after a hrefhttps://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace idterminology-2:strip-leading-and-trailing-ascii-whitespace-2 data-x-internalstrip-leading-and-trailing-ascii-whitespace>stripping leading and trailing ASCII whitespace/a> from it, it is a a href#valid-non-empty-url idterminology-2:valid-non-empty-url>valid non-empty URL/a>./p> p>This specification defines the URL dfn idabout:legacy-compat>code>about:legacy-compat/code>/dfn> as a reserved, though unresolvable, code idterminology-2:about-protocol>a data-x-internalabout-protocol hrefhttps://tools.ietf.org/html/rfc6694#section-2>about:/a>/code> URL, for use in a href#syntax-doctype idterminology-2:syntax-doctype>DOCTYPE/a>s in a idterminology-2:html-documents hrefhttps://dom.spec.whatwg.org/#html-document data-x-internalhtml-documents>HTML documents/a> when needed for compatibility with XML tools. a href#refsABOUT>ABOUT/a>/p> p>This specification defines the URL dfn idabout:html-kind>code>about:html-kind/code>/dfn> as a reserved, though unresolvable, code idterminology-2:about-protocol-2>a data-x-internalabout-protocol hrefhttps://tools.ietf.org/html/rfc6694#section-2>about:/a>/code> URL, that is used as an identifier for kinds of media tracks. a href#refsABOUT>ABOUT/a>/p> p>This specification defines the URL dfn idabout:srcdoc>code>about:srcdoc/code>/dfn> as a reserved, though unresolvable, code idterminology-2:about-protocol-3>a data-x-internalabout-protocol hrefhttps://tools.ietf.org/html/rfc6694#section-2>about:/a>/code> URL, that is used as the a hrefhttps://dom.spec.whatwg.org/#concept-document-url idterminology-2:the-documents-address data-x-internalthe-documents-address>URL/a> of a href#an-iframe-srcdoc-document idterminology-2:an-iframe-srcdoc-document>code>iframe/code> code>srcdoc/code> documents/a>. a href#refsABOUT>ABOUT/a>/p> p>The dfn idfallback-base-url>fallback base URL/dfn> of a code idterminology-2:document>a href#document>Document/a>/code> object var>document/var> is the a idterminology-2:url-record hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a> obtained by running these steps:/p> ol>li>p>If var>document/var> is a href#an-iframe-srcdoc-document idterminology-2:an-iframe-srcdoc-document-2>an code>iframe/code> code>srcdoc/code> document/a>, then return the a href#document-base-url idterminology-2:document-base-url>document base URL/a> of var>document/var>s a href#concept-document-bc idterminology-2:concept-document-bc>browsing context/a>s a href#browsing-context-container idterminology-2:browsing-context-container>browsing context container/a>s a idterminology-2:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>.li> p>If var>document/var>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url idterminology-2:the-documents-address-2 data-x-internalthe-documents-address>URL/a> is code idterminology-2:about:blank>a href#about:blank>about:blank/a>/code>, and var>document/var>s a href#concept-document-bc idterminology-2:concept-document-bc-2>browsing context/a> has a a href#creator-browsing-context idterminology-2:creator-browsing-context>creator browsing context/a>, then return the a href#creator-base-url idterminology-2:creator-base-url>creator base URL/a>./p> li>p>Return var>document/var>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url idterminology-2:the-documents-address-3 data-x-internalthe-documents-address>URL/a>./ol> p>The dfn iddocument-base-url data-export>document base URL/dfn> of a code idterminology-2:document-2>a href#document>Document/a>/code> object is the a idterminology-2:absolute-url hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a> obtained by running these steps:/p> ol>li>p>If there is no code idterminology-2:the-base-element>a href#the-base-element>base/a>/code> element that has an code idterminology-2:attr-base-href>a href#attr-base-href>href/a>/code> attribute in the code idterminology-2:document-3>a href#document>Document/a>/code>, then the a href#document-base-url idterminology-2:document-base-url-2>document base URL/a> is the code idterminology-2:document-4>a href#document>Document/a>/code>s a href#fallback-base-url idterminology-2:fallback-base-url>fallback base URL/a>; abort these steps.li>p>Otherwise, the a href#document-base-url idterminology-2:document-base-url-3>document base URL/a> is the a href#frozen-base-url idterminology-2:frozen-base-url>frozen base URL/a> of the first code idterminology-2:the-base-element-2>a href#the-base-element>base/a>/code> element in the code idterminology-2:document-5>a href#document>Document/a>/code> that has an code idterminology-2:attr-base-href-2>a href#attr-base-href>href/a>/code> attribute, in a idterminology-2:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>./ol> h4 idresolving-urls>span classsecno>2.4.2/span> Parsing URLsa href#resolving-urls classself-link>/a>/h4> p>Parsing a URL is the process of taking a string and obtaining the a idresolving-urls:url-record hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a> that it represents. While this process is defined in the WHATWG URL standard, the HTML standard defines a wrapper for convenience. a href#refsURL>URL/a>/p> p classnote>This wrapper is only useful when the character encoding for the URL parser has to match that of the document or environment settings object for legacy reasons. When that is not the case the a idresolving-urls:url-parser hrefhttps://url.spec.whatwg.org/#concept-url-parser data-x-internalurl-parser>URL parser/a> can be used directly./p> p idresolve-a-url>To dfn idparse-a-url>parse a URL/dfn> var>url/var>, relative to either a var>document/var> or var>environment settings object/var>, the user agent must use the following steps. Parsing a URL either results in failure or a a href#resulting-url-string idresolving-urls:resulting-url-string>resulting URL string/a> and a href#resulting-url-record idresolving-urls:resulting-url-record>resulting URL record/a>./p> ol>li>p>Let var>encoding/var> be var>document/var>s a hrefhttps://dom.spec.whatwg.org/#concept-document-encoding idresolving-urls:documents-character-encoding data-x-internaldocuments-character-encoding>character encoding/a>, if var>document/var> was given, and var>environment settings object/var>s a href#api-url-character-encoding idresolving-urls:api-url-character-encoding>API URL character encoding/a> otherwise.li>p>Let var>baseURL/var> be var>document/var>s a href#document-base-url idresolving-urls:document-base-url>base URL/a>, if var>document/var> was given, and var>environment settings object/var>s a href#api-base-url idresolving-urls:api-base-url>API base URL/a> otherwise.li>p>Let var>urlRecord/var> be the result of applying the a idresolving-urls:url-parser-2 hrefhttps://url.spec.whatwg.org/#concept-url-parser data-x-internalurl-parser>URL parser/a> to var>url/var>, with var>baseURL/var> and var>encoding/var>.li>p>If var>urlRecord/var> is failure, then abort these steps with an error.li>p>Let var>urlString/var> be the result of applying the a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idresolving-urls:concept-url-serializer data-x-internalconcept-url-serializer>URL serializer/a> to var>urlRecord/var>.li>p>Return var>urlString/var> as the dfn idresulting-url-string>resulting URL string/dfn> and var>urlRecord/var> as the dfn idresulting-url-record>resulting URL record/dfn>./ol> h4 iddynamic-changes-to-base-urls>span classsecno>2.4.3/span> Dynamic changes to base URLsa href#dynamic-changes-to-base-urls classself-link>/a>/h4> p>When a documents a href#document-base-url iddynamic-changes-to-base-urls:document-base-url>document base URL/a> changes, all elements in that document are a href#affected-by-a-base-url-change iddynamic-changes-to-base-urls:affected-by-a-base-url-change>affected by a base URL change/a>./p> p>The following are a href#base-url-change-steps iddynamic-changes-to-base-urls:base-url-change-steps>base URL change steps/a>, which run when an element is a href#affected-by-a-base-url-change iddynamic-changes-to-base-urls:affected-by-a-base-url-change-2>affected by a base URL change/a> (as defined by the DOM specification):/p> dl classswitch>dt>If the element creates a a href#hyperlink iddynamic-changes-to-base-urls:hyperlink>hyperlink/a>dd> p>If the a iddynamic-changes-to-base-urls:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> identified by the hyperlink is being shown to the user, or if any data derived from that a iddynamic-changes-to-base-urls:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> is affecting the display, then the code iddynamic-changes-to-base-urls:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute should be a href#parse-a-url iddynamic-changes-to-base-urls:parse-a-url>reparsed/a> relative to the elements a iddynamic-changes-to-base-urls:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> and the UI updated appropriately./p> p classexample>For example, the CSS code iddynamic-changes-to-base-urls:selector-link>a href#selector-link>:link/a>/code>/code iddynamic-changes-to-base-urls:selector-visited>a href#selector-visited>:visited/a>/code> a hrefhttps://drafts.csswg.org/selectors/#pseudo-class iddynamic-changes-to-base-urls:pseudo-class data-x-internalpseudo-class>pseudo-classes/a> might have been affected./p> p>If the hyperlink has a code iddynamic-changes-to-base-urls:ping>a href#ping>ping/a>/code> attribute and its a hrefhttps://url.spec.whatwg.org/#concept-url iddynamic-changes-to-base-urls:url-3 data-x-internalurl>URL(s)/a> are being shown to the user, then the code iddynamic-changes-to-base-urls:ping-2>a href#ping>ping/a>/code> attributes tokens should be a href#parse-a-url iddynamic-changes-to-base-urls:parse-a-url-2>reparsed/a> relative to the elements a iddynamic-changes-to-base-urls:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> and the UI updated appropriately./p> dt>If the element is a code iddynamic-changes-to-base-urls:the-q-element>a href#the-q-element>q/a>/code>, code iddynamic-changes-to-base-urls:the-blockquote-element>a href#the-blockquote-element>blockquote/a>/code>, code iddynamic-changes-to-base-urls:the-ins-element>a href#the-ins-element>ins/a>/code>, or code iddynamic-changes-to-base-urls:the-del-element>a href#the-del-element>del/a>/code> element with a code>cite/code> attributedd> p>If the a iddynamic-changes-to-base-urls:url-4 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> identified by the code>cite/code> attribute is being shown to the user, or if any data derived from that a iddynamic-changes-to-base-urls:url-5 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> is affecting the display, then the a iddynamic-changes-to-base-urls:url-6 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> should be a href#parse-a-url iddynamic-changes-to-base-urls:parse-a-url-3>reparsed/a> relative to the elements a iddynamic-changes-to-base-urls:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> and the UI updated appropriately./p> dt>Otherwisedd> p>The element is not directly affected./p> p classexample>For instance, changing the base URL doesnt affect the image displayed by code iddynamic-changes-to-base-urls:the-img-element>a href#the-img-element>img/a>/code> elements, although subsequent accesses of the code iddynamic-changes-to-base-urls:dom-img-src>a href#dom-img-src>src/a>/code> IDL attribute from script will return a new a iddynamic-changes-to-base-urls:absolute-url hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a> that might no longer correspond to the image being shown./p> /dl> h3 idfetching-resources>span classsecno>2.5/span> Fetching resourcesa href#fetching-resources classself-link>/a>/h3>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id11235 titleMechanism to disable sending of cookies with requests for style sheets, background images, fonts, WebSockets, server-sent events, video src>, source>, track>, iframe>, img>, etc>11235/a>/div> h4 idterminology-3>span classsecno>2.5.1/span> Terminologya href#terminology-3 classself-link>/a>/h4> p>A a hrefhttps://fetch.spec.whatwg.org/#concept-response idterminology-3:concept-response data-x-internalconcept-response>response/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-response-type idterminology-3:concept-response-type data-x-internalconcept-response-type>type/a> is code>basic/code>, code>cors/code>, or code>default/code> is dfn idcors-same-origin>CORS-same-origin/dfn>. a href#refsFETCH>FETCH/a>/p> p>A a hrefhttps://fetch.spec.whatwg.org/#concept-response idterminology-3:concept-response-2 data-x-internalconcept-response>response/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-response-type idterminology-3:concept-response-type-2 data-x-internalconcept-response-type>type/a> is code>opaque/code> or code>opaqueredirect/code> is dfn idcors-cross-origin>CORS-cross-origin/dfn>./p> p>A a hrefhttps://fetch.spec.whatwg.org/#concept-response idterminology-3:concept-response-3 data-x-internalconcept-response>response/a>s dfn idunsafe-response data-export>unsafe response/dfn> is its a hrefhttps://fetch.spec.whatwg.org/#concept-internal-response idterminology-3:concept-internal-response data-x-internalconcept-internal-response>internal response/a> if it has one, and the a hrefhttps://fetch.spec.whatwg.org/#concept-response idterminology-3:concept-response-4 data-x-internalconcept-response>response/a> itself otherwise./p> p>To dfn idcreate-a-potential-cors-request>create a potential-CORS request/dfn>, given a var>url/var>, var>destination/var>, var>corsAttributeState/var>, and an optional i>same-origin fallback flag/i>, run these steps:/p> ol>li>p>Let var>mode/var> be code>no-cors/code> if var>corsAttributeState/var> is a href#attr-crossorigin-none idterminology-3:attr-crossorigin-none>No CORS/a>, and code>cors/code> otherwise.li>p>If i>same-origin fallback flag/i> is set and var>mode/var> is code>no-cors/code>, set var>mode/var> to code>same-origin/code>.li>p>Let var>credentialsMode/var> be code>include/code>.li>p>If var>corsAttributeState/var> is a href#attr-crossorigin-anonymous idterminology-3:attr-crossorigin-anonymous>Anonymous/a>, set var>credentialsMode/var> to code>same-origin/code>.li>p>Let var>request/var> be a new a hrefhttps://fetch.spec.whatwg.org/#concept-request idterminology-3:concept-request data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idterminology-3:concept-request-url data-x-internalconcept-request-url>url/a> is var>url/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination idterminology-3:concept-request-destination data-x-internalconcept-request-destination>destination/a> is var>destination/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-mode idterminology-3:concept-request-mode data-x-internalconcept-request-mode>mode/a> is var>mode/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode idterminology-3:concept-request-credentials-mode data-x-internalconcept-request-credentials-mode>credentials mode/a> is var>credentialsMode/var>, and whose a idterminology-3:use-url-credentials-flag hrefhttps://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag data-x-internaluse-url-credentials-flag>use-URL-credentials flag/a> is set./ol> h4 idcontent-type-sniffing>span classsecno>2.5.2/span> Determining the type of a resourcea href#content-type-sniffing classself-link>/a>/h4> p>The dfn idcontent-type>Content-Type metadata/dfn> of a resource must be obtained and interpreted in a manner consistent with the requirements of the WHATWG MIME Sniffing standard. a href#refsMIMESNIFF>MIMESNIFF/a>/p> p>The dfn idcontent-type-sniffing-2>a hrefhttps://mimesniff.spec.whatwg.org/#computed-mime-type>computed MIME type/a>/dfn> of a resource must be found in a manner consistent with the requirements given in the WHATWG MIME Sniffing standard. a href#refsMIMESNIFF>MIMESNIFF/a>/p> p>The dfn idcontent-type-sniffing:-image>a hrefhttps://mimesniff.spec.whatwg.org/#rules-for-sniffing-images-specifically>rules for sniffing images specifically/a>/dfn>, the dfn idcontent-type-sniffing:-text-or-binary>a hrefhttps://mimesniff.spec.whatwg.org/#rules-for-text-or-binary>rules for distinguishing if a resource is text or binary/a>/dfn>, and the dfn idcontent-type-sniffing:-video>a hrefhttps://mimesniff.spec.whatwg.org/#rules-for-sniffing-audio-and-video-specifically>rules for sniffing audio and video specifically/a>/dfn> are also defined in the WHATWG MIME Sniffing standard. These rules return a a idcontent-type-sniffing:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> as their result. a href#refsMIMESNIFF>MIMESNIFF/a>/p> p classwarning>It is imperative that the rules in the WHATWG MIME Sniffing standard be followed exactly. When a user agent uses different heuristics for content type detection than the server expects, security problems can occur. For more details, see the WHATWG MIME Sniffing standard. a href#refsMIMESNIFF>MIMESNIFF/a>/p> h4 idextracting-character-encodings-from-meta-elements>span classsecno>2.5.3/span> Extracting character encodings from code idextracting-character-encodings-from-meta-elements:the-meta-element>a href#the-meta-element>meta/a>/code> elementsa href#extracting-character-encodings-from-meta-elements classself-link>/a>/h4> p>The dfn idalgorithm-for-extracting-a-character-encoding-from-a-meta-element>algorithm for extracting a character encoding from a code>meta/code> element/dfn>, given a string var>s/var>, is as follows. It either returns a character encoding or nothing./p> ol>li>p>Let var>position/var> be a pointer into var>s/var>, initially pointing at the start of the string.li>p>i>Loop/i>: Find the first seven characters in var>s/var> after var>position/var> that are an a idextracting-character-encodings-from-meta-elements:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the word code>charset/code>. If no such match is found, return nothing and abort these steps.li>p>Skip any a idextracting-character-encodings-from-meta-elements:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> that immediately follow the word code>charset/code> (there might not be any).li>p>If the next character is not a U+003D EQUALS SIGN (), then move var>position/var> to point just before that next character, and jump back to the step labeled i>loop/i>.li>p>Skip any a idextracting-character-encodings-from-meta-elements:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> that immediately follow the equals sign (there might not be any).li> p>Process the next character as follows:/p> dl classswitch>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 idextracting-character-encodings-from-meta-elements:getting-an-encoding hrefhttps://encoding.spec.whatwg.org/#concept-encoding-get data-x-internalgetting-an-encoding>getting an encoding/a> from the substring that is between this character and the next earliest occurrence of this character.dt>If it is an unmatched U+0022 QUOTATION MARK character ()dt>If it is an unmatched U+0027 APOSTROPHE character ()dt>If there is no next characterdd>Return nothing.dt>Otherwisedd>Return the result of a idextracting-character-encodings-from-meta-elements:getting-an-encoding-2 hrefhttps://encoding.spec.whatwg.org/#concept-encoding-get data-x-internalgetting-an-encoding>getting an encoding/a> from the substring that consists of this character up to but not including the first a idextracting-character-encodings-from-meta-elements:space-characters-3 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> or U+003B SEMICOLON character (;), or the end of var>s/var>, whichever comes first./dl> /ol> p classnote>This algorithm is distinct from those in the HTTP specification (for example, HTTP doesnt allow the use of single quotes and requires supporting a backslash-escape mechanism that is not supported by this algorithm). While the algorithm is used in contexts that, historically, were related to HTTP, the syntax as supported by implementations diverged some time ago. a href#refsHTTP>HTTP/a>/p> h4 idcors-settings-attributes>span classsecno>2.5.4/span> CORS settings attributesa href#cors-settings-attributes classself-link>/a>/h4> p>A dfn idcors-settings-attribute>CORS settings attribute/dfn> is an a href#enumerated-attribute idcors-settings-attributes:enumerated-attribute>enumerated attribute/a>. The following table lists the keywords and states for the attribute — the keywords in the left column map to the states in the cell in the second column on the same row as the keyword./p> table>thead>tr>th> Keyword th> State th> Brief description tbody>tr>td>dfn idattr-crossorigin-anonymous-keyword>code>anonymous/code>/dfn> td>dfn idattr-crossorigin-anonymous>Anonymous/dfn> td>a hrefhttps://fetch.spec.whatwg.org/#concept-request idcors-settings-attributes:concept-request data-x-internalconcept-request>Requests/a> for the element will have their a hrefhttps://fetch.spec.whatwg.org/#concept-request-mode idcors-settings-attributes:concept-request-mode data-x-internalconcept-request-mode>mode/a> set to code>cors/code> and their a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode idcors-settings-attributes:concept-request-credentials-mode data-x-internalconcept-request-credentials-mode>credentials mode/a> set to code>same-origin/code>. tr>td>dfn idattr-crossorigin-use-credentials-keyword>code>use-credentials/code>/dfn> td>dfn idattr-crossorigin-use-credentials>Use Credentials/dfn> td>a hrefhttps://fetch.spec.whatwg.org/#concept-request idcors-settings-attributes:concept-request-2 data-x-internalconcept-request>Requests/a> for the element will have their a hrefhttps://fetch.spec.whatwg.org/#concept-request-mode idcors-settings-attributes:concept-request-mode-2 data-x-internalconcept-request-mode>mode/a> set to code>cors/code> and their a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode idcors-settings-attributes:concept-request-credentials-mode-2 data-x-internalconcept-request-credentials-mode>credentials mode/a> set to code>include/code>. /table> p>The empty string is also a valid keyword, and maps to the a href#attr-crossorigin-anonymous idcors-settings-attributes:attr-crossorigin-anonymous>Anonymous/a> state. The attributes i idcors-settings-attributes:invalid-value-default>a href#invalid-value-default>invalid value default/a>/i> is the a href#attr-crossorigin-anonymous idcors-settings-attributes:attr-crossorigin-anonymous-2>Anonymous/a> state. For the purposes of a href#reflect idcors-settings-attributes:reflect>reflection/a>, the canonical case for the a href#attr-crossorigin-anonymous idcors-settings-attributes:attr-crossorigin-anonymous-3>Anonymous/a> state is the code idcors-settings-attributes:attr-crossorigin-anonymous-keyword>a href#attr-crossorigin-anonymous-keyword>anonymous/a>/code> keyword. The i idcors-settings-attributes:missing-value-default>a href#missing-value-default>missing value default/a>/i>, used when the attribute is omitted, is the dfn idattr-crossorigin-none>No CORS/dfn> state./p> p>The majority of fetches governed by a href#cors-settings-attribute idcors-settings-attributes:cors-settings-attribute>CORS settings attributes/a> will be done via the a href#create-a-potential-cors-request idcors-settings-attributes:create-a-potential-cors-request>create a potential-CORS request/a> algorithm./p> p>For a href#module-script idcors-settings-attributes:module-script>module scripts/a>, certain a href#cors-settings-attribute idcors-settings-attributes:cors-settings-attribute-2>CORS settings attributes/a> have been repurposed to have a slightly different meaning, wherein they only impact the a hrefhttps://fetch.spec.whatwg.org/#concept-request idcors-settings-attributes:concept-request-3 data-x-internalconcept-request>request/a>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode idcors-settings-attributes:concept-request-credentials-mode-3 data-x-internalconcept-request-credentials-mode>credentials mode/a> (since the a hrefhttps://fetch.spec.whatwg.org/#concept-request-mode idcors-settings-attributes:concept-request-mode-3 data-x-internalconcept-request-mode>mode/a> is always code>cors/code>). To perform this translation, we define the dfn idmodule-script-credentials-mode>module script credentials mode/dfn> for a given a href#cors-settings-attribute idcors-settings-attributes:cors-settings-attribute-3>CORS settings attribute/a> to be determined by switching on the attributes state:/p> dl classswitch>dt>a href#attr-crossorigin-none idcors-settings-attributes:attr-crossorigin-none>No CORS/a>dd>code>omit/code>dt>a href#attr-crossorigin-anonymous idcors-settings-attributes:attr-crossorigin-anonymous-4>Anonymous/a>dd>code>same-origin/code>dt>a href#attr-crossorigin-none idcors-settings-attributes:attr-crossorigin-none-2>Use Credentials/a>dd>code>include/code>/dl> h4 idreferrer-policy-attributes>span classsecno>2.5.5/span> Referrer policy attributesa href#referrer-policy-attributes classself-link>/a>/h4> p>A dfn idreferrer-policy-attribute data-export>referrer policy attribute/dfn> is an a href#enumerated-attribute idreferrer-policy-attributes:enumerated-attribute>enumerated attribute/a>. Each a idreferrer-policy-attributes:referrer-policy hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>referrer policy/a>, including the empty string, is a keyword for this attribute, mapping to a state of the same name./p> p>The attributes i idreferrer-policy-attributes:invalid-value-default>a href#invalid-value-default>invalid value default/a>/i> and i idreferrer-policy-attributes:missing-value-default>a href#missing-value-default>missing value default/a>/i> are both the empty string state./p> p>The impact of these states on the processing model of various a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idreferrer-policy-attributes:concept-fetch data-x-internalconcept-fetch>fetches/a> is defined in more detail throughout this specification, in the WHATWG Fetch standard, and in cite>Referrer Policy/cite>. a href#refsFETCH>FETCH/a> a href#refsREFERRERPOLICY>REFERRERPOLICY/a>/p> div classnote> p>Several signals can contribute to which processing model is used for a given a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idreferrer-policy-attributes:concept-fetch-2 data-x-internalconcept-fetch>fetch/a>; a a href#referrer-policy-attribute idreferrer-policy-attributes:referrer-policy-attribute>referrer policy attribute/a> is only one of them. In general, the order in which these signals are processed are:/p> ol>li>p>First, the presence of a code idreferrer-policy-attributes:link-type-noreferrer>a href#link-type-noreferrer>noreferrer/a>/code> link type;li>p>Then, the value of a a href#referrer-policy-attribute idreferrer-policy-attributes:referrer-policy-attribute-2>referrer policy attribute/a>;li>p>Then, the presence of any code idreferrer-policy-attributes:the-meta-element>a href#the-meta-element>meta/a>/code> element with code idreferrer-policy-attributes:attr-meta-name>a href#attr-meta-name>name/a>/code> attribute set to code idreferrer-policy-attributes:meta-referrer>a href#meta-referrer>referrer/a>/code>.li>p>Finally, the `code idreferrer-policy-attributes:http-referrer-policy>a data-x-internalhttp-referrer-policy hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy-header-dfn>Referrer-Policy/a>/code>` HTTP header./ol> /div> h3 idcommon-dom-interfaces>span classsecno>2.6/span> Common DOM interfacesa href#common-dom-interfaces classself-link>/a>/h3> h4 idreflecting-content-attributes-in-idl-attributes>span classsecno>2.6.1/span> Reflecting content attributes in IDL attributesa href#reflecting-content-attributes-in-idl-attributes classself-link>/a>/h4> p>Some IDL attributes are defined to dfn idreflect>reflect/dfn> a particular content attribute. This means that on getting, the IDL attribute returns the current value of the content attribute, and on setting, the IDL attribute changes the value of the content attribute to the given value./p> p>In general, on getting, if the content attribute is not present, the IDL attribute must act as if the content attributes value is the empty string; and on setting, if the content attribute is not present, it must first be added./p> p>If a reflecting IDL attribute is a code idreflecting-content-attributes-in-idl-attributes:idl-usvstring>a data-x-internalidl-usvstring hrefhttps://heycam.github.io/webidl/#idl-USVString>USVString/a>/code> attribute whose content attribute is defined to contain a a idreflecting-content-attributes-in-idl-attributes:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>, then on getting, if the content attribute is absent, the IDL attribute must return the empty string. Otherwise, the IDL attribute must a href#parse-a-url idreflecting-content-attributes-in-idl-attributes:parse-a-url>parse/a> the value of the content attribute relative to the elements a idreflecting-content-attributes-in-idl-attributes:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> and if that is successful, return the a href#resulting-url-string idreflecting-content-attributes-in-idl-attributes:resulting-url-string>resulting URL string/a>. If parsing fails, then the value of the content attribute must be returned instead, a hrefhttps://heycam.github.io/webidl/#es-type-mapping idreflecting-content-attributes-in-idl-attributes:concept-idl-convert data-x-internalconcept-idl-convert>converted/a> to a code idreflecting-content-attributes-in-idl-attributes:idl-usvstring-2>a data-x-internalidl-usvstring hrefhttps://heycam.github.io/webidl/#idl-USVString>USVString/a>/code>. On setting, the content attribute must be set to the specified new value./p> p>If a reflecting IDL attribute is a code idreflecting-content-attributes-in-idl-attributes:idl-domstring>a data-x-internalidl-domstring hrefhttps://heycam.github.io/webidl/#idl-DOMString>DOMString/a>/code> attribute whose content attribute is an a href#enumerated-attribute idreflecting-content-attributes-in-idl-attributes:enumerated-attribute>enumerated attribute/a>, and the IDL attribute is dfn idlimited-to-only-known-values>limited to only known values/dfn>, then, on getting, the IDL attribute must return the conforming value associated with the state the attribute is in (in its canonical case), if any, or the empty string if the attribute is in a state that has no associated keyword value or if the attribute is not in a defined state (e.g. the attribute is missing and there is no i idreflecting-content-attributes-in-idl-attributes:missing-value-default>a href#missing-value-default>missing value default/a>/i>). On setting, the content attribute must be set to the specified new value./p> p>If a reflecting IDL attribute is a nullable code idreflecting-content-attributes-in-idl-attributes:idl-domstring-2>a data-x-internalidl-domstring hrefhttps://heycam.github.io/webidl/#idl-DOMString>DOMString/a>/code> attribute whose content attribute is an a href#enumerated-attribute idreflecting-content-attributes-in-idl-attributes:enumerated-attribute-2>enumerated attribute/a>, then, on getting, if the corresponding content attribute is in its i>missing value default/i> then the IDL attribute must return null, otherwise, the IDL attribute must return the conforming value associated with the state the attribute is in (in its canonical case). On setting, if the new value is null, the content attribute must be removed, and otherwise, the content attribute must be set to the specified new value./p> p>If a reflecting IDL attribute is a code idreflecting-content-attributes-in-idl-attributes:idl-domstring-3>a data-x-internalidl-domstring hrefhttps://heycam.github.io/webidl/#idl-DOMString>DOMString/a>/code> or code idreflecting-content-attributes-in-idl-attributes:idl-usvstring-3>a data-x-internalidl-usvstring hrefhttps://heycam.github.io/webidl/#idl-USVString>USVString/a>/code> attribute but doesnt fall into any of the above categories, then the getting and setting must be done in a transparent, case-preserving manner./p> p>If a reflecting IDL attribute is a code idreflecting-content-attributes-in-idl-attributes:idl-boolean>a data-x-internalidl-boolean hrefhttps://heycam.github.io/webidl/#idl-boolean>boolean/a>/code> attribute, then on getting the IDL attribute must return true if the content attribute is set, and false if it is absent. On setting, the content attribute must be removed if the IDL attribute is set to false, and must be set to the empty string if the IDL attribute is set to true. (This corresponds to the rules for a href#boolean-attribute idreflecting-content-attributes-in-idl-attributes:boolean-attribute>boolean content attributes/a>.)/p> p>If a reflecting IDL attribute has a signed integer type (code idreflecting-content-attributes-in-idl-attributes:idl-long>a data-x-internalidl-long hrefhttps://heycam.github.io/webidl/#idl-long>long/a>/code>) then, on getting, the content attribute must be parsed according to the a href#rules-for-parsing-integers idreflecting-content-attributes-in-idl-attributes:rules-for-parsing-integers>rules for parsing signed integers/a>, and if that is successful, and the value is in the range of the IDL attributes type, the resulting value must be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, then the default value must be returned instead, or 0 if there is no default value. On setting, the given value must be converted to the shortest possible string representing the number as a a href#valid-integer idreflecting-content-attributes-in-idl-attributes:valid-integer>valid integer/a> and then that string must be used as the new content attribute value./p> p>If a reflecting IDL attribute has a signed integer type (code idreflecting-content-attributes-in-idl-attributes:idl-long-2>a data-x-internalidl-long hrefhttps://heycam.github.io/webidl/#idl-long>long/a>/code>) that is dfn idlimited-to-only-non-negative-numbers>limited to only non-negative numbers/dfn> then, on getting, the content attribute must be parsed according to the a href#rules-for-parsing-non-negative-integers idreflecting-content-attributes-in-idl-attributes:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers/a>, and if that is successful, and the value is in the range of the IDL attributes type, the resulting value must be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, the default value must be returned instead, or −1 if there is no default value. On setting, if the value is negative, the user agent must throw an a idreflecting-content-attributes-in-idl-attributes:indexsizeerror hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idreflecting-content-attributes-in-idl-attributes:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>. Otherwise, the given value must be converted to the shortest possible string representing the number as a a href#valid-non-negative-integer idreflecting-content-attributes-in-idl-attributes:valid-non-negative-integer>valid non-negative integer/a> and then that string must be used as the new content attribute value./p> p>If a reflecting IDL attribute has an em>unsigned/em> integer type (code idreflecting-content-attributes-in-idl-attributes:idl-unsigned-long>a data-x-internalidl-unsigned-long hrefhttps://heycam.github.io/webidl/#idl-unsigned-long>unsigned long/a>/code>) then, on getting, the content attribute must be parsed according to the a href#rules-for-parsing-non-negative-integers idreflecting-content-attributes-in-idl-attributes:rules-for-parsing-non-negative-integers-2>rules for parsing non-negative integers/a>, and if that is successful, and the value is in the range 0 to 2147483647 inclusive, the resulting value must be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, the default value must be returned instead, or 0 if there is no default value. On setting, first, if the new value is in the range 0 to 2147483647, then let var>n/var> be the new value, otherwise let var>n/var> be the default value, or 0 if there is no default value; then, var>n/var> must be converted to the shortest possible string representing the number as a a href#valid-non-negative-integer idreflecting-content-attributes-in-idl-attributes:valid-non-negative-integer-2>valid non-negative integer/a> and that string must be used as the new content attribute value./p> p>If a reflecting IDL attribute has an unsigned integer type (code idreflecting-content-attributes-in-idl-attributes:idl-unsigned-long-2>a data-x-internalidl-unsigned-long hrefhttps://heycam.github.io/webidl/#idl-unsigned-long>unsigned long/a>/code>) that is dfn idlimited-to-only-non-negative-numbers-greater-than-zero>limited to only non-negative numbers greater than zero/dfn>, then the behavior is similar to the previous case, but zero is not allowed. On getting, the content attribute must first be parsed according to the a href#rules-for-parsing-non-negative-integers idreflecting-content-attributes-in-idl-attributes:rules-for-parsing-non-negative-integers-3>rules for parsing non-negative integers/a>, and if that is successful, and the value is in the range 1 to 2147483647 inclusive, the resulting value must be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, the default value must be returned instead, or 1 if there is no default value. On setting, if the value is zero, the user agent must throw an a idreflecting-content-attributes-in-idl-attributes:indexsizeerror-2 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idreflecting-content-attributes-in-idl-attributes:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>. Otherwise, first, if the new value is in the range 1 to 2147483647, then let var>n/var> be the new value, otherwise let var>n/var> be the default value, or 1 if there is no default value; then, var>n/var> must be converted to the shortest possible string representing the number as a a href#valid-non-negative-integer idreflecting-content-attributes-in-idl-attributes:valid-non-negative-integer-3>valid non-negative integer/a> and that string must be used as the new content attribute value./p> p>If a reflecting IDL attribute has an unsigned integer type (code idreflecting-content-attributes-in-idl-attributes:idl-unsigned-long-3>a data-x-internalidl-unsigned-long hrefhttps://heycam.github.io/webidl/#idl-unsigned-long>unsigned long/a>/code>) that is dfn idlimited-to-only-non-negative-numbers-greater-than-zero-with-fallback>limited to only non-negative numbers greater than zero with fallback/dfn>, then the behavior is similar to the previous case, but disallowed values are converted to the default value. On getting, the content attribute must first be parsed according to the a href#rules-for-parsing-non-negative-integers idreflecting-content-attributes-in-idl-attributes:rules-for-parsing-non-negative-integers-4>rules for parsing non-negative integers/a>, and if that is successful, and the value is in the range 1 to 2147483647 inclusive, the resulting value must be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, the default value must be returned instead. On setting, first, if the new value is in the range 1 to 2147483647, then let var>n/var> be the new value, otherwise let var>n/var> be the default value; then, var>n/var> must be converted to the shortest possible string representing the number as a a href#valid-non-negative-integer idreflecting-content-attributes-in-idl-attributes:valid-non-negative-integer-4>valid non-negative integer/a> and that string must be used as the new content attribute value./p> p>If a reflecting IDL attribute has an unsigned integer type (code idreflecting-content-attributes-in-idl-attributes:idl-unsigned-long-4>a data-x-internalidl-unsigned-long hrefhttps://heycam.github.io/webidl/#idl-unsigned-long>unsigned long/a>/code>) that is dfn idclamped-to-the-range>clamped to the range/dfn> var>min/var>, var>max/var>, then on getting, the content attribute must first be parsed according to the a href#rules-for-parsing-non-negative-integers idreflecting-content-attributes-in-idl-attributes:rules-for-parsing-non-negative-integers-5>rules for parsing non-negative integers/a>, and if that is successful, and the value is between var>min/var> and var>max/var> inclusive, the resulting value must be returned. If it fails, the default value must be returned. If it succeeds but the value is less than var>min/var>, var>min/var> must be returned. If it succeeds but the value is greater than var>max/var>, var>max/var> must be returned. On setting, it behaves the same as setting a regular reflected unsigned integer./p> p>If a reflecting IDL attribute has a floating-point number type (code idreflecting-content-attributes-in-idl-attributes:idl-double>a data-x-internalidl-double hrefhttps://heycam.github.io/webidl/#idl-double>double/a>/code> or code idreflecting-content-attributes-in-idl-attributes:idl-unrestricted-double>a data-x-internalidl-unrestricted-double hrefhttps://heycam.github.io/webidl/#idl-unrestricted-double>unrestricted double/a>/code>), then, on getting, the content attribute must be parsed according to the a href#rules-for-parsing-floating-point-number-values idreflecting-content-attributes-in-idl-attributes:rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values/a>, and if that is successful, the resulting value must be returned. If, on the other hand, it fails, or if the attribute is absent, the default value must be returned instead, or 0.0 if there is no default value. On setting, the given value must be converted to the a href#best-representation-of-the-number-as-a-floating-point-number idreflecting-content-attributes-in-idl-attributes:best-representation-of-the-number-as-a-floating-point-number>best representation of the number as a floating-point number/a> and then that string must be used as the new content attribute value./p> p>If a reflecting IDL attribute has a floating-point number type (code idreflecting-content-attributes-in-idl-attributes:idl-double-2>a data-x-internalidl-double hrefhttps://heycam.github.io/webidl/#idl-double>double/a>/code> or code idreflecting-content-attributes-in-idl-attributes:idl-unrestricted-double-2>a data-x-internalidl-unrestricted-double hrefhttps://heycam.github.io/webidl/#idl-unrestricted-double>unrestricted double/a>/code>) that is dfn idlimited-to-numbers-greater-than-zero>limited to numbers greater than zero/dfn>, then the behavior is similar to the previous case, but zero and negative values are not allowed. On getting, the content attribute must be parsed according to the a href#rules-for-parsing-floating-point-number-values idreflecting-content-attributes-in-idl-attributes:rules-for-parsing-floating-point-number-values-2>rules for parsing floating-point number values/a>, and if that is successful and the value is greater than 0.0, the resulting value must be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, the default value must be returned instead, or 0.0 if there is no default value. On setting, if the value is less than or equal to zero, then the value must be ignored. Otherwise, the given value must be converted to the a href#best-representation-of-the-number-as-a-floating-point-number idreflecting-content-attributes-in-idl-attributes:best-representation-of-the-number-as-a-floating-point-number-2>best representation of the number as a floating-point number/a> and then that string must be used as the new content attribute value./p> p classnote>The values Infinity and Not-a-Number (NaN) values throw an exception on setting, as defined in the Web IDL specification. a href#refsWEBIDL>WEBIDL/a>/p> p>If a reflecting IDL attribute has the type code idreflecting-content-attributes-in-idl-attributes:domtokenlist>a data-x-internaldomtokenlist hrefhttps://dom.spec.whatwg.org/#interface-domtokenlist>DOMTokenList/a>/code>, then on getting it must return a code idreflecting-content-attributes-in-idl-attributes:domtokenlist-2>a data-x-internaldomtokenlist hrefhttps://dom.spec.whatwg.org/#interface-domtokenlist>DOMTokenList/a>/code> object whose associated element is the element in question and whose associated attributes local name is the name of the attribute in question./p> h4 idcollections>span classsecno>2.6.2/span> Collectionsa href#collections classself-link>/a>/h4> p>The code idcollections:htmlformcontrolscollection>a href#htmlformcontrolscollection>HTMLFormControlsCollection/a>/code> and code idcollections:htmloptionscollection>a href#htmloptionscollection>HTMLOptionsCollection/a>/code> interfaces are a hrefhttps://dom.spec.whatwg.org/#concept-collection idcollections:concept-collection data-x-internalconcept-collection>collections/a> derived from the code idcollections:htmlcollection>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> interface. The code idcollections:htmlallcollection>a href#htmlallcollection>HTMLAllCollection/a>/code> interface is a a hrefhttps://dom.spec.whatwg.org/#concept-collection idcollections:concept-collection-2 data-x-internalconcept-collection>collection/a>, but is not so derived./p> h5 idthe-htmlallcollection-interface>span classsecno>2.6.2.1/span> The code idthe-htmlallcollection-interface:htmlallcollection>a href#htmlallcollection>HTMLAllCollection/a>/code> interfacea href#the-htmlallcollection-interface classself-link>/a>/h5> p>The code idthe-htmlallcollection-interface:htmlallcollection-2>a href#htmlallcollection>HTMLAllCollection/a>/code> interface is used for the legacy code idthe-htmlallcollection-interface:dom-document-all>a href#dom-document-all>document.all/a>/code> attribute. It operates similarly to code idthe-htmlallcollection-interface:htmlcollection>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code>; the main differences are that it allows a staggering variety of different (ab)uses of its methods to all end up returning something, and that it can be called as a function as an alternative to property access./p> p classnote>All code idthe-htmlallcollection-interface:htmlallcollection-3>a href#htmlallcollection>HTMLAllCollection/a>/code> objects are rooted at a code idthe-htmlallcollection-interface:document>a href#document>Document/a>/code> and have a filter that matches all elements, so the elements a idthe-htmlallcollection-interface:represented-by-the-collection hrefhttps://dom.spec.whatwg.org/#represented-by-the-collection data-x-internalrepresented-by-the-collection>represented by the collection/a> of an code idthe-htmlallcollection-interface:htmlallcollection-4>a href#htmlallcollection>HTMLAllCollection/a>/code> object consist of all the descendant elements of the root code idthe-htmlallcollection-interface:document-2>a href#document>Document/a>/code>./p> p>Objects that implement the code idthe-htmlallcollection-interface:htmlallcollection-5>a href#htmlallcollection>HTMLAllCollection/a>/code> interface are a hrefhttps://heycam.github.io/webidl/#dfn-legacy-platform-object idthe-htmlallcollection-interface:legacy-platform-object data-x-internallegacy-platform-object>legacy platform objects/a> with an additonal Call internal method described in the a href#HTMLAllCollection-call>section below/a>. They also have an a idthe-htmlallcollection-interface:ishtmldda hrefhttps://tc39.github.io/ecma262/#sec-IsHTMLDDA-internal-slot data-x-internalishtmldda>IsHTMLDDA/a> internal slot./p> div classnote> p>Objects that implement the code idthe-htmlallcollection-interface:htmlallcollection-6>a href#htmlallcollection>HTMLAllCollection/a>/code> interface have several unusual behaviors, due of the fact that they have an a idthe-htmlallcollection-interface:ishtmldda-2 hrefhttps://tc39.github.io/ecma262/#sec-IsHTMLDDA-internal-slot data-x-internalishtmldda>IsHTMLDDA/a> internal slot:/p> ul>li>p>The a hrefhttps://tc39.github.io/ecma262/#sec-toboolean idthe-htmlallcollection-interface:js-toboolean data-x-internaljs-toboolean>ToBoolean/a> abstract operation in JavaScript returns false when given objects implementing the code idthe-htmlallcollection-interface:htmlallcollection-7>a href#htmlallcollection>HTMLAllCollection/a>/code> interface.li>p>The a hrefhttps://tc39.github.io/ecma262/#sec-abstract-equality-comparison idthe-htmlallcollection-interface:js-abstract-equality data-x-internaljs-abstract-equality>Abstract Equality Comparison/a> algorithm, when given objects implementing the code idthe-htmlallcollection-interface:htmlallcollection-8>a href#htmlallcollection>HTMLAllCollection/a>/code> interface, returns true when compared to the code>undefined/code> and code>null/code> values. (Comparisons using the a hrefhttps://tc39.github.io/ecma262/#sec-strict-equality-comparison idthe-htmlallcollection-interface:js-strict-equality data-x-internaljs-strict-equality>Strict Equality Comparison/a> algorithm, and Abstract Equality comparisons to other values such as strings or objects, are unaffected.)li>p>The code idthe-htmlallcollection-interface:js-typeof>a data-x-internaljs-typeof hrefhttps://tc39.github.io/ecma262/#sec-typeof-operator>typeof/a>/code> operator in JavaScript returns the string code>undefined/code> when applied to objects implementing the code idthe-htmlallcollection-interface:htmlallcollection-9>a href#htmlallcollection>HTMLAllCollection/a>/code> interface./ul> p>These special behaviors are motivated by a desire for compatibility with two classes of legacy content: one that uses the presence of code idthe-htmlallcollection-interface:dom-document-all-2>a href#dom-document-all>document.all/a>/code> as a way to detect legacy user agents, and one that only supports those legacy user agents and uses the code idthe-htmlallcollection-interface:dom-document-all-3>a href#dom-document-all>document.all/a>/code> object without testing for its presence first. a href#refsJAVASCRIPT>JAVASCRIPT/a>/p> /div> pre classidl>ExposedWindow, LegacyUnenumerableNamedPropertiesinterface dfn idhtmlallcollection>HTMLAllCollection/dfn> { readonly attribute unsigned long a href#dom-htmlallcollection-length idthe-htmlallcollection-interface:dom-htmlallcollection-length>length/a>; getter a idthe-htmlallcollection-interface:element hrefhttps://dom.spec.whatwg.org/#interface-element data-x-internalelement>Element/a>? (unsigned long index); getter (a idthe-htmlallcollection-interface:htmlcollection-2 hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> or a idthe-htmlallcollection-interface:element-2 hrefhttps://dom.spec.whatwg.org/#interface-element data-x-internalelement>Element/a>)? a href#dom-htmlallcollection-nameditem idthe-htmlallcollection-interface:dom-htmlallcollection-nameditem>namedItem/a>(DOMString name); (a idthe-htmlallcollection-interface:htmlcollection-3 hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> or a idthe-htmlallcollection-interface:element-3 hrefhttps://dom.spec.whatwg.org/#interface-element data-x-internalelement>Element/a>)? a href#dom-htmlallcollection-item idthe-htmlallcollection-interface:dom-htmlallcollection-item>item/a>(optional DOMString nameOrIndex); // Note: HTMLAllCollection objects have a a href#HTMLAllCollection-call>custom Call internal method/a> and an a idthe-htmlallcollection-interface:ishtmldda-3 hrefhttps://tc39.github.io/ecma262/#sec-IsHTMLDDA-internal-slot data-x-internalishtmldda>IsHTMLDDA/a> internal slot.};/pre> dl classdomintro>dt>var>collection/var> . code idthe-htmlallcollection-interface:dom-htmlallcollection-length-2>a href#dom-htmlallcollection-length>length/a>/code>dd> p>Returns the number of elements in the collection./p> dt>var>element/var> var>collection/var> . code idthe-htmlallcollection-interface:dom-htmlallcollection-item-2>a href#dom-htmlallcollection-item>item/a>/code>(var>index/var>)dt>var>element/var> var>collection/var>(var>index/var>)dt>var>element/var> var>collection/var>var>index/var>dd> p>Returns the item with index var>index/var> from the collection (determined by a idthe-htmlallcollection-interface:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>)./p> dt>var>element/var> var>collection/var> . code idthe-htmlallcollection-interface:dom-htmlallcollection-item-3>a href#dom-htmlallcollection-item>item/a>/code>(var>name/var>)dt>var>collection/var> var>collection/var> . code idthe-htmlallcollection-interface:dom-htmlallcollection-item-4>a href#dom-htmlallcollection-item>item/a>/code>(var>name/var>)dt>var>element/var> var>collection/var> . code idthe-htmlallcollection-interface:dom-htmlallcollection-nameditem-2>a href#dom-htmlallcollection-nameditem>namedItem/a>/code>(var>name/var>)dt>var>collection/var> var>collection/var> . code idthe-htmlallcollection-interface:dom-htmlallcollection-nameditem-3>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>element/var> var>collection/var>var>name/var>dt>var>collection/var> var>collection/var>var>name/var>dd> p>Returns the item with a hrefhttps://dom.spec.whatwg.org/#concept-id idthe-htmlallcollection-interface:concept-id data-x-internalconcept-id>ID/a> or name var>name/var> from the collection./p> p>If there are multiple matching items, then an code idthe-htmlallcollection-interface:htmlcollection-4>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> object containing all those elements is returned./p> p>Only code idthe-htmlallcollection-interface:the-button-element>a href#the-button-element>button/a>/code>, code idthe-htmlallcollection-interface:the-form-element>a href#the-form-element>form/a>/code>, code idthe-htmlallcollection-interface:the-iframe-element>a href#the-iframe-element>iframe/a>/code>, code idthe-htmlallcollection-interface:the-input-element>a href#the-input-element>input/a>/code>, code idthe-htmlallcollection-interface:the-map-element>a href#the-map-element>map/a>/code>, code idthe-htmlallcollection-interface:the-meta-element>a href#the-meta-element>meta/a>/code>, code idthe-htmlallcollection-interface:the-object-element>a href#the-object-element>object/a>/code>, code idthe-htmlallcollection-interface:the-select-element>a href#the-select-element>select/a>/code>, and code idthe-htmlallcollection-interface:the-textarea-element>a href#the-textarea-element>textarea/a>/code> elements can have a name for the purpose of this method; their name is given by the value of their code>name/code> attribute./p> /dl> p>The objects a idthe-htmlallcollection-interface:supported-property-indices hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a> are as defined for code idthe-htmlallcollection-interface:htmlcollection-5>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> objects./p> p>The a idthe-htmlallcollection-interface:supported-property-names hrefhttps://heycam.github.io/webidl/#dfn-supported-property-names data-x-internalsupported-property-names>supported property names/a> consist of the non-empty values of all the code idthe-htmlallcollection-interface:the-id-attribute>a href#the-id-attribute>id/a>/code> attributes of all the elements a idthe-htmlallcollection-interface:represented-by-the-collection-2 hrefhttps://dom.spec.whatwg.org/#represented-by-the-collection data-x-internalrepresented-by-the-collection>represented by the collection/a>, and the non-empty values of all the code>name/code> attributes of all the a href#all-named-elements idthe-htmlallcollection-interface:all-named-elements>all-named elements/a> a idthe-htmlallcollection-interface:represented-by-the-collection-3 hrefhttps://dom.spec.whatwg.org/#represented-by-the-collection data-x-internalrepresented-by-the-collection>represented by the collection/a>, in a idthe-htmlallcollection-interface:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>, ignoring later duplicates, with the code idthe-htmlallcollection-interface:the-id-attribute-2>a href#the-id-attribute>id/a>/code> of an element preceding its code>name/code> if it contributes both, they differ from each other, and neither is the duplicate of an earlier entry./p> p>On getting, the dfn iddom-htmlallcollection-length>code>length/code>/dfn> attribute must return the number of nodes a idthe-htmlallcollection-interface:represented-by-the-collection-4 hrefhttps://dom.spec.whatwg.org/#represented-by-the-collection data-x-internalrepresented-by-the-collection>represented by the collection/a>./p> p>The indexed property getter must return the result of a href#concept-get-all-indexed idthe-htmlallcollection-interface:concept-get-all-indexed>getting the all-indexed element/a> from this code idthe-htmlallcollection-interface:htmlallcollection-10>a href#htmlallcollection>HTMLAllCollection/a>/code> given the passed index./p> p>The dfn iddom-htmlallcollection-nameditem>code>namedItem(var>name/var>)/code>/dfn> method must return the result of a href#concept-get-all-named idthe-htmlallcollection-interface:concept-get-all-named>getting the all-named element(s)/a> from this code idthe-htmlallcollection-interface:htmlallcollection-11>a href#htmlallcollection>HTMLAllCollection/a>/code> given var>name/var>./p> p>The dfn iddom-htmlallcollection-item>code>item(var>nameOrIndex/var>)/code>/dfn> method must perform the following steps:/p> ol>li>p>If var>nameOrIndex/var> was not provided, return null.li>p>Return the result of a href#concept-get-all-indexed-or-named idthe-htmlallcollection-interface:concept-get-all-indexed-or-named>getting the all-indexed or named element(s)/a> from this code idthe-htmlallcollection-interface:htmlallcollection-12>a href#htmlallcollection>HTMLAllCollection/a>/code>, given var>nameOrIndex/var>./ol> hr> p>The following elements are dfn idall-named-elements>all-named elements/dfn>: code idthe-htmlallcollection-interface:the-a-element>a href#the-a-element>a/a>/code>, code idthe-htmlallcollection-interface:the-button-element-2>a href#the-button-element>button/a>/code>, code idthe-htmlallcollection-interface:the-embed-element>a href#the-embed-element>embed/a>/code>, code idthe-htmlallcollection-interface:the-form-element-2>a href#the-form-element>form/a>/code>, code idthe-htmlallcollection-interface:frame>a href#frame>frame/a>/code>, code idthe-htmlallcollection-interface:frameset>a href#frameset>frameset/a>/code>, code idthe-htmlallcollection-interface:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code>, code idthe-htmlallcollection-interface:the-img-element>a href#the-img-element>img/a>/code>, code idthe-htmlallcollection-interface:the-input-element-2>a href#the-input-element>input/a>/code>, code idthe-htmlallcollection-interface:the-map-element-2>a href#the-map-element>map/a>/code>, code idthe-htmlallcollection-interface:the-meta-element-2>a href#the-meta-element>meta/a>/code>, code idthe-htmlallcollection-interface:the-object-element-2>a href#the-object-element>object/a>/code>, code idthe-htmlallcollection-interface:the-select-element-2>a href#the-select-element>select/a>/code>, and code idthe-htmlallcollection-interface:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code> /p> p>To dfn idconcept-get-all-indexed>get the all-indexed element/dfn> from an code idthe-htmlallcollection-interface:htmlallcollection-13>a href#htmlallcollection>HTMLAllCollection/a>/code> var>collection/var> given an index var>index/var>, return the var>index/var>sup>th/sup> element in var>collection/var>, or null if there is no such var>index/var>sup>th/sup> element./p> p>To dfn idconcept-get-all-named>get the all-named element(s)/dfn> from an code idthe-htmlallcollection-interface:htmlallcollection-14>a href#htmlallcollection>HTMLAllCollection/a>/code> var>collection/var> given a name var>name/var>, perform the following steps:/p> ol>li>p>If var>name/var> is the empty string, return null.li> p>Let var>subCollection/var> be an code idthe-htmlallcollection-interface:htmlcollection-6>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> object rooted at the same code idthe-htmlallcollection-interface:document-3>a href#document>Document/a>/code> as var>collection/var>, whose filter matches only elements that are either:/p> ul>li>p>a href#all-named-elements idthe-htmlallcollection-interface:all-named-elements-2>all-named elements/a> with a code>name/code> attribute equal to var>name/var>, or,li>p>elements with an a hrefhttps://dom.spec.whatwg.org/#concept-id idthe-htmlallcollection-interface:concept-id-2 data-x-internalconcept-id>ID/a> equal to var>name/var>./ul> li>p>If there is exactly one element in var>subCollection/var>, then return that element.li>p>Otherwise, if var>subCollection/var> is empty, return null.li>p>Otherwise, return var>subCollection/var>./ol> p>To dfn idconcept-get-all-indexed-or-named>get the all-indexed or named element(s)/dfn> from an code idthe-htmlallcollection-interface:htmlallcollection-15>a href#htmlallcollection>HTMLAllCollection/a>/code> var>collection/var> given var>nameOrIndex/var>: ol>li>p>If var>nameOrIndex/var>, a hrefhttps://heycam.github.io/webidl/#es-type-mapping idthe-htmlallcollection-interface:concept-idl-convert data-x-internalconcept-idl-convert>converted/a> to a JavaScript String value, is an a idthe-htmlallcollection-interface:array-index-property-name hrefhttps://heycam.github.io/webidl/#dfn-array-index-property-name data-x-internalarray-index-property-name>array index property name/a>, return the result of a href#concept-get-all-indexed idthe-htmlallcollection-interface:concept-get-all-indexed-2>getting the all-indexed element/a> from this code idthe-htmlallcollection-interface:htmlallcollection-16>a href#htmlallcollection>HTMLAllCollection/a>/code> given the number represented by var>nameOrIndex/var>.li>p>Return the result of a href#concept-get-all-named idthe-htmlallcollection-interface:concept-get-all-named-2>getting the all-named element(s)/a> from this code idthe-htmlallcollection-interface:htmlallcollection-17>a href#htmlallcollection>HTMLAllCollection/a>/code> given var>nameOrIndex/var>./ol> h6 idHTMLAllCollection-call>span classsecno>2.6.2.1.1/span> Call ( var>thisArgument/var>, var>argumentsList/var> )a href#HTMLAllCollection-call classself-link>/a>/h6> ol>li>p>If var>argumentsList/var>s a hrefhttps://infra.spec.whatwg.org/#list-size idHTMLAllCollection-call:list-size data-x-internallist-size>size/a> is zero, return null.li>p>Let var>nameOrIndex/var> be the result of a hrefhttps://heycam.github.io/webidl/#es-type-mapping idHTMLAllCollection-call:concept-idl-convert data-x-internalconcept-idl-convert>converting/a> var>argumentsList/var>0 to a code idHTMLAllCollection-call:idl-domstring>a data-x-internalidl-domstring hrefhttps://heycam.github.io/webidl/#idl-DOMString>DOMString/a>/code>.li>p>Let var>result/var> be the result of a href#concept-get-all-indexed-or-named idHTMLAllCollection-call:concept-get-all-indexed-or-named>getting the all-indexed or named element(s)/a> from this code idHTMLAllCollection-call:htmlallcollection>a href#htmlallcollection>HTMLAllCollection/a>/code> given var>nameOrIndex/var>.li>p>Return the result of a hrefhttps://heycam.github.io/webidl/#es-type-mapping idHTMLAllCollection-call:concept-idl-convert-2 data-x-internalconcept-idl-convert>converting/a> var>result/var> to an ECMAScript value./ol> p classnote>The var>thisArgument/var> is ignored, and thus code such as code>Function.prototype.call.call(document.all, null, x)/code> will still search for elements. (code>document.all.call/code> does not exist, since code>document.all/code> does not inherit from code>Function.prototype/code>.)/p> h5 idthe-htmlformcontrolscollection-interface>span classsecno>2.6.2.2/span> The code idthe-htmlformcontrolscollection-interface:htmlformcontrolscollection>a href#htmlformcontrolscollection>HTMLFormControlsCollection/a>/code> interfacea href#the-htmlformcontrolscollection-interface classself-link>/a>/h5> p>The code idthe-htmlformcontrolscollection-interface:htmlformcontrolscollection-2>a href#htmlformcontrolscollection>HTMLFormControlsCollection/a>/code> interface is used for a hrefhttps://dom.spec.whatwg.org/#concept-collection idthe-htmlformcontrolscollection-interface:concept-collection data-x-internalconcept-collection>collections/a> of a href#category-listed idthe-htmlformcontrolscollection-interface:category-listed>listed elements/a> in code idthe-htmlformcontrolscollection-interface:the-form-element>a href#the-form-element>form/a>/code> elements./p> pre classidl>ExposedWindowinterface dfn idhtmlformcontrolscollection>HTMLFormControlsCollection/dfn> : a idthe-htmlformcontrolscollection-interface:htmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> { // inherits a hrefhttps://dom.spec.whatwg.org/#dom-htmlcollection-length idthe-htmlformcontrolscollection-interface:dom-htmlcollection-length data-x-internaldom-htmlcollection-length>length/a> and a hrefhttps://dom.spec.whatwg.org/#dom-htmlcollection-item idthe-htmlformcontrolscollection-interface:dom-htmlcollection-item data-x-internaldom-htmlcollection-item>item/a>() getter (a href#radionodelist idthe-htmlformcontrolscollection-interface:radionodelist>RadioNodeList/a> or a idthe-htmlformcontrolscollection-interface:element hrefhttps://dom.spec.whatwg.org/#interface-element data-x-internalelement>Element/a>)? a href#dom-htmlformcontrolscollection-nameditem idthe-htmlformcontrolscollection-interface:dom-htmlformcontrolscollection-nameditem>namedItem/a>(DOMString name); // shadows inherited a hrefhttps://dom.spec.whatwg.org/#dom-htmlcollection-nameditem idthe-htmlformcontrolscollection-interface:dom-htmlcollection-nameditem data-x-internaldom-htmlcollection-nameditem>namedItem()/a>};ExposedWindowinterface dfn idradionodelist>RadioNodeList/dfn> : a idthe-htmlformcontrolscollection-interface:nodelist hrefhttps://dom.spec.whatwg.org/#interface-nodelist data-x-internalnodelist>NodeList/a> { attribute DOMString a href#dom-radionodelist-value idthe-htmlformcontrolscollection-interface:dom-radionodelist-value>value/a>;};/pre> dl classdomintro>dt>var>collection/var> . code idthe-htmlformcontrolscollection-interface:dom-htmlcollection-length-2>a data-x-internaldom-htmlcollection-length hrefhttps://dom.spec.whatwg.org/#dom-htmlcollection-length>length/a>/code>dd> p>Returns the number of elements in the collection./p> dt>var>element/var> var>collection/var> . code idthe-htmlformcontrolscollection-interface:dom-htmlcollection-item-2>a data-x-internaldom-htmlcollection-item hrefhttps://dom.spec.whatwg.org/#dom-htmlcollection-item>item/a>/code>(var>index/var>)dt>var>element/var> var>collection/var>var>index/var>dd> p>Returns the item with index var>index/var> from the collection. The items are sorted in a idthe-htmlformcontrolscollection-interface:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>./p> dt>var>element/var> var>collection/var> . code idthe-htmlformcontrolscollection-interface:dom-htmlformcontrolscollection-nameditem-2>a href#dom-htmlformcontrolscollection-nameditem>namedItem/a>/code>(var>name/var>)dt>var>radioNodeList/var> var>collection/var> . code idthe-htmlformcontrolscollection-interface:dom-htmlformcontrolscollection-nameditem-3>a href#dom-htmlformcontrolscollection-nameditem>namedItem/a>/code>(var>name/var>)dt>var>element/var> var>collection/var>var>name/var>dt>var>radioNodeList/var> var>collection/var>var>name/var>dd> p>Returns the item with a hrefhttps://dom.spec.whatwg.org/#concept-id idthe-htmlformcontrolscollection-interface:concept-id data-x-internalconcept-id>ID/a> or code idthe-htmlformcontrolscollection-interface:attr-fe-name>a href#attr-fe-name>name/a>/code> var>name/var> from the collection./p> p>If there are multiple matching items, then a code idthe-htmlformcontrolscollection-interface:radionodelist-2>a href#radionodelist>RadioNodeList/a>/code> object containing all those elements is returned./p> dt>var>radioNodeList/var> . var>value/var> var>value/var> dd> p>Returns the value of the first checked radio button represented by the object./p> p>Can be set, to check the first radio button with the given value represented by the object./p> /dl> p>The objects a idthe-htmlformcontrolscollection-interface:supported-property-indices hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a> are as defined for code idthe-htmlformcontrolscollection-interface:htmlcollection-2>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> objects./p> p>The a idthe-htmlformcontrolscollection-interface:supported-property-names hrefhttps://heycam.github.io/webidl/#dfn-supported-property-names data-x-internalsupported-property-names>supported property names/a> consist of the non-empty values of all the code idthe-htmlformcontrolscollection-interface:the-id-attribute>a href#the-id-attribute>id/a>/code> and code idthe-htmlformcontrolscollection-interface:attr-fe-name-2>a href#attr-fe-name>name/a>/code> attributes of all the elements a idthe-htmlformcontrolscollection-interface:represented-by-the-collection hrefhttps://dom.spec.whatwg.org/#represented-by-the-collection data-x-internalrepresented-by-the-collection>represented by the collection/a>, in a idthe-htmlformcontrolscollection-interface:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>, ignoring later duplicates, with the code idthe-htmlformcontrolscollection-interface:the-id-attribute-2>a href#the-id-attribute>id/a>/code> of an element preceding its code idthe-htmlformcontrolscollection-interface:attr-fe-name-3>a href#attr-fe-name>name/a>/code> if it contributes both, they differ from each other, and neither is the duplicate of an earlier entry./p> p>The dfn iddom-htmlformcontrolscollection-nameditem>code>namedItem(var>name/var>)/code>/dfn> method must act according to the following algorithm:/p> ol>li>If var>name/var> is the empty string, return null and stop the algorithm.li>If, at the time the method is called, there is exactly one node in the collection that has either an code idthe-htmlformcontrolscollection-interface:the-id-attribute-3>a href#the-id-attribute>id/a>/code> attribute or a code idthe-htmlformcontrolscollection-interface:attr-fe-name-4>a href#attr-fe-name>name/a>/code> attribute equal to var>name/var>, then return that node and stop the algorithm.li>Otherwise, if there are no nodes in the collection that have either an code idthe-htmlformcontrolscollection-interface:the-id-attribute-4>a href#the-id-attribute>id/a>/code> attribute or a code idthe-htmlformcontrolscollection-interface:attr-fe-name-5>a href#attr-fe-name>name/a>/code> attribute equal to var>name/var>, then return null and stop the algorithm.li>Otherwise, create a new code idthe-htmlformcontrolscollection-interface:radionodelist-3>a href#radionodelist>RadioNodeList/a>/code> object representing a a href#live idthe-htmlformcontrolscollection-interface:live>live/a> view of the code idthe-htmlformcontrolscollection-interface:htmlformcontrolscollection-3>a href#htmlformcontrolscollection>HTMLFormControlsCollection/a>/code> object, further filtered so that the only nodes in the code idthe-htmlformcontrolscollection-interface:radionodelist-4>a href#radionodelist>RadioNodeList/a>/code> object are those that have either an code idthe-htmlformcontrolscollection-interface:the-id-attribute-5>a href#the-id-attribute>id/a>/code> attribute or a code idthe-htmlformcontrolscollection-interface:attr-fe-name-6>a href#attr-fe-name>name/a>/code> attribute equal to var>name/var>. The nodes in the code idthe-htmlformcontrolscollection-interface:radionodelist-5>a href#radionodelist>RadioNodeList/a>/code> object must be sorted in a idthe-htmlformcontrolscollection-interface:tree-order-3 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>.li>Return that code idthe-htmlformcontrolscollection-interface:radionodelist-6>a href#radionodelist>RadioNodeList/a>/code> object./ol> hr> p>Members of the code idthe-htmlformcontrolscollection-interface:radionodelist-7>a href#radionodelist>RadioNodeList/a>/code> interface inherited from the code idthe-htmlformcontrolscollection-interface:nodelist-2>a data-x-internalnodelist hrefhttps://dom.spec.whatwg.org/#interface-nodelist>NodeList/a>/code> interface must behave as they would on a code idthe-htmlformcontrolscollection-interface:nodelist-3>a data-x-internalnodelist hrefhttps://dom.spec.whatwg.org/#interface-nodelist>NodeList/a>/code> object./p> p>The dfn iddom-radionodelist-value>code>value/code>/dfn> IDL attribute on the code idthe-htmlformcontrolscollection-interface:radionodelist-8>a href#radionodelist>RadioNodeList/a>/code> object, on getting, must return the value returned by running the following steps:/p> ol>li>p>Let var>element/var> be the first element in a idthe-htmlformcontrolscollection-interface:tree-order-4 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> represented by the code idthe-htmlformcontrolscollection-interface:radionodelist-9>a href#radionodelist>RadioNodeList/a>/code> object that is an code idthe-htmlformcontrolscollection-interface:the-input-element>a href#the-input-element>input/a>/code> element whose code idthe-htmlformcontrolscollection-interface:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#radio-button-state-(typeradio) idthe-htmlformcontrolscollection-interface:radio-button-state-(typeradio)>Radio Button/a> state and whose a href#concept-fe-checked idthe-htmlformcontrolscollection-interface: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 idthe-htmlformcontrolscollection-interface: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 idthe-htmlformcontrolscollection-interface:attr-input-value-2>a href#attr-input-value>value/a>/code> attribute./ol> p>On setting, the code idthe-htmlformcontrolscollection-interface:dom-radionodelist-value-2>a href#dom-radionodelist-value>value/a>/code> IDL attribute must run the following steps:/p> ol>li>p>If the new value is the string code>on/code>: let var>element/var> be the first element in a idthe-htmlformcontrolscollection-interface:tree-order-5 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> represented by the code idthe-htmlformcontrolscollection-interface:radionodelist-10>a href#radionodelist>RadioNodeList/a>/code> object that is an code idthe-htmlformcontrolscollection-interface:the-input-element-2>a href#the-input-element>input/a>/code> element whose code idthe-htmlformcontrolscollection-interface:attr-input-type-2>a href#attr-input-type>type/a>/code> attribute is in the a href#radio-button-state-(typeradio) idthe-htmlformcontrolscollection-interface:radio-button-state-(typeradio)-2>Radio Button/a> state and whose code idthe-htmlformcontrolscollection-interface:attr-input-value-3>a href#attr-input-value>value/a>/code> content attribute is either absent, or present and equal to the new value, if any. If no such element exists, then instead let var>element/var> be null./p> p>Otherwise: let var>element/var> be the first element in a idthe-htmlformcontrolscollection-interface:tree-order-6 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> represented by the code idthe-htmlformcontrolscollection-interface:radionodelist-11>a href#radionodelist>RadioNodeList/a>/code> object that is an code idthe-htmlformcontrolscollection-interface:the-input-element-3>a href#the-input-element>input/a>/code> element whose code idthe-htmlformcontrolscollection-interface:attr-input-type-3>a href#attr-input-type>type/a>/code> attribute is in the a href#radio-button-state-(typeradio) idthe-htmlformcontrolscollection-interface:radio-button-state-(typeradio)-3>Radio Button/a> state and whose code idthe-htmlformcontrolscollection-interface:attr-input-value-4>a href#attr-input-value>value/a>/code> content attribute is present and equal to the new value, if any. If no such element exists, then instead let var>element/var> be null.li>p>If var>element/var> is not null, then set its a href#concept-fe-checked idthe-htmlformcontrolscollection-interface:concept-fe-checked-2>checkedness/a> to true./p> /ol> h5 idthe-htmloptionscollection-interface>span classsecno>2.6.2.3/span> The code idthe-htmloptionscollection-interface:htmloptionscollection>a href#htmloptionscollection>HTMLOptionsCollection/a>/code> interfacea href#the-htmloptionscollection-interface classself-link>/a>/h5> p>The code idthe-htmloptionscollection-interface:htmloptionscollection-2>a href#htmloptionscollection>HTMLOptionsCollection/a>/code> interface is used for a hrefhttps://dom.spec.whatwg.org/#concept-collection idthe-htmloptionscollection-interface:concept-collection data-x-internalconcept-collection>collections/a> of code idthe-htmloptionscollection-interface:the-option-element>a href#the-option-element>option/a>/code> elements. It is always rooted on a code idthe-htmloptionscollection-interface:the-select-element>a href#the-select-element>select/a>/code> element and has attributes and methods that manipulate that elements descendants./p> pre classidl>ExposedWindowinterface dfn idhtmloptionscollection>HTMLOptionsCollection/dfn> : a idthe-htmloptionscollection-interface:htmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> { // inherits a hrefhttps://dom.spec.whatwg.org/#dom-htmlcollection-item idthe-htmloptionscollection-interface:dom-htmlcollection-item data-x-internaldom-htmlcollection-item>item/a>(), a hrefhttps://dom.spec.whatwg.org/#dom-htmlcollection-nameditem idthe-htmloptionscollection-interface:dom-htmlcollection-nameditem data-x-internaldom-htmlcollection-nameditem>namedItem/a>() a href#cereactions idthe-htmloptionscollection-interface:cereactions>CEReactions/a> attribute unsigned long a href#dom-htmloptionscollection-length idthe-htmloptionscollection-interface:dom-htmloptionscollection-length>length/a>; // shadows inherited a hrefhttps://dom.spec.whatwg.org/#dom-htmlcollection-length idthe-htmloptionscollection-interface:dom-htmlcollection-length data-x-internaldom-htmlcollection-length>length/a> a href#cereactions idthe-htmloptionscollection-interface:cereactions-2>CEReactions/a> a href#dom-htmloptionscollection-setter>setter/a> void (unsigned long index, a href#htmloptionelement idthe-htmloptionscollection-interface:htmloptionelement>HTMLOptionElement/a>? option); a href#cereactions idthe-htmloptionscollection-interface:cereactions-3>CEReactions/a> void a href#dom-htmloptionscollection-add idthe-htmloptionscollection-interface:dom-htmloptionscollection-add>add/a>((a href#htmloptionelement idthe-htmloptionscollection-interface:htmloptionelement-2>HTMLOptionElement/a> or a href#htmloptgroupelement idthe-htmloptionscollection-interface:htmloptgroupelement>HTMLOptGroupElement/a>) element, optional (a href#htmlelement idthe-htmloptionscollection-interface:htmlelement>HTMLElement/a> or long)? before null); a href#cereactions idthe-htmloptionscollection-interface:cereactions-4>CEReactions/a> void a href#dom-htmloptionscollection-remove idthe-htmloptionscollection-interface:dom-htmloptionscollection-remove>remove/a>(long index); attribute long a href#dom-htmloptionscollection-selectedindex idthe-htmloptionscollection-interface:dom-htmloptionscollection-selectedindex>selectedIndex/a>;};/pre> dl classdomintro>dt>var>collection/var> . code idthe-htmloptionscollection-interface:dom-htmloptionscollection-length-2>a href#dom-htmloptionscollection-length>length/a>/code> var>value/var> dd> p>Returns the number of elements in the collection./p> p>When set to a smaller number, truncates the number of code idthe-htmloptionscollection-interface:the-option-element-2>a href#the-option-element>option/a>/code> elements in the corresponding container./p> p>When set to a greater number, adds new blank code idthe-htmloptionscollection-interface:the-option-element-3>a href#the-option-element>option/a>/code> elements to that container./p> dt>var>element/var> var>collection/var> . code idthe-htmloptionscollection-interface:dom-htmlcollection-item-2>a data-x-internaldom-htmlcollection-item hrefhttps://dom.spec.whatwg.org/#dom-htmlcollection-item>item/a>/code>(var>index/var>)dt>var>element/var> var>collection/var>var>index/var>dd> p>Returns the item with index var>index/var> from the collection. The items are sorted in a idthe-htmloptionscollection-interface:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>./p> dt>var>collection/var>var>index/var> var>element/var>dd> p>When var>index/var> is a greater number than the number of items in the collection, adds new blank code idthe-htmloptionscollection-interface:the-option-element-4>a href#the-option-element>option/a>/code> elements in the corresponding container. p>When set to null, removes the item at index var>index/var> from the collection./p> p>When set to an code idthe-htmloptionscollection-interface:the-option-element-5>a href#the-option-element>option/a>/code> element, adds or replaces it at index var>index/var> from the collection./p> dt>var>element/var> var>collection/var> . code idthe-htmloptionscollection-interface:dom-htmlcollection-nameditem-2>a data-x-internaldom-htmlcollection-nameditem hrefhttps://dom.spec.whatwg.org/#dom-htmlcollection-nameditem>namedItem/a>/code>(var>name/var>)dt>var>element/var> var>collection/var>var>name/var>dd> p>Returns the item with a hrefhttps://dom.spec.whatwg.org/#concept-id idthe-htmloptionscollection-interface:concept-id data-x-internalconcept-id>ID/a> or code idthe-htmloptionscollection-interface:attr-option-name>a href#attr-option-name>name/a>/code> var>name/var> from the collection./p> p>If there are multiple matching items, then the first is returned./p> dt>var>collection/var> . code idthe-htmloptionscollection-interface:dom-htmloptionscollection-add-2>a href#dom-htmloptionscollection-add>add/a>/code>(var>element/var> , var>before/var> )dd> p>Inserts var>element/var> before the node given by var>before/var>./p> p>The var>before/var> argument can be a number, in which case var>element/var> is inserted before the item with that number, or an element from the collection, in which case var>element/var> is inserted before that element./p> p>If var>before/var> is omitted, null, or a number out of range, then var>element/var> will be added at the end of the list./p> p>This method will throw a a idthe-htmloptionscollection-interface:hierarchyrequesterror hrefhttps://heycam.github.io/webidl/#hierarchyrequesterror data-x-internalhierarchyrequesterror>code>HierarchyRequestError/code>/a> code idthe-htmloptionscollection-interface:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if var>element/var> is an ancestor of the element into which it is to be inserted./p> dt>var>collection/var> . code idthe-htmloptionscollection-interface:dom-htmloptionscollection-remove-2>a href#dom-htmloptionscollection-remove>remove/a>/code>(var>index/var>)dd> p>Removes the item with index var>index/var> from the collection./p> dt>var>collection/var> . code idthe-htmloptionscollection-interface:dom-htmloptionscollection-selectedindex-2>a href#dom-htmloptionscollection-selectedindex>selectedIndex/a>/code> var>value/var> dd> p>Returns the index of the first selected item, if any, or −1 if there is no selected item./p> p>Can be set, to change the selection./p> /dl> p>The objects a idthe-htmloptionscollection-interface:supported-property-indices hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a> are as defined for code idthe-htmloptionscollection-interface:htmlcollection-2>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> objects./p> p>On getting, the dfn iddom-htmloptionscollection-length>code>length/code>/dfn> attribute must return the number of nodes a idthe-htmloptionscollection-interface:represented-by-the-collection hrefhttps://dom.spec.whatwg.org/#represented-by-the-collection data-x-internalrepresented-by-the-collection>represented by the collection/a>./p> p>On setting, the behavior depends on whether the new value is equal to, greater than, or less than the number of nodes a idthe-htmloptionscollection-interface:represented-by-the-collection-2 hrefhttps://dom.spec.whatwg.org/#represented-by-the-collection data-x-internalrepresented-by-the-collection>represented by the collection/a> at that time. If the number is the same, then setting the attribute must do nothing. If the new value is greater, then var>n/var> new code idthe-htmloptionscollection-interface:the-option-element-6>a href#the-option-element>option/a>/code> elements with no attributes and no child nodes must be appended to the code idthe-htmloptionscollection-interface:the-select-element-2>a href#the-select-element>select/a>/code> element on which the code idthe-htmloptionscollection-interface:htmloptionscollection-3>a href#htmloptionscollection>HTMLOptionsCollection/a>/code> is rooted, where var>n/var> is the difference between the two numbers (new value minus old value). Mutation events must be fired as if a code idthe-htmloptionscollection-interface:documentfragment>a data-x-internaldocumentfragment hrefhttps://dom.spec.whatwg.org/#interface-documentfragment>DocumentFragment/a>/code> containing the new code idthe-htmloptionscollection-interface:the-option-element-7>a href#the-option-element>option/a>/code> elements had been inserted. If the new value is lower, then the last var>n/var> nodes in the collection must be removed from their parent nodes, where var>n/var> is the difference between the two numbers (old value minus new value)./p> p classnote>Setting code idthe-htmloptionscollection-interface:dom-htmloptionscollection-length-3>a href#dom-htmloptionscollection-length>length/a>/code> never removes or adds any code idthe-htmloptionscollection-interface:the-optgroup-element>a href#the-optgroup-element>optgroup/a>/code> elements, and never adds new children to existing code idthe-htmloptionscollection-interface:the-optgroup-element-2>a href#the-optgroup-element>optgroup/a>/code> elements (though it can remove children from them)./p> p>The a idthe-htmloptionscollection-interface:supported-property-names hrefhttps://heycam.github.io/webidl/#dfn-supported-property-names data-x-internalsupported-property-names>supported property names/a> consist of the non-empty values of all the code idthe-htmloptionscollection-interface:the-id-attribute>a href#the-id-attribute>id/a>/code> and code idthe-htmloptionscollection-interface:attr-option-name-2>a href#attr-option-name>name/a>/code> attributes of all the elements a idthe-htmloptionscollection-interface:represented-by-the-collection-3 hrefhttps://dom.spec.whatwg.org/#represented-by-the-collection data-x-internalrepresented-by-the-collection>represented by the collection/a>, in a idthe-htmloptionscollection-interface:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>, ignoring later duplicates, with the code idthe-htmloptionscollection-interface:the-id-attribute-2>a href#the-id-attribute>id/a>/code> of an element preceding its code idthe-htmloptionscollection-interface:attr-option-name-3>a href#attr-option-name>name/a>/code> if it contributes both, they differ from each other, and neither is the duplicate of an earlier entry./p> p iddom-htmloptionscollection-setter>When the user agent is to a idthe-htmloptionscollection-interface:set-the-value-of-a-new-indexed-property hrefhttps://heycam.github.io/webidl/#dfn-set-the-value-of-a-new-indexed-property data-x-internalset-the-value-of-a-new-indexed-property>set the value of a new indexed property/a> or a idthe-htmloptionscollection-interface:set-the-value-of-an-existing-indexed-property hrefhttps://heycam.github.io/webidl/#dfn-set-the-value-of-an-existing-indexed-property data-x-internalset-the-value-of-an-existing-indexed-property>set the value of an existing indexed property/a> for a given property index var>index/var> to a new value var>value/var>, it must run the following algorithm:/p> ol>li>p>If var>value/var> is null, invoke the steps for the code idthe-htmloptionscollection-interface:dom-htmloptionscollection-remove-3>a href#dom-htmloptionscollection-remove>remove/a>/code> method with var>index/var> as the argument, and abort these steps.li>p>Let var>length/var> be the number of nodes a idthe-htmloptionscollection-interface:represented-by-the-collection-4 hrefhttps://dom.spec.whatwg.org/#represented-by-the-collection data-x-internalrepresented-by-the-collection>represented by the collection/a>.li>p>Let var>n/var> be var>index/var> minus var>length/var>.li>p>If var>n/var> is greater than zero, then a hrefhttps://dom.spec.whatwg.org/#concept-node-append idthe-htmloptionscollection-interface:concept-node-append data-x-internalconcept-node-append>append/a> a code idthe-htmloptionscollection-interface:documentfragment-2>a data-x-internaldocumentfragment hrefhttps://dom.spec.whatwg.org/#interface-documentfragment>DocumentFragment/a>/code> consisting of span>var>n/var>-1/span> new code idthe-htmloptionscollection-interface:the-option-element-8>a href#the-option-element>option/a>/code> elements with no attributes and no child nodes to the code idthe-htmloptionscollection-interface:the-select-element-3>a href#the-select-element>select/a>/code> element on which the code idthe-htmloptionscollection-interface:htmloptionscollection-4>a href#htmloptionscollection>HTMLOptionsCollection/a>/code> is rooted.li>p>If var>n/var> is greater than or equal to zero, a hrefhttps://dom.spec.whatwg.org/#concept-node-append idthe-htmloptionscollection-interface:concept-node-append-2 data-x-internalconcept-node-append>append/a> var>value/var> to the code idthe-htmloptionscollection-interface:the-select-element-4>a href#the-select-element>select/a>/code> element. Otherwise, a hrefhttps://dom.spec.whatwg.org/#concept-node-replace idthe-htmloptionscollection-interface:concept-node-replace data-x-internalconcept-node-replace>replace/a> the var>index/var>th element in the collection by var>value/var>./ol> p>The dfn iddom-htmloptionscollection-add>code>add(var>element/var>, var>before/var>)/code>/dfn> method must act according to the following algorithm:/p> ol>li>p>If var>element/var> is an ancestor of the code idthe-htmloptionscollection-interface:the-select-element-5>a href#the-select-element>select/a>/code> element on which the code idthe-htmloptionscollection-interface:htmloptionscollection-5>a href#htmloptionscollection>HTMLOptionsCollection/a>/code> is rooted, then throw a a idthe-htmloptionscollection-interface:hierarchyrequesterror-2 hrefhttps://heycam.github.io/webidl/#hierarchyrequesterror data-x-internalhierarchyrequesterror>code>HierarchyRequestError/code>/a> code idthe-htmloptionscollection-interface:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>If var>before/var> is an element, but that element isnt a descendant of the code idthe-htmloptionscollection-interface:the-select-element-6>a href#the-select-element>select/a>/code> element on which the code idthe-htmloptionscollection-interface:htmloptionscollection-6>a href#htmloptionscollection>HTMLOptionsCollection/a>/code> is rooted, then throw a a idthe-htmloptionscollection-interface:notfounderror hrefhttps://heycam.github.io/webidl/#notfounderror data-x-internalnotfounderror>code>NotFoundError/code>/a> code idthe-htmloptionscollection-interface:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>If var>element/var> and var>before/var> are the same element, then return and abort these steps.li>p>If var>before/var> is a node, then let var>reference/var> be that node. Otherwise, if var>before/var> is an integer, and there is a var>before/var>th node in the collection, let var>reference/var> be that node. Otherwise, let var>reference/var> be null.li>p>If var>reference/var> is not null, let var>parent/var> be the parent node of var>reference/var>. Otherwise, let var>parent/var> be the code idthe-htmloptionscollection-interface:the-select-element-7>a href#the-select-element>select/a>/code> element on which the code idthe-htmloptionscollection-interface:htmloptionscollection-7>a href#htmloptionscollection>HTMLOptionsCollection/a>/code> is rooted.li>p>a idthe-htmloptionscollection-interface:pre-insert hrefhttps://dom.spec.whatwg.org/#concept-node-pre-insert data-x-internalpre-insert>Pre-insert/a> var>element/var> into var>parent/var> node before var>reference/var>./p> /ol> p>The dfn iddom-htmloptionscollection-remove>code>remove(var>index/var>)/code>/dfn> method must act according to the following algorithm:/p> ol>li>p>If the number of nodes a idthe-htmloptionscollection-interface:represented-by-the-collection-5 hrefhttps://dom.spec.whatwg.org/#represented-by-the-collection data-x-internalrepresented-by-the-collection>represented by the collection/a> is zero, abort these steps.li>p>If var>index/var> is not a number greater than or equal to 0 and less than the number of nodes a idthe-htmloptionscollection-interface:represented-by-the-collection-6 hrefhttps://dom.spec.whatwg.org/#represented-by-the-collection data-x-internalrepresented-by-the-collection>represented by the collection/a>, abort these steps.li>p>Let var>element/var> be the var>index/var>th element in the collection.li>p>Remove var>element/var> from its parent node./ol> p>The dfn iddom-htmloptionscollection-selectedindex>code>selectedIndex/code>/dfn> IDL attribute must act like the identically named attribute on the code idthe-htmloptionscollection-interface:the-select-element-8>a href#the-select-element>select/a>/code> element on which the code idthe-htmloptionscollection-interface:htmloptionscollection-8>a href#htmloptionscollection>HTMLOptionsCollection/a>/code> is rooted/p> h4 idthe-domstringlist-interface>span classsecno>2.6.3/span> The code idthe-domstringlist-interface:domstringlist>a href#domstringlist>DOMStringList/a>/code> interfacea href#the-domstringlist-interface classself-link>/a>/h4> p>The code idthe-domstringlist-interface:domstringlist-2>a href#domstringlist>DOMStringList/a>/code> interface is a non-fashionable retro way of representing a list of strings./p> pre classidl>Exposed(Window,Worker)interface dfn iddomstringlist>DOMStringList/dfn> { readonly attribute unsigned long a href#dom-domstringlist-length idthe-domstringlist-interface:dom-domstringlist-length>length/a>; getter DOMString? a href#dom-domstringlist-item idthe-domstringlist-interface:dom-domstringlist-item>item/a>(unsigned long index); boolean a href#dom-domstringlist-contains idthe-domstringlist-interface:dom-domstringlist-contains>contains/a>(DOMString string);};/pre> p classwarning>New APIs must use code>sequence<DOMString>/code> or equivalent rather than code idthe-domstringlist-interface:domstringlist-3>a href#domstringlist>DOMStringList/a>/code>./p> dl classdomintro>dt>var>strings/var> . code idthe-domstringlist-interface:dom-domstringlist-length-2>a href#dom-domstringlist-length>length/a>/code>dd>p>Returns the number of strings in var>strings/var>.dt>var>strings/var>var>index/var>dt>var>strings/var> . code idthe-domstringlist-interface:dom-domstringlist-item-2>a href#dom-domstringlist-item>item/a>/code>(var>index/var>)dd>p>Returns the string with index var>index/var> from var>strings/var>.dt>var>strings/var> . code idthe-domstringlist-interface:dom-domstringlist-contains-2>a href#dom-domstringlist-contains>contains/a>/code>(var>string/var>)dd>p>Returns true if var>strings/var> contains var>string/var>, and false otherwise./dl> p>Each code idthe-domstringlist-interface:domstringlist-4>a href#domstringlist>DOMStringList/a>/code> object has an associated a idthe-domstringlist-interface:list hrefhttps://infra.spec.whatwg.org/#list data-x-internallist>list/a>./p> p>The a idthe-domstringlist-interface:supported-property-indices hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a> for a code idthe-domstringlist-interface:domstringlist-5>a href#domstringlist>DOMStringList/a>/code> object are the numbers zero to the associated lists a hrefhttps://infra.spec.whatwg.org/#list-size idthe-domstringlist-interface:list-size data-x-internallist-size>size/a> minus one. If its associated list a hrefhttps://infra.spec.whatwg.org/#list-is-empty idthe-domstringlist-interface:list-is-empty data-x-internallist-is-empty>is empty/a>, it has no a idthe-domstringlist-interface:supported-property-indices-2 hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a>./p> p>The dfn iddom-domstringlist-length>code>length/code>/dfn> attributes getter must return this code idthe-domstringlist-interface:domstringlist-6>a href#domstringlist>DOMStringList/a>/code> objects associated lists a hrefhttps://infra.spec.whatwg.org/#list-size idthe-domstringlist-interface:list-size-2 data-x-internallist-size>size/a>./p> p>The dfn iddom-domstringlist-item>code>item(var>index/var>)/code>/dfn> method, when invoked, must return the var>index/var>th item in this code idthe-domstringlist-interface:domstringlist-7>a href#domstringlist>DOMStringList/a>/code> objects associated list, or null if var>index/var> plus one is greater than this code idthe-domstringlist-interface:domstringlist-8>a href#domstringlist>DOMStringList/a>/code> objects associated lists a hrefhttps://infra.spec.whatwg.org/#list-size idthe-domstringlist-interface:list-size-3 data-x-internallist-size>size/a>./p> p>The dfn iddom-domstringlist-contains>code>contains(var>string/var>)/code>/dfn> method, when invoked, must return true if this code idthe-domstringlist-interface:domstringlist-9>a href#domstringlist>DOMStringList/a>/code> objects associated list a hrefhttps://infra.spec.whatwg.org/#list-contain idthe-domstringlist-interface:list-contains data-x-internallist-contains>contains/a> var>string/var>, and false otherwise./p> h4 idgarbage-collection>span classsecno>2.6.4/span> Garbage collectiona href#garbage-collection classself-link>/a>/h4> p>There is an dfn idimplied-strong-reference>implied strong reference/dfn> from any IDL attribute that returns a pre-existing object to that object./p> div classexample> p>For example, the code idgarbage-collection:dom-document-2>a href#dom-document-2>window.document/a>/code> attribute means that there is a strong reference from a code idgarbage-collection:window>a href#window>Window/a>/code> object to its code idgarbage-collection:document>a href#document>Document/a>/code> object. Similarly, there is always a strong reference from a code idgarbage-collection:document-2>a href#document>Document/a>/code> to any descendant nodes, and from any node to its a idgarbage-collection:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>./p> /div> h3 idsafe-passing-of-structured-data>span classsecno>2.7/span> Safe passing of structured dataa href#safe-passing-of-structured-data classself-link>/a>/h3> p>This section uses the terminology and typographic conventions from the JavaScript specification. a href#refsJAVASCRIPT>JAVASCRIPT/a>/p> h4 idserializable-objects>span classsecno>2.7.1/span> dfn>Serializable objects/dfn>a href#serializable-objects classself-link>/a>/h4> p>a href#serializable-objects idserializable-objects:serializable-objects>Serializable objects/a> support being serialized, and later deserialized, in a way that is independent of any given a idserializable-objects:javascript-realm hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript Realm/a>. This allows them to be stored on disk and later restored, or cloned across document and worker boundaries (including across documents of different a href#concept-origin idserializable-objects:concept-origin>origins/a> or in different a href#event-loop idserializable-objects:event-loop>event loops/a>)./p> p>Not all objects are a href#serializable-objects idserializable-objects:serializable-objects-2>serializable objects/a>, and not all aspects of objects that are a href#serializable-objects idserializable-objects:serializable-objects-3>serializable objects/a> are necessarily preserved when they are serialized./p> p>a hrefhttps://heycam.github.io/webidl/#dfn-platform-object idserializable-objects:platform-object data-x-internalplatform-object>Platform objects/a> can be a href#serializable-objects idserializable-objects:serializable-objects-4>serializable objects/a> if they implement only interfaces decorated with the dfn idserializable data-dfn-typeextended-attribute data-ltSerializable data-export>code>Serializable/code>/dfn> IDL a idserializable-objects:extended-attribute hrefhttps://heycam.github.io/webidl/#dfn-extended-attribute data-x-internalextended-attribute>extended attribute/a>. Such interfaces must also define the following algorithms:/p> dl>dt>dfn idserialization-steps data-export>serialization steps/dfn>, taking a a idserializable-objects:platform-object-2 hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a> var>value/var>, a a idserializable-objects:record hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type data-x-internalrecord>Record/a> var>serialized/var>, and a boolean var>forStorage/var>dd> p>A set of steps that serializes the data in var>value/var> into fields of var>serialized/var>. The resulting data serialized into var>serialized/var> must be independent of any a idserializable-objects:javascript-realm-2 hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript Realm/a>./p> p>These steps may throw an exception if serialization is not possible./p> p>These steps may perform a a href#sub-serialization idserializable-objects:sub-serialization>sub-serialization/a> to serialize nested data structures. They should not call a href#structuredserialize idserializable-objects:structuredserialize>StructuredSerialize/a> directly, as doing so will omit the important var>memory/var> argument./p> p>The introduction of these steps should omit mention of the var>forStorage/var> argument if it is not relevant to the algorithm./p> dt>dfn iddeserialization-steps data-export>deserialization steps/dfn>, taking a a idserializable-objects:record-2 hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type data-x-internalrecord>Record/a> var>serialized/var> and a a idserializable-objects:platform-object-3 hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a> var>value/var>dd> p>A set of steps that deserializes the data in var>serialized/var>, using it to set up var>value/var> as appropriate. var>value/var> will be a newly-created instance of the a idserializable-objects:platform-object-4 hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a> type in question, with none of its internal data set up; setting that up is the job of these steps./p> p>These steps may throw an exception if deserialization is not possible./p> p>These steps may perform a a href#sub-deserialization idserializable-objects:sub-deserialization>sub-deserialization/a> to deserialize nested data structures. They should not call a href#structureddeserialize idserializable-objects:structureddeserialize>StructuredDeserialize/a> directly, as doing so will omit the important var>targetRealm/var> and var>memory/var> arguments./p> /dl> p>It is up to the definition of individual platform objects to determine what data is serialized and deserialized by these steps. Typically the steps are very symmetric./p> p>The code idserializable-objects:serializable>a href#serializable>Serializable/a>/code> extended attribute must take no arguments, and must not appear on anything other than an interface. It must appear only once on an interface. It must not be used on a callback interface. If it appears on a partial interface or an interface that is really a mixin, then it must also appear on the original or mixed-in-to interface, and any supplied a href#serialization-steps idserializable-objects:serialization-steps>serialization steps/a> and a href#deserialization-steps idserializable-objects:deserialization-steps>deserialization steps/a> for the partial interface or mixin should be understood as being appended to those of the original or mixed-in-to interface./p> div classexample> p>Lets say we were defining a platform object code>Person/code>, which had associated with it two pieces of associated data:/p> ul classbrief>li>a name value, which is a string;li>and a best friend value, which is either another code>Person/code> instance or null/ul> p>We could then define code>Person/code> instances to be a href#serializable-objects idserializable-objects:serializable-objects-5>serializable objects/a> by annotating the code>Person/code> interface with the code idserializable-objects:serializable-2>a href#serializable>Serializable/a>/code> a idserializable-objects:extended-attribute-2 hrefhttps://heycam.github.io/webidl/#dfn-extended-attribute data-x-internalextended-attribute>extended attribute/a>, and defining the following accompanying algorithms:/p> dl>dt>a href#serialization-steps idserializable-objects:serialization-steps-2>serialization steps/a>dd> ol>li>p>Set var>serialized/var>.Name to var>value/var>s associated name value.li>p>Let var>serializedBestFriend/var> be the a href#sub-serialization idserializable-objects:sub-serialization-2>sub-serialization/a> of var>value/var>s associated best friend value.li>p>Set var>serialized/var>.BestFriend to var>serializedBestFriend/var>./ol> dt>a href#deserialization-steps idserializable-objects:deserialization-steps-2>deserialization steps/a>dd> ol>li>p>Set var>value/var>s associated name value to var>serialized/var>.Name.li>p>Let var>deserializedBestFriend/var> be the a href#sub-deserialization idserializable-objects:sub-deserialization-2>sub-deserialization/a> of var>serialized/var>.BestFriend.li>p>Set var>value/var>s associated best friend value to var>deserializedBestFriend/var>./ol> /dl> /div> p>Objects defined in the JavaScript specification are handled by the a href#structuredserialize idserializable-objects:structuredserialize-2>StructuredSerialize/a> abstract operation directly./p> p idcloneable-objects classnote>Originally, this specification defined the concept of cloneable objects, which could be cloned from one a idserializable-objects:javascript-realm-3 hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript Realm/a> to another. However, to better specify the behavior of certain more complex situations, the model was updated to make the serialization and deserialization explicit./p> h4 idtransferable-objects data-lttransferable object data-export>span classsecno>2.7.2/span> dfn>Transferable objects/dfn>a href#transferable-objects classself-link>/a>/h4> p>a href#transferable-objects idtransferable-objects:transferable-objects>Transferable objects/a> support being transferred across a href#event-loop idtransferable-objects:event-loop>event loops/a>. Transferring is effectively recreating the object while sharing a reference to the underlying data and then detaching the object being transferred. This is useful to transfer ownership of expensive resources. Not all objects are a href#transferable-objects idtransferable-objects:transferable-objects-2>transferable objects/a> and not all aspects of objects that are a href#transferable-objects idtransferable-objects:transferable-objects-3>transferable objects/a> are necessarily preserved when transferred./p> p classnote>Transferring is an irreversible and non-idempotent operation. Once an object has been transferred, it cannot be transferred, or indeed used, again./p> p>a hrefhttps://heycam.github.io/webidl/#dfn-platform-object idtransferable-objects:platform-object data-x-internalplatform-object>Platform objects/a> can be a href#transferable-objects idtransferable-objects:transferable-objects-4>transferable objects/a> if they implement only interfaces decorated with the dfn idtransferable data-dfn-typeextended-attribute data-ltTransferable data-export>code>Transferable/code>/dfn> IDL a idtransferable-objects:extended-attribute hrefhttps://heycam.github.io/webidl/#dfn-extended-attribute data-x-internalextended-attribute>extended attribute/a>. Such interfaces must also define the following algorithms:/p> dl>dt>dfn idtransfer-steps data-export>transfer steps/dfn>, taking a a idtransferable-objects:platform-object-2 hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a> var>value/var> and a a idtransferable-objects:record hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type data-x-internalrecord>Record/a> var>dataHolder/var>dd> p>A set of steps that transfers the data in var>value/var> into fields of var>dataHolder/var>. The resulting data held in var>dataHolder/var> must be independent of any a idtransferable-objects:javascript-realm hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript Realm/a>./p> p>These steps may throw an exception if transferral is not possible./p> dt>dfn idtransfer-receiving-steps data-export>transfer-receiving steps/dfn>, taking a a idtransferable-objects:record-2 hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type data-x-internalrecord>Record/a> var>dataHolder/var> and a a idtransferable-objects:platform-object-3 hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a> var>value/var>dd> p>A set of steps that receives the data in var>dataHolder/var>, using it to set up var>value/var> as appropriate. var>value/var> will be a newly-created instance of the a idtransferable-objects:platform-object-4 hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a> type in question, with none of its internal data set up; setting that up is the job of these steps./p> p>These steps may throw an exception if it is not possible to receive the transfer./p> /dl> p>It is up to the definition of individual platform objects to determine what data is transferred by these steps. Typically the steps are very symmetric./p> p>The code idtransferable-objects:transferable>a href#transferable>Transferable/a>/code> extended attribute must take no arguments, and must not appear on anything other than an interface. It must appear only once on an interface. It must not be used on a callback interface. If it appears on a partial interface or an interface that is really a mixin, then it must also appear on the original or mixed-in-to interface, and any supplied a href#serialization-steps idtransferable-objects:serialization-steps>serialization steps/a> and a href#deserialization-steps idtransferable-objects:deserialization-steps>deserialization steps/a> for the partial interface or mixin should be understood as being appended to those of the original or mixed-in-to interface./p> p>a hrefhttps://heycam.github.io/webidl/#dfn-platform-object idtransferable-objects:platform-object-5 data-x-internalplatform-object>Platform objects/a> that are a href#transferable-objects idtransferable-objects:transferable-objects-5>transferable objects/a> have a dfn data-dfn-forplatform object iddetached data-dfn-typeattribute data-export>Detached/dfn> internal slot. This is used to ensure that once a platform object has been transferred, it cannot be transferred again./p> p>Objects defined in the JavaScript specification are handled by the a href#structuredserializewithtransfer idtransferable-objects:structuredserializewithtransfer>StructuredSerializeWithTransfer/a> abstract operation directly./p> h4 idstructuredserializeinternal data-dfn-typeabstract-op data-noexport data-ltStructuredSerializeInternal>span classsecno>2.7.3/span> dfn>StructuredSerializeInternal/dfn> ( var>value/var>, var>forStorage/var> , var>memory/var> )a href#structuredserializeinternal classself-link>/a>/h4> p>The a href#structuredserializeinternal idstructuredserializeinternal:structuredserializeinternal>StructuredSerializeInternal/a> abstract operation takes as input a JavaScript value var>value/var> and serializes it to a a hrefhttps://tc39.github.io/ecma262/#sec-code-realms idstructuredserializeinternal:javascript-realm data-x-internaljavascript-realm>Realm/a>-independent form, represented here as a a idstructuredserializeinternal:record hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type data-x-internalrecord>Record/a>. This serialized form has all the information necessary to later deserialize into a new JavaScript value in a different Realm./p> p>This process can throw an exception, for example when trying to serialize un-serializable objects./p> ol>li> p>If var>memory/var> was not supplied, let var>memory/var> be an empty a hrefhttps://infra.spec.whatwg.org/#ordered-map idstructuredserializeinternal:ordered-map data-x-internalordered-map>map/a>./p> p classnote>The purpose of the var>memory/var> map is to avoid serializing objects twice. This ends up preserving cycles and the identity of duplicate objects in graphs./p> li>p>If var>memory/var>var>value/var> a hrefhttps://infra.spec.whatwg.org/#map-exists idstructuredserializeinternal:map-exists data-x-internalmap-exists>exists/a>, then return var>memory/var>var>value/var>.li>p>Let var>deep/var> be false.li>p>If a hrefhttps://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values idstructuredserializeinternal:js-type data-x-internaljs-type>Type/a>(var>value/var>) is Undefined, Null, Boolean, String, or Number, then return { Type: primitive, Value: var>value/var> }.li>p>If a hrefhttps://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values idstructuredserializeinternal:js-type-2 data-x-internaljs-type>Type/a>(var>value/var>) is Symbol, then throw a a idstructuredserializeinternal:datacloneerror hrefhttps://heycam.github.io/webidl/#datacloneerror data-x-internaldatacloneerror>code>DataCloneError/code>/a> code idstructuredserializeinternal:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Let var>serialized/var> be an uninitialized value.li>p>If var>value/var> has a BooleanData internal slot, then set var>serialized/var> to { Type: Boolean, BooleanData: var>value/var>.BooleanData }.li>p>Otherwise, if var>value/var> has a NumberData internal slot, then set var>serialized/var> to { Type: Number, NumberData: var>value/var>.NumberData }.li>p>Otherwise, if var>value/var> has a StringData internal slot, then set var>serialized/var> to { Type: String, StringData: var>value/var>.StringData }.li>p>Otherwise, if var>value/var> has a DateValue internal slot, then set var>serialized/var> to { Type: Date, DateValue: var>value/var>.DateValue }.li>p>Otherwise, if var>value/var> has a RegExpMatcher internal slot, then set var>serialized/var> to { Type: RegExp, RegExpMatcher: var>value/var>.RegExpMatcher, OriginalSource: var>value/var>.OriginalSource, OriginalFlags: var>value/var>.OriginalFlags }.li> p>Otherwise, if var>value/var> has an ArrayBufferData internal slot, then:/p> ol>li>p>Let var>size/var> be var>value/var>.ArrayBufferByteLength.li> p>If ! a idstructuredserializeinternal:issharedarraybuffer hrefhttps://tc39.github.io/ecma262/#sec-issharedarraybuffer data-x-internalissharedarraybuffer>IsSharedArrayBuffer/a>(var>value/var>) is true, then: ol>li>p>If var>forStorage/var> is true, then throw a a idstructuredserializeinternal:datacloneerror-2 hrefhttps://heycam.github.io/webidl/#datacloneerror data-x-internaldatacloneerror>code>DataCloneError/code>/a> code idstructuredserializeinternal:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Set var>serialized/var> to { Type: SharedArrayBuffer, ArrayBufferData: var>value/var>.ArrayBufferData, ArrayBufferByteLength: var>size/var>, AgentCluster: the a idstructuredserializeinternal:current-realm-record hrefhttps://tc39.github.io/ecma262/#current-realm data-x-internalcurrent-realm-record>current Realm Record/a>s corresponding a idstructuredserializeinternal:agent-cluster hrefhttps://tc39.github.io/ecma262/#sec-agent-clusters data-x-internalagent-cluster>agent cluster/a> }./ol> li> p>Otherwise:/p> ol>li>p>If ! a idstructuredserializeinternal:isdetachedbuffer hrefhttps://tc39.github.io/ecma262/#sec-isdetachedbuffer data-x-internalisdetachedbuffer>IsDetachedBuffer/a>(var>value/var>) is true, then throw a a idstructuredserializeinternal:datacloneerror-3 hrefhttps://heycam.github.io/webidl/#datacloneerror data-x-internaldatacloneerror>code>DataCloneError/code>/a> code idstructuredserializeinternal:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li> p>Let var>dataCopy/var> be ? a idstructuredserializeinternal:createbytedatablock hrefhttps://tc39.github.io/ecma262/#sec-createbytedatablock data-x-internalcreatebytedatablock>CreateByteDataBlock/a>(var>size/var>)./p> p classnote>This can throw a code idstructuredserializeinternal:js-rangeerror>a data-x-internaljs-rangeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-rangeerror>RangeError/a>/code> exception upon allocation failure./p> li>p>Perform ! a idstructuredserializeinternal:copydatablockbytes hrefhttps://tc39.github.io/ecma262/#sec-copydatablockbytes data-x-internalcopydatablockbytes>CopyDataBlockBytes/a>(var>dataCopy/var>, 0, var>value/var>.ArrayBufferData, 0, var>size/var>).li>p>Set var>serialized/var> to { Type: ArrayBuffer, ArrayBufferData: var>dataCopy/var>, ArrayBufferByteLength: var>size/var> }./ol> /ol> li> p>Otherwise, if var>value/var> has a ViewedArrayBuffer internal slot, then:/p> ol>li>p>Let var>buffer/var> be the value of var>value/var>s ViewedArrayBuffer internal slot.li>p>Let var>bufferSerialized/var> be ? a href#structuredserializeinternal idstructuredserializeinternal:structuredserializeinternal-2>StructuredSerializeInternal/a>(var>buffer/var>, var>forStorage/var>, var>memory/var>).li>p>Assert: var>bufferSerialized/var>.Type is ArrayBuffer.li>p>If var>value/var> has a DataView internal slot, then set var>serialized/var> to { Type: ArrayBufferView, Constructor: DataView, ArrayBufferSerialized: var>bufferSerialized/var>, ByteLength: var>value/var>.ByteLength, ByteOffset: var>value/var>.ByteOffset }.li> p>Otherwise:/p> ol>li>p>Assert: var>value/var> has a TypedArrayName internal slot.li>p>Set var>serialized/var> to { Type: ArrayBufferView, Constructor: var>value/var>.TypedArrayName, ArrayBufferSerialized: var>bufferSerialized/var>, ByteLength: var>value/var>.ByteLength, ByteOffset: var>value/var>.ByteOffset, ArrayLength: var>value/var>.ArrayLength }./ol> /ol> li> p>Otherwise, if var>value/var> has MapData internal slot, then:/p> ol>li>p>Set var>serialized/var> to { Type: Map, MapData: a new empty a hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type idstructuredserializeinternal:js-list data-x-internaljs-list>List/a> }.li>p>Set var>deep/var> to true./ol> li> p>Otherwise, if var>value/var> has SetData internal slot, then:/p> ol>li>p>Set var>serialized/var> to { Type: Set, SetData: a new empty a hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type idstructuredserializeinternal:js-list-2 data-x-internaljs-list>List/a> }.li>p>Set var>deep/var> to true./ol> li> p>Otherwise, if var>value/var> is an Array exotic object, then:/p> ol>li>p>Let var>valueLenDescriptor/var> be ? a idstructuredserializeinternal:ordinarygetownproperty hrefhttps://tc39.github.io/ecma262/#sec-ordinarygetownproperty data-x-internalordinarygetownproperty>OrdinaryGetOwnProperty/a>(var>value/var>, code>length/code>).li>p>Let var>valueLen/var> be var>valueLenDescriptor/var>.Value.li>p>Set var>serialized/var> to { Type: Array, Length: var>valueLen/var>, Properties: a new empty a hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type idstructuredserializeinternal:js-list-3 data-x-internaljs-list>List/a> }.li>p>Set var>deep/var> to true./ol> li> p>Otherwise, if var>value/var> is a a idstructuredserializeinternal:platform-object hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a> that is a a href#serializable-objects idstructuredserializeinternal:serializable-objects>serializable object/a>:/p> ol>li>p>If var>value/var> has a a href#detached idstructuredserializeinternal:detached>Detached/a> internal slot whose value is true, then throw a a idstructuredserializeinternal:datacloneerror-4 hrefhttps://heycam.github.io/webidl/#datacloneerror data-x-internaldatacloneerror>code>DataCloneError/code>/a> code idstructuredserializeinternal:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Let var>typeString/var> be the identifier of the a idstructuredserializeinternal:primary-interface hrefhttps://heycam.github.io/webidl/#dfn-primary-interface data-x-internalprimary-interface>primary interface/a> of var>value/var>.li>p>Set var>serialized/var> to { Type: var>typeString/var> }.li>p>Set var>deep/var> to true./ol> li>p>Otherwise, if var>value/var> is a a idstructuredserializeinternal:platform-object-2 hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a>, then throw a a idstructuredserializeinternal:datacloneerror-5 hrefhttps://heycam.github.io/webidl/#datacloneerror data-x-internaldatacloneerror>code>DataCloneError/code>/a> code idstructuredserializeinternal:domexception-5>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Otherwise, if a idstructuredserializeinternal:iscallable hrefhttps://tc39.github.io/ecma262/#sec-iscallable data-x-internaliscallable>IsCallable/a>(var>value/var>) is true, then throw a a idstructuredserializeinternal:datacloneerror-6 hrefhttps://heycam.github.io/webidl/#datacloneerror data-x-internaldatacloneerror>code>DataCloneError/code>/a> code idstructuredserializeinternal:domexception-6>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li> p>Otherwise, if var>value/var> has any internal slot other than Prototype or Extensible, then throw a a idstructuredserializeinternal:datacloneerror-7 hrefhttps://heycam.github.io/webidl/#datacloneerror data-x-internaldatacloneerror>code>DataCloneError/code>/a> code idstructuredserializeinternal:domexception-7>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> p classexample>For instance, a PromiseState or WeakMapData internal slot./p> li> p>Otherwise, if var>value/var> is an exotic object, then throw a a idstructuredserializeinternal:datacloneerror-8 hrefhttps://heycam.github.io/webidl/#datacloneerror data-x-internaldatacloneerror>code>DataCloneError/code>/a> code idstructuredserializeinternal:domexception-8>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> p classexample>For instance, a proxy object./p> li> p>Otherwise:/p> ol>li>p>Set var>serialized/var> to { Type: Object, Properties: a new empty a hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type idstructuredserializeinternal:js-list-4 data-x-internaljs-list>List/a> }.li>p>Set var>deep/var> to true./ol> li>p>a hrefhttps://infra.spec.whatwg.org/#map-set idstructuredserializeinternal:map-set data-x-internalmap-set>Set/a> var>memory/var>var>value/var> to var>serialized/var>.li> p>If var>deep/var> is true, then:/p> ol>li> p>If var>value/var> has a MapData internal slot, then: ol>li>p>Let var>copiedList/var> be a new empty a hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type idstructuredserializeinternal:js-list-5 data-x-internaljs-list>List/a>. li> p>a hrefhttps://infra.spec.whatwg.org/#list-iterate idstructuredserializeinternal:list-iterate data-x-internallist-iterate>For each/a> a idstructuredserializeinternal:record-2 hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type data-x-internalrecord>Record/a> { Key, Value } var>entry/var> of var>value/var>.MapData:/p> ol>li>p>Let var>copiedEntry/var> be a new a idstructuredserializeinternal:record-3 hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type data-x-internalrecord>Record/a> { Key: var>entry/var>.Key, Value: var>entry/var>.Value }.li>p>If var>copiedEntry/var>.Key is not the special value i>empty/i>, a hrefhttps://infra.spec.whatwg.org/#list-append idstructuredserializeinternal:list-append data-x-internallist-append>append/a> var>copiedEntry/var> to var>copiedList/var>./ol> li> p>a hrefhttps://infra.spec.whatwg.org/#list-iterate idstructuredserializeinternal:list-iterate-2 data-x-internallist-iterate>For each/a> a idstructuredserializeinternal:record-4 hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type data-x-internalrecord>Record/a> { Key, Value } var>entry/var> of var>copiedList/var>:/p> ol>li>p>Let var>serializedKey/var> be ? a href#structuredserializeinternal idstructuredserializeinternal:structuredserializeinternal-3>StructuredSerializeInternal/a>(var>entry/var>.Key, var>forStorage/var>, var>memory/var>).li>p>Let var>serializedValue/var> be ? a href#structuredserializeinternal idstructuredserializeinternal:structuredserializeinternal-4>StructuredSerializeInternal/a>(var>entry/var>.Value, var>forStorage/var>, var>memory/var>).li>p>a hrefhttps://infra.spec.whatwg.org/#list-append idstructuredserializeinternal:list-append-2 data-x-internallist-append>Append/a> { Key: var>serializedKey/var>, Value: var>serializedValue/var> } to var>serialized/var>.MapData./ol> /ol> li> p>Otherwise, if var>value/var> has a SetData internal slot, then:/p> ol>li>p>Let var>copiedList/var> be a new empty a hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type idstructuredserializeinternal:js-list-6 data-x-internaljs-list>List/a>. li> p>a hrefhttps://infra.spec.whatwg.org/#list-iterate idstructuredserializeinternal:list-iterate-3 data-x-internallist-iterate>For each/a> var>entry/var> of var>value/var>.SetData:/p> ol>li>p>If var>entry/var> is not the special value i>empty/i>, a hrefhttps://infra.spec.whatwg.org/#list-append idstructuredserializeinternal:list-append-3 data-x-internallist-append>append/a> var>entry/var> to var>copiedList/var>./ol> li> p>a hrefhttps://infra.spec.whatwg.org/#list-iterate idstructuredserializeinternal:list-iterate-4 data-x-internallist-iterate>For each/a> var>entry/var> of var>copiedList/var>:/p> ol>li>p>Let var>serializedEntry/var> be ? a href#structuredserializeinternal idstructuredserializeinternal:structuredserializeinternal-5>StructuredSerializeInternal/a>(var>entry/var>, var>forStorage/var>, var>memory/var>).li>p>a hrefhttps://infra.spec.whatwg.org/#list-append idstructuredserializeinternal:list-append-4 data-x-internallist-append>Append/a> var>serializedEntry/var> to var>serialized/var>.SetData./ol> /ol> li> p>Otherwise, if var>value/var> is a a idstructuredserializeinternal:platform-object-3 hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a> that is a a href#serializable-objects idstructuredserializeinternal:serializable-objects-2>serializable object/a>, then perform the appropriate a href#serialization-steps idstructuredserializeinternal:serialization-steps>serialization steps/a> given var>value/var>, var>serialized/var>, and var>forStorage/var>./p> p>The a href#serialization-steps idstructuredserializeinternal:serialization-steps-2>serialization steps/a> may need to perform a dfn idsub-serialization data-export>sub-serialization/dfn>. This is an operation which takes as input a value var>subValue/var>, and returns a href#structuredserializeinternal idstructuredserializeinternal:structuredserializeinternal-6>StructuredSerializeInternal/a>(var>subValue/var>, var>forStorage/var>, var>memory/var>). (In other words, a a href#sub-serialization idstructuredserializeinternal:sub-serialization>sub-serialization/a> is a specialization of a href#structuredserializeinternal idstructuredserializeinternal:structuredserializeinternal-7>StructuredSerializeInternal/a> to be consistent within this invocation.)/p> li> p>Otherwise: ol>li>p>Let var>enumerableKeys/var> be a new empty a hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type idstructuredserializeinternal:js-list-7 data-x-internaljs-list>List/a>.li> p>For each var>key/var> in ! var>value/var>.OwnPropertyKeys():/p> ol>li> p>If a hrefhttps://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values idstructuredserializeinternal:js-type-3 data-x-internaljs-type>Type/a>(var>key/var>) is String, then:/p> ol>li>p>Let var>valueDesc/var> be ! var>value/var>.GetOwnProperty(var>key/var>).li>p>If var>valueDesc/var>.Enumerable is true, then a hrefhttps://infra.spec.whatwg.org/#list-append idstructuredserializeinternal:list-append-5 data-x-internallist-append>append/a> var>key/var> to var>enumerableKeys/var>./ol> /ol> li> p>For each var>key/var> in var>enumerableKeys/var>:/p> ol>li> p>If ! a idstructuredserializeinternal:hasownproperty hrefhttps://tc39.github.io/ecma262/#sec-hasownproperty data-x-internalhasownproperty>HasOwnProperty/a>(var>value/var>, var>key/var>) is true, then:/p> ol>li>p>Let var>inputValue/var> be ? var>value/var>.Get(var>key/var>, var>value/var>).li>p>Let var>outputValue/var> be ? a href#structuredserializeinternal idstructuredserializeinternal:structuredserializeinternal-8>StructuredSerializeInternal/a>(var>inputValue/var>, var>forStorage/var>, var>memory/var>).li>p>a hrefhttps://infra.spec.whatwg.org/#list-append idstructuredserializeinternal:list-append-6 data-x-internallist-append>Append/a> { Key: var>key/var>, Value: var>outputValue/var> } to var>serialized/var>.Properties./ol> /ol> /ol> p classnote>The key collection performed above is very similar to the JavaScript specifications a idstructuredserializeinternal:enumerableownproperties hrefhttps://tc39.github.io/ecma262/#sec-enumerableownproperties data-x-internalenumerableownproperties>EnumerableOwnProperties/a> operation, but crucially it uses the deterministic ordering provided by the OwnPropertyKeys internal method, instead of reordering the keys in an unspecified manner as a idstructuredserializeinternal:enumerableownproperties-2 hrefhttps://tc39.github.io/ecma262/#sec-enumerableownproperties data-x-internalenumerableownproperties>EnumerableOwnProperties/a> does. a href#refsJAVASCRIPT>JAVASCRIPT/a>/p> /ol> li>p>Return var>serialized/var>./ol> div classexample> p>Its important to realize that the a hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type idstructuredserializeinternal:record-5 data-x-internalrecord>Records/a> produced by a href#structuredserializeinternal idstructuredserializeinternal:structuredserializeinternal-9>StructuredSerializeInternal/a> might contain pointers to other records that create circular references. For example, when we pass the following JavaScript object into a href#structuredserializeinternal idstructuredserializeinternal:structuredserializeinternal-10>StructuredSerializeInternal/a>:/p> pre>const o {};o.myself o;/pre> p>it produces the following result:/p> pre>samp>{ Type: Object, Properties: « { Key: myself, Value: i><a pointer to this whole structure>/i> } »}/samp>/pre> /div> h4 idstructuredserialize data-dfn-typeabstract-op data-ltStructuredSerialize data-export>span classsecno>2.7.4/span> dfn>StructuredSerialize/dfn> ( var>value/var> )a href#structuredserialize classself-link>/a>/h4> ol>li>p>Return ? a href#structuredserializeinternal idstructuredserialize:structuredserializeinternal>StructuredSerializeInternal/a>(var>value/var>, false)./ol> h4 idstructuredserializeforstorage data-dfn-typeabstract-op data-ltStructuredSerializeForStorage data-export>span classsecno>2.7.5/span> dfn>StructuredSerializeForStorage/dfn> ( var>value/var> )a href#structuredserializeforstorage classself-link>/a>/h4> ol>li>p>Return ? a href#structuredserializeinternal idstructuredserializeforstorage:structuredserializeinternal>StructuredSerializeInternal/a>(var>value/var>, true)./ol> h4 idstructureddeserialize data-dfn-typeabstract-op data-ltStructuredDeserialize data-export>span classsecno>2.7.6/span> dfn>StructuredDeserialize/dfn> ( var>serialized/var>, var>targetRealm/var> , var>memory/var> )a href#structureddeserialize classself-link>/a>/h4> p>The a href#structureddeserialize idstructureddeserialize:structureddeserialize>StructuredDeserialize/a> abstract operation takes as input a a idstructureddeserialize:record hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type data-x-internalrecord>Record/a> var>serialized/var>, which was previously produced by a href#structuredserialize idstructureddeserialize:structuredserialize>StructuredSerialize/a> or a href#structuredserializeforstorage idstructureddeserialize:structuredserializeforstorage>StructuredSerializeForStorage/a>, and deserializes it into a new JavaScript value, created in var>targetRealm/var>./p> p>This process can throw an exception, for example when trying to allocate memory for the new objects (especially code>ArrayBuffer/code> objects)./p> ol>li> p>If var>memory/var> was not supplied, let var>memory/var> be an empty a hrefhttps://infra.spec.whatwg.org/#ordered-map idstructureddeserialize:ordered-map data-x-internalordered-map>map/a>./p> p classnote>The purpose of the var>memory/var> map is to avoid deserializing objects twice. This ends up preserving cycles and the identity of duplicate objects in graphs./p> li>p>If var>memory/var>var>serialized/var> a hrefhttps://infra.spec.whatwg.org/#map-exists idstructureddeserialize:map-exists data-x-internalmap-exists>exists/a>, then return var>memory/var>var>serialized/var>.li>p>Let var>deep/var> be false.li>p>Let var>value/var> be an uninitialized value.li> p>If var>serialized/var> contains a TransferConsumed field, then:/p> ol>li>p>Assert: var>serialized/var>.TransferConsumed is false. (It must be impossible to get in a situation where a href#structureddeserialize idstructureddeserialize:structureddeserialize-2>StructuredDeserialize/a> is being called multiple times on the same serialization, if that serialization contains transfer data holders.)li>p>Set var>serialized/var>.TransferConsumed to true.li> p>If var>serialized/var>.Type is ArrayBuffer, then set var>value/var> to a new ArrayBuffer object in var>targetRealm/var> whose ArrayBufferData internal slot value is var>serialized/var>.ArrayBufferData, and whose ArrayBufferByteLength internal slot value is var>serialized/var>.ArrayBufferByteLength./p> p classnote>In cases where the original memory occupied by ArrayBufferData is accessible during the deserialization, this step is unlikely to throw an exception, as no new memory needs to be allocated: the memory occupied by ArrayBufferData is instead just getting transferred into the new ArrayBuffer. This could be true, for example, when both the source and target Realms are in the same process./p> li> p>Otherwise:/p> ol>li>p>Let var>interfaceName/var> be var>serialized/var>.Type.li>p>If the interface identified by var>interfaceName/var> is not exposed in var>targetRealm/var>, then throw a a idstructureddeserialize:datacloneerror hrefhttps://heycam.github.io/webidl/#datacloneerror data-x-internaldatacloneerror>code>DataCloneError/code>/a> code idstructureddeserialize:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Set var>value/var> to a new instance of the interface identified by var>interfaceName/var>, created in var>targetRealm/var>.li>p>Perform the appropriate a href#transfer-receiving-steps idstructureddeserialize:transfer-receiving-steps>transfer-receiving steps/a> for the interface identified by var>interfaceName/var> given var>serialized/var> and var>value/var>./ol> /ol> li>p>Otherwise, if var>serialized/var>.Type is primitive, then set var>value/var> to var>serialized/var>.Value./p> li>p>Otherwise, if var>serialized/var>.Type is Boolean, then set var>value/var> to a new Boolean object in var>targetRealm/var> whose BooleanData internal slot value is var>serialized/var>.BooleanData.li>p>Otherwise, if var>serialized/var>.Type is Number, then set var>value/var> to a new Number object in var>targetRealm/var> whose NumberData internal slot value is var>serialized/var>.NumberData.li>p>Otherwise, if var>serialized/var>.Type is String, then set var>value/var> to a new String object in var>targetRealm/var> whose StringData internal slot value is var>serialized/var>.StringData.li>p>Otherwise, if var>serialized/var>.Type is Date, then set var>value/var> to a new Date object in var>targetRealm/var> whose DateValue internal slot value is var>serialized/var>.DateValue.li>p>Otherwise, if var>serialized/var>.Type is RegExp, then set var>value/var> to a new RegExp object in var>targetRealm/var> whose RegExpMatcher internal slot value is var>serialized/var>.RegExpMatcher, whose OriginalSource internal slot value is var>serialized/var>.OriginalSource, and whose OriginalFlags internal slot value is var>serialized/var>.OriginalFlags.li> p>Otherwise, if var>serialized/var>.Type is SharedArrayBuffer, then:/p> ol>li>p>If var>targetRealm/var>s corresponding a idstructureddeserialize:agent-cluster hrefhttps://tc39.github.io/ecma262/#sec-agent-clusters data-x-internalagent-cluster>agent cluster/a> is not var>serialized/var>.AgentCluster, then then throw a a idstructureddeserialize:datacloneerror-2 hrefhttps://heycam.github.io/webidl/#datacloneerror data-x-internaldatacloneerror>code>DataCloneError/code>/a> code idstructureddeserialize:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Otherwise, set var>value/var> to a new SharedArrayBuffer object in var>targetRealm/var> whose ArrayBufferData internal slot value is var>serialized/var>.ArrayBufferData and whose ArrayBufferByteLength internal slot value is var>serialized/var>.ArrayBufferByteLength./ol> li> p>Otherwise, if var>serialized/var>.Type is ArrayBuffer, then set var>value/var> to a new ArrayBuffer object in var>targetRealm/var> whose ArrayBufferData internal slot value is var>serialized/var>.ArrayBufferData, and whose ArrayBufferByteLength internal slot value is var>serialized/var>.ArrayBufferByteLength./p> p>If this throws an exception, catch it, and then throw a a idstructureddeserialize:datacloneerror-3 hrefhttps://heycam.github.io/webidl/#datacloneerror data-x-internaldatacloneerror>code>DataCloneError/code>/a> code idstructureddeserialize:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> p classnote>This step might throw an exception if there is not enough memory available to create such an ArrayBuffer object./p> li> p>Otherwise, if var>serialized/var>.Type is ArrayBufferView, then:/p> ol>li>p>Let var>deserializedArrayBuffer/var> be ? a href#structureddeserialize idstructureddeserialize:structureddeserialize-3>StructuredDeserialize/a>(var>serialized/var>.ArrayBufferSerialized, var>targetRealm/var>, var>memory/var>).li>p>If var>serialized/var>.Constructor is DataView, then set var>value/var> to a new DataView object in var>targetRealm/var> whose ViewedArrayBuffer internal slot value is var>deserializedArrayBuffer/var>, whose ByteLength internal slot value is var>serialized/var>.ByteLength, and whose ByteOffset internal slot value is var>serialized/var>.ByteOffset.li>p>Otherwise, set var>value/var> to a new typed array object in var>targetRealm/var>, using the constructor given by var>serialized/var>.Constructor, whose ViewedArrayBuffer internal slot value is var>deserializedArrayBuffer/var>, whose TypedArrayName internal slot value is var>serialized/var>.Constructor, whose ByteLength internal slot value is var>serialized/var>.ByteLength, whose ByteOffset internal slot value is var>serialized/var>.ByteOffset, and whose ArrayLength internal slot value is var>serialized/var>.ArrayLength./ol> li> p>Otherwise, if var>serialized/var>.Type is Map, then:/p> ol>li>p>Set var>value/var> to a new Map object in var>targetRealm/var> whose MapData internal slot value is a new empty a hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type idstructureddeserialize:js-list data-x-internaljs-list>List/a>.li>p>Set var>deep/var> to true./ol> li> p>Otherwise, if var>serialized/var>.Type is Set, then:/p> ol>li>p>Set var>value/var> to a new Set object in var>targetRealm/var> whose SetData internal slot value is a new empty a hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type idstructureddeserialize:js-list-2 data-x-internaljs-list>List/a>.li>p>Set var>deep/var> to true./ol> li> p>Otherwise, if var>serialized/var>.Type is Array, then:/p> ol>li>p>Let var>outputProto/var> be the a idstructureddeserialize:arrayprototype hrefhttps://tc39.github.io/ecma262/#sec-properties-of-the-array-prototype-object data-x-internalarrayprototype>%ArrayPrototype%/a> intrinsic object in var>targetRealm/var>.li>p>Set var>value/var> to ! a idstructureddeserialize:arraycreate hrefhttps://tc39.github.io/ecma262/#sec-arraycreate data-x-internalarraycreate>ArrayCreate/a>(var>serialized/var>.Length, var>outputProto/var>).li>p>Set var>deep/var> to true./ol> li> p>Otherwise, if var>serialized/var>.Type is Object, then:/p> ol>li>p>Set var>value/var> to a new Object in var>targetRealm/var>.li>p>Set var>deep/var> to true./ol> li> p>Otherwise:/p> ol>li>p>Let var>interfaceName/var> be var>serialized/var>.Type.li>p>If the interface identified by var>interfaceName/var> is not exposed in var>targetRealm/var>, then throw a a idstructureddeserialize:datacloneerror-4 hrefhttps://heycam.github.io/webidl/#datacloneerror data-x-internaldatacloneerror>code>DataCloneError/code>/a> code idstructureddeserialize:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Set var>value/var> to a new instance of the interface identified by var>interfaceName/var>, created in var>targetRealm/var>./p> li>p>Set var>deep/var> to true./ol> li>p>a hrefhttps://infra.spec.whatwg.org/#map-set idstructureddeserialize:map-set data-x-internalmap-set>Set/a> var>memory/var>var>serialized/var> to var>value/var>.li> p>If var>deep/var> is true, then:/p> ol>li> p>If var>serialized/var>.Type is Map, then:/p> ol>li> p>a hrefhttps://infra.spec.whatwg.org/#list-iterate idstructureddeserialize:list-iterate data-x-internallist-iterate>For each/a> a idstructureddeserialize:record-2 hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type data-x-internalrecord>Record/a> { Key, Value } var>entry/var> of var>serialized/var>.MapData:/p> ol>li>p>Let var>deserializedKey/var> be ? a href#structureddeserialize idstructureddeserialize:structureddeserialize-4>StructuredDeserialize/a>(var>entry/var>.Key, var>targetRealm/var>, var>memory/var>).li>p>Let var>deserializedValue/var> be ? a href#structureddeserialize idstructureddeserialize:structureddeserialize-5>StructuredDeserialize/a>(var>entry/var>.Value, var>targetRealm/var>, var>memory/var>).li>p>a hrefhttps://infra.spec.whatwg.org/#list-append idstructureddeserialize:list-append data-x-internallist-append>Append/a> { Key: var>deserializedKey/var>, Value: var>deserializedValue/var> } to var>value/var>.MapData./ol> /ol> li> p>Otherwise, if var>serialized/var>.Type is Set, then:/p> ol>li> p>a hrefhttps://infra.spec.whatwg.org/#list-iterate idstructureddeserialize:list-iterate-2 data-x-internallist-iterate>For each/a> var>entry/var> of var>serialized/var>.SetData:/p> ol>li>p>Let var>deserializedEntry/var> be ? a href#structureddeserialize idstructureddeserialize:structureddeserialize-6>StructuredDeserialize/a>(var>entry/var>, var>targetRealm/var>, var>memory/var>).li>p>a hrefhttps://infra.spec.whatwg.org/#list-append idstructureddeserialize:list-append-2 data-x-internallist-append>Append/a> var>deserializedEntry/var> to var>value/var>.SetData./ol> /ol> li> p>Otherwise, if var>serialized/var>.Type is Array or Object, then:/p> ol>li> p>a hrefhttps://infra.spec.whatwg.org/#list-iterate idstructureddeserialize:list-iterate-3 data-x-internallist-iterate>For each/a> a idstructureddeserialize:record-3 hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type data-x-internalrecord>Record/a> { Key, Value } var>entry/var> of var>serialized/var>.Properties:/p> ol>li>p>Let var>deserializedValue/var> be ? a href#structureddeserialize idstructureddeserialize:structureddeserialize-7>StructuredDeserialize/a>(var>entry/var>.Value, var>targetRealm/var>, var>memory/var>).li>p>Let var>result/var> be ! a idstructureddeserialize:createdataproperty hrefhttps://tc39.github.io/ecma262/#sec-createdataproperty data-x-internalcreatedataproperty>CreateDataProperty/a>(var>value/var>, var>entry/var>.Key, var>deserializedValue/var>).li>p>Assert: var>result/var> is true./ol> /ol> li> p>Otherwise:/p> ol>li> p>Perform the appropriate a href#deserialization-steps idstructureddeserialize:deserialization-steps>deserialization steps/a> for the interface identified by var>serialized/var>.Type, given var>serialized/var> and var>value/var>./p> p>The a href#deserialization-steps idstructureddeserialize:deserialization-steps-2>deserialization steps/a> may need to perform a dfn idsub-deserialization data-export>sub-deserialization/dfn>. This is an operation which takes as input a previously-serialized a idstructureddeserialize:record-4 hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type data-x-internalrecord>Record/a> var>subSerialized/var>, and returns a href#structureddeserialize idstructureddeserialize:structureddeserialize-8>StructuredDeserialize/a>(var>subSerialized/var>, var>targetRealm/var>, var>memory/var>). (In other words, a a href#sub-deserialization idstructureddeserialize:sub-deserialization>sub-deserialization/a> is a specialization of a href#structureddeserialize idstructureddeserialize:structureddeserialize-9>StructuredDeserialize/a> to be consistent within this invocation.)/p> /ol> /ol> li>p>Return var>value/var>./ol> h4 idstructuredserializewithtransfer data-dfn-typeabstract-op data-ltStructuredSerializeWithTransfer data-export>span classsecno>2.7.7/span> dfn>StructuredSerializeWithTransfer/dfn> ( var>value/var>, var>transferList/var> )a href#structuredserializewithtransfer classself-link>/a>/h4> ol>li> p>Let var>memory/var> be an empty a hrefhttps://infra.spec.whatwg.org/#ordered-map idstructuredserializewithtransfer:ordered-map data-x-internalordered-map>map/a>./p> p classnote>In addition to how it is used normally by a href#structuredserializeinternal idstructuredserializewithtransfer:structuredserializeinternal>StructuredSerializeInternal/a>, in this algorithm var>memory/var> is also used to ensure that a href#structuredserializeinternal idstructuredserializewithtransfer:structuredserializeinternal-2>StructuredSerializeInternal/a> ignores items in var>transferList/var>, and let us do our own handling instead./p> li> p>a hrefhttps://infra.spec.whatwg.org/#list-iterate idstructuredserializewithtransfer:list-iterate data-x-internallist-iterate>For each/a> var>transferable/var> of var>transferList/var>:/p> ol>li>p>If var>transferable/var> has neither an ArrayBufferData internal slot nor a a href#detached idstructuredserializewithtransfer:detached>Detached/a> internal slot, then throw a a idstructuredserializewithtransfer:datacloneerror hrefhttps://heycam.github.io/webidl/#datacloneerror data-x-internaldatacloneerror>code>DataCloneError/code>/a> code idstructuredserializewithtransfer:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If var>transferable/var> has an ArrayBufferData internal slot and either ! a idstructuredserializewithtransfer:issharedarraybuffer hrefhttps://tc39.github.io/ecma262/#sec-issharedarraybuffer data-x-internalissharedarraybuffer>IsSharedArrayBuffer/a>(var>transferable/var>) is true or ! a idstructuredserializewithtransfer:isdetachedbuffer hrefhttps://tc39.github.io/ecma262/#sec-isdetachedbuffer data-x-internalisdetachedbuffer>IsDetachedBuffer/a>(var>transferable/var>) is true, then throw a a idstructuredserializewithtransfer:datacloneerror-2 hrefhttps://heycam.github.io/webidl/#datacloneerror data-x-internaldatacloneerror>code>DataCloneError/code>/a> code idstructuredserializewithtransfer:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If var>transferable/var> has a a href#detached idstructuredserializewithtransfer:detached-2>Detached/a> internal slot and var>transferable/var>.a href#detached idstructuredserializewithtransfer:detached-3>Detached/a> is true, then throw a a idstructuredserializewithtransfer:datacloneerror-3 hrefhttps://heycam.github.io/webidl/#datacloneerror data-x-internaldatacloneerror>code>DataCloneError/code>/a> code idstructuredserializewithtransfer:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Let var>placeholder/var> be a user-agent-defined placeholder object.li>p>a hrefhttps://infra.spec.whatwg.org/#map-set idstructuredserializewithtransfer:map-set data-x-internalmap-set>Set/a> var>memory/var>var>transferable/var> to var>placeholder/var>./ol> li>p>Let var>serialized/var> be ? a href#structuredserializeinternal idstructuredserializewithtransfer:structuredserializeinternal-3>StructuredSerializeInternal/a>(var>value/var>, false, var>memory/var>).li>p>Let var>transferDataHolders/var> be a new empty a hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type idstructuredserializewithtransfer:js-list data-x-internaljs-list>List/a>.li> p>a hrefhttps://infra.spec.whatwg.org/#list-iterate idstructuredserializewithtransfer:list-iterate-2 data-x-internallist-iterate>For each/a> var>transferable/var> of var>transferList/var>:/p> ol>li>p>Let var>placeholder/var> be var>memory/var>var>transferable/var>.li>p>Let var>dataHolder/var> be an uninitialized value.li> p>If var>transferable/var> has an ArrayBufferData internal slot, then:/p> ol>li>p>Set var>dataHolder/var> to { TransferConsumed: false, Type: ArrayBuffer, ArrayBufferData: var>transferable/var>.ArrayBufferData, ArrayBufferByteLength: var>transferable/var>.ArrayBufferByteLength }.li>p>Perform ! a idstructuredserializewithtransfer:detacharraybuffer hrefhttps://tc39.github.io/ecma262/#sec-detacharraybuffer data-x-internaldetacharraybuffer>DetachArrayBuffer/a>(var>transferable/var>)./ol> li> p>Otherwise:/p> ol>li>p>Assert: var>transferable/var> is a a idstructuredserializewithtransfer:platform-object hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a> that is a a href#transferable-objects idstructuredserializewithtransfer:transferable-objects>transferable object/a>.li>p>Let var>interfaceName/var> be the identifier of the a idstructuredserializewithtransfer:primary-interface hrefhttps://heycam.github.io/webidl/#dfn-primary-interface data-x-internalprimary-interface>primary interface/a> of var>transferable/var>.li>p>Set var>dataHolder/var> to { TransferConsumed: false, Type: var>interfaceName/var> }.li>p>Perform the appropriate a href#transfer-steps idstructuredserializewithtransfer:transfer-steps>transfer steps/a> for the interface identified by var>interfaceName/var>, given var>transferable/var> and var>dataHolder/var>.li>p>Set var>transferable/var>.a href#detached idstructuredserializewithtransfer:detached-4>Detached/a> to true./ol> li>p>Within var>serialized/var>, replace all instances of var>placeholder/var> with var>dataHolder/var>.li>p>a hrefhttps://infra.spec.whatwg.org/#list-append idstructuredserializewithtransfer:list-append data-x-internallist-append>Append/a> var>dataHolder/var> to var>transferDataHolders/var>./ol> li>p>Return { Serialized: var>serialized/var>, TransferDataHolders: var>transferDataHolders/var> }./ol> h4 idstructureddeserializewithtransfer data-dfn-typeabstract-op data-ltStructuredDeserializeWithTransfer data-export>span classsecno>2.7.8/span> dfn>StructuredDeserializeWithTransfer/dfn> ( var>serializeWithTransferResult/var>, var>targetRealm/var> )a href#structureddeserializewithtransfer classself-link>/a>/h4> ol>li> p>Let var>memory/var> be an empty a hrefhttps://infra.spec.whatwg.org/#ordered-map idstructureddeserializewithtransfer:ordered-map data-x-internalordered-map>map/a>./p> p classnote>In addition to how it is used normally by a href#structureddeserialize idstructureddeserializewithtransfer:structureddeserialize>StructuredDeserialize/a>, in this algorithm var>memory/var> is also used to help us determine the list of transferred values./p> li>p>Let var>deserialized/var> be ? a href#structureddeserialize idstructureddeserializewithtransfer:structureddeserialize-2>StructuredDeserialize/a>(var>serializeWithTransferResult/var>.Serialized, var>targetRealm/var>, var>memory/var>).li>p>Let var>transferredValues/var> be a new empty a hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type idstructureddeserializewithtransfer:js-list data-x-internaljs-list>List/a>.li> p>a hrefhttps://infra.spec.whatwg.org/#list-iterate idstructureddeserializewithtransfer:list-iterate data-x-internallist-iterate>For each/a> var>transferDataHolder/var> of var>serializeWithTransferResult/var>.TransferDataHolders:/p> ol>li>p>a hrefhttps://infra.spec.whatwg.org/#list-append idstructureddeserializewithtransfer:list-append data-x-internallist-append>Append/a> var>memory/var>var>transferDataHolder/var> to var>transferredValues/var>./ol> li>p>Return { Deserialized: var>deserialized/var>, TransferredValues: var>transferredValues/var> }./ol> h4 idperforming-structured-clones-from-other-specifications>span classsecno>2.7.9/span> Performing serialization and transferring from other specificationsa href#performing-structured-clones-from-other-specifications classself-link>/a>/h4> p>Other specifications may use the abstract operations defined here. The following provides some guidance on when each abstract operation is typically useful, with examples./p> dl>dt>a href#structuredserializewithtransfer idperforming-structured-clones-from-other-specifications:structuredserializewithtransfer>StructuredSerializeWithTransfer/a>dt>a href#structureddeserializewithtransfer idperforming-structured-clones-from-other-specifications:structureddeserializewithtransfer>StructuredDeserializeWithTransfer/a>dd> p>Cloning a value to another a idperforming-structured-clones-from-other-specifications:javascript-realm hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript Realm/a>, with a transfer list, but where the target Realm is not known ahead of time. In this case the serialization step can be performed immediately, with the deserialization step delayed until the target Realm becomes known./p> p classexample>code idperforming-structured-clones-from-other-specifications:dom-messageport-postmessage>a href#dom-messageport-postmessage>messagePort.postMessage()/a>/code> uses this pair of abstract operations, as the destination Realm is not known until the code idperforming-structured-clones-from-other-specifications:messageport>a href#messageport>MessagePort/a>/code> a href#has-been-shipped idperforming-structured-clones-from-other-specifications:has-been-shipped>has been shipped/a>./p> dt>a href#structuredserialize idperforming-structured-clones-from-other-specifications:structuredserialize>StructuredSerialize/a>dt>a href#structuredserializeforstorage idperforming-structured-clones-from-other-specifications:structuredserializeforstorage>StructuredSerializeForStorage/a>dt>a href#structureddeserialize idperforming-structured-clones-from-other-specifications:structureddeserialize>StructuredDeserialize/a>dd> p>Creating a a idperforming-structured-clones-from-other-specifications:javascript-realm-2 hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript Realm/a>-independent snapshot of a given value which can be saved for an indefinite amount of time, and then reified back into a JavaScript value later, possibly multiple times./p> p>a href#structuredserializeforstorage idperforming-structured-clones-from-other-specifications:structuredserializeforstorage-2>StructuredSerializeForStorage/a> can be used for situations where the serialization is anticipated to be stored in a persistent manner, instead of passed between Realms. It throws when attempting to serialize code idperforming-structured-clones-from-other-specifications:sharedarraybuffer>a data-x-internalsharedarraybuffer hrefhttps://tc39.github.io/ecma262/#sec-sharedarraybuffer-objects>SharedArrayBuffer/a>/code> objects, since storing shared memory does not make sense. Similarly, it can throw or possibly have different behavior when given a a idperforming-structured-clones-from-other-specifications:platform-object hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a> with custom a href#serialization-steps idperforming-structured-clones-from-other-specifications:serialization-steps>serialization steps/a> when the var>forStorage/var> argument is true./p> p classexample>code idperforming-structured-clones-from-other-specifications:dom-history-pushstate>a href#dom-history-pushstate>history.pushState()/a>/code> and code idperforming-structured-clones-from-other-specifications:dom-history-replacestate>a href#dom-history-replacestate>history.replaceState()/a>/code> use a href#structuredserializeforstorage idperforming-structured-clones-from-other-specifications:structuredserializeforstorage-3>StructuredSerializeForStorage/a> on author-supplied state objects, storing them as a href#serialized-state idperforming-structured-clones-from-other-specifications:serialized-state>serialized state/a> in the appropriate a href#session-history-entry idperforming-structured-clones-from-other-specifications:session-history-entry>session history entry/a>. Then, a href#structureddeserialize idperforming-structured-clones-from-other-specifications:structureddeserialize-2>StructuredDeserialize/a> is used so that the code idperforming-structured-clones-from-other-specifications:dom-history-state>a href#dom-history-state>history.state/a>/code> property can return a clone of the originally-supplied state object./p> p classexample>code idperforming-structured-clones-from-other-specifications:dom-broadcastchannel-postmessage>a href#dom-broadcastchannel-postmessage>broadcastChannel.postMessage()/a>/code> uses a href#structuredserialize idperforming-structured-clones-from-other-specifications:structuredserialize-2>StructuredSerialize/a> on its input, then uses a href#structureddeserialize idperforming-structured-clones-from-other-specifications:structureddeserialize-3>StructuredDeserialize/a> multiple times on the result to produce a fresh clone for each destination being broadcast to. Note that transferring does not make sense in multi-destination situations./p> p classexample>Any API for persisting JavaScript values to the filesystem would also use a href#structuredserializeforstorage idperforming-structured-clones-from-other-specifications:structuredserializeforstorage-4>StructuredSerializeForStorage/a> on its input and a href#structureddeserialize idperforming-structured-clones-from-other-specifications:structureddeserialize-4>StructuredDeserialize/a> on its output./p> /dl> p>In general, call sites may pass in Web IDL values instead of JavaScript values; this is to be understood to perform an implicit a hrefhttps://heycam.github.io/webidl/#es-type-mapping idperforming-structured-clones-from-other-specifications:concept-idl-convert data-x-internalconcept-idl-convert>conversion/a> to the JavaScript value before invoking these algorithms./p> p idstructuredclone classnote>span idstructured-clone>/span>This specification used to define a structured clone algorithm, and more recently a StructuredClone abstract operation. However, in practice all known uses of it were better served by separate serialization and deserialization steps, so it was removed./p> hr> p>Call sites that are not invoked as a result of author code synchronously calling into a user agent method must take care to properly a href#prepare-to-run-script idperforming-structured-clones-from-other-specifications:prepare-to-run-script>prepare to run script/a> and a href#prepare-to-run-a-callback idperforming-structured-clones-from-other-specifications:prepare-to-run-a-callback>prepare to run a callback/a> before invoking a href#structuredserialize idperforming-structured-clones-from-other-specifications:structuredserialize-3>StructuredSerialize/a>, a href#structuredserializeforstorage idperforming-structured-clones-from-other-specifications:structuredserializeforstorage-5>StructuredSerializeForStorage/a>, or a href#structuredserializewithtransfer idperforming-structured-clones-from-other-specifications:structuredserializewithtransfer-2>StructuredSerializeWithTransfer/a> abstract operations, if they are being performed on arbitrary objects. This is necessary because the serialization process can invoke author-defined accessors as part of its final deep-serialization steps, and these accessors could call into operations that rely on the a href#concept-entry-everything idperforming-structured-clones-from-other-specifications:concept-entry-everything>entry/a> and a href#concept-incumbent-everything idperforming-structured-clones-from-other-specifications:concept-incumbent-everything>incumbent/a> concepts being properly set up./p> p classexample>code idperforming-structured-clones-from-other-specifications:dom-window-postmessage>a href#dom-window-postmessage>window.postMessage()/a>/code> performs a href#structuredserializewithtransfer idperforming-structured-clones-from-other-specifications:structuredserializewithtransfer-3>StructuredSerializeWithTransfer/a> on its arguments, but is careful to do so immediately, inside the synchronous portion of its algorithm. Thus it is able to use the algorithms without needing to a href#prepare-to-run-script idperforming-structured-clones-from-other-specifications:prepare-to-run-script-2>prepare to run script/a> and a href#prepare-to-run-a-callback idperforming-structured-clones-from-other-specifications:prepare-to-run-a-callback-2>prepare to run a callback/a>./p> p classexample>In contrast, a hypothetical API that used a href#structuredserialize idperforming-structured-clones-from-other-specifications:structuredserialize-4>StructuredSerialize/a> to serialize some author-supplied object periodically, directly from a a href#concept-task idperforming-structured-clones-from-other-specifications:concept-task>task/a> on the a href#event-loop idperforming-structured-clones-from-other-specifications:event-loop>event loop/a>, would need to ensure it performs the appropriate preparations beforehand. As of this time, we know of no such APIs on the platform; usually it is simpler to perform the serialization ahead of time, as a synchronous consequence of author code./p> h2 iddom>span classsecno>3/span> Semantics, structure, and APIs of HTML documentsa href#dom classself-link>/a>/h2> h3 iddocuments>span classsecno>3.1/span> Documentsa href#documents classself-link>/a>/h3> p>Every XML and HTML document in an HTML UA is represented by a code iddocuments:document>a href#document>Document/a>/code> object. a href#refsDOM>DOM/a>/p> p>The code iddocuments:document-2>a href#document>Document/a>/code> objects dfn data-x-forDocument idthe-documents-address>a hrefhttps://dom.spec.whatwg.org/#concept-document-url>URL/a>/dfn> is defined in the WHATWG DOM standard. It is initially set when the code iddocuments:document-3>a href#document>Document/a>/code> object is created, but can change during the lifetime of the code iddocuments:document-4>a href#document>Document/a>/code> object; for example, it changes when the user a href#navigate iddocuments:navigate>navigates/a> to a a href#scroll-to-fragid iddocuments:scroll-to-fragid>fragment/a> on the page and when the code iddocuments:dom-history-pushstate>a href#dom-history-pushstate>pushState()/a>/code> method is called with a new a iddocuments:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>. a href#refsDOM>DOM/a>/p> p classwarning>Interactive user agents typically expose the code iddocuments:document-5>a href#document>Document/a>/code> objects a hrefhttps://dom.spec.whatwg.org/#concept-document-url iddocuments:the-documents-address data-x-internalthe-documents-address>URL/a> in their user interface. This is the primary mechanism by which a user can tell if a site is attempting to impersonate another./p> p>When a code iddocuments:document-6>a href#document>Document/a>/code> is created by a a href#concept-script iddocuments:concept-script>script/a> using the code iddocuments:dom-domimplementation-createdocument>a data-x-internaldom-domimplementation-createdocument hrefhttps://dom.spec.whatwg.org/#dom-domimplementation-createdocument>createDocument()/a>/code> or code iddocuments:dom-domimplementation-createhtmldocument>a data-x-internaldom-domimplementation-createhtmldocument hrefhttps://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument>createHTMLDocument()/a>/code> the code iddocuments:document-7>a href#document>Document/a>/code> is both a href#ready-for-post-load-tasks iddocuments:ready-for-post-load-tasks>ready for post-load tasks/a> and a href#completely-loaded iddocuments:completely-loaded>completely loaded/a> immediately./p> p>dfn idthe-documents-referrer data-export>The documents referrer/dfn> is a string (representing a a iddocuments:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>) that can be set when the code iddocuments:document-8>a href#document>Document/a>/code> is created. If it is not explicitly set, then its value is the empty string./p> p>Each code iddocuments:document-9>a href#document>Document/a>/code> object has a dfn idreload-override-flag>reload override flag/dfn> that is originally unset. The flag is set by the code iddocuments:dom-document-open>a href#dom-document-open>document.open()/a>/code> and code iddocuments:dom-document-open-2>a href#dom-document-open>document.write()/a>/code> methods in certain situations. When the flag is set, the code iddocuments:document-10>a href#document>Document/a>/code> also has a dfn idreload-override-buffer>reload override buffer/dfn> which is a Unicode string that is used as the source of the document when it is reloaded./p> p>When the user agent is to perform dfn idan-overridden-reload>an overridden reload/dfn>, given a a href#source-browsing-context iddocuments:source-browsing-context>source browsing context/a>, it must act as follows:/p> ol>li>p>Let var>source/var> be the value of the a href#browsing-context iddocuments:browsing-context>browsing context/a>s a href#active-document iddocuments:active-document>active document/a>s a href#reload-override-buffer iddocuments:reload-override-buffer>reload override buffer/a>.li>p>Let var>address/var> be the a href#browsing-context iddocuments:browsing-context-2>browsing context/a>s a href#active-document iddocuments:active-document-2>active document/a>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url iddocuments:the-documents-address-2 data-x-internalthe-documents-address>URL/a>.li>p>Let var>HTTPS state/var> be the a href#concept-document-https-state iddocuments:concept-document-https-state>HTTPS state/a> of the a href#browsing-context iddocuments:browsing-context-3>browsing context/a>s a href#active-document iddocuments:active-document-3>active document/a>.li>p>Let var>referrer policy/var> be the a href#concept-document-referrer-policy iddocuments:concept-document-referrer-policy>referrer policy/a> of the a href#browsing-context iddocuments:browsing-context-4>browsing context/a>s a href#active-document iddocuments:active-document-4>active document/a>.li>p>Let var>CSP list/var> be the a href#concept-document-csp-list iddocuments:concept-document-csp-list>CSP list/a> of the a href#browsing-context iddocuments:browsing-context-5>browsing context/a>s a href#active-document iddocuments:active-document-5>active document/a>.li> p>a href#navigate iddocuments:navigate-2>Navigate/a> the a href#browsing-context iddocuments:browsing-context-6>browsing context/a> to a new a hrefhttps://fetch.spec.whatwg.org/#concept-response iddocuments:concept-response data-x-internalconcept-response>response/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-response-body iddocuments:concept-response-body data-x-internalconcept-response-body>body/a> is var>source/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-response-header-list iddocuments:concept-response-header-list data-x-internalconcept-response-header-list>header list/a> is `code iddocuments:http-referrer-policy>a data-x-internalhttp-referrer-policy hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy-header-dfn>Referrer-Policy/a>/code>`/var>referrer policy/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-response-csp-list iddocuments:concept-response-csp-list data-x-internalconcept-response-csp-list>CSP list/a> is var>CSP list/var> and a hrefhttps://fetch.spec.whatwg.org/#concept-response-https-state iddocuments:concept-response-https-state data-x-internalconcept-response-https-state>HTTPS state/a> is var>HTTPS state/var>, with the var>a href#exceptions-enabled iddocuments:exceptions-enabled>exceptions enabled flag/a>/var> set and a href#replacement-enabled iddocuments:replacement-enabled>replacement enabled/a>. The a href#source-browsing-context iddocuments:source-browsing-context-2>source browsing context/a> is that given to the a href#an-overridden-reload iddocuments:an-overridden-reload>overridden reload/a> algorithm. When the a href#navigate iddocuments:navigate-3>navigate/a> algorithm creates a code iddocuments:document-11>a href#document>Document/a>/code> object for this purpose, set that code iddocuments:document-12>a href#document>Document/a>/code>s a href#reload-override-flag iddocuments:reload-override-flag>reload override flag/a> and set its a href#reload-override-buffer iddocuments:reload-override-buffer-2>reload override buffer/a> to var>source/var>. Rethrow any exceptions./p> p>When it comes time to a href#set-the-documents-address iddocuments:set-the-documents-address>set the documents address/a> in the a href#navigate iddocuments:navigate-4>navigation algorithm/a>, use var>address/var> as the a href#override-url iddocuments:override-url>override URL/a>./p> /ol> h4 idthe-document-object>span classsecno>3.1.1/span> The code idthe-document-object:document>a href#document>Document/a>/code> objecta href#the-document-object classself-link>/a>/h4> p>The WHATWG DOM standard defines a code idthe-document-object:dom-document>a data-x-internaldom-document hrefhttps://dom.spec.whatwg.org/#interface-document>Document/a>/code> interface, which this specification extends significantly./p> pre classidl>enum dfn iddocumentreadystate>DocumentReadyState/dfn> { loading, interactive, complete };typedef (a href#htmlscriptelement idthe-document-object:htmlscriptelement>HTMLScriptElement/a> or a idthe-document-object:svgscriptelement hrefhttps://www.w3.org/TR/SVG11/script.html#InterfaceSVGScriptElement data-x-internalsvgscriptelement>SVGScriptElement/a>) dfn idhtmlorsvgscriptelement>HTMLOrSVGScriptElement/dfn>;OverrideBuiltinspartial interface dfn data-lt iddocument>Document/dfn> { // a href#resource-metadata-management idthe-document-object:resource-metadata-management>resource metadata management/a> PutForwardsa href#dom-location-href idthe-document-object:dom-location-href>href/a>, Unforgeable readonly attribute a href#location idthe-document-object:location>Location/a>? a href#dom-document-location idthe-document-object:dom-document-location>location/a>; attribute USVString a href#dom-document-domain idthe-document-object:dom-document-domain>domain/a>; readonly attribute USVString a href#dom-document-referrer idthe-document-object:dom-document-referrer>referrer/a>; attribute USVString a href#dom-document-cookie idthe-document-object:dom-document-cookie>cookie/a>; readonly attribute DOMString a href#dom-document-lastmodified idthe-document-object:dom-document-lastmodified>lastModified/a>; readonly attribute a href#documentreadystate idthe-document-object:documentreadystate>DocumentReadyState/a> a href#dom-document-readystate idthe-document-object:dom-document-readystate>readyState/a>; // a href#dom-tree-accessors idthe-document-object:dom-tree-accessors>DOM tree accessors/a> a href#dom-document-nameditem>getter/a> object (DOMString name); a href#cereactions idthe-document-object:cereactions>CEReactions/a> attribute DOMString a href#document.title idthe-document-object:document.title>title/a>; a href#cereactions idthe-document-object:cereactions-2>CEReactions/a> attribute DOMString a href#dom-document-dir idthe-document-object:dom-document-dir>dir/a>; a href#cereactions idthe-document-object:cereactions-3>CEReactions/a> attribute a href#htmlelement idthe-document-object:htmlelement>HTMLElement/a>? a href#dom-document-body idthe-document-object:dom-document-body>body/a>; readonly attribute a href#htmlheadelement idthe-document-object:htmlheadelement>HTMLHeadElement/a>? a href#dom-document-head idthe-document-object:dom-document-head>head/a>; SameObject readonly attribute a idthe-document-object:htmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> a href#dom-document-images idthe-document-object:dom-document-images>images/a>; SameObject readonly attribute a idthe-document-object:htmlcollection-2 hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> a href#dom-document-embeds idthe-document-object:dom-document-embeds>embeds/a>; SameObject readonly attribute a idthe-document-object:htmlcollection-3 hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> a href#dom-document-plugins idthe-document-object:dom-document-plugins>plugins/a>; SameObject readonly attribute a idthe-document-object:htmlcollection-4 hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> a href#dom-document-links idthe-document-object:dom-document-links>links/a>; SameObject readonly attribute a idthe-document-object:htmlcollection-5 hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> a href#dom-document-forms idthe-document-object:dom-document-forms>forms/a>; SameObject readonly attribute a idthe-document-object:htmlcollection-6 hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> a href#dom-document-scripts idthe-document-object:dom-document-scripts>scripts/a>; NodeList a href#dom-document-getelementsbyname idthe-document-object:dom-document-getelementsbyname>getElementsByName/a>(DOMString elementName); readonly attribute a href#htmlorsvgscriptelement idthe-document-object:htmlorsvgscriptelement>HTMLOrSVGScriptElement/a>? a href#dom-document-currentscript idthe-document-object:dom-document-currentscript>currentScript/a>; // classic scripts in a document tree only // a href#dynamic-markup-insertion idthe-document-object:dynamic-markup-insertion>dynamic markup insertion/a> a href#cereactions idthe-document-object:cereactions-4>CEReactions/a> a href#document idthe-document-object:document-2>Document/a> a href#dom-document-open idthe-document-object:dom-document-open>open/a>(optional DOMString type text/html, optional DOMString replace ); a href#windowproxy idthe-document-object:windowproxy>WindowProxy/a> a href#dom-document-open idthe-document-object:dom-document-open-2>open/a>(USVString url, DOMString name, DOMString features); a href#cereactions idthe-document-object:cereactions-5>CEReactions/a> void a href#dom-document-close idthe-document-object:dom-document-close>close/a>(); a href#cereactions idthe-document-object:cereactions-6>CEReactions/a> void a href#dom-document-write idthe-document-object:dom-document-write>write/a>(DOMString... text); a href#cereactions idthe-document-object:cereactions-7>CEReactions/a> void a href#dom-document-writeln idthe-document-object:dom-document-writeln>writeln/a>(DOMString... text); // a href#editing idthe-document-object:editing>user interaction/a> readonly attribute a href#windowproxy idthe-document-object:windowproxy-2>WindowProxy/a>? a href#dom-document-defaultview idthe-document-object:dom-document-defaultview>defaultView/a>; readonly attribute a idthe-document-object:element hrefhttps://dom.spec.whatwg.org/#interface-element data-x-internalelement>Element/a>? a href#dom-document-activeelement idthe-document-object:dom-document-activeelement>activeElement/a>; boolean a href#dom-document-hasfocus idthe-document-object:dom-document-hasfocus>hasFocus/a>(); a href#cereactions idthe-document-object:cereactions-8>CEReactions/a> attribute DOMString a href#designMode idthe-document-object:designMode>designMode/a>; a href#cereactions idthe-document-object:cereactions-9>CEReactions/a> boolean a hrefhttps://w3c.github.io/editing/execCommand.html#execcommand%28%29 idthe-document-object:execCommand data-x-internalexecCommand>execCommand/a>(DOMString commandId, optional boolean showUI false, optional DOMString value ); boolean a hrefhttps://w3c.github.io/editing/execCommand.html#querycommandenabled%28%29 idthe-document-object:dom-document-querycommandenabled data-x-internaldom-document-querycommandenabled>queryCommandEnabled/a>(DOMString commandId); boolean a hrefhttps://w3c.github.io/editing/execCommand.html#querycommandindeterm%28%29 idthe-document-object:dom-document-querycommandindeterm data-x-internaldom-document-querycommandindeterm>queryCommandIndeterm/a>(DOMString commandId); boolean a hrefhttps://w3c.github.io/editing/execCommand.html#querycommandstate%28%29 idthe-document-object:dom-document-querycommandstate data-x-internaldom-document-querycommandstate>queryCommandState/a>(DOMString commandId); boolean a hrefhttps://w3c.github.io/editing/execCommand.html#querycommandsupported%28%29 idthe-document-object:dom-document-querycommandsupported data-x-internaldom-document-querycommandsupported>queryCommandSupported/a>(DOMString commandId); DOMString a hrefhttps://w3c.github.io/editing/execCommand.html#querycommandvalue%28%29 idthe-document-object:dom-document-querycommandvalue data-x-internaldom-document-querycommandvalue>queryCommandValue/a>(DOMString commandId); // special a href#event-handler-idl-attributes idthe-document-object:event-handler-idl-attributes>event handler IDL attributes/a> that only apply to Document objects LenientThis attribute a href#eventhandler idthe-document-object:eventhandler>EventHandler/a> a href#handler-onreadystatechange idthe-document-object:handler-onreadystatechange>onreadystatechange/a>;};a href#document idthe-document-object:document-3>Document/a> implements a href#globaleventhandlers idthe-document-object:globaleventhandlers>GlobalEventHandlers/a>;a href#document idthe-document-object:document-4>Document/a> implements a href#documentandelementeventhandlers idthe-document-object:documentandelementeventhandlers>DocumentAndElementEventHandlers/a>;/pre> p>The code idthe-document-object:document-5>a href#document>Document/a>/code> has an dfn data-dfn-forDocument idconcept-document-https-state data-export>HTTPS state/dfn> (an a idthe-document-object:https-state-value hrefhttps://fetch.spec.whatwg.org/#concept-https-state-value data-x-internalhttps-state-value>HTTPS state value/a>), initially code>none/code>, which represents the security properties of the network channel used to deliver the code idthe-document-object:document-6>a href#document>Document/a>/code>s data./p> p>The code idthe-document-object:document-7>a href#document>Document/a>/code> has a dfn data-dfn-forDocument idconcept-document-referrer-policy data-export>referrer policy/dfn> (a a idthe-document-object:referrer-policy hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>referrer policy/a>), initially the empty string, which represents the default a idthe-document-object:referrer-policy-2 hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>referrer policy/a> used by a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idthe-document-object:concept-fetch data-x-internalconcept-fetch>fetches/a> initiated by the code idthe-document-object:document-8>a href#document>Document/a>/code>./p> p>The code idthe-document-object:document-9>a href#document>Document/a>/code> has a dfn data-dfn-forDocument idconcept-document-csp-list data-export>CSP list/dfn>, which is a list of a idthe-document-object:content-security-policy hrefhttps://w3c.github.io/webappsec-csp/#content-security-policy-object data-x-internalcontent-security-policy>Content Security Policy/a> objects active in this context. The list is empty unless otherwise specified./p> p>The code idthe-document-object:document-10>a href#document>Document/a>/code> has a dfn data-dfn-forDocument idconcept-document-module-map>module map/dfn>, which is a a href#module-map idthe-document-object:module-map>module map/a>, initially empty./p> h4 idresource-metadata-management>span classsecno>3.1.2/span> dfn>Resource metadata management/dfn>a href#resource-metadata-management classself-link>/a>/h4> dl classdomintro>dt>var>document/var> . code idresource-metadata-management:dom-document-referrer>a href#dom-document-referrer>referrer/a>/code>dd> p>Returns the a hrefhttps://dom.spec.whatwg.org/#concept-document-url idresource-metadata-management:the-documents-address data-x-internalthe-documents-address>URL/a> of the code idresource-metadata-management:document>a href#document>Document/a>/code> from which the user navigated to this one, unless it was blocked or there was no such document, in which case it returns the empty string./p> p>The code idresource-metadata-management:link-type-noreferrer>a href#link-type-noreferrer>noreferrer/a>/code> link type can be used to block the referrer./p> /dl> p>The dfn iddom-document-referrer>code>referrer/code>/dfn> attribute must return a href#the-documents-referrer idresource-metadata-management:the-documents-referrer>the documents referrer/a>./p> hr> dl classdomintro>dt>var>document/var> . code idresource-metadata-management:dom-document-cookie>a href#dom-document-cookie>cookie/a>/code> var>value/var> dd> p>Returns the HTTP cookies that apply to the code idresource-metadata-management:document-2>a href#document>Document/a>/code>. If there are no cookies or cookies cant be applied to this resource, the empty string will be returned./p> p>Can be set, to add a new cookie to the elements set of HTTP cookies./p> p>If the contents are a href#sandboxed-origin-browsing-context-flag idresource-metadata-management:sandboxed-origin-browsing-context-flag>sandboxed into a unique origin/a> (e.g. in an code idresource-metadata-management:the-iframe-element>a href#the-iframe-element>iframe/a>/code> with the code idresource-metadata-management:attr-iframe-sandbox>a href#attr-iframe-sandbox>sandbox/a>/code> attribute), a a idresource-metadata-management:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idresource-metadata-management:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> will be thrown on getting and setting./p> /dl> p>The dfn iddom-document-cookie>code>cookie/code>/dfn> attribute represents the cookies of the resource identified by the documents a hrefhttps://dom.spec.whatwg.org/#concept-document-url idresource-metadata-management:the-documents-address-2 data-x-internalthe-documents-address>URL/a>./p> p>A code idresource-metadata-management:document-3>a href#document>Document/a>/code> object that falls into one of the following conditions is a dfn idcookie-averse-document-object>cookie-averse code>Document/code> object/dfn>:/p> ul>li>A code idresource-metadata-management:document-4>a href#document>Document/a>/code> that has no a href#concept-document-bc idresource-metadata-management:concept-document-bc>browsing context/a>.li>A code idresource-metadata-management:document-5>a href#document>Document/a>/code> whose a hrefhttps://dom.spec.whatwg.org/#concept-document-url idresource-metadata-management:the-documents-address-3 data-x-internalthe-documents-address>URL/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idresource-metadata-management:concept-url-scheme data-x-internalconcept-url-scheme>scheme/a> is not a a idresource-metadata-management:network-scheme hrefhttps://fetch.spec.whatwg.org/#network-scheme data-x-internalnetwork-scheme>network scheme/a>./ul> p idsandboxCookies>On getting, if the document is a a href#cookie-averse-document-object idresource-metadata-management:cookie-averse-document-object>cookie-averse code>Document/code> object/a>, then the user agent must return the empty string. Otherwise, if the code idresource-metadata-management:document-6>a href#document>Document/a>/code>s a href#concept-origin idresource-metadata-management:concept-origin>origin/a> is an a href#concept-origin-opaque idresource-metadata-management:concept-origin-opaque>opaque origin/a>, the user agent must throw a a idresource-metadata-management:securityerror-2 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idresource-metadata-management:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>. Otherwise, the user agent must return the a href#cookie-string idresource-metadata-management:cookie-string>cookie-string/a> for the documents a hrefhttps://dom.spec.whatwg.org/#concept-document-url idresource-metadata-management:the-documents-address-4 data-x-internalthe-documents-address>URL/a> for a non-HTTP API, decoded using a idresource-metadata-management:utf-8-decode-without-bom hrefhttps://encoding.spec.whatwg.org/#utf-8-decode-without-bom data-x-internalutf-8-decode-without-bom>UTF-8 decode without BOM/a>. a href#refsCOOKIES>COOKIES/a>a href#fingerprinting-vector idresource-metadata-management:fingerprinting-vector classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a>/p> p>On setting, if the document is a a href#cookie-averse-document-object idresource-metadata-management:cookie-averse-document-object-2>cookie-averse code>Document/code> object/a>, then the user agent must do nothing. Otherwise, if the code idresource-metadata-management:document-7>a href#document>Document/a>/code>s a href#concept-origin idresource-metadata-management:concept-origin-2>origin/a> is an a href#concept-origin-opaque idresource-metadata-management:concept-origin-opaque-2>opaque origin/a>, the user agent must throw a a idresource-metadata-management:securityerror-3 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idresource-metadata-management:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>. Otherwise, the user agent must act as it would when a href#receives-a-set-cookie-string idresource-metadata-management:receives-a-set-cookie-string>receiving a set-cookie-string/a> for the documents a hrefhttps://dom.spec.whatwg.org/#concept-document-url idresource-metadata-management:the-documents-address-5 data-x-internalthe-documents-address>URL/a> via a non-HTTP API, consisting of the new value a hrefhttps://encoding.spec.whatwg.org/#utf-8-encode idresource-metadata-management:utf-8-encode data-x-internalutf-8-encode>encoded as UTF-8/a>. a href#refsCOOKIES>COOKIES/a> a href#refsENCODING>ENCODING/a>/p> p classnote>Since the code idresource-metadata-management:dom-document-cookie-2>a href#dom-document-cookie>cookie/a>/code> attribute is accessible across frames, the path restrictions on cookies are only a tool to help manage which cookies are sent to which parts of the site, and are not in any way a security feature./p> p classwarning>The code idresource-metadata-management:dom-document-cookie-3>a href#dom-document-cookie>cookie/a>/code> attributes getter and setter synchronously access shared state. Since there is no locking mechanism, other browsing contexts in a multiprocess user agent can modify cookies while scripts are running. A site could, for instance, try to read a cookie, increment its value, then write it back out, using the new value of the cookie as a unique identifier for the session; if the site does this twice in two different browser windows at the same time, it might end up using the same unique identifier for both sessions, with potentially disastrous effects./p> hr> dl classdomintro>dt>var>document/var> . code idresource-metadata-management:dom-document-lastmodified>a href#dom-document-lastmodified>lastModified/a>/code>dd> p>Returns the date of the last modification to the document, as reported by the server, in the form code>MM/DD/YYYY hh:mm:ss/code>, in the users local time zone./p> p>If the last modification date is not known, the current time is returned instead./p> /dl> p>The dfn iddom-document-lastmodified>code>lastModified/code>/dfn> attribute, on getting, must return the date and time of the code idresource-metadata-management:document-8>a href#document>Document/a>/code>s source files last modification, in the users local time zone, in the following format:/p> ol>li> The month component of the date. li> A U+002F SOLIDUS character (/). li> The day component of the date. li> A U+002F SOLIDUS character (/). li> The year component of the date. li> A U+0020 SPACE character. li> The hours component of the time. li> A U+003A COLON character (:). li> The minutes component of the time. li> A U+003A COLON character (:). li> The seconds component of the time. /ol> p>All the numeric components above, other than the year, must be given as two a idresource-metadata-management:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> representing the number in base ten, zero-padded if necessary. The year must be given as the shortest possible string of four or more a idresource-metadata-management:ascii-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> representing the number in base ten, zero-padded if necessary./p> p>The code idresource-metadata-management:document-9>a href#document>Document/a>/code>s source files last modification date and time must be derived from relevant features of the networking protocols used, e.g. from the value of the HTTP `code idresource-metadata-management:http-last-modified>a data-x-internalhttp-last-modified hrefhttps://tools.ietf.org/html/rfc7232#section-2.2>Last-Modified/a>/code>` header of the document, or from metadata in the file system for local files. If the last modification date and time are not known, the attribute must return the current date and time in the above format./p> hr> dl classdomintro>dt>var>document/var> . code idresource-metadata-management:dom-document-readystate>a href#dom-document-readystate>readyState/a>/code>dd> p>Returns code>loading/code> while the code idresource-metadata-management:document-10>a href#document>Document/a>/code> is loading, code>interactive/code> once it is finished parsing but still loading subresources, and code>complete/code> once it has loaded./p> p>The code idresource-metadata-management:event-readystatechange>a href#event-readystatechange>readystatechange/a>/code> event fires on the code idresource-metadata-management:document-11>a href#document>Document/a>/code> object when this value changes./p> p>The code idresource-metadata-management:event-domcontentloaded>a href#event-domcontentloaded>DOMContentLoaded/a>/code> event fires after the transition to code>interactive/code> but before the transition to code>complete/code>, at the point where all subresources apart from code idresource-metadata-management:attr-script-async>a href#attr-script-async>async/a>/code> code idresource-metadata-management:the-script-element>a href#the-script-element>script/a>/code> elements have loaded./p> /dl> p>Each document has a dfn idcurrent-document-readiness>current document readiness/dfn>. When a code idresource-metadata-management:document-12>a href#document>Document/a>/code> object is created, it must have its a href#current-document-readiness idresource-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 idresource-metadata-management:html-parser>HTML parser/a>, an a href#xml-parser idresource-metadata-management:xml-parser>XML parser/a>, or an XSLT processor, and to the string code>complete/code> otherwise. Various algorithms during page loading affect this value. When the value is set, the user agent must a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idresource-metadata-management:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idresource-metadata-management:event-readystatechange-2>a href#event-readystatechange>readystatechange/a>/code> at the code idresource-metadata-management:document-13>a href#document>Document/a>/code> object./p> p>A code idresource-metadata-management:document-14>a href#document>Document/a>/code> is said to have an dfn idactive-parser>active parser/dfn> if it is associated with an a href#html-parser idresource-metadata-management:html-parser-2>HTML parser/a> or an a href#xml-parser idresource-metadata-management:xml-parser-2>XML parser/a> that has not yet been a href#stop-parsing idresource-metadata-management:stop-parsing>stopped/a> or a href#abort-a-parser idresource-metadata-management:abort-a-parser>aborted/a>./p> p>The dfn iddom-document-readystate>code>readyState/code>/dfn> IDL attribute must, on getting, return the a href#current-document-readiness idresource-metadata-management:current-document-readiness-2>current document readiness/a>./p> h4 iddom-tree-accessors>span classsecno>3.1.3/span> dfn>DOM tree accessors/dfn>a href#dom-tree-accessors classself-link>/a>/h4> p>dfn idthe-html-element-2>The code>html/code> element/dfn> of a document is its a iddom-tree-accessors:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>, if its an code iddom-tree-accessors:the-html-element>a href#the-html-element>html/a>/code> element, and null otherwise./p> hr> dl classdomintro>dt>var>document/var> . code iddom-tree-accessors:dom-document-head>a href#dom-document-head>head/a>/code>dd> p>Returns a href#the-head-element-2 iddom-tree-accessors:the-head-element-2>the code>head/code> element/a>./p> /dl> p>dfn idthe-head-element-2>The code>head/code> element/dfn> of a document is the first code iddom-tree-accessors:the-head-element>a href#the-head-element>head/a>/code> element that is a child of a href#the-html-element-2 iddom-tree-accessors:the-html-element-2>the code>html/code> element/a>, if there is one, or null otherwise./p> p>The dfn iddom-document-head>code>head/code>/dfn> attribute, on getting, must return a href#the-head-element-2 iddom-tree-accessors:the-head-element-2-2>the code>head/code> element/a> of the document (a code iddom-tree-accessors:the-head-element-3>a href#the-head-element>head/a>/code> element or null).div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> documentheadspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>4.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>4+/span>/span>span classie yes>span>IE/span> span>9+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>5.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.3+/span>/span>span classopera yes>span>Opera/span> span>11+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featdocumenthead>caniuse.com/a>/div> hr> dl classdomintro>dt>var>document/var> . code iddom-tree-accessors:document.title>a href#document.title>title/a>/code> var>value/var> dd> p>Returns the documents title, as given by a href#the-title-element-2 iddom-tree-accessors:the-title-element-2>the code>title/code> element/a> for HTML and as given by the a iddom-tree-accessors:svg-title hrefhttps://www.w3.org/TR/SVG11/struct.html#TitleElement data-x-internalsvg-title>SVG code>title/code>/a> element for SVG./p> p>Can be set, to update the documents title. If there is no appropriate element to update, the new value is ignored./p> /dl> p>dfn idthe-title-element-2>The code>title/code> element/dfn> of a document is the first code iddom-tree-accessors:the-title-element>a href#the-title-element>title/a>/code> element in the document (in a iddom-tree-accessors:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>), if there is one, or null otherwise./p> p>The dfn iddocument.title>code>title/code>/dfn> attribute must, on getting, run the following algorithm:/p> ol>li>p>If the a iddom-tree-accessors:document-element-2 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> is an a iddom-tree-accessors:svg-svg hrefhttps://www.w3.org/TR/SVG11/struct.html#SVGElement data-x-internalsvg-svg>SVG code>svg/code>/a> element, then let var>value/var> be the a iddom-tree-accessors:child-text-content hrefhttps://dom.spec.whatwg.org/#concept-child-text-content data-x-internalchild-text-content>child text content/a> of the first a iddom-tree-accessors:svg-title-2 hrefhttps://www.w3.org/TR/SVG11/struct.html#TitleElement data-x-internalsvg-title>SVG code>title/code>/a> element that is a child of the a iddom-tree-accessors:document-element-3 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>.li>p>Otherwise, let var>value/var> be the a iddom-tree-accessors:child-text-content-2 hrefhttps://dom.spec.whatwg.org/#concept-child-text-content data-x-internalchild-text-content>child text content/a> of a href#the-title-element-2 iddom-tree-accessors:the-title-element-2-2>the code>title/code> element/a>, or the empty string if a href#the-title-element-2 iddom-tree-accessors:the-title-element-2-3>the code>title/code> element/a> is null.li>p>a iddom-tree-accessors:strip-and-collapse-ascii-whitespace hrefhttps://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace data-x-internalstrip-and-collapse-ascii-whitespace>Strip and collapse ASCII whitespace/a> in var>value/var>.li>p>Return var>value/var>./ol> p>On setting, the steps corresponding to the first matching condition in the following list must be run:/p> dl classswitch>dt>If the a iddom-tree-accessors:document-element-4 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> is an a iddom-tree-accessors:svg-svg-2 hrefhttps://www.w3.org/TR/SVG11/struct.html#SVGElement data-x-internalsvg-svg>SVG code>svg/code>/a> elementdd> ol>li>p>If there is an a iddom-tree-accessors:svg-title-3 hrefhttps://www.w3.org/TR/SVG11/struct.html#TitleElement data-x-internalsvg-title>SVG code>title/code>/a> element that is a child of the a iddom-tree-accessors:document-element-5 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>, let var>element/var> be the first such element.li> p>Otherwise:/p> ol>li>p>Let var>element/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-create-element iddom-tree-accessors:create-an-element data-x-internalcreate-an-element>creating an element/a> given the a iddom-tree-accessors:document-element-6 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>s a iddom-tree-accessors:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, code iddom-tree-accessors:svg-title-4>a data-x-internalsvg-title hrefhttps://www.w3.org/TR/SVG11/struct.html#TitleElement>title/a>/code>, and the a iddom-tree-accessors:svg-namespace hrefhttps://infra.spec.whatwg.org/#svg-namespace data-x-internalsvg-namespace>SVG namespace/a>./p> li>p>Insert var>element/var> as the a iddom-tree-accessors:first-child hrefhttps://dom.spec.whatwg.org/#concept-tree-first-child data-x-internalfirst-child>first child/a> of the a iddom-tree-accessors:document-element-7 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>./ol> li>p>Act as if the code iddom-tree-accessors:textcontent>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> IDL attribute of var>element/var> was set to the new value being assigned./ol> dt>If the a iddom-tree-accessors:document-element-8 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> is in the a iddom-tree-accessors:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>dd> ol>li>p>If a href#the-title-element-2 iddom-tree-accessors:the-title-element-2-4>the code>title/code> element/a> is null and a href#the-head-element-2 iddom-tree-accessors:the-head-element-2-3>the code>head/code> element/a> is null, then abort these steps.li>p>If a href#the-title-element-2 iddom-tree-accessors:the-title-element-2-5>the code>title/code> element/a> is non-null, let var>element/var> be a href#the-title-element-2 iddom-tree-accessors:the-title-element-2-6>the code>title/code> element/a>.li> p>Otherwise:/p> ol>li>p>Let var>element/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-create-element iddom-tree-accessors:create-an-element-2 data-x-internalcreate-an-element>creating an element/a> given the a iddom-tree-accessors:document-element-9 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>s a iddom-tree-accessors:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, code iddom-tree-accessors:the-title-element-3>a href#the-title-element>title/a>/code>, and the a iddom-tree-accessors:html-namespace-2-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>./p> li>p>a hrefhttps://dom.spec.whatwg.org/#concept-node-append iddom-tree-accessors:concept-node-append data-x-internalconcept-node-append>Append/a> var>element/var> to a href#the-head-element-2 iddom-tree-accessors:the-head-element-2-4>the code>head/code> element/a>./ol> li>p>Act as if the code iddom-tree-accessors:textcontent-2>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> IDL attribute of var>element/var> was set to the new value being assigned./ol> dt>Otherwisedd> p>Do nothing./p> /dl> hr> dl classdomintro>dt>var>document/var> . code iddom-tree-accessors:dom-document-body>a href#dom-document-body>body/a>/code> var>value/var> dd> p>Returns a href#the-body-element-2 iddom-tree-accessors:the-body-element-2>the body element/a>./p> p>Can be set, to replace a href#the-body-element-2 iddom-tree-accessors:the-body-element-2-2>the body element/a>./p> p>If the new value is not a code iddom-tree-accessors:the-body-element>a href#the-body-element>body/a>/code> or code iddom-tree-accessors:frameset>a href#frameset>frameset/a>/code> element, this will throw a a iddom-tree-accessors:hierarchyrequesterror hrefhttps://heycam.github.io/webidl/#hierarchyrequesterror data-x-internalhierarchyrequesterror>code>HierarchyRequestError/code>/a> code iddom-tree-accessors:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> /dl> p>dfn idthe-body-element-2>The body element/dfn> of a document is the first of a href#the-html-element-2 iddom-tree-accessors:the-html-element-2-2>the code>html/code> element/a>s children that is either a code iddom-tree-accessors:the-body-element-3>a href#the-body-element>body/a>/code> element or a code iddom-tree-accessors:frameset-2>a href#frameset>frameset/a>/code> element, or null if there is no such element./p> p>The dfn iddom-document-body>code>body/code>/dfn> attribute, on getting, must return a href#the-body-element-2 iddom-tree-accessors:the-body-element-2-3>the body element/a> of the document (either a code iddom-tree-accessors:the-body-element-4>a href#the-body-element>body/a>/code> element, a code iddom-tree-accessors:frameset-3>a href#frameset>frameset/a>/code> element, or null). On setting, the following algorithm must be run:/p> ol>li>If the new value is not a code iddom-tree-accessors:the-body-element-5>a href#the-body-element>body/a>/code> or code iddom-tree-accessors:frameset-4>a href#frameset>frameset/a>/code> element, then throw a a iddom-tree-accessors:hierarchyrequesterror-2 hrefhttps://heycam.github.io/webidl/#hierarchyrequesterror data-x-internalhierarchyrequesterror>code>HierarchyRequestError/code>/a> code iddom-tree-accessors:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>Otherwise, if the new value is the same as a href#the-body-element-2 iddom-tree-accessors:the-body-element-2-4>the body element/a>, do nothing. Abort these steps.li>Otherwise, if a href#the-body-element-2 iddom-tree-accessors:the-body-element-2-5>the body element/a> is not null, then a hrefhttps://dom.spec.whatwg.org/#concept-node-replace iddom-tree-accessors:concept-node-replace data-x-internalconcept-node-replace>replace/a> a href#the-body-element-2 iddom-tree-accessors:the-body-element-2-6>the body element/a> with the new value within a href#the-body-element-2 iddom-tree-accessors:the-body-element-2-7>the body element/a>s parent and abort these steps.li>Otherwise, if there is no a iddom-tree-accessors:document-element-10 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>, throw a a iddom-tree-accessors:hierarchyrequesterror-3 hrefhttps://heycam.github.io/webidl/#hierarchyrequesterror data-x-internalhierarchyrequesterror>code>HierarchyRequestError/code>/a> code iddom-tree-accessors:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>Otherwise, a href#the-body-element-2 iddom-tree-accessors:the-body-element-2-8>the body element/a> is null, but theres a a iddom-tree-accessors:document-element-11 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>. a hrefhttps://dom.spec.whatwg.org/#concept-node-append iddom-tree-accessors:concept-node-append-2 data-x-internalconcept-node-append>Append/a> the new value to the a iddom-tree-accessors:document-element-12 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>./ol> hr> dl classdomintro>dt>var>document/var> . code iddom-tree-accessors:dom-document-images>a href#dom-document-images>images/a>/code>dd> p>Returns an code iddom-tree-accessors:htmlcollection>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> of the code iddom-tree-accessors:the-img-element>a href#the-img-element>img/a>/code> elements in the code iddom-tree-accessors:document>a href#document>Document/a>/code>./p> dt>var>document/var> . code iddom-tree-accessors:dom-document-embeds>a href#dom-document-embeds>embeds/a>/code>dt>var>document/var> . code iddom-tree-accessors:dom-document-plugins>a href#dom-document-plugins>plugins/a>/code>dd> p>Return an code iddom-tree-accessors:htmlcollection-2>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> of the code iddom-tree-accessors:the-embed-element>a href#the-embed-element>embed/a>/code> elements in the code iddom-tree-accessors:document-2>a href#document>Document/a>/code>./p> dt>var>document/var> . code iddom-tree-accessors:dom-document-links>a href#dom-document-links>links/a>/code>dd> p>Returns an code iddom-tree-accessors:htmlcollection-3>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> of the code iddom-tree-accessors:the-a-element>a href#the-a-element>a/a>/code> and code iddom-tree-accessors:the-area-element>a href#the-area-element>area/a>/code> elements in the code iddom-tree-accessors:document-3>a href#document>Document/a>/code> that have code iddom-tree-accessors:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attributes./p> dt>var>document/var> . code iddom-tree-accessors:dom-document-forms>a href#dom-document-forms>forms/a>/code>dd> p>Return an code iddom-tree-accessors:htmlcollection-4>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> of the code iddom-tree-accessors:the-form-element>a href#the-form-element>form/a>/code> elements in the code iddom-tree-accessors:document-4>a href#document>Document/a>/code>./p> dt>var>document/var> . code iddom-tree-accessors:dom-document-scripts>a href#dom-document-scripts>scripts/a>/code>dd> p>Return an code iddom-tree-accessors:htmlcollection-5>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> of the code iddom-tree-accessors:the-script-element>a href#the-script-element>script/a>/code> elements in the code iddom-tree-accessors:document-5>a href#document>Document/a>/code>./p> /dl> p>The dfn iddom-document-images>code>images/code>/dfn> attribute must return an code iddom-tree-accessors:htmlcollection-6>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> rooted at the code iddom-tree-accessors:document-6>a href#document>Document/a>/code> node, whose filter matches only code iddom-tree-accessors:the-img-element-2>a href#the-img-element>img/a>/code> elements./p> p>The dfn iddom-document-embeds>code>embeds/code>/dfn> attribute must return an code iddom-tree-accessors:htmlcollection-7>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> rooted at the code iddom-tree-accessors:document-7>a href#document>Document/a>/code> node, whose filter matches only code iddom-tree-accessors:the-embed-element-2>a href#the-embed-element>embed/a>/code> elements./p> p>The dfn iddom-document-plugins>code>plugins/code>/dfn> attribute must return the same object as that returned by the code iddom-tree-accessors:dom-document-embeds-2>a href#dom-document-embeds>embeds/a>/code> attribute./p> p>The dfn iddom-document-links>code>links/code>/dfn> attribute must return an code iddom-tree-accessors:htmlcollection-8>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> rooted at the code iddom-tree-accessors:document-8>a href#document>Document/a>/code> node, whose filter matches only code iddom-tree-accessors:the-a-element-2>a href#the-a-element>a/a>/code> elements with code iddom-tree-accessors:attr-hyperlink-href-2>a href#attr-hyperlink-href>href/a>/code> attributes and code iddom-tree-accessors:the-area-element-2>a href#the-area-element>area/a>/code> elements with code iddom-tree-accessors:attr-hyperlink-href-3>a href#attr-hyperlink-href>href/a>/code> attributes./p> p>The dfn iddom-document-forms>code>forms/code>/dfn> attribute must return an code iddom-tree-accessors:htmlcollection-9>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> rooted at the code iddom-tree-accessors:document-9>a href#document>Document/a>/code> node, whose filter matches only code iddom-tree-accessors:the-form-element-2>a href#the-form-element>form/a>/code> elements./p> p>The dfn iddom-document-scripts>code>scripts/code>/dfn> attribute must return an code iddom-tree-accessors:htmlcollection-10>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> rooted at the code iddom-tree-accessors:document-10>a href#document>Document/a>/code> node, whose filter matches only code iddom-tree-accessors:the-script-element-2>a href#the-script-element>script/a>/code> elements./p> hr> dl classdomintro>dt>var>collection/var> var>document/var> . code iddom-tree-accessors:dom-document-getelementsbyname>a href#dom-document-getelementsbyname>getElementsByName/a>/code>(var>name/var>)dd> p>Returns a code iddom-tree-accessors:nodelist>a data-x-internalnodelist hrefhttps://dom.spec.whatwg.org/#interface-nodelist>NodeList/a>/code> of elements in the code iddom-tree-accessors:document-11>a href#document>Document/a>/code> that have a code>name/code> attribute with the value var>name/var>./p> /dl> p>The dfn iddom-document-getelementsbyname>code>getElementsByName(var>name/var>)/code>/dfn> method takes a string var>name/var>, and must return a a href#live iddom-tree-accessors:live>live/a> code iddom-tree-accessors:nodelist-2>a data-x-internalnodelist hrefhttps://dom.spec.whatwg.org/#interface-nodelist>NodeList/a>/code> containing all the a href#html-elements iddom-tree-accessors:html-elements>HTML elements/a> in that document that have a code>name/code> attribute whose value is equal to the var>name/var> argument (in a a href#case-sensitive iddom-tree-accessors:case-sensitive>case-sensitive/a> manner), in a iddom-tree-accessors:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>. When the method is invoked on a code iddom-tree-accessors:document-12>a href#document>Document/a>/code> object again with the same argument, the user agent may return the same as the object returned by the earlier call. In other cases, a new code iddom-tree-accessors:nodelist-3>a data-x-internalnodelist hrefhttps://dom.spec.whatwg.org/#interface-nodelist>NodeList/a>/code> object must be returned./p> hr> dl classdomintro>dt>var>document/var> . code iddom-tree-accessors:dom-document-currentscript>a href#dom-document-currentscript>currentScript/a>/code>dd> p>Returns the code iddom-tree-accessors:the-script-element-3>a href#the-script-element>script/a>/code> element, or the a iddom-tree-accessors:svg-script hrefhttps://www.w3.org/TR/SVG11/script.html#ScriptElement data-x-internalsvg-script>SVG code>script/code>/a> element, that is currently executing, as long as the element represents a a href#classic-script iddom-tree-accessors:classic-script>classic script/a>. In the case of reentrant script execution, returns the one that most recently started executing amongst those that have not yet finished executing./p> p>Returns null if the code iddom-tree-accessors:document-13>a href#document>Document/a>/code> is not currently executing a code iddom-tree-accessors:the-script-element-4>a href#the-script-element>script/a>/code> or a iddom-tree-accessors:svg-script-2 hrefhttps://www.w3.org/TR/SVG11/script.html#ScriptElement data-x-internalsvg-script>SVG code>script/code>/a> element (e.g., because the running script is an event handler, or a timeout), or if the currently executing code iddom-tree-accessors:the-script-element-5>a href#the-script-element>script/a>/code> or a iddom-tree-accessors:svg-script-3 hrefhttps://www.w3.org/TR/SVG11/script.html#ScriptElement data-x-internalsvg-script>SVG code>script/code>/a> element represents a a href#module-script iddom-tree-accessors:module-script>module script/a>./p> /dl> p>The dfn iddom-document-currentscript>code>currentScript/code>/dfn> attribute, on getting, must return the value to which it was most recently set. When the code iddom-tree-accessors:document-14>a href#document>Document/a>/code> is created, the code iddom-tree-accessors:dom-document-currentscript-2>a href#dom-document-currentscript>currentScript/a>/code> must be initialized to null.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> document-currentscriptspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>29+/span>/span>span classios_saf yes>span>iOS Safari/span> span>8+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>4+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>8+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>4.4+/span>/span>span classopera yes>span>Opera/span> span>16+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featdocument-currentscript>caniuse.com/a>/div> p classnote>This API has fallen out of favor in the implementor and standards community, as it globally exposes code iddom-tree-accessors:the-script-element-6>a href#the-script-element>script/a>/code> or a iddom-tree-accessors:svg-script-4 hrefhttps://www.w3.org/TR/SVG11/script.html#ScriptElement data-x-internalsvg-script>SVG code>script/code>/a> elements. As such, it is not available in newer contexts, such as when running a href#module-script iddom-tree-accessors:module-script-2>module scripts/a> or when running scripts in a a iddom-tree-accessors:shadow-tree hrefhttps://dom.spec.whatwg.org/#concept-shadow-tree data-x-internalshadow-tree>shadow tree/a>. We are looking into creating a new solution for identifying the running script in such contexts, which does not make it globally available: see issue a hrefhttps://github.com/whatwg/html/issues/1013>#1013/a>./p> hr> p iddom-document-namedItem-which>The code iddom-tree-accessors:document-15>a href#document>Document/a>/code> interface a hrefhttps://heycam.github.io/webidl/#dfn-support-named-properties iddom-tree-accessors:support-named-properties data-x-internalsupport-named-properties>supports named properties/a>. The a iddom-tree-accessors:supported-property-names hrefhttps://heycam.github.io/webidl/#dfn-supported-property-names data-x-internalsupported-property-names>supported property names/a> of a code iddom-tree-accessors:document-16>a href#document>Document/a>/code> object var>document/var> at any moment consist of the following, in a iddom-tree-accessors:tree-order-3 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> according to the element that contributed them, ignoring later duplicates, and with values from code iddom-tree-accessors:the-id-attribute>a href#the-id-attribute>id/a>/code> attributes coming before values from code>name/code> attributes when the same element contributes both:/p> ul>li>p>the value of the code>name/code> content attribute for all a href#exposed iddom-tree-accessors:exposed>exposed/a> code iddom-tree-accessors:the-embed-element-3>a href#the-embed-element>embed/a>/code>, code iddom-tree-accessors:the-form-element-3>a href#the-form-element>form/a>/code>, code iddom-tree-accessors:the-iframe-element>a href#the-iframe-element>iframe/a>/code>, code iddom-tree-accessors:the-img-element-3>a href#the-img-element>img/a>/code>, and a href#exposed iddom-tree-accessors:exposed-2>exposed/a> code iddom-tree-accessors:the-object-element>a href#the-object-element>object/a>/code> elements that have a non-empty code>name/code> content attribute and are a iddom-tree-accessors:in-a-document-tree hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a> with var>document/var> as their a iddom-tree-accessors:root hrefhttps://dom.spec.whatwg.org/#concept-tree-root data-x-internalroot>root/a>;p>li>p>the value of the code iddom-tree-accessors:the-id-attribute-2>a href#the-id-attribute>id/a>/code> content attribute for all a href#exposed iddom-tree-accessors:exposed-3>exposed/a> code iddom-tree-accessors:the-object-element-2>a href#the-object-element>object/a>/code> elements that have a non-empty code iddom-tree-accessors:the-id-attribute-3>a href#the-id-attribute>id/a>/code> content attribute and are a iddom-tree-accessors:in-a-document-tree-2 hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a> with var>document/var> as their a iddom-tree-accessors:root-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-root data-x-internalroot>root/a>; andli>p>the value of the code iddom-tree-accessors:the-id-attribute-4>a href#the-id-attribute>id/a>/code> content attribute for all code iddom-tree-accessors:the-img-element-4>a href#the-img-element>img/a>/code> elements that have both a non-empty code iddom-tree-accessors:the-id-attribute-5>a href#the-id-attribute>id/a>/code> content attribute and a non-empty code>name/code> content attribute, and are a iddom-tree-accessors:in-a-document-tree-3 hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a> with var>document/var> as their a iddom-tree-accessors:root-3 hrefhttps://dom.spec.whatwg.org/#concept-tree-root data-x-internalroot>root/a>./ul> p iddom-document-nameditem>To a iddom-tree-accessors:determine-the-value-of-a-named-property hrefhttps://heycam.github.io/webidl/#dfn-determine-the-value-of-a-named-property data-x-internaldetermine-the-value-of-a-named-property>determine the value of a named property/a> var>name/var> for a code iddom-tree-accessors:document-17>a href#document>Document/a>/code>, the user agent must return the value obtained using the following steps:/p> ol>li> p>Let var>elements/var> be the list of a href#dom-document-nameditem-filter iddom-tree-accessors:dom-document-nameditem-filter>named elements/a> with the name var>name/var> that are a iddom-tree-accessors:in-a-document-tree-4 hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a> with the code iddom-tree-accessors:document-18>a href#document>Document/a>/code> as their a iddom-tree-accessors:root-4 hrefhttps://dom.spec.whatwg.org/#concept-tree-root data-x-internalroot>root/a>./p> p classnote>There will be at least one such element, by definition./p> li> p>If var>elements/var> has only one element, and that element is an code iddom-tree-accessors:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code> element, and that code iddom-tree-accessors:the-iframe-element-3>a href#the-iframe-element>iframe/a>/code> elements a href#nested-browsing-context iddom-tree-accessors:nested-browsing-context>nested browsing context/a> is not null, then return the code iddom-tree-accessors:windowproxy>a href#windowproxy>WindowProxy/a>/code> object of the elements a href#nested-browsing-context iddom-tree-accessors:nested-browsing-context-2>nested browsing context/a>./p> li> p>Otherwise, if var>elements/var> has only one element, return that element./p> li> p>Otherwise return an code iddom-tree-accessors:htmlcollection-11>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> rooted at the code iddom-tree-accessors:document-19>a href#document>Document/a>/code> node, whose filter matches only a href#dom-document-nameditem-filter iddom-tree-accessors:dom-document-nameditem-filter-2>named elements/a> with the name var>name/var>./p> /ol> p>dfn iddom-document-nameditem-filter>Named elements/dfn> with the name var>name/var>, for the purposes of the above algorithm, are those that are either:/p> ul>li>a href#exposed iddom-tree-accessors:exposed-4>Exposed/a> code iddom-tree-accessors:the-embed-element-4>a href#the-embed-element>embed/a>/code>, code iddom-tree-accessors:the-form-element-4>a href#the-form-element>form/a>/code>, code iddom-tree-accessors:the-iframe-element-4>a href#the-iframe-element>iframe/a>/code>, code iddom-tree-accessors:the-img-element-5>a href#the-img-element>img/a>/code>, or a href#exposed iddom-tree-accessors:exposed-5>exposed/a> code iddom-tree-accessors:the-object-element-3>a href#the-object-element>object/a>/code> elements that have a code>name/code> content attribute whose value is var>name/var>, orli>a href#exposed iddom-tree-accessors:exposed-6>Exposed/a> code iddom-tree-accessors:the-object-element-4>a href#the-object-element>object/a>/code> elements that have an code iddom-tree-accessors:the-id-attribute-6>a href#the-id-attribute>id/a>/code> content attribute whose value is var>name/var>, orli>code iddom-tree-accessors:the-img-element-6>a href#the-img-element>img/a>/code> elements that have an code iddom-tree-accessors:the-id-attribute-7>a href#the-id-attribute>id/a>/code> content attribute whose value is var>name/var>, and that have a non-empty code>name/code> content attribute present also./ul> p>An code iddom-tree-accessors:the-embed-element-5>a href#the-embed-element>embed/a>/code> or code iddom-tree-accessors:the-object-element-5>a href#the-object-element>object/a>/code> element is said to be dfn idexposed>exposed/dfn> if it has no a href#exposed iddom-tree-accessors:exposed-7>exposed/a> code iddom-tree-accessors:the-object-element-6>a href#the-object-element>object/a>/code> ancestor, and, for code iddom-tree-accessors:the-object-element-7>a href#the-object-element>object/a>/code> elements, is additionally either not showing its a href#fallback-content iddom-tree-accessors:fallback-content>fallback content/a> or has no code iddom-tree-accessors:the-object-element-8>a href#the-object-element>object/a>/code> or code iddom-tree-accessors:the-embed-element-6>a href#the-embed-element>embed/a>/code> descendants./p> hr> p classnote>The code iddom-tree-accessors:dom-document-dir>a href#dom-document-dir>dir/a>/code> attribute on the code iddom-tree-accessors:document-20>a href#document>Document/a>/code> interface is defined along with the code iddom-tree-accessors:the-dir-attribute>a href#the-dir-attribute>dir/a>/code> content attribute./p> h3 idelements>span classsecno>3.2/span> Elementsa href#elements classself-link>/a>/h3> h4 idsemantics-2>span classsecno>3.2.1/span> Semanticsa href#semantics-2 classself-link>/a>/h4> p>Elements, attributes, and attribute values in HTML are defined (by this specification) to have certain meanings (semantics). For example, the code idsemantics-2:the-ol-element>a href#the-ol-element>ol/a>/code> element represents an ordered list, and the code idsemantics-2:attr-lang>a href#attr-lang>lang/a>/code> attribute represents the language of the content./p> p>These definitions allow HTML processors, such as Web browsers or search engines, to present and use documents and applications in a wide variety of contexts that the author might not have considered./p> div classexample> p>As a simple example, consider a Web page written by an author who only considered desktop computer Web browsers:/p> pre><!DOCTYPE HTML><html langen> <head> <title>My Page</title> </head> <body> <h1>Welcome to my page</h1> <p>I like cars and lorries and have a big Jeep!</p> <h2>Where I live</h2> <p>I live in a small hut on a mountain!</p> </body></html>/pre> p>Because HTML conveys em>meaning/em>, rather than presentation, the same page can also be used by a small browser on a mobile phone, without any change to the page. Instead of headings being in large letters as on the desktop, for example, the browser on the mobile phone might use the same size text for the whole page, but with the headings in bold./p> p>But it goes further than just differences in screen size: the same page could equally be used by a blind user using a browser based around speech synthesis, which instead of displaying the page on a screen, reads the page to the user, e.g. using headphones. Instead of large text for the headings, the speech browser might use a different volume or a slower voice./p> p>Thats not all, either. Since the browsers know which parts of the page are the headings, they can create a document outline that the user can use to quickly navigate around the document, using keys for jump to next heading or jump to previous heading. Such features are especially common with speech browsers, where users would otherwise find quickly navigating a page quite difficult./p> p>Even beyond browsers, software can make use of this information. Search engines can use the headings to more effectively index a page, or to provide quick links to subsections of the page from their results. Tools can use the headings to create a table of contents (that is in fact how this very specifications table of contents is generated)./p> p>This example has focused on headings, but the same principle applies to all of the semantics in HTML./p> /div> p>Authors must not use elements, attributes, or attribute values for purposes other than their appropriate intended semantic purpose, as doing so prevents software from correctly processing the page./p> div classexample> p>For example, the following snippet, intended to represent the heading of a corporate site, is non-conforming because the second line is not intended to be a heading of a subsection, but merely a subheading or subtitle (a subordinate heading for the same section)./p> pre classbad><body> <h1>ACME Corporation</h1> <h2>The leaders in arbitrary fast delivery since 1920</h2> .../pre> p>The code idsemantics-2:the-hgroup-element>a href#the-hgroup-element>hgroup/a>/code> element is intended for these kinds of situations:/p> pre><body> <hgroup> <h1>ACME Corporation</h1> <h2>The leaders in arbitrary fast delivery since 1920</h2> </hgroup> .../pre> /div> div classexample> p>The document in this next example is similarly non-conforming, despite being syntactically correct, because the data placed in the cells is clearly not tabular data, and the code idsemantics-2:the-cite-element>a href#the-cite-element>cite/a>/code> element mis-used:/p> pre langen-GB classbad><!DOCTYPE HTML><html langen-GB> <head> <title> Demonstration </title> </head> <body> <table> <tr> <td> My favourite animal is the cat. </td> </tr> <tr> <td> —<a hrefhttps://example.org/~ernest/><cite>Ernest</cite></a>, in an essay from 1992 </td> </tr> </table> </body></html>/pre> p>This would make software that relies on these semantics fail: for example, a speech browser that allowed a blind user to navigate tables in the document would report the quote above as a table, confusing the user; similarly, a tool that extracted titles of works from pages would extract Ernest as the title of a work, even though its actually a persons name, not a title./p> p>A corrected version of this document might be:/p> pre langen-GB><!DOCTYPE HTML><html langen-GB> <head> <title> Demonstration </title> </head> <body> <blockquote> <p> My favourite animal is the cat. </p> </blockquote> <p> —<a hrefhttps://example.org/~ernest/>Ernest</a>, in an essay from 1992 </p> </body></html>/pre> /div> p>Authors must not use elements, attributes, or attribute values that are not permitted by this specification or a href#other-applicable-specifications idsemantics-2:other-applicable-specifications>other applicable specifications/a>, as doing so makes it significantly harder for the language to be extended in the future./p> div classexample> p>In the next example, there is a non-conforming attribute value (carpet) and a non-conforming attribute (texture), which is not permitted by this specification:/p> pre classbad><label>Carpet: <input typecarpet namec texturedeep pile></label>/pre> p>Here would be an alternative and correct way to mark this up:/p> pre><label>Carpet: <input typetext classcarpet namec data-texturedeep pile></label>/pre> /div> p idno-browsing-context>DOM nodes whose a idsemantics-2:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> does not have a a href#browsing-context idsemantics-2:browsing-context>browsing context/a> are exempt from all document conformance requirements other than the a href#writing>HTML syntax/a> requirements and a href#writing-xhtml-documents>XML syntax/a> requirements./p> div classexample> p>In particular, the code idsemantics-2:the-template-element>a href#the-template-element>template/a>/code> elements a href#template-contents idsemantics-2:template-contents>template contents/a>s a idsemantics-2:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> does not have a a href#browsing-context idsemantics-2:browsing-context-2>browsing context/a>. For example, the a href#concept-element-content-model idsemantics-2:concept-element-content-model>content model/a> requirements and attribute value microsyntax requirements do not apply to a code idsemantics-2:the-template-element-2>a href#the-template-element>template/a>/code> elements a href#template-contents idsemantics-2:template-contents-2>template contents/a>. In this example an code idsemantics-2:the-img-element>a href#the-img-element>img/a>/code> element has attribute values that are placeholders that would be invalid outside a code idsemantics-2:the-template-element-3>a href#the-template-element>template/a>/code> element./p> pre><template> <article> <img mark>src{{src}} alt{{alt}}/mark>> <h1></h1> </article></template>/pre> p>However, if the above markup were to omit the code></h1>/code> end tag, that would be a violation of the a href#writing>HTML syntax/a>, and would thus be flagged as an error by conformance checkers./p> /div> p>Through scripting and using other mechanisms, the values of attributes, text, and indeed the entire structure of the document may change dynamically while a user agent is processing it. The semantics of a document at an instant in time are those represented by the state of the document at that instant in time, and the semantics of a document can therefore change over time. User agents must update their presentation of the document as this occurs./p> p classexample>HTML has a code idsemantics-2:the-progress-element>a href#the-progress-element>progress/a>/code> element that describes a progress bar. If its value attribute is dynamically updated by a script, the UA would update the rendering to show the progress changing./p> h4 idelements-in-the-dom>span classsecno>3.2.2/span> Elements in the DOMa href#elements-in-the-dom classself-link>/a>/h4> p>The nodes representing a href#html-elements idelements-in-the-dom:html-elements>HTML elements/a> in the DOM must implement, and expose to scripts, the interfaces listed for them in the relevant sections of this specification. This includes a href#html-elements idelements-in-the-dom:html-elements-2>HTML elements/a> in a idelements-in-the-dom:xml-documents hrefhttps://dom.spec.whatwg.org/#xml-document data-x-internalxml-documents>XML documents/a>, even when those documents are in another context (e.g. inside an XSLT transform)./p> p>Elements in the DOM dfn idrepresents>represent/dfn> things; that is, they have intrinsic em>meaning/em>, also known as semantics./p> p classexample>For example, an code idelements-in-the-dom:the-ol-element>a href#the-ol-element>ol/a>/code> element represents an ordered list./p> p>Elements can be dfn idreferenced>referenced/dfn> (referred to) in some way, either explicitly or implicitly. One way that an element in the DOM can be explicitly referenced is by giving an code idelements-in-the-dom:the-id-attribute>a href#the-id-attribute>id/a>/code> attribute to the element, and then creating a a href#hyperlink idelements-in-the-dom:hyperlink>hyperlink/a> with that code idelements-in-the-dom:the-id-attribute-2>a href#the-id-attribute>id/a>/code> attributes value as the a href#scroll-to-fragid idelements-in-the-dom:scroll-to-fragid>fragment/a> for the a href#hyperlink idelements-in-the-dom:hyperlink-2>hyperlink/a>s code idelements-in-the-dom:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute value. Hyperlinks are not necessary for a reference, however; any manner of referring to the element in question will suffice./p> div classexample> p>Consider the following code idelements-in-the-dom:the-figure-element>a href#the-figure-element>figure/a>/code> element, which is given an code idelements-in-the-dom:the-id-attribute-3>a href#the-id-attribute>id/a>/code> attribute:/p> pre><figure idmodule-script-graph> <img srcmodule-script-graph.svg altModule A depends on module B, which depends on modules C and D.> <figcaption>Figure 27: a simple module graph</figcaption></figure>/pre> p>A a href#hyperlink idelements-in-the-dom:hyperlink-3>hyperlink/a>-based a href#referenced idelements-in-the-dom:referenced>reference/a> could be created using the code idelements-in-the-dom:the-a-element>a href#the-a-element>a/a>/code> element, like so:/p> pre>As we can see in <a href#module-script-graph>figure 27</a>, .../pre> p>However, there are many other ways of a href#referenced idelements-in-the-dom:referenced-2>referencing/a> the code idelements-in-the-dom:the-figure-element-2>a href#the-figure-element>figure/a>/code> element, such as:/p> ul>li>p>As depicted in the figure of modules A, B, C, and D...li>p>In Figure 27... (without a hyperlink)li>p>From the contents of the simple module graph figure...li>p>In the figure below... (but a href#figure-note-about-references>this is discouraged/a>)/ul> /div> p>The basic interface, from which all the a href#html-elements idelements-in-the-dom:html-elements-3>HTML elements/a> interfaces inherit, and which must be used by elements that have no additional requirements, is the code idelements-in-the-dom:htmlelement>a href#htmlelement>HTMLElement/a>/code> interface./p> pre classidl>ExposedWindow, a href#htmlconstructor idelements-in-the-dom:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlelement>HTMLElement/dfn> : a idelements-in-the-dom:element hrefhttps://dom.spec.whatwg.org/#interface-element data-x-internalelement>Element/a> { // metadata attributes a href#cereactions idelements-in-the-dom:cereactions>CEReactions/a> attribute DOMString a href#dom-title idelements-in-the-dom:dom-title>title/a>; a href#cereactions idelements-in-the-dom:cereactions-2>CEReactions/a> attribute DOMString a href#dom-lang idelements-in-the-dom:dom-lang>lang/a>; a href#cereactions idelements-in-the-dom:cereactions-3>CEReactions/a> attribute boolean a href#dom-translate idelements-in-the-dom:dom-translate>translate/a>; a href#cereactions idelements-in-the-dom:cereactions-4>CEReactions/a> attribute DOMString a href#dom-dir idelements-in-the-dom:dom-dir>dir/a>; SameObject readonly attribute a href#domstringmap idelements-in-the-dom:domstringmap>DOMStringMap/a> a href#dom-dataset idelements-in-the-dom:dom-dataset>dataset/a>; // a href#editing idelements-in-the-dom:editing>user interaction/a> a href#cereactions idelements-in-the-dom:cereactions-5>CEReactions/a> attribute boolean a href#dom-hidden idelements-in-the-dom:dom-hidden>hidden/a>; void a href#dom-click idelements-in-the-dom:dom-click>click/a>(); a href#cereactions idelements-in-the-dom:cereactions-6>CEReactions/a> attribute long a href#dom-tabindex idelements-in-the-dom:dom-tabindex>tabIndex/a>; void a href#dom-focus idelements-in-the-dom:dom-focus>focus/a>(optional a href#focusoptions idelements-in-the-dom:focusoptions>FocusOptions/a> options); void a href#dom-blur idelements-in-the-dom:dom-blur>blur/a>(); a href#cereactions idelements-in-the-dom:cereactions-7>CEReactions/a> attribute DOMString a href#dom-accesskey idelements-in-the-dom:dom-accesskey>accessKey/a>; readonly attribute DOMString a href#dom-accesskeylabel idelements-in-the-dom:dom-accesskeylabel>accessKeyLabel/a>; a href#cereactions idelements-in-the-dom:cereactions-8>CEReactions/a> attribute boolean a href#dom-draggable idelements-in-the-dom:dom-draggable>draggable/a>; a href#cereactions idelements-in-the-dom:cereactions-9>CEReactions/a> attribute boolean a href#dom-spellcheck idelements-in-the-dom:dom-spellcheck>spellcheck/a>; a href#cereactions idelements-in-the-dom:cereactions-10>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-innertext idelements-in-the-dom:dom-innertext>innerText/a>;};a href#htmlelement idelements-in-the-dom:htmlelement-2>HTMLElement/a> implements a href#globaleventhandlers idelements-in-the-dom:globaleventhandlers>GlobalEventHandlers/a>;a href#htmlelement idelements-in-the-dom:htmlelement-3>HTMLElement/a> implements a href#documentandelementeventhandlers idelements-in-the-dom:documentandelementeventhandlers>DocumentAndElementEventHandlers/a>;a href#htmlelement idelements-in-the-dom:htmlelement-4>HTMLElement/a> implements a href#elementcontenteditable idelements-in-the-dom:elementcontenteditable>ElementContentEditable/a>;// Note: a href#customized-built-in-element-restrictions>intentionally/a> not a href#htmlconstructor idelements-in-the-dom:htmlconstructor-2>HTMLConstructor/a>ExposedWindowinterface dfn idhtmlunknownelement>HTMLUnknownElement/dfn> : a href#htmlelement idelements-in-the-dom:htmlelement-5>HTMLElement/a> { };/pre> p>The code idelements-in-the-dom:htmlelement-6>a href#htmlelement>HTMLElement/a>/code> interface holds methods and attributes related to a number of disparate features, and the members of this interface are therefore described in various different sections of this specification./p> hr> p>The a idelements-in-the-dom:element-interface hrefhttps://dom.spec.whatwg.org/#concept-element-interface data-x-internalelement-interface>element interface/a> for an element with name var>name/var> in the a idelements-in-the-dom:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a> is determined as follows:/p> ol>li>p>If var>name/var> is code idelements-in-the-dom:applet>a href#applet>applet/a>/code>, code idelements-in-the-dom:bgsound>a href#bgsound>bgsound/a>/code>, code idelements-in-the-dom:blink>a href#blink>blink/a>/code>, code idelements-in-the-dom:isindex>a href#isindex>isindex/a>/code>, code idelements-in-the-dom:keygen>a href#keygen>keygen/a>/code>, code idelements-in-the-dom:multicol>a href#multicol>multicol/a>/code>, code idelements-in-the-dom:nextid>a href#nextid>nextid/a>/code>, or code idelements-in-the-dom:spacer>a href#spacer>spacer/a>/code>, then return code idelements-in-the-dom:htmlunknownelement>a href#htmlunknownelement>HTMLUnknownElement/a>/code>.li>p>If var>name/var> is code idelements-in-the-dom:acronym>a href#acronym>acronym/a>/code>, code idelements-in-the-dom:basefont>a href#basefont>basefont/a>/code>, code idelements-in-the-dom:big>a href#big>big/a>/code>, code idelements-in-the-dom:center>a href#center>center/a>/code>, code idelements-in-the-dom:nobr>a href#nobr>nobr/a>/code>, code idelements-in-the-dom:noembed>a href#noembed>noembed/a>/code>, code idelements-in-the-dom:noframes>a href#noframes>noframes/a>/code>, code idelements-in-the-dom:plaintext>a href#plaintext>plaintext/a>/code>, code idelements-in-the-dom:rb>a href#rb>rb/a>/code>, code idelements-in-the-dom:rtc>a href#rtc>rtc/a>/code>, code idelements-in-the-dom:strike>a href#strike>strike/a>/code>, or code idelements-in-the-dom:tt>a href#tt>tt/a>/code>, then return code idelements-in-the-dom:htmlelement-7>a href#htmlelement>HTMLElement/a>/code>.li>p>If var>name/var> is code idelements-in-the-dom:listing>a href#listing>listing/a>/code> or code idelements-in-the-dom:xmp>a href#xmp>xmp/a>/code>, then return code idelements-in-the-dom:htmlpreelement>a href#htmlpreelement>HTMLPreElement/a>/code>.li>p>Otherwise, if this specification defines an interface appropriate for the a href#element-type idelements-in-the-dom:element-type>element type/a> corresponding to the local name var>name/var>, then return that interface.li>p>If a href#other-applicable-specifications idelements-in-the-dom:other-applicable-specifications>other applicable specifications/a> define an appropriate interface for var>name/var>, then return the interface they define.li>p>If var>name/var> is a a href#valid-custom-element-name idelements-in-the-dom:valid-custom-element-name>valid custom element name/a>, then return code idelements-in-the-dom:htmlelement-8>a href#htmlelement>HTMLElement/a>/code>./p> li>p>Return code idelements-in-the-dom:htmlunknownelement-2>a href#htmlunknownelement>HTMLUnknownElement/a>/code>./ol> p classnote>The use of code idelements-in-the-dom:htmlelement-9>a href#htmlelement>HTMLElement/a>/code> instead of code idelements-in-the-dom:htmlunknownelement-3>a href#htmlunknownelement>HTMLUnknownElement/a>/code> in the case of a href#valid-custom-element-name idelements-in-the-dom:valid-custom-element-name-2>valid custom element names/a> is done to ensure that any potential future a href#upgrades idelements-in-the-dom:upgrades>upgrades/a> only cause a linear transition of the elements prototype chain, from code idelements-in-the-dom:htmlelement-10>a href#htmlelement>HTMLElement/a>/code> to a subclass, instead of a lateral one, from code idelements-in-the-dom:htmlunknownelement-4>a href#htmlunknownelement>HTMLUnknownElement/a>/code> to an unrelated subclass./p> h4 idhtml-element-constructors>span classsecno>3.2.3/span> HTML element constructorsa href#html-element-constructors classself-link>/a>/h4> p>To support the a href#custom-elements>custom elements/a> feature, all HTML elements have special constructor behavior. This is indicated via the dfn idhtmlconstructor data-dfn-typeextended-attribute data-ltHTMLConstructor data-export>code>HTMLConstructor/code>/dfn> IDL a idhtml-element-constructors:extended-attribute hrefhttps://heycam.github.io/webidl/#dfn-extended-attribute data-x-internalextended-attribute>extended attribute/a>. It indicates that the interface object for the given interface will have a specific behavior when called, as defined in detail below./p> p>The code idhtml-element-constructors:htmlconstructor>a href#htmlconstructor>HTMLConstructor/a>/code> extended attribute must take no arguments, and must not appear on anything other than an interface. It must appear only once on an interface, and the interface must not be annotated with the code>Constructor/code> or code>NoInterfaceObject/code> extended attributes. (However, the interface may be annotated with code>NamedConstructor/code>; there is no conflict there.) It must not be used on a callback interface./p> p>a hrefhttps://heycam.github.io/webidl/#dfn-interface-object idhtml-element-constructors:interface-object data-x-internalinterface-object>Interface objects/a> for interfaces annotated with the code idhtml-element-constructors:htmlconstructor-2>a href#htmlconstructor>HTMLConstructor/a>/code> extended attribute must run the following steps as the function body behavior for both Call and Construct invocations of the corresponding JavaScript function object. When invoked with Call, the NewTarget value is undefined, and so the algorithm below will immediately throw. When invoked with Construct, the Construct var>newTarget/var> parameter provides the NewTarget value./p> ol>li>p>Let var>registry/var> be the a href#current-global-object idhtml-element-constructors:current-global-object>current global object/a>s code idhtml-element-constructors:customelementregistry>a href#customelementregistry>CustomElementRegistry/a>/code> object.li> p>If NewTarget is equal to the a idhtml-element-constructors:active-function-object hrefhttps://tc39.github.io/ecma262/#active-function-object data-x-internalactive-function-object>active function object/a>, then throw a code idhtml-element-constructors:typeerror>a data-x-internaltypeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror>TypeError/a>/code> and abort these steps./p> div classexample no-backref> p>This can occur when a custom element is defined using an a idhtml-element-constructors:element-interface hrefhttps://dom.spec.whatwg.org/#concept-element-interface data-x-internalelement-interface>element interface/a> as its constructor:/p> pre>customElements.define(bad-1, HTMLButtonElement);new HTMLButtonElement(); // (1)document.createElement(bad-1); // (2)/pre> p>In this case, during the execution of code idhtml-element-constructors:htmlbuttonelement>a href#htmlbuttonelement>HTMLButtonElement/a>/code> (either explicitly, as in (1), or implicitly, as in (2)), both the a idhtml-element-constructors:active-function-object-2 hrefhttps://tc39.github.io/ecma262/#active-function-object data-x-internalactive-function-object>active function object/a> and NewTarget are code idhtml-element-constructors:htmlbuttonelement-2>a href#htmlbuttonelement>HTMLButtonElement/a>/code>. If this check was not present, it would be possible to create an instance of code idhtml-element-constructors:htmlbuttonelement-3>a href#htmlbuttonelement>HTMLButtonElement/a>/code> whose local name was code>bad-1/code>./p> /div> li> p>Let var>definition/var> be the entry in var>registry/var> with a href#concept-custom-element-definition-constructor idhtml-element-constructors:concept-custom-element-definition-constructor>constructor/a> equal to NewTarget. If there is no such definition, then throw a code idhtml-element-constructors:typeerror-2>a data-x-internaltypeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror>TypeError/a>/code> and abort these steps./p> p classnote>Since there can be no entry in var>registry/var> with a a href#concept-custom-element-definition-constructor idhtml-element-constructors:concept-custom-element-definition-constructor-2>constructor/a> of undefined, this step also prevents HTML element constructors from being called as functions (since in that case NewTarget will be undefined)./p> li> p>If var>definition/var>s a href#concept-custom-element-definition-local-name idhtml-element-constructors:concept-custom-element-definition-local-name>local name/a> is equal to var>definition/var>s a href#concept-custom-element-definition-name idhtml-element-constructors:concept-custom-element-definition-name>name/a> (i.e., var>definition/var> is for an a href#autonomous-custom-element idhtml-element-constructors:autonomous-custom-element>autonomous custom element/a>), then:/p> ol>li> p>If the a idhtml-element-constructors:active-function-object-3 hrefhttps://tc39.github.io/ecma262/#active-function-object data-x-internalactive-function-object>active function object/a> is not code idhtml-element-constructors:htmlelement>a href#htmlelement>HTMLElement/a>/code>, then throw a code idhtml-element-constructors:typeerror-3>a data-x-internaltypeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror>TypeError/a>/code> and abort these steps./p> div classexample no-backref> p>This can occur when a custom element is defined to not extend any local names, but inherits from a non-code idhtml-element-constructors:htmlelement-2>a href#htmlelement>HTMLElement/a>/code> class:/p> pre>customElements.define(bad-2, class Bad2 extends HTMLParagraphElement {});/pre> p>In this case, during the (implicit) code>super()/code> call that occurs when constructing an instance of code>Bad2/code>, the a idhtml-element-constructors:active-function-object-4 hrefhttps://tc39.github.io/ecma262/#active-function-object data-x-internalactive-function-object>active function object/a> is code idhtml-element-constructors:htmlparagraphelement>a href#htmlparagraphelement>HTMLParagraphElement/a>/code>, not code idhtml-element-constructors:htmlelement-3>a href#htmlelement>HTMLElement/a>/code>./p> /div> /ol> li> p>Otherwise (i.e., if var>definition/var> is for a a href#customized-built-in-element idhtml-element-constructors:customized-built-in-element>customized built-in element/a>):/p> ol>li>p>Let var>valid local names/var> be the list of local names for elements defined in this specification or in a href#other-applicable-specifications idhtml-element-constructors:other-applicable-specifications>other applicable specifications/a> that use the a idhtml-element-constructors:active-function-object-5 hrefhttps://tc39.github.io/ecma262/#active-function-object data-x-internalactive-function-object>active function object/a> as their a idhtml-element-constructors:element-interface-2 hrefhttps://dom.spec.whatwg.org/#concept-element-interface data-x-internalelement-interface>element interface/a>.li> p>If var>valid local names/var> does not contain var>definition/var>s a href#concept-custom-element-definition-local-name idhtml-element-constructors:concept-custom-element-definition-local-name-2>local name/a>, then throw a code idhtml-element-constructors:typeerror-4>a data-x-internaltypeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror>TypeError/a>/code> and abort these steps./p> div classexample no-backref> p>This can occur when a custom element is defined to extend a given local name but inherits from the wrong class:/p> pre>customElements.define(bad-3, class Bad3 extends HTMLQuoteElement {}, { extends: p });/pre> p>In this case, during the (implicit) code>super()/code> call that occurs when constructing an instance of code>Bad3/code>, var>valid local names/var> is the list containing code idhtml-element-constructors:the-q-element>a href#the-q-element>q/a>/code> and code idhtml-element-constructors:the-blockquote-element>a href#the-blockquote-element>blockquote/a>/code>, but var>definition/var>s a href#concept-custom-element-definition-local-name idhtml-element-constructors:concept-custom-element-definition-local-name-3>local name/a> is code idhtml-element-constructors:the-p-element>a href#the-p-element>p/a>/code>, which is not in that list./p> /div> /ol> li>p>Let var>prototype/var> be a hrefhttps://tc39.github.io/ecma262/#sec-get-o-p idhtml-element-constructors:js-get data-x-internaljs-get>Get/a>(NewTarget, prototype). Rethrow any exceptions.li> p>If a hrefhttps://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values idhtml-element-constructors:js-type data-x-internaljs-type>Type/a>(var>prototype/var>) is not Object, then:/p> ol>li>p>Let var>realm/var> be a idhtml-element-constructors:getfunctionrealm hrefhttps://tc39.github.io/ecma262/#sec-getfunctionrealm data-x-internalgetfunctionrealm>GetFunctionRealm/a>(NewTarget).li>p>Set var>prototype/var> to the a idhtml-element-constructors:interface-prototype-object hrefhttps://heycam.github.io/webidl/#dfn-interface-prototype-object data-x-internalinterface-prototype-object>interface prototype object/a> of var>realm/var> whose interface is the same as the interface of the a idhtml-element-constructors:active-function-object-6 hrefhttps://tc39.github.io/ecma262/#active-function-object data-x-internalactive-function-object>active function object/a>./ol> p classnote>The realm of the a idhtml-element-constructors:active-function-object-7 hrefhttps://tc39.github.io/ecma262/#active-function-object data-x-internalactive-function-object>active function object/a> might not be var>realm/var>, so we are using the more general concept of the same interface across realms; we are not looking for equality of a hrefhttps://heycam.github.io/webidl/#dfn-interface-object idhtml-element-constructors:interface-object-2 data-x-internalinterface-object>interface objects/a>. This fallback behavior, including using the realm of NewTarget and looking up the appropriate prototype there, is designed to match analogous behavior for the JavaScript built-ins./p> li> p>If var>definition/var>s a href#concept-custom-element-definition-construction-stack idhtml-element-constructors:concept-custom-element-definition-construction-stack>construction stack/a> is empty, then:/p> ol>li>p>Let var>element/var> be a new element that implements the interface to which the a idhtml-element-constructors:active-function-object-8 hrefhttps://tc39.github.io/ecma262/#active-function-object data-x-internalactive-function-object>active function object/a> corresponds, with no attributes, namespace set to the a idhtml-element-constructors:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>, local name set to var>definition/var>s a href#concept-custom-element-definition-local-name idhtml-element-constructors:concept-custom-element-definition-local-name-4>local name/a>, and a idhtml-element-constructors:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> set to the a href#current-global-object idhtml-element-constructors:current-global-object-2>current global object/a>s a href#concept-document-window idhtml-element-constructors:concept-document-window>associated code>Document/code>/a>.li>p>Perform var>element/var>.SetPrototypeOf(var>prototype/var>). Rethrow any exceptions.li>p>Set var>element/var>s a idhtml-element-constructors:custom-element-state hrefhttps://dom.spec.whatwg.org/#concept-element-custom-element-state data-x-internalcustom-element-state>custom element state/a> to code>custom/code>.li>p>Set var>element/var>s a hrefhttps://dom.spec.whatwg.org/#concept-element-custom-element-definition idhtml-element-constructors:concept-element-custom-element-definition data-x-internalconcept-element-custom-element-definition>custom element definition/a> to var>definition/var>.li>p>Return var>element/var>./ol> p classnote>This occurs when author script constructs a new custom element directly, e.g. via code>new MyCustomElement()/code>./p> li>p>Let var>element/var> be the last entry in var>definition/var>s a href#concept-custom-element-definition-construction-stack idhtml-element-constructors:concept-custom-element-definition-construction-stack-2>construction stack/a>.li> p>If var>element/var> is an a href#concept-already-constructed-marker idhtml-element-constructors:concept-already-constructed-marker>i>already constructed/i> marker/a>, then throw an a idhtml-element-constructors:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idhtml-element-constructors:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps./p> div classexample> p>This can occur when the author code inside the a href#custom-element-constructor idhtml-element-constructors:custom-element-constructor>custom element constructor/a> a href#custom-element-conformance>non-conformantly/a> creates another instance of the class being constructed, before calling code>super()/code>:/p> pre>let doSillyThing false;class DontDoThis extends HTMLElement { constructor() { if (doSillyThing) { doSillyThing false; new DontDoThis(); // Now the construction stack will contain an i>already constructed/i> marker. } // This will then fail with an InvalidStateError DOMException: super(); }}/pre> /div> div classexample> p>This can also occur when author code inside the a href#custom-element-constructor idhtml-element-constructors:custom-element-constructor-2>custom element constructor/a> a href#custom-element-conformance>non-conformantly/a> calls code>super()/code> twice, since per the JavaScript specification, this actually executes the superclass constructor (i.e. this algorithm) twice, before throwing an error: pre>class DontDoThisEither extends HTMLElement { constructor() { super(); // This will throw, but not until it has already called into the HTMLElement constructor super(); }}/pre> /div> li>p>Perform var>element/var>.SetPrototypeOf(var>prototype/var>). Rethrow any exceptions.li>p>Replace the last entry in var>definition/var>s a href#concept-custom-element-definition-construction-stack idhtml-element-constructors:concept-custom-element-definition-construction-stack-3>construction stack/a> with an a href#concept-already-constructed-marker idhtml-element-constructors:concept-already-constructed-marker-2>i>already constructed/i> marker/a>.li> p>Return var>element/var>./p> p classnote>This step is normally reached when a href#upgrades idhtml-element-constructors:upgrades>upgrading/a> a custom element; the existing element is returned, so that the code>super()/code> call inside the a href#custom-element-constructor idhtml-element-constructors:custom-element-constructor-3>custom element constructor/a> assigns that existing element to b>this/b>./p> /ol> hr> p>In addition to the constructor behavior implied by code idhtml-element-constructors:htmlconstructor-3>a href#htmlconstructor>HTMLConstructor/a>/code>, some elements also have a hrefhttps://heycam.github.io/webidl/#dfn-named-constructor idhtml-element-constructors:named-constructor data-x-internalnamed-constructor>named constructors/a> (which are really factory functions with a modified code>prototype/code> property). div classexample> p>Named constructors for HTML elements can also be used in an code>extends/code> clause when defining a a href#custom-element-constructor idhtml-element-constructors:custom-element-constructor-4>custom element constructor/a>:/p> pre>class AutoEmbiggenedImage extends Image { constructor(width, height) { super(width * 10, height * 10); }}customElements.define(auto-embiggened, AutoEmbiggenedImage, { extends: img });const image new AutoEmbiggenedImage(15, 20);console.assert(image.width 150);console.assert(image.height 200);/pre> /div> h4 idelement-definitions>span classsecno>3.2.4/span> Element definitionsa href#element-definitions classself-link>/a>/h4> p>Each element in this specification has a definition that includes the following information:/p> dl>dt>dfn idconcept-element-categories>Categories/dfn>dd>p>A list of a href#content-categories idelement-definitions:content-categories>categories/a> to which the element belongs. These are used when defining the a href#content-models idelement-definitions:content-models>content models/a> for each element.dt>dfn idconcept-element-contexts>Contexts in which this element can be used/dfn>dd> p>A em>non-normative/em> description of where the element can be used. This information is redundant with the content models of elements that allow this one as a child, and is provided only as a convenience./p> p classnote>For simplicity, only the most specific expectations are listed. For example, an element that is both a href#flow-content-2 idelement-definitions:flow-content-2>flow content/a> and a href#phrasing-content-2 idelement-definitions:phrasing-content-2>phrasing content/a> can be used anywhere that either a href#flow-content-2 idelement-definitions:flow-content-2-2>flow content/a> or a href#phrasing-content-2 idelement-definitions:phrasing-content-2-2>phrasing content/a> is expected, but since anywhere that a href#flow-content-2 idelement-definitions:flow-content-2-3>flow content/a> is expected, a href#phrasing-content-2 idelement-definitions:phrasing-content-2-3>phrasing content/a> is also expected (since all a href#phrasing-content-2 idelement-definitions:phrasing-content-2-4>phrasing content/a> is a href#flow-content-2 idelement-definitions:flow-content-2-4>flow content/a>), only where a href#phrasing-content-2 idelement-definitions:phrasing-content-2-5>phrasing content/a> is expected will be listed./p> dt>dfn idconcept-element-content-model>Content model/dfn>dd>p>A normative description of what content must be included as children and descendants of the element.dt>dfn idconcept-element-tag-omission>Tag omission in text/html/dfn>dd>p>A em>non-normative/em> description of whether, in the code idelement-definitions:text/html>a href#text/html>text/html/a>/code> syntax, the a href#syntax-start-tag idelement-definitions:syntax-start-tag>start/a> and a href#syntax-end-tag idelement-definitions:syntax-end-tag>end/a> tags can be omitted. This information is redundant with the normative requirements given in the a href#syntax-tag-omission idelement-definitions:syntax-tag-omission>optional tags/a> section, and is provided in the element definitions only as a convenience.dt>dfn idconcept-element-attributes>Content attributes/dfn>dd>p>A normative list of attributes that may be specified on the element (except where otherwise disallowed), along with non-normative descriptions of those attributes. (The content to the left of the dash is normative, the content to the right of the dash is not.)dt>dfn idconcept-element-dom>DOM interface/dfn>dd>p>A normative definition of a DOM interface that such elements must implement./dl> p>This is then followed by a description of what the element a href#represents idelement-definitions:represents>represents/a>, along with any additional normative conformance criteria that may apply to authors and implementations. Examples are sometimes also included./p> h5 idattributes>span classsecno>3.2.4.1/span> Attributesa href#attributes classself-link>/a>/h5> p idattribute-text>An attribute value is a string. Except where otherwise specified, attribute values on a href#html-elements idattributes:html-elements>HTML elements/a> may be any string value, including the empty string, and there is no restriction on what text can be specified in such attribute values./p> h4 idcontent-models>span classsecno>3.2.5/span> dfn>Content models/dfn>a href#content-models classself-link>/a>/h4> p>Each element defined in this specification has a content model: a description of the elements expected a href#concept-html-contents idcontent-models:concept-html-contents>contents/a>. An a href#html-elements idcontent-models:html-elements>HTML element/a> must have contents that match the requirements described in the elements content model. The dfn idconcept-html-contents>contents/dfn> of an element are its children in the DOM./p> p>a idcontent-models:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> is always allowed between elements. User agents represent these characters between elements in the source markup as code idcontent-models:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes in the DOM. Empty code idcontent-models:text-2>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes and code idcontent-models:text-3>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes consisting of just sequences of those characters are considered dfn idinter-element-whitespace>inter-element whitespace/dfn>./p> p>a href#inter-element-whitespace idcontent-models:inter-element-whitespace>Inter-element whitespace/a>, comment nodes, and processing instruction nodes must be ignored when establishing whether an elements contents match the elements content model or not, and must be ignored when following algorithms that define document and element semantics./p> p classnote>Thus, an element var>A/var> is said to be i>preceded or followed/i> by a second element var>B/var> if var>A/var> and var>B/var> have the same parent node and there are no other element nodes or code idcontent-models:text-4>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes (other than a href#inter-element-whitespace idcontent-models:inter-element-whitespace-2>inter-element whitespace/a>) between them. Similarly, a node is the i>only child/i> of an element if that element contains no other nodes other than a href#inter-element-whitespace idcontent-models:inter-element-whitespace-3>inter-element whitespace/a>, comment nodes, and processing instruction nodes./p> p>Authors must not use a href#html-elements idcontent-models:html-elements-2>HTML elements/a> anywhere except where they are explicitly allowed, as defined for each element, or as explicitly required by other specifications. For XML compound documents, these contexts could be inside elements from other namespaces, if those elements are defined as providing the relevant contexts./p> div classexample> p>For example, the Atom specification defines a code>content/code> element. When its code>type/code> attribute has the value code>xhtml/code>, the Atom specification requires that it contain a single HTML code idcontent-models:the-div-element>a href#the-div-element>div/a>/code> element. Thus, a code idcontent-models:the-div-element-2>a href#the-div-element>div/a>/code> element is allowed in that context, even though this is not explicitly normatively stated by this specification. a href#refsATOM>ATOM/a>/p> /div> p>In addition, a href#html-elements idcontent-models:html-elements-3>HTML elements/a> may be orphan nodes (i.e. without a parent node)./p> div classexample> p>For example, creating a code idcontent-models:the-td-element>a href#the-td-element>td/a>/code> element and storing it in a global variable in a script is conforming, even though code idcontent-models:the-td-element-2>a href#the-td-element>td/a>/code> elements are otherwise only supposed to be used inside code idcontent-models:the-tr-element>a href#the-tr-element>tr/a>/code> elements./p> pre>var data { name: Banana, cell: document.createElement(td),};/pre> /div> h5 idthe-nothing-content-model>span classsecno>3.2.5.1/span> The nothing content modela href#the-nothing-content-model classself-link>/a>/h5> p>When an elements content model is dfn idconcept-content-nothing>nothing/dfn>, the element must contain no code idthe-nothing-content-model:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes (other than a href#inter-element-whitespace idthe-nothing-content-model:inter-element-whitespace>inter-element whitespace/a>) and no element nodes./p> p classnote>Most HTML elements whose content model is nothing are also, for convenience, a href#void-elements idthe-nothing-content-model:void-elements>void elements/a> (elements that have no a href#syntax-end-tag idthe-nothing-content-model:syntax-end-tag>end tag/a> in the a href#syntax>HTML syntax/a>). However, these are entirely separate concepts./p> h5 idkinds-of-content>span classsecno>3.2.5.2/span> Kinds of contenta href#kinds-of-content classself-link>/a>/h5> p>Each element in HTML falls into zero or more dfn idcontent-categories>categories/dfn> that group elements with similar characteristics together. The following broad categories are used in this specification:/p> ul classbrief>li>a href#metadata-content-2 idkinds-of-content:metadata-content-2>Metadata content/a>li>a href#flow-content-2 idkinds-of-content:flow-content-2>Flow content/a>li>a href#sectioning-content-2 idkinds-of-content:sectioning-content-2>Sectioning content/a>li>a href#heading-content-2 idkinds-of-content:heading-content-2>Heading content/a>li>a href#phrasing-content-2 idkinds-of-content:phrasing-content-2>Phrasing content/a>li>a href#embedded-content-category idkinds-of-content:embedded-content-category>Embedded content/a>li>a href#interactive-content-2 idkinds-of-content:interactive-content-2>Interactive content/a>/ul> p classnote>Some elements also fall into other categories, which are defined in other parts of this specification./p> p>These categories are related as follows:/p> p>object width1000 height288 data/images/content-venn.svg>/object>/p> p>Sectioning content, heading content, phrasing content, embedded content, and interactive content are all types of flow content. Metadata is sometimes flow content. Metadata and interactive content are sometimes phrasing content. Embedded content is also a type of phrasing content, and sometimes is interactive content./p> p>Other categories are also used for specific purposes, e.g. form controls are specified using a number of categories to define common requirements. Some elements have unique requirements and do not fit into any particular category./p> h6 idmetadata-content>span classsecno>3.2.5.2.1/span> Metadata contenta href#metadata-content classself-link>/a>/h6> p>dfn idmetadata-content-2>Metadata content/dfn> is content that sets up the presentation or behavior of the rest of the content, or that sets up the relationship of the document with other documents, or that conveys other out of band information./p> ul classbrief category-list>li>code idmetadata-content:the-base-element>a href#the-base-element>base/a>/code>li>code idmetadata-content:the-link-element>a href#the-link-element>link/a>/code>li>code idmetadata-content:the-meta-element>a href#the-meta-element>meta/a>/code>li>code idmetadata-content:the-noscript-element>a href#the-noscript-element>noscript/a>/code>li>code idmetadata-content:the-script-element>a href#the-script-element>script/a>/code>li>code idmetadata-content:the-style-element>a href#the-style-element>style/a>/code>li>code idmetadata-content:the-template-element>a href#the-template-element>template/a>/code>li>code idmetadata-content:the-title-element>a href#the-title-element>title/a>/code>/ul> p>Elements from other namespaces whose semantics are primarily metadata-related (e.g. RDF) are also a href#metadata-content-2 idmetadata-content:metadata-content-2>metadata content/a>./p> div classexample> p>Thus, in the XML serialization, one can use RDF, like this:/p> pre><html xmlnshttp://www.w3.org/1999/xhtml xmlns:rhttp://www.w3.org/1999/02/22-rdf-syntax-ns# xml:langen> <head> <title>Hedrals Home Page</title> <r:RDF> <Person xmlnshttp://www.w3.org/2000/10/swap/pim/contact# r:abouthttps://hedral.example.com/#> <fullName>Cat Hedral</fullName> <mailbox r:resourcemailto:hedral@damowmow.com/> <personalTitle>Sir</personalTitle> </Person> </r:RDF> </head> <body> <h1>My home page</h1> <p>I like playing with string, I guess. Sister says squirrels are fun too so sometimes I follow her to play with them.</p> </body></html>/pre> p>This isnt possible in the HTML serialization, however./p> /div> h6 idflow-content>span classsecno>3.2.5.2.2/span> Flow contenta href#flow-content classself-link>/a>/h6> p>Most elements that are used in the body of documents and applications are categorized as dfn idflow-content-2>flow content/dfn>./p> ul classbrief category-list>li>code idflow-content:the-a-element>a href#the-a-element>a/a>/code>li>code idflow-content:the-abbr-element>a href#the-abbr-element>abbr/a>/code>li>code idflow-content:the-address-element>a href#the-address-element>address/a>/code>li>code idflow-content:the-area-element>a href#the-area-element>area/a>/code> (if it is a descendant of a code idflow-content:the-map-element>a href#the-map-element>map/a>/code> element)li>code idflow-content:the-article-element>a href#the-article-element>article/a>/code>li>code idflow-content:the-aside-element>a href#the-aside-element>aside/a>/code>li>code idflow-content:the-audio-element>a href#the-audio-element>audio/a>/code>li>code idflow-content:the-b-element>a href#the-b-element>b/a>/code>li>code idflow-content:the-bdi-element>a href#the-bdi-element>bdi/a>/code>li>code idflow-content:the-bdo-element>a href#the-bdo-element>bdo/a>/code>li>code idflow-content:the-blockquote-element>a href#the-blockquote-element>blockquote/a>/code>li>code idflow-content:the-br-element>a href#the-br-element>br/a>/code>li>code idflow-content:the-button-element>a href#the-button-element>button/a>/code>li>code idflow-content:the-canvas-element>a href#the-canvas-element>canvas/a>/code>li>code idflow-content:the-cite-element>a href#the-cite-element>cite/a>/code>li>code idflow-content:the-code-element>a href#the-code-element>code/a>/code>li>code idflow-content:the-data-element>a href#the-data-element>data/a>/code>li>code idflow-content:the-datalist-element>a href#the-datalist-element>datalist/a>/code>li>code idflow-content:the-del-element>a href#the-del-element>del/a>/code>li>code idflow-content:the-details-element>a href#the-details-element>details/a>/code>li>code idflow-content:the-dfn-element>a href#the-dfn-element>dfn/a>/code>li>code idflow-content:the-dialog-element>a href#the-dialog-element>dialog/a>/code>li>code idflow-content:the-div-element>a href#the-div-element>div/a>/code>li>code idflow-content:the-dl-element>a href#the-dl-element>dl/a>/code>li>code idflow-content:the-em-element>a href#the-em-element>em/a>/code>li>code idflow-content:the-embed-element>a href#the-embed-element>embed/a>/code>li>code idflow-content:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code>li>code idflow-content:the-figure-element>a href#the-figure-element>figure/a>/code>li>code idflow-content:the-footer-element>a href#the-footer-element>footer/a>/code>li>code idflow-content:the-form-element>a href#the-form-element>form/a>/code>li>code idflow-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 idflow-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 idflow-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 idflow-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 idflow-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 idflow-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 idflow-content:the-header-element>a href#the-header-element>header/a>/code>li>code idflow-content:the-hgroup-element>a href#the-hgroup-element>hgroup/a>/code>li>code idflow-content:the-hr-element>a href#the-hr-element>hr/a>/code>li>code idflow-content:the-i-element>a href#the-i-element>i/a>/code>li>code idflow-content:the-iframe-element>a href#the-iframe-element>iframe/a>/code>li>code idflow-content:the-img-element>a href#the-img-element>img/a>/code>li>code idflow-content:the-input-element>a href#the-input-element>input/a>/code>li>code idflow-content:the-ins-element>a href#the-ins-element>ins/a>/code>li>code idflow-content:the-kbd-element>a href#the-kbd-element>kbd/a>/code>li>code idflow-content:the-label-element>a href#the-label-element>label/a>/code>li>code idflow-content:the-link-element>a href#the-link-element>link/a>/code> (if it is a href#allowed-in-the-body idflow-content:allowed-in-the-body>allowed in the body/a>)li>code idflow-content:the-main-element>a href#the-main-element>main/a>/code>li>code idflow-content:the-map-element-2>a href#the-map-element>map/a>/code>li>code idflow-content:the-mark-element>a href#the-mark-element>mark/a>/code>li>a idflow-content:mathml-math hrefhttps://www.w3.org/Math/draft-spec/chapter2.html#interf.toplevel data-x-internalmathml-math>MathML code>math/code>/a>li>code idflow-content:the-menu-element>a href#the-menu-element>menu/a>/code>li>code idflow-content:the-meta-element>a href#the-meta-element>meta/a>/code> (if the code idflow-content:names:-the-itemprop-attribute>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute is present)li>code idflow-content:the-meter-element>a href#the-meter-element>meter/a>/code>li>code idflow-content:the-nav-element>a href#the-nav-element>nav/a>/code>li>code idflow-content:the-noscript-element>a href#the-noscript-element>noscript/a>/code>li>code idflow-content:the-object-element>a href#the-object-element>object/a>/code>li>code idflow-content:the-ol-element>a href#the-ol-element>ol/a>/code>li>code idflow-content:the-output-element>a href#the-output-element>output/a>/code>li>code idflow-content:the-p-element>a href#the-p-element>p/a>/code>li>code idflow-content:the-picture-element>a href#the-picture-element>picture/a>/code>li>code idflow-content:the-pre-element>a href#the-pre-element>pre/a>/code>li>code idflow-content:the-progress-element>a href#the-progress-element>progress/a>/code>li>code idflow-content:the-q-element>a href#the-q-element>q/a>/code>li>code idflow-content:the-ruby-element>a href#the-ruby-element>ruby/a>/code>li>code idflow-content:the-s-element>a href#the-s-element>s/a>/code>li>code idflow-content:the-samp-element>a href#the-samp-element>samp/a>/code>li>code idflow-content:the-script-element>a href#the-script-element>script/a>/code>li>code idflow-content:the-section-element>a href#the-section-element>section/a>/code>li>code idflow-content:the-select-element>a href#the-select-element>select/a>/code>li>code idflow-content:the-slot-element>a href#the-slot-element>slot/a>/code>li>code idflow-content:the-small-element>a href#the-small-element>small/a>/code>li>code idflow-content:the-span-element>a href#the-span-element>span/a>/code>li>code idflow-content:the-strong-element>a href#the-strong-element>strong/a>/code>li>code idflow-content:the-sub-and-sup-elements>a href#the-sub-and-sup-elements>sub/a>/code>li>code idflow-content:the-sub-and-sup-elements-2>a href#the-sub-and-sup-elements>sup/a>/code>li>a idflow-content:svg-svg hrefhttps://www.w3.org/TR/SVG11/struct.html#SVGElement data-x-internalsvg-svg>SVG code>svg/code>/a>li>code idflow-content:the-table-element>a href#the-table-element>table/a>/code>li>code idflow-content:the-template-element>a href#the-template-element>template/a>/code>li>code idflow-content:the-textarea-element>a href#the-textarea-element>textarea/a>/code>li>code idflow-content:the-time-element>a href#the-time-element>time/a>/code>li>code idflow-content:the-u-element>a href#the-u-element>u/a>/code>li>code idflow-content:the-ul-element>a href#the-ul-element>ul/a>/code>li>code idflow-content:the-var-element>a href#the-var-element>var/a>/code>li>code idflow-content:the-video-element>a href#the-video-element>video/a>/code>li>code idflow-content:the-wbr-element>a href#the-wbr-element>wbr/a>/code>li>a href#autonomous-custom-element idflow-content:autonomous-custom-element>autonomous custom elements/a>li>a href#text-content idflow-content:text-content>Text/a>/ul> h6 idsectioning-content>span classsecno>3.2.5.2.3/span> Sectioning contenta href#sectioning-content classself-link>/a>/h6> p>dfn idsectioning-content-2>Sectioning content/dfn> is content that defines the scope of a href#heading-content-2 idsectioning-content:heading-content-2>headings/a> and a href#the-footer-element idsectioning-content:the-footer-element>footers/a>./p> ul classbrief category-list>li>code idsectioning-content:the-article-element>a href#the-article-element>article/a>/code>li>code idsectioning-content:the-aside-element>a href#the-aside-element>aside/a>/code>li>code idsectioning-content:the-nav-element>a href#the-nav-element>nav/a>/code>li>code idsectioning-content:the-section-element>a href#the-section-element>section/a>/code>/ul> p>Each a href#sectioning-content-2 idsectioning-content:sectioning-content-2>sectioning content/a> element potentially has a heading and an a href#outline idsectioning-content:outline>outline/a>. See the section on a href#headings-and-sections idsectioning-content:headings-and-sections>headings and sections/a> for further details./p> p classnote>There are also certain elements that are a href#sectioning-root idsectioning-content:sectioning-root>sectioning roots/a>. These are distinct from a href#sectioning-content-2 idsectioning-content:sectioning-content-2-2>sectioning content/a>, but they can also have an a href#outline idsectioning-content:outline-2>outline/a>./p> h6 idheading-content>span classsecno>3.2.5.2.4/span> Heading contenta href#heading-content classself-link>/a>/h6> p>dfn idheading-content-2>Heading content/dfn> defines the header of a section (whether explicitly marked up using a href#sectioning-content-2 idheading-content:sectioning-content-2>sectioning content/a> elements, or implied by the heading content itself)./p> ul classbrief category-list>li>code idheading-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 idheading-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 idheading-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 idheading-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 idheading-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 idheading-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 idheading-content:the-hgroup-element>a href#the-hgroup-element>hgroup/a>/code>/ul> h6 idphrasing-content>span classsecno>3.2.5.2.5/span> Phrasing contenta href#phrasing-content classself-link>/a>/h6>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id25493 titleimg> Are alts not being respected in document outline for things like h1>img alt"Title" src"path/to/i ...>25493/a>/div> p>dfn idphrasing-content-2>Phrasing content/dfn> is the text of the document, as well as elements that mark up that text at the intra-paragraph level. Runs of a href#phrasing-content-2 idphrasing-content:phrasing-content-2>phrasing content/a> form a href#paragraph idphrasing-content:paragraph>paragraphs/a>./p> ul classbrief category-list>li>code idphrasing-content:the-a-element>a href#the-a-element>a/a>/code>li>code idphrasing-content:the-abbr-element>a href#the-abbr-element>abbr/a>/code>li>code idphrasing-content:the-area-element>a href#the-area-element>area/a>/code> (if it is a descendant of a code idphrasing-content:the-map-element>a href#the-map-element>map/a>/code> element)li>code idphrasing-content:the-audio-element>a href#the-audio-element>audio/a>/code>li>code idphrasing-content:the-b-element>a href#the-b-element>b/a>/code>li>code idphrasing-content:the-bdi-element>a href#the-bdi-element>bdi/a>/code>li>code idphrasing-content:the-bdo-element>a href#the-bdo-element>bdo/a>/code>li>code idphrasing-content:the-br-element>a href#the-br-element>br/a>/code>li>code idphrasing-content:the-button-element>a href#the-button-element>button/a>/code>li>code idphrasing-content:the-canvas-element>a href#the-canvas-element>canvas/a>/code>li>code idphrasing-content:the-cite-element>a href#the-cite-element>cite/a>/code>li>code idphrasing-content:the-code-element>a href#the-code-element>code/a>/code>li>code idphrasing-content:the-data-element>a href#the-data-element>data/a>/code>li>code idphrasing-content:the-datalist-element>a href#the-datalist-element>datalist/a>/code>li>code idphrasing-content:the-del-element>a href#the-del-element>del/a>/code>li>code idphrasing-content:the-dfn-element>a href#the-dfn-element>dfn/a>/code>li>code idphrasing-content:the-em-element>a href#the-em-element>em/a>/code>li>code idphrasing-content:the-embed-element>a href#the-embed-element>embed/a>/code>li>code idphrasing-content:the-i-element>a href#the-i-element>i/a>/code>li>code idphrasing-content:the-iframe-element>a href#the-iframe-element>iframe/a>/code>li>code idphrasing-content:the-img-element>a href#the-img-element>img/a>/code>li>code idphrasing-content:the-input-element>a href#the-input-element>input/a>/code>li>code idphrasing-content:the-ins-element>a href#the-ins-element>ins/a>/code>li>code idphrasing-content:the-kbd-element>a href#the-kbd-element>kbd/a>/code>li>code idphrasing-content:the-label-element>a href#the-label-element>label/a>/code>li>code idphrasing-content:the-link-element>a href#the-link-element>link/a>/code> (if it is a href#allowed-in-the-body idphrasing-content:allowed-in-the-body>allowed in the body/a>)li>code idphrasing-content:the-map-element-2>a href#the-map-element>map/a>/code>li>code idphrasing-content:the-mark-element>a href#the-mark-element>mark/a>/code>li>a idphrasing-content:mathml-math hrefhttps://www.w3.org/Math/draft-spec/chapter2.html#interf.toplevel data-x-internalmathml-math>MathML code>math/code>/a>li>code idphrasing-content:the-meta-element>a href#the-meta-element>meta/a>/code> (if the code idphrasing-content:names:-the-itemprop-attribute>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute is present)li>code idphrasing-content:the-meter-element>a href#the-meter-element>meter/a>/code>li>code idphrasing-content:the-noscript-element>a href#the-noscript-element>noscript/a>/code>li>code idphrasing-content:the-object-element>a href#the-object-element>object/a>/code>li>code idphrasing-content:the-output-element>a href#the-output-element>output/a>/code>li>code idphrasing-content:the-picture-element>a href#the-picture-element>picture/a>/code>li>code idphrasing-content:the-progress-element>a href#the-progress-element>progress/a>/code>li>code idphrasing-content:the-q-element>a href#the-q-element>q/a>/code>li>code idphrasing-content:the-ruby-element>a href#the-ruby-element>ruby/a>/code>li>code idphrasing-content:the-s-element>a href#the-s-element>s/a>/code>li>code idphrasing-content:the-samp-element>a href#the-samp-element>samp/a>/code>li>code idphrasing-content:the-script-element>a href#the-script-element>script/a>/code>li>code idphrasing-content:the-select-element>a href#the-select-element>select/a>/code>li>code idphrasing-content:the-slot-element>a href#the-slot-element>slot/a>/code>li>code idphrasing-content:the-small-element>a href#the-small-element>small/a>/code>li>code idphrasing-content:the-span-element>a href#the-span-element>span/a>/code>li>code idphrasing-content:the-strong-element>a href#the-strong-element>strong/a>/code>li>code idphrasing-content:the-sub-and-sup-elements>a href#the-sub-and-sup-elements>sub/a>/code>li>code idphrasing-content:the-sub-and-sup-elements-2>a href#the-sub-and-sup-elements>sup/a>/code>li>a idphrasing-content:svg-svg hrefhttps://www.w3.org/TR/SVG11/struct.html#SVGElement data-x-internalsvg-svg>SVG code>svg/code>/a>li>code idphrasing-content:the-template-element>a href#the-template-element>template/a>/code>li>code idphrasing-content:the-textarea-element>a href#the-textarea-element>textarea/a>/code>li>code idphrasing-content:the-time-element>a href#the-time-element>time/a>/code>li>code idphrasing-content:the-u-element>a href#the-u-element>u/a>/code>li>code idphrasing-content:the-var-element>a href#the-var-element>var/a>/code>li>code idphrasing-content:the-video-element>a href#the-video-element>video/a>/code>li>code idphrasing-content:the-wbr-element>a href#the-wbr-element>wbr/a>/code>li>a href#autonomous-custom-element idphrasing-content:autonomous-custom-element>autonomous custom elements/a>li>a href#text-content idphrasing-content:text-content>Text/a>/ul> p classnote>Most elements that are categorized as phrasing content can only contain elements that are themselves categorized as phrasing content, not any flow content./p> p>dfn idtext-content>Text/dfn>, in the context of content models, means either nothing, or code idphrasing-content:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes. a href#text-content idphrasing-content:text-content-2>Text/a> is sometimes used as a content model on its own, but is also a href#phrasing-content-2 idphrasing-content:phrasing-content-2-2>phrasing content/a>, and can be a href#inter-element-whitespace idphrasing-content:inter-element-whitespace>inter-element whitespace/a> (if the code idphrasing-content:text-2>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes are empty or contain just a idphrasing-content:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>)./p> p>code idphrasing-content:text-3>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes and attribute values must consist of a hrefhttps://infra.spec.whatwg.org/#scalar-value idphrasing-content:scalar-value data-x-internalscalar-value>scalar values/a>, excluding a hrefhttps://infra.spec.whatwg.org/#noncharacter idphrasing-content:noncharacter data-x-internalnoncharacter>noncharacters/a>, and a hrefhttps://infra.spec.whatwg.org/#control idphrasing-content:control data-x-internalcontrol>controls/a> other than a idphrasing-content:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>. This specification includes extra constraints on the exact value of code idphrasing-content:text-4>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes and attribute values depending on their precise context. /p> h6 idembedded-content-2>span classsecno>3.2.5.2.6/span> Embedded contenta href#embedded-content-2 classself-link>/a>/h6> p>dfn idembedded-content-category>Embedded content/dfn> is content that imports another resource into the document, or content from another vocabulary that is inserted into the document./p> ul classbrief category-list>li>code idembedded-content-2:the-audio-element>a href#the-audio-element>audio/a>/code>li>code idembedded-content-2:the-canvas-element>a href#the-canvas-element>canvas/a>/code>li>code idembedded-content-2:the-embed-element>a href#the-embed-element>embed/a>/code>li>code idembedded-content-2:the-iframe-element>a href#the-iframe-element>iframe/a>/code>li>code idembedded-content-2:the-img-element>a href#the-img-element>img/a>/code>li>a idembedded-content-2:mathml-math hrefhttps://www.w3.org/Math/draft-spec/chapter2.html#interf.toplevel data-x-internalmathml-math>MathML code>math/code>/a>li>code idembedded-content-2:the-object-element>a href#the-object-element>object/a>/code>li>code idembedded-content-2:the-picture-element>a href#the-picture-element>picture/a>/code>li>a idembedded-content-2:svg-svg hrefhttps://www.w3.org/TR/SVG11/struct.html#SVGElement data-x-internalsvg-svg>SVG code>svg/code>/a>li>code idembedded-content-2:the-video-element>a href#the-video-element>video/a>/code>/ul> p>Elements that are from namespaces other than the a idembedded-content-2:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a> and that convey content but not metadata, are a href#embedded-content-category idembedded-content-2:embedded-content-category>embedded content/a> for the purposes of the content models defined in this specification. (For example, MathML, or SVG.)/p> p>Some embedded content elements can have dfn idfallback-content>fallback content/dfn>: content that is to be used when the external resource cannot be used (e.g. because it is of an unsupported format). The element definitions state what the fallback is, if any./p> h6 idinteractive-content>span classsecno>3.2.5.2.7/span> Interactive contenta href#interactive-content classself-link>/a>/h6> p>dfn idinteractive-content-2>Interactive content/dfn> is content that is specifically intended for user interaction./p> ul classbrief category-list>li>code idinteractive-content:the-a-element>a href#the-a-element>a/a>/code> (if the code idinteractive-content:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute is present)li>code idinteractive-content:the-audio-element>a href#the-audio-element>audio/a>/code> (if the code idinteractive-content:attr-media-controls>a href#attr-media-controls>controls/a>/code> attribute is present)li>code idinteractive-content:the-button-element>a href#the-button-element>button/a>/code>li>code idinteractive-content:the-details-element>a href#the-details-element>details/a>/code>li>code idinteractive-content:the-embed-element>a href#the-embed-element>embed/a>/code>li>code idinteractive-content:the-iframe-element>a href#the-iframe-element>iframe/a>/code>li>code idinteractive-content:the-img-element>a href#the-img-element>img/a>/code> (if the code idinteractive-content:attr-hyperlink-usemap>a href#attr-hyperlink-usemap>usemap/a>/code> attribute is present)li>code idinteractive-content:the-input-element>a href#the-input-element>input/a>/code> (if the code idinteractive-content:attr-input-type>a href#attr-input-type>type/a>/code> attribute is em>not/em> in the a href#hidden-state-(typehidden) idinteractive-content:hidden-state-(typehidden)>Hidden/a> state)li>code idinteractive-content:the-label-element>a href#the-label-element>label/a>/code>li>code idinteractive-content:the-object-element>a href#the-object-element>object/a>/code> (if the code idinteractive-content:attr-hyperlink-usemap-2>a href#attr-hyperlink-usemap>usemap/a>/code> attribute is present)li>code idinteractive-content:the-select-element>a href#the-select-element>select/a>/code>li>code idinteractive-content:the-textarea-element>a href#the-textarea-element>textarea/a>/code>li>code idinteractive-content:the-video-element>a href#the-video-element>video/a>/code> (if the code idinteractive-content:attr-media-controls-2>a href#attr-media-controls>controls/a>/code> attribute is present)/ul> p>The code idinteractive-content:attr-tabindex>a href#attr-tabindex>tabindex/a>/code> attribute can also make any element into a href#interactive-content-2 idinteractive-content:interactive-content-2>interactive content/a>./p> h6 idpalpable-content>span classsecno>3.2.5.2.8/span> Palpable contenta href#palpable-content classself-link>/a>/h6> p>As a general rule, elements whose content model allows any a href#flow-content-2 idpalpable-content:flow-content-2>flow content/a> or a href#phrasing-content-2 idpalpable-content:phrasing-content-2>phrasing content/a> should have at least one node in its a href#concept-html-contents idpalpable-content:concept-html-contents>contents/a> that is dfn idpalpable-content-2>palpable content/dfn> and that does not have the code idpalpable-content:the-hidden-attribute>a href#the-hidden-attribute>hidden/a>/code> attribute specified./p> p classnote>a href#palpable-content-2 idpalpable-content:palpable-content-2>Palpable content/a> makes an element non-empty by providing either some descendant non-empty a href#text-content idpalpable-content:text-content>text/a>, or else something users can hear (code idpalpable-content:the-audio-element>a href#the-audio-element>audio/a>/code> elements) or view (code idpalpable-content:the-video-element>a href#the-video-element>video/a>/code> or code idpalpable-content:the-img-element>a href#the-img-element>img/a>/code> or code idpalpable-content:the-canvas-element>a href#the-canvas-element>canvas/a>/code> elements) or otherwise interact with (for example, interactive form controls)./p> p>This requirement is not a hard requirement, however, as there are many cases where an element can be empty legitimately, for example when it is used as a placeholder which will later be filled in by a script, or when the element is part of a template and would on most pages be filled in but on some pages is not relevant./p> p>Conformance checkers are encouraged to provide a mechanism for authors to find elements that fail to fulfill this requirement, as an authoring aid./p> p>The following elements are palpable content:/p> ul classbrief category-list>li>code idpalpable-content:the-a-element>a href#the-a-element>a/a>/code>li>code idpalpable-content:the-abbr-element>a href#the-abbr-element>abbr/a>/code>li>code idpalpable-content:the-address-element>a href#the-address-element>address/a>/code>li>code idpalpable-content:the-article-element>a href#the-article-element>article/a>/code>li>code idpalpable-content:the-aside-element>a href#the-aside-element>aside/a>/code>li>code idpalpable-content:the-audio-element-2>a href#the-audio-element>audio/a>/code> (if the code idpalpable-content:attr-media-controls>a href#attr-media-controls>controls/a>/code> attribute is present)li>code idpalpable-content:the-b-element>a href#the-b-element>b/a>/code>li>code idpalpable-content:the-bdi-element>a href#the-bdi-element>bdi/a>/code>li>code idpalpable-content:the-bdo-element>a href#the-bdo-element>bdo/a>/code>li>code idpalpable-content:the-blockquote-element>a href#the-blockquote-element>blockquote/a>/code>li>code idpalpable-content:the-button-element>a href#the-button-element>button/a>/code>li>code idpalpable-content:the-canvas-element-2>a href#the-canvas-element>canvas/a>/code>li>code idpalpable-content:the-cite-element>a href#the-cite-element>cite/a>/code>li>code idpalpable-content:the-code-element>a href#the-code-element>code/a>/code>li>code idpalpable-content:the-data-element>a href#the-data-element>data/a>/code>li>code idpalpable-content:the-details-element>a href#the-details-element>details/a>/code>li>code idpalpable-content:the-dfn-element>a href#the-dfn-element>dfn/a>/code>li>code idpalpable-content:the-div-element>a href#the-div-element>div/a>/code>li>code idpalpable-content:the-dl-element>a href#the-dl-element>dl/a>/code> (if the elements children include at least one name-value group)li>code idpalpable-content:the-em-element>a href#the-em-element>em/a>/code>li>code idpalpable-content:the-embed-element>a href#the-embed-element>embed/a>/code>li>code idpalpable-content:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code>li>code idpalpable-content:the-figure-element>a href#the-figure-element>figure/a>/code>li>code idpalpable-content:the-footer-element>a href#the-footer-element>footer/a>/code>li>code idpalpable-content:the-form-element>a href#the-form-element>form/a>/code>li>code idpalpable-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 idpalpable-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 idpalpable-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 idpalpable-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 idpalpable-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 idpalpable-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 idpalpable-content:the-header-element>a href#the-header-element>header/a>/code>li>code idpalpable-content:the-hgroup-element>a href#the-hgroup-element>hgroup/a>/code>li>code idpalpable-content:the-i-element>a href#the-i-element>i/a>/code>li>code idpalpable-content:the-iframe-element>a href#the-iframe-element>iframe/a>/code>li>code idpalpable-content:the-img-element-2>a href#the-img-element>img/a>/code>li>code idpalpable-content:the-input-element>a href#the-input-element>input/a>/code> (if the code idpalpable-content:attr-input-type>a href#attr-input-type>type/a>/code> attribute is em>not/em> in the a href#hidden-state-(typehidden) idpalpable-content:hidden-state-(typehidden)>Hidden/a> state)li>code idpalpable-content:the-ins-element>a href#the-ins-element>ins/a>/code>li>code idpalpable-content:the-kbd-element>a href#the-kbd-element>kbd/a>/code>li>code idpalpable-content:the-label-element>a href#the-label-element>label/a>/code>li>code idpalpable-content:the-main-element>a href#the-main-element>main/a>/code>li>code idpalpable-content:the-map-element>a href#the-map-element>map/a>/code>li>code idpalpable-content:the-mark-element>a href#the-mark-element>mark/a>/code>li>a idpalpable-content:mathml-math hrefhttps://www.w3.org/Math/draft-spec/chapter2.html#interf.toplevel data-x-internalmathml-math>MathML code>math/code>/a>li>code idpalpable-content:the-menu-element>a href#the-menu-element>menu/a>/code> (if the elements children include at least one code idpalpable-content:the-li-element>a href#the-li-element>li/a>/code> element)li>code idpalpable-content:the-meter-element>a href#the-meter-element>meter/a>/code>li>code idpalpable-content:the-nav-element>a href#the-nav-element>nav/a>/code>li>code idpalpable-content:the-object-element>a href#the-object-element>object/a>/code>li>code idpalpable-content:the-ol-element>a href#the-ol-element>ol/a>/code> (if the elements children include at least one code idpalpable-content:the-li-element-2>a href#the-li-element>li/a>/code> element)li>code idpalpable-content:the-output-element>a href#the-output-element>output/a>/code>li>code idpalpable-content:the-p-element>a href#the-p-element>p/a>/code>li>code idpalpable-content:the-pre-element>a href#the-pre-element>pre/a>/code>li>code idpalpable-content:the-progress-element>a href#the-progress-element>progress/a>/code>li>code idpalpable-content:the-q-element>a href#the-q-element>q/a>/code>li>code idpalpable-content:the-ruby-element>a href#the-ruby-element>ruby/a>/code>li>code idpalpable-content:the-s-element>a href#the-s-element>s/a>/code>li>code idpalpable-content:the-samp-element>a href#the-samp-element>samp/a>/code>li>code idpalpable-content:the-section-element>a href#the-section-element>section/a>/code>li>code idpalpable-content:the-select-element>a href#the-select-element>select/a>/code>li>code idpalpable-content:the-small-element>a href#the-small-element>small/a>/code>li>code idpalpable-content:the-span-element>a href#the-span-element>span/a>/code>li>code idpalpable-content:the-strong-element>a href#the-strong-element>strong/a>/code>li>code idpalpable-content:the-sub-and-sup-elements>a href#the-sub-and-sup-elements>sub/a>/code>li>code idpalpable-content:the-sub-and-sup-elements-2>a href#the-sub-and-sup-elements>sup/a>/code>li>a idpalpable-content:svg-svg hrefhttps://www.w3.org/TR/SVG11/struct.html#SVGElement data-x-internalsvg-svg>SVG code>svg/code>/a>li>code idpalpable-content:the-table-element>a href#the-table-element>table/a>/code>li>code idpalpable-content:the-textarea-element>a href#the-textarea-element>textarea/a>/code>li>code idpalpable-content:the-time-element>a href#the-time-element>time/a>/code>li>code idpalpable-content:the-u-element>a href#the-u-element>u/a>/code>li>code idpalpable-content:the-ul-element>a href#the-ul-element>ul/a>/code> (if the elements children include at least one code idpalpable-content:the-li-element-3>a href#the-li-element>li/a>/code> element)li>code idpalpable-content:the-var-element>a href#the-var-element>var/a>/code>li>code idpalpable-content:the-video-element-2>a href#the-video-element>video/a>/code>li>a href#autonomous-custom-element idpalpable-content:autonomous-custom-element>autonomous custom elements/a>li>a href#text-content idpalpable-content:text-content-2>Text/a> that is not a href#inter-element-whitespace idpalpable-content:inter-element-whitespace>inter-element whitespace/a>/ul> h6 idscript-supporting-elements>span classsecno>3.2.5.2.9/span> Script-supporting elementsa href#script-supporting-elements classself-link>/a>/h6> p>dfn idscript-supporting-elements-2>Script-supporting elements/dfn> are those that do not a href#represents idscript-supporting-elements:represents>represent/a> anything themselves (i.e. they are not rendered), but are used to support scripts, e.g. to provide functionality for the user./p> p>The following elements are script-supporting elements:/p> ul classbrief category-list>li>code idscript-supporting-elements:the-script-element>a href#the-script-element>script/a>/code>li>code idscript-supporting-elements:the-template-element>a href#the-template-element>template/a>/code>/ul> h5 idtransparent-content-models>span classsecno>3.2.5.3/span> Transparent content modelsa href#transparent-content-models classself-link>/a>/h5> p>Some elements are described as dfn idtransparent>transparent/dfn>; they have transparent in the description of their content model. The content model of a a href#transparent idtransparent-content-models:transparent>transparent/a> element is derived from the content model of its parent element: the elements required in the part of the content model that is transparent are the same elements as required in the part of the content model of the parent of the transparent element in which the transparent element finds itself./p> div classexample> p>For instance, an code idtransparent-content-models:the-ins-element>a href#the-ins-element>ins/a>/code> element inside a code idtransparent-content-models:the-ruby-element>a href#the-ruby-element>ruby/a>/code> element cannot contain an code idtransparent-content-models:the-rt-element>a href#the-rt-element>rt/a>/code> element, because the part of the code idtransparent-content-models:the-ruby-element-2>a href#the-ruby-element>ruby/a>/code> elements content model that allows code idtransparent-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 idtransparent-content-models:phrasing-content-2>phrasing content/a>, and the code idtransparent-content-models:the-rt-element-2>a href#the-rt-element>rt/a>/code> element is not a href#phrasing-content-2 idtransparent-content-models:phrasing-content-2-2>phrasing content/a>./p> /div> p classnote>In some cases, where transparent elements are nested in each other, the process has to be applied iteratively./p> div classexample> p>Consider the following markup fragment:/p> pre><p><object><param><ins><map><a href/>Apples</a></map></ins></object></p>/pre> p>To check whether Apples is allowed inside the code idtransparent-content-models:the-a-element>a href#the-a-element>a/a>/code> element, the content models are examined. The code idtransparent-content-models:the-a-element-2>a href#the-a-element>a/a>/code> elements content model is transparent, as is the code idtransparent-content-models:the-map-element>a href#the-map-element>map/a>/code> elements, as is the code idtransparent-content-models:the-ins-element-3>a href#the-ins-element>ins/a>/code> elements, as is the part of the code idtransparent-content-models:the-object-element>a href#the-object-element>object/a>/code> elements in which the code idtransparent-content-models:the-ins-element-4>a href#the-ins-element>ins/a>/code> element is found. The code idtransparent-content-models:the-object-element-2>a href#the-object-element>object/a>/code> element is found in the code idtransparent-content-models:the-p-element>a href#the-p-element>p/a>/code> element, whose content model is a href#phrasing-content-2 idtransparent-content-models:phrasing-content-2-3>phrasing content/a>. Thus, Apples is allowed, as text is phrasing content./p> /div> p>When a transparent element has no parent, then the part of its content model that is transparent must instead be treated as accepting any a href#flow-content-2 idtransparent-content-models:flow-content-2>flow content/a>./p> h5 idparagraphs>span classsecno>3.2.5.4/span> Paragraphsa href#paragraphs classself-link>/a>/h5> p classnote>The term a href#paragraph idparagraphs:paragraph>paragraph/a> as defined in this section is used for more than just the definition of the code idparagraphs:the-p-element>a href#the-p-element>p/a>/code> element. The a href#paragraph idparagraphs:paragraph-2>paragraph/a> concept defined here is used to describe how to interpret documents. The code idparagraphs:the-p-element-2>a href#the-p-element>p/a>/code> element is merely one of several ways of marking up a a href#paragraph idparagraphs:paragraph-3>paragraph/a>./p> p>A dfn idparagraph>paragraph/dfn> is typically a run of a href#phrasing-content-2 idparagraphs:phrasing-content-2>phrasing content/a> that forms a block of text with one or more sentences that discuss a particular topic, as in typography, but can also be used for more general thematic grouping. For instance, an address is also a paragraph, as is a part of a form, a byline, or a stanza in a poem./p> div classexample> p>In the following example, there are two paragraphs in a section. There is also a heading, which contains phrasing content that is not a paragraph. Note how the comments and a href#inter-element-whitespace idparagraphs:inter-element-whitespace>inter-element whitespace/a> do not form paragraphs./p> pre><section> <h1>Example of paragraphs</h1> This is the <em>first</em> paragraph in this example. <p>This is the second.</p> <!-- This is not a paragraph. --></section>/pre> /div> p>Paragraphs in a href#flow-content-2 idparagraphs:flow-content-2>flow content/a> are defined relative to what the document looks like without the code idparagraphs:the-a-element>a href#the-a-element>a/a>/code>, code idparagraphs:the-ins-element>a href#the-ins-element>ins/a>/code>, code idparagraphs:the-del-element>a href#the-del-element>del/a>/code>, and code idparagraphs:the-map-element>a href#the-map-element>map/a>/code> elements complicating matters, since those elements, with their hybrid content models, can straddle paragraph boundaries, as shown in the first two examples below./p> p classnote>Generally, having elements straddle paragraph boundaries is best avoided. Maintaining such markup can be difficult./p> div classexample> p>The following example takes the markup from the earlier example and puts code idparagraphs:the-ins-element-2>a href#the-ins-element>ins/a>/code> and code idparagraphs:the-del-element-2>a href#the-del-element>del/a>/code> elements around some of the markup to show that the text was changed (though in this case, the changes admittedly dont make much sense). Notice how this example has exactly the same paragraphs as the previous one, despite the code idparagraphs:the-ins-element-3>a href#the-ins-element>ins/a>/code> and code idparagraphs:the-del-element-3>a href#the-del-element>del/a>/code> elements — the code idparagraphs:the-ins-element-4>a href#the-ins-element>ins/a>/code> element straddles the heading and the first paragraph, and the code idparagraphs:the-del-element-4>a href#the-del-element>del/a>/code> element straddles the boundary between the two paragraphs./p> pre><section> <ins><h1>Example of paragraphs</h1> This is the <em>first</em> paragraph in</ins> this example<del>. <p>This is the second.</p></del> <!-- This is not a paragraph. --></section>/pre> /div> p>Let var>view/var> be a view of the DOM that replaces all code idparagraphs:the-a-element-2>a href#the-a-element>a/a>/code>, code idparagraphs:the-ins-element-5>a href#the-ins-element>ins/a>/code>, code idparagraphs:the-del-element-5>a href#the-del-element>del/a>/code>, and code idparagraphs:the-map-element-2>a href#the-map-element>map/a>/code> elements in the document with their a href#concept-html-contents idparagraphs:concept-html-contents>contents/a>. Then, in var>view/var>, for each run of sibling a href#phrasing-content-2 idparagraphs:phrasing-content-2-2>phrasing content/a> nodes uninterrupted by other types of content, in an element that accepts content other than a href#phrasing-content-2 idparagraphs:phrasing-content-2-3>phrasing content/a> as well as a href#phrasing-content-2 idparagraphs:phrasing-content-2-4>phrasing content/a>, let var>first/var> be the first node of the run, and let var>last/var> be the last node of the run. For each such run that consists of at least one node that is neither a href#embedded-content-category idparagraphs:embedded-content-category>embedded content/a> nor a href#inter-element-whitespace idparagraphs:inter-element-whitespace-2>inter-element whitespace/a>, a paragraph exists in the original DOM from immediately before var>first/var> to immediately after var>last/var>. (Paragraphs can thus span across code idparagraphs:the-a-element-3>a href#the-a-element>a/a>/code>, code idparagraphs:the-ins-element-6>a href#the-ins-element>ins/a>/code>, code idparagraphs:the-del-element-6>a href#the-del-element>del/a>/code>, and code idparagraphs:the-map-element-3>a href#the-map-element>map/a>/code> elements.)/p> p>Conformance checkers may warn authors of cases where they have paragraphs that overlap each other (this can happen with code idparagraphs:the-object-element>a href#the-object-element>object/a>/code>, code idparagraphs:the-video-element>a href#the-video-element>video/a>/code>, code idparagraphs:the-audio-element>a href#the-audio-element>audio/a>/code>, and code idparagraphs:the-canvas-element>a href#the-canvas-element>canvas/a>/code> elements, and indirectly through elements in other namespaces that allow HTML to be further embedded therein, like a idparagraphs:svg-svg hrefhttps://www.w3.org/TR/SVG11/struct.html#SVGElement data-x-internalsvg-svg>SVG code>svg/code>/a> or a idparagraphs:mathml-math hrefhttps://www.w3.org/Math/draft-spec/chapter2.html#interf.toplevel data-x-internalmathml-math>MathML code>math/code>/a>)./p> p>A a href#paragraph idparagraphs:paragraph-4>paragraph/a> is also formed explicitly by code idparagraphs:the-p-element-3>a href#the-p-element>p/a>/code> elements./p> p classnote>The code idparagraphs:the-p-element-4>a href#the-p-element>p/a>/code> element can be used to wrap individual paragraphs when there would otherwise not be any content other than phrasing content to separate the paragraphs from each other./p> div classexample> p>In the following example, the link spans half of the first paragraph, all of the heading separating the two paragraphs, and half of the second paragraph. It straddles the paragraphs and the heading./p> pre><header> Welcome! <a hrefabout.html> This is home of... <h1>The Falcons!</h1> The Lockheed Martin multirole jet fighter aircraft! </a> This page discusses the F-16 Fighting Falcons innermost secrets.</header>/pre> p>Here is another way of marking this up, this time showing the paragraphs explicitly, and splitting the one link element into three:/p> pre><header> <p>Welcome! <a hrefabout.html>This is home of...</a></p> <h1><a hrefabout.html>The Falcons!</a></h1> <p><a hrefabout.html>The Lockheed Martin multirole jet fighter aircraft!</a> This page discusses the F-16 Fighting Falcons innermost secrets.</p></header>/pre> /div> div classexample> p>It is possible for paragraphs to overlap when using certain elements that define fallback content. For example, in the following section:/p> pre><section> <h1>My Cats</h1> You can play with my cat simulator. <object datacats.sim> To see the cat simulator, use one of the following links: <ul> <li><a hrefcats.sim>Download simulator file</a> <li><a hrefhttps://sims.example.com/watch?vLYds5xY4INU>Use online simulator</a> </ul> Alternatively, upgrade to the Mellblom Browser. </object> Im quite proud of it.</section>/pre> p>There are five paragraphs:/p> ol classbrief>li>The paragraph that says You can play with my cat simulator. i>object/i> Im quite proud of it., where i>object/i> is the code idparagraphs:the-object-element-2>a href#the-object-element>object/a>/code> element.li>The paragraph that says To see the cat simulator, use one of the following links:.li>The paragraph that says Download simulator file.li>The paragraph that says Use online simulator.li>The paragraph that says Alternatively, upgrade to the Mellblom Browser../ol> p>The first paragraph is overlapped by the other four. A user agent that supports the cats.sim resource will only show the first one, but a user agent that shows the fallback will confusingly show the first sentence of the first paragraph as if it was in the same paragraph as the second one, and will show the last paragraph as if it was at the start of the second sentence of the first paragraph./p> p>To avoid this confusion, explicit code idparagraphs:the-p-element-5>a href#the-p-element>p/a>/code> elements can be used. For example:/p> pre><section> <h1>My Cats</h1> <p>You can play with my cat simulator.</p> <object datacats.sim> <p>To see the cat simulator, use one of the following links:</p> <ul> <li><a hrefcats.sim>Download simulator file</a> <li><a hrefhttps://sims.example.com/watch?vLYds5xY4INU>Use online simulator</a> </ul> <p>Alternatively, upgrade to the Mellblom Browser.</p> </object> <p>Im quite proud of it.</p></section>/pre> /div> h4 idglobal-attributes>span classsecno>3.2.6/span> dfn>Global attributes/dfn>a href#global-attributes classself-link>/a>/h4> p>The following attributes are common to and may be specified on all a href#html-elements idglobal-attributes:html-elements>HTML elements/a> (even those not defined in this specification):/p> ul classbrief>li>code idglobal-attributes:the-accesskey-attribute>a href#the-accesskey-attribute>accesskey/a>/code>li>code idglobal-attributes:attr-contenteditable>a href#attr-contenteditable>contenteditable/a>/code>li>code idglobal-attributes:the-dir-attribute>a href#the-dir-attribute>dir/a>/code>li>code idglobal-attributes:the-draggable-attribute>a href#the-draggable-attribute>draggable/a>/code>li>code idglobal-attributes:the-hidden-attribute>a href#the-hidden-attribute>hidden/a>/code>li>code idglobal-attributes:attr-is>a href#attr-is>is/a>/code>li>code idglobal-attributes:attr-itemid>a href#attr-itemid>itemid/a>/code>li>code idglobal-attributes:names:-the-itemprop-attribute>a href#names:-the-itemprop-attribute>itemprop/a>/code>li>code idglobal-attributes:attr-itemref>a href#attr-itemref>itemref/a>/code>li>code idglobal-attributes:attr-itemscope>a href#attr-itemscope>itemscope/a>/code>li>code idglobal-attributes:attr-itemtype>a href#attr-itemtype>itemtype/a>/code>li>code idglobal-attributes:attr-lang>a href#attr-lang>lang/a>/code>li>code idglobal-attributes:attr-spellcheck>a href#attr-spellcheck>spellcheck/a>/code>li>code idglobal-attributes:the-style-attribute>a href#the-style-attribute>style/a>/code>li>code idglobal-attributes:attr-tabindex>a href#attr-tabindex>tabindex/a>/code>li>code idglobal-attributes:attr-title>a href#attr-title>title/a>/code>li>code idglobal-attributes:attr-translate>a href#attr-translate>translate/a>/code>/ul> p>These attributes are only defined by this specification as attributes for a href#html-elements idglobal-attributes:html-elements-2>HTML elements/a>. When this specification refers to elements having these attributes, elements from namespaces that are not defined as having these attributes must not be considered as being elements with these attributes./p> div classexample> p>For example, in the following XML fragment, the code>bogus/code> element does not have a code idglobal-attributes:the-dir-attribute-2>a href#the-dir-attribute>dir/a>/code> attribute as defined in this specification, despite having an attribute with the literal name code>dir/code>. Thus, a href#the-directionality idglobal-attributes:the-directionality>the directionality/a> of the inner-most code idglobal-attributes:the-span-element>a href#the-span-element>span/a>/code> element is a href#concept-rtl idglobal-attributes:concept-rtl>rtl/a>, inherited from the code idglobal-attributes:the-div-element>a href#the-div-element>div/a>/code> element indirectly through the code>bogus/code> element./p> pre classbad><div xmlnshttp://www.w3.org/1999/xhtml dirrtl> <bogus xmlnshttps://example.net/ns dirltr> <span xmlnshttp://www.w3.org/1999/xhtml> </span> </bogus></div>/pre> /div> hr> p>The WHATWG DOM standard defines the user agent requirements for the dfn idclasses>code>class/code>/dfn>, dfn idthe-id-attribute>code>id/code>/dfn>, and dfn idattr-slot>code>slot/code>/dfn> attributes for any element in any namespace. a href#refsDOM>DOM/a>/p> p>The code idglobal-attributes:classes>a href#classes>class/a>/code>, code idglobal-attributes:the-id-attribute>a href#the-id-attribute>id/a>/code>, and code idglobal-attributes:attr-slot>a href#attr-slot>slot/a>/code> attributes may be specified on all a href#html-elements idglobal-attributes:html-elements-3>HTML elements/a>./p> p>When specified on a href#html-elements idglobal-attributes:html-elements-4>HTML elements/a>, the code idglobal-attributes:classes-2>a href#classes>class/a>/code> attribute must have a value that is a a href#set-of-space-separated-tokens idglobal-attributes:set-of-space-separated-tokens>set of space-separated tokens/a> representing the various classes that the element belongs to./p> div classnote> p>Assigning classes to an element affects class matching in selectors in CSS, the code idglobal-attributes:dom-document-getelementsbyclassname>a data-x-internaldom-document-getelementsbyclassname hrefhttps://dom.spec.whatwg.org/#dom-document-getelementsbyclassname>getElementsByClassName()/a>/code> method in the DOM, and other such features./p> p>There are no additional restrictions on the tokens authors can use in the code idglobal-attributes:classes-3>a href#classes>class/a>/code> attribute, but authors are encouraged to use values that describe the nature of the content, rather than values that describe the desired presentation of the content./p> /div> p>When specified on a href#html-elements idglobal-attributes:html-elements-5>HTML elements/a>, the code idglobal-attributes:the-id-attribute-2>a href#the-id-attribute>id/a>/code> attribute value must be unique amongst all the a hrefhttps://dom.spec.whatwg.org/#concept-id idglobal-attributes:concept-id data-x-internalconcept-id>IDs/a> in the elements a idglobal-attributes:tree hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a> and must contain at least one character. The value must not contain any a idglobal-attributes:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>./p> div classnote> p>The code idglobal-attributes:the-id-attribute-3>a href#the-id-attribute>id/a>/code> attribute specifies its elements a hrefhttps://dom.spec.whatwg.org/#concept-id idglobal-attributes:concept-id-2 data-x-internalconcept-id>unique identifier (ID)/a>./p> p>There are no other restrictions on what form an ID can take; in particular, IDs can consist of just digits, start with a digit, start with an underscore, consist of just punctuation, etc./p> p>An elements a hrefhttps://dom.spec.whatwg.org/#concept-id idglobal-attributes:concept-id-3 data-x-internalconcept-id>unique identifier/a> can be used for a variety of purposes, most notably as a way to link to specific parts of a document using a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idglobal-attributes:concept-url-fragment data-x-internalconcept-url-fragment>fragments/a>, as a way to target an element when scripting, and as a way to style a specific element from CSS./p> /div> p>Identifiers are opaque strings. Particular meanings should not be derived from the value of the code idglobal-attributes:the-id-attribute-4>a href#the-id-attribute>id/a>/code> attribute./p> p>There are no conformance requirements for the code idglobal-attributes:attr-slot-2>a href#attr-slot>slot/a>/code> attribute specific to a href#html-elements idglobal-attributes:html-elements-6>HTML elements/a>./p> p classnote>The code idglobal-attributes:attr-slot-3>a href#attr-slot>slot/a>/code> attribute is used to a idglobal-attributes:assign-a-slot hrefhttps://dom.spec.whatwg.org/#assign-a-slot data-x-internalassign-a-slot>assign a slot/a> to an element: an element with a code idglobal-attributes:attr-slot-4>a href#attr-slot>slot/a>/code> attribute is a hrefhttps://dom.spec.whatwg.org/#assign-a-slot idglobal-attributes:assign-a-slot-2 data-x-internalassign-a-slot>assigned/a> to the a hrefhttps://dom.spec.whatwg.org/#concept-slot idglobal-attributes:concept-slot data-x-internalconcept-slot>slot/a> created by the code idglobal-attributes:the-slot-element>a href#the-slot-element>slot/a>/code> element whose a href#attr-slot-name idglobal-attributes:attr-slot-name>name/a> attributes value matches that code idglobal-attributes:attr-slot-5>a href#attr-slot>slot/a>/code> attributes value — but only if that code idglobal-attributes:the-slot-element-2>a href#the-slot-element>slot/a>/code> element finds itself in the a idglobal-attributes:shadow-tree hrefhttps://dom.spec.whatwg.org/#concept-shadow-tree data-x-internalshadow-tree>shadow tree/a> whose a idglobal-attributes:root hrefhttps://dom.spec.whatwg.org/#concept-tree-root data-x-internalroot>root/a>s a hrefhttps://dom.spec.whatwg.org/#concept-documentfragment-host idglobal-attributes:concept-documentfragment-host data-x-internalconcept-documentfragment-host>host/a> has the corresponding code idglobal-attributes:attr-slot-6>a href#attr-slot>slot/a>/code> attribute value./p> hr> p>To enable assistive technology products to expose a more fine-grained interface than is otherwise possible with HTML elements and attributes, a set of a href#wai-aria>annotations for assistive technology products/a> can be specified (the ARIA code idglobal-attributes:attr-aria-role>a href#attr-aria-role>role/a>/code> and code idglobal-attributes:attr-aria-*>a href#attr-aria-*>aria-*/a>/code> attributes). a href#refsARIA>ARIA/a>/p> hr> p>The following a href#event-handler-content-attributes idglobal-attributes:event-handler-content-attributes>event handler content attributes/a> may be specified on any a href#html-elements idglobal-attributes:html-elements-7>HTML element/a>:/p> ul classbrief>li>code idglobal-attributes:handler-onabort>a href#handler-onabort>onabort/a>/code>li>code idglobal-attributes:handler-onauxclick>a href#handler-onauxclick>onauxclick/a>/code>li>code idglobal-attributes:handler-onblur>a href#handler-onblur>onblur/a>/code>*li>code idglobal-attributes:handler-oncancel>a href#handler-oncancel>oncancel/a>/code>li>code idglobal-attributes:handler-oncanplay>a href#handler-oncanplay>oncanplay/a>/code>li>code idglobal-attributes:handler-oncanplaythrough>a href#handler-oncanplaythrough>oncanplaythrough/a>/code>li>code idglobal-attributes:handler-onchange>a href#handler-onchange>onchange/a>/code>li>code idglobal-attributes:handler-onclick>a href#handler-onclick>onclick/a>/code>li>code idglobal-attributes:handler-onclose>a href#handler-onclose>onclose/a>/code>li>code idglobal-attributes:handler-oncontextmenu>a href#handler-oncontextmenu>oncontextmenu/a>/code>li>code idglobal-attributes:handler-oncuechange>a href#handler-oncuechange>oncuechange/a>/code>li>code idglobal-attributes:handler-ondblclick>a href#handler-ondblclick>ondblclick/a>/code>li>code idglobal-attributes:handler-ondrag>a href#handler-ondrag>ondrag/a>/code>li>code idglobal-attributes:handler-ondragend>a href#handler-ondragend>ondragend/a>/code>li>code idglobal-attributes:handler-ondragenter>a href#handler-ondragenter>ondragenter/a>/code>li>code idglobal-attributes:handler-ondragexit>a href#handler-ondragexit>ondragexit/a>/code>li>code idglobal-attributes:handler-ondragleave>a href#handler-ondragleave>ondragleave/a>/code>li>code idglobal-attributes:handler-ondragover>a href#handler-ondragover>ondragover/a>/code>li>code idglobal-attributes:handler-ondragstart>a href#handler-ondragstart>ondragstart/a>/code>li>code idglobal-attributes:handler-ondrop>a href#handler-ondrop>ondrop/a>/code>li>code idglobal-attributes:handler-ondurationchange>a href#handler-ondurationchange>ondurationchange/a>/code>li>code idglobal-attributes:handler-onemptied>a href#handler-onemptied>onemptied/a>/code>li>code idglobal-attributes:handler-onended>a href#handler-onended>onended/a>/code>li>code idglobal-attributes:handler-onerror>a href#handler-onerror>onerror/a>/code>*li>code idglobal-attributes:handler-onfocus>a href#handler-onfocus>onfocus/a>/code>*li>code idglobal-attributes:handler-oninput>a href#handler-oninput>oninput/a>/code>li>code idglobal-attributes:handler-oninvalid>a href#handler-oninvalid>oninvalid/a>/code>li>code idglobal-attributes:handler-onkeydown>a href#handler-onkeydown>onkeydown/a>/code>li>code idglobal-attributes:handler-onkeypress>a href#handler-onkeypress>onkeypress/a>/code>li>code idglobal-attributes:handler-onkeyup>a href#handler-onkeyup>onkeyup/a>/code>li>code idglobal-attributes:handler-onload>a href#handler-onload>onload/a>/code>*li>code idglobal-attributes:handler-onloadeddata>a href#handler-onloadeddata>onloadeddata/a>/code>li>code idglobal-attributes:handler-onloadedmetadata>a href#handler-onloadedmetadata>onloadedmetadata/a>/code>li>code idglobal-attributes:handler-onloadend>a href#handler-onloadend>onloadend/a>/code>li>code idglobal-attributes:handler-onloadstart>a href#handler-onloadstart>onloadstart/a>/code>li>code idglobal-attributes:handler-onmousedown>a href#handler-onmousedown>onmousedown/a>/code>li>code idglobal-attributes:handler-onmouseenter>a href#handler-onmouseenter>onmouseenter/a>/code>li>code idglobal-attributes:handler-onmouseleave>a href#handler-onmouseleave>onmouseleave/a>/code>li>code idglobal-attributes:handler-onmousemove>a href#handler-onmousemove>onmousemove/a>/code>li>code idglobal-attributes:handler-onmouseout>a href#handler-onmouseout>onmouseout/a>/code>li>code idglobal-attributes:handler-onmouseover>a href#handler-onmouseover>onmouseover/a>/code>li>code idglobal-attributes:handler-onmouseup>a href#handler-onmouseup>onmouseup/a>/code>li>code idglobal-attributes:handler-onwheel>a href#handler-onwheel>onwheel/a>/code>li>code idglobal-attributes:handler-onpause>a href#handler-onpause>onpause/a>/code>li>code idglobal-attributes:handler-onplay>a href#handler-onplay>onplay/a>/code>li>code idglobal-attributes:handler-onplaying>a href#handler-onplaying>onplaying/a>/code>li>code idglobal-attributes:handler-onprogress>a href#handler-onprogress>onprogress/a>/code>li>code idglobal-attributes:handler-onratechange>a href#handler-onratechange>onratechange/a>/code>li>code idglobal-attributes:handler-onreset>a href#handler-onreset>onreset/a>/code>li>code idglobal-attributes:handler-onresize>a href#handler-onresize>onresize/a>/code>*li>code idglobal-attributes:handler-onscroll>a href#handler-onscroll>onscroll/a>/code>*li>code idglobal-attributes:handler-onsecuritypolicyviolation>a href#handler-onsecuritypolicyviolation>onsecuritypolicyviolation/a>/code>li>code idglobal-attributes:handler-onseeked>a href#handler-onseeked>onseeked/a>/code>li>code idglobal-attributes:handler-onseeking>a href#handler-onseeking>onseeking/a>/code>li>code idglobal-attributes:handler-onselect>a href#handler-onselect>onselect/a>/code>li>code idglobal-attributes:handler-onstalled>a href#handler-onstalled>onstalled/a>/code>li>code idglobal-attributes:handler-onsubmit>a href#handler-onsubmit>onsubmit/a>/code>li>code idglobal-attributes:handler-onsuspend>a href#handler-onsuspend>onsuspend/a>/code>li>code idglobal-attributes:handler-ontimeupdate>a href#handler-ontimeupdate>ontimeupdate/a>/code>li>code idglobal-attributes:handler-ontoggle>a href#handler-ontoggle>ontoggle/a>/code>li>code idglobal-attributes:handler-onvolumechange>a href#handler-onvolumechange>onvolumechange/a>/code>li>code idglobal-attributes:handler-onwaiting>a href#handler-onwaiting>onwaiting/a>/code>/ul> p classnote>The attributes marked with an asterisk have a different meaning when specified on code idglobal-attributes:the-body-element>a href#the-body-element>body/a>/code> elements as those elements expose a href#event-handlers idglobal-attributes:event-handlers>event handlers/a> of the code idglobal-attributes:window>a href#window>Window/a>/code> object with the same names./p> p classnote>While these attributes apply to all elements, they are not useful on all elements. For example, only a href#media-element idglobal-attributes:media-element>media elements/a> will ever receive a code idglobal-attributes:event-media-volumechange>a href#event-media-volumechange>volumechange/a>/code> event fired by the user agent./p> hr> p>a href#custom-data-attribute idglobal-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 idglobal-attributes:html-elements-8>HTML element/a>, to store custom data, state, annotations, and similar, specific to the page./p> hr> p>In a idglobal-attributes:html-documents hrefhttps://dom.spec.whatwg.org/#html-document data-x-internalhtml-documents>HTML documents/a>, elements in the a idglobal-attributes:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-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 idglobal-attributes:xml-documents hrefhttps://dom.spec.whatwg.org/#xml-document data-x-internalxml-documents>XML documents/a>./p> p classnote>In HTML, the code>xmlns/code> attribute has absolutely no effect. It is basically a talisman. It is allowed merely to make migration to and from XML mildly easier. When parsed by an a href#html-parser idglobal-attributes:html-parser>HTML parser/a>, the attribute ends up in no namespace, not the code>http://www.w3.org/2000/xmlns//code> namespace like namespace declaration attributes in XML do./p> p classnote>In XML, an code>xmlns/code> attribute is part of the namespace declaration mechanism, and an element cannot actually have an code>xmlns/code> attribute in no namespace specified./p> hr> p>The XML specification also allows the use of the code idglobal-attributes:attr-xml-space>a href#attr-xml-space>xml:space/a>/code> attribute in the a idglobal-attributes:xml-namespace hrefhttps://infra.spec.whatwg.org/#xml-namespace data-x-internalxml-namespace>XML namespace/a> on any element in an a hrefhttps://dom.spec.whatwg.org/#xml-document idglobal-attributes:xml-documents-2 data-x-internalxml-documents>XML document/a>. This attribute has no effect on a href#html-elements idglobal-attributes:html-elements-9>HTML elements/a>, as the default behavior in HTML is to preserve whitespace. a href#refsXML>XML/a>/p> p classnote>There is no way to serialize the code idglobal-attributes:attr-xml-space-2>a href#attr-xml-space>xml:space/a>/code> attribute on a href#html-elements idglobal-attributes:html-elements-10>HTML elements/a> in the code idglobal-attributes:text/html>a href#text/html>text/html/a>/code> syntax./p> h5 idthe-title-attribute>span classsecno>3.2.6.1/span> The code idthe-title-attribute:attr-title>a href#attr-title>title/a>/code> attributea href#the-title-attribute classself-link>/a>/h5> p>The dfn idattr-title>code>title/code>/dfn> attribute a href#represents idthe-title-attribute:represents>represents/a> advisory information for the element, such as would be appropriate for a tooltip. On a link, this could be the title or a description of the target resource; on an image, it could be the image credit or a description of the image; on a paragraph, it could be a footnote or commentary on the text; on a citation, it could be further information about the source; on a href#interactive-content-2 idthe-title-attribute:interactive-content-2>interactive content/a>, it could be a label for, or instructions for, use of the element; and so forth. The value is text./p> p classnote>Relying on the code idthe-title-attribute:attr-title-2>a href#attr-title>title/a>/code> attribute is currently discouraged as many user agents do not expose the attribute in an accessible manner as required by this specification (e.g. requiring a pointing device such as a mouse to cause a tooltip to appear, which excludes keyboard-only users and touch-only users, such as anyone with a modern phone or tablet)./p> p>If this attribute is omitted from an element, then it implies that the code idthe-title-attribute:attr-title-3>a href#attr-title>title/a>/code> attribute of the nearest ancestor a href#html-elements idthe-title-attribute:html-elements>HTML element/a> with a code idthe-title-attribute:attr-title-4>a href#attr-title>title/a>/code> attribute set is also relevant to this element. Setting the attribute overrides this, explicitly stating that the advisory information of any ancestors is not relevant to this element. Setting the attribute to the empty string indicates that the element has no advisory information./p> p>If the code idthe-title-attribute:attr-title-5>a href#attr-title>title/a>/code> attributes value contains U+000A LINE FEED (LF) characters, the content is split into multiple lines. Each U+000A LINE FEED (LF) character represents a line break./p> div classexample> p>Caution is advised with respect to the use of newlines in code idthe-title-attribute:attr-title-6>a href#attr-title>title/a>/code> attributes./p> p>For instance, the following snippet actually defines an abbreviations expansion em>with a line break in it/em>:/p> pre classbad><p>My logs show that there was some interest in <abbr titleHypertextTransport Protocol>HTTP</abbr> today.</p>/pre> /div> p>Some elements, such as code idthe-title-attribute:the-link-element>a href#the-link-element>link/a>/code>, code idthe-title-attribute:the-abbr-element>a href#the-abbr-element>abbr/a>/code>, and code idthe-title-attribute:the-input-element>a href#the-input-element>input/a>/code>, define additional semantics for the code idthe-title-attribute:attr-title-7>a href#attr-title>title/a>/code> attribute beyond the semantics described above./p> p>The dfn idadvisory-information>advisory information/dfn> of an element is the value that the following algorithm returns, with the algorithm being aborted once a value is returned. When the algorithm returns the empty string, then there is no advisory information./p> ol>li>p>If the element is a code idthe-title-attribute:the-link-element-2>a href#the-link-element>link/a>/code>, code idthe-title-attribute:the-style-element>a href#the-style-element>style/a>/code>, code idthe-title-attribute:the-dfn-element>a href#the-dfn-element>dfn/a>/code>, or code idthe-title-attribute:the-abbr-element-2>a href#the-abbr-element>abbr/a>/code> element, then: if the element has a code>title/code> attribute, return the value of that attribute, otherwise, return the empty string.li>p>Otherwise, if the element has a code idthe-title-attribute:attr-title-8>a href#attr-title>title/a>/code> attribute, then return its value.li>p>Otherwise, if the element has a parent element, then return the parent elements a href#advisory-information idthe-title-attribute:advisory-information>advisory information/a>.li>p>Otherwise, return the empty string./ol> p>User agents should inform the user when elements have a href#advisory-information idthe-title-attribute:advisory-information-2>advisory information/a>, otherwise the information would not be discoverable./p> hr> p>The dfn iddom-title>code>title/code>/dfn> IDL attribute must a href#reflect idthe-title-attribute:reflect>reflect/a> the code idthe-title-attribute:attr-title-9>a href#attr-title>title/a>/code> content attribute./p> h5 idthe-lang-and-xml:lang-attributes>span classsecno>3.2.6.2/span> The code idthe-lang-and-xml:lang-attributes:attr-lang>a href#attr-lang>lang/a>/code> and code idthe-lang-and-xml:lang-attributes:attr-xml-lang>a href#attr-xml-lang>xml:lang/a>/code> attributesa href#the-lang-and-xml:lang-attributes classself-link>/a>/h5> p>The dfn idattr-lang>code>lang/code>/dfn> attribute (in no namespace) specifies the primary language for the elements contents and for any of the elements attributes that contain text. Its value must be a valid BCP 47 language tag, or the empty string. Setting the attribute to the empty string indicates that the primary language is unknown. a href#refsBCP47>BCP47/a>/p> p>The dfn idattr-xml-lang>code>lang/code>/dfn> attribute in the a idthe-lang-and-xml:lang-attributes:xml-namespace hrefhttps://infra.spec.whatwg.org/#xml-namespace data-x-internalxml-namespace>XML namespace/a> is defined in XML. a href#refsXML>XML/a>/p> p>If these attributes are omitted from an element, then the language of this element is the same as the language of its parent element, if any./p> p>The code idthe-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 idthe-lang-and-xml:lang-attributes:html-elements>HTML element/a>./p> p>The a href#attr-xml-lang idthe-lang-and-xml:lang-attributes:attr-xml-lang-2>code>lang/code> attribute in the span>XML namespace/span>/a> may be used on a href#html-elements idthe-lang-and-xml:lang-attributes:html-elements-2>HTML elements/a> in a idthe-lang-and-xml:lang-attributes:xml-documents hrefhttps://dom.spec.whatwg.org/#xml-document data-x-internalxml-documents>XML documents/a>, as well as elements in other namespaces if the relevant specifications allow it (in particular, MathML and SVG allow a href#attr-xml-lang idthe-lang-and-xml:lang-attributes:attr-xml-lang-3>code>lang/code> attributes in the span>XML namespace/span>/a> to be specified on their elements). If both the code idthe-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 idthe-lang-and-xml:lang-attributes:attr-xml-lang-4>code>lang/code> attribute in the span>XML namespace/span>/a> are specified on the same element, they must have exactly the same value when compared in an a idthe-lang-and-xml:lang-attributes:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> manner./p> p>Authors must not use the a href#attr-xml-lang idthe-lang-and-xml:lang-attributes:attr-xml-lang-5>code>lang/code> attribute in the span>XML namespace/span>/a> on a href#html-elements idthe-lang-and-xml:lang-attributes:html-elements-3>HTML elements/a> in a idthe-lang-and-xml:lang-attributes:html-documents hrefhttps://dom.spec.whatwg.org/#html-document data-x-internalhtml-documents>HTML documents/a>. To ease migration to and from XML, authors may specify an attribute in no namespace with no prefix and with the literal localname code>xml:lang/code> on a href#html-elements idthe-lang-and-xml:lang-attributes:html-elements-4>HTML elements/a> in a idthe-lang-and-xml:lang-attributes:html-documents-2 hrefhttps://dom.spec.whatwg.org/#html-document data-x-internalhtml-documents>HTML documents/a>, but such attributes must only be specified if a code idthe-lang-and-xml:lang-attributes:attr-lang-4>a href#attr-lang>lang/a>/code> attribute in no namespace is also specified, and both attributes must have the same value when compared in an a idthe-lang-and-xml:lang-attributes:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> manner./p> p classnote>The attribute in no namespace with no prefix and with the literal localname code>xml:lang/code> has no effect on language processing./p> hr> p>To determine the dfn idlanguage>language/dfn> of a node, user agents must look at the nearest ancestor element (including the element itself if the node is an element) that has a a href#attr-xml-lang idthe-lang-and-xml:lang-attributes:attr-xml-lang-6>code>lang/code> attribute in the span>XML namespace/span>/a> set or is an a href#html-elements idthe-lang-and-xml:lang-attributes:html-elements-5>HTML element/a> and has a code idthe-lang-and-xml:lang-attributes:attr-lang-5>a href#attr-lang>lang/a>/code> in no namespace attribute set. That attribute specifies the language of the node (regardless of its value)./p> p>If both the code idthe-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 idthe-lang-and-xml:lang-attributes:attr-xml-lang-7>code>lang/code> attribute in the span>XML namespace/span>/a> are set on an element, user agents must use the a href#attr-xml-lang idthe-lang-and-xml:lang-attributes:attr-xml-lang-8>code>lang/code> attribute in the span>XML namespace/span>/a>, and the code idthe-lang-and-xml:lang-attributes:attr-lang-7>a href#attr-lang>lang/a>/code> attribute in no namespace must be a href#ignore idthe-lang-and-xml:lang-attributes:ignore>ignored/a> for the purposes of determining the elements language./p> p>If nodes a hrefhttps://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor idthe-lang-and-xml:lang-attributes:inclusive-ancestor data-x-internalinclusive-ancestor>inclusive ancestors/a> do not have either attribute set, but there is a a href#pragma-set-default-language idthe-lang-and-xml:lang-attributes:pragma-set-default-language>pragma-set default language/a> set, then that is the language of the node. If there is no a href#pragma-set-default-language idthe-lang-and-xml:lang-attributes:pragma-set-default-language-2>pragma-set default language/a> set, then language information from a higher-level protocol (such as HTTP), if any, must be used as the final fallback language instead. In the absence of any such language information, and in cases where the higher-level protocol reports multiple languages, the language of the node is unknown, and the corresponding language tag is the empty string./p> p>If the resulting value is not a recognized language tag, then it must be treated as an unknown language having the given language tag, distinct from all other languages. For the purposes of round-tripping or communicating with other services that expect language tags, user agents should pass unknown language tags through unmodified, and tagged as being BCP 47 language tags, so that subsequent services do not interpret the data as another type of language description. a href#refsBCP47>BCP47/a>/p> p classexample>Thus, for instance, an element with code>langxyzzy/code> would be matched by the selector code>:lang(xyzzy)/code> (e.g. in CSS), but it would not be matched by code>:lang(abcde)/code>, even though both are equally invalid. Similarly, if a Web browser and screen reader working in unison communicated about the language of the element, the browser would tell the screen reader that the language was xyzzy, even if it knew it was invalid, just in case the screen reader actually supported a language with that tag after all. Even if the screen reader supported both BCP 47 and another syntax for encoding language names, and in that other syntax the string xyzzy was a way to denote the Belarusian language, it would be em>incorrect/em> for the screen reader to then start treating text as Belarusian, because xyzzy is not how Belarusian is described in BCP 47 codes (BCP 47 uses the code be for Belarusian)./p> p>If the resulting value is the empty string, then it must be interpreted as meaning that the language of the node is explicitly unknown./p> hr> p>User agents may use the elements language to determine proper processing or rendering (e.g. in the selection of appropriate fonts or pronunciations, for dictionary selection, or for the user interfaces of form controls such as date pickers). /p> hr> p>The dfn iddom-lang>code>lang/code>/dfn> IDL attribute must a href#reflect idthe-lang-and-xml:lang-attributes:reflect>reflect/a> the code idthe-lang-and-xml:lang-attributes:attr-lang-8>a href#attr-lang>lang/a>/code> content attribute in no namespace./p> h5 idthe-translate-attribute>span classsecno>3.2.6.3/span> The code idthe-translate-attribute:attr-translate>a href#attr-translate>translate/a>/code> attributea href#the-translate-attribute classself-link>/a>/h5> p>The dfn idattr-translate>code>translate/code>/dfn> attribute is an a href#enumerated-attribute idthe-translate-attribute:enumerated-attribute>enumerated attribute/a> that is used to specify whether an elements attribute values and the values of its code idthe-translate-attribute:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node children are to be translated when the page is localized, or whether to leave them unchanged./p> p>The attributes keywords are the empty string, code>yes/code>, and code>no/code>. The empty string and the code>yes/code> keyword map to the i>yes/i> state. The code>no/code> keyword maps to the i>no/i> state. In addition, there is a third state, the i>inherit/i> state, which is the i idthe-translate-attribute:missing-value-default>a href#missing-value-default>missing value default/a>/i> (and the i idthe-translate-attribute:invalid-value-default>a href#invalid-value-default>invalid value default/a>/i>)./p> p>Each element (even non-HTML elements) has a dfn idtranslation-mode>translation mode/dfn>, which is in either the a href#translate-enabled idthe-translate-attribute:translate-enabled>translate-enabled/a> state or the a href#no-translate idthe-translate-attribute:no-translate>no-translate/a> state. If an a href#html-elements idthe-translate-attribute:html-elements>HTML element/a>s code idthe-translate-attribute:attr-translate-2>a href#attr-translate>translate/a>/code> attribute is in the i>yes/i> state, then the elements a href#translation-mode idthe-translate-attribute:translation-mode>translation mode/a> is in the a href#translate-enabled idthe-translate-attribute:translate-enabled-2>translate-enabled/a> state; otherwise, if the elements code idthe-translate-attribute:attr-translate-3>a href#attr-translate>translate/a>/code> attribute is in the i>no/i> state, then the elements a href#translation-mode idthe-translate-attribute:translation-mode-2>translation mode/a> is in the a href#no-translate idthe-translate-attribute:no-translate-2>no-translate/a> state. Otherwise, either the elements code idthe-translate-attribute:attr-translate-4>a href#attr-translate>translate/a>/code> attribute is in the i>inherit/i> state, or the element is not an a href#html-elements idthe-translate-attribute:html-elements-2>HTML element/a> and thus does not have a code idthe-translate-attribute:attr-translate-5>a href#attr-translate>translate/a>/code> attribute; in either case, the elements a href#translation-mode idthe-translate-attribute:translation-mode-3>translation mode/a> is in the same state as its parent elements, if any, or in the a href#translate-enabled idthe-translate-attribute:translate-enabled-3>translate-enabled/a> state, if the element is a a idthe-translate-attribute:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>./p> p>When an element is in the dfn idtranslate-enabled>translate-enabled/dfn> state, the elements a href#translatable-attributes idthe-translate-attribute:translatable-attributes>translatable attributes/a> and the values of its code idthe-translate-attribute:text-2>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node children are to be translated when the page is localized./p> p>When an element is in the dfn idno-translate>no-translate/dfn> state, the elements attribute values and the values of its code idthe-translate-attribute:text-3>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node children are to be left as-is when the page is localized, e.g. because the element contains a persons name or a name of a computer program./p> p>The following attributes are dfn idtranslatable-attributes>translatable attributes/dfn>:/p> ul classbrief>li>code idthe-translate-attribute:attr-th-abbr>a href#attr-th-abbr>abbr/a>/code> on code idthe-translate-attribute:the-th-element>a href#the-th-element>th/a>/code> elementsli>code>alt/code> on code idthe-translate-attribute:attr-area-alt>a href#attr-area-alt>area/a>/code>, code idthe-translate-attribute:attr-img-alt>a href#attr-img-alt>img/a>/code>, and code idthe-translate-attribute:attr-input-alt>a href#attr-input-alt>input/a>/code> elementsli>code idthe-translate-attribute:attr-meta-content>a href#attr-meta-content>content/a>/code> on code idthe-translate-attribute:the-meta-element>a href#the-meta-element>meta/a>/code> elements, if the code idthe-translate-attribute:attr-meta-name>a href#attr-meta-name>name/a>/code> attribute specifies a metadata name whose value is known to be translatableli>code idthe-translate-attribute:attr-hyperlink-download>a href#attr-hyperlink-download>download/a>/code> on code idthe-translate-attribute:the-a-element>a href#the-a-element>a/a>/code> and code idthe-translate-attribute:the-area-element>a href#the-area-element>area/a>/code> elementsli>code>label/code> on code idthe-translate-attribute:attr-optgroup-label>a href#attr-optgroup-label>optgroup/a>/code>, code idthe-translate-attribute:attr-option-label>a href#attr-option-label>option/a>/code>, and code idthe-translate-attribute:attr-track-label>a href#attr-track-label>track/a>/code> elementsli>code idthe-translate-attribute:attr-lang>a href#attr-lang>lang/a>/code> on a href#html-elements idthe-translate-attribute:html-elements-3>HTML elements/a>; must be translated to match the language used in the translationli>code>placeholder/code> on code idthe-translate-attribute:attr-input-placeholder>a href#attr-input-placeholder>input/a>/code> and code idthe-translate-attribute:attr-textarea-placeholder>a href#attr-textarea-placeholder>textarea/a>/code> elementsli>code idthe-translate-attribute:attr-iframe-srcdoc>a href#attr-iframe-srcdoc>srcdoc/a>/code> on code idthe-translate-attribute:the-iframe-element>a href#the-iframe-element>iframe/a>/code> elements; must be parsed and recursively processedli>code idthe-translate-attribute:the-style-attribute>a href#the-style-attribute>style/a>/code> on a href#html-elements idthe-translate-attribute:html-elements-4>HTML elements/a>; must be parsed and recursively processed (e.g. for the values of a idthe-translate-attribute:content hrefhttps://drafts.csswg.org/css2/generate.html#content data-x-internalcontent>content/a> properties)li>code idthe-translate-attribute:attr-title>a href#attr-title>title/a>/code> on all a href#html-elements idthe-translate-attribute:html-elements-5>HTML elements/a>li>code idthe-translate-attribute:attr-input-value>a href#attr-input-value>value/a>/code> on code idthe-translate-attribute:the-input-element>a href#the-input-element>input/a>/code> elements with a code idthe-translate-attribute:attr-input-type>a href#attr-input-type>type/a>/code> attribute in the a href#button-state-(typebutton) idthe-translate-attribute:button-state-(typebutton)>Button/a> state or the a href#reset-button-state-(typereset) idthe-translate-attribute:reset-button-state-(typereset)>Reset Button/a> state/ul> p>Other specifications may define other attributes that are also a href#translatable-attributes idthe-translate-attribute:translatable-attributes-2>translatable attributes/a>. For example, ARIA would define the code idthe-translate-attribute:attr-aria-label>a data-x-internalattr-aria-label hrefhttps://w3c.github.io/aria/aria/aria.html#aria-label>aria-label/a>/code> attribute as translatable./p> hr> p>The dfn iddom-translate>code>translate/code>/dfn> IDL attribute must, on getting, return true if the elements a href#translation-mode idthe-translate-attribute:translation-mode-4>translation mode/a> is a href#translate-enabled idthe-translate-attribute:translate-enabled-4>translate-enabled/a>, and false otherwise. On setting, it must set the content attributes value to code>yes/code> if the new value is true, and set the content attributes value to code>no/code> otherwise./p> div classexample> p>In this example, everything in the document is to be translated when the page is localized, except the sample keyboard input and sample program output:/p> pre><!DOCTYPE HTML><html langen> <!-- default on the document element is translateyes --> <head> <title>The Bee Game</title> <!-- implied translateyes inherited from ancestors --> </head> <body> <p>The Bee Game is a text adventure game in English.</p> <p>When the game launches, the first thing you should do is type <kbd strong>translateno/strong>>eat honey</kbd>. The game will respond with:</p> <pre><samp strong>translateno/strong>>Yum yum! That was some good honey!</samp></pre> </body></html>/pre> /div> h5 idthe-dir-attribute>span classsecno>3.2.6.4/span> The dfn>code>dir/code>/dfn> attributea href#the-dir-attribute classself-link>/a>/h5> p>The code idthe-dir-attribute:the-dir-attribute>a href#the-dir-attribute>dir/a>/code> attribute specifies the elements text directionality. The attribute is an a href#enumerated-attribute idthe-dir-attribute:enumerated-attribute>enumerated attribute/a> with the following keywords and states:/p> dl>dt>The dfn idattr-dir-ltr>code>ltr/code>/dfn> keyword, which maps to the dfn idattr-dir-ltr-state>ltr/dfn> statedd> p>Indicates that the contents of the element are explicitly directionally isolated left-to-right text./p> dt>The dfn idattr-dir-rtl>code>rtl/code>/dfn> keyword, which maps to the dfn idattr-dir-rtl-state>rtl/dfn> statedd> p>Indicates that the contents of the element are explicitly directionally isolated right-to-left text./p> dt>The dfn idattr-dir-auto>code>auto/code>/dfn> keyword, which maps to the dfn idattr-dir-auto-state>auto/dfn> statedd> p>Indicates that the contents of the element are explicitly directionally isolated text, but that the direction is to be determined programmatically using the contents of the element (as described below)./p> p classnote>The heuristic used by this state is very crude (it just looks at the first character with a strong directionality, in a manner analogous to the Paragraph Level determination in the bidirectional algorithm). Authors are urged to only use this value as a last resort when the direction of the text is truly unknown and no better server-side heuristic can be applied. a href#refsBIDI>BIDI/a>/p> p classnote>For code idthe-dir-attribute:the-textarea-element>a href#the-textarea-element>textarea/a>/code> and code idthe-dir-attribute:the-pre-element>a href#the-pre-element>pre/a>/code> elements, the heuristic is applied on a per-paragraph level./p> /dl> p>The attribute has no i idthe-dir-attribute:invalid-value-default>a href#invalid-value-default>invalid value default/a>/i> and no i idthe-dir-attribute:missing-value-default>a href#missing-value-default>missing value default/a>/i>./p> hr> p>dfn idthe-directionality>The directionality/dfn> of an element (any element, not just an a href#html-elements idthe-dir-attribute:html-elements>HTML element/a>) is either dfn idconcept-ltr>ltr/dfn> or dfn idconcept-rtl>rtl/dfn>, and is determined as per the first appropriate set of steps from the following list:/p> dl classswitch>dt>If the elements code idthe-dir-attribute:the-dir-attribute-2>a href#the-dir-attribute>dir/a>/code> attribute is in the a href#attr-dir-ltr-state idthe-dir-attribute:attr-dir-ltr-state>ltr/a> statedt>If the element is a a idthe-dir-attribute:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> and the code idthe-dir-attribute:the-dir-attribute-3>a href#the-dir-attribute>dir/a>/code> attribute is not in a defined state (i.e. it is not present or has an invalid value)dt>If the element is an code idthe-dir-attribute:the-input-element>a href#the-input-element>input/a>/code> element whose code idthe-dir-attribute:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#telephone-state-(typetel) idthe-dir-attribute:telephone-state-(typetel)>Telephone/a> state, and the code idthe-dir-attribute:the-dir-attribute-4>a href#the-dir-attribute>dir/a>/code> attribute is not in a defined state (i.e. it is not present or has an invalid value)dd>p>a href#the-directionality idthe-dir-attribute:the-directionality>The directionality/a> of the element is a href#concept-ltr idthe-dir-attribute:concept-ltr>ltr/a>.dt>If the elements code idthe-dir-attribute:the-dir-attribute-5>a href#the-dir-attribute>dir/a>/code> attribute is in the a href#attr-dir-rtl-state idthe-dir-attribute:attr-dir-rtl-state>rtl/a> statedd>p>a href#the-directionality idthe-dir-attribute:the-directionality-2>The directionality/a> of the element is a href#concept-rtl idthe-dir-attribute:concept-rtl>rtl/a>.dt>If the element is an code idthe-dir-attribute:the-input-element-2>a href#the-input-element>input/a>/code> element whose code idthe-dir-attribute:attr-input-type-2>a href#attr-input-type>type/a>/code> attribute is in the a href#text-(typetext)-state-and-search-state-(typesearch) idthe-dir-attribute:text-(typetext)-state-and-search-state-(typesearch)>Text/a>, a href#text-(typetext)-state-and-search-state-(typesearch) idthe-dir-attribute:text-(typetext)-state-and-search-state-(typesearch)-2>Search/a>, a href#telephone-state-(typetel) idthe-dir-attribute:telephone-state-(typetel)-2>Telephone/a>, a href#url-state-(typeurl) idthe-dir-attribute:url-state-(typeurl)>URL/a>, or a href#e-mail-state-(typeemail) idthe-dir-attribute:e-mail-state-(typeemail)>E-mail/a> state, and the code idthe-dir-attribute:the-dir-attribute-6>a href#the-dir-attribute>dir/a>/code> attribute is in the a href#attr-dir-auto-state idthe-dir-attribute:attr-dir-auto-state>auto/a> statedt>If the element is a code idthe-dir-attribute:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code> element and the code idthe-dir-attribute:the-dir-attribute-7>a href#the-dir-attribute>dir/a>/code> attribute is in the a href#attr-dir-auto-state idthe-dir-attribute:attr-dir-auto-state-2>auto/a> statedd> p>If the elements a href#concept-fe-value idthe-dir-attribute:concept-fe-value>value/a> contains a character of bidirectional character type AL or R, and there is no character of bidirectional character type L anywhere before it in the elements a href#concept-fe-value idthe-dir-attribute:concept-fe-value-2>value/a>, then a href#the-directionality idthe-dir-attribute:the-directionality-3>the directionality/a> of the element is a href#concept-rtl idthe-dir-attribute:concept-rtl-2>rtl/a>. a href#refsBIDI>BIDI/a>/p> p>Otherwise, if the elements a href#concept-fe-value idthe-dir-attribute:concept-fe-value-3>value/a> is not the empty string, or if the element is a a idthe-dir-attribute:document-element-2 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>, a href#the-directionality idthe-dir-attribute:the-directionality-4>the directionality/a> of the element is a href#concept-ltr idthe-dir-attribute:concept-ltr-2>ltr/a>./p> p>Otherwise, a href#the-directionality idthe-dir-attribute:the-directionality-5>the directionality/a> of the element is the same as the elements parent elements a href#the-directionality idthe-dir-attribute:the-directionality-6>directionality/a>./p> dt>If the elements code idthe-dir-attribute:the-dir-attribute-8>a href#the-dir-attribute>dir/a>/code> attribute is in the a href#attr-dir-auto-state idthe-dir-attribute:attr-dir-auto-state-3>auto/a> statedt>If the element is a code idthe-dir-attribute:the-bdi-element>a href#the-bdi-element>bdi/a>/code> element and the code idthe-dir-attribute:the-dir-attribute-9>a href#the-dir-attribute>dir/a>/code> attribute is not in a defined state (i.e. it is not present or has an invalid value)dd> p>Find the first character in a idthe-dir-attribute:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> that matches the following criteria:/p> ul>li>p>The character is from a code idthe-dir-attribute:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node that is a descendant of the element whose a href#the-directionality idthe-dir-attribute:the-directionality-7>directionality/a> is being determined.li>p>The character is of bidirectional character type L, AL, or R. a href#refsBIDI>BIDI/a>li> p>The character is not in a code idthe-dir-attribute:text-2>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node that has an ancestor element that is a descendant of the element whose a href#the-directionality idthe-dir-attribute:the-directionality-8>directionality/a> is being determined and that is either:/p> ul classbrief>li>A code idthe-dir-attribute:the-bdi-element-2>a href#the-bdi-element>bdi/a>/code> element. li>A code idthe-dir-attribute:the-script-element>a href#the-script-element>script/a>/code> element. li>A code idthe-dir-attribute:the-style-element>a href#the-style-element>style/a>/code> element. li>A code idthe-dir-attribute:the-textarea-element-3>a href#the-textarea-element>textarea/a>/code> element. li>An element with a code idthe-dir-attribute:the-dir-attribute-10>a href#the-dir-attribute>dir/a>/code> attribute in a defined state. /ul> /ul> p>If such a character is found and it is of bidirectional character type AL or R, a href#the-directionality idthe-dir-attribute:the-directionality-9>the directionality/a> of the element is a href#concept-rtl idthe-dir-attribute:concept-rtl-3>rtl/a>./p> p>If such a character is found and it is of bidirectional character type L, a href#the-directionality idthe-dir-attribute:the-directionality-10>the directionality/a> of the element is a href#concept-ltr idthe-dir-attribute:concept-ltr-3>ltr/a>./p> p>Otherwise, if the element is a a idthe-dir-attribute:document-element-3 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>, a href#the-directionality idthe-dir-attribute:the-directionality-11>the directionality/a> of the element is a href#concept-ltr idthe-dir-attribute:concept-ltr-4>ltr/a>./p> p>Otherwise, a href#the-directionality idthe-dir-attribute:the-directionality-12>the directionality/a> of the element is the same as the elements parent elements a href#the-directionality idthe-dir-attribute:the-directionality-13>directionality/a>./p> dt>If the element has a parent element and the code idthe-dir-attribute:the-dir-attribute-11>a href#the-dir-attribute>dir/a>/code> attribute is not in a defined state (i.e. it is not present or has an invalid value)dd>p>a href#the-directionality idthe-dir-attribute:the-directionality-14>The directionality/a> of the element is the same as the elements parent elements a href#the-directionality idthe-dir-attribute:the-directionality-15>directionality/a>./dl> p classnote>Since the code idthe-dir-attribute:the-dir-attribute-12>a href#the-dir-attribute>dir/a>/code> attribute is only defined for a href#html-elements idthe-dir-attribute:html-elements-2>HTML elements/a>, it cannot be present on elements from other namespaces. Thus, elements from other namespaces always just inherit their a href#the-directionality idthe-dir-attribute:the-directionality-16>directionality/a> from their parent element, or, if they dont have one, default to a href#concept-ltr idthe-dir-attribute:concept-ltr-5>ltr/a>./p> p classnote>This attribute a href#bidireq>has rendering requirements involving the bidirectional algorithm/a>./p> hr> p>The dfn iddirectionality-of-the-attribute>directionality of an attribute/dfn> of an a href#html-elements idthe-dir-attribute:html-elements-3>HTML element/a>, which is used when the text of that attribute is to be included in the rendering in some manner, is determined as per the first appropriate set of steps from the following list:/p> dl classswitch>dt>If the attribute is a a href#directionality-capable-attribute idthe-dir-attribute:directionality-capable-attribute>directionality-capable attribute/a> and the elements code idthe-dir-attribute:the-dir-attribute-13>a href#the-dir-attribute>dir/a>/code> attribute is in the a href#attr-dir-auto-state idthe-dir-attribute:attr-dir-auto-state-4>auto/a> statedd> p>Find the first character (in logical order) of the attributes value that is of bidirectional character type L, AL, or R. a href#refsBIDI>BIDI/a>/p> p>If such a character is found and it is of bidirectional character type AL or R, the a href#directionality-of-the-attribute idthe-dir-attribute:directionality-of-the-attribute>directionality of the attribute/a> is a href#concept-rtl idthe-dir-attribute:concept-rtl-4>rtl/a>./p> p>Otherwise, the a href#directionality-of-the-attribute idthe-dir-attribute:directionality-of-the-attribute-2>directionality of the attribute/a> is a href#concept-ltr idthe-dir-attribute:concept-ltr-6>ltr/a>./p> dt>Otherwisedd>The a href#directionality-of-the-attribute idthe-dir-attribute:directionality-of-the-attribute-3>directionality of the attribute/a> is the same as a href#the-directionality idthe-dir-attribute:the-directionality-17>the elements directionality/a>./dl> p>The following attributes are dfn iddirectionality-capable-attribute>directionality-capable attributes/dfn>:/p> ul classbrief>li>code idthe-dir-attribute:attr-th-abbr>a href#attr-th-abbr>abbr/a>/code> on code idthe-dir-attribute:the-th-element>a href#the-th-element>th/a>/code> elementsli>code>alt/code> on code idthe-dir-attribute:attr-area-alt>a href#attr-area-alt>area/a>/code>, code idthe-dir-attribute:attr-img-alt>a href#attr-img-alt>img/a>/code>, and code idthe-dir-attribute:attr-input-alt>a href#attr-input-alt>input/a>/code> elementsli>code idthe-dir-attribute:attr-meta-content>a href#attr-meta-content>content/a>/code> on code idthe-dir-attribute:the-meta-element>a href#the-meta-element>meta/a>/code> elements, if the code idthe-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-readableli>code>label/code> on code idthe-dir-attribute:attr-optgroup-label>a href#attr-optgroup-label>optgroup/a>/code>, code idthe-dir-attribute:attr-option-label>a href#attr-option-label>option/a>/code>, and code idthe-dir-attribute:attr-track-label>a href#attr-track-label>track/a>/code> elementsli>code>placeholder/code> on code idthe-dir-attribute:attr-input-placeholder>a href#attr-input-placeholder>input/a>/code> and code idthe-dir-attribute:attr-textarea-placeholder>a href#attr-textarea-placeholder>textarea/a>/code> elementsli>code idthe-dir-attribute:attr-title>a href#attr-title>title/a>/code> on all a href#html-elements idthe-dir-attribute:html-elements-4>HTML elements/a>/ul> hr> dl classdomintro>dt>var>document/var> . code idthe-dir-attribute:dom-dir>a href#dom-dir>dir/a>/code> var>value/var> dd> p>Returns a href#the-html-element-2 idthe-dir-attribute:the-html-element-2>the code>html/code> element/a>s code idthe-dir-attribute:the-dir-attribute-14>a href#the-dir-attribute>dir/a>/code> attributes value, if any./p> p>Can be set, to either code>ltr/code>, code>rtl/code>, or code>auto/code> to replace a href#the-html-element-2 idthe-dir-attribute:the-html-element-2-2>the code>html/code> element/a>s code idthe-dir-attribute:the-dir-attribute-15>a href#the-dir-attribute>dir/a>/code> attributes value./p> p>If there is no a href#the-html-element-2 idthe-dir-attribute:the-html-element-2-3>code>html/code> element/a>, returns the empty string and ignores new values./p> /dl> p>The dfn iddom-dir>code>dir/code>/dfn> IDL attribute on an element must a href#reflect idthe-dir-attribute:reflect>reflect/a> the code idthe-dir-attribute:the-dir-attribute-16>a href#the-dir-attribute>dir/a>/code> content attribute of that element, a href#limited-to-only-known-values idthe-dir-attribute:limited-to-only-known-values>limited to only known values/a>./p> p>The dfn iddom-document-dir>code>dir/code>/dfn> IDL attribute on code idthe-dir-attribute:document>a href#document>Document/a>/code> objects must a href#reflect idthe-dir-attribute:reflect-2>reflect/a> the code idthe-dir-attribute:the-dir-attribute-17>a href#the-dir-attribute>dir/a>/code> content attribute of a href#the-html-element-2 idthe-dir-attribute:the-html-element-2-4>the code>html/code> element/a>, if any, a href#limited-to-only-known-values idthe-dir-attribute:limited-to-only-known-values-2>limited to only known values/a>. If there is no such element, then the attribute must return the empty string and do nothing on setting./p> p classnote>Authors are strongly encouraged to use the code idthe-dir-attribute:the-dir-attribute-18>a href#the-dir-attribute>dir/a>/code> attribute to indicate text direction rather than using CSS, since that way their documents will continue to render correctly even in the absence of CSS (e.g. as interpreted by search engines)./p> div classexample> p>This markup fragment is of an IM conversation./p> pre><p dirauto classu1><b><bdi>Student</bdi>:</b> How do you write Whats your name? in Arabic?</p><p dirauto classu2><b><bdi>Teacher</bdi>:</b> ما اسمك؟</p><p dirauto classu1><b><bdi>Student</bdi>:</b> Thanks.</p><p dirauto classu2><b><bdi>Teacher</bdi>:</b> Thats written شكرًا.</p><p dirauto classu2><b><bdi>Teacher</bdi>:</b> Do you know how to write Please?</p><p dirauto classu1><b><bdi>Student</bdi>:</b> من فضلك, right?</p>/pre> p>Given a suitable style sheet and the default alignment styles for the code idthe-dir-attribute:the-p-element>a href#the-p-element>p/a>/code> element, namely to align the text to the i>start edge/i> of the paragraph, the resulting rendering could be as follows:/p> p>img width366 src/images/im.png height157 altEach paragraph rendered as a separate block, with the paragraphs left-aligned except the second paragraph and the last one, which would be right aligned, with the usernames (Student and Teacher in this example) flush right, with a colon to their left, and the text first to the left of that.>/p> p>As noted earlier, the code idthe-dir-attribute:attr-dir-auto>a href#attr-dir-auto>auto/a>/code> value is not a panacea. The final paragraph in this example is misinterpreted as being right-to-left text, since it begins with an Arabic character, which causes the right? to be to the left of the Arabic text./p> /div> h5 idthe-style-attribute>span classsecno>3.2.6.5/span> The dfn>code>style/code>/dfn> attributea href#the-style-attribute classself-link>/a>/h5> p>All a href#html-elements idthe-style-attribute:html-elements>HTML elements/a> may have the code idthe-style-attribute:the-style-attribute>a href#the-style-attribute>style/a>/code> content attribute set. This is a a hrefhttps://drafts.csswg.org/css-style-attr/#style-attribute idthe-style-attribute:css-styling-attribute data-x-internalcss-styling-attribute>style attribute/a> as defined by the cite>CSS Style Attributes/cite> specification. a href#refsCSSATTR>CSSATTR/a>/p> p>In user agents that support CSS, the attributes value must be parsed when the attribute is added or has its value changed, according to the rules given for a hrefhttps://drafts.csswg.org/css-style-attr/#style-attribute idthe-style-attribute:css-styling-attribute-2 data-x-internalcss-styling-attribute>style attributes/a>. a href#refsCSSATTR>CSSATTR/a>/p> p>However, if the a idthe-style-attribute:should-elements-inline-behavior-be-blocked-by-content-security-policy hrefhttps://w3c.github.io/webappsec-csp/#should-block-inline data-x-internalshould-elements-inline-behavior-be-blocked-by-content-security-policy>Should elements inline behavior be blocked by Content Security Policy?/a> algorithm returns code>Blocked/code> when executed upon the attributes a idthe-style-attribute:element hrefhttps://dom.spec.whatwg.org/#interface-element data-x-internalelement>element/a>, code>style attribute/code>, and the attributes value, then the style rules defined in the attributes value must not be applied to the a idthe-style-attribute:element-2 hrefhttps://dom.spec.whatwg.org/#interface-element data-x-internalelement>element/a>. a href#refsCSP>CSP/a>/p> p>Documents that use code idthe-style-attribute:the-style-attribute-2>a href#the-style-attribute>style/a>/code> attributes on any of their elements must still be comprehensible and usable if those attributes were removed./p> p classnote>In particular, using the code idthe-style-attribute:the-style-attribute-3>a href#the-style-attribute>style/a>/code> attribute to hide and show content, or to convey meaning that is otherwise not included in the document, is non-conforming. (To hide and show content, use the code idthe-style-attribute:the-hidden-attribute>a href#the-hidden-attribute>hidden/a>/code> attribute.)/p> hr> dl classdomintro>dt>var>element/var> . code idthe-style-attribute:dom-style>a href#dom-style>style/a>/code>dd> p>Returns a code idthe-style-attribute:cssstyledeclaration>a data-x-internalcssstyledeclaration hrefhttps://drafts.csswg.org/cssom/#the-cssstyledeclaration-interface>CSSStyleDeclaration/a>/code> object for the elements code idthe-style-attribute:the-style-attribute-4>a href#the-style-attribute>style/a>/code> attribute./p> /dl> p>The dfn iddom-style>code>style/code>/dfn> IDL attribute is defined in the CSS Object Model (CSSOM) specification. a href#refsCSSOM>CSSOM/a>/p> div classexample> p>In the following example, the words that refer to colors are marked up using the code idthe-style-attribute:the-span-element>a href#the-span-element>span/a>/code> element and the code idthe-style-attribute:the-style-attribute-5>a href#the-style-attribute>style/a>/code> attribute to make those words show up in the relevant colors in visual media./p> pre><p>My sweat suit is <span stylecolor: green; background:transparent>green</span> and my eyes are <span stylecolor: blue;background: transparent>blue</span>.</p>/pre> /div> h5 idembedding-custom-non-visible-data-with-the-data-*-attributes>span classsecno>3.2.6.6/span> dfn>Embedding custom non-visible data/dfn> with the code idembedding-custom-non-visible-data-with-the-data-*-attributes:attr-data-*>a href#attr-data-*>data-*/a>/code> attributesa href#embedding-custom-non-visible-data-with-the-data-*-attributes classself-link>/a>/h5>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> datasetspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>7+/span>/span>span classios_saf yes>span>iOS Safari/span> span>5.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>6+/span>/span>span classie yes>span>IE/span> span>11+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini partial>span>Opera Mini (limited)/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>5.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>3+/span>/span>span classopera yes>span>Opera/span> span>11.1+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featdataset>caniuse.com/a>/div> p>A dfn idcustom-data-attribute>custom data attribute/dfn> is an attribute in no namespace whose name starts with the string dfn idattr-data-*>code>data-/code>/dfn>, has at least one character after the hyphen, is a href#xml-compatible idembedding-custom-non-visible-data-with-the-data-*-attributes:xml-compatible>XML-compatible/a>, and contains no a hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha idembedding-custom-non-visible-data-with-the-data-*-attributes:uppercase-ascii-letters data-x-internaluppercase-ascii-letters>ASCII upper alphas/a>./p> p classnote>All attribute names on a href#html-elements idembedding-custom-non-visible-data-with-the-data-*-attributes:html-elements>HTML elements/a> in a idembedding-custom-non-visible-data-with-the-data-*-attributes:html-documents hrefhttps://dom.spec.whatwg.org/#html-document data-x-internalhtml-documents>HTML documents/a> get ASCII-lowercased automatically, so the restriction on ASCII uppercase letters doesnt affect such documents./p> p>a href#custom-data-attribute idembedding-custom-non-visible-data-with-the-data-*-attributes:custom-data-attribute>Custom data attributes/a> are intended to store custom data, state, annotations, and similar, private to the page or application, for which there are no more appropriate attributes or elements./p> p>These attributes are not intended for use by software that is not known to the administrators of the site that uses the attributes. For generic extensions that are to be used by multiple independent tools, either this specification should be extended to provide the feature explicitly, or a technology like a href#microdata idembedding-custom-non-visible-data-with-the-data-*-attributes:microdata>microdata/a> should be used (with a standardized vocabulary)./p> div classexample> p>For instance, a site about music could annotate list items representing tracks in an album with custom data attributes containing the length of each track. This information could then be used by the site itself to allow the user to sort the list by track length, or to filter the list for tracks of certain lengths./p> pre><ol> <li data-length2m11s>Beyond The Sea</li> ...</ol>/pre> p>It would be inappropriate, however, for the user to use generic software not associated with that music site to search for tracks of a certain length by looking at this data./p> p>This is because these attributes are intended for use by the sites own scripts, and are not a generic extension mechanism for publicly-usable metadata./p> /div> div classexample> p>Similarly, a page author could write markup that provides information for a translation tool that they are intending to use:/p> pre><p>The third <span data-mytrans-deAnspruch>claim</span> covers the case of <spantranslateno>HTML</span> markup.</p>/pre> p>In this example, the code>data-mytrans-de/code> attribute gives specific text for the MyTrans product to use when translating the phrase claim to German. However, the standard code idembedding-custom-non-visible-data-with-the-data-*-attributes:attr-translate>a href#attr-translate>translate/a>/code> attribute is used to tell it that in all languages, HTML is to remain unchanged. When a standard attribute is available, there is no need for a a href#custom-data-attribute idembedding-custom-non-visible-data-with-the-data-*-attributes:custom-data-attribute-2>custom data attribute/a> to be used./p> /div> div classexample> p>In this example, custom data attributes are used to store the result of a feature detection for code idembedding-custom-non-visible-data-with-the-data-*-attributes:paymentrequest>a data-x-internalpaymentrequest hrefhttps://w3c.github.io/payment-request/#dom-paymentrequest>PaymentRequest/a>/code>, which could be used in CSS to style a checkout page differently./p> pre><script> if (PaymentRequest in window) { document.documentElement.dataset.hasPaymentRequest ; }</script>/pre> p>Here, the code>data-has-payment-request/code> attribute is effectively being used as a a href#boolean-attribute idembedding-custom-non-visible-data-with-the-data-*-attributes:boolean-attribute>boolean attribute/a>; it is enough to check the presence of the attribute. However, if the author so wishes, it could later be populated with some value, maybe to indicate limited functionality of the feature./p> /div> p>Every a href#html-elements idembedding-custom-non-visible-data-with-the-data-*-attributes:html-elements-2>HTML element/a> may have any number of a href#custom-data-attribute idembedding-custom-non-visible-data-with-the-data-*-attributes:custom-data-attribute-3>custom data attributes/a> specified, with any value./p> p>Authors should carefully design such extensions so that when the attributes are ignored and any associated CSS dropped, the page is still usable./p> p>User agents must not derive any implementation behavior from these attributes or values. Specifications intended for user agents must not define these attributes to have any meaningful values./p> p>JavaScript libraries may use the a href#custom-data-attribute idembedding-custom-non-visible-data-with-the-data-*-attributes:custom-data-attribute-4>custom data attributes/a>, as they are considered to be part of the page on which they are used. Authors of libraries that are reused by many authors are encouraged to include their name in the attribute names, to reduce the risk of clashes. Where it makes sense, library authors are also encouraged to make the exact name used in the attribute names customizable, so that libraries whose authors unknowingly picked the same name can be used on the same page, and so that multiple versions of a particular library can be used on the same page even when those versions are not mutually compatible./p> div classexample> p>For example, a library called DoQuery could use attribute names like code>data-doquery-range/code>, and a library called jJo could use attributes names like code>data-jjo-range/code>. The jJo library could also provide an API to set which prefix to use (e.g. code>J.setDataPrefix(j2)/code>, making the attributes have names like code>data-j2-range/code>)./p> /div> hr> dl classdomintro>dt>var>element/var> . code idembedding-custom-non-visible-data-with-the-data-*-attributes:dom-dataset>a href#dom-dataset>dataset/a>/code>dd> p>Returns a code idembedding-custom-non-visible-data-with-the-data-*-attributes:domstringmap>a href#domstringmap>DOMStringMap/a>/code> object for the elements code idembedding-custom-non-visible-data-with-the-data-*-attributes:attr-data-*-2>a href#attr-data-*>data-*/a>/code> attributes./p> p>Hyphenated names become camel-cased. For example, code>data-foo-bar/code> becomes code>element.dataset.fooBar/code>./p> /dl> p>The dfn iddom-dataset>code>dataset/code>/dfn> IDL attribute provides convenient accessors for all the code idembedding-custom-non-visible-data-with-the-data-*-attributes:attr-data-*-3>a href#attr-data-*>data-*/a>/code> attributes on an element. On getting, the code idembedding-custom-non-visible-data-with-the-data-*-attributes:dom-dataset-2>a href#dom-dataset>dataset/a>/code> IDL attribute must return a code idembedding-custom-non-visible-data-with-the-data-*-attributes:domstringmap-2>a href#domstringmap>DOMStringMap/a>/code> whose associated element is this element./p> p>The code idembedding-custom-non-visible-data-with-the-data-*-attributes:domstringmap-3>a href#domstringmap>DOMStringMap/a>/code> interface is used for the code idembedding-custom-non-visible-data-with-the-data-*-attributes:dom-dataset-3>a href#dom-dataset>dataset/a>/code> attribute. Each code idembedding-custom-non-visible-data-with-the-data-*-attributes:domstringmap-4>a href#domstringmap>DOMStringMap/a>/code> has an dfn idconcept-domstringmap-element>associated element/dfn>./p> pre classidl>ExposedWindow, OverrideBuiltinsinterface dfn iddomstringmap>DOMStringMap/dfn> { a href#dom-domstringmap-nameditem>getter/a> DOMString (DOMString name); a href#cereactions idembedding-custom-non-visible-data-with-the-data-*-attributes:cereactions>CEReactions/a> a href#dom-domstringmap-setitem>setter/a> void (DOMString name, DOMString value); a href#cereactions idembedding-custom-non-visible-data-with-the-data-*-attributes:cereactions-2>CEReactions/a> a href#dom-domstringmap-removeitem>deleter/a> void (DOMString name);};/pre> p>To dfn idconcept-domstringmap-pairs>get a code>DOMStringMap/code>s name-value pairs/dfn>, run the following algorithm:/p> ol>li>p>Let var>list/var> be an empty list of name-value pairs.li>p>For each content attribute on the code idembedding-custom-non-visible-data-with-the-data-*-attributes:domstringmap-5>a href#domstringmap>DOMStringMap/a>/code>s a href#concept-domstringmap-element idembedding-custom-non-visible-data-with-the-data-*-attributes:concept-domstringmap-element>associated element/a> whose first five characters are the string code>data-/code> and whose remaining characters (if any) do not include any a hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha idembedding-custom-non-visible-data-with-the-data-*-attributes:uppercase-ascii-letters-2 data-x-internaluppercase-ascii-letters>ASCII upper alphas/a>, in the order that those attributes are listed in the elements a idembedding-custom-non-visible-data-with-the-data-*-attributes:attribute-list hrefhttps://dom.spec.whatwg.org/#concept-element-attribute data-x-internalattribute-list>attribute list/a>, add a name-value pair to var>list/var> whose name is the attributes name with the first five characters removed and whose value is the attributes value.li>p>For each name in var>list/var>, for each U+002D HYPHEN-MINUS character (-) in the name that is followed by an a idembedding-custom-non-visible-data-with-the-data-*-attributes:lowercase-ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-lower-alpha data-x-internallowercase-ascii-letters>ASCII lower alpha/a>, remove the U+002D HYPHEN-MINUS character (-) and replace the character that followed it by the same character a idembedding-custom-non-visible-data-with-the-data-*-attributes:converted-to-ascii-uppercase hrefhttps://infra.spec.whatwg.org/#ascii-uppercase data-x-internalconverted-to-ascii-uppercase>converted to ASCII uppercase/a>.li>p>Return var>list/var>./ol> p>The a idembedding-custom-non-visible-data-with-the-data-*-attributes:supported-property-names hrefhttps://heycam.github.io/webidl/#dfn-supported-property-names data-x-internalsupported-property-names>supported property names/a> on a code idembedding-custom-non-visible-data-with-the-data-*-attributes:domstringmap-6>a href#domstringmap>DOMStringMap/a>/code> object at any instant are the names of each pair returned from a href#concept-domstringmap-pairs idembedding-custom-non-visible-data-with-the-data-*-attributes:concept-domstringmap-pairs>getting the code>DOMStringMap/code>s name-value pairs/a> at that instant, in the order returned./p> p iddom-domstringmap-nameditem>To a idembedding-custom-non-visible-data-with-the-data-*-attributes:determine-the-value-of-a-named-property hrefhttps://heycam.github.io/webidl/#dfn-determine-the-value-of-a-named-property data-x-internaldetermine-the-value-of-a-named-property>determine the value of a named property/a> var>name/var> for a code idembedding-custom-non-visible-data-with-the-data-*-attributes:domstringmap-7>a href#domstringmap>DOMStringMap/a>/code>, return the value component of the name-value pair whose name component is var>name/var> in the list returned from a href#concept-domstringmap-pairs idembedding-custom-non-visible-data-with-the-data-*-attributes:concept-domstringmap-pairs-2>getting the code>DOMStringMap/code>s name-value pairs/a>./p> p iddom-domstringmap-setitem>To a idembedding-custom-non-visible-data-with-the-data-*-attributes:set-the-value-of-a-new-named-property hrefhttps://heycam.github.io/webidl/#dfn-set-the-value-of-a-new-named-property data-x-internalset-the-value-of-a-new-named-property>set the value of a new named property/a> or a idembedding-custom-non-visible-data-with-the-data-*-attributes:set-the-value-of-an-existing-named-property hrefhttps://heycam.github.io/webidl/#dfn-set-the-value-of-an-existing-named-property data-x-internalset-the-value-of-an-existing-named-property>set the value of an existing named property/a> for a code idembedding-custom-non-visible-data-with-the-data-*-attributes:domstringmap-8>a href#domstringmap>DOMStringMap/a>/code>, given a property name var>name/var> and a new value var>value/var>, run the following steps:/p> ol>li>p>If var>name/var> contains a U+002D HYPHEN-MINUS character (-) followed by an a idembedding-custom-non-visible-data-with-the-data-*-attributes:lowercase-ascii-letters-2 hrefhttps://infra.spec.whatwg.org/#ascii-lower-alpha data-x-internallowercase-ascii-letters>ASCII lower alpha/a>, then throw a a idembedding-custom-non-visible-data-with-the-data-*-attributes:syntaxerror hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idembedding-custom-non-visible-data-with-the-data-*-attributes:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>For each a idembedding-custom-non-visible-data-with-the-data-*-attributes:uppercase-ascii-letters-3 hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha data-x-internaluppercase-ascii-letters>ASCII upper alpha/a> in var>name/var>, insert a U+002D HYPHEN-MINUS character (-) before the character and replace the character with the same character a idembedding-custom-non-visible-data-with-the-data-*-attributes:converted-to-ascii-lowercase hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>.li>p>Insert the string code>data-/code> at the front of var>name/var>.li>p>If var>name/var> does not match the XML code idembedding-custom-non-visible-data-with-the-data-*-attributes:xml-name>a data-x-internalxml-name hrefhttps://www.w3.org/TR/xml/#NT-Name>Name/a>/code> production, throw an a idembedding-custom-non-visible-data-with-the-data-*-attributes:invalidcharactererror hrefhttps://heycam.github.io/webidl/#invalidcharactererror data-x-internalinvalidcharactererror>code>InvalidCharacterError/code>/a> code idembedding-custom-non-visible-data-with-the-data-*-attributes:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-set-value idembedding-custom-non-visible-data-with-the-data-*-attributes:concept-element-attributes-set-value data-x-internalconcept-element-attributes-set-value>Set an attribute value/a> for the code idembedding-custom-non-visible-data-with-the-data-*-attributes:domstringmap-9>a href#domstringmap>DOMStringMap/a>/code>s a href#concept-domstringmap-element idembedding-custom-non-visible-data-with-the-data-*-attributes:concept-domstringmap-element-2>associated element/a> using var>name/var> and var>value/var>./ol> p iddom-domstringmap-removeitem>To a idembedding-custom-non-visible-data-with-the-data-*-attributes:delete-an-existing-named-property hrefhttps://heycam.github.io/webidl/#dfn-delete-an-existing-named-property data-x-internaldelete-an-existing-named-property>delete an existing named property/a> var>name/var> for a code idembedding-custom-non-visible-data-with-the-data-*-attributes:domstringmap-10>a href#domstringmap>DOMStringMap/a>/code>, run the following steps:/p> ol>li>p>For each a idembedding-custom-non-visible-data-with-the-data-*-attributes:uppercase-ascii-letters-4 hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha data-x-internaluppercase-ascii-letters>ASCII upper alpha/a> in var>name/var>, insert a U+002D HYPHEN-MINUS character (-) before the character and replace the character with the same character a idembedding-custom-non-visible-data-with-the-data-*-attributes:converted-to-ascii-lowercase-2 hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>.li>p>Insert the string code>data-/code> at the front of var>name/var>.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-remove idembedding-custom-non-visible-data-with-the-data-*-attributes:concept-element-attributes-remove data-x-internalconcept-element-attributes-remove>Remove an attribute by name/a> given var>name/var> and the code idembedding-custom-non-visible-data-with-the-data-*-attributes:domstringmap-11>a href#domstringmap>DOMStringMap/a>/code>s a href#concept-domstringmap-element idembedding-custom-non-visible-data-with-the-data-*-attributes:concept-domstringmap-element-3>associated element/a>./ol> p classnote>This algorithm will only get invoked by the Web IDL specification for names that are given by the earlier algorithm for a href#concept-domstringmap-pairs idembedding-custom-non-visible-data-with-the-data-*-attributes:concept-domstringmap-pairs-3>getting the code>DOMStringMap/code>s name-value pairs/a>. a href#refsWEBIDL>WEBIDL/a>/p> div classexample> p>If a Web page wanted an element to represent a space ship, e.g. as part of a game, it would have to use the code idembedding-custom-non-visible-data-with-the-data-*-attributes:classes>a href#classes>class/a>/code> attribute along with code idembedding-custom-non-visible-data-with-the-data-*-attributes:attr-data-*-4>a href#attr-data-*>data-*/a>/code> attributes:/p> pre><div classspaceship data-ship-id92432 data-weaponslaser 2 data-shields50% data-x30 data-y10 data-z90> <button classfire onclickspaceshipsthis.parentNode.dataset.shipId.fire()> Fire </button></div>/pre> p>Notice how the hyphenated attribute name becomes camel-cased in the API./p> /div> div classexample> p>Given the following fragment and elements with similar constructions:/p> pre><img classtower idtower5 data-x12 data-y5 data-airobotarget data-hp46 data-abilityflames srctowers/rocket.png altRocket Tower>/pre> p>...one could imagine a function code>splashDamage()/code> that takes some arguments, the first of which is the element to process:/p> pre>function splashDamage(node, x, y, damage) { if (node.classList.contains(tower) && // checking the class attribute node.dataset.x x && // reading the data-x attribute node.dataset.y y) { // reading the data-y attribute var hp parseInt(node.dataset.hp); // reading the data-hp attribute hp hp - damage; if (hp < 0) { hp 0; node.dataset.ai dead; // setting the data-ai attribute delete node.dataset.ability; // removing the data-ability attribute } node.dataset.hp hp; // setting the data-hp attribute }}/pre> /div> h4 idthe-innertext-idl-attribute>span classsecno>3.2.7/span> The code idthe-innertext-idl-attribute:dom-innertext>a href#dom-innertext>innerText/a>/code> IDL attributea href#the-innertext-idl-attribute classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> innertextspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>4.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>45+/span>/span>span classie yes>span>IE/span> span>6+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>3.2+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.3+/span>/span>span classopera yes>span>Opera/span> span>9.5+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featinnertext>caniuse.com/a>/div> dl classdomintro>dt>var>element/var> . code idthe-innertext-idl-attribute:dom-innertext-2>a href#dom-innertext>innerText/a>/code> var>value/var> dd> p>Returns the elements text content as rendered./p> p>Can be set, to replace the elements children with the given value, but with line breaks converted to code idthe-innertext-idl-attribute:the-br-element>a href#the-br-element>br/a>/code> elements./p> /dl> p>On getting, the dfn iddom-innertext>code>innerText/code>/dfn> attribute must follow these steps:/p> ol>li> p>If this element is not a href#being-rendered idthe-innertext-idl-attribute:being-rendered>being rendered/a>, or if the user agent is a non-CSS user agent, then return the same value as the code idthe-innertext-idl-attribute:textcontent>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> IDL attribute on this element./p> p classnote>This step can produce surprising results, as when the code idthe-innertext-idl-attribute:dom-innertext-3>a href#dom-innertext>innerText/a>/code> attribute is accessed on an element not a href#being-rendered idthe-innertext-idl-attribute:being-rendered-2>being rendered/a>, its text contents are returned, but when accessed on an element that is a href#being-rendered idthe-innertext-idl-attribute:being-rendered-3>being rendered/a>, all of its children that are not a href#being-rendered idthe-innertext-idl-attribute:being-rendered-4>being rendered/a> have their text contents ignored./p> li> p>Let var>results/var> be the a idthe-innertext-idl-attribute:list hrefhttps://infra.spec.whatwg.org/#list data-x-internallist>list/a> resulting in running the a href#inner-text-collection-steps idthe-innertext-idl-attribute:inner-text-collection-steps>inner text collection steps/a> with this element. Each item in var>results/var> will either be a a idthe-innertext-idl-attribute:javascript-string hrefhttps://infra.spec.whatwg.org/#javascript-string data-x-internaljavascript-string>JavaScript string/a> or a positive integer (a i>required line break count/i>)./p> p classnote>Intuitively, a i>required line break count/i> item means that a certain number of line breaks appear at that point, but they can be collapsed with the line breaks induced by adjacent i>required line break count/i> items, reminiscent to CSS margin-collapsing./p> li>p>a hrefhttps://infra.spec.whatwg.org/#list-remove idthe-innertext-idl-attribute:list-remove data-x-internallist-remove>Remove/a> any items from var>results/var> that are the empty string.li>p>a hrefhttps://infra.spec.whatwg.org/#list-remove idthe-innertext-idl-attribute:list-remove-2 data-x-internallist-remove>Remove/a> any runs of consecutive i>required line break count/i> items at the start or end of var>results/var>.li>p>a hrefhttps://infra.spec.whatwg.org/#list-remove idthe-innertext-idl-attribute:list-replace data-x-internallist-replace>Replace/a> each remaining run of consecutive i>required line break count/i> items with a string consisting of as many U+000A LINE FEED (LF) characters as the maximum of the values in the i>required line break count/i> items.li>p>Return the concatenation of the string items in var>results/var>./ol> p>The dfn idinner-text-collection-steps>inner text collection steps/dfn>, given a a idthe-innertext-idl-attribute:node hrefhttps://dom.spec.whatwg.org/#interface-node data-x-internalnode>node/a> var>node/var>, are as follows:/p> ol>li>p>Let var>items/var> be the result of running the a href#inner-text-collection-steps idthe-innertext-idl-attribute:inner-text-collection-steps-2>inner text collection steps/a> with each child node of var>node/var> in a idthe-innertext-idl-attribute:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>, and then concatenating the results to a single a idthe-innertext-idl-attribute:list-2 hrefhttps://infra.spec.whatwg.org/#list data-x-internallist>list/a>.li>p>If var>node/var>s a idthe-innertext-idl-attribute:computed-value hrefhttps://drafts.csswg.org/css-cascade/#computed-value data-x-internalcomputed-value>computed value/a> of a idthe-innertext-idl-attribute:visibility hrefhttps://drafts.csswg.org/css2/visufx.html#propdef-visibility data-x-internalvisibility>visibility/a> is not visible, then return var>items/var>.li> p>If var>node/var> is not a href#being-rendered idthe-innertext-idl-attribute:being-rendered-5>being rendered/a>, then return var>items/var>. For the purpose of this step, the following elements must act as described if the a idthe-innertext-idl-attribute:computed-value-2 hrefhttps://drafts.csswg.org/css-cascade/#computed-value data-x-internalcomputed-value>computed value/a> of the a idthe-innertext-idl-attribute:display hrefhttps://drafts.csswg.org/css2/visuren.html#display-prop data-x-internaldisplay>display/a> property is not none:/p> ul classbrief>li>code idthe-innertext-idl-attribute:the-select-element>a href#the-select-element>select/a>/code> elements have an associated non-replaced inline CSS box whose child boxes include only those of code idthe-innertext-idl-attribute:the-optgroup-element>a href#the-optgroup-element>optgroup/a>/code> and code idthe-innertext-idl-attribute:the-option-element>a href#the-option-element>option/a>/code> element child nodes;li>code idthe-innertext-idl-attribute:the-optgroup-element-2>a href#the-optgroup-element>optgroup/a>/code> elements have an associated non-replaced block-level CSS box whose child boxes include only those of code idthe-innertext-idl-attribute:the-option-element-2>a href#the-option-element>option/a>/code> element child nodes; andli>code idthe-innertext-idl-attribute:the-option-element-3>a href#the-option-element>option/a>/code> element have an associated non-replaced block-level CSS box whose child boxes are as normal for non-replaced block-level CSS boxes./ul> p classnote>var>items/var> can be non-empty due to display:contents./p> li>p>If var>node/var> is a code idthe-innertext-idl-attribute:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node, then for each CSS text box produced by var>node/var>, in content order, compute the text of the box after application of the CSS a idthe-innertext-idl-attribute:white-space hrefhttps://drafts.csswg.org/css-text/#white-space-property data-x-internalwhite-space>white-space/a> processing rules and a idthe-innertext-idl-attribute:text-transform hrefhttps://drafts.csswg.org/css-text/#text-transform-property data-x-internaltext-transform>text-transform/a> rules, set var>items/var> to the a idthe-innertext-idl-attribute:list-3 hrefhttps://infra.spec.whatwg.org/#list data-x-internallist>list/a> of the resulting strings, and return var>items/var>. The CSS a idthe-innertext-idl-attribute:white-space-2 hrefhttps://drafts.csswg.org/css-text/#white-space-property data-x-internalwhite-space>white-space/a> processing rules are slightly modified: collapsible spaces at the end of lines are always collapsed, but they are only removed if the line is the last line of the block, or it ends with a code idthe-innertext-idl-attribute:the-br-element-2>a href#the-br-element>br/a>/code> element. Soft hyphens should be preserved. a href#refsCSSTEXT>CSSTEXT/a>li>p>If var>node/var> is a code idthe-innertext-idl-attribute:the-br-element-3>a href#the-br-element>br/a>/code> element, then a hrefhttps://infra.spec.whatwg.org/#list-append idthe-innertext-idl-attribute:list-append data-x-internallist-append>append/a> a string containing a single U+000A LINE FEED (LF) character to var>items/var>.li>p>If var>node/var>s a idthe-innertext-idl-attribute:computed-value-3 hrefhttps://drafts.csswg.org/css-cascade/#computed-value data-x-internalcomputed-value>computed value/a> of a idthe-innertext-idl-attribute:display-2 hrefhttps://drafts.csswg.org/css2/visuren.html#display-prop data-x-internaldisplay>display/a> is a idthe-innertext-idl-attribute:table-cell hrefhttps://drafts.csswg.org/css-tables/#table-cell data-x-internaltable-cell>table-cell/a>, and var>node/var>s CSS box is not the last a idthe-innertext-idl-attribute:table-cell-2 hrefhttps://drafts.csswg.org/css-tables/#table-cell data-x-internaltable-cell>table-cell/a> box of its enclosing a idthe-innertext-idl-attribute:table-row hrefhttps://drafts.csswg.org/css-tables/#table-row data-x-internaltable-row>table-row/a> box, then a hrefhttps://infra.spec.whatwg.org/#list-append idthe-innertext-idl-attribute:list-append-2 data-x-internallist-append>append/a> a string containing a single U+0009 CHARACTER TABULATION (tab) character to var>items/var>.li>p>If var>node/var>s a idthe-innertext-idl-attribute:computed-value-4 hrefhttps://drafts.csswg.org/css-cascade/#computed-value data-x-internalcomputed-value>computed value/a> of a idthe-innertext-idl-attribute:display-3 hrefhttps://drafts.csswg.org/css2/visuren.html#display-prop data-x-internaldisplay>display/a> is a idthe-innertext-idl-attribute:table-row-2 hrefhttps://drafts.csswg.org/css-tables/#table-row data-x-internaltable-row>table-row/a>, and var>node/var>s CSS box is not the last a idthe-innertext-idl-attribute:table-row-3 hrefhttps://drafts.csswg.org/css-tables/#table-row data-x-internaltable-row>table-row/a> box of the nearest ancestor a idthe-innertext-idl-attribute:table hrefhttps://drafts.csswg.org/css-tables/#table data-x-internaltable>table/a> box, then a hrefhttps://infra.spec.whatwg.org/#list-append idthe-innertext-idl-attribute:list-append-3 data-x-internallist-append>append/a> a string containing a single U+000A LINE FEED (LF) character to var>items/var>.li>p>If var>node/var> is a code idthe-innertext-idl-attribute:the-p-element>a href#the-p-element>p/a>/code> element, then a hrefhttps://infra.spec.whatwg.org/#list-append idthe-innertext-idl-attribute:list-append-4 data-x-internallist-append>append/a> 2 (a i>required line break count/i>) at the beginning and end of var>items/var>.li> p>If var>node/var>s a idthe-innertext-idl-attribute:used-value hrefhttps://drafts.csswg.org/css-cascade/#used-value data-x-internalused-value>used value/a> of a idthe-innertext-idl-attribute:display-4 hrefhttps://drafts.csswg.org/css2/visuren.html#display-prop data-x-internaldisplay>display/a> is a idthe-innertext-idl-attribute:block-level hrefhttps://drafts.csswg.org/css-display/#block-level data-x-internalblock-level>block-level/a> or a idthe-innertext-idl-attribute:table-caption hrefhttps://drafts.csswg.org/css-tables/#table-caption data-x-internaltable-caption>table-caption/a>, then a hrefhttps://infra.spec.whatwg.org/#list-append idthe-innertext-idl-attribute:list-append-5 data-x-internallist-append>append/a> 1 (a i>required line break count/i>) at the beginning and end of var>items/var>. a href#refsCSSDISPLAY>CSSDISPLAY/a>/p> p classnote>Floats and absolutely-positioned elements fall into this category./p> li>p>Return var>items/var>./ol> p classnote>Note that descendant nodes of most replaced elements (e.g., code idthe-innertext-idl-attribute:the-textarea-element>a href#the-textarea-element>textarea/a>/code>, code idthe-innertext-idl-attribute:the-input-element>a href#the-input-element>input/a>/code>, and code idthe-innertext-idl-attribute:the-video-element>a href#the-video-element>video/a>/code> — but not code idthe-innertext-idl-attribute:the-button-element>a href#the-button-element>button/a>/code>) are not rendered by CSS, strictly speaking, and therefore have no CSS boxes for the purposes of this algorithm./p> p classbig-issue>This algorithm is amenable to being generalized to work on a hrefhttps://dom.spec.whatwg.org/#concept-range idthe-innertext-idl-attribute:concept-range data-x-internalconcept-range>ranges/a>. Then we can use it as the basis for code idthe-innertext-idl-attribute:selection>a data-x-internalselection hrefhttps://w3c.github.io/selection-api/#selection-interface>Selection/a>/code>s stringifier and maybe expose it directly on a hrefhttps://dom.spec.whatwg.org/#concept-range idthe-innertext-idl-attribute:concept-range-2 data-x-internalconcept-range>ranges/a>. See a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id10583>Bugzilla bug 10583/a>./p> p>On setting, the code idthe-innertext-idl-attribute:dom-innertext-4>a href#dom-innertext>innerText/a>/code> attribute must follow these steps:/p> ol>li>p>Let var>document/var> be this elements a idthe-innertext-idl-attribute:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>.li>p>Let var>fragment/var> be a new code idthe-innertext-idl-attribute:documentfragment>a data-x-internaldocumentfragment hrefhttps://dom.spec.whatwg.org/#interface-documentfragment>DocumentFragment/a>/code> object whose a idthe-innertext-idl-attribute:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is var>document/var>.li>p>Let var>input/var> be the given value.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the start of the string.li>p>Let var>text/var> be the empty string.li> p>While var>position/var> is not past the end of var>input/var>:/p> ol>li>p>a idthe-innertext-idl-attribute:collect-a-sequence-of-code-points hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are not U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters from var>input/var> given var>position/var>. Set var>text/var> to the collected characters.li>p>If var>text/var> is not the empty string, then a hrefhttps://dom.spec.whatwg.org/#concept-node-append idthe-innertext-idl-attribute:concept-node-append data-x-internalconcept-node-append>append/a> a new code idthe-innertext-idl-attribute:text-2>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node whose a hrefhttps://dom.spec.whatwg.org/#concept-cd-data idthe-innertext-idl-attribute:concept-cd-data data-x-internalconcept-cd-data>data/a> is var>text/var> and a idthe-innertext-idl-attribute:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is var>document/var> to var>fragment/var>.li> p>While var>position/var> is not past the end of var>input/var>, and the character at var>position/var> is either a U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) character:/p> ol>li>p>If the character at var>position/var> is a U+000D CARRIAGE RETURN (CR) character and the next character is a U+000A LINE FEED (LF) character, then advance var>position/var> to the next character in var>input/var>.li>p>Advance var>position/var> to the next character in var>input/var>.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-node-append idthe-innertext-idl-attribute:concept-node-append-2 data-x-internalconcept-node-append>Append/a> the result of a hrefhttps://dom.spec.whatwg.org/#concept-create-element idthe-innertext-idl-attribute:create-an-element data-x-internalcreate-an-element>creating an element/a> given var>document/var>, code idthe-innertext-idl-attribute:the-br-element-4>a href#the-br-element>br/a>/code>, and the a idthe-innertext-idl-attribute:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a> to var>fragment/var>./ol> /ol> li>p>a hrefhttps://dom.spec.whatwg.org/#concept-node-replace-all idthe-innertext-idl-attribute:concept-node-replace-all data-x-internalconcept-node-replace-all>Replace all/a> with var>fragment/var> within this element./ol> h4 idrequirements-relating-to-the-bidirectional-algorithm>span classsecno>3.2.8/span> Requirements relating to the bidirectional algorithma href#requirements-relating-to-the-bidirectional-algorithm classself-link>/a>/h4> h5 idauthoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters>span classsecno>3.2.8.1/span> Authoring conformance criteria for bidirectional-algorithm formatting charactersa href#authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters classself-link>/a>/h5> p>a href#text-content idauthoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:text-content>Text content/a> in a href#html-elements idauthoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:html-elements>HTML elements/a> with code idauthoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes in their a href#concept-html-contents idauthoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:concept-html-contents>contents/a>, and text in attributes of a href#html-elements idauthoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:html-elements-2>HTML elements/a> that allow free-form text, may contain characters in the ranges U+202A to U+202E and U+2066 to U+2069 (the bidirectional-algorithm formatting characters). a href#refsBIDI>BIDI/a>/p> p classnote>Authors are encouraged to use the code idauthoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:the-dir-attribute>a href#the-dir-attribute>dir/a>/code> attribute, the code idauthoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:the-bdo-element>a href#the-bdo-element>bdo/a>/code> element, and the code idauthoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:the-bdi-element>a href#the-bdi-element>bdi/a>/code> element, rather than maintaining the bidirectional-algorithm formatting characters manually. The bidirectional-algorithm formatting characters interact poorly with CSS./p> h5 iduser-agent-conformance-criteria>span classsecno>3.2.8.2/span> User agent conformance criteriaa href#user-agent-conformance-criteria classself-link>/a>/h5> p>User agents must implement the Unicode bidirectional algorithm to determine the proper ordering of characters when rendering documents and parts of documents. a href#refsBIDI>BIDI/a>/p> p>The mapping of HTML to the Unicode bidirectional algorithm must be done in one of three ways. Either the user agent must implement CSS, including in particular the CSS a iduser-agent-conformance-criteria:unicode-bidi hrefhttps://drafts.csswg.org/css-writing-modes/#unicode-bidi data-x-internalunicode-bidi>unicode-bidi/a>, a iduser-agent-conformance-criteria:direction hrefhttps://drafts.csswg.org/css-writing-modes/#direction data-x-internaldirection>direction/a>, and a iduser-agent-conformance-criteria:content hrefhttps://drafts.csswg.org/css2/generate.html#content data-x-internalcontent>content/a> properties, and must have, in its user agent style sheet, the rules using those properties given in this specifications a href#rendering>rendering/a> section, or, alternatively, the user agent must act as if it implemented just the aforementioned properties and had a user agent style sheet that included all the aforementioned rules, but without letting style sheets specified in documents override them, or, alternatively, the user agent must implement another styling language with equivalent semantics. a href#refsCSSGC>CSSGC/a>/p> p idbidireq>The following elements and attributes have requirements defined by the a href#rendering>rendering/a> section that, due to the requirements in this section, are requirements on all user agents (not just those that a href#renderingUA>support the suggested default rendering/a>):/p> ul classbrief>li>code iduser-agent-conformance-criteria:the-dir-attribute>a href#the-dir-attribute>dir/a>/code> attributeli>code iduser-agent-conformance-criteria:the-bdi-element>a href#the-bdi-element>bdi/a>/code> elementli>code iduser-agent-conformance-criteria:the-bdo-element>a href#the-bdo-element>bdo/a>/code> elementli>code iduser-agent-conformance-criteria:the-br-element>a href#the-br-element>br/a>/code> elementli>code iduser-agent-conformance-criteria:the-pre-element>a href#the-pre-element>pre/a>/code> elementli>code iduser-agent-conformance-criteria:the-textarea-element>a href#the-textarea-element>textarea/a>/code> elementli>code iduser-agent-conformance-criteria:the-wbr-element>a href#the-wbr-element>wbr/a>/code> element/ul> h4 idwai-aria>span classsecno>3.2.9/span> Requirements related to ARIA and to platform accessibility APIsa href#wai-aria classself-link>/a>/h4> p>User agent requirements for implementing Accessibility API semantics on a href#html-elements idwai-aria:html-elements>HTML elements/a> are defined in cite>HTML Accessibility API Mappings/cite>. a href#refsHTMLAAM>HTMLAAM/a>/p> p>Conformance checker requirements for checking use of ARIA code idwai-aria:attr-aria-role>a href#attr-aria-role>role/a>/code> and code idwai-aria:attr-aria-*>a href#attr-aria-*>aria-*/a>/code> attributes on a href#html-elements idwai-aria:html-elements-2>HTML elements/a> are defined in cite>ARIA in HTML/cite>. a href#refsARIAHTML>ARIAHTML/a>/p> h2 idsemantics>span classsecno>4/span> The elements of HTMLa href#semantics classself-link>/a>/h2> h3 idthe-root-element>span classsecno>4.1/span> The document elementa href#the-root-element classself-link>/a>/h3> h4 idthe-html-element>span classsecno>4.1.1/span> The dfn>code>html/code>/dfn> elementa href#the-html-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-html-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-html-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As documents a idthe-html-element:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>.dd>Wherever a subdocument fragment is allowed in a compound document.dt>a href#concept-element-content-model idthe-html-element:concept-element-content-model>Content model/a>:dd>A code idthe-html-element:the-head-element>a href#the-head-element>head/a>/code> element followed by a code idthe-html-element:the-body-element>a href#the-body-element>body/a>/code> element.dt>a href#concept-element-tag-omission idthe-html-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>An code idthe-html-element:the-html-element>a href#the-html-element>html/a>/code> elements a href#syntax-start-tag idthe-html-element:syntax-start-tag>start tag/a> can be omitted if the first thing inside the code idthe-html-element:the-html-element-2>a href#the-html-element>html/a>/code> element is not a a href#syntax-comments idthe-html-element:syntax-comments>comment/a>.dd>An code idthe-html-element:the-html-element-3>a href#the-html-element>html/a>/code> elements a href#syntax-end-tag idthe-html-element:syntax-end-tag>end tag/a> can be omitted if the code idthe-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 idthe-html-element:syntax-comments-2>comment/a>.dt>a href#concept-element-attributes idthe-html-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-html-element:global-attributes>Global attributes/a>dd>code idthe-html-element:attr-html-manifest>a href#attr-html-manifest>manifest/a>/code> — a href#concept-appcache-manifest idthe-html-element:concept-appcache-manifest>Application cache manifest/a>dt>a href#concept-element-dom idthe-html-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-html-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlhtmlelement>HTMLHtmlElement/dfn> : a href#htmlelement idthe-html-element:htmlelement>HTMLElement/a> { // a href#HTMLHtmlElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-html-element:the-html-element-5>a href#the-html-element>html/a>/code> element a href#represents idthe-html-element:represents>represents/a> the root of an HTML document./p> p>Authors are encouraged to specify a code idthe-html-element:attr-lang>a href#attr-lang>lang/a>/code> attribute on the root code idthe-html-element:the-html-element-6>a href#the-html-element>html/a>/code> element, giving the documents language. This aids speech synthesis tools to determine what pronunciations to use, translation tools to determine what rules to use, and so forth./p> p>The dfn idattr-html-manifest>code>manifest/code>/dfn> attribute gives the address of the documents a href#application-cache idthe-html-element:application-cache>application cache/a> a href#concept-appcache-manifest idthe-html-element:concept-appcache-manifest-2>manifest/a>, if there is one. If the attribute is present, the attributes value must be a a href#valid-non-empty-url-potentially-surrounded-by-spaces idthe-html-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces/a>./p> p classcritical>The code idthe-html-element:attr-html-manifest-2>a href#attr-html-manifest>manifest/a>/code> attribute is part of the legacy a href#offline>offline Web applications/a> feature, which is in the process of being removed from the Web platform. (This is a long process that takes many years.) Using the code idthe-html-element:attr-html-manifest-3>a href#attr-html-manifest>manifest/a>/code> attribute at this time is highly discouraged. Use service workers instead. a href#refsSW>SW/a>/p> p>The code idthe-html-element:attr-html-manifest-4>a href#attr-html-manifest>manifest/a>/code> attribute only a href#concept-appcache-init idthe-html-element:concept-appcache-init>has an effect/a> during the early stages of document load. Changing the attribute dynamically thus has no effect (and thus, no DOM API is provided for this attribute)./p> p classnote>For the purposes of a href#concept-appcache-init idthe-html-element:concept-appcache-init-2>application cache selection/a>, later code idthe-html-element:the-base-element>a href#the-base-element>base/a>/code> elements cannot affect the a href#parse-a-url idthe-html-element:parse-a-url>parsing of URLs/a> in code idthe-html-element:attr-html-manifest-5>a href#attr-html-manifest>manifest/a>/code> attributes, as the attributes are processed before those elements are seen./p> p classnote>The code idthe-html-element:dom-applicationcache>a href#dom-applicationcache>window.applicationCache/a>/code> IDL attribute provides scripted access to the offline a href#application-cache idthe-html-element:application-cache-2>application cache/a> mechanism./p> div classexample> p>The code idthe-html-element:the-html-element-7>a href#the-html-element>html/a>/code> element in the following example declares that the documents language is English./p> pre><!DOCTYPE html>strong><html langen>/strong><head><title>Swapping Songs</title></head><body><h1>Swapping Songs</h1><p>Tonight I swapped some of the songs I wrote with some friends, whogave me some of the songs they wrote. I love sharing my music.</p></body>strong></html>/strong>/pre> /div> h3 iddocument-metadata>span classsecno>4.2/span> Document metadataa href#document-metadata classself-link>/a>/h3> h4 idthe-head-element data-dfn-typeelement data-lthead>span classsecno>4.2.1/span> The dfn>code>head/code>/dfn> elementa href#the-head-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-head-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-head-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As the first element in an code idthe-head-element:the-html-element>a href#the-html-element>html/a>/code> element.dt>a href#concept-element-content-model idthe-head-element:concept-element-content-model>Content model/a>:dd>If the document is a href#an-iframe-srcdoc-document idthe-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 idthe-head-element:metadata-content-2>metadata content/a>, of which no more than one is a code idthe-head-element:the-title-element>a href#the-title-element>title/a>/code> element and no more than one is a code idthe-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 idthe-head-element:metadata-content-2-2>metadata content/a>, of which exactly one is a code idthe-head-element:the-title-element-2>a href#the-title-element>title/a>/code> element and no more than one is a code idthe-head-element:the-base-element-2>a href#the-base-element>base/a>/code> element.dt>a href#concept-element-tag-omission idthe-head-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>A code idthe-head-element:the-head-element>a href#the-head-element>head/a>/code> elements a href#syntax-start-tag idthe-head-element:syntax-start-tag>start tag/a> can be omitted if the element is empty, or if the first thing inside the code idthe-head-element:the-head-element-2>a href#the-head-element>head/a>/code> element is an element.dd>A code idthe-head-element:the-head-element-3>a href#the-head-element>head/a>/code> elements a href#syntax-end-tag idthe-head-element:syntax-end-tag>end tag/a> can be omitted if the code idthe-head-element:the-head-element-4>a href#the-head-element>head/a>/code> element is not immediately followed by a idthe-head-element:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> or a a href#syntax-comments idthe-head-element:syntax-comments>comment/a>.dt>a href#concept-element-attributes idthe-head-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-head-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-head-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-head-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlheadelement>HTMLHeadElement/dfn> : a href#htmlelement idthe-head-element:htmlelement>HTMLElement/a> {};/pre> /dl> p>The code idthe-head-element:the-head-element-5>a href#the-head-element>head/a>/code> element a href#represents idthe-head-element:represents>represents/a> a collection of metadata for the code idthe-head-element:document>a href#document>Document/a>/code>./p> div classexample> p>The collection of metadata in a code idthe-head-element:the-head-element-6>a href#the-head-element>head/a>/code> element can be large or small. Here is an example of a very short one:/p> pre><!doctype html><html langen> <head> <title>A document with a short head</title> </head> <body> .../pre> p>Here is an example of a longer one:/p> pre><!DOCTYPE HTML><HTML LANGEN> <HEAD> <META CHARSETUTF-8> <BASE HREFhttps://www.example.com/> <TITLE>An application with a long head</TITLE> <LINK RELSTYLESHEET HREFdefault.css> <LINK RELSTYLESHEET ALTERNATE HREFbig.css TITLEBig Text> <SCRIPT SRCsupport.js></SCRIPT> <META NAMEAPPLICATION-NAME CONTENTLong headed application> </HEAD> <BODY> .../pre> /div> p classnote>The code idthe-head-element:the-title-element-3>a href#the-title-element>title/a>/code> element is a required child in most situations, but when a higher-level protocol provides title information, e.g. in the Subject line of an e-mail when HTML is used as an e-mail authoring format, the code idthe-head-element:the-title-element-4>a href#the-title-element>title/a>/code> element can be omitted./p> h4 idthe-title-element>span classsecno>4.2.2/span> The dfn>code>title/code>/dfn> elementa href#the-title-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-title-element:concept-element-categories>Categories/a>:dd>a href#metadata-content-2 idthe-title-element:metadata-content-2>Metadata content/a>.dt>a href#concept-element-contexts idthe-title-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>In a code idthe-title-element:the-head-element>a href#the-head-element>head/a>/code> element containing no other code idthe-title-element:the-title-element>a href#the-title-element>title/a>/code> elements.dt>a href#concept-element-content-model idthe-title-element:concept-element-content-model>Content model/a>:dd>a href#text-content idthe-title-element:text-content>Text/a> that is not a href#inter-element-whitespace idthe-title-element:inter-element-whitespace>inter-element whitespace/a>.dt>a href#concept-element-tag-omission idthe-title-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-title-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-title-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-title-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-title-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmltitleelement>HTMLTitleElement/dfn> : a href#htmlelement idthe-title-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-title-element:cereactions>CEReactions/a> attribute DOMString a href#dom-title-text idthe-title-element:dom-title-text>text/a>;};/pre> /dl> p>The code idthe-title-element:the-title-element-2>a href#the-title-element>title/a>/code> element a href#represents idthe-title-element:represents>represents/a> the documents title or name. Authors should use titles that identify their documents even when they are used out of context, for example in a users history or bookmarks, or in search results. The documents title is often different from its first heading, since the first heading does not have to stand alone when taken out of context./p> p>There must be no more than one code idthe-title-element:the-title-element-3>a href#the-title-element>title/a>/code> element per document./p> p classnote>If its reasonable for the code idthe-title-element:document>a href#document>Document/a>/code> to have no title, then the code idthe-title-element:the-title-element-4>a href#the-title-element>title/a>/code> element is probably not required. See the code idthe-title-element:the-head-element-2>a href#the-head-element>head/a>/code> elements content model for a description of when the element is required./p> dl classdomintro>dt>var>title/var> . code idthe-title-element:dom-title-text-2>a href#dom-title-text>text/a>/code> var>value/var> dd> p>Returns the a idthe-title-element:child-text-content hrefhttps://dom.spec.whatwg.org/#concept-child-text-content data-x-internalchild-text-content>child text content/a> of the element./p> p>Can be set, to replace the elements children with the given value./p> /dl> p>The IDL attribute dfn iddom-title-text>code>text/code>/dfn> must return the a idthe-title-element:child-text-content-2 hrefhttps://dom.spec.whatwg.org/#concept-child-text-content data-x-internalchild-text-content>child text content/a> of the code idthe-title-element:the-title-element-5>a href#the-title-element>title/a>/code> element. On setting, it must act the same way as the code idthe-title-element:textcontent>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> IDL attribute./p> div classexample> p>Here are some examples of appropriate titles, contrasted with the top-level headings that might be used on those same pages./p> pre> <title>Introduction to The Mating Rituals of Bees</title> ... <h1>Introduction</h1> <p>This companion guide to the highly successful <cite>Introduction to Medieval Bee-Keeping</cite> book is.../pre> p>The next page might be a part of the same site. Note how the title describes the subject matter unambiguously, while the first heading assumes the reader knows what the context is and therefore wont wonder if the dances are Salsa or Waltz:/p> pre> <title>Dances used during bee mating rituals</title> ... <h1>The Dances</h1>/pre> /div> p>The string to use as the documents title is given by the code idthe-title-element:document.title>a href#document.title>document.title/a>/code> IDL attribute./p> p>User agents should use the documents title when referring to the document in their user interface. When the contents of a code idthe-title-element:the-title-element-6>a href#the-title-element>title/a>/code> element are used in this way, a href#the-directionality idthe-title-element:the-directionality>the directionality/a> of that code idthe-title-element:the-title-element-7>a href#the-title-element>title/a>/code> element should be used to set the directionality of the documents title in the user interface./p> h4 idthe-base-element data-dfn-typeelement data-ltbase>span classsecno>4.2.3/span> The dfn>code>base/code>/dfn> elementa href#the-base-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-base-element:concept-element-categories>Categories/a>:dd>a href#metadata-content-2 idthe-base-element:metadata-content-2>Metadata content/a>.dt>a href#concept-element-contexts idthe-base-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>In a code idthe-base-element:the-head-element>a href#the-head-element>head/a>/code> element containing no other code idthe-base-element:the-base-element>a href#the-base-element>base/a>/code> elements.dt>a href#concept-element-content-model idthe-base-element:concept-element-content-model>Content model/a>:dd>a href#concept-content-nothing idthe-base-element:concept-content-nothing>Nothing/a>.dt>a href#concept-element-tag-omission idthe-base-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>No a href#syntax-end-tag idthe-base-element:syntax-end-tag>end tag/a>.dt>a href#concept-element-attributes idthe-base-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-base-element:global-attributes>Global attributes/a>dd>code idthe-base-element:attr-base-href>a href#attr-base-href>href/a>/code> — a href#document-base-url idthe-base-element:document-base-url>Document base URL/a>dd>code idthe-base-element:attr-base-target>a href#attr-base-target>target/a>/code> — Default a href#browsing-context idthe-base-element:browsing-context>browsing context/a> for a href#hyperlink idthe-base-element:hyperlink>hyperlink/a> a href#navigate idthe-base-element:navigate>navigation/a> and a href#form-submission-2 idthe-base-element:form-submission-2>form submission/a>dt>a href#concept-element-dom idthe-base-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-base-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlbaseelement>HTMLBaseElement/dfn> : a href#htmlelement idthe-base-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-base-element:cereactions>CEReactions/a> attribute USVString a href#dom-base-href idthe-base-element:dom-base-href>href/a>; a href#cereactions idthe-base-element:cereactions-2>CEReactions/a> attribute DOMString a href#dom-base-target idthe-base-element:dom-base-target>target/a>;};/pre> /dl> p>The code idthe-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 idthe-base-element:document-base-url-2>document base URL/a> for the purposes of a href#parse-a-url idthe-base-element:parse-a-url>parsing URLs/a>, and the name of the default a href#browsing-context idthe-base-element:browsing-context-2>browsing context/a> for the purposes of a href#following-hyperlinks-2 idthe-base-element:following-hyperlinks-2>following hyperlinks/a>. The element does not a href#represents idthe-base-element:represents>represent/a> any content beyond this information./p> p>There must be no more than one code idthe-base-element:the-base-element-3>a href#the-base-element>base/a>/code> element per document./p> p>A code idthe-base-element:the-base-element-4>a href#the-base-element>base/a>/code> element must have either an code idthe-base-element:attr-base-href-2>a href#attr-base-href>href/a>/code> attribute, a code idthe-base-element:attr-base-target-2>a href#attr-base-target>target/a>/code> attribute, or both./p> p>The dfn idattr-base-href>code>href/code>/dfn> content attribute, if specified, must contain a a href#valid-url-potentially-surrounded-by-spaces idthe-base-element:valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by spaces/a>./p> p>A code idthe-base-element:the-base-element-5>a href#the-base-element>base/a>/code> element, if it has an code idthe-base-element:attr-base-href-3>a href#attr-base-href>href/a>/code> attribute, must come before any other elements in the tree that have attributes defined as taking a hrefhttps://url.spec.whatwg.org/#concept-url idthe-base-element:url data-x-internalurl>URLs/a>, except the code idthe-base-element:the-html-element>a href#the-html-element>html/a>/code> element (its code idthe-base-element:attr-html-manifest>a href#attr-html-manifest>manifest/a>/code> attribute isnt affected by code idthe-base-element:the-base-element-6>a href#the-base-element>base/a>/code> elements)./p> p classnote>If there are multiple code idthe-base-element:the-base-element-7>a href#the-base-element>base/a>/code> elements with code idthe-base-element:attr-base-href-4>a href#attr-base-href>href/a>/code> attributes, all but the first are ignored./p> p>The dfn idattr-base-target>code>target/code>/dfn> attribute, if specified, must contain a a href#valid-browsing-context-name-or-keyword idthe-base-element:valid-browsing-context-name-or-keyword>valid browsing context name or keyword/a>, which specifies which a href#browsing-context idthe-base-element:browsing-context-3>browsing context/a> is to be used as the default when a href#hyperlink idthe-base-element:hyperlink-2>hyperlinks/a> and a href#the-form-element idthe-base-element:the-form-element>forms/a> in the code idthe-base-element:document>a href#document>Document/a>/code> cause a href#navigate idthe-base-element:navigate-2>navigation/a>./p> p>A code idthe-base-element:the-base-element-8>a href#the-base-element>base/a>/code> element, if it has a code idthe-base-element:attr-base-target-3>a href#attr-base-target>target/a>/code> attribute, must come before any elements in the tree that represent a href#hyperlink idthe-base-element:hyperlink-3>hyperlinks/a>./p> p classnote>If there are multiple code idthe-base-element:the-base-element-9>a href#the-base-element>base/a>/code> elements with code idthe-base-element:attr-base-target-4>a href#attr-base-target>target/a>/code> attributes, all but the first are ignored./p> p>To dfn idget-an-elements-target>get an elements target/dfn>, given an code idthe-base-element:the-a-element>a href#the-a-element>a/a>/code>, code idthe-base-element:the-area-element>a href#the-area-element>area/a>/code>, or code idthe-base-element:the-form-element-2>a href#the-form-element>form/a>/code> element var>element/var>, run these steps: ol>li>p>If var>element/var> has a code>target/code> attribute, then return that attributes value.li>p>If var>element/var>s a idthe-base-element:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> contains a code idthe-base-element:the-base-element-10>a href#the-base-element>base/a>/code> element with a code idthe-base-element:attr-base-target-5>a href#attr-base-target>target/a>/code> attribute, then return the value of the code idthe-base-element:attr-base-target-6>a href#attr-base-target>target/a>/code> attribute of the first such code idthe-base-element:the-base-element-11>a href#the-base-element>base/a>/code> element.li>p>Return null./ol> hr> p>A code idthe-base-element:the-base-element-12>a href#the-base-element>base/a>/code> element that is the first code idthe-base-element:the-base-element-13>a href#the-base-element>base/a>/code> element with an code idthe-base-element:attr-base-href-5>a href#attr-base-href>href/a>/code> content attribute a idthe-base-element:in-a-document-tree hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a> has a dfn idfrozen-base-url>frozen base URL/dfn>. The a href#frozen-base-url idthe-base-element:frozen-base-url>frozen base URL/a> must be a href#immediately idthe-base-element:immediately>immediately/a> a href#set-the-frozen-base-url idthe-base-element:set-the-frozen-base-url>set/a> for an element whenever any of the following situations occur:/p> ul classbrief>li>The code idthe-base-element:the-base-element-14>a href#the-base-element>base/a>/code> element becomes the first code idthe-base-element:the-base-element-15>a href#the-base-element>base/a>/code> element in a idthe-base-element:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> with an code idthe-base-element:attr-base-href-6>a href#attr-base-href>href/a>/code> content attribute in its code idthe-base-element:document-2>a href#document>Document/a>/code>.li>The code idthe-base-element:the-base-element-16>a href#the-base-element>base/a>/code> element is the first code idthe-base-element:the-base-element-17>a href#the-base-element>base/a>/code> element in a idthe-base-element:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> with an code idthe-base-element:attr-base-href-7>a href#attr-base-href>href/a>/code> content attribute in its code idthe-base-element:document-3>a href#document>Document/a>/code>, and its code idthe-base-element:attr-base-href-8>a href#attr-base-href>href/a>/code> content attribute is changed./ul> p>To dfn idset-the-frozen-base-url data-export>set the frozen base URL/dfn> for an element var>element/var>:/p> ol>li>p>Let var>document/var> be var>element/var>s a idthe-base-element:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>. li>p>Let var>urlRecord/var> be the result of a hrefhttps://url.spec.whatwg.org/#concept-url-parser idthe-base-element:url-parser data-x-internalurl-parser>parsing/a> the value of var>element/var>s code idthe-base-element:attr-base-href-9>a href#attr-base-href>href/a>/code> content attribute with var>document/var>s a href#fallback-base-url idthe-base-element:fallback-base-url>fallback base URL/a>, and var>document/var>s a hrefhttps://dom.spec.whatwg.org/#concept-document-encoding idthe-base-element:documents-character-encoding data-x-internaldocuments-character-encoding>character encoding/a>. (Thus, the code idthe-base-element:the-base-element-18>a href#the-base-element>base/a>/code> element isnt affected by itself.)li>p>Set var>element/var>s a href#frozen-base-url idthe-base-element:frozen-base-url-2>frozen base URL/a> to var>document/var>s a href#fallback-base-url idthe-base-element:fallback-base-url-2>fallback base URL/a>, if var>urlRecord/var> is failure or running a idthe-base-element:is-base-allowed-for-document hrefhttps://w3c.github.io/webappsec-csp/#allow-base-for-document data-x-internalis-base-allowed-for-document>Is base allowed for Document?/a> on the a href#resulting-url-record idthe-base-element:resulting-url-record>resulting URL record/a> and var>document/var> returns code>Blocked/code>, and to var>urlRecord/var> otherwise./ol> p>The dfn iddom-base-href>code>href/code>/dfn> IDL attribute, on getting, must return the result of running the following algorithm: ol>li>p>Let var>document/var> be var>element/var>s a idthe-base-element:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>. li>p>Let var>url/var> be the value of the code idthe-base-element:attr-base-href-10>a href#attr-base-href>href/a>/code> attribute of this element, if it has one, and the empty string otherwise.li>p>Let var>urlRecord/var> be the result of a hrefhttps://url.spec.whatwg.org/#concept-url-parser idthe-base-element:url-parser-2 data-x-internalurl-parser>parsing/a> var>url/var> with var>document/var>s a href#fallback-base-url idthe-base-element:fallback-base-url-3>fallback base URL/a>, and var>document/var>s a hrefhttps://dom.spec.whatwg.org/#concept-document-encoding idthe-base-element:documents-character-encoding-2 data-x-internaldocuments-character-encoding>character encoding/a>. (Thus, the code idthe-base-element:the-base-element-19>a href#the-base-element>base/a>/code> element isnt affected by other code idthe-base-element:the-base-element-20>a href#the-base-element>base/a>/code> elements or itself.)li>p>If var>urlRecord/var> is failure, return var>url/var>.li>p>Return the a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idthe-base-element:concept-url-serializer data-x-internalconcept-url-serializer>serialization/a> of var>urlRecord/var>./ol> p>The code idthe-base-element:dom-base-href-2>a href#dom-base-href>href/a>/code> IDL attribute, on setting, must set the code idthe-base-element:attr-base-href-11>a href#attr-base-href>href/a>/code> content attribute to the given new value./p> p>The dfn iddom-base-target>code>target/code>/dfn> IDL attribute must a href#reflect idthe-base-element:reflect>reflect/a> the content attribute of the same name./p> div classexample> p>In this example, a code idthe-base-element:the-base-element-21>a href#the-base-element>base/a>/code> element is used to set the a href#document-base-url idthe-base-element:document-base-url-3>document base URL/a>:/p> pre><!DOCTYPE html><html langen> <head> <title>This is an example for the <base> element</title> <base hrefhttps://www.example.com/news/index.html> </head> <body> <p>Visit the <a hrefarchives.html>archives</a>.</p> </body></html>/pre> p>The link in the above example would be a link to code>https://www.example.com/news/archives.html/code>./p> /div> h4 idthe-link-element data-dfn-typeelement data-ltlink>span classsecno>4.2.4/span> The dfn>code>link/code>/dfn> elementa href#the-link-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id21622 titleCSSOM defines algorithms named "create a style sheet" and various other similar ones. These need to be explicitly invoked somehow so that link relstylesheet> elements correctly contribute to document.styleSheets.>21622/a>/div> dl classelement>dt>a href#concept-element-categories idthe-link-element:concept-element-categories>Categories/a>:dd>a href#metadata-content-2 idthe-link-element:metadata-content-2>Metadata content/a>.dd>If the element is a href#allowed-in-the-body idthe-link-element:allowed-in-the-body>allowed in the body/a>: a href#flow-content-2 idthe-link-element:flow-content-2>flow content/a>.dd>If the element is a href#allowed-in-the-body idthe-link-element:allowed-in-the-body-2>allowed in the body/a>: a href#phrasing-content-2 idthe-link-element:phrasing-content-2>phrasing content/a>.dt>a href#concept-element-contexts idthe-link-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#metadata-content-2 idthe-link-element:metadata-content-2-2>metadata content/a> is expected.dd>In a code idthe-link-element:the-noscript-element>a href#the-noscript-element>noscript/a>/code> element that is a child of a code idthe-link-element:the-head-element>a href#the-head-element>head/a>/code> element.dd>If the element is a href#allowed-in-the-body idthe-link-element:allowed-in-the-body-3>allowed in the body/a>: where a href#phrasing-content-2 idthe-link-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-link-element:concept-element-content-model>Content model/a>:dd>a href#concept-content-nothing idthe-link-element:concept-content-nothing>Nothing/a>.dt>a href#concept-element-tag-omission idthe-link-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>No a href#syntax-end-tag idthe-link-element:syntax-end-tag>end tag/a>.dt>a href#concept-element-attributes idthe-link-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-link-element:global-attributes>Global attributes/a>dd>code idthe-link-element:attr-link-href>a href#attr-link-href>href/a>/code> — Address of the a href#hyperlink idthe-link-element:hyperlink>hyperlink/a>dd>code idthe-link-element:attr-link-crossorigin>a href#attr-link-crossorigin>crossorigin/a>/code> — How the element handles crossorigin requestsdd>code idthe-link-element:attr-link-rel>a href#attr-link-rel>rel/a>/code> — Relationship between the document containing the a href#hyperlink idthe-link-element:hyperlink-2>hyperlink/a> and the destination resourcedd>code idthe-link-element:attr-link-media>a href#attr-link-media>media/a>/code> — Applicable mediadd>code idthe-link-element:attr-link-nonce>a href#attr-link-nonce>nonce/a>/code> — Cryptographic nonce used in cite>Content Security Policy/cite> checks a href#refsCSP>CSP/a>dd>code idthe-link-element:attr-link-integrity>a href#attr-link-integrity>integrity/a>/code> — Integrity metadata used in cite>Subresource Integrity/cite> checks a href#refsSRI>SRI/a>dd>code idthe-link-element:attr-link-hreflang>a href#attr-link-hreflang>hreflang/a>/code> — Language of the linked resourcedd>code idthe-link-element:attr-link-type>a href#attr-link-type>type/a>/code> — Hint for the type of the referenced resourcedd>code idthe-link-element:attr-link-referrerpolicy>a href#attr-link-referrerpolicy>referrerpolicy/a>/code> — a idthe-link-element:referrer-policy hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>Referrer policy/a> for a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idthe-link-element:concept-fetch data-x-internalconcept-fetch>fetches/a> initiated by the elementdd>code idthe-link-element:attr-link-sizes>a href#attr-link-sizes>sizes/a>/code> — Sizes of the icons (for code idthe-link-element:attr-link-rel-2>a href#attr-link-rel>rel/a>/code>code idthe-link-element:rel-icon>a href#rel-icon>icon/a>/code>)dd>code idthe-link-element:attr-link-as>a href#attr-link-as>as/a>/code> — a hrefhttps://fetch.spec.whatwg.org/#concept-potential-destination idthe-link-element:concept-potential-destination data-x-internalconcept-potential-destination>Potential destination/a> for a preload request (for code idthe-link-element:attr-link-rel-3>a href#attr-link-rel>rel/a>/code>code idthe-link-element:link-type-preload>a href#link-type-preload>preload/a>/code> and code idthe-link-element:attr-link-rel-4>a href#attr-link-rel>rel/a>/code>code idthe-link-element:link-type-modulepreload>a href#link-type-modulepreload>modulepreload/a>/code>)dd>code idthe-link-element:attr-link-scope>a href#attr-link-scope>scope/a>/code> — a idthe-link-element:scope-url hrefhttps://w3c.github.io/ServiceWorker/#dfn-scope-url data-x-internalscope-url>Scope url/a> for a a idthe-link-element:service-worker-registration hrefhttps://w3c.github.io/ServiceWorker/#dfn-service-worker-registration data-x-internalservice-worker-registration>service worker registration/a> (for code idthe-link-element:attr-link-rel-5>a href#attr-link-rel>rel/a>/code>code idthe-link-element:link-type-serviceworker>a href#link-type-serviceworker>serviceworker/a>/code>)dd>code idthe-link-element:attr-link-updateviacache>a href#attr-link-updateviacache>updateviacache/a>/code> — a idthe-link-element:update-via-cache-mode hrefhttps://w3c.github.io/ServiceWorker/#dfn-update-via-cache data-x-internalupdate-via-cache-mode>Update via cache mode/a> for a a idthe-link-element:service-worker-registration-2 hrefhttps://w3c.github.io/ServiceWorker/#dfn-service-worker-registration data-x-internalservice-worker-registration>service worker registration/a> (for code idthe-link-element:attr-link-rel-6>a href#attr-link-rel>rel/a>/code>code idthe-link-element:link-type-serviceworker-2>a href#link-type-serviceworker>serviceworker/a>/code>)dd>code idthe-link-element:attr-link-workertype>a href#attr-link-workertype>workertype/a>/code> — a idthe-link-element:service-worker-type hrefhttps://w3c.github.io/ServiceWorker/#dfn-type data-x-internalservice-worker-type>Service worker type/a> for a a idthe-link-element:service-worker-registration-3 hrefhttps://w3c.github.io/ServiceWorker/#dfn-service-worker-registration data-x-internalservice-worker-registration>service worker registration/a> (for code idthe-link-element:attr-link-rel-7>a href#attr-link-rel>rel/a>/code>code idthe-link-element:link-type-serviceworker-3>a href#link-type-serviceworker>serviceworker/a>/code>)dd>code idthe-link-element:attr-link-color>a href#attr-link-color>color/a>/code> — Color to use when customizing a sites icon (for code idthe-link-element:attr-link-rel-8>a href#attr-link-rel>rel/a>/code>code>mask-icon/code>)dd>Also, the code idthe-link-element:attr-link-title>a href#attr-link-title>title/a>/code> attribute a href#attr-link-title idthe-link-element:attr-link-title-2>has special semantics/a> on this element: Title of the link; a idthe-link-element:css-style-sheet-set-name hrefhttps://drafts.csswg.org/cssom/#css-style-sheet-set-name data-x-internalcss-style-sheet-set-name>CSS style sheet set name/a>.dt>a href#concept-element-dom idthe-link-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-link-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmllinkelement>HTMLLinkElement/dfn> : a href#htmlelement idthe-link-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-link-element:cereactions>CEReactions/a> attribute USVString a href#dom-link-href idthe-link-element:dom-link-href>href/a>; a href#cereactions idthe-link-element:cereactions-2>CEReactions/a> attribute DOMString? a href#dom-link-crossorigin idthe-link-element:dom-link-crossorigin>crossOrigin/a>; a href#cereactions idthe-link-element:cereactions-3>CEReactions/a> attribute DOMString a href#dom-link-rel idthe-link-element:dom-link-rel>rel/a>; a href#cereactions idthe-link-element:cereactions-4>CEReactions/a> attribute DOMString a href#dom-link-as idthe-link-element:dom-link-as>as/a>; // (default ) SameObject, PutForwardsa hrefhttps://dom.spec.whatwg.org/#dom-domtokenlist-value idthe-link-element:dom-domtokenlist-value data-x-internaldom-domtokenlist-value>value/a> readonly attribute a idthe-link-element:domtokenlist hrefhttps://dom.spec.whatwg.org/#interface-domtokenlist data-x-internaldomtokenlist>DOMTokenList/a> a href#dom-link-rellist idthe-link-element:dom-link-rellist>relList/a>; a href#cereactions idthe-link-element:cereactions-5>CEReactions/a> attribute DOMString a href#dom-link-media idthe-link-element:dom-link-media>media/a>; a href#cereactions idthe-link-element:cereactions-6>CEReactions/a> attribute DOMString a href#dom-link-nonce idthe-link-element:dom-link-nonce>nonce/a>; a href#cereactions idthe-link-element:cereactions-7>CEReactions/a> attribute DOMString a href#dom-link-integrity idthe-link-element:dom-link-integrity>integrity/a>; a href#cereactions idthe-link-element:cereactions-8>CEReactions/a> attribute DOMString a href#dom-link-hreflang idthe-link-element:dom-link-hreflang>hreflang/a>; a href#cereactions idthe-link-element:cereactions-9>CEReactions/a> attribute DOMString a href#dom-link-type idthe-link-element:dom-link-type>type/a>; SameObject, PutForwardsa hrefhttps://dom.spec.whatwg.org/#dom-domtokenlist-value idthe-link-element:dom-domtokenlist-value-2 data-x-internaldom-domtokenlist-value>value/a> readonly attribute a idthe-link-element:domtokenlist-2 hrefhttps://dom.spec.whatwg.org/#interface-domtokenlist data-x-internaldomtokenlist>DOMTokenList/a> a href#dom-link-sizes idthe-link-element:dom-link-sizes>sizes/a>; a href#cereactions idthe-link-element:cereactions-10>CEReactions/a> attribute DOMString a href#dom-link-referrerpolicy idthe-link-element:dom-link-referrerpolicy>referrerPolicy/a>; a href#cereactions idthe-link-element:cereactions-11>CEReactions/a> attribute USVString a href#dom-link-scope idthe-link-element:dom-link-scope>scope/a>; a href#cereactions idthe-link-element:cereactions-12>CEReactions/a> attribute DOMString a href#dom-link-workertype idthe-link-element:dom-link-workertype>workerType/a>; a href#cereactions idthe-link-element:cereactions-13>CEReactions/a> attribute DOMString a href#dom-link-updateviacache idthe-link-element:dom-link-updateviacache>updateViaCache/a>; // a href#HTMLLinkElement-partial>also has obsolete members/a>};a href#htmllinkelement idthe-link-element:htmllinkelement>HTMLLinkElement/a> implements a idthe-link-element:linkstyle hrefhttps://drafts.csswg.org/cssom/#the-linkstyle-interface data-x-internallinkstyle>LinkStyle/a>;/pre> /dl> p>The code idthe-link-element:the-link-element>a href#the-link-element>link/a>/code> element allows authors to link their document to other resources./p> p>The destination of the link(s) is given by the dfn idattr-link-href>code>href/code>/dfn> attribute, which must be present and must contain a a href#valid-non-empty-url-potentially-surrounded-by-spaces idthe-link-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces/a>. If the code idthe-link-element:attr-link-href-2>a href#attr-link-href>href/a>/code> attribute is absent, then the element does not define a link./p> p>The dfn idattr-link-crossorigin>code>crossorigin/code>/dfn> attribute is a a href#cors-settings-attribute idthe-link-element:cors-settings-attribute>CORS settings attribute/a>. It is intended for use with a href#external-resource-link idthe-link-element:external-resource-link>external resource links/a>./p> p>The types of link indicated (the relationships) are given by the value of the dfn idattr-link-rel>code>rel/code>/dfn> attribute, which, if present, must have a value that is a a href#set-of-space-separated-tokens idthe-link-element:set-of-space-separated-tokens>set of space-separated tokens/a>. The a href#linkTypes>allowed keywords and their meanings/a> are defined in a later section. If the code idthe-link-element:attr-link-rel-9>a href#attr-link-rel>rel/a>/code> attribute is absent, has no keywords, or if none of the keywords used are allowed according to the definitions in this specification, then the element does not create any links./p> p>code idthe-link-element:attr-link-rel-10>a href#attr-link-rel>rel/a>/code>s a hrefhttps://dom.spec.whatwg.org/#concept-supported-tokens idthe-link-element:concept-supported-tokens data-x-internalconcept-supported-tokens>supported tokens/a> are the keywords defined in a href#linkTypes>HTML link types/a> which are allowed on code idthe-link-element:the-link-element-2>a href#the-link-element>link/a>/code> elements, impact the processing model, and are supported by the user agent. The possible a hrefhttps://dom.spec.whatwg.org/#concept-supported-tokens idthe-link-element:concept-supported-tokens-2 data-x-internalconcept-supported-tokens>supported tokens/a> are code idthe-link-element:rel-alternate>a href#rel-alternate>alternate/a>/code>, code idthe-link-element:link-type-dns-prefetch>a href#link-type-dns-prefetch>dns-prefetch/a>/code>, code idthe-link-element:rel-icon-2>a href#rel-icon>icon/a>/code>, code idthe-link-element:link-type-modulepreload-2>a href#link-type-modulepreload>modulepreload/a>/code>, code idthe-link-element:link-type-next>a href#link-type-next>next/a>/code>, code idthe-link-element:link-type-pingback>a href#link-type-pingback>pingback/a>/code>, code idthe-link-element:link-type-preconnect>a href#link-type-preconnect>preconnect/a>/code>, code idthe-link-element:link-type-prefetch>a href#link-type-prefetch>prefetch/a>/code>, code idthe-link-element:link-type-preload-2>a href#link-type-preload>preload/a>/code>, code idthe-link-element:link-type-prerender>a href#link-type-prerender>prerender/a>/code>, code idthe-link-element:link-type-search>a href#link-type-search>search/a>/code>, code idthe-link-element:link-type-serviceworker-4>a href#link-type-serviceworker>serviceworker/a>/code>, and code idthe-link-element:link-type-stylesheet>a href#link-type-stylesheet>stylesheet/a>/code>. code idthe-link-element:attr-link-rel-11>a href#attr-link-rel>rel/a>/code>s a hrefhttps://dom.spec.whatwg.org/#concept-supported-tokens idthe-link-element:concept-supported-tokens-3 data-x-internalconcept-supported-tokens>supported tokens/a> must only include the tokens from this list that the user agent implements the processing model for./p> p classnote>Theoretically a user agent could support the processing model for the code idthe-link-element:link-type-canonical>a href#link-type-canonical>canonical/a>/code> keyword — if it were a search engine that executed JavaScript. But in practice thats quite unlikely. So in most cases, code idthe-link-element:link-type-canonical-2>a href#link-type-canonical>canonical/a>/code> ought not be included in code idthe-link-element:attr-link-rel-12>a href#attr-link-rel>rel/a>/code>s a hrefhttps://dom.spec.whatwg.org/#concept-supported-tokens idthe-link-element:concept-supported-tokens-4 data-x-internalconcept-supported-tokens>supported tokens/a>./p> p>A code idthe-link-element:the-link-element-3>a href#the-link-element>link/a>/code> element must have either a code idthe-link-element:attr-link-rel-13>a href#attr-link-rel>rel/a>/code> attribute or an code idthe-link-element:names:-the-itemprop-attribute>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute, but not both./p> p>If a code idthe-link-element:the-link-element-4>a href#the-link-element>link/a>/code> element has an code idthe-link-element:names:-the-itemprop-attribute-2>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute, or has a code idthe-link-element:attr-link-rel-14>a href#attr-link-rel>rel/a>/code> attribute that contains only keywords that are a href#body-ok idthe-link-element:body-ok>body-ok/a>, then the element is said to be dfn idallowed-in-the-body>allowed in the body/dfn>. This means that the element can be used where a href#phrasing-content-2 idthe-link-element:phrasing-content-2-3>phrasing content/a> is expected./p> p classnote>If the code idthe-link-element:attr-link-rel-15>a href#attr-link-rel>rel/a>/code> attribute is used, the element can only sometimes be used in the code idthe-link-element:the-body-element>a href#the-body-element>body/a>/code> of the page. When used with the code idthe-link-element:names:-the-itemprop-attribute-3>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute, the element can be used both in the code idthe-link-element:the-head-element-2>a href#the-head-element>head/a>/code> element and in the code idthe-link-element:the-body-element-2>a href#the-body-element>body/a>/code> of the page, subject to the constraints of the microdata model./p> p>Two categories of links can be created using the code idthe-link-element:the-link-element-5>a href#the-link-element>link/a>/code> element: a href#external-resource-link idthe-link-element:external-resource-link-2>Links to external resources/a> and a href#hyperlink idthe-link-element:hyperlink-3>hyperlinks/a>. The a href#linkTypes>link types section/a> defines whether a particular link type is an external resource or a hyperlink. One code idthe-link-element:the-link-element-6>a href#the-link-element>link/a>/code> element can create multiple links (of which some might be a href#external-resource-link idthe-link-element:external-resource-link-3>external resource links/a> and some might be a href#hyperlink idthe-link-element:hyperlink-4>hyperlinks/a>); exactly which and how many links are created depends on the keywords given in the code idthe-link-element:attr-link-rel-16>a href#attr-link-rel>rel/a>/code> attribute. User agents must process the links on a per-link basis, not a per-element basis./p> p classnote>Each link created for a code idthe-link-element:the-link-element-7>a href#the-link-element>link/a>/code> element is handled separately. For instance, if there are two code idthe-link-element:the-link-element-8>a href#the-link-element>link/a>/code> elements with code>relstylesheet/code>, they each count as a separate external resource, and each is affected by its own attributes independently. Similarly, if a single code idthe-link-element:the-link-element-9>a href#the-link-element>link/a>/code> element has a code idthe-link-element:attr-link-rel-17>a href#attr-link-rel>rel/a>/code> attribute with the value code>next stylesheet/code>, it creates both a a href#hyperlink idthe-link-element:hyperlink-5>hyperlink/a> (for the code idthe-link-element:link-type-next-2>a href#link-type-next>next/a>/code> keyword) and an a href#external-resource-link idthe-link-element:external-resource-link-4>external resource link/a> (for the code idthe-link-element:link-type-stylesheet-2>a href#link-type-stylesheet>stylesheet/a>/code> keyword), and they are affected by other attributes (such as code idthe-link-element:attr-link-media-2>a href#attr-link-media>media/a>/code> or code idthe-link-element:attr-link-title-3>a href#attr-link-title>title/a>/code>) differently./p> div classexample> p>For example, the following code idthe-link-element:the-link-element-10>a href#the-link-element>link/a>/code> element creates two a href#hyperlink idthe-link-element:hyperlink-6>hyperlinks/a> (to the same page):/p> pre><link relauthor license href/about>/pre> p>The two links created by this element are one whose semantic is that the target page has information about the current pages author, and one whose semantic is that the target page has information regarding the license under which the current page is provided./p> /div> p classnote>a href#hyperlink idthe-link-element:hyperlink-7>Hyperlinks/a> created with the code idthe-link-element:the-link-element-11>a href#the-link-element>link/a>/code> element and its code idthe-link-element:attr-link-rel-18>a href#attr-link-rel>rel/a>/code> attribute apply to the whole document. This contrasts with the code idthe-link-element:attr-hyperlink-rel>a href#attr-hyperlink-rel>rel/a>/code> attribute of code idthe-link-element:the-a-element>a href#the-a-element>a/a>/code> and code idthe-link-element:the-area-element>a href#the-area-element>area/a>/code> elements, which indicates the type of a link whose context is given by the links location within the document./p> p>The exact behavior for a href#external-resource-link idthe-link-element:external-resource-link-5>links to external resources/a> depends on the exact relationship, as defined for the relevant a href#linkTypes>link type/a>./p> p>The dfn idattr-link-media>code>media/code>/dfn> attribute says which media the resource applies to. The value must be a a href#valid-media-query-list idthe-link-element:valid-media-query-list>valid media query list/a>./p> p>The dfn idattr-link-nonce>code>nonce/code>/dfn> attribute represents a cryptographic nonce (number used once) which can be used by cite>Content Security Policy/cite> to determine whether or not an a href#external-resource-link idthe-link-element:external-resource-link-6>external resource specified by the link/a> will be loaded and applied to the document. The value is text. a href#refsCSP>CSP/a>/p> p>The dfn data-dfn-forlink idattr-link-integrity data-dfn-typeelement-attr data-export>code>integrity/code>/dfn> attribute represents the a hrefhttps://fetch.spec.whatwg.org/#concept-request-integrity-metadata idthe-link-element:concept-request-integrity-metadata data-x-internalconcept-request-integrity-metadata>integrity metadata/a> for requests which this element is responsible for. The value is text. The attribute must not be specified on code idthe-link-element:the-link-element-12>a href#the-link-element>link/a>/code> elements that do not have a code idthe-link-element:attr-link-rel-19>a href#attr-link-rel>rel/a>/code> attribute that contains the code idthe-link-element:link-type-stylesheet-3>a href#link-type-stylesheet>stylesheet/a>/code> keyword. a href#refsSRI>SRI/a>/p> p>The dfn idattr-link-hreflang>code>hreflang/code>/dfn> attribute on the code idthe-link-element:the-link-element-13>a href#the-link-element>link/a>/code> element has the same semantics as the a href#attr-hyperlink-hreflang idthe-link-element:attr-hyperlink-hreflang>code>hreflang/code> attribute on the code>a/code> element/a>./p> p>The dfn idattr-link-type>code>type/code>/dfn> attribute gives the a idthe-link-element:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> of the linked resource. It is purely advisory. The value must be a a idthe-link-element:valid-mime-type hrefhttps://mimesniff.spec.whatwg.org/#valid-mime-type data-x-internalvalid-mime-type>valid MIME type/a>./p> p>For a href#external-resource-link idthe-link-element:external-resource-link-7>external resource links/a>, the code idthe-link-element:attr-link-type-2>a href#attr-link-type>type/a>/code> attribute is used as a hint to user agents so that they can avoid fetching resources they do not support./p> p>The dfn idattr-link-referrerpolicy>code>referrerpolicy/code>/dfn> attribute is a a href#referrer-policy-attribute idthe-link-element:referrer-policy-attribute>referrer policy attribute/a>. It is intended for use with a href#external-resource-link idthe-link-element:external-resource-link-8>external resource links/a>, where it helps set the a idthe-link-element:referrer-policy-2 hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>referrer policy/a> used when a href#concept-link-obtain idthe-link-element:concept-link-obtain>obtaining/a> the external resource. a href#refsREFERRERPOLICY>REFERRERPOLICY/a>./p> p>The dfn idattr-link-title>code>title/code>/dfn> attribute gives the title of the link. With one exception, it is purely advisory. The value is text. The exception is for style sheet links that are a idthe-link-element:in-a-document-tree hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a>, for which the code idthe-link-element:attr-link-title-4>a href#attr-link-title>title/a>/code> attribute defines a hrefhttps://drafts.csswg.org/cssom/#css-style-sheet-set idthe-link-element:css-style-sheet-set data-x-internalcss-style-sheet-set>CSS style sheet sets/a>./p> p classnote>The code idthe-link-element:attr-link-title-5>a href#attr-link-title>title/a>/code> attribute on code idthe-link-element:the-link-element-14>a href#the-link-element>link/a>/code> elements differs from the global code idthe-link-element:attr-title>a href#attr-title>title/a>/code> attribute of most other elements in that a link without a title does not inherit the title of the parent element: it merely has no title./p> hr> p>The dfn idattr-link-sizes>code>sizes/code>/dfn> attribute gives the sizes of icons for visual media. Its value, if present, is merely advisory. User agents may use the value to decide which icon(s) to use if multiple icons are available. If specified, the attribute must have a value that is an a href#unordered-set-of-unique-space-separated-tokens idthe-link-element:unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens/a> which are a idthe-link-element:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a>. Each value must be either an a idthe-link-element:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code idthe-link-element: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 idthe-link-element:valid-non-negative-integer>valid non-negative integers/a> that do not have a leading U+0030 DIGIT ZERO (0) character and that are separated by a single U+0078 LATIN SMALL LETTER X or U+0058 LATIN CAPITAL LETTER X character. The attribute must not be specified on code idthe-link-element:the-link-element-15>a href#the-link-element>link/a>/code> elements that do not have a code idthe-link-element:attr-link-rel-20>a href#attr-link-rel>rel/a>/code> attribute that specifies the code idthe-link-element:rel-icon-3>a href#rel-icon>icon/a>/code> keyword or the code>apple-touch-icon/code> keyword./p> p classnote>The code>apple-touch-icon/code> keyword is a registered a href#concept-rel-extensions idthe-link-element:concept-rel-extensions>extension to the predefined set of link types/a>, but user agents are not required to support it in any way./p> hr> p>The dfn idattr-link-as>code>as/code>/dfn> attribute specifies the a hrefhttps://fetch.spec.whatwg.org/#concept-potential-destination idthe-link-element:concept-potential-destination-2 data-x-internalconcept-potential-destination>potential destination/a> for a preload request for the resource given by the code idthe-link-element:attr-link-href-3>a href#attr-link-href>href/a>/code> attribute. It is an a href#enumerated-attribute idthe-link-element:enumerated-attribute>enumerated attribute/a>. Each a hrefhttps://fetch.spec.whatwg.org/#concept-potential-destination idthe-link-element:concept-potential-destination-3 data-x-internalconcept-potential-destination>potential destination/a> is a keyword for this attribute, mapping to a state of the same name. The attribute must be specified on code idthe-link-element:the-link-element-16>a href#the-link-element>link/a>/code> elements that have a code idthe-link-element:attr-link-rel-21>a href#attr-link-rel>rel/a>/code> attribute that contains the code idthe-link-element:link-type-preload-3>a href#link-type-preload>preload/a>/code> keyword. It may be specified on code idthe-link-element:the-link-element-17>a href#the-link-element>link/a>/code> elements that have a code idthe-link-element:attr-link-rel-22>a href#attr-link-rel>rel/a>/code> attribute that contains the code idthe-link-element:link-type-modulepreload-3>a href#link-type-modulepreload>modulepreload/a>/code> keyword; in such cases it must have a value which is a a hrefhttps://fetch.spec.whatwg.org/#request-destination-script-like idthe-link-element:concept-script-like-destination data-x-internalconcept-script-like-destination>script-like destination/a>. For other code idthe-link-element:the-link-element-18>a href#the-link-element>link/a>/code> elements, it must not be specified./p> p>The processing model for how the code idthe-link-element:attr-link-as-2>a href#attr-link-as>as/a>/code> attribute is used is given in the steps to obtain the resource, for a href#concept-link-obtain idthe-link-element:concept-link-obtain-2>for code>preload/code> links/a> and a href#modulepreload-obtain-steps>for code>modulepreload/code> links/a>, respectively./p> p classnote>The attribute does not have a i idthe-link-element:missing-value-default>a href#missing-value-default>missing value default/a>/i> or i idthe-link-element:invalid-value-default>a href#invalid-value-default>invalid value default/a>/i>, meaning that invalid or missing values for the attribute map to no state. This is accounted for in the processing model. For code idthe-link-element:link-type-preload-4>a href#link-type-preload>preload/a>/code> links, both conditions are an error; for code idthe-link-element:link-type-modulepreload-4>a href#link-type-modulepreload>modulepreload/a>/code> links, a missing value will be treated as code>script/code>./p> hr> p>The dfn idattr-link-scope>code>scope/code>/dfn> attribute specifies the a idthe-link-element:scope-url-2 hrefhttps://w3c.github.io/ServiceWorker/#dfn-scope-url data-x-internalscope-url>scope url/a> for a a idthe-link-element:service-worker-registration-4 hrefhttps://w3c.github.io/ServiceWorker/#dfn-service-worker-registration data-x-internalservice-worker-registration>service worker registration/a>. If the attribute is present, the value must be a a href#valid-url-potentially-surrounded-by-spaces idthe-link-element:valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by spaces/a>. The attribute must not be specified on code idthe-link-element:the-link-element-19>a href#the-link-element>link/a>/code> elements that do not have a code idthe-link-element:attr-link-rel-23>a href#attr-link-rel>rel/a>/code> attribute that contains the code idthe-link-element:link-type-serviceworker-5>a href#link-type-serviceworker>serviceworker/a>/code> keyword./p> p>The dfn idattr-link-updateviacache>code>updateviacache/code>/dfn> attribute specifies the a idthe-link-element:update-via-cache-mode-2 hrefhttps://w3c.github.io/ServiceWorker/#dfn-update-via-cache data-x-internalupdate-via-cache-mode>update via cache mode/a> for a a idthe-link-element:service-worker-registration-5 hrefhttps://w3c.github.io/ServiceWorker/#dfn-service-worker-registration data-x-internalservice-worker-registration>service worker registration/a>. It is an a href#enumerated-attribute idthe-link-element:enumerated-attribute-2>enumerated attribute/a>. Each a idthe-link-element:update-via-cache-mode-3 hrefhttps://w3c.github.io/ServiceWorker/#dfn-update-via-cache data-x-internalupdate-via-cache-mode>update via cache mode/a> is a keyword for this attribute, mapping to a state of the same name. The a href#missing-value-default idthe-link-element:missing-value-default-2>missing value default/a> is the i>imports/i> state. The attribute must not be specified on code idthe-link-element:the-link-element-20>a href#the-link-element>link/a>/code> elements that do not have a code idthe-link-element:attr-link-rel-24>a href#attr-link-rel>rel/a>/code> attribute that contains the code idthe-link-element:link-type-serviceworker-6>a href#link-type-serviceworker>serviceworker/a>/code> keyword./p> p>The dfn idattr-link-workertype>code>workertype/code>/dfn> attribute is an a href#enumerated-attribute idthe-link-element:enumerated-attribute-3>enumerated attribute/a> that specifies the a idthe-link-element:service-worker-type-2 hrefhttps://w3c.github.io/ServiceWorker/#dfn-type data-x-internalservice-worker-type>service worker type/a> for a a idthe-link-element:service-worker-registration-6 hrefhttps://w3c.github.io/ServiceWorker/#dfn-service-worker-registration data-x-internalservice-worker-registration>service worker registration/a>. The attributes keywords are code>classic/code> and code>module/code>, which map to the respective states i>classic/i> and i>module/i>. The a href#missing-value-default idthe-link-element:missing-value-default-3>missing value default/a> is the i>classic/i> state. There is an additional state, not represented by a keyword: the i>invalid/i> state. The a href#invalid-value-default idthe-link-element:invalid-value-default-2>invalid value default/a> is the i>invalid/i> state. The attribute must not be specified on code idthe-link-element:the-link-element-21>a href#the-link-element>link/a>/code> elements that do not have a code idthe-link-element:attr-link-rel-25>a href#attr-link-rel>rel/a>/code> attribute that contains the code idthe-link-element:link-type-serviceworker-7>a href#link-type-serviceworker>serviceworker/a>/code> keyword./p> hr> p>The dfn idattr-link-color>code>color/code>/dfn> attribute is used with the code>mask-icon/code> link type. The attribute must not be specified on code idthe-link-element:the-link-element-22>a href#the-link-element>link/a>/code> elements that do not have a code idthe-link-element:attr-link-rel-26>a href#attr-link-rel>rel/a>/code> attribute that contains the code>mask-icon/code> keyword. The value must be a string that matches the CSS a idthe-link-element:color hrefhttps://drafts.csswg.org/css-color/#typedef-color data-x-internalcolor><color>/a> production, defining a suggested color that user agents can use to customize the display of the icon that the user sees when they pin your site./p> p classnote>This specification does not have any user agent requirements for the code idthe-link-element:attr-link-color-2>a href#attr-link-color>color/a>/code> attribute./p> p classnote>The code>mask-icon/code> keyword is a registered a href#concept-rel-extensions idthe-link-element:concept-rel-extensions-2>extension to the predefined set of link types/a>, but user agents are not required to support it in any way./p> hr> p>The IDL attributes dfn iddom-link-href>code>href/code>/dfn>, dfn iddom-link-hreflang>code>hreflang/code>/dfn>, dfn iddom-link-integrity>code>integrity/code>/dfn>, dfn iddom-link-media>code>media/code>/dfn>, dfn iddom-link-nonce>code>nonce/code>/dfn>, dfn iddom-link-rel>code>rel/code>/dfn>, dfn iddom-link-scope>code>scope/code>/dfn>, dfn iddom-link-sizes>code>sizes/code>/dfn>, and dfn iddom-link-type>code>type/code>/dfn> each must a href#reflect idthe-link-element:reflect>reflect/a> the respective content attributes of the same name./p> p classnote>There is no reflecting IDL attribute for the code idthe-link-element:attr-link-color-3>a href#attr-link-color>color/a>/code> attribute, but this might be added later./p> p>The dfn iddom-link-as>code>as/code>/dfn> IDL attribute must a href#reflect idthe-link-element:reflect-2>reflect/a> the code idthe-link-element:attr-link-as-3>a href#attr-link-as>as/a>/code> content attribute, a href#limited-to-only-known-values idthe-link-element:limited-to-only-known-values>limited to only known values/a>./p> p>The dfn iddom-link-crossorigin>code>crossOrigin/code>/dfn> IDL attribute must a href#reflect idthe-link-element:reflect-3>reflect/a> the code idthe-link-element:attr-link-crossorigin-2>a href#attr-link-crossorigin>crossorigin/a>/code> content attribute, a href#limited-to-only-known-values idthe-link-element:limited-to-only-known-values-2>limited to only known values/a>./p> p>The dfn iddom-link-referrerpolicy>code>referrerPolicy/code>/dfn> IDL attribute must a href#reflect idthe-link-element:reflect-4>reflect/a> the code idthe-link-element:attr-link-referrerpolicy-2>a href#attr-link-referrerpolicy>referrerpolicy/a>/code> content attribute, a href#limited-to-only-known-values idthe-link-element:limited-to-only-known-values-3>limited to only known values/a>./p> p>The dfn iddom-link-rellist>code>relList/code>/dfn> IDL attribute must a href#reflect idthe-link-element:reflect-5>reflect/a> the code idthe-link-element:attr-link-rel-27>a href#attr-link-rel>rel/a>/code> content attribute./p> p>The dfn iddom-link-updateviacache>code>updateViaCache/code>/dfn> IDL attribute must a href#reflect idthe-link-element:reflect-6>reflect/a> the code idthe-link-element:attr-link-updateviacache-2>a href#attr-link-updateviacache>updateviacache/a>/code> content attribute, a href#limited-to-only-known-values idthe-link-element:limited-to-only-known-values-4>limited to only known values/a>./p> p>The dfn iddom-link-workertype>code>workerType/code>/dfn> IDL attribute must a href#reflect idthe-link-element:reflect-7>reflect/a> the code idthe-link-element:attr-link-workertype-2>a href#attr-link-workertype>workertype/a>/code> content attribute, a href#limited-to-only-known-values idthe-link-element:limited-to-only-known-values-5>limited to only known values/a>./p> h5 idprocessing-the-media-attribute>span classsecno>4.2.4.1/span> Processing the code idprocessing-the-media-attribute:attr-link-media>a href#attr-link-media>media/a>/code> attributea href#processing-the-media-attribute classself-link>/a>/h5> p>If the link is a a href#hyperlink idprocessing-the-media-attribute:hyperlink>hyperlink/a> then the code idprocessing-the-media-attribute:attr-link-media-2>a href#attr-link-media>media/a>/code> attribute is purely advisory, and describes for which media the document in question was designed./p> p>However, if the link is an a href#external-resource-link idprocessing-the-media-attribute:external-resource-link>external resource link/a>, then the code idprocessing-the-media-attribute:attr-link-media-3>a href#attr-link-media>media/a>/code> attribute is prescriptive. The user agent must apply the external resource when the code idprocessing-the-media-attribute:attr-link-media-4>a href#attr-link-media>media/a>/code> attributes value a href#matches-the-environment idprocessing-the-media-attribute:matches-the-environment>matches the environment/a> and the other relevant conditions apply, and must not apply it otherwise./p> p iddefault-media>The default, if the code idprocessing-the-media-attribute:attr-link-media-5>a href#attr-link-media>media/a>/code> attribute is omitted, is code>all/code>, meaning that by default links apply to all media./p> p classnote>The external resource might have further restrictions defined within that limit its applicability. For example, a CSS style sheet might have some code>@media/code> blocks. This specification does not override such further restrictions or requirements./p> h5 idprocessing-the-type-attribute>span classsecno>4.2.4.2/span> Processing the code idprocessing-the-type-attribute:attr-link-type>a href#attr-link-type>type/a>/code> attributea href#processing-the-type-attribute classself-link>/a>/h5> p>If code idprocessing-the-type-attribute:attr-link-type-2>a href#attr-link-type>type/a>/code> attribute is present, then the user agent must assume that the resource is of the given type (even if that is not a a idprocessing-the-type-attribute:valid-mime-type hrefhttps://mimesniff.spec.whatwg.org/#valid-mime-type data-x-internalvalid-mime-type>valid MIME type/a>, e.g. the empty string). If the attribute is omitted, but the a href#external-resource-link idprocessing-the-type-attribute:external-resource-link>external resource link/a> type has a default type defined, then the user agent must assume that the resource is of that type. If the UA does not support the given a idprocessing-the-type-attribute:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> for the given link relationship, then the UA should not a href#concept-link-obtain idprocessing-the-type-attribute:concept-link-obtain>obtain/a> the resource; if the UA does support the given a idprocessing-the-type-attribute:mime-type-2 hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> for the given link relationship, then the UA should a href#concept-link-obtain idprocessing-the-type-attribute:concept-link-obtain-2>obtain/a> the resource at the appropriate time as specified for the a href#external-resource-link idprocessing-the-type-attribute:external-resource-link-2>external resource link/a>s particular type. If the attribute is omitted, and the a href#external-resource-link idprocessing-the-type-attribute:external-resource-link-3>external resource link/a> type does not have a default type defined, but the user agent would a href#concept-link-obtain idprocessing-the-type-attribute:concept-link-obtain-3>obtain/a> the resource if the type was known and supported, then the user agent should a href#concept-link-obtain idprocessing-the-type-attribute:concept-link-obtain-4>obtain/a> the resource under the assumption that it will be supported./p> p>User agents must not consider the code idprocessing-the-type-attribute:attr-link-type-3>a href#attr-link-type>type/a>/code> attribute authoritative — upon fetching the resource, user agents must not use the code idprocessing-the-type-attribute:attr-link-type-4>a href#attr-link-type>type/a>/code> attribute to determine its actual type. Only the actual type (as defined in the next paragraph) is used to determine whether to em>apply/em> the resource, not the aforementioned assumed type./p> p idconcept-link-type-sniffing>If the a href#external-resource-link idprocessing-the-type-attribute:external-resource-link-4>external resource link/a> type defines rules for processing the resources a href#content-type idprocessing-the-type-attribute:content-type>Content-Type metadata/a>, then those rules apply. Otherwise, if the resource is expected to be an image, user agents may apply the a hrefhttps://mimesniff.spec.whatwg.org/#rules-for-sniffing-images-specifically idprocessing-the-type-attribute:content-type-sniffing:-image data-x-internalcontent-type-sniffing:-image>image sniffing rules/a>, with the var>official type/var> being the type determined from the resources a href#content-type idprocessing-the-type-attribute:content-type-2>Content-Type metadata/a>, and use the resulting a hrefhttps://mimesniff.spec.whatwg.org/#computed-mime-type idprocessing-the-type-attribute:content-type-sniffing-2 data-x-internalcontent-type-sniffing-2>computed type of the resource/a> as if it was the actual type. Otherwise, if neither of these conditions apply or if the user agent opts not to apply the image sniffing rules, then the user agent must use the resources a href#content-type idprocessing-the-type-attribute:content-type-3>Content-Type metadata/a> to determine the type of the resource. If there is no type metadata, but the a href#external-resource-link idprocessing-the-type-attribute:external-resource-link-5>external resource link/a> type has a default type defined, then the user agent must assume that the resource is of that type./p> p classnote>The code idprocessing-the-type-attribute:link-type-stylesheet>a href#link-type-stylesheet>stylesheet/a>/code> link type defines rules for processing the resources a href#content-type idprocessing-the-type-attribute:content-type-4>Content-Type metadata/a>./p> p>Once the user agent has established the type of the resource, the user agent must apply the resource if it is of a supported type and the other relevant conditions apply, and must ignore the resource otherwise./p> div classexample> p>If a document contains style sheet links labeled as follows:/p> pre><link relstylesheet hrefA typetext/plain><link relstylesheet hrefB typetext/css><link relstylesheet hrefC>/pre> p>...then a compliant UA that supported only CSS style sheets would fetch the B and C files, and skip the A file (since code idprocessing-the-type-attribute:text/plain>a data-x-internaltext/plain hrefhttps://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain/a>/code> is not the a idprocessing-the-type-attribute:mime-type-3 hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> for CSS style sheets)./p> p>For files B and C, it would then check the actual types returned by the server. For those that are sent as code idprocessing-the-type-attribute:text/css>a href#text/css>text/css/a>/code>, it would apply the styles, but for those labeled as code idprocessing-the-type-attribute:text/plain-2>a data-x-internaltext/plain hrefhttps://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain/a>/code>, or any other type, it would not./p> p>If one of the two files was returned without a a href#content-type idprocessing-the-type-attribute:content-type-5>Content-Type/a> metadata, or with a syntactically incorrect type like code>Content-Type: null/code>, then the default type for code idprocessing-the-type-attribute:link-type-stylesheet-2>a href#link-type-stylesheet>stylesheet/a>/code> links would kick in. Since that default type is code idprocessing-the-type-attribute:text/css-2>a href#text/css>text/css/a>/code>, the style sheet em>would/em> nonetheless be applied./p> /div> h5 idobtaining-a-resource-from-a-link-element>span classsecno>4.2.4.3/span> Obtaining a resource from a code idobtaining-a-resource-from-a-link-element:the-link-element>a href#the-link-element>link/a>/code> elementa href#obtaining-a-resource-from-a-link-element classself-link>/a>/h5> p>For external resources that are represented in the DOM (for example, style sheets), the DOM representation must be made available (modulo cross-origin restrictions) even if the resource is not applied. To dfn idconcept-link-obtain>obtain the resource/dfn>, the user agent must run the following steps:/p> ol>li>p>If the code idobtaining-a-resource-from-a-link-element:attr-link-href>a href#attr-link-href>href/a>/code> attributes value is the empty string, then abort these steps.li>p>a href#parse-a-url idobtaining-a-resource-from-a-link-element:parse-a-url>Parse/a> the a idobtaining-a-resource-from-a-link-element:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> given by the code idobtaining-a-resource-from-a-link-element:attr-link-href-2>a href#attr-link-href>href/a>/code> attribute, relative to the elements a idobtaining-a-resource-from-a-link-element:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>. If that fails, then abort these steps. Otherwise, let var>url/var> be the a href#resulting-url-record idobtaining-a-resource-from-a-link-element:resulting-url-record>resulting URL record/a>.li>p>Let var>corsAttributeState/var> be the current state of the elements code idobtaining-a-resource-from-a-link-element:attr-link-crossorigin>a href#attr-link-crossorigin>crossorigin/a>/code> content attribute.li>p>Let var>request/var> be the result of a href#create-a-potential-cors-request idobtaining-a-resource-from-a-link-element:create-a-potential-cors-request>creating a potential-CORS request/a> given var>url/var>, the empty string, and var>corsAttributeState/var>. li>p>Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-client idobtaining-a-resource-from-a-link-element:concept-request-client data-x-internalconcept-request-client>client/a> to the code idobtaining-a-resource-from-a-link-element:the-link-element-2>a href#the-link-element>link/a>/code> elements a idobtaining-a-resource-from-a-link-element:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s code idobtaining-a-resource-from-a-link-element:window>a href#window>Window/a>/code> objects a href#environment-settings-object idobtaining-a-resource-from-a-link-element:environment-settings-object>environment settings object/a>. li>p>Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-nonce-metadata idobtaining-a-resource-from-a-link-element:concept-request-nonce-metadata data-x-internalconcept-request-nonce-metadata>cryptographic nonce metadata/a> to the current value of the code idobtaining-a-resource-from-a-link-element:the-link-element-3>a href#the-link-element>link/a>/code> elements code idobtaining-a-resource-from-a-link-element:attr-link-nonce>a href#attr-link-nonce>nonce/a>/code> content attribute.li>p>Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-integrity-metadata idobtaining-a-resource-from-a-link-element:concept-request-integrity-metadata data-x-internalconcept-request-integrity-metadata>integrity metadata/a> to the current value of the code idobtaining-a-resource-from-a-link-element:the-link-element-4>a href#the-link-element>link/a>/code> elements code idobtaining-a-resource-from-a-link-element:attr-link-integrity>a href#attr-link-integrity>integrity/a>/code> content attribute.li>p>Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-referrer-policy idobtaining-a-resource-from-a-link-element:concept-request-referrer-policy data-x-internalconcept-request-referrer-policy>referrer policy/a> to the current state of the code idobtaining-a-resource-from-a-link-element:the-link-element-5>a href#the-link-element>link/a>/code> elements code idobtaining-a-resource-from-a-link-element:attr-link-referrerpolicy>a href#attr-link-referrerpolicy>referrerpolicy/a>/code> attribute.li> p>If the code idobtaining-a-resource-from-a-link-element:attr-link-rel>a href#attr-link-rel>rel/a>/code> attribute contains the code idobtaining-a-resource-from-a-link-element:link-type-preload>a href#link-type-preload>preload/a>/code> keyword, then:/p> ol>li>p>Let var>as/var> be the current state of the code idobtaining-a-resource-from-a-link-element:attr-link-as>a href#attr-link-as>as/a>/code> attribute.li>p>If var>as/var> is no state, then return.li>p>Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination idobtaining-a-resource-from-a-link-element:concept-request-destination data-x-internalconcept-request-destination>destination/a> to the result of a hrefhttps://fetch.spec.whatwg.org/#concept-potential-destination-translate idobtaining-a-resource-from-a-link-element:concept-potential-destination-translate data-x-internalconcept-potential-destination-translate>translating/a> var>as/var>./ol> li>p>a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idobtaining-a-resource-from-a-link-element:concept-fetch data-x-internalconcept-fetch>Fetch/a> var>request/var>./ol> p>User agents may opt to only try to obtain such resources when they are needed, instead of pro-actively fetching all the external resources that are not applied./p> p>The semantics of the protocol used (e.g. HTTP) must be followed when fetching external resources. (For example, redirects will be followed and 404 responses will cause the external resource to not be applied.)/p> p>Once the attempts to obtain the resource and its a href#critical-subresources idobtaining-a-resource-from-a-link-element:critical-subresources>critical subresources/a> are complete, the user agent must, if the loads were successful, a href#queue-a-task idobtaining-a-resource-from-a-link-element:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idobtaining-a-resource-from-a-link-element:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idobtaining-a-resource-from-a-link-element:event-load>a href#event-load>load/a>/code> at the code idobtaining-a-resource-from-a-link-element:the-link-element-6>a href#the-link-element>link/a>/code> element, or, if the resource or one of its a href#critical-subresources idobtaining-a-resource-from-a-link-element:critical-subresources-2>critical subresources/a> failed to completely load for any reason (e.g. DNS error, HTTP 404 response, a connection being prematurely closed, unsupported Content-Type), a href#queue-a-task idobtaining-a-resource-from-a-link-element:queue-a-task-2>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idobtaining-a-resource-from-a-link-element:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idobtaining-a-resource-from-a-link-element:event-error>a href#event-error>error/a>/code> at the code idobtaining-a-resource-from-a-link-element:the-link-element-7>a href#the-link-element>link/a>/code> element. Non-network errors in processing the resource or its subresources (e.g. CSS parse errors, PNG decoding errors) are not failures for the purposes of this paragraph./p> p>The a href#task-source idobtaining-a-resource-from-a-link-element:task-source>task source/a> for these a href#concept-task idobtaining-a-resource-from-a-link-element:concept-task>tasks/a> is the a href#dom-manipulation-task-source idobtaining-a-resource-from-a-link-element:dom-manipulation-task-source>DOM manipulation task source/a>./p> p>Unless otherwise specified for a given code idobtaining-a-resource-from-a-link-element:attr-link-rel-2>a href#attr-link-rel>rel/a>/code> keyword, the element must a href#delay-the-load-event idobtaining-a-resource-from-a-link-element:delay-the-load-event>delay the load event/a> of the elements a idobtaining-a-resource-from-a-link-element:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> until all the attempts to obtain the resource and its a href#critical-subresources idobtaining-a-resource-from-a-link-element:critical-subresources-3>critical subresources/a> are complete. (Resources that the user agent has not yet attempted to obtain, e.g. because it is waiting for the resource to be needed, do not a href#delay-the-load-event idobtaining-a-resource-from-a-link-element:delay-the-load-event-2>delay the load event/a>.)/p> h5 idprocessing-link-headers>span classsecno>4.2.4.4/span> Processing `code idprocessing-link-headers:http-link>a data-x-internalhttp-link hrefhttps://tools.ietf.org/html/rfc5988#section-5>Link/a>/code>` headersa href#processing-link-headers classself-link>/a>/h5> p>HTTP `code idprocessing-link-headers:http-link-2>a data-x-internalhttp-link hrefhttps://tools.ietf.org/html/rfc5988#section-5>Link/a>/code>` headers, if supported, must be assumed to come before any links in the document, in the order that they were given in the HTTP message. These headers are to be processed according to the rules given in the relevant specifications. a href#refsHTTP>HTTP/a> a href#refsWEBLINK>WEBLINK/a>/p> p classnote>Registration of relation types in HTTP `code idprocessing-link-headers:http-link-3>a data-x-internalhttp-link hrefhttps://tools.ietf.org/html/rfc5988#section-5>Link/a>/code>` headers is distinct from a href#linkTypes>HTML link types/a>, and thus their semantics can be different from same-named HTML types./p> h5 idproviding-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element>span classsecno>4.2.4.5/span> Providing users with a means to follow hyperlinks created using the code idproviding-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element:the-link-element>a href#the-link-element>link/a>/code> elementa href#providing-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element classself-link>/a>/h5> p idlinkui>Interactive user agents may provide users with a means to a href#following-hyperlinks-2 idproviding-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element:following-hyperlinks-2>follow the hyperlinks/a> created using the code idproviding-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element:the-link-element-2>a href#the-link-element>link/a>/code> element, somewhere within their user interface. The exact interface is not defined by this specification, but it could include the following information (obtained from the elements attributes, again as defined below), in some form or another (possibly simplified), for each a href#hyperlink idproviding-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element:hyperlink>hyperlink/a> created with each code idproviding-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element:the-link-element-3>a href#the-link-element>link/a>/code> element in the document:/p> ul>li>The relationship between this document and the resource (given by the code idproviding-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element:attr-link-rel>a href#attr-link-rel>rel/a>/code> attribute)li>The title of the resource (given by the code idproviding-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element:attr-link-title>a href#attr-link-title>title/a>/code> attribute).li>The address of the resource (given by the code idproviding-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element:attr-link-href>a href#attr-link-href>href/a>/code> attribute).li>The language of the resource (given by the code idproviding-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element:attr-link-hreflang>a href#attr-link-hreflang>hreflang/a>/code> attribute).li>The optimum media for the resource (given by the code idproviding-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element:attr-link-media>a href#attr-link-media>media/a>/code> attribute)./ul> p>User agents could also include other information, such as the type of the resource (as given by the code idproviding-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element:attr-link-type>a href#attr-link-type>type/a>/code> attribute)./p> p>The a idproviding-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element:activation-behaviour hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a> of code idproviding-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element:the-link-element-4>a href#the-link-element>link/a>/code> elements that create a href#hyperlink idproviding-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element:hyperlink-2>hyperlinks/a> is to a href#following-hyperlinks-2 idproviding-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element:following-hyperlinks-2-2>follow the hyperlink/a> created by the code idproviding-users-with-a-means-to-follow-hyperlinks-created-using-the-link-element:the-link-element-5>a href#the-link-element>link/a>/code> element./p> h4 idthe-meta-element data-dfn-typeelement data-ltmeta>span classsecno>4.2.5/span> The dfn idmeta>code>meta/code>/dfn> elementa href#the-meta-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-meta-element:concept-element-categories>Categories/a>:dd>a href#metadata-content-2 idthe-meta-element:metadata-content-2>Metadata content/a>.dd>If the code idthe-meta-element:names:-the-itemprop-attribute>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute is present: a href#flow-content-2 idthe-meta-element:flow-content-2>flow content/a>.dd>If the code idthe-meta-element:names:-the-itemprop-attribute-2>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute is present: a href#phrasing-content-2 idthe-meta-element:phrasing-content-2>phrasing content/a>.dt>a href#concept-element-contexts idthe-meta-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>If the code idthe-meta-element:attr-meta-charset>a href#attr-meta-charset>charset/a>/code> attribute is present, or if the elements code idthe-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 idthe-meta-element:attr-meta-http-equiv-content-type>Encoding declaration state/a>: in a code idthe-meta-element:the-head-element>a href#the-head-element>head/a>/code> element.dd>If the code idthe-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 idthe-meta-element:attr-meta-http-equiv-content-type-2>Encoding declaration state/a>: in a code idthe-meta-element:the-head-element-2>a href#the-head-element>head/a>/code> element.dd>If the code idthe-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 idthe-meta-element:attr-meta-http-equiv-content-type-3>Encoding declaration state/a>: in a code idthe-meta-element:the-noscript-element>a href#the-noscript-element>noscript/a>/code> element that is a child of a code idthe-meta-element:the-head-element-3>a href#the-head-element>head/a>/code> element.dd>If the code idthe-meta-element:attr-meta-name>a href#attr-meta-name>name/a>/code> attribute is present: where a href#metadata-content-2 idthe-meta-element:metadata-content-2-2>metadata content/a> is expected.dd>If the code idthe-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 idthe-meta-element:metadata-content-2-3>metadata content/a> is expected.dd>If the code idthe-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 idthe-meta-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-meta-element:concept-element-content-model>Content model/a>:dd>a href#concept-content-nothing idthe-meta-element:concept-content-nothing>Nothing/a>.dt>a href#concept-element-tag-omission idthe-meta-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>No a href#syntax-end-tag idthe-meta-element:syntax-end-tag>end tag/a>.dt>a href#concept-element-attributes idthe-meta-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-meta-element:global-attributes>Global attributes/a>dd>code idthe-meta-element:attr-meta-name-2>a href#attr-meta-name>name/a>/code> — Metadata namedd>code idthe-meta-element:attr-meta-http-equiv-4>a href#attr-meta-http-equiv>http-equiv/a>/code> — Pragma directivedd>code idthe-meta-element:attr-meta-content>a href#attr-meta-content>content/a>/code> — Value of the elementdd>code idthe-meta-element:attr-meta-charset-2>a href#attr-meta-charset>charset/a>/code> — a href#character-encoding-declaration idthe-meta-element:character-encoding-declaration>Character encoding declaration/a>dt>a href#concept-element-dom idthe-meta-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-meta-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlmetaelement>HTMLMetaElement/dfn> : a href#htmlelement idthe-meta-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-meta-element:cereactions>CEReactions/a> attribute DOMString a href#dom-meta-name idthe-meta-element:dom-meta-name>name/a>; a href#cereactions idthe-meta-element:cereactions-2>CEReactions/a> attribute DOMString a href#dom-meta-httpequiv idthe-meta-element:dom-meta-httpequiv>httpEquiv/a>; a href#cereactions idthe-meta-element:cereactions-3>CEReactions/a> attribute DOMString a href#dom-meta-content idthe-meta-element:dom-meta-content>content/a>; // a href#HTMLMetaElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-meta-element:the-meta-element>a href#the-meta-element>meta/a>/code> element a href#represents idthe-meta-element:represents>represents/a> various kinds of metadata that cannot be expressed using the code idthe-meta-element:the-title-element>a href#the-title-element>title/a>/code>, code idthe-meta-element:the-base-element>a href#the-base-element>base/a>/code>, code idthe-meta-element:the-link-element>a href#the-link-element>link/a>/code>, code idthe-meta-element:the-style-element>a href#the-style-element>style/a>/code>, and code idthe-meta-element:the-script-element>a href#the-script-element>script/a>/code> elements./p> p>The code idthe-meta-element:the-meta-element-2>a href#the-meta-element>meta/a>/code> element can represent document-level metadata with the code idthe-meta-element:attr-meta-name-3>a href#attr-meta-name>name/a>/code> attribute, pragma directives with the code idthe-meta-element:attr-meta-http-equiv-5>a href#attr-meta-http-equiv>http-equiv/a>/code> attribute, and the files a href#character-encoding-declaration idthe-meta-element:character-encoding-declaration-2>character encoding declaration/a> when an HTML document is serialized to string form (e.g. for transmission over the network or for disk storage) with the code idthe-meta-element:attr-meta-charset-3>a href#attr-meta-charset>charset/a>/code> attribute./p> p>Exactly one of the code idthe-meta-element:attr-meta-name-4>a href#attr-meta-name>name/a>/code>, code idthe-meta-element:attr-meta-http-equiv-6>a href#attr-meta-http-equiv>http-equiv/a>/code>, code idthe-meta-element:attr-meta-charset-4>a href#attr-meta-charset>charset/a>/code>, and code idthe-meta-element:names:-the-itemprop-attribute-5>a href#names:-the-itemprop-attribute>itemprop/a>/code> attributes must be specified./p> p>If either code idthe-meta-element:attr-meta-name-5>a href#attr-meta-name>name/a>/code>, code idthe-meta-element:attr-meta-http-equiv-7>a href#attr-meta-http-equiv>http-equiv/a>/code>, or code idthe-meta-element:names:-the-itemprop-attribute-6>a href#names:-the-itemprop-attribute>itemprop/a>/code> is specified, then the code idthe-meta-element:attr-meta-content-2>a href#attr-meta-content>content/a>/code> attribute must also be specified. Otherwise, it must be omitted./p> p>The dfn idattr-meta-charset>code>charset/code>/dfn> attribute specifies the a hrefhttps://encoding.spec.whatwg.org/#encoding idthe-meta-element:encoding data-x-internalencoding>character encoding/a> used by the document. This is a a href#character-encoding-declaration idthe-meta-element:character-encoding-declaration-3>character encoding declaration/a>. If the attribute is present, its value must be an a idthe-meta-element:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>utf-8/code>./p> p classnote>The code idthe-meta-element:attr-meta-charset-5>a href#attr-meta-charset>charset/a>/code> attribute on the code idthe-meta-element:the-meta-element-3>a href#the-meta-element>meta/a>/code> element has no effect in XML documents, but is allowed in XML documents in order to facilitate migration to and from XML./p> p>There must not be more than one code idthe-meta-element:the-meta-element-4>a href#the-meta-element>meta/a>/code> element with a code idthe-meta-element:attr-meta-charset-6>a href#attr-meta-charset>charset/a>/code> attribute per document./p> p>The dfn data-dfn-formeta idattr-meta-content data-dfn-typeelement-attr data-export>code>content/code>/dfn> attribute gives the value of the document metadata or pragma directive when the element is used for those purposes. The allowed values depend on the exact context, as described in subsequent sections of this specification./p> p>If a code idthe-meta-element:the-meta-element-5>a href#the-meta-element>meta/a>/code> element has a dfn idattr-meta-name>code>name/code>/dfn> attribute, it sets document metadata. Document metadata is expressed in terms of name-value pairs, the code idthe-meta-element:attr-meta-name-6>a href#attr-meta-name>name/a>/code> attribute on the code idthe-meta-element:the-meta-element-6>a href#the-meta-element>meta/a>/code> element giving the name, and the code idthe-meta-element:attr-meta-content-3>a href#attr-meta-content>content/a>/code> attribute on the same element giving the value. The name specifies what aspect of metadata is being set; valid names and the meaning of their values are described in the following sections. If a code idthe-meta-element:the-meta-element-7>a href#the-meta-element>meta/a>/code> element has no code idthe-meta-element:attr-meta-content-4>a href#attr-meta-content>content/a>/code> attribute, then the value part of the metadata name-value pair is the empty string./p> p>The dfn iddom-meta-name>code>name/code>/dfn> and dfn iddom-meta-content>code>content/code>/dfn> IDL attributes must a href#reflect idthe-meta-element:reflect>reflect/a> the respective content attributes of the same name. The IDL attribute dfn iddom-meta-httpequiv>code>httpEquiv/code>/dfn> must a href#reflect idthe-meta-element:reflect-2>reflect/a> the content attribute code idthe-meta-element:attr-meta-http-equiv-8>a href#attr-meta-http-equiv>http-equiv/a>/code>./p> h5 idstandard-metadata-names>span classsecno>4.2.5.1/span> Standard metadata namesa href#standard-metadata-names classself-link>/a>/h5> p>This specification defines a few names for the code idstandard-metadata-names:attr-meta-name>a href#attr-meta-name>name/a>/code> attribute of the code idstandard-metadata-names:the-meta-element>a href#the-meta-element>meta/a>/code> element./p> p>Names are case-insensitivespan classimpl>, and must be compared in an a idstandard-metadata-names:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> manner/span>./p> dl>dt>dfn idmeta-application-name>code>application-name/code>/dfn>dd> p>The value must be a short free-form string giving the name of the Web application that the page represents. If the page is not a Web application, the code idstandard-metadata-names:meta-application-name>a href#meta-application-name>application-name/a>/code> metadata name must not be used. Translations of the Web applications name may be given, using the code idstandard-metadata-names:attr-lang>a href#attr-lang>lang/a>/code> attribute to specify the language of each name./p> p>There must not be more than one code idstandard-metadata-names:the-meta-element-2>a href#the-meta-element>meta/a>/code> element with a given a href#language idstandard-metadata-names:language>language/a> and with its code idstandard-metadata-names:attr-meta-name-2>a href#attr-meta-name>name/a>/code> attribute set to the value code idstandard-metadata-names:meta-application-name-2>a href#meta-application-name>application-name/a>/code> per document./p> p>User agents may use the application name in UI in preference to the pages code idstandard-metadata-names:the-title-element>a href#the-title-element>title/a>/code>, since the title might include status messages and the like relevant to the status of the page at a particular moment in time instead of just being the name of the application./p> p>To find the application name to use given an ordered list of languages (e.g. British English, American English, and English), user agents must run the following steps:/p> ol>li>p>Let var>languages/var> be the list of languages.li>p>Let var>default language/var> be the a href#language idstandard-metadata-names:language-2>language/a> of the code idstandard-metadata-names:document>a href#document>Document/a>/code>s a idstandard-metadata-names:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>, if any, and if that language is not unknown./p> li>p>If there is a var>default language/var>, and if it is not the same language as any of the languages in var>languages/var>, append it to var>languages/var>.li> p>Let var>winning language/var> be the first language in var>languages/var> for which there is a code idstandard-metadata-names:the-meta-element-3>a href#the-meta-element>meta/a>/code> element in the code idstandard-metadata-names:document-2>a href#document>Document/a>/code> that has its code idstandard-metadata-names:attr-meta-name-3>a href#attr-meta-name>name/a>/code> attribute set to the value code idstandard-metadata-names:meta-application-name-3>a href#meta-application-name>application-name/a>/code> and whose a href#language idstandard-metadata-names:language-3>language/a> is the language in question./p> p>If none of the languages have such a code idstandard-metadata-names:the-meta-element-4>a href#the-meta-element>meta/a>/code> element, then abort these steps; theres no given application name./p> li> p>Return the value of the code idstandard-metadata-names:attr-meta-content>a href#attr-meta-content>content/a>/code> attribute of the first code idstandard-metadata-names:the-meta-element-5>a href#the-meta-element>meta/a>/code> element in the code idstandard-metadata-names:document-3>a href#document>Document/a>/code> in a idstandard-metadata-names:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> that has its code idstandard-metadata-names:attr-meta-name-4>a href#attr-meta-name>name/a>/code> attribute set to the value code idstandard-metadata-names:meta-application-name-4>a href#meta-application-name>application-name/a>/code> and whose a href#language idstandard-metadata-names:language-4>language/a> is var>winning language/var>./p> /ol> p classnote>This algorithm would be used by a browser when it needs a name for the page, for instance, to label a bookmark. The languages it would provide to the algorithm would be the users preferred languages./p> dt>dfn idmeta-author>code>author/code>/dfn>dd>p>The value must be a free-form string giving the name of one of the pages authors.dt>dfn idmeta-description>code>description/code>/dfn>dd>p>The value must be a free-form string that describes the page. The value must be appropriate for use in a directory of pages, e.g. in a search engine. There must not be more than one code idstandard-metadata-names:the-meta-element-6>a href#the-meta-element>meta/a>/code> element with its code idstandard-metadata-names:attr-meta-name-5>a href#attr-meta-name>name/a>/code> attribute set to the value code idstandard-metadata-names:meta-description>a href#meta-description>description/a>/code> per document.dt>dfn idmeta-generator>code>generator/code>/dfn>dd> p>The value must be a free-form string that identifies one of the software packages used to generate the document. This value must not be used on pages whose markup is not generated by software, e.g. pages whose markup was written by a user in a text editor./p> div classexample> p>Here is what a tool called Frontweaver could include in its output, in the pages code idstandard-metadata-names:the-head-element>a href#the-head-element>head/a>/code> element, to identify itself as the tool used to generate the page:/p> pre><meta namegenerator contentFrontweaver 8.2>/pre> /div> dt>dfn idmeta-keywords>code>keywords/code>/dfn>dd> p>The value must be a a href#set-of-comma-separated-tokens idstandard-metadata-names:set-of-comma-separated-tokens>set of comma-separated tokens/a>, each of which is a keyword relevant to the page./p> div classexample> p>This page about typefaces on British motorways uses a code idstandard-metadata-names:the-meta-element-7>a href#the-meta-element>meta/a>/code> element to specify some keywords that users might use to look for the page:/p> pre><!DOCTYPE HTML><html langen-GB> <head> <title>Typefaces on UK motorways</title> <meta namekeywords contentbritish,type face,font,fonts,highway,highways> </head> <body> .../pre> /div> p classnote>Many search engines do not consider such keywords, because this feature has historically been used unreliably and even misleadingly as a way to spam search engine results in a way that is not helpful for users./p> p>To obtain the list of keywords that the author has specified as applicable to the page, the user agent must run the following steps:/p> ol>li>p>Let var>keywords/var> be an empty list.li> p>For each code idstandard-metadata-names:the-meta-element-8>a href#the-meta-element>meta/a>/code> element with a code idstandard-metadata-names:attr-meta-name-6>a href#attr-meta-name>name/a>/code> attribute and a code idstandard-metadata-names:attr-meta-content-2>a href#attr-meta-content>content/a>/code> attribute and whose code idstandard-metadata-names:attr-meta-name-7>a href#attr-meta-name>name/a>/code> attributes value is code idstandard-metadata-names:meta-keywords>a href#meta-keywords>keywords/a>/code>:/p> ol>li>p>a hrefhttps://infra.spec.whatwg.org/#split-on-commas idstandard-metadata-names:split-a-string-on-commas data-x-internalsplit-a-string-on-commas>Split the value of the elements code>content/code> attribute on commas/a>.li>p>Add the resulting tokens, if any, to var>keywords/var>./ol> li>p>Remove any duplicates from var>keywords/var>.li>p>Return var>keywords/var>. This is the list of keywords that the author has specified as applicable to the page./ol> p>User agents should not use this information when there is insufficient confidence in the reliability of the value./p> p classexample>For instance, it would be reasonable for a content management system to use the keyword information of pages within the system to populate the index of a site-specific search engine, but a large-scale content aggregator that used this information would likely find that certain users would try to game its ranking mechanism through the use of inappropriate keywords./p> dt>dfn idmeta-referrer>code>referrer/code>/dfn>dd> p>The value must be a a idstandard-metadata-names:referrer-policy hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>referrer policy/a>, which defines the default a idstandard-metadata-names:referrer-policy-2 hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>referrer policy/a> for the code idstandard-metadata-names:document-4>a href#document>Document/a>/code>. a href#refsREFERRERPOLICY>REFERRERPOLICY/a>/p> p>If any code idstandard-metadata-names:the-meta-element-9>a href#the-meta-element>meta/a>/code> elements are a href#insert-an-element-into-a-document idstandard-metadata-names:insert-an-element-into-a-document>inserted into the document/a> or a href#remove-an-element-from-a-document idstandard-metadata-names:remove-an-element-from-a-document>removed from the document/a>, or existing code idstandard-metadata-names:the-meta-element-10>a href#the-meta-element>meta/a>/code> elements have their code idstandard-metadata-names:attr-meta-name-8>a href#attr-meta-name>name/a>/code> or code idstandard-metadata-names:attr-meta-content-3>a href#attr-meta-content>content/a>/code> attributes changed, user agents must run the following algorithm:/p> ol>li> p>Let var>candidate elements/var> be the list of all code idstandard-metadata-names:the-meta-element-11>a href#the-meta-element>meta/a>/code> elements that meet the following criteria, in a idstandard-metadata-names:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>:/p> ul classbrief>li>The element is a idstandard-metadata-names:in-a-document-tree hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a>li>The element has a code idstandard-metadata-names:attr-meta-name-9>a href#attr-meta-name>name/a>/code> attribute, whose value is code idstandard-metadata-names:meta-referrer>a href#meta-referrer>referrer/a>/code>li>The element has a code idstandard-metadata-names:attr-meta-content-4>a href#attr-meta-content>content/a>/code> attribute, whose value is not the empty stringli>The element is a child of a href#the-head-element-2 idstandard-metadata-names:the-head-element-2>the code>head/code> element/a> of the document/ul> li> p>For each var>element/var> in var>candidate elements/var>:/p> ol>li>p>Let var>value/var> be the value of var>element/var>s code idstandard-metadata-names:attr-meta-content-5>a href#attr-meta-content>content/a>/code> attribute, a idstandard-metadata-names:converted-to-ascii-lowercase hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>.li> p>If var>value/var> is one of the values given in the first column of the following table, then set var>value/var> to the value given in the second column:/p> table>thead>tr>th>Legacy value th>Referrer policy tbody>tr>td>code>never/code> td>code idstandard-metadata-names:referrer-policy-no-referrer>a data-x-internalreferrer-policy-no-referrer hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy-no-referrer>no-referrer/a>/code> tr>td>code>default/code> td>code idstandard-metadata-names:referrer-policy-no-referrer-when-downgrade>a data-x-internalreferrer-policy-no-referrer-when-downgrade hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy-no-referrer-when-downgrade>no-referrer-when-downgrade/a>/code> tr>td>code>always/code> td>code idstandard-metadata-names:referrer-policy-unsafe-url>a data-x-internalreferrer-policy-unsafe-url hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy-unsafe-url>unsafe-url/a>/code> tr>td>code>origin-when-crossorigin/code> td>code idstandard-metadata-names:referrer-policy-origin-when-cross-origin>a data-x-internalreferrer-policy-origin-when-cross-origin hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy-origin-when-cross-origin>origin-when-cross-origin/a>/code> /table> li>p>If var>value/var> is a a idstandard-metadata-names:referrer-policy-3 hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>referrer policy/a>, then set var>element/var>s a idstandard-metadata-names:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#concept-document-referrer-policy idstandard-metadata-names:concept-document-referrer-policy>referrer policy/a> to var>policy/var>./ol> p classnote>The fact that these steps are applied for each element enables a hrefhttps://w3c.github.io/webappsec-referrer-policy/#unknown-policy-values>deployment of fallback values for older user agents/a>. a href#refsREFERRERPOLICY>REFERRERPOLICY/a>/p> /ol> dt>dfn idmeta-theme-color>code>theme-color/code>/dfn>dd> p>The value must be a string that matches the CSS a idstandard-metadata-names:color hrefhttps://drafts.csswg.org/css-color/#typedef-color data-x-internalcolor><color>/a> production, defining a suggested color that user agents should use to customize the display of the page or of the surrounding user interface. For example, a browser might color the pages title bar with the specified value, or use it as a color highlight in a tab bar or task switcher./p> p>There must not be more than one code idstandard-metadata-names:the-meta-element-12>a href#the-meta-element>meta/a>/code> element with its code idstandard-metadata-names:attr-meta-name-10>a href#attr-meta-name>name/a>/code> attribute set to the value code idstandard-metadata-names:meta-theme-color>a href#meta-theme-color>theme-color/a>/code> per document./p> div classexample> p>This standard itself uses WHATWG green as its theme color:/p> pre><!DOCTYPE HTML><title>HTML Standard</title><meta nametheme-color content#3c790a>.../pre> /div> p>To obtain a pages theme color, user agents must run the following steps:/p> ol>li> p>Let var>candidate elements/var> be the list of all code idstandard-metadata-names:the-meta-element-13>a href#the-meta-element>meta/a>/code> elements that meet the following criteria, in a idstandard-metadata-names:tree-order-3 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>:/p> ul classbrief>li>The element is a idstandard-metadata-names:in-a-document-tree-2 hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a>li>The element has a code idstandard-metadata-names:attr-meta-name-11>a href#attr-meta-name>name/a>/code> attribute, whose value is code idstandard-metadata-names:meta-theme-color-2>a href#meta-theme-color>theme-color/a>/code>li>The element has a code idstandard-metadata-names:attr-meta-content-6>a href#attr-meta-content>content/a>/code> attribute/ul> li> p>For each var>element/var> in var>candidate elements/var>:/p> ol>li>p>Let var>value/var> be the result of a hrefhttps://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace idstandard-metadata-names:strip-leading-and-trailing-ascii-whitespace data-x-internalstrip-leading-and-trailing-ascii-whitespace>stripping leading and trailing ASCII whitespace/a> from the value of var>element/var>s code idstandard-metadata-names:attr-meta-content-7>a href#attr-meta-content>content/a>/code> attribute.li>p>If var>value/var> can be a href#parsed-as-a-css-color-value idstandard-metadata-names:parsed-as-a-css-color-value>parsed as a CSS <color> value/a>, return the parsed color./ol> li>p>If this step is reached, the page has no theme color./ol> p>If any code idstandard-metadata-names:the-meta-element-14>a href#the-meta-element>meta/a>/code> elements are a href#insert-an-element-into-a-document idstandard-metadata-names:insert-an-element-into-a-document-2>inserted into the document/a> or a href#remove-an-element-from-a-document idstandard-metadata-names:remove-an-element-from-a-document-2>removed from the document/a>, or existing code idstandard-metadata-names:the-meta-element-15>a href#the-meta-element>meta/a>/code> elements have their code idstandard-metadata-names:attr-meta-name-12>a href#attr-meta-name>name/a>/code> or code idstandard-metadata-names:attr-meta-content-8>a href#attr-meta-content>content/a>/code> attributes changed, user agents must re-run the above algorithm and apply the result to any affected UI./p> p>When using the theme color in UI, user agents may adjust it in implementation-specific ways to make it more suitable for the UI in question. For example, if a user agent intends to use the theme color as a background and display white text over it, it might use a darker variant of the theme color in that part of the UI, to ensure adequate contrast./p> /dl> h5 idother-metadata-names>span classsecno>4.2.5.2/span> Other metadata namesa href#other-metadata-names classself-link>/a>/h5> p>Anyone can create and use their own dfn idconcept-meta-extensions>extensions to the predefined set of metadata names/dfn>. There is no requirement to register such extensions./p> p>However, a new metadata name should not be created in any of the following cases:/p> ul>li>p>If either the name is a a idother-metadata-names:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>, or the value of its accompanying code idother-metadata-names:attr-meta-content>a href#attr-meta-content>content/a>/code> attribute is a a idother-metadata-names:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>; in those cases, registering it as an a href#concept-rel-extensions idother-metadata-names:concept-rel-extensions>extension to the predefined set of link types/a> is encouraged (rather than creating a new metadata name).li>p>If the name is for something expected to have processing requirements in user agents; in that case it ought to be standardized./ul> p>Also, before creating and using a new metadata name, consulting the a hrefhttps://wiki.whatwg.org/wiki/MetaExtensions>WHATWG Wiki MetaExtensions page/a> is encouraged — to avoid choosing a metadata name thats already in use, and to avoid duplicating the purpose of any metadata names that are already in use, and to avoid new standardized names clashing with your chosen name. a href#refsWHATWGWIKI>WHATWGWIKI/a>/p> p>Anyone is free to edit the WHATWG Wiki MetaExtensions page at any time to add a metadata name. New metadata names can be specified with the following information:/p> dl>dt>Keyworddd>p>The actual name being defined. The name should not be confusingly similar to any other defined name (e.g. differing only in case).dt>Brief descriptiondd>p>A short non-normative description of what the metadata names meaning is, including the format the value is required to be in.dt>Specificationdd>A link to a more detailed description of the metadata names semantics and requirements. It could be another page on the Wiki, or a link to an external page.dt>Synonymsdd>p>A list of other names that have exactly the same processing requirements. Authors should not use the names defined to be synonyms (they are only intended to allow user agents to support legacy content). Anyone may remove synonyms that are not used in practice; only names that need to be processed as synonyms for compatibility with legacy content are to be registered in this way.dt>Statusdd> p>One of the following:/p> dl>dt>Proposeddd>The name has not received wide peer review and approval. Someone has proposed it and is, or soon will be, using it.dt>Ratifieddd>The name has received wide peer review and approval. It has a specification that unambiguously defines how to handle pages that use the name, including when they use it in incorrect ways.dt>Discontinueddd>The metadata name has received wide peer review and it has been found wanting. Existing pages are using this metadata name, but new pages should avoid it. The brief description and specification entries will give details of what authors should use instead, if anything./dl> p>If a metadata name is found to be redundant with existing values, it should be removed and listed as a synonym for the existing value./p> p>If a metadata name is added in the proposed state for a period of a month or more without being used or specified, then it may be removed from the WHATWG Wiki MetaExtensions page./p> p>If a metadata name is added with the proposed status and found to be redundant with existing values, it should be removed and listed as a synonym for the existing value. If a metadata name is added with the proposed status and found to be harmful, then it should be changed to discontinued status./p> p>Anyone can change the status at any time, but should only do so in accordance with the definitions above./p> /dl> h5 idpragma-directives>span classsecno>4.2.5.3/span> Pragma directivesa href#pragma-directives classself-link>/a>/h5> p>When the dfn data-dfn-formeta idattr-meta-http-equiv data-dfn-typeelement-attr data-export>code>http-equiv/code>/dfn> attribute is specified on a code idpragma-directives:the-meta-element>a href#the-meta-element>meta/a>/code> element, the element is a pragma directive./p> p>The code idpragma-directives:attr-meta-http-equiv>a href#attr-meta-http-equiv>http-equiv/a>/code> attribute is an a href#enumerated-attribute idpragma-directives:enumerated-attribute>enumerated attribute/a>. The following table lists the keywords defined for this attribute. The states given in the first cell of the rows with keywords give the states to which those keywords map. Some of the keywords are non-conforming, as noted in the last column./p> table idtable-http-equiv>thead>tr>th>State th>Keyword th>Notes tbody>tr>td>a href#attr-meta-http-equiv-content-language idpragma-directives:attr-meta-http-equiv-content-language>Content Language/a> td>code>content-language/code> td>Non-conforming tr>td>a href#attr-meta-http-equiv-content-type idpragma-directives:attr-meta-http-equiv-content-type>Encoding declaration/a> td>code>content-type/code> td> tr>td>a href#attr-meta-http-equiv-default-style idpragma-directives:attr-meta-http-equiv-default-style>Default style/a> td>code>default-style/code> td> tr>td>a href#attr-meta-http-equiv-refresh idpragma-directives:attr-meta-http-equiv-refresh>Refresh/a> td>code>refresh/code> td> tr>td>a href#attr-meta-http-equiv-set-cookie idpragma-directives:attr-meta-http-equiv-set-cookie>Cookie setter/a> td>code>set-cookie/code> td>Non-conforming tr>td>a href#attr-meta-http-equiv-x-ua-compatible idpragma-directives:attr-meta-http-equiv-x-ua-compatible>X-UA-Compatible/a> td>code>x-ua-compatible/code> td> tr>td>a href#attr-meta-http-equiv-content-security-policy idpragma-directives:attr-meta-http-equiv-content-security-policy>Content security policy/a> td>code>Content-Security-Policy/code> td> /table> p>When a code idpragma-directives:the-meta-element-2>a href#the-meta-element>meta/a>/code> element is a href#insert-an-element-into-a-document idpragma-directives:insert-an-element-into-a-document>inserted into the document/a>, if its code idpragma-directives:attr-meta-http-equiv-2>a href#attr-meta-http-equiv>http-equiv/a>/code> attribute is present and represents one of the above states, then the user agent must run the algorithm appropriate for that state, as described in the following list:/p> dl>dt>dfn idattr-meta-http-equiv-content-language>Content language state/dfn> (code>http-equivcontent-language/code>) dd> p classnote>This feature is non-conforming. Authors are encouraged to use the code idpragma-directives:attr-lang>a href#attr-lang>lang/a>/code> attribute instead./p> p>This pragma sets the dfn idpragma-set-default-language>pragma-set default language/dfn>. Until such a pragma is successfully processed, there is no a href#pragma-set-default-language idpragma-directives:pragma-set-default-language>pragma-set default language/a>./p> ol>li>p>If the code idpragma-directives:the-meta-element-3>a href#the-meta-element>meta/a>/code> element has no code idpragma-directives:attr-meta-content>a href#attr-meta-content>content/a>/code> attribute, then abort these steps.li>p>If the elements code idpragma-directives:attr-meta-content-2>a href#attr-meta-content>content/a>/code> attribute contains a U+002C COMMA character (,) then abort these steps.li>p>Let var>input/var> be the value of the elements code idpragma-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 idpragma-directives:skip-ascii-whitespace hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace data-x-internalskip-ascii-whitespace>Skip ASCII whitespace/a> within var>input/var> given var>position/var>.li>p>a idpragma-directives:collect-a-sequence-of-code-points hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are not a idpragma-directives:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> from var>input/var> given var>position/var>.li>p>Let var>candidate/var> be the string that resulted from the previous step.li>p>If var>candidate/var> is the empty string, abort these steps.li> p>Set the a href#pragma-set-default-language idpragma-directives:pragma-set-default-language-2>pragma-set default language/a> to var>candidate/var>./p> p classnote>If the value consists of multiple space-separated tokens, tokens after the first are ignored./p> /ol> p classnote>This pragma is almost, but not quite, entirely unlike the HTTP `code idpragma-directives:http-content-language>a data-x-internalhttp-content-language hrefhttps://tools.ietf.org/html/rfc7231#section-3.1.3.2>Content-Language/a>/code>` header of the same name. a href#refsHTTP>HTTP/a>/p> dt>dfn idattr-meta-http-equiv-content-type>Encoding declaration state/dfn> (code>http-equivcontent-type/code>) dd> p>The a href#attr-meta-http-equiv-content-type idpragma-directives:attr-meta-http-equiv-content-type-2>Encoding declaration state/a> is just an alternative form of setting the code idpragma-directives:attr-meta-charset>a href#attr-meta-charset>charset/a>/code> attribute: it is a a href#character-encoding-declaration idpragma-directives:character-encoding-declaration>character encoding declaration/a>. This states user agent requirements are all handled by the parsing section of the specification./p> p>For code idpragma-directives:the-meta-element-4>a href#the-meta-element>meta/a>/code> elements with an code idpragma-directives:attr-meta-http-equiv-3>a href#attr-meta-http-equiv>http-equiv/a>/code> attribute in the a href#attr-meta-http-equiv-content-type idpragma-directives:attr-meta-http-equiv-content-type-3>Encoding declaration state/a>, the code idpragma-directives:attr-meta-content-4>a href#attr-meta-content>content/a>/code> attribute must have a value that is an a idpragma-directives:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for a string that consists of: the literal string code>text/html;/code>, optionally followed by any number of a idpragma-directives:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, followed by the literal string code>charsetutf-8/code>./p> p>A document must not contain both a code idpragma-directives:the-meta-element-5>a href#the-meta-element>meta/a>/code> element with an code idpragma-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 idpragma-directives:attr-meta-http-equiv-content-type-4>Encoding declaration state/a> and a code idpragma-directives:the-meta-element-6>a href#the-meta-element>meta/a>/code> element with the code idpragma-directives:attr-meta-charset-2>a href#attr-meta-charset>charset/a>/code> attribute present./p> p>The a href#attr-meta-http-equiv-content-type idpragma-directives:attr-meta-http-equiv-content-type-5>Encoding declaration state/a> may be used in a idpragma-directives:html-documents hrefhttps://dom.spec.whatwg.org/#html-document data-x-internalhtml-documents>HTML documents/a>, but elements with an code idpragma-directives:attr-meta-http-equiv-5>a href#attr-meta-http-equiv>http-equiv/a>/code> attribute in that state must not be used in a idpragma-directives:xml-documents hrefhttps://dom.spec.whatwg.org/#xml-document data-x-internalxml-documents>XML documents/a>./p> dt>dfn idattr-meta-http-equiv-default-style>Default style state/dfn> (code>http-equivdefault-style/code>) dd> p>This pragma sets the a hrefhttps://drafts.csswg.org/cssom/#css-style-sheet-set-name idpragma-directives:css-style-sheet-set-name data-x-internalcss-style-sheet-set-name>name/a> of the default a idpragma-directives:css-style-sheet-set hrefhttps://drafts.csswg.org/cssom/#css-style-sheet-set data-x-internalcss-style-sheet-set>CSS style sheet set/a>./p> ol>li>p>If the code idpragma-directives:the-meta-element-7>a href#the-meta-element>meta/a>/code> element has no code idpragma-directives:attr-meta-content-5>a href#attr-meta-content>content/a>/code> attribute, or if that attributes value is the empty string, then abort these steps.li>p>a idpragma-directives:change-the-preferred-css-style-sheet-set-name hrefhttps://drafts.csswg.org/cssom/#change-the-preferred-css-style-sheet-set-name data-x-internalchange-the-preferred-css-style-sheet-set-name>Change the preferred CSS style sheet set name/a> with the name being the value of the elements code idpragma-directives:attr-meta-content-6>a href#attr-meta-content>content/a>/code> attribute. a href#refsCSSOM>CSSOM/a>/ol> dt>dfn idattr-meta-http-equiv-refresh>Refresh state/dfn> (code>http-equivrefresh/code>) dd> p>This pragma acts as timed redirect./p> p>A code idpragma-directives:document>a href#document>Document/a>/code> object has an associated dfn data-dfn-forDocument idwill-declaratively-refresh>will declaratively refresh/dfn> (a boolean). It is initially false./p> ol>li>p>If the code idpragma-directives:the-meta-element-8>a href#the-meta-element>meta/a>/code> element has no code idpragma-directives:attr-meta-content-7>a href#attr-meta-content>content/a>/code> attribute, or if that attributes value is the empty string, then return.li>p>Let var>input/var> be the value of the elements code idpragma-directives:attr-meta-content-8>a href#attr-meta-content>content/a>/code> attribute.li>p>Run the a href#shared-declarative-refresh-steps idpragma-directives:shared-declarative-refresh-steps>shared declarative refresh steps/a> with the code idpragma-directives:the-meta-element-9>a href#the-meta-element>meta/a>/code> elements a idpragma-directives:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, var>input/var>, and the code idpragma-directives:the-meta-element-10>a href#the-meta-element>meta/a>/code> element./ol> p>The dfn idshared-declarative-refresh-steps>shared declarative refresh steps/dfn>, given a code idpragma-directives:document-2>a href#document>Document/a>/code> object var>document/var>, string var>input/var>, and optionally a code idpragma-directives:the-meta-element-11>a href#the-meta-element>meta/a>/code> element var>meta/var>, are as follows:/p> ol>li>p>If var>document/var>s a href#will-declaratively-refresh idpragma-directives:will-declaratively-refresh>will declaratively refresh/a> is true, then return.li>p>Let var>position/var> point at the first a idpragma-directives:code-point hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> of var>input/var>.li>p>a idpragma-directives:skip-ascii-whitespace-2 hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace data-x-internalskip-ascii-whitespace>Skip ASCII whitespace/a> within var>input/var> given var>position/var>.li>p>Let var>time/var> be 0.li>p>a idpragma-directives:collect-a-sequence-of-code-points-2 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idpragma-directives:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>, and let the result be var>timeString/var>.li> p>If var>timeString/var> is the empty string, then:/p> ol>li>p>If the a idpragma-directives:code-point-2 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> in var>input/var> pointed to by var>position/var> is not U+002E (.), then return./ol> li>p>Otherwise, set var>time/var> to the result of parsing var>timeString/var> using the a href#rules-for-parsing-non-negative-integers idpragma-directives:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers/a>.li>p>a idpragma-directives:collect-a-sequence-of-code-points-3 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idpragma-directives:ascii-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> and U+002E FULL STOP characters (.) from var>input/var> given var>position/var>. Ignore any collected characters.li>p>Let var>urlRecord/var> be var>document/var>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url idpragma-directives:the-documents-address data-x-internalthe-documents-address>URL/a>.li> p>If var>position/var> is not past the end of var>input/var>, then:/p> ol>li>p>If the a idpragma-directives:code-point-3 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> in var>input/var> pointed to by var>position/var> is not U+003B (;), U+002C (,), or a idpragma-directives:space-characters-3 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, then return.li>p>a idpragma-directives:skip-ascii-whitespace-3 hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace data-x-internalskip-ascii-whitespace>Skip ASCII whitespace/a> within var>input/var> given var>position/var>.li>p>If the a idpragma-directives:code-point-4 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> in var>input/var> pointed to by var>position/var> is U+003B (;) or U+002C (,), then advance var>position/var> to the next a idpragma-directives:code-point-5 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a>.li>p>a idpragma-directives:skip-ascii-whitespace-4 hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace data-x-internalskip-ascii-whitespace>Skip ASCII whitespace/a> within var>input/var> given var>position/var>./ol> li> p>If var>position/var> is not past the end of var>input/var>, then:/p> ol>li>p>Let var>urlString/var> be the substring of var>input/var> from the a idpragma-directives:code-point-6 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> at var>position/var> to the end of the string.li>p>If the a idpragma-directives:code-point-7 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> in var>input/var> pointed to by var>position/var> is U+0055 (U) or U+0075 (u), then advance var>position/var> to the next a idpragma-directives:code-point-8 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a>. Otherwise, jump to the step labeled i>skip quotes/i>.li>p>If the a idpragma-directives:code-point-9 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> in var>input/var> pointed to by var>position/var> is U+0052 (R) or U+0072 (r), then advance var>position/var> to the next a idpragma-directives:code-point-10 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a>. Otherwise, jump to the step labeled i>parse/i>.li>p>If the a idpragma-directives:code-point-11 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> in var>input/var> pointed to by var>position/var> is U+004C (L) or U+006C (l), then advance var>position/var> to the next a idpragma-directives:code-point-12 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a>. Otherwise, jump to the step labeled i>parse/i>.li>p>a idpragma-directives:skip-ascii-whitespace-5 hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace data-x-internalskip-ascii-whitespace>Skip ASCII whitespace/a> within var>input/var> given var>position/var>.li>p>If the a idpragma-directives:code-point-13 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> in var>input/var> pointed to by var>position/var> is U+003D (), then advance var>position/var> to the next a idpragma-directives:code-point-14 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a>. Otherwise, jump to the step labeled i>parse/i>.li>p>a idpragma-directives:skip-ascii-whitespace-6 hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace data-x-internalskip-ascii-whitespace>Skip ASCII whitespace/a> within var>input/var> given var>position/var>.li>p>i>Skip quotes/i>: If the a idpragma-directives:code-point-15 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> in var>input/var> pointed to by var>position/var> is U+0027 () or U+0022 (), then let var>quote/var> be that a idpragma-directives:code-point-16 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a>, and advance var>position/var> to the next a idpragma-directives:code-point-17 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a>. Otherwise, let var>quote/var> be the empty string.li>p>Set var>urlString/var> to the substring of var>input/var> from the a idpragma-directives:code-point-18 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> 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 a idpragma-directives:code-point-19 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> in var>urlString/var> equal to var>quote/var>, then truncate var>urlString/var> at that a idpragma-directives:code-point-20 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a>, so that it and all subsequent a hrefhttps://infra.spec.whatwg.org/#code-point idpragma-directives:code-point-21 data-x-internalcode-point>code points/a> are removed./p> li>p>i>Parse/i>: a href#parse-a-url idpragma-directives:parse-a-url>Parse/a> var>urlString/var> relative to var>document/var>. If that fails, return. Otherwise, set var>urlRecord/var> to the a href#resulting-url-record idpragma-directives:resulting-url-record>resulting URL record/a>./ol> li>p>Set var>document/var>s a href#will-declaratively-refresh idpragma-directives:will-declaratively-refresh-2>will declaratively refresh/a> to true.li> p>Perform one or more of the following steps:/p> ul>li> p>After the refresh has come due (as defined below), if the user has not canceled the redirect and, if var>meta/var> is given, var>document/var>s a href#active-sandboxing-flag-set idpragma-directives:active-sandboxing-flag-set>active sandboxing flag set/a> does not have the a href#sandboxed-automatic-features-browsing-context-flag idpragma-directives:sandboxed-automatic-features-browsing-context-flag>sandboxed automatic features browsing context flag/a> set, then a href#navigate idpragma-directives:navigate>navigate/a> var>document/var>s a href#concept-document-bc idpragma-directives:concept-document-bc>browsing context/a> to var>urlRecord/var>, with a href#replacement-enabled idpragma-directives:replacement-enabled>replacement enabled/a>, and with var>document/var>s a href#concept-document-bc idpragma-directives:concept-document-bc-2>browsing context/a> as the a href#source-browsing-context idpragma-directives:source-browsing-context>source browsing context/a>./p> p>For the purposes of the previous paragraph, a refresh is said to have come due as soon as the em>later/em> of the following two conditions occurs:/p> ul>li>At least var>time/var> seconds have elapsed since var>document/var> has a href#completely-loaded idpragma-directives:completely-loaded>completely loaded/a>, adjusted to take into account user or user agent preferences.li>If var>meta/var> is given, at least var>time/var> seconds have elapsed since var>meta/var> was a href#insert-an-element-into-a-document idpragma-directives:insert-an-element-into-a-document-2>inserted into the document/a> var>document/var>, adjusted to take into account user or user agent preferences./ul> p classnote>It is important to use var>document/var> here, and not var>meta/var>s a idpragma-directives:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, as that might have changed between the initial set of steps and the refresh coming due and var>meta/var> is not always given (in case of the HTTP `code idpragma-directives:refresh>a href#refresh>Refresh/a>/code>` header)./p> li>p>Provide the user with an interface that, when selected, a href#navigate idpragma-directives:navigate-2>navigates/a> a a href#browsing-context idpragma-directives:browsing-context>browsing context/a> to var>urlRecord/var>, with var>document/var>s a href#concept-document-bc idpragma-directives:concept-document-bc-3>browsing context/a> as the a href#source-browsing-context idpragma-directives:source-browsing-context-2>source browsing context/a>.li>p>Do nothing./ul> p>In addition, the user agent may, as with anything, inform the user of any and all aspects of its operation, including the state of any timers, the destinations of any timed redirects, and so forth./p> /ol> p>For code idpragma-directives:the-meta-element-12>a href#the-meta-element>meta/a>/code> elements with an code idpragma-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 idpragma-directives:attr-meta-http-equiv-refresh-2>Refresh state/a>, the code idpragma-directives:attr-meta-content-9>a href#attr-meta-content>content/a>/code> attribute must have a value consisting either of:/p> ul>li>just a a href#valid-non-negative-integer idpragma-directives:valid-non-negative-integer>valid non-negative integer/a>, orli>a a href#valid-non-negative-integer idpragma-directives:valid-non-negative-integer-2>valid non-negative integer/a>, followed by a U+003B SEMICOLON character (;), followed by one or more a idpragma-directives:space-characters-4 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, followed by a substring that is an a idpragma-directives:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>URL/code>, followed by a U+003D EQUALS SIGN character (), followed by a a idpragma-directives:valid-url-string hrefhttps://url.spec.whatwg.org/#valid-url-string data-x-internalvalid-url-string>valid URL string/a> that does not start with a literal U+0027 APOSTROPHE () or U+0022 QUOTATION MARK () character./ul> p>In the former case, the integer represents a number of seconds before the page is to be reloaded; in the latter case the integer represents a number of seconds before the page is to be replaced by the page at the given a idpragma-directives:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>./p> div classexample> p>A news organizations front page could include the following markup in the pages code idpragma-directives:the-head-element>a href#the-head-element>head/a>/code> element, to ensure that the page automatically reloads from the server every five minutes:/p> pre><meta http-equivRefresh content300>/pre> /div> div classexample> p>A sequence of pages could be used as an automated slide show by making each page refresh to the next page in the sequence, using markup such as the following:/p> pre><meta http-equivRefresh content20; URLpage4.html>/pre> /div> dt>dfn idattr-meta-http-equiv-set-cookie>Cookie setter/dfn> (code>http-equivset-cookie/code>) dd> p>This pragma sets an HTTP cookie. a href#refsCOOKIES>COOKIES/a>/p> p>It is non-conforming. Real HTTP headers should be used instead./p> ol>li>p>If the code idpragma-directives:the-meta-element-13>a href#the-meta-element>meta/a>/code> element has no code idpragma-directives:attr-meta-content-10>a href#attr-meta-content>content/a>/code> attribute, or if that attributes value is the empty string, then abort these steps.li>p>Act as if a href#receives-a-set-cookie-string idpragma-directives:receives-a-set-cookie-string>receiving a set-cookie-string/a> for the documents a hrefhttps://dom.spec.whatwg.org/#concept-document-url idpragma-directives:the-documents-address-2 data-x-internalthe-documents-address>URL/a> via a non-HTTP API, consisting of the value of the elements code idpragma-directives:attr-meta-content-11>a href#attr-meta-content>content/a>/code> attribute a hrefhttps://encoding.spec.whatwg.org/#utf-8-encode idpragma-directives:utf-8-encode data-x-internalutf-8-encode>encoded as UTF-8/a>. a href#refsCOOKIES>COOKIES/a> a href#refsENCODING>ENCODING/a>/ol> dt>dfn idattr-meta-http-equiv-x-ua-compatible>X-UA-Compatible state/dfn> (code>http-equivx-ua-compatible/code>) dd> p>In practice, this pragma encourages Internet Explorer to more closely follow the specifications./p> p>For code idpragma-directives:the-meta-element-14>a href#the-meta-element>meta/a>/code> elements with an code idpragma-directives:attr-meta-http-equiv-7>a href#attr-meta-http-equiv>http-equiv/a>/code> attribute in the a href#attr-meta-http-equiv-x-ua-compatible idpragma-directives:attr-meta-http-equiv-x-ua-compatible-2>X-UA-Compatible state/a>, the code idpragma-directives:attr-meta-content-12>a href#attr-meta-content>content/a>/code> attribute must have a value that is an a idpragma-directives:ascii-case-insensitive-3 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>IEedge/code>./p> p>User agents are required to ignore this pragma./p> dt>dfn idattr-meta-http-equiv-content-security-policy data-dfn-typedfn data-export>Content security policy state/dfn> (code>http-equivcontent-security-policy/code>) dd> p>This pragma a hrefhttps://w3c.github.io/webappsec-csp/#enforced idpragma-directives:enforce-the-policy data-x-internalenforce-the-policy>enforces/a> a a idpragma-directives:content-security-policy hrefhttps://w3c.github.io/webappsec-csp/#content-security-policy-object data-x-internalcontent-security-policy>Content Security Policy/a> on a code idpragma-directives:document-3>a href#document>Document/a>/code>. a href#refsCSP>CSP/a>/p> ol>li>p>If the code idpragma-directives:the-meta-element-15>a href#the-meta-element>meta/a>/code> element is not a child of a code idpragma-directives:the-head-element-2>a href#the-head-element>head/a>/code> element, abort these steps.li>p>If the code idpragma-directives:the-meta-element-16>a href#the-meta-element>meta/a>/code> element has no code idpragma-directives:attr-meta-content-13>a href#attr-meta-content>content/a>/code> attribute, or if that attributes value is the empty string, then abort these steps.li>p>Let var>policy/var> be the result of executing Content Security Policys a idpragma-directives:parse-a-serialized-content-security-policy hrefhttps://w3c.github.io/webappsec-csp/#parse-serialized-policy data-x-internalparse-a-serialized-content-security-policy>parse a serialized Content Security Policy/a> algorithm on the code idpragma-directives:the-meta-element-17>a href#the-meta-element>meta/a>/code> elements code idpragma-directives:attr-meta-content-14>a href#attr-meta-content>content/a>/code> attributes value.li>p>Remove all occurrences of the code idpragma-directives:report-uri-directive>a data-x-internalreport-uri-directive hrefhttps://w3c.github.io/webappsec-csp/#report-uri>report-uri/a>/code>, code idpragma-directives:frame-ancestors-directive>a data-x-internalframe-ancestors-directive hrefhttps://w3c.github.io/webappsec-csp/#frame-ancestors>frame-ancestors/a>/code>, and code idpragma-directives:sandbox-directive>a data-x-internalsandbox-directive hrefhttps://w3c.github.io/webappsec-csp/#sandbox>sandbox/a>/code> a hrefhttps://w3c.github.io/webappsec-csp/#directives idpragma-directives:content-security-policy-directive data-x-internalcontent-security-policy-directive>directives/a> from var>policy/var>.li>p>a idpragma-directives:enforce-the-policy-2 hrefhttps://w3c.github.io/webappsec-csp/#enforced data-x-internalenforce-the-policy>Enforce the policy/a> var>policy/var>./ol> p>For code idpragma-directives:the-meta-element-18>a href#the-meta-element>meta/a>/code> elements with an code idpragma-directives:attr-meta-http-equiv-8>a href#attr-meta-http-equiv>http-equiv/a>/code> attribute in the a href#attr-meta-http-equiv-content-security-policy idpragma-directives:attr-meta-http-equiv-content-security-policy-2>Content security policy state/a>, the code idpragma-directives:attr-meta-content-15>a href#attr-meta-content>content/a>/code> attribute must have a value consisting of a a hrefhttps://w3c.github.io/webappsec-csp/#grammardef-serialized-policy idpragma-directives:content-security-policy-syntax data-x-internalcontent-security-policy-syntax>valid Content Security Policy/a>, but must not contain any code idpragma-directives:report-uri-directive-2>a data-x-internalreport-uri-directive hrefhttps://w3c.github.io/webappsec-csp/#report-uri>report-uri/a>/code>, code idpragma-directives:frame-ancestors-directive-2>a data-x-internalframe-ancestors-directive hrefhttps://w3c.github.io/webappsec-csp/#frame-ancestors>frame-ancestors/a>/code>, or code idpragma-directives:sandbox-directive-2>a data-x-internalsandbox-directive hrefhttps://w3c.github.io/webappsec-csp/#sandbox>sandbox/a>/code> a hrefhttps://w3c.github.io/webappsec-csp/#directives idpragma-directives:content-security-policy-directive-2 data-x-internalcontent-security-policy-directive>directives/a>. The a idpragma-directives:content-security-policy-2 hrefhttps://w3c.github.io/webappsec-csp/#content-security-policy-object data-x-internalcontent-security-policy>Content Security Policy/a> given in the code idpragma-directives:attr-meta-content-16>a href#attr-meta-content>content/a>/code> attribute will be a hrefhttps://w3c.github.io/webappsec-csp/#enforced idpragma-directives:enforce-the-policy-3 data-x-internalenforce-the-policy>enforced/a> upon the current document. a href#refsCSP>CSP/a>/p> div classexample> p>A page might choose to mitigate the risk of cross-site scripting attacks by preventing the execution of inline JavaScript, as well as blocking all plugin content, using a policy such as the following: pre><meta http-equivContent-Security-Policy contentscript-src self; object-src none>/pre> /div> /dl> p>There must not be more than one code idpragma-directives:the-meta-element-19>a href#the-meta-element>meta/a>/code> element with any particular state in the document at a time./p> h5 idother-pragma-directives>span classsecno>4.2.5.4/span> Other pragma directivesa href#other-pragma-directives classself-link>/a>/h5> p>dfn idconcept-http-equiv-extensions>Extensions to the predefined set of pragma directives/dfn> may, under certain conditions, be registered in the a hrefhttps://wiki.whatwg.org/wiki/PragmaExtensions>WHATWG Wiki PragmaExtensions page/a>. a href#refsWHATWGWIKI>WHATWGWIKI/a>/p> p>Such extensions must use a name that is identical to an HTTP header registered in the Permanent Message Header Field Registry, and must have behavior identical to that described for the HTTP header. a href#refsIANAPERMHEADERS>IANAPERMHEADERS/a>/p> p>Pragma directives corresponding to headers describing metadata, or not requiring specific user agent processing, must not be registered; instead, use a href#concept-meta-extensions idother-pragma-directives:concept-meta-extensions>metadata names/a>. Pragma directives corresponding to headers that affect the HTTP processing model (e.g. caching) must not be registered, as they would result in HTTP-level behavior being different for user agents that implement HTML than for user agents that do not./p> p>Anyone is free to edit the WHATWG Wiki PragmaExtensions page at any time to add a pragma directive satisfying these conditions. Such registrations must specify the following information:/p> dl>dt>Keyworddd>p>The actual name being defined. The name must match a previously-registered HTTP name with the same requirements.dt>Brief descriptiondd>p>A short non-normative description of the purpose of the pragma directive.dt>Specificationdd>A link to the specification defining the corresponding HTTP header./dl> p>Conformance checkers must use the information given on the WHATWG Wiki PragmaExtensions page to establish if a value is allowed or not: values defined in this specification or listed on the aforementioned page must be accepted, whereas values not listed in either this specification or on the aforementioned page must be rejected as invalid. Conformance checkers may cache this information (e.g. for performance reasons or to avoid the use of unreliable network connectivity)./p> h5 idcharset>span classsecno>4.2.5.5/span> Specifying the documents character encodinga href#charset classself-link>/a>/h5> p>A dfn idcharacter-encoding-declaration>character encoding declaration/dfn> is a mechanism by which the a hrefhttps://encoding.spec.whatwg.org/#encoding idcharset:encoding data-x-internalencoding>character encoding/a> used to store or transmit a document is specified./p> p>The Encoding standard requires use of the a idcharset:utf-8 hrefhttps://encoding.spec.whatwg.org/#utf-8 data-x-internalutf-8>UTF-8/a> a hrefhttps://encoding.spec.whatwg.org/#encoding idcharset:encoding-2 data-x-internalencoding>character encoding/a> and requires use of the code>utf-8/code> a idcharset:encoding-label hrefhttps://encoding.spec.whatwg.org/#label data-x-internalencoding-label>encoding label/a> to identify it. Those requirements necessitate that the documents a href#character-encoding-declaration idcharset:character-encoding-declaration>character encoding declaration/a>, if it exists, specifies an a idcharset:encoding-label-2 hrefhttps://encoding.spec.whatwg.org/#label data-x-internalencoding-label>encoding label/a> using an a idcharset:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for code>utf-8/code>. Regardless of whether a a href#character-encoding-declaration idcharset:character-encoding-declaration-2>character encoding declaration/a> is present or not, the actual a hrefhttps://dom.spec.whatwg.org/#concept-document-encoding idcharset:documents-character-encoding data-x-internaldocuments-character-encoding>character encoding/a> used to encode the document must be a idcharset:utf-8-2 hrefhttps://encoding.spec.whatwg.org/#utf-8 data-x-internalutf-8>UTF-8/a>. a href#refsENCODING>ENCODING/a>/p> p>To enforce the above rules, authoring tools must default to using a idcharset:utf-8-3 hrefhttps://encoding.spec.whatwg.org/#utf-8 data-x-internalutf-8>UTF-8/a> for newly-created documents./p> p>The following restrictions also apply:/p> ul>li>The character encoding declaration must be serialized without the use of a href#syntax-charref idcharset:syntax-charref>character references/a> or character escapes of any kind.li idcharset1024>span idcharset512>The element containing the character encoding declaration must be serialized completely within the first 1024 bytes of the document./span>/ul> p>In addition, due to a number of restrictions on code idcharset:the-meta-element>a href#the-meta-element>meta/a>/code> elements, there can only be one code idcharset:the-meta-element-2>a href#the-meta-element>meta/a>/code>-based character encoding declaration per document./p> p>If an a hrefhttps://dom.spec.whatwg.org/#html-document idcharset:html-documents data-x-internalhtml-documents>HTML document/a> does not start with a BOM, and its a idcharset:encoding-3 hrefhttps://encoding.spec.whatwg.org/#encoding data-x-internalencoding>encoding/a> is not explicitly given by a href#content-type idcharset:content-type>Content-Type metadata/a>, and the document is not a href#an-iframe-srcdoc-document idcharset:an-iframe-srcdoc-document>an code>iframe/code> code>srcdoc/code> document/a>, then the encoding must be specified using a code idcharset:the-meta-element-3>a href#the-meta-element>meta/a>/code> element with a code idcharset:attr-meta-charset>a href#attr-meta-charset>charset/a>/code> attribute or a code idcharset:the-meta-element-4>a href#the-meta-element>meta/a>/code> element with an code idcharset:attr-meta-http-equiv>a href#attr-meta-http-equiv>http-equiv/a>/code> attribute in the a href#attr-meta-http-equiv-content-type idcharset:attr-meta-http-equiv-content-type>Encoding declaration state/a>./p> div classnote> p>A character encoding declaration is required (either in the a href#content-type idcharset:content-type-2>Content-Type metadata/a> or explicitly in the file) even when all characters are in the ASCII range, because a character encoding is needed to process non-ASCII characters entered by the user in forms, in URLs generated by scripts, and so forth./p> p>Using non-UTF-8 encodings can have unexpected results on form submission and URL encodings, which use the a idcharset:documents-character-encoding-2 hrefhttps://dom.spec.whatwg.org/#concept-document-encoding data-x-internaldocuments-character-encoding>documents character encoding/a> by default./p> /div> p>If the document is a href#an-iframe-srcdoc-document idcharset:an-iframe-srcdoc-document-2>an code>iframe/code> code>srcdoc/code> document/a>, the document must not have a a href#character-encoding-declaration idcharset:character-encoding-declaration-3>character encoding declaration/a>. (In this case, the source is already decoded, since it is part of the document that contained the code idcharset:the-iframe-element>a href#the-iframe-element>iframe/a>/code>.)/p> p>In XML, the XML declaration should be used for inline character encoding information, if necessary./p> div classexample> p>In HTML, to declare that the character encoding is a idcharset:utf-8-4 hrefhttps://encoding.spec.whatwg.org/#utf-8 data-x-internalutf-8>UTF-8/a>, the author could include the following markup near the top of the document (in the code idcharset:the-head-element>a href#the-head-element>head/a>/code> element):/p> pre><meta charsetutf-8>/pre> p>In XML, the XML declaration would be used instead, at the very top of the markup:/p> pre><?xml version1.0 encodingutf-8?>/pre> /div> h4 idthe-style-element data-dfn-typeelement data-ltstyle>span classsecno>4.2.6/span> The dfn>code>style/code>/dfn> elementa href#the-style-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-style-element:concept-element-categories>Categories/a>:dd>a href#metadata-content-2 idthe-style-element:metadata-content-2>Metadata content/a>.dt>a href#concept-element-contexts idthe-style-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#metadata-content-2 idthe-style-element:metadata-content-2-2>metadata content/a> is expected.dd>In a code idthe-style-element:the-noscript-element>a href#the-noscript-element>noscript/a>/code> element that is a child of a code idthe-style-element:the-head-element>a href#the-head-element>head/a>/code> element.dt>a href#concept-element-content-model idthe-style-element:concept-element-content-model>Content model/a>:dd>a href#text-content idthe-style-element:text-content>Text/a> that gives a a idthe-style-element:conformant-style-sheet hrefhttps://drafts.csswg.org/css-syntax/#conform-classes data-x-internalconformant-style-sheet>conformant style sheet/a>.dt>a href#concept-element-tag-omission idthe-style-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-style-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-style-element:global-attributes>Global attributes/a>dd>code idthe-style-element:attr-style-media>a href#attr-style-media>media/a>/code> — Applicable mediadd>code idthe-style-element:attr-style-nonce>a href#attr-style-nonce>nonce/a>/code> — Cryptographic nonce used in cite>Content Security Policy/cite> checks a href#refsCSP>CSP/a>dd>Also, the code idthe-style-element:attr-style-title>a href#attr-style-title>title/a>/code> attribute a href#attr-style-title idthe-style-element:attr-style-title-2>has special semantics/a> on this element: a idthe-style-element:css-style-sheet-set-name hrefhttps://drafts.csswg.org/cssom/#css-style-sheet-set-name data-x-internalcss-style-sheet-set-name>CSS style sheet set name/a>.dt>a href#concept-element-dom idthe-style-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-style-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlstyleelement>HTMLStyleElement/dfn> : a href#htmlelement idthe-style-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-style-element:cereactions>CEReactions/a> attribute DOMString a href#dom-style-media idthe-style-element:dom-style-media>media/a>; a href#cereactions idthe-style-element:cereactions-2>CEReactions/a> attribute DOMString a href#dom-style-nonce idthe-style-element:dom-style-nonce>nonce/a>; // a href#HTMLStyleElement-partial>also has obsolete members/a>};a href#htmlstyleelement idthe-style-element:htmlstyleelement>HTMLStyleElement/a> implements a idthe-style-element:linkstyle hrefhttps://drafts.csswg.org/cssom/#the-linkstyle-interface data-x-internallinkstyle>LinkStyle/a>;/pre> /dl> p>The code idthe-style-element:the-style-element>a href#the-style-element>style/a>/code> element allows authors to embed CSS style sheets in their documents. The code idthe-style-element:the-style-element-2>a href#the-style-element>style/a>/code> element is one of several inputs to the styling processing model. The element does not a href#represents idthe-style-element:represents>represent/a> content for the user./p> p>The dfn idattr-style-media>code>media/code>/dfn> attribute says which media the styles apply to. The value must be a a href#valid-media-query-list idthe-style-element:valid-media-query-list>valid media query list/a>. The user agent must apply the styles when the code idthe-style-element:attr-style-media-2>a href#attr-style-media>media/a>/code> attributes value a href#matches-the-environment idthe-style-element:matches-the-environment>matches the environment/a> and the other relevant conditions apply, and must not apply them otherwise./p> p classnote>The styles might be further limited in scope, e.g. in CSS with the use of code>@media/code> blocks. This specification does not override such further restrictions or requirements./p> p idstyle-default-media>The default, if the code idthe-style-element:attr-style-media-3>a href#attr-style-media>media/a>/code> attribute is omitted, is code>all/code>, meaning that by default styles apply to all media./p> p>The dfn idattr-style-nonce>code>nonce/code>/dfn> attribute represents a cryptographic nonce (number used once) which can be used by cite>Content Security Policy/cite> to determine whether or not the style specified by an element will be applied to the document. The value is text. a href#refsCSP>CSP/a>/p> p idtitle-on-style>The dfn idattr-style-title>code>title/code>/dfn> attribute on code idthe-style-element:the-style-element-3>a href#the-style-element>style/a>/code> elements defines a hrefhttps://drafts.csswg.org/cssom/#css-style-sheet-set idthe-style-element:css-style-sheet-set data-x-internalcss-style-sheet-set>CSS style sheet sets/a>. If the code idthe-style-element:the-style-element-4>a href#the-style-element>style/a>/code> element has no code idthe-style-element:attr-style-title-3>a href#attr-style-title>title/a>/code> attribute, then it has no title; the code idthe-style-element:attr-title>a href#attr-title>title/a>/code> attribute of ancestors does not apply to the code idthe-style-element:the-style-element-5>a href#the-style-element>style/a>/code> element. If the code idthe-style-element:the-style-element-6>a href#the-style-element>style/a>/code> element is not a idthe-style-element:in-a-document-tree hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a>, then the code idthe-style-element:attr-style-title-4>a href#attr-style-title>title/a>/code> attribute is ignored. a href#refsCSSOM>CSSOM/a>/p> p classnote>The code idthe-style-element:attr-style-title-5>a href#attr-style-title>title/a>/code> attribute on code idthe-style-element:the-style-element-7>a href#the-style-element>style/a>/code> elements, like the code idthe-style-element:attr-link-title>a href#attr-link-title>title/a>/code> attribute on code idthe-style-element:the-link-element>a href#the-link-element>link/a>/code> elements, differs from the global code idthe-style-element:attr-title-2>a href#attr-title>title/a>/code> attribute in that a code idthe-style-element:the-style-element-8>a href#the-style-element>style/a>/code> block without a title does not inherit the title of the parent element: it merely has no title./p> p>The a idthe-style-element:child-text-content hrefhttps://dom.spec.whatwg.org/#concept-child-text-content data-x-internalchild-text-content>child text content/a> of a code idthe-style-element:the-style-element-9>a href#the-style-element>style/a>/code> element must be that of a a idthe-style-element:conformant-style-sheet-2 hrefhttps://drafts.csswg.org/css-syntax/#conform-classes data-x-internalconformant-style-sheet>conformant style sheet/a>./p> hr> p>The user agent must run the a href#update-a-style-block idthe-style-element:update-a-style-block>update a code>style/code> block/a> algorithm whenever one of the following conditions occur:/p> ul>li>p>The element is popped off the a href#stack-of-open-elements idthe-style-element:stack-of-open-elements>stack of open elements/a> of an a href#html-parser idthe-style-element:html-parser>HTML parser/a> or a href#xml-parser idthe-style-element:xml-parser>XML parser/a>.li>p>The element is not on the a href#stack-of-open-elements idthe-style-element:stack-of-open-elements-2>stack of open elements/a> of an a href#html-parser idthe-style-element:html-parser-2>HTML parser/a> or a href#xml-parser idthe-style-element:xml-parser-2>XML parser/a>, and it a href#becomes-connected idthe-style-element:becomes-connected>becomes connected/a> or a href#becomes-disconnected idthe-style-element:becomes-disconnected>disconnected/a>.li>p>The elements a idthe-style-element:child-text-content-change-steps hrefhttps://dom.spec.whatwg.org/#concept-node-adopt-ext data-x-internalchild-text-content-change-steps>child text content change steps/a> run./ul> p>The dfn idupdate-a-style-block data-export>update a code>style/code> block/dfn> algorithm is as follows:/p> ol>li>p>Let var>element/var> be the code idthe-style-element:the-style-element-10>a href#the-style-element>style/a>/code> element.li>p>If var>element/var> has an a idthe-style-element:associated-css-style-sheet hrefhttps://drafts.csswg.org/cssom/#associated-css-style-sheet data-x-internalassociated-css-style-sheet>associated CSS style sheet/a>, a hrefhttps://drafts.csswg.org/cssom/#remove-a-css-style-sheet idthe-style-element:remove-a-css-style-sheet data-x-internalremove-a-css-style-sheet>remove the CSS style sheet/a> in question.li>p>If var>element/var>s a idthe-style-element:root hrefhttps://dom.spec.whatwg.org/#concept-tree-root data-x-internalroot>root/a> is neither a a idthe-style-element:shadow-root hrefhttps://dom.spec.whatwg.org/#concept-shadow-root data-x-internalshadow-root>shadow root/a> nor a a href#document idthe-style-element:document>document/a>, then return.li> p>If var>element/var>s code idthe-style-element:attr-style-type>a href#attr-style-type>type/a>/code> attribute is present and its value is neither the empty string nor an a idthe-style-element:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for code idthe-style-element:text/css>a href#text/css>text/css/a>/code>, then return./p> p classnote>In particular, a code idthe-style-element:attr-style-type-2>a href#attr-style-type>type/a>/code> value with parameters, such as code>text/css; charsetutf-8/code>, will cause this algorithm to return early./p> li>p>If the a idthe-style-element:should-elements-inline-behavior-be-blocked-by-content-security-policy hrefhttps://w3c.github.io/webappsec-csp/#should-block-inline data-x-internalshould-elements-inline-behavior-be-blocked-by-content-security-policy>Should elements inline behavior be blocked by Content Security Policy?/a> algorithm returns code>Blocked/code> when executed upon the code idthe-style-element:the-style-element-11>a href#the-style-element>style/a>/code> element, code>style/code>, and the code idthe-style-element:the-style-element-12>a href#the-style-element>style/a>/code> elements a idthe-style-element:child-text-content-2 hrefhttps://dom.spec.whatwg.org/#concept-child-text-content data-x-internalchild-text-content>child text content/a>, then return. a href#refsCSP>CSP/a>li> p>a idthe-style-element:create-a-css-style-sheet hrefhttps://drafts.csswg.org/cssom/#create-a-css-style-sheet data-x-internalcreate-a-css-style-sheet>Create a CSS style sheet/a> with the following properties:/p> dl>dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-type idthe-style-element:concept-css-style-sheet-type data-x-internalconcept-css-style-sheet-type>type/a>dd>p>code idthe-style-element:text/css-2>a href#text/css>text/css/a>/code>dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-owner-node idthe-style-element:concept-css-style-sheet-owner-node data-x-internalconcept-css-style-sheet-owner-node>owner node/a>dd>p>var>element/var>dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-media idthe-style-element:concept-css-style-sheet-media data-x-internalconcept-css-style-sheet-media>media/a>dd> p>The code idthe-style-element:attr-style-media-4>a href#attr-style-media>media/a>/code> attribute of var>element/var>./p> p classnote>This is a reference to the (possibly absent at this time) attribute, rather than a copy of the attributes current value. The CSSOM specification defines what happens when the attribute is dynamically set, changed, or removed./p> dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-title idthe-style-element:concept-css-style-sheet-title data-x-internalconcept-css-style-sheet-title>title/a>dd> p>The code idthe-style-element:attr-style-title-6>a href#attr-style-title>title/a>/code> attribute of var>element/var>, if var>element/var> is a idthe-style-element:in-a-document-tree-2 hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a>, or the empty string otherwise./p> p classnote>Again, this is a em>reference/em> to the attribute./p> dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-alternate-flag idthe-style-element:concept-css-style-sheet-alternate-flag data-x-internalconcept-css-style-sheet-alternate-flag>alternate flag/a>dd>p>Unset.dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-origin-clean-flag idthe-style-element:concept-css-style-sheet-origin-clean-flag data-x-internalconcept-css-style-sheet-origin-clean-flag>origin-clean flag/a>dd>p>Set.dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-location idthe-style-element:concept-css-style-sheet-location data-x-internalconcept-css-style-sheet-location>location/a>dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-parent-css-style-sheet idthe-style-element:concept-css-style-sheet-parent-css-style-sheet data-x-internalconcept-css-style-sheet-parent-css-style-sheet>parent CSS style sheet/a>dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-owner-css-rule idthe-style-element:concept-css-style-sheet-owner-css-rule data-x-internalconcept-css-style-sheet-owner-css-rule>owner CSS rule/a>dd>p>nulldt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-disabled-flag idthe-style-element:concept-css-style-sheet-disabeld-flag data-x-internalconcept-css-style-sheet-disabeld-flag>disabled flag/a>dd>p>Left at its default value.dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-css-rules idthe-style-element:concept-css-style-sheet-css-rules data-x-internalconcept-css-style-sheet-css-rules>CSS rules/a>dd> p>Left uninitialized./p> p classXXX>This doesnt seem right. Presumably we should be using the elements a idthe-style-element:child-text-content-3 hrefhttps://dom.spec.whatwg.org/#concept-child-text-content data-x-internalchild-text-content>child text content/a>? Tracked as a hrefhttps://github.com/whatwg/html/issues/2997>issue #2997/a>./p> /dl> /ol> p>Once the attempts to obtain the style sheets a href#critical-subresources idthe-style-element:critical-subresources>critical subresources/a>, if any, are complete, or, if the style sheet has no a href#critical-subresources idthe-style-element:critical-subresources-2>critical subresources/a>, once the style sheet has been parsed and processed, the user agent must, if the loads were successful or there were none, a href#queue-a-task idthe-style-element:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-style-element:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idthe-style-element:event-load>a href#event-load>load/a>/code> at the code idthe-style-element:the-style-element-13>a href#the-style-element>style/a>/code> element, or, if one of the style sheets a href#critical-subresources idthe-style-element:critical-subresources-3>critical subresources/a> failed to completely load for any reason (e.g. DNS error, HTTP 404 response, a connection being prematurely closed, unsupported Content-Type), a href#queue-a-task idthe-style-element:queue-a-task-2>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-style-element:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idthe-style-element:event-error>a href#event-error>error/a>/code> at the code idthe-style-element:the-style-element-14>a href#the-style-element>style/a>/code> element. Non-network errors in processing the style sheet or its subresources (e.g. CSS parse errors, PNG decoding errors) are not failures for the purposes of this paragraph./p> p>The a href#task-source idthe-style-element:task-source>task source/a> for these a href#concept-task idthe-style-element:concept-task>tasks/a> is the a href#dom-manipulation-task-source idthe-style-element:dom-manipulation-task-source>DOM manipulation task source/a>./p> p>The element must a href#delay-the-load-event idthe-style-element:delay-the-load-event>delay the load event/a> of the elements a idthe-style-element:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> until all the attempts to obtain the style sheets a href#critical-subresources idthe-style-element:critical-subresources-4>critical subresources/a>, if any, are complete./p> p classnote>This specification does not specify a style system, but CSS is expected to be supported by most Web browsers. a href#refsCSS>CSS/a>/p> p>The dfn iddom-style-media>code>media/code>/dfn> and dfn iddom-style-nonce>code>nonce/code>/dfn> IDL attributes must a href#reflect idthe-style-element:reflect>reflect/a> the respective content attributes of the same name./p> p>The code idthe-style-element:linkstyle-2>a data-x-internallinkstyle hrefhttps://drafts.csswg.org/cssom/#the-linkstyle-interface>LinkStyle/a>/code> interface is also implemented by this element. a href#refsCSSOM>CSSOM/a>/p> div classexample> p>The following document has its stress emphasis styled as bright red text rather than italics text, while leaving titles of works and Latin words in their default italics. It shows how using appropriate elements enables easier restyling of documents./p> pre><!DOCTYPE html><html langen-US> <head> <title>My favorite book</title> <style> body { color: black; background: white; } em { font-style: normal; color: red; } </style> </head> <body> <p>My <em>favorite</em> book of all time has <em>got</em> to be <cite>A Cats Life</cite>. It is a book by P. Rahmel that talks about the <i langla>Felis Catus</i> in modern human society.</p> </body></html>/pre> /div> h4 idinteractions-of-styling-and-scripting>span classsecno>4.2.7/span> Interactions of styling and scriptinga href#interactions-of-styling-and-scripting classself-link>/a>/h4> p>Style sheets, whether added by a code idinteractions-of-styling-and-scripting:the-link-element>a href#the-link-element>link/a>/code> element, a code idinteractions-of-styling-and-scripting:the-style-element>a href#the-style-element>style/a>/code> element, an code idinteractions-of-styling-and-scripting:xml-stylesheet>a data-x-internalxml-stylesheet hrefhttps://www.w3.org/TR/xml-stylesheet/#the-xml-stylesheet-processing-instruction><?xml-stylesheet?>/a>/code> PI, an HTTP `code idinteractions-of-styling-and-scripting:http-link>a data-x-internalhttp-link hrefhttps://tools.ietf.org/html/rfc5988#section-5>Link/a>/code>` header, or some other mechanism, have a dfn idstyle-sheet-ready>style sheet ready/dfn> flag, which is initially unset./p> p>When a style sheet is ready to be applied, its a href#style-sheet-ready idinteractions-of-styling-and-scripting:style-sheet-ready>style sheet ready/a> flag must be set. If the style sheet referenced no other resources (e.g. it was an internal style sheet given by a code idinteractions-of-styling-and-scripting:the-style-element-2>a href#the-style-element>style/a>/code> element with no code>@import/code> rules), then the style rules must be a href#immediately idinteractions-of-styling-and-scripting:immediately>immediately/a> made available to script; otherwise, the style rules must only be made available to script once the a href#event-loop idinteractions-of-styling-and-scripting:event-loop>event loop/a> reaches its a href#update-the-rendering idinteractions-of-styling-and-scripting:update-the-rendering>update the rendering/a> step./p> p>A style sheet in the context of the code idinteractions-of-styling-and-scripting:document>a href#document>Document/a>/code> of an a href#html-parser idinteractions-of-styling-and-scripting:html-parser>HTML parser/a> or a href#xml-parser idinteractions-of-styling-and-scripting:xml-parser>XML parser/a> is said to be dfn ida-style-sheet-that-is-blocking-scripts>a style sheet that is blocking scripts/dfn> if the element was created by that code idinteractions-of-styling-and-scripting:document-2>a href#document>Document/a>/code>s parser, and the element is either a code idinteractions-of-styling-and-scripting:the-style-element-3>a href#the-style-element>style/a>/code> element or a code idinteractions-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 idinteractions-of-styling-and-scripting:link-type-stylesheet>external resource link that contributes to the styling processing model/a> when the element was created by the parser, and the elements style sheet was enabled when the element was created by the parser, and the elements a href#style-sheet-ready idinteractions-of-styling-and-scripting:style-sheet-ready-2>style sheet ready/a> flag is not yet set, and, the last time the a href#event-loop idinteractions-of-styling-and-scripting:event-loop-2>event loop/a> reached a href#step1>step 1/a>, the elements a idinteractions-of-styling-and-scripting:root hrefhttps://dom.spec.whatwg.org/#concept-tree-root data-x-internalroot>root/a> was that code idinteractions-of-styling-and-scripting:document-3>a href#document>Document/a>/code>, and the user agent hasnt given up on that particular style sheet yet. A user agent may give up on a style sheet at any time./p> p classnote>Giving up on a style sheet before the style sheet loads, if the style sheet eventually does still load, means that the script might end up operating with incorrect information. For example, if a style sheet sets the color of an element to green, but a script that inspects the resulting style is executed before the sheet is loaded, the script will find that the element is black (or whatever the default color is), and might thus make poor choices (e.g. deciding to use black as the color elsewhere on the page, instead of green). Implementors have to balance the likelihood of a script using incorrect information with the performance impact of doing nothing while waiting for a slow network request to finish./p> p>A code idinteractions-of-styling-and-scripting:document-4>a href#document>Document/a>/code> dfn idhas-a-style-sheet-that-is-blocking-scripts>has a style sheet that is blocking scripts/dfn> if there is either a href#a-style-sheet-that-is-blocking-scripts idinteractions-of-styling-and-scripting:a-style-sheet-that-is-blocking-scripts>a style sheet that is blocking scripts/a> in the context of that code idinteractions-of-styling-and-scripting:document-5>a href#document>Document/a>/code>, or if that code idinteractions-of-styling-and-scripting:document-6>a href#document>Document/a>/code> has a a href#concept-document-bc idinteractions-of-styling-and-scripting:concept-document-bc>browsing context/a> that has a a href#parent-browsing-context idinteractions-of-styling-and-scripting:parent-browsing-context>parent browsing context/a>, and the a href#active-document idinteractions-of-styling-and-scripting:active-document>active document/a> of that a href#parent-browsing-context idinteractions-of-styling-and-scripting:parent-browsing-context-2>parent browsing context/a> itself a href#has-a-style-sheet-that-is-blocking-scripts idinteractions-of-styling-and-scripting:has-a-style-sheet-that-is-blocking-scripts>has a style sheet that is blocking scripts/a>./p> p>A code idinteractions-of-styling-and-scripting:document-7>a href#document>Document/a>/code> dfn idhas-no-style-sheet-that-is-blocking-scripts>has no style sheet that is blocking scripts/dfn> if it does not a href#has-a-style-sheet-that-is-blocking-scripts idinteractions-of-styling-and-scripting:has-a-style-sheet-that-is-blocking-scripts-2>have a style sheet that is blocking scripts/a> as defined in the previous paragraph./p> h3 idsections>span classsecno>4.3/span> Sectionsa href#sections classself-link>/a>/h3>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> html5semanticspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>26+/span>/span>span classios_saf yes>span>iOS Safari/span> span>7.0+/span>/span>span classand_uc partial>span>UC Browser for Android (limited)/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>21+/span>/span>span classie partial>span>IE (limited)/span> span>9+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini partial>span>Opera Mini (limited)/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>6.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>4.4+/span>/span>span classopera yes>span>Opera/span> span>15+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#feathtml5semantic>caniuse.com/a>/div> h4 idthe-body-element>span classsecno>4.3.1/span> The dfn>code>body/code>/dfn> elementa href#the-body-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-body-element:concept-element-categories>Categories/a>:dd>a href#sectioning-root idthe-body-element:sectioning-root>Sectioning root/a>.dt>a href#concept-element-contexts idthe-body-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As the second element in an code idthe-body-element:the-html-element>a href#the-html-element>html/a>/code> element.dt>a href#concept-element-content-model idthe-body-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-body-element:flow-content-2>Flow content/a>.dt>a href#concept-element-tag-omission idthe-body-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>A code idthe-body-element:the-body-element>a href#the-body-element>body/a>/code> elements a href#syntax-start-tag idthe-body-element:syntax-start-tag>start tag/a> can be omitted if the element is empty, or if the first thing inside the code idthe-body-element:the-body-element-2>a href#the-body-element>body/a>/code> element is not a idthe-body-element:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> or a a href#syntax-comments idthe-body-element:syntax-comments>comment/a>, except if the first thing inside the code idthe-body-element:the-body-element-3>a href#the-body-element>body/a>/code> element is a code idthe-body-element:the-meta-element>a href#the-meta-element>meta/a>/code>, code idthe-body-element:the-link-element>a href#the-link-element>link/a>/code>, code idthe-body-element:the-script-element>a href#the-script-element>script/a>/code>, code idthe-body-element:the-style-element>a href#the-style-element>style/a>/code>, or code idthe-body-element:the-template-element>a href#the-template-element>template/a>/code> element. dd>A code idthe-body-element:the-body-element-4>a href#the-body-element>body/a>/code> elements a href#syntax-end-tag idthe-body-element:syntax-end-tag>end tag/a> can be omitted if the code idthe-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 idthe-body-element:syntax-comments-2>comment/a>.dt>a href#concept-element-attributes idthe-body-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-body-element:global-attributes>Global attributes/a>dd>code idthe-body-element:handler-window-onafterprint>a href#handler-window-onafterprint>onafterprint/a>/code>dd>code idthe-body-element:handler-window-onbeforeprint>a href#handler-window-onbeforeprint>onbeforeprint/a>/code>dd>code idthe-body-element:handler-window-onbeforeunload>a href#handler-window-onbeforeunload>onbeforeunload/a>/code>dd>code idthe-body-element:handler-window-onhashchange>a href#handler-window-onhashchange>onhashchange/a>/code>dd>code idthe-body-element:handler-window-onlanguagechange>a href#handler-window-onlanguagechange>onlanguagechange/a>/code>dd>code idthe-body-element:handler-window-onmessage>a href#handler-window-onmessage>onmessage/a>/code>dd>code idthe-body-element:handler-window-onmessageerror>a href#handler-window-onmessageerror>onmessageerror/a>/code>dd>code idthe-body-element:handler-window-onoffline>a href#handler-window-onoffline>onoffline/a>/code>dd>code idthe-body-element:handler-window-ononline>a href#handler-window-ononline>ononline/a>/code>dd>code idthe-body-element:handler-window-onpagehide>a href#handler-window-onpagehide>onpagehide/a>/code>dd>code idthe-body-element:handler-window-onpageshow>a href#handler-window-onpageshow>onpageshow/a>/code>dd>code idthe-body-element:handler-window-onpopstate>a href#handler-window-onpopstate>onpopstate/a>/code>dd>code idthe-body-element:handler-window-onrejectionhandled>a href#handler-window-onrejectionhandled>onrejectionhandled/a>/code>dd>code idthe-body-element:handler-window-onstorage>a href#handler-window-onstorage>onstorage/a>/code>dd>code idthe-body-element:handler-window-onunhandledrejection>a href#handler-window-onunhandledrejection>onunhandledrejection/a>/code>dd>code idthe-body-element:handler-window-onunload>a href#handler-window-onunload>onunload/a>/code>dt>a href#concept-element-dom idthe-body-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-body-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlbodyelement>HTMLBodyElement/dfn> : a href#htmlelement idthe-body-element:htmlelement>HTMLElement/a> { // a href#HTMLBodyElement-partial>also has obsolete members/a>};a href#htmlbodyelement idthe-body-element:htmlbodyelement>HTMLBodyElement/a> implements a href#windoweventhandlers idthe-body-element:windoweventhandlers>WindowEventHandlers/a>;/pre>/dl> p>The code idthe-body-element:the-body-element-6>a href#the-body-element>body/a>/code> element a href#represents idthe-body-element:represents>represents/a> the main content of the document./p> p>In conforming documents, there is only one code idthe-body-element:the-body-element-7>a href#the-body-element>body/a>/code> element. The code idthe-body-element:dom-document-body>a href#dom-document-body>document.body/a>/code> IDL attribute provides scripts with easy access to a documents code idthe-body-element:the-body-element-8>a href#the-body-element>body/a>/code> element./p> p classnote>Some DOM operations (for example, parts of the a href#dnd idthe-body-element:dnd>drag and drop/a> model) are defined in terms of a href#the-body-element-2 idthe-body-element:the-body-element-2-2>the body element/a>. This refers to a particular element in the DOM, as per the definition of the term, and not any arbitrary code idthe-body-element:the-body-element-9>a href#the-body-element>body/a>/code> element./p> p>The code idthe-body-element:the-body-element-10>a href#the-body-element>body/a>/code> element exposes as a href#event-handler-content-attributes idthe-body-element:event-handler-content-attributes>event handler content attributes/a> a number of the a href#event-handlers idthe-body-element:event-handlers>event handlers/a> of the code idthe-body-element:window>a href#window>Window/a>/code> object. It also mirrors their a href#event-handler-idl-attributes idthe-body-element:event-handler-idl-attributes>event handler IDL attributes/a>./p> p>The code idthe-body-element:handler-onblur>a href#handler-onblur>onblur/a>/code>, code idthe-body-element:handler-onerror>a href#handler-onerror>onerror/a>/code>, code idthe-body-element:handler-onfocus>a href#handler-onfocus>onfocus/a>/code>, code idthe-body-element:handler-onload>a href#handler-onload>onload/a>/code>, code idthe-body-element:handler-onresize>a href#handler-onresize>onresize/a>/code>, and code idthe-body-element:handler-onscroll>a href#handler-onscroll>onscroll/a>/code> a href#event-handlers idthe-body-element:event-handlers-2>event handlers/a> of the code idthe-body-element:window-2>a href#window>Window/a>/code> object, exposed on the code idthe-body-element:the-body-element-11>a href#the-body-element>body/a>/code> element, replace the generic a href#event-handlers idthe-body-element:event-handlers-3>event handlers/a> with the same names normally supported by a href#html-elements idthe-body-element:html-elements>HTML elements/a>./p> p classexample>Thus, for example, a bubbling code idthe-body-element:event-error>a href#event-error>error/a>/code> event dispatched on a child of a href#the-body-element-2 idthe-body-element:the-body-element-2-3>the body element/a> of a code idthe-body-element:document>a href#document>Document/a>/code> would first trigger the code idthe-body-element:handler-onerror-2>a href#handler-onerror>onerror/a>/code> a href#event-handler-content-attributes idthe-body-element:event-handler-content-attributes-2>event handler content attributes/a> of that element, then that of the root code idthe-body-element:the-html-element-2>a href#the-html-element>html/a>/code> element, and only em>then/em> would it trigger the code idthe-body-element:handler-onerror-3>a href#handler-onerror>onerror/a>/code> a href#event-handler-content-attributes idthe-body-element:event-handler-content-attributes-3>event handler content attribute/a> on the code idthe-body-element:the-body-element-12>a href#the-body-element>body/a>/code> element. This is because the event would bubble from the target, to the code idthe-body-element:the-body-element-13>a href#the-body-element>body/a>/code>, to the code idthe-body-element:the-html-element-3>a href#the-html-element>html/a>/code>, to the code idthe-body-element:document-2>a href#document>Document/a>/code>, to the code idthe-body-element:window-3>a href#window>Window/a>/code>, and the a href#event-handlers idthe-body-element:event-handlers-4>event handler/a> on the code idthe-body-element:the-body-element-14>a href#the-body-element>body/a>/code> is watching the code idthe-body-element:window-4>a href#window>Window/a>/code> not the code idthe-body-element:the-body-element-15>a href#the-body-element>body/a>/code>. A regular event listener attached to the code idthe-body-element:the-body-element-16>a href#the-body-element>body/a>/code> using code>addEventListener()/code>, however, would be run when the event bubbled through the code idthe-body-element:the-body-element-17>a href#the-body-element>body/a>/code> and not when it reaches the code idthe-body-element:window-5>a href#window>Window/a>/code> object./p> div classexample> p>This page updates an indicator to show whether or not the user is online:/p> pre><!DOCTYPE HTML><html langen> <head> <title>Online or offline?</title> <script> function update(online) { document.getElementById(status).textContent online ? Online : Offline; } </script> </head> <body ononlineupdate(true) onofflineupdate(false) onloadupdate(navigator.onLine)> <p>You are: <span idstatus>(Unknown)</span></p> </body></html>/pre> /div> h4 idthe-article-element>span classsecno>4.3.2/span> The dfn>code>article/code>/dfn> elementa href#the-article-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-article-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-article-element:flow-content-2>Flow content/a>.dd>a href#sectioning-content-2 idthe-article-element:sectioning-content-2>Sectioning content/a>.dd>a href#palpable-content-2 idthe-article-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-article-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-article-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-article-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-article-element:flow-content-2-3>Flow content/a>.dt>a href#concept-element-tag-omission idthe-article-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-article-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-article-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-article-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-article-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-article-element:the-article-element>a href#the-article-element>article/a>/code> element a href#represents idthe-article-element:represents>represents/a> a complete, or self-contained, composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content./p> p>When code idthe-article-element:the-article-element-2>a href#the-article-element>article/a>/code> elements are nested, the inner code idthe-article-element:the-article-element-3>a href#the-article-element>article/a>/code> elements represent articles that are in principle related to the contents of the outer article. For instance, a blog entry on a site that accepts user-submitted comments could represent the comments as code idthe-article-element:the-article-element-4>a href#the-article-element>article/a>/code> elements nested within the code idthe-article-element:the-article-element-5>a href#the-article-element>article/a>/code> element for the blog entry./p> p>Author information associated with an code idthe-article-element:the-article-element-6>a href#the-article-element>article/a>/code> element (q.v. the code idthe-article-element:the-address-element>a href#the-address-element>address/a>/code> element) does not apply to nested code idthe-article-element:the-article-element-7>a href#the-article-element>article/a>/code> elements./p> p classnote>When used specifically with content to be redistributed in syndication, the code idthe-article-element:the-article-element-8>a href#the-article-element>article/a>/code> element is similar in purpose to the code>entry/code> element in Atom. a href#refsATOM>ATOM/a> p classnote>The schema.org microdata vocabulary can be used to provide the publication date for an code idthe-article-element:the-article-element-9>a href#the-article-element>article/a>/code> element, using one of the CreativeWork subtypes./p> p>When the main content of the page (i.e. excluding footers, headers, navigation blocks, and sidebars) is all one single self-contained composition, that content may be marked with an code idthe-article-element:the-article-element-10>a href#the-article-element>article/a>/code>, but it is technically redundant in that case (since its self-evident that the page is a single composition, as it is a single document)./p> div idarticle-example classexample> p>This example shows a blog post using the code idthe-article-element:the-article-element-11>a href#the-article-element>article/a>/code> element, with some schema.org annotations:/p> pre><article itemscope itemtypehttp://schema.org/BlogPosting> <header> <h1 itempropheadline>The Very First Rule of Life</h1> <p><time itempropdatePublished datetime2009-10-09>3 days ago</time></p> <link itempropurl href?comments0> </header> <p>If theres a microphone anywhere near you, assume its hot and sending whatever youre saying to the world. Seriously.</p> <p>em>.../em></p> <footer> <a itempropdiscussionUrl href?comments1>Show comments...</a> </footer></article>/pre> p>Here is that same blog post, but showing some of the comments:/p> pre><article itemscope itemtypehttp://schema.org/BlogPosting> <header> <h1 itempropheadline>The Very First Rule of Life</h1> <p><time itempropdatePublished datetime2009-10-09>3 days ago</time></p> <link itempropurl href?comments0> </header> <p>If theres a microphone anywhere near you, assume its hot and sending whatever youre saying to the world. Seriously.</p> <p>em>.../em></p> <section> <h1>Comments</h1> <article itempropcomment itemscope itemtypehttp://schema.org/UserComments idc1> <link itempropurl href#c1> <footer> <p>Posted by: <span itempropcreator itemscope itemtypehttp://schema.org/Person> <span itempropname>George Washington</span> </span></p> <p><time itempropcommentTime datetime2009-10-10>15 minutes ago</time></p> </footer> <p>Yeah! Especially when talking about your lobbyist friends!</p> </article> <article itempropcomment itemscope itemtypehttp://schema.org/UserComments idc2> <link itempropurl href#c2> <footer> <p>Posted by: <span itempropcreator itemscope itemtypehttp://schema.org/Person> <span itempropname>George Hammond</span> </span></p> <p><time itempropcommentTime datetime2009-10-10>5 minutes ago</time></p> </footer> <p>Hey, you have the same first name as me.</p> </article> </section></article>/pre> p>Notice the use of code idthe-article-element:the-footer-element>a href#the-footer-element>footer/a>/code> to give the information for each comment (such as who wrote it and when): the code idthe-article-element:the-footer-element-2>a href#the-footer-element>footer/a>/code> element em>can/em> appear at the start of its section when appropriate, such as in this case. (Using code idthe-article-element:the-header-element>a href#the-header-element>header/a>/code> in this case wouldnt be wrong either; its mostly a matter of authoring preference.)/p> /div> div classexample> p>In this example, code idthe-article-element:the-article-element-12>a href#the-article-element>article/a>/code> elements are used to host widgets on a portal page. The widgets are implemented as a href#customized-built-in-element idthe-article-element:customized-built-in-element>customized built-in elements/a> in order to get specific styling and scripted behavior./p> pre><!DOCTYPE HTML><html langen><title>eHome Portal</title><script src/scripts/widgets.js><link relstylesheet href/styles/main.css><article isstock-widget> <h1>Stocks</h1> <table> <thead> <tr> <th> Stock <th> Value <th> Delta <tbody> <template> <tr> <td> <td> <td> </template> </table> <p> <input typebutton valueRefresh onclickthis.parentElement.refresh()></article><article isnews-widget> <h1>News</h1> <ul> <template> <li> <p><img> <strong></strong> <p> </template> </ul> <p> <input typebutton valueRefresh onclickthis.parentElement.refresh()></article>/pre> /div> h4 idthe-section-element>span classsecno>4.3.3/span> The dfn>code>section/code>/dfn> elementa href#the-section-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-section-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-section-element:flow-content-2>Flow content/a>.dd>a href#sectioning-content-2 idthe-section-element:sectioning-content-2>Sectioning content/a>.dd>a href#palpable-content-2 idthe-section-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-section-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-section-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-section-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-section-element:flow-content-2-3>Flow content/a>.dt>a href#concept-element-tag-omission idthe-section-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-section-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-section-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-section-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-section-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-section-element:the-section-element>a href#the-section-element>section/a>/code> element a href#represents idthe-section-element:represents>represents/a> a generic section of a document or application. A section, in this context, is a thematic grouping of content, typically with a heading./p> p classexample>Examples of sections would be chapters, the various tabbed pages in a tabbed dialog box, or the numbered sections of a thesis. A Web sites home page could be split into sections for an introduction, news items, and contact information./p> p classnote>Authors are encouraged to use the code idthe-section-element:the-article-element>a href#the-article-element>article/a>/code> element instead of the code idthe-section-element:the-section-element-2>a href#the-section-element>section/a>/code> element when it would make sense to syndicate the contents of the element./p> p iduse-div-for-wrappers classnote>The code idthe-section-element:the-section-element-3>a href#the-section-element>section/a>/code> element is not a generic container element. When an element is needed only for styling purposes or as a convenience for scripting, authors are encouraged to use the code idthe-section-element:the-div-element>a href#the-div-element>div/a>/code> element instead. A general rule is that the code idthe-section-element:the-section-element-4>a href#the-section-element>section/a>/code> element is appropriate only if the elements contents would be listed explicitly in the documents a href#outline idthe-section-element:outline>outline/a>./p> div classexample> p>In the following example, we see an article (part of a larger Web page) about apples, containing two short sections./p> pre><article> <hgroup> <h1>Apples</h1> <h2>Tasty, delicious fruit!</h2> </hgroup> <p>The apple is the pomaceous fruit of the apple tree.</p> <section> <h1>Red Delicious</h1> <p>These bright red apples are the most common found in many supermarkets.</p> </section> <section> <h1>Granny Smith</h1> <p>These juicy, green apples make a great filling for apple pies.</p> </section></article>/pre> p>Notice how the use of code idthe-section-element:the-section-element-5>a href#the-section-element>section/a>/code> means that the author can use code idthe-section-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code> elements throughout, without having to worry about whether a particular section is at the top level, the second level, the third level, and so on./p> /div> div classexample> p>Here is a graduation programme with two sections, one for the list of people graduating, and one for the description of the ceremony. (The markup in this example features an uncommon style sometimes used to minimize the amount of a href#inter-element-whitespace idthe-section-element:inter-element-whitespace>inter-element whitespace/a>.)/p> pre><!DOCTYPE Html><Html LangEn ><Head ><Title >Graduation Ceremony Summer 2022</Title ></Head ><Body ><H1 >Graduation</H1 ><Section ><H1 >Ceremony</H1 ><P >Opening Procession</P ><P >Speech by Validactorian</P ><P >Speech by Class President</P ><P >Presentation of Diplomas</P ><P >Closing Speech by Headmaster</P ></Section ><Section ><H1 >Graduates</H1 ><Ul ><Li >Molly Carpenter</Li ><Li >Anastasia Luccio</Li ><Li >Ebenezar McCoy</Li ><Li >Karrin Murphy</Li ><Li >Thomas Raith</Li ><Li >Susan Rodriguez</Li ></Ul ></Section ></Body></Html>/pre> /div> div classexample> p>In this example, a book author has marked up some sections as chapters and some as appendices, and uses CSS to style the headers in these two classes of section differently./p> pre><style> section { border: double medium; margin: 2em; } section.chapter h1 { font: 2em Roboto, Helvetica Neue, sans-serif; } section.appendix h1 { font: small-caps 2em Roboto, Helvetica Neue, sans-serif; }</style><header> <hgroup> <h1>My Book</h1> <h2>A sample with not much content</h2> </hgroup> <p><small>Published by Dummy Publicorp Ltd.</small></p></header><section classchapter> <h1>My First Chapter</h1> <p>This is the first of my chapters. It doesnt say much.</p> <p>But it has two paragraphs!</p></section><section classchapter> <h1>It Continues: The Second Chapter</h1> <p>Bla dee bla, dee bla dee bla. Boom.</p></section><section classchapter> <h1>Chapter Three: A Further Example</h1> <p>Its not like a battle between brightness and earthtones would go unnoticed.</p> <p>But it might ruin my story.</p></section><section classappendix> <h1>Appendix A: Overview of Examples</h1> <p>These are demonstrations.</p></section><section classappendix> <h1>Appendix B: Some Closing Remarks</h1> <p>Hopefully this long example shows that you <em>can</em> style sections, so long as they are used to indicate actual sections.</p></section>/pre> /div> h4 idthe-nav-element>span classsecno>4.3.4/span> The dfn>code>nav/code>/dfn> elementa href#the-nav-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-nav-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-nav-element:flow-content-2>Flow content/a>.dd>a href#sectioning-content-2 idthe-nav-element:sectioning-content-2>Sectioning content/a>.dd>a href#palpable-content-2 idthe-nav-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-nav-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-nav-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-nav-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-nav-element:flow-content-2-3>Flow content/a>, but with no code idthe-nav-element:the-main-element>a href#the-main-element>main/a>/code> element descendants.dt>a href#concept-element-tag-omission idthe-nav-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-nav-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-nav-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-nav-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-nav-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-nav-element:the-nav-element>a href#the-nav-element>nav/a>/code> element a href#represents idthe-nav-element:represents>represents/a> a section of a page that links to other pages or to parts within the page: a section with navigation links./p> p classnote>Not all groups of links on a page need to be in a code idthe-nav-element:the-nav-element-2>a href#the-nav-element>nav/a>/code> element — the element is primarily intended for sections that consist of major navigation blocks. In particular, it is common for footers to have a short list of links to various pages of a site, such as the terms of service, the home page, and a copyright page. The code idthe-nav-element:the-footer-element>a href#the-footer-element>footer/a>/code> element alone is sufficient for such cases; while a code idthe-nav-element:the-nav-element-3>a href#the-nav-element>nav/a>/code> element can be used in such cases, it is usually unnecessary./p> p classnote>User agents (such as screen readers) that are targeted at users who can benefit from navigation information being omitted in the initial rendering, or who can benefit from navigation information being immediately available, can use this element as a way to determine what content on the page to initially skip or provide on request (or both)./p> div classexample> p>In the following example, there are two code idthe-nav-element:the-nav-element-4>a href#the-nav-element>nav/a>/code> elements, one for primary navigation around the site, and one for secondary navigation around the page itself./p> pre><body> <h1>The Wiki Center Of Exampland</h1> <nav> <ul> <li><a href/>Home</a></li> <li><a href/events>Current Events</a></li> em>...more.../em> </ul> </nav> <article> <header> <h1>Demos in Exampland</h1> <p>Written by A. N. Other.</p> </header> <nav> <ul> <li><a href#public>Public demonstrations</a></li> <li><a href#destroy>Demolitions</a></li> em>...more.../em> </ul> </nav> <div> <section idpublic> <h1>Public demonstrations</h1> <p>em>...more.../em></p> </section> <section iddestroy> <h1>Demolitions</h1> <p>em>...more.../em></p> </section> em>...more.../em> </div> <footer> <p><a href?edit>Edit</a> | <a href?delete>Delete</a> | <a href?Rename>Rename</a></p> </footer> </article> <footer> <p><small>© copyright 1998 Exampland Emperor</small></p> </footer></body>/pre> /div> div classexample> p>In the following example, the page has several places where links are present, but only one of those places is considered a navigation section./p> pre><body itemscope itemtypehttp://schema.org/Blog> <header> <h1>Wake up sheeple!</h1> <p><a hrefnews.html>News</a> - <a hrefblog.html>Blog</a> - <a hrefforums.html>Forums</a></p> <p>Last Modified: <span itempropdateModified>2009-04-01</span></p> <nav> <h1>Navigation</h1> <ul> <li><a hrefarticles.html>Index of all articles</a></li> <li><a hreftoday.html>Things sheeple need to wake up for today</a></li> <li><a hrefsuccesses.html>Sheeple we have managed to wake</a></li> </ul> </nav> </header> <main> <article itempropblogPosts itemscope itemtypehttp://schema.org/BlogPosting> <header> <h1 itempropheadline>My Day at the Beach</h1> </header> <main itemproparticleBody> <p>Today I went to the beach and had a lot of fun.</p> em>...more content.../em> </main> <footer> <p>Posted <time itempropdatePublished datetime2009-10-10>Thursday</time>.</p> </footer> </article> em>...more blog posts.../em> </main> <footer> <p>Copyright © <span itempropcopyrightYear>2010</span> <span itempropcopyrightHolder>The Example Company</span> </p> <p><a hrefabout.html>About</a> - <a hrefpolicy.html>Privacy Policy</a> - <a hrefcontact.html>Contact Us</a></p> </footer></body>/pre> p>Notice the code idthe-nav-element:the-main-element-2>a href#the-main-element>main/a>/code> elements being used to wrap all the contents of the page other than the header and footer, and all the contents of the blog entry other than its header and footer./p> p>You can also see microdata annotations in the above example that use the schema.org vocabulary to provide the publication date and other metadata about the blog post./p> /div> div classexample> p>A code idthe-nav-element:the-nav-element-5>a href#the-nav-element>nav/a>/code> element doesnt have to contain a list, it can contain other kinds of content as well. In this navigation block, links are provided in prose:/p> pre><nav> <h1>Navigation</h1> <p>You are on my home page. To the north lies <a href/blog>my blog</a>, from whence the sounds of battle can be heard. To the east you can see a large mountain, upon which many <a href/school>school papers</a> are littered. Far up thus mountain you can spy a little figure who appears to be me, desperately scribbling a <a href/school/thesis>thesis</a>.</p> <p>To the west are several exits. One fun-looking exit is labeled <a hrefhttps://games.example.com/>games</a>. Another more boring-looking exit is labeled <a hrefhttps://isp.example.net/>ISP™</a>.</p> <p>To the south lies a dark and dank <a href/about>contacts page</a>. Cobwebs cover its disused entrance, and at one point you see a rat run quickly out of the page.</p></nav>/pre> /div> div classexample> p>In this example, code idthe-nav-element:the-nav-element-6>a href#the-nav-element>nav/a>/code> is used in an e-mail application, to let the user switch folders:/p> pre><p><input typebutton valueCompose onclickcompose()></p><nav> <h1>Folders</h1> <ul> <li> <a href/inbox onclickreturn openFolder(this.href)>Inbox</a> <span classcount></span> <li> <a href/sent onclickreturn openFolder(this.href)>Sent</a> <li> <a href/drafts onclickreturn openFolder(this.href)>Drafts</a> <li> <a href/trash onclickreturn openFolder(this.href)>Trash</a> <li> <a href/customers onclickreturn openFolder(this.href)>Customers</a> </ul></nav>/pre> /div> h4 idthe-aside-element>span classsecno>4.3.5/span> The dfn>code>aside/code>/dfn> elementa href#the-aside-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-aside-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-aside-element:flow-content-2>Flow content/a>.dd>a href#sectioning-content-2 idthe-aside-element:sectioning-content-2>Sectioning content/a>.dd>a href#palpable-content-2 idthe-aside-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-aside-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-aside-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-aside-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-aside-element:flow-content-2-3>Flow content/a>, but with no code idthe-aside-element:the-main-element>a href#the-main-element>main/a>/code> element descendants.dt>a href#concept-element-tag-omission idthe-aside-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-aside-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-aside-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-aside-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-aside-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-aside-element:the-aside-element>a href#the-aside-element>aside/a>/code> element a href#represents idthe-aside-element:represents>represents/a> a section of a page that consists of content that is tangentially related to the content around the code idthe-aside-element:the-aside-element-2>a href#the-aside-element>aside/a>/code> element, and which could be considered separate from that content. Such sections are often represented as sidebars in printed typography./p> p>The element can be used for typographical effects like pull quotes or sidebars, for advertising, for groups of code idthe-aside-element:the-nav-element>a href#the-nav-element>nav/a>/code> elements, and for other content that is considered separate from the main content of the page./p> p classnote>Its not appropriate to use the code idthe-aside-element:the-aside-element-3>a href#the-aside-element>aside/a>/code> element just for parentheticals, since those are part of the main flow of the document./p> div classexample> p>The following example shows how an aside is used to mark up background material on Switzerland in a much longer news story on Europe./p> pre><aside> <h1>Switzerland</h1> <p>Switzerland, a land-locked country in the middle of geographic Europe, has not joined the geopolitical European Union, though it is a signatory to a number of European treaties.</p></aside>/pre> /div> div classexample> p>The following example shows how an aside is used to mark up a pull quote in a longer article./p> pre>...<p>He later joined a large company, continuing on the same work.<q>I love my job. People ask me what I do for fun when Im not atwork. But Im paid to do my hobby, so I never know what toanswer. Some people wonder what they would do if they didnt have towork... but I know what I would do, because I was unemployed for ayear, and I filled that time doing exactly what I do now.</q></p><aside> <q> People ask me what I do for fun when Im not at work. But Im paid to do my hobby, so I never know what to answer. </q></aside><p>Of course his work — or should that be hobby? —isnt his only passion. He also enjoys other pleasures.</p>.../pre> /div> div classexample> p>The following extract shows how code idthe-aside-element:the-aside-element-4>a href#the-aside-element>aside/a>/code> can be used for blogrolls and other side content on a blog:/p> pre><body> <header> <h1>My wonderful blog</h1> <p>My tagline</p> </header> <aside> <!-- em>this aside contains two sections that are tangentially related to the page, namely, links to other blogs, and links to blog posts from this blog/em> --> <nav> <h1>My blogroll</h1> <ul> <li><a hrefhttps://blog.example.com/>Example Blog</a> </ul> </nav> <nav> <h1>Archives</h1> <ol reversed> <li><a href/last-post>My last post</a> <li><a href/first-post>My first post</a> </ol> </nav> </aside> <aside> <!-- em>this aside is tangentially related to the page also, it contains twitter messages from the blog author/em> --> <h1>Twitter Feed</h1> <blockquote citehttps://twitter.example.net/t31351234> Im on vacation, writing my blog. </blockquote> <blockquote citehttps://twitter.example.net/t31219752> Im going to go on vacation soon. </blockquote> </aside> <article> <!-- em>this is a blog post/em> --> <h1>My last post</h1> <p>This is my last post.</p> <footer> <p><a href/last-post relbookmark>Permalink</a> </footer> </article> <article> <!-- em>this is also a blog post/em> --> <h1>My first post</h1> <p>This is my first post.</p> <aside> <!-- em>this aside is about the blog post, since its inside the <article> element; it would be wrong, for instance, to put the blogroll here, since the blogroll isnt really related to this post specifically, only to the page as a whole/em> --> <h1>Posting</h1> <p>While Im thinking about it, I wanted to say something about posting. Posting is fun!</p> </aside> <footer> <p><a href/first-post relbookmark>Permalink</a> </footer> </article> <footer> <nav> <a href/archives>Archives</a> — <a href/about>About me</a> — <a href/copyright>Copyright</a> </nav> </footer></body>/pre> /div> h4 idthe-h1,-h2,-h3,-h4,-h5,-and-h6-elements>span classsecno>4.3.6/span> The dfn idthe-h1-element>code>h1/code>/dfn>, dfn idthe-h2-element>code>h2/code>/dfn>, dfn idthe-h3-element>code>h3/code>/dfn>, dfn idthe-h4-element>code>h4/code>/dfn>, dfn idthe-h5-element>code>h5/code>/dfn>, and dfn idthe-h6-element>code>h6/code>/dfn> elementsa href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-h1,-h2,-h3,-h4,-h5,-and-h6-elements:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-h1,-h2,-h3,-h4,-h5,-and-h6-elements:flow-content-2>Flow content/a>.dd>a href#heading-content-2 idthe-h1,-h2,-h3,-h4,-h5,-and-h6-elements:heading-content-2>Heading content/a>.dd>a href#palpable-content-2 idthe-h1,-h2,-h3,-h4,-h5,-and-h6-elements:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-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 idthe-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 idthe-h1,-h2,-h3,-h4,-h5,-and-h6-elements:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-h1,-h2,-h3,-h4,-h5,-and-h6-elements:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-h1,-h2,-h3,-h4,-h5,-and-h6-elements:phrasing-content-2>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-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 idthe-h1,-h2,-h3,-h4,-h5,-and-h6-elements:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-h1,-h2,-h3,-h4,-h5,-and-h6-elements:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-h1,-h2,-h3,-h4,-h5,-and-h6-elements:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-h1,-h2,-h3,-h4,-h5,-and-h6-elements:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlheadingelement>HTMLHeadingElement/dfn> : a href#htmlelement idthe-h1,-h2,-h3,-h4,-h5,-and-h6-elements:htmlelement>HTMLElement/a> { // a href#HTMLHeadingElement-partial>also has obsolete members/a>};/pre> /dl> p>These elements a href#represents idthe-h1,-h2,-h3,-h4,-h5,-and-h6-elements:represents>represent/a> headings for their sections./p> p>The semantics and meaning of these elements are defined in the section on a href#headings-and-sections idthe-h1,-h2,-h3,-h4,-h5,-and-h6-elements:headings-and-sections>headings and sections/a>./p> p>These elements have a dfn idrank>rank/dfn> given by the number in their name. The code idthe-h1,-h2,-h3,-h4,-h5,-and-h6-elements:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code> element is said to have the highest rank, the code idthe-h1,-h2,-h3,-h4,-h5,-and-h6-elements:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6/a>/code> element has the lowest rank, and two elements with the same name have equal rank./p> div classexample> p>As far as their respective document outlines (their heading and section structures) are concerned, these two snippets are semantically equivalent:/p> pre><body><h1>Lets call it a draw(ing surface)</h1><h2>Diving in</h2><h2>Simple shapes</h2><h2>Canvas coordinates</h2><h3>Canvas coordinates diagram</h3><h2>Paths</h2></body>/pre> pre><body> <h1>Lets call it a draw(ing surface)</h1> <section> <h1>Diving in</h1> </section> <section> <h1>Simple shapes</h1> </section> <section> <h1>Canvas coordinates</h1> <section> <h1>Canvas coordinates diagram</h1> </section> </section> <section> <h1>Paths</h1> </section></body>/pre> p>Authors might prefer the former style for its terseness, or the latter style for its convenience in the face of heavy editing; which is best is purely an issue of preferred authoring style./p> p>The two styles can be combined, for compatibility with legacy tools while still future-proofing for when that compatibility is no longer needed. This third snippet again has the same outline as the previous two:/p> pre><body> <h1>Lets call it a draw(ing surface)</h1> <section> <h2>Diving in</h2> </section> <section> <h2>Simple shapes</h2> </section> <section> <h2>Canvas coordinates</h2> <section> <h3>Canvas coordinates diagram</h3> </section> </section> <section> <h2>Paths</h2> </section></body>/pre> /div> h4 idthe-hgroup-element>span classsecno>4.3.7/span> The dfn>code>hgroup/code>/dfn> elementa href#the-hgroup-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-hgroup-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-hgroup-element:flow-content-2>Flow content/a>.dd>a href#heading-content-2 idthe-hgroup-element:heading-content-2>Heading content/a>.dd>a href#palpable-content-2 idthe-hgroup-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-hgroup-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-hgroup-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-hgroup-element:concept-element-content-model>Content model/a>:dd>One or more code idthe-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 idthe-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 idthe-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 idthe-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 idthe-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 idthe-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 idthe-hgroup-element:the-template-element>a href#the-template-element>template/a>/code> elements.dt>a href#concept-element-tag-omission idthe-hgroup-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-hgroup-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-hgroup-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-hgroup-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-hgroup-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-hgroup-element:the-hgroup-element>a href#the-hgroup-element>hgroup/a>/code> element a href#represents idthe-hgroup-element:represents>represents/a> the heading of a section, which consists of all the code idthe-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 idthe-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-8>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6/a>/code> element children of the code idthe-hgroup-element:the-hgroup-element-2>a href#the-hgroup-element>hgroup/a>/code> element. The element is used to group a set of code idthe-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 idthe-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-10>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6/a>/code> elements when the heading has multiple levels, such as subheadings, alternative titles, or taglines./p> p>The a href#rank idthe-hgroup-element:rank>rank/a> of an code idthe-hgroup-element:the-hgroup-element-3>a href#the-hgroup-element>hgroup/a>/code> element is the rank of the highest-ranked code idthe-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 idthe-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 idthe-hgroup-element:the-hgroup-element-4>a href#the-hgroup-element>hgroup/a>/code> element, if there are any such elements, or otherwise the same as for an code idthe-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-13>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code> element (the highest rank). Other code idthe-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-14>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code>–code idthe-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-15>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6/a>/code> elements of a href#heading-content-2 idthe-hgroup-element:heading-content-2-2>heading content/a> in the code idthe-hgroup-element:the-hgroup-element-5>a href#the-hgroup-element>hgroup/a>/code> element indicate subheadings or subtitles or (secondary) alternative titles./p> p>The section on a href#headings-and-sections idthe-hgroup-element:headings-and-sections>headings and sections/a> defines how code idthe-hgroup-element:the-hgroup-element-6>a href#the-hgroup-element>hgroup/a>/code> elements are assigned to individual sections./p> div classexample> p>Here are some examples of valid headings./p> pre><hgroup> <h1>The reality dysfunction</h1> <h2>Space is not the only void</h2></hgroup>/pre> pre><hgroup> <h1>Dr. Strangelove</h1> <h2>Or: How I Learned to Stop Worrying and Love the Bomb</h2></hgroup>/pre> p>The point of using code idthe-hgroup-element:the-hgroup-element-7>a href#the-hgroup-element>hgroup/a>/code> in these examples is to prevent the code idthe-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-16>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2/a>/code> element (which acts as a secondary title) from creating a separate section of its own in any a href#outline idthe-hgroup-element:outline>outline/a> and to instead cause the contents of the code idthe-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-17>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2/a>/code> to be shown in rendered output from the a href#outline idthe-hgroup-element:outline-2>outline/a> algorithm in some way to indicate that it is not the title of a separate section but instead just a secondary title in a group of titles./p> p>How a user agent exposes such multi-level headings in user interfaces (e.g. in tables of contents or search results) is left open to implementors, as it is a user interface issue. The first example above could be rendered as:/p> pre>The reality dysfunction: Space is not the only void/pre> p>Alternatively, it could look like this: pre>The reality dysfunction (Space is not the only void)/pre> p>In interfaces where a title can be rendered on multiple lines, it could be rendered as follows, maybe with the first line in a bigger font size:/p> pre>The reality dysfunctionSpace is not the only void/pre> /div> div classexample> p>The following two examples show ways in which two code idthe-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-18>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code> headings could be used within an code idthe-hgroup-element:the-hgroup-element-8>a href#the-hgroup-element>hgroup/a>/code> element to group the US and UK names for the same movie./p> pre><hgroup> <h1>The Avengers</h1> <h1>Avengers Assemble</h1></hgroup><hgroup> <h1>Avengers Assemble</h1> <h1>The Avengers</h1></hgroup>/pre> p>The first example above shows how the movie names might be grouped in a publication in the US, with the US name i>The Avengers/i> as the (primary) title, and the UK name i>Avengers Assemble/i> as the (secondary) alternative title. The second example above shows how the movie names might be grouped in a publication in the UK, with the UK name as the (primary) title, and the US name as the (secondary) alternative title./p> p>In both cases it is important to note the use of the code idthe-hgroup-element:the-hgroup-element-9>a href#the-hgroup-element>hgroup/a>/code> element to group the two titles indicates that the titles are not equivalent; instead the first code idthe-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-19>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code> gives the (primary) title while the second gives the (secondary) alternative title. Even though both the title and alternative title are marked up with code idthe-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-20>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code> elements, in a rendered view of output from the a href#outline idthe-hgroup-element:outline-3>outline/a> algorithm, the second code idthe-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-21>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code> in the code idthe-hgroup-element:the-hgroup-element-10>a href#the-hgroup-element>hgroup/a>/code> will be shown in some way that clearly indicates it is secondary; for example: p>In a US publication:/p> pre>The Avengers (Avengers Assemble)/pre> p>In a UK publication:/p> pre>Avengers Assemble (The Avengers)/pre> /div> div classexample> p>In the following example, an code idthe-hgroup-element:the-hgroup-element-11>a href#the-hgroup-element>hgroup/a>/code> element is used to mark up a two-level heading in a wizard-style dialog box:/p> pre><dialog onclosewalletSetup.continue(this.returnValue)> <hgroup> <h1>Wallet Setup</h1> <h2>Configure your Wallet funding source</h2> </hgroup> <p>Your Wallet can be used to buy wands at the merchant in town, to buy potions from travelling salesmen you may find in the dungeons, and to pay for mercenaries.</p> <p>We support two payment sources:</p> <form methoddialog> <fieldset oninputthis.getElementsByTagName(input)0.checked true> <legend> <label> <input typeradio namepayment-type valuecc> Credit Card </label> </legend> <p><label>Name on card: <input namecc1 autocompletesection-cc cc-name placeholderY. Name></label> <p><label>Card number: <input namecc2 inputmodenumeric autocompletesection-cc cc-number placeholder6331 1019 9999 0016></label> <p><label>Expiry Date: <input namecc3 typemonth autocompletesection-cc cc-exp placeholder2020-02></label> <p><label>Security Code: <input namecc4 inputmodenumeric autocompletesection-cc cc-csc placeholder246></label> </fieldset> <fieldset oninputthis.getElementsByTagName(input)0.checked true> <legend> <label> <input typeradio namepayment-type valuebank> Checking Account </label> </legend> <p><label>Name on account: <input namebank1 autocompletesection-bank cc-name></label> <p><label>Routing number: <input namebank2 inputmodenumeric></label> <p><label>Account number: <input namebank3 inputmodenumeric></label> </fieldset> <button typesubmit valueback> ← Back </button> <button typesubmit valuenext> Next → </button> </form></dialog>/pre> /div> h4 idthe-header-element>span classsecno>4.3.8/span> The dfn>code>header/code>/dfn> elementa href#the-header-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-header-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-header-element:flow-content-2>Flow content/a>.dd>a href#palpable-content-2 idthe-header-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-header-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-header-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-header-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-header-element:flow-content-2-3>Flow content/a>, but with no code idthe-header-element:the-header-element>a href#the-header-element>header/a>/code>, code idthe-header-element:the-footer-element>a href#the-footer-element>footer/a>/code>, or code idthe-header-element:the-main-element>a href#the-main-element>main/a>/code> element descendants.dt>a href#concept-element-tag-omission idthe-header-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-header-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-header-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-header-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-header-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-header-element:the-header-element-2>a href#the-header-element>header/a>/code> element a href#represents idthe-header-element:represents>represents/a> a group of introductory or navigational aids./p> p classnote>A code idthe-header-element:the-header-element-3>a href#the-header-element>header/a>/code> element is intended to usually contain the sections heading (an code idthe-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 idthe-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 idthe-header-element:the-hgroup-element>a href#the-hgroup-element>hgroup/a>/code> element), but this is not required. The code idthe-header-element:the-header-element-4>a href#the-header-element>header/a>/code> element can also be used to wrap a sections table of contents, a search form, or any relevant logos./p> div classexample> p>Here are some sample headers. This first one is for a game:/p> pre><header> <p>Welcome to...</p> <h1>Voidwars!</h1></header>/pre> p>The following snippet shows how the element can be used to mark up a specifications header:/p> pre><header> <hgroup> <h1>Fullscreen API</h1> <h2>Living Standard — Last Updated 19 October 2015</h2> </hgroup> <dl> <dt>Participate:</dt> <dd><a hrefhttps://github.com/whatwg/fullscreen>GitHub whatwg/fullscreen</a></dd> <dt>Commits:</dt> <dd><a hrefhttps://github.com/whatwg/fullscreen/commits>GitHub whatwg/fullscreen/commits</a></dd> </dl></header>/pre> /div> p classnote>The code idthe-header-element:the-header-element-5>a href#the-header-element>header/a>/code> element is not a href#sectioning-content-2 idthe-header-element:sectioning-content-2>sectioning content/a>; it doesnt introduce a new section./p> div classexample> p>In this example, the page has a page heading given by the code idthe-header-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code> element, and two subsections whose headings are given by code idthe-header-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2/a>/code> elements. The content after the code idthe-header-element:the-header-element-6>a href#the-header-element>header/a>/code> element is still part of the last subsection started in the code idthe-header-element:the-header-element-7>a href#the-header-element>header/a>/code> element, because the code idthe-header-element:the-header-element-8>a href#the-header-element>header/a>/code> element doesnt take part in the a href#outline idthe-header-element:outline>outline/a> algorithm./p> pre><body> <header> <h1>Little Green Guys With Guns</h1> <nav> <ul> <li><a href/games>Games</a> <li><a href/forum>Forum</a> <li><a href/download>Download</a> </ul> </nav> <h2>Important News</h2> <!-- this starts a second subsection --> <!-- this is part of the subsection entitled Important News --> <p>To play todays games you will need to update your client.</p> <h2>Games</h2> <!-- this starts a third subsection --> </header> <p>You have three active games:</p> <!-- this is still part of the subsection entitled Games --> .../pre> /div> h4 idthe-footer-element>span classsecno>4.3.9/span> The dfn>code>footer/code>/dfn> elementa href#the-footer-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id12990 titleNested footer>s might make sense in some cases, but are currently disallowed>12990/a>/div> dl classelement>dt>a href#concept-element-categories idthe-footer-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-footer-element:flow-content-2>Flow content/a>.dd>a href#palpable-content-2 idthe-footer-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-footer-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-footer-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-footer-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-footer-element:flow-content-2-3>Flow content/a>, but with no code idthe-footer-element:the-header-element>a href#the-header-element>header/a>/code>, code idthe-footer-element:the-footer-element>a href#the-footer-element>footer/a>/code>, or code idthe-footer-element:the-main-element>a href#the-main-element>main/a>/code> element descendants.dt>a href#concept-element-tag-omission idthe-footer-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-footer-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-footer-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-footer-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-footer-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-footer-element:the-footer-element-2>a href#the-footer-element>footer/a>/code> element a href#represents idthe-footer-element:represents>represents/a> a footer for its nearest ancestor a href#sectioning-content-2 idthe-footer-element:sectioning-content-2>sectioning content/a> or a href#sectioning-root idthe-footer-element:sectioning-root>sectioning root/a> element. A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like./p> p>When the code idthe-footer-element:the-footer-element-3>a href#the-footer-element>footer/a>/code> element contains entire sections, they a href#represents idthe-footer-element:represents-2>represent/a> appendices, indexes, long colophons, verbose license agreements, and other such content./p> p classnote>Contact information for the author or editor of a section belongs in an code idthe-footer-element:the-address-element>a href#the-address-element>address/a>/code> element, possibly itself inside a code idthe-footer-element:the-footer-element-4>a href#the-footer-element>footer/a>/code>. Bylines and other information that could be suitable for both a code idthe-footer-element:the-header-element-2>a href#the-header-element>header/a>/code> or a code idthe-footer-element:the-footer-element-5>a href#the-footer-element>footer/a>/code> can be placed in either (or neither). The primary purpose of these elements is merely to help the author write self-explanatory markup that is easy to maintain and style; they are not intended to impose specific structures on authors./p> p>Footers dont necessarily have to appear at the em>end/em> of a section, though they usually do./p> p>When the nearest ancestor a href#sectioning-content-2 idthe-footer-element:sectioning-content-2-2>sectioning content/a> or a href#sectioning-root idthe-footer-element:sectioning-root-2>sectioning root/a> element is a href#the-body-element-2 idthe-footer-element:the-body-element-2>the body element/a>, then it applies to the whole page./p> p classnote>The code idthe-footer-element:the-footer-element-6>a href#the-footer-element>footer/a>/code> element is not a href#sectioning-content-2 idthe-footer-element:sectioning-content-2-3>sectioning content/a>; it doesnt introduce a new section./p> div classexample> p>Here is a page with two footers, one at the top and one at the bottom, with the same content:/p> pre><body> <footer><a href../>Back to index...</a></footer> <hgroup> <h1>Lorem ipsum</h1> <h2>The ipsum of all lorems</h2> </hgroup> <p>A dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> <footer><a href../>Back to index...</a></footer></body>/pre> /div> div classexample> p>Here is an example which shows the code idthe-footer-element:the-footer-element-7>a href#the-footer-element>footer/a>/code> element being used both for a site-wide footer and for a section footer./p> pre><!DOCTYPE HTML><HTML LANGen><HEAD><TITLE>The Ramblings of a Scientist</TITLE><BODY><H1>The Ramblings of a Scientist</H1><ARTICLE> <H1>Episode 15</H1> <VIDEO SRC/fm/015.ogv CONTROLS PRELOAD> <P><A HREF/fm/015.ogv>Download video</A>.</P> </VIDEO> <FOOTER> <!-- footer for article --> <P>Published <TIME DATETIME2009-10-21T18:26-07:00>on 2009/10/21 at 6:26pm</TIME></P> </FOOTER></ARTICLE><ARTICLE> <H1>My Favorite Trains</H1> <P>I love my trains. My favorite train of all time is a Köf.</P> <P>It is fun to see them pull some coal cars because they look so dwarfed in comparison.</P> <FOOTER> <!-- footer for article --> <P>Published <TIME DATETIME2009-09-15T14:54-07:00>on 2009/09/15 at 2:54pm</TIME></P> </FOOTER></ARTICLE><FOOTER> <!-- site wide footer --> <NAV> <P><A HREF/credits.html>Credits</A> — <A HREF/tos.html>Terms of Service</A> — <A HREF/index.html>Blog Index</A></P> </NAV> <P>Copyright © 2009 Gordon Freeman</P></FOOTER></BODY></HTML>/pre> /div> div classexample> p>Some site designs have what is sometimes referred to as fat footers — footers that contain a lot of material, including images, links to other articles, links to pages for sending feedback, special offers... in some ways, a whole front page in the footer./p> p>This fragment shows the bottom of a page on a site with a fat footer:/p> pre>... <footer> <nav> <section> <h1>Articles</h1> <p><img srcimages/somersaults.jpeg alt> Go to the gym with our somersaults class! Our teacher Jim takes you through the paces in this two-part article. <a hrefarticles/somersaults/1>Part 1</a> · <a hrefarticles/somersaults/2>Part 2</a></p> <p><img srcimages/kindplus.jpeg> Tired of walking on the edge of a clif<!-- sic -->? Our guest writer Lara shows you how to bumble your way through the bars. <a hrefarticles/kindplus/1>Read more...</a></p> <p><img srcimages/crisps.jpeg> The chips are down, now all thats left is a potato. What can you do with it? <a hrefarticles/crisps/1>Read more...</a></p> </section> <ul> <li> <a href/about>About us...</a> <li> <a href/feedback>Send feedback!</a> <li> <a href/sitemap>Sitemap</a> </ul> </nav> <p><small>Copyright © 2015 The Snacker — <a href/tos>Terms of Service</a></small></p> </footer></body>/pre> /div> h4 idthe-address-element>span classsecno>4.3.10/span> The dfn>code>address/code>/dfn> elementa href#the-address-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-address-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-address-element:flow-content-2>Flow content/a>.dd>a href#palpable-content-2 idthe-address-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-address-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-address-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-address-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-address-element:flow-content-2-3>Flow content/a>, but with no a href#heading-content-2 idthe-address-element:heading-content-2>heading content/a> descendants, no a href#sectioning-content-2 idthe-address-element:sectioning-content-2>sectioning content/a> descendants, and no code idthe-address-element:the-header-element>a href#the-header-element>header/a>/code>, code idthe-address-element:the-footer-element>a href#the-footer-element>footer/a>/code>, or code idthe-address-element:the-address-element>a href#the-address-element>address/a>/code> element descendants.dt>a href#concept-element-tag-omission idthe-address-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-address-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-address-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-address-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-address-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-address-element:the-address-element-2>a href#the-address-element>address/a>/code> element a href#represents idthe-address-element:represents>represents/a> the contact information for its nearest code idthe-address-element:the-article-element>a href#the-article-element>article/a>/code> or code idthe-address-element:the-body-element>a href#the-body-element>body/a>/code> element ancestor. If that is a href#the-body-element-2 idthe-address-element:the-body-element-2>the body element/a>, then the contact information applies to the document as a whole./p> div classexample> p>For example, a page at the W3C Web site related to HTML might include the following contact information:/p> pre><ADDRESS> <A href../People/Raggett/>Dave Raggett</A>, <A href../People/Arnaud/>Arnaud Le Hors</A>, contact persons for the <A hrefActivity>W3C HTML Activity</A></ADDRESS>/pre> /div> p>The code idthe-address-element:the-address-element-3>a href#the-address-element>address/a>/code> element must not be used to represent arbitrary addresses (e.g. postal addresses), unless those addresses are in fact the relevant contact information. (The code idthe-address-element:the-p-element>a href#the-p-element>p/a>/code> element is the appropriate element for marking up postal addresses in general.)/p> p>The code idthe-address-element:the-address-element-4>a href#the-address-element>address/a>/code> element must not contain information other than contact information./p> div classexample> p>For example, the following is non-conforming use of the code idthe-address-element:the-address-element-5>a href#the-address-element>address/a>/code> element:/p> pre classbad><ADDRESS>Last Modified: 1999/12/24 23:37:50</ADDRESS>/pre> /div> p>Typically, the code idthe-address-element:the-address-element-6>a href#the-address-element>address/a>/code> element would be included along with other information in a code idthe-address-element:the-footer-element-2>a href#the-footer-element>footer/a>/code> element./p> p>The contact information for a node var>node/var> is a collection of code idthe-address-element:the-address-element-7>a href#the-address-element>address/a>/code> elements defined by the first applicable entry from the following list:/p> dl classswitch>dt>If var>node/var> is an code idthe-address-element:the-article-element-2>a href#the-article-element>article/a>/code> elementdt>If var>node/var> is a code idthe-address-element:the-body-element-3>a href#the-body-element>body/a>/code> elementdd> p>The contact information consists of all the code idthe-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 idthe-address-element:the-body-element-4>a href#the-body-element>body/a>/code> or code idthe-address-element:the-article-element-3>a href#the-article-element>article/a>/code> element ancestor that is a descendant of var>node/var>./p> dt>If var>node/var> has an ancestor element that is an code idthe-address-element:the-article-element-4>a href#the-article-element>article/a>/code> elementdt>If var>node/var> has an ancestor element that is a code idthe-address-element:the-body-element-5>a href#the-body-element>body/a>/code> elementdd> p>The contact information of var>node/var> is the same as the contact information of the nearest code idthe-address-element:the-article-element-5>a href#the-article-element>article/a>/code> or code idthe-address-element:the-body-element-6>a href#the-body-element>body/a>/code> element ancestor, whichever is nearest./p> dt>If var>node/var>s a idthe-address-element:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> has a href#the-body-element-2 idthe-address-element:the-body-element-2-2>a body element/a>dd> p>The contact information of var>node/var> is the same as the contact information of a href#the-body-element-2 idthe-address-element:the-body-element-2-3>the body element/a> of the code idthe-address-element:document>a href#document>Document/a>/code>./p> dt>Otherwisedd> p>There is no contact information for var>node/var>./p> /dl> p>User agents may expose the contact information of a node to the user, or use it for other purposes, such as indexing sections based on the sections contact information./p> div classexample> p>In this example the footer contains contact information and a copyright notice./p> pre><footer> <address> For more details, contact <a hrefmailto:js@example.com>John Smith</a>. </address> <p><small>© copyright 2038 Example Corp.</small></p></footer>/pre> /div> h4 idheadings-and-sections>span classsecno>4.3.11/span> dfn>Headings and sections/dfn>a href#headings-and-sections classself-link>/a>/h4> p>The code idheadings-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 idheadings-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 idheadings-and-sections:the-hgroup-element>a href#the-hgroup-element>hgroup/a>/code> element are headings./p> p>The first element of a href#heading-content-2 idheadings-and-sections:heading-content-2>heading content/a> in an element of a href#sectioning-content-2 idheadings-and-sections:sectioning-content-2>sectioning content/a> a href#represents idheadings-and-sections:represents>represents/a> the heading for that section. Subsequent headings of equal or higher a href#rank idheadings-and-sections:rank>rank/a> start new (implied) sections, headings of lower a href#rank idheadings-and-sections:rank-2>rank/a> start implied subsections that are part of the previous one. In both cases, the element a href#represents idheadings-and-sections:represents-2>represents/a> the heading of the implied section./p> p>Certain elements are said to be dfn idsectioning-root>sectioning roots/dfn>, including code idheadings-and-sections:the-blockquote-element>a href#the-blockquote-element>blockquote/a>/code> and code idheadings-and-sections:the-td-element>a href#the-td-element>td/a>/code> elements. These elements can have their own outlines, but the sections and headings inside these elements do not contribute to the outlines of their ancestors./p> ul classbrief category-list>li>code idheadings-and-sections:the-blockquote-element-2>a href#the-blockquote-element>blockquote/a>/code>li>code idheadings-and-sections:the-body-element>a href#the-body-element>body/a>/code>li>code idheadings-and-sections:the-details-element>a href#the-details-element>details/a>/code>li>code idheadings-and-sections:the-dialog-element>a href#the-dialog-element>dialog/a>/code>li>code idheadings-and-sections:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code>li>code idheadings-and-sections:the-figure-element>a href#the-figure-element>figure/a>/code>li>code idheadings-and-sections:the-td-element-2>a href#the-td-element>td/a>/code>/ul> p>a href#sectioning-content-2 idheadings-and-sections:sectioning-content-2-2>Sectioning content/a> elements are always considered subsections of their nearest ancestor a href#sectioning-root idheadings-and-sections:sectioning-root>sectioning root/a> or their nearest ancestor element of a href#sectioning-content-2 idheadings-and-sections:sectioning-content-2-3>sectioning content/a>, whichever is nearest, regardless of what implied sections other headings may have created./p> div classexample> p>For the following fragment:/p> pre><body> <h1>Foo</h1> <h2>Bar</h2> <blockquote> <h3>Bla</h3> </blockquote> <p>Baz</p> <h2>Quux</h2> <section> <h3>Thud</h3> </section> <p>Grunt</p></body>/pre> p>...the structure would be:/p> ol>li> Foo (heading of explicit code idheadings-and-sections:the-body-element-2>a href#the-body-element>body/a>/code> section, containing the Grunt paragraph) ol>li> Bar (heading starting implied section, containing a block quote and the Baz paragraph) li> Quux (heading starting implied section with no content other than the heading itself) li> Thud (heading of explicit code idheadings-and-sections:the-section-element>a href#the-section-element>section/a>/code> section) /ol> /ol> p>Notice how the code idheadings-and-sections:the-section-element-2>a href#the-section-element>section/a>/code> ends the earlier implicit section so that a later paragraph (Grunt) is back at the top level./p> /div> p>Sections may contain headings of any a href#rank idheadings-and-sections:rank-3>rank/a>, but authors are strongly encouraged to either use only code idheadings-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 idheadings-and-sections:rank-4>rank/a> for the sections nesting level./p> p>Authors are also encouraged to explicitly wrap sections in elements of a href#sectioning-content-2 idheadings-and-sections:sectioning-content-2-4>sectioning content/a>, instead of relying on the implicit sections generated by having multiple headings in one element of a href#sectioning-content-2 idheadings-and-sections:sectioning-content-2-5>sectioning content/a>./p> div classexample> p>For example, the following is correct:/p> pre><body> <h4>Apples</h4> <p>Apples are fruit.</p> <section> <h2>Taste</h2> <p>They taste lovely.</p> <h6>Sweet</h6> <p>Red apples are sweeter than green ones.</p> <h1>Color</h1> <p>Apples come in various colors.</p> </section></body>/pre> p>However, the same document would be more clearly expressed as:/p> pre><body> <h1>Apples</h1> <p>Apples are fruit.</p> <section> <h2>Taste</h2> <p>They taste lovely.</p> <section> <h3>Sweet</h3> <p>Red apples are sweeter than green ones.</p> </section> </section> <section> <h2>Color</h2> <p>Apples come in various colors.</p> </section></body>/pre> p>Both of the documents above are semantically identical and would produce the same outline in compliant user agents./p> p>This third example is also semantically identical, and might be easier to maintain (e.g. if sections are often moved around in editing):/p> pre><body> <h1>Apples</h1> <p>Apples are fruit.</p> <section> <h1>Taste</h1> <p>They taste lovely.</p> <section> <h1>Sweet</h1> <p>Red apples are sweeter than green ones.</p> </section> </section> <section> <h1>Color</h1> <p>Apples come in various colors.</p> </section></body>/pre> p>This final example would need explicit style rules to be rendered well in legacy browsers. Legacy browsers without CSS support would render all the headings as top-level headings./p> /div> h5 idoutlines>span classsecno>4.3.11.1/span> Creating an outlinea href#outlines classself-link>/a>/h5> p>This section defines an algorithm for creating an outline for a a href#sectioning-content-2 idoutlines:sectioning-content-2>sectioning content/a> element or a a href#sectioning-root idoutlines:sectioning-root>sectioning root/a> element. It is defined in terms of a walk over the nodes of a DOM tree, in a idoutlines:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>, with each node being visited when it is i>entered/i> and when it is i>exited/i> during the walk./p> p>The dfn idoutline>outline/dfn> for a a href#sectioning-content-2 idoutlines:sectioning-content-2-2>sectioning content/a> element or a a href#sectioning-root idoutlines:sectioning-root-2>sectioning root/a> element consists of a list of one or more potentially nested a href#concept-section idoutlines:concept-section>sections/a>. The element for which an a href#outline idoutlines:outline>outline/a> is created is said to be dfn idthe-outlines-owner>the outlines owner/dfn>./p> p>A dfn idconcept-section>section/dfn> is a container that corresponds to some nodes in the original DOM tree. Each section can have one heading associated with it, and can contain any number of further nested sections. The algorithm for the outline also associates each node in the DOM tree with a particular section and potentially a heading. (The sections in the outline arent code idoutlines:the-section-element>a href#the-section-element>section/a>/code> elements, though some may correspond to such elements — they are merely conceptual sections.)/p> div classexample> p>The following markup fragment:/p> pre><body> <hgroup iddocument-title> <h1>HTML</h1> <h2>Living Standard — Last Updated 12 August 2016</h2> </hgroup> <p>Some intro to the document.</p> <h2>Table of contents</h2> <ol idtoc>...</ol> <h2>First section</h2> <p>Some intro to the first section.</p></body>/pre> p>...results in the following outline being created for the code idoutlines:the-body-element>a href#the-body-element>body/a>/code> node (and thus the entire document):/p> ol classbrief>li> p>strong>Section created for code idoutlines:the-body-element-2>a href#the-body-element>body/a>/code> node/strong>./p> p>Associated with heading code><hgroup iddocument-title>...</hgroup>/code> consisting of primary heading code><h1>HTML</h1>/code> and secondary heading code><h2>Living Standard — Last Updated 12 August 2016</h2>/code>./p> p>Also associated with the paragraph code><p>Some intro to the document.</p>/code> (though it likely would not be shown in a rendered view of the outline)./p> p>Nested sections:/p> ol classbrief>li> p>strong>Section implied for first code idoutlines:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2/a>/code> element./strong>/p> p>Associated with heading code><h2>Table of contents</h2>/code>./p> p>Also associated with the ordered list code><ol idtoc>...</ol>/code> (though it likely would not be shown in a rendered view of the outline)./p> p>No nested sections./p> li> p>strong>Section implied for second code idoutlines: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./strong>/p> p>Associated with heading code><h2>First section</h2>/code>./p> p>Also associated with the paragraph code><p>Some intro to the first section.</p>/code> (though it likely would not be shown in a rendered view of the outline)./p> p>No nested sections./p> /ol> /ol> p>The following image shows what a rendered view of the outline might look like./p> p>img src/images/outline.svg width465 altTop-level section with the multi-level heading "HTML: Living Standard — Last Updated 12 August 2016" and two subsections; "Table of contents" and "First section". height120>/p> /div> p>The algorithm that must be followed during a walk of a DOM subtree rooted at a a href#sectioning-content-2 idoutlines:sectioning-content-2-3>sectioning content/a> element or a a href#sectioning-root idoutlines:sectioning-root-3>sectioning root/a> element to determine that elements a href#outline idoutlines:outline-2>outline/a> is as follows:/p> ol>li>p>Let var>current outline target/var> be null. (It holds the element whose a href#outline idoutlines: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 idoutlines:concept-section-2>section/a>, so that elements in the DOM can all be associated with a section.)li>p>Create a stack to hold elements, which is used to handle nesting. Initialize this stack to empty.li> p>Walk over the DOM in a idoutlines:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>, starting with the a href#sectioning-content-2 idoutlines:sectioning-content-2-4>sectioning content/a> element or a href#sectioning-root idoutlines:sectioning-root-4>sectioning root/a> element at the root of the subtree for which an outline is to be created, and trigger the first relevant step below for each element as the walk enters and exits it./p> dl classswitch>dt>When exiting an element, if that element is the element at the top of the stackdd> p classnote>The element being exited is a a href#heading-content-2 idoutlines:heading-content-2>heading content/a> element or an element with a code idoutlines:the-hidden-attribute>a href#the-hidden-attribute>hidden/a>/code> attribute./p> p>Pop that element from the stack./p> dt>If the top of the stack is a a href#heading-content-2 idoutlines:heading-content-2-2>heading content/a> element or an element with a code idoutlines:the-hidden-attribute-2>a href#the-hidden-attribute>hidden/a>/code> attributedd>p>Do nothing.dt>When entering an element with a code idoutlines:the-hidden-attribute-3>a href#the-hidden-attribute>hidden/a>/code> attributedd> p>Push the element being entered onto the stack. (This causes the algorithm to skip that element and any descendants of the element.)/p> dt>When entering a a href#sectioning-content-2 idoutlines:sectioning-content-2-5>sectioning content/a> elementdd> p>Run these steps:/p> ol>li> p>If var>current outline target/var> is not null, then:/p> ol>li>p>If the var>current section/var> has no heading, create an implied heading and let that be the heading for the var>current section/var>.li>p>Push var>current outline target/var> onto the stack./ol> li>p>Let var>current outline target/var> be the element that is being entered.li>p>Let var>current section/var> be a newly created a href#concept-section idoutlines:concept-section-3>section/a> for the var>current outline target/var> element.li>p>Associate var>current outline target/var> with var>current section/var>.li>p>Let there be a new a href#outline idoutlines:outline-4>outline/a> for the new var>current outline target/var>, initialized with just the new var>current section/var> as the only a href#concept-section idoutlines:concept-section-4>section/a> in the outline./ol> dt>When exiting a a href#sectioning-content-2 idoutlines:sectioning-content-2-6>sectioning content/a> element, if the stack is not emptydd> p>Run these steps:/p> ol>li>p>If the var>current section/var> has no heading, create an implied heading and let that be the heading for the var>current section/var>.li>p>Pop the top element from the stack, and let the var>current outline target/var> be that element.li>p>Let var>current section/var> be the last section in the a href#outline idoutlines:outline-5>outline/a> of the var>current outline target/var> element.li>p>Append the a href#outline idoutlines:outline-6>outline/a> of the a href#sectioning-content-2 idoutlines:sectioning-content-2-7>sectioning content/a> element being exited to the var>current section/var>. (This does not change which section is the last section in the a href#outline idoutlines:outline-7>outline/a>.)/ol> dt>When entering a a href#sectioning-root idoutlines:sectioning-root-5>sectioning root/a> elementdd> p>Run these steps:/p> ol>li>p>If var>current outline target/var> is not null, push var>current outline target/var> onto the stack.li>p>Let var>current outline target/var> be the element that is being entered.li>p>Let var>current outline target/var>s i>parent section/i> be var>current section/var>.li>p>Let var>current section/var> be a newly created a href#concept-section idoutlines:concept-section-5>section/a> for the var>current outline target/var> element.li>p>Let there be a new a href#outline idoutlines:outline-8>outline/a> for the new var>current outline target/var>, initialized with just the new var>current section/var> as the only a href#concept-section idoutlines:concept-section-6>section/a> in the outline./ol> dt>When exiting a a href#sectioning-root idoutlines:sectioning-root-6>sectioning root/a> element, if the stack is not emptydd> p>Run these steps:/p> ol>li>p>If the var>current section/var> has no heading, create an implied heading and let that be the heading for the var>current section/var>.li>p>Let var>current section/var> be var>current outline target/var>s i>parent section/i>.li>p>Pop the top element from the stack, and let the var>current outline target/var> be that element./ol> dt>When exiting a a href#sectioning-content-2 idoutlines:sectioning-content-2-8>sectioning content/a> element or a a href#sectioning-root idoutlines:sectioning-root-7>sectioning root/a> element (when the stack is empty)dd> p classnote>The var>current outline target/var> is the element being exited, and it is the a href#sectioning-content-2 idoutlines:sectioning-content-2-9>sectioning content/a> element or a a href#sectioning-root idoutlines:sectioning-root-8>sectioning root/a> element at the root of the subtree for which an outline is being generated./p> p>If the var>current section/var> has no heading, create an implied heading and let that be the heading for the var>current section/var>./p> p>Skip to the next step in the overall set of steps. (The walk is over.)/p> dt>When entering a a href#heading-content-2 idoutlines:heading-content-2-3>heading content/a> elementdd> p>If the var>current section/var> has no heading, let the element being entered be the heading for the var>current section/var>./p> p classnote>If the element being entered is an code idoutlines:the-hgroup-element>a href#the-hgroup-element>hgroup/a>/code> element, that code idoutlines:the-hgroup-element-2>a href#the-hgroup-element>hgroup/a>/code> as a whole is a em>multi-level/em> heading for the var>current section/var>, with the highest-a href#rank idoutlines:rank>ranked/a> code idoutlines: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 idoutlines:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6/a>/code> descendant of the code idoutlines:the-hgroup-element-3>a href#the-hgroup-element>hgroup/a>/code> providing the primary heading for the var>current section/var>, and with other code idoutlines: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 idoutlines:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-6>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6/a>/code> descendants of the code idoutlines:the-hgroup-element-4>a href#the-hgroup-element>hgroup/a>/code> providing secondary headings for the var>current section/var>./p> p>Otherwise, if the element being entered has a a href#rank idoutlines:rank-2>rank/a> equal to or higher than the heading of the last section of the a href#outline idoutlines:outline-9>outline/a> of the var>current outline target/var>, or if the heading of the last section of the a href#outline idoutlines:outline-10>outline/a> of the var>current outline target/var> is an implied heading, then create a new a href#concept-section idoutlines:concept-section-7>section/a> and append it to the a href#outline idoutlines:outline-11>outline/a> of the var>current outline target/var> element, so that this new section is the new last section of that outline. Let var>current section/var> be that new section. Let the element being entered be the new heading for the var>current section/var>./p> p>Otherwise, run these substeps:/p> ol>li>p>Let var>candidate section/var> be var>current section/var>.li>p>i>Heading loop/i>: If the element being entered has a a href#rank idoutlines:rank-3>rank/a> lower than the a href#rank idoutlines:rank-4>rank/a> of the heading of the var>candidate section/var>, then create a new a href#concept-section idoutlines:concept-section-8>section/a>, and append it to var>candidate section/var>. (This does not change which section is the last section in the outline.) Let var>current section/var> be this new section. Let the element being entered be the new heading for the var>current section/var>. Abort these substeps./p> li>p>Let var>new candidate section/var> be the a href#concept-section idoutlines:concept-section-9>section/a> that contains var>candidate section/var> in the a href#outline idoutlines:outline-12>outline/a> of var>current outline target/var>.li>p>Let var>candidate section/var> be var>new candidate section/var>.li>p>Return to the step labeled i>heading loop/i>./ol> p>Push the element being entered onto the stack. (This causes the algorithm to skip any descendants of the element.)/p> p classnote>Recall that code idoutlines:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-7>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code> has the em>highest/em> rank, and code idoutlines:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-8>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6/a>/code> has the lowest rank./p> dt>Otherwisedd>p>Do nothing./dl> p idassociatedSection>In addition, whenever the walk exits a node, after doing the steps above, if the node is not associated with a a href#concept-section idoutlines:concept-section-10>section/a> yet, associate the node with the a href#concept-section idoutlines:concept-section-11>section/a> var>current section/var>./p> li>p>Associate all non-element nodes that are in the subtree for which an outline is being created with the a href#concept-section idoutlines:concept-section-12>section/a> with which their parent element is associated.li>p>Associate all nodes in the subtree with the heading of the a href#concept-section idoutlines:concept-section-13>section/a> with which they are associated, if any./ol> p>The tree of sections created by the algorithm above, or a proper subset thereof, must be used when generating document outlines, for example when generating tables of contents./p> p>The outline created for a href#the-body-element-2 idoutlines:the-body-element-2-2>the body element/a> of a code idoutlines:document>a href#document>Document/a>/code> is the a href#outline idoutlines:outline-13>outline/a> of the entire document./p> p>When creating an interactive table of contents, entries should jump the user to the relevant a href#sectioning-content-2 idoutlines:sectioning-content-2-10>sectioning content/a> element, if the a href#concept-section idoutlines:concept-section-14>section/a> was created for a real element in the original document, or to the relevant a href#heading-content-2 idoutlines:heading-content-2-4>heading content/a> element, if the a href#concept-section idoutlines:concept-section-15>section/a> in the tree was generated for a heading in the above process./p> p classnote>Selecting the first a href#concept-section idoutlines:concept-section-16>section/a> of the document therefore always takes the user to the top of the document, regardless of where the first heading in the code idoutlines:the-body-element-3>a href#the-body-element>body/a>/code> is to be found./p> p>The dfn idoutline-depth>outline depth/dfn> of a a href#heading-content-2 idoutlines:heading-content-2-5>heading content/a> element associated with a a href#concept-section idoutlines:concept-section-17>section/a> var>section/var> is the number of a href#concept-section idoutlines:concept-section-18>sections/a> that are ancestors of var>section/var> in the outermost a href#outline idoutlines:outline-14>outline/a> that var>section/var> finds itself in when the a href#outline idoutlines:outline-15>outlines/a> of its code idoutlines:document-2>a href#document>Document/a>/code>s elements are created, plus 1. The a href#outline-depth idoutlines:outline-depth>outline depth/a> of a a href#heading-content-2 idoutlines:heading-content-2-6>heading content/a> element not associated with a a href#concept-section idoutlines:concept-section-19>section/a> is 1./p> p>User agents should provide default headings for sections that do not have explicit section headings./p> div classexample> p>Consider the following snippet:/p> pre><body> <nav> <p><a href/>Home</a></p> </nav> <p>Hello world.</p> <aside> <p>My cat is cute.</p> </aside></body>/pre> p>Although it contains no headings, this snippet has three sections: a document (the code idoutlines:the-body-element-4>a href#the-body-element>body/a>/code>) with two subsections (a code idoutlines:the-nav-element>a href#the-nav-element>nav/a>/code> and an code idoutlines:the-aside-element>a href#the-aside-element>aside/a>/code>). A user agent could present the outline as follows:/p> ol classbrief>li>Untitled document ol>li>Navigationli>Sidebar/ol> /ol> p>These default headings (Untitled document, Navigation, Sidebar) are not specified by this specification, and might vary with the users language, the pages language, the users preferences, the user agent implementors preferences, etc./p> /div> div classnote> 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 idoutlines:sectioning-content-2-11>sectioning content/a> element or a a href#sectioning-root idoutlines:sectioning-root-9>sectioning root/a> element), and the var>enter/var> and var>exit/var> arguments are callbacks that are called with the nodes as they are entered and exited. a href#refsJAVASCRIPT>JAVASCRIPT/a>/p> pre>function (root, enter, exit) { var node root; start: while (node) { enter(node); if (node.firstChild) { node node.firstChild; continue start; } while (node) { exit(node); if (node root) { node null; } else if (node.nextSibling) { node node.nextSibling; continue start; } else { node node.parentNode; } } }}/pre> /div> h5 idsample-outlines>span classsecno>4.3.11.2/span> Sample outlinesa href#sample-outlines classself-link>/a>/h5> p>i>This section is non-normative./i>/p> div classexample> p>The following document shows a straight-forward application of the a href#outline idsample-outlines:outline>outline/a> algorithm. First, here is the document, which is a book with very short chapters and subsections:/p> pre><!DOCTYPE HTML><html langen><title>The Tax Book (all in one page)</title><h1>The Tax Book</h1><h2>Earning money</h2><p>Earning money is good.</p><h3>Getting a job</h3><p>To earn money you typically need a job.</p><h2>Spending money</h2><p>Spending is what money is mainly used for.</p><h3>Cheap things</h3><p>Buying cheap things often not cost-effective.</p><h3>Expensive things</h3><p>The most expensive thing is often not the most cost-effective either.</p><h2>Investing money</h2><p>You can lend your money to other people.</p><h2>Losing money</h2><p>If you spend money or invest money, sooner or later you will lose money.<h3>Poor judgement</h3><p>Usually if you lose money its because you made a mistake.</p>/pre> p>This book would form the following outline:/p> ol classbrief>li> The Tax Book ol classbrief>li> Earning money ol classbrief>li> Getting a job /ol> li> Spending money ol classbrief>li> Cheap things li> Expensive things /ol> li> Investing money li> Losing money ol classbrief>li> Poor judgement /ol> /ol> /ol> p>Notice that the code idsample-outlines:the-title-element>a href#the-title-element>title/a>/code> element does not participate in the outline./p> /div> div classexample> p>Here is a similar document, but this time using code idsample-outlines:the-section-element>a href#the-section-element>section/a>/code> elements to get the same effect:/p> pre><!DOCTYPE HTML><html langen><title>The Tax Book (all in one page)</title><h1>The Tax Book</h1><section> <h1>Earning money</h1> <p>Earning money is good.</p> <section> <h1>Getting a job</h1> <p>To earn money you typically need a job.</p> </section></section><section> <h1>Spending money</h1> <p>Spending is what money is mainly used for.</p> <section> <h1>Cheap things</h1> <p>Buying cheap things often not cost-effective.</p> </section> <section> <h1>Expensive things</h1> <p>The most expensive thing is often not the most cost-effective either.</p> </section></section><section> <h1>Investing money</h1> <p>You can lend your money to other people.</p></section><section> <h1>Losing money</h1> <p>If you spend money or invest money, sooner or later you will lose money. <section> <h1>Poor judgement</h1> <p>Usually if you lose money its because you made a mistake.</p> </section></section>/pre> p>This book would form the same outline:/p> ol classbrief>li> The Tax Book ol classbrief>li> Earning money ol classbrief>li> Getting a job /ol> li> Spending money ol classbrief>li> Cheap things li> Expensive things /ol> li> Investing money li> Losing money ol classbrief>li> Poor judgement /ol> /ol> /ol> /div> div classexample> p>A document can contain multiple top-level headings:/p> pre><!DOCTYPE HTML><html langen><title>Alphabetic Fruit</title><h1>Apples</h1><p>Pomaceous.</p><h1>Bananas</h1><p>Edible.</p><h1>Carambola</h1><p>Star.</p>/pre> p>This would form the following simple outline consisting of three top-level sections:/p> ol classbrief>li> Apples li> Bananas li> Carambola /ol> p>Effectively, the code idsample-outlines:the-body-element>a href#the-body-element>body/a>/code> element is split into three./p> /div> div classexample> p>Mixing both the code idsample-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 idsample-outlines:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6/a>/code> model and the code idsample-outlines:the-section-element-2>a href#the-section-element>section/a>/code>/code idsample-outlines:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code> model can lead to some unintuitive results./p> p>Consider for example the following, which is just the previous example but with the contents of the (implied) code idsample-outlines:the-body-element-2>a href#the-body-element>body/a>/code> wrapped in a code idsample-outlines:the-section-element-3>a href#the-section-element>section/a>/code>:/p> pre><!DOCTYPE HTML><html langen><title>Alphabetic Fruit</title><section> <h1>Apples</h1> <p>Pomaceous.</p> <h1>Bananas</h1> <p>Edible.</p> <h1>Carambola</h1> <p>Star.</p></section>/pre> p>The resulting outline would be:/p> ol classbrief>li> i>(untitled page)/i> ol classbrief>li> Apples li> Bananas li> Carambola /ol> /ol> p>This result is described as i>unintuitive/i> because it results in three subsections even though theres only one code idsample-outlines:the-section-element-4>a href#the-section-element>section/a>/code> element. Effectively, the code idsample-outlines:the-section-element-5>a href#the-section-element>section/a>/code> is split into three, just like the implied code idsample-outlines:the-body-element-3>a href#the-body-element>body/a>/code> element in the previous example./p> p>(In this example, i>(untitled page)/i> is the implied heading for the code idsample-outlines:the-body-element-4>a href#the-body-element>body/a>/code> element, since it has no explicit heading.)/p> /div> div classexample> p>Headings never rise above other sections. Thus, in the following example, the first code idsample-outlines:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code> does not actually describe the page header; it describes the header for the second half of the page:/p> pre><!DOCTYPE HTML><html langen><title>Feathers on The Site of Encyclopedic Knowledge</title><section> <h1>A plea from our caretakers</h1> <p>Please, we beg of you, send help! Were stuck in the server room!</p></section><h1>Feathers</h1><p>Epidermal growths.</p>/pre> p>The resulting outline would be:/p> ol classbrief>li> i>(untitled page)/i> ol classbrief>li> A plea from our caretakers /ol> li> Feathers /ol> /div> div classexample> p>Thus, when an code idsample-outlines:the-article-element>a href#the-article-element>article/a>/code> element starts with a code idsample-outlines:the-nav-element>a href#the-nav-element>nav/a>/code> block and only later has its heading, the result is that the code idsample-outlines:the-nav-element-2>a href#the-nav-element>nav/a>/code> block is not part of the same section as the rest of the code idsample-outlines:the-article-element-2>a href#the-article-element>article/a>/code> in the outline. For instance, take this document:/p> pre><!DOCTYPE HTML><html langen><title>Were adopting a child! — Rays blog</title><h1>Rays blog</h1><article> <header> <nav> <a href?t-1d>Yesterday</a>; <a href?t-7d>Last week</a>; <a href?t-1m>Last month</a> </nav> <h1>Were adopting a child!</h1> </header> <main> <p>As of today, Janine and I have signed the papers to become the proud parents of baby Diane! Weve been looking forward to this day for weeks.</p> </main></article></html>/pre> p>The resulting outline would be:/p> ol classbrief>li> Rays blog ol classbrief>li> i>Untitled article/i> ol classbrief>li> i>Untitled navigation section/i> /ol> li> Were adopting a child! /ol> /ol> p>Also worthy of note in this example is that the code idsample-outlines:the-header-element>a href#the-header-element>header/a>/code> and code idsample-outlines:the-main-element>a href#the-main-element>main/a>/code> elements have no effect whatsoever on the document outline./p> /div> div classexample> p>The code idsample-outlines:the-hgroup-element>a href#the-hgroup-element>hgroup/a>/code> element can be used for subheadings. For example:/p> pre><!DOCTYPE HTML><html langen><title>Chronotype: CS Student</title><hgroup> <h1> The morning </h1> <h2> 06:00 to 12:00 </h2></hgroup><p>We sleep.</p><hgroup> <h1> The afternoon </h1> <h2> 12:00 to 18:00 </h2></hgroup><p>We study.</p><hgroup> <h2>Additional Commentary</h2> <h3>Because not all this is necessarily true</h3> <h6>Ok its almost certainly not true</h6></hgroup><p>Yeah we probably play, rather than study.</p><hgroup> <h1> The evening </h1> <h2> 18:00 to 00:00 </h2></hgroup><p>We play.</p><hgroup> <h1> The night </h1> <h2> 00:00 to 06:00 </h2></hgroup><p>We play some more.</p></html>/pre> p>The resulting outline would be:/p> ol classbrief>li> The morning small>06:00 to 12:00/small> li> The afternoon small>12:00 to 18:00/small> ol classbrief>li> Additional Commentary small>Because not all this is necessarily true small>Ok its almost certainly not true/small>/small> /ol> li> The evening small>18:00 to 00:00/small> li> The night small>00:00 to 06:00/small> /ol> p>Exactly how this is represented by user agents, as most interface issues, is left as a matter of implementation preference, but the key part is that the code idsample-outlines:the-hgroup-element-2>a href#the-hgroup-element>hgroup/a>/code>s descendant code idsample-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 idsample-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 elements heading. Thus, the following would be equally valid:/p> ol classbrief>li> The morning — 06:00 to 12:00 li> The afternoon — 12:00 to 18:00 ol classbrief>li> Additional Commentary — Because not all this is necessarily true — Ok its almost certainly not true /ol> li> The evening — 18:00 to 00:00 li> The night — 00:00 to 06:00 /ol> p>But so would the following:/p> ol classbrief>li> The morning li> The afternoon ol classbrief>li> Additional Commentary /ol> li> The evening li> The night /ol> p>The following would also be valid, though maybe less practical in most contexts:/p> ol classbrief>li> p>The morning p> 06:00 to 12:00 li> p>The afternoon p> 12:00 to 18:00 ol classbrief>li> p> Additional Commentary p> Because not all this is necessarily true p> Ok its almost certainly not true /ol> li> p>The evening p> 18:00 to 00:00 li> p>The night p> 00:00 to 06:00 /ol> /div> h5 idexposing-outlines-to-users>span classsecno>4.3.11.3/span> Exposing outlines to usersa href#exposing-outlines-to-users classself-link>/a>/h5> p>User agents are encouraged to expose page outlines to users to aid in navigation. This is especially true for non-visual media, e.g. screen readers./p> p>However, to mitigate the difficulties that arise from authors misusing a href#sectioning-content-2 idexposing-outlines-to-users:sectioning-content-2>sectioning content/a>, user agents are also encouraged to offer a mode that navigates the page using a href#heading-content-2 idexposing-outlines-to-users:heading-content-2>heading content/a> alone./p> div classexample> p>For instance, a user agent could map the arrow keys as follows:/p> dl>dt>kbd>kbd>Shift/kbd>+kbd>← Left/kbd>/kbd> dd>Go to previous section, including subsections of previous sections dt>kbd>kbd>Shift/kbd>+kbd>→ Right/kbd>/kbd> dd>Go to next section, including subsections of the current section dt>kbd>kbd>Shift/kbd>+kbd>↑ Up/kbd>/kbd> dd>Go to parent section of the current section dt>kbd>kbd>Shift/kbd>+kbd>↓ Down/kbd>/kbd> dd>Go to next section, skipping subsections of the current section /dl> p>Plus in addition, the user agent could map the kbd>kbd>j/kbd>/kbd> and kbd>kbd>k/kbd>/kbd> keys to navigating to the previous or next element of a href#heading-content-2 idexposing-outlines-to-users:heading-content-2-2>heading content/a>, regardless of the sections outline depth and ignoring sections with no headings./p> /div> h4 idusage-summary-2>span classsecno>4.3.12/span> Usage summarya href#usage-summary-2 classself-link>/a>/h4> p>i>This section is non-normative./i>/p> table classvertical-summary-table>thead>tr>th rowspan2>Element th>Purpose tr>th>Example tbody>tr>td rowspan2>code idusage-summary-2:the-body-element>a href#the-body-element>body/a>/code> td>The main content of the document. tr>td>pre classexample><!DOCTYPE HTML><html langen> <head> <title>Steve Hills Home Page</title> </head> strong><body>/strong> <p>Hard Trance is My Life.</p> strong></body>/strong></html>/pre> tr>td rowspan2>code idusage-summary-2:the-article-element>a href#the-article-element>article/a>/code> td>A complete, or self-contained, composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content. tr>td>pre classexample>strong><article>/strong> <img src/tumblr_masqy2s5yn1rzfqbpo1_500.jpg altYellow smiley face with the caption masif> <p>My fave Masif tee so far!</p> <footer>Posted 2 days ago</footer>strong></article>/strong>strong><article>/strong> <img src/tumblr_m9tf6wSr6W1rzfqbpo1_500.jpg alt> <p>Happy 2nd birthday Masif Saturdays!!!</p> <footer>Posted 3 weeks ago</footer>strong></article>/strong>/pre> tr>td rowspan2>code idusage-summary-2:the-section-element>a href#the-section-element>section/a>/code> td>A generic section of a document or application. A section, in this context, is a thematic grouping of content, typically with a heading. tr>td>pre classexample><h1>Biography</h1>strong><section>/strong> <h1>The facts</h1> <p>1500+ shows, 14+ countries</p>strong></section>/strong>strong><section>/strong> <h1>2010/2011 figures per year</h1> <p>100+ shows, 8+ countries</p>strong></section>/strong>/pre> tr>td rowspan2>code idusage-summary-2:the-nav-element>a href#the-nav-element>nav/a>/code> td>A section of a page that links to other pages or to parts within the page: a section with navigation links. tr>td>pre classexample>strong><nav>/strong> <p><a href/>Home</a> <p><a href/biog.html>Bio</a> <p><a href/discog.html>Discog</a>strong></nav>/strong>/pre> tr>td rowspan2>code idusage-summary-2:the-aside-element>a href#the-aside-element>aside/a>/code> td>A section of a page that consists of content that is tangentially related to the content around the code idusage-summary-2:the-aside-element-2>a href#the-aside-element>aside/a>/code> element, and which could be considered separate from that content. Such sections are often represented as sidebars in printed typography. tr>td>pre classexample><h1>Music</h1><p>As any burner can tell you, the event has a lot of trance.</p>strong><aside>/strong>You can buy the music we played at our <a hrefbuy.html>playlist page</a>.strong></aside>/strong><p>This year we played a kind of trance that originated in Belgium, Germany, and the Netherlands in the mid 90s.</p>/pre> tr>td rowspan2>code idusage-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 idusage-summary-2:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6/a>/code> td>A section heading tr>td>pre classexample>strong><h1>/strong>The Guide To Music On The Playastrong></h1>/strong>strong><h2>/strong>The Main Stagestrong></h2>/strong><p>If you want to play on a stage, you should bring one.</p>strong><h2>/strong>Amplified Musicstrong></h2>/strong><p>Amplifiers up to 300W or 90dB are welcome.</p>/pre> tr>td rowspan2>code idusage-summary-2:the-hgroup-element>a href#the-hgroup-element>hgroup/a>/code> td>The heading of a section, which consists of all the code idusage-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 idusage-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 idusage-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 idusage-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 idusage-summary-2:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-6>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6/a>/code> elements when the heading has multiple levels, such as subheadings, alternative titles, or taglines. tr>td>pre classexample>strong><hgroup>/strong> <h1>Burning Music</h1> <h2>The Guide To Music On The Playa</h2>strong></hgroup>/strong><section> strong><hgroup>/strong> <h1>Main Stage</h1> <h2>The Fiction Of A Music Festival</h2> strong></hgroup>/strong> <p>If you want to play on a stage, you should bring one.</p></section><section> strong><hgroup>/strong> <h1>Loudness!</h1> <h2>Questions About Amplified Music</h2> strong></hgroup>/strong> <p>Amplifiers up to 300W or 90dB are welcome.</p></section>/pre> tr>td rowspan2>code idusage-summary-2:the-header-element>a href#the-header-element>header/a>/code> td>A group of introductory or navigational aids. tr>td>pre classexample><article> strong><header>/strong> <h1>Hard Trance is My Life</h1> <p>By DJ Steve Hill and Technikal</p> strong></header>/strong> <p>The album with the amusing punctuation has red artwork.</p></article>/pre> tr>td rowspan2>code idusage-summary-2:the-footer-element>a href#the-footer-element>footer/a>/code> td>A footer for its nearest ancestor a href#sectioning-content-2 idusage-summary-2:sectioning-content-2>sectioning content/a> or a href#sectioning-root idusage-summary-2:sectioning-root>sectioning root/a> element. A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like. tr>td>pre classexample><article> <h1>Hard Trance is My Life</h1> <p>The album with the amusing punctuation has red artwork.</p> strong><footer>/strong> <p>Artists: DJ Steve Hill and Technikal</p> strong></footer>/strong></article>/pre> /table> h5 idarticle-or-section>span classsecno>4.3.12.1/span> Article or section?a href#article-or-section classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>A code idarticle-or-section:the-section-element>a href#the-section-element>section/a>/code> forms part of something else. An code idarticle-or-section:the-article-element>a href#the-article-element>article/a>/code> is its own thing. But how does one know which is which? Mostly the real answer is it depends on author intent./p> p>For example, one could imagine a book with a Granny Smith chapter that just said These juicy, green apples make a great filling for apple pies.; that would be a code idarticle-or-section:the-section-element-2>a href#the-section-element>section/a>/code> because thered be lots of other chapters on (maybe) other kinds of apples./p> p>On the other hand, one could imagine a tweet or reddit comment or tumblr post or newspaper classified ad that just said Granny Smith. These juicy, green apples make a great filling for apple pies.; it would then be code idarticle-or-section:the-article-element-2>a href#the-article-element>article/a>/code>s because that was the whole thing./p> p>A comment on an article is not part of the code idarticle-or-section:the-article-element-3>a href#the-article-element>article/a>/code> on which it is commenting, therefore it is its own code idarticle-or-section:the-article-element-4>a href#the-article-element>article/a>/code>./p> h3 idgrouping-content>span classsecno>4.4/span> Grouping contenta href#grouping-content classself-link>/a>/h3> h4 idthe-p-element>span classsecno>4.4.1/span> The dfn>code>p/code>/dfn> elementa href#the-p-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-p-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-p-element:flow-content-2>Flow content/a>.dd>a href#palpable-content-2 idthe-p-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-p-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-p-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-p-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-p-element:phrasing-content-2>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-p-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>A code idthe-p-element:the-p-element>a href#the-p-element>p/a>/code> elements a href#syntax-end-tag idthe-p-element:syntax-end-tag>end tag/a> can be omitted if the code idthe-p-element:the-p-element-2>a href#the-p-element>p/a>/code> element is immediately followed by an code idthe-p-element:the-address-element>a href#the-address-element>address/a>/code>, code idthe-p-element:the-article-element>a href#the-article-element>article/a>/code>, code idthe-p-element:the-aside-element>a href#the-aside-element>aside/a>/code>, code idthe-p-element:the-blockquote-element>a href#the-blockquote-element>blockquote/a>/code>, code idthe-p-element:the-details-element>a href#the-details-element>details/a>/code>, code idthe-p-element:the-div-element>a href#the-div-element>div/a>/code>, code idthe-p-element:the-dl-element>a href#the-dl-element>dl/a>/code>, code idthe-p-element:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code>, code idthe-p-element:the-figcaption-element>a href#the-figcaption-element>figcaption/a>/code>, code idthe-p-element:the-figure-element>a href#the-figure-element>figure/a>/code>, code idthe-p-element:the-footer-element>a href#the-footer-element>footer/a>/code>, code idthe-p-element:the-form-element>a href#the-form-element>form/a>/code>, code idthe-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 idthe-p-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2/a>/code>, code idthe-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 idthe-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 idthe-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 idthe-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 idthe-p-element:the-header-element>a href#the-header-element>header/a>/code>, code idthe-p-element:the-hgroup-element>a href#the-hgroup-element>hgroup/a>/code>, code idthe-p-element:the-hr-element>a href#the-hr-element>hr/a>/code>, code idthe-p-element:the-main-element>a href#the-main-element>main/a>/code>, code idthe-p-element:the-menu-element>a href#the-menu-element>menu/a>/code>, code idthe-p-element:the-nav-element>a href#the-nav-element>nav/a>/code>, code idthe-p-element:the-ol-element>a href#the-ol-element>ol/a>/code>, code idthe-p-element:the-p-element-3>a href#the-p-element>p/a>/code>, code idthe-p-element:the-pre-element>a href#the-pre-element>pre/a>/code>, code idthe-p-element:the-section-element>a href#the-section-element>section/a>/code>, code idthe-p-element:the-table-element>a href#the-table-element>table/a>/code>, or code idthe-p-element:the-ul-element>a href#the-ul-element>ul/a>/code> element, or if there is no more content in the parent element and the parent element is an a href#html-elements idthe-p-element:html-elements>HTML element/a> that is not an code idthe-p-element:the-a-element>a href#the-a-element>a/a>/code>, code idthe-p-element:the-audio-element>a href#the-audio-element>audio/a>/code>, code idthe-p-element:the-del-element>a href#the-del-element>del/a>/code>, code idthe-p-element:the-ins-element>a href#the-ins-element>ins/a>/code>, code idthe-p-element:the-map-element>a href#the-map-element>map/a>/code>, code idthe-p-element:the-noscript-element>a href#the-noscript-element>noscript/a>/code>, or code idthe-p-element:the-video-element>a href#the-video-element>video/a>/code> element, or an a href#autonomous-custom-element idthe-p-element:autonomous-custom-element>autonomous custom element/a>.dt>a href#concept-element-attributes idthe-p-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-p-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-p-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-p-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlparagraphelement>HTMLParagraphElement/dfn> : a href#htmlelement idthe-p-element:htmlelement>HTMLElement/a> { // a href#HTMLParagraphElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-p-element:the-p-element-4>a href#the-p-element>p/a>/code> element a href#represents idthe-p-element:represents>represents/a> a a href#paragraph idthe-p-element:paragraph>paragraph/a>./p> p classnote>While paragraphs are usually represented in visual media by blocks of text that are physically separated from adjacent blocks through blank lines, a style sheet or user agent would be equally justified in presenting paragraph breaks in a different manner, for instance using inline pilcrows (¶)./p> div classexample> p>The following examples are conforming HTML fragments:/p> pre><p>The little kitten gently seated herself on a piece ofcarpet. Later in her life, this would be referred to as the time thecat sat on the mat.</p>/pre> pre><fieldset> <legend>Personal information</legend> <p> <label>Name: <input namen></label> <label><input nameanon typecheckbox> Hide from other users</label> </p> <p><label>Address: <textarea namea></textarea></label></p></fieldset>/pre> pre><p>There was once an example from Femley,<br>Whose markup was of dubious quality.<br>The validator complained,<br>So the author was pained,<br>To move the error from the markup to the rhyming.</p>/pre> /div> p>The code idthe-p-element:the-p-element-5>a href#the-p-element>p/a>/code> element should not be used when a more specific element is more appropriate./p> div classexample> p>The following example is technically correct:/p>pre><section> <!-- ... --> <p>Last modified: 2001-04-23</p> <p>Author: fred@example.com</p></section>/pre> p>However, it would be better marked-up as:/p>pre><section> <!-- ... --> <footer>Last modified: 2001-04-23</footer> <address>Author: fred@example.com</address></section>/pre> p>Or:/p>pre><section> <!-- ... --> <footer> <p>Last modified: 2001-04-23</p> <address>Author: fred@example.com</address> </footer></section>/pre> /div> div classnote> p>List elements (in particular, code idthe-p-element:the-ol-element-2>a href#the-ol-element>ol/a>/code> and code idthe-p-element:the-ul-element-2>a href#the-ul-element>ul/a>/code> elements) cannot be children of code idthe-p-element:the-p-element-6>a href#the-p-element>p/a>/code> elements. When a sentence contains a bulleted list, therefore, one might wonder how it should be marked up./p> div classexample> p>For instance, this fantastic sentence has bullets relating to/p> ul>li>wizards, li>faster-than-light travel, and li>telepathy, /ul> p>and is further discussed below./p> /div> p>The solution is to realize that a i idthe-p-element:paragraph-2>a href#paragraph>paragraph/a>/i>, in HTML terms, is not a logical concept, but a structural one. In the fantastic example above, there are actually em>five/em> a href#paragraph idthe-p-element:paragraph-3>paragraphs/a> as defined by this specification: one before the list, one for each bullet, and one after the list./p> div classexample> p>The markup for the above example could therefore be:/p> pre><p>For instance, this fantastic sentence has bullets relating to</p><ul> <li>wizards, <li>faster-than-light travel, and <li>telepathy,</ul><p>and is further discussed below.</p>/pre> /div> p>Authors wishing to conveniently style such logical paragraphs consisting of multiple structural paragraphs can use the code idthe-p-element:the-div-element-2>a href#the-div-element>div/a>/code> element instead of the code idthe-p-element:the-p-element-7>a href#the-p-element>p/a>/code> element./p> div classexample> p>Thus for instance the above example could become the following:/p> pre><div>For instance, this fantastic sentence has bullets relating to<ul> <li>wizards, <li>faster-than-light travel, and <li>telepathy,</ul>and is further discussed below.</div>/pre> p>This example still has five structural paragraphs, but now the author can style just the code idthe-p-element:the-div-element-3>a href#the-div-element>div/a>/code> instead of having to consider each part of the example separately./p> /div> /div> h4 idthe-hr-element>span classsecno>4.4.2/span> The dfn>code>hr/code>/dfn> elementa href#the-hr-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-hr-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-hr-element:flow-content-2>Flow content/a>.dt>a href#concept-element-contexts idthe-hr-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-hr-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-hr-element:concept-element-content-model>Content model/a>:dd>a href#concept-content-nothing idthe-hr-element:concept-content-nothing>Nothing/a>.dt>a href#concept-element-tag-omission idthe-hr-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>No a href#syntax-end-tag idthe-hr-element:syntax-end-tag>end tag/a>.dt>a href#concept-element-attributes idthe-hr-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-hr-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-hr-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-hr-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlhrelement>HTMLHRElement/dfn> : a href#htmlelement idthe-hr-element:htmlelement>HTMLElement/a> { // a href#HTMLHRElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-hr-element:the-hr-element>a href#the-hr-element>hr/a>/code> element a href#represents idthe-hr-element:represents>represents/a> a a href#paragraph idthe-hr-element:paragraph>paragraph/a>-level thematic break, e.g. a scene change in a story, or a transition to another topic within a section of a reference book./p> div classexample> p>The following fictional extract from a project manual shows two sections that use the code idthe-hr-element:the-hr-element-2>a href#the-hr-element>hr/a>/code> element to separate topics within the section./p> pre><section> <h1>Communication</h1> <p>There are various methods of communication. This section covers a few of the important ones used by the project.</p> strong><hr>/strong> <p>Communication stones seem to come in pairs and have mysterious properties:</p> <ul> <li>They can transfer thoughts in two directions once activated if used alone.</li> <li>If used with another device, they can transfer ones consciousness to another body.</li> <li>If both stones are used with another device, the consciousnesses switch bodies.</li> </ul> strong><hr>/strong> <p>Radios use the electromagnetic spectrum in the meter range and longer.</p> strong><hr>/strong> <p>Signal flares use the electromagnetic spectrum in the nanometer range.</p></section><section> <h1>Food</h1> <p>All food at the project is rationed:</p> <dl> <dt>Potatoes</dt> <dd>Two per day</dd> <dt>Soup</dt> <dd>One bowl per day</dd> </dl> strong><hr>/strong> <p>Cooking is done by the chefs on a set rotation.</p></section>/pre> p>There is no need for an code idthe-hr-element:the-hr-element-3>a href#the-hr-element>hr/a>/code> element between the sections themselves, since the code idthe-hr-element:the-section-element>a href#the-section-element>section/a>/code> elements and the code idthe-hr-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code> elements imply thematic changes themselves./p> /div> div classexample> p>The following extract from cite>Pandoras Star/cite> by Peter F. Hamilton shows two paragraphs that precede a scene change and the paragraph that follows it. The scene change, represented in the printed book by a gap containing a solitary centered star between the second and third paragraphs, is here represented using the code idthe-hr-element:the-hr-element-4>a href#the-hr-element>hr/a>/code> element./p> pre langen-GB><p>Dudley was ninety-two, in his second life, and fast approachingtime for another rejuvenation. Despite his body having the physicalage of a standard fifty-year-old, the prospect of a long degradingcampaign within academia was one he regarded with dread. For asupposedly advanced civilization, the Intersolar Commonwealth could beappallingly backward at times, not to mention cruel.</p><p><i>Maybe it wont be that bad</i>, he told himself. The lie wascomforting enough to get him through the rest of the nightsshift.</p>strong><hr>/strong><p>The Carlton AllLander drove Dudley home just after dawn. Like theastronomer, the vehicle was old and worn, but perfectly capable ofdoing its job. It had a cheap diesel engine, common enough on asemi-frontier world like Gralmond, although its drive array was athoroughly modern photoneural processor. With its high suspension anddeep-tread tyres it could plough along the dirt track to theobservatory in all weather and seasons, including the metre-deep snowof Gralmonds winters.</p>/pre> /div> p classnote>The code idthe-hr-element:the-hr-element-5>a href#the-hr-element>hr/a>/code> element does not affect the documents a href#outline idthe-hr-element:outline>outline/a>./p> h4 idthe-pre-element>span classsecno>4.4.3/span> The dfn>code>pre/code>/dfn> elementa href#the-pre-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-pre-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-pre-element:flow-content-2>Flow content/a>.dd>a href#palpable-content-2 idthe-pre-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-pre-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-pre-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-pre-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-pre-element:phrasing-content-2>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-pre-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-pre-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-pre-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-pre-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-pre-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlpreelement>HTMLPreElement/dfn> : a href#htmlelement idthe-pre-element:htmlelement>HTMLElement/a> { // a href#HTMLPreElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-pre-element:the-pre-element>a href#the-pre-element>pre/a>/code> element a href#represents idthe-pre-element:represents>represents/a> a block of preformatted text, in which structure is represented by typographic conventions rather than by elements./p> p classnote>In a href#syntax idthe-pre-element:syntax>the HTML syntax/a>, a leading newline character immediately following the code idthe-pre-element:the-pre-element-2>a href#the-pre-element>pre/a>/code> element start tag is stripped./p> p>Some examples of cases where the code idthe-pre-element:the-pre-element-3>a href#the-pre-element>pre/a>/code> element could be used:/p> ul>li>Including an e-mail, with paragraphs indicated by blank lines, lists indicated by lines prefixed with a bullet, and so on.li>Including fragments of computer code, with structure indicated according to the conventions of that language.li>Displaying ASCII art./ul> p classnote>Authors are encouraged to consider how preformatted text will be experienced when the formatting is lost, as will be the case for users of speech synthesizers, braille displays, and the like. For cases like ASCII art, it is likely that an alternative presentation, such as a textual description, would be more universally accessible to the readers of the document./p> p>To represent a block of computer code, the code idthe-pre-element:the-pre-element-4>a href#the-pre-element>pre/a>/code> element can be used with a code idthe-pre-element:the-code-element>a href#the-code-element>code/a>/code> element; to represent a block of computer output the code idthe-pre-element:the-pre-element-5>a href#the-pre-element>pre/a>/code> element can be used with a code idthe-pre-element:the-samp-element>a href#the-samp-element>samp/a>/code> element. Similarly, the code idthe-pre-element:the-kbd-element>a href#the-kbd-element>kbd/a>/code> element can be used within a code idthe-pre-element:the-pre-element-6>a href#the-pre-element>pre/a>/code> element to indicate text that the user is to enter./p> p classnote>This element a href#bidireq>has rendering requirements involving the bidirectional algorithm/a>./p> div classexample> p>In the following snippet, a sample of computer code is presented./p> pre><p>This is the <code>Panel</code> constructor:</p><pre><code>function Panel(element, canClose, closeHandler) { this.element element; this.canClose canClose; this.closeHandler function () { if (closeHandler) closeHandler() };}</code></pre>/pre> /div> div classexample> p>In the following snippet, code idthe-pre-element:the-samp-element-2>a href#the-samp-element>samp/a>/code> and code idthe-pre-element:the-kbd-element-2>a href#the-kbd-element>kbd/a>/code> elements are mixed in the contents of a code idthe-pre-element:the-pre-element-7>a href#the-pre-element>pre/a>/code> element to show a session of Zork I./p> pre><pre><samp>You are in an open field west of a big white house with a boardedfront door.There is a small mailbox here.></samp> <kbd>open mailbox</kbd><samp>Opening the mailbox reveals:A leaflet.></samp></pre>/pre> /div> div classexample> p>The following shows a contemporary poem that uses the code idthe-pre-element:the-pre-element-8>a href#the-pre-element>pre/a>/code> element to preserve its unusual formatting, which forms an intrinsic part of the poem itself./p> pre><pre> maxlingit is with a heart heavythat i admit loss of a feline so loveda friend lost to the unknown (night)~cdr 11dec07</pre>/pre> /div> h4 idthe-blockquote-element>span classsecno>4.4.4/span> The dfn>code>blockquote/code>/dfn> elementa href#the-blockquote-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-blockquote-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-blockquote-element:flow-content-2>Flow content/a>.dd>a href#sectioning-root idthe-blockquote-element:sectioning-root>Sectioning root/a>.dd>a href#palpable-content-2 idthe-blockquote-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-blockquote-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-blockquote-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-blockquote-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-blockquote-element:flow-content-2-3>Flow content/a>.dt>a href#concept-element-tag-omission idthe-blockquote-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-blockquote-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-blockquote-element:global-attributes>Global attributes/a>dd>code idthe-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 editdt>a href#concept-element-dom idthe-blockquote-element:concept-element-dom>DOM interface/a>:dd>pre classidl>ExposedWindow, a href#htmlconstructor idthe-blockquote-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlquoteelement>HTMLQuoteElement/dfn> : a href#htmlelement idthe-blockquote-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-blockquote-element:cereactions>CEReactions/a> attribute USVString a href#dom-quote-cite idthe-blockquote-element:dom-quote-cite>cite/a>;};/pre> p classnote>The code idthe-blockquote-element:htmlquoteelement>a href#htmlquoteelement>HTMLQuoteElement/a>/code> interface is also used by the code idthe-blockquote-element:the-q-element>a href#the-q-element>q/a>/code> element./p> /dl> p>The code idthe-blockquote-element:the-blockquote-element>a href#the-blockquote-element>blockquote/a>/code> element a href#represents idthe-blockquote-element:represents>represents/a> a section that is quoted from another source./p> p>Content inside a code idthe-blockquote-element:the-blockquote-element-2>a href#the-blockquote-element>blockquote/a>/code> must be quoted from another source, whose address, if it has one, may be cited in the dfn idattr-blockquote-cite>code>cite/code>/dfn> attribute./p> p>If the code idthe-blockquote-element:attr-blockquote-cite-2>a href#attr-blockquote-cite>cite/a>/code> attribute is present, it must be a a href#valid-url-potentially-surrounded-by-spaces idthe-blockquote-element:valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by spaces/a>. To obtain the corresponding citation link, the value of the attribute must be a href#parse-a-url idthe-blockquote-element:parse-a-url>parsed/a> relative to the elements a idthe-blockquote-element:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>. User agents may allow users to follow such citation links, but they are primarily intended for private use (e.g., by server-side scripts collecting statistics about a sites use of quotations), not for readers./p> p>The content of a code idthe-blockquote-element:the-blockquote-element-3>a href#the-blockquote-element>blockquote/a>/code> may be abbreviated or may have context added in the conventional manner for the texts language./p> div classexample> p>For example, in English this is traditionally done using square brackets. Consider a page with the sentence Jane ate the cracker. She then said she liked apples and fish.; it could be quoted as follows:/p> pre><blockquote> <p>Jane then said she liked ... fish.</p></blockquote>/pre> /div> p>Attribution for the quotation, if any, must be placed outside the code idthe-blockquote-element:the-blockquote-element-4>a href#the-blockquote-element>blockquote/a>/code> element./p> div classexample> p>For example, here the attribution is given in a paragraph after the quote:/p> pre><blockquote> <p>I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours.</p></blockquote><p>— Stephen Roberts</p>/pre> p>The other examples below show other ways of showing attribution./p> /div> p>The dfn iddom-quote-cite>code>cite/code>/dfn> IDL attribute must a href#reflect idthe-blockquote-element:reflect>reflect/a> the elements code>cite/code> content attribute./p> div classexample> p>Here a code idthe-blockquote-element:the-blockquote-element-5>a href#the-blockquote-element>blockquote/a>/code> element is used in conjunction with a code idthe-blockquote-element:the-figure-element>a href#the-figure-element>figure/a>/code> element and its code idthe-blockquote-element:the-figcaption-element>a href#the-figcaption-element>figcaption/a>/code> to clearly relate a quote to its attribution (which is not part of the quote and therefore doesnt belong inside the code idthe-blockquote-element:the-blockquote-element-6>a href#the-blockquote-element>blockquote/a>/code> itself):/p> pre><figure> <blockquote> <p>The truth may be puzzling. It may take some work to grapple with. It may be counterintuitive. It may contradict deeply held prejudices. It may not be consonant with what we desperately want to be true. But our preferences do not determine whats true. We have a method, and that method helps us to reach not absolute truth, only asymptotic approaches to the truth — never there, just closer and closer, always finding vast new oceans of undiscovered possibilities. Cleverly designed experiments are the key.</p> </blockquote> <figcaption>Carl Sagan, in <cite>Wonder and Skepticism</cite>, from the <cite>Skeptical Inquirer</cite> Volume 19, Issue 1 (January-February 1995)</figcaption></figure>/pre> /div> div classexample> p>This next example shows the use of code idthe-blockquote-element:the-cite-element>a href#the-cite-element>cite/a>/code> alongside code idthe-blockquote-element:the-blockquote-element-7>a href#the-blockquote-element>blockquote/a>/code>:/p> pre><p>His next piece was the aptly named <cite>Sonnet 130</cite>:</p><blockquote citehttps://quotes.example.org/s/sonnet130.html> <p>My mistress eyes are nothing like the sun,<br> Coral is far more red, than her lips red,<br> .../pre> /div> div classexample> p>This example shows how a forum post could use code idthe-blockquote-element:the-blockquote-element-8>a href#the-blockquote-element>blockquote/a>/code> to show what post a user is replying to. The code idthe-blockquote-element:the-article-element>a href#the-article-element>article/a>/code> element is used for each post, to mark up the threading./p> pre><article> <h1><a hrefhttps://bacon.example.com/?blog109431>Bacon on a crowbar</a></h1> <article> <header><strong>t3yw</strong> 12 points 1 hour ago</header> <p>I bet a narwhal would love that.</p> <footer><a href?pid29578>permalink</a></footer> <article> <header><strong>greg</strong> 8 points 1 hour ago</header> <blockquote><p>I bet a narwhal would love that.</p></blockquote> <p>Dude narwhals dont eat bacon.</p> <footer><a href?pid29579>permalink</a></footer> <article> <header><strong>t3yw</strong> 15 points 1 hour ago</header> <blockquote> <blockquote><p>I bet a narwhal would love that.</p></blockquote> <p>Dude narwhals dont eat bacon.</p> </blockquote> <p>Next thing youll be saying they dont get capes and wizard hats either!</p> <footer><a href?pid29580>permalink</a></footer> <article> <article> <header><strong>boing</strong> -5 points 1 hour ago</header> <p>narwhals are worse than ceiling cat</p> <footer><a href?pid29581>permalink</a></footer> </article> </article> </article> </article> <article> <header><strong>fred</strong> 1 points 23 minutes ago</header> <blockquote><p>I bet a narwhal would love that.</p></blockquote> <p>I bet theyd love to peel a banana too.</p> <footer><a href?pid29582>permalink</a></footer> </article> </article></article>/pre> /div> div classexample> p>This example shows the use of a code idthe-blockquote-element:the-blockquote-element-9>a href#the-blockquote-element>blockquote/a>/code> for short snippets, demonstrating that one does not have to use code idthe-blockquote-element:the-p-element>a href#the-p-element>p/a>/code> elements inside code idthe-blockquote-element:the-blockquote-element-10>a href#the-blockquote-element>blockquote/a>/code> elements:/p> pre><p>He began his list of lessons with the following:</p><blockquote>One should never assume that his side ofthe issue will be recognized, let alone that it willbe conceded to have merits.</blockquote><p>He continued with a number of similar points, ending with:</p><blockquote>Finally, one should be prepared for the threatof breakdown in negotiations at any given moment and notbe cowed by the possibility.</blockquote><p>We shall now discuss these points.../pre> /div> p classnote>a href#conversations>Examples of how to represent a conversation/a> are shown in a later section; it is not appropriate to use the code idthe-blockquote-element:the-cite-element-2>a href#the-cite-element>cite/a>/code> and code idthe-blockquote-element:the-blockquote-element-11>a href#the-blockquote-element>blockquote/a>/code> elements for this purpose./p> h4 idthe-ol-element>span classsecno>4.4.5/span> The dfn>code>ol/code>/dfn> elementa href#the-ol-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-ol-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-ol-element:flow-content-2>Flow content/a>.dd>If the elements children include at least one code idthe-ol-element:the-li-element>a href#the-li-element>li/a>/code> element: a href#palpable-content-2 idthe-ol-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-ol-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-ol-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-ol-element:concept-element-content-model>Content model/a>:dd>Zero or more code idthe-ol-element:the-li-element-2>a href#the-li-element>li/a>/code> and a href#script-supporting-elements-2 idthe-ol-element:script-supporting-elements-2>script-supporting/a> elements.dt>a href#concept-element-tag-omission idthe-ol-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-ol-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-ol-element:global-attributes>Global attributes/a>dd>code idthe-ol-element:attr-ol-reversed>a href#attr-ol-reversed>reversed/a>/code> — Number the list backwardsdd>code idthe-ol-element:attr-ol-start>a href#attr-ol-start>start/a>/code> — a href#concept-ol-start idthe-ol-element:concept-ol-start>Starting value/a> of the listdd>code idthe-ol-element:attr-ol-type>a href#attr-ol-type>type/a>/code> — Kind of list markerdt>a href#concept-element-dom idthe-ol-element:concept-element-dom>DOM interface/a>:dd>pre classidl>ExposedWindow, a href#htmlconstructor idthe-ol-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlolistelement>HTMLOListElement/dfn> : a href#htmlelement idthe-ol-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-ol-element:cereactions>CEReactions/a> attribute boolean a href#dom-ol-reversed idthe-ol-element:dom-ol-reversed>reversed/a>; a href#cereactions idthe-ol-element:cereactions-2>CEReactions/a> attribute long a href#dom-ol-start idthe-ol-element:dom-ol-start>start/a>; a href#cereactions idthe-ol-element:cereactions-3>CEReactions/a> attribute DOMString a href#dom-ol-type idthe-ol-element:dom-ol-type>type/a>; // a href#HTMLOListElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-ol-element:the-ol-element>a href#the-ol-element>ol/a>/code> element a href#represents idthe-ol-element:represents>represents/a> a list of items, where the items have been intentionally ordered, such that changing the order would change the meaning of the document./p> p>The items of the list are the code idthe-ol-element:the-li-element-3>a href#the-li-element>li/a>/code> element child nodes of the code idthe-ol-element:the-ol-element-2>a href#the-ol-element>ol/a>/code> element, in a idthe-ol-element:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>./p> p>The dfn idattr-ol-reversed>code>reversed/code>/dfn> attribute is a a href#boolean-attribute idthe-ol-element:boolean-attribute>boolean attribute/a>. If present, it indicates that the list is a descending list (..., 3, 2, 1). If the attribute is omitted, the list is an ascending list (1, 2, 3, ...).div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> ol-reversedspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>20+/span>/span>span classios_saf yes>span>iOS Safari/span> span>6.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>18+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>6.1+/span>/span>span classedge no>span>Edge/span> span>None/span>/span>span classandroid yes>span>Android Browser/span> span>4.4+/span>/span>span classopera yes>span>Opera/span> span>12.1+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featol-reversed>caniuse.com/a>/div> p>The dfn idattr-ol-start>code>start/code>/dfn> attribute, if present, must be a a href#valid-integer idthe-ol-element:valid-integer>valid integer/a>. It is used to determine the a href#concept-ol-start idthe-ol-element:concept-ol-start-2>starting value/a> of the list./p> p>An code idthe-ol-element:the-ol-element-3>a href#the-ol-element>ol/a>/code> element has a dfn idconcept-ol-start>starting value/dfn>, which is an integer determined as follows:/p> ol>li> p>If the code idthe-ol-element:the-ol-element-4>a href#the-ol-element>ol/a>/code> element has a code idthe-ol-element:attr-ol-start-2>a href#attr-ol-start>start/a>/code> attribute, then:/p> ol>li>p>Let var>parsed/var> be the result of a href#rules-for-parsing-integers idthe-ol-element:rules-for-parsing-integers>parsing the value of the attribute as an integer/a>.li>p>If var>parsed/var> is not an error, then return var>parsed/var>./ol> li>p>If the code idthe-ol-element:the-ol-element-5>a href#the-ol-element>ol/a>/code> element has a code idthe-ol-element:attr-ol-reversed-2>a href#attr-ol-reversed>reversed/a>/code> attribute, then return the number of a href#list-owner idthe-ol-element:list-owner>owned code>li/code> elements/a>.li>p>Return 1./ol> p>The dfn idattr-ol-type>code>type/code>/dfn> attribute can be used to specify the kind of marker to use in the list, in the cases where that matters (e.g. because items are to be a href#referenced idthe-ol-element:referenced>referenced/a> by their number/letter). The attribute, if specified, must have a value that is a a href#case-sensitive idthe-ol-element:case-sensitive>case-sensitive/a> match for one of the characters given in the first cell of one of the rows of the following table. The code idthe-ol-element:attr-ol-type-2>a href#attr-ol-type>type/a>/code> attribute represents the state given in the cell in the second column of the row whose first cell matches the attributes value; if none of the cells match, or if the attribute is omitted, then the attribute represents the a href#attr-ol-type-state-decimal idthe-ol-element:attr-ol-type-state-decimal>decimal/a> state./p> table>thead>tr>th>Keyword th>State th>Description th colspan8>Examples for values 1-3 and 3999-4001 tbody>tr>td>dfn idattr-ol-type-keyword-decimal>code>1/code>/dfn> (U+0031) td>dfn idattr-ol-type-state-decimal>decimal/dfn> td>Decimal numbers td classeg>samp>1./samp> td classeg>samp>2./samp> td classeg>samp>3./samp> td classeg>... td classeg>samp>3999./samp> td classeg>samp>4000./samp> td classeg>samp>4001./samp> td classeg>... tr>td>dfn idattr-ol-type-keyword-lower-alpha>code>a/code>/dfn> (U+0061) td>dfn idattr-ol-type-state-lower-alpha>lower-alpha/dfn> td>Lowercase latin alphabet td classeg>samp>a./samp> td classeg>samp>b./samp> td classeg>samp>c./samp> td classeg>... td classeg>samp>ewu./samp> td classeg>samp>ewv./samp> td classeg>samp>eww./samp> td classeg>... tr>td>dfn idattr-ol-type-keyword-upper-alpha>code>A/code>/dfn> (U+0041) td>dfn idattr-ol-type-state-upper-alpha>upper-alpha/dfn> td>Uppercase latin alphabet td classeg>samp>A./samp> td classeg>samp>B./samp> td classeg>samp>C./samp> td classeg>... td classeg>samp>EWU./samp> td classeg>samp>EWV./samp> td classeg>samp>EWW./samp> td classeg>... tr>td>dfn idattr-ol-type-keyword-lower-roman>code>i/code>/dfn> (U+0069) td>dfn idattr-ol-type-state-lower-roman>lower-roman/dfn> td>Lowercase roman numerals td classeg>samp>i./samp> td classeg>samp>ii./samp> td classeg>samp>iii./samp> td classeg>... td classeg>samp>mmmcmxcix./samp> td classeg>samp>i̅v̅./samp> td classeg>samp>i̅v̅i./samp> td classeg>... tr>td>dfn idattr-ol-type-keyword-upper-roman>code>I/code>/dfn> (U+0049) td>dfn idattr-ol-type-state-upper-roman>upper-roman/dfn> td>Uppercase roman numerals td classeg>samp>I./samp> td classeg>samp>II./samp> td classeg>samp>III./samp> td classeg>... td classeg>samp>MMMCMXCIX./samp> td classeg>samp>I̅V̅./samp> td classeg>samp>I̅V̅I./samp> td classeg>... /table> p>User agents should render the items of the list in a manner consistent with the state of the code idthe-ol-element:attr-ol-type-3>a href#attr-ol-type>type/a>/code> attribute of the code idthe-ol-element:the-ol-element-6>a href#the-ol-element>ol/a>/code> element. Numbers less than or equal to zero should always use the decimal system regardless of the code idthe-ol-element:attr-ol-type-4>a href#attr-ol-type>type/a>/code> attribute./p> p classnote>For CSS user agents, a mapping for this attribute to the a idthe-ol-element:list-style-type hrefhttps://drafts.csswg.org/css-lists/#propdef-list-style-type data-x-internallist-style-type>list-style-type/a> CSS property is given a href#decohints>in the rendering section/a> (the mapping is straightforward: the states above have the same names as their corresponding CSS values)./p> p classnote>It is possible to redefine the default CSS list styles used to implement this attribute in CSS user agents; doing so will affect how list items are rendered./p> p>The dfn iddom-ol-reversed>code>reversed/code>/dfn> and dfn iddom-ol-type>code>type/code>/dfn> IDL attributes must a href#reflect idthe-ol-element:reflect>reflect/a> the respective content attributes of the same name./p> p>The dfn iddom-ol-start>code>start/code>/dfn> IDL attribute must a href#reflect idthe-ol-element:reflect-2>reflect/a> the content attribute of the same name, with a default value of 1./p> p classnote>This means that the code idthe-ol-element:dom-ol-start-2>a href#dom-ol-start>start/a>/code> IDL attribute does not necessarily match the lists a href#concept-ol-start idthe-ol-element:concept-ol-start-3>starting value/a>, in cases where the code idthe-ol-element:attr-ol-start-3>a href#attr-ol-start>start/a>/code> content attribute is omitted and the code idthe-ol-element:attr-ol-reversed-3>a href#attr-ol-reversed>reversed/a>/code> content attribute is specified./p> div classexample> p>The following markup shows a list where the order matters, and where the code idthe-ol-element:the-ol-element-7>a href#the-ol-element>ol/a>/code> element is therefore appropriate. Compare this list to the equivalent list in the code idthe-ol-element:the-ul-element>a href#the-ul-element>ul/a>/code> section to see an example of the same items using the code idthe-ol-element:the-ul-element-2>a href#the-ul-element>ul/a>/code> element./p> pre><p>I have lived in the following countries (given in the order of whenI first lived there):</p><ol> <li>Switzerland <li>United Kingdom <li>United States <li>Norway</ol>/pre> p>Note how changing the order of the list changes the meaning of the document. In the following example, changing the relative order of the first two items has changed the birthplace of the author:/p> pre><p>I have lived in the following countries (given in the order of whenI first lived there):</p><ol> <li>United Kingdom <li>Switzerland <li>United States <li>Norway</ol>/pre> /div> h4 idthe-ul-element>span classsecno>4.4.6/span> The dfn>code>ul/code>/dfn> elementa href#the-ul-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-ul-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-ul-element:flow-content-2>Flow content/a>.dd>If the elements children include at least one code idthe-ul-element:the-li-element>a href#the-li-element>li/a>/code> element: a href#palpable-content-2 idthe-ul-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-ul-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-ul-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-ul-element:concept-element-content-model>Content model/a>:dd>Zero or more code idthe-ul-element:the-li-element-2>a href#the-li-element>li/a>/code> and a href#script-supporting-elements-2 idthe-ul-element:script-supporting-elements-2>script-supporting/a> elements.dt>a href#concept-element-tag-omission idthe-ul-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-ul-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-ul-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-ul-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-ul-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlulistelement>HTMLUListElement/dfn> : a href#htmlelement idthe-ul-element:htmlelement>HTMLElement/a> { // a href#HTMLUListElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-ul-element:the-ul-element>a href#the-ul-element>ul/a>/code> element a href#represents idthe-ul-element:represents>represents/a> a list of items, where the order of the items is not important — that is, where changing the order would not materially change the meaning of the document./p> p>The items of the list are the code idthe-ul-element:the-li-element-3>a href#the-li-element>li/a>/code> element child nodes of the code idthe-ul-element:the-ul-element-2>a href#the-ul-element>ul/a>/code> element./p> div classexample> p>The following markup shows a list where the order does not matter, and where the code idthe-ul-element:the-ul-element-3>a href#the-ul-element>ul/a>/code> element is therefore appropriate. Compare this list to the equivalent list in the code idthe-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 idthe-ul-element:the-ol-element-2>a href#the-ol-element>ol/a>/code> element./p> pre><p>I have lived in the following countries:</p><ul> <li>Norway <li>Switzerland <li>United Kingdom <li>United States</ul>/pre> p>Note that changing the order of the list does not change the meaning of the document. The items in the snippet above are given in alphabetical order, but in the snippet below they are given in order of the size of their current account balance in 2007, without changing the meaning of the document whatsoever:/p> pre><p>I have lived in the following countries:</p><ul> <li>Switzerland <li>Norway <li>United Kingdom <li>United States</ul>/pre> /div> h4 idthe-menu-element>span classsecno>4.4.7/span> The dfn idmenus>code>menu/code>/dfn> elementa href#the-menu-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-menu-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-menu-element:flow-content-2>Flow content/a>.dd>If the elements children include at least one code idthe-menu-element:the-li-element>a href#the-li-element>li/a>/code> element: a href#palpable-content-2 idthe-menu-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-menu-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-menu-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-menu-element:concept-element-content-model>Content model/a>:dd>Zero or more code idthe-menu-element:the-li-element-2>a href#the-li-element>li/a>/code> and a href#script-supporting-elements-2 idthe-menu-element:script-supporting-elements-2>script-supporting/a> elements.dt>a href#concept-element-tag-omission idthe-menu-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-menu-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-menu-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-menu-element:concept-element-dom>DOM interface/a>:dd>pre classidl>ExposedWindow, a href#htmlconstructor idthe-menu-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlmenuelement>HTMLMenuElement/dfn> : a href#htmlelement idthe-menu-element:htmlelement>HTMLElement/a> { // a href#HTMLMenuElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-menu-element:the-menu-element>a href#the-menu-element>menu/a>/code> element a href#represents idthe-menu-element:represents>represents/a> a toolbar consisting of its contents, in the form of an unordered list of items (represented by code idthe-menu-element:the-li-element-3>a href#the-li-element>li/a>/code> elements), each of which represents a command that the user can perform or activate./p> p classnote>The code idthe-menu-element:the-menu-element-2>a href#the-menu-element>menu/a>/code> element is simply a semantic alternative to code idthe-menu-element:the-ul-element>a href#the-ul-element>ul/a>/code> to express an unordered list of commands (a toolbar)./p> div classexample> p>In this example, a text-editing application uses a code idthe-menu-element:the-menu-element-3>a href#the-menu-element>menu/a>/code> element to provide a series of editing commands:/p> pre><menu> <li><button onclickcopy()><img srccopy.svg altCopy></button></li> <li><button onclickcut()><img srccut.svg altCut></button></li> <li><button onclickpaste()><img srcpaste.svg altPaste></button></li></menu>/pre> p>Note that the styling to make this look like a conventional toolbar menu is up to the application./p> /div> h4 idthe-li-element>span classsecno>4.4.8/span> The dfn>code>li/code>/dfn> elementa href#the-li-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-li-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-li-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Inside code idthe-li-element:the-ol-element>a href#the-ol-element>ol/a>/code> elements.dd>Inside code idthe-li-element:the-ul-element>a href#the-ul-element>ul/a>/code> elements.dd>Inside code idthe-li-element:the-menu-element>a href#the-menu-element>menu/a>/code> elements.dt>a href#concept-element-content-model idthe-li-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-li-element:flow-content-2>Flow content/a>.dt>a href#concept-element-tag-omission idthe-li-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>An code idthe-li-element:the-li-element>a href#the-li-element>li/a>/code> elements a href#syntax-end-tag idthe-li-element:syntax-end-tag>end tag/a> can be omitted if the code idthe-li-element:the-li-element-2>a href#the-li-element>li/a>/code> element is immediately followed by another code idthe-li-element:the-li-element-3>a href#the-li-element>li/a>/code> element or if there is no more content in the parent element.dt>a href#concept-element-attributes idthe-li-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-li-element:global-attributes>Global attributes/a>dd>If the element is not a child of an code idthe-li-element:the-ul-element-2>a href#the-ul-element>ul/a>/code> or code idthe-li-element:the-menu-element-2>a href#the-menu-element>menu/a>/code> element: code idthe-li-element:attr-li-value>a href#attr-li-value>value/a>/code> — a href#ordinal-value idthe-li-element:ordinal-value>Ordinal value/a> of the list itemdt>a href#concept-element-dom idthe-li-element:concept-element-dom>DOM interface/a>:dd>pre classidl>ExposedWindow, a href#htmlconstructor idthe-li-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmllielement>HTMLLIElement/dfn> : a href#htmlelement idthe-li-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-li-element:cereactions>CEReactions/a> attribute long a href#dom-li-value idthe-li-element:dom-li-value>value/a>; // a href#HTMLLIElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-li-element:the-li-element-4>a href#the-li-element>li/a>/code> element a href#represents idthe-li-element:represents>represents/a> a list item. If its parent element is an code idthe-li-element:the-ol-element-2>a href#the-ol-element>ol/a>/code>, code idthe-li-element:the-ul-element-3>a href#the-ul-element>ul/a>/code>, or code idthe-li-element:the-menu-element-3>a href#the-menu-element>menu/a>/code> element, then the element is an item of the parent elements list, as defined for those elements. Otherwise, the list item has no defined list-related relationship to any other code idthe-li-element:the-li-element-5>a href#the-li-element>li/a>/code> element./p> p>The dfn idattr-li-value>code>value/code>/dfn> attribute, if present, must be a a href#valid-integer idthe-li-element:valid-integer>valid integer/a>. It is used to determine the a href#ordinal-value idthe-li-element:ordinal-value-2>ordinal value/a> of the list item, when the code idthe-li-element:the-li-element-6>a href#the-li-element>li/a>/code>s a href#list-owner idthe-li-element:list-owner>list owner/a> is an code idthe-li-element:the-ol-element-3>a href#the-ol-element>ol/a>/code> element./p> hr> p>Any element whose a idthe-li-element:computed-value hrefhttps://drafts.csswg.org/css-cascade/#computed-value data-x-internalcomputed-value>computed value/a> of a idthe-li-element:display hrefhttps://drafts.csswg.org/css2/visuren.html#display-prop data-x-internaldisplay>display/a> is list-item has a dfn idlist-owner>list owner/dfn>, which is determined as follows:/p> ol>li>p>If the element is not a href#being-rendered idthe-li-element:being-rendered>being rendered/a>, return null; the element has no a href#list-owner idthe-li-element:list-owner-2>list owner/a>./p> li>p>Let var>ancestor/var> be the elements parent.li>p>If the element has an code idthe-li-element:the-ol-element-4>a href#the-ol-element>ol/a>/code>, code idthe-li-element:the-ul-element-4>a href#the-ul-element>ul/a>/code>, or code idthe-li-element:the-menu-element-4>a href#the-menu-element>menu/a>/code> ancestor, set var>ancestor/var> to the closest such ancestor element.li> p>Return the closest inclusive ancestor of var>ancestor/var> that produces a CSS box./p> p classnote>Such an element will always exist, as at the very least the a idthe-li-element:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> will always produce a CSS box./p> /ol> p>To determine the dfn idordinal-value>ordinal value/dfn> of each element owned by a given a href#list-owner idthe-li-element:list-owner-3>list owner/a> var>owner/var>, perform the following steps:/p> ol>li>p>Let var>i/var> be 1.li>p>If var>owner/var> is an code idthe-li-element:the-ol-element-5>a href#the-ol-element>ol/a>/code> element, let var>numbering/var> be var>owner/var>s a href#concept-ol-start idthe-li-element:concept-ol-start>starting value/a>. Otherwise, let var>numbering/var> be 1.li>p>i>Loop:/i> If var>i/var> is greater than the number of a href#list-owner idthe-li-element:list-owner-4>list items that var>owner/var> owns/a>, then abort this algorithm; all of var>owner/var>s a href#list-owner idthe-li-element:list-owner-5>owned list items/a> have been assigned a href#ordinal-value idthe-li-element:ordinal-value-3>ordinal values/a>.li>p>Let var>item/var> be the var>i/var>th of var>owner/var>s a href#list-owner idthe-li-element:list-owner-6>owned list items/a>, in a idthe-li-element:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>./p> li> p>If var>item/var> is an code idthe-li-element:the-li-element-7>a href#the-li-element>li/a>/code> element that has a code idthe-li-element:attr-li-value-2>a href#attr-li-value>value/a>/code> attribute, then:/p> ol>li>p>Let var>parsed/var> be the result of a href#rules-for-parsing-integers idthe-li-element:rules-for-parsing-integers>parsing the value of the attribute as an integer/a>.li>p>If var>parsed/var> is not an error, then set var>numbering/var> to var>parsed/var>./ol> li>p>The a href#ordinal-value idthe-li-element:ordinal-value-4>ordinal value/a> of var>item/var> is var>numbering/var>.li>p>If var>owner/var> is an code idthe-li-element:the-ol-element-6>a href#the-ol-element>ol/a>/code> element, and var>owner/var> has a code idthe-li-element:attr-ol-reversed>a href#attr-ol-reversed>reversed/a>/code> attribute, decrement var>numbering/var> by 1; otherwise, increment var>numbering/var> by 1.li>p>Increment var>i/var> by 1.li>p>Go to the step labeled i>loop/i>./p> /ol> hr> p>The dfn iddom-li-value>code>value/code>/dfn> IDL attribute must a href#reflect idthe-li-element:reflect>reflect/a> the value of the code idthe-li-element:attr-li-value-3>a href#attr-li-value>value/a>/code> content attribute./p> div classexample> p>The elements code idthe-li-element:dom-li-value-2>a href#dom-li-value>value/a>/code> IDL attribute does not directly correspond to its a href#ordinal-value idthe-li-element:ordinal-value-5>ordinal value/a>; it simply a href#reflect idthe-li-element:reflect-2>reflects/a> the content attribute. For example, given this list: pre><ol> <li>Item 1 <li value3>Item 3 <li>Item 4</ol>/pre> p>The a href#ordinal-value idthe-li-element:ordinal-value-6>ordinal values/a> are 1, 3, and 4, whereas the code idthe-li-element:dom-li-value-3>a href#dom-li-value>value/a>/code> IDL attributes return 0, 3, 0 on getting./p> /div> div classexample> p>The following example, the top ten movies are listed (in reverse order). Note the way the list is given a title by using a code idthe-li-element:the-figure-element>a href#the-figure-element>figure/a>/code> element and its code idthe-li-element:the-figcaption-element>a href#the-figcaption-element>figcaption/a>/code> element./p> pre><figure> <figcaption>The top 10 movies of all time</figcaption> <ol> <li value10><cite>Josie and the Pussycats</cite>, 2001</li> <li value9><cite langsh>Црна мачка, бели мачор</cite>, 1998</li> <li value8><cite>A Bugs Life</cite>, 1998</li> <li value7><cite>Toy Story</cite>, 1995</li> <li value6><cite>Monsters, Inc</cite>, 2001</li> <li value5><cite>Cars</cite>, 2006</li> <li value4><cite>Toy Story 2</cite>, 1999</li> <li value3><cite>Finding Nemo</cite>, 2003</li> <li value2><cite>The Incredibles</cite>, 2004</li> <li value1><cite>Ratatouille</cite>, 2007</li> </ol></figure>/pre> p>The markup could also be written as follows, using the code idthe-li-element:attr-ol-reversed-2>a href#attr-ol-reversed>reversed/a>/code> attribute on the code idthe-li-element:the-ol-element-7>a href#the-ol-element>ol/a>/code> element:/p> pre><figure> <figcaption>The top 10 movies of all time</figcaption> <ol reversed> <li><cite>Josie and the Pussycats</cite>, 2001</li> <li><cite langsh>Црна мачка, бели мачор</cite>, 1998</li> <li><cite>A Bugs Life</cite>, 1998</li> <li><cite>Toy Story</cite>, 1995</li> <li><cite>Monsters, Inc</cite>, 2001</li> <li><cite>Cars</cite>, 2006</li> <li><cite>Toy Story 2</cite>, 1999</li> <li><cite>Finding Nemo</cite>, 2003</li> <li><cite>The Incredibles</cite>, 2004</li> <li><cite>Ratatouille</cite>, 2007</li> </ol></figure>/pre> /div> p classnote>While it is conforming to include heading elements (e.g. code idthe-li-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code>) inside code idthe-li-element:the-li-element-8>a href#the-li-element>li/a>/code> elements, it likely does not convey the semantics that the author intended. A heading starts a new section, so a heading in a list implicitly splits the list into spanning multiple sections./p> h4 idthe-dl-element>span classsecno>4.4.9/span> The dfn>code>dl/code>/dfn> elementa href#the-dl-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-dl-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-dl-element:flow-content-2>Flow content/a>.dd>If the elements children include at least one name-value group: a href#palpable-content-2 idthe-dl-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-dl-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-dl-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-dl-element:concept-element-content-model>Content model/a>:dd>Either: Zero or more groups each consisting of one or more code idthe-dl-element:the-dt-element>a href#the-dt-element>dt/a>/code> elements followed by one or more code idthe-dl-element:the-dd-element>a href#the-dd-element>dd/a>/code> elements, optionally intermixed with a href#script-supporting-elements-2 idthe-dl-element:script-supporting-elements-2>script-supporting elements/a>.dd>Or: One or more code idthe-dl-element:the-div-element>a href#the-div-element>div/a>/code> elements, optionally intermixed with a href#script-supporting-elements-2 idthe-dl-element:script-supporting-elements-2-2>script-supporting elements/a>.dt>a href#concept-element-tag-omission idthe-dl-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-dl-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-dl-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-dl-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-dl-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmldlistelement>HTMLDListElement/dfn> : a href#htmlelement idthe-dl-element:htmlelement>HTMLElement/a> { // a href#HTMLDListElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-dl-element:the-dl-element>a href#the-dl-element>dl/a>/code> element a href#represents idthe-dl-element:represents>represents/a> an association list consisting of zero or more name-value groups (a description list). A name-value group consists of one or more names (code idthe-dl-element:the-dt-element-2>a href#the-dt-element>dt/a>/code> elements, possibly as children of a code idthe-dl-element:the-div-element-2>a href#the-div-element>div/a>/code> element child) followed by one or more values (code idthe-dl-element:the-dd-element-2>a href#the-dd-element>dd/a>/code> elements, possibly as children of a code idthe-dl-element:the-div-element-3>a href#the-div-element>div/a>/code> element child), ignoring any nodes other than code idthe-dl-element:the-dt-element-3>a href#the-dt-element>dt/a>/code> and code idthe-dl-element:the-dd-element-3>a href#the-dd-element>dd/a>/code> element children, and code idthe-dl-element:the-dt-element-4>a href#the-dt-element>dt/a>/code> and code idthe-dl-element:the-dd-element-4>a href#the-dd-element>dd/a>/code> elements that are children of code idthe-dl-element:the-div-element-4>a href#the-div-element>div/a>/code> element children. Within a single code idthe-dl-element:the-dl-element-2>a href#the-dl-element>dl/a>/code> element, there should not be more than one code idthe-dl-element:the-dt-element-5>a href#the-dt-element>dt/a>/code> element for each name./p> p>Name-value groups may be terms and definitions, metadata topics and values, questions and answers, or any other groups of name-value data./p> p>The values within a group are alternatives; multiple paragraphs forming part of the same value must all be given within the same code idthe-dl-element:the-dd-element-5>a href#the-dd-element>dd/a>/code> element./p> p>The order of the list of groups, and of the names and values within each group, may be significant./p> p>In order to annotate groups with a href#microdata idthe-dl-element:microdata>microdata/a> attributes, or other a href#global-attributes idthe-dl-element:global-attributes-2>global attributes/a> that apply to whole groups, or just for styling purposes, each group in a code idthe-dl-element:the-dl-element-3>a href#the-dl-element>dl/a>/code> element can be wrapped in a code idthe-dl-element:the-div-element-5>a href#the-div-element>div/a>/code> element. This does not change the semantics of the code idthe-dl-element:the-dl-element-4>a href#the-dl-element>dl/a>/code> element./p> p>The name-value groups of a code idthe-dl-element:the-dl-element-5>a href#the-dl-element>dl/a>/code> element var>dl/var> are determined using the following algorithm. A name-value group has a name (a list of code idthe-dl-element:the-dt-element-6>a href#the-dt-element>dt/a>/code> elements, initially empty) and a value (a list of code idthe-dl-element:the-dd-element-6>a href#the-dd-element>dd/a>/code> elements, initially empty)./p> ol>li>p>Let var>groups/var> be an empty list of name-value groups.li>p>Let var>current/var> be a new name-value group.li>p>Let var>seenDd/var> be false.li>p>Let var>child/var> be var>dl/var>s a idthe-dl-element:first-child hrefhttps://dom.spec.whatwg.org/#concept-tree-first-child data-x-internalfirst-child>first child/a>.li>p>Let var>grandchild/var> be null.li> p>While var>child/var> is not null:/p> ol>li> p>If var>child/var> is a code idthe-dl-element:the-div-element-6>a href#the-div-element>div/a>/code> element, then:/p> ol>li>p>Let var>grandchild/var> be var>child/var>s a idthe-dl-element:first-child-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-first-child data-x-internalfirst-child>first child/a>.li> p>While var>grandchild/var> is not null:/p> ol>li>p>a href#process-dt-or-dd idthe-dl-element:process-dt-or-dd>Process code>dt/code> or code>dd/code>/a> for var>grandchild/var>.li>p>Set var>grandchild/var> to var>grandchild/var>s a idthe-dl-element:next-sibling hrefhttps://dom.spec.whatwg.org/#concept-tree-next-sibling data-x-internalnext-sibling>next sibling/a>./ol> /ol> li>p>Otherwise, a href#process-dt-or-dd idthe-dl-element:process-dt-or-dd-2>process code>dt/code> or code>dd/code>/a> for var>child/var>.li>p>Set var>child/var> to var>child/var>s a idthe-dl-element:next-sibling-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-next-sibling data-x-internalnext-sibling>next sibling/a>./ol> li>p>If var>current/var> is not empty, then append var>current/var> to var>groups/var>.li>p>Return var>groups/var>./ol> p>To dfn idprocess-dt-or-dd>process code>dt/code> or code>dd/code>/dfn> for a node var>node/var> means to follow these steps:/p> ol>li>p>Let var>groups/var>, var>current/var>, and var>seenDd/var> be the same variables as those of the same name in the algorithm that invoked these steps.li> p>If var>node/var> is a code idthe-dl-element:the-dt-element-7>a href#the-dt-element>dt/a>/code> element, then:/p> ol>li>p>If var>seenDd/var> is true, then append var>current/var> to var>groups/var>, set var>current/var> to a new name-value group, and set var>seenDd/var> to false.li>p>Append var>node/var> to var>current/var>s name./ol> li>p>Otherwise, if var>node/var> is a code idthe-dl-element:the-dd-element-7>a href#the-dd-element>dd/a>/code> element, then append var>node/var> to var>current/var>s value and set var>seenDd/var> to true./ol> p classnote>When a name-value group has an empty list as name or value, it is often due to accidentally using code idthe-dl-element:the-dd-element-8>a href#the-dd-element>dd/a>/code> elements in the place of code idthe-dl-element:the-dt-element-8>a href#the-dt-element>dt/a>/code> elements and vice versa. Conformance checkers can spot such mistakes and might be able to advise authors how to correctly use the markup./p> div classexample> p>In the following example, one entry (Authors) is linked to two values (John and Luke)./p> pre><dl> <dt> Authors <dd> John <dd> Luke <dt> Editor <dd> Frank</dl>/pre> /div> div classexample> p>In the following example, one definition is linked to two terms./p> pre><dl> <dt langen-US> <dfn>color</dfn> </dt> span langen-GB><dt langen-GB> <dfn>colour</dfn> </dt>/span> <dd> A sensation which (in humans) derives from the ability of the fine structure of the eye to distinguish three differently filtered analyses of a view. </dd></dl>/pre> /div> div classexample> p>The following example illustrates the use of the code idthe-dl-element:the-dl-element-6>a href#the-dl-element>dl/a>/code> element to mark up metadata of sorts. At the end of the example, one group has two metadata labels (Authors and Editors) and two values (Robert Rothman and Daniel Jackson). This example also uses the code idthe-dl-element:the-div-element-7>a href#the-div-element>div/a>/code> element around the groups of code idthe-dl-element:the-dt-element-9>a href#the-dt-element>dt/a>/code> and code idthe-dl-element:the-dd-element-9>a href#the-dd-element>dd/a>/code> element, to aid with styling./p> pre><dl> <div> <dt> Last modified time </dt> <dd> 2004-12-23T23:33Z </dd> </div> <div> <dt> Recommended update interval </dt> <dd> 60s </dd> </div> <div> <dt> Authors </dt> <dt> Editors </dt> <dd> Robert Rothman </dd> <dd> Daniel Jackson </dd> </div></dl>/pre> /div> div classexample> p>The following example shows the code idthe-dl-element:the-dl-element-7>a href#the-dl-element>dl/a>/code> element used to give a set of instructions. The order of the instructions here is important (in the other examples, the order of the blocks was not important)./p> pre><p>Determine the victory points as follows (use thefirst matching case):</p><dl> <dt> If you have exactly five gold coins </dt> <dd> You get five victory points </dd> <dt> If you have one or more gold coins, and you have one or more silver coins </dt> <dd> You get two victory points </dd> <dt> If you have one or more silver coins </dt> <dd> You get one victory point </dd> <dt> Otherwise </dt> <dd> You get no victory points </dd></dl>/pre> /div> div classexample> p>The following snippet shows a code idthe-dl-element:the-dl-element-8>a href#the-dl-element>dl/a>/code> element being used as a glossary. Note the use of code idthe-dl-element:the-dfn-element>a href#the-dfn-element>dfn/a>/code> to indicate the word being defined./p> pre><dl> <dt><dfn>Apartment</dfn>, n.</dt> <dd>An execution context grouping one or more threads with one or more COM objects.</dd> <dt><dfn>Flat</dfn>, n.</dt> <dd>A deflated tire.</dd> <dt><dfn>Home</dfn>, n.</dt> <dd>The users login directory.</dd></dl>/pre> /div> div classexample> p>This example uses a href#microdata idthe-dl-element:microdata-2>microdata/a> attributes in a code idthe-dl-element:the-dl-element-9>a href#the-dl-element>dl/a>/code> element, together with the code idthe-dl-element:the-div-element-8>a href#the-div-element>div/a>/code> element, to annotate the ice cream desserts at a French restaurant./p> pre langfr><dl> <div itemscope itemtypehttp://schema.org/Product> <dt itempropname>Café ou Chocolat Liégeois <dd itempropoffers itemscope itemtypehttp://schema.org/Offer> <span itempropprice>3.50</span> <data itemproppriceCurrency valueEUR>€</data> <dd itempropdescription> 2 boules Café ou Chocolat, 1 boule Vanille, sause café ou chocolat, chantilly </div> <div itemscope itemtypehttp://schema.org/Product> <dt itempropname>Américaine <dd itempropoffers itemscope itemtypehttp://schema.org/Offer> <span itempropprice>3.50</span> <data itemproppriceCurrency valueEUR>€</data> <dd itempropdescription> 1 boule Crème brûlée, 1 boule Vanille, 1 boule Caramel, chantilly </div></dl>/pre> p>Without the code idthe-dl-element:the-div-element-9>a href#the-div-element>div/a>/code> element the markup would need to use the code idthe-dl-element:attr-itemref>a href#attr-itemref>itemref/a>/code> attribute to link the data in the code idthe-dl-element:the-dd-element-10>a href#the-dd-element>dd/a>/code> elements with the item, as follows./p> pre langfr><dl> <dt itemscope itemtypehttp://schema.org/Product itemref1-offer 1-description> <span itempropname>Café ou Chocolat Liégeois</span> <dd id1-offer itempropoffers itemscope itemtypehttp://schema.org/Offer> <span itempropprice>3.50</span> <data itemproppriceCurrency valueEUR>€</data> <dd id1-description itempropdescription> 2 boules Café ou Chocolat, 1 boule Vanille, sause café ou chocolat, chantilly <dt itemscope itemtypehttp://schema.org/Product itemref2-offer 2-description> <span itempropname>Américaine</span> <dd id2-offer itempropoffers itemscope itemtypehttp://schema.org/Offer> <span itempropprice>3.50</span> <data itemproppriceCurrency valueEUR>€</data> <dd id2-description itempropdescription> 1 boule Crème brûlée, 1 boule Vanille, 1 boule Caramel, chantilly</dl>/pre> /div> p classnote>The code idthe-dl-element:the-dl-element-10>a href#the-dl-element>dl/a>/code> element is inappropriate for marking up dialogue. See some a href#conversations>examples of how to mark up dialogue/a>./p> h4 idthe-dt-element>span classsecno>4.4.10/span> The dfn>code>dt/code>/dfn> elementa href#the-dt-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-dt-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-dt-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Before code idthe-dt-element:the-dd-element>a href#the-dd-element>dd/a>/code> or code idthe-dt-element:the-dt-element>a href#the-dt-element>dt/a>/code> elements inside code idthe-dt-element:the-dl-element>a href#the-dl-element>dl/a>/code> elements.dd>Before code idthe-dt-element:the-dd-element-2>a href#the-dd-element>dd/a>/code> or code idthe-dt-element:the-dt-element-2>a href#the-dt-element>dt/a>/code> elements inside code idthe-dt-element:the-div-element>a href#the-div-element>div/a>/code> elements that are children of a code idthe-dt-element:the-dl-element-2>a href#the-dl-element>dl/a>/code> element.dt>a href#concept-element-content-model idthe-dt-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-dt-element:flow-content-2>Flow content/a>, but with no code idthe-dt-element:the-header-element>a href#the-header-element>header/a>/code>, code idthe-dt-element:the-footer-element>a href#the-footer-element>footer/a>/code>, a href#sectioning-content-2 idthe-dt-element:sectioning-content-2>sectioning content/a>, or a href#heading-content-2 idthe-dt-element:heading-content-2>heading content/a> descendants.dt>a href#concept-element-tag-omission idthe-dt-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>A code idthe-dt-element:the-dt-element-3>a href#the-dt-element>dt/a>/code> elements a href#syntax-end-tag idthe-dt-element:syntax-end-tag>end tag/a> can be omitted if the code idthe-dt-element:the-dt-element-4>a href#the-dt-element>dt/a>/code> element is immediately followed by another code idthe-dt-element:the-dt-element-5>a href#the-dt-element>dt/a>/code> element or a code idthe-dt-element:the-dd-element-3>a href#the-dd-element>dd/a>/code> element.dt>a href#concept-element-attributes idthe-dt-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-dt-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-dt-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-dt-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-dt-element:the-dt-element-6>a href#the-dt-element>dt/a>/code> element a href#represents idthe-dt-element:represents>represents/a> the term, or name, part of a term-description group in a description list (code idthe-dt-element:the-dl-element-3>a href#the-dl-element>dl/a>/code> element)./p> p classnote>The code idthe-dt-element:the-dt-element-7>a href#the-dt-element>dt/a>/code> element itself, when used in a code idthe-dt-element:the-dl-element-4>a href#the-dl-element>dl/a>/code> element, does not indicate that its contents are a term being defined, but this can be indicated using the code idthe-dt-element:the-dfn-element>a href#the-dfn-element>dfn/a>/code> element./p> div classexample> p>This example shows a list of frequently asked questions (a FAQ) marked up using the code idthe-dt-element:the-dt-element-8>a href#the-dt-element>dt/a>/code> element for questions and the code idthe-dt-element:the-dd-element-4>a href#the-dd-element>dd/a>/code> element for answers./p> pre><article> <h1>FAQ</h1> <dl> <dt>What do we want?</dt> <dd>Our data.</dd> <dt>When do we want it?</dt> <dd>Now.</dd> <dt>Where is it?</dt> <dd>We are not sure.</dd> </dl></article>/pre> /div> h4 idthe-dd-element>span classsecno>4.4.11/span> The dfn>code>dd/code>/dfn> elementa href#the-dd-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-dd-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-dd-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>After code idthe-dd-element:the-dt-element>a href#the-dt-element>dt/a>/code> or code idthe-dd-element:the-dd-element>a href#the-dd-element>dd/a>/code> elements inside code idthe-dd-element:the-dl-element>a href#the-dl-element>dl/a>/code> elements.dd>After code idthe-dd-element:the-dt-element-2>a href#the-dt-element>dt/a>/code> or code idthe-dd-element:the-dd-element-2>a href#the-dd-element>dd/a>/code> elements inside code idthe-dd-element:the-div-element>a href#the-div-element>div/a>/code> elements that are children of a code idthe-dd-element:the-dl-element-2>a href#the-dl-element>dl/a>/code> element.dt>a href#concept-element-content-model idthe-dd-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-dd-element:flow-content-2>Flow content/a>.dt>a href#concept-element-tag-omission idthe-dd-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>A code idthe-dd-element:the-dd-element-3>a href#the-dd-element>dd/a>/code> elements a href#syntax-end-tag idthe-dd-element:syntax-end-tag>end tag/a> can be omitted if the code idthe-dd-element:the-dd-element-4>a href#the-dd-element>dd/a>/code> element is immediately followed by another code idthe-dd-element:the-dd-element-5>a href#the-dd-element>dd/a>/code> element or a code idthe-dd-element:the-dt-element-3>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 idthe-dd-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-dd-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-dd-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-dd-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-dd-element:the-dd-element-6>a href#the-dd-element>dd/a>/code> element a href#represents idthe-dd-element:represents>represents/a> the description, definition, or value, part of a term-description group in a description list (code idthe-dd-element:the-dl-element-3>a href#the-dl-element>dl/a>/code> element)./p> div classexample> p>A code idthe-dd-element:the-dl-element-4>a href#the-dl-element>dl/a>/code> can be used to define a vocabulary list, like in a dictionary. In the following example, each entry, given by a code idthe-dd-element:the-dt-element-4>a href#the-dt-element>dt/a>/code> with a code idthe-dd-element:the-dfn-element>a href#the-dfn-element>dfn/a>/code>, has several code idthe-dd-element:the-dd-element-7>a href#the-dd-element>dd/a>/code>s, showing the various parts of the definition./p> pre><dl> <dt><dfn>happiness</dfn></dt> <dd classpronunciation>/hæ p. nes/</dd> <dd classpart-of-speech><i><abbr>n.</abbr></i></dd> <dd>The state of being happy.</dd> <dd>Good fortune; success. <q>Oh <b>happiness</b>! It worked!</q></dd> <dt><dfn>rejoice</dfn></dt> <dd classpronunciation>/ri jois/</dd> <dd><i classpart-of-speech><abbr>v.intr.</abbr></i> To be delighted oneself.</dd> <dd><i classpart-of-speech><abbr>v.tr.</abbr></i> To cause one to be delighted.</dd></dl>/pre> /div> h4 idthe-figure-element>span classsecno>4.4.12/span> The dfn>code>figure/code>/dfn> elementa href#the-figure-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-figure-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-figure-element:flow-content-2>Flow content/a>.dd>a href#sectioning-root idthe-figure-element:sectioning-root>Sectioning root/a>.dd>a href#palpable-content-2 idthe-figure-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-figure-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-figure-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-figure-element:concept-element-content-model>Content model/a>:dd>Either: One code idthe-figure-element:the-figcaption-element>a href#the-figcaption-element>figcaption/a>/code> element followed by a href#flow-content-2 idthe-figure-element:flow-content-2-3>flow content/a>.dd>Or: a href#flow-content-2 idthe-figure-element:flow-content-2-4>Flow content/a> followed by one code idthe-figure-element:the-figcaption-element-2>a href#the-figcaption-element>figcaption/a>/code> element.dd>Or: a href#flow-content-2 idthe-figure-element:flow-content-2-5>Flow content/a>.dt>a href#concept-element-tag-omission idthe-figure-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-figure-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-figure-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-figure-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-figure-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-figure-element:the-figure-element>a href#the-figure-element>figure/a>/code> element a href#represents idthe-figure-element:represents>represents/a> some a href#flow-content-2 idthe-figure-element:flow-content-2-6>flow content/a>, optionally with a caption, that is self-contained (like a complete sentence) and is typically a href#referenced idthe-figure-element:referenced>referenced/a> as a single unit from the main flow of the document./p> p classnote>Self-contained in this context does not necessarily mean independent. For example, each sentence in a paragraph is self-contained; an image that is part of a sentence would be inappropriate for code idthe-figure-element:the-figure-element-2>a href#the-figure-element>figure/a>/code>, but an entire sentence made of images would be fitting./p> p>The element can thus be used to annotate illustrations, diagrams, photos, code listings, etc./p> div idfigure-note-about-references classnote> p>When a code idthe-figure-element:the-figure-element-3>a href#the-figure-element>figure/a>/code> is referred to from the main content of the document by identifying it by its caption (e.g. by figure number), it enables such content to be easily moved away from that primary content, e.g. to the side of the page, to dedicated pages, or to an appendix, without affecting the flow of the document./p> p>If a code idthe-figure-element:the-figure-element-4>a href#the-figure-element>figure/a>/code> element is a href#referenced idthe-figure-element:referenced-2>referenced/a> by its relative position, e.g. in the photograph above or as the next figure shows, then moving the figure would disrupt the pages meaning. Authors are encouraged to consider using labels to refer to figures, rather than using such relative references, so that the page can easily be restyled without affecting the pages meaning./p> /div> p>The first code idthe-figure-element:the-figcaption-element-3>a href#the-figcaption-element>figcaption/a>/code> element child of the element, if any, represents the caption of the code idthe-figure-element:the-figure-element-5>a href#the-figure-element>figure/a>/code> elements contents. If there is no child code idthe-figure-element:the-figcaption-element-4>a href#the-figcaption-element>figcaption/a>/code> element, then there is no caption./p> p>A code idthe-figure-element:the-figure-element-6>a href#the-figure-element>figure/a>/code> elements contents are part of the surrounding flow. If the purpose of the page is to display the figure, for example a photograph on an image sharing site, the code idthe-figure-element:the-figure-element-7>a href#the-figure-element>figure/a>/code> and code idthe-figure-element:the-figcaption-element-5>a href#the-figcaption-element>figcaption/a>/code> elements can be used to explicitly provide a caption for that figure. For content that is only tangentially related, or that serves a separate purpose than the surrounding flow, the code idthe-figure-element:the-aside-element>a href#the-aside-element>aside/a>/code> element should be used (and can itself wrap a code idthe-figure-element:the-figure-element-8>a href#the-figure-element>figure/a>/code>). For example, a pull quote that repeats content from an code idthe-figure-element:the-article-element>a href#the-article-element>article/a>/code> would be more appropriate in an code idthe-figure-element:the-aside-element-2>a href#the-aside-element>aside/a>/code> than in a code idthe-figure-element:the-figure-element-9>a href#the-figure-element>figure/a>/code>, because it isnt part of the content, its a repetition of the content for the purposes of enticing readers or highlighting key topics./p> div classexample> p>This example shows the code idthe-figure-element:the-figure-element-10>a href#the-figure-element>figure/a>/code> element to mark up a code listing./p> pre><p>In <a href#l4>listing 4</a> we see the primary core interfaceAPI declaration.</p><figure idl4> <figcaption>Listing 4. The primary core interface API declaration.</figcaption> <pre><code>interface PrimaryCore { boolean verifyDataLine(); void sendData(in sequence<byte> data); void initSelfDestruct();}</code></pre></figure><p>The API is designed to use UTF-8.</p>/pre> /div> div classexample> p>Here we see a code idthe-figure-element:the-figure-element-11>a href#the-figure-element>figure/a>/code> element to mark up a photo that is the main content of the page (as in a gallery)./p> pre><!DOCTYPE HTML><html langen><title>Bubbles at work — My Gallery™</title><figure> <img srcbubbles-work.jpeg altBubbles, sitting in his office chair, works on his latest project intently.> <figcaption>Bubbles at work</figcaption></figure><nav><a href19414.html>Prev</a> — <a href19416.html>Next</a></nav>/pre> /div> div classexample> p>In this example, we see an image that is em>not/em> a figure, as well as an image and a video that are. The first image is literally part of the examples second sentence, so its not a self-contained unit, and thus code idthe-figure-element:the-figure-element-12>a href#the-figure-element>figure/a>/code> would be inappropriate./p> pre><h2>Malinkos comics</h2><p>This case centered on some sort of intellectual propertyinfringement related to a comic (see Exhibit A). The suit startedafter a trailer ending with these words:<blockquote> <img srcpromblem-packed-action.png altROUGH COPY! Promblem-Packed Action!></blockquote><p>...was aired. A lawyer, armed with a Bigger Notebook, launched apreemptive strike using snowballs. A complete copy of the trailer isincluded with Exhibit B.<figure> <img srcex-a.png altTwo squiggles on a dirty piece of paper.> <figcaption>Exhibit A. The alleged <cite>rough copy</cite> comic.</figcaption></figure><figure> <video srcex-b.mov></video> <figcaption>Exhibit B. The <cite>Rough Copy</cite> trailer.</figcaption></figure><p>The case was resolved out of court./pre> /div> div classexample> p>Here, a part of a poem is marked up using code idthe-figure-element:the-figure-element-13>a href#the-figure-element>figure/a>/code>./p> pre><figure> <p>Twas brillig, and the slithy toves<br> Did gyre and gimble in the wabe;<br> All mimsy were the borogoves,<br> And the mome raths outgrabe.</p> <figcaption><cite>Jabberwocky</cite> (first verse). Lewis Carroll, 1832-98</figcaption></figure>/pre> /div> div classexample> p>In this example, which could be part of a much larger work discussing a castle, nested code idthe-figure-element:the-figure-element-14>a href#the-figure-element>figure/a>/code> elements are used to provide both a group caption and individual captions for each figure in the group:/p> pre><figure> <figcaption>The castle through the ages: 1423, 1858, and 1999 respectively.</figcaption> <figure> <figcaption>Etching. Anonymous, ca. 1423.</figcaption> <img srccastle1423.jpeg altThe castle has one tower, and a tall wall around it.> </figure> <figure> <figcaption>Oil-based paint on canvas. Maria Towle, 1858.</figcaption> <img srccastle1858.jpeg altThe castle now has two towers and two walls.> </figure> <figure> <figcaption>Film photograph. Peter Jankle, 1999.</figcaption> <img srccastle1999.jpeg altThe castle lies in ruins, the original tower all that remains in one piece.> </figure></figure>/pre> /div> div classexample> p>The previous example could also be more succinctly written as follows (using code idthe-figure-element:attr-title>a href#attr-title>title/a>/code> attributes in place of the nested code idthe-figure-element:the-figure-element-15>a href#the-figure-element>figure/a>/code>/code idthe-figure-element:the-figcaption-element-6>a href#the-figcaption-element>figcaption/a>/code> pairs):/p> pre><figure> <img srccastle1423.jpeg titleEtching. Anonymous, ca. 1423. altThe castle has one tower, and a tall wall around it.> <img srccastle1858.jpeg titleOil-based paint on canvas. Maria Towle, 1858. altThe castle now has two towers and two walls.> <img srccastle1999.jpeg titleFilm photograph. Peter Jankle, 1999. altThe castle lies in ruins, the original tower all that remains in one piece.> <figcaption>The castle through the ages: 1423, 1858, and 1999 respectively.</figcaption></figure>/pre> /div> div classexample> p>The figure is sometimes a href#referenced idthe-figure-element:referenced-3>referenced/a> only implicitly from the content:/p> pre><article> <h1>Fiscal negotiations stumble in Congress as deadline nears</h1> <figure> <img srcobama-reid.jpeg altObama and Reid sit together smiling in the Oval Office.> <figcaption>Barack Obama and Harry Reid. White House press photograph.</figcaption> </figure> <p>Negotiations in Congress to end the fiscal impasse sputtered on Tuesday, leaving both chambers grasping for a way to reopen the government and raise the countrys borrowing authority with a Thursday deadline drawing near.</p> ...</article>/pre> /div> h4 idthe-figcaption-element>span classsecno>4.4.13/span> The dfn>code>figcaption/code>/dfn> elementa href#the-figcaption-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-figcaption-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-figcaption-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As the first or last child of a code idthe-figcaption-element:the-figure-element>a href#the-figure-element>figure/a>/code> element.dt>a href#concept-element-content-model idthe-figcaption-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-figcaption-element:flow-content-2>Flow content/a>.dt>a href#concept-element-tag-omission idthe-figcaption-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-figcaption-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-figcaption-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-figcaption-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-figcaption-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-figcaption-element:the-figcaption-element>a href#the-figcaption-element>figcaption/a>/code> element a href#represents idthe-figcaption-element:represents>represents/a> a caption or legend for the rest of the contents of the code idthe-figcaption-element:the-figcaption-element-2>a href#the-figcaption-element>figcaption/a>/code> elements parent code idthe-figcaption-element:the-figure-element-2>a href#the-figure-element>figure/a>/code> element, if any./p> h4 idthe-main-element>span classsecno>4.4.14/span> The dfn>code>main/code>/dfn> elementa href#the-main-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-main-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-main-element:flow-content-2>Flow content/a>.dd>a href#palpable-content-2 idthe-main-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-main-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-main-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-main-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-main-element:flow-content-2-3>Flow content/a>.dt>a href#concept-element-tag-omission idthe-main-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-main-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-main-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-main-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-main-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-main-element:the-main-element>a href#the-main-element>main/a>/code> element can be used as a container for the dominant contents of another element. It a href#represents idthe-main-element:represents>represents/a> its children./p> p classnote>The code idthe-main-element:the-main-element-2>a href#the-main-element>main/a>/code> element is distinct from the code idthe-main-element:the-section-element>a href#the-section-element>section/a>/code> and code idthe-main-element:the-article-element>a href#the-article-element>article/a>/code> elements in that the code idthe-main-element:the-main-element-3>a href#the-main-element>main/a>/code> element does not contribute to the document a href#outline idthe-main-element:outline>outline/a>./p> p classnote>There is no restriction as to the number of code idthe-main-element:the-main-element-4>a href#the-main-element>main/a>/code> elements in a document. Indeed, there are many cases where it would make sense to have multiple code idthe-main-element:the-main-element-5>a href#the-main-element>main/a>/code> elements. For example, a page with multiple code idthe-main-element:the-article-element-2>a href#the-article-element>article/a>/code> elements might need to indicate the dominant contents of each such element./p> div classexample> p>In this example, the author has used a presentation where each component of the page is rendered in a box. To wrap the main content of the page (as opposed to the header, the footer, the navigation bar, and a sidebar), the code idthe-main-element:the-main-element-6>a href#the-main-element>main/a>/code> element is used./p> pre><!DOCTYPE html><html langen><title>RPG System 17</title><style> header, nav, aside, main, footer { margin: 0.5em; border: thin solid; padding: 0.5em; background: #EFF; color: black; box-shadow: 0 0 0.25em #033; } h1, h2, p { margin: 0; } nav, main { float: left; } aside { float: right; } footer { clear: both; }</style><header> <h1>System Eighteen</h1></header><nav> <a href../16/>← System 17</a> <a href../18/>RPXIX →</a></nav><aside> <p>This system has no HP mechanic, so theres no healing.</aside><main> <h2>Character creation</h2> <p>Attributes (magic, strength, agility) are purchased at the cost of one point per level.</p> <h2>Rolls</h2> <p>Each encounter, roll the dice for all your skills. If you roll more than the opponent, you win.</p></main><footer> <p>Copyright © 2013</footer></html>/pre> /div> h4 idthe-div-element>span classsecno>4.4.15/span> The dfn>code>div/code>/dfn> elementa href#the-div-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-div-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-div-element:flow-content-2>Flow content/a>.dd>a href#palpable-content-2 idthe-div-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-div-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-div-element:flow-content-2-2>flow content/a> is expected.dd>As a child of a code idthe-div-element:the-dl-element>a href#the-dl-element>dl/a>/code> element.dt>a href#concept-element-content-model idthe-div-element:concept-element-content-model>Content model/a>:dd>If the element is a child of a code idthe-div-element:the-dl-element-2>a href#the-dl-element>dl/a>/code> element: one or more code idthe-div-element:the-dt-element>a href#the-dt-element>dt/a>/code> elements followed by one or more code idthe-div-element:the-dd-element>a href#the-dd-element>dd/a>/code> elements, optionally intermixed with a href#script-supporting-elements-2 idthe-div-element:script-supporting-elements-2>script-supporting elements/a>.dd>If the element is not a child of a code idthe-div-element:the-dl-element-3>a href#the-dl-element>dl/a>/code> element: a href#flow-content-2 idthe-div-element:flow-content-2-3>Flow content/a>.dt>a href#concept-element-tag-omission idthe-div-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-div-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-div-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-div-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-div-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmldivelement>HTMLDivElement/dfn> : a href#htmlelement idthe-div-element:htmlelement>HTMLElement/a> { // a href#HTMLDivElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-div-element:the-div-element>a href#the-div-element>div/a>/code> element has no special meaning at all. It a href#represents idthe-div-element:represents>represents/a> its children. It can be used with the code idthe-div-element:classes>a href#classes>class/a>/code>, code idthe-div-element:attr-lang>a href#attr-lang>lang/a>/code>, and code idthe-div-element:attr-title>a href#attr-title>title/a>/code> attributes to mark up semantics common to a group of consecutive elements. It can also be used in a code idthe-div-element:the-dl-element-4>a href#the-dl-element>dl/a>/code> element, wrapping groups of code idthe-div-element:the-dt-element-2>a href#the-dt-element>dt/a>/code> and code idthe-div-element:the-dd-element-2>a href#the-dd-element>dd/a>/code> elements./p> p classnote>Authors are strongly encouraged to view the code idthe-div-element:the-div-element-2>a href#the-div-element>div/a>/code> element as an element of last resort, for when no other element is suitable. Use of more appropriate elements instead of the code idthe-div-element:the-div-element-3>a href#the-div-element>div/a>/code> element leads to better accessibility for readers and easier maintainability for authors./p> div classexample> p>For example, a blog post would be marked up using code idthe-div-element:the-article-element>a href#the-article-element>article/a>/code>, a chapter using code idthe-div-element:the-section-element>a href#the-section-element>section/a>/code>, a pages navigation aids using code idthe-div-element:the-nav-element>a href#the-nav-element>nav/a>/code>, and a group of form controls using code idthe-div-element:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code>./p> p>On the other hand, code idthe-div-element:the-div-element-4>a href#the-div-element>div/a>/code> elements can be useful for stylistic purposes or to wrap multiple paragraphs within a section that are all to be annotated in a similar way. In the following example, we see code idthe-div-element:the-div-element-5>a href#the-div-element>div/a>/code> elements used as a way to set the language of two paragraphs at once, instead of setting the language on the two paragraph elements separately:/p> pre><article langen-US> <h1>My use of language and my cats</h1> <p>My cats behavior hasnt changed much since her absence, except that she plays her new physique to the neighbors regularly, in an attempt to get pets.</p> <div langen-GB> <p>My other cat, coloured black and white, is a sweetie. He followed us to the pool today, walking down the pavement with us. Yesterday he apparently visited our neighbours. I wonder if he recognises that their flat is a mirror image of ours.</p> <p>Hm, I just noticed that in the last paragraph I used British English. But Im supposed to write in American English. So I shouldnt say pavement or flat or colour...</p> </div> <p>I should say sidewalk and apartment and color!</p></article>/pre> /div> h3 idtext-level-semantics>span classsecno>4.5/span> Text-level semanticsa href#text-level-semantics classself-link>/a>/h3> h4 idthe-a-element data-dfn-typeelement data-lta>span classsecno>4.5.1/span> The dfn>code>a/code>/dfn> elementa href#the-a-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-a-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-a-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-a-element:phrasing-content-2>Phrasing content/a>.dd>If the element has an code idthe-a-element:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute: a href#interactive-content-2 idthe-a-element:interactive-content-2>Interactive content/a>.dd>a href#palpable-content-2 idthe-a-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-a-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-a-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-a-element:concept-element-content-model>Content model/a>:dd>a href#transparent idthe-a-element:transparent>Transparent/a>, but there must be no a href#interactive-content-2 idthe-a-element:interactive-content-2-2>interactive content/a> or code idthe-a-element:the-a-element>a href#the-a-element>a/a>/code> element descendants.dt>a href#concept-element-tag-omission idthe-a-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-a-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-a-element:global-attributes>Global attributes/a>dd>code idthe-a-element:attr-hyperlink-href-2>a href#attr-hyperlink-href>href/a>/code> — Address of the a href#hyperlink idthe-a-element:hyperlink>hyperlink/a>dd>code idthe-a-element:attr-hyperlink-target>a href#attr-hyperlink-target>target/a>/code> — a href#browsing-context idthe-a-element:browsing-context>Browsing context/a> for a href#hyperlink idthe-a-element:hyperlink-2>hyperlink/a> a href#navigate idthe-a-element:navigate>navigation/a>dd>code idthe-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 sodd>code idthe-a-element:ping>a href#ping>ping/a>/code> — a hrefhttps://url.spec.whatwg.org/#concept-url idthe-a-element:url data-x-internalurl>URLs/a> to pingdd>code idthe-a-element:attr-hyperlink-rel>a href#attr-hyperlink-rel>rel/a>/code> — Relationship between the location in the document containing the a href#hyperlink idthe-a-element:hyperlink-3>hyperlink/a> and the destination resourcedd>code idthe-a-element:attr-hyperlink-hreflang>a href#attr-hyperlink-hreflang>hreflang/a>/code> — Language of the linked resourcedd>code idthe-a-element:attr-hyperlink-type>a href#attr-hyperlink-type>type/a>/code> — Hint for the type of the referenced resourcedd>code idthe-a-element:attr-hyperlink-referrerpolicy>a href#attr-hyperlink-referrerpolicy>referrerpolicy/a>/code> — a idthe-a-element:referrer-policy hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>Referrer policy/a> for a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idthe-a-element:concept-fetch data-x-internalconcept-fetch>fetches/a> initiated by the elementdt>a href#concept-element-dom idthe-a-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-a-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlanchorelement>HTMLAnchorElement/dfn> : a href#htmlelement idthe-a-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-a-element:cereactions>CEReactions/a> attribute DOMString a href#dom-a-target idthe-a-element:dom-a-target>target/a>; a href#cereactions idthe-a-element:cereactions-2>CEReactions/a> attribute DOMString a href#dom-a-download idthe-a-element:dom-a-download>download/a>; a href#cereactions idthe-a-element:cereactions-3>CEReactions/a> attribute USVString a href#dom-a-ping idthe-a-element:dom-a-ping>ping/a>; a href#cereactions idthe-a-element:cereactions-4>CEReactions/a> attribute DOMString a href#dom-a-rel idthe-a-element:dom-a-rel>rel/a>; SameObject, PutForwardsa hrefhttps://dom.spec.whatwg.org/#dom-domtokenlist-value idthe-a-element:dom-domtokenlist-value data-x-internaldom-domtokenlist-value>value/a> readonly attribute a idthe-a-element:domtokenlist hrefhttps://dom.spec.whatwg.org/#interface-domtokenlist data-x-internaldomtokenlist>DOMTokenList/a> a href#dom-a-rellist idthe-a-element:dom-a-rellist>relList/a>; a href#cereactions idthe-a-element:cereactions-5>CEReactions/a> attribute DOMString a href#dom-a-hreflang idthe-a-element:dom-a-hreflang>hreflang/a>; a href#cereactions idthe-a-element:cereactions-6>CEReactions/a> attribute DOMString a href#dom-a-type idthe-a-element:dom-a-type>type/a>; a href#cereactions idthe-a-element:cereactions-7>CEReactions/a> attribute DOMString a href#dom-a-text idthe-a-element:dom-a-text>text/a>; a href#cereactions idthe-a-element:cereactions-8>CEReactions/a> attribute DOMString a href#dom-a-referrerpolicy idthe-a-element:dom-a-referrerpolicy>referrerPolicy/a>; // a href#HTMLAnchorElement-partial>also has obsolete members/a>};a href#htmlanchorelement idthe-a-element:htmlanchorelement>HTMLAnchorElement/a> implements a href#htmlhyperlinkelementutils idthe-a-element:htmlhyperlinkelementutils>HTMLHyperlinkElementUtils/a>;/pre> /dl> p>If the code idthe-a-element:the-a-element-2>a href#the-a-element>a/a>/code> element has an code idthe-a-element:attr-hyperlink-href-3>a href#attr-hyperlink-href>href/a>/code> attribute, then it a href#represents idthe-a-element:represents>represents/a> a a href#hyperlink idthe-a-element:hyperlink-4>hyperlink/a> (a hypertext anchor) labeled by its contents./p> p>If the code idthe-a-element:the-a-element-3>a href#the-a-element>a/a>/code> element has no code idthe-a-element:attr-hyperlink-href-4>a href#attr-hyperlink-href>href/a>/code> attribute, then the element a href#represents idthe-a-element:represents-2>represents/a> a placeholder for where a link might otherwise have been placed, if it had been relevant, consisting of just the elements contents./p> p>The code idthe-a-element:attr-hyperlink-target-2>a href#attr-hyperlink-target>target/a>/code>, code idthe-a-element:attr-hyperlink-download-2>a href#attr-hyperlink-download>download/a>/code>, code idthe-a-element:ping-2>a href#ping>ping/a>/code>, code idthe-a-element:attr-hyperlink-rel-2>a href#attr-hyperlink-rel>rel/a>/code>, code idthe-a-element:attr-hyperlink-hreflang-2>a href#attr-hyperlink-hreflang>hreflang/a>/code>, code idthe-a-element:attr-hyperlink-type-2>a href#attr-hyperlink-type>type/a>/code>, and code idthe-a-element:attr-hyperlink-referrerpolicy-2>a href#attr-hyperlink-referrerpolicy>referrerpolicy/a>/code> attributes must be omitted if the code idthe-a-element:attr-hyperlink-href-5>a href#attr-hyperlink-href>href/a>/code> attribute is not present./p> p>If the code idthe-a-element:names:-the-itemprop-attribute>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute is specified on an code idthe-a-element:the-a-element-4>a href#the-a-element>a/a>/code> element, then the code idthe-a-element:attr-hyperlink-href-6>a href#attr-hyperlink-href>href/a>/code> attribute must also be specified./p> div classexample> p>If a site uses a consistent navigation toolbar on every page, then the link that would normally link to the page itself could be marked up using an code idthe-a-element:the-a-element-5>a href#the-a-element>a/a>/code> element:/p> pre><nav> <ul> <li> <a href/>Home</a> </li> <li> <a href/news>News</a> </li> <li> <a>Examples</a> </li> <li> <a href/legal>Legal</a> </li> </ul></nav>/pre> /div> p>The code idthe-a-element:attr-hyperlink-href-7>a href#attr-hyperlink-href>href/a>/code>, code idthe-a-element:attr-hyperlink-target-3>a href#attr-hyperlink-target>target/a>/code>, code idthe-a-element:attr-hyperlink-download-3>a href#attr-hyperlink-download>download/a>/code>, code idthe-a-element:ping-3>a href#ping>ping/a>/code>, and code idthe-a-element:attr-hyperlink-referrerpolicy-3>a href#attr-hyperlink-referrerpolicy>referrerpolicy/a>/code> attributes affect what happens when users a href#following-hyperlinks-2 idthe-a-element:following-hyperlinks-2>follow hyperlinks/a> or a href#downloading-hyperlinks idthe-a-element:downloading-hyperlinks>download hyperlinks/a> created using the code idthe-a-element:the-a-element-6>a href#the-a-element>a/a>/code> element. The code idthe-a-element:attr-hyperlink-rel-3>a href#attr-hyperlink-rel>rel/a>/code>, code idthe-a-element:attr-hyperlink-hreflang-3>a href#attr-hyperlink-hreflang>hreflang/a>/code>, and code idthe-a-element:attr-hyperlink-type-3>a href#attr-hyperlink-type>type/a>/code> attributes may be used to indicate to the user the likely nature of the target resource before the user follows the link./p> p>The a idthe-a-element:activation-behaviour hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a> of code idthe-a-element:the-a-element-7>a href#the-a-element>a/a>/code> elements that create a href#hyperlink idthe-a-element:hyperlink-5>hyperlinks/a> is to run the following steps:/p> ol>li>p>If the target of the code idthe-a-element:event-click>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> event is an code idthe-a-element:the-img-element>a href#the-img-element>img/a>/code> element with an code idthe-a-element:attr-img-ismap>a href#attr-img-ismap>ismap/a>/code> attribute specified, then server-side image map processing must be performed, as follows:/p> ol>li>Let var>x/var> and var>y/var> be zero.li>If the code idthe-a-element:event-click-2>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> event was a real pointing-device-triggered code idthe-a-element:event-click-3>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> event on the code idthe-a-element:the-img-element-2>a href#the-img-element>img/a>/code> element, then set var>x/var> to the distance in a hrefhttps://drafts.csswg.org/css-values/#px idthe-a-element:px data-x-internalpx>CSS pixels/a> from the left edge of the image to the location of the click, and set var>y/var> to the distance in a hrefhttps://drafts.csswg.org/css-values/#px idthe-a-element:px-2 data-x-internalpx>CSS pixels/a> from the top edge of the image to the location of the click.li>If var>x/var> is negative, set var>x/var> to zero.li>If var>y/var> is negative, set var>y/var> to zero.li>Let var>hyperlink suffix/var> be a U+003F QUESTION MARK character, the value of var>x/var> expressed as a base-ten integer using a idthe-a-element:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, a U+002C COMMA character (,), and the value of var>y/var> expressed as a base-ten integer using a idthe-a-element:ascii-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>./ol> li>p>a href#following-hyperlinks-2 idthe-a-element:following-hyperlinks-2-2>Follow the hyperlink/a> or a href#downloading-hyperlinks idthe-a-element:downloading-hyperlinks-2>download the hyperlink/a> created by the code idthe-a-element:the-a-element-8>a href#the-a-element>a/a>/code> element, as determined by the code idthe-a-element:attr-hyperlink-download-4>a href#attr-hyperlink-download>download/a>/code> attribute and any expressed user preference, passing var>hyperlink suffix/var>, if the steps above defined it./ol> dl classdomintro>dt>var>a/var> . code idthe-a-element:dom-a-text-2>a href#dom-a-text>text/a>/code>dd> p>Same as code idthe-a-element:textcontent>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code>./p> /dl> p>The IDL attributes dfn iddom-a-download>code>download/code>/dfn>, dfn data-dfn-fora iddom-a-ping data-dfn-typeelement-attr data-export>code>ping/code>/dfn>, dfn iddom-a-target>code>target/code>/dfn>, dfn iddom-a-rel>code>rel/code>/dfn>, dfn iddom-a-hreflang>code>hreflang/code>/dfn>, and dfn iddom-a-type>code>type/code>/dfn>, must a href#reflect idthe-a-element:reflect>reflect/a> the respective content attributes of the same name./p> p>The IDL attribute dfn iddom-a-rellist>code>relList/code>/dfn> must a href#reflect idthe-a-element:reflect-2>reflect/a> the code idthe-a-element:attr-hyperlink-rel-4>a href#attr-hyperlink-rel>rel/a>/code> content attribute.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> rellistspan classand_chr partial>span>Chrome for Android (limited)/span> span>61+/span>/span>span classchrome partial>span>Chrome (limited)/span> span>50+/span>/span>span classios_saf yes>span>iOS Safari/span> span>9.0+/span>/span>span classand_uc no>span>UC Browser for Android/span> span>None/span>/span>span classfirefox yes>span>Firefox/span> span>30+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung partial>span>Samsung Internet (limited)/span> span>5+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>9+/span>/span>span classedge no>span>Edge/span> span>None/span>/span>span classandroid partial>span>Android Browser (limited)/span> span>56+/span>/span>span classopera partial>span>Opera (limited)/span> span>37+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featrellist>caniuse.com/a>/div> p>The IDL attribute dfn iddom-a-referrerpolicy>code>referrerPolicy/code>/dfn> must a href#reflect idthe-a-element:reflect-3>reflect/a> the code idthe-a-element:attr-hyperlink-referrerpolicy-4>a href#attr-hyperlink-referrerpolicy>referrerpolicy/a>/code> content attribute, a href#limited-to-only-known-values idthe-a-element:limited-to-only-known-values>limited to only known values/a>./p> p>The dfn iddom-a-text>code>text/code>/dfn> IDL attribute, on getting, must return the same value as the code idthe-a-element:textcontent-2>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> IDL attribute on the element, and on setting, must act as if the code idthe-a-element:textcontent-3>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> IDL attribute on the element had been set to the new value./p> div classexample> p>The code idthe-a-element:the-a-element-9>a href#the-a-element>a/a>/code> element may be wrapped around entire paragraphs, lists, tables, and so forth, even entire sections, so long as there is no interactive content within (e.g. buttons or other links). This example shows how this can be used to make an entire advertising block into a link:/p> pre><aside classadvertising> <h1>Advertising</h1> <a hrefhttps://ad.example.com/?adid1929&pubid1422> <section> <h1>Mellblomatic 9000!</h1> <p>Turn all your widgets into mellbloms!</p> <p>Only $9.99 plus shipping and handling.</p> </section> </a> <a hrefhttps://ad.example.com/?adid375&pubid1422> <section> <h1>The Mellblom Browser</h1> <p>Web browsing at the speed of light.</p> <p>No other browser goes faster!</p> </section> </a></aside>/pre> /div> h4 idthe-em-element>span classsecno>4.5.2/span> The dfn>code>em/code>/dfn> elementa href#the-em-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-em-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-em-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-em-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-em-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-em-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-em-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-em-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-em-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-em-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-em-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-em-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-em-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-em-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-em-element:the-em-element>a href#the-em-element>em/a>/code> element a href#represents idthe-em-element:represents>represents/a> stress emphasis of its contents./p> p>The level of stress that a particular piece of content has is given by its number of ancestor code idthe-em-element:the-em-element-2>a href#the-em-element>em/a>/code> elements./p> p>The placement of stress emphasis changes the meaning of the sentence. The element thus forms an integral part of the content. The precise way in which stress is used in this way depends on the language./p> div classexample> p>These examples show how changing the stress emphasis changes the meaning. First, a general statement of fact, with no stress:/p> pre><p>Cats are cute animals.</p>/pre> p>By emphasizing the first word, the statement implies that the kind of animal under discussion is in question (maybe someone is asserting that dogs are cute):/p> pre><p><em>Cats</em> are cute animals.</p>/pre> p>Moving the stress to the verb, one highlights that the truth of the entire sentence is in question (maybe someone is saying cats are not cute):/p> pre><p>Cats <em>are</em> cute animals.</p>/pre> p>By moving it to the adjective, the exact nature of the cats is reasserted (maybe someone suggested cats were em>mean/em> animals):/p> pre><p>Cats are <em>cute</em> animals.</p>/pre> p>Similarly, if someone asserted that cats were vegetables, someone correcting this might emphasize the last word:/p> pre><p>Cats are cute <em>animals</em>.</p>/pre> p>By emphasizing the entire sentence, it becomes clear that the speaker is fighting hard to get the point across. This kind of stress emphasis also typically affects the punctuation, hence the exclamation mark here./p> pre><p><em>Cats are cute animals!</em></p>/pre> p>Anger mixed with emphasizing the cuteness could lead to markup such as:/p> pre><p><em>Cats are <em>cute</em> animals!</em></p>/pre> /div> div classnote> p>The code idthe-em-element:the-em-element-3>a href#the-em-element>em/a>/code> element isnt a generic italics element. Sometimes, text is intended to stand out from the rest of the paragraph, as if it was in a different mood or voice. For this, the code idthe-em-element:the-i-element>a href#the-i-element>i/a>/code> element is more appropriate./p> p>The code idthe-em-element:the-em-element-4>a href#the-em-element>em/a>/code> element also isnt intended to convey importance; for that purpose, the code idthe-em-element:the-strong-element>a href#the-strong-element>strong/a>/code> element is more appropriate./p> /div> h4 idthe-strong-element>span classsecno>4.5.3/span> The dfn>code>strong/code>/dfn> elementa href#the-strong-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-strong-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-strong-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-strong-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-strong-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-strong-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-strong-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-strong-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-strong-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-strong-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-strong-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-strong-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-strong-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-strong-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-strong-element:the-strong-element>a href#the-strong-element>strong/a>/code> element a href#represents idthe-strong-element:represents>represents/a> strong importance, seriousness, or urgency for its contents./p> p>strong>Importance/strong>: the code idthe-strong-element:the-strong-element-2>a href#the-strong-element>strong/a>/code> element can be used in a heading, caption, or paragraph to distinguish the part that really matters from other parts that might be more detailed, more jovial, or merely boilerplate. (This is distinct from marking up subheadings, for which the code idthe-strong-element:the-hgroup-element>a href#the-hgroup-element>hgroup/a>/code> element is appropriate.)/p> p classexample>For example, the first word of the previous paragraph is marked up with code idthe-strong-element:the-strong-element-3>a href#the-strong-element>strong/a>/code> to distinguish it from the more detailed text in the rest of the paragraph./p> p>strong>Seriousness/strong>: the code idthe-strong-element:the-strong-element-4>a href#the-strong-element>strong/a>/code> element can be used to mark up a warning or caution notice./p> p>strong>Urgency/strong>: the code idthe-strong-element:the-strong-element-5>a href#the-strong-element>strong/a>/code> element can be used to denote contents that the user needs to see sooner than other parts of the document./p> p>The relative level of importance of a piece of content is given by its number of ancestor code idthe-strong-element:the-strong-element-6>a href#the-strong-element>strong/a>/code> elements; each code idthe-strong-element:the-strong-element-7>a href#the-strong-element>strong/a>/code> element increases the importance of its contents./p> p>Changing the importance of a piece of text with the code idthe-strong-element:the-strong-element-8>a href#the-strong-element>strong/a>/code> element does not change the meaning of the sentence./p> div classexample> p>Here, the word chapter and the actual chapter number are mere boilerplate, and the actual name of the chapter is marked up with code idthe-strong-element:the-strong-element-9>a href#the-strong-element>strong/a>/code>:/p> pre><h1>Chapter 1: <strong>The Praxis</strong></h1>/pre> p>In the following example, the name of the diagram in the caption is marked up with code idthe-strong-element:the-strong-element-10>a href#the-strong-element>strong/a>/code>, to distinguish it from boilerplate text (before) and the description (after):/p> pre><figcaption>Figure 1. <strong>Ant colony dynamics</strong>. The ants in this colony areaffected by the heat source (upper left) and the food source (lower right).</figcaption>/pre> p>In this example, the heading is really Flowers, Bees, and Honey, but the author has added a light-hearted addition to the heading. The code idthe-strong-element:the-strong-element-11>a href#the-strong-element>strong/a>/code> element is thus used to mark up the first part to distinguish it from the latter part./p> pre><h1><strong>Flowers, Bees, and Honey</strong> and other things I dont understand</h1>/pre> /div> div classexample> p>Here is an example of a warning notice in a game, with the various parts marked up according to how important they are:/p> pre><p><strong>Warning.</strong> This dungeon is dangerous.<strong>Avoid the ducks.</strong> Take any gold you find.<strong><strong>Do not take any of the diamonds</strong>,they are explosive and <strong>will destroy anything withinten meters.</strong></strong> You have been warned.</p>/pre> /div> div classexample> p>In this example, the code idthe-strong-element:the-strong-element-12>a href#the-strong-element>strong/a>/code> element is used to denote the part of the text that the user is intended to read first./p> pre><p>Welcome to Remy, the reminder system.</p><p>Your tasks for today:</p><ul> <li><p><strong>Turn off the oven.</strong></p></li> <li><p>Put out the trash.</p></li> <li><p>Do the laundry.</p></li></ul>/pre> /div> h4 idthe-small-element>span classsecno>4.5.4/span> The dfn>code>small/code>/dfn> elementa href#the-small-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-small-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-small-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-small-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-small-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-small-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-small-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-small-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-small-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-small-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-small-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-small-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-small-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-small-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-small-element:the-small-element>a href#the-small-element>small/a>/code> element a href#represents idthe-small-element:represents>represents/a> side comments such as small print./p> p classnote>Small print typically features disclaimers, caveats, legal restrictions, or copyrights. Small print is also sometimes used for attribution, or for satisfying licensing requirements./p> p classnote>The code idthe-small-element:the-small-element-2>a href#the-small-element>small/a>/code> element does not de-emphasize or lower the importance of text emphasized by the code idthe-small-element:the-em-element>a href#the-em-element>em/a>/code> element or marked as important with the code idthe-small-element:the-strong-element>a href#the-strong-element>strong/a>/code> element. To mark text as not emphasized or important, simply do not mark it up with the code idthe-small-element:the-em-element-2>a href#the-em-element>em/a>/code> or code idthe-small-element:the-strong-element-2>a href#the-strong-element>strong/a>/code> elements respectively./p> p>The code idthe-small-element:the-small-element-3>a href#the-small-element>small/a>/code> element should not be used for extended spans of text, such as multiple paragraphs, lists, or sections of text. It is only intended for short runs of text. The text of a page listing terms of use, for instance, would not be a suitable candidate for the code idthe-small-element:the-small-element-4>a href#the-small-element>small/a>/code> element: in such a case, the text is not a side comment, it is the main content of the page./p> p>The code idthe-small-element:the-small-element-5>a href#the-small-element>small/a>/code> element must not be used for subheadings; for that purpose, use the code idthe-small-element:the-hgroup-element>a href#the-hgroup-element>hgroup/a>/code> element./p> div classexample> p>In this example, the code idthe-small-element:the-small-element-6>a href#the-small-element>small/a>/code> element is used to indicate that value-added tax is not included in a price of a hotel room:/p> pre classexample><dl> <dt>Single room <dd>199 € <small>breakfast included, VAT not included</small> <dt>Double room <dd>239 € <small>breakfast included, VAT not included</small></dl>/pre> /div> div classexample> p>In this second example, the code idthe-small-element:the-small-element-7>a href#the-small-element>small/a>/code> element is used for a side comment in an article./p> pre><p>Example Corp today announced record profits for thesecond quarter <small>(Full Disclosure: Foo News is a subsidiary ofExample Corp)</small>, leading to speculation about a third quartermerger with Demo Group.</p>/pre> p>This is distinct from a sidebar, which might be multiple paragraphs long and is removed from the main flow of text. In the following example, we see a sidebar from the same article. This sidebar also has small print, indicating the source of the information in the sidebar./p> pre><aside> <h1>Example Corp</h1> <p>This company mostly creates small software and Web sites.</p> <p>The Example Corp company mission is To provide entertainment and news on a sample basis.</p> <p><small>Information obtained from <a hrefhttps://example.com/about.html>example.com</a> home page.</small></p></aside>/pre> /div> div classexample> p>In this last example, the code idthe-small-element:the-small-element-8>a href#the-small-element>small/a>/code> element is marked as being em>important/em> small print./p> pre><p><strong><small>Continued use of this service will result in a kiss.</small></strong></p>/pre> /div> h4 idthe-s-element>span classsecno>4.5.5/span> The dfn>code>s/code>/dfn> elementa href#the-s-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-s-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-s-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-s-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-s-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-s-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-s-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-s-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-s-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-s-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-s-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-s-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-s-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-s-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-s-element:the-s-element>a href#the-s-element>s/a>/code> element a href#represents idthe-s-element:represents>represents/a> contents that are no longer accurate or no longer relevant./p> p classnote>The code idthe-s-element:the-s-element-2>a href#the-s-element>s/a>/code> element is not appropriate when indicating document edits; to mark a span of text as having been removed from a document, use the code idthe-s-element:the-del-element>a href#the-del-element>del/a>/code> element./p> div classexample> p>In this example a recommended retail price has been marked as no longer relevant as the product in question has a new sale price./p> pre><p>Buy our Iced Tea and Lemonade!</p><p><s>Recommended retail price: $3.99 per bottle</s></p><p><strong>Now selling for just $2.99 a bottle!</strong></p>/pre> /div> h4 idthe-cite-element>span classsecno>4.5.6/span> The dfn>code>cite/code>/dfn> elementa href#the-cite-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-cite-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-cite-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-cite-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-cite-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-cite-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-cite-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-cite-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-cite-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-cite-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-cite-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-cite-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-cite-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-cite-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-cite-element:the-cite-element>a href#the-cite-element>cite/a>/code> element a href#represents idthe-cite-element:represents>represents/a> the title of a work (e.g. a book, a paper, an essay, a poem, a score, a song, a script, a film, a TV show, a game, a sculpture, a painting, a theatre production, a play, an opera, a musical, an exhibition, a legal case report, a computer program, etc). This can be a work that is being quoted or a href#referenced idthe-cite-element:referenced>referenced/a> in detail (i.e. a citation), or it can just be a work that is mentioned in passing./p> p>A persons name is not the title of a work — even if people call that person a piece of work — and the element must therefore not be used to mark up peoples names. (In some cases, the code idthe-cite-element:the-b-element>a href#the-b-element>b/a>/code> element might be appropriate for names; e.g. in a gossip article where the names of famous people are keywords rendered with a different style to draw attention to them. In other cases, if an element is em>really/em> needed, the code idthe-cite-element:the-span-element>a href#the-span-element>span/a>/code> element can be used.)/p> div classexample> p>This next example shows a typical use of the code idthe-cite-element:the-cite-element-2>a href#the-cite-element>cite/a>/code> element:/p> pre><p>My favorite book is <cite>The Reality Dysfunction</cite> byPeter F. Hamilton. My favorite comic is <cite>Pearls BeforeSwine</cite> by Stephan Pastis. My favorite track is <cite>JiveSamba</cite> by the Cannonball Adderley Sextet.</p>/pre> /div> div classexample> p>This is correct usage:/p> pre><p>According to the Wikipedia article <cite>HTML</cite>, as itstood in mid-February 2008, leaving attribute values unquoted isunsafe. This is obviously an over-simplification.</p>/pre> p>The following, however, is incorrect usage, as the code idthe-cite-element:the-cite-element-3>a href#the-cite-element>cite/a>/code> element here is containing far more than the title of the work:/p> pre classbad><!-- do not copy this example, it is an example of bad usage! --><p>According to <cite>the Wikipedia article on HTML</cite>, as itstood in mid-February 2008, leaving attribute values unquoted isunsafe. This is obviously an over-simplification.</p>/pre> /div> div classexample> p>The code idthe-cite-element:the-cite-element-4>a href#the-cite-element>cite/a>/code> element is obviously a key part of any citation in a bibliography, but it is only used to mark the title:/p> pre><p><cite>Universal Declaration of Human Rights</cite>, United Nations,December 1948. Adopted by General Assembly resolution 217 A (III).</p>/pre> /div> p classnote>A em>citation/em> is not a em>quote/em> (for which the code idthe-cite-element:the-q-element>a href#the-q-element>q/a>/code> element is appropriate)./p> div classexample> p>This is incorrect usage, because code idthe-cite-element:the-cite-element-5>a href#the-cite-element>cite/a>/code> is not for quotes:/p> pre classbad><p><cite>This is wrong!</cite>, said Ian.</p>/pre> p>This is also incorrect usage, because a person is not a work:/p> pre classbad><p><q>This is still wrong!</q>, said <cite>Ian</cite>.</p>/pre> p>The correct usage does not use a code idthe-cite-element:the-cite-element-6>a href#the-cite-element>cite/a>/code> element:/p> pre><p><q>This is correct</q>, said Ian.</p>/pre> p>As mentioned above, the code idthe-cite-element:the-b-element-2>a href#the-b-element>b/a>/code> element might be relevant for marking names as being keywords in certain kinds of documents:/p> pre><p>And then <b>Ian</b> said <q>this might be right, in agossip column, maybe!</q>.</p>/pre> /div> h4 idthe-q-element>span classsecno>4.5.7/span> The dfn>code>q/code>/dfn> elementa href#the-q-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-q-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-q-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-q-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-q-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-q-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-q-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-q-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-q-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-q-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-q-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-q-element:global-attributes>Global attributes/a>dd>code idthe-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 editdt>a href#concept-element-dom idthe-q-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-q-element:htmlquoteelement>a href#htmlquoteelement>HTMLQuoteElement/a>/code>./dl> p>The code idthe-q-element:the-q-element>a href#the-q-element>q/a>/code> element a href#represents idthe-q-element:represents>represents/a> some a href#phrasing-content-2 idthe-q-element:phrasing-content-2-4>phrasing content/a> quoted from another source./p> p>Quotation punctuation (such as quotation marks) that is quoting the contents of the element must not appear immediately before, after, or inside code idthe-q-element:the-q-element-2>a href#the-q-element>q/a>/code> elements; they will be inserted into the rendering by the user agent./p> p>Content inside a code idthe-q-element:the-q-element-3>a href#the-q-element>q/a>/code> element must be quoted from another source, whose address, if it has one, may be cited in the dfn idattr-q-cite>code>cite/code>/dfn> attribute. The source may be fictional, as when quoting characters in a novel or screenplay./p> p>If the code idthe-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 idthe-q-element:valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by spaces/a>. To obtain the corresponding citation link, the value of the attribute must be a href#parse-a-url idthe-q-element:parse-a-url>parsed/a> relative to the elements a idthe-q-element:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>. User agents may allow users to follow such citation links, but they are primarily intended for private use (e.g., by server-side scripts collecting statistics about a sites use of quotations), not for readers./p> p>The code idthe-q-element:the-q-element-4>a href#the-q-element>q/a>/code> element must not be used in place of quotation marks that do not represent quotes; for example, it is inappropriate to use the code idthe-q-element:the-q-element-5>a href#the-q-element>q/a>/code> element for marking up sarcastic statements./p> p>The use of code idthe-q-element:the-q-element-6>a href#the-q-element>q/a>/code> elements to mark up quotations is entirely optional; using explicit quotation punctuation without code idthe-q-element:the-q-element-7>a href#the-q-element>q/a>/code> elements is just as correct./p> div classexample> p>Here is a simple example of the use of the code idthe-q-element:the-q-element-8>a href#the-q-element>q/a>/code> element:/p> pre><p>The man said <q>Things that are impossible just takelonger</q>. I disagreed with him.</p>/pre> /div> div classexample> p>Here is an example with both an explicit citation link in the code idthe-q-element:the-q-element-9>a href#the-q-element>q/a>/code> element, and an explicit citation outside:/p> pre><p>The W3C page <cite>About W3C</cite> says the W3Csmission is <q citehttps://www.w3.org/Consortium/>To lead theWorld Wide Web to its full potential by developing protocols andguidelines that ensure long-term growth for the Web</q>. Idisagree with this mission.</p>/pre> /div> div classexample> p>In the following example, the quotation itself contains a quotation:/p> pre><p>In <cite>Example One</cite>, he writes <q>The mansaid <q>Things that are impossible just take longer</q>. Idisagreed with him</q>. Well, I disagree even more!</p>/pre> /div> div classexample> p>In the following example, quotation marks are used instead of the code idthe-q-element:the-q-element-10>a href#the-q-element>q/a>/code> element:/p> pre><p>His best argument was ❝I disagree❞, whichI thought was laughable.</p>/pre> /div> div classexample> p>In the following example, there is no quote — the quotation marks are used to name a word. Use of the code idthe-q-element:the-q-element-11>a href#the-q-element>q/a>/code> element in this case would be inappropriate./p> pre><p>The word ineffable could have been used to describe the disasterresulting from the campaigns mismanagement.</p>/pre> /div> h4 idthe-dfn-element>span classsecno>4.5.8/span> The dfn>code>dfn/code>/dfn> elementa href#the-dfn-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-dfn-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-dfn-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-dfn-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-dfn-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-dfn-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-dfn-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-dfn-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-dfn-element:phrasing-content-2-3>Phrasing content/a>, but there must be no code idthe-dfn-element:the-dfn-element>a href#the-dfn-element>dfn/a>/code> element descendants.dt>a href#concept-element-tag-omission idthe-dfn-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-dfn-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-dfn-element:global-attributes>Global attributes/a>dd>Also, the code idthe-dfn-element:attr-dfn-title>a href#attr-dfn-title>title/a>/code> attribute a href#attr-dfn-title idthe-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 idthe-dfn-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-dfn-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-dfn-element:the-dfn-element-2>a href#the-dfn-element>dfn/a>/code> element a href#represents idthe-dfn-element:represents>represents/a> the defining instance of a term. The a href#paragraph idthe-dfn-element:paragraph>paragraph/a>, a href#the-dl-element idthe-dfn-element:the-dl-element>description list group/a>, or a href#sectioning-content-2 idthe-dfn-element:sectioning-content-2>section/a> that is the nearest ancestor of the code idthe-dfn-element:the-dfn-element-3>a href#the-dfn-element>dfn/a>/code> element must also contain the definition(s) for the a href#defining-term idthe-dfn-element:defining-term>term/a> given by the code idthe-dfn-element:the-dfn-element-4>a href#the-dfn-element>dfn/a>/code> element./p> p>dfn iddefining-term>Defining term/dfn>: if the code idthe-dfn-element:the-dfn-element-5>a href#the-dfn-element>dfn/a>/code> element has a dfn idattr-dfn-title>code>title/code>/dfn> attribute, then the exact value of that attribute is the term being defined. Otherwise, if it contains exactly one element child node and no child code idthe-dfn-element:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes, and that child element is an code idthe-dfn-element:the-abbr-element>a href#the-abbr-element>abbr/a>/code> element with a code idthe-dfn-element:attr-abbr-title>a href#attr-abbr-title>title/a>/code> attribute, then the exact value of em>that/em> attribute is the term being defined. Otherwise, it is the exact code idthe-dfn-element:textcontent>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> of the code idthe-dfn-element:the-dfn-element-6>a href#the-dfn-element>dfn/a>/code> element that gives the term being defined./p> p>If the code idthe-dfn-element:attr-dfn-title-3>a href#attr-dfn-title>title/a>/code> attribute of the code idthe-dfn-element:the-dfn-element-7>a href#the-dfn-element>dfn/a>/code> element is present, then it must contain only the term being defined./p> p classnote>The code idthe-dfn-element:attr-title>a href#attr-title>title/a>/code> attribute of ancestor elements does not affect code idthe-dfn-element:the-dfn-element-8>a href#the-dfn-element>dfn/a>/code> elements./p> p>An code idthe-dfn-element:the-a-element>a href#the-a-element>a/a>/code> element that links to a code idthe-dfn-element:the-dfn-element-9>a href#the-dfn-element>dfn/a>/code> element represents an instance of the term defined by the code idthe-dfn-element:the-dfn-element-10>a href#the-dfn-element>dfn/a>/code> element./p> div classexample> p>In the following fragment, the term Garage Door Opener is first defined in the first paragraph, then used in the second. In both cases, its abbreviation is what is actually displayed./p> pre><p>The strong><dfn><abbr titleGarage Door Opener>GDO</abbr></dfn>/strong>is a device that allows off-world teams to open the iris.</p><!-- ... later in the document: --><p>Tealc activated his strong><abbr titleGarage Door Opener>GDO</abbr>/strong>and so Hammond ordered the iris to be opened.</p>/pre> p>With the addition of an code idthe-dfn-element:the-a-element-2>a href#the-a-element>a/a>/code> element, the a href#referenced idthe-dfn-element:referenced>reference/a> can be made explicit:/p> pre><p>The <dfn strong>idgdo/strong>><abbr titleGarage Door Opener>GDO</abbr></dfn>is a device that allows off-world teams to open the iris.</p><!-- ... later in the document: --><p>Tealc activated his strong><a href#gdo>/strong><abbr titleGarage Door Opener>GDO</abbr>strong></a>/strong>and so Hammond ordered the iris to be opened.</p>/pre> /div> h4 idthe-abbr-element>span classsecno>4.5.9/span> The dfn>code>abbr/code>/dfn> elementa href#the-abbr-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-abbr-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-abbr-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-abbr-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-abbr-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-abbr-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-abbr-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-abbr-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-abbr-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-abbr-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-abbr-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-abbr-element:global-attributes>Global attributes/a>dd>Also, the code idthe-abbr-element:attr-abbr-title>a href#attr-abbr-title>title/a>/code> attribute a href#attr-abbr-title idthe-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 idthe-abbr-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-abbr-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-abbr-element:the-abbr-element>a href#the-abbr-element>abbr/a>/code> element a href#represents idthe-abbr-element:represents>represents/a> an abbreviation or acronym, optionally with its expansion. The dfn idattr-abbr-title>code>title/code>/dfn> attribute may be used to provide an expansion of the abbreviation. The attribute, if specified, must contain an expansion of the abbreviation, and nothing else./p> div classexample> p>The paragraph below contains an abbreviation marked up with the code idthe-abbr-element:the-abbr-element-2>a href#the-abbr-element>abbr/a>/code> element. This paragraph a href#defining-term idthe-abbr-element:defining-term>defines the term/a> Web Hypertext Application Technology Working Group./p> pre><p>The <dfn idwhatwg><abbrtitleWeb Hypertext Application Technology Working Group>WHATWG</abbr></dfn>is a loose unofficial collaboration of Web browser manufacturers andinterested parties who wish to develop new technologies designed toallow authors to write and deploy Applications over the World WideWeb.</p>/pre> p>An alternative way to write this would be:/p> pre><p>The <dfn idwhatwg>Web Hypertext Application TechnologyWorking Group</dfn> (<abbrtitleWeb Hypertext Application Technology Working Group>WHATWG</abbr>)is a loose unofficial collaboration of Web browser manufacturers andinterested parties who wish to develop new technologies designed toallow authors to write and deploy Applications over the World WideWeb.</p>/pre> /div> div classexample> p>This paragraph has two abbreviations. Notice how only one is defined; the other, with no expansion associated with it, does not use the code idthe-abbr-element:the-abbr-element-3>a href#the-abbr-element>abbr/a>/code> element./p> pre><p>The<abbr titleWeb Hypertext Application Technology Working Group>WHATWG</abbr>started working on HTML5 in 2004.</p>/pre> /div> div classexample> p>This paragraph links an abbreviation to its definition./p> pre><p>The <a href#whatwg><abbrtitleWeb Hypertext Application Technology Working Group>WHATWG</abbr></a>community does not have much representation from Asia.</p>/pre> /div> div classexample> p>This paragraph marks up an abbreviation without giving an expansion, possibly as a hook to apply styles for abbreviations (e.g. smallcaps)./p> pre><p>Philip` and Dashiva both denied that they were going toget the issue counts from past revisions of the specification tobackfill the <abbr>WHATWG</abbr> issue graph.</p>/pre> /div> p>If an abbreviation is pluralized, the expansions grammatical number (plural vs singular) must match the grammatical number of the contents of the element./p> div classexample> p>Here the plural is outside the element, so the expansion is in the singular:/p> pre><p>Two <abbr titleWorking Group>WG</abbr>s worked onthis specification: the <abbr>WHATWG</abbr> and the<abbr>HTMLWG</abbr>.</p>/pre> p>Here the plural is inside the element, so the expansion is in the plural:/p> pre><p>Two <abbr titleWorking Groups>WGs</abbr> worked onthis specification: the <abbr>WHATWG</abbr> and the<abbr>HTMLWG</abbr>.</p>/pre> /div> p>Abbreviations do not have to be marked up using this element. It is expected to be useful in the following cases:/p> ul>li>Abbreviations for which the author wants to give expansions, where using the code idthe-abbr-element:the-abbr-element-4>a href#the-abbr-element>abbr/a>/code> element with a code idthe-abbr-element:attr-title>a href#attr-title>title/a>/code> attribute is an alternative to including the expansion inline (e.g. in parentheses).li>Abbreviations that are likely to be unfamiliar to the documents readers, for which authors are encouraged to either mark up the abbreviation using an code idthe-abbr-element:the-abbr-element-5>a href#the-abbr-element>abbr/a>/code> element with a code idthe-abbr-element:attr-title-2>a href#attr-title>title/a>/code> attribute or include the expansion inline in the text the first time the abbreviation is used.li>Abbreviations whose presence needs to be semantically annotated, e.g. so that they can be identified from a style sheet and given specific styles, for which the code idthe-abbr-element:the-abbr-element-6>a href#the-abbr-element>abbr/a>/code> element can be used without a code idthe-abbr-element:attr-title-3>a href#attr-title>title/a>/code> attribute./ul> p>Providing an expansion in a code idthe-abbr-element:attr-title-4>a href#attr-title>title/a>/code> attribute once will not necessarily cause other code idthe-abbr-element:the-abbr-element-7>a href#the-abbr-element>abbr/a>/code> elements in the same document with the same contents but without a code idthe-abbr-element:attr-title-5>a href#attr-title>title/a>/code> attribute to behave as if they had the same expansion. Every code idthe-abbr-element:the-abbr-element-8>a href#the-abbr-element>abbr/a>/code> element is independent./p> h4 idthe-ruby-element>span classsecno>4.5.10/span> The dfn>code>ruby/code>/dfn> elementa href#the-ruby-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> rubyspan classand_chr partial>span>Chrome for Android (limited)/span> span>61+/span>/span>span classchrome partial>span>Chrome (limited)/span> span>5+/span>/span>span classios_saf partial>span>iOS Safari (limited)/span> span>5.0+/span>/span>span classand_uc partial>span>UC Browser for Android (limited)/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>38+/span>/span>span classie partial>span>IE (limited)/span> span>5.5+/span>/span>span classsamsung partial>span>Samsung Internet (limited)/span> span>4+/span>/span>span classsafari partial>span>Safari (limited)/span> span>5+/span>/span>span classedge partial>span>Edge (limited)/span> span>12+/span>/span>span classandroid partial>span>Android Browser (limited)/span> span>3+/span>/span>span classopera partial>span>Opera (limited)/span> span>15+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featruby>caniuse.com/a>/div> dl classelement>dt>a href#concept-element-categories idthe-ruby-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-ruby-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-ruby-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-ruby-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-ruby-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-ruby-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-ruby-element:concept-element-content-model>Content model/a>:dd>See prose.dt>a href#concept-element-tag-omission idthe-ruby-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-ruby-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-ruby-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-ruby-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-ruby-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-ruby-element:the-ruby-element>a href#the-ruby-element>ruby/a>/code> element allows one or more spans of phrasing content to be marked with ruby annotations. Ruby annotations are short runs of text presented alongside base text, primarily used in East Asian typography as a guide for pronunciation or to include other annotations. In Japanese, this form of typography is also known as i>furigana/i>./p> p>The content model of code idthe-ruby-element:the-ruby-element-2>a href#the-ruby-element>ruby/a>/code> elements consists of one or more of the following sequences:/p> ol classbrief>li>One or the other of the following: ul classbrief>li>a href#phrasing-content-2 idthe-ruby-element:phrasing-content-2-3>Phrasing content/a>, but with no code idthe-ruby-element:the-ruby-element-3>a href#the-ruby-element>ruby/a>/code> elements and with no code idthe-ruby-element:the-ruby-element-4>a href#the-ruby-element>ruby/a>/code> element descendants li>A single code idthe-ruby-element:the-ruby-element-5>a href#the-ruby-element>ruby/a>/code> element that itself has no code idthe-ruby-element:the-ruby-element-6>a href#the-ruby-element>ruby/a>/code> element descendants /ul> li>One or the other of the following: ul classbrief>li>One or more code idthe-ruby-element:the-rt-element>a href#the-rt-element>rt/a>/code> elements li>An code idthe-ruby-element:the-rp-element>a href#the-rp-element>rp/a>/code> element followed by one or more code idthe-ruby-element:the-rt-element-2>a href#the-rt-element>rt/a>/code> elements, each of which is itself followed by an code idthe-ruby-element:the-rp-element-2>a href#the-rp-element>rp/a>/code> element /ul> /ol> p>The code idthe-ruby-element:the-ruby-element-7>a href#the-ruby-element>ruby/a>/code> and code idthe-ruby-element:the-rt-element-3>a href#the-rt-element>rt/a>/code> elements can be used for a variety of kinds of annotations, including in particular (though by no means limited to) those described below. For more details on Japanese Ruby in particular, and how to render Ruby for Japanese, see cite>Requirements for Japanese Text Layout/cite>. a href#refsJLREQ>JLREQ/a>/p> p classnote>At the time of writing, CSS does not yet provide a way to fully control the rendering of the HTML code idthe-ruby-element:the-ruby-element-8>a href#the-ruby-element>ruby/a>/code> element. It is hoped that CSS will be extended to support the styles described below in due course./p> dl>dt>Mono-ruby for individual base characters in Japanese dd> p>One or more hiragana or katakana characters (the ruby annotation) are placed with each ideographic character (the base text). This is used to provide readings of kanji characters. div classexample> pre><ruby>B<rt>annotation</ruby>/pre> /div> div classexample> p>In this example, notice how each annotation corresponds to a single base character. pre><ruby>君<rt>くん</ruby><ruby>子<rt>し</ruby>は<ruby>和<rt>わ</ruby>して<ruby>同<rt>どう</ruby>ぜず。/pre> p langja>ruby>君rt>くん/ruby>ruby>子rt>し/ruby>はruby>和rt>わ/ruby>してruby>同rt>どう/ruby>ぜず。 p>This example can also be written as follows, using one code idthe-ruby-element:the-ruby-element-9>a href#the-ruby-element>ruby/a>/code> element with two segments of base text and two annotations (one for each) rather than two back-to-back code idthe-ruby-element:the-ruby-element-10>a href#the-ruby-element>ruby/a>/code> elements each with one base text segment and annotation (as in the markup above): pre><ruby>君<rt>くん</rt>子<rt>し</ruby>は<ruby>和<rt>わ</ruby>して<ruby>同<rt>どう</ruby>ぜず。/pre> /div> dt>Mono-ruby for compound words (jukugo) dd> p>This is similar to the previous case: each ideographic character in the compound word (the base text) has its reading given in hiragana or katakana characters (the ruby annotation). The difference is that the base text segments form a compound word rather than being separate from each other. div classexample> pre><ruby>B<rt>annotation</rt>B<rt>annotation</ruby>/pre> /div> div classexample> 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 idthe-ruby-element:the-ruby-element-11>a href#the-ruby-element>ruby/a>/code> element./p> p>The rendering here is expected to be that each annotation be placed over (or next to, in vertical text) the corresponding base character, with the annotations not overhanging any of the adjacent characters./p> pre><ruby>鬼<rt>き</rt>門<rt>もん</rt></ruby>の<ruby>方<rt>ほう</rt>角<rt>がく</rt></ruby>を<ruby>凝<rt>ぎょう</rt>視<rt>し</rt></ruby>する/pre> p langja>ruby>鬼rt>き/rt>門rt>もん/ruby>のruby>方rt>ほう/rt>角rt>がく/ruby>をruby>凝rt>ぎょう/rt>視rt>し/ruby>する /div> dt>Jukugo-ruby dd> p>This is semantically identical to the previous case (each individual ideographic character in the base compound word has its reading given in an annotation in hiragana or katakana characters), but the rendering is the more complicated Jukugo Ruby rendering. div classexample> p>This is the same example as above for mono-ruby for compound words. The different rendering is expected to be achieved using different styling (e.g. in CSS), and is not shown here./p> pre><ruby>鬼<rt>き</rt>門<rt>もん</rt></ruby>の<ruby>方<rt>ほう</rt>角<rt>がく</rt></ruby>を<ruby>凝<rt>ぎょう</rt>視<rt>し</rt></ruby>する/pre> /div> p classnote>For more details on a hrefhttps://www.w3.org/TR/jlreq/#positioning_of_jukugoruby>Jukugo Ruby rendering/a>, see Appendix F in the cite>Requirements for Japanese Text Layout/cite>. a href#refsJLREQ>JLREQ/a>/p> dt>Group ruby for describing meanings dd> p>The annotation describes the meaning of the base text, rather than (or in addition to) the pronunciation. As such, both the base text and the annotation can be multiple characters long. div classexample> pre><ruby>BASE<rt>annotation</ruby>/pre> /div> div classexample> p>Here a compound ideographic word has its corresponding katakana given as an annotation. pre><ruby>境界面<rt>インターフェース</ruby>/pre> p langja>ruby>境界面rt>インターフェース/ruby> /div> div classexample> p>Here a compound ideographic word has its translation in English provided as an annotation. pre><ruby langja>編集者<rt langen>editor</ruby>/pre> p>ruby langja>編集者rt langen>editor/ruby> /div> dt>Group ruby for Jukuji readings dd> p>A phonetic reading that corresponds to multiple base characters, because a one-to-one mapping would be difficult. (In English, the words Colonel and Lieutenant are examples of words where a direct mapping of pronunciation to individual letters is, in some dialects, rather unclear.) div classexample> p>In this example, the name of a species of flowers has a phonetic reading provided using group ruby: pre><ruby>紫陽花<rt>あじさい</ruby>/pre> p langja>ruby>紫陽花rt>あじさい/ruby> /div> dt>Text with both phonetic and semantic annotations (double-sided ruby) dd> p>Sometimes, ruby styles described above are combined. p>If this results in two annotations covering the same single base segment, then the annotations can just be placed back to back. div classexample> pre><ruby>BASE<rt>annotation 1<rt>annotation 2</ruby>/pre> /div> div classexample> pre><ruby>B<rt>a<rt>a</ruby><ruby>A<rt>a<rt>a</ruby><ruby>S<rt>a<rt>a</ruby><ruby>E<rt>a<rt>a</ruby>/pre> /div> div classexample> p>In this contrived example, some symbols are given names in English and French. pre><ruby> ♥ <rt> Heart <rt langfr> Cœur </rt> ☘ <rt> Shamrock <rt langfr> Trèfle </rt> ✶ <rt> Star <rt langfr> Étoile </rt></ruby>/pre> /div> p>In more complication situations such as following examples, a nested code idthe-ruby-element:the-ruby-element-12>a href#the-ruby-element>ruby/a>/code> element is used to give the inner annotations, and then that whole code idthe-ruby-element:the-ruby-element-13>a href#the-ruby-element>ruby/a>/code> is then given an annotation at the outer level. div classexample> pre><ruby><ruby>B<rt>a</rt>A<rt>n</rt>S<rt>t</rt>E<rt>n</rt></ruby><rt>annotation</ruby>/pre> /div> div classexample> p>Here both a phonetic reading and the meaning are given in ruby annotations. The annotation on the nested code idthe-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 idthe-ruby-element:the-rt-element-4>a href#the-rt-element>rt/a>/code> element that is a child of the outer code idthe-ruby-element:the-ruby-element-15>a href#the-ruby-element>ruby/a>/code> element gives the meaning using hiragana. pre><ruby><ruby>東<rt>とう</rt>南<rt>なん</rt></ruby><rt>たつみ</rt></ruby>の方角/pre> p langja>ruby>ruby>東rt>とう/rt>南rt>なん/ruby>rt>たつみ/ruby>の方角 /div> div classexample> p>This is the same example, but the meaning is given in English instead of Japanese: pre><ruby><ruby>東<rt>とう</rt>南<rt>なん</rt></ruby><rt langen>Southeast</rt></ruby>の方角/pre> p langja>ruby>ruby>東rt>とう/rt>南rt>なん/ruby>rt langen>Southeast/ruby>の方角 /div> /dl> hr> p>Within a code idthe-ruby-element:the-ruby-element-16>a href#the-ruby-element>ruby/a>/code> element that does not have a code idthe-ruby-element:the-ruby-element-17>a href#the-ruby-element>ruby/a>/code> element ancestor, content is segmented and segments are placed into three categories: base text segments, annotation segments, and ignored segments. Ignored segments do not form part of the documents semantics (they consist of some a href#inter-element-whitespace idthe-ruby-element:inter-element-whitespace>inter-element whitespace/a> and code idthe-ruby-element:the-rp-element-3>a href#the-rp-element>rp/a>/code> elements, the latter of which are used for legacy user agents that do not support ruby at all). Base text segments can overlap (with a limit of two segments overlapping any one position in the DOM, and with any segment having an earlier start point than an overlapping segment also having an equal or later end point, and any segment have a later end point than an overlapping segment also having an equal or earlier start point). Annotation segments correspond to code idthe-ruby-element:the-rt-element-5>a href#the-rt-element>rt/a>/code> elements. Each annotation segment can be associated with a base text segment, and each base text segment can have annotation segments associated with it. (In a conforming document, each base text segment is associated with at least one annotation segment, and each annotation segment is associated with one base text segment.) A code idthe-ruby-element:the-ruby-element-18>a href#the-ruby-element>ruby/a>/code> element a href#represents idthe-ruby-element:represents>represents/a> the union of the segments of base text it contains, along with the mapping from those base text segments to annotation segments. Segments are described in terms of DOM ranges; annotation segment ranges always consist of exactly one element. a href#refsDOM>DOM/a>/p> p>At any particular time, the segmentation and categorization of content of a code idthe-ruby-element:the-ruby-element-19>a href#the-ruby-element>ruby/a>/code> element is the result that would be obtained from running the following algorithm:/p> ol>li>p>Let var>base text segments/var> be an empty list of base text segments, each potentially with a list of base text subsegments.li>p>Let var>annotation segments/var> be an empty list of annotation segments, each potentially being associated with a base text segment or subsegment.li>p>Let var>root/var> be the code idthe-ruby-element:the-ruby-element-20>a href#the-ruby-element>ruby/a>/code> element for which the algorithm is being run.li>p>If var>root/var> has a code idthe-ruby-element:the-ruby-element-21>a href#the-ruby-element>ruby/a>/code> element ancestor, then jump to the step labeled i>end/i>.li>p>Let var>current parent/var> be var>root/var>.li>p>Let var>index/var> be 0.li>p>Let var>start index/var> be null.li>p>Let var>parent start index/var> be null.li>p>Let var>current base text/var> be null.li>p>i>Start mode/i>: If var>index/var> is equal to or greater than the number of child nodes in var>current parent/var>, then jump to the step labeled i>end mode/i>./p> li>p>If the var>index/var>th node in var>current parent/var> is an code idthe-ruby-element:the-rt-element-6>a href#the-rt-element>rt/a>/code> or code idthe-ruby-element:the-rp-element-4>a href#the-rp-element>rp/a>/code> element, jump to the step labeled i>annotation mode/i>.li>p>Set var>start index/var> to the value of var>index/var>.li>p>i>Base mode/i>: If the var>index/var>th node in var>current parent/var> is a code idthe-ruby-element:the-ruby-element-22>a href#the-ruby-element>ruby/a>/code> element, and if var>current parent/var> is the same element as var>root/var>, then a href#push-a-ruby-level idthe-ruby-element:push-a-ruby-level>push a ruby level/a> and then jump to the step labeled i>start mode/i>.li>p>If the var>index/var>th node in var>current parent/var> is an code idthe-ruby-element:the-rt-element-7>a href#the-rt-element>rt/a>/code> or code idthe-ruby-element:the-rp-element-5>a href#the-rp-element>rp/a>/code> element, then a href#set-the-current-base-text idthe-ruby-element:set-the-current-base-text>set the current base text/a> and then jump to the step labeled i>annotation mode/i>.li>p>Increment var>index/var> by one.li>p>i>Base mode post-increment/i>: If var>index/var> is equal to or greater than the number of child nodes in var>current parent/var>, then jump to the step labeled i>end mode/i>.li>p>Jump back to the step labeled i>base mode/i>.li>p>i>Annotation mode/i>: If the var>index/var>th node in var>current parent/var> is an code idthe-ruby-element:the-rt-element-8>a href#the-rt-element>rt/a>/code> element, then a href#push-a-ruby-annotation idthe-ruby-element:push-a-ruby-annotation>push a ruby annotation/a> and jump to the step labeled i>annotation mode increment/i>.li>p>If the var>index/var>th node in var>current parent/var> is an code idthe-ruby-element:the-rp-element-6>a href#the-rp-element>rp/a>/code> element, jump to the step labeled i>annotation mode increment/i>.li>p>If the var>index/var>th node in var>current parent/var> is not a code idthe-ruby-element:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node, or is a code idthe-ruby-element:text-2>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node that is not a href#inter-element-whitespace idthe-ruby-element:inter-element-whitespace-2>inter-element whitespace/a>, then jump to the step labeled i>base mode/i>.li>p>i>Annotation mode increment/i>: Let var>lookahead index/var> be var>index/var> plus one.li>p>i>Annotation mode white-space skipper/i>: If var>lookahead index/var> is equal to the number of child nodes in var>current parent/var> then jump to the step labeled i>end mode/i>.li>p>If the var>lookahead index/var>th node in var>current parent/var> is an code idthe-ruby-element:the-rt-element-9>a href#the-rt-element>rt/a>/code> element or an code idthe-ruby-element:the-rp-element-7>a href#the-rp-element>rp/a>/code> element, then set var>index/var> to var>lookahead index/var> and jump to the step labeled i>annotation mode/i>.li>p>If the var>lookahead index/var>th node in var>current parent/var> is not a code idthe-ruby-element:text-3>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node, or is a code idthe-ruby-element:text-4>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node that is not a href#inter-element-whitespace idthe-ruby-element:inter-element-whitespace-3>inter-element whitespace/a>, then jump to the step labeled i>base mode/i> (without further incrementing var>index/var>, so the a href#inter-element-whitespace idthe-ruby-element:inter-element-whitespace-4>inter-element whitespace/a> seen so far becomes part of the next base text segment).li>p>Increment var>lookahead index/var> by one.li>p>Jump to the step labeled i>annotation mode white-space skipper/i>.li>p>i>End mode/i>: If var>current parent/var> is not the same element as var>root/var>, then a href#pop-a-ruby-level idthe-ruby-element:pop-a-ruby-level>pop a ruby level/a> and jump to the step labeled i>base mode post-increment/i>.li>p>i>End/i>: Return var>base text segments/var> and var>annotation segments/var>. Any content of the code idthe-ruby-element:the-ruby-element-23>a href#the-ruby-element>ruby/a>/code> element not described by segments in either of those lists is implicitly in an i>ignored segment/i>./ol> p>When the steps above say to dfn idset-the-current-base-text>set the current base text/dfn>, it means to run the following steps at that point in the algorithm:/p> ol>li>p>Let var>text range/var> be a DOM range whose a hrefhttps://dom.spec.whatwg.org/#concept-range-start idthe-ruby-element:concept-range-start data-x-internalconcept-range-start>start/a> is the a hrefhttps://dom.spec.whatwg.org/#concept-range-bp idthe-ruby-element:concept-range-bp data-x-internalconcept-range-bp>boundary point/a> (var>current parent/var>, var>start index/var>) and whose a hrefhttps://dom.spec.whatwg.org/#concept-range-end idthe-ruby-element:concept-range-end data-x-internalconcept-range-end>end/a> is the a hrefhttps://dom.spec.whatwg.org/#concept-range-bp idthe-ruby-element:concept-range-bp-2 data-x-internalconcept-range-bp>boundary point/a> (var>current parent/var>, var>index/var>).li>p>Let var>new text segment/var> be a base text segment described by the range var>annotation range/var>./p> li>p>Add var>new text segment/var> to var>base text segments/var>.li>p>Let var>current base text/var> be var>new text segment/var>.li>p>Let var>start index/var> be null./ol> p>When the steps above say to dfn idpush-a-ruby-level>push a ruby level/dfn>, it means to run the following steps at that point in the algorithm:/p> ol>li>p>Let var>current parent/var> be the var>index/var>th node in var>current parent/var>.li>p>Let var>index/var> be 0.li>p>Set var>saved start index/var> to the value of var>start index/var>.li>p>Let var>start index/var> be null./ol> p>When the steps above say to dfn idpop-a-ruby-level>pop a ruby level/dfn>, it means to run the following steps at that point in the algorithm:/p> ol>li>p>Let var>index/var> be the position of var>current parent/var> in var>root/var>.li>p>Let var>current parent/var> be var>root/var>.li>p>Increment var>index/var> by one.li>p>Set var>start index/var> to the value of var>saved start index/var>.li>p>Let var>saved start index/var> be null./ol> p>When the steps above say to dfn idpush-a-ruby-annotation>push a ruby annotation/dfn>, it means to run the following steps at that point in the algorithm:/p> ol>li>p>Let var>rt/var> be the code idthe-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 hrefhttps://dom.spec.whatwg.org/#concept-range-start idthe-ruby-element:concept-range-start-2 data-x-internalconcept-range-start>start/a> is the a hrefhttps://dom.spec.whatwg.org/#concept-range-bp idthe-ruby-element:concept-range-bp-3 data-x-internalconcept-range-bp>boundary point/a> (var>current parent/var>, var>index/var>) and whose a hrefhttps://dom.spec.whatwg.org/#concept-range-end idthe-ruby-element:concept-range-end-2 data-x-internalconcept-range-end>end/a> is the a hrefhttps://dom.spec.whatwg.org/#concept-range-bp idthe-ruby-element:concept-range-bp-4 data-x-internalconcept-range-bp>boundary point/a> (var>current parent/var>, var>index/var> plus one) (i.e. that contains only var>rt/var>).li>p>Let var>new annotation segment/var> be an annotation segment described by the range var>annotation range/var>.li>p>If var>current base text/var> is not null, associate var>new annotation segment/var> with var>current base text/var>.li>p>Add var>new annotation segment/var> to var>annotation segments/var>./ol> div classexample> p>In this example, each ideograph in the Japanese text span langja>漢字/span> is annotated with its reading in hiragana./p> pre langja>...<ruby>漢<rt>かん</rt>字<rt>じ</rt></ruby>.../pre> p>This might be rendered as:/p> p>img src/images/sample-ruby-ja.png width171 altThe two main ideographs, each with its annotation in hiragana rendered in a smaller font above it. height78>/p> /div> div classexample> p>In this example, each ideograph in the traditional Chinese text span langzh-TW>漢字/span> is annotated with its bopomofo reading./p> pre langzh-TW><ruby>漢<rt>ㄏㄢˋ</rt>字<rt>ㄗˋ</rt></ruby>/pre> p>This might be rendered as:/p> p>img src/images/sample-ruby-bopomofo.png width78 altThe two main ideographs, each with its bopomofo annotation rendered in a smaller font next to it. height100>/p> /div> div classexample> p>In this example, each ideograph in the simplified Chinese text span langzh-CN>汉字/span> is annotated with its pinyin reading./p> pre langzh-CN>...<ruby>汉<rt>hàn</rt>字<rt>zì</rt></ruby>.../pre> p>This might be rendered as:/p> p>img src/images/sample-ruby-pinyin.png width173 altThe two main ideographs, each with its pinyin annotation rendered in a smaller font above it. height79>/p> /div> div classexample> p>In this more contrived example, the acronym HTML has four annotations: one for the whole acronym, briefly describing what it is, one for the letters HT expanding them to Hypertext, one for the letter M expanding it to Markup, and one for the letter L expanding it to Language./p> pre><ruby> <ruby>HT<rt>Hypertext</rt>M<rt>Markup</rt>L<rt>Language</rt></ruby> <rt>An abstract language for describing documents and applications</ruby>/pre> /div> h4 idthe-rt-element>span classsecno>4.5.11/span> The dfn>code>rt/code>/dfn> elementa href#the-rt-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-rt-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-rt-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As a child of a code idthe-rt-element:the-ruby-element>a href#the-ruby-element>ruby/a>/code> element.dt>a href#concept-element-content-model idthe-rt-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-rt-element:phrasing-content-2>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-rt-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>An code idthe-rt-element:the-rt-element>a href#the-rt-element>rt/a>/code> elements a href#syntax-end-tag idthe-rt-element:syntax-end-tag>end tag/a> can be omitted if the code idthe-rt-element:the-rt-element-2>a href#the-rt-element>rt/a>/code> element is immediately followed by an code idthe-rt-element:the-rt-element-3>a href#the-rt-element>rt/a>/code> or code idthe-rt-element:the-rp-element>a href#the-rp-element>rp/a>/code> element, or if there is no more content in the parent element.dt>a href#concept-element-attributes idthe-rt-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-rt-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-rt-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-rt-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-rt-element:the-rt-element-4>a href#the-rt-element>rt/a>/code> element marks the ruby text component of a ruby annotation. When it is the child of a code idthe-rt-element:the-ruby-element-2>a href#the-ruby-element>ruby/a>/code> element, it doesnt a href#represents idthe-rt-element:represents>represent/a> anything itself, but the code idthe-rt-element:the-ruby-element-3>a href#the-ruby-element>ruby/a>/code> element uses it as part of determining what em>it/em> a href#represents idthe-rt-element:represents-2>represents/a>./p> p>An code idthe-rt-element:the-rt-element-5>a href#the-rt-element>rt/a>/code> element that is not a child of a code idthe-rt-element:the-ruby-element-4>a href#the-ruby-element>ruby/a>/code> element a href#represents idthe-rt-element:represents-3>represents/a> the same thing as its children./p> h4 idthe-rp-element>span classsecno>4.5.12/span> The dfn>code>rp/code>/dfn> elementa href#the-rp-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-rp-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-rp-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As a child of a code idthe-rp-element:the-ruby-element>a href#the-ruby-element>ruby/a>/code> element, either immediately before or immediately after an code idthe-rp-element:the-rt-element>a href#the-rt-element>rt/a>/code> element.dt>a href#concept-element-content-model idthe-rp-element:concept-element-content-model>Content model/a>:dd>a href#text-content idthe-rp-element:text-content>Text/a>.dt>a href#concept-element-tag-omission idthe-rp-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>An code idthe-rp-element:the-rp-element>a href#the-rp-element>rp/a>/code> elements a href#syntax-end-tag idthe-rp-element:syntax-end-tag>end tag/a> can be omitted if the code idthe-rp-element:the-rp-element-2>a href#the-rp-element>rp/a>/code> element is immediately followed by an code idthe-rp-element:the-rt-element-2>a href#the-rt-element>rt/a>/code> or code idthe-rp-element:the-rp-element-3>a href#the-rp-element>rp/a>/code> element, or if there is no more content in the parent element.dt>a href#concept-element-attributes idthe-rp-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-rp-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-rp-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-rp-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-rp-element:the-rp-element-4>a href#the-rp-element>rp/a>/code> element can be used to provide parentheses or other content around a ruby text component of a ruby annotation, to be shown by user agents that dont support ruby annotations./p> p>An code idthe-rp-element:the-rp-element-5>a href#the-rp-element>rp/a>/code> element that is a child of a code idthe-rp-element:the-ruby-element-2>a href#the-ruby-element>ruby/a>/code> element a href#represents idthe-rp-element:represents>represents/a> nothing. An code idthe-rp-element:the-rp-element-6>a href#the-rp-element>rp/a>/code> element whose parent element is not a code idthe-rp-element:the-ruby-element-3>a href#the-ruby-element>ruby/a>/code> element a href#represents idthe-rp-element:represents-2>represents/a> its children./p> div classexample> p>The example above, in which each ideograph in the text span langja>漢字/span> is annotated with its phonetic reading, could be expanded to use code idthe-rp-element:the-rp-element-7>a href#the-rp-element>rp/a>/code> so that in legacy user agents the readings are in parentheses:/p> pre langja>...<ruby>漢<rp>(</rp><rt>かん</rt><rp>)</rp>字<rp>(</rp><rt>じ</rt><rp>)</rp></ruby>.../pre> p>In conforming user agents the rendering would be as above, but in user agents that do not support ruby, the rendering would be:/p> pre langja>... 漢(かん)字(じ).../pre> /div> div classexample> p>When there are multiple annotations for a segment, code idthe-rp-element:the-rp-element-8>a href#the-rp-element>rp/a>/code> elements can also be placed between the annotations. Here is another copy of an earlier contrived example showing some symbols with names given in English and French, but this time with code idthe-rp-element:the-rp-element-9>a href#the-rp-element>rp/a>/code> elements as well: pre><ruby>♥<rp>: </rp><rt>Heart</rt><rp>, </rp><rt langfr>Cœur</rt><rp>.</rp>☘<rp>: </rp><rt>Shamrock</rt><rp>, </rp><rt langfr>Trèfle</rt><rp>.</rp>✶<rp>: </rp><rt>Star</rt><rp>, </rp><rt langfr>Étoile</rt><rp>.</rp></ruby>/pre> p>This would make the example render as follows in non-ruby-capable user agents: pre>♥: Heart, span langfr>Cœur/span>. ☘: Shamrock, span langfr>Trèfle/span>. ✶: Star, span langfr>Étoile/span>./pre> /div> h4 idthe-data-element>span classsecno>4.5.13/span> The dfn>code>data/code>/dfn> elementa href#the-data-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-data-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-data-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-data-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-data-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-data-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-data-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-data-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-data-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-data-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-data-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-data-element:global-attributes>Global attributes/a>dd>code idthe-data-element:attr-data-value>a href#attr-data-value>value/a>/code> — Machine-readable valuedt>a href#concept-element-dom idthe-data-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-data-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmldataelement>HTMLDataElement/dfn> : a href#htmlelement idthe-data-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-data-element:cereactions>CEReactions/a> attribute DOMString a href#dom-data-value idthe-data-element:dom-data-value>value/a>;};/pre> /dl> p>The code idthe-data-element:the-data-element>a href#the-data-element>data/a>/code> element a href#represents idthe-data-element:represents>represents/a> its contents, along with a machine-readable form of those contents in the code idthe-data-element:attr-data-value-2>a href#attr-data-value>value/a>/code> attribute./p> p>The dfn idattr-data-value>code>value/code>/dfn> attribute must be present. Its value must be a representation of the elements contents in a machine-readable format./p> p classnote>When the value is date- or time-related, the more specific code idthe-data-element:the-time-element>a href#the-time-element>time/a>/code> element can be used instead./p> p>The element can be used for several purposes./p> p>When combined with microformats or the a href#microdata>microdata attributes/a> defined in this specification, the element serves to provide both a machine-readable value for the purposes of data processors, and a human-readable value for the purposes of rendering in a Web browser. In this case, the format to be used in the code idthe-data-element:attr-data-value-3>a href#attr-data-value>value/a>/code> attribute is determined by the microformats or microdata vocabulary in use./p> p>The element can also, however, be used in conjunction with scripts in the page, for when a script has a literal value to store alongside a human-readable value. In such cases, the format to be used depends only on the needs of the script. (The code idthe-data-element:attr-data-*>a href#attr-data-*>data-*/a>/code> attributes can also be useful in such situations.)/p> p>The dfn iddom-data-value>code>value/code>/dfn> IDL attribute must a href#reflect idthe-data-element:reflect>reflect/a> the content attribute of the same name./p> div classexample> p>Here, a short table has its numeric values encoded using the code idthe-data-element:the-data-element-2>a href#the-data-element>data/a>/code> element so that the table sorting JavaScript library can provide a sorting mechanism on each column despite the numbers being presented in textual form in one column and in a decomposed form in another./p> pre><script srcsortable.js></script><table classsortable> <thead> <tr> <th> Game <th> Corporations <th> Map Size <tbody> <tr> <td> 1830 <td> <data value8>Eight</data> <td> <data value93>19+74 hexes (93 total)</data> <tr> <td> 1856 <td> <data value11>Eleven</data> <td> <data value99>12+87 hexes (99 total)</data> <tr> <td> 1870 <td> <data value10>Ten</data> <td> <data value149>4+145 hexes (149 total)</data></table>/pre> /div> h4 idthe-time-element>span classsecno>4.5.14/span> The dfn>code>time/code>/dfn> elementa href#the-time-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-time-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-time-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-time-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-time-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-time-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-time-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-time-element:concept-element-content-model>Content model/a>:dd>If the element has a code idthe-time-element:attr-time-datetime>a href#attr-time-datetime>datetime/a>/code> attribute: a href#phrasing-content-2 idthe-time-element:phrasing-content-2-3>Phrasing content/a>.dd>Otherwise: a href#text-content idthe-time-element:text-content>Text/a>, but must match requirements described in prose below.dt>a href#concept-element-tag-omission idthe-time-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-time-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-time-element:global-attributes>Global attributes/a>dd>code idthe-time-element:attr-time-datetime-2>a href#attr-time-datetime>datetime/a>/code> — Machine-readable valuedt>a href#concept-element-dom idthe-time-element:concept-element-dom>DOM interface/a>:dd>pre classidl>ExposedWindow, a href#htmlconstructor idthe-time-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmltimeelement>HTMLTimeElement/dfn> : a href#htmlelement idthe-time-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-time-element:cereactions>CEReactions/a> attribute DOMString a href#dom-time-datetime idthe-time-element:dom-time-datetime>dateTime/a>;};/pre> /dl> p>The code idthe-time-element:the-time-element>a href#the-time-element>time/a>/code> element a href#represents idthe-time-element:represents>represents/a> its contents, along with a machine-readable form of those contents in the code idthe-time-element:attr-time-datetime-3>a href#attr-time-datetime>datetime/a>/code> attribute. The kind of content is limited to various kinds of dates, times, time-zone offsets, and durations, as described below./p> p>The dfn idattr-time-datetime>code>datetime/code>/dfn> attribute may be present. If present, its value must be a representation of the elements contents in a machine-readable format./p> p>A code idthe-time-element:the-time-element-2>a href#the-time-element>time/a>/code> element that does not have a code idthe-time-element:attr-time-datetime-4>a href#attr-time-datetime>datetime/a>/code> content attribute must not have any element descendants./p> p>The dfn iddatetime-value>datetime value/dfn> of a code idthe-time-element:the-time-element-3>a href#the-time-element>time/a>/code> element is the value of the elements code idthe-time-element:attr-time-datetime-5>a href#attr-time-datetime>datetime/a>/code> content attribute, if it has one, otherwise the a idthe-time-element:child-text-content hrefhttps://dom.spec.whatwg.org/#concept-child-text-content data-x-internalchild-text-content>child text content/a> of the code idthe-time-element:the-time-element-4>a href#the-time-element>time/a>/code> element./p> p>The a href#datetime-value idthe-time-element:datetime-value>datetime value/a> of a code idthe-time-element:the-time-element-5>a href#the-time-element>time/a>/code> element must match one of the following syntaxes./p> dl>dt>A a href#valid-month-string idthe-time-element:valid-month-string>valid month string/a>dd> pre classexample><time>2011-11</time>/pre> dt>A a href#valid-date-string idthe-time-element:valid-date-string>valid date string/a>dd> pre classexample><time>2011-11-18</time>/pre> dt>A a href#valid-yearless-date-string idthe-time-element:valid-yearless-date-string>valid yearless date string/a>dd> pre classexample><time>11-18</time>/pre> dt>A a href#valid-time-string idthe-time-element:valid-time-string>valid time string/a>dd> pre classexample><time>14:54</time>/pre> pre classexample><time>14:54:39</time>/pre> pre classexample><time>14:54:39.929</time>/pre> dt>A a href#valid-local-date-and-time-string idthe-time-element:valid-local-date-and-time-string>valid local date and time string/a>dd> pre classexample><time>2011-11-18T14:54</time>/pre> pre classexample><time>2011-11-18T14:54:39</time>/pre> pre classexample><time>2011-11-18T14:54:39.929</time>/pre> pre classexample><time>2011-11-18 14:54</time>/pre> pre classexample><time>2011-11-18 14:54:39</time>/pre> pre classexample><time>2011-11-18 14:54:39.929</time>/pre> p classnote>Times with dates but without a time zone offset are useful for specifying events that are observed at the same specific time in each time zone, throughout a day. For example, the 2020 new year is celebrated at 2020-01-01 00:00 in each time zone, not at the same precise moment across all time zones. For events that occur at the same time across all time zones, for example a videoconference meeting, a a href#valid-global-date-and-time-string idthe-time-element:valid-global-date-and-time-string>valid global date and time string/a> is likely more useful./p> dt>A a href#valid-time-zone-offset-string idthe-time-element:valid-time-zone-offset-string>valid time-zone offset string/a>dd> pre classexample><time>Z</time>/pre> pre classexample><time>+0000</time>/pre> pre classexample><time>+00:00</time>/pre> pre classexample><time>-0800</time>/pre> pre classexample><time>-08:00</time>/pre> p classnote>For times without dates (or times referring to events that recur on multiple dates), specifying the geographic location that controls the time is usually more useful than specifying a time zone offset, because geographic locations change time zone offsets with daylight saving time. In some cases, geographic locations even change time zone, e.g. when the boundaries of those time zones are redrawn, as happened with Samoa at the end of 2011. There exists a time zone database that describes the boundaries of time zones and what rules apply within each such zone, known as the i>time zone database/i>. a href#refsTZDATABASE>TZDATABASE/a>/p> dt>A a href#valid-global-date-and-time-string idthe-time-element:valid-global-date-and-time-string-2>valid global date and time string/a>dd> pre classexample><time>2011-11-18T14:54Z</time>/pre> pre classexample><time>2011-11-18T14:54:39Z</time>/pre> pre classexample><time>2011-11-18T14:54:39.929Z</time>/pre> pre classexample><time>2011-11-18T14:54+0000</time>/pre> pre classexample><time>2011-11-18T14:54:39+0000</time>/pre> pre classexample><time>2011-11-18T14:54:39.929+0000</time>/pre> pre classexample><time>2011-11-18T14:54+00:00</time>/pre> pre classexample><time>2011-11-18T14:54:39+00:00</time>/pre> pre classexample><time>2011-11-18T14:54:39.929+00:00</time>/pre> pre classexample><time>2011-11-18T06:54-0800</time>/pre> pre classexample><time>2011-11-18T06:54:39-0800</time>/pre> pre classexample><time>2011-11-18T06:54:39.929-0800</time>/pre> pre classexample><time>2011-11-18T06:54-08:00</time>/pre> pre classexample><time>2011-11-18T06:54:39-08:00</time>/pre> pre classexample><time>2011-11-18T06:54:39.929-08:00</time>/pre> pre classexample><time>2011-11-18 14:54Z</time>/pre> pre classexample><time>2011-11-18 14:54:39Z</time>/pre> pre classexample><time>2011-11-18 14:54:39.929Z</time>/pre> pre classexample><time>2011-11-18 14:54+0000</time>/pre> pre classexample><time>2011-11-18 14:54:39+0000</time>/pre> pre classexample><time>2011-11-18 14:54:39.929+0000</time>/pre> pre classexample><time>2011-11-18 14:54+00:00</time>/pre> pre classexample><time>2011-11-18 14:54:39+00:00</time>/pre> pre classexample><time>2011-11-18 14:54:39.929+00:00</time>/pre> pre classexample><time>2011-11-18 06:54-0800</time>/pre> pre classexample><time>2011-11-18 06:54:39-0800</time>/pre> pre classexample><time>2011-11-18 06:54:39.929-0800</time>/pre> pre classexample><time>2011-11-18 06:54-08:00</time>/pre> pre classexample><time>2011-11-18 06:54:39-08:00</time>/pre> pre classexample><time>2011-11-18 06:54:39.929-08:00</time>/pre> p classnote>Times with dates and a time zone offset are useful for specifying specific events, or recurring virtual events where the time is not anchored to a specific geographic location. For example, the precise time of an asteroid impact, or a particular meeting in a series of meetings held at 1400 UTC every day, regardless of whether any particular part of the world is observing daylight saving time or not. For events where the precise time varies by the local time zone offset of a specific geographic location, a a href#valid-local-date-and-time-string idthe-time-element:valid-local-date-and-time-string-2>valid local date and time string/a> combined with that geographic location is likely more useful./p> dt>A a href#valid-week-string idthe-time-element:valid-week-string>valid week string/a>dd> pre classexample><time>2011-W47</time>/pre> dt>Four or more a idthe-time-element:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, at least one of which is not U+0030 DIGIT ZERO (0)dd> pre classexample><time>2011</time>/pre> pre classexample><time>0001</time>/pre> dt>A a href#valid-duration-string idthe-time-element:valid-duration-string>valid duration string/a>dd> pre classexample><time>PT4H18M3S</time>/pre> pre classexample><time>4h 18m 3s</time>/pre> /dl> p>The dfn idmachine-readable-equivalent-of-the-elements-contents>machine-readable equivalent of the elements contents/dfn> must be obtained from the elements a href#datetime-value idthe-time-element:datetime-value-2>datetime value/a> by using the following algorithm:/p> ol>li>p>If a href#parse-a-month-string idthe-time-element:parse-a-month-string>parsing a month string/a> from the elements a href#datetime-value idthe-time-element:datetime-value-3>datetime value/a> returns a a href#concept-month idthe-time-element:concept-month>month/a>, that is the machine-readable equivalent; abort these steps.li>p>If a href#parse-a-date-string idthe-time-element:parse-a-date-string>parsing a date string/a> from the elements a href#datetime-value idthe-time-element:datetime-value-4>datetime value/a> returns a a href#concept-date idthe-time-element:concept-date>date/a>, that is the machine-readable equivalent; abort these steps.li>p>If a href#parse-a-yearless-date-string idthe-time-element:parse-a-yearless-date-string>parsing a yearless date string/a> from the elements a href#datetime-value idthe-time-element:datetime-value-5>datetime value/a> returns a a href#concept-yearless-date idthe-time-element:concept-yearless-date>yearless date/a>, that is the machine-readable equivalent; abort these steps.li>p>If a href#parse-a-time-string idthe-time-element:parse-a-time-string>parsing a time string/a> from the elements a href#datetime-value idthe-time-element:datetime-value-6>datetime value/a> returns a a href#concept-time idthe-time-element:concept-time>time/a>, that is the machine-readable equivalent; abort these steps.li>p>If a href#parse-a-local-date-and-time-string idthe-time-element:parse-a-local-date-and-time-string>parsing a local date and time string/a> from the elements a href#datetime-value idthe-time-element:datetime-value-7>datetime value/a> returns a a href#concept-datetime-local idthe-time-element:concept-datetime-local>local date and time/a>, that is the machine-readable equivalent; abort these steps.li>p>If a href#parse-a-time-zone-offset-string idthe-time-element:parse-a-time-zone-offset-string>parsing a time-zone offset string/a> from the elements a href#datetime-value idthe-time-element:datetime-value-8>datetime value/a> returns a a href#concept-timezone idthe-time-element:concept-timezone>time-zone offset/a>, that is the machine-readable equivalent; abort these steps.li>p>If a href#parse-a-global-date-and-time-string idthe-time-element:parse-a-global-date-and-time-string>parsing a global date and time string/a> from the elements a href#datetime-value idthe-time-element:datetime-value-9>datetime value/a> returns a a href#concept-datetime idthe-time-element:concept-datetime>global date and time/a>, that is the machine-readable equivalent; abort these steps.li>p>If a href#parse-a-week-string idthe-time-element:parse-a-week-string>parsing a week string/a> from the elements a href#datetime-value idthe-time-element:datetime-value-10>datetime value/a> returns a a href#concept-week idthe-time-element:concept-week>week/a>, that is the machine-readable equivalent; abort these steps.li>p>If the elements a href#datetime-value idthe-time-element:datetime-value-11>datetime value/a> consists of only a idthe-time-element:ascii-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, at least one of which is not U+0030 DIGIT ZERO (0), then the machine-readable equivalent is the base-ten interpretation of those digits, representing a year; abort these steps.li>p>If a href#parse-a-duration-string idthe-time-element:parse-a-duration-string>parsing a duration string/a> from the elements a href#datetime-value idthe-time-element:datetime-value-12>datetime value/a> returns a a href#concept-duration idthe-time-element:concept-duration>duration/a>, that is the machine-readable equivalent; abort these steps.li>p>There is no machine-readable equivalent./ol> p classnote>The algorithms referenced above are intended to be designed such that for any arbitrary string var>s/var>, only one of the algorithms returns a value. A more efficient approach might be to create a single algorithm that parses all these data types in one pass; developing such an algorithm is left as an exercise to the reader./p> p>The dfn iddom-time-datetime>code>dateTime/code>/dfn> IDL attribute must a href#reflect idthe-time-element:reflect>reflect/a> the elements code idthe-time-element:attr-time-datetime-6>a href#attr-time-datetime>datetime/a>/code> content attribute./p> div classexample> p>The code idthe-time-element:the-time-element-6>a href#the-time-element>time/a>/code> element can be used to encode dates, for example in microformats. The following shows a hypothetical way of encoding an event using a variant on hCalendar that uses the code idthe-time-element:the-time-element-7>a href#the-time-element>time/a>/code> element:/p> pre><div classvevent> <a classurl hrefhttp://www.web2con.com/>http://www.web2con.com/</a> <span classsummary>Web 2.0 Conference</span>: <time classdtstart datetime2005-10-05>October 5</time> - <time classdtend datetime2005-10-07>7</time>, at the <span classlocation>Argent Hotel, San Francisco, CA</span></div>/pre> /div> div classexample> p>Here, a fictional microdata vocabulary based on the Atom vocabulary is used with the code idthe-time-element:the-time-element-8>a href#the-time-element>time/a>/code> element to mark up a blog posts publication date./p> pre><article itemscope itemtypehttps://n.example.org/rfc4287> <h1 itemproptitle>Big tasks</h1> <footer>Published <time itemproppublished datetime2009-08-29>two days ago</time>.</footer> <p itempropcontent>Today, I went out and bought a bike for my kid.</p></article>/pre> /div> div classexample> p>In this example, another articles publication date is marked up using code idthe-time-element:the-time-element-9>a href#the-time-element>time/a>/code>, this time using the schema.org microdata vocabulary:/p> pre><article itemscope itemtypehttp://schema.org/BlogPosting> <h1 itempropheadline>Small tasks</h1> <footer>Published <time itempropdatePublished datetime2009-08-30>yesterday</time>.</footer> <p itemproparticleBody>I put a bike bell on her bike.</p></article>/pre> /div> div classexample> p>In the following snippet, the code idthe-time-element:the-time-element-10>a href#the-time-element>time/a>/code> element is used to encode a date in the ISO8601 format, for later processing by a script:/p> pre><p>Our first date was <time datetime2006-09-23>a Saturday</time>.</p>/pre> p>In this second snippet, the value includes a time:/p> pre><p>We stopped talking at <time datetime2006-09-24T05:00-07:00>5am the next morning</time>.</p>/pre> p>A script loaded by the page (and thus privy to the pages internal convention of marking up dates and times using the code idthe-time-element:the-time-element-11>a href#the-time-element>time/a>/code> element) could scan through the page and look at all the code idthe-time-element:the-time-element-12>a href#the-time-element>time/a>/code> elements therein to create an index of dates and times./p> /div> div classexample> p>For example, this element conveys the string Friday with the additional semantic that the 18th of November 2011 is the meaning that corresponds to Friday:/p> pre>Today is <time datetime2011-11-18>Friday</time>./pre> /div> div classexample> p>In this example, a specific time in the Pacific Standard Time timezone is specified:/p> pre>Your next meeting is at <time datetime2011-11-18T15:00-08:00>3pm</time>./pre> /div> h4 idthe-code-element>span classsecno>4.5.15/span> The dfn>code>code/code>/dfn> elementa href#the-code-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-code-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-code-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-code-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-code-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-code-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-code-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-code-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-code-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-code-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-code-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-code-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-code-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-code-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-code-element:the-code-element>a href#the-code-element>code/a>/code> element a href#represents idthe-code-element:represents>represents/a> a fragment of computer code. This could be an XML element name, a file name, a computer program, or any other string that a computer would recognize./p> p>There is no formal way to indicate the language of computer code being marked up. Authors who wish to mark code idthe-code-element:the-code-element-2>a href#the-code-element>code/a>/code> elements with the language used, e.g. so that syntax highlighting scripts can use the right rules, can use the code idthe-code-element:classes>a href#classes>class/a>/code> attribute, e.g. by adding a class prefixed with code>language-/code> to the element./p> div classexample> p>The following example shows how the element can be used in a paragraph to mark up element names and computer code, including punctuation./p> pre><p>The <code>code</code> element represents a fragment of computercode.</p><p>When you call the <code>activate()</code> method on the<code>robotSnowman</code> object, the eyes glow.</p><p>The example below uses the <code>begin</code> keyword to indicatethe start of a statement block. It is paired with an <code>end</code>keyword, which is followed by the <code>.</code> punctuation character(full stop) to indicate the end of the program.</p>/pre> /div> div classexample> p>The following example shows how a block of code could be marked up using the code idthe-code-element:the-pre-element>a href#the-pre-element>pre/a>/code> and code idthe-code-element:the-code-element-3>a href#the-code-element>code/a>/code> elements./p> pre><pre><code classlanguage-pascal>var i: Integer;begin i : 1;end.</code></pre>/pre> p>A class is used in that example to indicate the language used./p> /div> p classnote>See the code idthe-code-element:the-pre-element-2>a href#the-pre-element>pre/a>/code> element for more details./p> h4 idthe-var-element>span classsecno>4.5.16/span> The dfn>code>var/code>/dfn> elementa href#the-var-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-var-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-var-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-var-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-var-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-var-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-var-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-var-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-var-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-var-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-var-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-var-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-var-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-var-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-var-element:the-var-element>a href#the-var-element>var/a>/code> element a href#represents idthe-var-element:represents>represents/a> a variable. This could be an actual variable in a mathematical expression or programming context, an identifier representing a constant, a symbol identifying a physical quantity, a function parameter, or just be a term used as a placeholder in prose./p> div classexample> p>In the paragraph below, the letter n is being used as a variable in prose:/p> pre><p>If there are <var>n</var> pipes leading to the icecream factory then I expect at <em>least</em> <var>n</var>flavors of ice cream to be available for purchase!</p>/pre> /div> p>For mathematics, in particular for anything beyond the simplest of expressions, MathML is more appropriate. However, the code idthe-var-element:the-var-element-2>a href#the-var-element>var/a>/code> element can still be used to refer to specific variables that are then mentioned in MathML expressions./p> div classexample> p>In this example, an equation is shown, with a legend that references the variables in the equation. The expression itself is marked up with MathML, but the variables are mentioned in the figures legend using code idthe-var-element:the-var-element-3>a href#the-var-element>var/a>/code>./p> pre><figure> <math> <mi>a</mi> <mo></mo> <msqrt> <msup><mi>b</mi><mn>2</mn></msup> <mi>+</mi> <msup><mi>c</mi><mn>2</mn></msup> </msqrt> </math> <figcaption> Using Pythagoras theorem to solve for the hypotenuse <var>a</var> of a triangle with sides <var>b</var> and <var>c</var> </figcaption></figure>/pre> /div> div classexample> p>Here, the equation describing mass-energy equivalence is used in a sentence, and the code idthe-var-element:the-var-element-4>a href#the-var-element>var/a>/code> element is used to mark the variables and constants in that equation:/p> pre><p>Then she turned to the blackboard and picked up the chalk. After a few momentsthought, she wrote <var>E</var> <var>m</var> <var>c</var><sup>2</sup>. The teacherlooked pleased.</p>/pre> /div> h4 idthe-samp-element>span classsecno>4.5.17/span> The dfn>code>samp/code>/dfn> elementa href#the-samp-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-samp-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-samp-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-samp-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-samp-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-samp-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-samp-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-samp-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-samp-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-samp-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-samp-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-samp-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-samp-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-samp-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-samp-element:the-samp-element>a href#the-samp-element>samp/a>/code> element a href#represents idthe-samp-element:represents>represents/a> sample or quoted output from another program or computing system./p> p classnote>See the code idthe-samp-element:the-pre-element>a href#the-pre-element>pre/a>/code> and code idthe-samp-element:the-kbd-element>a href#the-kbd-element>kbd/a>/code> elements for more details./p> p classnote>This element can be contrasted with the code idthe-samp-element:the-output-element>a href#the-output-element>output/a>/code> element, which can be used to provide immediate output in a Web application./p> div classexample> p>This example shows the code idthe-samp-element:the-samp-element-2>a href#the-samp-element>samp/a>/code> element being used inline:/p> pre><p>The computer said <samp>Too much cheese in traytwo</samp> but I didnt know what that meant.</p>/pre> /div> div classexample> p>This second example shows a block of sample output from a console program. Nested code idthe-samp-element:the-samp-element-3>a href#the-samp-element>samp/a>/code> and code idthe-samp-element:the-kbd-element-2>a href#the-kbd-element>kbd/a>/code> elements allow for the styling of specific elements of the sample output using a style sheet. Theres also a few parts of the code idthe-samp-element:the-samp-element-4>a href#the-samp-element>samp/a>/code> that are annotated with even more detailed markup, to enable very precise styling. To achieve this, code idthe-samp-element:the-span-element>a href#the-span-element>span/a>/code> elements are used./p> pre><pre><samp><span classprompt>jdoe@mowmow:~$</span> <kbd>ssh demo.example.com</kbd>Last login: Tue Apr 12 09:10:17 2005 from mowmow.example.com on pts/1Linux demo 2.6.10-grsec+gg3+e+fhs6b+nfs+gr0501+++p3+c4a+gr2b-reslog-v6.189 #1 SMP Tue Feb 1 11:22:36 PST 2005 i686 unknown<span classprompt>jdoe@demo:~$</span> <span classcursor>_</span></samp></pre>/pre> /div> div classexample> p>This third example shows a block of input and its respective output. The example uses both code idthe-samp-element:the-code-element>a href#the-code-element>code/a>/code> and code idthe-samp-element:the-samp-element-5>a href#the-samp-element>samp/a>/code> elements./p> pre><pre><code classlanguage-javascript>console.log(2.3 + 2.4)</code><samp>4.699999999999999</samp></pre>/pre> /div> h4 idthe-kbd-element>span classsecno>4.5.18/span> The dfn>code>kbd/code>/dfn> elementa href#the-kbd-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-kbd-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-kbd-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-kbd-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-kbd-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-kbd-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-kbd-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-kbd-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-kbd-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-kbd-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-kbd-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-kbd-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-kbd-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-kbd-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-kbd-element:the-kbd-element>a href#the-kbd-element>kbd/a>/code> element a href#represents idthe-kbd-element:represents>represents/a> user input (typically keyboard input, although it may also be used to represent other input, such as voice commands)./p> p>When the code idthe-kbd-element:the-kbd-element-2>a href#the-kbd-element>kbd/a>/code> element is nested inside a code idthe-kbd-element:the-samp-element>a href#the-samp-element>samp/a>/code> element, it represents the input as it was echoed by the system./p> p>When the code idthe-kbd-element:the-kbd-element-3>a href#the-kbd-element>kbd/a>/code> element em>contains/em> a code idthe-kbd-element:the-samp-element-2>a href#the-samp-element>samp/a>/code> element, it represents input based on system output, for example invoking a menu item./p> p>When the code idthe-kbd-element:the-kbd-element-4>a href#the-kbd-element>kbd/a>/code> element is nested inside another code idthe-kbd-element:the-kbd-element-5>a href#the-kbd-element>kbd/a>/code> element, it represents an actual key or other single unit of input as appropriate for the input mechanism./p> div classexample> p>Here the code idthe-kbd-element:the-kbd-element-6>a href#the-kbd-element>kbd/a>/code> element is used to indicate keys to press:/p> pre><p>To make George eat an apple, press <kbd><kbd>Shift</kbd>+<kbd>F3</kbd></kbd></p>/pre> p>In this second example, the user is told to pick a particular menu item. The outer code idthe-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 idthe-kbd-element:the-kbd-element-8>a href#the-kbd-element>kbd/a>/code> elements representing each individual step of the input, and the code idthe-kbd-element:the-samp-element-3>a href#the-samp-element>samp/a>/code> elements inside them indicating that the steps are input based on something being displayed by the system, in this case menu labels:/p> pre><p>To make George eat an apple, select <kbd><kbd><samp>File</samp></kbd>|<kbd><samp>Eat Apple...</samp></kbd></kbd></p>/pre> p>Such precision isnt necessary; the following is equally fine:/p> pre><p>To make George eat an apple, select <kbd>File | Eat Apple...</kbd></p>/pre> /div> h4 idthe-sub-and-sup-elements>span classsecno>4.5.19/span> The dfn idthe-sub-element>code>sub/code>/dfn> and dfn idthe-sup-element>code>sup/code>/dfn> elementsa href#the-sub-and-sup-elements classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-sub-and-sup-elements:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-sub-and-sup-elements:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-sub-and-sup-elements:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-sub-and-sup-elements:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-sub-and-sup-elements:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-sub-and-sup-elements:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-sub-and-sup-elements:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-sub-and-sup-elements:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-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 idthe-sub-and-sup-elements:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-sub-and-sup-elements:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-sub-and-sup-elements:concept-element-dom>DOM interface/a>:dd>Use code idthe-sub-and-sup-elements:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-sub-and-sup-elements:the-sub-and-sup-elements>a href#the-sub-and-sup-elements>sup/a>/code> element a href#represents idthe-sub-and-sup-elements:represents>represents/a> a superscript and the code idthe-sub-and-sup-elements:the-sub-and-sup-elements-2>a href#the-sub-and-sup-elements>sub/a>/code> element a href#represents idthe-sub-and-sup-elements:represents-2>represents/a> a subscript./p> p>These elements must be used only to mark up typographical conventions with specific meanings, not for typographical presentation for presentations sake. For example, it would be inappropriate for the code idthe-sub-and-sup-elements:the-sub-and-sup-elements-3>a href#the-sub-and-sup-elements>sub/a>/code> and code idthe-sub-and-sup-elements:the-sub-and-sup-elements-4>a href#the-sub-and-sup-elements>sup/a>/code> elements to be used in the name of the LaTeX document preparation system. In general, authors should use these elements only if the em>absence/em> of those elements would change the meaning of the content./p> p>In certain languages, superscripts are part of the typographical conventions for some abbreviations./p> div classexample> pre><p>The most beautiful women are<span langfr><abbr>M<sup>lle</sup></abbr> Gwendoline</span> and<span langfr><abbr>M<sup>me</sup></abbr> Denise</span>.</p>/pre> /div> p>The code idthe-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 idthe-sub-and-sup-elements:the-var-element>a href#the-var-element>var/a>/code> element, for variables that have subscripts./p> div classexample> p>Here, the code idthe-sub-and-sup-elements:the-sub-and-sup-elements-6>a href#the-sub-and-sup-elements>sub/a>/code> element is used to represent the subscript that identifies the variable in a family of variables:/p> pre><p>The coordinate of the <var>i</var>th point is(<var>x<sub><var>i</var></sub></var>, <var>y<sub><var>i</var></sub></var>).For example, the 10th point has coordinate(<var>x<sub>10</sub></var>, <var>y<sub>10</sub></var>).</p>/pre> /div> p>Mathematical expressions often use subscripts and superscripts. Authors are encouraged to use MathML for marking up mathematics, but authors may opt to use code idthe-sub-and-sup-elements:the-sub-and-sup-elements-7>a href#the-sub-and-sup-elements>sub/a>/code> and code idthe-sub-and-sup-elements:the-sub-and-sup-elements-8>a href#the-sub-and-sup-elements>sup/a>/code> if detailed mathematical markup is not desired. a href#refsMATHML>MATHML/a>/p> div classexample> pre><var>E</var><var>m</var><var>c</var><sup>2</sup>/pre> pre>f(<var>x</var>, <var>n</var>) log<sub>4</sub><var>x</var><sup><var>n</var></sup>/pre> /div> h4 idthe-i-element>span classsecno>4.5.20/span> The dfn>code>i/code>/dfn> elementa href#the-i-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-i-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-i-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-i-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-i-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-i-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-i-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-i-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-i-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-i-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-i-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-i-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-i-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-i-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-i-element:the-i-element>a href#the-i-element>i/a>/code> element a href#represents idthe-i-element:represents>represents/a> a span of text in an alternate voice or mood, or otherwise offset from the normal prose in a manner indicating a different quality of text, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, transliteration, a thought, or a ship name in Western texts./p> p>Terms in languages different from the main text should be annotated with code idthe-i-element:attr-lang>a href#attr-lang>lang/a>/code> attributes (or, in XML, a href#attr-xml-lang idthe-i-element:attr-xml-lang>code>lang/code> attributes in the span>XML namespace/span>/a>)./p> div classexample> p>The examples below show uses of the code idthe-i-element:the-i-element-2>a href#the-i-element>i/a>/code> element:/p> pre><p>The <i classtaxonomy>Felis silvestris catus</i> is cute.</p><p>The term <i>prose content</i> is defined above.</p><p>There is a certain <i langfr>je ne sais quoi</i> in the air.</p>/pre> p>In the following example, a dream sequence is marked up using code idthe-i-element:the-i-element-3>a href#the-i-element>i/a>/code> elements./p> pre><p>Raymond tried to sleep.</p><p><i>The ship sailed away on Thursday</i>, hedreamt. <i>The ship had many people aboard, including a beautifulprincess called Carey. He watched her, day-in, day-out, hoping shewould notice him, but she never did.</i></p><p><i>Finally one night he picked up the courage to speak withher—</i></p><p>Raymond woke with a start as the fire alarm rang out.</p>/pre> /div> p>Authors can use the code idthe-i-element:classes>a href#classes>class/a>/code> attribute on the code idthe-i-element:the-i-element-4>a href#the-i-element>i/a>/code> element to identify why the element is being used, so that if the style of a particular use (e.g. dream sequences as opposed to taxonomic terms) is to be changed at a later date, the author doesnt have to go through the entire document (or series of related documents) annotating each use./p> p>Authors are encouraged to consider whether other elements might be more applicable than the code idthe-i-element:the-i-element-5>a href#the-i-element>i/a>/code> element, for instance the code idthe-i-element:the-em-element>a href#the-em-element>em/a>/code> element for marking up stress emphasis, or the code idthe-i-element:the-dfn-element>a href#the-dfn-element>dfn/a>/code> element to mark up the defining instance of a term./p> p classnote>Style sheets can be used to format code idthe-i-element:the-i-element-6>a href#the-i-element>i/a>/code> elements, just like any other element can be restyled. Thus, it is not the case that content in code idthe-i-element:the-i-element-7>a href#the-i-element>i/a>/code> elements will necessarily be italicized./p> h4 idthe-b-element>span classsecno>4.5.21/span> The dfn>code>b/code>/dfn> elementa href#the-b-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-b-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-b-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-b-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-b-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-b-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-b-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-b-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-b-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-b-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-b-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-b-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-b-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-b-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-b-element:the-b-element>a href#the-b-element>b/a>/code> element a href#represents idthe-b-element:represents>represents/a> a span of text to which attention is being drawn for utilitarian purposes without conveying any extra importance and with no implication of an alternate voice or mood, such as key words in a document abstract, product names in a review, actionable words in interactive text-driven software, or an article lede./p> div classexample> p>The following example shows a use of the code idthe-b-element:the-b-element-2>a href#the-b-element>b/a>/code> element to highlight key words without marking them up as important:/p> pre><p>The <b>frobonitor</b> and <b>barbinator</b> components are fried.</p>/pre> /div> div classexample> p>In the following example, objects in a text adventure are highlighted as being special by use of the code idthe-b-element:the-b-element-3>a href#the-b-element>b/a>/code> element./p> pre><p>You enter a small room. Your <b>sword</b> glowsbrighter. A <b>rat</b> scurries past the corner wall.</p>/pre> /div> div classexample> p>Another case where the code idthe-b-element:the-b-element-4>a href#the-b-element>b/a>/code> element is appropriate is in marking up the lede (or lead) sentence or paragraph. The following example shows how a a hrefhttp://news.bbc.co.uk/2/hi/uk_news/scotland/north_east/7101506.stm>BBC article about kittens adopting a rabbit as their own/a> could be marked up:/p> pre><article> <h2>Kittens adopted by pet rabbit</h2> <p><b classlede>Six abandoned kittens have found an unexpected new mother figure — a pet rabbit.</b></p> <p>Veterinary nurse Melanie Humble took the three-week-old kittens to her Aberdeen home.</p>i>.../i>/pre> /div> p>As with the code idthe-b-element:the-i-element>a href#the-i-element>i/a>/code> element, authors can use the code idthe-b-element:classes>a href#classes>class/a>/code> attribute on the code idthe-b-element:the-b-element-5>a href#the-b-element>b/a>/code> element to identify why the element is being used, so that if the style of a particular use is to be changed at a later date, the author doesnt have to go through annotating each use./p> p>The code idthe-b-element:the-b-element-6>a href#the-b-element>b/a>/code> element should be used as a last resort when no other element is more appropriate. In particular, headings should use the code idthe-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 idthe-b-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6/a>/code> elements, stress emphasis should use the code idthe-b-element:the-em-element>a href#the-em-element>em/a>/code> element, importance should be denoted with the code idthe-b-element:the-strong-element>a href#the-strong-element>strong/a>/code> element, and text marked or highlighted should use the code idthe-b-element:the-mark-element>a href#the-mark-element>mark/a>/code> element./p> div classexample> p>The following would be em>incorrect/em> usage:/p> pre classbad><p><b>WARNING!</b> Do not frob the barbinator!</p>/pre> p>In the previous example, the correct element to use would have been code idthe-b-element:the-strong-element-2>a href#the-strong-element>strong/a>/code>, not code idthe-b-element:the-b-element-7>a href#the-b-element>b/a>/code>./p> /div> p classnote>Style sheets can be used to format code idthe-b-element:the-b-element-8>a href#the-b-element>b/a>/code> elements, just like any other element can be restyled. Thus, it is not the case that content in code idthe-b-element:the-b-element-9>a href#the-b-element>b/a>/code> elements will necessarily be boldened./p> h4 idthe-u-element>span classsecno>4.5.22/span> The dfn>code>u/code>/dfn> elementa href#the-u-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-u-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-u-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-u-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-u-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-u-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-u-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-u-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-u-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-u-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-u-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-u-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-u-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-u-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-u-element:the-u-element>a href#the-u-element>u/a>/code> element a href#represents idthe-u-element:represents>represents/a> a span of text with an unarticulated, though explicitly rendered, non-textual annotation, such as labeling the text as being a proper name in Chinese text (a Chinese proper name mark), or labeling the text as being misspelt./p> p>In most cases, another element is likely to be more appropriate: for marking stress emphasis, the code idthe-u-element:the-em-element>a href#the-em-element>em/a>/code> element should be used; for marking key words or phrases either the code idthe-u-element:the-b-element>a href#the-b-element>b/a>/code> element or the code idthe-u-element:the-mark-element>a href#the-mark-element>mark/a>/code> element should be used, depending on the context; for marking book titles, the code idthe-u-element:the-cite-element>a href#the-cite-element>cite/a>/code> element should be used; for labeling text with explicit textual annotations, the code idthe-u-element:the-ruby-element>a href#the-ruby-element>ruby/a>/code> element should be used; for technical terms, taxonomic designation, transliteration, a thought, or for labeling ship names in Western texts, the code idthe-u-element:the-i-element>a href#the-i-element>i/a>/code> element should be used./p> p classnote>The default rendering of the code idthe-u-element:the-u-element-2>a href#the-u-element>u/a>/code> element in visual presentations clashes with the conventional rendering of hyperlinks (underlining). Authors are encouraged to avoid using the code idthe-u-element:the-u-element-3>a href#the-u-element>u/a>/code> element where it could be confused for a hyperlink./p> div classexample> p>In this example, a code idthe-u-element:the-u-element-4>a href#the-u-element>u/a>/code> element is used to mark a word as misspelt:/p> pre><p>The <u>see</u> is full of fish.</p>/pre> /div> h4 idthe-mark-element>span classsecno>4.5.23/span> The dfn>code>mark/code>/dfn> elementa href#the-mark-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-mark-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-mark-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-mark-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-mark-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-mark-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-mark-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-mark-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-mark-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-mark-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-mark-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-mark-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-mark-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-mark-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-mark-element:the-mark-element>a href#the-mark-element>mark/a>/code> element a href#represents idthe-mark-element:represents>represents/a> a run of text in one document marked or highlighted for a href#referenced idthe-mark-element:referenced>reference/a> purposes, due to its relevance in another context. When used in a quotation or other block of text referred to from the prose, it indicates a highlight that was not originally present but which has been added to bring the readers attention to a part of the text that might not have been considered important by the original author when the block was originally written, but which is now under previously unexpected scrutiny. When used in the main prose of a document, it indicates a part of the document that has been highlighted due to its likely relevance to the users current activity./p> div classexample> p>This example shows how the code idthe-mark-element:the-mark-element-2>a href#the-mark-element>mark/a>/code> element can be used to bring attention to a particular part of a quotation:/p> pre><p langen-US>Consider the following quote:</p>span langen-GB><blockquote langen-GB> <p>Look around and you will find, no-ones really <mark>colour</mark> blind.</p></blockquote>/span><p langen-US>As we can tell from the <em>spelling</em> of the word,the person writing this quote is clearly not American.</p>/pre> p>(If the goal was to mark the element as misspelt, however, the code idthe-mark-element:the-u-element>a href#the-u-element>u/a>/code> element, possibly with a class, would be more appropriate.)/p> /div> div classexample> p>Another example of the code idthe-mark-element:the-mark-element-3>a href#the-mark-element>mark/a>/code> element is highlighting parts of a document that are matching some search string. If someone looked at a document, and the server knew that the user was searching for the word kitten, then the server might return the document with one paragraph modified as follows:/p> pre><p>I also have some <mark>kitten</mark>s who are visiting methese days. Theyre really cute. I think they like my garden! Maybe Ishould adopt a <mark>kitten</mark>.</p>/pre> /div> div classexample> p>In the following snippet, a paragraph of text refers to a specific part of a code fragment./p> pre><p>The highlighted part below is where the error lies:</p><pre><code>var i: Integer;begin i : <mark>1.1</mark>;end.</code></pre>/pre> p>This is separate from em>syntax highlighting/em>, for which code idthe-mark-element:the-span-element>a href#the-span-element>span/a>/code> is more appropriate. Combining both, one would get:/p> pre><p>The highlighted part below is where the error lies:</p><pre><code><span classkeyword>var</span> <span classident>i</span>: <span classtype>Integer</span>;<span classkeyword>begin</span> <span classident>i</span> : <span classliteral><mark>1.1</mark></span>;<span classkeyword>end</span>.</code></pre>/pre> /div> div classexample> p>This is another example showing the use of code idthe-mark-element:the-mark-element-4>a href#the-mark-element>mark/a>/code> to highlight a part of quoted text that was originally not emphasized. In this example, common typographic conventions have led the author to explicitly style code idthe-mark-element:the-mark-element-5>a href#the-mark-element>mark/a>/code> elements in quotes to render in italics./p> pre><style> blockquote mark, q mark { font: inherit; font-style: italic; text-decoration: none; background: transparent; color: inherit; } .bubble em { font: inherit; font-size: larger; text-decoration: underline; }</style><article> <h1>She knew</h1> <p>Did you notice the subtle joke in the joke on panel 4?</p> <blockquote> <p classbubble>I didnt <em>want</em> to believe. <mark>Of course on some level I realized it was a known-plaintext attack.</mark> But I couldnt admit it until I saw for myself.</p> </blockquote> <p>(Emphasis mine.) I thought that was great. Its so pedantic, yet it explains everything neatly.</p></article>/pre> p>Note, incidentally, the distinction between the code idthe-mark-element:the-em-element>a href#the-em-element>em/a>/code> element in this example, which is part of the original text being quoted, and the code idthe-mark-element:the-mark-element-6>a href#the-mark-element>mark/a>/code> element, which is highlighting a part for comment./p> /div> div classexample> p>The following example shows the difference between denoting the em>importance/em> of a span of text (code idthe-mark-element:the-strong-element>a href#the-strong-element>strong/a>/code>) as opposed to denoting the em>relevance/em> of a span of text (code idthe-mark-element:the-mark-element-7>a href#the-mark-element>mark/a>/code>). It is an extract from a textbook, where the extract has had the parts relevant to the exam highlighted. The safety warnings, important though they may be, are apparently not relevant to the exam./p> pre><h3>Wormhole Physics Introduction</h3><p><mark>A wormhole in normal conditions can be held open for amaximum of just under 39 minutes.</mark> Conditions that can increasethe time include a powerful energy source coupled to one or both ofthe gates connecting the wormhole, and a large gravity well (such as ablack hole).</p><p><mark>Momentum is preserved across the wormhole. Electromagneticradiation can travel in both directions through a wormhole,but matter cannot.</mark></p><p>When a wormhole is created, a vortex normally forms.<strong>Warning: The vortex caused by the wormhole opening willannihilate anything in its path.</strong> Vortexes can be avoided whenusing sufficiently advanced dialing technology.</p><p><mark>An obstruction in a gate will prevent it from accepting awormhole connection.</mark></p>/pre> /div> h4 idthe-bdi-element>span classsecno>4.5.24/span> The dfn>code>bdi/code>/dfn> elementa href#the-bdi-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id27475 titleExamples: illustrate difference between bdo and bdi>27475/a>/div> dl classelement>dt>a href#concept-element-categories idthe-bdi-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-bdi-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-bdi-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-bdi-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-bdi-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-bdi-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-bdi-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-bdi-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-bdi-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-bdi-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-bdi-element:global-attributes>Global attributes/a>dd>Also, the code idthe-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 idthe-bdi-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-bdi-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-bdi-element:the-bdi-element>a href#the-bdi-element>bdi/a>/code> element a href#represents idthe-bdi-element:represents>represents/a> a span of text that is to be isolated from its surroundings for the purposes of bidirectional text formatting. a href#refsBIDI>BIDI/a>/p> p classnote>The code idthe-bdi-element:the-dir-attribute-2>a href#the-dir-attribute>dir/a>/code> global attribute defaults to code idthe-bdi-element:attr-dir-auto>a href#attr-dir-auto>auto/a>/code> on this element (it never inherits from the parent element like with other elements)./p> p classnote>This element a href#bidireq>has rendering requirements involving the bidirectional algorithm/a>./p> div classexample> p>This element is especially useful when embedding user-generated content with an unknown directionality./p> p>In this example, usernames are shown along with the number of posts that the user has submitted. If the code idthe-bdi-element:the-bdi-element-2>a href#the-bdi-element>bdi/a>/code> element were not used, the username of the Arabic user would end up confusing the text (the bidirectional algorithm would put the colon and the number 3 next to the word User rather than next to the word posts)./p> pre><ul> <li>User <bdi>jcranmer</bdi>: 12 posts. <li>User <bdi>hober</bdi>: 5 posts. <li>User <bdi>bdo dirrtl>إيان/bdo></bdi>: 3 posts.</ul>/pre> figure> img src/images/sample-bdi.png alt> figcaption>When using the code idthe-bdi-element:the-bdi-element-3>a href#the-bdi-element>bdi/a>/code> element, the username acts as expected./figcaption> /figure> figure> img src/images/sample-not-bdi.png alt> figcaption>If the code idthe-bdi-element:the-bdi-element-4>a href#the-bdi-element>bdi/a>/code> element were to be replaced by a code idthe-bdi-element:the-b-element>a href#the-b-element>b/a>/code> element, the username would confuse the bidirectional algorithm and the third bullet would end up saying User 3 :, followed by the Arabic name (right-to-left), followed by posts and a period./figcaption> /figure> /div> h4 idthe-bdo-element>span classsecno>4.5.25/span> The dfn>code>bdo/code>/dfn> elementa href#the-bdo-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-bdo-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-bdo-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-bdo-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-bdo-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-bdo-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-bdo-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-bdo-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-bdo-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-bdo-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-bdo-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-bdo-element:global-attributes>Global attributes/a>dd>Also, the code idthe-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 idthe-bdo-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-bdo-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-bdo-element:the-bdo-element>a href#the-bdo-element>bdo/a>/code> element a href#represents idthe-bdo-element:represents>represents/a> explicit text directionality formatting control for its children. It allows authors to override the Unicode bidirectional algorithm by explicitly specifying a direction override. a href#refsBIDI>BIDI/a>/p> p>Authors must specify the code idthe-bdo-element:the-dir-attribute-2>a href#the-dir-attribute>dir/a>/code> attribute on this element, with the value code idthe-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 idthe-bdo-element:attr-dir-rtl>a href#attr-dir-rtl>rtl/a>/code> to specify a right-to-left override. The code idthe-bdo-element:attr-dir-auto>a href#attr-dir-auto>auto/a>/code> value must not be specified./p> p classnote>This element a href#bidireq>has rendering requirements involving the bidirectional algorithm/a>./p> h4 idthe-span-element>span classsecno>4.5.26/span> The dfn>code>span/code>/dfn> elementa href#the-span-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-span-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-span-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-span-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-span-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-span-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-span-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-span-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-span-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-span-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-span-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-span-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-span-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-span-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlspanelement>HTMLSpanElement/dfn> : a href#htmlelement idthe-span-element:htmlelement>HTMLElement/a> {};/pre> /dl> p>The code idthe-span-element:the-span-element>a href#the-span-element>span/a>/code> element doesnt mean anything on its own, but can be useful when used together with the a href#global-attributes idthe-span-element:global-attributes-2>global attributes/a>, e.g. code idthe-span-element:classes>a href#classes>class/a>/code>, code idthe-span-element:attr-lang>a href#attr-lang>lang/a>/code>, or code idthe-span-element:the-dir-attribute>a href#the-dir-attribute>dir/a>/code>. It a href#represents idthe-span-element:represents>represents/a> its children./p> div classexample> p>In this example, a code fragment is marked up using code idthe-span-element:the-span-element-2>a href#the-span-element>span/a>/code> elements and code idthe-span-element:classes-2>a href#classes>class/a>/code> attributes so that its keywords and identifiers can be color-coded from CSS:/p> pre><pre><code classlang-c><span classkeyword>for</span> (<span classident>j</span> 0; <span classident>j</span> < 256; <span classident>j</span>++) { <span classident>i_t3</span> (<span classident>i_t3</span> & 0x1ffff) | (<span classident>j</span> << 17); <span classident>i_t6</span> (((((((<span classident>i_t3</span> >> 3) ^ <span classident>i_t3</span>) >> 1) ^ <span classident>i_t3</span>) >> 8) ^ <span classident>i_t3</span>) >> 5) & 0xff; <span classkeyword>if</span> (<span classident>i_t6</span> <span classident>i_t1</span>) <span classkeyword>break</span>;}</code></pre>/pre> /div> h4 idthe-br-element>span classsecno>4.5.27/span> The dfn>code>br/code>/dfn> elementa href#the-br-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-br-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-br-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-br-element:phrasing-content-2>Phrasing content/a>.dt>a href#concept-element-contexts idthe-br-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-br-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-br-element:concept-element-content-model>Content model/a>:dd>a href#concept-content-nothing idthe-br-element:concept-content-nothing>Nothing/a>.dt>a href#concept-element-tag-omission idthe-br-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>No a href#syntax-end-tag idthe-br-element:syntax-end-tag>end tag/a>.dt>a href#concept-element-attributes idthe-br-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-br-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-br-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-br-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlbrelement>HTMLBRElement/dfn> : a href#htmlelement idthe-br-element:htmlelement>HTMLElement/a> { // a href#HTMLBRElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-br-element:the-br-element>a href#the-br-element>br/a>/code> element a href#represents idthe-br-element:represents>represents/a> a line break./p> p classnote>While line breaks are usually represented in visual media by physically moving subsequent text to a new line, a style sheet or user agent would be equally justified in causing line breaks to be rendered in a different manner, for instance as green dots, or as extra spacing./p> p>code idthe-br-element:the-br-element-2>a href#the-br-element>br/a>/code> elements must be used only for line breaks that are actually part of the content, as in poems or addresses./p> div classexample> p>The following example is correct usage of the code idthe-br-element:the-br-element-3>a href#the-br-element>br/a>/code> element:/p> pre><p>P. Sherman<br>42 Wallaby Way<br>Sydney</p>/pre> /div> p>code idthe-br-element:the-br-element-4>a href#the-br-element>br/a>/code> elements must not be used for separating thematic groups in a paragraph./p> div classexample> p>The following examples are non-conforming, as they abuse the code idthe-br-element:the-br-element-5>a href#the-br-element>br/a>/code> element:/p> pre><p><a ...>34 comments.</a><br><a ...>Add a comment.</a></p>/pre> pre><p><label>Name: <input namename></label><br><label>Address: <input nameaddress></label></p>/pre> p>Here are alternatives to the above, which are correct:/p> pre><p><a ...>34 comments.</a></p><p><a ...>Add a comment.</a></p>/pre> pre><p><label>Name: <input namename></label></p><p><label>Address: <input nameaddress></label></p>/pre> /div> p>If a a href#paragraph idthe-br-element:paragraph>paragraph/a> consists of nothing but a single code idthe-br-element:the-br-element-6>a href#the-br-element>br/a>/code> element, it represents a placeholder blank line (e.g. as in a template). Such blank lines must not be used for presentation purposes./p> p>Any content inside code idthe-br-element:the-br-element-7>a href#the-br-element>br/a>/code> elements must not be considered part of the surrounding text./p> p classnote>This element a href#bidireq>has rendering requirements involving the bidirectional algorithm/a>./p> h4 idthe-wbr-element>span classsecno>4.5.28/span> The dfn>code>wbr/code>/dfn> elementa href#the-wbr-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> wbr-elementspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>5.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>2+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>3.2+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.3+/span>/span>span classopera yes>span>Opera/span> span>9.5+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featwbr-element>caniuse.com/a>/div> dl classelement>dt>a href#concept-element-categories idthe-wbr-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-wbr-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-wbr-element:phrasing-content-2>Phrasing content/a>.dt>a href#concept-element-contexts idthe-wbr-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-wbr-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-wbr-element:concept-element-content-model>Content model/a>:dd>a href#concept-content-nothing idthe-wbr-element:concept-content-nothing>Nothing/a>.dt>a href#concept-element-tag-omission idthe-wbr-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>No a href#syntax-end-tag idthe-wbr-element:syntax-end-tag>end tag/a>.dt>a href#concept-element-attributes idthe-wbr-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-wbr-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-wbr-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-wbr-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-wbr-element:the-wbr-element>a href#the-wbr-element>wbr/a>/code> element a href#represents idthe-wbr-element:represents>represents/a> a line break opportunity./p> div classexample> p>In the following example, someone is quoted as saying something which, for effect, is written as one long word. However, to ensure that the text can be wrapped in a readable fashion, the individual words in the quote are separated using a code idthe-wbr-element:the-wbr-element-2>a href#the-wbr-element>wbr/a>/code> element./p> pre><p>So then she pointed at the tiger and screamedthere<wbr>is<wbr>no<wbr>way<wbr>you<wbr>are<wbr>ever<wbr>going<wbr>to<wbr>catch<wbr>me!</p>/pre> /div> p>Any content inside code idthe-wbr-element:the-wbr-element-3>a href#the-wbr-element>wbr/a>/code> elements must not be considered part of the surrounding text./p> pre classexample>var wbr document.createElement(wbr);wbr.textContent This is wrong;document.body.appendChild(wbr);/pre> p classnote>This element a href#bidireq>has rendering requirements involving the bidirectional algorithm/a>./p> h4 idusage-summary>span classsecno>4.5.29/span> Usage summarya href#usage-summary classself-link>/a>/h4> p>i>This section is non-normative./i>/p> table>thead>tr>th>Element th>Purpose th>Example tbody>tr>td>code idusage-summary:the-a-element>a href#the-a-element>a/a>/code> td>Hyperlinks td>pre classexample>Visit my strong><a hrefdrinks.html>drinks</a>/strong> page./pre> tr>td>code idusage-summary:the-em-element>a href#the-em-element>em/a>/code> td>Stress emphasis td>pre classexample>I must say I strong><em>adore</em>/strong> lemonade./pre> tr>td>code idusage-summary:the-strong-element>a href#the-strong-element>strong/a>/code> td>Importance td>pre classexample>This tea is strong><strong>very hot</strong>/strong>./pre> tr>td>code idusage-summary:the-small-element>a href#the-small-element>small/a>/code> td>Side comments td>pre classexample>These grapes are made into wine. strong><small>Alcohol is addictive.</small>/strong>/pre> tr>td>code idusage-summary:the-s-element>a href#the-s-element>s/a>/code> td>Inaccurate text td>pre classexample>Price: strong><s>£4.50</s>/strong> £2.00!/pre> tr>td>code idusage-summary:the-cite-element>a href#the-cite-element>cite/a>/code> td>Titles of works td>pre classexample>The case strong><cite>Hugo v. Danielle</cite>/strong> is relevant here./pre> tr>td>code idusage-summary:the-q-element>a href#the-q-element>q/a>/code> td>Quotations td>pre classexample>The judge said strong><q>You can drink water from the fish tank</q>/strong> but advised against it./pre> tr>td>code idusage-summary:the-dfn-element>a href#the-dfn-element>dfn/a>/code> td>Defining instance td>pre classexample>The term strong><dfn>organic food</dfn>/strong> refers to food produced without synthetic chemicals./pre> tr>td>code idusage-summary:the-abbr-element>a href#the-abbr-element>abbr/a>/code> td>Abbreviations td>pre classexample>Organic food in Ireland is certified by the strong><abbr titleIrish Organic Farmers and Growers Association>IOFGA</abbr>/strong>./pre> tr>td>code idusage-summary:the-ruby-element>a href#the-ruby-element>ruby/a>/code>, code idusage-summary:the-rt-element>a href#the-rt-element>rt/a>/code>, code idusage-summary:the-rp-element>a href#the-rp-element>rp/a>/code> td>Ruby annotations td>pre classexample>strong><ruby> OJ <rp>(<rt>Orange Juice<rp>)</ruby>/strong>/pre> tr>td>code idusage-summary:the-data-element>a href#the-data-element>data/a>/code> td>Machine-readable equivalent td>pre classexample>Available starting today! strong><data valueUPC:022014640201>North Coast Organic Apple Cider</data>/strong>/pre> tr>td>code idusage-summary:the-time-element>a href#the-time-element>time/a>/code> td>Machine-readable equivalent of date- or time-related data td>pre classexample>Available starting on strong><time datetime2011-11-18>November 18th</time>/strong>!/pre> tr>td>code idusage-summary:the-code-element>a href#the-code-element>code/a>/code> td>Computer code td>pre classexample>The strong><code>fruitdb</code>/strong> program can be used for tracking fruit production./pre> tr>td>code idusage-summary:the-var-element>a href#the-var-element>var/a>/code> td>Variables td>pre classexample>If there are strong><var>n</var>/strong> fruit in the bowl, at least strong><var>n</var>/strong>÷2 will be ripe./pre> tr>td>code idusage-summary:the-samp-element>a href#the-samp-element>samp/a>/code> td>Computer output td>pre classexample>The computer said strong><samp>Unknown error -3</samp>/strong>./pre> tr>td>code idusage-summary:the-kbd-element>a href#the-kbd-element>kbd/a>/code> td>User input td>pre classexample>Hit strong><kbd>F1</kbd>/strong> to continue./pre> tr>td>code idusage-summary:the-sub-and-sup-elements>a href#the-sub-and-sup-elements>sub/a>/code> td>Subscripts td>pre classexample>Water is Hstrong><sub>2</sub>/strong>O./pre> tr>td>code idusage-summary:the-sub-and-sup-elements-2>a href#the-sub-and-sup-elements>sup/a>/code> td>Superscripts td>pre classexample>The Hydrogen in heavy water is usually strong><sup>2</sup>/strong>H./pre> tr>td>code idusage-summary:the-i-element>a href#the-i-element>i/a>/code> td>Alternative voice td>pre classexample>Lemonade consists primarily of strong><i>Citrus limon</i>/strong>./pre> tr>td>code idusage-summary:the-b-element>a href#the-b-element>b/a>/code> td>Keywords td>pre classexample>Take a strong><b>lemon</b>/strong> and squeeze it with a strong><b>juicer</b>/strong>./pre> tr>td>code idusage-summary:the-u-element>a href#the-u-element>u/a>/code> td>Annotations td>pre classexample>The mixture of apple juice and strong><u classspelling>eldeflower</u>/strong> juice is very pleasant./pre> tr>td>code idusage-summary:the-mark-element>a href#the-mark-element>mark/a>/code> td>Highlight td>pre classexample>Elderflower cordial, with one strong><mark>part</mark>/strong> cordial to ten strong><mark>part</mark>/strong>s water, stands astrong><mark>part</mark>/strong> from the rest./pre> tr>td>code idusage-summary:the-bdi-element>a href#the-bdi-element>bdi/a>/code> td>Text directionality isolation td>pre classexample>The recommended restaurant is strong><bdi lang>My Juice Café (At The Beach)</bdi>/strong>./pre> tr>td>code idusage-summary:the-bdo-element>a href#the-bdo-element>bdo/a>/code> td>Text directionality formatting td>pre classexample>The proposal is to write English, but in reverse order. Juice would become strong><bdo dirrtl>Juice</bdo>/strong>/pre> tr>td>code idusage-summary:the-span-element>a href#the-span-element>span/a>/code> td>Other td>pre classexample>In French we call it strong><span langfr>sirop de sureau</span>/strong>./pre> tr>td>code idusage-summary:the-br-element>a href#the-br-element>br/a>/code> td>Line break td>pre classexample>Simply Orange Juice Companystrong><br>/strong>Apopka, FL 32703strong><br>/strong>U.S.A./pre> tr>td>code idusage-summary:the-wbr-element>a href#the-wbr-element>wbr/a>/code> td>Line breaking opportunity td>pre classexample>www.simplystrong><wbr>/strong>orangestrong><wbr>/strong>juice.com/pre> /table> h3 idlinks>span classsecno>4.6/span> Linksa href#links classself-link>/a>/h3> h4 idintroduction-2>span classsecno>4.6.1/span> Introductiona href#introduction-2 classself-link>/a>/h4> p>Links are a conceptual construct, created by code idintroduction-2:the-a-element>a href#the-a-element>a/a>/code>, code idintroduction-2:the-area-element>a href#the-area-element>area/a>/code>, and code idintroduction-2:the-link-element>a href#the-link-element>link/a>/code> elements, that a href#represents idintroduction-2:represents>represent/a> a connection between two resources, one of which is the current code idintroduction-2:document>a href#document>Document/a>/code>. There are two kinds of links in HTML:/p> dl>dt>dfn idexternal-resource-link data-ltexternal resource link data-export>Links to external resources/dfn>dd>p>These are links to resources that are to be used to augment the current document, generally automatically processed by the user agent.dt>dfn idhyperlink data-lthyperlink data-export>Hyperlinks/dfn>dd>p>These are links to other resources that are generally exposed to the user by the user agent so that the user can cause the user agent to a href#navigate idintroduction-2:navigate>navigate/a> to those resources, e.g. to visit them in a browser or download them./dl> p>For code idintroduction-2:the-link-element-2>a href#the-link-element>link/a>/code> elements with an code idintroduction-2:attr-link-href>a href#attr-link-href>href/a>/code> attribute and a code idintroduction-2:attr-link-rel>a href#attr-link-rel>rel/a>/code> attribute, links must be created for the keywords of the code idintroduction-2:attr-link-rel-2>a href#attr-link-rel>rel/a>/code> attribute, as defined for those keywords in the a href#linkTypes>link types/a> section./p> p>Similarly, for code idintroduction-2:the-a-element-2>a href#the-a-element>a/a>/code> and code idintroduction-2:the-area-element-2>a href#the-area-element>area/a>/code> elements with an code idintroduction-2:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute and a code idintroduction-2:attr-hyperlink-rel>a href#attr-hyperlink-rel>rel/a>/code> attribute, links must be created for the keywords of the code idintroduction-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 idintroduction-2:the-link-element-3>a href#the-link-element>link/a>/code> elements, however, code idintroduction-2:the-a-element-3>a href#the-a-element>a/a>/code> and code idintroduction-2:the-area-element-3>a href#the-area-element>area/a>/code> elements with an code idintroduction-2:attr-hyperlink-href-2>a href#attr-hyperlink-href>href/a>/code> attribute that either do not have a code idintroduction-2:attr-hyperlink-rel-3>a href#attr-hyperlink-rel>rel/a>/code> attribute, or whose code idintroduction-2:attr-hyperlink-rel-4>a href#attr-hyperlink-rel>rel/a>/code> attribute has no keywords that are defined as specifying a href#hyperlink idintroduction-2:hyperlink>hyperlinks/a>, must also create a a href#hyperlink idintroduction-2:hyperlink-2>hyperlink/a>. This implied hyperlink has no special meaning (it has no a href#linkTypes>link type/a>) beyond linking the elements a idintroduction-2:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> to the resource given by the elements code idintroduction-2:attr-hyperlink-href-3>a href#attr-hyperlink-href>href/a>/code> attribute./p> p>A a href#hyperlink idintroduction-2:hyperlink-3>hyperlink/a> can have one or more dfn idhyperlink-annotation>hyperlink annotations/dfn> that modify the processing semantics of that hyperlink./p> h4 idlinks-created-by-a-and-area-elements>span classsecno>4.6.2/span> Links created by code idlinks-created-by-a-and-area-elements:the-a-element>a href#the-a-element>a/a>/code> and code idlinks-created-by-a-and-area-elements:the-area-element>a href#the-area-element>area/a>/code> elementsa href#links-created-by-a-and-area-elements classself-link>/a>/h4> p>The dfn idattr-hyperlink-href>code>href/code>/dfn> attribute on code idlinks-created-by-a-and-area-elements:the-a-element-2>a href#the-a-element>a/a>/code> and code idlinks-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 idlinks-created-by-a-and-area-elements:valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by spaces/a>./p> p classnote>The code idlinks-created-by-a-and-area-elements:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute on code idlinks-created-by-a-and-area-elements:the-a-element-3>a href#the-a-element>a/a>/code> and code idlinks-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 idlinks-created-by-a-and-area-elements:attr-hyperlink-href-2>a href#attr-hyperlink-href>href/a>/code> attributes they do not create hyperlinks./p> p>The dfn idattr-hyperlink-target>code>target/code>/dfn> attribute, if present, must be a a href#valid-browsing-context-name-or-keyword idlinks-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 idlinks-created-by-a-and-area-elements:browsing-context>browsing context/a> that will be used. User agents use this name when a href#following-hyperlinks-2 idlinks-created-by-a-and-area-elements:following-hyperlinks-2>following hyperlinks/a>./p> p>When an code idlinks-created-by-a-and-area-elements:the-a-element-4>a href#the-a-element>a/a>/code> or code idlinks-created-by-a-and-area-elements:the-area-element-4>a href#the-area-element>area/a>/code> elements a idlinks-created-by-a-and-area-elements:activation-behaviour hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a> is invoked, the user agent may allow the user to indicate a preference regarding whether the hyperlink is to be used for a href#navigate idlinks-created-by-a-and-area-elements:navigate>navigation/a> or whether the resource it specifies is to be downloaded./p> p>In the absence of a user preference, the default should be navigation if the element has no code idlinks-created-by-a-and-area-elements:attr-hyperlink-download>a href#attr-hyperlink-download>download/a>/code> attribute, and should be to download the specified resource if it does./p> p>Whether determined by the users preferences or via the presence or absence of the attribute, if the decision is to use the hyperlink for a href#navigate idlinks-created-by-a-and-area-elements:navigate-2>navigation/a> then the user agent must a href#following-hyperlinks-2 idlinks-created-by-a-and-area-elements:following-hyperlinks-2-2>follow the hyperlink/a>, and if the decision is to use the hyperlink to download a resource, the user agent must a href#downloading-hyperlinks idlinks-created-by-a-and-area-elements:downloading-hyperlinks>download the hyperlink/a>. These terms are defined in subsequent sections below./p> p>The dfn idattr-hyperlink-download>code>download/code>/dfn> attribute, if present, indicates that the author intends the hyperlink to be used for a href#downloading-hyperlinks idlinks-created-by-a-and-area-elements:downloading-hyperlinks-2>downloading a resource/a>. The attribute may have a value; the value, if any, specifies the default file name that the author recommends for use in labeling the resource in a local file system. There are no restrictions on allowed values, but authors are cautioned that most file systems have limitations with regard to what punctuation is supported in file names, and user agents are likely to adjust file names accordingly./p> p>The dfn idping>code>ping/code>/dfn> attribute, if present, gives the URLs of the resources that are interested in being notified if the user follows the hyperlink. The value must be a a href#set-of-space-separated-tokens idlinks-created-by-a-and-area-elements:set-of-space-separated-tokens>set of space-separated tokens/a>, each of which must be a a href#valid-non-empty-url idlinks-created-by-a-and-area-elements:valid-non-empty-url>valid non-empty URL/a> whose a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idlinks-created-by-a-and-area-elements:concept-url-scheme data-x-internalconcept-url-scheme>scheme/a> is an a idlinks-created-by-a-and-area-elements:http(s)-scheme hrefhttps://fetch.spec.whatwg.org/#http-scheme data-x-internalhttp(s)-scheme>HTTP(S) scheme/a>. The value is used by the user agent for a href#hyperlink-auditing idlinks-created-by-a-and-area-elements:hyperlink-auditing>hyperlink auditing/a>.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> pingspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>15+/span>/span>span classios_saf yes>span>iOS Safari/span> span>5.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox no>span>Firefox/span> span>None/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>6+/span>/span>span classedge no>span>Edge/span> span>None/span>/span>span classandroid yes>span>Android Browser/span> span>4.4+/span>/span>span classopera yes>span>Opera/span> span>15+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featping>caniuse.com/a>/div> p>The dfn idattr-hyperlink-rel>code>rel/code>/dfn> attribute on code idlinks-created-by-a-and-area-elements:the-a-element-5>a href#the-a-element>a/a>/code> and code idlinks-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 attributes value must be a a href#set-of-space-separated-tokens idlinks-created-by-a-and-area-elements:set-of-space-separated-tokens-2>set of space-separated tokens/a>. The a href#linkTypes>allowed keywords and their meanings/a> are defined below./p> p>code idlinks-created-by-a-and-area-elements:attr-hyperlink-rel>a href#attr-hyperlink-rel>rel/a>/code>s a hrefhttps://dom.spec.whatwg.org/#concept-supported-tokens idlinks-created-by-a-and-area-elements:concept-supported-tokens data-x-internalconcept-supported-tokens>supported tokens/a> are the keywords defined in a href#linkTypes>HTML link types/a> which are allowed on code idlinks-created-by-a-and-area-elements:the-a-element-6>a href#the-a-element>a/a>/code> and code idlinks-created-by-a-and-area-elements:the-area-element-6>a href#the-area-element>area/a>/code> elements, impact the processing model, and are supported by the user agent. The possible a hrefhttps://dom.spec.whatwg.org/#concept-supported-tokens idlinks-created-by-a-and-area-elements:concept-supported-tokens-2 data-x-internalconcept-supported-tokens>supported tokens/a> are code idlinks-created-by-a-and-area-elements:link-type-noreferrer>a href#link-type-noreferrer>noreferrer/a>/code> and code idlinks-created-by-a-and-area-elements:link-type-noopener>a href#link-type-noopener>noopener/a>/code>. code idlinks-created-by-a-and-area-elements:attr-hyperlink-rel-2>a href#attr-hyperlink-rel>rel/a>/code>s a hrefhttps://dom.spec.whatwg.org/#concept-supported-tokens idlinks-created-by-a-and-area-elements:concept-supported-tokens-3 data-x-internalconcept-supported-tokens>supported tokens/a> must only include the tokens from this list that the user agent implements the processing model for./p> p>Other specifications may add a href#linkTypes>HTML link types/a> as defined in a href#other-link-types>Other link types/a>, with the following additional requirements:/p> ul>li>Such specifications may require that their link types be included in code idlinks-created-by-a-and-area-elements:attr-link-rel>a href#attr-link-rel>rel/a>/code>s a hrefhttps://dom.spec.whatwg.org/#concept-supported-tokens idlinks-created-by-a-and-area-elements:concept-supported-tokens-4 data-x-internalconcept-supported-tokens>supported tokens/a>.li>Such specifications may specify that their link types are a href#body-ok idlinks-created-by-a-and-area-elements:body-ok>body-ok/a>./ul> p>The code idlinks-created-by-a-and-area-elements:attr-hyperlink-rel-3>a href#attr-hyperlink-rel>rel/a>/code> attribute has no default value. If the attribute is omitted or if none of the values in the attribute are recognized by the user agent, then the document has no particular relationship with the destination resource other than there being a hyperlink between the two./p> p>The dfn idattr-hyperlink-hreflang>code>hreflang/code>/dfn> attribute on code idlinks-created-by-a-and-area-elements:the-a-element-7>a href#the-a-element>a/a>/code> elements that create a href#hyperlink idlinks-created-by-a-and-area-elements:hyperlink>hyperlinks/a>, if present, gives the language of the linked resource. It is purely advisory. The value must be a valid BCP 47 language tag. a href#refsBCP47>BCP47/a> User agents must not consider this attribute authoritative — upon fetching the resource, user agents must use only language information associated with the resource to determine its language, not metadata included in the link to the resource./p> p>The dfn idattr-hyperlink-type>code>type/code>/dfn> attribute, if present, gives the a idlinks-created-by-a-and-area-elements:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> of the linked resource. It is purely advisory. The value must be a a idlinks-created-by-a-and-area-elements:valid-mime-type hrefhttps://mimesniff.spec.whatwg.org/#valid-mime-type data-x-internalvalid-mime-type>valid MIME type/a>. User agents must not consider the code idlinks-created-by-a-and-area-elements:attr-hyperlink-type>a href#attr-hyperlink-type>type/a>/code> attribute authoritative — upon fetching the resource, user agents must not use metadata included in the link to the resource to determine its type./p> p>The dfn idattr-hyperlink-referrerpolicy>code>referrerpolicy/code>/dfn> attribute is a a href#referrer-policy-attribute idlinks-created-by-a-and-area-elements:referrer-policy-attribute>referrer policy attribute/a>. Its purpose is to set the a idlinks-created-by-a-and-area-elements:referrer-policy hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>referrer policy/a> used when a href#following-hyperlinks-2 idlinks-created-by-a-and-area-elements:following-hyperlinks-2-3>following hyperlinks/a>. a href#refsREFERRERPOLICY>REFERRERPOLICY/a>/p> h4 idapi-for-a-and-area-elements>span classsecno>4.6.3/span> API for code idapi-for-a-and-area-elements:the-a-element>a href#the-a-element>a/a>/code> and code idapi-for-a-and-area-elements:the-area-element>a href#the-area-element>area/a>/code> elementsa href#api-for-a-and-area-elements classself-link>/a>/h4> pre classidl>ExposedWindow, NoInterfaceObjectinterface dfn idhtmlhyperlinkelementutils>HTMLHyperlinkElementUtils/dfn> { a href#cereactions idapi-for-a-and-area-elements:cereactions>CEReactions/a> stringifier attribute USVString a href#dom-hyperlink-href idapi-for-a-and-area-elements:dom-hyperlink-href>href/a>; readonly attribute USVString a href#dom-hyperlink-origin idapi-for-a-and-area-elements:dom-hyperlink-origin>origin/a>; a href#cereactions idapi-for-a-and-area-elements:cereactions-2>CEReactions/a> attribute USVString a href#dom-hyperlink-protocol idapi-for-a-and-area-elements:dom-hyperlink-protocol>protocol/a>; a href#cereactions idapi-for-a-and-area-elements:cereactions-3>CEReactions/a> attribute USVString a href#dom-hyperlink-username idapi-for-a-and-area-elements:dom-hyperlink-username>username/a>; a href#cereactions idapi-for-a-and-area-elements:cereactions-4>CEReactions/a> attribute USVString a href#dom-hyperlink-password idapi-for-a-and-area-elements:dom-hyperlink-password>password/a>; a href#cereactions idapi-for-a-and-area-elements:cereactions-5>CEReactions/a> attribute USVString a href#dom-hyperlink-host idapi-for-a-and-area-elements:dom-hyperlink-host>host/a>; a href#cereactions idapi-for-a-and-area-elements:cereactions-6>CEReactions/a> attribute USVString a href#dom-hyperlink-hostname idapi-for-a-and-area-elements:dom-hyperlink-hostname>hostname/a>; a href#cereactions idapi-for-a-and-area-elements:cereactions-7>CEReactions/a> attribute USVString a href#dom-hyperlink-port idapi-for-a-and-area-elements:dom-hyperlink-port>port/a>; a href#cereactions idapi-for-a-and-area-elements:cereactions-8>CEReactions/a> attribute USVString a href#dom-hyperlink-pathname idapi-for-a-and-area-elements:dom-hyperlink-pathname>pathname/a>; a href#cereactions idapi-for-a-and-area-elements:cereactions-9>CEReactions/a> attribute USVString a href#dom-hyperlink-search idapi-for-a-and-area-elements:dom-hyperlink-search>search/a>; a href#cereactions idapi-for-a-and-area-elements:cereactions-10>CEReactions/a> attribute USVString a href#dom-hyperlink-hash idapi-for-a-and-area-elements:dom-hyperlink-hash>hash/a>;};/pre> dl classdomintro>dt>var>hyperlink/var> . code>toString()/code>dt>var>hyperlink/var> . code idapi-for-a-and-area-elements:dom-hyperlink-href-2>a href#dom-hyperlink-href>href/a>/code>dd> p>Returns the hyperlinks URL./p> p>Can be set, to change the URL./p> dt>var>hyperlink/var> . code idapi-for-a-and-area-elements:dom-hyperlink-origin-2>a href#dom-hyperlink-origin>origin/a>/code>dd> p>Returns the hyperlinks URLs origin./p> dt>var>hyperlink/var> . code idapi-for-a-and-area-elements:dom-hyperlink-protocol-2>a href#dom-hyperlink-protocol>protocol/a>/code>dd> p>Returns the hyperlinks URLs scheme./p> p>Can be set, to change the URLs scheme./p> dt>var>hyperlink/var> . code idapi-for-a-and-area-elements:dom-hyperlink-username-2>a href#dom-hyperlink-username>username/a>/code>dd> p>Returns the hyperlinks URLs username./p> p>Can be set, to change the URLs username./p> dt>var>hyperlink/var> . code idapi-for-a-and-area-elements:dom-hyperlink-password-2>a href#dom-hyperlink-password>password/a>/code>dd> p>Returns the hyperlinks URLs password./p> p>Can be set, to change the URLs password./p> dt>var>hyperlink/var> . code idapi-for-a-and-area-elements:dom-hyperlink-host-2>a href#dom-hyperlink-host>host/a>/code>dd> p>Returns the hyperlinks URLs host and port (if different from the default port for the scheme)./p> p>Can be set, to change the URLs host and port./p> dt>var>hyperlink/var> . code idapi-for-a-and-area-elements:dom-hyperlink-hostname-2>a href#dom-hyperlink-hostname>hostname/a>/code>dd> p>Returns the hyperlinks URLs host./p> p>Can be set, to change the URLs host./p> dt>var>hyperlink/var> . code idapi-for-a-and-area-elements:dom-hyperlink-port-2>a href#dom-hyperlink-port>port/a>/code>dd> p>Returns the hyperlinks URLs port./p> p>Can be set, to change the URLs port./p> dt>var>hyperlink/var> . code idapi-for-a-and-area-elements:dom-hyperlink-pathname-2>a href#dom-hyperlink-pathname>pathname/a>/code>dd> p>Returns the hyperlinks URLs path./p> p>Can be set, to change the URLs path./p> dt>var>hyperlink/var> . code idapi-for-a-and-area-elements:dom-hyperlink-search-2>a href#dom-hyperlink-search>search/a>/code>dd> p>Returns the hyperlinks URLs query (includes leading code>?/code> if non-empty)./p> p>Can be set, to change the URLs query (ignores leading code>?/code>)./p> dt>var>hyperlink/var> . code idapi-for-a-and-area-elements:dom-hyperlink-hash-2>a href#dom-hyperlink-hash>hash/a>/code>dd> p>Returns the hyperlinks URLs fragment (includes leading code>#/code> if non-empty)./p> p>Can be set, to change the URLs fragment (ignores leading code>#/code>)./p> /dl> p>An element implementing the code idapi-for-a-and-area-elements:htmlhyperlinkelementutils>a href#htmlhyperlinkelementutils>HTMLHyperlinkElementUtils/a>/code> mixin has an associated dfn idconcept-hyperlink-url>url/dfn> (null or a a idapi-for-a-and-area-elements:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>). It is initially null. p>An element implementing the code idapi-for-a-and-area-elements:htmlhyperlinkelementutils-2>a href#htmlhyperlinkelementutils>HTMLHyperlinkElementUtils/a>/code> mixin has an associated dfn idconcept-hyperlink-url-set>set the url/dfn> algorithm, which runs these steps:/p> ol>li>p>If this elements code idapi-for-a-and-area-elements:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> content attribute is absent, set this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url>url/a> to null.li>p>Otherwise, parse this elements code idapi-for-a-and-area-elements:attr-hyperlink-href-2>a href#attr-hyperlink-href>href/a>/code> content attribute value relative to this elements a idapi-for-a-and-area-elements:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>. If a href#parse-a-url idapi-for-a-and-area-elements:parse-a-url>parsing/a> is successful, set this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-2>url/a> to the result; otherwise, set this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-3>url/a> to null./ol> p>When elements implementing the code idapi-for-a-and-area-elements:htmlhyperlinkelementutils-3>a href#htmlhyperlinkelementutils>HTMLHyperlinkElementUtils/a>/code> mixin are created, and whenever those elements have their code idapi-for-a-and-area-elements:attr-hyperlink-href-3>a href#attr-hyperlink-href>href/a>/code> content attribute set, changed, or removed, the user agent must a href#concept-hyperlink-url-set idapi-for-a-and-area-elements:concept-hyperlink-url-set>set the url/a>./p> p classnote>This is only observable for code idapi-for-a-and-area-elements:blob-protocol>a data-x-internalblob-protocol hrefhttps://w3c.github.io/FileAPI/#DefinitionOfScheme>blob:/a>/code> URLs as a hrefhttps://url.spec.whatwg.org/#concept-url-parser idapi-for-a-and-area-elements:url-parser data-x-internalurl-parser>parsing/a> them involves a a idapi-for-a-and-area-elements:blob-url-store hrefhttps://w3c.github.io/FileAPI/#BlobURLStore data-x-internalblob-url-store>Blob URL Store/a> lookup./p> p>An element implementing the code idapi-for-a-and-area-elements:htmlhyperlinkelementutils-4>a href#htmlhyperlinkelementutils>HTMLHyperlinkElementUtils/a>/code> mixin has an associated dfn idreinitialise-url>reinitialize url/dfn> algorithm, which runs these steps:/p> ol>li>p>If elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-4>url/a> is non-null, its a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idapi-for-a-and-area-elements:concept-url-scheme data-x-internalconcept-url-scheme>scheme/a> is code>blob/code>, and its a idapi-for-a-and-area-elements:cannot-be-a-base-url-flag hrefhttps://url.spec.whatwg.org/#url-cannot-be-a-base-url-flag data-x-internalcannot-be-a-base-url-flag>cannot-be-a-base-URL flag/a> is set, terminate these steps.li>p>a href#concept-hyperlink-url-set idapi-for-a-and-area-elements:concept-hyperlink-url-set-2>Set the url/a>./ol> p>To dfn idupdate-href>update code>href/code>/dfn>, set the elements code idapi-for-a-and-area-elements:attr-hyperlink-href-4>a href#attr-hyperlink-href>href/a>/code> content attributes value to the elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-5>url/a>, a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idapi-for-a-and-area-elements:concept-url-serializer data-x-internalconcept-url-serializer>serialized/a>./p> hr> p>The dfn iddom-hyperlink-href>code>href/code>/dfn> attributes getter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url>Reinitialize url/a>.li>p>Let var>url/var> be this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-6>url/a>.li>p>If var>url/var> is null and this element has no code idapi-for-a-and-area-elements:attr-hyperlink-href-5>a href#attr-hyperlink-href>href/a>/code> content attribute, return the empty string. li>p>Otherwise, if var>url/var> is null, return this elements code idapi-for-a-and-area-elements:attr-hyperlink-href-6>a href#attr-hyperlink-href>href/a>/code> content attributes value.li>p>Return var>url/var>, a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idapi-for-a-and-area-elements:concept-url-serializer-2 data-x-internalconcept-url-serializer>serialized/a>./ol> p>The code idapi-for-a-and-area-elements:dom-hyperlink-href-3>a href#dom-hyperlink-href>href/a>/code> attributes setter must set this elements code idapi-for-a-and-area-elements:attr-hyperlink-href-7>a href#attr-hyperlink-href>href/a>/code> content attributes value to the given value. p>The dfn iddom-hyperlink-origin>code>origin/code>/dfn> attributes getter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-2>Reinitialize url/a>.li>p>If this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-7>url/a> is null, return the empty string.li>p>Return the a href#ascii-serialisation-of-an-origin idapi-for-a-and-area-elements:ascii-serialisation-of-an-origin>serialization/a> of this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-8>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-origin idapi-for-a-and-area-elements:concept-url-origin data-x-internalconcept-url-origin>origin/a>./ol> p>The dfn iddom-hyperlink-protocol>code>protocol/code>/dfn> attributes getter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-3>Reinitialize url/a>.li>p>If this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-9>url/a> is null, return code>:/code>.li>p>Return this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-10>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idapi-for-a-and-area-elements:concept-url-scheme-2 data-x-internalconcept-url-scheme>scheme/a>, followed by code>:/code>./ol> p>The code idapi-for-a-and-area-elements:dom-hyperlink-protocol-3>a href#dom-hyperlink-protocol>protocol/a>/code> attributes setter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-4>Reinitialize url/a>.li>p>If this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-11>url/a> is null, terminate these steps.li> p>a hrefhttps://url.spec.whatwg.org/#concept-basic-url-parser idapi-for-a-and-area-elements:basic-url-parser data-x-internalbasic-url-parser>Basic URL parse/a> the given value, followed by code>:/code>, with this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-12>url/a> as var>url/var> and a idapi-for-a-and-area-elements:scheme-start-state hrefhttps://url.spec.whatwg.org/#scheme-start-state data-x-internalscheme-start-state>scheme start state/a> as var>state override/var>./p> p classnote>Because the URL parser ignores multiple consecutive colons, providing a value of code>https:/code> (or even code>https::::/code>) is the same as providing a value of code>https/code>./p> li>p>a href#update-href idapi-for-a-and-area-elements:update-href>Update code>href/code>/a>./ol> p>The dfn iddom-hyperlink-username>code>username/code>/dfn> attributes getter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-5>Reinitialize url/a>.li>p>If this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-13>url/a> is null, return the empty string.li>p>Return this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-14>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-username idapi-for-a-and-area-elements:concept-url-username data-x-internalconcept-url-username>username/a>./ol> p>The code idapi-for-a-and-area-elements:dom-hyperlink-username-3>a href#dom-hyperlink-username>username/a>/code> attributes setter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-6>Reinitialize url/a>.li>p>Let var>url/var> be this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-15>url/a>.li>p>If var>url/var> is null or var>url/var> a idapi-for-a-and-area-elements:cannot-have-a-username/password/port hrefhttps://url.spec.whatwg.org/#cannot-have-a-username-password-port data-x-internalcannot-have-a-username/password/port>cannot have a username/password/port/a>, then return.li>p>a idapi-for-a-and-area-elements:set-the-username hrefhttps://url.spec.whatwg.org/#set-the-username data-x-internalset-the-username>Set the username/a>, given var>url/var> and the given value.li>p>a href#update-href idapi-for-a-and-area-elements:update-href-2>Update code>href/code>/a>./ol> p>The dfn iddom-hyperlink-password>code>password/code>/dfn> attributes getter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-7>Reinitialize url/a>.li>p>Let var>url/var> be this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-16>url/a>.li>p>If var>url/var> is null, then return the empty string.li>p>Return var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-password idapi-for-a-and-area-elements:concept-url-password data-x-internalconcept-url-password>password/a>./ol> p>The code idapi-for-a-and-area-elements:dom-hyperlink-password-3>a href#dom-hyperlink-password>password/a>/code> attributes setter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-8>Reinitialize url/a>.li>p>Let var>url/var> be this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-17>url/a>.li>p>If var>url/var> is null or var>url/var> a idapi-for-a-and-area-elements:cannot-have-a-username/password/port-2 hrefhttps://url.spec.whatwg.org/#cannot-have-a-username-password-port data-x-internalcannot-have-a-username/password/port>cannot have a username/password/port/a>, then return.li>p>a idapi-for-a-and-area-elements:set-the-password hrefhttps://url.spec.whatwg.org/#set-the-password data-x-internalset-the-password>Set the password/a>, given var>url/var> and the given value.li>p>a href#update-href idapi-for-a-and-area-elements:update-href-3>Update code>href/code>/a>./ol> p>The dfn iddom-hyperlink-host>code>host/code>/dfn> attributes getter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-9>Reinitialize url/a>.li>p>Let var>url/var> be this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-18>url/a>.li>p>If var>url/var> or var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-host idapi-for-a-and-area-elements:concept-url-host data-x-internalconcept-url-host>host/a> is null, return the empty string.li>p>If var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-port idapi-for-a-and-area-elements:concept-url-port data-x-internalconcept-url-port>port/a> is null, return var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-host idapi-for-a-and-area-elements:concept-url-host-2 data-x-internalconcept-url-host>host/a>, a hrefhttps://url.spec.whatwg.org/#concept-host-serializer idapi-for-a-and-area-elements:host-serializer data-x-internalhost-serializer>serialized/a>.li>p>Return var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-host idapi-for-a-and-area-elements:concept-url-host-3 data-x-internalconcept-url-host>host/a>, a hrefhttps://url.spec.whatwg.org/#concept-host-serializer idapi-for-a-and-area-elements:host-serializer-2 data-x-internalhost-serializer>serialized/a>, followed by code>:/code> and var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-port idapi-for-a-and-area-elements:concept-url-port-2 data-x-internalconcept-url-port>port/a>, a hrefhttps://url.spec.whatwg.org/#serialize-an-integer idapi-for-a-and-area-elements:serialize-an-integer data-x-internalserialize-an-integer>serialized/a>./ol> p>The code idapi-for-a-and-area-elements:dom-hyperlink-host-3>a href#dom-hyperlink-host>host/a>/code> attributes setter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-10>Reinitialize url/a>.li>p>Let var>url/var> be this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-19>url/a>.li>p>If var>url/var> is null or var>url/var>s a idapi-for-a-and-area-elements:cannot-be-a-base-url-flag-2 hrefhttps://url.spec.whatwg.org/#url-cannot-be-a-base-url-flag data-x-internalcannot-be-a-base-url-flag>cannot-be-a-base-URL flag/a> is set, terminate these steps.li>p>a hrefhttps://url.spec.whatwg.org/#concept-basic-url-parser idapi-for-a-and-area-elements:basic-url-parser-2 data-x-internalbasic-url-parser>Basic URL parse/a> the given value, with var>url/var> as var>url/var> and a idapi-for-a-and-area-elements:host-state hrefhttps://url.spec.whatwg.org/#host-state data-x-internalhost-state>host state/a> as var>state override/var>.li>p>a href#update-href idapi-for-a-and-area-elements:update-href-4>Update code>href/code>/a>./ol> p>The dfn iddom-hyperlink-hostname>code>hostname/code>/dfn> attributes getter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-11>Reinitialize url/a>.li>p>Let var>url/var> be this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-20>url/a>.li>p>If var>url/var> or var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-host idapi-for-a-and-area-elements:concept-url-host-4 data-x-internalconcept-url-host>host/a> is null, return the empty string.li>p>Return var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-host idapi-for-a-and-area-elements:concept-url-host-5 data-x-internalconcept-url-host>host/a>, a hrefhttps://url.spec.whatwg.org/#concept-host-serializer idapi-for-a-and-area-elements:host-serializer-3 data-x-internalhost-serializer>serialized/a>./ol> p>The code idapi-for-a-and-area-elements:dom-hyperlink-hostname-3>a href#dom-hyperlink-hostname>hostname/a>/code> attributes setter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-12>Reinitialize url/a>.li>p>Let var>url/var> be this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-21>url/a>.li>p>If var>url/var> is null or var>url/var>s a idapi-for-a-and-area-elements:cannot-be-a-base-url-flag-3 hrefhttps://url.spec.whatwg.org/#url-cannot-be-a-base-url-flag data-x-internalcannot-be-a-base-url-flag>cannot-be-a-base-URL flag/a> is set, terminate these steps.li>p>a hrefhttps://url.spec.whatwg.org/#concept-basic-url-parser idapi-for-a-and-area-elements:basic-url-parser-3 data-x-internalbasic-url-parser>Basic URL parse/a> the given value, with var>url/var> as var>url/var> and a idapi-for-a-and-area-elements:hostname-state hrefhttps://url.spec.whatwg.org/#hostname-state data-x-internalhostname-state>hostname state/a> as var>state override/var>.li>p>a href#update-href idapi-for-a-and-area-elements:update-href-5>Update code>href/code>/a>./ol> p>The dfn iddom-hyperlink-port>code>port/code>/dfn> attributes getter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-13>Reinitialize url/a>.li>p>Let var>url/var> be this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-22>url/a>.li>p>If var>url/var> or var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-port idapi-for-a-and-area-elements:concept-url-port-3 data-x-internalconcept-url-port>port/a> is null, return the empty string.li>p>Return var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-port idapi-for-a-and-area-elements:concept-url-port-4 data-x-internalconcept-url-port>port/a>, a hrefhttps://url.spec.whatwg.org/#serialize-an-integer idapi-for-a-and-area-elements:serialize-an-integer-2 data-x-internalserialize-an-integer>serialized/a>./ol> p>The code idapi-for-a-and-area-elements:dom-hyperlink-port-3>a href#dom-hyperlink-port>port/a>/code> attributes setter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-14>Reinitialize url/a>.li>p>Let var>url/var> be this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-23>url/a>.li>p>If var>url/var> is null or var>url/var> a idapi-for-a-and-area-elements:cannot-have-a-username/password/port-3 hrefhttps://url.spec.whatwg.org/#cannot-have-a-username-password-port data-x-internalcannot-have-a-username/password/port>cannot have a username/password/port/a>, then return.li>p>If the given value is the empty string, then set var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-port idapi-for-a-and-area-elements:concept-url-port-5 data-x-internalconcept-url-port>port/a> to null.li>p>Otherwise, a hrefhttps://url.spec.whatwg.org/#concept-basic-url-parser idapi-for-a-and-area-elements:basic-url-parser-4 data-x-internalbasic-url-parser>basic URL parse/a> the given value, with var>url/var> as var>url/var> and a idapi-for-a-and-area-elements:port-state hrefhttps://url.spec.whatwg.org/#port-state data-x-internalport-state>port state/a> as var>state override/var>.li>p>a href#update-href idapi-for-a-and-area-elements:update-href-6>Update code>href/code>/a>./ol> p>The dfn iddom-hyperlink-pathname>code>pathname/code>/dfn> attributes getter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-15>Reinitialize url/a>.li>p>Let var>url/var> be this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-24>url/a>.li>p>If var>url/var> is null, return the empty string.li>p>If var>url/var>s a idapi-for-a-and-area-elements:cannot-be-a-base-url-flag-4 hrefhttps://url.spec.whatwg.org/#url-cannot-be-a-base-url-flag data-x-internalcannot-be-a-base-url-flag>cannot-be-a-base-URL flag/a> is set, return the first string in var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-path idapi-for-a-and-area-elements:concept-url-path data-x-internalconcept-url-path>path/a>.li>p>If var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-path idapi-for-a-and-area-elements:concept-url-path-2 data-x-internalconcept-url-path>path/a> is empty, then return the empty string.li>p>Return code>//code>, followed by the strings in var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-path idapi-for-a-and-area-elements:concept-url-path-3 data-x-internalconcept-url-path>path/a> (including empty strings), separated from each other by code>//code>./ol> p>The code idapi-for-a-and-area-elements:dom-hyperlink-pathname-3>a href#dom-hyperlink-pathname>pathname/a>/code> attributes setter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-16>Reinitialize url/a>.li>p>Let var>url/var> be this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-25>url/a>.li>p>If var>url/var> is null or var>url/var>s a idapi-for-a-and-area-elements:cannot-be-a-base-url-flag-5 hrefhttps://url.spec.whatwg.org/#url-cannot-be-a-base-url-flag data-x-internalcannot-be-a-base-url-flag>cannot-be-a-base-URL flag/a> is set, terminate these steps.li>p>Set var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-path idapi-for-a-and-area-elements:concept-url-path-4 data-x-internalconcept-url-path>path/a> to the empty list.li>p>a hrefhttps://url.spec.whatwg.org/#concept-basic-url-parser idapi-for-a-and-area-elements:basic-url-parser-5 data-x-internalbasic-url-parser>Basic URL parse/a> the given value, with var>url/var> as var>url/var> and a idapi-for-a-and-area-elements:path-start-state hrefhttps://url.spec.whatwg.org/#path-start-state data-x-internalpath-start-state>path start state/a> as var>state override/var>.li>p>a href#update-href idapi-for-a-and-area-elements:update-href-7>Update code>href/code>/a>./ol> p>The dfn iddom-hyperlink-search>code>search/code>/dfn> attributes getter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-17>Reinitialize url/a>.li>p>Let var>url/var> be this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-26>url/a>.li>p>If var>url/var> is null, or var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-query idapi-for-a-and-area-elements:concept-url-query data-x-internalconcept-url-query>query/a> is either null or the empty string, return the empty string.li>p>Return code>?/code>, followed by var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-query idapi-for-a-and-area-elements:concept-url-query-2 data-x-internalconcept-url-query>query/a>./ol> p>The code idapi-for-a-and-area-elements:dom-hyperlink-search-3>a href#dom-hyperlink-search>search/a>/code> attributes setter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-18>Reinitialize url/a>.li>p>Let var>url/var> be this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-27>url/a>.li>p>If var>url/var> is null, terminate these steps.li>p>If the given value is the empty string, set var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-query idapi-for-a-and-area-elements:concept-url-query-3 data-x-internalconcept-url-query>query/a> to null. li> p>Otherwise:/p> ol>li>p>Let var>input/var> be the given value with a single leading code>?/code> removed, if any.li>p>Set var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-query idapi-for-a-and-area-elements:concept-url-query-4 data-x-internalconcept-url-query>query/a> to the empty string.li>p>a hrefhttps://url.spec.whatwg.org/#concept-basic-url-parser idapi-for-a-and-area-elements:basic-url-parser-6 data-x-internalbasic-url-parser>Basic URL parse/a> var>input/var>, with var>url/var> as var>url/var> and a idapi-for-a-and-area-elements:query-state hrefhttps://url.spec.whatwg.org/#query-state data-x-internalquery-state>query state/a> as var>state override/var>, and this elements a idapi-for-a-and-area-elements:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a idapi-for-a-and-area-elements:documents-character-encoding hrefhttps://dom.spec.whatwg.org/#concept-document-encoding data-x-internaldocuments-character-encoding>documents character encoding/a> as var>encoding override/var>./ol> li>p>a href#update-href idapi-for-a-and-area-elements:update-href-8>Update code>href/code>/a>./ol> p>The dfn iddom-hyperlink-hash>code>hash/code>/dfn> attributes getter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-19>Reinitialize url/a>.li>p>Let var>url/var> be this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-28>url/a>.li>p>If var>url/var> is null, or var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idapi-for-a-and-area-elements:concept-url-fragment data-x-internalconcept-url-fragment>fragment/a> is either null or the empty string, return the empty string.li>p>Return code>#/code>, followed by var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idapi-for-a-and-area-elements:concept-url-fragment-2 data-x-internalconcept-url-fragment>fragment/a>./ol> p>The code idapi-for-a-and-area-elements:dom-hyperlink-hash-3>a href#dom-hyperlink-hash>hash/a>/code> attributes setter must run these steps:/p> ol>li>p>a href#reinitialise-url idapi-for-a-and-area-elements:reinitialise-url-20>Reinitialize url/a>.li>p>Let var>url/var> be this elements a href#concept-hyperlink-url idapi-for-a-and-area-elements:concept-hyperlink-url-29>url/a>.li>p>If var>url/var> is null, then return.li>p>If the given value is the empty string, set var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idapi-for-a-and-area-elements:concept-url-fragment-3 data-x-internalconcept-url-fragment>fragment/a> to null. li> p>Otherwise:/p> ol>li>p>Let var>input/var> be the given value with a single leading code>#/code> removed, if any.li>p>Set var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idapi-for-a-and-area-elements:concept-url-fragment-4 data-x-internalconcept-url-fragment>fragment/a> to the empty string.li>p>a hrefhttps://url.spec.whatwg.org/#concept-basic-url-parser idapi-for-a-and-area-elements:basic-url-parser-7 data-x-internalbasic-url-parser>Basic URL parse/a> var>input/var>, with var>url/var> as var>url/var> and a idapi-for-a-and-area-elements:fragment-state hrefhttps://url.spec.whatwg.org/#fragment-state data-x-internalfragment-state>fragment state/a> as var>state override/var>./ol> li>p>a href#update-href idapi-for-a-and-area-elements:update-href-9>Update code>href/code>/a>./ol> h4 idfollowing-hyperlinks>span classsecno>4.6.4/span> Following hyperlinksa href#following-hyperlinks classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id28925 titleAppend the hyperlink suffix to the URL before resolving>28925/a>/div> p>An element var>element/var> dfn idcannot-navigate>cannot navigate/dfn> if one of the following is true:/p> ul classbrief>li>var>element/var>s a idfollowing-hyperlinks:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is not a href#fully-active idfollowing-hyperlinks:fully-active>fully active/a>li>var>element/var> is not an code idfollowing-hyperlinks:the-a-element>a href#the-a-element>a/a>/code> element and is not a idfollowing-hyperlinks:connected hrefhttps://dom.spec.whatwg.org/#connected data-x-internalconnected>connected/a>./ul> p classnote>This is also used by a href#concept-form-submit idfollowing-hyperlinks:concept-form-submit>form submission/a> for the code idfollowing-hyperlinks:the-form-element>a href#the-form-element>form/a>/code> element. The exception for code idfollowing-hyperlinks:the-a-element-2>a href#the-a-element>a/a>/code> elements is for compatibility with web content./p> p>When a user dfn idfollowing-hyperlinks-2>follows a hyperlink/dfn> created by an element var>subject/var>, optionally with a var>hyperlink suffix/var>, the user agent must run the following steps:/p> ol>li>p>If var>subject/var> a href#cannot-navigate idfollowing-hyperlinks:cannot-navigate>cannot navigate/a>, then return.li>p>Let var>replace/var> be false.li>p>Let var>source/var> be var>subject/var>s a idfollowing-hyperlinks:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#concept-document-bc idfollowing-hyperlinks:concept-document-bc>browsing context/a>.li>p>Let var>targetAttributeValue/var> be null.li>p>If var>subject/var> is an code idfollowing-hyperlinks:the-a-element-3>a href#the-a-element>a/a>/code> or code idfollowing-hyperlinks:the-area-element>a href#the-area-element>area/a>/code> element, then set var>targetAttributeValue/var> to the result of a href#get-an-elements-target idfollowing-hyperlinks:get-an-elements-target>getting an elements target/a> given var>subject/var>.li>p>Let var>noopener/var> be true if var>subject/var>s a href#linkTypes>link types/a> include the code idfollowing-hyperlinks:link-type-noreferrer>a href#link-type-noreferrer>noreferrer/a>/code> or code idfollowing-hyperlinks:link-type-noopener>a href#link-type-noopener>noopener/a>/code> keywordli>p>Let var>target/var> and var>replace/var> be the result of applying a href#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name idfollowing-hyperlinks:the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context/a> given var>targetAttributeValue/var>, var>source/var>, and var>noopener/var>.li>p>If var>target/var> is null, then return.li>p>If var>noopener/var> and var>replace/var> are true, then a href#disowned-its-opener idfollowing-hyperlinks:disowned-its-opener>disown var>target/var>s opener/a>.li>p>a href#parse-a-url idfollowing-hyperlinks:parse-a-url>Parse/a> the a idfollowing-hyperlinks:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> given by var>subject/var>s code idfollowing-hyperlinks:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute, relative to var>subject/var>s a idfollowing-hyperlinks:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>.li> p>If that is successful, let var>URL/var> be the a href#resulting-url-string idfollowing-hyperlinks:resulting-url-string>resulting URL string/a>./p> p>Otherwise, if a href#parse-a-url idfollowing-hyperlinks:parse-a-url-2>parsing/a> the a idfollowing-hyperlinks:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> failed, the user agent may report the error to the user in a user-agent-specific manner, may a href#queue-a-task idfollowing-hyperlinks:queue-a-task>queue a task/a> to a href#navigate idfollowing-hyperlinks:navigate>navigate/a> the var>target/var> a href#browsing-context idfollowing-hyperlinks:browsing-context>browsing context/a> to an error page to report the error, or may ignore the error and do nothing. In any case, the user agent must then abort these steps./p> li>p>If there is a var>hyperlink suffix/var>, append it to var>URL/var>.li>p>Let var>resource/var> be a new a hrefhttps://fetch.spec.whatwg.org/#concept-request idfollowing-hyperlinks:concept-request data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idfollowing-hyperlinks:concept-request-url data-x-internalconcept-request-url>url/a> is var>URL/var> and whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-referrer-policy idfollowing-hyperlinks:concept-request-referrer-policy data-x-internalconcept-request-referrer-policy>referrer policy/a> is the current state of var>subject/var>s code>referrerpolicy/code> content attribute.li>p>a href#queue-a-task idfollowing-hyperlinks:queue-a-task-2>Queue a task/a> to a href#navigate idfollowing-hyperlinks:navigate-2>navigate/a> the var>target/var> a href#browsing-context idfollowing-hyperlinks:browsing-context-2>browsing context/a> to var>resource/var>. If var>replace/var> is true, the navigation must be performed with a href#replacement-enabled idfollowing-hyperlinks:replacement-enabled>replacement enabled/a>. The a href#source-browsing-context idfollowing-hyperlinks:source-browsing-context>source browsing context/a> must be var>source/var>./ol> p>The a href#task-source idfollowing-hyperlinks:task-source>task source/a> for the tasks mentioned above is the a href#dom-manipulation-task-source idfollowing-hyperlinks:dom-manipulation-task-source>DOM manipulation task source/a>./p> h4 iddownloading-resources>span classsecno>4.6.5/span> Downloading resourcesa href#downloading-resources classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> downloadspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>14+/span>/span>span classios_saf no>span>iOS Safari/span> span>None/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>20+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>10.1+/span>/span>span classedge yes>span>Edge/span> span>13+/span>/span>span classandroid yes>span>Android Browser/span> span>4.4+/span>/span>span classopera yes>span>Opera/span> span>15+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featdownload>caniuse.com/a>/div> p>In some cases, resources are intended for later use rather than immediate viewing. To indicate that a resource is intended to be downloaded for use later, rather than immediately used, the code iddownloading-resources:attr-hyperlink-download>a href#attr-hyperlink-download>download/a>/code> attribute can be specified on the code iddownloading-resources:the-a-element>a href#the-a-element>a/a>/code> or code iddownloading-resources:the-area-element>a href#the-area-element>area/a>/code> element that creates the a href#hyperlink iddownloading-resources:hyperlink>hyperlink/a> to that resource./p> p>The attribute can furthermore be given a value, to specify the file name that user agents are to use when storing the resource in a file system. This value can be overridden by the `code iddownloading-resources:http-content-disposition>a data-x-internalhttp-content-disposition hrefhttps://tools.ietf.org/html/rfc6266>Content-Disposition/a>/code>` HTTP headers filename parameters. a href#refsRFC6266>RFC6266/a>/p> p>In cross-origin situations, the code iddownloading-resources:attr-hyperlink-download-2>a href#attr-hyperlink-download>download/a>/code> attribute has to be combined with the `code iddownloading-resources:http-content-disposition-2>a data-x-internalhttp-content-disposition hrefhttps://tools.ietf.org/html/rfc6266>Content-Disposition/a>/code>` HTTP header, specifically with the code>attachment/code> disposition type, to avoid the user being warned of possibly nefarious activity. (This is to protect users from being made to download sensitive personal or confidential information without their full understanding.)/p> hr> p>When a user dfn iddownloading-hyperlinks>downloads a hyperlink/dfn> created by an element var>subject/var>, optionally with a var>hyperlink suffix/var>, the user agent must run the following steps:/p> ol>li>p>If var>subject/var> a href#cannot-navigate iddownloading-resources:cannot-navigate>cannot navigate/a>, then return.li>p>a href#parse-a-url iddownloading-resources:parse-a-url>Parse/a> the a iddownloading-resources:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> given by var>subject/var>s code iddownloading-resources:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute, relative to var>subject/var>s a iddownloading-resources:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>.li>p>If a href#parse-a-url iddownloading-resources:parse-a-url-2>parsing/a> the a iddownloading-resources:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> fails, the user agent may report the error to the user in a user-agent-specific manner, may a href#navigate iddownloading-resources:navigate>navigate/a> to an error page to report the error, or may ignore the error and do nothing. In either case, the user agent must abort these steps./p> li>p>Otherwise, let var>URL/var> be the a href#resulting-url-string iddownloading-resources:resulting-url-string>resulting URL string/a>.li>p>If there is a var>hyperlink suffix/var>, append it to var>URL/var>.li>p>Return to whatever algorithm invoked these steps and continue these steps a href#in-parallel iddownloading-resources:in-parallel>in parallel/a>.li>p>Let var>request/var> be a new a hrefhttps://fetch.spec.whatwg.org/#concept-request iddownloading-resources:concept-request data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url iddownloading-resources:concept-request-url data-x-internalconcept-request-url>url/a> is var>URL/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-client iddownloading-resources:concept-request-client data-x-internalconcept-request-client>client/a> is a href#entry-settings-object iddownloading-resources:entry-settings-object>entry settings object/a>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-initiator iddownloading-resources:concept-request-initiator data-x-internalconcept-request-initiator>initiator/a> is code>download/code>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination iddownloading-resources:concept-request-destination data-x-internalconcept-request-destination>destination/a> is the empty string, and whose a iddownloading-resources:synchronous-flag hrefhttps://fetch.spec.whatwg.org/#synchronous-flag data-x-internalsynchronous-flag>synchronous flag/a> and a iddownloading-resources:use-url-credentials-flag hrefhttps://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag data-x-internaluse-url-credentials-flag>use-URL-credentials flag/a> are set. li>p>Handle the result of a hrefhttps://fetch.spec.whatwg.org/#concept-fetch iddownloading-resources:concept-fetch data-x-internalconcept-fetch>fetching/a> var>request/var> a href#as-a-download iddownloading-resources:as-a-download>as a download/a>./ol> p>When a user agent is to handle a resource obtained from a fetch dfn idas-a-download>as a download/dfn>, it should provide the user with a way to save the resource for later use, if a resource is successfully obtained; or otherwise should report any problems downloading the file to the user./p> p>If the user agent needs a file name for a resource being handled a href#as-a-download iddownloading-resources:as-a-download-2>as a download/a>, it should select one using the following algorithm./p> p classwarning>This algorithm is intended to mitigate security dangers involved in downloading files from untrusted sites, and user agents are strongly urged to follow it./p> ol>li>p>Let var>filename/var> be the void value.li>p>If the resource has a `code iddownloading-resources:http-content-disposition-3>a data-x-internalhttp-content-disposition hrefhttps://tools.ietf.org/html/rfc6266>Content-Disposition/a>/code>` header, that header specifies the code>attachment/code> disposition type, and the header includes file name information, then let var>filename/var> have the value specified by the header, and jump to the step labeled i>sanitize/i> below. a href#refsRFC6266>RFC6266/a>li>p>Let var>interface origin/var> be the a href#concept-origin iddownloading-resources:concept-origin>origin/a> of the code iddownloading-resources:document>a href#document>Document/a>/code> in which the a href#downloading-hyperlinks iddownloading-resources:downloading-hyperlinks>download/a> or a href#navigate iddownloading-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#concept-origin iddownloading-resources:concept-origin-2>origin/a> of the URL of the resource being downloaded, unless that URLs a hrefhttps://url.spec.whatwg.org/#concept-url-scheme iddownloading-resources:concept-url-scheme data-x-internalconcept-url-scheme>scheme/a> component is code>data/code>, in which case let var>resource origin/var> be the same as the var>interface origin/var>, if any.li>p>If there is no var>interface origin/var>, then let var>trusted operation/var> be true. Otherwise, let var>trusted operation/var> be true if var>resource origin/var> is the a href#same-origin iddownloading-resources:same-origin>same origin/a> as var>interface origin/var>, and false otherwise.li>p>If var>trusted operation/var> is true and the resource has a `code iddownloading-resources:http-content-disposition-4>a data-x-internalhttp-content-disposition hrefhttps://tools.ietf.org/html/rfc6266>Content-Disposition/a>/code>` header and that header includes file name information, then let var>filename/var> have the value specified by the header, and jump to the step labeled i>sanitize/i> below. a href#refsRFC6266>RFC6266/a>li>p>If the download was not initiated from a a href#hyperlink iddownloading-resources:hyperlink-2>hyperlink/a> created by an code iddownloading-resources:the-a-element-2>a href#the-a-element>a/a>/code> or code iddownloading-resources:the-area-element-2>a href#the-area-element>area/a>/code> element, or if the element of the a href#hyperlink iddownloading-resources:hyperlink-3>hyperlink/a> from which it was initiated did not have a code iddownloading-resources:attr-hyperlink-download-3>a href#attr-hyperlink-download>download/a>/code> attribute when the download was initiated, or if there was such an attribute but its value when the download was initiated was the empty string, then jump to the step labeled i>no proposed file name/i>.li>p>Let var>proposed filename/var> have the value of the code iddownloading-resources:attr-hyperlink-download-4>a href#attr-hyperlink-download>download/a>/code> attribute of the element of the a href#hyperlink iddownloading-resources:hyperlink-4>hyperlink/a> that initiated the download at the time the download was initiated.li>p>If var>trusted operation/var> is true, let var>filename/var> have the value of var>proposed filename/var>, and jump to the step labeled i>sanitize/i> below.li>p>If the resource has a `code iddownloading-resources:http-content-disposition-5>a data-x-internalhttp-content-disposition hrefhttps://tools.ietf.org/html/rfc6266>Content-Disposition/a>/code>` header and that header specifies the code>attachment/code> disposition type, let var>filename/var> have the value of var>proposed filename/var>, and jump to the step labeled i>sanitize/i> below. a href#refsRFC6266>RFC6266/a>li>p>i>No proposed file name/i>: If var>trusted operation/var> is true, or if the user indicated a preference for having the resource in question downloaded, let var>filename/var> have a value derived from the a iddownloading-resources:url-3 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the resource in a user-agent-defined manner, and jump to the step labeled i>sanitize/i> below.li> p>Act in a user-agent-defined manner to safeguard the user from a potentially hostile cross-origin download. If the download is not to be aborted, then let var>filename/var> be set to the users preferred file name or to a file name selected by the user agent, and jump to the step labeled i>sanitize/i> below./p> div classwarning> p>If the algorithm reaches this step, then a download was begun from a different origin than the resource being downloaded, and the origin did not mark the file as suitable for downloading, and the download was not initiated by the user. This could be because a code iddownloading-resources:attr-hyperlink-download-5>a href#attr-hyperlink-download>download/a>/code> attribute was used to trigger the download, or because the resource in question is not of a type that the user agent supports./p> p>This could be dangerous, because, for instance, a hostile server could be trying to get a user to unknowingly download private information and then re-upload it to the hostile server, by tricking the user into thinking the data is from the hostile server./p> p>Thus, it is in the users interests that the user be somehow notified that the resource in question comes from quite a different source, and to prevent confusion, any suggested file name from the potentially hostile var>interface origin/var> should be ignored./p> /div> li>p>i>Sanitize/i>: Optionally, allow the user to influence var>filename/var>. For example, a user agent could prompt the user for a file name, potentially providing the value of var>filename/var> as determined above as a default value.li> p>Adjust var>filename/var> to be suitable for the local file system./p> p classexample>For example, this could involve removing characters that are not legal in file names, or trimming leading and trailing whitespace./p> li>p>If the platform conventions do not in any way use a href#concept-extension iddownloading-resources:concept-extension>extensions/a> to determine the types of file on the file system, then return var>filename/var> as the file name and abort these steps.li>p>Let var>claimed type/var> be the type given by the resources a href#content-type iddownloading-resources:content-type>Content-Type metadata/a>, if any is known. Let var>named type/var> be the type given by var>filename/var>s a href#concept-extension iddownloading-resources:concept-extension-2>extension/a>, if any is known. For the purposes of this step, a i>type/i> is a mapping of a a iddownloading-resources:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> to an a href#concept-extension iddownloading-resources:concept-extension-3>extension/a>.li>p>If var>named type/var> is consistent with the users preferences (e.g. because the value of var>filename/var> was determined by prompting the user), then return var>filename/var> as the file name and abort these steps.li>p>If var>claimed type/var> and var>named type/var> are the same type (i.e. the type given by the resources a href#content-type iddownloading-resources:content-type-2>Content-Type metadata/a> is consistent with the type given by var>filename/var>s a href#concept-extension iddownloading-resources:concept-extension-4>extension/a>), then return var>filename/var> as the file name and abort these steps.li> p>If the var>claimed type/var> is known, then alter var>filename/var> to add an a href#concept-extension iddownloading-resources:concept-extension-5>extension/a> corresponding to var>claimed type/var>./p> p>Otherwise, if var>named type/var> is known to be potentially dangerous (e.g. it will be treated by the platform conventions as a native executable, shell script, HTML application, or executable-macro-capable document) then optionally alter var>filename/var> to add a known-safe a href#concept-extension iddownloading-resources:concept-extension-6>extension/a> (e.g. code>.txt/code>)./p> p classnote>This last step would make it impossible to download executables, which might not be desirable. As always, implementors are forced to balance security and usability in this matter./p> li>p>Return var>filename/var> as the file name./ol> p>For the purposes of this algorithm, a file dfn idconcept-extension>extension/dfn> consists of any part of the file name that platform conventions dictate will be used for identifying the type of the file. For example, many operating systems use the part of the file name following the last dot (code>./code>) in the file name to determine the type of the file, and from that the manner in which the file is to be opened or executed./p> p>User agents should ignore any directory or path information provided by the resource itself, its a iddownloading-resources:url-4 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>, and any code iddownloading-resources:attr-hyperlink-download-6>a href#attr-hyperlink-download>download/a>/code> attribute, in deciding where to store the resulting file in the users file system./p> h5 idhyperlink-auditing>span classsecno>4.6.5.1/span> dfn>Hyperlink auditing/dfn>a href#hyperlink-auditing classself-link>/a>/h5>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id24137 titleI think the fetching stops working per spec after the document has unloaded, since the document isnt fully active at that point (or maybe the document even gets discarded before all ping URLs have started fetching)>24137/a>/div> p>If a a href#hyperlink idhyperlink-auditing:hyperlink>hyperlink/a> created by an code idhyperlink-auditing:the-a-element>a href#the-a-element>a/a>/code> or code idhyperlink-auditing:the-area-element>a href#the-area-element>area/a>/code> element has a code idhyperlink-auditing:ping>a href#ping>ping/a>/code> attribute, and the user follows the hyperlink, and the value of the elements code idhyperlink-auditing:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute can be a href#parse-a-url idhyperlink-auditing:parse-a-url>parsed/a>, relative to the elements a idhyperlink-auditing:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, without failure, then the user agent must take the code idhyperlink-auditing:ping-2>a href#ping>ping/a>/code> attributes value, a hrefhttps://infra.spec.whatwg.org/#split-on-ascii-whitespace idhyperlink-auditing:split-a-string-on-spaces data-x-internalsplit-a-string-on-spaces>split that string on ASCII whitespace/a>, a href#parse-a-url idhyperlink-auditing:parse-a-url-2>parse/a> each resulting token relative to the elements a idhyperlink-auditing:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, and then run these steps for each a href#resulting-url-record idhyperlink-auditing:resulting-url-record>resulting URL record/a> var>ping URL/var>, ignoring tokens that fail to parse:/p> ol>li>p>If var>ping URL/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idhyperlink-auditing:concept-url-scheme data-x-internalconcept-url-scheme>scheme/a> is not an a idhyperlink-auditing:http(s)-scheme hrefhttps://fetch.spec.whatwg.org/#http-scheme data-x-internalhttp(s)-scheme>HTTP(S) scheme/a>, then abort these steps.li>p>Optionally, abort these steps. (For example, the user agent might wish to ignore any or all ping URLs in accordance with the users expressed preferences.)li>p>Let var>request/var> be a new a hrefhttps://fetch.spec.whatwg.org/#concept-request idhyperlink-auditing:concept-request data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idhyperlink-auditing:concept-request-url data-x-internalconcept-request-url>url/a> is var>ping URL/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-method idhyperlink-auditing:concept-request-method data-x-internalconcept-request-method>method/a> is `code>POST/code>`, a hrefhttps://fetch.spec.whatwg.org/#concept-request-body idhyperlink-auditing:concept-request-body data-x-internalconcept-request-body>body/a> is `code>PING/code>`, a hrefhttps://fetch.spec.whatwg.org/#concept-request-client idhyperlink-auditing:concept-request-client data-x-internalconcept-request-client>client/a> is the a href#environment-settings-object idhyperlink-auditing:environment-settings-object>environment settings object/a> of the code idhyperlink-auditing:document>a href#document>Document/a>/code> containing the a href#hyperlink idhyperlink-auditing:hyperlink-2>hyperlink/a>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination idhyperlink-auditing:concept-request-destination data-x-internalconcept-request-destination>destination/a> is the empty string, a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode idhyperlink-auditing:concept-request-credentials-mode data-x-internalconcept-request-credentials-mode>credentials mode/a> is code>include/code>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-referrer idhyperlink-auditing:concept-request-referrer data-x-internalconcept-request-referrer>referrer/a> is code>no-referrer/code>, and whose a idhyperlink-auditing:use-url-credentials-flag hrefhttps://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag data-x-internaluse-url-credentials-flag>use-URL-credentials flag/a> is set.li> p>Let var>target URL/var> be the a href#resulting-url-string idhyperlink-auditing:resulting-url-string>resulting URL string/a> obtained from a href#parse-a-url idhyperlink-auditing:parse-a-url-3>parsing/a> the value of the elements code idhyperlink-auditing:attr-hyperlink-href-2>a href#attr-hyperlink-href>href/a>/code> attribute and then:/p> dl classswitch>dt>If the a hrefhttps://dom.spec.whatwg.org/#concept-document-url idhyperlink-auditing:the-documents-address data-x-internalthe-documents-address>URL/a> of the code idhyperlink-auditing:document-2>a href#document>Document/a>/code> object containing the hyperlink being audited and var>ping URL/var> have the a href#same-origin idhyperlink-auditing:same-origin>same origin/a>dt>If the origins are different, but the a href#concept-document-https-state idhyperlink-auditing:concept-document-https-state>HTTPS state/a> of the code idhyperlink-auditing:document-3>a href#document>Document/a>/code> containing the hyperlink being audited is code>none/code>dd>var>request/var> must include a `code idhyperlink-auditing:ping-from>a href#ping-from>Ping-From/a>/code>` header with, as its value, the a hrefhttps://dom.spec.whatwg.org/#concept-document-url idhyperlink-auditing:the-documents-address-2 data-x-internalthe-documents-address>URL/a> of the document containing the hyperlink, and a `code idhyperlink-auditing:ping-to>a href#ping-to>Ping-To/a>/code>` HTTP header with, as its value, the var>target URL/var>.dt>Otherwisedd>var>request/var> must include a `code idhyperlink-auditing:ping-to-2>a href#ping-to>Ping-To/a>/code>` HTTP header with, as its value, var>target URL/var>. span classnote>var>request/var> does not include a `code idhyperlink-auditing:ping-from-2>a href#ping-from>Ping-From/a>/code>` header./span>/dl> li>p>a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idhyperlink-auditing:concept-fetch data-x-internalconcept-fetch>Fetch/a> var>request/var>./ol> p>This may be done a href#in-parallel idhyperlink-auditing:in-parallel>in parallel/a> with the primary fetch, and is independent of the result of that fetch./p> p>User agents should allow the user to adjust this behavior, for example in conjunction with a setting that disables the sending of HTTP `code idhyperlink-auditing:http-referer>a data-x-internalhttp-referer hrefhttps://tools.ietf.org/html/rfc7231#section-5.5.2>Referer/a>/code>` (sic) headers. Based on the users preferences, UAs may either a href#ignore idhyperlink-auditing:ignore>ignore/a> the code idhyperlink-auditing:ping-3>a href#ping>ping/a>/code> attribute altogether, or selectively ignore URLs in the list (e.g. ignoring any third-party URLs); this is explicitly accounted for in the steps above./p> p>User agents must ignore any entity bodies returned in the responses. User agents may close the connection prematurely once they start receiving a response body./p> p>When the code idhyperlink-auditing:ping-4>a href#ping>ping/a>/code> attribute is present, user agents should clearly indicate to the user that following the hyperlink will also cause secondary requests to be sent in the background, possibly including listing the actual target URLs./p> p classexample>For example, a visual user agent could include the hostnames of the target ping URLs along with the hyperlinks actual URL in a status bar or tooltip./p> div classnote> p>The code idhyperlink-auditing:ping-5>a href#ping>ping/a>/code> attribute is redundant with pre-existing technologies like HTTP redirects and JavaScript in allowing Web pages to track which off-site links are most popular or allowing advertisers to track click-through rates./p> p>However, the code idhyperlink-auditing:ping-6>a href#ping>ping/a>/code> attribute provides these advantages to the user over those alternatives:/p> ul>li>It allows the user to see the final target URL unobscured.li>It allows the UA to inform the user about the out-of-band notifications.li>It allows the user to disable the notifications without losing the underlying link functionality.li>It allows the UA to optimize the use of available network bandwidth so that the target page loads faster./ul> p>Thus, while it is possible to track users without this feature, authors are encouraged to use the code idhyperlink-auditing:ping-7>a href#ping>ping/a>/code> attribute so that the user agent can make the user experience more transparent./p> /div> h4 idlinkTypes>span classsecno>4.6.6/span> Link typesa href#linkTypes classself-link>/a>/h4> p>The following table summarizes the link types that are defined by this specification, by their corresponding keywords. This table is non-normative; the actual definitions for the link types are given in the next few sections./p> p>In this section, the term i>referenced document/i> refers to the resource identified by the element representing the link, and the term i>current document/i> refers to the resource within which the element representing the link finds itself./p> p>To determine which link types apply to a code idlinkTypes:the-link-element>a href#the-link-element>link/a>/code>, code idlinkTypes:the-a-element>a href#the-a-element>a/a>/code>, or code idlinkTypes:the-area-element>a href#the-area-element>area/a>/code> element, the elements code>rel/code> attribute must be a hrefhttps://infra.spec.whatwg.org/#split-on-ascii-whitespace idlinkTypes:split-a-string-on-spaces data-x-internalsplit-a-string-on-spaces>split on ASCII whitespace/a>. The resulting tokens are the keywords for the link types that apply to that element./p> p>Except where otherwise specified, a keyword must not be specified more than once per code idlinkTypes:attr-hyperlink-rel>a href#attr-hyperlink-rel>rel/a>/code> attribute./p> p>Some of the sections that follow the table below list synonyms for certain keywords. The indicated synonyms are to be handled as specified by user agents, but must not be used in documents (for example, the keyword code>copyright/code>)./p> p>Keywords are always a idlinkTypes:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a>, and must be compared as such./p> p classexample>Thus, code>relnext/code> is the same as code>relNEXT/code>./p> p>Keywords that are dfn idbody-ok>body-ok/dfn> affect whether code idlinkTypes:the-link-element-2>a href#the-link-element>link/a>/code> elements are a href#allowed-in-the-body idlinkTypes:allowed-in-the-body>allowed in the body/a>. The a href#body-ok idlinkTypes:body-ok>body-ok/a> keywords defined by this specification are code idlinkTypes:link-type-dns-prefetch>a href#link-type-dns-prefetch>dns-prefetch/a>/code>, code idlinkTypes:link-type-modulepreload>a href#link-type-modulepreload>modulepreload/a>/code>, code idlinkTypes:link-type-pingback>a href#link-type-pingback>pingback/a>/code>, code idlinkTypes:link-type-preconnect>a href#link-type-preconnect>preconnect/a>/code>, code idlinkTypes:link-type-prefetch>a href#link-type-prefetch>prefetch/a>/code>, code idlinkTypes:link-type-preload>a href#link-type-preload>preload/a>/code>, code idlinkTypes:link-type-prerender>a href#link-type-prerender>prerender/a>/code>, and code idlinkTypes:link-type-stylesheet>a href#link-type-stylesheet>stylesheet/a>/code>. Other specifications can also define a href#body-ok idlinkTypes:body-ok-2>body-ok/a> keywords./p> table classyesno>thead>tr>th rowspan2>Link typeth colspan2>Effect on...th rowspan2>a href#body-ok idlinkTypes:body-ok-3>body-ok/a>th rowspan2>Brief descriptiontr>th>code idlinkTypes:the-link-element-3>a href#the-link-element>link/a>/code>th>code idlinkTypes:the-a-element-2>a href#the-a-element>a/a>/code> and code idlinkTypes:the-area-element-2>a href#the-area-element>area/a>/code>tbody>tr>td>code idlinkTypes:rel-alternate>a href#rel-alternate>alternate/a>/code>td>a href#hyperlink idlinkTypes:hyperlink>Hyperlink/a>td>a href#hyperlink idlinkTypes:hyperlink-2>Hyperlink/a>td classno> · td>Gives alternate representations of the current document.tr>td>code idlinkTypes:link-type-canonical>a href#link-type-canonical>canonical/a>/code>td>a href#hyperlink idlinkTypes:hyperlink-3>Hyperlink/a>td>em>not allowed/em>td classno> · td>Gives the preferred URL for the current document.tr>td>code idlinkTypes:link-type-author>a href#link-type-author>author/a>/code>td>a href#hyperlink idlinkTypes:hyperlink-4>Hyperlink/a>td>a href#hyperlink idlinkTypes:hyperlink-5>Hyperlink/a>td classno> · td>Gives a link to the author of the current document or article.tr>td>code idlinkTypes:link-type-bookmark>a href#link-type-bookmark>bookmark/a>/code>td>em>not allowed/em>td>a href#hyperlink idlinkTypes:hyperlink-6>Hyperlink/a>td classno> · td>Gives the permalink for the nearest ancestor section.tr>td>code idlinkTypes:link-type-dns-prefetch-2>a href#link-type-dns-prefetch>dns-prefetch/a>/code>td>a href#external-resource-link idlinkTypes:external-resource-link>External Resource/a>td>em>not allowed/em>td classyes> Yes td>Specifies that the user agent should preemptively perform DNS resolution for the target resources a href#concept-origin idlinkTypes:concept-origin>origin/a>.tr>td>code idlinkTypes:link-type-external>a href#link-type-external>external/a>/code>td>em>not allowed/em>td>a href#hyperlink-annotation idlinkTypes:hyperlink-annotation>Annotation/a>td classno> · td>Indicates that the referenced document is not part of the same site as the current document.tr>td>code idlinkTypes:link-type-help>a href#link-type-help>help/a>/code>td>a href#hyperlink idlinkTypes:hyperlink-7>Hyperlink/a>td>a href#hyperlink idlinkTypes:hyperlink-8>Hyperlink/a>td classno> · td>Provides a link to context-sensitive help.tr>td>code idlinkTypes:rel-icon>a href#rel-icon>icon/a>/code>td>a href#external-resource-link idlinkTypes:external-resource-link-2>External Resource/a>td>em>not allowed/em>td classno> · td>Imports an icon to represent the current document.tr>td>code idlinkTypes:link-type-modulepreload-2>a href#link-type-modulepreload>modulepreload/a>/code>td>a href#external-resource-link idlinkTypes:external-resource-link-3>External Resource/a>td>em>not allowed/em>td classyes> Yes td>Specifies that the user agent must preemptively a href#fetch-a-single-module-script idlinkTypes:fetch-a-single-module-script>fetch the module script/a> and store it in the documents a href#concept-document-module-map idlinkTypes:concept-document-module-map>module map/a> for later evaluation. Optionally, the modules dependencies can be fetched as well.tr>td>code idlinkTypes:link-type-license>a href#link-type-license>license/a>/code>td>a href#hyperlink idlinkTypes:hyperlink-9>Hyperlink/a>td>a href#hyperlink idlinkTypes:hyperlink-10>Hyperlink/a>td classno> · td>Indicates that the main content of the current document is covered by the copyright license described by the referenced document.tr>td>code idlinkTypes:link-type-next>a href#link-type-next>next/a>/code>td>a href#hyperlink idlinkTypes:hyperlink-11>Hyperlink/a>td>a href#hyperlink idlinkTypes:hyperlink-12>Hyperlink/a>td classno> · 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 idlinkTypes:link-type-nofollow>a href#link-type-nofollow>nofollow/a>/code>td>em>not allowed/em>td>a href#hyperlink-annotation idlinkTypes:hyperlink-annotation-2>Annotation/a>td classno> · td>Indicates that the current documents original author or publisher does not endorse the referenced document.tr>td>code idlinkTypes:link-type-noopener>a href#link-type-noopener>noopener/a>/code>td>em>not allowed/em>td>a href#hyperlink-annotation idlinkTypes:hyperlink-annotation-3>Annotation/a>td classno> · td>Requires any a href#browsing-context idlinkTypes:browsing-context>browsing context/a> created by following the hyperlink to a href#disowned-its-opener idlinkTypes:disowned-its-opener>disown its opener/a>.tr>td>code idlinkTypes:link-type-noreferrer>a href#link-type-noreferrer>noreferrer/a>/code>td>em>not allowed/em>td>a href#hyperlink-annotation idlinkTypes:hyperlink-annotation-4>Annotation/a>td classno> · td>Requires that the user agent not send an HTTP `code idlinkTypes:http-referer>a data-x-internalhttp-referer hrefhttps://tools.ietf.org/html/rfc7231#section-5.5.2>Referer/a>/code>` (sic) header if the user follows the hyperlink.tr>td>code idlinkTypes:link-type-pingback-2>a href#link-type-pingback>pingback/a>/code>td>a href#external-resource-link idlinkTypes:external-resource-link-4>External Resource/a>td>em>not allowed/em>td classyes> Yes td>Gives the address of the pingback server that handles pingbacks to the current document.tr>td>code idlinkTypes:link-type-preconnect-2>a href#link-type-preconnect>preconnect/a>/code>td>a href#external-resource-link idlinkTypes:external-resource-link-5>External Resource/a>td>em>not allowed/em>td classyes> Yes td>Specifies that the user agent should preemptively connect to the target resources a href#concept-origin idlinkTypes:concept-origin-2>origin/a>.tr>td>code idlinkTypes:link-type-prefetch-2>a href#link-type-prefetch>prefetch/a>/code>td>a href#external-resource-link idlinkTypes:external-resource-link-6>External Resource/a>td>em>not allowed/em>td classyes> Yes td>Specifies that the user agent should preemptively a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idlinkTypes:concept-fetch data-x-internalconcept-fetch>fetch/a> and cache the target resource as it is likely to be required for a followup a href#navigate idlinkTypes:navigate>navigation/a>.tr>td>code idlinkTypes:link-type-preload-2>a href#link-type-preload>preload/a>/code>td>a href#external-resource-link idlinkTypes:external-resource-link-7>External Resource/a>td>em>not allowed/em>td classyes> Yes td>Specifies that the user agent must preemptively a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idlinkTypes:concept-fetch-2 data-x-internalconcept-fetch>fetch/a> and cache the target resource for current a href#navigate idlinkTypes:navigate-2>navigation/a> according to the a hrefhttps://fetch.spec.whatwg.org/#concept-potential-destination idlinkTypes:concept-potential-destination data-x-internalconcept-potential-destination>potential destination/a> given by the code idlinkTypes:attr-link-as>a href#attr-link-as>as/a>/code> attribute (and the a hrefhttps://fetch.spec.whatwg.org/#concept-request-priority idlinkTypes:concept-request-priority data-x-internalconcept-request-priority>priority/a> associated with the a hrefhttps://fetch.spec.whatwg.org/#concept-potential-destination-translate idlinkTypes:concept-potential-destination-translate data-x-internalconcept-potential-destination-translate>corresponding/a> a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination idlinkTypes:concept-request-destination data-x-internalconcept-request-destination>destination/a>).tr>td>code idlinkTypes:link-type-prerender-2>a href#link-type-prerender>prerender/a>/code>td>a href#external-resource-link idlinkTypes:external-resource-link-8>External Resource/a>td>em>not allowed/em>td classyes> Yes td>Specifies that the user agent should preemptively a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idlinkTypes:concept-fetch-3 data-x-internalconcept-fetch>fetch/a> the target resource and process it in a way that helps deliver a faster response in the future.tr>td>code idlinkTypes:link-type-prev>a href#link-type-prev>prev/a>/code>td>a href#hyperlink idlinkTypes:hyperlink-13>Hyperlink/a>td>a href#hyperlink idlinkTypes:hyperlink-14>Hyperlink/a>td classno> · 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 idlinkTypes:link-type-search>a href#link-type-search>search/a>/code>td>a href#hyperlink idlinkTypes:hyperlink-15>Hyperlink/a>td>a href#hyperlink idlinkTypes:hyperlink-16>Hyperlink/a>td classno> · td>Gives a link to a resource that can be used to search through the current document and its related pages.tr>td>code idlinkTypes:link-type-serviceworker>a href#link-type-serviceworker>serviceworker/a>/code>td>a href#hyperlink idlinkTypes:hyperlink-17>Hyperlink/a>td>em>not allowed/em>td classno> · td>Declares a a idlinkTypes:service-worker-registration hrefhttps://w3c.github.io/ServiceWorker/#dfn-service-worker-registration data-x-internalservice-worker-registration>service worker registration/a>.tr>td>code idlinkTypes:link-type-stylesheet-2>a href#link-type-stylesheet>stylesheet/a>/code>td>a href#external-resource-link idlinkTypes:external-resource-link-9>External Resource/a>td>em>not allowed/em>td classyes> Yes td>Imports a stylesheet.tr>td>code idlinkTypes:link-type-tag>a href#link-type-tag>tag/a>/code>td>em>not allowed/em>td>a href#hyperlink idlinkTypes:hyperlink-18>Hyperlink/a>td classno> · td>Gives a tag (identified by the given address) that applies to the current document./table> h5 idrel-alternate>span classsecno>4.6.6.1/span> Link type dfn>code>alternate/code>/dfn>a href#rel-alternate classself-link>/a>/h5> p>The code idrel-alternate:rel-alternate>a href#rel-alternate>alternate/a>/code> keyword may be used with code idrel-alternate:the-link-element>a href#the-link-element>link/a>/code>, code idrel-alternate:the-a-element>a href#the-a-element>a/a>/code>, and code idrel-alternate:the-area-element>a href#the-area-element>area/a>/code> elements./p> p>The meaning of this keyword depends on the values of the other attributes./p> dl classswitch>dt>If the element is a code idrel-alternate:the-link-element-2>a href#the-link-element>link/a>/code> element and the code idrel-alternate:attr-link-rel>a href#attr-link-rel>rel/a>/code> attribute also contains the keyword code idrel-alternate:link-type-stylesheet>a href#link-type-stylesheet>stylesheet/a>/code>dd> p>The code idrel-alternate:rel-alternate-2>a href#rel-alternate>alternate/a>/code> keyword modifies the meaning of the code idrel-alternate:link-type-stylesheet-2>a href#link-type-stylesheet>stylesheet/a>/code> keyword in the way described for that keyword. The code idrel-alternate:rel-alternate-3>a href#rel-alternate>alternate/a>/code> keyword does not create a link of its own./p> div classexample> p>Here, a set of code idrel-alternate:the-link-element-3>a href#the-link-element>link/a>/code> elements provide some style sheets:/p> pre><!-- a persistent style sheet --><link relstylesheet hrefdefault.css><!-- the preferred alternate style sheet --><link relstylesheet hrefgreen.css titleGreen styles><!-- some alternate style sheets --><link relalternate stylesheet hrefcontrast.css titleHigh contrast><link relalternate stylesheet hrefbig.css titleBig fonts><link relalternate stylesheet hrefwide.css titleWide screen>/pre> /div> dt>If the code idrel-alternate:rel-alternate-4>a href#rel-alternate>alternate/a>/code> keyword is used with the code idrel-alternate:attr-hyperlink-type>a href#attr-hyperlink-type>type/a>/code> attribute set to the value code>application/rss+xml/code> or the value code>application/atom+xml/code>dd> p>The keyword creates a a href#hyperlink idrel-alternate:hyperlink>hyperlink/a> referencing a syndication feed (though not necessarily syndicating exactly the same content as the current page)./p> p>For the purposes of feed autodiscovery, user agents should consider all code idrel-alternate:the-link-element-4>a href#the-link-element>link/a>/code> elements in the document with the code idrel-alternate:rel-alternate-5>a href#rel-alternate>alternate/a>/code> keyword used and with their code idrel-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>. If the user agent has the concept of a default syndication feed, the first such element (in a idrel-alternate:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>) should be used as the default./p> div classexample> p>The following code idrel-alternate:the-link-element-5>a href#the-link-element>link/a>/code> elements give syndication feeds for a blog:/p> pre><link relalternate typeapplication/atom+xml hrefposts.xml titleCool Stuff Blog><link relalternate typeapplication/atom+xml hrefposts.xml?categoryrobots titleCool Stuff Blog: robots category><link relalternate typeapplication/atom+xml hrefcomments.xml titleCool Stuff Blog: Comments>/pre> p>Such code idrel-alternate:the-link-element-6>a href#the-link-element>link/a>/code> elements would be used by user agents engaged in feed autodiscovery, with the first being the default (where applicable)./p> p>The following example offers various different syndication feeds to the user, using code idrel-alternate:the-a-element-2>a href#the-a-element>a/a>/code> elements:/p> pre><p>You can access the planets database using Atom feeds:</p><ul> <li><a hrefrecently-visited-planets.xml relalternate typeapplication/atom+xml>Recently Visited Planets</a></li> <li><a hrefknown-bad-planets.xml relalternate typeapplication/atom+xml>Known Bad Planets</a></li> <li><a hrefunexplored-planets.xml relalternate typeapplication/atom+xml>Unexplored Planets</a></li></ul>/pre> p>These links would not be used in feed autodiscovery./p> /div> dt>Otherwisedd> p>The keyword creates a a href#hyperlink idrel-alternate:hyperlink-2>hyperlink/a> referencing an alternate representation of the current document./p> p>The nature of the referenced document is given by the code idrel-alternate:attr-hyperlink-hreflang>a href#attr-hyperlink-hreflang>hreflang/a>/code>, and code idrel-alternate:attr-hyperlink-type-3>a href#attr-hyperlink-type>type/a>/code> attributes./p> p>If the code idrel-alternate:rel-alternate-6>a href#rel-alternate>alternate/a>/code> keyword is used with the code idrel-alternate:attr-hyperlink-hreflang-2>a href#attr-hyperlink-hreflang>hreflang/a>/code> attribute, and that attributes value differs from the a idrel-alternate:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>s a href#language idrel-alternate:language>language/a>, it indicates that the referenced document is a translation./p> p>If the code idrel-alternate:rel-alternate-7>a href#rel-alternate>alternate/a>/code> keyword is used with the code idrel-alternate:attr-hyperlink-type-4>a href#attr-hyperlink-type>type/a>/code> attribute, it indicates that the referenced document is a reformulation of the current document in the specified format./p> p>The code idrel-alternate:attr-hyperlink-hreflang-3>a href#attr-hyperlink-hreflang>hreflang/a>/code> and code idrel-alternate:attr-hyperlink-type-5>a href#attr-hyperlink-type>type/a>/code> attributes can be combined when specified with the code idrel-alternate:rel-alternate-8>a href#rel-alternate>alternate/a>/code> keyword./p> div classexample> p>The following example shows how you can specify versions of the page that use alternative formats, are aimed at other languages, and that are intended for other media:/p> pre><link relalternate href/en/html hreflangen typetext/html titleEnglish HTML><link relalternate href/fr/html hreflangfr typetext/html titleFrench HTML><link relalternate href/en/html/print hreflangen typetext/html mediaprint titleEnglish HTML (for printing)><link relalternate href/fr/html/print hreflangfr typetext/html mediaprint titleFrench HTML (for printing)><link relalternate href/en/pdf hreflangen typeapplication/pdf titleEnglish PDF><link relalternate href/fr/pdf hreflangfr typeapplication/pdf titleFrench PDF>/pre> /div> p>This relationship is transitive — that is, if a document links to two other documents with the link type code idrel-alternate:rel-alternate-9>a href#rel-alternate>alternate/a>/code>, then, in addition to implying that those documents are alternative representations of the first document, it is also implying that those two documents are alternative representations of each other./p> /dl> h5 idlink-type-author>span classsecno>4.6.6.2/span> Link type dfn>code>author/code>/dfn>a href#link-type-author classself-link>/a>/h5> p>The code idlink-type-author:link-type-author>a href#link-type-author>author/a>/code> keyword may be used with code idlink-type-author:the-link-element>a href#the-link-element>link/a>/code>, code idlink-type-author:the-a-element>a href#the-a-element>a/a>/code>, and code idlink-type-author:the-area-element>a href#the-area-element>area/a>/code> elements. This keyword creates a a href#hyperlink idlink-type-author:hyperlink>hyperlink/a>./p> p>For code idlink-type-author:the-a-element-2>a href#the-a-element>a/a>/code> and code idlink-type-author:the-area-element-2>a href#the-area-element>area/a>/code> elements, the code idlink-type-author:link-type-author-2>a href#link-type-author>author/a>/code> keyword indicates that the referenced document provides further information about the author of the nearest code idlink-type-author:the-article-element>a href#the-article-element>article/a>/code> element ancestor of the element defining the hyperlink, if there is one, or of the page as a whole, otherwise./p> p>For code idlink-type-author:the-link-element-2>a href#the-link-element>link/a>/code> elements, the code idlink-type-author:link-type-author-3>a href#link-type-author>author/a>/code> keyword indicates that the referenced document provides further information about the author for the page as a whole./p> p classnote>The referenced document can be, and often is, a code idlink-type-author:mailto-protocol>a data-x-internalmailto-protocol hrefhttps://tools.ietf.org/html/rfc6068#section-2>mailto:/a>/code> URL giving the e-mail address of the author. a href#refsMAILTO>MAILTO/a>/p> p>strong>Synonyms/strong>: For historical reasons, user agents must also treat code idlink-type-author:the-link-element-3>a href#the-link-element>link/a>/code>, code idlink-type-author:the-a-element-3>a href#the-a-element>a/a>/code>, and code idlink-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 idlink-type-author:link-type-author-4>a href#link-type-author>author/a>/code> keyword specified as a link relationship./p> h5 idlink-type-bookmark>span classsecno>4.6.6.3/span> Link type dfn>code>bookmark/code>/dfn>a href#link-type-bookmark classself-link>/a>/h5> p>The code idlink-type-bookmark:link-type-bookmark>a href#link-type-bookmark>bookmark/a>/code> keyword may be used with code idlink-type-bookmark:the-a-element>a href#the-a-element>a/a>/code> and code idlink-type-bookmark:the-area-element>a href#the-area-element>area/a>/code> elements. This keyword creates a a href#hyperlink idlink-type-bookmark:hyperlink>hyperlink/a>./p> p>The code idlink-type-bookmark:link-type-bookmark-2>a href#link-type-bookmark>bookmark/a>/code> keyword gives a permalink for the nearest ancestor code idlink-type-bookmark:the-article-element>a href#the-article-element>article/a>/code> element of the linking element in question, or of a href#associatedSection>the section the linking element is most closely associated with/a>, if there are no ancestor code idlink-type-bookmark:the-article-element-2>a href#the-article-element>article/a>/code> elements./p> div classexample> p>The following snippet has three permalinks. A user agent could determine which permalink applies to which part of the spec by looking at where the permalinks are given./p> pre> ... <body> <h1>Example of permalinks</h1> <div ida> <h2>First example</h2> <p><a hrefa.html relbookmark>This permalink applies to only the content from the first H2 to the second H2</a>. The DIV isnt exactly that section, but it roughly corresponds to it.</p> </div> <h2>Second example</h2> <article idb> <p><a hrefb.html relbookmark>This permalink applies to the outer ARTICLE element</a> (which could be, e.g., a blog post).</p> <article idc> <p><a hrefc.html relbookmark>This permalink applies to the inner ARTICLE element</a> (which could be, e.g., a blog comment).</p> </article> </article> </body> .../pre> /div> h5 idlink-type-canonical>span classsecno>4.6.6.4/span> Link type dfn>code>canonical/code>/dfn>a href#link-type-canonical classself-link>/a>/h5> p>The code idlink-type-canonical:link-type-canonical>a href#link-type-canonical>canonical/a>/code> keyword may be used with code idlink-type-canonical:the-link-element>a href#the-link-element>link/a>/code> element. This keyword creates a a href#hyperlink idlink-type-canonical:hyperlink>hyperlink/a>./p> p>The code idlink-type-canonical:link-type-canonical-2>a href#link-type-canonical>canonical/a>/code> keyword indicates that URL given by the code idlink-type-canonical:attr-link-href>a href#attr-link-href>href/a>/code> attribute is the preferred URL for the current document. That helps search engines reduce duplicate content, as described in more detail in cite>The Canonical Link Relation/cite> specification. a href#refsRFC6596>RFC6596/a>/p> h5 idlink-type-dns-prefetch>span classsecno>4.6.6.5/span> Link type dfn>code>dns-prefetch/code>/dfn>a href#link-type-dns-prefetch classself-link>/a>/h5> p>The code idlink-type-dns-prefetch:link-type-dns-prefetch>a href#link-type-dns-prefetch>dns-prefetch/a>/code> keyword may be used with code idlink-type-dns-prefetch:the-link-element>a href#the-link-element>link/a>/code> elements. This keyword creates an a href#external-resource-link idlink-type-dns-prefetch:external-resource-link>external resource link/a>. This keyword is a href#body-ok idlink-type-dns-prefetch:body-ok>body-ok/a>./p> p>The code idlink-type-dns-prefetch:link-type-dns-prefetch-2>a href#link-type-dns-prefetch>dns-prefetch/a>/code> keyword indicates that preemptively performing DNS resolution for the a href#concept-origin idlink-type-dns-prefetch:concept-origin>origin/a> of the specified resource is likely to be beneficial, as it is highly likely that the user will require resources located at that a href#concept-origin idlink-type-dns-prefetch:concept-origin-2>origin/a>, and the user experience would be improved by preempting the latency costs associated with DNS resolution. User agents must implement the processing model of the code idlink-type-dns-prefetch:link-type-dns-prefetch-3>a href#link-type-dns-prefetch>dns-prefetch/a>/code> keyword described in the cite>Resource Hints/cite> specification. a href#refsRESOURCEHINTS>RESOURCEHINTS/a>/p> p>There is no default type for resources given by the code idlink-type-dns-prefetch:link-type-dns-prefetch-4>a href#link-type-dns-prefetch>dns-prefetch/a>/code> keyword./p> h5 idlink-type-external>span classsecno>4.6.6.6/span> Link type dfn>code>external/code>/dfn>a href#link-type-external classself-link>/a>/h5> p>The code idlink-type-external:link-type-external>a href#link-type-external>external/a>/code> keyword may be used with code idlink-type-external:the-a-element>a href#the-a-element>a/a>/code> and code idlink-type-external:the-area-element>a href#the-area-element>area/a>/code> elements. This keyword does not create a a href#hyperlink idlink-type-external:hyperlink>hyperlink/a>, but a href#hyperlink-annotation idlink-type-external:hyperlink-annotation>annotates/a> any other hyperlinks created by the element (the implied hyperlink, if no other keywords create one)./p> p>The code idlink-type-external:link-type-external-2>a href#link-type-external>external/a>/code> keyword indicates that the link is leading to a document that is not part of the site that the current document forms a part of./p> h5 idlink-type-help>span classsecno>4.6.6.7/span> Link type dfn>code>help/code>/dfn>a href#link-type-help classself-link>/a>/h5> p>The code idlink-type-help:link-type-help>a href#link-type-help>help/a>/code> keyword may be used with code idlink-type-help:the-link-element>a href#the-link-element>link/a>/code>, code idlink-type-help:the-a-element>a href#the-a-element>a/a>/code>, and code idlink-type-help:the-area-element>a href#the-area-element>area/a>/code> elements. This keyword creates a a href#hyperlink idlink-type-help:hyperlink>hyperlink/a>./p> p>For code idlink-type-help:the-a-element-2>a href#the-a-element>a/a>/code> and code idlink-type-help:the-area-element-2>a href#the-area-element>area/a>/code> elements, the code idlink-type-help:link-type-help-2>a href#link-type-help>help/a>/code> keyword indicates that the referenced document provides further help information for the parent of the element defining the hyperlink, and its children./p> div classexample> p>In the following example, the form control has associated context-sensitive help. The user agent could use this information, for example, displaying the referenced document if the user presses the Help or F1 key./p> pre> <p><label> Topic: <input nametopic> <a hrefhelp/topic.html relhelp>(Help)</a></label></p>/pre> /div> p>For code idlink-type-help:the-link-element-2>a href#the-link-element>link/a>/code> elements, the code idlink-type-help:link-type-help-3>a href#link-type-help>help/a>/code> keyword indicates that the referenced document provides help for the page as a whole./p> p>For code idlink-type-help:the-a-element-3>a href#the-a-element>a/a>/code> and code idlink-type-help:the-area-element-3>a href#the-area-element>area/a>/code> elements, on some browsers, the code idlink-type-help:link-type-help-4>a href#link-type-help>help/a>/code> keyword causes the link to use a different cursor./p> h5 idrel-icon>span classsecno>4.6.6.8/span> Link type dfn>code>icon/code>/dfn>a href#rel-icon classself-link>/a>/h5>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> link-icon-pngspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf no>span>iOS Safari/span> span>None/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>2+/span>/span>span classie yes>span>IE/span> span>11+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>3.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.1+/span>/span>span classopera yes>span>Opera/span> span>9+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featlink-icon-png>caniuse.com/a>/div> p>The code idrel-icon:rel-icon>a href#rel-icon>icon/a>/code> keyword may be used with code idrel-icon:the-link-element>a href#the-link-element>link/a>/code> elements. This keyword creates an a href#external-resource-link idrel-icon:external-resource-link>external resource link/a>./p> p>The specified resource is an icon representing the page or site, and should be used by the user agent when representing the page in the user interface./p> p>Icons could be auditory icons, visual icons, or other kinds of icons. If multiple icons are provided, the user agent must select the most appropriate icon according to the code idrel-icon:attr-link-type>a href#attr-link-type>type/a>/code>, code idrel-icon:attr-link-media>a href#attr-link-media>media/a>/code>, and code idrel-icon:attr-link-sizes>a href#attr-link-sizes>sizes/a>/code> attributes. If there are multiple equally appropriate icons, user agents must use the last one declared in a idrel-icon:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> at the time that the user agent collected the list of icons. If the user agent tries to use an icon but that icon is determined, upon closer examination, to in fact be inappropriate (e.g. because it uses an unsupported format), then the user agent must try the next-most-appropriate icon as determined by the attributes./p> p classnote>User agents are not required to update icons when the list of icons changes, but are encouraged to do so./p> p>There is no default type for resources given by the code idrel-icon:rel-icon-2>a href#rel-icon>icon/a>/code> keyword. However, for the purposes of a href#concept-link-type-sniffing>determining the type of the resource/a>, user agents must expect the resource to be an image./p> p>The code idrel-icon:attr-link-sizes-2>a href#attr-link-sizes>sizes/a>/code> keywords represent icon sizes in raw pixels (as opposed to a hrefhttps://drafts.csswg.org/css-values/#px idrel-icon:px data-x-internalpx>CSS pixels/a>)./p> p classnote>An icon that is 50 a hrefhttps://drafts.csswg.org/css-values/#px idrel-icon:px-2 data-x-internalpx>CSS pixels/a> wide intended for displays with a device pixel density of two device pixels per a hrefhttps://drafts.csswg.org/css-values/#px idrel-icon:px-3 data-x-internalpx>CSS pixel/a> (2x, 192dpi) would have a width of 100 raw pixels. This feature does not support indicating that a different resource is to be used for small high-resolution icons vs large low-resolution icons (e.g. 50×50 2x vs 100×100 1x)./p> p>To parse and process the attributes value, the user agent must first a hrefhttps://infra.spec.whatwg.org/#split-on-ascii-whitespace idrel-icon:split-a-string-on-spaces data-x-internalsplit-a-string-on-spaces>split the attributes value on ASCII whitespace/a>, and must then parse each resulting keyword to determine what it represents./p> p>The dfn idattr-link-sizes-any>code>any/code>/dfn> keyword represents that the resource contains a scalable icon, e.g. as provided by an SVG image./p> p>Other keywords must be further parsed as follows to determine what they represent:/p> ul>li>p>If the keyword doesnt contain exactly one U+0078 LATIN SMALL LETTER X or U+0058 LATIN CAPITAL LETTER X character, then this keyword doesnt represent anything. Abort these steps for that keyword.li>p>Let var>width string/var> be the string before the code>x/code> or code>X/code>.li>p>Let var>height string/var> be the string after the code>x/code> or code>X/code>.li>p>If either var>width string/var> or var>height string/var> start with a U+0030 DIGIT ZERO (0) character or contain any characters other than a idrel-icon:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, then this keyword doesnt represent anything. Abort these steps for that keyword.li>p>Apply the a href#rules-for-parsing-non-negative-integers idrel-icon:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers/a> to var>width string/var> to obtain var>width/var>.li>p>Apply the a href#rules-for-parsing-non-negative-integers idrel-icon:rules-for-parsing-non-negative-integers-2>rules for parsing non-negative integers/a> to var>height string/var> to obtain var>height/var>.li>p>The keyword represents that the resource contains a bitmap icon with a width of var>width/var> device pixels and a height of var>height/var> device pixels./ul> p>The keywords specified on the code idrel-icon:attr-link-sizes-3>a href#attr-link-sizes>sizes/a>/code> attribute must not represent icon sizes that are not actually available in the linked resource./p> p>In the absence of a code idrel-icon:the-link-element-2>a href#the-link-element>link/a>/code> with the code idrel-icon:rel-icon-3>a href#rel-icon>icon/a>/code> keyword, for code idrel-icon:document>a href#document>Document/a>/code> objects whose a hrefhttps://dom.spec.whatwg.org/#concept-document-url idrel-icon:the-documents-address data-x-internalthe-documents-address>URL/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idrel-icon:concept-url-scheme data-x-internalconcept-url-scheme>scheme/a> is an a idrel-icon:http(s)-scheme hrefhttps://fetch.spec.whatwg.org/#http-scheme data-x-internalhttp(s)-scheme>HTTP(S) scheme/a>, user agents may instead run these steps a href#in-parallel idrel-icon:in-parallel>in parallel/a>:/p> ol>li>p>Let var>request/var> be a new a hrefhttps://fetch.spec.whatwg.org/#concept-request idrel-icon:concept-request data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idrel-icon:concept-request-url data-x-internalconcept-request-url>url/a> is the a idrel-icon:url-record hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a> obtained by resolving the a idrel-icon:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> code>/favicon.ico/code> against the code idrel-icon:document-2>a href#document>Document/a>/code> objects a hrefhttps://dom.spec.whatwg.org/#concept-document-url idrel-icon:the-documents-address-2 data-x-internalthe-documents-address>URL/a>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-client idrel-icon:concept-request-client data-x-internalconcept-request-client>client/a> is the code idrel-icon:document-3>a href#document>Document/a>/code> objects a href#relevant-settings-object idrel-icon:relevant-settings-object>relevant settings object/a>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination idrel-icon:concept-request-destination data-x-internalconcept-request-destination>destination/a> is code>image/code>, a idrel-icon:synchronous-flag hrefhttps://fetch.spec.whatwg.org/#synchronous-flag data-x-internalsynchronous-flag>synchronous flag/a> is set, a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode idrel-icon:concept-request-credentials-mode data-x-internalconcept-request-credentials-mode>credentials mode/a> is code>include/code>, and whose a idrel-icon:use-url-credentials-flag hrefhttps://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag data-x-internaluse-url-credentials-flag>use-URL-credentials flag/a> is set.li>p>Let var>response/var> be the result of a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idrel-icon:concept-fetch data-x-internalconcept-fetch>fetching/a> var>request/var>.li>p>Use var>response/var>s a href#unsafe-response idrel-icon:unsafe-response>unsafe response/a> as an icon as if it had been declared using the code idrel-icon:rel-icon-4>a href#rel-icon>icon/a>/code> keyword./ol> div classexample> p>The following snippet shows the top part of an application with several icons./p> pre><!DOCTYPE HTML><html langen> <head> <title>lsForums — Inbox</title> <link relicon hreffavicon.png sizes16x16 typeimage/png> <link relicon hrefwindows.ico sizes32x32 48x48 typeimage/vnd.microsoft.icon> <link relicon hrefmac.icns sizes128x128 512x512 8192x8192 32768x32768> <link relicon hrefiphone.png sizes57x57 typeimage/png> <link relicon hrefgnome.svg sizesany typeimage/svg+xml> <link relstylesheet hreflsforums.css> <script srclsforums.js></script> <meta nameapplication-name contentlsForums> </head> <body> .../pre> /div> p>For historical reasons, the code idrel-icon:rel-icon-5>a href#rel-icon>icon/a>/code> keyword may be preceded by the keyword code>shortcut/code>. If the code>shortcut/code> keyword is present, the code idrel-icon:attr-hyperlink-rel>a href#attr-hyperlink-rel>rel/a>/code> attributes entire value must be an a idrel-icon:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>shortcut icon/code> (with a single U+0020 SPACE character between the tokens and no other a idrel-icon:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>)./p> h5 idlink-type-license>span classsecno>4.6.6.9/span> Link type dfn>code>license/code>/dfn>a href#link-type-license classself-link>/a>/h5> p>The code idlink-type-license:link-type-license>a href#link-type-license>license/a>/code> keyword may be used with code idlink-type-license:the-link-element>a href#the-link-element>link/a>/code>, code idlink-type-license:the-a-element>a href#the-a-element>a/a>/code>, and code idlink-type-license:the-area-element>a href#the-area-element>area/a>/code> elements. This keyword creates a a href#hyperlink idlink-type-license:hyperlink>hyperlink/a>./p> p>The code idlink-type-license:link-type-license-2>a href#link-type-license>license/a>/code> keyword indicates that the referenced document provides the copyright license terms under which the main content of the current document is provided./p> p>This specification does not specify how to distinguish between the main content of a document and content that is not deemed to be part of that main content. The distinction should be made clear to the user./p> div classexample> p>Consider a photo sharing site. A page on that site might describe and show a photograph, and the page might be marked up as follows:/p> pre><!DOCTYPE HTML><html langen> <head> <title>Exampl Pictures: Kissat</title> <link relstylesheet href/style/default> </head> <body> <h1>Kissat</h1> <nav> <a href../>Return to photo index</a> </nav> <figure> <img src/pix/39627052_fd8dcd98b5.jpg> <figcaption>Kissat</figcaption> </figure> <p>One of them has six toes!</p> <p><small><a rellicense hrefhttp://www.opensource.org/licenses/mit-license.php>MIT Licensed</a></small></p> <footer> <a href/>Home</a> | <a href../>Photo index</a> <p><small>© copyright 2009 Exampl Pictures. All Rights Reserved.</small></p> </footer> </body></html>/pre> p>In this case the code idlink-type-license:link-type-license-3>a href#link-type-license>license/a>/code> applies to just the photo (the main content of the document), not the whole document. In particular not the design of the page itself, which is covered by the copyright given at the bottom of the document. This could be made clearer in the styling (e.g. making the license link prominently positioned near the photograph, while having the page copyright in light small text at the foot of the page)./p> /div> p>strong>Synonyms/strong>: For historical reasons, user agents must also treat the keyword code>copyright/code> like the code idlink-type-license:link-type-license-4>a href#link-type-license>license/a>/code> keyword./p> h5 idlink-type-modulepreload>span classsecno>4.6.6.10/span> Link type dfn>code>modulepreload/code>/dfn>a href#link-type-modulepreload classself-link>/a>/h5> p>The code idlink-type-modulepreload:link-type-modulepreload>a href#link-type-modulepreload>modulepreload/a>/code> keyword may be used with code idlink-type-modulepreload:the-link-element>a href#the-link-element>link/a>/code> elements. This keyword creates an a href#external-resource-link idlink-type-modulepreload:external-resource-link>external resource link/a>. This keyword is a href#body-ok idlink-type-modulepreload:body-ok>body-ok/a>./p> p>The code idlink-type-modulepreload:link-type-modulepreload-2>a href#link-type-modulepreload>modulepreload/a>/code> keyword is a specialized alternative to the code idlink-type-modulepreload:link-type-preload>a href#link-type-preload>preload/a>/code> keyword, with a processing model geared toward preloading a href#module-script idlink-type-modulepreload:module-script>module scripts/a>. In particular, it uses the specific fetch behavior for module scripts (including, e.g., a different interpretation of the code idlink-type-modulepreload:attr-link-crossorigin>a href#attr-link-crossorigin>crossorigin/a>/code> attribute), and places the result into the appropriate a href#concept-document-module-map idlink-type-modulepreload:concept-document-module-map>module map/a> for later evaluation. In contrast, a similar a href#external-resource-link idlink-type-modulepreload:external-resource-link-2>external resource link/a> using the code idlink-type-modulepreload:link-type-preload-2>a href#link-type-preload>preload/a>/code> keyword would place the result in the preload cache, without affecting the documents a href#concept-document-module-map idlink-type-modulepreload:concept-document-module-map-2>module map/a>./p> p>Additionally, implementations can take advantage of the fact that a href#module-script idlink-type-modulepreload:module-script-2>module scripts/a> declare their dependencies in order to fetch the specified modules dependency as well. This is intended as an optimization opportunity, since the user agent knows that, in all likelihood, those dependencies will also be needed later. It will not generally be observable without using technology such as service workers, or monitoring on the server side. Notably, the appropriate code idlink-type-modulepreload:event-load>a href#event-load>load/a>/code> or code idlink-type-modulepreload:event-error>a href#event-error>error/a>/code> events will occur after the specified module is fetched, and will not wait for any dependencies./p> p>The appropriate times to fetch the resource for such a link are:/p> ul>li>p>When the a href#external-resource-link idlink-type-modulepreload:external-resource-link-3>external resource link/a> is created on a code idlink-type-modulepreload:the-link-element-2>a href#the-link-element>link/a>/code> element that is already a href#browsing-context-connected idlink-type-modulepreload:browsing-context-connected>browsing-context connected/a>.li>p>When the a href#external-resource-link idlink-type-modulepreload:external-resource-link-4>external resource link/a>s code idlink-type-modulepreload:the-link-element-3>a href#the-link-element>link/a>/code> element a href#becomes-browsing-context-connected idlink-type-modulepreload:becomes-browsing-context-connected>becomes browsing-context connected/a>.li>p>When the code idlink-type-modulepreload:attr-link-href>a href#attr-link-href>href/a>/code> attribute of the code idlink-type-modulepreload:the-link-element-4>a href#the-link-element>link/a>/code> element of an a href#external-resource-link idlink-type-modulepreload:external-resource-link-5>external resource link/a> that is already a href#browsing-context-connected idlink-type-modulepreload:browsing-context-connected-2>browsing-context connected/a> is changed./ul> p classnote>Unlike some other link relations, changing the relevant attributes (such as code idlink-type-modulepreload:attr-link-as>a href#attr-link-as>as/a>/code>, code idlink-type-modulepreload:attr-link-crossorigin-2>a href#attr-link-crossorigin>crossorigin/a>/code>, and code idlink-type-modulepreload:attr-link-referrerpolicy>a href#attr-link-referrerpolicy>referrerpolicy/a>/code>) of such a code idlink-type-modulepreload:the-link-element-5>a href#the-link-element>link/a>/code> attribute does not trigger a new fetch. This is because the documents a href#concept-document-module-map idlink-type-modulepreload:concept-document-module-map-3>module map/a> has already been populated by a previous fetch, and so re-fetching would be pointless./p> p idmodulepreload-obtain-steps>To obtain the resource for such a link:/p> ol>li>p>If the code idlink-type-modulepreload:attr-link-href-2>a href#attr-link-href>href/a>/code> attributes value is the empty string, then return.li>p>Let var>destination/var> be the current state of the code idlink-type-modulepreload:attr-link-as-2>a href#attr-link-as>as/a>/code> attribute (a a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination idlink-type-modulepreload:concept-request-destination data-x-internalconcept-request-destination>destination/a>), or code>script/code> if it is in no state.li>p>If var>destination/var> is not a hrefhttps://fetch.spec.whatwg.org/#request-destination-script-like idlink-type-modulepreload:concept-script-like-destination data-x-internalconcept-script-like-destination>script-like/a>, then a href#queue-a-task idlink-type-modulepreload:queue-a-task>queue a task/a> on the a href#networking-task-source idlink-type-modulepreload:networking-task-source>networking task source/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idlink-type-modulepreload:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idlink-type-modulepreload:event-error-2>a href#event-error>error/a>/code> at the code idlink-type-modulepreload:the-link-element-6>a href#the-link-element>link/a>/code> element, and return.li>p>a href#parse-a-url idlink-type-modulepreload:parse-a-url>Parse/a> the a idlink-type-modulepreload:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> given by the code idlink-type-modulepreload:attr-link-href-3>a href#attr-link-href>href/a>/code> attribute, relative to the elements a idlink-type-modulepreload:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>. If that fails, then return. Otherwise, let var>url/var> be the a href#resulting-url-record idlink-type-modulepreload:resulting-url-record>resulting URL record/a>.li>p>Let var>settings object/var> be the code idlink-type-modulepreload:the-link-element-7>a href#the-link-element>link/a>/code> elements a idlink-type-modulepreload:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#relevant-settings-object idlink-type-modulepreload:relevant-settings-object>relevant settings object/a>.li>p>Let var>credentials mode/var> be the a href#module-script-credentials-mode idlink-type-modulepreload:module-script-credentials-mode>module script credentials mode/a> for the code idlink-type-modulepreload:attr-link-crossorigin-3>a href#attr-link-crossorigin>crossorigin/a>/code> attribute.li>p>Let var>cryptographic nonce/var> be the value of the code idlink-type-modulepreload:attr-link-nonce>a href#attr-link-nonce>nonce/a>/code> attribute, if it is specified, or the empty string otherwise.li>p>Let var>integrity metadata/var> be the value of the code idlink-type-modulepreload:attr-link-integrity>a href#attr-link-integrity>integrity/a>/code> attribute, if it is specified, or the empty string otherwise.li>p>Let var>options/var> be a a href#script-fetch-options idlink-type-modulepreload:script-fetch-options>script fetch options/a> whose a href#concept-script-fetch-options-nonce idlink-type-modulepreload:concept-script-fetch-options-nonce>cryptographic nonce/a> is var>cryptographic nonce/var>, a href#concept-script-fetch-options-integrity idlink-type-modulepreload:concept-script-fetch-options-integrity>integrity metadata/a> is var>integrity metadata/var>, a href#concept-script-fetch-options-parser idlink-type-modulepreload:concept-script-fetch-options-parser>parser metadata/a> is code>not-parser-inserted/code>, and a href#concept-script-fetch-options-credentials idlink-type-modulepreload:concept-script-fetch-options-credentials>credentials mode/a> is var>credentials mode/var>.li>p>a href#fetch-a-single-module-script idlink-type-modulepreload:fetch-a-single-module-script>Fetch a single module script/a> given var>url/var>, var>settings object/var>, var>destination/var>, var>options/var>, var>settings object/var>, code>client/code>, and with the var>top-level module fetch/var> flag set. Wait until algorithm asynchronously completes with var>result/var>.li>p>If var>result/var> is null, a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idlink-type-modulepreload:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idlink-type-modulepreload:event-error-3>a href#event-error>error/a>/code> at the code idlink-type-modulepreload:the-link-element-8>a href#the-link-element>link/a>/code> element, and return.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idlink-type-modulepreload:concept-event-fire-3 data-x-internalconcept-event-fire>Fire an event/a> named code idlink-type-modulepreload:event-load-2>a href#event-load>load/a>/code> at the code idlink-type-modulepreload:the-link-element-9>a href#the-link-element>link/a>/code> element.li> p>Optionally, perform the following steps:/p> ol>li>p>Let var>visited set/var> be « var>url/var> ».li>p>a href#fetch-the-descendants-of-and-instantiate-a-module-script idlink-type-modulepreload:fetch-the-descendants-of-and-instantiate-a-module-script>Fetch the descendants of and instantiate/a> var>result/var> given var>destination/var> and var>visited set/var>./ol> p classnote>Generally, performing these steps will be beneficial for performance, as it allows pre-loading the modules that will invariably be requested later, when a href#fetch-a-module-script-tree idlink-type-modulepreload:fetch-a-module-script-tree>fetch a module script graph/a> is called. However, user agents might wish to skip them in bandwidth-constrained situations, or situations where the relevant fetches are already in flight./p> /ol> div idexample-modulepreload-manifest classexample> p>The following snippet shows the top part of an application with several modules preloaded:/p> pre><!DOCTYPE html><html langen><title>IRCFog</title><link relmodulepreload hrefapp.mjs><link relmodulepreload hrefhelpers.mjs><link relmodulepreload hrefirc.mjs><link relmodulepreload hreffog-machine.mjs><script typemodule srcapp.mjs>.../pre> p>Assume that the module graph for the application is as follows:/p> img srcimages/ircfog-modules.svg width301 altThe module graph is rooted at app.mjs, which depends on irc.mjs and fog-machine.mjs. In turn, irc.mjs depends on helpers.mjs. height151> p>Here we see the application developer has used code idlink-type-modulepreload:link-type-modulepreload-3>a href#link-type-modulepreload>modulepreload/a>/code> all of the modules in their module graph, ensuring that the user agent initiates fetches for them all. Without such preloading, the user agent might need to go through multiple network roundtrips before discovering code>helpers.mjs/code>, if technologies such as HTTP/2 Server Push are not in play. In this way, code idlink-type-modulepreload:link-type-modulepreload-4>a href#link-type-modulepreload>modulepreload/a>/code> code idlink-type-modulepreload:the-link-element-10>a href#the-link-element>link/a>/code> elements can be used as a sort of manifest of the applications modules./p> /div> div idexample-modulepreload-dynamic-import classexample> p>The following code shows how code idlink-type-modulepreload:link-type-modulepreload-5>a href#link-type-modulepreload>modulepreload/a>/code> links can be used in conjunction with code idlink-type-modulepreload:import()>a data-x-internalimport() hrefhttps://tc39.github.io/proposal-dynamic-import/#sec-import-calls>import()/a>/code> to ensure network fetching is done ahead of time, so that when code idlink-type-modulepreload:import()-2>a data-x-internalimport() hrefhttps://tc39.github.io/proposal-dynamic-import/#sec-import-calls>import()/a>/code> is called, the module is already ready (but not evaluated) in the a href#module-map idlink-type-modulepreload:module-map>module map/a>:/p> pre><link relmodulepreload hrefawesome-viewer.js><button onclickimport(./awesome-viewer.js).then(m > m.view())> View awesome thing</button>/pre> /div> h5 idlink-type-nofollow>span classsecno>4.6.6.11/span> Link type dfn>code>nofollow/code>/dfn>a href#link-type-nofollow classself-link>/a>/h5> p>The code idlink-type-nofollow:link-type-nofollow>a href#link-type-nofollow>nofollow/a>/code> keyword may be used with code idlink-type-nofollow:the-a-element>a href#the-a-element>a/a>/code> and code idlink-type-nofollow:the-area-element>a href#the-area-element>area/a>/code> elements. This keyword does not create a a href#hyperlink idlink-type-nofollow:hyperlink>hyperlink/a>, but a href#hyperlink-annotation idlink-type-nofollow:hyperlink-annotation>annotates/a> any other hyperlinks created by the element (the implied hyperlink, if no other keywords create one)./p> p>The code idlink-type-nofollow:link-type-nofollow-2>a href#link-type-nofollow>nofollow/a>/code> keyword indicates that the link is not endorsed by the original author or publisher of the page, or that the link to the referenced document was included primarily because of a commercial relationship between people affiliated with the two pages./p> h5 idlink-type-noopener>span classsecno>4.6.6.12/span> Link type dfn>code>noopener/code>/dfn>a href#link-type-noopener classself-link>/a>/h5>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> rel-noopenerspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>49+/span>/span>span classios_saf yes>span>iOS Safari/span> span>10.3+/span>/span>span classand_uc no>span>UC Browser for Android/span> span>None/span>/span>span classfirefox yes>span>Firefox/span> span>52+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>5+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>10.1+/span>/span>span classedge no>span>Edge/span> span>None/span>/span>span classandroid yes>span>Android Browser/span> span>56+/span>/span>span classopera yes>span>Opera/span> span>36+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featrel-noopener>caniuse.com/a>/div> p>The code idlink-type-noopener:link-type-noopener>a href#link-type-noopener>noopener/a>/code> keyword may be used with code idlink-type-noopener:the-a-element>a href#the-a-element>a/a>/code> and code idlink-type-noopener:the-area-element>a href#the-area-element>area/a>/code> elements. This keyword does not create a a href#hyperlink idlink-type-noopener:hyperlink>hyperlink/a>, but a href#hyperlink-annotation idlink-type-noopener:hyperlink-annotation>annotates/a> any other hyperlinks created by the element (the implied hyperlink, if no other keywords create one)./p> p>The keyword indicates that any newly created a href#browsing-context idlink-type-noopener:browsing-context>browsing context/a> which results from following the a href#hyperlink idlink-type-noopener:hyperlink-2>hyperlink/a> will have a href#disowned-its-opener idlink-type-noopener:disowned-its-opener>disowned its opener/a>, which means that its code idlink-type-noopener:dom-opener>a href#dom-opener>window.opener/a>/code> property will be code>null/code>./p> h5 idlink-type-noreferrer>span classsecno>4.6.6.13/span> Link type dfn>code>noreferrer/code>/dfn>a href#link-type-noreferrer classself-link>/a>/h5>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> rel-noreferrerspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>16+/span>/span>span classios_saf yes>span>iOS Safari/span> span>4.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>33+/span>/span>span classie partial>span>IE (limited)/span> span>11+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>5+/span>/span>span classedge yes>span>Edge/span> span>13+/span>/span>span classandroid yes>span>Android Browser/span> span>2.3+/span>/span>span classopera yes>span>Opera/span> span>15+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featrel-noreferrer>caniuse.com/a>/div> p>The code idlink-type-noreferrer:link-type-noreferrer>a href#link-type-noreferrer>noreferrer/a>/code> keyword may be used with code idlink-type-noreferrer:the-a-element>a href#the-a-element>a/a>/code> and code idlink-type-noreferrer:the-area-element>a href#the-area-element>area/a>/code> elements. This keyword does not create a a href#hyperlink idlink-type-noreferrer:hyperlink>hyperlink/a>, but a href#hyperlink-annotation idlink-type-noreferrer:hyperlink-annotation>annotates/a> any other hyperlinks created by the element (the implied hyperlink, if no other keywords create one)./p> p>It indicates that no referrer information is to be leaked when following the link./p> p>If a user agent follows a link defined by an code idlink-type-noreferrer:the-a-element-2>a href#the-a-element>a/a>/code> or code idlink-type-noreferrer:the-area-element-2>a href#the-area-element>area/a>/code> element that has the code idlink-type-noreferrer:link-type-noreferrer-2>a href#link-type-noreferrer>noreferrer/a>/code> keyword, the user agent must set their a hrefhttps://fetch.spec.whatwg.org/#concept-request idlink-type-noreferrer:concept-request data-x-internalconcept-request>request/a>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-referrer idlink-type-noreferrer:concept-request-referrer data-x-internalconcept-request-referrer>referrer/a> to code>no-referrer/code>./p> p classnote>For historical reasons, the code idlink-type-noreferrer:link-type-noreferrer-3>a href#link-type-noreferrer>noreferrer/a>/code> keyword implies the behavior associated with the code idlink-type-noreferrer:link-type-noopener>a href#link-type-noopener>noopener/a>/code> keyword when present on a hyperlink that a href#creating-a-new-browsing-context idlink-type-noreferrer:creating-a-new-browsing-context>creates/a> a new a href#browsing-context idlink-type-noreferrer:browsing-context>browsing context/a>. That is, code><a href... relnoreferrer target_blank>/code> has the same behavior as code><a href... relnoreferrer noopener target_blank>/code>./p> h5 idlink-type-pingback>span classsecno>4.6.6.14/span> Link type dfn>code>pingback/code>/dfn>a href#link-type-pingback classself-link>/a>/h5> p>The code idlink-type-pingback:link-type-pingback>a href#link-type-pingback>pingback/a>/code> keyword may be used with code idlink-type-pingback:the-link-element>a href#the-link-element>link/a>/code> elements. This keyword creates an a href#external-resource-link idlink-type-pingback:external-resource-link>external resource link/a>. This keyword is a href#body-ok idlink-type-pingback:body-ok>body-ok/a>./p> p>For the semantics of the code idlink-type-pingback:link-type-pingback-2>a href#link-type-pingback>pingback/a>/code> keyword, see the Pingback 1.0 specification. a href#refsPINGBACK>PINGBACK/a>/p> h5 idlink-type-preconnect>span classsecno>4.6.6.15/span> Link type dfn>code>preconnect/code>/dfn>a href#link-type-preconnect classself-link>/a>/h5> p>The code idlink-type-preconnect:link-type-preconnect>a href#link-type-preconnect>preconnect/a>/code> keyword may be used with code idlink-type-preconnect:the-link-element>a href#the-link-element>link/a>/code> elements. This keyword creates an a href#external-resource-link idlink-type-preconnect:external-resource-link>external resource link/a>. This keyword is a href#body-ok idlink-type-preconnect:body-ok>body-ok/a>./p> p>The code idlink-type-preconnect:link-type-preconnect-2>a href#link-type-preconnect>preconnect/a>/code> keyword indicates that preemptively initiating a connection to the a href#concept-origin idlink-type-preconnect:concept-origin>origin/a> of the specified resource is likely to be beneficial, as it is highly likely that the user will require resources located at that a href#concept-origin idlink-type-preconnect:concept-origin-2>origin/a>, and the user experience would be improved by preempting the latency costs associated with establishing the connection. User agents must implement the processing model of the code idlink-type-preconnect:link-type-preconnect-3>a href#link-type-preconnect>preconnect/a>/code> keyword described in cite>Resource Hints/cite>. a href#refsRESOURCEHINTS>RESOURCEHINTS/a>/p> p>There is no default type for resources given by the code idlink-type-preconnect:link-type-preconnect-4>a href#link-type-preconnect>preconnect/a>/code> keyword./p> h5 idlink-type-prefetch>span classsecno>4.6.6.16/span> Link type dfn>code>prefetch/code>/dfn>a href#link-type-prefetch classself-link>/a>/h5> p>The code idlink-type-prefetch:link-type-prefetch>a href#link-type-prefetch>prefetch/a>/code> keyword may be used with code idlink-type-prefetch:the-link-element>a href#the-link-element>link/a>/code> elements. This keyword creates an a href#external-resource-link idlink-type-prefetch:external-resource-link>external resource link/a>. This keyword is a href#body-ok idlink-type-prefetch:body-ok>body-ok/a>./p> p>The code idlink-type-prefetch:link-type-prefetch-2>a href#link-type-prefetch>prefetch/a>/code> keyword indicates that preemptively a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idlink-type-prefetch:concept-fetch data-x-internalconcept-fetch>fetching/a> and caching the specified resource is likely to be beneficial, as it is highly likely that the user will require this resource for future navigations. User agents must implement the processing model of the code idlink-type-prefetch:link-type-prefetch-3>a href#link-type-prefetch>prefetch/a>/code> keyword described in cite>Resource Hints/cite>. a href#refsRESOURCEHINTS>RESOURCEHINTS/a>/p> p>There is no default type for resources given by the code idlink-type-prefetch:link-type-prefetch-4>a href#link-type-prefetch>prefetch/a>/code> keyword./p> h5 idlink-type-preload>span classsecno>4.6.6.17/span> Link type dfn>code>preload/code>/dfn>a href#link-type-preload classself-link>/a>/h5> p>The code idlink-type-preload:link-type-preload>a href#link-type-preload>preload/a>/code> keyword may be used with code idlink-type-preload:the-link-element>a href#the-link-element>link/a>/code> elements. This keyword creates an a href#external-resource-link idlink-type-preload:external-resource-link>external resource link/a>. This keyword is a href#body-ok idlink-type-preload:body-ok>body-ok/a>./p> p>The code idlink-type-preload:link-type-preload-2>a href#link-type-preload>preload/a>/code> keyword indicates that the user agent must preemptively a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idlink-type-preload:concept-fetch data-x-internalconcept-fetch>fetch/a> and cache the specified resource according to the a hrefhttps://fetch.spec.whatwg.org/#concept-potential-destination idlink-type-preload:concept-potential-destination data-x-internalconcept-potential-destination>potential destination/a> given by the code idlink-type-preload:attr-link-as>a href#attr-link-as>as/a>/code> attribute (and the a hrefhttps://fetch.spec.whatwg.org/#concept-request-priority idlink-type-preload:concept-request-priority data-x-internalconcept-request-priority>priority/a> associated with the a hrefhttps://fetch.spec.whatwg.org/#concept-potential-destination-translate idlink-type-preload:concept-potential-destination-translate data-x-internalconcept-potential-destination-translate>corresponding/a> a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination idlink-type-preload:concept-request-destination data-x-internalconcept-request-destination>destination/a>), as it is highly likely that the user will require this resource for the current navigation. User agents must implement the processing model of the code idlink-type-preload:link-type-preload-3>a href#link-type-preload>preload/a>/code> keyword described in cite>Preload/cite>, as well as in this specifications a href#concept-link-obtain idlink-type-preload:concept-link-obtain>obtain the resource/a> algorithm. a href#refsPRELOAD>PRELOAD/a>/p> p>There is no default type for resources given by the code idlink-type-preload:link-type-preload-4>a href#link-type-preload>preload/a>/code> keyword./p> h5 idlink-type-prerender>span classsecno>4.6.6.18/span> Link type dfn>code>prerender/code>/dfn>a href#link-type-prerender classself-link>/a>/h5> p>The code idlink-type-prerender:link-type-prerender>a href#link-type-prerender>prerender/a>/code> keyword may be used with code idlink-type-prerender:the-link-element>a href#the-link-element>link/a>/code> elements. This keyword creates an a href#external-resource-link idlink-type-prerender:external-resource-link>external resource link/a>. This keyword is a href#body-ok idlink-type-prerender:body-ok>body-ok/a>./p> p>The code idlink-type-prerender:link-type-prerender-2>a href#link-type-prerender>prerender/a>/code> keyword indicates that the specified resource might be required by the next navigation, and so it may be beneficial to not only preemptively a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idlink-type-prerender:concept-fetch data-x-internalconcept-fetch>fetch/a> the resource, but also to process it, e.g. by a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idlink-type-prerender:concept-fetch-2 data-x-internalconcept-fetch>fetching/a> its subresources or performing some rendering. User agents must implement the processing model of the code idlink-type-prerender:link-type-prerender-3>a href#link-type-prerender>prerender/a>/code> keyword described in cite>Resource Hints/cite>. a href#refsRESOURCEHINTS>RESOURCEHINTS/a>/p> p>There is no default type for resources given by the code idlink-type-prerender:link-type-prerender-4>a href#link-type-prerender>prerender/a>/code> keyword./p> h5 idlink-type-search>span classsecno>4.6.6.19/span> Link type dfn>code>search/code>/dfn>a href#link-type-search classself-link>/a>/h5> p>The code idlink-type-search:link-type-search>a href#link-type-search>search/a>/code> keyword may be used with code idlink-type-search:the-link-element>a href#the-link-element>link/a>/code>, code idlink-type-search:the-a-element>a href#the-a-element>a/a>/code>, and code idlink-type-search:the-area-element>a href#the-area-element>area/a>/code> elements. This keyword creates a a href#hyperlink idlink-type-search:hyperlink>hyperlink/a>./p> p>The code idlink-type-search:link-type-search-2>a href#link-type-search>search/a>/code> keyword indicates that the referenced document provides an interface specifically for searching the document and its related resources./p> p classnote>OpenSearch description documents can be used with code idlink-type-search:the-link-element-2>a href#the-link-element>link/a>/code> elements and the code idlink-type-search:link-type-search-3>a href#link-type-search>search/a>/code> link type to enable user agents to autodiscover search interfaces. a href#refsOPENSEARCH>OPENSEARCH/a>/p> h5 data-dfn-forlink/rel idlink-type-serviceworker data-dfn-typeattr-value data-ltserviceworker data-export>span classsecno>4.6.6.20/span> Link type dfn>code>serviceworker/code>/dfn>a href#link-type-serviceworker classself-link>/a>/h5> p>The code idlink-type-serviceworker:link-type-serviceworker>a href#link-type-serviceworker>serviceworker/a>/code> keyword may be used with code idlink-type-serviceworker:the-link-element>a href#the-link-element>link/a>/code> elements. This keyword creates an a href#external-resource-link idlink-type-serviceworker:external-resource-link>external resource link/a> that is used to declare a a idlink-type-serviceworker:service-worker-registration hrefhttps://w3c.github.io/ServiceWorker/#dfn-service-worker-registration data-x-internalservice-worker-registration>service worker registration/a> and its a idlink-type-serviceworker:script-url hrefhttps://w3c.github.io/ServiceWorker/#dfn-script-url data-x-internalscript-url>script url/a>, a idlink-type-serviceworker:scope-url hrefhttps://w3c.github.io/ServiceWorker/#dfn-scope-url data-x-internalscope-url>scope url/a>, a hrefhttps://w3c.github.io/ServiceWorker/#dfn-type idlink-type-serviceworker:service-worker-type data-x-internalservice-worker-type>type/a>, and a idlink-type-serviceworker:update-via-cache-mode hrefhttps://w3c.github.io/ServiceWorker/#dfn-update-via-cache data-x-internalupdate-via-cache-mode>update via cache mode/a>./p> p>User agents must implement the processing model for code idlink-type-serviceworker:the-link-element-2>a href#the-link-element>link/a>/code>-element a hrefhttps://w3c.github.io/ServiceWorker/#dfn-serviceworker-link idlink-type-serviceworker:serviceworker-link data-x-internalserviceworker-link>serviceworker links/a> described in cite>Service Workers/cite>, using the code idlink-type-serviceworker:attr-link-href>a href#attr-link-href>href/a>/code>, code idlink-type-serviceworker:attr-link-scope>a href#attr-link-scope>scope/a>/code>, code idlink-type-serviceworker:attr-link-workertype>a href#attr-link-workertype>workertype/a>/code>, and code idlink-type-serviceworker:attr-link-updateviacache>a href#attr-link-updateviacache>updateviacache/a>/code> attributes. a href#refsSW>SW/a>/p> h5 idlink-type-stylesheet>span classsecno>4.6.6.21/span> Link type dfn>code>stylesheet/code>/dfn>a href#link-type-stylesheet classself-link>/a>/h5> p>The code idlink-type-stylesheet:link-type-stylesheet>a href#link-type-stylesheet>stylesheet/a>/code> keyword may be used with code idlink-type-stylesheet:the-link-element>a href#the-link-element>link/a>/code> elements. This keyword creates an a href#external-resource-link idlink-type-stylesheet:external-resource-link>external resource link/a> that contributes to the styling processing model. This keyword is a href#body-ok idlink-type-stylesheet:body-ok>body-ok/a>./p> p>The specified resource is a CSS style sheet that describes how to present the document./p> p>If the code idlink-type-stylesheet:rel-alternate>a href#rel-alternate>alternate/a>/code> keyword is also specified on the code idlink-type-stylesheet:the-link-element-2>a href#the-link-element>link/a>/code> element, then dfn idthe-link-is-an-alternative-stylesheet>the link is an alternative stylesheet/dfn>; in this case, the code idlink-type-stylesheet:attr-title>a href#attr-title>title/a>/code> attribute must be specified on the code idlink-type-stylesheet:the-link-element-3>a href#the-link-element>link/a>/code> element, with a non-empty value./p> p>The default type for resources given by the code idlink-type-stylesheet:link-type-stylesheet-2>a href#link-type-stylesheet>stylesheet/a>/code> keyword is code idlink-type-stylesheet:text/css>a href#text/css>text/css/a>/code>./p> p>The appropriate times to a href#concept-link-obtain idlink-type-stylesheet:concept-link-obtain>obtain/a> the resource are: ul>li>p>When the a href#external-resource-link idlink-type-stylesheet:external-resource-link-2>external resource link/a> is created on a code idlink-type-stylesheet:the-link-element-4>a href#the-link-element>link/a>/code> element that is already a href#browsing-context-connected idlink-type-stylesheet:browsing-context-connected>browsing-context connected/a>.li>p>When the a href#external-resource-link idlink-type-stylesheet:external-resource-link-3>external resource link/a>s code idlink-type-stylesheet:the-link-element-5>a href#the-link-element>link/a>/code> element a href#becomes-browsing-context-connected idlink-type-stylesheet:becomes-browsing-context-connected>becomes browsing-context connected/a>.li>p>When the code idlink-type-stylesheet:attr-link-href>a href#attr-link-href>href/a>/code> attribute of the code idlink-type-stylesheet:the-link-element-6>a href#the-link-element>link/a>/code> element of an a href#external-resource-link idlink-type-stylesheet:external-resource-link-4>external resource link/a> that is already a href#browsing-context-connected idlink-type-stylesheet:browsing-context-connected-2>browsing-context connected/a> is changed.li>p>When the code idlink-type-stylesheet:attr-link-crossorigin>a href#attr-link-crossorigin>crossorigin/a>/code> attribute of the code idlink-type-stylesheet:the-link-element-7>a href#the-link-element>link/a>/code> element of an a href#external-resource-link idlink-type-stylesheet:external-resource-link-5>external resource link/a> that is already a href#browsing-context-connected idlink-type-stylesheet:browsing-context-connected-3>browsing-context connected/a> is set, changed, or removed.li>p>When the code idlink-type-stylesheet:attr-link-type>a href#attr-link-type>type/a>/code> attribute of the code idlink-type-stylesheet:the-link-element-8>a href#the-link-element>link/a>/code> element of an a href#external-resource-link idlink-type-stylesheet:external-resource-link-6>external resource link/a> that is already a href#browsing-context-connected idlink-type-stylesheet:browsing-context-connected-4>browsing-context connected/a> is set or changed to a value that does not or no longer matches the a href#content-type idlink-type-stylesheet:content-type>Content-Type metadata/a> of the previous obtained external resource, if any.li>p>When the code idlink-type-stylesheet:attr-link-type-2>a href#attr-link-type>type/a>/code> attribute of the code idlink-type-stylesheet:the-link-element-9>a href#the-link-element>link/a>/code> element of an a href#external-resource-link idlink-type-stylesheet:external-resource-link-7>external resource link/a> that is already a href#browsing-context-connected idlink-type-stylesheet:browsing-context-connected-5>browsing-context connected/a>, but was previously not obtained due to the code idlink-type-stylesheet:attr-link-type-3>a href#attr-link-type>type/a>/code> attribute specifying an unsupported type, is set, removed, or changed.li>p>When the a href#external-resource-link idlink-type-stylesheet:external-resource-link-8>external resource link/a> that is already a href#browsing-context-connected idlink-type-stylesheet:browsing-context-connected-6>browsing-context connected/a> changes from being a href#the-link-is-an-alternative-stylesheet idlink-type-stylesheet:the-link-is-an-alternative-stylesheet>an alternative stylesheet/a> to not being one, or vice versa./ul> p>strong>Quirk/strong>: If the document has been set to a idlink-type-stylesheet:quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>, has the a href#same-origin idlink-type-stylesheet:same-origin>same origin/a> as the a idlink-type-stylesheet:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the external resource, and the a href#content-type idlink-type-stylesheet:content-type-2>Content-Type metadata/a> of the external resource is not a supported style sheet type, the user agent must instead assume it to be code idlink-type-stylesheet:text/css-2>a href#text/css>text/css/a>/code>./p> p>Once a resource has been a href#concept-link-obtain idlink-type-stylesheet:concept-link-obtain-2>obtained/a>, if its a href#content-type idlink-type-stylesheet:content-type-3>Content-Type metadata/a> is code idlink-type-stylesheet:text/css-3>a href#text/css>text/css/a>/code>, then run these steps:/p> ol>li>p>Let var>element/var> be the code idlink-type-stylesheet:the-link-element-10>a href#the-link-element>link/a>/code> element that created the a href#external-resource-link idlink-type-stylesheet:external-resource-link-9>external resource link/a>.li>p>If var>element/var> has an a idlink-type-stylesheet:associated-css-style-sheet hrefhttps://drafts.csswg.org/cssom/#associated-css-style-sheet data-x-internalassociated-css-style-sheet>associated CSS style sheet/a>, a hrefhttps://drafts.csswg.org/cssom/#remove-a-css-style-sheet idlink-type-stylesheet:remove-a-css-style-sheet data-x-internalremove-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 idlink-type-stylesheet:external-resource-link-10>external resource link/a> that contributes to the styling processing model, or if, since the resource in question was a href#concept-link-obtain idlink-type-stylesheet:concept-link-obtain-3>obtained/a>, it has become appropriate to a href#concept-link-obtain idlink-type-stylesheet:concept-link-obtain-4>obtain/a> it again (meaning this algorithm is about to be invoked again for a newly obtained resource), then return.li> p>a idlink-type-stylesheet:create-a-css-style-sheet hrefhttps://drafts.csswg.org/cssom/#create-a-css-style-sheet data-x-internalcreate-a-css-style-sheet>Create a CSS style sheet/a> with the following properties:/p> dl>dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-type idlink-type-stylesheet:concept-css-style-sheet-type data-x-internalconcept-css-style-sheet-type>type/a>dd>p>code idlink-type-stylesheet:text/css-4>a href#text/css>text/css/a>/code>dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-location idlink-type-stylesheet:concept-css-style-sheet-location data-x-internalconcept-css-style-sheet-location>location/a>dd> p>The a href#resulting-url-string idlink-type-stylesheet:resulting-url-string>resulting URL string/a> determined during the a href#concept-link-obtain idlink-type-stylesheet:concept-link-obtain-5>obtain/a> algorithm./p> p classnote>This is before any redirects get applied./p> dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-owner-node idlink-type-stylesheet:concept-css-style-sheet-owner-node data-x-internalconcept-css-style-sheet-owner-node>owner node/a>dd>p>var>element/var>dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-media idlink-type-stylesheet:concept-css-style-sheet-media data-x-internalconcept-css-style-sheet-media>media/a>dd> p>The code idlink-type-stylesheet:attr-link-media>a href#attr-link-media>media/a>/code> attribute of var>element/var>./p> p classnote>This is a reference to the (possibly absent at this time) attribute, rather than a copy of the attributes current value. The CSSOM specification defines what happens when the attribute is dynamically set, changed, or removed./p> dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-title idlink-type-stylesheet:concept-css-style-sheet-title data-x-internalconcept-css-style-sheet-title>title/a>dd> p>The code idlink-type-stylesheet:attr-link-title>a href#attr-link-title>title/a>/code> attribute of var>element/var>, if var>element/var> is a idlink-type-stylesheet:in-a-document-tree hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a>, or the empty string otherwise./p> p classnote>This is similarly a reference to the attribute, rather than a copy of the attributes current value./p> dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-alternate-flag idlink-type-stylesheet:concept-css-style-sheet-alternate-flag data-x-internalconcept-css-style-sheet-alternate-flag>alternate flag/a>dd>p>Set if a href#the-link-is-an-alternative-stylesheet idlink-type-stylesheet:the-link-is-an-alternative-stylesheet-2>the link is an alternative stylesheet/a>; unset otherwise.dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-origin-clean-flag idlink-type-stylesheet:concept-css-style-sheet-origin-clean-flag data-x-internalconcept-css-style-sheet-origin-clean-flag>origin-clean flag/a>dd>p>Set if the resource is a href#cors-same-origin idlink-type-stylesheet:cors-same-origin>CORS-same-origin/a>; unset otherwise.dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-parent-css-style-sheet idlink-type-stylesheet:concept-css-style-sheet-parent-css-style-sheet data-x-internalconcept-css-style-sheet-parent-css-style-sheet>parent CSS style sheet/a>dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-owner-css-rule idlink-type-stylesheet:concept-css-style-sheet-owner-css-rule data-x-internalconcept-css-style-sheet-owner-css-rule>owner CSS rule/a>dd>p>nulldt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-disabled-flag idlink-type-stylesheet:concept-css-style-sheet-disabeld-flag data-x-internalconcept-css-style-sheet-disabeld-flag>disabled flag/a>dd>p>Left at its default value.dt>a hrefhttps://drafts.csswg.org/cssom/#concept-css-style-sheet-css-rules idlink-type-stylesheet:concept-css-style-sheet-css-rules data-x-internalconcept-css-style-sheet-css-rules>CSS rules/a>dd> p>Left uninitialized./p> p classXXX>This doesnt seem right. Presumably we should be using the response body? Tracked as a hrefhttps://github.com/whatwg/html/issues/2997>issue #2997/a>./p> /dl> p>The CSS a idlink-type-stylesheet:environment-encoding hrefhttps://drafts.csswg.org/css-syntax/#environment-encoding data-x-internalenvironment-encoding>environment encoding/a> is the result of running the following steps: a href#refsCSSSYNTAX>CSSSYNTAX/a>/p> ol>li>p>If the element has a code idlink-type-stylesheet:attr-link-charset>a href#attr-link-charset>charset/a>/code> attribute, a hrefhttps://encoding.spec.whatwg.org/#concept-encoding-get idlink-type-stylesheet:getting-an-encoding data-x-internalgetting-an-encoding>get an encoding/a> from that attributes value. If that succeeds, return the resulting encoding and abort these steps. a href#refsENCODING>ENCODING/a>li>p>Otherwise, return the a idlink-type-stylesheet:documents-character-encoding hrefhttps://dom.spec.whatwg.org/#concept-document-encoding data-x-internaldocuments-character-encoding>documents character encoding/a>. a href#refsDOM>DOM/a>/ol> /ol> h5 idlink-type-tag>span classsecno>4.6.6.22/span> Link type dfn>code>tag/code>/dfn>a href#link-type-tag classself-link>/a>/h5> p>The code idlink-type-tag:link-type-tag>a href#link-type-tag>tag/a>/code> keyword may be used with code idlink-type-tag:the-a-element>a href#the-a-element>a/a>/code> and code idlink-type-tag:the-area-element>a href#the-area-element>area/a>/code> elements. This keyword creates a a href#hyperlink idlink-type-tag:hyperlink>hyperlink/a>./p> p>The code idlink-type-tag:link-type-tag-2>a href#link-type-tag>tag/a>/code> keyword indicates that the em>tag/em> that the referenced document represents applies to the current document./p> p classnote>Since it indicates that the tag em>applies to the current document/em>, it would be inappropriate to use this keyword in the markup of a a href#tag-cloud>tag cloud/a>, which lists the popular tags across a set of pages./p> div classexample> p>This document is about some gems, and so it is i>tagged/i> with code>https://en.wikipedia.org/wiki/Gemstone/code> to unambiguously categorize it as applying to the jewel kind of gems, and not to, say, the towns in the US, the Ruby package format, or the Swiss locomotive class:/p> pre><!DOCTYPE HTML><html langen> <head> <title>My Precious</title> </head> <body> <header><h1>My precious</h1> <p>Summer 2012</p></header> <p>Recently I managed to dispose of a red gem that had been bothering me. I now have a much nicer blue sapphire.</p> <p>The red gem had been found in a bauxite stone while I was digging out the office level, but nobody was willing to haul it away. The same red gem stayed there for literally years.</p> <footer> Tags: <a reltag hrefhttps://en.wikipedia.org/wiki/Gemstone>Gemstone</a> </footer> </body></html>/pre> /div> div classexample> p>In em>this/em> document, there are two articles. The code idlink-type-tag:link-type-tag-3>a href#link-type-tag>tag/a>/code> link, however, applies to the whole page (and would do so wherever it was placed, including if it was within the code idlink-type-tag:the-article-element>a href#the-article-element>article/a>/code> elements)./p> pre><!DOCTYPE HTML><html langen> <head> <title>Gem 4/4</title> </head> <body> <article> <h1>801: Steinbock</h1> <p>The number 801 Gem 4/4 electro-diesel has an ibex and was rebuilt in 2002.</p> </article> <article> <h1>802: Murmeltier</h1> <figure> <img srchttps://upload.wikimedia.org/wikipedia/commons/b/b0/Trains_de_la_Bernina_en_hiver_2.jpg altThe 802 was red with pantographs and tall vents on the side.> <figcaption>The 802 in the 1980s, above Lago Bianco.</figcaption> </figure> <p>The number 802 Gem 4/4 electro-diesel has a marmot and was rebuilt in 2003.</p> </article> <p classtopic><a reltag hrefhttps://en.wikipedia.org/wiki/Rhaetian_Railway_Gem_4/4>Gem 4/4</a></p> </body></html>/pre> /div> h5 idsequential-link-types>span classsecno>4.6.6.23/span> Sequential link typesa href#sequential-link-types classself-link>/a>/h5> p>Some documents form part of a sequence of documents./p> p>A sequence of documents is one where each document can have a em>previous sibling/em> and a em>next sibling/em>. A document with no previous sibling is the start of its sequence, a document with no next sibling is the end of its sequence./p> p>A document may be part of multiple sequences./p> h6 idlink-type-next>span classsecno>4.6.6.23.1/span> Link type dfn>code>next/code>/dfn>a href#link-type-next classself-link>/a>/h6> p>The code idlink-type-next:link-type-next>a href#link-type-next>next/a>/code> keyword may be used with code idlink-type-next:the-link-element>a href#the-link-element>link/a>/code>, code idlink-type-next:the-a-element>a href#the-a-element>a/a>/code>, and code idlink-type-next:the-area-element>a href#the-area-element>area/a>/code> elements. This keyword creates a a href#hyperlink idlink-type-next:hyperlink>hyperlink/a>./p> p>The code idlink-type-next:link-type-next-2>a href#link-type-next>next/a>/code> keyword indicates that the document is part of a sequence, and that the link is leading to the document that is the next logical document in the sequence./p> p>When the code idlink-type-next:link-type-next-3>a href#link-type-next>next/a>/code> keyword is used with a code idlink-type-next:the-link-element-2>a href#the-link-element>link/a>/code> element, user agents should implement one of the processing models described in cite>Resource Hints/cite>, i.e. should process such links as if they were using one of the code idlink-type-next:link-type-dns-prefetch>a href#link-type-dns-prefetch>dns-prefetch/a>/code>, code idlink-type-next:link-type-preconnect>a href#link-type-preconnect>preconnect/a>/code>, code idlink-type-next:link-type-prefetch>a href#link-type-prefetch>prefetch/a>/code>, or code idlink-type-next:link-type-prerender>a href#link-type-prerender>prerender/a>/code> keywords. Which resource hint the user agent wishes to use is implementation-dependent; for example, a user agent may wish to use the less-costly code idlink-type-next:link-type-preconnect-2>a href#link-type-preconnect>preconnect/a>/code> hint when trying to conserve data, battery power, or processing power, or may wish to pick a resource hint depending on heuristic analysis of past user behavior in similar scenarios. a href#refsRESOURCEHINTS>RESOURCEHINTS/a>/p> h6 idlink-type-prev>span classsecno>4.6.6.23.2/span> Link type dfn>code>prev/code>/dfn>a href#link-type-prev classself-link>/a>/h6> p>The code idlink-type-prev:link-type-prev>a href#link-type-prev>prev/a>/code> keyword may be used with code idlink-type-prev:the-link-element>a href#the-link-element>link/a>/code>, code idlink-type-prev:the-a-element>a href#the-a-element>a/a>/code>, and code idlink-type-prev:the-area-element>a href#the-area-element>area/a>/code> elements. This keyword creates a a href#hyperlink idlink-type-prev:hyperlink>hyperlink/a>./p> p>The code idlink-type-prev:link-type-prev-2>a href#link-type-prev>prev/a>/code> keyword indicates that the document is part of a sequence, and that the link is leading to the document that is the previous logical document in the sequence./p> p>strong>Synonyms/strong>: For historical reasons, user agents must also treat the keyword code>previous/code> like the code idlink-type-prev:link-type-prev-3>a href#link-type-prev>prev/a>/code> keyword./p> h5 idother-link-types>span classsecno>4.6.6.24/span> Other link typesa href#other-link-types classself-link>/a>/h5> p>dfn idconcept-rel-extensions>Extensions to the predefined set of link types/dfn> may be registered in the a hrefhttp://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions>microformats wiki existing-rel-values page/a>. a href#refsMFREL>MFREL/a>/p> p>Anyone is free to edit the span>microformats wiki existing-rel-values page/span> at any time to add a type. Extension types must be specified with the following information:/p> dl>dt>Keyworddd> p>The actual value being defined. The value should not be confusingly similar to any other defined value (e.g. differing only in case)./p> p>If the value contains a U+003A COLON character (:), it must also be an a idother-link-types:absolute-url hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>./p> dt>Effect on... code idother-link-types:the-link-element>a href#the-link-element>link/a>/code>dd> p>One of the following:/p> dl>dt>Not alloweddd>The keyword must not be specified on code idother-link-types:the-link-element-2>a href#the-link-element>link/a>/code> elements.dt>Hyperlinkdd>The keyword may be specified on a code idother-link-types:the-link-element-3>a href#the-link-element>link/a>/code> element; it creates a a href#hyperlink idother-link-types:hyperlink>hyperlink/a>.dt>External Resourcedd>The keyword may be specified on a code idother-link-types:the-link-element-4>a href#the-link-element>link/a>/code> element; it creates an a href#external-resource-link idother-link-types:external-resource-link>external resource link/a>./dl> dt>Effect on... code idother-link-types:the-a-element>a href#the-a-element>a/a>/code> and code idother-link-types:the-area-element>a href#the-area-element>area/a>/code>dd> p>One of the following:/p> dl>dt>Not alloweddd>The keyword must not be specified on code idother-link-types:the-a-element-2>a href#the-a-element>a/a>/code> and code idother-link-types:the-area-element-2>a href#the-area-element>area/a>/code> elements.dt>Hyperlinkdd>The keyword may be specified on code idother-link-types:the-a-element-3>a href#the-a-element>a/a>/code> and code idother-link-types:the-area-element-3>a href#the-area-element>area/a>/code> elements; it creates a a href#hyperlink idother-link-types:hyperlink-2>hyperlink/a>.dt>External Resourcedd>The keyword may be specified on code idother-link-types:the-a-element-4>a href#the-a-element>a/a>/code> and code idother-link-types:the-area-element-4>a href#the-area-element>area/a>/code> elements; it creates an a href#external-resource-link idother-link-types:external-resource-link-2>external resource link/a>.dt>Hyperlink Annotationdd>The keyword may be specified on code idother-link-types:the-a-element-5>a href#the-a-element>a/a>/code> and code idother-link-types:the-area-element-5>a href#the-area-element>area/a>/code> elements; it a href#hyperlink-annotation idother-link-types:hyperlink-annotation>annotates/a> other a href#hyperlink idother-link-types:hyperlink-3>hyperlinks/a> created by the element./dl> dt>Brief descriptiondd>p>A short non-normative description of what the keywords meaning is.dt>Specificationdd>p>A link to a more detailed description of the keywords semantics and requirements. It could be another page on the Wiki, or a link to an external page.dt>Synonymsdd>p>A list of other keyword values that have exactly the same processing requirements. Authors should not use the values defined to be synonyms, they are only intended to allow user agents to support legacy content. Anyone may remove synonyms that are not used in practice; only names that need to be processed as synonyms for compatibility with legacy content are to be registered in this way.dt>Statusdd> p>One of the following:/p> dl>dt>Proposeddd>The keyword has not received wide peer review and approval. Someone has proposed it and is, or soon will be, using it.dt>Ratifieddd>The keyword has received wide peer review and approval. It has a specification that unambiguously defines how to handle pages that use the keyword, including when they use it in incorrect ways.dt>Discontinueddd>The keyword has received wide peer review and it has been found wanting. Existing pages are using this keyword, but new pages should avoid it. The brief description and specification entries will give details of what authors should use instead, if anything./dl> p>If a keyword is found to be redundant with existing values, it should be removed and listed as a synonym for the existing value./p> p>If a keyword is registered in the proposed state for a period of a month or more without being used or specified, then it may be removed from the registry./p> p>If a keyword is added with the proposed status and found to be redundant with existing values, it should be removed and listed as a synonym for the existing value. If a keyword is added with the proposed status and found to be harmful, then it should be changed to discontinued status./p> p>Anyone can change the status at any time, but should only do so in accordance with the definitions above./p> /dl> p>Conformance checkers must use the information given on the span>microformats wiki existing-rel-values page/span> to establish if a value is allowed or not: values defined in this specification or marked as proposed or ratified must be accepted when used on the elements for which they apply as described in the Effect on... field, whereas values marked as discontinued or not listed in either this specification or on the aforementioned page must be rejected as invalid. Conformance checkers may cache this information (e.g. for performance reasons or to avoid the use of unreliable network connectivity)./p> p>When an author uses a new type not defined by either this specification or the Wiki page, conformance checkers should offer to add the value to the Wiki, with the details described above, with the proposed status./p> p>Types defined as extensions in the a hrefhttp://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions>microformats wiki existing-rel-values page/a> with the status proposed or ratified may be used with the code>rel/code> attribute on code idother-link-types:the-link-element-5>a href#the-link-element>link/a>/code>, code idother-link-types:the-a-element-6>a href#the-a-element>a/a>/code>, and code idother-link-types:the-area-element-6>a href#the-area-element>area/a>/code> elements in accordance to the Effect on... field. a href#refsMFREL>MFREL/a>/p> h3 idedits>span classsecno>4.7/span> Editsa href#edits classself-link>/a>/h3> p>The code idedits:the-ins-element>a href#the-ins-element>ins/a>/code> and code idedits:the-del-element>a href#the-del-element>del/a>/code> elements represent edits to the document./p> h4 idthe-ins-element>span classsecno>4.7.1/span> The dfn>code>ins/code>/dfn> elementa href#the-ins-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-ins-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-ins-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-ins-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-ins-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-ins-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-ins-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-ins-element:concept-element-content-model>Content model/a>:dd>a href#transparent idthe-ins-element:transparent>Transparent/a>.dt>a href#concept-element-tag-omission idthe-ins-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-ins-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-ins-element:global-attributes>Global attributes/a>dd>code idthe-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 editdd>code idthe-ins-element:attr-mod-datetime>a href#attr-mod-datetime>datetime/a>/code> — Date and (optionally) time of the changedt>a href#concept-element-dom idthe-ins-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-ins-element:htmlmodelement>a href#htmlmodelement>HTMLModElement/a>/code>./dl> p>The code idthe-ins-element:the-ins-element>a href#the-ins-element>ins/a>/code> element a href#represents idthe-ins-element:represents>represents/a> an addition to the document./p> div classexample> p>The following represents the addition of a single paragraph:/p> pre><aside> <ins> <p> I like fruit. </p> </ins></aside>/pre> p>As does the following, because everything in the code idthe-ins-element:the-aside-element>a href#the-aside-element>aside/a>/code> element here counts as a href#phrasing-content-2 idthe-ins-element:phrasing-content-2-3>phrasing content/a> and therefore there is just one a href#paragraph idthe-ins-element:paragraph>paragraph/a>:/p> pre><aside> <ins> Apples are <em>tasty</em>. </ins> <ins> So are pears. </ins></aside>/pre> /div> p>code idthe-ins-element:the-ins-element-2>a href#the-ins-element>ins/a>/code> elements should not cross a href#paragraph idthe-ins-element:paragraph-2>implied paragraph/a> boundaries./p> div classexample> p>The following example represents the addition of two paragraphs, the second of which was inserted in two parts. The first code idthe-ins-element:the-ins-element-3>a href#the-ins-element>ins/a>/code> element in this example thus crosses a paragraph boundary, which is considered poor form./p> pre classbad><aside> <!-- dont do this --> <ins datetime2005-03-16 00:00Z> <p> I like fruit. </p> Apples are <em>tasty</em>. </ins> <ins datetime2007-12-19 00:00Z> So are pears. </ins></aside>/pre> p>Here is a better way of marking this up. It uses more elements, but none of the elements cross implied paragraph boundaries./p> pre><aside> <ins datetime2005-03-16 00:00Z> <p> I like fruit. </p> </ins> <ins datetime2005-03-16 00:00Z> Apples are <em>tasty</em>. </ins> <ins datetime2007-12-19 00:00Z> So are pears. </ins></aside>/pre> /div> h4 idthe-del-element>span classsecno>4.7.2/span> The dfn>code>del/code>/dfn> elementa href#the-del-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-del-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-del-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-del-element:phrasing-content-2>Phrasing content/a>.dt>a href#concept-element-contexts idthe-del-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-del-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-del-element:concept-element-content-model>Content model/a>:dd>a href#transparent idthe-del-element:transparent>Transparent/a>.dt>a href#concept-element-tag-omission idthe-del-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-del-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-del-element:global-attributes>Global attributes/a>dd>code idthe-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 editdd>code idthe-del-element:attr-mod-datetime>a href#attr-mod-datetime>datetime/a>/code> — Date and (optionally) time of the changedt>a href#concept-element-dom idthe-del-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-del-element:htmlmodelement>a href#htmlmodelement>HTMLModElement/a>/code>./dl> p>The code idthe-del-element:the-del-element>a href#the-del-element>del/a>/code> element a href#represents idthe-del-element:represents>represents/a> a removal from the document./p> p>code idthe-del-element:the-del-element-2>a href#the-del-element>del/a>/code> elements should not cross a href#paragraph idthe-del-element:paragraph>implied paragraph/a> boundaries./p> div classexample> p>The following shows a to do list where items that have been done are crossed-off with the date and time of their completion./p> pre><h1>To Do</h1><ul> <li>Empty the dishwasher</li> <li><del datetime2009-10-11T01:25-07:00>Watch Walter Lewins lectures</del></li> <li><del datetime2009-10-10T23:38-07:00>Download more tracks</del></li> <li>Buy a printer</li></ul>/pre> /div> h4 idattributes-common-to-ins-and-del-elements>span classsecno>4.7.3/span> Attributes common to code idattributes-common-to-ins-and-del-elements:the-ins-element>a href#the-ins-element>ins/a>/code> and code idattributes-common-to-ins-and-del-elements:the-del-element>a href#the-del-element>del/a>/code> elementsa href#attributes-common-to-ins-and-del-elements classself-link>/a>/h4> p>The dfn idattr-mod-cite>code>cite/code>/dfn> attribute may be used to specify the a hrefhttps://dom.spec.whatwg.org/#concept-document-url idattributes-common-to-ins-and-del-elements:the-documents-address data-x-internalthe-documents-address>URL/a> of a document that explains the change. When that document is long, for instance the minutes of a meeting, authors are encouraged to include a a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idattributes-common-to-ins-and-del-elements:concept-url-fragment data-x-internalconcept-url-fragment>fragment/a> pointing to the specific part of that document that discusses the change./p> p>If the code idattributes-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 idattributes-common-to-ins-and-del-elements:valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by spaces/a> that explains the change. To obtain the corresponding citation link, the value of the attribute must be a href#parse-a-url idattributes-common-to-ins-and-del-elements:parse-a-url>parsed/a> relative to the elements a idattributes-common-to-ins-and-del-elements:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>. User agents may allow users to follow such citation links, but they are primarily intended for private use (e.g., by server-side scripts collecting statistics about a sites edits), not for readers./p> p>The dfn idattr-mod-datetime>code>datetime/code>/dfn> attribute may be used to specify the time and date of the change./p> p>If present, the code idattributes-common-to-ins-and-del-elements:attr-mod-datetime>a href#attr-mod-datetime>datetime/a>/code> attributes value must be a a href#valid-date-string-with-optional-time idattributes-common-to-ins-and-del-elements:valid-date-string-with-optional-time>valid date string with optional time/a>./p> p>User agents must parse the code idattributes-common-to-ins-and-del-elements:attr-mod-datetime-2>a href#attr-mod-datetime>datetime/a>/code> attribute according to the a href#parse-a-date-or-time-string idattributes-common-to-ins-and-del-elements:parse-a-date-or-time-string>parse a date or time string/a> algorithm. If that doesnt return a a href#concept-date idattributes-common-to-ins-and-del-elements:concept-date>date/a> or a a href#concept-datetime idattributes-common-to-ins-and-del-elements:concept-datetime>global date and time/a>, then the modification has no associated timestamp (the value is non-conforming; it is not a a href#valid-date-string-with-optional-time idattributes-common-to-ins-and-del-elements:valid-date-string-with-optional-time-2>valid date string with optional time/a>). Otherwise, the modification is marked as having been made at the given a href#concept-date idattributes-common-to-ins-and-del-elements:concept-date-2>date/a> or a href#concept-datetime idattributes-common-to-ins-and-del-elements:concept-datetime-2>global date and time/a>. If the given value is a a href#concept-datetime idattributes-common-to-ins-and-del-elements:concept-datetime-3>global date and time/a> then user agents should use the associated time-zone offset information to determine which time zone to present the given datetime in./p> p>This value may be shown to the user, but it is primarily intended for private use./p> p>The code idattributes-common-to-ins-and-del-elements:the-ins-element-2>a href#the-ins-element>ins/a>/code> and code idattributes-common-to-ins-and-del-elements:the-del-element-2>a href#the-del-element>del/a>/code> elements must implement the code idattributes-common-to-ins-and-del-elements:htmlmodelement>a href#htmlmodelement>HTMLModElement/a>/code> interface:/p> pre classidl>ExposedWindow, a href#htmlconstructor idattributes-common-to-ins-and-del-elements:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlmodelement>HTMLModElement/dfn> : a href#htmlelement idattributes-common-to-ins-and-del-elements:htmlelement>HTMLElement/a> { a href#cereactions idattributes-common-to-ins-and-del-elements:cereactions>CEReactions/a> attribute USVString a href#dom-mod-cite idattributes-common-to-ins-and-del-elements:dom-mod-cite>cite/a>; a href#cereactions idattributes-common-to-ins-and-del-elements:cereactions-2>CEReactions/a> attribute DOMString a href#dom-mod-datetime idattributes-common-to-ins-and-del-elements:dom-mod-datetime>dateTime/a>;};/pre> p>The dfn iddom-mod-cite>code>cite/code>/dfn> IDL attribute must a href#reflect idattributes-common-to-ins-and-del-elements:reflect>reflect/a> the elements code idattributes-common-to-ins-and-del-elements:attr-mod-cite-2>a href#attr-mod-cite>cite/a>/code> content attribute. The dfn iddom-mod-datetime>code>dateTime/code>/dfn> IDL attribute must a href#reflect idattributes-common-to-ins-and-del-elements:reflect-2>reflect/a> the elements code idattributes-common-to-ins-and-del-elements:attr-mod-datetime-3>a href#attr-mod-datetime>datetime/a>/code> content attribute./p> h4 idedits-and-paragraphs>span classsecno>4.7.4/span> Edits and paragraphsa href#edits-and-paragraphs classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>Since the code idedits-and-paragraphs:the-ins-element>a href#the-ins-element>ins/a>/code> and code idedits-and-paragraphs:the-del-element>a href#the-del-element>del/a>/code> elements do not affect a href#paragraph idedits-and-paragraphs:paragraph>paragraphing/a>, it is possible, in some cases where paragraphs are a href#paragraph idedits-and-paragraphs:paragraph-2>implied/a> (without explicit code idedits-and-paragraphs:the-p-element>a href#the-p-element>p/a>/code> elements), for an code idedits-and-paragraphs:the-ins-element-2>a href#the-ins-element>ins/a>/code> or code idedits-and-paragraphs:the-del-element-2>a href#the-del-element>del/a>/code> element to span both an entire paragraph or other non-a href#phrasing-content-2 idedits-and-paragraphs:phrasing-content-2>phrasing content/a> elements and part of another paragraph. For example:/p> pre><section> <ins> <p> This is a paragraph that was inserted. </p> This is another paragraph whose first sentence was inserted at the same time as the paragraph above. </ins> This is a second sentence, which was there all along.</section>/pre> p>By only wrapping some paragraphs in code idedits-and-paragraphs:the-p-element-2>a href#the-p-element>p/a>/code> elements, one can even get the end of one paragraph, a whole second paragraph, and the start of a third paragraph to be covered by the same code idedits-and-paragraphs:the-ins-element-3>a href#the-ins-element>ins/a>/code> or code idedits-and-paragraphs:the-del-element-3>a href#the-del-element>del/a>/code> element (though this is very confusing, and not considered good practice):/p> pre classbad><section> This is the first paragraph. <ins>This sentence was inserted. <p>This second paragraph was inserted.</p> This sentence was inserted too.</ins> This is the third paragraph in this example. <!-- (dont do this) --></section>/pre> p>However, due to the way a href#paragraph idedits-and-paragraphs:paragraph-3>implied paragraphs/a> are defined, it is not possible to mark up the end of one paragraph and the start of the very next one using the same code idedits-and-paragraphs:the-ins-element-4>a href#the-ins-element>ins/a>/code> or code idedits-and-paragraphs:the-del-element-4>a href#the-del-element>del/a>/code> element. You instead have to use one (or two) code idedits-and-paragraphs:the-p-element-3>a href#the-p-element>p/a>/code> element(s) and two code idedits-and-paragraphs:the-ins-element-5>a href#the-ins-element>ins/a>/code> or code idedits-and-paragraphs:the-del-element-5>a href#the-del-element>del/a>/code> elements, as for example:/p> pre><section> <p>This is the first paragraph. <del>This sentence was deleted.</del></p> <p><del>This sentence was deleted too.</del> That sentence needed a separate <del> element.</p></section>/pre> p>Partly because of the confusion described above, authors are strongly encouraged to always mark up all paragraphs with the code idedits-and-paragraphs:the-p-element-4>a href#the-p-element>p/a>/code> element, instead of having code idedits-and-paragraphs:the-ins-element-6>a href#the-ins-element>ins/a>/code> or code idedits-and-paragraphs:the-del-element-6>a href#the-del-element>del/a>/code> elements that cross a href#paragraph idedits-and-paragraphs:paragraph-4>implied paragraphs/a> boundaries./p> h4 idedits-and-lists>span classsecno>4.7.5/span> Edits and listsa href#edits-and-lists classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>The content models of the code idedits-and-lists:the-ol-element>a href#the-ol-element>ol/a>/code> and code idedits-and-lists:the-ul-element>a href#the-ul-element>ul/a>/code> elements do not allow code idedits-and-lists:the-ins-element>a href#the-ins-element>ins/a>/code> and code idedits-and-lists:the-del-element>a href#the-del-element>del/a>/code> elements as children. Lists always represent all their items, including items that would otherwise have been marked as deleted./p> p>To indicate that an item is inserted or deleted, an code idedits-and-lists:the-ins-element-2>a href#the-ins-element>ins/a>/code> or code idedits-and-lists:the-del-element-2>a href#the-del-element>del/a>/code> element can be wrapped around the contents of the code idedits-and-lists:the-li-element>a href#the-li-element>li/a>/code> element. To indicate that an item has been replaced by another, a single code idedits-and-lists:the-li-element-2>a href#the-li-element>li/a>/code> element can have one or more code idedits-and-lists:the-del-element-3>a href#the-del-element>del/a>/code> elements followed by one or more code idedits-and-lists:the-ins-element-3>a href#the-ins-element>ins/a>/code> elements./p> div classexample> p>In the following example, a list that started empty had items added and removed from it over time. The bits in the example that have been emphasized show the parts that are the current state of the list. The list item numbers dont take into account the edits, though./p> pre><h1>Stop-ship bugs</h1><ol> <li><ins datetime2008-02-12T15:20Z>em>Bug 225: Rain detector doesnt work in snow/em></ins></li> <li><del datetime2008-03-01T20:22Z><ins datetime2008-02-14T12:02Z>Bug 228: Water buffer overflows in April</ins></del></li> <li><ins datetime2008-02-16T13:50Z>em>Bug 230: Water heater doesnt use renewable fuels/em></ins></li> <li><del datetime2008-02-20T21:15Z><ins datetime2008-02-16T14:25Z>Bug 232: Carbon dioxide emissions detected after startup</ins></del></li></ol>/pre> /div> div classexample> p>In the following example, a list that started with just fruit was replaced by a list with just colors./p> pre><h1>List of <del>fruits</del><ins>colors</ins></h1><ul> <li><del>Lime</del><ins>Green</ins></li> <li><del>Apple</del></li> <li>Orange</li> <li><del>Pear</del></li> <li><ins>Teal</ins></li> <li><del>Lemon</del><ins>Yellow</ins></li> <li>Olive</li> <li><ins>Purple</ins></li></ul>/pre> /div> h4 idedits-and-tables>span classsecno>4.7.6/span> Edits and tablesa href#edits-and-tables classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>The elements that form part of the table model have complicated content model requirements that do not allow for the code idedits-and-tables:the-ins-element>a href#the-ins-element>ins/a>/code> and code idedits-and-tables:the-del-element>a href#the-del-element>del/a>/code> elements, so indicating edits to a table can be difficult./p> p>To indicate that an entire row or an entire column has been added or removed, the entire contents of each cell in that row or column can be wrapped in code idedits-and-tables:the-ins-element-2>a href#the-ins-element>ins/a>/code> or code idedits-and-tables:the-del-element-2>a href#the-del-element>del/a>/code> elements (respectively)./p> div classexample> p>Here, a tables row has been added:/p> pre><table> <thead> <tr> <th> Game name <th> Game publisher <th> Verdict <tbody> <tr> <td> Diablo 2 <td> Blizzard <td> 8/10 <tr> <td> Portal <td> Valve <td> 10/10strong> <tr> <td> <ins>Portal 2</ins> <td> <ins>Valve</ins> <td> <ins>10/10</ins>/strong></table>/pre> p>Here, a column has been removed (the time at which it was removed is given also, as is a link to the page explaining why):/p> pre><table> <thead> <tr> <th> Game name <th> Game publisher <th> strong><del cite/edits/r192 datetime2011-05-02 14:23Z>Verdict</del>/strong> <tbody> <tr> <td> Diablo 2 <td> Blizzard <td> strong><del cite/edits/r192 datetime2011-05-02 14:23Z>8/10</del>/strong> <tr> <td> Portal <td> Valve <td> strong><del cite/edits/r192 datetime2011-05-02 14:23Z>10/10</del>/strong> <tr> <td> Portal 2 <td> Valve <td> strong><del cite/edits/r192 datetime2011-05-02 14:23Z>10/10</del>/strong></table>/pre> /div> p>Generally speaking, there is no good way to indicate more complicated edits (e.g. that a cell was removed, moving all subsequent cells up or to the left)./p> h3 idembedded-content>span classsecno>4.8/span> Embedded contenta href#embedded-content classself-link>/a>/h3> h4 idthe-picture-element>span classsecno>4.8.1/span> The dfn>code>picture/code>/dfn> elementa href#the-picture-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> picturespan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>38+/span>/span>span classios_saf yes>span>iOS Safari/span> span>9.3+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>38+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>9.1+/span>/span>span classedge yes>span>Edge/span> span>13+/span>/span>span classandroid yes>span>Android Browser/span> span>56+/span>/span>span classopera yes>span>Opera/span> span>25+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featpicture>caniuse.com/a>/div> dl classelement>dt>a href#concept-element-categories idthe-picture-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-picture-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-picture-element:phrasing-content-2>Phrasing content/a>.dd>a href#embedded-content-category idthe-picture-element:embedded-content-category>Embedded content/a>.dt>a href#concept-element-contexts idthe-picture-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#embedded-content-category idthe-picture-element:embedded-content-category-2>embedded content/a> is expected.dt>a href#concept-element-content-model idthe-picture-element:concept-element-content-model>Content model/a>:dd>Zero or more code idthe-picture-element:the-source-element>a href#the-source-element>source/a>/code> elements, followed by one code idthe-picture-element:the-img-element>a href#the-img-element>img/a>/code> element, optionally intermixed with a href#script-supporting-elements-2 idthe-picture-element:script-supporting-elements-2>script-supporting elements/a>.dt>a href#concept-element-tag-omission idthe-picture-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-picture-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-picture-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-picture-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-picture-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlpictureelement>HTMLPictureElement/dfn> : a href#htmlelement idthe-picture-element:htmlelement>HTMLElement/a> {};/pre> /dl> p>The code idthe-picture-element:the-picture-element>a href#the-picture-element>picture/a>/code> element is a container which provides multiple sources to its contained code idthe-picture-element:the-img-element-2>a href#the-img-element>img/a>/code> element to allow authors to declaratively control or give hints to the user agent about which image resource to use, based on the screen pixel density, a idthe-picture-element:viewport hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> size, image format, and other factors. It a href#represents idthe-picture-element:represents>represents/a> its children./p> p classnote>The code idthe-picture-element:the-picture-element-2>a href#the-picture-element>picture/a>/code> element is somewhat different from the similar-looking code idthe-picture-element:the-video-element>a href#the-video-element>video/a>/code> and code idthe-picture-element:the-audio-element>a href#the-audio-element>audio/a>/code> elements. While all of them contain code idthe-picture-element:the-source-element-2>a href#the-source-element>source/a>/code> elements, the code idthe-picture-element:the-source-element-3>a href#the-source-element>source/a>/code> elements code idthe-picture-element:attr-source-src>a href#attr-source-src>src/a>/code> attribute has no meaning when the element is nested within a code idthe-picture-element:the-picture-element-3>a href#the-picture-element>picture/a>/code> element, and the resource selection algorithm is different. Also, the code idthe-picture-element:the-picture-element-4>a href#the-picture-element>picture/a>/code> element itself does not display anything; it merely provides a context for its contained code idthe-picture-element:the-img-element-3>a href#the-img-element>img/a>/code> element that enables it to choose from multiple a hrefhttps://url.spec.whatwg.org/#concept-url idthe-picture-element:url data-x-internalurl>URLs/a>./p> h4 idthe-source-element>span classsecno>4.8.2/span> The dfn>code>source/code>/dfn> elementa href#the-source-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-source-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-source-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As a child of a code idthe-source-element:the-picture-element>a href#the-picture-element>picture/a>/code> element, before the code idthe-source-element:the-img-element>a href#the-img-element>img/a>/code> element.dd>As a child of a a href#media-element idthe-source-element:media-element>media element/a>, before any a href#flow-content-2 idthe-source-element:flow-content-2>flow content/a> or code idthe-source-element:the-track-element>a href#the-track-element>track/a>/code> elements.dt>a href#concept-element-content-model idthe-source-element:concept-element-content-model>Content model/a>:dd>a href#concept-content-nothing idthe-source-element:concept-content-nothing>Nothing/a>.dt>a href#concept-element-tag-omission idthe-source-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>No a href#syntax-end-tag idthe-source-element:syntax-end-tag>end tag/a>.dt>a href#concept-element-attributes idthe-source-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-source-element:global-attributes>Global attributes/a>dd>code idthe-source-element:attr-source-src>a href#attr-source-src>src/a>/code> — Address of the resourcedd>code idthe-source-element:attr-source-type>a href#attr-source-type>type/a>/code> — Type of embedded resourcedd>code idthe-source-element:attr-source-srcset>a href#attr-source-srcset>srcset/a>/code> — Images to use in different situations (e.g. high-resolution displays, small monitors, etc)dd>code idthe-source-element:attr-source-sizes>a href#attr-source-sizes>sizes/a>/code> — Image sizes for different page layoutsdd>code idthe-source-element:attr-source-media>a href#attr-source-media>media/a>/code> — Applicable mediadt>a href#concept-element-dom idthe-source-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-source-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlsourceelement>HTMLSourceElement/dfn> : a href#htmlelement idthe-source-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-source-element:cereactions>CEReactions/a> attribute USVString a href#dom-source-src idthe-source-element:dom-source-src>src/a>; a href#cereactions idthe-source-element:cereactions-2>CEReactions/a> attribute DOMString a href#dom-source-type idthe-source-element:dom-source-type>type/a>; a href#cereactions idthe-source-element:cereactions-3>CEReactions/a> attribute USVString a href#dom-source-srcset idthe-source-element:dom-source-srcset>srcset/a>; a href#cereactions idthe-source-element:cereactions-4>CEReactions/a> attribute DOMString a href#dom-source-sizes idthe-source-element:dom-source-sizes>sizes/a>; a href#cereactions idthe-source-element:cereactions-5>CEReactions/a> attribute DOMString a href#dom-source-media idthe-source-element:dom-source-media>media/a>;};/pre> /dl> p>The code idthe-source-element:the-source-element>a href#the-source-element>source/a>/code> element allows authors to specify multiple alternative a href#source-set idthe-source-element:source-set>source sets/a> for code idthe-source-element:the-img-element-2>a href#the-img-element>img/a>/code> elements or multiple alternative a href#media-resource idthe-source-element:media-resource>media resources/a> for a href#media-element idthe-source-element:media-element-2>media elements/a>. It does not a href#represents idthe-source-element:represents>represent/a> anything on its own./p> p>The dfn idattr-source-type>code>type/code>/dfn> attribute may be present. If present, the value must be a a idthe-source-element:valid-mime-type hrefhttps://mimesniff.spec.whatwg.org/#valid-mime-type data-x-internalvalid-mime-type>valid MIME type/a>./p> p>The remainder of the requirements depend on whether the parent is a code idthe-source-element:the-picture-element-2>a href#the-picture-element>picture/a>/code> element or a a href#media-element idthe-source-element:media-element-3>media element/a>:/p> dl classswitch>dt>code idthe-source-element:the-source-element-2>a href#the-source-element>source/a>/code> elements parent is a code idthe-source-element:the-picture-element-3>a href#the-picture-element>picture/a>/code> elementdd> p>The dfn idattr-source-srcset>code>srcset/code>/dfn> attribute must be present, and is a a href#srcset-attribute idthe-source-element:srcset-attribute>srcset attribute/a>./p> p>The code idthe-source-element:attr-source-srcset-2>a href#attr-source-srcset>srcset/a>/code> attribute contributes the a href#image-source idthe-source-element:image-source>image sources/a> to the a href#source-set idthe-source-element:source-set-2>source set/a>, if the code idthe-source-element:the-source-element-3>a href#the-source-element>source/a>/code> element is selected./p> p>If the code idthe-source-element:attr-source-srcset-3>a href#attr-source-srcset>srcset/a>/code> attribute has any a href#image-candidate-string idthe-source-element:image-candidate-string>image candidate strings/a> using a a href#width-descriptor idthe-source-element:width-descriptor>width descriptor/a>, the dfn idattr-source-sizes>code>sizes/code>/dfn> attribute must also be present, and is a a href#sizes-attribute idthe-source-element:sizes-attribute>sizes attribute/a>. The code idthe-source-element:attr-source-sizes-2>a href#attr-source-sizes>sizes/a>/code> attribute contributes the a href#source-size-2 idthe-source-element:source-size-2>source size/a> to the a href#source-set idthe-source-element:source-set-3>source set/a>, if the code idthe-source-element:the-source-element-4>a href#the-source-element>source/a>/code> element is selected./p> p>The dfn idattr-source-media>code>media/code>/dfn> attributes may also be present. If present, the value must contain a a href#valid-media-query-list idthe-source-element:valid-media-query-list>valid media query list/a>. The user agent will skip to the next code idthe-source-element:the-source-element-5>a href#the-source-element>source/a>/code> element if the value does not a href#matches-the-environment idthe-source-element:matches-the-environment>match the environment/a>./p> p>The code idthe-source-element:attr-source-type-2>a href#attr-source-type>type/a>/code> attribute gives the type of the images in the a href#source-set idthe-source-element:source-set-4>source set/a>, to allow the user agent to skip to the next code idthe-source-element:the-source-element-6>a href#the-source-element>source/a>/code> element if it does not support the given type./p> p classnote>If the code idthe-source-element:attr-source-type-3>a href#attr-source-type>type/a>/code> attribute is em>not/em> specified, the user agent will not select a different code idthe-source-element:the-source-element-7>a href#the-source-element>source/a>/code> element if it finds that it does not support the image format after fetching it./p> p>When a code idthe-source-element:the-source-element-8>a href#the-source-element>source/a>/code> element has a following sibling code idthe-source-element:the-source-element-9>a href#the-source-element>source/a>/code> element or code idthe-source-element:the-img-element-3>a href#the-img-element>img/a>/code> element with a code idthe-source-element:attr-img-srcset>a href#attr-img-srcset>srcset/a>/code> attribute specified, it must have at least one of the following:/p> ul>li>p>A code idthe-source-element:attr-source-media-2>a href#attr-source-media>media/a>/code> attribute specified with a value that, after a hrefhttps://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace idthe-source-element:strip-leading-and-trailing-ascii-whitespace data-x-internalstrip-leading-and-trailing-ascii-whitespace>stripping leading and trailing ASCII whitespace/a>, is not the empty string and is not an a idthe-source-element:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>all/code>.li>p>A code idthe-source-element:attr-source-type-4>a href#attr-source-type>type/a>/code> attribute specified./ul> p>The code idthe-source-element:attr-source-src-2>a href#attr-source-src>src/a>/code> attribute must not be present./p> dt>code idthe-source-element:the-source-element-10>a href#the-source-element>source/a>/code> elements parent is a a href#media-element idthe-source-element:media-element-4>media element/a>dd> p>The dfn idattr-source-src>code>src/code>/dfn> attribute gives the a idthe-source-element:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the a href#media-resource idthe-source-element:media-resource-2>media resource/a>. The value must be a a href#valid-non-empty-url-potentially-surrounded-by-spaces idthe-source-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces/a>. This attribute must be present./p> p classnote>Dynamically modifying a code idthe-source-element:the-source-element-11>a href#the-source-element>source/a>/code> element and its attribute when the element is already inserted in a code idthe-source-element:the-video-element>a href#the-video-element>video/a>/code> or code idthe-source-element:the-audio-element>a href#the-audio-element>audio/a>/code> element will have no effect. To change what is playing, just use the code idthe-source-element:attr-media-src>a href#attr-media-src>src/a>/code> attribute on the a href#media-element idthe-source-element:media-element-5>media element/a> directly, possibly making use of the code idthe-source-element:dom-navigator-canplaytype>a href#dom-navigator-canplaytype>canPlayType()/a>/code> method to pick from amongst available resources. Generally, manipulating code idthe-source-element:the-source-element-12>a href#the-source-element>source/a>/code> elements manually after the document has been parsed is an unnecessarily complicated approach./p> p>The code idthe-source-element:attr-source-type-5>a href#attr-source-type>type/a>/code> attribute gives the type of the a href#media-resource idthe-source-element:media-resource-3>media resource/a>, to help the user agent determine if it can play this a href#media-resource idthe-source-element:media-resource-4>media resource/a> before fetching it. The code>codecs/code> parameter, which certain MIME types define, might be necessary to specify exactly how the resource is encoded. a href#refsRFC6381>RFC6381/a>/p> div classexample> p>The following list shows some examples of how to use the code>codecs/code> MIME parameter in the code idthe-source-element:attr-source-type-6>a href#attr-source-type>type/a>/code> attribute./p> dl>dt>H.264 Constrained baseline profile video (main and extended video compatible) level 3 and Low-Complexity AAC audio in MP4 containerdd>pre><source srcvideo.mp4 typevideo/mp4; codecsavc1.42E01E, mp4a.40.2>/pre>dt>H.264 Extended profile video (baseline-compatible) level 3 and Low-Complexity AAC audio in MP4 containerdd>pre><source srcvideo.mp4 typevideo/mp4; codecsavc1.58A01E, mp4a.40.2>/pre>dt>H.264 Main profile video level 3 and Low-Complexity AAC audio in MP4 containerdd>pre><source srcvideo.mp4 typevideo/mp4; codecsavc1.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 containerdd>pre><source srcvideo.mp4 typevideo/mp4; codecsavc1.64001E, mp4a.40.2>/pre>dt>MPEG-4 Visual Simple Profile Level 0 video and Low-Complexity AAC audio in MP4 containerdd>pre><source srcvideo.mp4 typevideo/mp4; codecsmp4v.20.8, mp4a.40.2>/pre>dt>MPEG-4 Advanced Simple Profile Level 0 video and Low-Complexity AAC audio in MP4 containerdd>pre><source srcvideo.mp4 typevideo/mp4; codecsmp4v.20.240, mp4a.40.2>/pre>dt>MPEG-4 Visual Simple Profile Level 0 video and AMR audio in 3GPP containerdd>pre><source srcvideo.3gp typevideo/3gpp; codecsmp4v.20.8, samr>/pre>dt>Theora video and Vorbis audio in Ogg containerdd>pre><source srcvideo.ogv typevideo/ogg; codecstheora, vorbis>/pre>dt>Theora video and Speex audio in Ogg containerdd>pre><source srcvideo.ogv typevideo/ogg; codecstheora, speex>/pre>dt>Vorbis audio alone in Ogg containerdd>pre><source srcaudio.ogg typeaudio/ogg; codecsvorbis>/pre>dt>Speex audio alone in Ogg containerdd>pre><source srcaudio.spx typeaudio/ogg; codecsspeex>/pre>dt>FLAC audio alone in Ogg containerdd>pre><source srcaudio.oga typeaudio/ogg; codecsflac>/pre>dt>Dirac video and Vorbis audio in Ogg containerdd>pre><source srcvideo.ogv typevideo/ogg; codecsdirac, vorbis>/pre>/dl> /div> p>The code idthe-source-element:attr-source-srcset-4>a href#attr-source-srcset>srcset/a>/code>, code idthe-source-element:attr-source-sizes-3>a href#attr-source-sizes>sizes/a>/code>, and code idthe-source-element:attr-source-media-3>a href#attr-source-media>media/a>/code> attributes must not be present./p> /dl> p>If a code idthe-source-element:the-source-element-13>a href#the-source-element>source/a>/code> a href#nodes-are-inserted idthe-source-element:nodes-are-inserted>element is inserted/a> as a child of a a href#media-element idthe-source-element:media-element-6>media element/a> that has no code idthe-source-element:attr-media-src-2>a href#attr-media-src>src/a>/code> attribute and whose code idthe-source-element:dom-media-networkstate>a href#dom-media-networkstate>networkState/a>/code> has the value code idthe-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 idthe-source-element:media-element-7>media element/a>s a href#concept-media-load-algorithm idthe-source-element:concept-media-load-algorithm>resource selection algorithm/a>./p> p>The IDL attributes dfn iddom-source-src>code>src/code>/dfn>, dfn iddom-source-type>code>type/code>/dfn>, dfn iddom-source-srcset>code>srcset/code>/dfn>, dfn iddom-source-sizes>code>sizes/code>/dfn> and dfn iddom-source-media>code>media/code>/dfn> must a href#reflect idthe-source-element:reflect>reflect/a> the respective content attributes of the same name./p> div classexample> p>If the author isnt sure if user agents will all be able to render the media resources provided, the author can listen to the code idthe-source-element:event-error>a href#event-error>error/a>/code> event on the last code idthe-source-element:the-source-element-14>a href#the-source-element>source/a>/code> element and trigger fallback behavior:/p> pre><script> function fallback(video) { // replace <video> with its contents while (video.hasChildNodes()) { if (video.firstChild instanceof HTMLSourceElement) video.removeChild(video.firstChild); else video.parentNode.insertBefore(video.firstChild, video); } video.parentNode.removeChild(video); }</script><video controls autoplay> <source srcvideo.mp4 typevideo/mp4; codecsavc1.42E01E, mp4a.40.2> <source srcvideo.ogv typevideo/ogg; codecstheora, vorbis onerrorfallback(parentNode)> ...</video>/pre> /div> h4 idthe-img-element data-dfn-typeelement data-ltimg>span classsecno>4.8.3/span> The dfn>code>img/code>/dfn> elementa href#the-img-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id24055 titleimg>: Making img> processing model text reusable (see comment 5)>24055/a>, a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id26068 titleimg> Maybe avoid infinite recursion when setting src in onerror>26068/a>, a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id28096 titleimg> Fire the loadend event (and possible progress events) for multipart/x-mixed-replace image streams>28096/a>/div> dl classelement>dt>a href#concept-element-categories idthe-img-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-img-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-img-element:phrasing-content-2>Phrasing content/a>.dd>a href#embedded-content-category idthe-img-element:embedded-content-category>Embedded content/a>.dd>a href#form-associated-element idthe-img-element:form-associated-element>Form-associated element/a>.dd>If the element has a code idthe-img-element:attr-hyperlink-usemap>a href#attr-hyperlink-usemap>usemap/a>/code> attribute: a href#interactive-content-2 idthe-img-element:interactive-content-2>Interactive content/a>.dd>a href#palpable-content-2 idthe-img-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-img-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#embedded-content-category idthe-img-element:embedded-content-category-2>embedded content/a> is expected.dt>a href#concept-element-content-model idthe-img-element:concept-element-content-model>Content model/a>:dd>a href#concept-content-nothing idthe-img-element:concept-content-nothing>Nothing/a>.dt>a href#concept-element-tag-omission idthe-img-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>No a href#syntax-end-tag idthe-img-element:syntax-end-tag>end tag/a>.dt>a href#concept-element-attributes idthe-img-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-img-element:global-attributes>Global attributes/a>dd>code idthe-img-element:attr-img-alt>a href#attr-img-alt>alt/a>/code> — Replacement text for use when images are not availabledd>code idthe-img-element:attr-img-src>a href#attr-img-src>src/a>/code> — Address of the resourcedd>code idthe-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 idthe-img-element:attr-img-sizes>a href#attr-img-sizes>sizes/a>/code> — Image sizes for different page layoutsdd>code idthe-img-element:attr-img-crossorigin>a href#attr-img-crossorigin>crossorigin/a>/code> — How the element handles crossorigin requestsdd>code idthe-img-element:attr-hyperlink-usemap-2>a href#attr-hyperlink-usemap>usemap/a>/code> — Name of a href#image-map idthe-img-element:image-map>image map/a> to usedd>code idthe-img-element:attr-img-ismap>a href#attr-img-ismap>ismap/a>/code> — Whether the image is a server-side image mapdd>code idthe-img-element:attr-dim-width>a href#attr-dim-width>width/a>/code> — Horizontal dimensiondd>code idthe-img-element:attr-dim-height>a href#attr-dim-height>height/a>/code> — Vertical dimensiondd>code idthe-img-element:attr-img-referrerpolicy>a href#attr-img-referrerpolicy>referrerpolicy/a>/code> — a idthe-img-element:referrer-policy hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>Referrer policy/a> for a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idthe-img-element:concept-fetch data-x-internalconcept-fetch>fetches/a> initiated by the elementdt>a href#concept-element-dom idthe-img-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-img-element:htmlconstructor>HTMLConstructor/a>, NamedConstructora href#dom-image idthe-img-element:dom-image>Image/a>(optional unsigned long width, optional unsigned long height)interface dfn idhtmlimageelement>HTMLImageElement/dfn> : a href#htmlelement idthe-img-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-img-element:cereactions>CEReactions/a> attribute DOMString a href#dom-img-alt idthe-img-element:dom-img-alt>alt/a>; a href#cereactions idthe-img-element:cereactions-2>CEReactions/a> attribute USVString a href#dom-img-src idthe-img-element:dom-img-src>src/a>; a href#cereactions idthe-img-element:cereactions-3>CEReactions/a> attribute USVString a href#dom-img-srcset idthe-img-element:dom-img-srcset>srcset/a>; a href#cereactions idthe-img-element:cereactions-4>CEReactions/a> attribute DOMString a href#dom-img-sizes idthe-img-element:dom-img-sizes>sizes/a>; a href#cereactions idthe-img-element:cereactions-5>CEReactions/a> attribute DOMString? a href#dom-img-crossorigin idthe-img-element:dom-img-crossorigin>crossOrigin/a>; a href#cereactions idthe-img-element:cereactions-6>CEReactions/a> attribute DOMString a href#dom-img-usemap idthe-img-element:dom-img-usemap>useMap/a>; a href#cereactions idthe-img-element:cereactions-7>CEReactions/a> attribute boolean a href#dom-img-ismap idthe-img-element:dom-img-ismap>isMap/a>; a href#cereactions idthe-img-element:cereactions-8>CEReactions/a> attribute unsigned long a href#dom-img-width idthe-img-element:dom-img-width>width/a>; a href#cereactions idthe-img-element:cereactions-9>CEReactions/a> attribute unsigned long a href#dom-img-height idthe-img-element:dom-img-height>height/a>; readonly attribute unsigned long a href#dom-img-naturalwidth idthe-img-element:dom-img-naturalwidth>naturalWidth/a>; readonly attribute unsigned long a href#dom-img-naturalheight idthe-img-element:dom-img-naturalheight>naturalHeight/a>; readonly attribute boolean a href#dom-img-complete idthe-img-element:dom-img-complete>complete/a>; readonly attribute USVString a href#dom-img-currentsrc idthe-img-element:dom-img-currentsrc>currentSrc/a>; a href#cereactions idthe-img-element:cereactions-10>CEReactions/a> attribute DOMString a href#dom-img-referrerpolicy idthe-img-element:dom-img-referrerpolicy>referrerPolicy/a>; Promise<void> a href#dom-img-decode idthe-img-element:dom-img-decode>decode/a>(); // a href#HTMLImageElement-partial>also has obsolete members/a>};/pre> /dl> p>An code idthe-img-element:the-img-element>a href#the-img-element>img/a>/code> element represents an image./p> p>The image given by the dfn idattr-img-src>code>src/code>/dfn> and dfn idattr-img-srcset>code>srcset/code>/dfn> attributes, and any previous sibling code idthe-img-element:the-source-element>a href#the-source-element>source/a>/code> elements code idthe-img-element:attr-source-srcset>a href#attr-source-srcset>srcset/a>/code> attributes if the parent is a code idthe-img-element:the-picture-element>a href#the-picture-element>picture/a>/code> element, is the embedded content; the value of the dfn idattr-img-alt>code>alt/code>/dfn> attribute provides equivalent content for those who cannot process images or who have image loading disabled (i.e. it is the code idthe-img-element:the-img-element-2>a href#the-img-element>img/a>/code> elements a href#fallback-content idthe-img-element:fallback-content>fallback content/a>).div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> srcsetspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>38+/span>/span>span classios_saf yes>span>iOS Safari/span> span>9.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>38+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>9+/span>/span>span classedge yes>span>Edge/span> span>16+/span>/span>span classandroid yes>span>Android Browser/span> span>56+/span>/span>span classopera yes>span>Opera/span> span>25+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featsrcset>caniuse.com/a>/div> p>The requirements on the code idthe-img-element:attr-img-alt-2>a href#attr-img-alt>alt/a>/code> attributes value are described a href#alt>in a separate section/a>./p> p>The code idthe-img-element:attr-img-src-2>a href#attr-img-src>src/a>/code> attribute must be present, and must contain a a href#valid-non-empty-url-potentially-surrounded-by-spaces idthe-img-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces/a> referencing a non-interactive, optionally animated, image resource that is neither paged nor scripted./p> p classnote>The requirements above imply that images can be static bitmaps (e.g. PNGs, GIFs, JPEGs), single-page vector documents (single-page PDFs, XML files with an SVG document element), animated bitmaps (APNGs, animated GIFs), animated vector graphics (XML files with an SVG a idthe-img-element:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> that use declarative SMIL animation), and so forth. However, these definitions preclude SVG files with script, multipage PDF files, interactive MNG files, HTML documents, plain text documents, and so forth. a href#refsPNG>PNG/a> a href#refsGIF>GIF/a> a href#refsJPEG>JPEG/a> a href#refsPDF>PDF/a> a href#refsXML>XML/a> a href#refsAPNG>APNG/a> a href#refsSVG>SVG/a> a href#refsMNG>MNG/a> /p> p>The code idthe-img-element:attr-img-srcset-2>a href#attr-img-srcset>srcset/a>/code> attribute may also be present, and is a a href#srcset-attribute idthe-img-element:srcset-attribute>srcset attribute/a>./p> p>The code idthe-img-element:attr-img-srcset-3>a href#attr-img-srcset>srcset/a>/code> attribute and the code idthe-img-element:attr-img-src-3>a href#attr-img-src>src/a>/code> attribute (if a href#width-descriptor idthe-img-element:width-descriptor>width descriptors/a> are not used) contribute the a href#image-source idthe-img-element:image-source>image sources/a> to the a href#source-set idthe-img-element:source-set>source set/a> (if no code idthe-img-element:the-source-element-2>a href#the-source-element>source/a>/code> element was selected)./p> p>If the code idthe-img-element:attr-img-srcset-4>a href#attr-img-srcset>srcset/a>/code> attribute is present and has any a href#image-candidate-string idthe-img-element:image-candidate-string>image candidate strings/a> using a a href#width-descriptor idthe-img-element:width-descriptor-2>width descriptor/a>, the dfn idattr-img-sizes>code>sizes/code>/dfn> attribute must also be present, and is a a href#sizes-attribute idthe-img-element:sizes-attribute>sizes attribute/a>. The code idthe-img-element:attr-img-sizes-2>a href#attr-img-sizes>sizes/a>/code> attribute contributes the a href#source-size-2 idthe-img-element:source-size-2>source size/a> to the a href#source-set idthe-img-element:source-set-2>source set/a> (if no code idthe-img-element:the-source-element-3>a href#the-source-element>source/a>/code> element was selected)./p> p>The dfn idattr-img-crossorigin>code>crossorigin/code>/dfn> attribute is a a href#cors-settings-attribute idthe-img-element:cors-settings-attribute>CORS settings attribute/a>. Its purpose is to allow images from third-party sites that allow cross-origin access to be used with code idthe-img-element:the-canvas-element>a href#the-canvas-element>canvas/a>/code>./p> p>The dfn idattr-img-referrerpolicy>code>referrerpolicy/code>/dfn> attribute is a a href#referrer-policy-attribute idthe-img-element:referrer-policy-attribute>referrer policy attribute/a>. Its purpose is to set the a idthe-img-element:referrer-policy-2 hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>referrer policy/a> used when a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idthe-img-element:concept-fetch-2 data-x-internalconcept-fetch>fetching/a> the image. a href#refsREFERRERPOLICY>REFERRERPOLICY/a>/p> hr> p>The code idthe-img-element:the-img-element-3>a href#the-img-element>img/a>/code> element must not be used as a layout tool. In particular, code idthe-img-element:the-img-element-4>a href#the-img-element>img/a>/code> elements should not be used to display transparent images, as such images rarely convey meaning and rarely add anything useful to the document./p> hr> p>What an code idthe-img-element:the-img-element-5>a href#the-img-element>img/a>/code> element represents depends on the code idthe-img-element:attr-img-src-4>a href#attr-img-src>src/a>/code> attribute and the code idthe-img-element:attr-img-alt-3>a href#attr-img-alt>alt/a>/code> attribute./p> dl classswitch>dt>If the code idthe-img-element:attr-img-src-5>a href#attr-img-src>src/a>/code> attribute is set and the code idthe-img-element:attr-img-alt-4>a href#attr-img-alt>alt/a>/code> attribute is set to the empty stringdd> p>The image is either decorative or supplemental to the rest of the content, redundant with some other information in the document./p> p>If the image is a href#img-available idthe-img-element:img-available>available/a> and the user agent is configured to display that image, then the element a href#represents idthe-img-element:represents>represents/a> the elements image data./p> p>Otherwise, the element a href#represents idthe-img-element:represents-2>represents/a> nothing, and may be omitted completely from the rendering. User agents may provide the user with a notification that an image is present but has been omitted from the rendering./p> dt>If the code idthe-img-element:attr-img-src-6>a href#attr-img-src>src/a>/code> attribute is set and the code idthe-img-element:attr-img-alt-5>a href#attr-img-alt>alt/a>/code> attribute is set to a value that isnt emptydd> p>The image is a key part of the content; the code idthe-img-element:attr-img-alt-6>a href#attr-img-alt>alt/a>/code> attribute gives a textual equivalent or replacement for the image./p> p>If the image is a href#img-available idthe-img-element:img-available-2>available/a> and the user agent is configured to display that image, then the element a href#represents idthe-img-element:represents-3>represents/a> the elements image data./p> p>Otherwise, the element a href#represents idthe-img-element:represents-4>represents/a> the text given by the code idthe-img-element:attr-img-alt-7>a href#attr-img-alt>alt/a>/code> attribute. User agents may provide the user with a notification that an image is present but has been omitted from the rendering./p> dt>If the code idthe-img-element:attr-img-src-7>a href#attr-img-src>src/a>/code> attribute is set and the code idthe-img-element:attr-img-alt-8>a href#attr-img-alt>alt/a>/code> attribute is notdd> p>The image might be a key part of the content, and there is no textual equivalent of the image available./p> p classnote>In a conforming document, the absence of the code idthe-img-element:attr-img-alt-9>a href#attr-img-alt>alt/a>/code> attribute indicates that the image is a key part of the content but that a textual replacement for the image was not available when the image was generated./p> p>If the image is a href#img-available idthe-img-element:img-available-3>available/a> and the user agent is configured to display that image, then the element a href#represents idthe-img-element:represents-5>represents/a> the elements image data./p> p>Otherwise, the user agent should display some sort of indicator that there is an image that is not being rendered, and may, if requested by the user, or if so configured, or when required to provide contextual information in response to navigation, provide caption information for the image, derived as follows:/p> ol>li>p>If the image has a code idthe-img-element:attr-title>a href#attr-title>title/a>/code> attribute whose value is not the empty string, then the value of that attribute is the caption information; abort these steps.li>p>If the image is a descendant of a code idthe-img-element:the-figure-element>a href#the-figure-element>figure/a>/code> element that has a child code idthe-img-element:the-figcaption-element>a href#the-figcaption-element>figcaption/a>/code> element, and, ignoring the code idthe-img-element:the-figcaption-element-2>a href#the-figcaption-element>figcaption/a>/code> element and its descendants, the code idthe-img-element:the-figure-element-2>a href#the-figure-element>figure/a>/code> element has no a href#flow-content-2 idthe-img-element:flow-content-2-2>flow content/a> descendants other than a href#inter-element-whitespace idthe-img-element:inter-element-whitespace>inter-element whitespace/a> and the code idthe-img-element:the-img-element-6>a href#the-img-element>img/a>/code> element, then the contents of the first such code idthe-img-element:the-figcaption-element-3>a href#the-figcaption-element>figcaption/a>/code> element are the caption information; abort these steps.li>p>There is no caption information./ol> dt>If the code idthe-img-element:attr-img-src-8>a href#attr-img-src>src/a>/code> attribute is not set and either the code idthe-img-element:attr-img-alt-10>a href#attr-img-alt>alt/a>/code> attribute is set to the empty string or the code idthe-img-element:attr-img-alt-11>a href#attr-img-alt>alt/a>/code> attribute is not set at alldd> p>The element a href#represents idthe-img-element:represents-6>represents/a> nothing./p> dt>Otherwisedd> p>The element a href#represents idthe-img-element:represents-7>represents/a> the text given by the code idthe-img-element:attr-img-alt-12>a href#attr-img-alt>alt/a>/code> attribute./p> /dl> p>The code idthe-img-element:attr-img-alt-13>a href#attr-img-alt>alt/a>/code> attribute does not represent advisory information. User agents must not present the contents of the code idthe-img-element:attr-img-alt-14>a href#attr-img-alt>alt/a>/code> attribute in the same way as content of the code idthe-img-element:attr-title-2>a href#attr-title>title/a>/code> attribute./p> p>User agents may always provide the user with the option to display any image, or to prevent any image from being displayed. User agents may also apply heuristics to help the user make use of the image when the user is unable to see it, e.g. due to a visual disability or because they are using a text terminal with no graphics capabilities. Such heuristics could include, for instance, optical character recognition (OCR) of text found within the image./p> p classwarning>While user agents are encouraged to repair cases of missing code idthe-img-element:attr-img-alt-15>a href#attr-img-alt>alt/a>/code> attributes, authors must not rely on such behavior. a href#alt>Requirements for providing text to act as an alternative for images/a> are described in detail below./p> p>The em>contents/em> of code idthe-img-element:the-img-element-7>a href#the-img-element>img/a>/code> elements, if any, are ignored for the purposes of rendering./p> hr> p>The code idthe-img-element:attr-hyperlink-usemap-3>a href#attr-hyperlink-usemap>usemap/a>/code> attribute, if present, can indicate that the image has an associated a href#image-map idthe-img-element:image-map-2>image map/a>./p> p>The dfn idattr-img-ismap>code>ismap/code>/dfn> attribute, when used on an element that is a descendant of an code idthe-img-element:the-a-element>a href#the-a-element>a/a>/code> element with an code idthe-img-element:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute, indicates by its presence that the element provides access to a server-side image map. This affects how events are handled on the corresponding code idthe-img-element:the-a-element-2>a href#the-a-element>a/a>/code> element./p> p>The code idthe-img-element:attr-img-ismap-2>a href#attr-img-ismap>ismap/a>/code> attribute is a a href#boolean-attribute idthe-img-element:boolean-attribute>boolean attribute/a>. The attribute must not be specified on an element that does not have an ancestor code idthe-img-element:the-a-element-3>a href#the-a-element>a/a>/code> element with an code idthe-img-element:attr-hyperlink-href-2>a href#attr-hyperlink-href>href/a>/code> attribute./p> p classnote>The code idthe-img-element:attr-hyperlink-usemap-4>a href#attr-hyperlink-usemap>usemap/a>/code> and code idthe-img-element:attr-img-ismap-3>a href#attr-img-ismap>ismap/a>/code> attributes can result in confusing behavior when used together with code idthe-img-element:the-source-element-4>a href#the-source-element>source/a>/code> elements with the code idthe-img-element:attr-source-media>a href#attr-source-media>media/a>/code> attribute specified in a code idthe-img-element:the-picture-element-2>a href#the-picture-element>picture/a>/code> element./p> p>The code idthe-img-element:the-img-element-8>a href#the-img-element>img/a>/code> element supports a href#dimension-attributes idthe-img-element:dimension-attributes>dimension attributes/a>./p> p>The dfn iddom-img-alt>code>alt/code>/dfn>, dfn iddom-img-src>code>src/code>/dfn>, dfn iddom-img-srcset>code>srcset/code>/dfn> and dfn iddom-img-sizes>code>sizes/code>/dfn> IDL attributes must a href#reflect idthe-img-element:reflect>reflect/a> the respective content attributes of the same name./p> p>The dfn iddom-img-crossorigin>code>crossOrigin/code>/dfn> IDL attribute must a href#reflect idthe-img-element:reflect-2>reflect/a> the code idthe-img-element:attr-img-crossorigin-2>a href#attr-img-crossorigin>crossorigin/a>/code> content attribute, a href#limited-to-only-known-values idthe-img-element:limited-to-only-known-values>limited to only known values/a>./p> p>The dfn iddom-img-usemap>code>useMap/code>/dfn> IDL attribute must a href#reflect idthe-img-element:reflect-3>reflect/a> the code idthe-img-element:attr-hyperlink-usemap-5>a href#attr-hyperlink-usemap>usemap/a>/code> content attribute./p> p>The dfn iddom-img-ismap>code>isMap/code>/dfn> IDL attribute must a href#reflect idthe-img-element:reflect-4>reflect/a> the code idthe-img-element:attr-img-ismap-4>a href#attr-img-ismap>ismap/a>/code> content attribute./p> p>The dfn iddom-img-referrerpolicy>code>referrerPolicy/code>/dfn> IDL attribute must a href#reflect idthe-img-element:reflect-5>reflect/a> the code idthe-img-element:attr-img-referrerpolicy-2>a href#attr-img-referrerpolicy>referrerpolicy/a>/code> content attribute, a href#limited-to-only-known-values idthe-img-element:limited-to-only-known-values-2>limited to only known values/a>./p> dl classdomintro>dt>var>image/var> . code idthe-img-element:dom-img-width-2>a href#dom-img-width>width/a>/code> var>value/var> dt>var>image/var> . code idthe-img-element:dom-img-height-2>a href#dom-img-height>height/a>/code> var>value/var> dd> p>These attributes return the actual rendered dimensions of the image, or zero if the dimensions are not known./p> p>They can be set, to change the corresponding content attributes./p> dt>var>image/var> . code idthe-img-element:dom-img-naturalwidth-2>a href#dom-img-naturalwidth>naturalWidth/a>/code>dt>var>image/var> . code idthe-img-element:dom-img-naturalheight-2>a href#dom-img-naturalheight>naturalHeight/a>/code>dd> p>These attributes return the intrinsic dimensions of the image, or zero if the dimensions are not known./p> dt>var>image/var> . code idthe-img-element:dom-img-complete-2>a href#dom-img-complete>complete/a>/code>dd> p>Returns true if the image has been completely downloaded or if no image is specified; otherwise, returns false./p> dt>var>image/var> . code idthe-img-element:dom-img-currentsrc-2>a href#dom-img-currentsrc>currentSrc/a>/code>dd> p>Returns the images a idthe-img-element:absolute-url hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>./p> dt>var>image/var> . code idthe-img-element:dom-img-decode-2>a href#dom-img-decode>decode/a>/code>()dd> p>Images usually exist in some encoded form; user agents need to decode them into raw pixels before displaying them. This process can be relatively expensive./p> p>This method causes the user agent to decode the image a href#in-parallel idthe-img-element:in-parallel>in parallel/a>, returning a promise that fulfills when decoding is complete. The decoded image data will then be readily available for at least one frame after the fulfillment, ensuring that attempting to display the image will complete without decoding delay./p> p>The promise will be rejected with an a idthe-img-element:encodingerror hrefhttps://heycam.github.io/webidl/#encodingerror data-x-internalencodingerror>code>EncodingError/code>/a> code idthe-img-element:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the image cannot be decoded./p> dt>var>image/var> new code idthe-img-element:dom-image-2>a href#dom-image>Image/a>/code>( var>width/var> , var>height/var> )dd> p>Returns a new code idthe-img-element:the-img-element-9>a href#the-img-element>img/a>/code> element, with the code idthe-img-element:attr-dim-width-2>a href#attr-dim-width>width/a>/code> and code idthe-img-element:attr-dim-height-2>a href#attr-dim-height>height/a>/code> attributes set to the values passed in the relevant arguments, if applicable./p> /dl> p>The IDL attributes dfn iddom-img-width>code>width/code>/dfn> and dfn iddom-img-height>code>height/code>/dfn> must return the rendered width and height of the image, in a hrefhttps://drafts.csswg.org/css-values/#px idthe-img-element:px data-x-internalpx>CSS pixels/a>, if the image is a href#being-rendered idthe-img-element:being-rendered>being rendered/a>, and is being rendered to a visual medium; or else the a href#density-corrected-intrinsic-width-and-height idthe-img-element:density-corrected-intrinsic-width-and-height>density-corrected intrinsic width and height/a> of the image, in a hrefhttps://drafts.csswg.org/css-values/#px idthe-img-element:px-2 data-x-internalpx>CSS pixels/a>, if the image has a idthe-img-element:intrinsic-dimensions hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic data-x-internalintrinsic-dimensions>intrinsic dimensions/a> and is i idthe-img-element:img-available-4>a href#img-available>available/a>/i> but not being rendered to a visual medium; or else 0, if the image is not i idthe-img-element:img-available-5>a href#img-available>available/a>/i> or does not have a idthe-img-element:intrinsic-dimensions-2 hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic data-x-internalintrinsic-dimensions>intrinsic dimensions/a>. a href#refsCSS>CSS/a>/p> p>On setting, they must act as if they a href#reflect idthe-img-element:reflect-6>reflected/a> the respective content attributes of the same name./p> p>The IDL attributes dfn iddom-img-naturalwidth>code>naturalWidth/code>/dfn> and dfn iddom-img-naturalheight>code>naturalHeight/code>/dfn> must return the a href#density-corrected-intrinsic-width-and-height idthe-img-element:density-corrected-intrinsic-width-and-height-2>density-corrected intrinsic width and height/a> of the image, in a hrefhttps://drafts.csswg.org/css-values/#px idthe-img-element:px-3 data-x-internalpx>CSS pixels/a>, if the image has a idthe-img-element:intrinsic-dimensions-3 hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic data-x-internalintrinsic-dimensions>intrinsic dimensions/a> and is i idthe-img-element:img-available-6>a href#img-available>available/a>/i>, or else 0. a href#refsCSS>CSS/a>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id23581 titleThe case when @src refers to a image without intrinsic width/height (SVG) is undefined.>23581/a>p classsupport>strong>Support:/strong> img-naturalwidth-naturalheightspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>3.2+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>2+/span>/span>span classie yes>span>IE/span> span>9+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>3.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.1+/span>/span>span classopera yes>span>Opera/span> span>9+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featimg-naturalwidth-naturalheight>caniuse.com/a>/div> p>The IDL attribute dfn iddom-img-complete>code>complete/code>/dfn> must return true if any of the following conditions is true:div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id18742 titletests relying on HTMLImageElement.complete are incorrect>18742/a>, a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id26113 titleimg> .complete should be changed by "update the image data" algorithm>26113/a>/div> ul classbrief>li>Both the code idthe-img-element:attr-img-src-9>a href#attr-img-src>src/a>/code> attribute and the code idthe-img-element:attr-img-srcset-5>a href#attr-img-srcset>srcset/a>/code> attribute are omitted. li>The code idthe-img-element:attr-img-srcset-6>a href#attr-img-srcset>srcset/a>/code> attribute is omitted and the code idthe-img-element:attr-img-src-10>a href#attr-img-src>src/a>/code> attributes value is the empty string. li>The final a href#concept-task idthe-img-element:concept-task>task/a> that is a href#queue-a-task idthe-img-element:queue-a-task>queued/a> by the a href#networking-task-source idthe-img-element:networking-task-source>networking task source/a> once the resource has been fetched has been a href#queue-a-task idthe-img-element:queue-a-task-2>queued/a>. li>The code idthe-img-element:the-img-element-10>a href#the-img-element>img/a>/code> element is a href#img-all idthe-img-element:img-all>completely available/a>. li>The code idthe-img-element:the-img-element-11>a href#the-img-element>img/a>/code> element is a href#img-error idthe-img-element:img-error>broken/a>. /ul> p>Otherwise, the attribute must return false./p> p classnote>The value of code idthe-img-element:dom-img-complete-3>a href#dom-img-complete>complete/a>/code> can thus change while a a href#concept-script idthe-img-element:concept-script>script/a> is executing./p> p>The dfn iddom-img-currentsrc>code>currentSrc/code>/dfn> IDL attribute must return the code idthe-img-element:the-img-element-12>a href#the-img-element>img/a>/code> elements a href#current-request idthe-img-element:current-request>current request/a>s a href#img-req-url idthe-img-element:img-req-url>current URL/a>./p> p>The dfn iddom-img-decode>code>decode()/code>/dfn> method, when invoked, must perform the following steps:/p> ol>li>p>Let var>promise/var> be a new promise.li> p>a href#queue-a-microtask idthe-img-element:queue-a-microtask>Queue a microtask/a> to perform the following steps:/p> div classnote> p>This is done because a href#update-the-image-data idthe-img-element:update-the-image-data>updating the image data/a> takes place in a microtask as well. Thus, to make code such as/p> pre>img.src stars.jpg;img.decode();/pre> p>properly decode code>stars.jpg/code>, we need to delay any processing by one microtask./p> /div> ol>li> p>If any of the following conditions are true about this code idthe-img-element:the-img-element-13>a href#the-img-element>img/a>/code> element:/p> ul classbrief>li>p>its a idthe-img-element:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is not an a href#active-document idthe-img-element:active-document>active document/a>;li>p>its a href#current-request idthe-img-element:current-request-2>current request/a>s a href#img-req-state idthe-img-element:img-req-state>state/a> is a href#img-error idthe-img-element:img-error-2>broken/a>,/ul> p>then reject var>promise/var> with an a idthe-img-element:encodingerror-2 hrefhttps://heycam.github.io/webidl/#encodingerror data-x-internalencodingerror>code>EncodingError/code>/a> code idthe-img-element:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> li> p>Otherwise, a href#in-parallel idthe-img-element:in-parallel-2>in parallel/a>, wait for one of the following cases to occur, and perform the corresponding actions:/p> dl classswitch>dt>This code idthe-img-element:the-img-element-14>a href#the-img-element>img/a>/code> elements a idthe-img-element:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> stops being an a href#active-document idthe-img-element:active-document-2>active document/a>dt>This code idthe-img-element:the-img-element-15>a href#the-img-element>img/a>/code> elements a href#current-request idthe-img-element:current-request-3>current request/a> changes or is mutateddt>This code idthe-img-element:the-img-element-16>a href#the-img-element>img/a>/code> elements a href#current-request idthe-img-element:current-request-4>current request/a>s a href#img-req-state idthe-img-element:img-req-state-2>state/a> becomes a href#img-error idthe-img-element:img-error-3>broken/a>dd> p>Reject var>promise/var> with an a idthe-img-element:encodingerror-3 hrefhttps://heycam.github.io/webidl/#encodingerror data-x-internalencodingerror>code>EncodingError/code>/a> code idthe-img-element:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> dt>This code idthe-img-element:the-img-element-17>a href#the-img-element>img/a>/code> element becomes a href#img-all idthe-img-element:img-all-2>completely available/a>dd> p>Decode the images media data entirely into its bitmap form, suitable for rapid painting to the screen./p> p>If decoding does not need to be performed for this image (for example because it is a vector graphic), resolve var>promise/var> with undefined./p> p>If decoding fails (for example due to invalid image data), reject var>promise/var> with an a idthe-img-element:encodingerror-4 hrefhttps://heycam.github.io/webidl/#encodingerror data-x-internalencodingerror>code>EncodingError/code>/a> code idthe-img-element:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> p>If the decoding process completes successfully, resolve var>promise/var> with undefined./p> p>User agents should ensure that the decoded media data stays readily available until at least the end of the next successful a href#update-the-rendering idthe-img-element:update-the-rendering>update the rendering/a> step in the a href#event-loop idthe-img-element:event-loop>event loop/a>. This is an important part of the API contract, and should not be broken if at all possible. (Typically, this would only be violated in low-memory situations that require evicting decoded image data, or when the image is too large to keep in decoded form for this period of time.)/p> /dl> p classnote>Animated images will become a href#img-all idthe-img-element:img-all-3>completely available/a> only after all their frames are loaded. Thus, even though an implementation could decode the first frame before that point, the above steps will not do so, instead waiting until all frames are available./p> /ol> li>p>Return var>promise/var>./ol> div classexample> p>Without the code idthe-img-element:dom-img-decode-3>a href#dom-img-decode>decode()/a>/code> method, the process of loading an code idthe-img-element:the-img-element-18>a href#the-img-element>img/a>/code> element and then displaying it might look like the following:/p> pre>const img new Image();img.src nebula.jpg;img.onload () > { document.body.appendChild(img);};img.onerror () > { document.body.appendChild(new Text(Could not load the nebula :());};/pre> p>However, this can cause notable dropped frames, as the paint that occurs after inserting the image into the DOM causes a synchronous decode on the main thread./p> p>This can instead be rewritten using the code idthe-img-element:dom-img-decode-4>a href#dom-img-decode>decode()/a>/code> method:/p> pre>const img new Image();img.src nebula.jpg;img.decode().then(() > { document.body.appendChild(img);}).catch(() > { document.body.appendChild(new Text(Could not load the nebula :());});/pre> p>This latter form avoids the dropped frames of the original, by allowing the user agent to decode the image a href#in-parallel idthe-img-element:in-parallel-3>in parallel/a>, and only inserting it into the DOM (and thus causing it to be painted) once the decoding process is complete./p> /div> div classexample> p>Because the code idthe-img-element:dom-img-decode-5>a href#dom-img-decode>decode()/a>/code> method attempts to ensure that the decoded image data is available for at least one frame, it can be combined with the code idthe-img-element:dom-window-requestanimationframe>a href#dom-window-requestanimationframe>requestAnimationFrame()/a>/code> API. This means it can be used with coding styles or frameworks that ensure that all DOM modifications are batched together as a href#list-of-animation-frame-callbacks idthe-img-element:list-of-animation-frame-callbacks>animation frame callbacks/a>:/p> pre>const container document.querySelector(#container);const { containerWidth, containerHeight } computeDesiredSize();requestAnimationFrame(() > { container.style.width containerWidth; container.style.height containerHeight;});// ...const img new Image();img.src supernova.jpg;img.decode().then(() > { requestAnimationFrame(() > container.appendChild(img));});/pre> /div> p>A constructor is provided for creating code idthe-img-element:htmlimageelement>a href#htmlimageelement>HTMLImageElement/a>/code> objects (in addition to the factory methods from DOM such as code idthe-img-element:dom-document-createelement>a data-x-internaldom-document-createelement hrefhttps://dom.spec.whatwg.org/#dom-document-createelement>createElement()/a>/code>): dfn iddom-image>code>Image(var>width/var>, var>height/var>)/code>/dfn>. When invoked, the constructor must perform the following steps:/p> ol>li>p>Let var>document/var> be the a href#current-global-object idthe-img-element:current-global-object>current global object/a>s a href#concept-document-window idthe-img-element:concept-document-window>associated code>Document/code>/a>.li>p>Let var>img/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-create-element idthe-img-element:create-an-element data-x-internalcreate-an-element>creating an element/a> given var>document/var>, code idthe-img-element:the-img-element-19>a href#the-img-element>img/a>/code>, and the a idthe-img-element:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>.li>p>If var>width/var> is given, then a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-set-value idthe-img-element:concept-element-attributes-set-value data-x-internalconcept-element-attributes-set-value>set an attribute value/a> for var>img/var> using code idthe-img-element:attr-dim-width-3>a href#attr-dim-width>width/a>/code> and var>width/var>.li>p>If var>height/var> is given, then a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-set-value idthe-img-element:concept-element-attributes-set-value-2 data-x-internalconcept-element-attributes-set-value>set an attribute value/a> for var>img/var> using code idthe-img-element:attr-dim-height-3>a href#attr-dim-height>height/a>/code> and var>height/var>.li>p>Return var>img/var>./ol> div classexample> p>A single image can have different appropriate alternative text depending on the context./p> p>In each of the following cases, the same image is used, yet the code idthe-img-element:attr-img-alt-16>a href#attr-img-alt>alt/a>/code> text is different each time. The image is the coat of arms of the Carouge municipality in the canton Geneva in Switzerland./p> p>Here it is used as a supplementary icon:/p> pre><p>I lived in <img srccarouge.svg alt> Carouge.</p>/pre> p>Here it is used as an icon representing the town:/p> pre><p>Home town: <img srccarouge.svg altCarouge></p>/pre> p>Here it is used as part of a text on the town:/p> pre><p>Carouge has a coat of arms.</p><p><img srccarouge.svg altThe coat of arms depicts a lion, sitting in front of a tree.></p><p>It is used as decoration all over the town.</p>/pre> p>Here it is used as a way to support a similar text where the description is given as well as, instead of as an alternative to, the image:/p> pre><p>Carouge has a coat of arms.</p><p><img srccarouge.svg alt></p><p>The coat of arms depicts a lion, sitting in front of a tree.It is used as decoration all over the town.</p>/pre> p>Here it is used as part of a story:/p> pre><p>She picked up the folder and a piece of paper fell out.</p><p><img srccarouge.svg altShaped like a shield, the paper had ared background, a green tree, and a yellow lion with its tonguehanging out and whose tail was shaped like an S.></p><p>She stared at the folder. S! The answer she had been looking for allthis time was simply the letter S! How had she not seen that before? It allcame together now. The phone call where Hector had referred to a lions tail,the time Maria had stuck her tongue out...</p>/pre> p>Here it is not known at the time of publication what the image will be, only that it will be a coat of arms of some kind, and thus no replacement text can be provided, and instead only a brief caption for the image is provided, in the code idthe-img-element:attr-title-3>a href#attr-title>title/a>/code> attribute:/p> pre><p>The last user to have uploaded a coat of arms uploaded this one:</p><p><img srclast-uploaded-coat-of-arms.cgi titleUser-uploaded coat of arms.></p>/pre> p>Ideally, the author would find a way to provide real replacement text even in this case, e.g. by asking the previous user. Not providing replacement text makes the document more difficult to use for people who are unable to view images, e.g. blind users, or users or very low-bandwidth connections or who pay by the byte, or users who are forced to use a text-only Web browser./p> /div> div classexample> p>Here are some more examples showing the same picture used in different contexts, with different appropriate alternate texts each time./p> pre><article> <h1>My cats</h1> <h2>Fluffy</h2> <p>Fluffy is my favorite.</p> <img srcfluffy.jpg altShe likes playing with a ball of yarn.> <p>Shes just too cute.</p> <h2>Miles</h2> <p>My other cat, Miles just eats and sleeps.</p></article>/pre> pre><article> <h1>Photography</h1> <h2>Shooting moving targets indoors</h2> <p>The trick here is to know how to anticipate; to know at what speed and what distance the subject will pass by.</p> <img srcfluffy.jpg altA cat flying by, chasing a ball of yarn, can be photographed quite nicely using this technique.> <h2>Nature by night</h2> <p>To achieve this, youll need either an extremely sensitive film, or immense flash lights.</p></article>/pre> pre><article> <h1>About me</h1> <h2>My pets</h2> <p>Ive got a cat named Fluffy and a dog named Miles.</p> <img srcfluffy.jpg altFluffy, my cat, tends to keep itself busy.> <p>My dog Miles and I like go on long walks together.</p> <h2>music</h2> <p>After our walks, having emptied my mind, I like listening to Bach.</p></article>/pre> pre><article> <h1>Fluffy and the Yarn</h1> <p>Fluffy was a cat who liked to play with yarn. She also liked to jump.</p> <aside><img srcfluffy.jpg alt titleFluffy></aside> <p>She would play in the morning, she would play in the evening.</p></article>/pre> /div> h4 idimages>span classsecno>4.8.4/span> Imagesa href#images classself-link>/a>/h4> h5 idintroduction-3>span classsecno>4.8.4.1/span> Introductiona href#introduction-3 classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>To embed an image in HTML, when there is only a single image resource, use the code idintroduction-3:the-img-element>a href#the-img-element>img/a>/code> element and its code idintroduction-3:attr-img-src>a href#attr-img-src>src/a>/code> attribute./p> div classexample>pre><h2>From todays featured article</h2>strong><img src/uploads/100-marie-lloyd.jpg alt width100 height150>/strong><p><b><a href/wiki/Marie_Lloyd>Marie Lloyd</a></b> (1870–1922)was an English <a href/wiki/Music_hall>music hall</a> singer, .../pre> /div> p>However, there are a number of situations for which the author might wish to use multiple image resources that the user agent can choose from:/p> ul>li> p>Different users might have different environmental characteristics:/p> ul>li> p>The users physical screen size might be different from one another./p> div classexample> p>A mobile phones screen might be 4 inches diagonally, while a laptops screen might be 14 inches diagonally./p> svg font-size2.5 roleimg viewBox0 0 80 32 font-familysans-serif height200 aria-labelThe phones screen is much smaller compared to the laptops screen.> rect width6 fillwhite strokeblack x6 height12 y18 rx1>/rect> text transformtranslate(9 24) rotate(-60) text-anchormiddle dominant-baselinemiddle>4″/text> rect width40 stroke-width2 fillwhite strokeblack x30 height26 y2 rx2>/rect> line y230 stroke-linecapround stroke-width2 strokeblack x126 y130 x274>/line> text transformtranslate(50 15) rotate(-30) text-anchormiddle dominant-baselinemiddle>14″/text> /svg> /div> p classnote>This is only relevant when an images rendered size depends on the a idintroduction-3:viewport hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> size./p> li> p>The users screen pixel density might be different from one another./p> div classexample> p>A mobile phones screen might have three times as many physical pixels per inch compared to another mobile phones screen, regardless of their physical screen size./p> svg font-size2.5 roleimg viewBox0 0 56 27 font-familysans-serif height170 aria-labelOne phone has big pixels, the other has small pixels.> defs> pattern idimg-intro-pixel width3 patternUnitsuserSpaceOnUse stroke-linecapround x0 y0 height3> rect fillblack width3 x0 height3 y0>/rect> line y22.5 strokered x10.5 x20.5 y10.5>/line> line y22.5 strokelime x11.5 x21.5 y10.5>/line> line y22.5 strokeblue x12.5 x22.5 y10.5>/line> /pattern> /defs> rect width6 fillwhite strokeblack x6 height12 y8 rx1>/rect> rect width6 fillwhite strokeblack x36 height12 y8 rx1>/rect> line y224 stroke-width3 strokebrown x115 y116 x222>/line> circle cx10 cy10 fillurl(#img-intro-pixel) strokeblack r8>/circle> line y224 stroke-width3 strokebrown x145 y116 x252>/line> circle cx120 transformscale(0.333333) cy30 r24 stroke-width3 fillurl(#img-intro-pixel) strokeblack>/circle> text x20 y10 dominant-baselinemiddle>1x/text> text x50 y10 dominant-baselinemiddle>3x/text> /svg> /div> li> p>The users zoom level might be different from one another, or might change for a single user over time./p> p classexample>A user might zoom in to a particular image to be able to get a more detailed look./p> p>The zoom level and the screen pixel density (the previous point) can both affect the number of physical screen pixels per a hrefhttps://drafts.csswg.org/css-values/#px idintroduction-3:px data-x-internalpx>CSS pixel/a>. This ratio is usually referred to as dfn iddevice-pixel-ratio>device-pixel-ratio/dfn>./p> li> p>The users screen orientation might be different from one another, or might change for a single user over time./p> div classexample> p>A tablet can be held upright or rotated 90 degrees, so that the screen is either portrait or landscape./p> svg font-size2.5 roleimg viewBox0 0 60 32 font-familysans-serif height200 aria-labelThe tablet has two orientations.> rect width14 fillwhite strokeblack x6 height20 y5 rx1>/rect> line y224 stroke-width1.1 strokeblack x16 y124 x220>/line> text text-anchormiddle x13 y14.5 dominant-baselinemiddle>Portrait/text> rect width20 fillwhite strokeblack x30 height14 y11 rx1>/rect> line y211 stroke-width1.1 strokeblack x131 y125 x231>/line> text text-anchormiddle x40.5 y18 dominant-baselinemiddle>Landscape/text> /svg> /div> li> p>The users network speed, network latency and bandwidth cost might be different from one another, or might change for a single user over time./p> p classexample>A user might be on a fast, low-latency and constant-cost connection while at work, on a slow, low-latency and constant-cost connection while at home, and on a variable-speed, high-latency and variable-cost connection anywhere else./p> /ul> li> p>Authors might want to show the same image content but with different rendered size depending on, usually, the width of the a idintroduction-3:viewport-2 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>. This is usually referred to as dfn idviewport-based-selection>viewport-based selection/dfn>./p> div classexample> p>A Web page might have a banner at the top that always spans the entire a idintroduction-3:viewport-3 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> width. In this case, the rendered size of the image depends on the physical size of the screen (assuming a maximised browser window)./p> svg viewBox0 0 52 25.6 height160 aria-labelThe upright-held phone shows a small wolf at the top, and the tablet shows the same image but it is bigger. roleimg> rect width6 fillwhite strokeblack x6 height12 y8 rx1>/rect> rect fill#716966 x7 width4 height2 y9>/rect> image xlink:hrefimages/wolf.jpg width4 x7 y9 height2>/image> rect width20 fillwhite strokeblack x25 height14 y6 rx1>/rect> line y26 stroke-width1.1 strokeblack x126 y120 x226>/line> rect fill#716966 x27 width17 height8.5 y7>/rect> image xlink:hrefimages/wolf.jpg width17 x27 y7 height8.5>/image> /svg> /div> div classexample> p>Another Web page might have images in columns, with a single column for screens with a small physical size, two columns for screens with medium physical size, and three columns for screens with big physical size, with the images varying in rendered size in each case to fill up the a idintroduction-3:viewport-4 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>. In this case, the rendered size of an image might be em>bigger/em> in the one-column layout compared to the two-column layout, despite the screen being smaller./p> svg font-size2.5 roleimg viewBox0 0 115 32 font-familysans-serif height200 aria-labelThe rotated phone shows a top part of an image of a kettlebell swing; the upright-held tablet shows a bit smaller images in two columns; the laptop shows images in three columns.> rect width12 fillwhite strokeblack x6 height6 y24 rx1>/rect> rect fill#987b5a width10 x7 height4.5 y25>/rect> image xlink:hrefimages/kettlebell.jpg preserveAspectRatioxMinYMin slice width10 x7 y25 height4.5>/image> text text-anchormiddle x12 y21>Narrow, 1 column/text> rect width14 fillwhite strokeblack x32 height20 y10 rx1>/rect> line y229 stroke-width1.1 strokeblack x132 y129 x246>/line> rect fill#987b5a width5.5 x33 height5.5 y11>/rect> image xlink:hrefimages/kettlebell.jpg width5.5 x33 y11 height5.5>/image> rect fillburlywood width5.5 x39.5 height5.5 y11>/rect> rect fillsilver width5.5 x33 height5.5 y17.5>/rect> text text-anchormiddle x39 y7>Medium, 2 columns/text> rect width40 stroke-width2 fillwhite strokeblack x65 height26 y2 rx2>/rect> line y230 stroke-linecapround stroke-width2 strokeblack x161 y130 x2109>/line> rect fill#987b5a width10 x67 height10 y4>/rect> image xlink:hrefimages/kettlebell.jpg width10 x67 y4 height10>/image> rect fillburlywood width10 x80 height10 y4>/rect> rect fillsilver width10 x93 height10 y4>/rect> text text-anchormiddle x85 y25>Wide, 3 columns/text> /svg> /div> li> p>Authors might want to show different image content depending on the rendered size of the image. This is usually referred to as dfn idart-direction>art direction/dfn>./p> div classexample> p>When a Web page is viewed on a screen with a large physical size (assuming a maximised browser window), the author might wish to include some less relevant parts surrounding the critical part of the image. When the same Web page is viewed on a screen with a small physical size, the author might wish to show only the critical part of the image./p> svg viewBox0 0 52 25.6 height160 aria-labelThe upright-held phone shows a cropped image of a wolf; the rotated tablet shows the uncropped image. roleimg> rect width6 fillwhite strokeblack x6 height12 y8 rx1>/rect> rect fill#716966 x7 width4 height6 y9>/rect> image xlink:hrefimages/wolf.jpg preserveAspectRatioxMidYMid slice width4 x7 y9 height6>/image> rect width20 fillwhite strokeblack x25 height14 y6 rx1>/rect> line y26 stroke-width1.1 strokeblack x126 y120 x226>/line> rect fill#716966 x27 width17 height8.5 y7>/rect> image xlink:hrefimages/wolf.jpg width17 x27 y7 height8.5>/image> /svg> /div> li> p>Authors might want to show the same image content but using different image formats, depending on which image formats the user agent supports. This is usually referred to as dfn idimage-format-based-selection>image format-based selection/dfn>./p> p classexample>A Web page might have some images in the JPEG, WebP and JPEG XR image formats, with the latter two having better compression abilities compared to JPEG. Since different user agents can support different image formats, with some formats offering better compression ratios, the author would like to serve the better formats to user agents that support them, while providing JPEG fallback for user agents that dont./p> /ul> p>The above situations are not mutually exclusive. For example, it is reasonable to combine different resources for different a href#device-pixel-ratio idintroduction-3:device-pixel-ratio>device-pixel-ratio/a> with different resources for a href#art-direction idintroduction-3:art-direction>art direction/a>./p> p>While it is possible to solve these problems using scripting, doing so introduces some other problems:/p> ul>li>p>Some user agents aggressively download images specified in the HTML markup, before scripts have had a chance to run, so that Web pages complete loading sooner. If a script changes which image to download, the user agent will potentially start two separate downloads, which can instead cause worse page loading performance.li>p>If the author avoids specifying any image in the HTML markup and instead instantiates a single download from script, that avoids the double download problem above but then no image will be downloaded at all for users with scripting disabled and the aggressive image downloading optimization will also be disabled./ul> p>With this in mind, this specification introduces a number of features to address the above problems in a declarative manner./p> dl>dt>a href#device-pixel-ratio idintroduction-3:device-pixel-ratio-2>Device-pixel-ratio/a>-based selection when the rendered size of the image is fixeddd> p>The code idintroduction-3:attr-img-src-2>a href#attr-img-src>src/a>/code> and code idintroduction-3:attr-img-srcset>a href#attr-img-srcset>srcset/a>/code> attributes on the code idintroduction-3:the-img-element-2>a href#the-img-element>img/a>/code> element can be used, using the code>x/code> descriptor, to provide multiple images that only vary in their size (the smaller image is a scaled-down version of the bigger image)./p> p classnote>The code>x/code> descriptor is not appropriate when the rendered size of the image depends on the a idintroduction-3:viewport-5 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> width (a href#viewport-based-selection idintroduction-3:viewport-based-selection>viewport-based selection/a>), but can be used together with a href#art-direction idintroduction-3:art-direction-2>art direction/a>./p> div classexample>pre><h2>From todays featured article</h2><img strong>src/uploads/100-marie-lloyd.jpg/strong> strong>srcset/uploads/150-marie-lloyd.jpg 1.5x, /uploads/200-marie-lloyd.jpg 2x/strong> alt width100 height150><p><b><a href/wiki/Marie_Lloyd>Marie Lloyd</a></b> (1870–1922)was an English <a href/wiki/Music_hall>music hall</a> singer, .../pre> p>The user agent can choose any of the given resources depending on the users screens pixel density, zoom level, and possibly other factors such as the users network conditions./p> p>For backwards compatibility with older user agents that dont yet understand the code idintroduction-3:attr-img-srcset-2>a href#attr-img-srcset>srcset/a>/code> attribute, one of the URLs is specified in the code idintroduction-3:the-img-element-3>a href#the-img-element>img/a>/code> elements code idintroduction-3:attr-img-src-3>a href#attr-img-src>src/a>/code> attribute. This will result in something useful (though perhaps lower-resolution than the user would like) being displayed even in older user agents. For new user agents, the code idintroduction-3:attr-img-src-4>a href#attr-img-src>src/a>/code> attribute participates in the resource selection, as if it was specified in code idintroduction-3:attr-img-srcset-3>a href#attr-img-srcset>srcset/a>/code> with a code>1x/code> descriptor./p> p>The images rendered size is given in the code idintroduction-3:attr-dim-width>a href#attr-dim-width>width/a>/code> and code idintroduction-3:attr-dim-height>a href#attr-dim-height>height/a>/code> attributes, which allows the user agent to allocate space for the image before it is downloaded./p> /div> dt>a href#viewport-based-selection idintroduction-3:viewport-based-selection-2>Viewport-based selection/a>dd> p>The code idintroduction-3:attr-img-srcset-4>a href#attr-img-srcset>srcset/a>/code> and code idintroduction-3:attr-img-sizes>a href#attr-img-sizes>sizes/a>/code> attributes can be used, using the code>w/code> descriptor, to provide multiple images that only vary in their size (the smaller image is a scaled-down version of the bigger image)./p> div classexample> p>In this example, a banner image takes up the entire a idintroduction-3:viewport-6 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> width (using appropriate CSS)./p>pre><h1><img strong>sizes100vw srcsetwolf-400.jpg 400w, wolf-800.jpg 800w, wolf-1600.jpg 1600w/strong> srcwolf-400.jpg altThe rad wolf></h1>/pre> p>The user agent will calculate the effective pixel density of each image from the specified code>w/code> descriptors and the specified rendered size in the code idintroduction-3:attr-img-sizes-2>a href#attr-img-sizes>sizes/a>/code> attribute. It can then choose any of the given resources depending on the users screens pixel density, zoom level, and possibly other factors such as the users network conditions./p> p>If the users screen is 320 a hrefhttps://drafts.csswg.org/css-values/#px idintroduction-3:px-2 data-x-internalpx>CSS pixels/a> wide, this is equivalent to specifying code>wolf-400.jpg 1.25x, wolf-800.jpg 2.5x, wolf-1600.jpg 5x/code>. On the other hand, if the users screen is 1200 a hrefhttps://drafts.csswg.org/css-values/#px idintroduction-3:px-3 data-x-internalpx>CSS pixels/a> wide, this is equivalent to specifying code>wolf-400.jpg 0.33x, wolf-800.jpg 0.67x, wolf-1600.jpg 1.33x/code>. By using the code>w/code> descriptors and the code idintroduction-3:attr-img-sizes-3>a href#attr-img-sizes>sizes/a>/code> attribute, the user agent can choose the correct image source to download regardless of how large the users device is./p> p>For backwards compatibility, one of the URLs is specified in the code idintroduction-3:the-img-element-4>a href#the-img-element>img/a>/code> elements code idintroduction-3:attr-img-src-5>a href#attr-img-src>src/a>/code> attribute. In new user agents, the code idintroduction-3:attr-img-src-6>a href#attr-img-src>src/a>/code> attribute is ignored when the code idintroduction-3:attr-img-srcset-5>a href#attr-img-srcset>srcset/a>/code> attribute uses code>w/code> descriptors./p> /div> div classexample> p>In this example, the Web page has three layouts depending on the width of the a idintroduction-3:viewport-7 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>. The narrow layout has one column of images (the width of each image is about 100%), the middle layout has two columns of images (the width of each image is about 50%), and the widest layout has three columns of images, and some page margin (the width of each image is about 33%). It breaks between these layouts when the a idintroduction-3:viewport-8 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> is code>30em/code> wide and code>50em/code> wide, respectively./p>pre><img strong>sizes(max-width: 30em) 100vw, (max-width: 50em) 50vw, calc(33vw - 100px)/strong> strong>srcsetswing-200.jpg 200w, swing-400.jpg 400w, swing-800.jpg 800w, swing-1600.jpg 1600w/strong> srcswing-400.jpg altKettlebell Swing>/pre> p>The code idintroduction-3:attr-img-sizes-4>a href#attr-img-sizes>sizes/a>/code> attribute sets up the layout breakpoints at code>30em/code> and code>50em/code>, and declares the image sizes between these breakpoints to be code>100vw/code>, code>50vw/code>, or code>calc(33vw - 100px)/code>. These sizes do not necessarily have to match up exactly with the actual image width as specified in the CSS./p> p>The user agent will pick a width from the code idintroduction-3:attr-img-sizes-5>a href#attr-img-sizes>sizes/a>/code> attribute, using the first item with a a idintroduction-3:media-condition hrefhttps://drafts.csswg.org/mediaqueries/#typedef-media-condition data-x-internalmedia-condition><media-condition>/a> (the part in parentheses) that evaluates to true, or using the last item (code>calc(33vw - 100px)/code>) if they all evaluate to false./p> p>For example, if the a idintroduction-3:viewport-9 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> width is code>29em/code>, then code>(max-width: 30em)/code> evaluates to true and code>100vw/code> is used, so the image size, for the purpose of resource selection, is code>29em/code>. If the a idintroduction-3:viewport-10 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> width is instead code>32em/code>, then code>(max-width: 30em)/code> evaluates to false, but code>(max-width: 50em)/code> evaluates to true and code>50vw/code> is used, so the image size, for the purpose of resource selection, is code>16em/code> (half the a idintroduction-3:viewport-11 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> width). Notice that the slightly wider a idintroduction-3:viewport-12 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> results in a smaller image because of the different layout./p> p>The user agent can then calculate the effective pixel density and choose an appropriate resource similarly to the previous example./p> /div> dt>a href#art-direction idintroduction-3:art-direction-3>Art direction/a>-based selectiondd> p>The code idintroduction-3:the-picture-element>a href#the-picture-element>picture/a>/code> element and the code idintroduction-3:the-source-element>a href#the-source-element>source/a>/code> element, together with the code idintroduction-3:attr-source-media>a href#attr-source-media>media/a>/code> attribute, can be used, to provide multiple images that vary the image content (for instance the smaller image might be a cropped version of the bigger image)./p> div classexample>pre><picture> <source strong>media(min-width: 45em)/strong> srcsetlarge.jpg> <source strong>media(min-width: 32em)/strong> srcsetmed.jpg> <img srcsmall.jpg altThe wolf runs through the snow.></picture>/pre> p>The user agent will choose the first code idintroduction-3:the-source-element-2>a href#the-source-element>source/a>/code> element for which the media query in the code idintroduction-3:attr-source-media-2>a href#attr-source-media>media/a>/code> attribute matches, and then choose an appropriate URL from its code idintroduction-3:attr-source-srcset>a href#attr-source-srcset>srcset/a>/code> attribute./p> p>The rendered size of the image varies depending on which resource is chosen. To specify dimensions that the user agent can use before having downloaded the image, CSS can be used./p>pre classcss>img { width: 300px; height: 300px }@media (min-width: 32em) { img { width: 500px; height:300px } }@media (min-width: 45em) { img { width: 700px; height:400px } }/pre> /div> div classexample> p>This example combines a href#art-direction idintroduction-3:art-direction-4>art direction/a>- and a href#device-pixel-ratio idintroduction-3:device-pixel-ratio-3>device-pixel-ratio/a>-based selection. A banner that takes half the a idintroduction-3:viewport-13 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> is provided in two versions, one for wide screens and one for narrow screens./p>pre><h1> <picture> <source media(max-width: 500px) srcsetbanner-phone.jpeg, banner-phone-HD.jpeg 2x> <img srcbanner.jpeg srcsetbanner-HD.jpeg 2x altThe Breakfast Combo> </picture></h1>/pre> /div> dt>a href#image-format-based-selection idintroduction-3:image-format-based-selection>Image format-based selection/a>dd> p>The code idintroduction-3:attr-source-type>a href#attr-source-type>type/a>/code> attribute on the code idintroduction-3:the-source-element-3>a href#the-source-element>source/a>/code> element can be used, to provide multiple images in different formats./p> div classexample>pre><h2>From todays featured article</h2><picture> <source srcset/uploads/100-marie-lloyd.webp strong>typeimage/webp/strong>> <source srcset/uploads/100-marie-lloyd.jxr strong>typeimage/vnd.ms-photo/strong>> <img src/uploads/100-marie-lloyd.jpg alt width100 height150></picture><p><b><a href/wiki/Marie_Lloyd>Marie Lloyd</a></b> (1870–1922)was an English <a href/wiki/Music_hall>music hall</a> singer, .../pre> p>In this example, the user agent will choose the first source that has a code idintroduction-3:attr-source-type-2>a href#attr-source-type>type/a>/code> attribute with a supported MIME type. If the user agent supports WebP images, the first code idintroduction-3:the-source-element-4>a href#the-source-element>source/a>/code> element will be chosen. If not, but the user agent does support JPEG XR images, the second code idintroduction-3:the-source-element-5>a href#the-source-element>source/a>/code> element will be chosen. If neither of those formats are supported, the code idintroduction-3:the-img-element-5>a href#the-img-element>img/a>/code> element will be chosen./p> /div> /dl> h6 idadaptive-images>span classsecno>4.8.4.1.1/span> Adaptive imagesa href#adaptive-images classself-link>/a>/h6> p>i>This section is non-normative./i>/p> p>CSS and media queries can be used to construct graphical page layouts that adapt dynamically to the users environment, in particular to different a idadaptive-images:viewport hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> dimensions and pixel densities. For content, however, CSS does not help; instead, we have the code idadaptive-images:the-img-element>a href#the-img-element>img/a>/code> elements code idadaptive-images:attr-img-srcset>a href#attr-img-srcset>srcset/a>/code> attribute and the code idadaptive-images:the-picture-element>a href#the-picture-element>picture/a>/code> element. This section walks through a sample case showing how to use these features./p> p>Consider a situation where on wide screens (wider than 600 a hrefhttps://drafts.csswg.org/css-values/#px idadaptive-images:px data-x-internalpx>CSS pixels/a>) a 300×150 image named code>a-rectangle.png/code> is to be used, but on smaller screens (600 a hrefhttps://drafts.csswg.org/css-values/#px idadaptive-images:px-2 data-x-internalpx>CSS pixels/a> and less), a smaller 100×100 image called code>a-square.png/code> is to be used. The markup for this would look like this:/p> pre><figure> <picture> <source srcseta-square.png media(max-width: 600px)> <img srca-rectangle.png altBarney Frank wears a suit and glasses.> </picture> <figcaption>Barney Frank, 2011</figcaption></figure>/pre> p classnote>For details on what to put in the code idadaptive-images:attr-img-alt>a href#attr-img-alt>alt/a>/code> attribute, see the a href#alt>Requirements for providing text to act as an alternative for images/a> section./p> p>The problem with this is that the user agent does not necessarily know what dimensions to use for the image when the image is loading. To avoid the layout having to be reflowed multiple times as the page is loading, CSS and CSS media queries can be used to provide the dimensions:/p> pre><style> #a { width: 300px; height: 150px; } @media (max-width: 600px) { #a { width: 100px; height: 100px; } }</style><figure> <picture> <source srcseta-square.png media(max-width: 600px)> <img srca-rectangle.png altBarney Frank wears a suit and glasses. ida> </picture> <figcaption>Barney Frank, 2011</figcaption></figure>/pre> p>Alternatively, the code idadaptive-images:attr-dim-width>a href#attr-dim-width>width/a>/code> and code idadaptive-images:attr-dim-height>a href#attr-dim-height>height/a>/code> attributes can be used to provide the width for legacy user agents, using CSS just for the user agents that support code idadaptive-images:the-picture-element-2>a href#the-picture-element>picture/a>/code>:/p> pre><style media(max-width: 600px)> #a { width: 100px; height: 100px; }</style><figure> <picture> <source srcseta-square.png media(max-width: 600px)> <img srca-rectangle.png width300 height150 altBarney Frank wears a suit and glasses. ida> </picture> <figcaption>Barney Frank, 2011</figcaption></figure>/pre> hr> p>The code idadaptive-images:the-img-element-2>a href#the-img-element>img/a>/code> element is used with the code idadaptive-images:attr-img-src>a href#attr-img-src>src/a>/code> attribute, which gives the URL of the image to use for legacy user agents that do not support the code idadaptive-images:the-picture-element-3>a href#the-picture-element>picture/a>/code> element. This leads to a question of which image to provide in the code idadaptive-images:attr-img-src-2>a href#attr-img-src>src/a>/code> attribute./p> p>If the author wants the biggest image in legacy user agents, the markup could be as follows:/p> pre><picture> <source srcsetpear-mobile.jpeg media(max-width: 720px)> <source srcsetpear-tablet.jpeg media(max-width: 1280px)> <img srcpear-desktop.jpeg altThe pear is juicy.></picture>/pre> p>However, if legacy mobile user agents are more important, one can list all three images in the code idadaptive-images:the-source-element>a href#the-source-element>source/a>/code> elements, overriding the code idadaptive-images:attr-img-src-3>a href#attr-img-src>src/a>/code> attribute entirely./p> pre><picture> <source srcsetpear-mobile.jpeg media(max-width: 720px)> <source srcsetpear-tablet.jpeg media(max-width: 1280px)> <source srcsetpear-desktop.jpeg> <img srcpear-mobile.jpeg altThe pear is juicy.></picture>/pre> p>Since at this point the code idadaptive-images:attr-img-src-4>a href#attr-img-src>src/a>/code> attribute is actually being ignored entirely by code idadaptive-images:the-picture-element-4>a href#the-picture-element>picture/a>/code>-supporting user agents, the code idadaptive-images:attr-img-src-5>a href#attr-img-src>src/a>/code> attribute can default to any image, including one that is neither the smallest nor biggest:/p> pre><picture> <source srcsetpear-mobile.jpeg media(max-width: 720px)> <source srcsetpear-tablet.jpeg media(max-width: 1280px)> <source srcsetpear-desktop.jpeg> <img srcpear-tablet.jpeg altThe pear is juicy.></picture>/pre> hr> p>Above the code>max-width/code> media feature is used, giving the maximum (a idadaptive-images:viewport-2 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>) dimensions that an image is intended for. It is also possible to use code>min-width/code> instead./p> pre><picture> <source srcsetpear-desktop.jpeg media(min-width: 1281px)> <source srcsetpear-tablet.jpeg media(min-width: 721px)> <img srcpear-mobile.jpeg altThe pear is juicy.></picture>/pre> h5 idattributes-common-to-source-and-img-elements>span classsecno>4.8.4.2/span> Attributes common to code idattributes-common-to-source-and-img-elements:the-source-element>a href#the-source-element>source/a>/code> and code idattributes-common-to-source-and-img-elements:the-img-element>a href#the-img-element>img/a>/code> elementsa href#attributes-common-to-source-and-img-elements classself-link>/a>/h5> h6 idsrcset-attributes>span classsecno>4.8.4.2.1/span> Srcset attributesa href#srcset-attributes classself-link>/a>/h6> p>A dfn idsrcset-attribute>srcset attribute/dfn> is an attribute with requirements defined in this section./p> p>If present, its value must consist of one or more a href#image-candidate-string idsrcset-attributes:image-candidate-string>image candidate strings/a>, each separated from the next by a U+002C COMMA character (,). If an a href#image-candidate-string idsrcset-attributes:image-candidate-string-2>image candidate string/a> contains no descriptors and no a idsrcset-attributes:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> after the URL, the following a href#image-candidate-string idsrcset-attributes:image-candidate-string-3>image candidate string/a>, if there is one, must begin with one or more a idsrcset-attributes:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>./p> p>An dfn idimage-candidate-string>image candidate string/dfn> consists of the following components, in order, with the further restrictions described below this list:/p> ol>li>p>Zero or more a idsrcset-attributes:space-characters-3 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>.li>p>A a href#valid-non-empty-url idsrcset-attributes:valid-non-empty-url>valid non-empty URL/a> that does not start or end with a U+002C COMMA character (,), referencing a non-interactive, optionally animated, image resource that is neither paged nor scripted.li>p>Zero or more a idsrcset-attributes:space-characters-4 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>.li> p>Zero or one of the following:/p> ul>li>p>A dfn idwidth-descriptor>width descriptor/dfn>, consisting of: a idsrcset-attributes:space-characters-5 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, a a href#valid-non-negative-integer idsrcset-attributes:valid-non-negative-integer>valid non-negative integer/a> giving a number greater than zero representing the dfn idwidth-descriptor-value>width descriptor value/dfn>, and a U+0077 LATIN SMALL LETTER W character.li>p>A dfn idpixel-density-descriptor>pixel density descriptor/dfn>, consisting of: a idsrcset-attributes:space-characters-6 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, a a href#valid-floating-point-number idsrcset-attributes:valid-floating-point-number>valid floating-point number/a> giving a number greater than zero representing the dfn idpixel-density-descriptor-value>pixel density descriptor value/dfn>, and a U+0078 LATIN SMALL LETTER X character./ul> li>p>Zero or more a idsrcset-attributes:space-characters-7 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>./ol> p>There must not be an a href#image-candidate-string idsrcset-attributes:image-candidate-string-4>image candidate string/a> for an element that has the same a href#width-descriptor-value idsrcset-attributes:width-descriptor-value>width descriptor value/a> as another a href#image-candidate-string idsrcset-attributes:image-candidate-string-5>image candidate string/a>s a href#width-descriptor-value idsrcset-attributes:width-descriptor-value-2>width descriptor value/a> for the same element./p> p>There must not be an a href#image-candidate-string idsrcset-attributes:image-candidate-string-6>image candidate string/a> for an element that has the same a href#pixel-density-descriptor-value idsrcset-attributes:pixel-density-descriptor-value>pixel density descriptor value/a> as another a href#image-candidate-string idsrcset-attributes:image-candidate-string-7>image candidate string/a>s a href#pixel-density-descriptor-value idsrcset-attributes:pixel-density-descriptor-value-2>pixel density descriptor value/a> for the same element. For the purpose of this requirement, an a href#image-candidate-string idsrcset-attributes:image-candidate-string-8>image candidate string/a> with no descriptors is equivalent to an a href#image-candidate-string idsrcset-attributes:image-candidate-string-9>image candidate string/a> with a code>1x/code> descriptor./p> p>If an a href#image-candidate-string idsrcset-attributes:image-candidate-string-10>image candidate string/a> for an element has the a href#width-descriptor idsrcset-attributes:width-descriptor>width descriptor/a> specified, all other a href#image-candidate-string idsrcset-attributes:image-candidate-string-11>image candidate strings/a> for that element must also have the a href#width-descriptor idsrcset-attributes:width-descriptor-2>width descriptor/a> specified./p> p>The specified width in an a href#image-candidate-string idsrcset-attributes:image-candidate-string-12>image candidate string/a>s a href#width-descriptor idsrcset-attributes:width-descriptor-3>width descriptor/a> must match the a href#intrinsic-width idsrcset-attributes:intrinsic-width>intrinsic width/a> in the resource given by the a href#image-candidate-string idsrcset-attributes:image-candidate-string-13>image candidate string/a>s URL, if it has an a href#intrinsic-width idsrcset-attributes:intrinsic-width-2>intrinsic width/a>./p> p>If an element has a a href#srcset-attribute idsrcset-attributes:srcset-attribute>srcset attribute/a> present, all a href#image-candidate-string idsrcset-attributes:image-candidate-string-14>image candidate strings/a> for that element must have the a href#width-descriptor idsrcset-attributes:width-descriptor-4>width descriptor/a> specified./p> h6 idsizes-attributes>span classsecno>4.8.4.2.2/span> Sizes attributesa href#sizes-attributes classself-link>/a>/h6> p>A dfn idsizes-attribute>sizes attribute/dfn> is an attribute with requirements defined in this section./p> p>If present, the value must be a a href#valid-source-size-list idsizes-attributes:valid-source-size-list>valid source size list/a>./p> p>A dfn idvalid-source-size-list>valid source size list/dfn> is a string that matches the following grammar: a href#refsCSSVALUES>CSSVALUES/a> a href#refsMQ>MQ/a>/p>pre>dfn idsource-size-list><source-size-list>/dfn> a href#source-size idsizes-attributes:source-size><source-size>/a># , ? a href#source-size-value idsizes-attributes:source-size-value><source-size-value>/a>dfn idsource-size><source-size>/dfn> a idsizes-attributes:media-condition hrefhttps://drafts.csswg.org/mediaqueries/#typedef-media-condition data-x-internalmedia-condition><media-condition>/a> a href#source-size-value idsizes-attributes:source-size-value-2><source-size-value>/a>dfn idsource-size-value><source-size-value>/dfn> a idsizes-attributes:length hrefhttps://drafts.csswg.org/css-values/#lengths data-x-internallength><length>/a>/pre> p>A a href#source-size-value idsizes-attributes:source-size-value-3><source-size-value>/a> must not be negative, and must not use CSS functions other than the a idsizes-attributes:calc() hrefhttps://drafts.csswg.org/css-values/#funcdef-calc data-x-internalcalc()>calc()/a> function./p> p>The a href#source-size-value idsizes-attributes:source-size-value-4><source-size-value>/a> gives the intended layout width of the image. The author can specify different widths for different environments with a idsizes-attributes:media-condition-2 hrefhttps://drafts.csswg.org/mediaqueries/#typedef-media-condition data-x-internalmedia-condition><media-condition>/a>s./p> p classnote>Percentages are not allowed in a a href#source-size-value idsizes-attributes:source-size-value-5><source-size-value>/a>, to avoid confusion about what it would be relative to. The a idsizes-attributes:vw hrefhttps://drafts.csswg.org/css-values/#vw data-x-internalvw>vw/a> unit can be used for sizes relative to the a idsizes-attributes:viewport hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> width./p> h5 idimages-processing-model>span classsecno>4.8.4.3/span> Processing modela href#images-processing-model classself-link>/a>/h5> p>The a href#task-source idimages-processing-model:task-source>task source/a> for the a href#concept-task idimages-processing-model:concept-task>tasks/a> a href#queue-a-task idimages-processing-model:queue-a-task>queued/a> by algorithms in this section is the a href#dom-manipulation-task-source idimages-processing-model:dom-manipulation-task-source>DOM manipulation task source/a>./p> hr> p>An code idimages-processing-model:the-img-element>a href#the-img-element>img/a>/code> element has a dfn idcurrent-request>current request/dfn> and a dfn idpending-request>pending request/dfn>. The a href#current-request idimages-processing-model:current-request>current request/a> is initially set to a new a href#image-request idimages-processing-model:image-request>image request/a>. The a href#pending-request idimages-processing-model:pending-request>pending request/a> is initially set to null. The a href#current-request idimages-processing-model:current-request-2>current request/a> is usually referred to as the code idimages-processing-model:the-img-element-2>a href#the-img-element>img/a>/code> element itself.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id27484 titleimg> How should .complete interact with pending requests?>27484/a>/div> p>An dfn idimage-request>image request/dfn> has a dfn idimg-req-state>state/dfn>, dfn idimg-req-url>current URL/dfn>, and dfn idimg-req-data>image data/dfn>./p> p>An a href#image-request idimages-processing-model:image-request-2>image request/a>s a href#img-req-state idimages-processing-model:img-req-state>state/a> is one of the following:/p> dl>dt>dfn idimg-none>Unavailable/dfn>dd>The user agent hasnt obtained any image data, or has obtained some or all of the image data but hasnt yet decoded enough of the image to get the image dimensions.dt>dfn idimg-inc>Partially available/dfn>dd>The user agent has obtained some of the image data and at least the image dimensions are available.dt>dfn idimg-all>Completely available/dfn>dd>The user agent has obtained all of the image data and at least the image dimensions are available.dt>dfn idimg-error>Broken/dfn>dd>The user agent has obtained all of the image data that it can, but it cannot even decode the image enough to get the image dimensions (e.g. the image is corrupted, or the format is not supported, or no data could be obtained)./dl> p>An a href#image-request idimages-processing-model:image-request-3>image request/a>s a href#img-req-url idimages-processing-model:img-req-url>current URL/a> is initially the empty string./p> p>An a href#image-request idimages-processing-model:image-request-4>image request/a>s a href#img-req-data idimages-processing-model:img-req-data>image data/a> is the decoded image data./p> p>When an a href#image-request idimages-processing-model:image-request-5>image request/a>s a href#img-req-state idimages-processing-model:img-req-state-2>state/a> is either a href#img-inc idimages-processing-model:img-inc>partially available/a> or a href#img-all idimages-processing-model:img-all>completely available/a>, the a href#image-request idimages-processing-model:image-request-6>image request/a> is said to be dfn idimg-available>available/dfn>./p> p>When an code idimages-processing-model:the-img-element-3>a href#the-img-element>img/a>/code> element is in the a href#img-all idimages-processing-model:img-all-2>completely available/a> state em>and/em> the user agent can decode the media data without errors, then the code idimages-processing-model:the-img-element-4>a href#the-img-element>img/a>/code> element is said to be dfn idimg-good>fully decodable/dfn>./p> p>An a href#image-request idimages-processing-model:image-request-7>image request/a>s a href#img-req-state idimages-processing-model:img-req-state-3>state/a> is initially a href#img-none idimages-processing-model:img-none>unavailable/a>./p> p>When an code idimages-processing-model:the-img-element-5>a href#the-img-element>img/a>/code> element is a href#img-available idimages-processing-model:img-available>available/a>, it provides a a idimages-processing-model:paint-source hrefhttps://drafts.csswg.org/css-images-4/#paint-source data-x-internalpaint-source>paint source/a> whose width is the images a href#density-corrected-intrinsic-width-and-height idimages-processing-model:density-corrected-intrinsic-width-and-height>density-corrected intrinsic width/a> (if any), whose height is the images a href#density-corrected-intrinsic-width-and-height idimages-processing-model:density-corrected-intrinsic-width-and-height-2>density-corrected intrinsic height/a> (if any), and whose appearance is the intrinsic appearance of the image./p> hr> p>An code idimages-processing-model:the-img-element-6>a href#the-img-element>img/a>/code> element is said to dfn iduse-srcset-or-picture>use code>srcset/code> or code>picture/code>/dfn> if it has a code idimages-processing-model:attr-img-srcset>a href#attr-img-srcset>srcset/a>/code> attribute specified or if it has a parent that is a code idimages-processing-model:the-picture-element>a href#the-picture-element>picture/a>/code> element./p> hr> p>Each code idimages-processing-model:the-img-element-7>a href#the-img-element>img/a>/code> element has a dfn idlast-selected-source>last selected source/dfn>, which must initially be null./p> p>Each a href#image-request idimages-processing-model:image-request-8>image request/a> has a dfn idcurrent-pixel-density>current pixel density/dfn>, which must initially be undefined./p> p>When an code idimages-processing-model:the-img-element-8>a href#the-img-element>img/a>/code> element has a a href#current-pixel-density idimages-processing-model:current-pixel-density>current pixel density/a> that is not 1.0, the elements image data must be treated as if its resolution, in device pixels per a hrefhttps://drafts.csswg.org/css-values/#px idimages-processing-model:px data-x-internalpx>CSS pixels/a>, was the a href#current-pixel-density idimages-processing-model:current-pixel-density-2>current pixel density/a>. The images dfn iddensity-corrected-intrinsic-width-and-height>density-corrected intrinsic width and height/dfn> are the a hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic idimages-processing-model:intrinsic-dimensions data-x-internalintrinsic-dimensions>intrinsic width and height/a> after taking into account the a href#current-pixel-density idimages-processing-model:current-pixel-density-3>current pixel density/a>./p> p classexample>For example, if the a href#current-pixel-density idimages-processing-model:current-pixel-density-4>current pixel density/a> is 3.125, that means that there are 300 device pixels per a hrefhttps://drafts.csswg.org/css-values/#in idimages-processing-model:in data-x-internalin>CSS inch/a>, and thus if the image data is 300x600, it has a idimages-processing-model:intrinsic-dimensions-2 hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic data-x-internalintrinsic-dimensions>intrinsic dimensions/a> of 96 a hrefhttps://drafts.csswg.org/css-values/#px idimages-processing-model:px-2 data-x-internalpx>CSS pixels/a> by 192 a hrefhttps://drafts.csswg.org/css-values/#px idimages-processing-model:px-3 data-x-internalpx>CSS pixels/a>./p> p>An code idimages-processing-model:the-img-element-9>a href#the-img-element>img/a>/code> element is associated with a a href#source-set idimages-processing-model:source-set>source set/a>./p> p>A dfn idsource-set>source set/dfn> is an ordered set of zero or more a href#image-source idimages-processing-model:image-source>image sources/a> and a a href#source-size-2 idimages-processing-model:source-size-2>source size/a>./p> p>An dfn idimage-source>image source/dfn> is a a idimages-processing-model:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>, and optionally either a a href#pixel-density-descriptor idimages-processing-model:pixel-density-descriptor>pixel density descriptor/a>, or a a href#width-descriptor idimages-processing-model:width-descriptor>width descriptor/a>./p> p>A dfn idsource-size-2>source size/dfn> is a a href#source-size-value idimages-processing-model:source-size-value><source-size-value>/a>. When a a href#source-size-2 idimages-processing-model:source-size-2-2>source size/a> has a unit relative to the a idimages-processing-model:viewport hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>, it must be interpreted relative to the code idimages-processing-model:the-img-element-10>a href#the-img-element>img/a>/code> elements a idimages-processing-model:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a idimages-processing-model:viewport-2 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>. Other units must be interpreted the same as in Media Queries. a href#refsMQ>MQ/a>/p> hr> p>A dfn idconcept-microsyntax-parse-error>parse error/dfn> for algorithms in this section indicates a non-fatal mismatch between input and requirements. User agents are encouraged to expose a href#concept-microsyntax-parse-error idimages-processing-model:concept-microsyntax-parse-error>parse error/a>s somehow./p> hr> p>Whether the image is fetched successfully or not (e.g. whether the response status was an a idimages-processing-model:ok-status hrefhttps://fetch.spec.whatwg.org/#ok-status data-x-internalok-status>ok status/a>) must be ignored when determining the images type and whether it is a valid image./p> p classnote>This allows servers to return images with error responses, and have them displayed./p> p idimg-determine-type>The user agent should apply the a hrefhttps://mimesniff.spec.whatwg.org/#rules-for-sniffing-images-specifically idimages-processing-model:content-type-sniffing:-image data-x-internalcontent-type-sniffing:-image>image sniffing rules/a> to determine the type of the image, with the images a href#content-type idimages-processing-model:content-type>associated Content-Type headers/a> giving the var>official type/var>. If these rules are not applied, then the type of the image must be the type given by the images a href#content-type idimages-processing-model:content-type-2>associated Content-Type headers/a>.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id25889 titleimg> When to swap the image for the environment changes case>25889/a>, a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id26702 titleWhat img> represents should support srcset/picture>26702/a>/div> p>User agents must not support non-image resources with the code idimages-processing-model:the-img-element-11>a href#the-img-element>img/a>/code> element (e.g. XML files whose a idimages-processing-model:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> is an HTML element). User agents must not run executable code (e.g. scripts) embedded in the image resource. User agents must only display the first page of a multipage resource (e.g. a PDF file). User agents must not allow the resource to act in an interactive fashion, but should honour any animation in the resource./p> p>This specification does not specify which image types are to be supported./p> h6 idwhen-to-obtain-images>span classsecno>4.8.4.3.1/span> When to obtain imagesa href#when-to-obtain-images classself-link>/a>/h6> p>In a a href#browsing-context idwhen-to-obtain-images:browsing-context>browsing context/a> where a href#concept-bc-noscript idwhen-to-obtain-images:concept-bc-noscript>scripting is disabled/a>, user agents may obtain images immediately or on demand. In a a href#browsing-context idwhen-to-obtain-images:browsing-context-2>browsing context/a> where a href#concept-bc-noscript idwhen-to-obtain-images:concept-bc-noscript-2>scripting is enabled/a>, user agents must obtain images immediately./p> p>A user agent that obtains images immediately must synchronously a href#update-the-image-data idwhen-to-obtain-images:update-the-image-data>update the image data/a> of an code idwhen-to-obtain-images:the-img-element>a href#the-img-element>img/a>/code> element, with the i>restart animation/i> flag set if so stated, whenever that element is created or has experienced a href#relevant-mutations idwhen-to-obtain-images:relevant-mutations>relevant mutations/a>./p> p>A user agent that obtains images on demand must a href#update-the-image-data idwhen-to-obtain-images:update-the-image-data-2>update the image data/a> of an code idwhen-to-obtain-images:the-img-element-2>a href#the-img-element>img/a>/code> element whenever it needs the image data (i.e. on demand), but only if the code idwhen-to-obtain-images:the-img-element-3>a href#the-img-element>img/a>/code> element is in the a href#img-none idwhen-to-obtain-images:img-none>unavailable/a> state. When an code idwhen-to-obtain-images:the-img-element-4>a href#the-img-element>img/a>/code> element has experienced a href#relevant-mutations idwhen-to-obtain-images:relevant-mutations-2>relevant mutations/a>, if the user agent only obtains images on demand, the code idwhen-to-obtain-images:the-img-element-5>a href#the-img-element>img/a>/code> element must return to the a href#img-none idwhen-to-obtain-images:img-none-2>unavailable/a> state./p> h6 idreacting-to-dom-mutations>span classsecno>4.8.4.3.2/span> Reacting to DOM mutationsa href#reacting-to-dom-mutations classself-link>/a>/h6> p>The dfn idrelevant-mutations>relevant mutations/dfn> for an code idreacting-to-dom-mutations:the-img-element>a href#the-img-element>img/a>/code> element are as follows:/p> ul>li>p>The elements code idreacting-to-dom-mutations:attr-img-src>a href#attr-img-src>src/a>/code>, code idreacting-to-dom-mutations:attr-img-srcset>a href#attr-img-srcset>srcset/a>/code>, code idreacting-to-dom-mutations:attr-dim-width>a href#attr-dim-width>width/a>/code>, or code idreacting-to-dom-mutations:attr-img-sizes>a href#attr-img-sizes>sizes/a>/code> attributes are set, changed, or removed.li>p>The elements code idreacting-to-dom-mutations:attr-img-src-2>a href#attr-img-src>src/a>/code> attribute is set to the same value as the previous value. This must set the i>restart animation/i> flag for the a href#update-the-image-data idreacting-to-dom-mutations:update-the-image-data>update the image data/a> algorithm.li>p>The elements code idreacting-to-dom-mutations:attr-img-crossorigin>a href#attr-img-crossorigin>crossorigin/a>/code> attributes state is changed.li>p>The a href#nodes-are-inserted idreacting-to-dom-mutations:nodes-are-inserted>element is inserted/a> into or a href#nodes-are-removed idreacting-to-dom-mutations:nodes-are-removed>removed/a> from a code idreacting-to-dom-mutations:the-picture-element>a href#the-picture-element>picture/a>/code> parent element.li>p>The elements parent is a code idreacting-to-dom-mutations:the-picture-element-2>a href#the-picture-element>picture/a>/code> element and a code idreacting-to-dom-mutations:the-source-element>a href#the-source-element>source/a>/code> a href#nodes-are-inserted idreacting-to-dom-mutations:nodes-are-inserted-2>element is inserted/a> as a previous sibling.li>p>The elements parent is a code idreacting-to-dom-mutations:the-picture-element-3>a href#the-picture-element>picture/a>/code> element and a code idreacting-to-dom-mutations:the-source-element-2>a href#the-source-element>source/a>/code> element that was a previous sibling is a href#nodes-are-removed idreacting-to-dom-mutations:nodes-are-removed-2>removed/a>.li>p>The elements parent is a code idreacting-to-dom-mutations:the-picture-element-4>a href#the-picture-element>picture/a>/code> element and a code idreacting-to-dom-mutations:the-source-element-3>a href#the-source-element>source/a>/code> element that is a previous sibling has its code idreacting-to-dom-mutations:attr-source-srcset>a href#attr-source-srcset>srcset/a>/code>, code idreacting-to-dom-mutations:attr-source-sizes>a href#attr-source-sizes>sizes/a>/code>, code idreacting-to-dom-mutations:attr-source-media>a href#attr-source-media>media/a>/code>, or code idreacting-to-dom-mutations:attr-source-type>a href#attr-source-type>type/a>/code> attributes set, changed, or removed.li>p>The elements a hrefhttps://dom.spec.whatwg.org/#concept-node-adopt-ext idreacting-to-dom-mutations:concept-node-adopt-ext data-x-internalconcept-node-adopt-ext>adopting steps/a> are run./ul> h6 idthe-list-of-available-images>span classsecno>4.8.4.3.3/span> The list of available imagesa href#the-list-of-available-images classself-link>/a>/h6> p>Each code idthe-list-of-available-images:document>a href#document>Document/a>/code> object must have a dfn idlist-of-available-images>list of available images/dfn>. Each image in this list is identified by a tuple consisting of an a idthe-list-of-available-images:absolute-url hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>, a a href#cors-settings-attribute idthe-list-of-available-images:cors-settings-attribute>CORS settings attribute/a> mode, and, if the mode is not a href#attr-crossorigin-none idthe-list-of-available-images:attr-crossorigin-none>No CORS/a>, an a href#concept-origin idthe-list-of-available-images:concept-origin>origin/a>. Each image furthermore has an dfn idignore-higher-layer-caching>ignore higher-layer caching/dfn> flag. User agents may copy entries from one code idthe-list-of-available-images:document-2>a href#document>Document/a>/code> objects a href#list-of-available-images idthe-list-of-available-images:list-of-available-images>list of available images/a> to another at any time (e.g. when the code idthe-list-of-available-images:document-3>a href#document>Document/a>/code> is created, user agents can add to it all the images that are loaded in other code idthe-list-of-available-images:document-4>a href#document>Document/a>/code>s), but must not change the keys of entries copied in this way when doing so, and must unset the a href#ignore-higher-layer-caching idthe-list-of-available-images:ignore-higher-layer-caching>ignore higher-layer caching/a> flag for the copied entry. User agents may also remove images from such lists at any time (e.g. to save memory). User agents must remove entries in the a href#list-of-available-images idthe-list-of-available-images:list-of-available-images-2>list of available images/a> as appropriate given higher-layer caching semantics for the resource (e.g. the HTTP `code idthe-list-of-available-images:http-cache-control>a data-x-internalhttp-cache-control hrefhttps://tools.ietf.org/html/rfc7234#section-5.2>Cache-Control/a>/code>` response header) when the a href#ignore-higher-layer-caching idthe-list-of-available-images:ignore-higher-layer-caching-2>ignore higher-layer caching/a> flag is unset./p> p classnote>The a href#list-of-available-images idthe-list-of-available-images:list-of-available-images-3>list of available images/a> is intended to enable synchronous switching when changing the code idthe-list-of-available-images:attr-img-src>a href#attr-img-src>src/a>/code> attribute to a URL that has previously been loaded, and to avoid re-downloading images in the same document even when they dont allow caching per HTTP. It is not used to avoid re-downloading the same image while the previous image is still loading./p> p classnote>The user agent can also store the image data separately from the a href#list-of-available-images idthe-list-of-available-images:list-of-available-images-4>list of available images/a>./p> p classexample>For example, if a resource has the HTTP response header `code>Cache-Control: must-revalidate/code>`, and its a href#ignore-higher-layer-caching idthe-list-of-available-images:ignore-higher-layer-caching-3>ignore higher-layer caching/a> flag is unset, the user agent would remove it from the a href#list-of-available-images idthe-list-of-available-images:list-of-available-images-5>list of available images/a> but could keep the image data separately, and use that if the server responds with a code>304 Not Modified/code> status./p> h6 idupdating-the-image-data>span classsecno>4.8.4.3.4/span> Updating the image dataa href#updating-the-image-data classself-link>/a>/h6> p>When the user agent is to dfn idupdate-the-image-data>update the image data/dfn> of an code idupdating-the-image-data:the-img-element>a href#the-img-element>img/a>/code> element, optionally with the i>restart animations/i> flag set, it must run the following steps:div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id24597 titleMaybe make the img> fetch outlive the document (like ping)>24597/a>, a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id24712 titleimg>: Should probably not fire load if selected source is the same as the last selected source. (step 7.3)>24712/a>/div> ol>li> p>If the elements a idupdating-the-image-data:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is not the a href#active-document idupdating-the-image-data:active-document>active document/a>, then:/p> ol>li>p>Continue running this algorithm a href#in-parallel idupdating-the-image-data:in-parallel>in parallel/a>.li>p>Wait until the elements a idupdating-the-image-data:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is the a href#active-document idupdating-the-image-data:active-document-2>active document/a>.li>p>If another instance of this algorithm for this code idupdating-the-image-data:the-img-element-2>a href#the-img-element>img/a>/code> element was started after this instance (even if it aborted and is no longer running), then abort these steps.li>p>a href#queue-a-microtask idupdating-the-image-data:queue-a-microtask>Queue a microtask/a> to continue this algorithm./ol> li>p>If the user agent cannot support images, or its support for images has been disabled, then a href#abort-the-image-request idupdating-the-image-data:abort-the-image-request>abort the image request/a> for the a href#current-request idupdating-the-image-data:current-request>current request/a> and the a href#pending-request idupdating-the-image-data:pending-request>pending request/a>, set a href#current-request idupdating-the-image-data:current-request-2>current request/a>s a href#img-req-state idupdating-the-image-data:img-req-state>state/a> to a href#img-none idupdating-the-image-data:img-none>unavailable/a>, set a href#pending-request idupdating-the-image-data:pending-request-2>pending request/a> to null, and return.li>p>Let var>selected source/var> be null and var>selected pixel density/var> be undefined. li>p>If the element does not a href#use-srcset-or-picture idupdating-the-image-data:use-srcset-or-picture>use code>srcset/code> or code>picture/code>/a> and it has a code idupdating-the-image-data:attr-img-src>a href#attr-img-src>src/a>/code> attribute specified whose value is not the empty string, then set var>selected source/var> to the value of the elements code idupdating-the-image-data:attr-img-src-2>a href#attr-img-src>src/a>/code> attribute and set var>selected pixel density/var> to 1.0.li>p>Set the elements a href#last-selected-source idupdating-the-image-data:last-selected-source>last selected source/a> to var>selected source/var>.li> p>If var>selected source/var> is not null, then:/p> ol>li>p>a href#parse-a-url idupdating-the-image-data:parse-a-url>Parse/a> var>selected source/var>, relative to the elements a idupdating-the-image-data:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>. If that is not successful, then abort this inner set of steps. Otherwise, let var>urlString/var> be the a href#resulting-url-string idupdating-the-image-data:resulting-url-string>resulting URL string/a>.li>p>Let var>key/var> be a tuple consisting of var>urlString/var>, the code idupdating-the-image-data:the-img-element-3>a href#the-img-element>img/a>/code> elements code idupdating-the-image-data:attr-img-crossorigin>a href#attr-img-crossorigin>crossorigin/a>/code> attributes mode, and, if that mode is not a href#attr-crossorigin-none idupdating-the-image-data:attr-crossorigin-none>No CORS/a>, the a idupdating-the-image-data:node-document-4 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#concept-origin idupdating-the-image-data:concept-origin>origin/a>.li> p>If the a href#list-of-available-images idupdating-the-image-data:list-of-available-images>list of available images/a> contains an entry for var>key/var>, then:/p> ol>li>p>Set the a href#ignore-higher-layer-caching idupdating-the-image-data:ignore-higher-layer-caching>ignore higher-layer caching/a> flag for that entry.li>p>a href#abort-the-image-request idupdating-the-image-data:abort-the-image-request-2>Abort the image request/a> for the a href#current-request idupdating-the-image-data:current-request-3>current request/a> and the a href#pending-request idupdating-the-image-data:pending-request-3>pending request/a>.li>p>Set a href#pending-request idupdating-the-image-data:pending-request-4>pending request/a> to null.li>p>Let a href#current-request idupdating-the-image-data:current-request-4>current request/a> be a new a href#image-request idupdating-the-image-data:image-request>image request/a> whose a href#img-req-data idupdating-the-image-data:img-req-data>image data/a> is that of the entry and whose a href#img-req-state idupdating-the-image-data:img-req-state-2>state/a> is a href#img-all idupdating-the-image-data:img-all>completely available/a>.li>p>Update the presentation of the image appropriately.li>p>Set a href#current-request idupdating-the-image-data:current-request-5>current request/a>s a href#current-pixel-density idupdating-the-image-data:current-pixel-density>current pixel density/a> to var>selected pixel density/var>.li> p>a href#queue-a-task idupdating-the-image-data:queue-a-task>Queue a task/a> to:/p> ol>li>p>If i>restart animation/i> is set, then a href#restart-the-animation idupdating-the-image-data:restart-the-animation>restart the animation/a>.li>p>Set a href#current-request idupdating-the-image-data:current-request-6>current request/a>s a href#img-req-url idupdating-the-image-data:img-req-url>current URL/a> to var>urlString/var>.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idupdating-the-image-data:concept-event-fire data-x-internalconcept-event-fire>Fire an event/a> named code idupdating-the-image-data:event-load>a href#event-load>load/a>/code> at the code idupdating-the-image-data:the-img-element-4>a href#the-img-element>img/a>/code> element./ol> li>p>Abort the a href#update-the-image-data idupdating-the-image-data:update-the-image-data>update the image data/a> algorithm./ol> /ol> li>p>a href#await-a-stable-state idupdating-the-image-data:await-a-stable-state>Await a stable state/a>, allowing the a href#concept-task idupdating-the-image-data:concept-task>task/a> that invoked this algorithm to continue. The a href#synchronous-section idupdating-the-image-data:synchronous-section>synchronous section/a> consists of all the remaining steps of this algorithm until the algorithm says the a href#synchronous-section idupdating-the-image-data:synchronous-section-2>synchronous section/a> has ended. (Steps in a href#synchronous-section idupdating-the-image-data:synchronous-section-3>synchronous sections/a> are marked with ⌛.)li> p>⌛ If another instance of this algorithm for this code idupdating-the-image-data:the-img-element-5>a href#the-img-element>img/a>/code> element was started after this instance (even if it aborted and is no longer running), then abort these steps./p> p classnote>Only the last instance takes effect, to avoid multiple requests when, for example, the code idupdating-the-image-data:attr-img-src-3>a href#attr-img-src>src/a>/code>, code idupdating-the-image-data:attr-img-srcset>a href#attr-img-srcset>srcset/a>/code>, and code idupdating-the-image-data:attr-img-crossorigin-2>a href#attr-img-crossorigin>crossorigin/a>/code> attributes are all set in succession./p> li>p>⌛ Let var>selected source/var> and var>selected pixel density/var> be the URL and pixel density that results from a href#select-an-image-source idupdating-the-image-data:select-an-image-source>selecting an image source/a>, respectively.li> p>⌛ If var>selected source/var> is null, then:/p> ol>li>p>⌛ Set the a href#current-request idupdating-the-image-data:current-request-7>current request/a>s a href#img-req-state idupdating-the-image-data:img-req-state-3>state/a> to a href#img-error idupdating-the-image-data:img-error>broken/a>, a href#abort-the-image-request idupdating-the-image-data:abort-the-image-request-3>abort the image request/a> for the a href#current-request idupdating-the-image-data:current-request-8>current request/a> and the a href#pending-request idupdating-the-image-data:pending-request-5>pending request/a>, and set a href#pending-request idupdating-the-image-data:pending-request-6>pending request/a> to null.li>p>⌛ a href#queue-a-task idupdating-the-image-data:queue-a-task-2>Queue a task/a> to change the a href#current-request idupdating-the-image-data:current-request-9>current request/a>s a href#img-req-url idupdating-the-image-data:img-req-url-2>current URL/a> to the empty string, and then, if the element has a code idupdating-the-image-data:attr-img-src-4>a href#attr-img-src>src/a>/code> attribute or it a href#use-srcset-or-picture idupdating-the-image-data:use-srcset-or-picture-2>uses code>srcset/code> or code>picture/code>/a>, a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idupdating-the-image-data:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idupdating-the-image-data:event-error>a href#event-error>error/a>/code> at the code idupdating-the-image-data:the-img-element-6>a href#the-img-element>img/a>/code> element.li>p>⌛ Abort this algorithm./ol> li>p>⌛ a href#queue-a-task idupdating-the-image-data:queue-a-task-3>Queue a task/a> to a idupdating-the-image-data:fire-a-progress-event hrefhttps://xhr.spec.whatwg.org/#concept-event-fire-progress data-x-internalfire-a-progress-event>fire a progress event/a> named code idupdating-the-image-data:event-loadstart>a href#event-loadstart>loadstart/a>/code> at the code idupdating-the-image-data:the-img-element-7>a href#the-img-element>img/a>/code> element.li> p>⌛ a href#parse-a-url idupdating-the-image-data:parse-a-url-2>Parse/a> var>selected source/var>, relative to the elements a idupdating-the-image-data:node-document-5 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, and let var>urlString/var> be the a href#resulting-url-string idupdating-the-image-data:resulting-url-string-2>resulting URL string/a>. If that is not successful, then:/p> ol>li>p>⌛ a href#abort-the-image-request idupdating-the-image-data:abort-the-image-request-4>Abort the image request/a> for the a href#current-request idupdating-the-image-data:current-request-10>current request/a> and the a href#pending-request idupdating-the-image-data:pending-request-7>pending request/a>.li>p>⌛ Set the a href#current-request idupdating-the-image-data:current-request-11>current request/a>s a href#img-req-state idupdating-the-image-data:img-req-state-4>state/a> to a href#img-error idupdating-the-image-data:img-error-2>broken/a>.li>p>⌛ Set a href#pending-request idupdating-the-image-data:pending-request-8>pending request/a> to null.li>p>⌛ a href#queue-a-task idupdating-the-image-data:queue-a-task-4>Queue a task/a> to change the a href#current-request idupdating-the-image-data:current-request-12>current request/a>s a href#img-req-url idupdating-the-image-data:img-req-url-3>current URL/a> to var>selected source/var>, a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idupdating-the-image-data:concept-event-fire-3 data-x-internalconcept-event-fire>fire an event/a> named code idupdating-the-image-data:event-error-2>a href#event-error>error/a>/code> at the code idupdating-the-image-data:the-img-element-8>a href#the-img-element>img/a>/code> element and then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idupdating-the-image-data:concept-event-fire-4 data-x-internalconcept-event-fire>fire an event/a> named code idupdating-the-image-data:event-loadend>a href#event-loadend>loadend/a>/code> at the code idupdating-the-image-data:the-img-element-9>a href#the-img-element>img/a>/code> element.li>p>⌛ Abort the a href#update-the-image-data idupdating-the-image-data:update-the-image-data-2>update the image data/a> algorithm./ol> li>p>⌛ If the a href#pending-request idupdating-the-image-data:pending-request-9>pending request/a> is not null and var>urlString/var> is the same as the a href#pending-request idupdating-the-image-data:pending-request-10>pending request/a>s a href#img-req-url idupdating-the-image-data:img-req-url-4>current URL/a>, then return.li>p>⌛ If var>urlString/var> is the same as the a href#current-request idupdating-the-image-data:current-request-13>current request/a>s a href#img-req-url idupdating-the-image-data:img-req-url-5>current URL/a> and a href#current-request idupdating-the-image-data:current-request-14>current request/a>s a href#img-req-state idupdating-the-image-data:img-req-state-5>state/a> is a href#img-inc idupdating-the-image-data:img-inc>partially available/a>, then a href#abort-the-image-request idupdating-the-image-data:abort-the-image-request-5>abort the image request/a> for the a href#pending-request idupdating-the-image-data:pending-request-11>pending request/a>, a href#queue-a-task idupdating-the-image-data:queue-a-task-5>queue a task/a> to a href#restart-the-animation idupdating-the-image-data:restart-the-animation-2>restart the animation/a> if i>restart animation/i> is set, and return.li>p>⌛ If the a href#pending-request idupdating-the-image-data:pending-request-12>pending request/a> is not null, then a href#abort-the-image-request idupdating-the-image-data:abort-the-image-request-6>abort the image request/a> for the a href#pending-request idupdating-the-image-data:pending-request-13>pending request/a>.li>p>⌛ Set var>image request/var> to a new a href#image-request idupdating-the-image-data:image-request-2>image request/a> whose a href#img-req-url idupdating-the-image-data:img-req-url-6>current URL/a> is var>urlString/var>.li>p>⌛ If a href#current-request idupdating-the-image-data:current-request-15>current request/a>s a href#img-req-state idupdating-the-image-data:img-req-state-6>state/a> is a href#img-none idupdating-the-image-data:img-none-2>unavailable/a> or a href#img-error idupdating-the-image-data:img-error-3>broken/a>, then set the a href#current-request idupdating-the-image-data:current-request-16>current request/a> to var>image request/var>. Otherwise, set the a href#pending-request idupdating-the-image-data:pending-request-14>pending request/a> to var>image request/var>.li>p>⌛ Let var>request/var> be the result of a href#create-a-potential-cors-request idupdating-the-image-data:create-a-potential-cors-request>creating a potential-CORS request/a> given var>urlString/var>, code>image/code>, and the current state of the elements code idupdating-the-image-data:attr-img-crossorigin-3>a href#attr-img-crossorigin>crossorigin/a>/code> content attribute.li>p>⌛ Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-client idupdating-the-image-data:concept-request-client data-x-internalconcept-request-client>client/a> to the elements a idupdating-the-image-data:node-document-6 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s code idupdating-the-image-data:window>a href#window>Window/a>/code> objects a href#environment-settings-object idupdating-the-image-data:environment-settings-object>environment settings object/a>.li>p>⌛ If the element a href#use-srcset-or-picture idupdating-the-image-data:use-srcset-or-picture-3>uses code>srcset/code> or code>picture/code>/a>, set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-initiator idupdating-the-image-data:concept-request-initiator data-x-internalconcept-request-initiator>initiator/a> to code>imageset/code>.li>p>⌛ Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-referrer-policy idupdating-the-image-data:concept-request-referrer-policy data-x-internalconcept-request-referrer-policy>referrer policy/a> to the current state of the elements code idupdating-the-image-data:attr-img-referrerpolicy>a href#attr-img-referrerpolicy>referrerpolicy/a>/code> attribute.li> p>⌛ a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idupdating-the-image-data:concept-fetch data-x-internalconcept-fetch>Fetch/a> var>request/var>. Let this instance of the a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idupdating-the-image-data:concept-fetch-2 data-x-internalconcept-fetch>fetching/a> algorithm be associated with var>image request/var>./p> p>The resource obtained in this fashion, if any, is var>image request/var>s a href#img-req-data idupdating-the-image-data:img-req-data-2>image data/a>. It can be either a href#cors-same-origin idupdating-the-image-data:cors-same-origin>CORS-same-origin/a> or a href#cors-cross-origin idupdating-the-image-data:cors-cross-origin>CORS-cross-origin/a>; this affects the a href#concept-origin idupdating-the-image-data:concept-origin-2>origin/a> of the image itself (e.g. when used on a code idupdating-the-image-data:the-canvas-element>a href#the-canvas-element>canvas/a>/code>)./p> p>Fetching the image must a href#delay-the-load-event idupdating-the-image-data:delay-the-load-event>delay the load event/a> of the elements a idupdating-the-image-data:node-document-7 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> until the a href#concept-task idupdating-the-image-data:concept-task-2>task/a> that is a href#queue-a-task idupdating-the-image-data:queue-a-task-6>queued/a> by the a href#networking-task-source idupdating-the-image-data:networking-task-source>networking task source/a> once the resource has been fetched (a href#img-load>defined below/a>) has been run. /p> p classwarning>This, unfortunately, can be used to perform a rudimentary port scan of the users local network (especially in conjunction with scripting, though scripting isnt actually necessary to carry out such an attack). User agents may implement a href#concept-origin idupdating-the-image-data:concept-origin-3>cross-origin/a> access control policies that are stricter than those described above to mitigate this attack, but unfortunately such policies are typically not compatible with existing Web content./p> p>If the resource is a href#cors-same-origin idupdating-the-image-data:cors-same-origin-2>CORS-same-origin/a>, each a href#concept-task idupdating-the-image-data:concept-task-3>task/a> that is a href#queue-a-task idupdating-the-image-data:queue-a-task-7>queued/a> by the a href#networking-task-source idupdating-the-image-data:networking-task-source-2>networking task source/a> while the image is being fetched, if var>image request/var> is the a href#current-request idupdating-the-image-data:current-request-17>current request/a>, must a idupdating-the-image-data:fire-a-progress-event-2 hrefhttps://xhr.spec.whatwg.org/#concept-event-fire-progress data-x-internalfire-a-progress-event>fire a progress event/a> named code idupdating-the-image-data:event-progress>a href#event-progress>progress/a>/code> at the code idupdating-the-image-data:the-img-element-10>a href#the-img-element>img/a>/code> element./p> li>p>End the a href#synchronous-section idupdating-the-image-data:synchronous-section-4>synchronous section/a>, continuing the remaining steps a href#in-parallel idupdating-the-image-data:in-parallel-2>in parallel/a>, but without missing any data from fetching.li> p>As soon as possible, jump to the first applicable entry from the following list:/p> dl classswitch>dt>If the resource type is code idupdating-the-image-data:multipart/x-mixed-replace>a href#multipart/x-mixed-replace>multipart/x-mixed-replace/a>/code>dd> p>The next a href#concept-task idupdating-the-image-data:concept-task-4>task/a> that is a href#queue-a-task idupdating-the-image-data:queue-a-task-8>queued/a> by the a href#networking-task-source idupdating-the-image-data:networking-task-source-3>networking task source/a> while the image is being fetched must run the following steps:/p> ol>li> p>If var>image request/var> is the a href#pending-request idupdating-the-image-data:pending-request-15>pending request/a> and at least one body part has been completely decoded, a href#abort-the-image-request idupdating-the-image-data:abort-the-image-request-7>abort the image request/a> for the a href#current-request idupdating-the-image-data:current-request-18>current request/a>, a href#upgrade-the-pending-request-to-the-current-request idupdating-the-image-data:upgrade-the-pending-request-to-the-current-request>upgrade the pending request to the current request/a>./p> li>p>Otherwise, if var>image request/var> is the a href#pending-request idupdating-the-image-data:pending-request-16>pending request/a> and the user agent is able to determine that var>image request/var>s image is corrupted in some fatal way such that the image dimensions cannot be obtained, a href#abort-the-image-request idupdating-the-image-data:abort-the-image-request-8>abort the image request/a> for the a href#current-request idupdating-the-image-data:current-request-19>current request/a>, a href#upgrade-the-pending-request-to-the-current-request idupdating-the-image-data:upgrade-the-pending-request-to-the-current-request-2>upgrade the pending request to the current request/a>, and set the a href#current-request idupdating-the-image-data:current-request-20>current request/a>s a href#img-req-state idupdating-the-image-data:img-req-state-7>state/a> to a href#img-error idupdating-the-image-data:img-error-4>broken/a>.li>p>Otherwise, if var>image request/var> is the a href#current-request idupdating-the-image-data:current-request-21>current request/a>, its a href#img-req-state idupdating-the-image-data:img-req-state-8>state/a> is a href#img-none idupdating-the-image-data:img-none-3>unavailable/a>, and the user agent is able to determine var>image request/var>s images width and height, set the a href#current-request idupdating-the-image-data:current-request-22>current request/a>s a href#img-req-state idupdating-the-image-data:img-req-state-9>state/a> to a href#img-inc idupdating-the-image-data:img-inc-2>partially available/a>.li>p>Otherwise, if var>image request/var> is the a href#current-request idupdating-the-image-data:current-request-23>current request/a>, its a href#img-req-state idupdating-the-image-data:img-req-state-10>state/a> is a href#img-none idupdating-the-image-data:img-none-4>unavailable/a>, and the user agent is able to determine that var>image request/var>s image is corrupted in some fatal way such that the image dimensions cannot be obtained, set the a href#current-request idupdating-the-image-data:current-request-24>current request/a>s a href#img-req-state idupdating-the-image-data:img-req-state-11>state/a> to a href#img-error idupdating-the-image-data:img-error-5>broken/a>. /p> /ol> p>Each a href#concept-task idupdating-the-image-data:concept-task-5>task/a> that is a href#queue-a-task idupdating-the-image-data:queue-a-task-9>queued/a> by the a href#networking-task-source idupdating-the-image-data:networking-task-source-4>networking task source/a> while the image is being fetched must update the presentation of the image, but as each new body part comes in, it must replace the previous image. Once one body part has been completely decoded, the user agent must set the code idupdating-the-image-data:the-img-element-11>a href#the-img-element>img/a>/code> element to the a href#img-all idupdating-the-image-data:img-all-2>completely available/a> state and a href#queue-a-task idupdating-the-image-data:queue-a-task-10>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idupdating-the-image-data:concept-event-fire-5 data-x-internalconcept-event-fire>fire an event/a> named code idupdating-the-image-data:event-load-2>a href#event-load>load/a>/code> at the code idupdating-the-image-data:the-img-element-12>a href#the-img-element>img/a>/code> element./p> p classnote>The code idupdating-the-image-data:event-progress-2>a href#event-progress>progress/a>/code> and code idupdating-the-image-data:event-loadend-2>a href#event-loadend>loadend/a>/code> events are not fired for code idupdating-the-image-data:multipart/x-mixed-replace-2>a href#multipart/x-mixed-replace>multipart/x-mixed-replace/a>/code> image streams./p> dt>If the resource type and data corresponds to a supported image format, a href#img-determine-type>as described below/a>dd> p>The next a href#concept-task idupdating-the-image-data:concept-task-6>task/a> that is a href#queue-a-task idupdating-the-image-data:queue-a-task-11>queued/a> by the a href#networking-task-source idupdating-the-image-data:networking-task-source-5>networking task source/a> while the image is being fetched must run the following steps:/p> ol>li>p>If the user agent is able to determine var>image request/var>s images width and height, and var>image request/var> is a href#pending-request idupdating-the-image-data:pending-request-17>pending request/a>, set var>image request/var>s a href#img-req-state idupdating-the-image-data:img-req-state-12>state/a> to a href#img-inc idupdating-the-image-data:img-inc-3>partially available/a>.li>p>Otherwise, if the user agent is able to determine var>image request/var>s images width and height, and var>image request/var> is a href#current-request idupdating-the-image-data:current-request-25>current request/a>, update the code idupdating-the-image-data:the-img-element-13>a href#the-img-element>img/a>/code> elements presentation appropriately and set var>image request/var>s a href#img-req-state idupdating-the-image-data:img-req-state-13>state/a> to a href#img-inc idupdating-the-image-data:img-inc-4>partially available/a>.li>p>Otherwise, if the user agent is able to determine that var>image request/var>s image is corrupted in some fatal way such that the image dimensions cannot be obtained, and var>image request/var> is a href#pending-request idupdating-the-image-data:pending-request-18>pending request/a>, a href#abort-the-image-request idupdating-the-image-data:abort-the-image-request-9>abort the image request/a> for the a href#current-request idupdating-the-image-data:current-request-26>current request/a> and the a href#pending-request idupdating-the-image-data:pending-request-19>pending request/a>, a href#upgrade-the-pending-request-to-the-current-request idupdating-the-image-data:upgrade-the-pending-request-to-the-current-request-3>upgrade the pending request to the current request/a>, set a href#current-request idupdating-the-image-data:current-request-27>current request/a>s a href#img-req-state idupdating-the-image-data:img-req-state-14>state/a> to a href#img-error idupdating-the-image-data:img-error-6>broken/a>, a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idupdating-the-image-data:concept-event-fire-6 data-x-internalconcept-event-fire>fire an event/a> named code idupdating-the-image-data:event-error-3>a href#event-error>error/a>/code> at the code idupdating-the-image-data:the-img-element-14>a href#the-img-element>img/a>/code> element, a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idupdating-the-image-data:concept-event-fire-7 data-x-internalconcept-event-fire>fire an event/a> named code idupdating-the-image-data:event-loadend-3>a href#event-loadend>loadend/a>/code> at the code idupdating-the-image-data:the-img-element-15>a href#the-img-element>img/a>/code> element, and abort these steps.li> p>Otherwise, if the user agent is able to determine that var>image request/var>s image is corrupted in some fatal way such that the image dimensions cannot be obtained, and var>image request/var> is a href#current-request idupdating-the-image-data:current-request-28>current request/a>, a href#abort-the-image-request idupdating-the-image-data:abort-the-image-request-10>abort the image request/a> for var>image request/var>, a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idupdating-the-image-data:concept-event-fire-8 data-x-internalconcept-event-fire>fire an event/a> named code idupdating-the-image-data:event-error-4>a href#event-error>error/a>/code> at the code idupdating-the-image-data:the-img-element-16>a href#the-img-element>img/a>/code> element, a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idupdating-the-image-data:concept-event-fire-9 data-x-internalconcept-event-fire>fire an event/a> named code idupdating-the-image-data:event-loadend-4>a href#event-loadend>loadend/a>/code> at the code idupdating-the-image-data:the-img-element-17>a href#the-img-element>img/a>/code> element, and abort these steps./p> /ol> p idimg-load>That a href#concept-task idupdating-the-image-data:concept-task-7>task/a>, and each subsequent a href#concept-task idupdating-the-image-data:concept-task-8>task/a>, that is a href#queue-a-task idupdating-the-image-data:queue-a-task-12>queued/a> by the a href#networking-task-source idupdating-the-image-data:networking-task-source-6>networking task source/a> while the image is being fetched, if var>image request/var> is the a href#current-request idupdating-the-image-data:current-request-29>current request/a>, must update the presentation of the image appropriately (e.g., if the image is a progressive JPEG, each packet can improve the resolution of the image).div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id25797 titleimg> "list of available images" and fragment in the URL>25797/a>, a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id25798 titleimg> should maybe cache broken images>25798/a>/div> p>Furthermore, the last a href#concept-task idupdating-the-image-data:concept-task-9>task/a> that is a href#queue-a-task idupdating-the-image-data:queue-a-task-13>queued/a> by the a href#networking-task-source idupdating-the-image-data:networking-task-source-7>networking task source/a> once the resource has been fetched must additionally run these steps:/p> ol>li>p>If var>image request/var> is the a href#pending-request idupdating-the-image-data:pending-request-20>pending request/a>, a href#abort-the-image-request idupdating-the-image-data:abort-the-image-request-11>abort the image request/a> for the a href#current-request idupdating-the-image-data:current-request-30>current request/a>, a href#upgrade-the-pending-request-to-the-current-request idupdating-the-image-data:upgrade-the-pending-request-to-the-current-request-4>upgrade the pending request to the current request/a> and update the code idupdating-the-image-data:the-img-element-18>a href#the-img-element>img/a>/code> elements presentation appropriately.li>p>Set var>image request/var> to the a href#img-all idupdating-the-image-data:img-all-3>completely available/a> state.li>p>Add the image to the a href#list-of-available-images idupdating-the-image-data:list-of-available-images-2>list of available images/a> using the key var>key/var>, with the a href#ignore-higher-layer-caching idupdating-the-image-data:ignore-higher-layer-caching-2>ignore higher-layer caching/a> flag set.li>p>a href#fire-a-progress-event-or-event idupdating-the-image-data:fire-a-progress-event-or-event>Fire a progress event or event/a> named code idupdating-the-image-data:event-load-3>a href#event-load>load/a>/code> at the code idupdating-the-image-data:the-img-element-19>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-event idupdating-the-image-data:fire-a-progress-event-or-event-2>Fire a progress event or event/a> named code idupdating-the-image-data:event-loadend-5>a href#event-loadend>loadend/a>/code> at the code idupdating-the-image-data:the-img-element-20>a href#the-img-element>img/a>/code> element, depending on the resource in var>image request/var>./ol> dt>Otherwisedd>p>The image data is not in a supported file format; the user agent must set var>image request/var>s a href#img-req-state idupdating-the-image-data:img-req-state-15>state/a> to a href#img-error idupdating-the-image-data:img-error-7>broken/a>, a href#abort-the-image-request idupdating-the-image-data:abort-the-image-request-12>abort the image request/a> for the a href#current-request idupdating-the-image-data:current-request-31>current request/a> and the a href#pending-request idupdating-the-image-data:pending-request-21>pending request/a>, a href#upgrade-the-pending-request-to-the-current-request idupdating-the-image-data:upgrade-the-pending-request-to-the-current-request-5>upgrade the pending request to the current request/a> if var>image request/var> is the a href#pending-request idupdating-the-image-data:pending-request-22>pending request/a>, and then a href#queue-a-task idupdating-the-image-data:queue-a-task-14>queue a task/a> to first a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idupdating-the-image-data:concept-event-fire-10 data-x-internalconcept-event-fire>fire an event/a> named code idupdating-the-image-data:event-error-5>a href#event-error>error/a>/code> at the code idupdating-the-image-data:the-img-element-21>a href#the-img-element>img/a>/code> element and then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idupdating-the-image-data:concept-event-fire-11 data-x-internalconcept-event-fire>fire an event/a> named code idupdating-the-image-data:event-loadend-6>a href#event-loadend>loadend/a>/code> at the code idupdating-the-image-data:the-img-element-22>a href#the-img-element>img/a>/code> element./dl> /ol> p>While a user agent is running the above algorithm for an element var>x/var>, there must be a strong reference from the elements a idupdating-the-image-data:node-document-8 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> to the element var>x/var>, even if that element is not a idupdating-the-image-data:connected hrefhttps://dom.spec.whatwg.org/#connected data-x-internalconnected>connected/a>./p> p>To dfn idabort-the-image-request>abort the image request/dfn> for an a href#image-request idupdating-the-image-data:image-request-3>image request/a> var>image request/var> means to run the following steps:/p> ol>li>p>Forget var>image request/var>s a href#img-req-data idupdating-the-image-data:img-req-data-3>image data/a>, if any.li>p>Abort any instance of the a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idupdating-the-image-data:concept-fetch-3 data-x-internalconcept-fetch>fetching/a> algorithm for var>image request/var>, discarding any pending tasks generated by that algorithm./ol> p>To dfn idupgrade-the-pending-request-to-the-current-request>upgrade the pending request to the current request/dfn> for an code idupdating-the-image-data:the-img-element-23>a href#the-img-element>img/a>/code> element means to run the following steps:/p> ol>li>p>Let the code idupdating-the-image-data:the-img-element-24>a href#the-img-element>img/a>/code> elements a href#current-request idupdating-the-image-data:current-request-32>current request/a> be the a href#pending-request idupdating-the-image-data:pending-request-23>pending request/a>.li>p>Let the code idupdating-the-image-data:the-img-element-25>a href#the-img-element>img/a>/code> elements a href#pending-request idupdating-the-image-data:pending-request-24>pending request/a> be null./ol> p>To dfn idfire-a-progress-event-or-event>fire a progress event or event/dfn> named var>type/var> at an element var>e/var>, depending on resource var>r/var>, means to a idupdating-the-image-data:fire-a-progress-event-3 hrefhttps://xhr.spec.whatwg.org/#concept-event-fire-progress data-x-internalfire-a-progress-event>fire a progress event/a> named var>type/var> at var>e/var> if var>r/var> is a href#cors-same-origin idupdating-the-image-data:cors-same-origin-3>CORS-same-origin/a>, and otherwise a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idupdating-the-image-data:concept-event-fire-12 data-x-internalconcept-event-fire>fire an event/a> named var>type/var> at var>e/var>./p> h6 idselecting-an-image-source>span classsecno>4.8.4.3.5/span> Selecting an image sourcea href#selecting-an-image-source classself-link>/a>/h6> p>When asked to dfn idselect-an-image-source>select an image source/dfn> for a given code idselecting-an-image-source:the-img-element>a href#the-img-element>img/a>/code> element var>el/var>, user agents must do the following:/p> ol>li>p>a href#update-the-source-set idselecting-an-image-source:update-the-source-set>Update the source set/a> for var>el/var>.li>p>If var>el/var>s a href#source-set idselecting-an-image-source:source-set>source set/a> is empty, return null as the URL and undefined as the pixel density and abort these steps.li>p>Otherwise, take var>el/var>s a href#source-set idselecting-an-image-source:source-set-2>source set/a> and let it be var>source set/var>.li>p>If an entry var>b/var> in var>source set/var> has the same associated a href#pixel-density-descriptor idselecting-an-image-source:pixel-density-descriptor>pixel density descriptor/a> as an earlier entry var>a/var> in var>source set/var>, then remove entry var>b/var>. Repeat this step until none of the entries in var>source set/var> have the same associated a href#pixel-density-descriptor idselecting-an-image-source:pixel-density-descriptor-2>pixel density descriptor/a> as an earlier entry.li>p>In a user agent-specific manner, choose one a href#image-source idselecting-an-image-source:image-source>image source/a> from var>source set/var>. Let this be var>selected source/var>.li>p>Return var>selected source/var> and its associated pixel density./ol> h6 idupdating-the-source-set>span classsecno>4.8.4.3.6/span> Updating the source seta href#updating-the-source-set classself-link>/a>/h6> p>When asked to dfn idupdate-the-source-set>update the source set/dfn> for a given code idupdating-the-source-set:the-img-element>a href#the-img-element>img/a>/code> element var>el/var>, user agents must do the following:/p> ol>li>p>Set var>el/var>s a href#source-set idupdating-the-source-set:source-set>source set/a> to an empty a href#source-set idupdating-the-source-set:source-set-2>source set/a>.li>p>If var>el/var> has a parent node and that is a code idupdating-the-source-set:the-picture-element>a href#the-picture-element>picture/a>/code> element, let var>elements/var> be an array containing var>el/var>s parent nodes child elements, retaining relative order. Otherwise, let var>elements/var> be array containing only var>el/var>.li>p>If var>el/var> has a code idupdating-the-source-set:attr-dim-width>a href#attr-dim-width>width/a>/code> attribute, and parsing that attributes value using the a href#rules-for-parsing-dimension-values idupdating-the-source-set:rules-for-parsing-dimension-values>rules for parsing dimension values/a> doesnt generate an error or a percentage value, then let var>width/var> be the returned integer value. Otherwise, let var>width/var> be null.li> p>Iterate through var>elements/var>, doing the following for each item var>child/var>:/p> ol>li> p>If var>child/var> is var>el/var>:/p> ol>li>p>If var>child/var> has a code idupdating-the-source-set:attr-img-srcset>a href#attr-img-srcset>srcset/a>/code> attribute, a href#parse-a-srcset-attribute idupdating-the-source-set:parse-a-srcset-attribute>parse var>child/var>s srcset attribute/a> and let the returned a href#source-set idupdating-the-source-set:source-set-3>source set/a> be var>source set/var>. Otherwise, let var>source set/var> be an empty a href#source-set idupdating-the-source-set:source-set-4>source set/a>.li>p>a href#parse-a-sizes-attribute idupdating-the-source-set:parse-a-sizes-attribute>Parse var>child/var>s sizes attribute/a> with the fallback width var>width/var>, and let var>source set/var>s a href#source-size-2 idupdating-the-source-set:source-size-2>source size/a> be the returned value.li>p>If var>child/var> has a code idupdating-the-source-set:attr-img-src>a href#attr-img-src>src/a>/code> attribute whose value is not the empty string and var>source set/var> does not contain an a href#image-source idupdating-the-source-set:image-source>image source/a> with a a href#pixel-density-descriptor idupdating-the-source-set:pixel-density-descriptor>pixel density descriptor/a> value of 1, and no a href#image-source idupdating-the-source-set:image-source-2>image source/a> with a a href#width-descriptor idupdating-the-source-set:width-descriptor>width descriptor/a>, append var>child/var>s code idupdating-the-source-set:attr-img-src-2>a href#attr-img-src>src/a>/code> attribute value to var>source set/var>.li>p>a href#normalise-the-source-densities idupdating-the-source-set:normalise-the-source-densities>Normalize the source densities/a> of var>source set/var>.li>p>Let var>el/var>s a href#source-set idupdating-the-source-set:source-set-5>source set/a> be var>source set/var>.li>p>Abort this algorithm./ol> li>p>If var>child/var> is not a code idupdating-the-source-set:the-source-element>a href#the-source-element>source/a>/code> element, continue to the next child. Otherwise, var>child/var> is a code idupdating-the-source-set:the-source-element-2>a href#the-source-element>source/a>/code> element.li>p>If var>child/var> does not have a code idupdating-the-source-set:attr-source-srcset>a href#attr-source-srcset>srcset/a>/code> attribute, continue to the next child.li>p>a href#parse-a-srcset-attribute idupdating-the-source-set:parse-a-srcset-attribute-2>Parse var>child/var>s srcset attribute/a> and let the returned a href#source-set idupdating-the-source-set:source-set-6>source set/a> be var>source set/var>.li>p>If var>source set/var> has zero a href#image-source idupdating-the-source-set:image-source-3>image sources/a>, continue to the next child.li>p>If var>child/var> has a code idupdating-the-source-set:attr-source-media>a href#attr-source-media>media/a>/code> attribute, and its value does not a href#matches-the-environment idupdating-the-source-set:matches-the-environment>match the environment/a>, continue to the next child.li>p>a href#parse-a-sizes-attribute idupdating-the-source-set:parse-a-sizes-attribute-2>Parse var>child/var>s sizes attribute/a> with the fallback width var>width/var>, and let var>source set/var>s a href#source-size-2 idupdating-the-source-set:source-size-2-2>source size/a> be the returned value.li>p>If var>child/var> has a code idupdating-the-source-set:attr-source-type>a href#attr-source-type>type/a>/code> attribute, and its value is an unknown or unsupported a idupdating-the-source-set:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a>, continue to the next child.li>p>a href#normalise-the-source-densities idupdating-the-source-set:normalise-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 idupdating-the-source-set:source-set-7>source set/a> be var>source set/var>.li>p>Abort this algorithm./ol> /ol> p classnote>Each code idupdating-the-source-set:the-img-element-2>a href#the-img-element>img/a>/code> element independently considers its previous sibling code idupdating-the-source-set:the-source-element-3>a href#the-source-element>source/a>/code> elements plus the code idupdating-the-source-set:the-img-element-3>a href#the-img-element>img/a>/code> element itself for selecting an a href#image-source idupdating-the-source-set:image-source-4>image source/a>, ignoring any other (invalid) elements, including other code idupdating-the-source-set:the-img-element-4>a href#the-img-element>img/a>/code> elements in the same code idupdating-the-source-set:the-picture-element-2>a href#the-picture-element>picture/a>/code> element, or code idupdating-the-source-set:the-source-element-4>a href#the-source-element>source/a>/code> elements that are following siblings of the relevant code idupdating-the-source-set:the-img-element-5>a href#the-img-element>img/a>/code> element./p> h6 idparsing-a-srcset-attribute>span classsecno>4.8.4.3.7/span> Parsing a srcset attributea href#parsing-a-srcset-attribute classself-link>/a>/h6> p>When asked to dfn idparse-a-srcset-attribute>parse a srcset attribute/dfn> from an element, parse the value of the elements a href#srcset-attribute idparsing-a-srcset-attribute:srcset-attribute>srcset attribute/a> as follows:/p> ol>li>p>Let var>input/var> be the value passed to this algorithm.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the start of the string.li>p>Let var>candidates/var> be an initially empty a href#source-set idparsing-a-srcset-attribute:source-set>source set/a>.li>p>i>Splitting loop/i>: a idparsing-a-srcset-attribute:collect-a-sequence-of-code-points hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idparsing-a-srcset-attribute:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> or U+002C COMMA characters from var>input/var> given var>position/var>. If any U+002C COMMA characters were collected, that is a a href#concept-microsyntax-parse-error idparsing-a-srcset-attribute:concept-microsyntax-parse-error>parse error/a>.li>p>If var>position/var> is past the end of var>input/var>, return var>candidates/var> and abort these steps.li>p>a idparsing-a-srcset-attribute:collect-a-sequence-of-code-points-2 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are not a idparsing-a-srcset-attribute:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> from var>input/var> given var>position/var>, and let that be var>url/var>.li>p>Let var>descriptors/var> be a new empty list.li> p>If var>url/var> ends with U+002C (,), then:/p> ol>li>p>Remove all trailing U+002C COMMA characters from var>url/var>. If this removed more than one character, that is a a href#concept-microsyntax-parse-error idparsing-a-srcset-attribute:concept-microsyntax-parse-error-2>parse error/a>./ol> p>Otherwise:/p> ol>li>p>i>Descriptor tokenizer/i>: a idparsing-a-srcset-attribute:skip-ascii-whitespace hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace data-x-internalskip-ascii-whitespace>Skip ASCII whitespace/a> within var>input/var> given var>position/var>.li>p>Let var>current descriptor/var> be the empty string.li>p>Let var>state/var> be i>in descriptor/i>.li> p>Let var>c/var> be the character at var>position/var>. Do the following depending on the value of var>state/var>. For the purpose of this step, EOF is a special character representing that var>position/var> is past the end of var>input/var>./p> dl classswitch>dt>i>In descriptor/i>dd> p>Do the following, depending on the value of var>c/var>:/p> dl classswitch>dt>a idparsing-a-srcset-attribute:space-characters-3 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>dd>p>If var>current descriptor/var> is not empty, append var>current descriptor/var> to var>descriptors/var> and let var>current descriptor/var> be the empty string. Set var>state/var> to i>after descriptor/i>.dt>U+002C COMMA (,)dd>p>Advance var>position/var> to the next character in var>input/var>. If var>current descriptor/var> is not empty, append var>current descriptor/var> to var>descriptors/var>. Jump to the step labeled i>descriptor parser/i>.dt>U+0028 LEFT PARENTHESIS (()dd>p>Append var>c/var> to var>current descriptor/var>. Set var>state/var> to i>in parens/i>.dt>EOFdd>p>If var>current descriptor/var> is not empty, append var>current descriptor/var> to var>descriptors/var>. Jump to the step labeled i>descriptor parser/i>.dt>Anything elsedd>p>Append var>c/var> to var>current descriptor/var>./dl> dt>i>In parens/i>dd> p>Do the following, depending on the value of var>c/var>:/p> dl classswitch>dt>U+0029 RIGHT PARENTHESIS ())dd>p>Append var>c/var> to var>current descriptor/var>. Set var>state/var> to i>in descriptor/i>.dt>EOFdd>p>Append var>current descriptor/var> to var>descriptors/var>. Jump to the step labeled i>descriptor parser/i>.dt>Anything elsedd>p>Append var>c/var> to var>current descriptor/var>./dl> dt>i>After descriptor/i>dd> p>Do the following, depending on the value of var>c/var>:/p> dl classswitch>dt>a idparsing-a-srcset-attribute:space-characters-4 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>dd>p>Stay in this state.dt>EOFdd>p>Jump to the step labeled i>descriptor parser/i>.dt>Anything elsedd>p>Set var>state/var> to i>in descriptor/i>. Set var>position/var> to the em>previous/em> character in var>input/var>./dl> /dl> p>Advance var>position/var> to the next character in var>input/var>. Repeat this step./p> p classnote>In order to be compatible with future additions, this algorithm supports multiple descriptors and descriptors with parens./p> /ol> li>p>i>Descriptor parser/i>: Let var>error/var> be i>no/i>.li>p>Let var>width/var> be i>absent/i>.li>p>Let var>density/var> be i>absent/i>.li>p>Let var>future-compat-h/var> be i>absent/i>.li> p>For each descriptor in var>descriptors/var>, run the appropriate set of steps from the following list:/p> dl classswitch>dt>If the descriptor consists of a a href#valid-non-negative-integer idparsing-a-srcset-attribute:valid-non-negative-integer>valid non-negative integer/a> followed by a U+0077 LATIN SMALL LETTER W characterdd> ol>li> p>If the user agent does not support the code idparsing-a-srcset-attribute:attr-img-sizes>a href#attr-img-sizes>sizes/a>/code> attribute, let var>error/var> be i>yes/i>./p> p classnote>A conforming user agent will support the code idparsing-a-srcset-attribute:attr-img-sizes-2>a href#attr-img-sizes>sizes/a>/code> attribute. However, user agents typically implement and ship features in an incremental manner in practice./p> li>p>If var>width/var> and var>density/var> are not both i>absent/i>, then let var>error/var> be i>yes/i>.li>p>Apply the a href#rules-for-parsing-non-negative-integers idparsing-a-srcset-attribute:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers/a> to the descriptor. If the result is zero, let var>error/var> be i>yes/i>. Otherwise, let var>width/var> be the result./ol> dt>If the descriptor consists of a a href#valid-floating-point-number idparsing-a-srcset-attribute:valid-floating-point-number>valid floating-point number/a> followed by a U+0078 LATIN SMALL LETTER X characterdd> ol>li>p>If var>width/var>, var>density/var> and var>future-compat-h/var> are not all i>absent/i>, then let var>error/var> be i>yes/i>.li> p>Apply the a href#rules-for-parsing-floating-point-number-values idparsing-a-srcset-attribute:rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values/a> to the descriptor. If the result is less than zero, let var>error/var> be i>yes/i>. Otherwise, let var>density/var> be the result./p> p classnote>If var>density/var> is zero, the a idparsing-a-srcset-attribute:intrinsic-dimensions hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic data-x-internalintrinsic-dimensions>intrinsic dimensions/a> will be infinite. User agents are expected to have limits in how big images can be rendered, which is allowed by the a href#hardwareLimitations>hardware limitations/a> clause./p> /ol> dt>If the descriptor consists of a a href#valid-non-negative-integer idparsing-a-srcset-attribute:valid-non-negative-integer-2>valid non-negative integer/a> followed by a U+0068 LATIN SMALL LETTER H characterdd> p>This is a a href#concept-microsyntax-parse-error idparsing-a-srcset-attribute:concept-microsyntax-parse-error-3>parse error/a>./p> ol>li>p>If var>future-compat-h/var> and var>density/var> are not both i>absent/i>, then let var>error/var> be i>yes/i>.li>p>Apply the a href#rules-for-parsing-non-negative-integers idparsing-a-srcset-attribute:rules-for-parsing-non-negative-integers-2>rules for parsing non-negative integers/a> to the descriptor. If the result is zero, let var>error/var> be i>yes/i>. Otherwise, let var>future-compat-h/var> be the result./ol> dt>Anything elsedd>p>Let var>error/var> be i>yes/i>./dl> li>p>If var>future-compat-h/var> is not i>absent/i> and var>width/var> is i>absent/i>, let var>error/var> be i>yes/i>.li>p>If var>error/var> is still i>no/i>, then append a new a href#image-source idparsing-a-srcset-attribute:image-source>image source/a> to var>candidates/var> whose URL is var>url/var>, associated with a width var>width/var> if not i>absent/i> and a pixel density var>density/var> if not i>absent/i>. Otherwise, there is a a href#concept-microsyntax-parse-error idparsing-a-srcset-attribute:concept-microsyntax-parse-error-4>parse error/a>.li>p>Return to the step labeled i>splitting loop/i>./ol> h6 idparsing-a-sizes-attribute>span classsecno>4.8.4.3.8/span> Parsing a sizes attributea href#parsing-a-sizes-attribute classself-link>/a>/h6> p>When asked to dfn idparse-a-sizes-attribute>parse a sizes attribute/dfn> from an element, with a fallback width var>width/var>, a idparsing-a-sizes-attribute:parse-a-comma-separated-list-of-component-values hrefhttps://drafts.csswg.org/css-syntax/#parse-a-comma-separated-list-of-component-values data-x-internalparse-a-comma-separated-list-of-component-values>parse a comma-separated list of component values/a> from the value of the elements a href#sizes-attribute idparsing-a-sizes-attribute:sizes-attribute>sizes attribute/a> (or the empty string, if the attribute is absent), and let var>unparsed sizes list/var> be the result. a href#refsCSSSYNTAX>CSSSYNTAX/a>/p> p>For each var>unparsed size/var> in var>unparsed sizes list/var>:/p> ol>li>p>Remove all consecutive a idparsing-a-sizes-attribute:whitespace-token hrefhttps://drafts.csswg.org/css-syntax/#typedef-whitespace-token data-x-internalwhitespace-token><whitespace-token>/a>s from the end of var>unparsed size/var>. If var>unparsed size/var> is now empty, that is a a href#concept-microsyntax-parse-error idparsing-a-sizes-attribute:concept-microsyntax-parse-error>parse error/a>; continue to the next iteration of this algorithm.li>p>If the last a idparsing-a-sizes-attribute:component-value hrefhttps://drafts.csswg.org/css-syntax/#component-value data-x-internalcomponent-value>component value/a> in var>unparsed size/var> is a valid non-negative a href#source-size-value idparsing-a-sizes-attribute:source-size-value><source-size-value>/a>, let var>size/var> be its value and remove the a idparsing-a-sizes-attribute:component-value-2 hrefhttps://drafts.csswg.org/css-syntax/#component-value data-x-internalcomponent-value>component value/a> from var>unparsed size/var>. Any CSS function other than the a idparsing-a-sizes-attribute:calc() hrefhttps://drafts.csswg.org/css-values/#funcdef-calc data-x-internalcalc()>calc()/a> function is invalid. Otherwise, there is a a href#concept-microsyntax-parse-error idparsing-a-sizes-attribute:concept-microsyntax-parse-error-2>parse error/a>; continue to the next iteration of this algorithm.li>p>Remove all consecutive a idparsing-a-sizes-attribute:whitespace-token-2 hrefhttps://drafts.csswg.org/css-syntax/#typedef-whitespace-token data-x-internalwhitespace-token><whitespace-token>/a>s from the end of var>unparsed size/var>. If var>unparsed size/var> is now empty, return var>size/var> and exit this algorithm. If this was not the last item in var>unparsed sizes list/var>, that is a a href#concept-microsyntax-parse-error idparsing-a-sizes-attribute:concept-microsyntax-parse-error-3>parse error/a>.li>p>Parse the remaining a hrefhttps://drafts.csswg.org/css-syntax/#component-value idparsing-a-sizes-attribute:component-value-3 data-x-internalcomponent-value>component values/a> in var>unparsed size/var> as a a idparsing-a-sizes-attribute:media-condition hrefhttps://drafts.csswg.org/mediaqueries/#typedef-media-condition data-x-internalmedia-condition><media-condition>/a>. If it does not parse correctly, or it does parse correctly but the a idparsing-a-sizes-attribute:media-condition-2 hrefhttps://drafts.csswg.org/mediaqueries/#typedef-media-condition data-x-internalmedia-condition><media-condition>/a> evaluates to false, continue to the next iteration of this algorithm. a href#refsMQ>MQ/a>li>p>Return var>size/var> and exit this algorithm./ol> p>If the above algorithm exhausts var>unparsed sizes list/var> without returning a var>size/var> value, follow these steps:/p> ol>li>p>If var>width/var> is not null, return a a idparsing-a-sizes-attribute:length hrefhttps://drafts.csswg.org/css-values/#lengths data-x-internallength><length>/a> with the value var>width/var> and the unit a idparsing-a-sizes-attribute:px hrefhttps://drafts.csswg.org/css-values/#px data-x-internalpx>px/a>.li>p>Return code>100vw/code>./ol> p classnote>While a a href#valid-source-size-list idparsing-a-sizes-attribute:valid-source-size-list>valid source size list/a> only contains a bare a href#source-size-value idparsing-a-sizes-attribute:source-size-value-2><source-size-value>/a> (without an accompanying a idparsing-a-sizes-attribute:media-condition-3 hrefhttps://drafts.csswg.org/mediaqueries/#typedef-media-condition data-x-internalmedia-condition><media-condition>/a>) as the last entry in the a href#source-size-list idparsing-a-sizes-attribute:source-size-list><source-size-list>/a>, the parsing algorithm technically allows such at any point in the list, and will accept it immediately as the size if the preceding entries in the list werent used. This is to enable future extensions, and protect against simple author errors such as a final trailing comma./p> h6 idnormalizing-the-source-densities>span classsecno>4.8.4.3.9/span> Normalizing the source densitiesa href#normalizing-the-source-densities classself-link>/a>/h6> p>An a href#image-source idnormalizing-the-source-densities:image-source>image source/a> can have a a href#pixel-density-descriptor idnormalizing-the-source-densities:pixel-density-descriptor>pixel density descriptor/a>, a a href#width-descriptor idnormalizing-the-source-densities:width-descriptor>width descriptor/a>, or no descriptor at all accompanying its URL. Normalizing a a href#source-set idnormalizing-the-source-densities:source-set>source set/a> gives every a href#image-source idnormalizing-the-source-densities:image-source-2>image source/a> a a href#pixel-density-descriptor idnormalizing-the-source-densities:pixel-density-descriptor-2>pixel density descriptor/a>./p> p>When asked to dfn idnormalise-the-source-densities>normalize the source densities/dfn> of a a href#source-set idnormalizing-the-source-densities:source-set-2>source set/a> var>source set/var>, the user agent must do the following:/p> ol>li>p>Let var>source size/var> be var>source set/var>s a href#source-size-2 idnormalizing-the-source-densities:source-size-2>source size/a>.li> p>For each a href#image-source idnormalizing-the-source-densities:image-source-3>image source/a> in var>source set/var>:/p> ol>li>p>If the a href#image-source idnormalizing-the-source-densities:image-source-4>image source/a> has a a href#pixel-density-descriptor idnormalizing-the-source-densities:pixel-density-descriptor-3>pixel density descriptor/a>, continue to the next a href#image-source idnormalizing-the-source-densities:image-source-5>image source/a>.li> p>Otherwise, if the a href#image-source idnormalizing-the-source-densities:image-source-6>image source/a> has a a href#width-descriptor idnormalizing-the-source-densities:width-descriptor-2>width descriptor/a>, replace the a href#width-descriptor idnormalizing-the-source-densities:width-descriptor-3>width descriptor/a> with a a href#pixel-density-descriptor idnormalizing-the-source-densities:pixel-density-descriptor-4>pixel density descriptor/a> with a a href#pixel-density-descriptor-value idnormalizing-the-source-densities:pixel-density-descriptor-value>value/a> of the a href#width-descriptor-value idnormalizing-the-source-densities:width-descriptor-value>width descriptor value/a> divided by the a href#source-size-2 idnormalizing-the-source-densities:source-size-2-2>source size/a> and a unit of code>x/code>./p> p classnote>If the a href#source-size-2 idnormalizing-the-source-densities:source-size-2-3>source size/a> is zero, the density would be infinity, which results in the a idnormalizing-the-source-densities:intrinsic-dimensions hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic data-x-internalintrinsic-dimensions>intrinsic dimensions/a> being zero by zero./p> li>p>Otherwise, give the a href#image-source idnormalizing-the-source-densities:image-source-7>image source/a> a a href#pixel-density-descriptor idnormalizing-the-source-densities:pixel-density-descriptor-5>pixel density descriptor/a> of code>1x/code>./ol> /ol> h6 idreacting-to-environment-changes>span classsecno>4.8.4.3.10/span> Reacting to environment changesa href#reacting-to-environment-changes classself-link>/a>/h6> p idimg-environment-changes>The user agent may at any time run the following algorithm to update an code idreacting-to-environment-changes:the-img-element>a href#the-img-element>img/a>/code> elements image in order to react to changes in the environment. (User agents are em>not required/em> to ever run this algorithm; for example, if the user is not looking at the page any more, the user agent might want to wait until the user has returned to the page before determining which image to use, in case the environment changes again in the meantime.)/p> p classnote>User agents are encouraged to run this algorithm in particular when the user changes the a idreacting-to-environment-changes:viewport hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>s size (e.g. by resizing the window or changing the page zoom), and when an code idreacting-to-environment-changes:the-img-element-2>a href#the-img-element>img/a>/code> element is a href#insert-an-element-into-a-document idreacting-to-environment-changes:insert-an-element-into-a-document>inserted into a document/a>, so that the a href#density-corrected-intrinsic-width-and-height idreacting-to-environment-changes:density-corrected-intrinsic-width-and-height>density-corrected intrinsic width and height/a> match the new a idreacting-to-environment-changes:viewport-2 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>, and so that the correct image is chosen when a href#art-direction idreacting-to-environment-changes:art-direction>art direction/a> is involved./p> ol>li>p>a href#await-a-stable-state idreacting-to-environment-changes:await-a-stable-state>Await a stable state/a>. The a href#synchronous-section idreacting-to-environment-changes:synchronous-section>synchronous section/a> consists of all the remaining steps of this algorithm until the algorithm says the a href#synchronous-section idreacting-to-environment-changes:synchronous-section-2>synchronous section/a> has ended. (Steps in a href#synchronous-section idreacting-to-environment-changes:synchronous-section-3>synchronous sections/a> are marked with ⌛.)li>p>⌛ If the code idreacting-to-environment-changes:the-img-element-3>a href#the-img-element>img/a>/code> element does not a href#use-srcset-or-picture idreacting-to-environment-changes:use-srcset-or-picture>use code>srcset/code> or code>picture/code>/a>, its a idreacting-to-environment-changes:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is not the a href#active-document idreacting-to-environment-changes:active-document>active document/a>, has image data whose resource type is code idreacting-to-environment-changes:multipart/x-mixed-replace>a href#multipart/x-mixed-replace>multipart/x-mixed-replace/a>/code>, or the a href#pending-request idreacting-to-environment-changes:pending-request>pending request/a> is not null, then abort this algorithm.li>p>⌛ Let var>selected source/var> and var>selected pixel density/var> be the URL and pixel density that results from a href#select-an-image-source idreacting-to-environment-changes:select-an-image-source>selecting an image source/a>, respectively.li>p>⌛ If var>selected source/var> is null, then abort these steps.li>p>⌛ If var>selected source/var> and var>selected pixel density/var> are the same as the elements a href#last-selected-source idreacting-to-environment-changes:last-selected-source>last selected source/a> and a href#current-pixel-density idreacting-to-environment-changes:current-pixel-density>current pixel density/a>, then abort these steps.li>p>⌛ a href#parse-a-url idreacting-to-environment-changes:parse-a-url>Parse/a> var>selected source/var>, relative to the elements a idreacting-to-environment-changes:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, and let var>urlString/var> be the a href#resulting-url-string idreacting-to-environment-changes:resulting-url-string>resulting URL string/a>. If that is not successful, abort these steps.li>p>⌛ Let var>corsAttributeState/var> be the state of the elements code idreacting-to-environment-changes:attr-img-crossorigin>a href#attr-img-crossorigin>crossorigin/a>/code> content attribute.li>p>⌛ Let var>origin/var> be the a href#concept-origin idreacting-to-environment-changes:concept-origin>origin/a> of the code idreacting-to-environment-changes:the-img-element-4>a href#the-img-element>img/a>/code> elements a idreacting-to-environment-changes:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>.li>p>⌛ Let var>client/var> be the code idreacting-to-environment-changes:the-img-element-5>a href#the-img-element>img/a>/code> elements a idreacting-to-environment-changes:node-document-4 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s code idreacting-to-environment-changes:window>a href#window>Window/a>/code> objects a href#environment-settings-object idreacting-to-environment-changes:environment-settings-object>environment settings object/a>.li>p>⌛ Let var>key/var> be a tuple consisting of var>urlString/var>, var>corsAttributeState/var>, and, if var>corsAttributeState/var> is not a href#attr-crossorigin-none idreacting-to-environment-changes:attr-crossorigin-none>No CORS/a>, var>origin/var>.li>p>⌛ Let var>image request/var> be a new a href#image-request idreacting-to-environment-changes:image-request>image request/a> whose a href#img-req-url idreacting-to-environment-changes:img-req-url>current URL/a> is var>urlString/var>li>p>⌛ Let the elements a href#pending-request idreacting-to-environment-changes:pending-request-2>pending request/a> be var>image request/var>.li>p>End the a href#synchronous-section idreacting-to-environment-changes:synchronous-section-4>synchronous section/a>, continuing the remaining steps a href#in-parallel idreacting-to-environment-changes:in-parallel>in parallel/a>.li> p>If the a href#list-of-available-images idreacting-to-environment-changes:list-of-available-images>list of available images/a> contains an entry for var>key/var>, then set var>image request/var>s a href#img-req-data idreacting-to-environment-changes:img-req-data>image data/a> to that of the entry. Continue to the next step./p> p>Otherwise:/p> ol>li>p>Let var>request/var> be the result of a href#create-a-potential-cors-request idreacting-to-environment-changes:create-a-potential-cors-request>creating a potential-CORS request/a> given var>urlString/var>, code>image/code>, and var>corsAttributeState/var>.li>p>Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-client idreacting-to-environment-changes:concept-request-client data-x-internalconcept-request-client>client/a> to var>client/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-initiator idreacting-to-environment-changes:concept-request-initiator data-x-internalconcept-request-initiator>initiator/a> to code>imageset/code>, and set var>request/var>s a idreacting-to-environment-changes:synchronous-flag hrefhttps://fetch.spec.whatwg.org/#synchronous-flag data-x-internalsynchronous-flag>synchronous flag/a>.li>p>Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-referrer-policy idreacting-to-environment-changes:concept-request-referrer-policy data-x-internalconcept-request-referrer-policy>referrer policy/a> to the current state of the elements code idreacting-to-environment-changes:attr-img-referrerpolicy>a href#attr-img-referrerpolicy>referrerpolicy/a>/code> attribute.li>p>Let var>response/var> be the result of a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idreacting-to-environment-changes:concept-fetch data-x-internalconcept-fetch>fetching/a> var>request/var>.li>p>If var>response/var>s a href#unsafe-response idreacting-to-environment-changes:unsafe-response>unsafe response/a> is a a idreacting-to-environment-changes:network-error hrefhttps://fetch.spec.whatwg.org/#concept-network-error data-x-internalnetwork-error>network error/a> or if the image format is unsupported (as determined by applying the a hrefhttps://mimesniff.spec.whatwg.org/#rules-for-sniffing-images-specifically idreacting-to-environment-changes:content-type-sniffing:-image data-x-internalcontent-type-sniffing:-image>image sniffing rules/a>, again as mentioned earlier), or if the user agent is able to determine that var>image request/var>s image is corrupted in some fatal way such that the image dimensions cannot be obtained, or if the resource type is code idreacting-to-environment-changes:multipart/x-mixed-replace-2>a href#multipart/x-mixed-replace>multipart/x-mixed-replace/a>/code>, then let a href#pending-request idreacting-to-environment-changes:pending-request-3>pending request/a> be null and abort these steps.li>p>Otherwise, var>response/var>s a href#unsafe-response idreacting-to-environment-changes:unsafe-response-2>unsafe response/a> is var>image request/var>s a href#img-req-data idreacting-to-environment-changes:img-req-data-2>image data/a>. It can be either a href#cors-same-origin idreacting-to-environment-changes:cors-same-origin>CORS-same-origin/a> or a href#cors-cross-origin idreacting-to-environment-changes:cors-cross-origin>CORS-cross-origin/a>; this affects the a href#concept-origin idreacting-to-environment-changes:concept-origin-2>origin/a> of the image itself (e.g., when used on a code idreacting-to-environment-changes:the-canvas-element>a href#the-canvas-element>canvas/a>/code>)./ol> li> p>a href#queue-a-task idreacting-to-environment-changes:queue-a-task>Queue a task/a> to run these steps:/p> ol>li>p>If the code idreacting-to-environment-changes:the-img-element-6>a href#the-img-element>img/a>/code> element has experienced a href#relevant-mutations idreacting-to-environment-changes:relevant-mutations>relevant mutations/a> since this algorithm started, then let a href#pending-request idreacting-to-environment-changes:pending-request-4>pending request/a> be null and abort these steps./p> li>p>Let the code idreacting-to-environment-changes:the-img-element-7>a href#the-img-element>img/a>/code> elements a href#last-selected-source idreacting-to-environment-changes:last-selected-source-2>last selected source/a> be var>selected source/var> and the code idreacting-to-environment-changes:the-img-element-8>a href#the-img-element>img/a>/code> elements a href#current-pixel-density idreacting-to-environment-changes:current-pixel-density-2>current pixel density/a> be var>selected pixel density/var>.li>p>Set the var>image request/var>s a href#img-req-state idreacting-to-environment-changes:img-req-state>state/a> to a href#img-all idreacting-to-environment-changes:img-all>completely available/a>.li>p>Add the image to the a href#list-of-available-images idreacting-to-environment-changes:list-of-available-images-2>list of available images/a> using the key var>key/var>, with the a href#ignore-higher-layer-caching idreacting-to-environment-changes:ignore-higher-layer-caching>ignore higher-layer caching/a> flag set.li>p>a href#upgrade-the-pending-request-to-the-current-request idreacting-to-environment-changes:upgrade-the-pending-request-to-the-current-request>Upgrade the pending request to the current request/a>.li>p>Update the code idreacting-to-environment-changes:the-img-element-9>a href#the-img-element>img/a>/code> elements presentation appropriately.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idreacting-to-environment-changes:concept-event-fire data-x-internalconcept-event-fire>Fire an event/a> named code idreacting-to-environment-changes:event-load>a href#event-load>load/a>/code> at the code idreacting-to-environment-changes:the-img-element-10>a href#the-img-element>img/a>/code> element./ol> /ol> h5 idalt>span classsecno>4.8.4.4/span> Requirements for providing text to act as an alternative for imagesa href#alt classself-link>/a>/h5> h6 idgeneral-guidelines>span classsecno>4.8.4.4.1/span> General guidelinesa href#general-guidelines classself-link>/a>/h6> p>Except where otherwise specified, the code idgeneral-guidelines:attr-img-alt>a href#attr-img-alt>alt/a>/code> attribute must be specified and its value must not be empty; the value must be an appropriate replacement for the image. The specific requirements for the code idgeneral-guidelines:attr-img-alt-2>a href#attr-img-alt>alt/a>/code> attribute depend on what the image is intended to represent, as described in the following sections./p> p>The most general rule to consider when writing alternative text is the following: strong>the intent is that replacing every image with the text of its code idgeneral-guidelines:attr-img-alt-3>a href#attr-img-alt>alt/a>/code> attribute not change the meaning of the page/strong>./p> p>So, in general, alternative text can be written by considering what one would have written had one not been able to include the image./p> p>A corollary to this is that the code idgeneral-guidelines:attr-img-alt-4>a href#attr-img-alt>alt/a>/code> attributes value should never contain text that could be considered the images em>caption/em>, em>title/em>, or em>legend/em>. It is supposed to contain replacement text that could be used by users em>instead/em> of the image; it is not meant to supplement the image. The code idgeneral-guidelines:attr-title>a href#attr-title>title/a>/code> attribute can be used for supplemental information./p> p>Another corollary is that the code idgeneral-guidelines:attr-img-alt-5>a href#attr-img-alt>alt/a>/code> attributes value should not repeat information that is already provided in the prose next to the image./p> p classnote>One way to think of alternative text is to think about how you would read the page containing the image to someone over the phone, without mentioning that there is an image present. Whatever you say instead of the image is typically a good start for writing the alternative text./p> h6 ida-link-or-button-containing-nothing-but-the-image>span classsecno>4.8.4.4.2/span> A link or button containing nothing but the imagea href#a-link-or-button-containing-nothing-but-the-image classself-link>/a>/h6> p>When an a href#the-a-element ida-link-or-button-containing-nothing-but-the-image:the-a-element>a/a> element that creates a a href#hyperlink ida-link-or-button-containing-nothing-but-the-image:hyperlink>hyperlink/a>, or a code ida-link-or-button-containing-nothing-but-the-image:the-button-element>a href#the-button-element>button/a>/code> element, has no textual content but contains one or more images, the code ida-link-or-button-containing-nothing-but-the-image:attr-img-alt>a href#attr-img-alt>alt/a>/code> attributes must contain text that together convey the purpose of the link or button./p> div classexample> p>In this example, a user is asked to pick their preferred color from a list of three. Each color is given by an image, but for users who have configured their user agent not to display images, the color names are used instead:/p> pre><h1>Pick your color</h1><ul> <li><a hrefgreen.html>strong><img srcgreen.jpeg altGreen>/strong></a></li> <li><a hrefblue.html>strong><img srcblue.jpeg altBlue>/strong></a></li> <li><a hrefred.html>strong><img srcred.jpeg altRed>/strong></a></li></ul>/pre> /div> div classexample> p>In this example, each button has a set of images to indicate the kind of color output desired by the user. The first image is used in each case to give the alternative text./p> pre><button namergb>strong><img srcred altRGB><img srcgreen alt><img srcblue alt>/strong></button><button namecmyk>strong><img srccyan altCMYK><img srcmagenta alt><img srcyellow alt><img srcblack alt>/strong></button>/pre> p>Since each image represents one part of the text, it could also be written like this:/p> pre><button namergb>strong><img srcred altR><img srcgreen altG><img srcblue altB>/strong></button><button namecmyk>strong><img srccyan altC><img srcmagenta altM><img srcyellow altY><img srcblack altK>/strong></button>/pre> p>However, with other alternative text, this might not work, and putting all the alternative text into one image in each case might make more sense:/p> pre><button namergb>strong><img srcred altsRGB profile><img srcgreen alt><img srcblue alt>/strong></button><button namecmyk>strong><img srccyan altCMYK profile><img srcmagenta alt><img srcyellow alt><img srcblack alt>/strong></button>/pre> /div> h6 ida-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations>span classsecno>4.8.4.4.3/span> A phrase or paragraph with an alternative graphical representation: charts, diagrams, graphs, maps, illustrationsa href#a-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations classself-link>/a>/h6> p>Sometimes something can be more clearly stated in graphical form, for example as a flowchart, a diagram, a graph, or a simple map showing directions. In such cases, an image can be given using the code ida-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations:the-img-element>a href#the-img-element>img/a>/code> element, but the lesser textual version must still be given, so that users who are unable to view the image (e.g. because they have a very slow connection, or because they are using a text-only browser, or because they are listening to the page being read out by a hands-free automobile voice Web browser, or simply because they are blind) are still able to understand the message being conveyed./p> p>The text must be given in the code ida-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations:attr-img-alt>a href#attr-img-alt>alt/a>/code> attribute, and must convey the same message as the image specified in the code ida-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations:attr-img-src>a href#attr-img-src>src/a>/code> attribute./p> p>It is important to realize that the alternative text is a em>replacement/em> for the image, not a description of the image./p> div classexample> p>In the following example we have a hrefimages/parsing-model-overview.svg>a flowchart/a> in image form, with text in the code ida-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations:attr-img-alt-2>a href#attr-img-alt>alt/a>/code> attribute rephrasing the flowchart in prose form:/p> pre><p>In the common case, the data handled by the tokenization stagecomes from the network, but it can also come from script.</p><p>strong><img srcimages/parsing-model-overview.svg altThe Networkpasses data to the Input Stream Preprocessor, which passes it to theTokenizer, which passes it to the Tree Construction stage. From there,data goes to both the DOM and to Script Execution. Script Execution islinked to the DOM, and, using document.write(), passes data to theTokenizer.>/strong></p>/pre> /div> div classexample> p>Heres another example, showing a good solution and a bad solution to the problem of including an image in a description./p> p>First, heres the good solution. This sample shows how the alternative text should just be what you would have put in the prose if the image had never existed./p> pre><!-- This is the correct way to do things. --><p> You are standing in an open field west of a house. strong><img srchouse.jpeg altThe house is white, with a boarded front door.>/strong> There is a small mailbox here.</p>/pre> p>Second, heres the bad solution. In this incorrect way of doing things, the alternative text is simply a description of the image, instead of a textual replacement for the image. Its bad because when the image isnt shown, the text doesnt flow as well as in the first example./p> pre classbad><!-- em>This is the wrong way to do things./em> --><p> You are standing in an open field west of a house. <img srchouse.jpeg altA white house, with a boarded front door.> There is a small mailbox here.</p>/pre> p>Text such as Photo of white house with boarded door would be equally bad alternative text (though it could be suitable for the code ida-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations:attr-title>a href#attr-title>title/a>/code> attribute or in the code ida-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 ida-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations:the-figure-element>a href#the-figure-element>figure/a>/code> with this image)./p> /div> h6 ida-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos>span classsecno>4.8.4.4.4/span> A short phrase or label with an alternative graphical representation: icons, logosa href#a-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos classself-link>/a>/h6> p>A document can contain information in iconic form. The icon is intended to help users of visual browsers to recognize features at a glance./p> p>In some cases, the icon is supplemental to a text label conveying the same meaning. In those cases, the code ida-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos:attr-img-alt>a href#attr-img-alt>alt/a>/code> attribute must be present but must be empty./p> div classexample> p>Here the icons are next to text that conveys the same meaning, so they have an empty code ida-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos:attr-img-alt-2>a href#attr-img-alt>alt/a>/code> attribute:/p> pre><nav> <p><a href/help/>strong><img src/icons/help.png alt>/strong> Help</a></p> <p><a href/configure/>strong><img src/icons/configuration.png alt>/strong> Configuration Tools</a></p></nav>/pre> /div> p>In other cases, the icon has no text next to it describing what it means; the icon is supposed to be self-explanatory. In those cases, an equivalent textual label must be given in the code ida-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos:attr-img-alt-3>a href#attr-img-alt>alt/a>/code> attribute./p> div classexample> p>Here, posts on a news site are labeled with an icon indicating their topic./p> pre><body> <article> <header> <h1>Ratatouille wins <i>Best Movie of the Year</i> award</h1> <p>strong><img srcmovies.png altMovies>/strong></p> </header> <p>Pixar has won yet another <i>Best Movie of the Year</i> award, making this its 8th win in the last 12 years.</p> </article> <article> <header> <h1>Latest TWiT episode is online</h1> <p>strong><img srcpodcasts.png altPodcasts>/strong></p> </header> <p>The latest TWiT episode has been posted, in which we hear several tech news stories as well as learning much more about the iPhone. This week, the panelists compare how reflective their iPhones Apple logos are.</p> </article></body>/pre> /div> p>Many pages include logos, insignia, flags, or emblems, which stand for a particular entity such as a company, organization, project, band, software package, country, or some such./p> p>If the logo is being used to represent the entity, e.g. as a page heading, the code ida-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos:attr-img-alt-4>a href#attr-img-alt>alt/a>/code> attribute must contain the name of the entity being represented by the logo. The code ida-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos:attr-img-alt-5>a href#attr-img-alt>alt/a>/code> attribute must em>not/em> contain text like the word logo, as it is not the fact that it is a logo that is being conveyed, its the entity itself./p> p>If the logo is being used next to the name of the entity that it represents, then the logo is supplemental, and its code ida-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos:attr-img-alt-6>a href#attr-img-alt>alt/a>/code> attribute must instead be empty./p> p>If the logo is merely used as decorative material (as branding, or, for example, as a side image in an article that mentions the entity to which the logo belongs), then the entry below on purely decorative images applies. If the logo is actually being discussed, then it is being used as a phrase or paragraph (the description of the logo) with an alternative graphical representation (the logo itself), and the first entry above applies./p> div classexample> p>In the following snippets, all four of the above cases are present. First, we see a logo used to represent a company:/p> pre><h1>strong><img srcXYZ.gif altThe XYZ company>/strong></h1>/pre> p>Next, we see a paragraph which uses a logo right next to the company name, and so doesnt have any alternative text: pre><article> <h2>News</h2> <p>We have recently been looking at buying the strong><img srcalpha.gif alt> ΑΒΓ company/strong>, a small Greek company specializing in our type of product.</p>/pre> p>In this third snippet, we have a logo being used in an aside, as part of the larger article discussing the acquisition:/p>pre> strong><aside><p><img srcalpha-large.gif alt></p></aside>/strong> <p>The ΑΒΓ company has had a good quarter, and our pie chart studies of their accounts suggest a much bigger blue slice than its green and orange slices, which is always a good sign.</p></article>/pre> p>Finally, we have an opinion piece talking about a logo, and the logo is therefore described in detail in the alternative text./p> pre><p>Consider for a moment their logo:</p>strong><p><img src/images/logo altIt consists of a green circle with agreen question mark centered inside it.></p>/strong><p>How unoriginal can you get? I mean, oooooh, a question mark, how<em>revolutionary</em>, how utterly <em>ground-breaking</em>, Imsure everyone will rush to adopt those specifications now! They couldat least have tried for some sort of, I dont know, sequence ofrounded squares with varying shades of green and bold white outlines,at least that would look good on the cover of a blue book.</p>/pre> p>This example shows how the alternative text should be written such that if the image isnt i ida-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos:img-available>a href#img-available>available/a>/i>, and the text is used instead, the text flows seamlessly into the surrounding text, as if the image had never been there in the first place./p> /div> h6 idtext-that-has-been-rendered-to-a-graphic-for-typographical-effect>span classsecno>4.8.4.4.5/span> Text that has been rendered to a graphic for typographical effecta href#text-that-has-been-rendered-to-a-graphic-for-typographical-effect classself-link>/a>/h6> p>Sometimes, an image just consists of text, and the purpose of the image is not to highlight the actual typographic effects used to render the text, but just to convey the text itself./p> p>In such cases, the code idtext-that-has-been-rendered-to-a-graphic-for-typographical-effect:attr-img-alt>a href#attr-img-alt>alt/a>/code> attribute must be present but must consist of the same text as written in the image itself./p> div classexample> p>Consider a graphic containing the text Earth Day, but with the letters all decorated with flowers and plants. If the text is merely being used as a heading, to spice up the page for graphical users, then the correct alternative text is just the same text Earth Day, and no mention need be made of the decorations:/p> pre><h1>strong><img srcearthdayheading.png altEarth Day>/strong></h1>/pre> /div> div classexample> p>An illuminated manuscript might use graphics for some of its images. The alternative text in such a situation is just the character that the image represents./p> pre><p><img srcinitials/o.svg altO>nce upon a time and a long long time ago, late atnight, when it was dark, over the hills, through the woods, across a great ocean, in a land faraway, in a small house, on a hill, under a full moon.../pre> /div> p>When an image is used to represent a character that cannot otherwise be represented in Unicode, for example gaiji, itaiji, or new characters such as novel currency symbols, the alternative text should be a more conventional way of writing the same thing, e.g. using the phonetic hiragana or katakana to give the characters pronunciation./p> div classexample> p>In this example from 1997, a new-fangled currency symbol that looks like a curly E with two bars in the middle instead of one is represented using an image. The alternative text gives the characters pronunciation./p> pre><p>Only <img srceuro.png alteuro >5.99!/pre> /div> p>An image should not be used if characters would serve an identical purpose. Only when the text cannot be directly represented using text, e.g., because of decorations or because there is no appropriate character (as in the case of gaiji), would an image be appropriate./p> p classnote>If an author is tempted to use an image because their default system font does not support a given character, then Web Fonts are a better solution than images./p> h6 ida-graphical-representation-of-some-of-the-surrounding-text>span classsecno>4.8.4.4.6/span> A graphical representation of some of the surrounding texta href#a-graphical-representation-of-some-of-the-surrounding-text classself-link>/a>/h6> p>In many cases, the image is actually just supplementary, and its presence merely reinforces the surrounding text. In these cases, the code ida-graphical-representation-of-some-of-the-surrounding-text:attr-img-alt>a href#attr-img-alt>alt/a>/code> attribute must be present but its value must be the empty string./p> p>In general, an image falls into this category if removing the image doesnt make the page any less useful, but including the image makes it a lot easier for users of visual browsers to understand the concept./p> div classexample> p>A flowchart that repeats the previous paragraph in graphical form:/p> pre><p>The Network passes data to the Input Stream Preprocessor, whichpasses it to the Tokenizer, which passes it to the Tree Constructionstage. From there, data goes to both the DOM and to Script Execution.Script Execution is linked to the DOM, and, using document.write(),passes data to the Tokenizer.</p>strong><p><img srcimages/parsing-model-overview.svg alt></p>/strong>/pre> p>In these cases, it would be wrong to include alternative text that consists of just a caption. If a caption is to be included, then either the code ida-graphical-representation-of-some-of-the-surrounding-text:attr-title>a href#attr-title>title/a>/code> attribute can be used, or the code ida-graphical-representation-of-some-of-the-surrounding-text:the-figure-element>a href#the-figure-element>figure/a>/code> and code ida-graphical-representation-of-some-of-the-surrounding-text:the-figcaption-element>a href#the-figcaption-element>figcaption/a>/code> elements can be used. In the latter case, the image would in fact be a phrase or paragraph with an alternative graphical representation, and would thus require alternative text./p> pre><!-- Using the title attribute --><p>The Network passes data to the Input Stream Preprocessor, whichpasses it to the Tokenizer, which passes it to the Tree Constructionstage. From there, data goes to both the DOM and to Script Execution.Script Execution is linked to the DOM, and, using document.write(),passes data to the Tokenizer.</p><p>strong><img srcimages/parsing-model-overview.svg alt titleFlowchart representation of the parsing model.>/strong></p>/pre> pre><!-- Using <figure> and <figcaption> --><p>The Network passes data to the Input Stream Preprocessor, whichpasses it to the Tokenizer, which passes it to the Tree Constructionstage. From there, data goes to both the DOM and to Script Execution.Script Execution is linked to the DOM, and, using document.write(),passes data to the Tokenizer.</p><figure> strong><img srcimages/parsing-model-overview.svg altThe Network leads to the Input Stream Preprocessor, which leads to the Tokenizer, which leads to the Tree Construction stage. The Tree Construction stage leads to two items. The first is Script Execution, which leads via document.write() back to the Tokenizer. The second item from which Tree Construction leads is the DOM. The DOM is related to the Script Execution.>/strong> <figcaption>Flowchart representation of the parsing model.</figcaption></figure>/pre> pre classbad><!-- This is WRONG. Do not do this. Instead, do what the above examples do. --><p>The Network passes data to the Input Stream Preprocessor, whichpasses it to the Tokenizer, which passes it to the Tree Constructionstage. From there, data goes to both the DOM and to Script Execution.Script Execution is linked to the DOM, and, using document.write(),passes data to the Tokenizer.</p><p><img srcimages/parsing-model-overview.svg altFlowchart representation of the parsing model.></p><!-- Never put the images caption in the alt attribute! -->/pre> /div> div classexample> p>A graph that repeats the previous paragraph in graphical form:/p> pre><p>According to a study covering several billion pages,about 62% of documents on the Web in 2007 triggered the Quirksrendering mode of Web browsers, about 30% triggered the AlmostStandards mode, and about 9% triggered the Standards mode.</p>strong><p><img srcrendering-mode-pie-chart.png alt></p>/strong>/pre> /div> h6 idancillary-images>span classsecno>4.8.4.4.7/span> Ancillary imagesa href#ancillary-images classself-link>/a>/h6> p>Sometimes, an image is not critical to the content, but is nonetheless neither purely decorative nor entirely redundant with the text. In these cases, the code idancillary-images:attr-img-alt>a href#attr-img-alt>alt/a>/code> attribute must be present, and its value should either be the empty string, or a textual representation of the information that the image conveys. If the image has a caption giving the images title, then the code idancillary-images:attr-img-alt-2>a href#attr-img-alt>alt/a>/code> attributes value must not be empty (as that would be quite confusing for non-visual readers)./p> div classexample> p>Consider a news article about a political figure, in which the individuals face was shown in an image that, through a style sheet, is floated to the right. The image is not purely decorative, as it is relevant to the story. The image is not entirely redundant with the story either, as it shows what the politician looks like. Whether any alternative text need be provided is an authoring decision, in part influenced by whether the image colors the interpretation of the prose./p> p>In this first variant, the image is shown without context, and no alternative text is provided:/p> pre><p>strong><img srcalexsalmond.jpeg alt>/strong> Ahead of todays referendum,the First Minister of Scotland, Alex Salmond, wrote an open letter to allregistered voters. In it, he admitted that all countries make mistakes.</p>/pre> p>If the picture is just a face, there might be no value in describing it. Its of no interest to the reader whether the individual has red hair or blond hair, whether the individual has white skin or black skin, whether the individual has one eye or two eyes./p> p>However, if the picture is more dynamic, for instance showing the politician as angry, or particularly happy, or devastated, some alternative text would be useful in setting the tone of the article, a tone that might otherwise be missed:/p> pre><p>strong><img srcalexsalmond.jpeg altAlex Salmond is sad.>/strong>Ahead of todays referendum, the First Minister of Scotland, Alex Salmond,wrote an open letter to all registered voters. In it, he admitted that allcountries make mistakes.</p>/pre> pre><p>strong><img srcalexsalmond.jpeg altAlex Salmond is ecstatic!>/strong>Ahead of todays referendum, the First Minister of Scotland, Alex Salmond,wrote an open letter to all registered voters. In it, he admitted that allcountries make mistakes.</p>/pre> p>Whether the individual was sad or ecstatic makes a difference to how the rest of the paragraph is to be interpreted: is he likely saying that he is resigned to the populace making a bad choice in the upcoming referendum, or is he saying that the election was a mistake but the likely turnout will make it irrelevant? The interpretation varies based on the image./p> /div> div classexample> p>If the image has a caption, then including alternative text avoids leaving the non-visual user confused as to what the caption refers to./p> pre><p>Ahead of todays referendum, the First Minister of Scotland, Alex Salmond,wrote an open letter to all registered voters. In it, he admitted that allcountries make mistakes.</p>strong><figure> <img srcalexsalmond.jpeg altA high forehead, cheerful disposition, and dark hair round out Alex Salmonds face.> <figcaption> Alex Salmond, SNP. Photo © 2014 PolitiPhoto. </figcaption></figure>/strong>/pre> /div> h6 ida-purely-decorative-image-that-doesnt-add-any-information>span classsecno>4.8.4.4.8/span> A purely decorative image that doesnt add any informationa href#a-purely-decorative-image-that-doesnt-add-any-information classself-link>/a>/h6> p>If an image is decorative but isnt especially page-specific — for example an image that forms part of a site-wide design scheme — the image should be specified in the sites CSS, not in the markup of the document./p> p>However, a decorative image that isnt discussed by the surrounding text but still has some relevance can be included in a page using the code ida-purely-decorative-image-that-doesnt-add-any-information:the-img-element>a href#the-img-element>img/a>/code> element. Such images are decorative, but still form part of the content. In these cases, the code ida-purely-decorative-image-that-doesnt-add-any-information:attr-img-alt>a href#attr-img-alt>alt/a>/code> attribute must be present but its value must be the empty string./p> div classexample> p>Examples where the image is purely decorative despite being relevant would include things like a photo of the Black Rock City landscape in a blog post about an event at Burning Man, or an image of a painting inspired by a poem, on a page reciting that poem. The following snippet shows an example of the latter case (only the first verse is included in this snippet):/p> pre><h1>The Lady of Shalott</h1>strong><p><img srcshalott.jpeg alt></p>/strong><p>On either side the river lie<br>Long fields of barley and of rye,<br>That clothe the wold and meet the sky;<br>And through the field the road run by<br>To many-towerd Camelot;<br>And up and down the people go,<br>Gazing where the lilies blow<br>Round an island there below,<br>The island of Shalott.</p>/pre> /div> h6 ida-group-of-images-that-form-a-single-larger-picture-with-no-links>span classsecno>4.8.4.4.9/span> A group of images that form a single larger picture with no linksa href#a-group-of-images-that-form-a-single-larger-picture-with-no-links classself-link>/a>/h6> p>When a picture has been sliced into smaller image files that are then displayed together to form the complete picture again, one of the images must have its code ida-group-of-images-that-form-a-single-larger-picture-with-no-links:attr-img-alt>a href#attr-img-alt>alt/a>/code> attribute set as per the relevant rules that would be appropriate for the picture as a whole, and then all the remaining images must have their code ida-group-of-images-that-form-a-single-larger-picture-with-no-links:attr-img-alt-2>a href#attr-img-alt>alt/a>/code> attribute set to the empty string./p> div classexample> p>In the following example, a picture representing a company logo for span>XYZ Corp/span> has been split into two pieces, the first containing the letters XYZ and the second with the word Corp. The alternative text (XYZ Corp) is all in the first image./p> pre><h1>strong><img srclogo1.png altXYZ Corp><img srclogo2.png alt>/strong></h1>/pre> /div> div classexample> p>In the following example, a rating is shown as three filled stars and two empty stars. While the alternative text could have been ★★★☆☆, the author has instead decided to more helpfully give the rating in the form 3 out of 5. That is the alternative text of the first image, and the rest have blank alternative text./p> pre><p>Rating: <meter max5 value3>strong><img src1 alt3 out of 5 ><img src1 alt><img src1 alt><img src0 alt ><img src0 alt>/strong></meter></p>/pre> /div> h6 ida-group-of-images-that-form-a-single-larger-picture-with-links>span classsecno>4.8.4.4.10/span> A group of images that form a single larger picture with linksa href#a-group-of-images-that-form-a-single-larger-picture-with-links classself-link>/a>/h6> p>Generally, a href#image-map ida-group-of-images-that-form-a-single-larger-picture-with-links:image-map>image maps/a> should be used instead of slicing an image for links./p> p>However, if an image is indeed sliced and any of the components of the sliced picture are the sole contents of links, then one image per link must have alternative text in its code ida-group-of-images-that-form-a-single-larger-picture-with-links:attr-img-alt>a href#attr-img-alt>alt/a>/code> attribute representing the purpose of the link./p> div classexample> p>In the following example, a picture representing the flying spaghetti monster emblem, with each of the left noodly appendages and the right noodly appendages in different images, so that the user can pick the left side or the right side in an adventure./p> pre><h1>The Church</h1><p>You come across a flying spaghetti monster. Which side of HisNoodliness do you wish to reach out for?</p>strong><p><a href?goleft ><img srcfsm-left.png altLeft side. ></a ><img srcfsm-middle.png alt ><a href?goright><img srcfsm-right.png altRight side.></a></p>/strong>/pre> /div> h6 ida-key-part-of-the-content>span classsecno>4.8.4.4.11/span> A key part of the contenta href#a-key-part-of-the-content classself-link>/a>/h6> p>In some cases, the image is a critical part of the content. This could be the case, for instance, on a page that is part of a photo gallery. The image is the whole em>point/em> of the page containing it./p> p>How to provide alternative text for an image that is a key part of the content depends on the images provenance./p> dl>dt>The general casedd> p>When it is possible for detailed alternative text to be provided, for example if the image is part of a series of screenshots in a magazine review, or part of a comic strip, or is a photograph in a blog entry about that photograph, text that can serve as a substitute for the image must be given as the contents of the code ida-key-part-of-the-content:attr-img-alt>a href#attr-img-alt>alt/a>/code> attribute./p> div classexample> p>A screenshot in a gallery of screenshots for a new OS, with some alternative text:/p> pre><figure> strong><img srcKDE%20Light%20desktop.png altThe desktop is blue, with icons along the left hand side in two columns, reading System, Home, K-Mail, etc. A window is open showing that menus wrap to a second line if they cannot fit in the window. The window has a list of icons along the top, with an address bar below it, a list of icons for tabs along the left edge, a status bar on the bottom, and two panes in the middle. The desktop has a bar at the bottom of the screen with a few buttons, a pager, a list of open applications, and a clock.>/strong> <figcaption>Screenshot of a KDE desktop.</figcaption></figure>/pre> /div> div classexample> p>A graph in a financial report:/p> pre>strong><img srcsales.gif titleSales graph altFrom 1998 to 2005, sales increased by the following percentages with each year: 624%, 75%, 138%, 40%, 35%, 9%, 21%>/strong>/pre> p>Note that sales graph would be inadequate alternative text for a sales graph. Text that would be a good em>caption/em> is not generally suitable as replacement text./p> /div> dt>Images that defy a complete descriptiondd> p>In certain cases, the nature of the image might be such that providing thorough alternative text is impractical. For example, the image could be indistinct, or could be a complex fractal, or could be a detailed topographical map./p> p>In these cases, the code ida-key-part-of-the-content:attr-img-alt-2>a href#attr-img-alt>alt/a>/code> attribute must contain some suitable alternative text, but it may be somewhat brief./p> div classexample> p>Sometimes there simply is no text that can do justice to an image. For example, there is little that can be said to usefully describe a Rorschach inkblot test. However, a description, even if brief, is still better than nothing:/p> pre><figure> strong><img src/commons/a/a7/Rorschach1.jpg altA shape with left-right symmetry with indistinct edges, with a small gap in the center, two larger gaps offset slightly from the center, with two similar gaps under them. The outline is wider in the top half than the bottom half, with the sides extending upwards higher than the center, and the center extending below the sides.>/strong> <figcaption>A black outline of the first of the ten cards in the Rorschach inkblot test.</figcaption></figure>/pre> p>Note that the following would be a very bad use of alternative text:/p> pre classbad><!-- This example is wrong. Do not copy it. --><figure> <img src/commons/a/a7/Rorschach1.jpg altA black outline of the first of the ten cards in the Rorschach inkblot test.> <figcaption>A black outline of the first of the ten cards in the Rorschach inkblot test.</figcaption></figure>/pre> p>Including the caption in the alternative text like this isnt useful because it effectively duplicates the caption for users who dont have images, taunting them twice yet not helping them any more than if they had only read or heard the caption once./p> /div> div classexample> p>Another example of an image that defies full description is a fractal, which, by definition, is infinite in detail./p> p>The following example shows one possible way of providing alternative text for the full view of an image of the Mandelbrot set./p> pre>strong><img srcms1.jpeg altThe Mandelbrot set appears as a cardioid withits cusp on the real axis in the positive direction, with a smallerbulb aligned along the same center line, touching it in the negativedirection, and with these two shapes being surrounded by smaller bulbsof various sizes.>/strong>/pre> /div> div classexample> p>Similarly, a photograph of a persons face, for example in a biography, can be considered quite relevant and key to the content, but it can be hard to fully substitute text for:/p> pre><section classbio> <h1>A Biography of Isaac Asimov</h1> <p>Born <b>Isaak Yudovich Ozimov</b> in 1920, Isaac was a prolific author.</p> <p><img srcheadpics/asimov.jpeg altIsaac Asimov had dark hair, a tall forehead, and wore glasses. Later in life, he wore long white sideburns.> <p>Asimov was born in Russia, and moved to the US when he was three years old.</p> <p>...</section>/pre> p>In such cases it is unnecessary (and indeed discouraged) to include a reference to the presence of the image itself in the alternative text, since such text would be redundant with the browser itself reporting the presence of the image. For example, if the alternative text was A photo of Isaac Asimov, then a conforming user agent might read that out as (Image) A photo of Isaac Asimov rather than the more useful (Image) Isaac Asimov had dark hair, a tall forehead, and wore glasses..../p> /div> dt idunknown-images>Images whose contents are not knowndd> p>In some unfortunate cases, there might be no alternative text available at all, either because the image is obtained in some automated fashion without any associated alternative text (e.g. a Webcam), or because the page is being generated by a script using user-provided images where the user did not provide suitable or usable alternative text (e.g. photograph sharing sites), or because the author does not themself know what the images represent (e.g. a blind photographer sharing an image on their blog)./p> p>In such cases, the code ida-key-part-of-the-content:attr-img-alt-3>a href#attr-img-alt>alt/a>/code> attribute may be omitted, but one of the following conditions must be met as well:/p> ul>li idfigcaption-as-alt-condition>p>The code ida-key-part-of-the-content:the-img-element>a href#the-img-element>img/a>/code> element is in a code ida-key-part-of-the-content:the-figure-element>a href#the-figure-element>figure/a>/code> element that contains a code ida-key-part-of-the-content:the-figcaption-element>a href#the-figcaption-element>figcaption/a>/code> element that contains content other than a href#inter-element-whitespace ida-key-part-of-the-content:inter-element-whitespace>inter-element whitespace/a>, and, ignoring the code ida-key-part-of-the-content:the-figcaption-element-2>a href#the-figcaption-element>figcaption/a>/code> element and its descendants, the code ida-key-part-of-the-content:the-figure-element-2>a href#the-figure-element>figure/a>/code> element has no a href#flow-content-2 ida-key-part-of-the-content:flow-content-2>flow content/a> descendants other than a href#inter-element-whitespace ida-key-part-of-the-content:inter-element-whitespace-2>inter-element whitespace/a> and the code ida-key-part-of-the-content:the-img-element-2>a href#the-img-element>img/a>/code> element.li> p>The code ida-key-part-of-the-content:attr-title>a href#attr-title>title/a>/code> attribute is present and has a non-empty value./p> p classnote>Relying on the code ida-key-part-of-the-content:attr-title-2>a href#attr-title>title/a>/code> attribute is currently discouraged as many user agents do not expose the attribute in an accessible manner as required by this specification (e.g. requiring a pointing device such as a mouse to cause a tooltip to appear, which excludes keyboard-only users and touch-only users, such as anyone with a modern phone or tablet)./p> /ul> p classnote>Such cases are to be kept to an absolute minimum. If there is even the slightest possibility of the author having the ability to provide real alternative text, then it would not be acceptable to omit the code ida-key-part-of-the-content:attr-img-alt-4>a href#attr-img-alt>alt/a>/code> attribute./p> div classexample> p>A photo on a photo-sharing site, if the site received the image with no metadata other than the caption, could be marked up as follows:/p> pre><figure> strong><img src1100670787_6a7c664aef.jpg>/strong> <figcaption>Bubbles traveled everywhere with us.</figcaption></figure>/pre> p>It would be better, however, if a detailed description of the important parts of the image obtained from the user and included on the page./p> /div> div classexample> p>A blind users blog in which a photo taken by the user is shown. Initially, the user might not have any idea what the photo they took shows:/p> pre><article> <h1>I took a photo</h1> <p>I went out today and took a photo!</p> <figure> strong><img srcphoto2.jpeg>/strong> <figcaption>A photograph taken blindly from my front porch.</figcaption> </figure></article>/pre> p>Eventually though, the user might obtain a description of the image from their friends and could then include alternative text:/p> pre><article> <h1>I took a photo</h1> <p>I went out today and took a photo!</p> <figure> strong><img srcphoto2.jpeg altThe photograph shows my squirrel feeder hanging from the edge of my roof. It is half full, but there are no squirrels around. In the background, out-of-focus trees fill the shot. The feeder is made of wood with a metal grate, and it contains peanuts. The edge of the roof is wooden too, and is painted white with light blue streaks.>/strong> <figcaption>A photograph taken blindly from my front porch.</figcaption> </figure></article>/pre> /div> div classexample> p>Sometimes the entire point of the image is that a textual description is not available, and the user is to provide the description. For instance, the point of a CAPTCHA image is to see if the user can literally read the graphic. Here is one way to mark up a CAPTCHA (note the code ida-key-part-of-the-content:attr-title-3>a href#attr-title>title/a>/code> attribute):/p> pre><p><label>What does this image say?strong><img srccaptcha.cgi?id8934 titleCAPTCHA>/strong><input typetext namecaptcha></label>(If you cannot see the image, you can use an <ahref?audio>audio</a> test instead.)</p>/pre> p>Another example would be software that displays images and asks for alternative text precisely for the purpose of then writing a page with correct alternative text. Such a page could have a table of images, like this:/p> pre><table> <thead> <tr> <th> Image <th> Description <tbody> <tr> <td> strong><img src2421.png titleImage 640 by 100, filename banner.gif>/strong> <td> <input namealt2421> <tr> <td> strong><img src2422.png titleImage 200 by 480, filename ad3.gif>/strong> <td> <input namealt2422></table>/pre> p>Notice that even in this example, as much useful information as possible is still included in the code ida-key-part-of-the-content:attr-title-4>a href#attr-title>title/a>/code> attribute./p> /div> p classnote>Since some users cannot use images at all (e.g. because they have a very slow connection, or because they are using a text-only browser, or because they are listening to the page being read out by a hands-free automobile voice Web browser, or simply because they are blind), the code ida-key-part-of-the-content:attr-img-alt-5>a href#attr-img-alt>alt/a>/code> attribute is only allowed to be omitted rather than being provided with replacement text when no alternative text is available and none can be made available, as in the above examples. Lack of effort from the part of the author is not an acceptable reason for omitting the code ida-key-part-of-the-content:attr-img-alt-6>a href#attr-img-alt>alt/a>/code> attribute./p> /dl> h6 idan-image-not-intended-for-the-user>span classsecno>4.8.4.4.12/span> An image not intended for the usera href#an-image-not-intended-for-the-user classself-link>/a>/h6> p>Generally authors should avoid using code idan-image-not-intended-for-the-user:the-img-element>a href#the-img-element>img/a>/code> elements for purposes other than showing images./p> p>If an code idan-image-not-intended-for-the-user:the-img-element-2>a href#the-img-element>img/a>/code> element is being used for purposes other than showing an image, e.g. as part of a service to count page views, then the code idan-image-not-intended-for-the-user:attr-img-alt>a href#attr-img-alt>alt/a>/code> attribute must be the empty string./p> p>In such cases, the code idan-image-not-intended-for-the-user:attr-dim-width>a href#attr-dim-width>width/a>/code> and code idan-image-not-intended-for-the-user:attr-dim-height>a href#attr-dim-height>height/a>/code> attributes should both be set to zero./p> h6 idan-image-in-an-e-mail-or-private-document-intended-for-a-specific-person-who-is-known-to-be-able-to-view-images>span classsecno>4.8.4.4.13/span> An image in an e-mail or private document intended for a specific person who is known to be able to view imagesa href#an-image-in-an-e-mail-or-private-document-intended-for-a-specific-person-who-is-known-to-be-able-to-view-images classself-link>/a>/h6> p>i>This section does not apply to documents that are publicly accessible, or whose target audience is not necessarily personally known to the author, such as documents on a Web site, e-mails sent to public mailing lists, or software documentation./i>/p> p>When an image is included in a private communication (such as an HTML e-mail) aimed at a specific person who is known to be able to view images, the code idan-image-in-an-e-mail-or-private-document-intended-for-a-specific-person-who-is-known-to-be-able-to-view-images:attr-img-alt>a href#attr-img-alt>alt/a>/code> attribute may be omitted. However, even in such cases authors are strongly urged to include alternative text (as appropriate according to the kind of image involved, as described in the above entries), so that the e-mail is still usable should the user use a mail client that does not support images, or should the document be forwarded on to other users whose abilities might not include easily seeing images./p> h6 idguidance-for-markup-generators>span classsecno>4.8.4.4.14/span> Guidance for markup generatorsa href#guidance-for-markup-generators classself-link>/a>/h6> p>Markup generators (such as WYSIWYG authoring tools) should, wherever possible, obtain alternative text from their users. However, it is recognized that in many cases, this will not be possible./p> p>For images that are the sole contents of links, markup generators should examine the link target to determine the title of the target, or the URL of the target, and use information obtained in this manner as the alternative text./p> p>For images that have captions, markup generators should use the code idguidance-for-markup-generators:the-figure-element>a href#the-figure-element>figure/a>/code> and code idguidance-for-markup-generators:the-figcaption-element>a href#the-figcaption-element>figcaption/a>/code> elements, or the code idguidance-for-markup-generators:attr-title>a href#attr-title>title/a>/code> attribute, to provide the images caption./p> p>As a last resort, implementors should either set the code idguidance-for-markup-generators:attr-img-alt>a href#attr-img-alt>alt/a>/code> attribute to the empty string, under the assumption that the image is a purely decorative image that doesnt add any information but is still specific to the surrounding content, or omit the code idguidance-for-markup-generators:attr-img-alt-2>a href#attr-img-alt>alt/a>/code> attribute altogether, under the assumption that the image is a key part of the content./p> p>Markup generators may specify a dfn idattr-img-generator-unable-to-provide-required-alt>code>generator-unable-to-provide-required-alt/code>/dfn> attribute on code idguidance-for-markup-generators:the-img-element>a href#the-img-element>img/a>/code> elements for which they have been unable to obtain alternative text and for which they have therefore omitted the code idguidance-for-markup-generators:attr-img-alt-3>a href#attr-img-alt>alt/a>/code> attribute. The value of this attribute must be the empty string. Documents containing such attributes are not conforming, but conformance checkers will a href#guidance-for-conformance-checkers>silently ignore/a> this error./p> p classnote>This is intended to avoid markup generators from being pressured into replacing the error of omitting the code idguidance-for-markup-generators:attr-img-alt-4>a href#attr-img-alt>alt/a>/code> attribute with the even more egregious error of providing phony alternative text, because state-of-the-art automated conformance checkers cannot distinguish phony alternative text from correct alternative text./p> p>Markup generators should generally avoid using the images own file name as the alternative text. Similarly, markup generators should avoid generating alternative text from any content that will be equally available to presentation user agents (e.g. Web browsers)./p> p classnote>This is because once a page is generated, it will typically not be updated, whereas the browsers that later read the page can be updated by the user, therefore the browser is likely to have more up-to-date and finely-tuned heuristics than the markup generator did when generating the page./p> h6 idguidance-for-conformance-checkers>span classsecno>4.8.4.4.15/span> Guidance for conformance checkersa href#guidance-for-conformance-checkers classself-link>/a>/h6> p>A conformance checker must report the lack of an code idguidance-for-conformance-checkers:attr-img-alt>a href#attr-img-alt>alt/a>/code> attribute as an error unless one of the conditions listed below applies:/p> ul>li>p>The code idguidance-for-conformance-checkers:the-img-element>a href#the-img-element>img/a>/code> element is in a code idguidance-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 idguidance-for-conformance-checkers:the-img-element-2>a href#the-img-element>img/a>/code> element has a code idguidance-for-conformance-checkers:attr-title>a href#attr-title>title/a>/code> attribute with a value that is not the empty string (also as a href#unknown-images>described above/a>).li>p>The conformance checker has been configured to assume that the document is an e-mail or document intended for a specific person who is known to be able to view images.li>p>The code idguidance-for-conformance-checkers:the-img-element-3>a href#the-img-element>img/a>/code> element has a (non-conforming) code idguidance-for-conformance-checkers:attr-img-generator-unable-to-provide-required-alt>a href#attr-img-generator-unable-to-provide-required-alt>generator-unable-to-provide-required-alt/a>/code> attribute whose value is the empty string. A conformance checker that is not reporting the lack of an code idguidance-for-conformance-checkers:attr-img-alt-2>a href#attr-img-alt>alt/a>/code> attribute as an error must also not report the presence of the empty code idguidance-for-conformance-checkers:attr-img-generator-unable-to-provide-required-alt-2>a href#attr-img-generator-unable-to-provide-required-alt>generator-unable-to-provide-required-alt/a>/code> attribute as an error. (This case does not represent a case where the document is conforming, only that the generator could not determine appropriate alternative text — validators are not required to show an error in this case, because such an error might encourage markup generators to include bogus alternative text purely in an attempt to silence validators. Naturally, conformance checkers em>may/em> report the lack of an code idguidance-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 idguidance-for-conformance-checkers:attr-img-generator-unable-to-provide-required-alt-3>a href#attr-img-generator-unable-to-provide-required-alt>generator-unable-to-provide-required-alt/a>/code> attribute; for example, there could be a user option to report em>all/em> conformance errors even those that might be the more or less inevitable result of using a markup generator.)/ul> h4 idthe-iframe-element data-dfn-typeelement data-ltiframe>span classsecno>4.8.5/span> The dfn>code>iframe/code>/dfn> elementa href#the-iframe-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id28773 titleNothing ever sets the "mute iframe load" flag to false>28773/a>/div> dl classelement>dt>a href#concept-element-categories idthe-iframe-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-iframe-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-iframe-element:phrasing-content-2>Phrasing content/a>.dd>a href#embedded-content-category idthe-iframe-element:embedded-content-category>Embedded content/a>.dd>a href#interactive-content-2 idthe-iframe-element:interactive-content-2>Interactive content/a>.dd>a href#palpable-content-2 idthe-iframe-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-iframe-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#embedded-content-category idthe-iframe-element:embedded-content-category-2>embedded content/a> is expected.dt>a href#concept-element-content-model idthe-iframe-element:concept-element-content-model>Content model/a>:dd>a href#concept-content-nothing idthe-iframe-element:concept-content-nothing>Nothing/a>.dt>a href#concept-element-tag-omission idthe-iframe-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-iframe-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-iframe-element:global-attributes>Global attributes/a>dd>code idthe-iframe-element:attr-iframe-src>a href#attr-iframe-src>src/a>/code> — Address of the resourcedd>code idthe-iframe-element:attr-iframe-srcdoc>a href#attr-iframe-srcdoc>srcdoc/a>/code> — A document to render in the code idthe-iframe-element:the-iframe-element>a href#the-iframe-element>iframe/a>/code>dd>code idthe-iframe-element:attr-iframe-name>a href#attr-iframe-name>name/a>/code> — Name of a href#nested-browsing-context idthe-iframe-element:nested-browsing-context>nested browsing context/a>dd>code idthe-iframe-element:attr-iframe-sandbox>a href#attr-iframe-sandbox>sandbox/a>/code> — Security rules for nested contentdd>code idthe-iframe-element:attr-iframe-allowfullscreen>a href#attr-iframe-allowfullscreen>allowfullscreen/a>/code> — Whether to allow the code idthe-iframe-element:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code>s contents to use code idthe-iframe-element:dom-element-requestfullscreen>a data-x-internaldom-element-requestfullscreen hrefhttps://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen>requestFullscreen()/a>/code>dd>code idthe-iframe-element:attr-iframe-allowpaymentrequest>a href#attr-iframe-allowpaymentrequest>allowpaymentrequest/a>/code> — Whether the code idthe-iframe-element:the-iframe-element-3>a href#the-iframe-element>iframe/a>/code>s contents are allowed to use the code idthe-iframe-element:paymentrequest>a data-x-internalpaymentrequest hrefhttps://w3c.github.io/payment-request/#dom-paymentrequest>PaymentRequest/a>/code> interface to make payment requestsdd>code idthe-iframe-element:attr-iframe-allowusermedia>a href#attr-iframe-allowusermedia>allowusermedia/a>/code> — Whether to allow the code idthe-iframe-element:the-iframe-element-4>a href#the-iframe-element>iframe/a>/code>s contents to use code idthe-iframe-element:dom-mediadevices-getusermedia>a data-x-internaldom-mediadevices-getusermedia hrefhttps://w3c.github.io/mediacapture-main/#dom-mediadevices-getusermedia>getUserMedia()/a>/code>dd>code idthe-iframe-element:attr-dim-width>a href#attr-dim-width>width/a>/code> — Horizontal dimensiondd>code idthe-iframe-element:attr-dim-height>a href#attr-dim-height>height/a>/code> — Vertical dimensiondd>code idthe-iframe-element:attr-iframe-referrerpolicy>a href#attr-iframe-referrerpolicy>referrerpolicy/a>/code> — a idthe-iframe-element:referrer-policy hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>Referrer policy/a> for a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idthe-iframe-element:concept-fetch data-x-internalconcept-fetch>fetches/a> initiated by the elementdt>a href#concept-element-dom idthe-iframe-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-iframe-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmliframeelement>HTMLIFrameElement/dfn> : a href#htmlelement idthe-iframe-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-iframe-element:cereactions>CEReactions/a> attribute USVString a href#dom-iframe-src idthe-iframe-element:dom-iframe-src>src/a>; a href#cereactions idthe-iframe-element:cereactions-2>CEReactions/a> attribute DOMString a href#dom-iframe-srcdoc idthe-iframe-element:dom-iframe-srcdoc>srcdoc/a>; a href#cereactions idthe-iframe-element:cereactions-3>CEReactions/a> attribute DOMString a href#dom-iframe-name idthe-iframe-element:dom-iframe-name>name/a>; SameObject, PutForwardsa hrefhttps://dom.spec.whatwg.org/#dom-domtokenlist-value idthe-iframe-element:dom-domtokenlist-value data-x-internaldom-domtokenlist-value>value/a> readonly attribute a idthe-iframe-element:domtokenlist hrefhttps://dom.spec.whatwg.org/#interface-domtokenlist data-x-internaldomtokenlist>DOMTokenList/a> a href#dom-iframe-sandbox idthe-iframe-element:dom-iframe-sandbox>sandbox/a>; a href#cereactions idthe-iframe-element:cereactions-4>CEReactions/a> attribute boolean a href#dom-iframe-allowfullscreen idthe-iframe-element:dom-iframe-allowfullscreen>allowFullscreen/a>; a href#cereactions idthe-iframe-element:cereactions-5>CEReactions/a> attribute boolean a href#dom-iframe-allowpaymentrequest idthe-iframe-element:dom-iframe-allowpaymentrequest>allowPaymentRequest/a>; a href#cereactions idthe-iframe-element:cereactions-6>CEReactions/a> attribute boolean a href#dom-iframe-allowusermedia idthe-iframe-element:dom-iframe-allowusermedia>allowUserMedia/a>; a href#cereactions idthe-iframe-element:cereactions-7>CEReactions/a> attribute DOMString a href#dom-dim-width idthe-iframe-element:dom-dim-width>width/a>; a href#cereactions idthe-iframe-element:cereactions-8>CEReactions/a> attribute DOMString a href#dom-dim-height idthe-iframe-element:dom-dim-height>height/a>; a href#cereactions idthe-iframe-element:cereactions-9>CEReactions/a> attribute DOMString a href#dom-iframe-referrerpolicy idthe-iframe-element:dom-iframe-referrerpolicy>referrerPolicy/a>; readonly attribute a href#document idthe-iframe-element:document>Document/a>? a href#dom-iframe-contentdocument idthe-iframe-element:dom-iframe-contentdocument>contentDocument/a>; readonly attribute a href#windowproxy idthe-iframe-element:windowproxy>WindowProxy/a>? a href#dom-iframe-contentwindow idthe-iframe-element:dom-iframe-contentwindow>contentWindow/a>; a href#document idthe-iframe-element:document-2>Document/a>? a href#dom-media-getsvgdocument idthe-iframe-element:dom-media-getsvgdocument>getSVGDocument/a>(); // a href#HTMLIFrameElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-iframe-element:the-iframe-element-5>a href#the-iframe-element>iframe/a>/code> element a href#represents idthe-iframe-element:represents>represents/a> a a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-2>nested browsing context/a>./p> p>The dfn idattr-iframe-src>code>src/code>/dfn> attribute gives the a idthe-iframe-element:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of a page that the a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-3>nested browsing context/a> is to contain. The attribute, if present, must be a a href#valid-non-empty-url-potentially-surrounded-by-spaces idthe-iframe-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces/a>. If the code idthe-iframe-element:names:-the-itemprop-attribute>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute is specified on an code idthe-iframe-element:the-iframe-element-6>a href#the-iframe-element>iframe/a>/code> element, then the code idthe-iframe-element:attr-iframe-src-2>a href#attr-iframe-src>src/a>/code> attribute must also be specified./p> p>The dfn data-dfn-foriframe idattr-iframe-srcdoc data-dfn-typeelement-attr data-export>code>srcdoc/code>/dfn> attribute gives the content of the page that the a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-4>nested browsing context/a> is to contain. The value of the attribute is the source of dfn idan-iframe-srcdoc-document data-export>an code>iframe/code> code>srcdoc/code> document/dfn>.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> iframe-srcdocspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>20+/span>/span>span classios_saf yes>span>iOS Safari/span> span>6.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>25+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>6+/span>/span>span classandroid yes>span>Android Browser/span> span>4.4+/span>/span>span classopera yes>span>Opera/span> span>15+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featiframe-srcdoc>caniuse.com/a>/div> p>The code idthe-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 idthe-iframe-element:syntax>the HTML syntax/a> that consists of the following syntactic components, in the given order:/p> ol>li>Any number of a href#syntax-comments idthe-iframe-element:syntax-comments>comments/a> and a idthe-iframe-element:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>.li>Optionally, a a href#syntax-doctype idthe-iframe-element:syntax-doctype>DOCTYPE/a>. li>Any number of a href#syntax-comments idthe-iframe-element:syntax-comments-2>comments/a> and a idthe-iframe-element:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>.li>The a idthe-iframe-element:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>, in the form of an code idthe-iframe-element:the-html-element>a href#the-html-element>html/a>/code> a href#syntax-elements idthe-iframe-element:syntax-elements>element/a>.li>Any number of a href#syntax-comments idthe-iframe-element:syntax-comments-3>comments/a> and a idthe-iframe-element:space-characters-3 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>./ol> p classnote>The above requirements apply in a idthe-iframe-element:xml-documents hrefhttps://dom.spec.whatwg.org/#xml-document data-x-internalxml-documents>XML documents/a> as well. div classexample> p>Here a blog uses the code idthe-iframe-element:attr-iframe-srcdoc-3>a href#attr-iframe-srcdoc>srcdoc/a>/code> attribute in conjunction with the code idthe-iframe-element:attr-iframe-sandbox-2>a href#attr-iframe-sandbox>sandbox/a>/code> attribute described below to provide users of user agents that support this feature with an extra layer of protection from script injection in the blog post comments:/p> pre><article> <h1>I got my own magazine!</h1> <p>After much effort, Ive finally found a publisher, and so now I have my own magazine! Isnt that awesome?! The first issue will come out in September, and we have articles about getting food, and about getting in boxes, its going to be great!</p> <footer> <p>Written by <a href/users/cap>cap</a>, 1 hour ago. </footer> <article> <footer> Thirteen minutes ago, <a href/users/ch>ch</a> wrote: </footer> <iframe sandbox srcdoc<p>did you get a cover picture yet?></iframe> </article> <article> <footer> Nine minutes ago, <a href/users/cap>cap</a> wrote: </footer> <iframe sandbox srcdoc<p>Yeah, you can see it <a href"/gallery?modecover&amp;page1">in my gallery</a>.></iframe> </article> <article> <footer> Five minutes ago, <a href/users/ch>ch</a> wrote: </footer> <iframe sandbox srcdoc<p>hey thats earls table.<p>you should get earl&amp;me on the next cover.></iframe> </article>/pre> p>Notice the way that quotes have to be escaped (otherwise the code idthe-iframe-element:attr-iframe-srcdoc-4>a href#attr-iframe-srcdoc>srcdoc/a>/code> attribute would end prematurely), and the way raw ampersands (e.g. in URLs or in prose) mentioned in the sandboxed content have to be em>doubly/em> escaped — once so that the ampersand is preserved when originally parsing the code idthe-iframe-element:attr-iframe-srcdoc-5>a href#attr-iframe-srcdoc>srcdoc/a>/code> attribute, and once more to prevent the ampersand from being misinterpreted when parsing the sandboxed content./p> p>Furthermore, notice that since the a href#syntax-doctype idthe-iframe-element:syntax-doctype-2>DOCTYPE/a> is optional in a href#an-iframe-srcdoc-document idthe-iframe-element:an-iframe-srcdoc-document>code>iframe/code> code>srcdoc/code> documents/a>, and the code idthe-iframe-element:the-html-element-2>a href#the-html-element>html/a>/code>, code idthe-iframe-element:the-head-element>a href#the-head-element>head/a>/code>, and code idthe-iframe-element:the-body-element>a href#the-body-element>body/a>/code> elements have a href#syntax-tag-omission>optional start and end tags/a>, and the code idthe-iframe-element:the-title-element>a href#the-title-element>title/a>/code> element is also optional in a href#an-iframe-srcdoc-document idthe-iframe-element:an-iframe-srcdoc-document-2>code>iframe/code> code>srcdoc/code> documents/a>, the markup in a code idthe-iframe-element:attr-iframe-srcdoc-6>a href#attr-iframe-srcdoc>srcdoc/a>/code> attribute can be relatively succinct despite representing an entire document, since only the contents of the code idthe-iframe-element:the-body-element-2>a href#the-body-element>body/a>/code> element need appear literally in the syntax. The other elements are still present, but only by implication./p> /div> p classnote>In a href#syntax idthe-iframe-element:syntax-2>the HTML syntax/a>, authors need only remember to use U+0022 QUOTATION MARK characters () to wrap the attribute contents and then to escape all U+0022 QUOTATION MARK () and U+0026 AMPERSAND (&) characters, and to specify the code idthe-iframe-element:attr-iframe-sandbox-3>a href#attr-iframe-sandbox>sandbox/a>/code> attribute, to ensure safe embedding of content./p> p classnote>In XML the U+003C LESS-THAN SIGN character (<) needs to be escaped as well. In order to prevent a hrefhttps://www.w3.org/TR/xml/#AVNormalize>attribute-value normalization/a>, some of XMLs whitespace characters — specifically U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED (LF), and U+000D CARRIAGE RETURN (CR) — also need to be escaped. a href#refsXML>XML/a>/p> p classnote>If the code idthe-iframe-element:attr-iframe-src-3>a href#attr-iframe-src>src/a>/code> attribute and the code idthe-iframe-element:attr-iframe-srcdoc-7>a href#attr-iframe-srcdoc>srcdoc/a>/code> attribute are both specified together, the code idthe-iframe-element:attr-iframe-srcdoc-8>a href#attr-iframe-srcdoc>srcdoc/a>/code> attribute takes priority. This allows authors to provide a fallback a idthe-iframe-element:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> for legacy user agents that do not support the code idthe-iframe-element:attr-iframe-srcdoc-9>a href#attr-iframe-srcdoc>srcdoc/a>/code> attribute./p> hr> p>When an code idthe-iframe-element:the-iframe-element-7>a href#the-iframe-element>iframe/a>/code> element is a href#insert-an-element-into-a-document idthe-iframe-element:insert-an-element-into-a-document>inserted into a document/a> that has a a href#concept-document-bc idthe-iframe-element:concept-document-bc>browsing context/a>, the user agent must a href#creating-a-new-browsing-context idthe-iframe-element:creating-a-new-browsing-context>create a new browsing context/a>, set the elements a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-5>nested browsing context/a> to the newly-created a href#browsing-context idthe-iframe-element:browsing-context>browsing context/a>, and then a href#process-the-iframe-attributes idthe-iframe-element:process-the-iframe-attributes>process the code>iframe/code> attributes/a> for the first time./p> p>When an code idthe-iframe-element:the-iframe-element-8>a href#the-iframe-element>iframe/a>/code> element is a href#remove-an-element-from-a-document idthe-iframe-element:remove-an-element-from-a-document>removed from a document/a>, the user agent must a href#a-browsing-context-is-discarded idthe-iframe-element:a-browsing-context-is-discarded>discard/a> the elements a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-6>nested browsing context/a>, if it is not null, and then set the elements a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-7>nested browsing context/a> to null./p> p classnote>This happens without any code idthe-iframe-element:event-unload>a href#event-unload>unload/a>/code> events firing (the a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-8>nested browsing context/a> and its code idthe-iframe-element:document-3>a href#document>Document/a>/code> are em>a href#a-browsing-context-is-discarded idthe-iframe-element:a-browsing-context-is-discarded-2>discarded/a>/em>, not em>a href#unload-a-document idthe-iframe-element:unload-a-document>unloaded/a>/em>)./p> p>Whenever an code idthe-iframe-element:the-iframe-element-9>a href#the-iframe-element>iframe/a>/code> element with a non-null a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-9>nested browsing context/a> has its code idthe-iframe-element:attr-iframe-srcdoc-10>a href#attr-iframe-srcdoc>srcdoc/a>/code> attribute set, changed, or removed, the user agent must a href#process-the-iframe-attributes idthe-iframe-element:process-the-iframe-attributes-2>process the code>iframe/code> attributes/a>./p> p>Similarly, whenever an code idthe-iframe-element:the-iframe-element-10>a href#the-iframe-element>iframe/a>/code> element with a non-null a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-10>nested browsing context/a> but with no code idthe-iframe-element:attr-iframe-srcdoc-11>a href#attr-iframe-srcdoc>srcdoc/a>/code> attribute specified has its code idthe-iframe-element:attr-iframe-src-4>a href#attr-iframe-src>src/a>/code> attribute set, changed, or removed, the user agent must a href#process-the-iframe-attributes idthe-iframe-element:process-the-iframe-attributes-3>process the code>iframe/code> attributes/a>./p> p>When the user agent is to dfn idprocess-the-iframe-attributes>process the code>iframe/code> attributes/dfn>, it must run the first appropriate steps from the following list:/p> dl classswitch>dt>If the code idthe-iframe-element:attr-iframe-srcdoc-12>a href#attr-iframe-srcdoc>srcdoc/a>/code> attribute is specifieddd> p>a href#navigate idthe-iframe-element:navigate>Navigate/a> the elements a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-11>nested browsing context/a> to a new a hrefhttps://fetch.spec.whatwg.org/#concept-response idthe-iframe-element:concept-response data-x-internalconcept-response>response/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-response-url-list idthe-iframe-element:concept-response-url-list data-x-internalconcept-response-url-list>url list/a> consists of code idthe-iframe-element:about:srcdoc>a href#about:srcdoc>about:srcdoc/a>/code>, a hrefhttps://fetch.spec.whatwg.org/#concept-response-header-list idthe-iframe-element:concept-response-header-list data-x-internalconcept-response-header-list>header list/a> consists of `code>Content-Type/code>`/`code idthe-iframe-element:text/html>a href#text/html>text/html/a>/code>, a hrefhttps://fetch.spec.whatwg.org/#concept-response-body idthe-iframe-element:concept-response-body data-x-internalconcept-response-body>body/a> is the value of the attribute, a hrefhttps://fetch.spec.whatwg.org/#concept-response-csp-list idthe-iframe-element:concept-response-csp-list data-x-internalconcept-response-csp-list>CSP list/a> is the a href#concept-document-csp-list idthe-iframe-element:concept-document-csp-list>CSP list/a> of the code idthe-iframe-element:the-iframe-element-11>a href#the-iframe-element>iframe/a>/code> elements a idthe-iframe-element:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, a hrefhttps://fetch.spec.whatwg.org/#concept-response-https-state idthe-iframe-element:concept-response-https-state data-x-internalconcept-response-https-state>HTTPS state/a> is the a href#concept-document-https-state idthe-iframe-element:concept-document-https-state>HTTPS state/a> of the code idthe-iframe-element:the-iframe-element-12>a href#the-iframe-element>iframe/a>/code> elements a idthe-iframe-element:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>. p>The resulting code idthe-iframe-element:document-4>a href#document>Document/a>/code> must be considered a href#an-iframe-srcdoc-document idthe-iframe-element:an-iframe-srcdoc-document-3>an code>iframe/code> code>srcdoc/code> document/a>./p> dt>Otherwise, if the element has no code idthe-iframe-element:attr-iframe-src-5>a href#attr-iframe-src>src/a>/code> attribute specified, and the user agent is processing the code idthe-iframe-element:the-iframe-element-13>a href#the-iframe-element>iframe/a>/code>s attributes for the first timedd> p>a href#queue-a-task idthe-iframe-element:queue-a-task>Queue a task/a> to run the a href#iframe-load-event-steps idthe-iframe-element:iframe-load-event-steps>iframe load event steps/a>./p> p>The a href#task-source idthe-iframe-element:task-source>task source/a> for this a href#concept-task idthe-iframe-element:concept-task>task/a> is the a href#dom-manipulation-task-source idthe-iframe-element:dom-manipulation-task-source>DOM manipulation task source/a>./p> dt>Otherwisedd>p>Run the a href#otherwise-steps-for-iframe-or-frame-elements idthe-iframe-element:otherwise-steps-for-iframe-or-frame-elements>otherwise steps for code>iframe/code> or code>frame/code> elements/a>./dl> p>The dfn idotherwise-steps-for-iframe-or-frame-elements>otherwise steps for code>iframe/code> or code>frame/code> elements/dfn> are as follows:/p> ol>li> p>If the element has no code idthe-iframe-element:attr-iframe-src-6>a href#attr-iframe-src>src/a>/code> attribute specified, or its value is the empty string, let var>url/var> be the a idthe-iframe-element:url-3 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> code idthe-iframe-element:about:blank>a href#about:blank>about:blank/a>/code>./p> p>Otherwise, a href#parse-a-url idthe-iframe-element:parse-a-url>parse/a> the value of the code idthe-iframe-element:attr-iframe-src-7>a href#attr-iframe-src>src/a>/code> attribute, relative to the elements a idthe-iframe-element:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>./p> p>If that is not successful, then let var>url/var> be the a idthe-iframe-element:url-4 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> code idthe-iframe-element:about:blank-2>a href#about:blank>about:blank/a>/code>. Otherwise, let var>url/var> be the a href#resulting-url-record idthe-iframe-element:resulting-url-record>resulting URL record/a>./p> li>p>If there exists an a href#ancestor-browsing-context idthe-iframe-element:ancestor-browsing-context>ancestor browsing context/a> whose a href#active-document idthe-iframe-element:active-document>active document/a>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url idthe-iframe-element:the-documents-address data-x-internalthe-documents-address>URL/a>, ignoring a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idthe-iframe-element:concept-url-fragment data-x-internalconcept-url-fragment>fragments/a>, is equal to var>url/var>, then abort these steps.li>p>Let var>resource/var> be a new a hrefhttps://fetch.spec.whatwg.org/#concept-request idthe-iframe-element:concept-request data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idthe-iframe-element:concept-request-url data-x-internalconcept-request-url>url/a> is var>url/var> and whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-referrer-policy idthe-iframe-element:concept-request-referrer-policy data-x-internalconcept-request-referrer-policy>referrer policy/a> is the current state of the elements code idthe-iframe-element:attr-iframe-referrerpolicy-2>a href#attr-iframe-referrerpolicy>referrerpolicy/a>/code> content attribute.li>p>a href#navigate idthe-iframe-element:navigate-2>Navigate/a> the elements a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-12>nested browsing context/a> to var>resource/var>./ol> p>Any a href#navigate idthe-iframe-element:navigate-3>navigation/a> required of the user agent in the a href#process-the-iframe-attributes idthe-iframe-element:process-the-iframe-attributes-4>process the code>iframe/code> attributes/a> algorithm must use the code idthe-iframe-element:the-iframe-element-14>a href#the-iframe-element>iframe/a>/code> elements a idthe-iframe-element:node-document-4 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#browsing-context idthe-iframe-element:browsing-context-2>browsing context/a> as the a href#source-browsing-context idthe-iframe-element:source-browsing-context>source browsing context/a>./p> p>Furthermore, if the a href#active-document idthe-iframe-element:active-document-2>active document/a> of the elements a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-13>nested browsing context/a> before such a a href#navigate idthe-iframe-element:navigate-4>navigation/a> was not a href#completely-loaded idthe-iframe-element:completely-loaded>completely loaded/a> at the time of the new a href#navigate idthe-iframe-element:navigate-5>navigation/a>, then the a href#navigate idthe-iframe-element:navigate-6>navigation/a> must be completed with a href#replacement-enabled idthe-iframe-element:replacement-enabled>replacement enabled/a>./p> p>Similarly, if the a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-14>nested browsing context/a>s a href#session-history idthe-iframe-element:session-history>session history/a> contained only one code idthe-iframe-element:document-5>a href#document>Document/a>/code> when the a href#process-the-iframe-attributes idthe-iframe-element:process-the-iframe-attributes-5>process the code>iframe/code> attributes/a> algorithm was invoked, and that was the code idthe-iframe-element:about:blank-3>a href#about:blank>about:blank/a>/code> code idthe-iframe-element:document-6>a href#document>Document/a>/code> created when the a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-15>nested browsing context/a> was created, then any a href#navigate idthe-iframe-element:navigate-7>navigation/a> required of the user agent in that algorithm must be completed with a href#replacement-enabled idthe-iframe-element:replacement-enabled-2>replacement enabled/a>./p> p>When a code idthe-iframe-element:document-7>a href#document>Document/a>/code> in an code idthe-iframe-element:the-iframe-element-15>a href#the-iframe-element>iframe/a>/code> is marked as a href#completely-loaded idthe-iframe-element:completely-loaded-2>completely loaded/a>, the user agent must run the a href#iframe-load-event-steps idthe-iframe-element:iframe-load-event-steps-2>iframe load event steps/a> a href#in-parallel idthe-iframe-element:in-parallel>in parallel/a>./p> p classnote>A code idthe-iframe-element:event-load>a href#event-load>load/a>/code> event is also fired at the code idthe-iframe-element:the-iframe-element-16>a href#the-iframe-element>iframe/a>/code> element when it is created if no other data is loaded in it./p> p>Each code idthe-iframe-element:document-8>a href#document>Document/a>/code> has an dfn idiframe-load-in-progress>iframe load in progress/dfn> flag and a dfn idmute-iframe-load>mute iframe load/dfn> flag. When a code idthe-iframe-element:document-9>a href#document>Document/a>/code> is created, these flags must be unset for that code idthe-iframe-element:document-10>a href#document>Document/a>/code>./p> p>The dfn idiframe-load-event-steps>iframe load event steps/dfn> are as follows:/p> ol>li>p>Let var>child document/var> be the a href#active-document idthe-iframe-element:active-document-3>active document/a> of the code idthe-iframe-element:the-iframe-element-17>a href#the-iframe-element>iframe/a>/code> elements a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-16>nested browsing context/a> (which cannot be null at this point).li>p>If var>child document/var> has its a href#mute-iframe-load idthe-iframe-element:mute-iframe-load>mute iframe load/a> flag set, abort these steps.li>p>Set var>child document/var>s a href#iframe-load-in-progress idthe-iframe-element:iframe-load-in-progress>iframe load in progress/a> flag.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-iframe-element:concept-event-fire data-x-internalconcept-event-fire>Fire an event/a> named code idthe-iframe-element:event-load-2>a href#event-load>load/a>/code> at the code idthe-iframe-element:the-iframe-element-18>a href#the-iframe-element>iframe/a>/code> element.li>p>Unset var>child document/var>s a href#iframe-load-in-progress idthe-iframe-element:iframe-load-in-progress-2>iframe load in progress/a> flag./ol> p classwarning>This, in conjunction with scripting, can be used to probe the URL space of the local networks HTTP servers. User agents may implement a href#concept-origin idthe-iframe-element:concept-origin>cross-origin/a> access control policies that are stricter than those described above to mitigate this attack, but unfortunately such policies are typically not compatible with existing Web content./p> p>When the code idthe-iframe-element:the-iframe-element-19>a href#the-iframe-element>iframe/a>/code>s a href#browsing-context idthe-iframe-element:browsing-context-3>browsing context/a>s a href#active-document idthe-iframe-element:active-document-4>active document/a> is not a href#ready-for-post-load-tasks idthe-iframe-element:ready-for-post-load-tasks>ready for post-load tasks/a>, and when anything in the code idthe-iframe-element:the-iframe-element-20>a href#the-iframe-element>iframe/a>/code> is a href#delay-the-load-event idthe-iframe-element:delay-the-load-event>delaying the load event/a> of the code idthe-iframe-element:the-iframe-element-21>a href#the-iframe-element>iframe/a>/code>s a href#browsing-context idthe-iframe-element:browsing-context-4>browsing context/a>s a href#active-document idthe-iframe-element:active-document-5>active document/a>, and when the code idthe-iframe-element:the-iframe-element-22>a href#the-iframe-element>iframe/a>/code>s a href#browsing-context idthe-iframe-element:browsing-context-5>browsing context/a> is in the a href#delaying-load-events-mode idthe-iframe-element:delaying-load-events-mode>delaying code>load/code> events mode/a>, the code idthe-iframe-element:the-iframe-element-23>a href#the-iframe-element>iframe/a>/code> must a href#delay-the-load-event idthe-iframe-element:delay-the-load-event-2>delay the load event/a> of its document./p> p classnote>If, during the handling of the code idthe-iframe-element:event-load-3>a href#event-load>load/a>/code> event, the a href#browsing-context idthe-iframe-element:browsing-context-6>browsing context/a> in the code idthe-iframe-element:the-iframe-element-24>a href#the-iframe-element>iframe/a>/code> is again a href#navigate idthe-iframe-element:navigate-8>navigated/a>, that will further a href#delay-the-load-event idthe-iframe-element:delay-the-load-event-3>delay the load event/a>./p> p classnote>If, when the element is created, the code idthe-iframe-element:attr-iframe-srcdoc-13>a href#attr-iframe-srcdoc>srcdoc/a>/code> attribute is not set, and the code idthe-iframe-element:attr-iframe-src-8>a href#attr-iframe-src>src/a>/code> attribute is either also not set or set but its value cannot be a href#parse-a-url idthe-iframe-element:parse-a-url-2>parsed/a>, the browsing context will remain at the initial code idthe-iframe-element:about:blank-4>a href#about:blank>about:blank/a>/code> page./p> p classnote>If the user a href#navigate idthe-iframe-element:navigate-9>navigates/a> away from this page, the code idthe-iframe-element:the-iframe-element-25>a href#the-iframe-element>iframe/a>/code>s corresponding code idthe-iframe-element:windowproxy-2>a href#windowproxy>WindowProxy/a>/code> object will proxy new code idthe-iframe-element:window>a href#window>Window/a>/code> objects for new code idthe-iframe-element:document-11>a href#document>Document/a>/code> objects, but the code idthe-iframe-element:attr-iframe-src-9>a href#attr-iframe-src>src/a>/code> attribute will not change./p> hr> p>The dfn idattr-iframe-name>code>name/code>/dfn> attribute, if present, must be a a href#valid-browsing-context-name idthe-iframe-element:valid-browsing-context-name>valid browsing context name/a>. The given value is used to name the a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-17>nested browsing context/a>. When the browsing context is created, if the attribute is present, the a href#browsing-context-name idthe-iframe-element:browsing-context-name>browsing context name/a> must be set to the value of this attribute; otherwise, the a href#browsing-context-name idthe-iframe-element:browsing-context-name-2>browsing context name/a> must be set to the empty string./p> p>Whenever the code idthe-iframe-element:attr-iframe-name-2>a href#attr-iframe-name>name/a>/code> attribute is set, the nested a href#browsing-context idthe-iframe-element:browsing-context-7>browsing context/a>s a href#browsing-context-name idthe-iframe-element:browsing-context-name-3>name/a> must be changed to the new value. If the attribute is removed, the a href#browsing-context-name idthe-iframe-element:browsing-context-name-4>browsing context name/a> must be set to the empty string./p> hr> p>The dfn idattr-iframe-sandbox>code>sandbox/code>/dfn> attribute, when specified, enables a set of extra restrictions on any content hosted by the code idthe-iframe-element:the-iframe-element-26>a href#the-iframe-element>iframe/a>/code>. Its value must be an a href#unordered-set-of-unique-space-separated-tokens idthe-iframe-element:unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens/a> that are a idthe-iframe-element:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a>. The allowed values are code idthe-iframe-element:attr-iframe-sandbox-allow-forms>a href#attr-iframe-sandbox-allow-forms>allow-forms/a>/code>, code idthe-iframe-element:attr-iframe-sandbox-allow-modals>a href#attr-iframe-sandbox-allow-modals>allow-modals/a>/code>, code idthe-iframe-element:attr-iframe-sandbox-allow-orientation-lock>a href#attr-iframe-sandbox-allow-orientation-lock>allow-orientation-lock/a>/code>, code idthe-iframe-element:attr-iframe-sandbox-allow-pointer-lock>a href#attr-iframe-sandbox-allow-pointer-lock>allow-pointer-lock/a>/code>, code idthe-iframe-element:attr-iframe-sandbox-allow-popups>a href#attr-iframe-sandbox-allow-popups>allow-popups/a>/code>, code idthe-iframe-element:attr-iframe-sandbox-allow-popups-to-escape-sandbox>a href#attr-iframe-sandbox-allow-popups-to-escape-sandbox>allow-popups-to-escape-sandbox/a>/code>, code idthe-iframe-element:attr-iframe-sandbox-allow-presentation>a href#attr-iframe-sandbox-allow-presentation>allow-presentation/a>/code>, code idthe-iframe-element:attr-iframe-sandbox-allow-same-origin>a href#attr-iframe-sandbox-allow-same-origin>allow-same-origin/a>/code>, code idthe-iframe-element:attr-iframe-sandbox-allow-scripts>a href#attr-iframe-sandbox-allow-scripts>allow-scripts/a>/code>, code idthe-iframe-element:attr-iframe-sandbox-allow-top-navigation>a href#attr-iframe-sandbox-allow-top-navigation>allow-top-navigation/a>/code>, and code idthe-iframe-element:attr-iframe-sandbox-allow-top-navigation-by-user-activation>a href#attr-iframe-sandbox-allow-top-navigation-by-user-activation>allow-top-navigation-by-user-activation/a>/code>.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> iframe-sandboxspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>4.2+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>28+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>5+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.2+/span>/span>span classopera yes>span>Opera/span> span>15+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featiframe-sandbox>caniuse.com/a>/div> p>When the attribute is set, the content is treated as being from a unique a href#concept-origin idthe-iframe-element:concept-origin-2>origin/a>, forms, scripts, and various potentially annoying APIs are disabled, links are prevented from targeting other a href#browsing-context idthe-iframe-element:browsing-context-8>browsing contexts/a>, and plugins are secured. The code idthe-iframe-element:attr-iframe-sandbox-allow-same-origin-2>a href#attr-iframe-sandbox-allow-same-origin>allow-same-origin/a>/code> keyword causes the content to be treated as being from its real origin instead of forcing it into a unique origin; the code idthe-iframe-element:attr-iframe-sandbox-allow-top-navigation-2>a href#attr-iframe-sandbox-allow-top-navigation>allow-top-navigation/a>/code> keyword allows the content to a href#navigate idthe-iframe-element:navigate-10>navigate/a> its a href#top-level-browsing-context idthe-iframe-element:top-level-browsing-context>top-level browsing context/a>; the code idthe-iframe-element:attr-iframe-sandbox-allow-top-navigation-by-user-activation-2>a href#attr-iframe-sandbox-allow-top-navigation-by-user-activation>allow-top-navigation-by-user-activation/a>/code> keyword behaves similarly but only allows such a href#navigate idthe-iframe-element:navigate-11>navigation/a> when a href#triggered-by-user-activation idthe-iframe-element:triggered-by-user-activation>triggered by user activation/a>; and the code idthe-iframe-element:attr-iframe-sandbox-allow-forms-2>a href#attr-iframe-sandbox-allow-forms>allow-forms/a>/code>, code idthe-iframe-element:attr-iframe-sandbox-allow-modals-2>a href#attr-iframe-sandbox-allow-modals>allow-modals/a>/code>, code idthe-iframe-element:attr-iframe-sandbox-allow-orientation-lock-2>a href#attr-iframe-sandbox-allow-orientation-lock>allow-orientation-lock/a>/code>, code idthe-iframe-element:attr-iframe-sandbox-allow-pointer-lock-2>a href#attr-iframe-sandbox-allow-pointer-lock>allow-pointer-lock/a>/code>, code idthe-iframe-element:attr-iframe-sandbox-allow-popups-2>a href#attr-iframe-sandbox-allow-popups>allow-popups/a>/code>, code idthe-iframe-element:attr-iframe-sandbox-allow-presentation-2>a href#attr-iframe-sandbox-allow-presentation>allow-presentation/a>/code>, code idthe-iframe-element:attr-iframe-sandbox-allow-scripts-2>a href#attr-iframe-sandbox-allow-scripts>allow-scripts/a>/code>, and code idthe-iframe-element:attr-iframe-sandbox-allow-popups-to-escape-sandbox-2>a href#attr-iframe-sandbox-allow-popups-to-escape-sandbox>allow-popups-to-escape-sandbox/a>/code> keywords re-enable forms, modal dialogs, screen orientation lock, the pointer lock API, popups, the presentation API, scripts, and the creation of unsandboxed a href#auxiliary-browsing-context idthe-iframe-element:auxiliary-browsing-context>auxiliary browsing contexts/a> respectively. a href#refsPOINTERLOCK>POINTERLOCK/a> a href#refsSCREENORIENTATION>SCREENORIENTATION/a> a href#refsPRESENTATION>PRESENTATION/a>/p> p>The code idthe-iframe-element:attr-iframe-sandbox-allow-top-navigation-3>a href#attr-iframe-sandbox-allow-top-navigation>allow-top-navigation/a>/code> and code idthe-iframe-element:attr-iframe-sandbox-allow-top-navigation-by-user-activation-3>a href#attr-iframe-sandbox-allow-top-navigation-by-user-activation>allow-top-navigation-by-user-activation/a>/code> keywords must not both be specified, as doing so is redundant; only code idthe-iframe-element:attr-iframe-sandbox-allow-top-navigation-4>a href#attr-iframe-sandbox-allow-top-navigation>allow-top-navigation/a>/code> will have an effect in such non-conformant markup./p> p classwarning>Setting both the code idthe-iframe-element:attr-iframe-sandbox-allow-scripts-3>a href#attr-iframe-sandbox-allow-scripts>allow-scripts/a>/code> and code idthe-iframe-element:attr-iframe-sandbox-allow-same-origin-3>a href#attr-iframe-sandbox-allow-same-origin>allow-same-origin/a>/code> keywords together when the embedded page has the a href#same-origin idthe-iframe-element:same-origin>same origin/a> as the page containing the code idthe-iframe-element:the-iframe-element-27>a href#the-iframe-element>iframe/a>/code> allows the embedded page to simply remove the code idthe-iframe-element:attr-iframe-sandbox-4>a href#attr-iframe-sandbox>sandbox/a>/code> attribute and then reload itself, effectively breaking out of the sandbox altogether./p> p classwarning>These flags only take effect when the a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-18>nested browsing context/a> of the code idthe-iframe-element:the-iframe-element-28>a href#the-iframe-element>iframe/a>/code> is a href#navigate idthe-iframe-element:navigate-12>navigated/a>. Removing them, or removing the entire code idthe-iframe-element:attr-iframe-sandbox-5>a href#attr-iframe-sandbox>sandbox/a>/code> attribute, has no effect on an already-loaded page./p> p classwarning>Potentially hostile files should not be served from the same server as the file containing the code idthe-iframe-element:the-iframe-element-29>a href#the-iframe-element>iframe/a>/code> element. Sandboxing hostile content is of minimal help if an attacker can convince the user to just visit the hostile content directly, rather than in the code idthe-iframe-element:the-iframe-element-30>a href#the-iframe-element>iframe/a>/code>. To limit the damage that can be caused by hostile HTML content, it should be served from a separate dedicated domain. Using a different domain ensures that scripts in the files are unable to attack the site, even if the user is tricked into visiting those pages directly, without the protection of the code idthe-iframe-element:attr-iframe-sandbox-6>a href#attr-iframe-sandbox>sandbox/a>/code> attribute./p> p>When an code idthe-iframe-element:the-iframe-element-31>a href#the-iframe-element>iframe/a>/code> element with a code idthe-iframe-element:attr-iframe-sandbox-7>a href#attr-iframe-sandbox>sandbox/a>/code> attribute has its a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-19>nested browsing context/a> created (before the initial code idthe-iframe-element:about:blank-5>a href#about:blank>about:blank/a>/code> code idthe-iframe-element:document-12>a href#document>Document/a>/code> is created), and when an code idthe-iframe-element:the-iframe-element-32>a href#the-iframe-element>iframe/a>/code> elements code idthe-iframe-element:attr-iframe-sandbox-8>a href#attr-iframe-sandbox>sandbox/a>/code> attribute is set or changed while it has a a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-20>nested browsing context/a>, the user agent must a href#parse-a-sandboxing-directive idthe-iframe-element:parse-a-sandboxing-directive>parse the sandboxing directive/a> using the attributes value as the var>input/var> and the code idthe-iframe-element:the-iframe-element-33>a href#the-iframe-element>iframe/a>/code> elements a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-21>nested browsing context/a>s a href#iframe-sandboxing-flag-set idthe-iframe-element:iframe-sandboxing-flag-set>code>iframe/code> sandboxing flag set/a> as the output./p> p>When an code idthe-iframe-element:the-iframe-element-34>a href#the-iframe-element>iframe/a>/code> elements code idthe-iframe-element:attr-iframe-sandbox-9>a href#attr-iframe-sandbox>sandbox/a>/code> attribute is removed while it has a non-null a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-22>nested browsing context/a>, the user agent must empty the code idthe-iframe-element:the-iframe-element-35>a href#the-iframe-element>iframe/a>/code> elements a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-23>nested browsing context/a>s a href#iframe-sandboxing-flag-set idthe-iframe-element:iframe-sandboxing-flag-set-2>code>iframe/code> sandboxing flag set/a> as the output./p> div classexample> p>In this example, some completely-unknown, potentially hostile, user-provided HTML content is embedded in a page. Because it is served from a separate domain, it is affected by all the normal cross-site restrictions. In addition, the embedded page has scripting disabled, plugins disabled, forms disabled, and it cannot navigate any frames or windows other than itself (or any frames or windows it itself embeds)./p> pre><p>Were not scared of you! Here is your content, unedited:</p><iframe sandbox srchttps://usercontent.example.net/getusercontent.cgi?id12193></iframe>/pre> p classwarning>It is important to use a separate domain so that if the attacker convinces the user to visit that page directly, the page doesnt run in the context of the sites origin, which would make the user vulnerable to any attack found in the page./p> /div> div classexample> p>In this example, a gadget from another site is embedded. The gadget has scripting and forms enabled, and the origin sandbox restrictions are lifted, allowing the gadget to communicate with its originating server. The sandbox is still useful, however, as it disables plugins and popups, thus reducing the risk of the user being exposed to malware and other annoyances./p> pre><iframe sandboxallow-same-origin allow-forms allow-scripts srchttps://maps.example.com/embedded.html></iframe>/pre> /div> div classexample> p>Suppose a file A contained the following fragment:/p> pre><iframe sandboxallow-same-origin allow-forms srcB></iframe>/pre> p>Suppose that file B contained an iframe also:/p> pre><iframe sandboxallow-scripts srcC></iframe>/pre> p>Further, suppose that file C contained a link:/p> pre><a hrefD>Link</a>/pre> p>For this example, suppose all the files were served as code idthe-iframe-element:text/html-2>a href#text/html>text/html/a>/code>./p> p>Page C in this scenario has all the sandboxing flags set. Scripts are disabled, because the code idthe-iframe-element:the-iframe-element-36>a href#the-iframe-element>iframe/a>/code> in A has scripts disabled, and this overrides the code idthe-iframe-element:attr-iframe-sandbox-allow-scripts-4>a href#attr-iframe-sandbox-allow-scripts>allow-scripts/a>/code> keyword set on the code idthe-iframe-element:the-iframe-element-37>a href#the-iframe-element>iframe/a>/code> in B. Forms are also disabled, because the inner code idthe-iframe-element:the-iframe-element-38>a href#the-iframe-element>iframe/a>/code> (in B) does not have the code idthe-iframe-element:attr-iframe-sandbox-allow-forms-3>a href#attr-iframe-sandbox-allow-forms>allow-forms/a>/code> keyword set./p> p>Suppose now that a script in A removes all the code idthe-iframe-element:attr-iframe-sandbox-10>a href#attr-iframe-sandbox>sandbox/a>/code> attributes in A and B. This would change nothing immediately. If the user clicked the link in C, loading page D into the code idthe-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 idthe-iframe-element:the-iframe-element-40>a href#the-iframe-element>iframe/a>/code> in B had the code idthe-iframe-element:attr-iframe-sandbox-allow-same-origin-4>a href#attr-iframe-sandbox-allow-same-origin>allow-same-origin/a>/code> and code idthe-iframe-element:attr-iframe-sandbox-allow-forms-4>a href#attr-iframe-sandbox-allow-forms>allow-forms/a>/code> keywords set, because that was the state of the a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-24>nested browsing context/a> in the code idthe-iframe-element:the-iframe-element-41>a href#the-iframe-element>iframe/a>/code> in A when page B was loaded./p> p>Generally speaking, dynamically removing or changing the code idthe-iframe-element:attr-iframe-sandbox-11>a href#attr-iframe-sandbox>sandbox/a>/code> attribute is ill-advised, because it can make it quite hard to reason about what will be allowed and what will not./p> /div> hr> p>The dfn idattr-iframe-allowfullscreen>code>allowfullscreen/code>/dfn> attribute is a a href#boolean-attribute idthe-iframe-element:boolean-attribute>boolean attribute/a>. When specified, it indicates that code idthe-iframe-element:document-13>a href#document>Document/a>/code> objects in the code idthe-iframe-element:the-iframe-element-42>a href#the-iframe-element>iframe/a>/code> elements a href#browsing-context idthe-iframe-element:browsing-context-9>browsing context/a> are to be allowed to use code idthe-iframe-element:dom-element-requestfullscreen-2>a data-x-internaldom-element-requestfullscreen hrefhttps://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen>requestFullscreen()/a>/code> (if its not blocked for other reasons, e.g. there is another ancestor code idthe-iframe-element:the-iframe-element-43>a href#the-iframe-element>iframe/a>/code> without this attribute set)./p> div classexample> p>Here, an code idthe-iframe-element:the-iframe-element-44>a href#the-iframe-element>iframe/a>/code> is used to embed a player from a video site. The code idthe-iframe-element:attr-iframe-allowfullscreen-2>a href#attr-iframe-allowfullscreen>allowfullscreen/a>/code> attribute is needed to enable the player to show its video fullscreen./p> pre><article> <header> <p><img src/usericons/1627591962735> <b>Fred Flintstone</b></p> <p><a href/posts/3095182851 relbookmark>12:44</a> — <a href#acl-3095182851>Private Post</a></p> </header> <main> <p>Check out my new ride!</p> strong><iframe srchttps://video.example.com/embed?id92469812 allowfullscreen></iframe>/strong> </main></article>/pre> /div> p>The dfn idattr-iframe-allowpaymentrequest>code>allowpaymentrequest/code>/dfn> attribute is a a href#boolean-attribute idthe-iframe-element:boolean-attribute-2>boolean attribute/a>. When specified, it indicates that code idthe-iframe-element:document-14>a href#document>Document/a>/code> objects in the code idthe-iframe-element:the-iframe-element-45>a href#the-iframe-element>iframe/a>/code> elements a href#browsing-context idthe-iframe-element:browsing-context-10>browsing context/a> are to be allowed to use the code idthe-iframe-element:paymentrequest-2>a data-x-internalpaymentrequest hrefhttps://w3c.github.io/payment-request/#dom-paymentrequest>PaymentRequest/a>/code> interface to make payment requests./p> p>The dfn idattr-iframe-allowusermedia>code>allowusermedia/code>/dfn> attribute is a a href#boolean-attribute idthe-iframe-element:boolean-attribute-3>boolean attribute/a>. When specified, it indicates that code idthe-iframe-element:document-15>a href#document>Document/a>/code> objects in the code idthe-iframe-element:the-iframe-element-46>a href#the-iframe-element>iframe/a>/code> elements a href#browsing-context idthe-iframe-element:browsing-context-11>browsing context/a> are to be allowed to use code idthe-iframe-element:dom-mediadevices-getusermedia-2>a data-x-internaldom-mediadevices-getusermedia hrefhttps://w3c.github.io/mediacapture-main/#dom-mediadevices-getusermedia>getUserMedia()/a>/code> (if its not blocked for other reasons, e.g. there is another ancestor code idthe-iframe-element:the-iframe-element-47>a href#the-iframe-element>iframe/a>/code> without this attribute set)./p> p idfullscreen-logic>To determine whether a code idthe-iframe-element:document-16>a href#document>Document/a>/code> object var>document/var> is dfn idallowed-to-use data-export>allowed to use/dfn> the feature indicated by attribute name var>allowattribute/var>, run these steps:/p> ol>li>p>If var>document/var> has no a href#concept-document-bc idthe-iframe-element:concept-document-bc-2>browsing context/a>, then return false.li>p>If var>document/var>s a href#concept-document-bc idthe-iframe-element:concept-document-bc-3>browsing context/a>s a href#active-document idthe-iframe-element:active-document-6>active document/a> is not var>document/var>, then return false.li>p>If var>document/var>s a href#concept-document-bc idthe-iframe-element:concept-document-bc-4>browsing context/a> is a a href#top-level-browsing-context idthe-iframe-element:top-level-browsing-context-2>top-level browsing context/a>, then return true.li> p>If var>allowattribute/var> is code idthe-iframe-element:attr-iframe-allowfullscreen-3>a href#attr-iframe-allowfullscreen>allowfullscreen/a>/code>, then:/p> ol>li>p>If var>document/var>s a href#concept-document-bc idthe-iframe-element:concept-document-bc-5>browsing context/a> has a a href#browsing-context-container idthe-iframe-element:browsing-context-container>browsing context container/a> that is an code idthe-iframe-element:the-iframe-element-48>a href#the-iframe-element>iframe/a>/code> element with an var>allowattribute/var> attribute specified, and whose a idthe-iframe-element:node-document-5 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is a href#allowed-to-use idthe-iframe-element:allowed-to-use>allowed to use/a> the feature indicated by var>allowattribute/var>, then return true./ol> p classbig-issue>This step is legacy behavior for the code idthe-iframe-element:attr-iframe-allowfullscreen-4>a href#attr-iframe-allowfullscreen>allowfullscreen/a>/code> attribute that should not be used for new features. If possible this will be removed, see a hrefhttps://github.com/whatwg/html/issues/2143#issuecomment-265514585>issue 2143/a>./p> li> p>Otherwise:/p> ol>li>p>If var>document/var> has the var>var>allowattribute/var> flag/var> set, and var>document/var>s a href#concept-document-bc idthe-iframe-element:concept-document-bc-6>browsing context/a> has a a href#browsing-context-container idthe-iframe-element:browsing-context-container-2>browsing context container/a> that is an code idthe-iframe-element:the-iframe-element-49>a href#the-iframe-element>iframe/a>/code> element whose a idthe-iframe-element:node-document-6 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is a href#allowed-to-use idthe-iframe-element:allowed-to-use-2>allowed to use/a> the feature indicated by var>allowattribute/var>, then return true./ol> li>p>Return false./ol> p>To dfn idset-the-allow*-flags>set the allow* flags/dfn> for a code idthe-iframe-element:document-17>a href#document>Document/a>/code> var>document/var> means to run these steps:/p> ol>li> p>If var>document/var>s a href#concept-document-bc idthe-iframe-element:concept-document-bc-7>browsing context/a> has a a href#browsing-context-container idthe-iframe-element:browsing-context-container-3>browsing context container/a> whose a idthe-iframe-element:node-document-7 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#concept-origin idthe-iframe-element:concept-origin-3>origin/a> is a href#same-origin-domain idthe-iframe-element:same-origin-domain>same origin-domain/a> with var>document/var>s a href#concept-origin idthe-iframe-element:concept-origin-4>origin/a>, then set the var>allowpaymentrequest flag/var> and the var>allowusermedia flag/var> on var>document/var>, and abort these steps./p> p classnote>If code idthe-iframe-element:dom-document-domain>a href#dom-document-domain>document.domain/a>/code> has been used for the a href#browsing-context-container idthe-iframe-element:browsing-context-container-4>browsing context container/a>s a idthe-iframe-element:node-document-8 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, then its a href#concept-origin idthe-iframe-element:concept-origin-5>origin/a> cannot be a href#same-origin-domain idthe-iframe-element:same-origin-domain-2>same origin-domain/a> with var>document/var>s a href#concept-origin idthe-iframe-element:concept-origin-6>origin/a>, because these steps run when var>document/var> is initialized so it cannot itself yet have used code idthe-iframe-element:dom-document-domain-2>a href#dom-document-domain>document.domain/a>/code>. Note that this is less permissive compared to doing a a href#same-origin idthe-iframe-element:same-origin-2>same origin/a> check instead./p> div classexample> p>In this example, the child document is not allowed to use code idthe-iframe-element:paymentrequest-3>a data-x-internalpaymentrequest hrefhttps://w3c.github.io/payment-request/#dom-paymentrequest>PaymentRequest/a>/code>, despite being a href#same-origin-domain idthe-iframe-element:same-origin-domain-3>same origin-domain/a> at the time the child document tries to use it. At the time the child document is initialized, only the parent document has set code idthe-iframe-element:dom-document-domain-3>a href#dom-document-domain>document.domain/a>/code>, and the child document has not./p> pre><!-- https://foo.example.com/a.html --><!doctype html><script> document.domain example.com;</script><iframe srcb.html></iframe>/pre> pre><!-- https://bar.example.com/b.html --><!doctype html><script> document.domain example.com; // This happens after the document is initialized new PaymentRequest(…); // Not allowed to use</script>/pre> /div> div classexample> p>In this example, the child document em>is/em> allowed to use code idthe-iframe-element:paymentrequest-4>a data-x-internalpaymentrequest hrefhttps://w3c.github.io/payment-request/#dom-paymentrequest>PaymentRequest/a>/code>, despite not being a href#same-origin-domain idthe-iframe-element:same-origin-domain-4>same origin-domain/a> at the time the child document tries to use it. At the time the child document is initialized, none of the documents have set code idthe-iframe-element:dom-document-domain-4>a href#dom-document-domain>document.domain/a>/code> yet so a href#same-origin-domain idthe-iframe-element:same-origin-domain-5>same origin-domain/a> falls back to a normal a href#same-origin idthe-iframe-element:same-origin-3>same origin/a> check./p> pre><!-- https://example.com/a.html --><!doctype html><iframe srcb.html></iframe><!-- The child document is now initialized, before the script below is run. --><script> document.domain example.com;</script>/pre> pre><!-- https://example.com/b.html --><!doctype html><script> new PaymentRequest(…); // Allowed to use</script>/pre> /div> li>p>If var>document/var>s a href#concept-document-bc idthe-iframe-element:concept-document-bc-8>browsing context/a> has a a href#browsing-context-container idthe-iframe-element:browsing-context-container-5>browsing context container/a> that is an code idthe-iframe-element:the-iframe-element-50>a href#the-iframe-element>iframe/a>/code> element, let var>iframe/var> be that element. Otherwise, abort these steps.li>p>If var>iframe/var> has an code idthe-iframe-element:attr-iframe-allowpaymentrequest-2>a href#attr-iframe-allowpaymentrequest>allowpaymentrequest/a>/code> attribute specified, then set the var>allowpaymentrequest flag/var> on var>document/var>.li>p>If var>iframe/var> has an code idthe-iframe-element:attr-iframe-allowusermedia-2>a href#attr-iframe-allowusermedia>allowusermedia/a>/code> attribute specified, then set the var>allowusermedia flag/var> on var>document/var>./ol> hr> p>The code idthe-iframe-element:the-iframe-element-51>a href#the-iframe-element>iframe/a>/code> element supports a href#dimension-attributes idthe-iframe-element:dimension-attributes>dimension attributes/a> for cases where the embedded content has specific dimensions (e.g. ad units have well-defined dimensions)./p> p>An code idthe-iframe-element:the-iframe-element-52>a href#the-iframe-element>iframe/a>/code> element never has a href#fallback-content idthe-iframe-element:fallback-content>fallback content/a>, as it will always a href#creating-a-new-browsing-context idthe-iframe-element:creating-a-new-browsing-context-2>create/a> a nested a href#browsing-context idthe-iframe-element:browsing-context-12>browsing context/a>, regardless of whether the specified initial contents are successfully used./p> hr> p>The dfn idattr-iframe-referrerpolicy>code>referrerpolicy/code>/dfn> attribute is a a href#referrer-policy-attribute idthe-iframe-element:referrer-policy-attribute>referrer policy attribute/a>. Its purpose is to set the a idthe-iframe-element:referrer-policy-2 hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>referrer policy/a> used when a href#process-the-iframe-attributes idthe-iframe-element:process-the-iframe-attributes-6>processing the code>iframe/code> attributes/a>. a href#refsREFERRERPOLICY>REFERRERPOLICY/a>/p> hr> p>Descendants of code idthe-iframe-element:the-iframe-element-53>a href#the-iframe-element>iframe/a>/code> elements represent nothing. (In legacy user agents that do not support code idthe-iframe-element:the-iframe-element-54>a href#the-iframe-element>iframe/a>/code> elements, the contents would be parsed as markup that could act as fallback content.)/p> p classnote>The a href#html-parser idthe-iframe-element:html-parser>HTML parser/a> treats markup inside code idthe-iframe-element:the-iframe-element-55>a href#the-iframe-element>iframe/a>/code> elements as text./p> hr> p>The IDL attributes dfn iddom-iframe-src>code>src/code>/dfn>, dfn iddom-iframe-srcdoc>code>srcdoc/code>/dfn>, dfn iddom-iframe-name>code>name/code>/dfn>,and dfn iddom-iframe-sandbox>code>sandbox/code>/dfn> must a href#reflect idthe-iframe-element:reflect>reflect/a> the respective content attributes of the same name./p> p>The a hrefhttps://dom.spec.whatwg.org/#concept-supported-tokens idthe-iframe-element:concept-supported-tokens data-x-internalconcept-supported-tokens>supported tokens/a> for code idthe-iframe-element:dom-iframe-sandbox-2>a href#dom-iframe-sandbox>sandbox/a>/code>s code idthe-iframe-element:domtokenlist-2>a data-x-internaldomtokenlist hrefhttps://dom.spec.whatwg.org/#interface-domtokenlist>DOMTokenList/a>/code> are the allowed values defined in the code idthe-iframe-element:attr-iframe-sandbox-12>a href#attr-iframe-sandbox>sandbox/a>/code> attribute and supported by the user agent./p> p>The dfn iddom-iframe-allowfullscreen>code>allowFullscreen/code>/dfn> IDL attribute must a href#reflect idthe-iframe-element:reflect-2>reflect/a> the code idthe-iframe-element:attr-iframe-allowfullscreen-5>a href#attr-iframe-allowfullscreen>allowfullscreen/a>/code> content attribute./p> p>The dfn iddom-iframe-allowpaymentrequest>code>allowPaymentRequest/code>/dfn> IDL attribute must a href#reflect idthe-iframe-element:reflect-3>reflect/a> the code idthe-iframe-element:attr-iframe-allowpaymentrequest-3>a href#attr-iframe-allowpaymentrequest>allowpaymentrequest/a>/code> content attribute./p> p>The dfn iddom-iframe-allowusermedia>code>allowUserMedia/code>/dfn> IDL attribute must a href#reflect idthe-iframe-element:reflect-4>reflect/a> the code idthe-iframe-element:attr-iframe-allowusermedia-3>a href#attr-iframe-allowusermedia>allowusermedia/a>/code> content attribute./p> p>The dfn iddom-iframe-referrerpolicy>code>referrerPolicy/code>/dfn> IDL attribute must a href#reflect idthe-iframe-element:reflect-5>reflect/a> the code idthe-iframe-element:attr-iframe-referrerpolicy-3>a href#attr-iframe-referrerpolicy>referrerpolicy/a>/code> content attribute, a href#limited-to-only-known-values idthe-iframe-element:limited-to-only-known-values>limited to only known values/a>./p> p>The dfn iddom-iframe-contentdocument>code>contentDocument/code>/dfn> IDL attribute, on getting, must return the code idthe-iframe-element:the-iframe-element-56>a href#the-iframe-element>iframe/a>/code> elements a href#concept-bcc-content-document idthe-iframe-element:concept-bcc-content-document>content document/a>./p> p>The dfn iddom-iframe-contentwindow>code>contentWindow/code>/dfn> IDL attribute must return the code idthe-iframe-element:windowproxy-3>a href#windowproxy>WindowProxy/a>/code> object of the code idthe-iframe-element:the-iframe-element-57>a href#the-iframe-element>iframe/a>/code> elements a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-25>nested browsing context/a>, if its a href#nested-browsing-context idthe-iframe-element:nested-browsing-context-26>nested browsing context/a> is non-null, or null otherwise./p> div classexample> p>Here is an example of a page using an code idthe-iframe-element:the-iframe-element-58>a href#the-iframe-element>iframe/a>/code> to include advertising from an advertising broker:/p> pre><iframe srchttps://ads.example.com/?customerid923513721&formatbanner width468 height60></iframe>/pre> /div> h4 idthe-embed-element data-dfn-typeelement data-ltembed>span classsecno>4.8.6/span> The dfn>code>embed/code>/dfn> elementa href#the-embed-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-embed-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-embed-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-embed-element:phrasing-content-2>Phrasing content/a>.dd>a href#embedded-content-category idthe-embed-element:embedded-content-category>Embedded content/a>.dd>a href#interactive-content-2 idthe-embed-element:interactive-content-2>Interactive content/a>.dd>a href#palpable-content-2 idthe-embed-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-embed-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#embedded-content-category idthe-embed-element:embedded-content-category-2>embedded content/a> is expected.dt>a href#concept-element-content-model idthe-embed-element:concept-element-content-model>Content model/a>:dd>a href#concept-content-nothing idthe-embed-element:concept-content-nothing>Nothing/a>.dt>a href#concept-element-tag-omission idthe-embed-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>No a href#syntax-end-tag idthe-embed-element:syntax-end-tag>end tag/a>.dt>a href#concept-element-attributes idthe-embed-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-embed-element:global-attributes>Global attributes/a>dd>code idthe-embed-element:attr-embed-src>a href#attr-embed-src>src/a>/code> — Address of the resourcedd>code idthe-embed-element:attr-embed-type>a href#attr-embed-type>type/a>/code> — Type of embedded resourcedd>code idthe-embed-element:attr-dim-width>a href#attr-dim-width>width/a>/code> — Horizontal dimensiondd>code idthe-embed-element:attr-dim-height>a href#attr-dim-height>height/a>/code> — Vertical dimensiondd>Any other attribute that has no namespace (see prose).dt>a href#concept-element-dom idthe-embed-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-embed-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlembedelement>HTMLEmbedElement/dfn> : a href#htmlelement idthe-embed-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-embed-element:cereactions>CEReactions/a> attribute USVString a href#dom-embed-src idthe-embed-element:dom-embed-src>src/a>; a href#cereactions idthe-embed-element:cereactions-2>CEReactions/a> attribute DOMString a href#dom-embed-type idthe-embed-element:dom-embed-type>type/a>; a href#cereactions idthe-embed-element:cereactions-3>CEReactions/a> attribute DOMString a href#dom-dim-width idthe-embed-element:dom-dim-width>width/a>; a href#cereactions idthe-embed-element:cereactions-4>CEReactions/a> attribute DOMString a href#dom-dim-height idthe-embed-element:dom-dim-height>height/a>; a href#document idthe-embed-element:document>Document/a>? a href#dom-media-getsvgdocument idthe-embed-element:dom-media-getsvgdocument>getSVGDocument/a>(); // a href#HTMLEmbedElement-partial>also has obsolete members/a>};/pre> p>Depending on the type of content instantiated by the code idthe-embed-element:the-embed-element>a href#the-embed-element>embed/a>/code> element, the node may also support other interfaces./p> /dl> p>The code idthe-embed-element:the-embed-element-2>a href#the-embed-element>embed/a>/code> element provides an integration point for an external (typically non-HTML) application or interactive content./p> p>The dfn idattr-embed-src>code>src/code>/dfn> attribute gives the a idthe-embed-element:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the resource being embedded. The attribute, if present, must contain a a href#valid-non-empty-url-potentially-surrounded-by-spaces idthe-embed-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces/a>./p> p>If the code idthe-embed-element:names:-the-itemprop-attribute>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute is specified on an code idthe-embed-element:the-embed-element-3>a href#the-embed-element>embed/a>/code> element, then the code idthe-embed-element:attr-embed-src-2>a href#attr-embed-src>src/a>/code> attribute must also be specified./p> p>The dfn idattr-embed-type>code>type/code>/dfn> attribute, if present, gives the a idthe-embed-element:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> by which the plugin to instantiate is selected. The value must be a a idthe-embed-element:valid-mime-type hrefhttps://mimesniff.spec.whatwg.org/#valid-mime-type data-x-internalvalid-mime-type>valid MIME type/a>. If both the code idthe-embed-element:attr-embed-type-2>a href#attr-embed-type>type/a>/code> attribute and the code idthe-embed-element:attr-embed-src-3>a href#attr-embed-src>src/a>/code> attribute are present, then the code idthe-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 idthe-embed-element:content-type>explicit Content-Type metadata/a> of the resource given by the code idthe-embed-element:attr-embed-src-4>a href#attr-embed-src>src/a>/code> attribute./p> p>While any of the following conditions are occurring, any a href#plugin idthe-embed-element:plugin>plugin/a> instantiated for the element must be removed, and the code idthe-embed-element:the-embed-element-4>a href#the-embed-element>embed/a>/code> element a href#represents idthe-embed-element:represents>represents/a> nothing:/p> ul classbrief>li>p>The element has neither a code idthe-embed-element:attr-embed-src-5>a href#attr-embed-src>src/a>/code> attribute nor a code idthe-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 idthe-embed-element:media-element>media element/a> ancestor.li>p>The element has an ancestor code idthe-embed-element:the-object-element>a href#the-object-element>object/a>/code> element that is em>not/em> showing its a href#fallback-content idthe-embed-element:fallback-content>fallback content/a>./ul> p>An code idthe-embed-element:the-embed-element-5>a href#the-embed-element>embed/a>/code> element is said to be dfn idconcept-embed-active>potentially active/dfn> when the following conditions are all met simultaneously:/p> ul classbrief>li>The element is a idthe-embed-element:in-a-document hrefhttps://dom.spec.whatwg.org/#in-a-document data-x-internalin-a-document>in a document/a> or was a idthe-embed-element:in-a-document-2 hrefhttps://dom.spec.whatwg.org/#in-a-document data-x-internalin-a-document>in a document/a> the last time the a href#event-loop idthe-embed-element:event-loop>event loop/a> reached a href#step1>step 1/a>.li>The elements a idthe-embed-element:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is a href#fully-active idthe-embed-element:fully-active>fully active/a>.li>The element has either a code idthe-embed-element:attr-embed-src-6>a href#attr-embed-src>src/a>/code> attribute set or a code idthe-embed-element:attr-embed-type-5>a href#attr-embed-type>type/a>/code> attribute set (or both).li>The elements code idthe-embed-element:attr-embed-src-7>a href#attr-embed-src>src/a>/code> attribute is either absent or its value is not the empty string.li>The element is not a descendant of a a href#media-element idthe-embed-element:media-element-2>media element/a>.li>The element is not a descendant of an code idthe-embed-element:the-object-element-2>a href#the-object-element>object/a>/code> element that is not showing its a href#fallback-content idthe-embed-element:fallback-content-2>fallback content/a>.li>The element is a href#being-rendered idthe-embed-element:being-rendered>being rendered/a>, or was a href#being-rendered idthe-embed-element:being-rendered-2>being rendered/a> the last time the a href#event-loop idthe-embed-element:event-loop-2>event loop/a> reached a href#step1>step 1/a>./ul> p>Whenever an code idthe-embed-element:the-embed-element-6>a href#the-embed-element>embed/a>/code> element that was not a href#concept-embed-active idthe-embed-element:concept-embed-active>potentially active/a> becomes a href#concept-embed-active idthe-embed-element:concept-embed-active-2>potentially active/a>, and whenever a a href#concept-embed-active idthe-embed-element:concept-embed-active-3>potentially active/a> code idthe-embed-element:the-embed-element-7>a href#the-embed-element>embed/a>/code> element that is remaining a href#concept-embed-active idthe-embed-element:concept-embed-active-4>potentially active/a> and has its code idthe-embed-element:attr-embed-type-6>a href#attr-embed-type>src/a>/code> attribute set, changed, or removed or its code idthe-embed-element:attr-embed-type-7>a href#attr-embed-type>type/a>/code> attribute set, changed, or removed, the user agent must a href#queue-a-task idthe-embed-element:queue-a-task>queue a task/a> using the dfn idembed-task-source>embed task source/dfn> to run a href#the-embed-element-setup-steps idthe-embed-element:the-embed-element-setup-steps>the code>embed/code> element setup steps/a>./p> p>dfn idthe-embed-element-setup-steps>The code>embed/code> element setup steps/dfn> are as follows:/p> ol>li>p>If another a href#concept-task idthe-embed-element:concept-task>task/a> has since been queued to run a href#the-embed-element-setup-steps idthe-embed-element:the-embed-element-setup-steps-2>the code>embed/code> element setup steps/a> for this element, then abort these steps.li>p>If the a idthe-embed-element:should-element-be-blocked-a-priori-by-content-security-policy hrefhttps://w3c.github.io/webappsec-csp/#should-plugin-element-be-blocked-a-priori-by-content-security-policy data-x-internalshould-element-be-blocked-a-priori-by-content-security-policy>Should element be blocked i langla>a priori/i> by Content Security Policy?/a> algorithm returns code>Blocked/code> when executed on the element, then abort these steps. a href#refsCSP>CSP/a>li> dl classswitch>dt>If the element has a code idthe-embed-element:attr-embed-src-8>a href#attr-embed-src>src/a>/code> attribute setdd> p>The user agent must a href#parse-a-url idthe-embed-element:parse-a-url>parse/a> the value of the elements code idthe-embed-element:attr-embed-src-9>a href#attr-embed-src>src/a>/code> attribute, relative to the elements a idthe-embed-element:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>. If that is successful, the user agent should run these steps: ol>li>p>Let var>request/var> be a new a hrefhttps://fetch.spec.whatwg.org/#concept-request idthe-embed-element:concept-request data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idthe-embed-element:concept-request-url data-x-internalconcept-request-url>url/a> is the a href#resulting-url-record idthe-embed-element:resulting-url-record>resulting URL record/a>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-client idthe-embed-element:concept-request-client data-x-internalconcept-request-client>client/a> is the elements a idthe-embed-element:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s code idthe-embed-element:window>a href#window>Window/a>/code> objects a href#environment-settings-object idthe-embed-element:environment-settings-object>environment settings object/a>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination idthe-embed-element:concept-request-destination data-x-internalconcept-request-destination>destination/a> is code>embed/code>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode idthe-embed-element:concept-request-credentials-mode data-x-internalconcept-request-credentials-mode>credentials mode/a> is code>include/code>, and whose a idthe-embed-element:use-url-credentials-flag hrefhttps://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag data-x-internaluse-url-credentials-flag>use-URL-credentials flag/a> is set.li>p>a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idthe-embed-element:concept-fetch data-x-internalconcept-fetch>Fetch/a> var>request/var>./ol> p>The a href#concept-task idthe-embed-element:concept-task-2>task/a> that is a href#queue-a-task idthe-embed-element:queue-a-task-2>queued/a> by the a href#networking-task-source idthe-embed-element:networking-task-source>networking task source/a> once the resource has been fetched must run the following steps:/p> ol>li>p>If another a href#concept-task idthe-embed-element:concept-task-3>task/a> has since been queued to run a href#the-embed-element-setup-steps idthe-embed-element:the-embed-element-setup-steps-3>the code>embed/code> element setup steps/a> for this element, then abort these steps.li> p>Determine the dfn idconcept-embed-type>type of the content/dfn> being embedded, as follows (stopping at the first substep that determines the type):/p> ol>li>p>If the element has a code idthe-embed-element:attr-embed-type-8>a href#attr-embed-type>type/a>/code> attribute, and thatattributes value is a type that a a href#plugin idthe-embed-element:plugin-2>plugin/a> supports, then the value of the code idthe-embed-element:attr-embed-type-9>a href#attr-embed-type>type/a>/code> attribute is the a href#concept-embed-type idthe-embed-element:concept-embed-type>contents type/a>.li> p>Otherwise, if applying the a idthe-embed-element:url-parser hrefhttps://url.spec.whatwg.org/#concept-url-parser data-x-internalurl-parser>URL parser/a> algorithm to the a idthe-embed-element:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the specified resource (after any redirects) results in a a idthe-embed-element:url-record hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a> whose a hrefhttps://url.spec.whatwg.org/#concept-url-path idthe-embed-element:concept-url-path data-x-internalconcept-url-path>path/a> component matches a pattern that a a href#plugin idthe-embed-element:plugin-3>plugin/a> supports, then the a href#concept-embed-type idthe-embed-element:concept-embed-type-2>contents type/a> is the type that that plugin can handle./p> p classexample>For example, a plugin might say that it can handle resources with a hrefhttps://url.spec.whatwg.org/#concept-url-path idthe-embed-element:concept-url-path-2 data-x-internalconcept-url-path>path/a> components that end with the four character string code>.swf/code>./p> li>p>Otherwise, if the specified resource has a href#content-type idthe-embed-element:content-type-2>explicit Content-Type metadata/a>, then that is the a href#concept-embed-type idthe-embed-element:concept-embed-type-3>contents type/a>.li>p>Otherwise, the content has no a href#concept-embed-type idthe-embed-element:concept-embed-type-4>type/a> and there can be no appropriate a href#plugin idthe-embed-element:plugin-4>plugin/a> for it./ol> li> p>If the previous step determined that the a href#concept-embed-type idthe-embed-element:concept-embed-type-5>contents type/a> is code>image/svg+xml/code>, then run the following substeps:/p> ol>li>p>If the code idthe-embed-element:the-embed-element-8>a href#the-embed-element>embed/a>/code> elements a href#nested-browsing-context idthe-embed-element:nested-browsing-context>nested browsing context/a> is null, set the elements a href#nested-browsing-context idthe-embed-element:nested-browsing-context-2>nested browsing context/a> to a a href#creating-a-new-browsing-context idthe-embed-element:creating-a-new-browsing-context>newly-created browsing context/a>, and, if the element has a code idthe-embed-element:attr-embed-name>a href#attr-embed-name>name/a>/code> attribute, set the a href#browsing-context-name idthe-embed-element:browsing-context-name>browsing context name/a> of the elements new a href#nested-browsing-context idthe-embed-element:nested-browsing-context-3>nested browsing context/a> to the value of this attribute./p> li>p>a href#navigate idthe-embed-element:navigate>Navigate/a> the a href#nested-browsing-context idthe-embed-element:nested-browsing-context-4>nested browsing context/a> to the fetched resource, with a href#replacement-enabled idthe-embed-element:replacement-enabled>replacement enabled/a>, and with the code idthe-embed-element:the-embed-element-9>a href#the-embed-element>embed/a>/code> elements a idthe-embed-element:node-document-4 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#concept-document-bc idthe-embed-element:concept-document-bc>browsing context/a> as the a href#source-browsing-context idthe-embed-element:source-browsing-context>source browsing context/a>. (The code idthe-embed-element:attr-embed-src-10>a href#attr-embed-src>src/a>/code> attribute of the code idthe-embed-element:the-embed-element-10>a href#the-embed-element>embed/a>/code> element doesnt get updated if the browsing context gets further navigated to other locations.)li>p>The code idthe-embed-element:the-embed-element-11>a href#the-embed-element>embed/a>/code> element now a href#represents idthe-embed-element:represents-2>represents/a> its a href#nested-browsing-context idthe-embed-element:nested-browsing-context-5>nested browsing context/a>./ol> li> p>Otherwise, find and instantiate an appropriate a href#plugin idthe-embed-element:plugin-5>plugin/a> based on the a href#concept-embed-type idthe-embed-element:concept-embed-type-6>contents type/a>, and hand that a href#plugin idthe-embed-element:plugin-6>plugin/a> the content of the resource, replacing any previously instantiated plugin for the element. The code idthe-embed-element:the-embed-element-12>a href#the-embed-element>embed/a>/code> element now represents this a href#plugin idthe-embed-element:plugin-7>plugin/a> instance./p> li>p>Once the resource or plugin has completely loaded, a href#queue-a-task idthe-embed-element:queue-a-task-3>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-embed-element:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idthe-embed-element:event-load>a href#event-load>load/a>/code> at the element./ol> p>Whether the resource is fetched successfully or not (e.g. whether the response status was an a idthe-embed-element:ok-status hrefhttps://fetch.spec.whatwg.org/#ok-status data-x-internalok-status>ok status/a>) must be ignored when determining the a href#concept-embed-type idthe-embed-element:concept-embed-type-7>contents type/a> and when handing the resource to the plugin./p> p classnote>This allows servers to return data for plugins even with error responses (e.g. HTTP 500 Internal Server Error codes can still contain plugin data)./p> p>Fetching the resource must a href#delay-the-load-event idthe-embed-element:delay-the-load-event>delay the load event/a> of the elements a idthe-embed-element:node-document-5 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>./p> dt>If the element has no code idthe-embed-element:attr-embed-src-11>a href#attr-embed-src>src/a>/code> attribute setdd> p>The user agent should find and instantiate an appropriate a href#plugin idthe-embed-element:plugin-8>plugin/a> based on the value of the code idthe-embed-element:attr-embed-type-10>a href#attr-embed-type>type/a>/code> attribute. The code idthe-embed-element:the-embed-element-13>a href#the-embed-element>embed/a>/code> element now represents this a href#plugin idthe-embed-element:plugin-9>plugin/a> instance./p> p>Once the plugin is completely loaded, a href#queue-a-task idthe-embed-element:queue-a-task-4>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-embed-element:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idthe-embed-element:event-load-2>a href#event-load>load/a>/code> at the element./p> /dl> /ol> p>The code idthe-embed-element:the-embed-element-14>a href#the-embed-element>embed/a>/code> element has no a href#fallback-content idthe-embed-element:fallback-content-3>fallback content/a>. If the user agent cant find a suitable plugin when attempting to find and instantiate one for the algorithm above, then the user agent must use a default plugin. This default could be as simple as saying Unsupported Format./p> p>Whenever an code idthe-embed-element:the-embed-element-15>a href#the-embed-element>embed/a>/code> element that was a href#concept-embed-active idthe-embed-element:concept-embed-active-5>potentially active/a> stops being a href#concept-embed-active idthe-embed-element:concept-embed-active-6>potentially active/a>, any a href#plugin idthe-embed-element:plugin-10>plugin/a> that had been instantiated for that element must be unloaded./p> p idsandboxPluginEmbed>When a a href#plugin idthe-embed-element:plugin-11>plugin/a> is to be instantiated but it cannot be a href#concept-plugin-secure idthe-embed-element:concept-plugin-secure>secured/a> and the a href#sandboxed-plugins-browsing-context-flag idthe-embed-element:sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag/a> is set on the code idthe-embed-element:the-embed-element-16>a href#the-embed-element>embed/a>/code> elements a idthe-embed-element:node-document-6 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#active-sandboxing-flag-set idthe-embed-element:active-sandboxing-flag-set>active sandboxing flag set/a>, then the user agent must not instantiate the a href#plugin idthe-embed-element:plugin-12>plugin/a>, and must instead render the code idthe-embed-element:the-embed-element-17>a href#the-embed-element>embed/a>/code> element in a manner that conveys that the a href#plugin idthe-embed-element:plugin-13>plugin/a> was disabled. The user agent may offer the user the option to override the sandbox and instantiate the a href#plugin idthe-embed-element:plugin-14>plugin/a> anyway; if the user invokes such an option, the user agent must act as if the conditions above did not apply for the purposes of this element./p> p classwarning>Plugins that cannot be a href#concept-plugin-secure idthe-embed-element:concept-plugin-secure-2>secured/a> are disabled in sandboxed browsing contexts because they might not honor the restrictions imposed by the sandbox (e.g. they might allow scripting even when scripting in the sandbox is disabled). User agents should convey the danger of overriding the sandbox to the user if an option to do so is provided./p> p>When an code idthe-embed-element:the-embed-element-18>a href#the-embed-element>embed/a>/code> element has a non-null a href#nested-browsing-context idthe-embed-element:nested-browsing-context-6>nested browsing context/a>: if the code idthe-embed-element:the-embed-element-19>a href#the-embed-element>embed/a>/code> elements a href#nested-browsing-context idthe-embed-element:nested-browsing-context-7>nested browsing context/a>s a href#active-document idthe-embed-element:active-document>active document/a> is not a href#ready-for-post-load-tasks idthe-embed-element:ready-for-post-load-tasks>ready for post-load tasks/a>, and when anything is a href#delay-the-load-event idthe-embed-element:delay-the-load-event-2>delaying the load event/a> of the code idthe-embed-element:the-embed-element-20>a href#the-embed-element>embed/a>/code> elements a href#browsing-context idthe-embed-element:browsing-context>browsing context/a>s a href#active-document idthe-embed-element:active-document-2>active document/a>, and when the code idthe-embed-element:the-embed-element-21>a href#the-embed-element>embed/a>/code> elements a href#browsing-context idthe-embed-element:browsing-context-2>browsing context/a> is in the a href#delaying-load-events-mode idthe-embed-element:delaying-load-events-mode>delaying code>load/code> events mode/a>, the code idthe-embed-element:the-embed-element-22>a href#the-embed-element>embed/a>/code> must a href#delay-the-load-event idthe-embed-element:delay-the-load-event-3>delay the load event/a> of its document./p> p>The a href#task-source idthe-embed-element:task-source>task source/a> for the a href#concept-task idthe-embed-element:concept-task-4>tasks/a> mentioned in this section is the a href#dom-manipulation-task-source idthe-embed-element:dom-manipulation-task-source>DOM manipulation task source/a>./p> p>Any namespace-less attribute other than code idthe-embed-element:attr-embed-name-2>a href#attr-embed-name>name/a>/code>, code idthe-embed-element:attr-embed-align>a href#attr-embed-align>align/a>/code>, code idthe-embed-element:attr-embed-hspace>a href#attr-embed-hspace>hspace/a>/code>, and code idthe-embed-element:attr-embed-vspace>a href#attr-embed-vspace>vspace/a>/code> may be specified on the code idthe-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 idthe-embed-element:xml-compatible>XML-compatible/a> and contains no a hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha idthe-embed-element:uppercase-ascii-letters data-x-internaluppercase-ascii-letters>ASCII upper alphas/a>. These attributes are then passed as parameters to the a href#plugin idthe-embed-element:plugin-15>plugin/a>./p> p classnote>All attributes in a idthe-embed-element:html-documents hrefhttps://dom.spec.whatwg.org/#html-document data-x-internalhtml-documents>HTML documents/a> get lowercased automatically, so the restriction on uppercase letters doesnt affect such documents./p> p classnote>The four exceptions are to exclude legacy attributes that have side-effects beyond just sending parameters to the a href#plugin idthe-embed-element:plugin-16>plugin/a>./p> p>The user agent should pass the names and values of all the attributes of the code idthe-embed-element:the-embed-element-24>a href#the-embed-element>embed/a>/code> element that have no namespace to the a href#plugin idthe-embed-element:plugin-17>plugin/a> used, when one is instantiated./p> p>The code idthe-embed-element:htmlembedelement>a href#htmlembedelement>HTMLEmbedElement/a>/code> object representing the element must expose the scriptable interface of the a href#plugin idthe-embed-element:plugin-18>plugin/a> instantiated for the code idthe-embed-element:the-embed-element-25>a href#the-embed-element>embed/a>/code> element, if any./p> p>The code idthe-embed-element:the-embed-element-26>a href#the-embed-element>embed/a>/code> element supports a href#dimension-attributes idthe-embed-element:dimension-attributes>dimension attributes/a>./p> p>The IDL attributes dfn iddom-embed-src>code>src/code>/dfn> and dfn iddom-embed-type>code>type/code>/dfn> each must a href#reflect idthe-embed-element:reflect>reflect/a> the respective content attributes of the same name./p> div classexample> p>Heres a way to embed a resource that requires a proprietary plugin, like Flash:/p> pre><embed srccatgame.swf>/pre> p>If the user does not have the plugin (for example if the plugin vendor doesnt support the users platform), then the user will be unable to use the resource./p> p>To pass the plugin a parameter quality with the value high, an attribute can be specified:/p> pre><embed srccatgame.swf qualityhigh>/pre> p>This would be equivalent to the following, when using an code idthe-embed-element:the-object-element-3>a href#the-object-element>object/a>/code> element instead:/p> pre><object datacatgame.swf> <param namequality valuehigh></object>/pre> /div> h4 idthe-object-element data-dfn-typeelement data-ltobject>span classsecno>4.8.7/span> The dfn>code>object/code>/dfn> elementa href#the-object-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id24852 titleThe algorithm should probably unload the plugin even if it doesnt end up at the fallback step. Should also destroy the nested browsing context if it had one.>24852/a>/div> dl classelement>dt>a href#concept-element-categories idthe-object-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-object-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-object-element:phrasing-content-2>Phrasing content/a>.dd>a href#embedded-content-category idthe-object-element:embedded-content-category>Embedded content/a>.dd>If the element has a code idthe-object-element:attr-hyperlink-usemap>a href#attr-hyperlink-usemap>usemap/a>/code> attribute: a href#interactive-content-2 idthe-object-element:interactive-content-2>Interactive content/a>.dd>a href#category-listed idthe-object-element:category-listed>Listed/a> and a href#category-submit idthe-object-element:category-submit>submittable/a> a href#form-associated-element idthe-object-element:form-associated-element>form-associated element/a>.dd>a href#palpable-content-2 idthe-object-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-object-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#embedded-content-category idthe-object-element:embedded-content-category-2>embedded content/a> is expected.dt>a href#concept-element-content-model idthe-object-element:concept-element-content-model>Content model/a>:dd>Zero or more code idthe-object-element:the-param-element>a href#the-param-element>param/a>/code> elements, then, a href#transparent idthe-object-element:transparent>transparent/a>.dt>a href#concept-element-tag-omission idthe-object-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-object-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-object-element:global-attributes>Global attributes/a>dd>code idthe-object-element:attr-object-data>a href#attr-object-data>data/a>/code> — Address of the resourcedd>code idthe-object-element:attr-object-type>a href#attr-object-type>type/a>/code> — Type of embedded resourcedd>code idthe-object-element:attr-object-typemustmatch>a href#attr-object-typemustmatch>typemustmatch/a>/code> — Whether the code idthe-object-element:attr-object-type-2>a href#attr-object-type>type/a>/code> attribute and the a href#content-type idthe-object-element:content-type>Content-Type/a> value need to match for the resource to be useddd>code idthe-object-element:attr-object-name>a href#attr-object-name>name/a>/code> — Name of a href#nested-browsing-context idthe-object-element:nested-browsing-context>nested browsing context/a>dd>code idthe-object-element:attr-hyperlink-usemap-2>a href#attr-hyperlink-usemap>usemap/a>/code> — Name of a href#image-map idthe-object-element:image-map>image map/a> to usedd>code idthe-object-element:attr-fae-form>a href#attr-fae-form>form/a>/code> — Associates the control with a code idthe-object-element:the-form-element>a href#the-form-element>form/a>/code> elementdd>code idthe-object-element:attr-dim-width>a href#attr-dim-width>width/a>/code> — Horizontal dimensiondd>code idthe-object-element:attr-dim-height>a href#attr-dim-height>height/a>/code> — Vertical dimensiondt>a href#concept-element-dom idthe-object-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-object-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlobjectelement>HTMLObjectElement/dfn> : a href#htmlelement idthe-object-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-object-element:cereactions>CEReactions/a> attribute USVString a href#dom-object-data idthe-object-element:dom-object-data>data/a>; a href#cereactions idthe-object-element:cereactions-2>CEReactions/a> attribute DOMString a href#dom-object-type idthe-object-element:dom-object-type>type/a>; a href#cereactions idthe-object-element:cereactions-3>CEReactions/a> attribute boolean a href#dom-object-typemustmatch idthe-object-element:dom-object-typemustmatch>typeMustMatch/a>; a href#cereactions idthe-object-element:cereactions-4>CEReactions/a> attribute DOMString a href#dom-object-name idthe-object-element:dom-object-name>name/a>; a href#cereactions idthe-object-element:cereactions-5>CEReactions/a> attribute DOMString a href#dom-object-usemap idthe-object-element:dom-object-usemap>useMap/a>; readonly attribute a href#htmlformelement idthe-object-element:htmlformelement>HTMLFormElement/a>? a href#dom-fae-form idthe-object-element:dom-fae-form>form/a>; a href#cereactions idthe-object-element:cereactions-6>CEReactions/a> attribute DOMString a href#dom-dim-width idthe-object-element:dom-dim-width>width/a>; a href#cereactions idthe-object-element:cereactions-7>CEReactions/a> attribute DOMString a href#dom-dim-height idthe-object-element:dom-dim-height>height/a>; readonly attribute a href#document idthe-object-element:document>Document/a>? a href#dom-object-contentdocument idthe-object-element:dom-object-contentdocument>contentDocument/a>; readonly attribute a href#windowproxy idthe-object-element:windowproxy>WindowProxy/a>? a href#dom-object-contentwindow idthe-object-element:dom-object-contentwindow>contentWindow/a>; a href#document idthe-object-element:document-2>Document/a>? a href#dom-media-getsvgdocument idthe-object-element:dom-media-getsvgdocument>getSVGDocument/a>(); readonly attribute boolean a href#dom-cva-willvalidate idthe-object-element:dom-cva-willvalidate>willValidate/a>; readonly attribute a href#validitystate idthe-object-element:validitystate>ValidityState/a> a href#dom-cva-validity idthe-object-element:dom-cva-validity>validity/a>; readonly attribute DOMString a href#dom-cva-validationmessage idthe-object-element:dom-cva-validationmessage>validationMessage/a>; boolean a href#dom-cva-checkvalidity idthe-object-element:dom-cva-checkvalidity>checkValidity/a>(); boolean a href#dom-cva-reportvalidity idthe-object-element:dom-cva-reportvalidity>reportValidity/a>(); void a href#dom-cva-setcustomvalidity idthe-object-element:dom-cva-setcustomvalidity>setCustomValidity/a>(DOMString error); // a href#HTMLObjectElement-partial>also has obsolete members/a>};/pre> p>Depending on the type of content instantiated by the code idthe-object-element:the-object-element>a href#the-object-element>object/a>/code> element, the node also supports other interfaces./p> /dl> p>The code idthe-object-element:the-object-element-2>a href#the-object-element>object/a>/code> element can represent an external resource, which, depending on the type of the resource, will either be treated as an image, as a a href#nested-browsing-context idthe-object-element:nested-browsing-context-2>nested browsing context/a>, or as an external resource to be processed by a a href#plugin idthe-object-element:plugin>plugin/a>./p> p>The dfn idattr-object-data>code>data/code>/dfn> attribute, if present, specifies the a idthe-object-element:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the resource. If present, the attribute must be a a href#valid-non-empty-url-potentially-surrounded-by-spaces idthe-object-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces/a>./p> p classwarning>Authors who reference resources from other a href#concept-origin idthe-object-element:concept-origin>origins/a> that they do not trust are urged to use the code idthe-object-element:attr-object-typemustmatch-2>a href#attr-object-typemustmatch>typemustmatch/a>/code> attribute defined below. Without that attribute, it is possible in certain cases for an attacker on the remote host to use the plugin mechanism to run arbitrary scripts, even if the author has used features such as the Flash allowScriptAccess parameter./p> p>The dfn idattr-object-type>code>type/code>/dfn> attribute, if present, specifies the type of the resource. If present, the attribute must be a a idthe-object-element:valid-mime-type hrefhttps://mimesniff.spec.whatwg.org/#valid-mime-type data-x-internalvalid-mime-type>valid MIME type/a>./p> p>At least one of either the code idthe-object-element:attr-object-data-2>a href#attr-object-data>data/a>/code> attribute or the code idthe-object-element:attr-object-type-3>a href#attr-object-type>type/a>/code> attribute must be present./p> p>If the code idthe-object-element:names:-the-itemprop-attribute>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute is specified on an code idthe-object-element:the-object-element-3>a href#the-object-element>object/a>/code> element, then the code idthe-object-element:attr-object-data-3>a href#attr-object-data>data/a>/code> attribute must also be specified./p> p>The dfn idattr-object-typemustmatch>code>typemustmatch/code>/dfn> attribute is a a href#boolean-attribute idthe-object-element:boolean-attribute>boolean attribute/a> whose presence indicates that the resource specified by the code idthe-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 idthe-object-element:attr-object-type-4>a href#attr-object-type>type/a>/code> attribute and the a href#content-type idthe-object-element:content-type-2>Content-Type/a> of the aforementioned resource match./p> p>The code idthe-object-element:attr-object-typemustmatch-3>a href#attr-object-typemustmatch>typemustmatch/a>/code> attribute must not be specified unless both the code idthe-object-element:attr-object-data-5>a href#attr-object-data>data/a>/code> attribute and the code idthe-object-element:attr-object-type-5>a href#attr-object-type>type/a>/code> attribute are present./p> p>The dfn idattr-object-name>code>name/code>/dfn> attribute, if present, must be a a href#valid-browsing-context-name idthe-object-element:valid-browsing-context-name>valid browsing context name/a>. The given value is used to name the a href#nested-browsing-context idthe-object-element:nested-browsing-context-3>nested browsing context/a>, if applicable./p> p>Whenever one of the following conditions occur:/p> ul>li>the element is created, li>the element is popped off the a href#stack-of-open-elements idthe-object-element:stack-of-open-elements>stack of open elements/a> of an a href#html-parser idthe-object-element:html-parser>HTML parser/a> or a href#xml-parser idthe-object-element:xml-parser>XML parser/a>, li>the element is not on the a href#stack-of-open-elements idthe-object-element:stack-of-open-elements-2>stack of open elements/a> of an a href#html-parser idthe-object-element:html-parser-2>HTML parser/a> or a href#xml-parser idthe-object-element:xml-parser-2>XML parser/a>, and it is either a href#insert-an-element-into-a-document idthe-object-element:insert-an-element-into-a-document>inserted into a document/a> or a href#remove-an-element-from-a-document idthe-object-element:remove-an-element-from-a-document>removed from a document/a>, li>the elements a idthe-object-element:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> changes whether it is a href#fully-active idthe-object-element:fully-active>fully active/a>, li>one of the elements ancestor code idthe-object-element:the-object-element-4>a href#the-object-element>object/a>/code> elements changes to or from showing its a href#fallback-content idthe-object-element:fallback-content>fallback content/a>, li>the elements code idthe-object-element:attr-object-classid>a href#attr-object-classid>classid/a>/code> attribute is set, changed, or removed, li>the elements code idthe-object-element:attr-object-classid-2>a href#attr-object-classid>classid/a>/code> attribute is not present, and its code idthe-object-element:attr-object-data-6>a href#attr-object-data>data/a>/code> attribute is set, changed, or removed, li>neither the elements code idthe-object-element:attr-object-classid-3>a href#attr-object-classid>classid/a>/code> attribute nor its code idthe-object-element:attr-object-data-7>a href#attr-object-data>data/a>/code> attribute are present, and its code idthe-object-element:attr-object-type-6>a href#attr-object-type>type/a>/code> attribute is set, changed, or removed, li>the element changes from a href#being-rendered idthe-object-element:being-rendered>being rendered/a> to not being rendered, or vice versa, /ul> p>...the user agent must a href#queue-a-task idthe-object-element:queue-a-task>queue a task/a> to run the following steps to (re)determine what the code idthe-object-element:the-object-element-5>a href#the-object-element>object/a>/code> element represents. This a href#concept-task idthe-object-element:concept-task>task/a> being a href#queue-a-task idthe-object-element:queue-a-task-2>queued/a> or actively running must a href#delay-the-load-event idthe-object-element:delay-the-load-event>delay the load event/a> of the elements a idthe-object-element:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>. /p> ol>li> p>If the user has indicated a preference that this code idthe-object-element:the-object-element-6>a href#the-object-element>object/a>/code> elements a href#fallback-content idthe-object-element:fallback-content-2>fallback content/a> be shown instead of the elements usual behavior, then jump to the step below labeled i>fallback/i>./p> p classnote>For example, a user could ask for the elements a href#fallback-content idthe-object-element:fallback-content-3>fallback content/a> to be shown because that content uses a format that the user finds more accessible./p> li> p>If the element has an ancestor a href#media-element idthe-object-element:media-element>media element/a>, or has an ancestor code idthe-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 idthe-object-element:fallback-content-4>fallback content/a>, or if the element is not a idthe-object-element:in-a-document hrefhttps://dom.spec.whatwg.org/#in-a-document data-x-internalin-a-document>in a document/a> that has a a href#concept-document-bc idthe-object-element:concept-document-bc>browsing context/a>, or if the elements a idthe-object-element:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is not a href#fully-active idthe-object-element:fully-active-2>fully active/a>, or if the element is still in the a href#stack-of-open-elements idthe-object-element:stack-of-open-elements-3>stack of open elements/a> of an a href#html-parser idthe-object-element:html-parser-3>HTML parser/a> or a href#xml-parser idthe-object-element:xml-parser-3>XML parser/a>, or if the element is not a href#being-rendered idthe-object-element:being-rendered-2>being rendered/a>, or if the a idthe-object-element:should-element-be-blocked-a-priori-by-content-security-policy hrefhttps://w3c.github.io/webappsec-csp/#should-plugin-element-be-blocked-a-priori-by-content-security-policy data-x-internalshould-element-be-blocked-a-priori-by-content-security-policy>Should element be blocked i langla>a priori/i> by Content Security Policy?/a> algorithm returns code>Blocked/code> when executed on the element, then jump to the step below labeled i>fallback/i>. a href#refsCSP>CSP/a>/p> li> p>If the code idthe-object-element:attr-object-classid-4>a href#attr-object-classid>classid/a>/code> attribute is present, and has a value that isnt the empty string, then: if the user agent can find a a href#plugin idthe-object-element:plugin-2>plugin/a> suitable according to the value of the code idthe-object-element:attr-object-classid-5>a href#attr-object-classid>classid/a>/code> attribute, and either a href#sandboxPluginObject>plugins arent being sandboxed/a> or that a href#plugin idthe-object-element:plugin-3>plugin/a> can be a href#concept-plugin-secure idthe-object-element:concept-plugin-secure>secured/a>, then that a href#plugin idthe-object-element:plugin-4>plugin/a> a href#object-plugin>should be used/a>, and the value of the code idthe-object-element:attr-object-data-8>a href#attr-object-data>data/a>/code> attribute, if any, should be passed to the a href#plugin idthe-object-element:plugin-5>plugin/a>. If no suitable a href#plugin idthe-object-element:plugin-6>plugin/a> can be found, or if the a href#plugin idthe-object-element:plugin-7>plugin/a> reports an error, jump to the step below labeled i>fallback/i>./p> li>p>If the code idthe-object-element:attr-object-data-9>a href#attr-object-data>data/a>/code> attribute is present and its value is not the empty string, then:/p> ol>li>p>If the code idthe-object-element:attr-object-type-7>a href#attr-object-type>type/a>/code> attribute is present and its value is not a type that the user agent supports, and is not a type that the user agent can find a a href#plugin idthe-object-element:plugin-8>plugin/a> for, then the user agent may jump to the step below labeled i>fallback/i> without fetching the content to examine its real type.li>p>a href#parse-a-url idthe-object-element:parse-a-url>Parse/a> the a idthe-object-element:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> specified by the code idthe-object-element:attr-object-data-10>a href#attr-object-data>data/a>/code> attribute, relative to the elements a idthe-object-element:node-document-4 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>.li>p>If that failed, a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-object-element:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idthe-object-element:event-error>a href#event-error>error/a>/code> at the element, then jump to the step below labeled i>fallback/i>.li>p>Let var>request/var> be a new a hrefhttps://fetch.spec.whatwg.org/#concept-request idthe-object-element:concept-request data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idthe-object-element:concept-request-url data-x-internalconcept-request-url>url/a> is the a href#resulting-url-record idthe-object-element:resulting-url-record>resulting URL record/a>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-client idthe-object-element:concept-request-client data-x-internalconcept-request-client>client/a> is the elements a idthe-object-element:node-document-5 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s code idthe-object-element:window>a href#window>Window/a>/code> objects a href#environment-settings-object idthe-object-element:environment-settings-object>environment settings object/a>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination idthe-object-element:concept-request-destination data-x-internalconcept-request-destination>destination/a> is code>object/code>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode idthe-object-element:concept-request-credentials-mode data-x-internalconcept-request-credentials-mode>credentials mode/a> is code>include/code>, and whose a idthe-object-element:use-url-credentials-flag hrefhttps://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag data-x-internaluse-url-credentials-flag>use-URL-credentials flag/a> is set.li> p>a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idthe-object-element:concept-fetch data-x-internalconcept-fetch>Fetch/a> var>request/var>./p> p>Fetching the resource must a href#delay-the-load-event idthe-object-element:delay-the-load-event-2>delay the load event/a> of the elements a idthe-object-element:node-document-6 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> until the a href#concept-task idthe-object-element:concept-task-2>task/a> that is a href#queue-a-task idthe-object-element:queue-a-task-3>queued/a> by the a href#networking-task-source idthe-object-element:networking-task-source>networking task source/a> once the resource has been fetched (defined next) has been run./p> p>For the purposes of the a href#application-cache idthe-object-element:application-cache>application cache/a> networking model, this fetch operation is not for a a href#child-browsing-context idthe-object-element:child-browsing-context>child browsing context/a> (though it might end up being used for one after all, as defined below)./p> li>p>If the resource is not yet available (e.g. because the resource was not available in the cache, so that loading the resource required making a request over the network), then jump to the step below labeled i>fallback/i>. The a href#concept-task idthe-object-element:concept-task-3>task/a> that is a href#queue-a-task idthe-object-element:queue-a-task-4>queued/a> by the a href#networking-task-source idthe-object-element:networking-task-source-2>networking task source/a> once the resource is available must restart this algorithm from this step. Resources can load incrementally; user agents may opt to consider a resource available whenever enough data has been obtained to begin processing the resource.li>p>If the load failed (e.g. there was an HTTP 404 error, there was a DNS error), a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-object-element:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idthe-object-element:event-error-2>a href#event-error>error/a>/code> at the element, then jump to the step below labeled i>fallback/i>.li idobject-type-detection> p>Determine the var>resource type/var>, as follows:/p> ol>li> p>Let the var>resource type/var> be unknown./p> li> p>If the code idthe-object-element:the-object-element-8>a href#the-object-element>object/a>/code> element has a code idthe-object-element:attr-object-type-8>a href#attr-object-type>type/a>/code> attribute and a code idthe-object-element:attr-object-typemustmatch-4>a href#attr-object-typemustmatch>typemustmatch/a>/code> attribute, and the resource has a href#content-type idthe-object-element:content-type-3>associated Content-Type metadata/a>, and the type specified in a href#content-type idthe-object-element:content-type-4>the resources Content-Type metadata/a> is an a idthe-object-element:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the value of the elements code idthe-object-element:attr-object-type-9>a href#attr-object-type>type/a>/code> attribute, then let var>resource type/var> be that type and jump to the step below labeled i>handler/i>./p> li> p>If the code idthe-object-element:the-object-element-9>a href#the-object-element>object/a>/code> element has a code idthe-object-element:attr-object-typemustmatch-5>a href#attr-object-typemustmatch>typemustmatch/a>/code> attribute, jump to the step below labeled i>handler/i>./p> li> p>If the user agent is configured to strictly obey Content-Type headers for this resource, and the resource has a href#content-type idthe-object-element:content-type-5>associated Content-Type metadata/a>, then let the var>resource type/var> be the type specified in a href#content-type idthe-object-element:content-type-6>the resources Content-Type metadata/a>, and jump to the step below labeled i>handler/i>./p> p classwarning>This can introduce a vulnerability, wherein a site is trying to embed a resource that uses a particular plugin, but the remote site overrides that and instead furnishes the user agent with a resource that triggers a different plugin with different security characteristics. /p> li> p>If there is a code idthe-object-element:attr-object-type-10>a href#attr-object-type>type/a>/code> attribute present on the code idthe-object-element:the-object-element-10>a href#the-object-element>object/a>/code> element, and that attributes value is not a type that the user agent supports, but it em>is/em> a type that a a href#plugin idthe-object-element:plugin-9>plugin/a> supports, then let the var>resource type/var> be the type specified in that code idthe-object-element:attr-object-type-11>a href#attr-object-type>type/a>/code> attribute, and jump to the step below labeled i>handler/i>./p> li> p>Run the appropriate set of steps from the following list:/p> dl classswitch>dt>If the resource has a href#content-type idthe-object-element:content-type-7>associated Content-Type metadata/a>dd> ol>li> p>Let var>binary/var> be false./p> li> p>If the type specified in a href#content-type idthe-object-element:content-type-8>the resources Content-Type metadata/a> is code idthe-object-element:text/plain>a data-x-internaltext/plain hrefhttps://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain/a>/code>, and the result of applying the a hrefhttps://mimesniff.spec.whatwg.org/#rules-for-text-or-binary idthe-object-element:content-type-sniffing:-text-or-binary data-x-internalcontent-type-sniffing:-text-or-binary>rules for distinguishing if a resource is text or binary/a> to the resource is that the resource is not code idthe-object-element:text/plain-2>a data-x-internaltext/plain hrefhttps://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain/a>/code>, then set var>binary/var> to true./p> li> p>If the type specified in a href#content-type idthe-object-element:content-type-9>the resources Content-Type metadata/a> is code idthe-object-element:application/octet-stream>a data-x-internalapplication/octet-stream hrefhttps://tools.ietf.org/html/rfc2046#section-4.5.1>application/octet-stream/a>/code>, then set var>binary/var> to true./p> li> p>If var>binary/var> is false, then let the var>resource type/var> be the type specified in a href#content-type idthe-object-element:content-type-10>the resources Content-Type metadata/a>, and jump to the step below labeled i>handler/i>./p> li> p>If there is a code idthe-object-element:attr-object-type-12>a href#attr-object-type>type/a>/code> attribute present on the code idthe-object-element:the-object-element-11>a href#the-object-element>object/a>/code> element, and its value is not code idthe-object-element:application/octet-stream-2>a data-x-internalapplication/octet-stream hrefhttps://tools.ietf.org/html/rfc2046#section-4.5.1>application/octet-stream/a>/code>, then run the following steps:/p> ol>li> p>If the attributes value is a type that a a href#plugin idthe-object-element:plugin-10>plugin/a> supports, or the attributes value is a type that starts with code>image//code> that is not also an a idthe-object-element:xml-mime-type hrefhttps://mimesniff.spec.whatwg.org/#xml-mime-type data-x-internalxml-mime-type>XML MIME type/a>, then let the var>resource type/var> be the type specified in that code idthe-object-element:attr-object-type-13>a href#attr-object-type>type/a>/code> attribute./p> li> p>Jump to the step below labeled i>handler/i>./p> /ol> /ol> dt>Otherwise, if the resource does not have a href#content-type idthe-object-element:content-type-11>associated Content-Type metadata/a>dd> ol>li> p>If there is a code idthe-object-element:attr-object-type-14>a href#attr-object-type>type/a>/code> attribute present on the code idthe-object-element:the-object-element-12>a href#the-object-element>object/a>/code> element, then let the var>tentative type/var> be the type specified in that code idthe-object-element:attr-object-type-15>a href#attr-object-type>type/a>/code> attribute./p> p>Otherwise, let var>tentative type/var> be the a hrefhttps://mimesniff.spec.whatwg.org/#computed-mime-type idthe-object-element:content-type-sniffing-2 data-x-internalcontent-type-sniffing-2>computed type of the resource/a>./p> li> p>If var>tentative type/var> is em>not/em> code idthe-object-element:application/octet-stream-3>a data-x-internalapplication/octet-stream hrefhttps://tools.ietf.org/html/rfc2046#section-4.5.1>application/octet-stream/a>/code>, then let var>resource type/var> be var>tentative type/var> and jump to the step below labeled i>handler/i>./p> /ol> /dl> li> p>If applying the a idthe-object-element:url-parser hrefhttps://url.spec.whatwg.org/#concept-url-parser data-x-internalurl-parser>URL parser/a> algorithm to the a idthe-object-element:url-3 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the specified resource (after any redirects) results in a a idthe-object-element:url-record hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a> whose a hrefhttps://url.spec.whatwg.org/#concept-url-path idthe-object-element:concept-url-path data-x-internalconcept-url-path>path/a> component matches a pattern that a a href#plugin idthe-object-element:plugin-11>plugin/a> supports, then let var>resource type/var> be the type that that plugin can handle./p> p classexample>For example, a plugin might say that it can handle resources with a hrefhttps://url.spec.whatwg.org/#concept-url-path idthe-object-element:concept-url-path-2 data-x-internalconcept-url-path>path/a> components that end with the four character string code>.swf/code>./p> /ol> p classnote>It is possible for this step to finish, or for one of the substeps above to jump straight to the next step, with var>resource type/var> still being unknown. In both cases, the next step will trigger fallback./p> li>p>i>Handler/i>: Handle the content as given by the first of the following cases that matches:/p> dl classswitch>dt>If the var>resource type/var> is not a type that the user agent supports, but it em>is/em> a type that a a href#plugin idthe-object-element:plugin-12>plugin/a> supportsdd> p>If the code idthe-object-element:the-object-element-13>a href#the-object-element>object/a>/code> elements a href#nested-browsing-context idthe-object-element:nested-browsing-context-4>nested browsing context/a> is non-null, then it must be a href#a-browsing-context-is-discarded idthe-object-element:a-browsing-context-is-discarded>discarded/a> and then set to null./p> p>If a href#sandboxPluginObject>plugins are being sandboxed/a> and the plugin that supports var>resource type/var> cannot be a href#concept-plugin-secure idthe-object-element:concept-plugin-secure-2>secured/a>, jump to the step below labeled i>fallback/i>./p> p>Otherwise, the user agent should a href#object-plugin>use the plugin that supports var>resource type/var>/a> and pass the content of the resource to that a href#plugin idthe-object-element:plugin-13>plugin/a>. If the a href#plugin idthe-object-element:plugin-14>plugin/a> reports an error, then jump to the step below labeled i>fallback/i>./p> dt>If the var>resource type/var> is an a idthe-object-element:xml-mime-type-2 hrefhttps://mimesniff.spec.whatwg.org/#xml-mime-type data-x-internalxml-mime-type>XML MIME type/a>, or if the var>resource type/var> does not start with code>image//code>dd> p>If the code idthe-object-element:the-object-element-14>a href#the-object-element>object/a>/code> elements a href#nested-browsing-context idthe-object-element:nested-browsing-context-5>nested browsing context/a> is null, set the elements a href#nested-browsing-context idthe-object-element:nested-browsing-context-6>nested browsing context/a> to a a href#creating-a-new-browsing-context idthe-object-element:creating-a-new-browsing-context>newly-created browsing context/a>./p> p>The code idthe-object-element:the-object-element-15>a href#the-object-element>object/a>/code> element must be associated with a newly created a href#nested-browsing-context idthe-object-element:nested-browsing-context-7>nested browsing context/a>, if it does not already have one./p> p>If the a idthe-object-element:url-4 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the given resource is not code idthe-object-element:about:blank>a href#about:blank>about:blank/a>/code>, the elements a href#nested-browsing-context idthe-object-element:nested-browsing-context-8>nested browsing context/a> must then be a href#navigate idthe-object-element:navigate>navigated/a> to that resource, with a href#replacement-enabled idthe-object-element:replacement-enabled>replacement enabled/a>, and with the code idthe-object-element:the-object-element-16>a href#the-object-element>object/a>/code> elements a idthe-object-element:node-document-7 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#concept-document-bc idthe-object-element:concept-document-bc-2>browsing context/a> as the a href#source-browsing-context idthe-object-element:source-browsing-context>source browsing context/a>. (The code idthe-object-element:attr-object-data-11>a href#attr-object-data>data/a>/code> attribute of the code idthe-object-element:the-object-element-17>a href#the-object-element>object/a>/code> element doesnt get updated if the browsing context gets further navigated to other locations.)/p> p>If the a idthe-object-element:url-5 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the given resource em>is/em> code idthe-object-element:about:blank-2>a href#about:blank>about:blank/a>/code>, then, instead, the user agent must a href#queue-a-task idthe-object-element:queue-a-task-5>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-object-element:concept-event-fire-3 data-x-internalconcept-event-fire>fire an event/a> named code idthe-object-element:event-load>a href#event-load>load/a>/code> at the code idthe-object-element:the-object-element-18>a href#the-object-element>object/a>/code> element. span classnote>No code idthe-object-element:event-load-2>a href#event-load>load/a>/code> event is fired at the code idthe-object-element:about:blank-3>a href#about:blank>about:blank/a>/code> document itself./span>/p> p>The code idthe-object-element:the-object-element-19>a href#the-object-element>object/a>/code> element a href#represents idthe-object-element:represents>represents/a> the a href#nested-browsing-context idthe-object-element:nested-browsing-context-9>nested browsing context/a>./p> p>If the code idthe-object-element:attr-object-name-2>a href#attr-object-name>name/a>/code> attribute is present, the code idthe-object-element:the-object-element-20>a href#the-object-element>object/a>/code> elements a href#nested-browsing-context idthe-object-element:nested-browsing-context-10>nested browsing context/a>s a href#browsing-context-name idthe-object-element:browsing-context-name>browsing context name/a> must be set to the value of this attribute; otherwise, the a href#browsing-context-name idthe-object-element:browsing-context-name-2>browsing context name/a> must be set to the empty string./p> p classnote>In certain situations, e.g., if the resource was fetched from an a href#application-cache idthe-object-element:application-cache-2>application cache/a> but it is an HTML file with a code idthe-object-element:attr-html-manifest>a href#attr-html-manifest>manifest/a>/code> attribute that points to a different a href#concept-appcache-manifest idthe-object-element:concept-appcache-manifest>application cache manifest/a>, the a href#navigate idthe-object-element:navigate-2>navigation/a> of the a href#browsing-context idthe-object-element:browsing-context>browsing context/a> will be restarted so as to load the resource afresh from the network or a different a href#application-cache idthe-object-element:application-cache-3>application cache/a>. Even if the resource is then found to have a different type, it is still used as part of a a href#nested-browsing-context idthe-object-element:nested-browsing-context-11>nested browsing context/a>: only the a href#navigate idthe-object-element:navigate-3>navigate/a> algorithm is restarted, not this code idthe-object-element:the-object-element-21>a href#the-object-element>object/a>/code> algorithm./p> dt>If the var>resource type/var> starts with code>image//code>, and support for images has not been disableddd> p>If the code idthe-object-element:the-object-element-22>a href#the-object-element>object/a>/code> elements a href#nested-browsing-context idthe-object-element:nested-browsing-context-12>nested browsing context/a> is non-null, then it must be a href#a-browsing-context-is-discarded idthe-object-element:a-browsing-context-is-discarded-2>discarded/a> and then set to null./p> p>Apply the a hrefhttps://mimesniff.spec.whatwg.org/#rules-for-sniffing-images-specifically idthe-object-element:content-type-sniffing:-image data-x-internalcontent-type-sniffing:-image>image sniffing/a> rules to determine the type of the image./p> p>The code idthe-object-element:the-object-element-23>a href#the-object-element>object/a>/code> element a href#represents idthe-object-element:represents-2>represents/a> the specified image./p> p>If the image cannot be rendered, e.g. because it is malformed or in an unsupported format, jump to the step below labeled i>fallback/i>./p> dt>Otherwisedd> p>The given var>resource type/var> is not supported. Jump to the step below labeled i>fallback/i>./p> p classnote>If the previous step ended with the var>resource type/var> being unknown, this is the case that is triggered./p> /dl> li>p>The elements contents are not part of what the code idthe-object-element:the-object-element-24>a href#the-object-element>object/a>/code> element represents./p> li> p>Abort these steps. Once the resource is completely loaded, a href#queue-a-task idthe-object-element:queue-a-task-6>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-object-element:concept-event-fire-4 data-x-internalconcept-event-fire>fire an event/a> named code idthe-object-element:event-load-3>a href#event-load>load/a>/code> at the element./p> /ol> li>p>If the code idthe-object-element:attr-object-data-12>a href#attr-object-data>data/a>/code> attribute is absent but the code idthe-object-element:attr-object-type-16>a href#attr-object-type>type/a>/code> attribute is present, and the user agent can find a a href#plugin idthe-object-element:plugin-15>plugin/a> suitable according to the value of the code idthe-object-element:attr-object-type-17>a href#attr-object-type>type/a>/code> attribute, and either a href#sandboxPluginObject>plugins arent being sandboxed/a> or the a href#plugin idthe-object-element:plugin-16>plugin/a> can be a href#concept-plugin-secure idthe-object-element:concept-plugin-secure-3>secured/a>, then that a href#plugin idthe-object-element:plugin-17>plugin/a> a href#object-plugin>should be used/a>. If these conditions cannot be met, or if the a href#plugin idthe-object-element:plugin-18>plugin/a> reports an error, jump to the step below labeled i>fallback/i>. Otherwise abort these steps; once the plugin is completely loaded, a href#queue-a-task idthe-object-element:queue-a-task-7>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-object-element:concept-event-fire-5 data-x-internalconcept-event-fire>fire an event/a> named code idthe-object-element:event-load-4>a href#event-load>load/a>/code> at the element.li>p>i>Fallback/i>: The code idthe-object-element:the-object-element-25>a href#the-object-element>object/a>/code> element a href#represents idthe-object-element:represents-3>represents/a> the elements children, ignoring any leading code idthe-object-element:the-param-element-2>a href#the-param-element>param/a>/code> element children. This is the elements a href#fallback-content idthe-object-element:fallback-content-5>fallback content/a>. If the element has an instantiated a href#plugin idthe-object-element:plugin-19>plugin/a>, then unload it. If the elements a href#nested-browsing-context idthe-object-element:nested-browsing-context-13>nested browsing context/a> is non-null, then it must be a href#a-browsing-context-is-discarded idthe-object-element:a-browsing-context-is-discarded-3>discarded/a> and then set to null./ol> p idobject-plugin>When the algorithm above instantiates a a href#plugin idthe-object-element:plugin-20>plugin/a>, the user agent should pass to the a href#plugin idthe-object-element:plugin-21>plugin/a> used the names and values of all the attributes on the element, in the order they were added to the element, with the attributes added by the parser being ordered in source order, followed by a parameter named PARAM whose value is null, followed by all the names and values of a href#concept-param-parameter idthe-object-element:concept-param-parameter>parameters/a> given by code idthe-object-element:the-param-element-3>a href#the-param-element>param/a>/code> elements that are children of the code idthe-object-element:the-object-element-26>a href#the-object-element>object/a>/code> element, in a idthe-object-element:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>. If the a href#plugin idthe-object-element:plugin-22>plugin/a> supports a scriptable interface, the code idthe-object-element:htmlobjectelement>a href#htmlobjectelement>HTMLObjectElement/a>/code> object representing the element should expose that interface. The code idthe-object-element:the-object-element-27>a href#the-object-element>object/a>/code> element a href#represents idthe-object-element:represents-4>represents/a> the a href#plugin idthe-object-element:plugin-23>plugin/a>. The a href#plugin idthe-object-element:plugin-24>plugin/a> is not a nested a href#browsing-context idthe-object-element:browsing-context-2>browsing context/a>./p> p idsandboxPluginObject>Plugins are considered sandboxed for the purpose of an code idthe-object-element:the-object-element-28>a href#the-object-element>object/a>/code> element if the a href#sandboxed-plugins-browsing-context-flag idthe-object-element:sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag/a> is set on the code idthe-object-element:the-object-element-29>a href#the-object-element>object/a>/code> elements a idthe-object-element:node-document-8 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#active-sandboxing-flag-set idthe-object-element:active-sandboxing-flag-set>active sandboxing flag set/a>./p> p>Due to the algorithm above, the contents of code idthe-object-element:the-object-element-30>a href#the-object-element>object/a>/code> elements act as a href#fallback-content idthe-object-element:fallback-content-6>fallback content/a>, used only when referenced resources cant be shown (e.g. because it returned a 404 error). This allows multiple code idthe-object-element:the-object-element-31>a href#the-object-element>object/a>/code> elements to be nested inside each other, targeting multiple user agents with different capabilities, with the user agent picking the first one it supports./p> p>When an code idthe-object-element:the-object-element-32>a href#the-object-element>object/a>/code> elements a href#nested-browsing-context idthe-object-element:nested-browsing-context-14>nested browsing context/a> is non-null: if the code idthe-object-element:the-object-element-33>a href#the-object-element>object/a>/code> elements a href#nested-browsing-context idthe-object-element:nested-browsing-context-15>nested browsing context/a>s a href#active-document idthe-object-element:active-document>active document/a> is not a href#ready-for-post-load-tasks idthe-object-element:ready-for-post-load-tasks>ready for post-load tasks/a>, and when anything is a href#delay-the-load-event idthe-object-element:delay-the-load-event-3>delaying the load event/a> of the code idthe-object-element:the-object-element-34>a href#the-object-element>object/a>/code> elements a href#browsing-context idthe-object-element:browsing-context-3>browsing context/a>s a href#active-document idthe-object-element:active-document-2>active document/a>, and when the code idthe-object-element:the-object-element-35>a href#the-object-element>object/a>/code> elements a href#browsing-context idthe-object-element:browsing-context-4>browsing context/a> is in the a href#delaying-load-events-mode idthe-object-element:delaying-load-events-mode>delaying code>load/code> events mode/a>, the code idthe-object-element:the-object-element-36>a href#the-object-element>object/a>/code> must a href#delay-the-load-event idthe-object-element:delay-the-load-event-4>delay the load event/a> of its document./p> p>The a href#task-source idthe-object-element:task-source>task source/a> for the a href#concept-task idthe-object-element:concept-task-4>tasks/a> mentioned in this section is the a href#dom-manipulation-task-source idthe-object-element:dom-manipulation-task-source>DOM manipulation task source/a>./p> p>The code idthe-object-element:attr-hyperlink-usemap-3>a href#attr-hyperlink-usemap>usemap/a>/code> attribute, if present while the code idthe-object-element:the-object-element-37>a href#the-object-element>object/a>/code> element represents an image, can indicate that the object has an associated a href#image-map idthe-object-element:image-map-2>image map/a>. The attribute must be ignored if the code idthe-object-element:the-object-element-38>a href#the-object-element>object/a>/code> element doesnt represent an image./p> p>The code idthe-object-element:attr-fae-form-2>a href#attr-fae-form>form/a>/code> attribute is used to explicitly associate the code idthe-object-element:the-object-element-39>a href#the-object-element>object/a>/code> element with its a href#form-owner idthe-object-element:form-owner>form owner/a>./p> p>strong>Constraint validation/strong>: code idthe-object-element:the-object-element-40>a href#the-object-element>object/a>/code> elements are always a href#barred-from-constraint-validation idthe-object-element:barred-from-constraint-validation>barred from constraint validation/a>./p> p>The code idthe-object-element:the-object-element-41>a href#the-object-element>object/a>/code> element supports a href#dimension-attributes idthe-object-element:dimension-attributes>dimension attributes/a>./p> p>The IDL attributes dfn iddom-object-data>code>data/code>/dfn>, dfn iddom-object-type>code>type/code>/dfn> and dfn iddom-object-name>code>name/code>/dfn> each must a href#reflect idthe-object-element:reflect>reflect/a> the respective content attributes of the same name. The dfn iddom-object-typemustmatch>code>typeMustMatch/code>/dfn> IDL attribute must a href#reflect idthe-object-element:reflect-2>reflect/a> the code idthe-object-element:attr-object-typemustmatch-6>a href#attr-object-typemustmatch>typemustmatch/a>/code> content attribute. The dfn iddom-object-usemap>code>useMap/code>/dfn> IDL attribute must a href#reflect idthe-object-element:reflect-3>reflect/a> the code idthe-object-element:attr-hyperlink-usemap-4>a href#attr-hyperlink-usemap>usemap/a>/code> content attribute./p> p>The dfn iddom-object-contentdocument>code>contentDocument/code>/dfn> IDL attribute, on getting, must return the code idthe-object-element:the-object-element-42>a href#the-object-element>object/a>/code> elements a href#concept-bcc-content-document idthe-object-element:concept-bcc-content-document>content document/a>./p> p>The dfn iddom-object-contentwindow>code>contentWindow/code>/dfn> IDL attribute must return the code idthe-object-element:windowproxy-2>a href#windowproxy>WindowProxy/a>/code> object of the code idthe-object-element:the-object-element-43>a href#the-object-element>object/a>/code> elements a href#nested-browsing-context idthe-object-element:nested-browsing-context-16>nested browsing context/a>, if its a href#nested-browsing-context idthe-object-element:nested-browsing-context-17>nested browsing context/a> is non-null; otherwise, it must return null./p> p>The code idthe-object-element:dom-cva-willvalidate-2>a href#dom-cva-willvalidate>willValidate/a>/code>, code idthe-object-element:dom-cva-validity-2>a href#dom-cva-validity>validity/a>/code>, and code idthe-object-element:dom-cva-validationmessage-2>a href#dom-cva-validationmessage>validationMessage/a>/code> attributes, and the code idthe-object-element:dom-cva-checkvalidity-2>a href#dom-cva-checkvalidity>checkValidity()/a>/code>, code idthe-object-element:dom-cva-reportvalidity-2>a href#dom-cva-reportvalidity>reportValidity()/a>/code>, and code idthe-object-element:dom-cva-setcustomvalidity-2>a href#dom-cva-setcustomvalidity>setCustomValidity()/a>/code> methods, are part of the a href#the-constraint-validation-api idthe-object-element:the-constraint-validation-api>constraint validation API/a>. The code idthe-object-element:dom-fae-form-2>a href#dom-fae-form>form/a>/code> IDL attribute is part of the elements forms API./p> div classexample> p>In this example, an HTML page is embedded in another using the code idthe-object-element:the-object-element-44>a href#the-object-element>object/a>/code> element./p> pre><figure> <object dataclock.html></object> <figcaption>My HTML Clock</figcaption></figure>/pre> /div> div classexample> p>The following example shows how a plugin can be used in HTML (in this case the Flash plugin, to show a video file). Fallback is provided for users who do not have Flash enabled, in this case using the code idthe-object-element:the-video-element>a href#the-video-element>video/a>/code> element to show the video for those using user agents that support code idthe-object-element:the-video-element-2>a href#the-video-element>video/a>/code>, and finally providing a link to the video for those who have neither Flash nor a code idthe-object-element:the-video-element-3>a href#the-video-element>video/a>/code>-capable browser./p> pre><p>Look at my video: <object typeapplication/x-shockwave-flash> <param namemovie valuehttps://video.example.com/library/watch.swf> <param nameallowfullscreen valuetrue> <param nameflashvars valuehttps://video.example.com/vids/315981> <video controls srchttps://video.example.com/vids/315981> <a hrefhttps://video.example.com/vids/315981>View video</a>. </video> </object></p>/pre> /div> h4 idthe-param-element>span classsecno>4.8.8/span> The dfn>code>param/code>/dfn> elementa href#the-param-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-param-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-param-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As a child of an code idthe-param-element:the-object-element>a href#the-object-element>object/a>/code> element, before any a href#flow-content-2 idthe-param-element:flow-content-2>flow content/a>.dt>a href#concept-element-content-model idthe-param-element:concept-element-content-model>Content model/a>:dd>a href#concept-content-nothing idthe-param-element:concept-content-nothing>Nothing/a>.dt>a href#concept-element-tag-omission idthe-param-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>No a href#syntax-end-tag idthe-param-element:syntax-end-tag>end tag/a>.dt>a href#concept-element-attributes idthe-param-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-param-element:global-attributes>Global attributes/a>dd>code idthe-param-element:attr-param-name>a href#attr-param-name>name/a>/code> — Name of parameterdd>code idthe-param-element:attr-param-value>a href#attr-param-value>value/a>/code> — Value of parameterdt>a href#concept-element-dom idthe-param-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-param-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlparamelement>HTMLParamElement/dfn> : a href#htmlelement idthe-param-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-param-element:cereactions>CEReactions/a> attribute DOMString a href#dom-param-name idthe-param-element:dom-param-name>name/a>; a href#cereactions idthe-param-element:cereactions-2>CEReactions/a> attribute DOMString a href#dom-param-value idthe-param-element:dom-param-value>value/a>; // a href#HTMLParamElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-param-element:the-param-element>a href#the-param-element>param/a>/code> element defines parameters for plugins invoked by code idthe-param-element:the-object-element-2>a href#the-object-element>object/a>/code> elements. It does not a href#represents idthe-param-element:represents>represent/a> anything on its own./p> p>The dfn idattr-param-name>code>name/code>/dfn> attribute gives the name of the parameter./p> p>The dfn idattr-param-value>code>value/code>/dfn> attribute gives the value of the parameter./p> p>Both attributes must be present. They may have any value./p> p>If both attributes are present, and if the parent element of the code idthe-param-element:the-param-element-2>a href#the-param-element>param/a>/code> is an code idthe-param-element:the-object-element-3>a href#the-object-element>object/a>/code> element, then the element defines a dfn idconcept-param-parameter>parameter/dfn> with the given name-value pair./p> p>If either the name or value of a a href#concept-param-parameter idthe-param-element:concept-param-parameter>parameter/a> defined by a code idthe-param-element:the-param-element-3>a href#the-param-element>param/a>/code> element that is the child of an code idthe-param-element:the-object-element-4>a href#the-object-element>object/a>/code> element that a href#represents idthe-param-element:represents-2>represents/a> an instantiated a href#plugin idthe-param-element:plugin>plugin/a> changes, and if that a href#plugin idthe-param-element:plugin-2>plugin/a> is communicating with the user agent using an API that features the ability to update the a href#plugin idthe-param-element:plugin-3>plugin/a> when the name or value of a a href#concept-param-parameter idthe-param-element:concept-param-parameter-2>parameter/a> so changes, then the user agent must appropriately exercise that ability to notify the a href#plugin idthe-param-element:plugin-4>plugin/a> of the change./p> p>The IDL attributes dfn iddom-param-name>code>name/code>/dfn> and dfn iddom-param-value>code>value/code>/dfn> must both a href#reflect idthe-param-element:reflect>reflect/a> the respective content attributes of the same name./p> div classexample> p>The following example shows how the code idthe-param-element:the-param-element-4>a href#the-param-element>param/a>/code> element can be used to pass a parameter to a plugin, in this case the O3D plugin./p> pre><!DOCTYPE HTML><html langen> <head> <title>O3D Utah Teapot</title> </head> <body> <p> <object typeapplication/vnd.o3d.auto> strong><param nameo3d_features valueFloatingPointTextures>/strong> <img srco3d-teapot.png title3D Utah Teapot illustration rendered using O3D. altWhen O3D renders the Utah Teapot, it appears as a squat teapot with a shiny metallic finish on which the surroundings are reflected, with a faint shadow caused by the lighting.> <p>To see the teapot actually rendered by O3D on your computer, please download and install the <a hrefhttp://code.google.com/apis/o3d/docs/gettingstarted.html#install>O3D plugin</a>.</p> </object> <script srco3d-teapot.js></script> </p> </body></html>/pre> /div> h4 idthe-video-element>span classsecno>4.8.9/span> The dfn idvideo>code>video/code>/dfn> elementa href#the-video-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> videospan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>3.2+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>20+/span>/span>span classie yes>span>IE/span> span>9+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>4+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.3+/span>/span>span classopera yes>span>Opera/span> span>10.5+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featvideo>caniuse.com/a>/div> dl classelement>dt>a href#concept-element-categories idthe-video-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-video-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-video-element:phrasing-content-2>Phrasing content/a>.dd>a href#embedded-content-category idthe-video-element:embedded-content-category>Embedded content/a>.dd>If the element has a code idthe-video-element:attr-media-controls>a href#attr-media-controls>controls/a>/code> attribute: a href#interactive-content-2 idthe-video-element:interactive-content-2>Interactive content/a>.dd>a href#palpable-content-2 idthe-video-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-video-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#embedded-content-category idthe-video-element:embedded-content-category-2>embedded content/a> is expected.dt>a href#concept-element-content-model idthe-video-element:concept-element-content-model>Content model/a>:dd>If the element has a code idthe-video-element:attr-media-src>a href#attr-media-src>src/a>/code> attribute: zero or more code idthe-video-element:the-track-element>a href#the-track-element>track/a>/code> elements, then a href#transparent idthe-video-element:transparent>transparent/a>, but with no a href#media-element idthe-video-element:media-element>media element/a> descendants.dd>If the element does not have a code idthe-video-element:attr-media-src-2>a href#attr-media-src>src/a>/code> attribute: zero or more code idthe-video-element:the-source-element>a href#the-source-element>source/a>/code> elements, then zero or more code idthe-video-element:the-track-element-2>a href#the-track-element>track/a>/code> elements, then a href#transparent idthe-video-element:transparent-2>transparent/a>, but with no a href#media-element idthe-video-element:media-element-2>media element/a> descendants.dt>a href#concept-element-tag-omission idthe-video-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-video-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-video-element:global-attributes>Global attributes/a>dd>code idthe-video-element:attr-media-src-3>a href#attr-media-src>src/a>/code> — Address of the resourcedd>code idthe-video-element:attr-media-crossorigin>a href#attr-media-crossorigin>crossorigin/a>/code> — How the element handles crossorigin requestsdd>code idthe-video-element:attr-video-poster>a href#attr-video-poster>poster/a>/code> — Poster frame to show prior to video playbackdd>code idthe-video-element:attr-media-preload>a href#attr-media-preload>preload/a>/code> — Hints how much buffering the a href#media-resource idthe-video-element:media-resource>media resource/a> will likely needdd>code idthe-video-element:attr-media-autoplay>a href#attr-media-autoplay>autoplay/a>/code> — Hint that the a href#media-resource idthe-video-element:media-resource-2>media resource/a> can be started automatically when the page is loadeddd>code idthe-video-element:attr-video-playsinline>a href#attr-video-playsinline>playsinline/a>/code> — Encourage the user agent to display video content within the elements playback areadd>code idthe-video-element:attr-media-loop>a href#attr-media-loop>loop/a>/code> — Whether to loop the a href#media-resource idthe-video-element:media-resource-3>media resource/a>dd>code idthe-video-element:attr-media-muted>a href#attr-media-muted>muted/a>/code> — Whether to mute the a href#media-resource idthe-video-element:media-resource-4>media resource/a> by defaultdd>code idthe-video-element:attr-media-controls-2>a href#attr-media-controls>controls/a>/code> — Show user agent controlsdd>code idthe-video-element:attr-dim-width>a href#attr-dim-width>width/a>/code> — Horizontal dimensiondd>code idthe-video-element:attr-dim-height>a href#attr-dim-height>height/a>/code> — Vertical dimensiondt>a href#concept-element-dom idthe-video-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-video-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlvideoelement>HTMLVideoElement/dfn> : a href#htmlmediaelement idthe-video-element:htmlmediaelement>HTMLMediaElement/a> { a href#cereactions idthe-video-element:cereactions>CEReactions/a> attribute unsigned long a href#dom-dim-width idthe-video-element:dom-dim-width>width/a>; a href#cereactions idthe-video-element:cereactions-2>CEReactions/a> attribute unsigned long a href#dom-dim-height idthe-video-element:dom-dim-height>height/a>; readonly attribute unsigned long a href#dom-video-videowidth idthe-video-element:dom-video-videowidth>videoWidth/a>; readonly attribute unsigned long a href#dom-video-videoheight idthe-video-element:dom-video-videoheight>videoHeight/a>; a href#cereactions idthe-video-element:cereactions-3>CEReactions/a> attribute USVString a href#dom-video-poster idthe-video-element:dom-video-poster>poster/a>; a href#cereactions idthe-video-element:cereactions-4>CEReactions/a> attribute boolean a href#dom-video-playsinline idthe-video-element:dom-video-playsinline>playsInline/a>;};/pre> /dl> p>A code idthe-video-element:the-video-element>a href#the-video-element>video/a>/code> element is used for playing videos or movies, and audio files with captions./p> p>Content may be provided inside the code idthe-video-element:the-video-element-2>a href#the-video-element>video/a>/code> element. User agents should not show this content to the user; it is intended for older Web browsers which do not support code idthe-video-element:the-video-element-3>a href#the-video-element>video/a>/code>, so that legacy video plugins can be tried, or to show text to the users of these older browsers informing them of how to access the video contents./p> p classnote>In particular, this content is not intended to address accessibility concerns. To make video content accessible to the partially sighted, the blind, the hard-of-hearing, the deaf, and those with other physical or cognitive disabilities, a variety of features are available. Captions can be provided, either embedded in the video stream or as external files using the code idthe-video-element:the-track-element-3>a href#the-track-element>track/a>/code> element. Sign-language tracks can be embedded in the video stream. Audio descriptions can be embedded in the video stream or in text form using a a idthe-video-element:webvtt-file hrefhttps://w3c.github.io/webvtt/#webvtt-file data-x-internalwebvtt-file>WebVTT file/a> referenced using the code idthe-video-element:the-track-element-4>a href#the-track-element>track/a>/code> element and synthesized into speech by the user agent. WebVTT can also be used to provide chapter titles. For users who would rather not use a media element at all, transcripts or other textual alternatives can be provided by simply linking to them in the prose near the code idthe-video-element:the-video-element-4>a href#the-video-element>video/a>/code> element. a href#refsWEBVTT>WEBVTT/a>/p> p>The code idthe-video-element:the-video-element-5>a href#the-video-element>video/a>/code> element is a a href#media-element idthe-video-element:media-element-3>media element/a> whose a href#media-data idthe-video-element:media-data>media data/a> is ostensibly video data, possibly with associated audio data./p> p>The code idthe-video-element:attr-media-src-4>a href#attr-media-src>src/a>/code>, code idthe-video-element:attr-media-preload-2>a href#attr-media-preload>preload/a>/code>, code idthe-video-element:attr-media-autoplay-2>a href#attr-media-autoplay>autoplay/a>/code>, code idthe-video-element:attr-media-loop-2>a href#attr-media-loop>loop/a>/code>, code idthe-video-element:attr-media-muted-2>a href#attr-media-muted>muted/a>/code>, and code idthe-video-element:attr-media-controls-3>a href#attr-media-controls>controls/a>/code> attributes are a href#media-element-attributes idthe-video-element:media-element-attributes>the attributes common to all media elements/a>./p> p>The dfn idattr-video-poster>code>poster/code>/dfn> attribute gives the a idthe-video-element:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of an image file that the user agent can show while no video data is available. The attribute, if present, must contain a a href#valid-non-empty-url-potentially-surrounded-by-spaces idthe-video-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces/a>./p> p>If the specified resource is to be used, then, when the element is created or when the code idthe-video-element:attr-video-poster-2>a href#attr-video-poster>poster/a>/code> attribute is set, changed, or removed, the user agent must run the following steps to determine the elements dfn idposter-frame>poster frame/dfn> (regardless of the value of the elements a href#show-poster-flag idthe-video-element:show-poster-flag>show poster flag/a>):/p> ol>li>p>If there is an existing instance of this algorithm running for this code idthe-video-element:the-video-element-6>a href#the-video-element>video/a>/code> element, abort that instance of this algorithm without changing the a href#poster-frame idthe-video-element:poster-frame>poster frame/a>.li>p>If the code idthe-video-element:attr-video-poster-3>a href#attr-video-poster>poster/a>/code> attributes value is the empty string or if the attribute is absent, then there is no a href#poster-frame idthe-video-element:poster-frame-2>poster frame/a>; abort these steps.li>p>a href#parse-a-url idthe-video-element:parse-a-url>Parse/a> the code idthe-video-element:attr-video-poster-4>a href#attr-video-poster>poster/a>/code> attributes value relative to the elements a idthe-video-element:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>. If this fails, then there is no a href#poster-frame idthe-video-element:poster-frame-3>poster frame/a>; abort these steps.li>p>Let var>request/var> be a new a hrefhttps://fetch.spec.whatwg.org/#concept-request idthe-video-element:concept-request data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idthe-video-element:concept-request-url data-x-internalconcept-request-url>url/a> is the a href#resulting-url-record idthe-video-element:resulting-url-record>resulting URL record/a>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-client idthe-video-element:concept-request-client data-x-internalconcept-request-client>client/a> is the elements a idthe-video-element:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s code idthe-video-element:window>a href#window>Window/a>/code> objects a href#environment-settings-object idthe-video-element:environment-settings-object>environment settings object/a>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination idthe-video-element:concept-request-destination data-x-internalconcept-request-destination>destination/a> is code>image/code>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode idthe-video-element:concept-request-credentials-mode data-x-internalconcept-request-credentials-mode>credentials mode/a> is code>include/code>, and whose a idthe-video-element:use-url-credentials-flag hrefhttps://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag data-x-internaluse-url-credentials-flag>use-URL-credentials flag/a> is set. li>p>a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idthe-video-element:concept-fetch data-x-internalconcept-fetch>Fetch/a> var>request/var>. This must a href#delay-the-load-event idthe-video-element:delay-the-load-event>delay the load event/a> of the elements a idthe-video-element:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>.li>p>If an image is thus obtained, the a href#poster-frame idthe-video-element:poster-frame-4>poster frame/a> is that image. Otherwise, there is no a href#poster-frame idthe-video-element:poster-frame-5>poster frame/a>./ol> p classnote>The image given by the code idthe-video-element:attr-video-poster-5>a href#attr-video-poster>poster/a>/code> attribute, the i idthe-video-element:poster-frame-6>a href#poster-frame>poster frame/a>/i>, is intended to be a representative frame of the video (typically one of the first non-blank frames) that gives the user an idea of what the video is like./p> p>The dfn idattr-video-playsinline>code>playsinline/code>/dfn> attribute is a a href#boolean-attribute idthe-video-element:boolean-attribute>boolean attribute/a>. If present, it serves as a hint to the user agent that the video ought to be displayed inline in the document by default, constrained to the elements playback area, instead of being displayed fullscreen or in an independent resizable window./p> p classnote>The absence of the code idthe-video-element:attr-video-playsinline-2>a href#attr-video-playsinline>playsinline/a>/code> attributes does not imply that the video will display fullscreen by default. Indeed, most user agents have chosen to play all videos inline by default, and in such user agents the code idthe-video-element:attr-video-playsinline-3>a href#attr-video-playsinline>playsinline/a>/code> attribute has no effect./p> hr> p>A code idthe-video-element:the-video-element-7>a href#the-video-element>video/a>/code> element represents what is given for the first matching condition in the list below:/p> dl classswitch>dt>When no video data is available (the elements code idthe-video-element:dom-media-readystate>a href#dom-media-readystate>readyState/a>/code> attribute is either code idthe-video-element:dom-media-have_nothing>a href#dom-media-have_nothing>HAVE_NOTHING/a>/code>, or code idthe-video-element:dom-media-have_metadata>a href#dom-media-have_metadata>HAVE_METADATA/a>/code> but no video data has yet been obtained at all, or the elements code idthe-video-element:dom-media-readystate-2>a href#dom-media-readystate>readyState/a>/code> attribute is any subsequent value but the a href#media-resource idthe-video-element:media-resource-5>media resource/a> does not have a video channel)dd>The code idthe-video-element:the-video-element-8>a href#the-video-element>video/a>/code> element a href#represents idthe-video-element:represents>represents/a> its a href#poster-frame idthe-video-element:poster-frame-7>poster frame/a>, if any, or else a href#transparent-black idthe-video-element:transparent-black>transparent black/a> with no a idthe-video-element:intrinsic-dimensions hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic data-x-internalintrinsic-dimensions>intrinsic dimensions/a>.dt>When the code idthe-video-element:the-video-element-9>a href#the-video-element>video/a>/code> element is a href#dom-media-paused idthe-video-element:dom-media-paused>paused/a>, the a href#current-playback-position idthe-video-element:current-playback-position>current playback position/a> is the first frame of video, and the elements a href#show-poster-flag idthe-video-element:show-poster-flag-2>show poster flag/a> is setdd>The code idthe-video-element:the-video-element-10>a href#the-video-element>video/a>/code> element a href#represents idthe-video-element:represents-2>represents/a> its a href#poster-frame idthe-video-element:poster-frame-8>poster frame/a>, if any, or else the first frame of the video.dt>When the code idthe-video-element:the-video-element-11>a href#the-video-element>video/a>/code> element is a href#dom-media-paused idthe-video-element:dom-media-paused-2>paused/a>, and the frame of video corresponding to the a href#current-playback-position idthe-video-element:current-playback-position-2>current playback position/a> is not available (e.g. because the video is seeking or buffering)dt>When the code idthe-video-element:the-video-element-12>a href#the-video-element>video/a>/code> element is neither a href#potentially-playing idthe-video-element:potentially-playing>potentially playing/a> nor a href#dom-media-paused idthe-video-element:dom-media-paused-3>paused/a> (e.g. when seeking or stalled)dd>The code idthe-video-element:the-video-element-13>a href#the-video-element>video/a>/code> element a href#represents idthe-video-element:represents-3>represents/a> the last frame of the video to have been rendered.dt>When the code idthe-video-element:the-video-element-14>a href#the-video-element>video/a>/code> element is a href#dom-media-paused idthe-video-element:dom-media-paused-4>paused/a>dd>The code idthe-video-element:the-video-element-15>a href#the-video-element>video/a>/code> element a href#represents idthe-video-element:represents-4>represents/a> the frame of video corresponding to the a href#current-playback-position idthe-video-element:current-playback-position-3>current playback position/a>.dt>Otherwise (the code idthe-video-element:the-video-element-16>a href#the-video-element>video/a>/code> element has a video channel and is a href#potentially-playing idthe-video-element:potentially-playing-2>potentially playing/a>)dd>The code idthe-video-element:the-video-element-17>a href#the-video-element>video/a>/code> element a href#represents idthe-video-element:represents-5>represents/a> the frame of video at the continuously increasing a href#current-playback-position idthe-video-element:current-playback-position-4>current position/a>. When the a href#current-playback-position idthe-video-element:current-playback-position-5>current playback position/a> changes such that the last frame rendered is no longer the frame corresponding to the a href#current-playback-position idthe-video-element:current-playback-position-6>current playback position/a> in the video, the new frame must be rendered./dl> p>Frames of video must be obtained from the video track that was a href#dom-videotrack-selected idthe-video-element:dom-videotrack-selected>selected/a> when the a href#event-loop idthe-video-element:event-loop>event loop/a> last reached a href#step1>step 1/a>./p> p classnote>Which frame in a video stream corresponds to a particular playback position is defined by the video streams format./p> p>The code idthe-video-element:the-video-element-18>a href#the-video-element>video/a>/code> element also a href#represents idthe-video-element:represents-6>represents/a> any a href#text-track-cue idthe-video-element:text-track-cue>text track cues/a> whose a href#text-track-cue-active-flag idthe-video-element:text-track-cue-active-flag>text track cue active flag/a> is set and whose a href#text-track idthe-video-element:text-track>text track/a> is in the a href#text-track-showing idthe-video-element:text-track-showing>showing/a> mode, and any audio from the a href#media-resource idthe-video-element:media-resource-6>media resource/a>, at the a href#current-playback-position idthe-video-element:current-playback-position-7>current playback position/a>./p> p>Any audio associated with the a href#media-resource idthe-video-element:media-resource-7>media resource/a> must, if played, be played synchronized with the a href#current-playback-position idthe-video-element:current-playback-position-8>current playback position/a>, at the elements a href#effective-media-volume idthe-video-element:effective-media-volume>effective media volume/a>. The user agent must play the audio from audio tracks that were a href#dom-audiotrack-enabled idthe-video-element:dom-audiotrack-enabled>enabled/a> when the a href#event-loop idthe-video-element:event-loop-2>event loop/a> last reached step 1./p> p>In addition to the above, the user agent may provide messages to the user (such as buffering, no video loaded, error, or more detailed information) by overlaying text or icons on the video or other areas of the elements playback area, or in another appropriate manner./p> p>User agents that cannot render the video may instead make the element a href#represents idthe-video-element:represents-7>represent/a> a link to an external video playback utility or to the video data itself./p> p>When a code idthe-video-element:the-video-element-19>a href#the-video-element>video/a>/code> elements a href#media-resource idthe-video-element:media-resource-8>media resource/a> has a video channel, the element provides a a idthe-video-element:paint-source hrefhttps://drafts.csswg.org/css-images-4/#paint-source data-x-internalpaint-source>paint source/a> whose width is the a href#media-resource idthe-video-element:media-resource-9>media resource/a>s a href#concept-video-intrinsic-width idthe-video-element:concept-video-intrinsic-width>intrinsic width/a>, whose height is the a href#media-resource idthe-video-element:media-resource-10>media resource/a>s a href#concept-video-intrinsic-height idthe-video-element:concept-video-intrinsic-height>intrinsic height/a>, and whose appearance is the frame of video corresponding to the a href#current-playback-position idthe-video-element:current-playback-position-9>current playback position/a>, if that is available, or else (e.g. when the video is seeking or buffering) its previous appearance, if any, or else (e.g. because the video is still loading the first frame) blackness./p> hr> dl classdomintro>dt>var>video/var> . code idthe-video-element:dom-video-videowidth-2>a href#dom-video-videowidth>videoWidth/a>/code>dt>var>video/var> . code idthe-video-element:dom-video-videoheight-2>a href#dom-video-videoheight>videoHeight/a>/code>dd> p>These attributes return the intrinsic dimensions of the video, or zero if the dimensions are not known./p> /dl> p>The dfn idconcept-video-intrinsic-width>intrinsic width/dfn> and dfn idconcept-video-intrinsic-height>intrinsic height/dfn> of the a href#media-resource idthe-video-element:media-resource-11>media resource/a> are the dimensions of the resource in a hrefhttps://drafts.csswg.org/css-values/#px idthe-video-element:px data-x-internalpx>CSS pixels/a> after taking into account the resources dimensions, aspect ratio, clean aperture, resolution, and so forth, as defined for the format used by the resource. If an anamorphic format does not define how to apply the aspect ratio to the video datas dimensions to obtain the correct dimensions, then the user agent must apply the ratio by increasing one dimension and leaving the other unchanged./p> p>The dfn iddom-video-videowidth>code>videoWidth/code>/dfn> IDL attribute must return the a href#concept-video-intrinsic-width idthe-video-element:concept-video-intrinsic-width-2>intrinsic width/a> of the video in a hrefhttps://drafts.csswg.org/css-values/#px idthe-video-element:px-2 data-x-internalpx>CSS pixels/a>. The dfn iddom-video-videoheight>code>videoHeight/code>/dfn> IDL attribute must return the a href#concept-video-intrinsic-height idthe-video-element:concept-video-intrinsic-height-2>intrinsic height/a> of the video in a hrefhttps://drafts.csswg.org/css-values/#px idthe-video-element:px-3 data-x-internalpx>CSS pixels/a>. If the elements code idthe-video-element:dom-media-readystate-3>a href#dom-media-readystate>readyState/a>/code> attribute is code idthe-video-element:dom-media-have_nothing-2>a href#dom-media-have_nothing>HAVE_NOTHING/a>/code>, then the attributes must return 0./p> p iddimUpdate>Whenever the a href#concept-video-intrinsic-width idthe-video-element:concept-video-intrinsic-width-3>intrinsic width/a> or a href#concept-video-intrinsic-height idthe-video-element:concept-video-intrinsic-height-3>intrinsic height/a> of the video changes (including, for example, because the a href#dom-videotrack-selected idthe-video-element:dom-videotrack-selected-2>selected video track/a> was changed), if the elements code idthe-video-element:dom-media-readystate-4>a href#dom-media-readystate>readyState/a>/code> attribute is not code idthe-video-element:dom-media-have_nothing-3>a href#dom-media-have_nothing>HAVE_NOTHING/a>/code>, the user agent must a href#queue-a-task idthe-video-element:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-video-element:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idthe-video-element:event-media-resize>a href#event-media-resize>resize/a>/code> at the a href#media-element idthe-video-element:media-element-4>media element/a>./p> p>The code idthe-video-element:the-video-element-20>a href#the-video-element>video/a>/code> element supports a href#dimension-attributes idthe-video-element:dimension-attributes>dimension attributes/a>./p> p>In the absence of style rules to the contrary, video content should be rendered inside the elements playback area such that the video content is shown centered in the playback area at the largest possible size that fits completely within it, with the video contents aspect ratio being preserved. Thus, if the aspect ratio of the playback area does not match the aspect ratio of the video, the video will be shown letterboxed or pillarboxed. Areas of the elements playback area that do not contain the video represent nothing./p> p classnote>In user agents that implement CSS, the above requirement can be implemented by using the a href#video-object-fit>style rule suggested in the rendering section/a>./p> p>The a href#intrinsic-width idthe-video-element:intrinsic-width>intrinsic width/a> of a code idthe-video-element:the-video-element-21>a href#the-video-element>video/a>/code> elements playback area is the a href#intrinsic-width idthe-video-element:intrinsic-width-2>intrinsic width/a> of the a href#poster-frame idthe-video-element:poster-frame-9>poster frame/a>, if that is available and the element currently a href#represents idthe-video-element:represents-8>represents/a> its poster frame; otherwise, it is the a href#concept-video-intrinsic-width idthe-video-element:concept-video-intrinsic-width-4>intrinsic width/a> of the video resource, if that is available; otherwise the a href#intrinsic-width idthe-video-element:intrinsic-width-3>intrinsic width/a> is missing./p> p>The a href#intrinsic-height idthe-video-element:intrinsic-height>intrinsic height/a> of a code idthe-video-element:the-video-element-22>a href#the-video-element>video/a>/code> elements playback area is the a href#intrinsic-height idthe-video-element:intrinsic-height-2>intrinsic height/a> of the a href#poster-frame idthe-video-element:poster-frame-10>poster frame/a>, if that is available and the element currently a href#represents idthe-video-element:represents-9>represents/a> its poster frame; otherwise it is the a href#concept-video-intrinsic-height idthe-video-element:concept-video-intrinsic-height-4>intrinsic height/a> of the video resource, if that is available; otherwise the a href#intrinsic-height idthe-video-element:intrinsic-height-3>intrinsic height/a> is missing./p> p>The a idthe-video-element:default-object-size hrefhttps://drafts.csswg.org/css-images/#default-object-size data-x-internaldefault-object-size>default object size/a> is a width of 300 a hrefhttps://drafts.csswg.org/css-values/#px idthe-video-element:px-4 data-x-internalpx>CSS pixels/a> and a height of 150 a hrefhttps://drafts.csswg.org/css-values/#px idthe-video-element:px-5 data-x-internalpx>CSS pixels/a>. a href#refsCSSIMAGES>CSSIMAGES/a>/p> p>A code idthe-video-element:the-video-element-23>a href#the-video-element>video/a>/code> element is said to dfn idintersect-the-viewport>intersect the viewport/dfn> when it is a href#being-rendered idthe-video-element:being-rendered>being rendered/a> and its associated CSS layout box intersects the a idthe-video-element:viewport hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>./p> hr> p>User agents should provide controls to enable or disable the display of closed captions, audio description tracks, and other additional data associated with the video stream, though such features should, again, not interfere with the pages normal rendering./p> p>User agents may allow users to view the video content in manners more suitable to the user, such as fullscreen or in an independent resizable window. User agents may even trigger such a viewing mode by default upon playing a video, although they should not do so when the code idthe-video-element:attr-video-playsinline-4>a href#attr-video-playsinline>playsinline/a>/code> attribute is specified. As with the other user interface features, controls to enable this should not interfere with the pages normal rendering unless the user agent is a href#expose-a-user-interface-to-the-user idthe-video-element:expose-a-user-interface-to-the-user>exposing a user interface/a>. In such an independent viewing mode, however, user agents may make full user interfaces visible, even if the code idthe-video-element:attr-media-controls-4>a href#attr-media-controls>controls/a>/code> attribute is absent./p> p>User agents may allow video playback to affect system features that could interfere with the users experience; for example, user agents could disable screensavers while video playback is in progress./p> hr> p>The dfn iddom-video-poster>code>poster/code>/dfn> IDL attribute must a href#reflect idthe-video-element:reflect>reflect/a> the code idthe-video-element:attr-video-poster-6>a href#attr-video-poster>poster/a>/code> content attribute./p> p>The dfn iddom-video-playsinline>code>playsInline/code>/dfn> IDL attribute must a href#reflect idthe-video-element:reflect-2>reflect/a> the code idthe-video-element:attr-video-playsinline-5>a href#attr-video-playsinline>playsinline/a>/code> content attribute./p> div classexample> p>This example shows how to detect when a video has failed to play correctly:/p> pre><script> function failed(e) { // video playback failed - show a message saying why switch (e.target.error.code) { case e.target.error.MEDIA_ERR_ABORTED: alert(You aborted the video playback.); break; case e.target.error.MEDIA_ERR_NETWORK: alert(A network error caused the video download to fail part-way.); break; case e.target.error.MEDIA_ERR_DECODE: alert(The video playback was aborted due to a corruption problem or because the video used features your browser did not support.); break; case e.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED: alert(The video could not be loaded, either because the server or network failed or because the format is not supported.); break; default: alert(An unknown error occurred.); break; } }</script><p><video srctgif.vid autoplay controls onerrorfailed(event)></video></p><p><a hreftgif.vid>Download the video file</a>.</p>/pre> /div> h4 idthe-audio-element>span classsecno>4.8.10/span> The dfn idaudio>code>audio/code>/dfn> elementa href#the-audio-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> audiospan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>4.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>20+/span>/span>span classie yes>span>IE/span> span>9+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>4+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.3+/span>/span>span classopera yes>span>Opera/span> span>10.5+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#feataudio>caniuse.com/a>/div> dl classelement>dt>a href#concept-element-categories idthe-audio-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-audio-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-audio-element:phrasing-content-2>Phrasing content/a>.dd>a href#embedded-content-category idthe-audio-element:embedded-content-category>Embedded content/a>.dd>If the element has a code idthe-audio-element:attr-media-controls>a href#attr-media-controls>controls/a>/code> attribute: a href#interactive-content-2 idthe-audio-element:interactive-content-2>Interactive content/a>.dd>If the element has a code idthe-audio-element:attr-media-controls-2>a href#attr-media-controls>controls/a>/code> attribute: a href#palpable-content-2 idthe-audio-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-audio-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#embedded-content-category idthe-audio-element:embedded-content-category-2>embedded content/a> is expected.dt>a href#concept-element-content-model idthe-audio-element:concept-element-content-model>Content model/a>:dd>If the element has a code idthe-audio-element:attr-media-src>a href#attr-media-src>src/a>/code> attribute:zero or more code idthe-audio-element:the-track-element>a href#the-track-element>track/a>/code> elements, thena href#transparent idthe-audio-element:transparent>transparent/a>, but with no a href#media-element idthe-audio-element:media-element>media element/a> descendants.dd>If the element does not have a code idthe-audio-element:attr-media-src-2>a href#attr-media-src>src/a>/code> attribute: zero or more code idthe-audio-element:the-source-element>a href#the-source-element>source/a>/code> elements, then zero or more code idthe-audio-element:the-track-element-2>a href#the-track-element>track/a>/code> elements, then a href#transparent idthe-audio-element:transparent-2>transparent/a>, but with no a href#media-element idthe-audio-element:media-element-2>media element/a> descendants.dt>a href#concept-element-tag-omission idthe-audio-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-audio-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-audio-element:global-attributes>Global attributes/a>dd>code idthe-audio-element:attr-media-src-3>a href#attr-media-src>src/a>/code> — Address of the resourcedd>code idthe-audio-element:attr-media-crossorigin>a href#attr-media-crossorigin>crossorigin/a>/code> — How the element handles crossorigin requestsdd>code idthe-audio-element:attr-media-preload>a href#attr-media-preload>preload/a>/code> — Hints how much buffering the a href#media-resource idthe-audio-element:media-resource>media resource/a> will likely needdd>code idthe-audio-element:attr-media-autoplay>a href#attr-media-autoplay>autoplay/a>/code> — Hint that the a href#media-resource idthe-audio-element:media-resource-2>media resource/a> can be started automatically when the page is loadeddd>code idthe-audio-element:attr-media-loop>a href#attr-media-loop>loop/a>/code> — Whether to loop the a href#media-resource idthe-audio-element:media-resource-3>media resource/a>dd>code idthe-audio-element:attr-media-muted>a href#attr-media-muted>muted/a>/code> — Whether to mute the a href#media-resource idthe-audio-element:media-resource-4>media resource/a> by defaultdd>code idthe-audio-element:attr-media-controls-3>a href#attr-media-controls>controls/a>/code> — Show user agent controlsdt>a href#concept-element-dom idthe-audio-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-audio-element:htmlconstructor>HTMLConstructor/a>, NamedConstructora href#dom-audio idthe-audio-element:dom-audio>Audio/a>(optional DOMString src)interface dfn idhtmlaudioelement>HTMLAudioElement/dfn> : a href#htmlmediaelement idthe-audio-element:htmlmediaelement>HTMLMediaElement/a> {};/pre> /dl> p>An code idthe-audio-element:the-audio-element>a href#the-audio-element>audio/a>/code> element a href#represents idthe-audio-element:represents>represents/a> a sound or audio stream./p> p>Content may be provided inside the code idthe-audio-element:the-audio-element-2>a href#the-audio-element>audio/a>/code> element. User agents should not show this content to the user; it is intended for older Web browsers which do not support code idthe-audio-element:the-audio-element-3>a href#the-audio-element>audio/a>/code>, so that legacy audio plugins can be tried, or to show text to the users of these older browsers informing them of how to access the audio contents./p> p classnote>In particular, this content is not intended to address accessibility concerns. To make audio content accessible to the deaf or to those with other physical or cognitive disabilities, a variety of features are available. If captions or a sign language video are available, the code idthe-audio-element:the-video-element>a href#the-video-element>video/a>/code> element can be used instead of the code idthe-audio-element:the-audio-element-4>a href#the-audio-element>audio/a>/code> element to play the audio, allowing users to enable the visual alternatives. Chapter titles can be provided to aid navigation, using the code idthe-audio-element:the-track-element-3>a href#the-track-element>track/a>/code> element and a a idthe-audio-element:webvtt-file hrefhttps://w3c.github.io/webvtt/#webvtt-file data-x-internalwebvtt-file>WebVTT file/a>. And, naturally, transcripts or other textual alternatives can be provided by simply linking to them in the prose near the code idthe-audio-element:the-audio-element-5>a href#the-audio-element>audio/a>/code> element. a href#refsWEBVTT>WEBVTT/a>/p> p>The code idthe-audio-element:the-audio-element-6>a href#the-audio-element>audio/a>/code> element is a a href#media-element idthe-audio-element:media-element-3>media element/a> whose a href#media-data idthe-audio-element:media-data>media data/a> is ostensibly audio data./p> p>The code idthe-audio-element:attr-media-src-4>a href#attr-media-src>src/a>/code>, code idthe-audio-element:attr-media-preload-2>a href#attr-media-preload>preload/a>/code>, code idthe-audio-element:attr-media-autoplay-2>a href#attr-media-autoplay>autoplay/a>/code>, code idthe-audio-element:attr-media-loop-2>a href#attr-media-loop>loop/a>/code>, code idthe-audio-element:attr-media-muted-2>a href#attr-media-muted>muted/a>/code>, and code idthe-audio-element:attr-media-controls-4>a href#attr-media-controls>controls/a>/code> attributes are a href#media-element-attributes idthe-audio-element:media-element-attributes>the attributes common to all media elements/a>./p> p>When an code idthe-audio-element:the-audio-element-7>a href#the-audio-element>audio/a>/code> element is a href#potentially-playing idthe-audio-element:potentially-playing>potentially playing/a>, it must have its audio data played synchronized with the a href#current-playback-position idthe-audio-element:current-playback-position>current playback position/a>, at the elements a href#effective-media-volume idthe-audio-element:effective-media-volume>effective media volume/a>. The user agent must play the audio from audio tracks that were enabled when the a href#event-loop idthe-audio-element:event-loop>event loop/a> last reached a href#step1>step 1/a>./p> p>When an code idthe-audio-element:the-audio-element-8>a href#the-audio-element>audio/a>/code> element is not a href#potentially-playing idthe-audio-element:potentially-playing-2>potentially playing/a>, audio must not play for the element./p> dl classdomintro>dt>var>audio/var> new code idthe-audio-element:dom-audio-2>a href#dom-audio>Audio/a>/code>( var>url/var> )dd> p>Returns a new code idthe-audio-element:the-audio-element-9>a href#the-audio-element>audio/a>/code> element, with the code idthe-audio-element:attr-media-src-5>a href#attr-media-src>src/a>/code> attribute set to the value passed in the argument, if applicable./p> /dl> p>A constructor is provided for creating code idthe-audio-element:htmlaudioelement>a href#htmlaudioelement>HTMLAudioElement/a>/code> objects (in addition to the factory methods from DOM such as code idthe-audio-element:dom-document-createelement>a data-x-internaldom-document-createelement hrefhttps://dom.spec.whatwg.org/#dom-document-createelement>createElement()/a>/code>): dfn iddom-audio>code>Audio(var>src/var>)/code>/dfn>. When invoked, the constructor must perform the following steps:/p> ol>li>p>Let var>document/var> be the a href#current-global-object idthe-audio-element:current-global-object>current global object/a>s a href#concept-document-window idthe-audio-element:concept-document-window>associated code>Document/code>/a>.li>p>Let var>audio/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-create-element idthe-audio-element:create-an-element data-x-internalcreate-an-element>creating an element/a> given var>document/var>, code idthe-audio-element:the-audio-element-10>a href#the-audio-element>audio/a>/code>, and the a idthe-audio-element:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-set-value idthe-audio-element:concept-element-attributes-set-value data-x-internalconcept-element-attributes-set-value>Set an attribute value/a> for var>audio/var> using code idthe-audio-element:attr-media-preload-3>a href#attr-media-preload>preload/a>/code> and code idthe-audio-element:attr-media-preload-auto>a href#attr-media-preload-auto>auto/a>/code>.li>p>If var>src/var> is given, then a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-set-value idthe-audio-element:concept-element-attributes-set-value-2 data-x-internalconcept-element-attributes-set-value>set an attribute value/a> for var>audio/var> using code idthe-audio-element:attr-media-src-6>a href#attr-media-src>src/a>/code> and var>src/var>. (This will a href#concept-media-load-algorithm-at-creation>cause the user agent to invoke/a> the objects a href#concept-media-load-algorithm idthe-audio-element:concept-media-load-algorithm>resource selection algorithm/a> before returning.)li>p>Return var>audio/var>./ol> h4 idthe-track-element>span classsecno>4.8.11/span> The dfn>code>track/code>/dfn> elementa href#the-track-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-track-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-track-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As a child of a a href#media-element idthe-track-element:media-element>media element/a>, before any a href#flow-content-2 idthe-track-element:flow-content-2>flow content/a>.dt>a href#concept-element-content-model idthe-track-element:concept-element-content-model>Content model/a>:dd>a href#concept-content-nothing idthe-track-element:concept-content-nothing>Nothing/a>.dt>a href#concept-element-tag-omission idthe-track-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>No a href#syntax-end-tag idthe-track-element:syntax-end-tag>end tag/a>.dt>a href#concept-element-attributes idthe-track-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-track-element:global-attributes>Global attributes/a>dd>code idthe-track-element:attr-track-kind>a href#attr-track-kind>kind/a>/code> — The type of text trackdd>code idthe-track-element:attr-track-src>a href#attr-track-src>src/a>/code> — Address of the resourcedd>code idthe-track-element:attr-track-srclang>a href#attr-track-srclang>srclang/a>/code> — Language of the text trackdd>code idthe-track-element:attr-track-label>a href#attr-track-label>label/a>/code> — User-visible labeldd>code idthe-track-element:attr-track-default>a href#attr-track-default>default/a>/code> — Enable the track if no other a href#text-track idthe-track-element:text-track>text track/a> is more suitabledt>a href#concept-element-dom idthe-track-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-track-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmltrackelement>HTMLTrackElement/dfn> : a href#htmlelement idthe-track-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-track-element:cereactions>CEReactions/a> attribute DOMString a href#dom-track-kind idthe-track-element:dom-track-kind>kind/a>; a href#cereactions idthe-track-element:cereactions-2>CEReactions/a> attribute USVString a href#dom-track-src idthe-track-element:dom-track-src>src/a>; a href#cereactions idthe-track-element:cereactions-3>CEReactions/a> attribute DOMString a href#dom-track-srclang idthe-track-element:dom-track-srclang>srclang/a>; a href#cereactions idthe-track-element:cereactions-4>CEReactions/a> attribute DOMString a href#dom-track-label idthe-track-element:dom-track-label>label/a>; a href#cereactions idthe-track-element:cereactions-5>CEReactions/a> attribute boolean a href#dom-track-default idthe-track-element:dom-track-default>default/a>; const unsigned short a href#dom-track-none idthe-track-element:dom-track-none>NONE/a> 0; const unsigned short a href#dom-track-loading idthe-track-element:dom-track-loading>LOADING/a> 1; const unsigned short a href#dom-track-loaded idthe-track-element:dom-track-loaded>LOADED/a> 2; const unsigned short a href#dom-track-error idthe-track-element:dom-track-error>ERROR/a> 3; readonly attribute unsigned short a href#dom-track-readystate idthe-track-element:dom-track-readystate>readyState/a>; readonly attribute a href#texttrack idthe-track-element:texttrack>TextTrack/a> a href#dom-track-track idthe-track-element:dom-track-track>track/a>;};/pre> /dl> p>The code idthe-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 idthe-track-element:text-track-2>text tracks/a> for a href#media-element idthe-track-element:media-element-2>media elements/a>. It does not a href#represents idthe-track-element:represents>represent/a> anything on its own./p> p>The dfn idattr-track-kind>code>kind/code>/dfn> attribute is an a href#enumerated-attribute idthe-track-element:enumerated-attribute>enumerated attribute/a>. The following table lists the keywords defined for this attribute. The keyword given in the first cell of each row maps to the state given in the second cell./p> table>thead>tr>th>Keyword th>State th>Brief description tbody>tr>td>dfn idattr-track-kind-keyword-subtitles>code>subtitles/code>/dfn> td>dfn idattr-track-kind-subtitles>Subtitles/dfn> td> Transcription or translation of the dialogue, suitable for when the sound is available but not understood (e.g. because the user does not understand the language of the a href#media-resource idthe-track-element:media-resource>media resource/a>s audio track). Overlaid on the video. tr>td>dfn idattr-track-kind-keyword-captions>code>captions/code>/dfn> td>dfn idattr-track-kind-captions>Captions/dfn> td> Transcription or translation of the dialogue, sound effects, relevant musical cues, and other relevant audio information, suitable for when sound is unavailable or not clearly audible (e.g. because it is muted, drowned-out by ambient noise, or because the user is deaf). Overlaid on the video; labeled as appropriate for the hard-of-hearing. tr>td>dfn idattr-track-kind-keyword-descriptions>code>descriptions/code>/dfn> td>dfn idattr-track-kind-descriptions>Descriptions/dfn> td> Textual descriptions of the video component of the a href#media-resource idthe-track-element:media-resource-2>media resource/a>, intended for audio synthesis when the visual component is obscured, unavailable, or not usable (e.g. because the user is interacting with the application without a screen while driving, or because the user is blind). Synthesized as audio. tr>td>dfn idattr-track-kind-keyword-chapters>code>chapters/code>/dfn> td>dfn idattr-track-kind-chapters>Chapters metadata/dfn> td rowspan2> Tracks intended for use from script. Not displayed by the user agent. tr>td>dfn idattr-track-kind-keyword-metadata>code>metadata/code>/dfn> td>dfn idattr-track-kind-metadata>Metadata/dfn> /table> p>The attribute may be omitted. The i idthe-track-element:missing-value-default>a href#missing-value-default>missing value default/a>/i> is the a href#attr-track-kind-subtitles idthe-track-element:attr-track-kind-subtitles>subtitles/a> state. The i idthe-track-element:invalid-value-default>a href#invalid-value-default>invalid value default/a>/i> is the a href#attr-track-kind-metadata idthe-track-element:attr-track-kind-metadata>metadata/a> state./p> p>The dfn idattr-track-src>code>src/code>/dfn> attribute gives the a idthe-track-element:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the text track data. The value must be a a href#valid-non-empty-url-potentially-surrounded-by-spaces idthe-track-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces/a>. This attribute must be present./p> p>If the element has a code idthe-track-element:attr-track-src-2>a href#attr-track-src>src/a>/code> attribute whose value is not the empty string and whose value, when the attribute was set, could be successfully a href#parse-a-url idthe-track-element:parse-a-url>parsed/a> relative to the elements a idthe-track-element:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, then the elements dfn idtrack-url>track URL/dfn> is the a href#resulting-url-string idthe-track-element:resulting-url-string>resulting URL string/a>. Otherwise, the elements a href#track-url idthe-track-element:track-url>track URL/a> is the empty string./p> p>If the elements a href#track-url idthe-track-element:track-url-2>track URL/a> identifies a WebVTT resource, and the elements code idthe-track-element:attr-track-kind-2>a href#attr-track-kind>kind/a>/code> attribute is not in the a href#attr-track-kind-chapters idthe-track-element:attr-track-kind-chapters>chapters metadata/a> or a href#attr-track-kind-metadata idthe-track-element:attr-track-kind-metadata-2>metadata/a> state, then the WebVTT file must be a a idthe-track-element:webvtt-file-using-cue-text hrefhttps://w3c.github.io/webvtt/#webvtt-file-using-cue-text data-x-internalwebvtt-file-using-cue-text>WebVTT file using cue text/a>. a href#refsWEBVTT>WEBVTT/a>/p> p>The dfn idattr-track-srclang>code>srclang/code>/dfn> attribute gives the language of the text track data. The value must be a valid BCP 47 language tag. This attribute must be present if the elements code idthe-track-element:attr-track-kind-3>a href#attr-track-kind>kind/a>/code> attribute is in the a href#attr-track-kind-subtitles idthe-track-element:attr-track-kind-subtitles-2>subtitles/a> state. a href#refsBCP47>BCP47/a>/p> p>If the element has a code idthe-track-element:attr-track-srclang-2>a href#attr-track-srclang>srclang/a>/code> attribute whose value is not the empty string, then the elements dfn idtrack-language>track language/dfn> is the value of the attribute. Otherwise, the element has no a href#track-language idthe-track-element:track-language>track language/a>./p> p>The dfn idattr-track-label>code>label/code>/dfn> attribute gives a user-readable title for the track. This title is used by user agents when listing a href#attr-track-kind-subtitles idthe-track-element:attr-track-kind-subtitles-3>subtitle/a>, a href#attr-track-kind-captions idthe-track-element:attr-track-kind-captions>caption/a>, and a href#attr-track-kind-descriptions idthe-track-element:attr-track-kind-descriptions>audio description/a> tracks in their user interface./p> p>The value of the code idthe-track-element:attr-track-label-2>a href#attr-track-label>label/a>/code> attribute, if the attribute is present, must not be the empty string. Furthermore, there must not be two code idthe-track-element:the-track-element-2>a href#the-track-element>track/a>/code> element children of the same a href#media-element idthe-track-element:media-element-3>media element/a> whose code idthe-track-element:attr-track-kind-4>a href#attr-track-kind>kind/a>/code> attributes are in the same state, whose code idthe-track-element:attr-track-srclang-3>a href#attr-track-srclang>srclang/a>/code> attributes are both missing or have values that represent the same language, and whose code idthe-track-element:attr-track-label-3>a href#attr-track-label>label/a>/code> attributes are again both missing or both have the same value./p> p>If the element has a code idthe-track-element:attr-track-label-4>a href#attr-track-label>label/a>/code> attribute whose value is not the empty string, then the elements dfn idtrack-label>track label/dfn> is the value of the attribute. Otherwise, the elements a href#track-label idthe-track-element:track-label>track label/a> is an empty string./p> p>The dfn idattr-track-default>code>default/code>/dfn> attribute is a a href#boolean-attribute idthe-track-element:boolean-attribute>boolean attribute/a>, which, if specified, indicates that the track is to be enabled if the users preferences do not indicate that another track would be more appropriate./p> p>Each a href#media-element idthe-track-element:media-element-4>media element/a> must have no more than one code idthe-track-element:the-track-element-3>a href#the-track-element>track/a>/code> element child whose code idthe-track-element:attr-track-kind-5>a href#attr-track-kind>kind/a>/code> attribute is in the a href#attr-track-kind-subtitles idthe-track-element:attr-track-kind-subtitles-4>subtitles/a> or a href#attr-track-kind-captions idthe-track-element:attr-track-kind-captions-2>captions/a> state and whose code idthe-track-element:attr-track-default-2>a href#attr-track-default>default/a>/code> attribute is specified./p> p>Each a href#media-element idthe-track-element:media-element-5>media element/a> must have no more than one code idthe-track-element:the-track-element-4>a href#the-track-element>track/a>/code> element child whose code idthe-track-element:attr-track-kind-6>a href#attr-track-kind>kind/a>/code> attribute is in the a href#attr-track-kind-descriptions idthe-track-element:attr-track-kind-descriptions-2>description/a> state and whose code idthe-track-element:attr-track-default-3>a href#attr-track-default>default/a>/code> attribute is specified./p> p>Each a href#media-element idthe-track-element:media-element-6>media element/a> must have no more than one code idthe-track-element:the-track-element-5>a href#the-track-element>track/a>/code> element child whose code idthe-track-element:attr-track-kind-7>a href#attr-track-kind>kind/a>/code> attribute is in the a href#attr-track-kind-chapters idthe-track-element:attr-track-kind-chapters-2>chapters metadata/a> state and whose code idthe-track-element:attr-track-default-4>a href#attr-track-default>default/a>/code> attribute is specified./p> p classnote>There is no limit on the number of code idthe-track-element:the-track-element-6>a href#the-track-element>track/a>/code> elements whose code idthe-track-element:attr-track-kind-8>a href#attr-track-kind>kind/a>/code> attribute is in the a href#attr-track-kind-metadata idthe-track-element:attr-track-kind-metadata-3>metadata/a> state and whose code idthe-track-element:attr-track-default-5>a href#attr-track-default>default/a>/code> attribute is specified./p> dl classdomintro>dt>var>track/var> . code idthe-track-element:dom-track-readystate-2>a href#dom-track-readystate>readyState/a>/code>dd> p>Returns the a href#text-track-readiness-state idthe-track-element:text-track-readiness-state>text track readiness state/a>, represented by a number from the following list:/p> dl>dt>var>track/var> . code idthe-track-element:dom-track-none-2>a href#dom-track-none>NONE/a>/code> (0)dd> p>The a href#text-track-not-loaded idthe-track-element:text-track-not-loaded>text track not loaded/a> state./p> dt>var>track/var> . code idthe-track-element:dom-track-loading-2>a href#dom-track-loading>LOADING/a>/code> (1)dd> p>The a href#text-track-loading idthe-track-element:text-track-loading>text track loading/a> state./p> dt>var>track/var> . code idthe-track-element:dom-track-loaded-2>a href#dom-track-loaded>LOADED/a>/code> (2)dd> p>The a href#text-track-loaded idthe-track-element:text-track-loaded>text track loaded/a> state./p> dt>var>track/var> . code idthe-track-element:dom-track-error-2>a href#dom-track-error>ERROR/a>/code> (3)dd> p>The a href#text-track-failed-to-load idthe-track-element:text-track-failed-to-load>text track failed to load/a> state./p> /dl> dt>var>track/var> . code idthe-track-element:dom-track-track-2>a href#dom-track-track>track/a>/code>dd> p>Returns the code idthe-track-element:texttrack-2>a href#texttrack>TextTrack/a>/code> object corresponding to the a href#text-track idthe-track-element:text-track-3>text track/a> of the code idthe-track-element:the-track-element-7>a href#the-track-element>track/a>/code> element./p> /dl> p>The dfn iddom-track-readystate>code>readyState/code>/dfn> attribute must return the numeric value corresponding to the a href#text-track-readiness-state idthe-track-element:text-track-readiness-state-2>text track readiness state/a> of the code idthe-track-element:the-track-element-8>a href#the-track-element>track/a>/code> elements a href#text-track idthe-track-element:text-track-4>text track/a>, as defined by the following list:/p> dl>dt>dfn iddom-track-none>code>NONE/code>/dfn> (numeric value 0)dd>The a href#text-track-not-loaded idthe-track-element:text-track-not-loaded-2>text track not loaded/a> state.dt>dfn iddom-track-loading>code>LOADING/code>/dfn> (numeric value 1)dd>The a href#text-track-loading idthe-track-element:text-track-loading-2>text track loading/a> state.dt>dfn iddom-track-loaded>code>LOADED/code>/dfn> (numeric value 2)dd>The a href#text-track-loaded idthe-track-element:text-track-loaded-2>text track loaded/a> state.dt>dfn iddom-track-error>code>ERROR/code>/dfn> (numeric value 3)dd>The a href#text-track-failed-to-load idthe-track-element:text-track-failed-to-load-2>text track failed to load/a> state./dl> p>The dfn iddom-track-track>code>track/code>/dfn> IDL attribute must, on getting, return the code idthe-track-element:the-track-element-9>a href#the-track-element>track/a>/code> elements a href#text-track idthe-track-element:text-track-5>text track/a>s corresponding code idthe-track-element:texttrack-3>a href#texttrack>TextTrack/a>/code> object./p> p>The dfn iddom-track-src>code>src/code>/dfn>, dfn iddom-track-srclang>code>srclang/code>/dfn>, dfn iddom-track-label>code>label/code>/dfn>, and dfn iddom-track-default>code>default/code>/dfn> IDL attributes must a href#reflect idthe-track-element:reflect>reflect/a> the respective content attributes of the same name. The dfn iddom-track-kind>code>kind/code>/dfn> IDL attribute must a href#reflect idthe-track-element:reflect-2>reflect/a> the content attribute of the same name, a href#limited-to-only-known-values idthe-track-element:limited-to-only-known-values>limited to only known values/a>./p> div classexample> p>This video has subtitles in several languages:/p> pre><video srcbrave.webm> <track kindsubtitles srcbrave.en.vtt srclangen labelEnglish> <track kindcaptions srcbrave.en.hoh.vtt srclangen labelEnglish for the Hard of Hearing> <track kindsubtitles srcbrave.fr.vtt srclangfr langfr labelFrançais> <track kindsubtitles srcbrave.de.vtt srclangde langde labelDeutsch></video>/pre> p>(The code idthe-track-element:attr-lang>a href#attr-lang>lang/a>/code> attributes on the last two describe the language of the code idthe-track-element:attr-track-label-5>a href#attr-track-label>label/a>/code> attribute, not the language of the subtitles themselves. The language of the subtitles is given by the code idthe-track-element:attr-track-srclang-4>a href#attr-track-srclang>srclang/a>/code> attribute.)/p> /div> h4 idmedia-elements>span classsecno>4.8.12/span> Media elementsa href#media-elements classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id28625 titleProvide a hook for media session integration (blocking paused->playing transition)>28625/a>/div> p>a href#htmlmediaelement idmedia-elements:htmlmediaelement>HTMLMediaElement/a> objects (code idmedia-elements:the-audio-element>a href#the-audio-element>audio/a>/code> and code idmedia-elements:the-video-element>a href#the-video-element>video/a>/code>, in this specification) are simply known as dfn idmedia-element>media elements/dfn>./p> pre classidl>enum dfn idcanplaytyperesult>CanPlayTypeResult/dfn> { /* a href#dom-canplaytyperesult-nil idmedia-elements:dom-canplaytyperesult-nil>empty string/a> */, a href#dom-canplaytyperesult-maybe idmedia-elements:dom-canplaytyperesult-maybe>maybe/a>, a href#dom-canplaytyperesult-probably idmedia-elements:dom-canplaytyperesult-probably>probably/a> };typedef (a idmedia-elements:mediastream hrefhttps://w3c.github.io/mediacapture-main/getusermedia.html#idl-def-mediastream data-x-internalmediastream>MediaStream/a> or a idmedia-elements:mediasource hrefhttps://w3c.github.io/media-source/#idl-def-mediasource data-x-internalmediasource>MediaSource/a> or a idmedia-elements:blob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob data-x-internalblob>Blob/a>) dfn idmediaprovider>MediaProvider/dfn>;ExposedWindowinterface dfn idhtmlmediaelement>HTMLMediaElement/dfn> : a href#htmlelement idmedia-elements:htmlelement>HTMLElement/a> { // error state readonly attribute a href#mediaerror idmedia-elements:mediaerror>MediaError/a>? a href#dom-media-error idmedia-elements:dom-media-error>error/a>; // network state a href#cereactions idmedia-elements:cereactions>CEReactions/a> attribute USVString a href#dom-media-src idmedia-elements:dom-media-src>src/a>; attribute a href#mediaprovider idmedia-elements:mediaprovider>MediaProvider/a>? a href#dom-media-srcobject idmedia-elements:dom-media-srcobject>srcObject/a>; readonly attribute USVString a href#dom-media-currentsrc idmedia-elements:dom-media-currentsrc>currentSrc/a>; a href#cereactions idmedia-elements:cereactions-2>CEReactions/a> attribute DOMString? a href#dom-media-crossorigin idmedia-elements:dom-media-crossorigin>crossOrigin/a>; const unsigned short a href#dom-media-network_empty idmedia-elements:dom-media-network_empty>NETWORK_EMPTY/a> 0; const unsigned short a href#dom-media-network_idle idmedia-elements:dom-media-network_idle>NETWORK_IDLE/a> 1; const unsigned short a href#dom-media-network_loading idmedia-elements:dom-media-network_loading>NETWORK_LOADING/a> 2; const unsigned short a href#dom-media-network_no_source idmedia-elements:dom-media-network_no_source>NETWORK_NO_SOURCE/a> 3; readonly attribute unsigned short a href#dom-media-networkstate idmedia-elements:dom-media-networkstate>networkState/a>; a href#cereactions idmedia-elements:cereactions-3>CEReactions/a> attribute DOMString a href#dom-media-preload idmedia-elements:dom-media-preload>preload/a>; readonly attribute a href#timeranges idmedia-elements:timeranges>TimeRanges/a> a href#dom-media-buffered idmedia-elements:dom-media-buffered>buffered/a>; void a href#dom-media-load idmedia-elements:dom-media-load>load/a>(); a href#canplaytyperesult idmedia-elements:canplaytyperesult>CanPlayTypeResult/a> a href#dom-navigator-canplaytype idmedia-elements:dom-navigator-canplaytype>canPlayType/a>(DOMString type); // ready state const unsigned short a href#dom-media-have_nothing idmedia-elements:dom-media-have_nothing>HAVE_NOTHING/a> 0; const unsigned short a href#dom-media-have_metadata idmedia-elements:dom-media-have_metadata>HAVE_METADATA/a> 1; const unsigned short a href#dom-media-have_current_data idmedia-elements:dom-media-have_current_data>HAVE_CURRENT_DATA/a> 2; const unsigned short a href#dom-media-have_future_data idmedia-elements:dom-media-have_future_data>HAVE_FUTURE_DATA/a> 3; const unsigned short a href#dom-media-have_enough_data idmedia-elements:dom-media-have_enough_data>HAVE_ENOUGH_DATA/a> 4; readonly attribute unsigned short a href#dom-media-readystate idmedia-elements:dom-media-readystate>readyState/a>; readonly attribute boolean a href#dom-media-seeking idmedia-elements:dom-media-seeking>seeking/a>; // playback state attribute double a href#dom-media-currenttime idmedia-elements:dom-media-currenttime>currentTime/a>; void a href#dom-media-fastseek idmedia-elements:dom-media-fastseek>fastSeek/a>(double time); readonly attribute unrestricted double a href#dom-media-duration idmedia-elements:dom-media-duration>duration/a>; a hrefhttps://heycam.github.io/webidl/#idl-object idmedia-elements:idl-object data-x-internalidl-object>object/a> a href#dom-media-getstartdate idmedia-elements:dom-media-getstartdate>getStartDate/a>(); readonly attribute boolean a href#dom-media-paused idmedia-elements:dom-media-paused>paused/a>; attribute double a href#dom-media-defaultplaybackrate idmedia-elements:dom-media-defaultplaybackrate>defaultPlaybackRate/a>; attribute double a href#dom-media-playbackrate idmedia-elements:dom-media-playbackrate>playbackRate/a>; readonly attribute a href#timeranges idmedia-elements:timeranges-2>TimeRanges/a> a href#dom-media-played idmedia-elements:dom-media-played>played/a>; readonly attribute a href#timeranges idmedia-elements:timeranges-3>TimeRanges/a> a href#dom-media-seekable idmedia-elements:dom-media-seekable>seekable/a>; readonly attribute boolean a href#dom-media-ended idmedia-elements:dom-media-ended>ended/a>; a href#cereactions idmedia-elements:cereactions-4>CEReactions/a> attribute boolean a href#dom-media-autoplay idmedia-elements:dom-media-autoplay>autoplay/a>; a href#cereactions idmedia-elements:cereactions-5>CEReactions/a> attribute boolean a href#dom-media-loop idmedia-elements:dom-media-loop>loop/a>; Promise<void> a href#dom-media-play idmedia-elements:dom-media-play>play/a>(); void a href#dom-media-pause idmedia-elements:dom-media-pause>pause/a>(); // controls a href#cereactions idmedia-elements:cereactions-6>CEReactions/a> attribute boolean a href#dom-media-controls idmedia-elements:dom-media-controls>controls/a>; attribute double a href#dom-media-volume idmedia-elements:dom-media-volume>volume/a>; attribute boolean a href#dom-media-muted idmedia-elements:dom-media-muted>muted/a>; a href#cereactions idmedia-elements:cereactions-7>CEReactions/a> attribute boolean a href#dom-media-defaultmuted idmedia-elements:dom-media-defaultmuted>defaultMuted/a>; // tracks SameObject readonly attribute a href#audiotracklist idmedia-elements:audiotracklist>AudioTrackList/a> a href#dom-media-audiotracks idmedia-elements:dom-media-audiotracks>audioTracks/a>; SameObject readonly attribute a href#videotracklist idmedia-elements:videotracklist>VideoTrackList/a> a href#dom-media-videotracks idmedia-elements:dom-media-videotracks>videoTracks/a>; SameObject readonly attribute a href#texttracklist idmedia-elements:texttracklist>TextTrackList/a> a href#dom-media-texttracks idmedia-elements:dom-media-texttracks>textTracks/a>; a href#texttrack idmedia-elements:texttrack>TextTrack/a> a href#dom-media-addtexttrack idmedia-elements:dom-media-addtexttrack>addTextTrack/a>(a href#texttrackkind idmedia-elements:texttrackkind>TextTrackKind/a> kind, optional DOMString label , optional DOMString language );};/pre> p>The dfn idmedia-element-attributes>media element attributes/dfn>, code idmedia-elements:attr-media-src>a href#attr-media-src>src/a>/code>, code idmedia-elements:attr-media-crossorigin>a href#attr-media-crossorigin>crossorigin/a>/code>, code idmedia-elements:attr-media-preload>a href#attr-media-preload>preload/a>/code>, code idmedia-elements:attr-media-autoplay>a href#attr-media-autoplay>autoplay/a>/code>, code idmedia-elements:attr-media-loop>a href#attr-media-loop>loop/a>/code>, code idmedia-elements:attr-media-muted>a href#attr-media-muted>muted/a>/code>, and code idmedia-elements:attr-media-controls>a href#attr-media-controls>controls/a>/code>, apply to all a href#media-element idmedia-elements:media-element>media elements/a>. They are defined in this section./p> p>a href#media-element idmedia-elements:media-element-2>Media elements/a> are used to present audio data, or video and audio data, to the user. This is referred to as dfn idmedia-data>media data/dfn> in this section, since this section applies equally to a href#media-element idmedia-elements:media-element-3>media elements/a> for audio or for video. The term dfn idmedia-resource>media resource/dfn> is used to refer to the complete set of media data, e.g. the complete video file, or complete audio file. /p> p>A a href#media-resource idmedia-elements:media-resource>media resource/a> can have multiple audio and video tracks. For the purposes of a a href#media-element idmedia-elements:media-element-4>media element/a>, the video data of the a href#media-resource idmedia-elements:media-resource-2>media resource/a> is only that of the currently selected track (if any) as given by the elements code idmedia-elements:dom-media-videotracks-2>a href#dom-media-videotracks>videoTracks/a>/code> attribute when the a href#event-loop idmedia-elements:event-loop>event loop/a> last reached a href#step1>step 1/a>, and the audio data of the a href#media-resource idmedia-elements:media-resource-3>media resource/a> is the result of mixing all the currently enabled tracks (if any) given by the elements code idmedia-elements:dom-media-audiotracks-2>a href#dom-media-audiotracks>audioTracks/a>/code> attribute when the a href#event-loop idmedia-elements:event-loop-2>event loop/a> last reached a href#step1>step 1/a>./p> p classnote>Both code idmedia-elements:the-audio-element-2>a href#the-audio-element>audio/a>/code> and code idmedia-elements:the-video-element-2>a href#the-video-element>video/a>/code> elements can be used for both audio and video. The main difference between the two is simply that the code idmedia-elements:the-audio-element-3>a href#the-audio-element>audio/a>/code> element has no playback area for visual content (such as video or captions), whereas the code idmedia-elements:the-video-element-3>a href#the-video-element>video/a>/code> element does./p> p>Except where otherwise explicitly specified, the a href#task-source idmedia-elements:task-source>task source/a> for all the tasks a href#queue-a-task idmedia-elements:queue-a-task>queued/a> in this section and its subsections is the dfn idmedia-element-event-task-source>media element event task source/dfn> of the a href#media-element idmedia-elements:media-element-5>media element/a> in question./p> h5 iderror-codes>span classsecno>4.8.12.1/span> Error codesa href#error-codes classself-link>/a>/h5> dl classdomintro>dt>var>media/var> . code iderror-codes:dom-media-error>a href#dom-media-error>error/a>/code>dd> p>Returns a code iderror-codes:mediaerror>a href#mediaerror>MediaError/a>/code> object representing the current error state of the element./p> p>Returns null if there is no error./p> /dl> p>All a href#media-element iderror-codes:media-element>media elements/a> have an associated error status, which records the last error the element encountered since its a href#concept-media-load-algorithm iderror-codes:concept-media-load-algorithm>resource selection algorithm/a> was last invoked. The dfn iddom-media-error>code>error/code>/dfn> attribute, on getting, must return the code iderror-codes:mediaerror-2>a href#mediaerror>MediaError/a>/code> object created for this last error, or null if there has not been an error./p> pre classidl>ExposedWindowinterface dfn idmediaerror>MediaError/dfn> { const unsigned short a href#dom-mediaerror-media_err_aborted iderror-codes:dom-mediaerror-media_err_aborted>MEDIA_ERR_ABORTED/a> 1; const unsigned short a href#dom-mediaerror-media_err_network iderror-codes:dom-mediaerror-media_err_network>MEDIA_ERR_NETWORK/a> 2; const unsigned short a href#dom-mediaerror-media_err_decode iderror-codes:dom-mediaerror-media_err_decode>MEDIA_ERR_DECODE/a> 3; const unsigned short a href#dom-mediaerror-media_err_src_not_supported iderror-codes:dom-mediaerror-media_err_src_not_supported>MEDIA_ERR_SRC_NOT_SUPPORTED/a> 4; readonly attribute unsigned short a href#dom-mediaerror-code iderror-codes:dom-mediaerror-code>code/a>; readonly attribute DOMString a href#dom-mediaerror-message iderror-codes:dom-mediaerror-message>message/a>;};/pre> dl classdomintro>dt>var>media/var> . code iderror-codes:dom-media-error-2>a href#dom-media-error>error/a>/code> . code iderror-codes:dom-mediaerror-code-2>a href#dom-mediaerror-code>code/a>/code>dd> p>Returns the current errors error code, from the list below./p> dt>var>media/var> . code iderror-codes:dom-media-error-3>a href#dom-media-error>error/a>/code> . code iderror-codes:dom-mediaerror-message-2>a href#dom-mediaerror-message>message/a>/code>dd> p>Returns a specific informative diagnostic message about the error condition encountered. The message and message format are not generally uniform across different user agents. If no such message is available, then the empty string is returned./p> /dl> p>Every code iderror-codes:mediaerror-3>a href#mediaerror>MediaError/a>/code> object has a dfn idconcept-mediaerror-message>message/dfn>, which is a string, and a dfn idconcept-mediaerror-code>code/dfn>, which is one of the following:/p> dl>dt>dfn iddom-mediaerror-media_err_aborted>code>MEDIA_ERR_ABORTED/code>/dfn> (numeric value 1)dd>The fetching process for the a href#media-resource iderror-codes:media-resource>media resource/a> was aborted by the user agent at the users request.dt>dfn iddom-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 iderror-codes:media-resource-2>media resource/a>, after the resource was established to be usable.dt>dfn iddom-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 iderror-codes:media-resource-3>media resource/a>, after the resource was established to be usable.dt>dfn iddom-mediaerror-media_err_src_not_supported>code>MEDIA_ERR_SRC_NOT_SUPPORTED/code>/dfn> (numeric value 4)dd>The a href#media-resource iderror-codes:media-resource-4>media resource/a> indicated by the code iderror-codes:attr-media-src>a href#attr-media-src>src/a>/code> attribute or a href#assigned-media-provider-object iderror-codes:assigned-media-provider-object>assigned media provider object/a> was not suitable./dl> p>To dfn idcreating-a-mediaerror data-export>create a code>MediaError/code>/dfn>, given an error code which is one of the above values, return a new code iderror-codes:mediaerror-4>a href#mediaerror>MediaError/a>/code> object whose a href#concept-mediaerror-code iderror-codes:concept-mediaerror-code>code/a> is the given error code and whose a href#concept-mediaerror-message iderror-codes:concept-mediaerror-message>message/a> is a string containing any details the user agent is able to supply about the cause of the error condition, or the empty string if the user agent is unable to supply such details. This message string must not contain only the information already available via the supplied error code; for example, it must not simply be a translation of the code into a string format. If no additional information is available beyond that provided by the error code, the a href#concept-mediaerror-message iderror-codes:concept-mediaerror-message-2>message/a> must be set to the empty string./p> p>The dfn iddom-mediaerror-code>code>code/code>/dfn> attribute of a code iderror-codes:mediaerror-5>a href#mediaerror>MediaError/a>/code> object must return this code iderror-codes:mediaerror-6>a href#mediaerror>MediaError/a>/code> objects a href#concept-mediaerror-code iderror-codes:concept-mediaerror-code-2>code/a>./p> p>The dfn iddom-mediaerror-message>code>message/code>/dfn> attribute of a code iderror-codes:mediaerror-7>a href#mediaerror>MediaError/a>/code> object must return this code iderror-codes:mediaerror-8>a href#mediaerror>MediaError/a>/code> objects a href#concept-mediaerror-message iderror-codes:concept-mediaerror-message-3>message/a>./p> h5 idlocation-of-the-media-resource>span classsecno>4.8.12.2/span> Location of the media resourcea href#location-of-the-media-resource classself-link>/a>/h5> p>The dfn idattr-media-src>code>src/code>/dfn> content attribute on a href#media-element idlocation-of-the-media-resource:media-element>media elements/a> gives the a idlocation-of-the-media-resource:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the media resource (video, audio) to show. The attribute, if present, must contain a a href#valid-non-empty-url-potentially-surrounded-by-spaces idlocation-of-the-media-resource:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces/a>./p> p>If the code idlocation-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 idlocation-of-the-media-resource:media-element-2>media element/a>, then the code idlocation-of-the-media-resource:attr-media-src>a href#attr-media-src>src/a>/code> attribute must also be specified./p> p>The dfn idattr-media-crossorigin>code>crossorigin/code>/dfn> content attribute on a href#media-element idlocation-of-the-media-resource:media-element-3>media elements/a> is a a href#cors-settings-attribute idlocation-of-the-media-resource:cors-settings-attribute>CORS settings attribute/a>./p> p idconcept-media-load-algorithm-at-creation>If a a href#media-element idlocation-of-the-media-resource:media-element-4>media element/a> is created with a code idlocation-of-the-media-resource:attr-media-src-2>a href#attr-media-src>src/a>/code> attribute, the user agent must a href#immediately idlocation-of-the-media-resource:immediately>immediately/a> invoke the a href#media-element idlocation-of-the-media-resource:media-element-5>media element/a>s a href#concept-media-load-algorithm idlocation-of-the-media-resource:concept-media-load-algorithm>resource selection algorithm/a>./p> p>If a code idlocation-of-the-media-resource:attr-media-src-3>a href#attr-media-src>src/a>/code> attribute of a a href#media-element idlocation-of-the-media-resource:media-element-6>media element/a> is set or changed, the user agent must invoke the a href#media-element idlocation-of-the-media-resource:media-element-7>media element/a>s a href#media-element-load-algorithm idlocation-of-the-media-resource:media-element-load-algorithm>media element load algorithm/a>. (em>Removing/em> the code idlocation-of-the-media-resource:attr-media-src-4>a href#attr-media-src>src/a>/code> attribute does not do this, even if there are code idlocation-of-the-media-resource:the-source-element>a href#the-source-element>source/a>/code> elements present.)/p> p>The dfn iddom-media-src>code>src/code>/dfn> IDL attribute on a href#media-element idlocation-of-the-media-resource:media-element-8>media elements/a> must a href#reflect idlocation-of-the-media-resource:reflect>reflect/a> the content attribute of the same name./p> p>The dfn iddom-media-crossorigin>code>crossOrigin/code>/dfn> IDL attribute must a href#reflect idlocation-of-the-media-resource:reflect-2>reflect/a> the code idlocation-of-the-media-resource:attr-media-crossorigin>a href#attr-media-crossorigin>crossorigin/a>/code> content attribute, a href#limited-to-only-known-values idlocation-of-the-media-resource:limited-to-only-known-values>limited to only known values/a>./p> p>A dfn idmedia-provider-object>media provider object/dfn> is an object that can represent a a href#media-resource idlocation-of-the-media-resource:media-resource>media resource/a>, separate from a a idlocation-of-the-media-resource:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>. code idlocation-of-the-media-resource:mediastream>a data-x-internalmediastream hrefhttps://w3c.github.io/mediacapture-main/getusermedia.html#idl-def-mediastream>MediaStream/a>/code> objects, code idlocation-of-the-media-resource:mediasource>a data-x-internalmediasource hrefhttps://w3c.github.io/media-source/#idl-def-mediasource>MediaSource/a>/code> objects, and code idlocation-of-the-media-resource:blob>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> objects are all a href#media-provider-object idlocation-of-the-media-resource:media-provider-object>media provider objects/a>./p> p>Each a href#media-element idlocation-of-the-media-resource:media-element-9>media element/a> can have an dfn idassigned-media-provider-object>assigned media provider object/dfn>, which is a a href#media-provider-object idlocation-of-the-media-resource:media-provider-object-2>media provider object/a>. When a a href#media-element idlocation-of-the-media-resource:media-element-10>media element/a> is created, it has no a href#assigned-media-provider-object idlocation-of-the-media-resource:assigned-media-provider-object>assigned media provider object/a>./p> dl classdomintro>dt>var>media/var> . code idlocation-of-the-media-resource:dom-media-srcobject>a href#dom-media-srcobject>srcObject/a>/code> var>source/var> dd> p>Allows the a href#media-element idlocation-of-the-media-resource:media-element-11>media element/a> to be assigned a a href#media-provider-object idlocation-of-the-media-resource:media-provider-object-3>media provider object/a>./p> dt>var>media/var> . code idlocation-of-the-media-resource:dom-media-currentsrc>a href#dom-media-currentsrc>currentSrc/a>/code>dd> p>Returns the a idlocation-of-the-media-resource:url-3 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the current a href#media-resource idlocation-of-the-media-resource:media-resource-2>media resource/a>, if any./p> p>Returns the empty string when there is no a href#media-resource idlocation-of-the-media-resource:media-resource-3>media resource/a>, or it doesnt have a a idlocation-of-the-media-resource:url-4 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>./p> /dl> p>The dfn iddom-media-currentsrc>code>currentSrc/code>/dfn> IDL attribute must initially be set to the empty string. Its value is changed by the a href#concept-media-load-algorithm idlocation-of-the-media-resource:concept-media-load-algorithm-2>resource selection algorithm/a> defined below./p> p>The dfn iddom-media-srcobject>code>srcObject/code>/dfn> IDL attribute, on getting, must return the elements a href#assigned-media-provider-object idlocation-of-the-media-resource:assigned-media-provider-object-2>assigned media provider object/a>, if any, or null otherwise. On setting, it must set the elements a href#assigned-media-provider-object idlocation-of-the-media-resource:assigned-media-provider-object-3>assigned media provider object/a> to the new value, and then invoke the elements a href#media-element-load-algorithm idlocation-of-the-media-resource:media-element-load-algorithm-2>media element load algorithm/a>./p> p classnote>There are three ways to specify a a href#media-resource idlocation-of-the-media-resource:media-resource-4>media resource/a>: the code idlocation-of-the-media-resource:dom-media-srcobject-2>a href#dom-media-srcobject>srcObject/a>/code> IDL attribute, the code idlocation-of-the-media-resource:attr-media-src-5>a href#attr-media-src>src/a>/code> content attribute, and code idlocation-of-the-media-resource:the-source-element-2>a href#the-source-element>source/a>/code> elements. The IDL attribute takes priority, followed by the content attribute, followed by the elements./p> h5 idmime-types>span classsecno>4.8.12.3/span> MIME typesa href#mime-types classself-link>/a>/h5> p>A a href#media-resource idmime-types:media-resource>media resource/a> can be described in terms of its em>type/em>, specifically a a idmime-types:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a>, in some cases with a code>codecs/code> parameter. (Whether the code>codecs/code> parameter is allowed or not depends on the MIME type.) a href#refsRFC6381>RFC6381/a>/p> p>Types are usually somewhat incomplete descriptions; for example code>video/mpeg/code> doesnt say anything except what the container type is, and even a type like code>video/mp4; codecsavc1.42E01E, mp4a.40.2/code> doesnt include information like the actual bitrate (only the maximum bitrate). Thus, given a type, a user agent can often only know whether it em>might/em> be able to play media of that type (with varying levels of confidence), or whether it definitely em>cannot/em> play media of that type./p> p>dfn ida-type-that-the-user-agent-knows-it-cannot-render>A type that the user agent knows it cannot render/dfn> is one that describes a resource that the user agent definitely does not support, for example because it doesnt recognize the container type, or it doesnt support the listed codecs./p> p>The a idmime-types:mime-type-2 hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> code idmime-types:application/octet-stream>a data-x-internalapplication/octet-stream hrefhttps://tools.ietf.org/html/rfc2046#section-4.5.1>application/octet-stream/a>/code> with no parameters is never a href#a-type-that-the-user-agent-knows-it-cannot-render idmime-types:a-type-that-the-user-agent-knows-it-cannot-render>a type that the user agent knows it cannot render/a>. User agents must treat that type as equivalent to the lack of any explicit a href#content-type idmime-types:content-type>Content-Type metadata/a> when it is used to label a potential a href#media-resource idmime-types:media-resource-2>media resource/a>./p> p classnote>Only the a idmime-types:mime-type-3 hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> code idmime-types:application/octet-stream-2>a data-x-internalapplication/octet-stream hrefhttps://tools.ietf.org/html/rfc2046#section-4.5.1>application/octet-stream/a>/code> with no parameters is special-cased here; if any parameter appears with it, it will be treated just like any other a idmime-types:mime-type-4 hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a>. This is a deviation from the rule that unknown a idmime-types:mime-type-5 hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> parameters should be ignored./p> dl classdomintro>dt>var>media/var> . code idmime-types:dom-navigator-canplaytype>a href#dom-navigator-canplaytype>canPlayType/a>/code>(var>type/var>)dd> p>Returns the empty string (a negative response), maybe, or probably based on how confident the user agent is that it can play media resources of the given type./p> /dl> p>The dfn iddom-navigator-canplaytype>code>canPlayType(var>type/var>)/code>/dfn> method must return dfn iddom-canplaytyperesult-nil>the empty string/dfn> if var>type/var> is a href#a-type-that-the-user-agent-knows-it-cannot-render idmime-types:a-type-that-the-user-agent-knows-it-cannot-render-2>a type that the user agent knows it cannot render/a> or is the type code idmime-types:application/octet-stream-3>a data-x-internalapplication/octet-stream hrefhttps://tools.ietf.org/html/rfc2046#section-4.5.1>application/octet-stream/a>/code>; it must return dfn iddom-canplaytyperesult-probably>code>probably/code>/dfn> if the user agent is confident that the type represents a a href#media-resource idmime-types:media-resource-3>media resource/a> that it can render if used in with this code idmime-types:the-audio-element>a href#the-audio-element>audio/a>/code> or code idmime-types:the-video-element>a href#the-video-element>video/a>/code> element; and it must return dfn iddom-canplaytyperesult-maybe>code>maybe/code>/dfn> otherwise. Implementors are encouraged to return code idmime-types:dom-canplaytyperesult-maybe>a href#dom-canplaytyperesult-maybe>maybe/a>/code> unless the type can be confidently established as being supported or not. Generally, a user agent should never return code idmime-types:dom-canplaytyperesult-probably>a href#dom-canplaytyperesult-probably>probably/a>/code> for a type that allows the code>codecs/code> parameter if that parameter is not present./p> div classexample> p>This script tests to see if the user agent supports a (fictional) new format to dynamically decide whether to use a code idmime-types:the-video-element-2>a href#the-video-element>video/a>/code> element or a plugin:/p> pre><section idvideo> <p><a hrefplaying-cats.nfv>Download video</a></p></section><script> var videoSection document.getElementById(video); var videoElement document.createElement(video); var support videoElement.canPlayType(video/x-new-fictional-format;codecskittens,bunnies); if (support ! probably && New Fictional Video Plugin in navigator.plugins) { // not confident of browser support // but we have a plugin // so use plugin instead videoElement document.createElement(embed); } else if (support ) { // no support from browser and no plugin // do nothing videoElement null; } if (videoElement) { while (videoSection.hasChildNodes()) videoSection.removeChild(videoSection.firstChild); videoElement.setAttribute(src, playing-cats.nfv); videoSection.appendChild(videoElement); }</script>/pre> /div> p classnote>The code idmime-types:attr-source-type>a href#attr-source-type>type/a>/code> attribute of the code idmime-types:the-source-element>a href#the-source-element>source/a>/code> element allows the user agent to avoid downloading resources that use formats it cannot render./p> h5 idnetwork-states>span classsecno>4.8.12.4/span> Network statesa href#network-states classself-link>/a>/h5> dl classdomintro>dt>var>media/var> . code idnetwork-states:dom-media-networkstate>a href#dom-media-networkstate>networkState/a>/code>dd> p>Returns the current state of network activity for the element, from the codes in the list below./p> /dl> p>As a href#media-element idnetwork-states:media-element>media elements/a> interact with the network, their current network activity is represented by the dfn iddom-media-networkstate>code>networkState/code>/dfn> attribute. On getting, it must return the current network state of the element, which must be one of the following values:/p> dl>dt>dfn iddom-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 iddom-media-network_idle>code>NETWORK_IDLE/code>/dfn> (numeric value 1)dd>The elements a href#concept-media-load-algorithm idnetwork-states:concept-media-load-algorithm>resource selection algorithm/a> is active and has selected a a href#media-resource idnetwork-states:media-resource>resource/a>, but it is not actually using the network at this time.dt>dfn iddom-media-network_loading>code>NETWORK_LOADING/code>/dfn> (numeric value 2)dd>The user agent is actively trying to download data.dt>dfn iddom-media-network_no_source>code>NETWORK_NO_SOURCE/code>/dfn> (numeric value 3)dd>The elements a href#concept-media-load-algorithm idnetwork-states:concept-media-load-algorithm-2>resource selection algorithm/a> is active, but it has not yet found a a href#media-resource idnetwork-states:media-resource-2>resource/a> to use./dl> p>The a href#concept-media-load-algorithm idnetwork-states:concept-media-load-algorithm-3>resource selection algorithm/a> defined below describes exactly when the code idnetwork-states:dom-media-networkstate-2>a href#dom-media-networkstate>networkState/a>/code> attribute changes value and what events fire to indicate changes in this state./p> h5 idloading-the-media-resource>span classsecno>4.8.12.5/span> Loading the media resourcea href#loading-the-media-resource classself-link>/a>/h5>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id27989 titleShould audio and video tracks be exposed cross-origin?>27989/a>/div> dl classdomintro>dt>var>media/var> . code idloading-the-media-resource:dom-media-load>a href#dom-media-load>load/a>/code>()dd> p>Causes the element to reset and start selecting and loading a new a href#media-resource idloading-the-media-resource:media-resource>media resource/a> from scratch./p> /dl> p>All a href#media-element idloading-the-media-resource:media-element>media elements/a> have a dfn idcan-autoplay-flag>can autoplay flag/dfn>, which must begin in the true state, and a dfn iddelaying-the-load-event-flag>delaying-the-load-event flag/dfn>, which must begin in the false state. While the a href#delaying-the-load-event-flag idloading-the-media-resource:delaying-the-load-event-flag>delaying-the-load-event flag/a> is true, the element must a href#delay-the-load-event idloading-the-media-resource:delay-the-load-event>delay the load event/a> of its document./p> p>When the dfn iddom-media-load>code>load()/code>/dfn> method on a a href#media-element idloading-the-media-resource:media-element-2>media element/a> is invoked, the user agent must run the a href#media-element-load-algorithm idloading-the-media-resource:media-element-load-algorithm>media element load algorithm/a>./p> p>The dfn idmedia-element-load-algorithm>media element load algorithm/dfn> consists of the following steps./p> ol>li>p>Abort any already-running instance of the a href#concept-media-load-algorithm idloading-the-media-resource:concept-media-load-algorithm>resource selection algorithm/a> for this element.li>p>Let var>pending tasks/var> be a list of all a href#concept-task idloading-the-media-resource:concept-task>tasks/a> from the a href#media-element idloading-the-media-resource:media-element-3>media element/a>s a href#media-element-event-task-source idloading-the-media-resource:media-element-event-task-source>media element event task source/a> in one of the a href#task-queue idloading-the-media-resource:task-queue>task queues/a>.li>p>For each task in var>pending tasks/var> that would a href#resolve-pending-play-promises idloading-the-media-resource:resolve-pending-play-promises>resolve pending play promises/a> or a href#reject-pending-play-promises idloading-the-media-resource:reject-pending-play-promises>reject pending play promises/a>, immediately resolve or reject those promises in the order the corresponding tasks were queued.li> p>Remove each a href#concept-task idloading-the-media-resource:concept-task-2>task/a> in var>pending tasks/var> from its a href#task-queue idloading-the-media-resource:task-queue-2>task queue/a>/p> p classnote>Basically, pending events and callbacks are discarded and promises in-flight to be resolved/rejected are resolved/rejected immediately when the media element starts loading a new resource./p> li>p>If the a href#media-element idloading-the-media-resource:media-element-4>media element/a>s code idloading-the-media-resource:dom-media-networkstate>a href#dom-media-networkstate>networkState/a>/code> is set to code idloading-the-media-resource:dom-media-network_loading>a href#dom-media-network_loading>NETWORK_LOADING/a>/code> or code idloading-the-media-resource:dom-media-network_idle>a href#dom-media-network_idle>NETWORK_IDLE/a>/code>, a href#queue-a-task idloading-the-media-resource:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idloading-the-media-resource:event-media-abort>a href#event-media-abort>abort/a>/code> at the a href#media-element idloading-the-media-resource:media-element-5>media element/a>.li> p>If the a href#media-element idloading-the-media-resource:media-element-6>media element/a>s code idloading-the-media-resource:dom-media-networkstate-2>a href#dom-media-networkstate>networkState/a>/code> is not set to code idloading-the-media-resource:dom-media-network_empty>a href#dom-media-network_empty>NETWORK_EMPTY/a>/code>, then:/p> ol>li>p>a href#queue-a-task idloading-the-media-resource:queue-a-task-2>Queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idloading-the-media-resource:event-media-emptied>a href#event-media-emptied>emptied/a>/code> at the a href#media-element idloading-the-media-resource:media-element-7>media element/a>.li>p>If a fetching process is in progress for the a href#media-element idloading-the-media-resource:media-element-8>media element/a>, the user agent should stop it.li>p>If the a href#media-element idloading-the-media-resource:media-element-9>media element/a>s a href#assigned-media-provider-object idloading-the-media-resource:assigned-media-provider-object>assigned media provider object/a> is a code idloading-the-media-resource:mediasource>a data-x-internalmediasource hrefhttps://w3c.github.io/media-source/#idl-def-mediasource>MediaSource/a>/code> object, then a hrefhttps://w3c.github.io/media-source/#mediasource-detach idloading-the-media-resource:detaching-from-a-media-element data-x-internaldetaching-from-a-media-element>detach/a> it.li>p>a href#forget-the-media-elements-media-resource-specific-tracks idloading-the-media-resource:forget-the-media-elements-media-resource-specific-tracks>Forget the media elements media-resource-specific tracks/a>.li>p>If code idloading-the-media-resource:dom-media-readystate>a href#dom-media-readystate>readyState/a>/code> is not set to code idloading-the-media-resource:dom-media-have_nothing>a href#dom-media-have_nothing>HAVE_NOTHING/a>/code>, then set it to that state.li> p>If the code idloading-the-media-resource:dom-media-paused>a href#dom-media-paused>paused/a>/code> attribute is false, then:/p> ol>li>p>Set the code idloading-the-media-resource:dom-media-paused-2>a href#dom-media-paused>paused/a>/code> attribute to true.li>p>a href#take-pending-play-promises idloading-the-media-resource:take-pending-play-promises>Take pending play promises/a> and a href#reject-pending-play-promises idloading-the-media-resource:reject-pending-play-promises-2>reject pending play promises/a> with the result and an a idloading-the-media-resource:aborterror hrefhttps://heycam.github.io/webidl/#aborterror data-x-internalaborterror>code>AbortError/code>/a> code idloading-the-media-resource:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./ol> li>p>If code idloading-the-media-resource:dom-media-seeking>a href#dom-media-seeking>seeking/a>/code> is true, set it to false.li> p>Set the a href#current-playback-position idloading-the-media-resource:current-playback-position>current playback position/a> to 0./p> p>Set the a href#official-playback-position idloading-the-media-resource:official-playback-position>official playback position/a> to 0./p> p>If this changed the a href#official-playback-position idloading-the-media-resource:official-playback-position-2>official playback position/a>, then a href#queue-a-task idloading-the-media-resource:queue-a-task-3>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-3 data-x-internalconcept-event-fire>fire an event/a> named code idloading-the-media-resource:event-media-timeupdate>a href#event-media-timeupdate>timeupdate/a>/code> at the a href#media-element idloading-the-media-resource:media-element-10>media element/a>./p> li>p>Set the a href#timeline-offset idloading-the-media-resource:timeline-offset>timeline offset/a> to Not-a-Number (NaN).li> p>Update the code idloading-the-media-resource:dom-media-duration>a href#dom-media-duration>duration/a>/code> attribute to Not-a-Number (NaN)./p> p classnote>The user agent a href#durationChange>will not/a> fire a code idloading-the-media-resource:event-media-durationchange>a href#event-media-durationchange>durationchange/a>/code> event for this particular change of the duration./p> /ol> li>p>Set the code idloading-the-media-resource:dom-media-playbackrate>a href#dom-media-playbackrate>playbackRate/a>/code> attribute to the value of the code idloading-the-media-resource:dom-media-defaultplaybackrate>a href#dom-media-defaultplaybackrate>defaultPlaybackRate/a>/code> attribute.li>p>Set the code idloading-the-media-resource:dom-media-error>a href#dom-media-error>error/a>/code> attribute to null and the a href#can-autoplay-flag idloading-the-media-resource:can-autoplay-flag>can autoplay flag/a> to true.li>p>Invoke the a href#media-element idloading-the-media-resource:media-element-11>media element/a>s a href#concept-media-load-algorithm idloading-the-media-resource:concept-media-load-algorithm-2>resource selection algorithm/a>.li> p classnote>Playback of any previously playing a href#media-resource idloading-the-media-resource:media-resource-2>media resource/a> for this element stops./p> /ol> p>The dfn idconcept-media-load-algorithm>resource selection algorithm/dfn> for a a href#media-element idloading-the-media-resource:media-element-12>media element/a> is as follows. This algorithm is always invoked as part of a a href#concept-task idloading-the-media-resource:concept-task-3>task/a>, but one of the first steps in the algorithm is to return and continue running the remaining steps a href#in-parallel idloading-the-media-resource:in-parallel>in parallel/a>. In addition, this algorithm interacts closely with the a href#event-loop idloading-the-media-resource:event-loop>event loop/a> mechanism; in particular, it has a href#synchronous-section idloading-the-media-resource:synchronous-section>synchronous sections/a> (which are triggered as part of the a href#event-loop idloading-the-media-resource:event-loop-2>event loop/a> algorithm). Steps in such sections are marked with ⌛./p> ol>li>p>Set the elements code idloading-the-media-resource:dom-media-networkstate-3>a href#dom-media-networkstate>networkState/a>/code> attribute to the code idloading-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 elements a href#show-poster-flag idloading-the-media-resource:show-poster-flag>show poster flag/a> to true.li>p>Set the a href#media-element idloading-the-media-resource:media-element-13>media element/a>s a href#delaying-the-load-event-flag idloading-the-media-resource:delaying-the-load-event-flag-2>delaying-the-load-event flag/a> to true (this a href#delay-the-load-event idloading-the-media-resource:delay-the-load-event-2>delays the load event/a>).li>p>a href#await-a-stable-state idloading-the-media-resource:await-a-stable-state>Await a stable state/a>, allowing the a href#concept-task idloading-the-media-resource:concept-task-4>task/a> that invoked this algorithm to continue. The a href#synchronous-section idloading-the-media-resource:synchronous-section-2>synchronous section/a> consists of all the remaining steps of this algorithm until the algorithm says the a href#synchronous-section idloading-the-media-resource:synchronous-section-3>synchronous section/a> has ended. (Steps in a href#synchronous-section idloading-the-media-resource:synchronous-section-4>synchronous sections/a> are marked with ⌛.)li> p>⌛ If the a href#media-element idloading-the-media-resource:media-element-14>media element/a>s a href#blocked-on-parser idloading-the-media-resource:blocked-on-parser>blocked-on-parser/a> flag is false, then a href#populate-the-list-of-pending-text-tracks idloading-the-media-resource:populate-the-list-of-pending-text-tracks>populate the list of pending text tracks/a>./p> li> p>⌛ If the a href#media-element idloading-the-media-resource:media-element-15>media element/a> has an a href#assigned-media-provider-object idloading-the-media-resource:assigned-media-provider-object-2>assigned media provider object/a>, then let var>mode/var> be i>object/i>./p> p>⌛ Otherwise, if the a href#media-element idloading-the-media-resource:media-element-16>media element/a> has no a href#assigned-media-provider-object idloading-the-media-resource:assigned-media-provider-object-3>assigned media provider object/a> but has a code idloading-the-media-resource:attr-media-src>a href#attr-media-src>src/a>/code> attribute, then let var>mode/var> be i>attribute/i>./p> p>⌛ Otherwise, if the a href#media-element idloading-the-media-resource:media-element-17>media element/a> does not have an a href#assigned-media-provider-object idloading-the-media-resource:assigned-media-provider-object-4>assigned media provider object/a> and does not have a code idloading-the-media-resource:attr-media-src-2>a href#attr-media-src>src/a>/code> attribute, but does have a code idloading-the-media-resource:the-source-element>a href#the-source-element>source/a>/code> element child, then let var>mode/var> be i>children/i> and let var>candidate/var> be the first such code idloading-the-media-resource:the-source-element-2>a href#the-source-element>source/a>/code> element child in a idloading-the-media-resource:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>./p> p>⌛ Otherwise the a href#media-element idloading-the-media-resource:media-element-18>media element/a> has no a href#assigned-media-provider-object idloading-the-media-resource:assigned-media-provider-object-5>assigned media provider object/a> and has neither a code idloading-the-media-resource:attr-media-src-3>a href#attr-media-src>src/a>/code> attribute nor a code idloading-the-media-resource:the-source-element-3>a href#the-source-element>source/a>/code> element child: set the code idloading-the-media-resource:dom-media-networkstate-4>a href#dom-media-networkstate>networkState/a>/code> to code idloading-the-media-resource:dom-media-network_empty-2>a href#dom-media-network_empty>NETWORK_EMPTY/a>/code>, and abort these steps; the a href#synchronous-section idloading-the-media-resource:synchronous-section-5>synchronous section/a> ends./p> li>p>⌛ Set the a href#media-element idloading-the-media-resource:media-element-19>media element/a>s code idloading-the-media-resource:dom-media-networkstate-5>a href#dom-media-networkstate>networkState/a>/code> to code idloading-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 idloading-the-media-resource:queue-a-task-4>Queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-4 data-x-internalconcept-event-fire>fire an event/a> named code idloading-the-media-resource:event-media-loadstart>a href#event-media-loadstart>loadstart/a>/code> at the a href#media-element idloading-the-media-resource:media-element-20>media element/a>.li> p>Run the appropriate steps from the following list:/p> dl classswitch>dt>If var>mode/var> is i>object/i>dd> ol>li>p>⌛ Set the code idloading-the-media-resource:dom-media-currentsrc>a href#dom-media-currentsrc>currentSrc/a>/code> attribute to the empty string.li>p>End the a href#synchronous-section idloading-the-media-resource:synchronous-section-6>synchronous section/a>, continuing the remaining steps a href#in-parallel idloading-the-media-resource:in-parallel-2>in parallel/a>.li>p>Run the a href#concept-media-load-resource idloading-the-media-resource:concept-media-load-resource>resource fetch algorithm/a> with the a href#assigned-media-provider-object idloading-the-media-resource:assigned-media-provider-object-6>assigned media provider object/a>. If that algorithm returns without aborting em>this/em> one, then the load failed.li>p>i>Failed with media provider/i>: Reaching this step indicates that the media resource failed to load. a href#take-pending-play-promises idloading-the-media-resource:take-pending-play-promises-2>Take pending play promises/a> and a href#queue-a-task idloading-the-media-resource:queue-a-task-5>queue a task/a> to run the a href#dedicated-media-source-failure-steps idloading-the-media-resource:dedicated-media-source-failure-steps>dedicated media source failure steps/a> with the result.li>p>Wait for the a href#concept-task idloading-the-media-resource:concept-task-5>task/a> queued by the previous step to have executed.li>p>Abort these steps. The element wont attempt to load another resource until this algorithm is triggered again./ol> dt>If var>mode/var> is i>attribute/i>dd> ol>li>p>⌛ If the code idloading-the-media-resource:attr-media-src-4>a href#attr-media-src>src/a>/code> attributes value is the empty string, then end the a href#synchronous-section idloading-the-media-resource:synchronous-section-7>synchronous section/a>, and jump down to the i>failed with attribute/i> step below.li>p>⌛ Let var>urlString/var> and var>urlRecord/var> be the a href#resulting-url-string idloading-the-media-resource:resulting-url-string>resulting URL string/a> and the a href#resulting-url-record idloading-the-media-resource:resulting-url-record>resulting URL record/a>, respectively, that would have resulted from a href#parse-a-url idloading-the-media-resource:parse-a-url>parsing/a> the a idloading-the-media-resource:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> specified by the code idloading-the-media-resource:attr-media-src-5>a href#attr-media-src>src/a>/code> attributes value relative to the a href#media-element idloading-the-media-resource:media-element-21>media element/a>s a idloading-the-media-resource:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> when the code idloading-the-media-resource:attr-media-src-6>a href#attr-media-src>src/a>/code> attribute was last changed./p> li>p>⌛ If var>urlString/var> was obtained successfully, set the code idloading-the-media-resource:dom-media-currentsrc-2>a href#dom-media-currentsrc>currentSrc/a>/code> attribute to var>urlString/var>.li>p>End the a href#synchronous-section idloading-the-media-resource:synchronous-section-8>synchronous section/a>, continuing the remaining steps a href#in-parallel idloading-the-media-resource:in-parallel-3>in parallel/a>.li>p>If var>urlRecord/var> was obtained successfully, run the a href#concept-media-load-resource idloading-the-media-resource:concept-media-load-resource-2>resource fetch algorithm/a> with var>urlRecord/var>. If that algorithm returns without aborting em>this/em> one, then the load failed.li>p>i>Failed with attribute/i>: Reaching this step indicates that the media resource failed to load or that the given a idloading-the-media-resource:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> could not be a href#parse-a-url idloading-the-media-resource:parse-a-url-2>parsed/a>. a href#take-pending-play-promises idloading-the-media-resource:take-pending-play-promises-3>Take pending play promises/a> and a href#queue-a-task idloading-the-media-resource:queue-a-task-6>queue a task/a> to run the a href#dedicated-media-source-failure-steps idloading-the-media-resource:dedicated-media-source-failure-steps-2>dedicated media source failure steps/a> with the result.li>p>Wait for the a href#concept-task idloading-the-media-resource:concept-task-6>task/a> queued by the previous step to have executed.li>p>Abort these steps. The element wont attempt to load another resource until this algorithm is triggered again./ol> dt>Otherwise (var>mode/var> is i>children/i>)dd> ol>li> p>⌛ Let var>pointer/var> be a position defined by two adjacent nodes in the a href#media-element idloading-the-media-resource:media-element-22>media element/a>s child list, treating the start of the list (before the first child in the list, if any) and end of the list (after the last child in the list, if any) as nodes in their own right. One node is the node before var>pointer/var>, and the other node is the node after var>pointer/var>. Initially, let var>pointer/var> be the position between the var>candidate/var> node and the next node, if there are any, or the end of the list, if it is the last node./p> p>As a href#nodes-are-inserted idloading-the-media-resource:nodes-are-inserted>nodes are inserted/a> and a href#nodes-are-removed idloading-the-media-resource:nodes-are-removed>removed/a> into the a href#media-element idloading-the-media-resource:media-element-23>media element/a>, var>pointer/var> must be updated as follows:/p> dl>dt>If a new a href#nodes-are-inserted idloading-the-media-resource:nodes-are-inserted-2>node is inserted/a> 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 removeddd>Let var>pointer/var> be the point between the node after var>pointer/var> and the node before the node after var>pointer/var>. In other words, var>pointer/var> doesnt move relative to the remaining nodes.dt>If the node after var>pointer/var> is removeddd>Let var>pointer/var> be the point between the node before var>pointer/var> and the node after the node before var>pointer/var>. Just as with the previous case, var>pointer/var> doesnt move relative to the remaining nodes./dl> p>Other changes dont affect var>pointer/var>./p> li>p>⌛ i>Process candidate/i>: If var>candidate/var> does not have a code idloading-the-media-resource:attr-source-src>a href#attr-source-src>src/a>/code> attribute, or if its code idloading-the-media-resource:attr-source-src-2>a href#attr-source-src>src/a>/code> attributes value is the empty string, then end the a href#synchronous-section idloading-the-media-resource:synchronous-section-9>synchronous section/a>, and jump down to the i>failed with elements/i> step below.li>p>⌛ Let var>urlString/var> and var>urlRecord/var> be the a href#resulting-url-string idloading-the-media-resource:resulting-url-string-2>resulting URL string/a> and the a href#resulting-url-record idloading-the-media-resource:resulting-url-record-2>resulting URL record/a>, respectively, that would have resulted from a href#parse-a-url idloading-the-media-resource:parse-a-url-3>parsing/a> the a idloading-the-media-resource:url-3 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> specified by var>candidate/var>s code idloading-the-media-resource:attr-source-src-3>a href#attr-source-src>src/a>/code> attributes value relative to the var>candidate/var>s a idloading-the-media-resource:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> when the code idloading-the-media-resource:attr-source-src-4>a href#attr-source-src>src/a>/code> attribute was last changed./p> li>p>⌛ If var>urlString/var> was not obtained successfully, then end the a href#synchronous-section idloading-the-media-resource:synchronous-section-10>synchronous section/a>, and jump down to the i>failed with elements/i> step below.li>p>⌛ If var>candidate/var> has a code idloading-the-media-resource:attr-source-type>a href#attr-source-type>type/a>/code> attribute whose value, when parsed as a a idloading-the-media-resource:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> (including any codecs described by the code>codecs/code> parameter, for types that define that parameter), represents a href#a-type-that-the-user-agent-knows-it-cannot-render idloading-the-media-resource:a-type-that-the-user-agent-knows-it-cannot-render>a type that the user agent knows it cannot render/a>, then end the a href#synchronous-section idloading-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 idloading-the-media-resource:dom-media-currentsrc-3>a href#dom-media-currentsrc>currentSrc/a>/code> attribute to var>urlString/var>.li>p>End the a href#synchronous-section idloading-the-media-resource:synchronous-section-12>synchronous section/a>, continuing the remaining steps a href#in-parallel idloading-the-media-resource:in-parallel-4>in parallel/a>.li>p>Run the a href#concept-media-load-resource idloading-the-media-resource:concept-media-load-resource-3>resource fetch algorithm/a> with var>urlRecord/var>. If that algorithm returns without aborting em>this/em> one, then the load failed.li>p>i>Failed with elements/i>: a href#queue-a-task idloading-the-media-resource:queue-a-task-7>Queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-5 data-x-internalconcept-event-fire>fire an event/a> named code idloading-the-media-resource:event-source-error>a href#event-source-error>error/a>/code> at the var>candidate/var> element.li>p>a href#await-a-stable-state idloading-the-media-resource:await-a-stable-state-2>Await a stable state/a>. The a href#synchronous-section idloading-the-media-resource:synchronous-section-13>synchronous section/a> consists of all the remaining steps of this algorithm until the algorithm says the a href#synchronous-section idloading-the-media-resource:synchronous-section-14>synchronous section/a> has ended. (Steps in a href#synchronous-section idloading-the-media-resource:synchronous-section-15>synchronous sections/a> are marked with ⌛.)li>p>⌛ a href#forget-the-media-elements-media-resource-specific-tracks idloading-the-media-resource:forget-the-media-elements-media-resource-specific-tracks-2>Forget the media elements media-resource-specific tracks/a>.li>p>⌛ i>Find next candidate/i>: Let var>candidate/var> be null.li>p>⌛ i>Search loop/i>: If the node after var>pointer/var> is the end of the list, then jump to the i>waiting/i> step below.li>p>⌛ If the node after var>pointer/var> is a code idloading-the-media-resource:the-source-element-4>a href#the-source-element>source/a>/code> element, let var>candidate/var> be that element.li>p>⌛ Advance var>pointer/var> so that the node before var>pointer/var> is now the node that was after var>pointer/var>, and the node after var>pointer/var> is the node after the node that used to be after var>pointer/var>, if any.li>p>⌛ If var>candidate/var> is null, jump back to the i>search loop/i> step. Otherwise, jump back to the i>process candidate/i> step.li>p>⌛ i>Waiting/i>: Set the elements code idloading-the-media-resource:dom-media-networkstate-6>a href#dom-media-networkstate>networkState/a>/code> attribute to the code idloading-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 elements a href#show-poster-flag idloading-the-media-resource:show-poster-flag-2>show poster flag/a> to true.li>p>⌛ a href#queue-a-task idloading-the-media-resource:queue-a-task-8>Queue a task/a> to set the elements a href#delaying-the-load-event-flag idloading-the-media-resource:delaying-the-load-event-flag-3>delaying-the-load-event flag/a> to false. This stops a href#delay-the-load-event idloading-the-media-resource:delay-the-load-event-3>delaying the load event/a>.li>p>End the a href#synchronous-section idloading-the-media-resource:synchronous-section-16>synchronous section/a>, continuing the remaining steps a href#in-parallel idloading-the-media-resource:in-parallel-5>in parallel/a>.li>p>Wait until the node after var>pointer/var> is a node other than the end of the list. (This step might wait forever.)li>p>a href#await-a-stable-state idloading-the-media-resource:await-a-stable-state-3>Await a stable state/a>. The a href#synchronous-section idloading-the-media-resource:synchronous-section-17>synchronous section/a> consists of all the remaining steps of this algorithm until the algorithm says the a href#synchronous-section idloading-the-media-resource:synchronous-section-18>synchronous section/a> has ended. (Steps in a href#synchronous-section idloading-the-media-resource:synchronous-section-19>synchronous sections/a> are marked with ⌛.)li>p>⌛ Set the elements a href#delaying-the-load-event-flag idloading-the-media-resource:delaying-the-load-event-flag-4>delaying-the-load-event flag/a> back to true (this a href#delay-the-load-event idloading-the-media-resource:delay-the-load-event-4>delays the load event/a> again, in case it hasnt been fired yet)./p> li>p>⌛ Set the code idloading-the-media-resource:dom-media-networkstate-7>a href#dom-media-networkstate>networkState/a>/code> back to code idloading-the-media-resource:dom-media-network_loading-3>a href#dom-media-network_loading>NETWORK_LOADING/a>/code>.li>p>⌛ Jump back to the i>find next candidate/i> step above./ol> /dl> p>The dfn iddedicated-media-source-failure-steps>dedicated media source failure steps/dfn> with a list of promises var>promises/var> are the following steps:/p> ol>li>p>Set the code idloading-the-media-resource:dom-media-error-2>a href#dom-media-error>error/a>/code> attribute to the result of a href#creating-a-mediaerror idloading-the-media-resource:creating-a-mediaerror>creating a code>MediaError/code>/a> with code idloading-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-elements-media-resource-specific-tracks idloading-the-media-resource:forget-the-media-elements-media-resource-specific-tracks-3>Forget the media elements media-resource-specific tracks/a>.li>p>Set the elements code idloading-the-media-resource:dom-media-networkstate-8>a href#dom-media-networkstate>networkState/a>/code> attribute to the code idloading-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 elements a href#show-poster-flag idloading-the-media-resource:show-poster-flag-3>show poster flag/a> to true.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-6 data-x-internalconcept-event-fire>Fire an event/a> named code idloading-the-media-resource:event-media-error>a href#event-media-error>error/a>/code> at the a href#media-element idloading-the-media-resource:media-element-24>media element/a>.li>p>a href#reject-pending-play-promises idloading-the-media-resource:reject-pending-play-promises-3>Reject pending play promises/a> with var>promises/var> and a a idloading-the-media-resource:notsupportederror hrefhttps://heycam.github.io/webidl/#notsupportederror data-x-internalnotsupportederror>code>NotSupportedError/code>/a> code idloading-the-media-resource:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Set the elements a href#delaying-the-load-event-flag idloading-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 idloading-the-media-resource:delay-the-load-event-5>delaying the load event/a>./ol> /ol> p>The dfn idconcept-media-load-resource>resource fetch algorithm/dfn> for a a href#media-element idloading-the-media-resource:media-element-25>media element/a> and a given a idloading-the-media-resource:url-record hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a> or a href#media-provider-object idloading-the-media-resource:media-provider-object>media provider object/a> is as follows:/p> ol>li>p>If the algorithm was invoked with a href#media-provider-object idloading-the-media-resource:media-provider-object-2>media provider object/a> or a a idloading-the-media-resource:url-record-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a> whose a hrefhttps://url.spec.whatwg.org/#concept-url-object idloading-the-media-resource:concept-url-object data-x-internalconcept-url-object>object/a> is a a href#media-provider-object idloading-the-media-resource:media-provider-object-3>media provider object/a>, then let var>mode/var> be i>local/i>. Otherwise let var>mode/var> be i>remote/i>.li>p>If var>mode/var> is i>remote/i>, then let the var>current media resource/var> be the resource given by the a idloading-the-media-resource:url-record-3 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a> passed to this algorithm; otherwise, let the var>current media resource/var> be the resource given by the a href#media-provider-object idloading-the-media-resource:media-provider-object-4>media provider object/a>. Either way, the var>current media resource/var> is now the elements a href#media-resource idloading-the-media-resource:media-resource-3>media resource/a>.li>p>Remove all a href#media-resource-specific-text-track idloading-the-media-resource:media-resource-specific-text-track>media-resource-specific text tracks/a> from the a href#media-element idloading-the-media-resource:media-element-26>media element/a>s a href#list-of-pending-text-tracks idloading-the-media-resource:list-of-pending-text-tracks>list of pending text tracks/a>, if any./p> li> p>Run the appropriate steps from the following list:/p> dl classswitch>dt>If var>mode/var> is remotedd> ol>li> p>Optionally, run the following substeps. This is the expected behavior if the user agent intends to not attempt to fetch the resource until the user requests it explicitly (e.g. as a way to implement the code idloading-the-media-resource:attr-media-preload>a href#attr-media-preload>preload/a>/code> attributes code idloading-the-media-resource:attr-media-preload-none>a href#attr-media-preload-none>none/a>/code> keyword)./p> ol>li>p>Set the code idloading-the-media-resource:dom-media-networkstate-9>a href#dom-media-networkstate>networkState/a>/code> to code idloading-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 idloading-the-media-resource:queue-a-task-9>Queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-7 data-x-internalconcept-event-fire>fire an event/a> named code idloading-the-media-resource:event-media-suspend>a href#event-media-suspend>suspend/a>/code> at the element.li>p>a href#queue-a-task idloading-the-media-resource:queue-a-task-10>Queue a task/a> to set the elements a href#delaying-the-load-event-flag idloading-the-media-resource:delaying-the-load-event-flag-6>delaying-the-load-event flag/a> to false. This stops a href#delay-the-load-event idloading-the-media-resource:delay-the-load-event-6>delaying the load event/a>.li>p>Wait for the task to be run.li>p>Wait for an implementation-defined event (e.g. the user requesting that the media element begin playback).li>p>Set the elements a href#delaying-the-load-event-flag idloading-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 idloading-the-media-resource:delay-the-load-event-7>delays the load event/a> again, in case it hasnt been fired yet)./p> li>p>Set the code idloading-the-media-resource:dom-media-networkstate-10>a href#dom-media-networkstate>networkState/a>/code> to code idloading-the-media-resource:dom-media-network_loading-4>a href#dom-media-network_loading>NETWORK_LOADING/a>/code>./ol> li> p>Let var>destination/var> be code>audio/code> if the a href#media-element idloading-the-media-resource:media-element-27>media element/a> is an code idloading-the-media-resource:the-audio-element>a href#the-audio-element>audio/a>/code> element and to code>video/code> otherwise./p> p>Let var>request/var> be the result of a href#create-a-potential-cors-request idloading-the-media-resource:create-a-potential-cors-request>creating a potential-CORS request/a> given var>current media resource/var>s a idloading-the-media-resource:url-record-4 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a>, var>destination/var>, and the a href#media-element idloading-the-media-resource:media-element-28>media element/a>s code idloading-the-media-resource:attr-media-crossorigin>a href#attr-media-crossorigin>crossorigin/a>/code> content attribute value. p>Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-client idloading-the-media-resource:concept-request-client data-x-internalconcept-request-client>client/a> to the a href#media-element idloading-the-media-resource:media-element-29>media element/a>s a idloading-the-media-resource:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s code idloading-the-media-resource:window>a href#window>Window/a>/code> objects a href#environment-settings-object idloading-the-media-resource:environment-settings-object>environment settings object/a>./p> p>a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idloading-the-media-resource:concept-fetch data-x-internalconcept-fetch>Fetch/a> var>request/var>. p>The var>response/var>s a href#unsafe-response idloading-the-media-resource:unsafe-response>unsafe response/a> obtained in this fashion, if any, contains the a href#media-data idloading-the-media-resource:media-data>media data/a>. It can be a href#cors-same-origin idloading-the-media-resource:cors-same-origin>CORS-same-origin/a> or a href#cors-cross-origin idloading-the-media-resource:cors-cross-origin>CORS-cross-origin/a>; this affects whether subtitles referenced in the a href#media-data idloading-the-media-resource:media-data-2>media data/a> are exposed in the API and, for code idloading-the-media-resource:the-video-element>a href#the-video-element>video/a>/code> elements, whether a code idloading-the-media-resource:the-canvas-element>a href#the-canvas-element>canvas/a>/code> gets tainted when the video is drawn on it./p> p>The dfn idstall-timeout>stall timeout/dfn> is a user-agent defined length of time, which should be about three seconds. When a a href#media-element idloading-the-media-resource:media-element-30>media element/a> that is actively attempting to obtain a href#media-data idloading-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 idloading-the-media-resource:stall-timeout>stall timeout/a>, the user agent must a href#queue-a-task idloading-the-media-resource:queue-a-task-11>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-8 data-x-internalconcept-event-fire>fire an event/a> named code idloading-the-media-resource:event-media-stalled>a href#event-media-stalled>stalled/a>/code> at the element./p> p>User agents may allow users to selectively block or slow a href#media-data idloading-the-media-resource:media-data-4>media data/a> downloads. When a a href#media-element idloading-the-media-resource:media-element-31>media element/a>s download has been blocked altogether, the user agent must act as if it was stalled (as opposed to acting as if the connection was closed). The rate of the download may also be throttled automatically by the user agent, e.g. to balance the download with other connections sharing the same bandwidth./p> p idresourceSuspend>User agents may decide to not download more content at any time, e.g. after buffering five minutes of a one hour media resource, while waiting for the user to decide whether to play the resource or not, while waiting for user input in an interactive resource, or when the user navigates away from the page. When a a href#media-element idloading-the-media-resource:media-element-32>media element/a>s download has been suspended, the user agent must a href#queue-a-task idloading-the-media-resource:queue-a-task-12>queue a task/a>, to set the code idloading-the-media-resource:dom-media-networkstate-11>a href#dom-media-networkstate>networkState/a>/code> to code idloading-the-media-resource:dom-media-network_idle-3>a href#dom-media-network_idle>NETWORK_IDLE/a>/code> and a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-9 data-x-internalconcept-event-fire>fire an event/a> named code idloading-the-media-resource:event-media-suspend-2>a href#event-media-suspend>suspend/a>/code> at the element. If and when downloading of the resource resumes, the user agent must a href#queue-a-task idloading-the-media-resource:queue-a-task-13>queue a task/a> to set the code idloading-the-media-resource:dom-media-networkstate-12>a href#dom-media-networkstate>networkState/a>/code> to code idloading-the-media-resource:dom-media-network_loading-5>a href#dom-media-network_loading>NETWORK_LOADING/a>/code>. Between the queuing of these tasks, the load is suspended (so code idloading-the-media-resource:event-media-progress>a href#event-media-progress>progress/a>/code> events dont fire, as described above)./p> p classnote>The code idloading-the-media-resource:attr-media-preload-2>a href#attr-media-preload>preload/a>/code> attribute provides a hint regarding how much buffering the author thinks is advisable, even in the absence of the code idloading-the-media-resource:attr-media-autoplay>a href#attr-media-autoplay>autoplay/a>/code> attribute./p> p>When a user agent decides to completely suspend a download, e.g., if it is waiting until the user starts playback before downloading any further content, the user agent must a href#queue-a-task idloading-the-media-resource:queue-a-task-14>queue a task/a> to set the elements a href#delaying-the-load-event-flag idloading-the-media-resource:delaying-the-load-event-flag-8>delaying-the-load-event flag/a> to false. This stops a href#delay-the-load-event idloading-the-media-resource:delay-the-load-event-8>delaying the load event/a>./p> p>The user agent may use whatever means necessary to fetch the resource (within the constraints put forward by this and other specifications); for example, reconnecting to the server in the face of network errors, using HTTP range retrieval requests, or switching to a streaming protocol. The user agent must consider a resource erroneous only if it has given up trying to fetch it./p> p>To determine the format of the a href#media-resource idloading-the-media-resource:media-resource-4>media resource/a>, the user agent must use the a hrefhttps://mimesniff.spec.whatwg.org/#rules-for-sniffing-audio-and-video-specifically idloading-the-media-resource:content-type-sniffing:-video data-x-internalcontent-type-sniffing:-video>rules for sniffing audio and video specifically/a>./p> p>While the load is not suspended (see below), every 350ms (±200ms) or for every byte received, whichever is em>least/em> frequent, a href#queue-a-task idloading-the-media-resource:queue-a-task-15>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-10 data-x-internalconcept-event-fire>fire an event/a> named code idloading-the-media-resource:event-media-progress-2>a href#event-media-progress>progress/a>/code> at the element./p> p>The a href#networking-task-source idloading-the-media-resource:networking-task-source>networking task source/a> a href#concept-task idloading-the-media-resource:concept-task-7>tasks/a> to process the data as it is being fetched must each a href#immediately idloading-the-media-resource:immediately>immediately/a> a href#queue-a-task idloading-the-media-resource:queue-a-task-16>queue a task/a> to run the first appropriate steps from the a href#media-data-processing-steps-list idloading-the-media-resource:media-data-processing-steps-list>media data processing steps list/a> below. (A new task is used for this so that the work described below occurs relative to the a href#media-element-event-task-source idloading-the-media-resource:media-element-event-task-source-2>media element event task source/a> rather than the a href#networking-task-source idloading-the-media-resource:networking-task-source-2>networking task source/a>.)/p> p>When the a href#networking-task-source idloading-the-media-resource:networking-task-source-3>networking task source/a> has a href#queue-a-task idloading-the-media-resource:queue-a-task-17>queued/a> the last a href#concept-task idloading-the-media-resource:concept-task-8>task/a> as part of fetching the a href#media-resource idloading-the-media-resource:media-resource-5>media resource/a> (i.e. once the download has completed), if the fetching process completes without errors, including decoding the media data, and if all of the data is available to the user agent without network access, then, the user agent must move on to the i>final step/i> below. This might never happen, e.g. when streaming an infinite resource such as Web radio, or if the resource is longer than the user agents ability to cache data./p> p>While the user agent might still need network access to obtain parts of the a href#media-resource idloading-the-media-resource:media-resource-6>media resource/a>, the user agent must remain on this step./p> p classexample>For example, if the user agent has discarded the first half of a video, the user agent will remain at this step even once the a href#ended-playback idloading-the-media-resource:ended-playback>playback has ended/a>, because there is always the chance the user will seek back to the start. In fact, in this situation, once a href#ended-playback idloading-the-media-resource:ended-playback-2>playback has ended/a>, the user agent will end up firing a code idloading-the-media-resource:event-media-suspend-3>a href#event-media-suspend>suspend/a>/code> event, as described earlier./p> /ol> dt>Otherwise (var>mode/var> is i>local/i>)dd> p>The resource described by the var>current media resource/var>, if any, contains the a href#media-data idloading-the-media-resource:media-data-5>media data/a>. It is a href#cors-same-origin idloading-the-media-resource:cors-same-origin-2>CORS-same-origin/a>. /p> p>If the var>current media resource/var> is a raw data stream (e.g. from a code idloading-the-media-resource:file>a data-x-internalfile hrefhttps://w3c.github.io/FileAPI/#dfn-file>File/a>/code> object), then to determine the format of the a href#media-resource idloading-the-media-resource:media-resource-7>media resource/a>, the user agent must use the a hrefhttps://mimesniff.spec.whatwg.org/#rules-for-sniffing-audio-and-video-specifically idloading-the-media-resource:content-type-sniffing:-video-2 data-x-internalcontent-type-sniffing:-video>rules for sniffing audio and video specifically/a>. Otherwise, if the data stream is pre-decoded, then the format is the format given by the relevant specification./p> p>Whenever new data for the var>current media resource/var> becomes available, a href#queue-a-task idloading-the-media-resource:queue-a-task-18>queue a task/a> to run the first appropriate steps from the a href#media-data-processing-steps-list idloading-the-media-resource:media-data-processing-steps-list-2>media data processing steps list/a> below./p> p>When the var>current media resource/var> is permanently exhausted (e.g. all the bytes of a code idloading-the-media-resource:blob>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> have been processed), if there were no decoding errors, then the user agent must move on to the i>final step/i> below. This might never happen, e.g. if the var>current media resource/var> is a code idloading-the-media-resource:mediastream>a data-x-internalmediastream hrefhttps://w3c.github.io/mediacapture-main/getusermedia.html#idl-def-mediastream>MediaStream/a>/code>./p> /dl> p>The dfn idmedia-data-processing-steps-list>media data processing steps list/dfn> is as follows:/p> dl classswitch>dt>If the a href#media-data idloading-the-media-resource:media-data-6>media data/a> cannot be fetched at all, due to network errors, causing the user agent to give up trying to fetch the resourcedt>If the a href#media-data idloading-the-media-resource:media-data-7>media data/a> can be fetched but is found by inspection to be in an unsupported format, or can otherwise not be rendered at alldd> p>DNS errors, HTTP 4xx and 5xx errors (and equivalents in other protocols), and other fatal network errors that occur before the user agent has established whether the var>current media resource/var> is usable, as well as the file using an unsupported container format, or using unsupported codecs for all the data, must cause the user agent to execute the following steps:/p> ol>li>p>The user agent should cancel the fetching process.li>p>Abort this subalgorithm, returning to the a href#concept-media-load-algorithm idloading-the-media-resource:concept-media-load-algorithm-3>resource selection algorithm/a>./p> /ol> dt idfound-another-audio-track>If the a href#media-resource idloading-the-media-resource:media-resource-8>media resource/a> is found to have an audio trackdd> ol>li>p>Create an code idloading-the-media-resource:audiotrack>a href#audiotrack>AudioTrack/a>/code> object to represent the audio track.li>p>Update the a href#media-element idloading-the-media-resource:media-element-33>media element/a>s code idloading-the-media-resource:dom-media-audiotracks>a href#dom-media-audiotracks>audioTracks/a>/code> attributes code idloading-the-media-resource:audiotracklist>a href#audiotracklist>AudioTrackList/a>/code> object with the new code idloading-the-media-resource:audiotrack-2>a href#audiotrack>AudioTrack/a>/code> object.li>p>Let var>enable/var> be i>unknown/i>.li> p>If either the a href#media-resource idloading-the-media-resource:media-resource-9>media resource/a> or the a idloading-the-media-resource:url-4 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the var>current media resource/var> indicate a particular set of audio tracks to enable, or if the user agent has information that would facilitate the selection of specific audio tracks to improve the users experience, then: if this audio track is one of the ones to enable, then set var>enable/var> to i>true/i>, otherwise, set var>enable/var> to i>false/i>./p> p classexample>This could be triggered by a idloading-the-media-resource:media-fragment-syntax hrefhttps://www.w3.org/TR/media-frags/#media-fragment-syntax data-x-internalmedia-fragment-syntax>media fragment syntax/a>, but it could also be triggered e.g. by the user agent selecting a 5.1 surround sound audio track over a stereo audio track./p> li>p>If var>enable/var> is still i>unknown/i>, then, if the a href#media-element idloading-the-media-resource:media-element-34>media element/a> does not yet have an a href#dom-audiotrack-enabled idloading-the-media-resource:dom-audiotrack-enabled>enabled/a> audio track, then set var>enable/var> to i>true/i>, otherwise, set var>enable/var> to i>false/i>.li>p>If var>enable/var> is i>true/i>, then enable this audio track, otherwise, do not enable this audio track.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-11 data-x-internalconcept-event-fire>Fire an event/a> named code idloading-the-media-resource:event-media-addtrack>a href#event-media-addtrack>addtrack/a>/code> at this code idloading-the-media-resource:audiotracklist-2>a href#audiotracklist>AudioTrackList/a>/code> object, using code idloading-the-media-resource:trackevent>a href#trackevent>TrackEvent/a>/code>, with the code idloading-the-media-resource:dom-trackevent-track>a href#dom-trackevent-track>track/a>/code> attribute initialized to the new code idloading-the-media-resource:audiotrack-3>a href#audiotrack>AudioTrack/a>/code> object./ol> dt idfound-another-video-track>If the a href#media-resource idloading-the-media-resource:media-resource-10>media resource/a> is found to have a video trackdd> ol>li>p>Create a code idloading-the-media-resource:videotrack>a href#videotrack>VideoTrack/a>/code> object to represent the video track.li>p>Update the a href#media-element idloading-the-media-resource:media-element-35>media element/a>s code idloading-the-media-resource:dom-media-videotracks>a href#dom-media-videotracks>videoTracks/a>/code> attributes code idloading-the-media-resource:videotracklist>a href#videotracklist>VideoTrackList/a>/code> object with the new code idloading-the-media-resource:videotrack-2>a href#videotrack>VideoTrack/a>/code> object.li>p>Let var>enable/var> be i>unknown/i>.li> p>If either the a href#media-resource idloading-the-media-resource:media-resource-11>media resource/a> or the a idloading-the-media-resource:url-5 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the var>current media resource/var> indicate a particular set of video tracks to enable, or if the user agent has information that would facilitate the selection of specific video tracks to improve the users experience, then: if this video track is the first such video track, then set var>enable/var> to i>true/i>, otherwise, set var>enable/var> to i>false/i>./p> p classexample>This could again be triggered by a idloading-the-media-resource:media-fragment-syntax-2 hrefhttps://www.w3.org/TR/media-frags/#media-fragment-syntax data-x-internalmedia-fragment-syntax>media fragment syntax/a>./p> li>p>If var>enable/var> is still i>unknown/i>, then, if the a href#media-element idloading-the-media-resource:media-element-36>media element/a> does not yet have a a href#dom-videotrack-selected idloading-the-media-resource:dom-videotrack-selected>selected/a> video track, then set var>enable/var> to i>true/i>, otherwise, set var>enable/var> to i>false/i>.li>p>If var>enable/var> is i>true/i>, then select this track and unselect any previously selected video tracks, otherwise, do not select this video track. If other tracks are unselected, then a href#toggle-video-track>a code>change/code> event will be fired./a>li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-12 data-x-internalconcept-event-fire>Fire an event/a> named code idloading-the-media-resource:event-media-addtrack-2>a href#event-media-addtrack>addtrack/a>/code> at this code idloading-the-media-resource:videotracklist-2>a href#videotracklist>VideoTrackList/a>/code> object, using code idloading-the-media-resource:trackevent-2>a href#trackevent>TrackEvent/a>/code>, with the code idloading-the-media-resource:dom-trackevent-track-2>a href#dom-trackevent-track>track/a>/code> attribute initialized to the new code idloading-the-media-resource:videotrack-3>a href#videotrack>VideoTrack/a>/code> object./ol> dt idgetting-media-metadata>Once enough of the a href#media-data idloading-the-media-resource:media-data-8>media data/a> has been fetched to determine the duration of the a href#media-resource idloading-the-media-resource:media-resource-12>media resource/a>, its dimensions, and other metadatadd> p>This indicates that the resource is usable. The user agent must follow these substeps:/p> ol>li> p>a href#defineTimeline idloading-the-media-resource:defineTimeline>Establish the media timeline/a> for the purposes of the a href#current-playback-position idloading-the-media-resource:current-playback-position-2>current playback position/a> and the a href#earliest-possible-position idloading-the-media-resource:earliest-possible-position>earliest possible position/a>, based on the a href#media-data idloading-the-media-resource:media-data-9>media data/a>./p> li> p>Update the a href#timeline-offset idloading-the-media-resource:timeline-offset-2>timeline offset/a> to the date and time that corresponds to the zero time in the a href#media-timeline idloading-the-media-resource:media-timeline>media timeline/a> established in the previous step, if any. If no explicit time and date is given by the a href#media-resource idloading-the-media-resource:media-resource-13>media resource/a>, the a href#timeline-offset idloading-the-media-resource:timeline-offset-3>timeline offset/a> must be set to Not-a-Number (NaN)./p> li>p>Set the a href#current-playback-position idloading-the-media-resource:current-playback-position-3>current playback position/a> and the a href#official-playback-position idloading-the-media-resource:official-playback-position-3>official playback position/a> to the a href#earliest-possible-position idloading-the-media-resource:earliest-possible-position-2>earliest possible position/a>.li> p>Update the code idloading-the-media-resource:dom-media-duration-2>a href#dom-media-duration>duration/a>/code> attribute with the time of the last frame of the resource, if known, on the a href#media-timeline idloading-the-media-resource:media-timeline-2>media timeline/a> established above. If it is not known (e.g. a stream that is in principle infinite), update the code idloading-the-media-resource:dom-media-duration-3>a href#dom-media-duration>duration/a>/code> attribute to the value positive Infinity./p> p classnote>The user agent a href#durationChange>will/a> a href#queue-a-task idloading-the-media-resource:queue-a-task-19>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-13 data-x-internalconcept-event-fire>fire an event/a> named code idloading-the-media-resource:event-media-durationchange-2>a href#event-media-durationchange>durationchange/a>/code> at the element at this point./p> li> p>For code idloading-the-media-resource:the-video-element-2>a href#the-video-element>video/a>/code> elements, set the code idloading-the-media-resource:dom-video-videowidth>a href#dom-video-videowidth>videoWidth/a>/code> and code idloading-the-media-resource:dom-video-videoheight>a href#dom-video-videoheight>videoHeight/a>/code> attributes, and a href#queue-a-task idloading-the-media-resource:queue-a-task-20>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-14 data-x-internalconcept-event-fire>fire an event/a> named code idloading-the-media-resource:event-media-resize>a href#event-media-resize>resize/a>/code> at the a href#media-element idloading-the-media-resource:media-element-37>media element/a>./p> p classnote>Further code idloading-the-media-resource:event-media-resize-2>a href#event-media-resize>resize/a>/code> events will be fired if the dimensions subsequently change./p> li> p>Set the code idloading-the-media-resource:dom-media-readystate-2>a href#dom-media-readystate>readyState/a>/code> attribute to code idloading-the-media-resource:dom-media-have_metadata>a href#dom-media-have_metadata>HAVE_METADATA/a>/code>./p> p classnote>A code idloading-the-media-resource:event-media-loadedmetadata>a href#event-media-loadedmetadata>loadedmetadata/a>/code> DOM event a href#fire-loadedmetadata>will be fired/a> as part of setting the code idloading-the-media-resource:dom-media-readystate-3>a href#dom-media-readystate>readyState/a>/code> attribute to a new value./p> li>p>Let var>jumped/var> be false.li>p>If the a href#media-element idloading-the-media-resource:media-element-38>media element/a>s a href#default-playback-start-position idloading-the-media-resource:default-playback-start-position>default playback start position/a> is greater than zero, then a href#dom-media-seek idloading-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 idloading-the-media-resource:media-element-39>media element/a>s a href#default-playback-start-position idloading-the-media-resource:default-playback-start-position-2>default playback start position/a> be zero.li>p>Let the var>initial playback position/var> be zero.li> p>If either the a href#media-resource idloading-the-media-resource:media-resource-14>media resource/a> or the a idloading-the-media-resource:url-6 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the var>current media resource/var> indicate a particular start time, then set the var>initial playback position/var> to that time and, if var>jumped/var> is still false, a href#dom-media-seek idloading-the-media-resource:dom-media-seek-2>seek/a> to that time./p> p classexample>For example, with media formats that support a idloading-the-media-resource:media-fragment-syntax-3 hrefhttps://www.w3.org/TR/media-frags/#media-fragment-syntax data-x-internalmedia-fragment-syntax>media fragment syntax/a>, the a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idloading-the-media-resource:concept-url-fragment data-x-internalconcept-url-fragment>fragment/a> can be used to indicate a start position./p> li>p>If there is no a href#dom-audiotrack-enabled idloading-the-media-resource:dom-audiotrack-enabled-2>enabled/a> audio track, then enable an audio track. This a href#toggle-audio-track>will cause a code>change/code> event to be fired/a>.li>p>If there is no a href#dom-videotrack-selected idloading-the-media-resource:dom-videotrack-selected-2>selected/a> video track, then select a video track. This a href#toggle-video-track>will cause a code>change/code> event to be fired/a>./ol> p>Once the code idloading-the-media-resource:dom-media-readystate-4>a href#dom-media-readystate>readyState/a>/code> attribute reaches code idloading-the-media-resource:dom-media-have_current_data>a href#dom-media-have_current_data>HAVE_CURRENT_DATA/a>/code>, a href#fire-loadeddata>after the code>loadeddata/code> event has been fired/a>, set the elements a href#delaying-the-load-event-flag idloading-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 idloading-the-media-resource:delay-the-load-event-9>delaying the load event/a>./p> p classnote>A user agent that is attempting to reduce network usage while still fetching the metadata for each a href#media-resource idloading-the-media-resource:media-resource-15>media resource/a> would also stop buffering at this point, following a href#resourceSuspend>the rules described previously/a>, which involve the code idloading-the-media-resource:dom-media-networkstate-13>a href#dom-media-networkstate>networkState/a>/code> attribute switching to the code idloading-the-media-resource:dom-media-network_idle-4>a href#dom-media-network_idle>NETWORK_IDLE/a>/code> value and a code idloading-the-media-resource:event-media-suspend-4>a href#event-media-suspend>suspend/a>/code> event firing./p> p classnote>The user agent is em>required/em> to determine the duration of the a href#media-resource idloading-the-media-resource:media-resource-16>media resource/a> and go through this step before playing./p> dt>Once the entire a href#media-resource idloading-the-media-resource:media-resource-17>media resource/a> has been fetched (but potentially before any of it has been decoded)dd> p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-15 data-x-internalconcept-event-fire>Fire an event/a> named code idloading-the-media-resource:event-media-progress-3>a href#event-media-progress>progress/a>/code> at the a href#media-element idloading-the-media-resource:media-element-40>media element/a>./p> p>Set the code idloading-the-media-resource:dom-media-networkstate-14>a href#dom-media-networkstate>networkState/a>/code> to code idloading-the-media-resource:dom-media-network_idle-5>a href#dom-media-network_idle>NETWORK_IDLE/a>/code> and a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-16 data-x-internalconcept-event-fire>fire an event/a> named code idloading-the-media-resource:event-media-suspend-5>a href#event-media-suspend>suspend/a>/code> at the a href#media-element idloading-the-media-resource:media-element-41>media element/a>./p> p>If the user agent ever discards any a href#media-data idloading-the-media-resource:media-data-10>media data/a> and then needs to resume the network activity to obtain it again, then it must a href#queue-a-task idloading-the-media-resource:queue-a-task-21>queue a task/a> to set the code idloading-the-media-resource:dom-media-networkstate-15>a href#dom-media-networkstate>networkState/a>/code> to code idloading-the-media-resource:dom-media-network_loading-6>a href#dom-media-network_loading>NETWORK_LOADING/a>/code>./p> p classnote>If the user agent can keep the a href#media-resource idloading-the-media-resource:media-resource-18>media resource/a> loaded, then the algorithm will continue to its i>final step/i> below, which aborts the algorithm./p> dt>If the connection is interrupted after some a href#media-data idloading-the-media-resource:media-data-11>media data/a> has been received, causing the user agent to give up trying to fetch the resourcedd> 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 idloading-the-media-resource:media-element-42>media element/a>s code idloading-the-media-resource:dom-media-readystate-5>a href#dom-media-readystate>readyState/a>/code> attribute is no longer code idloading-the-media-resource:dom-media-have_nothing-2>a href#dom-media-have_nothing>HAVE_NOTHING/a>/code>) must cause the user agent to execute the following steps:/p> ol>li>p>The user agent should cancel the fetching process.li>p>Set the code idloading-the-media-resource:dom-media-error-3>a href#dom-media-error>error/a>/code> attribute to the result of a href#creating-a-mediaerror idloading-the-media-resource:creating-a-mediaerror-2>creating a code>MediaError/code>/a> with code idloading-the-media-resource:dom-mediaerror-media_err_network>a href#dom-mediaerror-media_err_network>MEDIA_ERR_NETWORK/a>/code>.li>p>Set the elements code idloading-the-media-resource:dom-media-networkstate-16>a href#dom-media-networkstate>networkState/a>/code> attribute to the code idloading-the-media-resource:dom-media-network_idle-6>a href#dom-media-network_idle>NETWORK_IDLE/a>/code> value.li>p>Set the elements a href#delaying-the-load-event-flag idloading-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 idloading-the-media-resource:delay-the-load-event-10>delaying the load event/a>.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-17 data-x-internalconcept-event-fire>Fire an event/a> named code idloading-the-media-resource:event-media-error-2>a href#event-media-error>error/a>/code> at the a href#media-element idloading-the-media-resource:media-element-43>media element/a>.li>p>Abort the overall a href#concept-media-load-algorithm idloading-the-media-resource:concept-media-load-algorithm-4>resource selection algorithm/a>./ol> dt idfatal-decode-error>If the a href#media-data idloading-the-media-resource:media-data-12>media data/a> is corrupteddd> p>Fatal errors in decoding the a href#media-data idloading-the-media-resource:media-data-13>media data/a> that occur after the user agent has established whether the var>current media resource/var> is usable (i.e. once the a href#media-element idloading-the-media-resource:media-element-44>media element/a>s code idloading-the-media-resource:dom-media-readystate-6>a href#dom-media-readystate>readyState/a>/code> attribute is no longer code idloading-the-media-resource:dom-media-have_nothing-3>a href#dom-media-have_nothing>HAVE_NOTHING/a>/code>) must cause the user agent to execute the following steps:/p> ol>li>p>The user agent should cancel the fetching process.li>p>Set the code idloading-the-media-resource:dom-media-error-4>a href#dom-media-error>error/a>/code> attribute to the result of a href#creating-a-mediaerror idloading-the-media-resource:creating-a-mediaerror-3>creating a code>MediaError/code>/a> with code idloading-the-media-resource:dom-mediaerror-media_err_decode>a href#dom-mediaerror-media_err_decode>MEDIA_ERR_DECODE/a>/code>.li>p>Set the elements code idloading-the-media-resource:dom-media-networkstate-17>a href#dom-media-networkstate>networkState/a>/code> attribute to the code idloading-the-media-resource:dom-media-network_idle-7>a href#dom-media-network_idle>NETWORK_IDLE/a>/code> value.li>p>Set the elements a href#delaying-the-load-event-flag idloading-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 idloading-the-media-resource:delay-the-load-event-11>delaying the load event/a>.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-18 data-x-internalconcept-event-fire>Fire an event/a> named code idloading-the-media-resource:event-media-error-3>a href#event-media-error>error/a>/code> at the a href#media-element idloading-the-media-resource:media-element-45>media element/a>.li>p>Abort the overall a href#concept-media-load-algorithm idloading-the-media-resource:concept-media-load-algorithm-5>resource selection algorithm/a>./ol> dt>If the a href#media-data idloading-the-media-resource:media-data-14>media data/a> fetching process is aborted by the userdd> p>The fetching process is aborted by the user, e.g. because the user pressed a stop button, the user agent must execute the following steps. These steps are not followed if the code idloading-the-media-resource:dom-media-load-2>a href#dom-media-load>load()/a>/code> method itself is invoked while these steps are running, as the steps above handle that particular kind of abort./p> ol>li>p>The user agent should cancel the fetching process.li>p>Set the code idloading-the-media-resource:dom-media-error-5>a href#dom-media-error>error/a>/code> attribute to the result of a href#creating-a-mediaerror idloading-the-media-resource:creating-a-mediaerror-4>creating a code>MediaError/code>/a> with code idloading-the-media-resource:dom-mediaerror-media_err_aborted>a href#dom-mediaerror-media_err_aborted>MEDIA_ERR_ABORTED/a>/code>.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-19 data-x-internalconcept-event-fire>Fire an event/a> named code idloading-the-media-resource:event-media-abort-2>a href#event-media-abort>abort/a>/code> at the a href#media-element idloading-the-media-resource:media-element-46>media element/a>.li> p>If the a href#media-element idloading-the-media-resource:media-element-47>media element/a>s code idloading-the-media-resource:dom-media-readystate-7>a href#dom-media-readystate>readyState/a>/code> attribute has a value equal to code idloading-the-media-resource:dom-media-have_nothing-4>a href#dom-media-have_nothing>HAVE_NOTHING/a>/code>, set the elements code idloading-the-media-resource:dom-media-networkstate-18>a href#dom-media-networkstate>networkState/a>/code> attribute to the code idloading-the-media-resource:dom-media-network_empty-3>a href#dom-media-network_empty>NETWORK_EMPTY/a>/code> value, set the elements a href#show-poster-flag idloading-the-media-resource:show-poster-flag-4>show poster flag/a> to true, and a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idloading-the-media-resource:concept-event-fire-20 data-x-internalconcept-event-fire>fire an event/a> named code idloading-the-media-resource:event-media-emptied-2>a href#event-media-emptied>emptied/a>/code> at the element./p> p>Otherwise, set the elements code idloading-the-media-resource:dom-media-networkstate-19>a href#dom-media-networkstate>networkState/a>/code> attribute to the code idloading-the-media-resource:dom-media-network_idle-8>a href#dom-media-network_idle>NETWORK_IDLE/a>/code> value./p> li>p>Set the elements a href#delaying-the-load-event-flag idloading-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 idloading-the-media-resource:delay-the-load-event-12>delaying the load event/a>.li>p>Abort the overall a href#concept-media-load-algorithm idloading-the-media-resource:concept-media-load-algorithm-6>resource selection algorithm/a>./ol> dt idnon-fatal-media-error>If the a href#media-data idloading-the-media-resource:media-data-15>media data/a> can be fetched but has non-fatal errors or uses, in part, codecs that are unsupported, preventing the user agent from rendering the content completely correctly but not preventing playback altogetherdd> p>The server returning data that is partially usable but cannot be optimally rendered must cause the user agent to render just the bits it can handle, and ignore the rest./p> dt idfound-a-media-resource-specific-timed-track>If the a href#media-resource idloading-the-media-resource:media-resource-19>media resource/a> is found to declare a a href#media-resource-specific-text-track idloading-the-media-resource:media-resource-specific-text-track-2>media-resource-specific text track/a> that the user agent supportsdd> p>If the a href#media-data idloading-the-media-resource:media-data-16>media data/a> is a href#cors-same-origin idloading-the-media-resource:cors-same-origin-3>CORS-same-origin/a>, run the a href#steps-to-expose-a-media-resource-specific-text-track idloading-the-media-resource:steps-to-expose-a-media-resource-specific-text-track>steps to expose a media-resource-specific text track/a> with the relevant data./p> p classnote>Cross-origin videos do not expose their subtitles, since that would allow attacks such as hostile sites reading subtitles from confidential videos on a users intranet./p> /dl> li>p>i>Final step:/i> If the user agent ever reaches this step (which can only happen if the entire resource gets loaded and kept available): abort the overall a href#concept-media-load-algorithm idloading-the-media-resource:concept-media-load-algorithm-7>resource selection algorithm/a>./ol> p>When a a href#media-element idloading-the-media-resource:media-element-48>media element/a> is to dfn idforget-the-media-elements-media-resource-specific-tracks>forget the media elements media-resource-specific tracks/dfn>, the user agent must remove from the a href#media-element idloading-the-media-resource:media-element-49>media element/a>s a href#list-of-text-tracks idloading-the-media-resource:list-of-text-tracks>list of text tracks/a> all the a href#media-resource-specific-text-track idloading-the-media-resource:media-resource-specific-text-track-3>media-resource-specific text tracks/a>, then empty the a href#media-element idloading-the-media-resource:media-element-50>media element/a>s code idloading-the-media-resource:dom-media-audiotracks-2>a href#dom-media-audiotracks>audioTracks/a>/code> attributes code idloading-the-media-resource:audiotracklist-3>a href#audiotracklist>AudioTrackList/a>/code> object, then empty the a href#media-element idloading-the-media-resource:media-element-51>media element/a>s code idloading-the-media-resource:dom-media-videotracks-2>a href#dom-media-videotracks>videoTracks/a>/code> attributes code idloading-the-media-resource:videotracklist-3>a href#videotracklist>VideoTrackList/a>/code> object. No events (in particular, no code idloading-the-media-resource:event-media-removetrack>a href#event-media-removetrack>removetrack/a>/code> events) are fired as part of this; the code idloading-the-media-resource:event-media-error-4>a href#event-media-error>error/a>/code> and code idloading-the-media-resource:event-media-emptied-3>a href#event-media-emptied>emptied/a>/code> events, fired by the algorithms that invoke this one, can be used instead./p> hr> p>The dfn idattr-media-preload>code>preload/code>/dfn> attribute is an a href#enumerated-attribute idloading-the-media-resource:enumerated-attribute>enumerated attribute/a>. The following table lists the keywords and states for the attribute — the keywords in the left column map to the states in the cell in the second column on the same row as the keyword. The attribute can be changed even once the a href#media-resource idloading-the-media-resource:media-resource-20>media resource/a> is being buffered or played; the descriptions in the table below are to be interpreted with that in mind./p> table>thead>tr>th> Keyword th> State th> Brief description tbody>tr>td>dfn idattr-media-preload-none>code>none/code>/dfn> td>dfn idattr-media-preload-none-state>None/dfn> td>Hints to the user agent that either the author does not expect the user to need the media resource, or that the server wants to minimize unnecessary traffic. This state does not provide a hint regarding how aggressively to actually download the media resource if buffering starts anyway (e.g. once the user hits play). tr>td>dfn idattr-media-preload-metadata>code>metadata/code>/dfn> td>dfn idattr-media-preload-metadata-state>Metadata/dfn> td>Hints to the user agent that the author does not expect the user to need the media resource, but that fetching the resource metadata (dimensions, track list, duration, etc), and maybe even the first few frames, is reasonable. If the user agent precisely fetches no more than the metadata, then the a href#media-element idloading-the-media-resource:media-element-52>media element/a> will end up with its code idloading-the-media-resource:dom-media-readystate-8>a href#dom-media-readystate>readyState/a>/code> attribute set to code idloading-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 idloading-the-media-resource:dom-media-have_current_data-2>a href#dom-media-have_current_data>HAVE_CURRENT_DATA/a>/code> or code idloading-the-media-resource:dom-media-have_future_data>a href#dom-media-have_future_data>HAVE_FUTURE_DATA/a>/code>. When the media resource is playing, hints to the user agent that bandwidth is to be considered scarce, e.g. suggesting throttling the download so that the media data is obtained at the slowest possible rate that still maintains consistent playback. tr>td>dfn idattr-media-preload-auto>code>auto/code>/dfn> td>dfn idattr-media-preload-auto-state>Automatic/dfn> td>Hints to the user agent that the user agent can put the users needs first without risk to the server, up to and including optimistically downloading the entire resource. /table> p>The empty string is also a valid keyword, and maps to the a href#attr-media-preload-auto-state idloading-the-media-resource:attr-media-preload-auto-state>Automatic/a> state. The attributes i idloading-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 idloading-the-media-resource:attr-media-preload-metadata-state>Metadata/a> state is suggested as a compromise between reducing server load and providing an optimal user experience./p> p classnote>Authors might switch the attribute from code idloading-the-media-resource:attr-media-preload-none-2>a href#attr-media-preload-none>none/a>/code> or code idloading-the-media-resource:attr-media-preload-metadata>a href#attr-media-preload-metadata>metadata/a>/code> to code idloading-the-media-resource:attr-media-preload-auto>a href#attr-media-preload-auto>auto/a>/code> dynamically once the user begins playback. For example, on a page with many videos this might be used to indicate that the many videos are not to be downloaded unless requested, but that once one em>is/em> requested it is to be downloaded aggressively./p> p>The code idloading-the-media-resource:attr-media-preload-3>a href#attr-media-preload>preload/a>/code> attribute is intended to provide a hint to the user agent about what the author thinks will lead to the best user experience. The attribute may be ignored altogether, for example based on explicit user preferences or based on the available connectivity./p> p>The dfn iddom-media-preload>code>preload/code>/dfn> IDL attribute must a href#reflect idloading-the-media-resource:reflect>reflect/a> the content attribute of the same name, a href#limited-to-only-known-values idloading-the-media-resource:limited-to-only-known-values>limited to only known values/a>./p> p classnote>The code idloading-the-media-resource:attr-media-autoplay-2>a href#attr-media-autoplay>autoplay/a>/code> attribute can override the code idloading-the-media-resource:attr-media-preload-4>a href#attr-media-preload>preload/a>/code> attribute (since if the media plays, it naturally has to buffer first, regardless of the hint given by the code idloading-the-media-resource:attr-media-preload-5>a href#attr-media-preload>preload/a>/code> attribute). Including both is not an error, however./p> hr> dl classdomintro>dt>var>media/var> . code idloading-the-media-resource:dom-media-buffered>a href#dom-media-buffered>buffered/a>/code>dd> p>Returns a code idloading-the-media-resource:timeranges>a href#timeranges>TimeRanges/a>/code> object that represents the ranges of the a href#media-resource idloading-the-media-resource:media-resource-21>media resource/a> that the user agent has buffered./p> /dl> p>The dfn iddom-media-buffered>code>buffered/code>/dfn> attribute must return a new static a href#normalised-timeranges-object idloading-the-media-resource:normalised-timeranges-object>normalized code>TimeRanges/code> object/a> that represents the ranges of the a href#media-resource idloading-the-media-resource:media-resource-22>media resource/a>, if any, that the user agent has buffered, at the time the attribute is evaluated. Users agents must accurately determine the ranges available, even for media streams where this can only be determined by tedious inspection./p> p classnote>Typically this will be a single range anchored at the zero point, but if, e.g. the user agent uses HTTP range requests in response to seeking, then there could be multiple ranges./p> p>User agents may discard previously buffered data./p> p classnote>Thus, a time position included within a range of the objects return by the code idloading-the-media-resource:dom-media-buffered-2>a href#dom-media-buffered>buffered/a>/code> attribute at one time can end up being not included in the range(s) of objects returned by the same attribute at later times./p> p classwarning>Returning a new object each time is a bad pattern for attribute getters and is only enshrined here as it would be costly to change it. It is not to be copied to new APIs./p> h5 idoffsets-into-the-media-resource>span classsecno>4.8.12.6/span> Offsets into the media resourcea href#offsets-into-the-media-resource classself-link>/a>/h5> dl classdomintro>dt>var>media/var> . code idoffsets-into-the-media-resource:dom-media-duration>a href#dom-media-duration>duration/a>/code>dd> p>Returns the length of the a href#media-resource idoffsets-into-the-media-resource:media-resource>media resource/a>, in seconds, assuming that the start of the a href#media-resource idoffsets-into-the-media-resource:media-resource-2>media resource/a> is at time zero./p> p>Returns NaN if the duration isnt available./p> p>Returns Infinity for unbounded streams./p> dt>var>media/var> . code idoffsets-into-the-media-resource:dom-media-currenttime>a href#dom-media-currenttime>currentTime/a>/code> var>value/var> dd> p>Returns the a href#official-playback-position idoffsets-into-the-media-resource:official-playback-position>official playback position/a>, in seconds./p> p>Can be set, to seek to the given time./p> /dl> p>A a href#media-resource idoffsets-into-the-media-resource:media-resource-3>media resource/a> has a dfn idmedia-timeline>media timeline/dfn> that maps times (in seconds) to positions in the a href#media-resource idoffsets-into-the-media-resource:media-resource-4>media resource/a>. The origin of a timeline is its earliest defined position. The duration of a timeline is its last defined position./p> p>dfn iddefineTimeline>Establishing the media timeline/dfn>: if the a href#media-resource idoffsets-into-the-media-resource:media-resource-5>media resource/a> somehow specifies an explicit timeline whose origin is not negative (i.e. gives each frame a specific time offset and gives the first frame a zero or positive offset), then the a href#media-timeline idoffsets-into-the-media-resource:media-timeline>media timeline/a> should be that timeline. (Whether the a href#media-resource idoffsets-into-the-media-resource:media-resource-6>media resource/a> can specify a timeline or not depends on the a href#media-resource idoffsets-into-the-media-resource:media-resource-7>media resources/a> format.) If the a href#media-resource idoffsets-into-the-media-resource:media-resource-8>media resource/a> specifies an explicit start time em>and date/em>, then that time and date should be considered the zero point in the a href#media-timeline idoffsets-into-the-media-resource:media-timeline-2>media timeline/a>; the a href#timeline-offset idoffsets-into-the-media-resource:timeline-offset>timeline offset/a> will be the time and date, exposed using the code idoffsets-into-the-media-resource:dom-media-getstartdate>a href#dom-media-getstartdate>getStartDate()/a>/code> method./p> p>If the a href#media-resource idoffsets-into-the-media-resource:media-resource-9>media resource/a> has a discontinuous timeline, the user agent must extend the timeline used at the start of the resource across the entire resource, so that the a href#media-timeline idoffsets-into-the-media-resource:media-timeline-3>media timeline/a> of the a href#media-resource idoffsets-into-the-media-resource:media-resource-10>media resource/a> increases linearly starting from the a href#earliest-possible-position idoffsets-into-the-media-resource:earliest-possible-position>earliest possible position/a> (as defined below), even if the underlying a href#media-data idoffsets-into-the-media-resource:media-data>media data/a> has out-of-order or even overlapping time codes./p> p classexample>For example, if two clips have been concatenated into one video file, but the video format exposes the original times for the two clips, the video data might expose a timeline that goes, say, 00:15..00:29 and then 00:05..00:38. However, the user agent would not expose those times; it would instead expose the times as 00:15..00:29 and 00:29..01:02, as a single video./p> p>In the rare case of a a href#media-resource idoffsets-into-the-media-resource:media-resource-11>media resource/a> that does not have an explicit timeline, the zero time on the a href#media-timeline idoffsets-into-the-media-resource:media-timeline-4>media timeline/a> should correspond to the first frame of the a href#media-resource idoffsets-into-the-media-resource:media-resource-12>media resource/a>. In the even rarer case of a a href#media-resource idoffsets-into-the-media-resource:media-resource-13>media resource/a> with no explicit timings of any kind, not even frame durations, the user agent must itself determine the time for each frame in a user-agent-defined manner. a href#fingerprinting-vector idoffsets-into-the-media-resource:fingerprinting-vector classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> p classnote>An example of a file format with no explicit timeline but with explicit frame durations is the Animated GIF format. An example of a file format with no explicit timings at all is the JPEG-push format (code idoffsets-into-the-media-resource:multipart/x-mixed-replace>a href#multipart/x-mixed-replace>multipart/x-mixed-replace/a>/code> with JPEG frames, often used as the format for MJPEG streams)./p> p>If, in the case of a resource with no timing information, the user agent will nonetheless be able to seek to an earlier point than the first frame originally provided by the server, then the zero time should correspond to the earliest seekable time of the a href#media-resource idoffsets-into-the-media-resource:media-resource-14>media resource/a>; otherwise, it should correspond to the first frame received from the server (the point in the a href#media-resource idoffsets-into-the-media-resource:media-resource-15>media resource/a> at which the user agent began receiving the stream)./p> p classnote>At the time of writing, there is no known format that lacks explicit frame time offsets yet still supports seeking to a frame before the first frame sent by the server./p> div classexample> p>Consider a stream from a TV broadcaster, which begins streaming on a sunny Friday afternoon in October, and always sends connecting user agents the media data on the same media timeline, with its zero time set to the start of this stream. Months later, user agents connecting to this stream will find that the first frame they receive has a time with millions of seconds. The code idoffsets-into-the-media-resource:dom-media-getstartdate-2>a href#dom-media-getstartdate>getStartDate()/a>/code> method would always return the date that the broadcast started; this would allow controllers to display real times in their scrubber (e.g. 2:30pm) rather than a time relative to when the broadcast began (8 months, 4 hours, 12 minutes, and 23 seconds)./p> p>Consider a stream that carries a video with several concatenated fragments, broadcast by a server that does not allow user agents to request specific times but instead just streams the video data in a predetermined order, with the first frame delivered always being identified as the frame with time zero. If a user agent connects to this stream and receives fragments defined as covering timestamps 2010-03-20 23:15:00 UTC to 2010-03-21 00:05:00 UTC and 2010-02-12 14:25:00 UTC to 2010-02-12 14:35:00 UTC, it would expose this with a a href#media-timeline idoffsets-into-the-media-resource:media-timeline-5>media timeline/a> starting at 0s and extending to 3,600s (one hour). Assuming the streaming server disconnected at the end of the second clip, the code idoffsets-into-the-media-resource:dom-media-duration-2>a href#dom-media-duration>duration/a>/code> attribute would then return 3,600. The code idoffsets-into-the-media-resource:dom-media-getstartdate-3>a href#dom-media-getstartdate>getStartDate()/a>/code> method would return a code idoffsets-into-the-media-resource:date>a data-x-internaldate hrefhttps://tc39.github.io/ecma262/#sec-date-objects>Date/a>/code> object with a time corresponding to 2010-03-20 23:15:00 UTC. However, if a different user agent connected five minutes later, em>it/em> would (presumably) receive fragments covering timestamps 2010-03-20 23:20:00 UTC to 2010-03-21 00:05:00 UTC and 2010-02-12 14:25:00 UTC to 2010-02-12 14:35:00 UTC, and would expose this with a a href#media-timeline idoffsets-into-the-media-resource:media-timeline-6>media timeline/a> starting at 0s and extending to 3,300s (fifty five minutes). In this case, the code idoffsets-into-the-media-resource:dom-media-getstartdate-4>a href#dom-media-getstartdate>getStartDate()/a>/code> method would return a code idoffsets-into-the-media-resource:date-2>a data-x-internaldate hrefhttps://tc39.github.io/ecma262/#sec-date-objects>Date/a>/code> object with a time corresponding to 2010-03-20 23:20:00 UTC./p> p>In both of these examples, the code idoffsets-into-the-media-resource:dom-media-seekable>a href#dom-media-seekable>seekable/a>/code> attribute would give the ranges that the controller would want to actually display in its UI; typically, if the servers dont support seeking to arbitrary times, this would be the range of time from the moment the user agent connected to the stream up to the latest frame that the user agent has obtained; however, if the user agent starts discarding earlier information, the actual range might be shorter./p> /div> p>In any case, the user agent must ensure that the a href#earliest-possible-position idoffsets-into-the-media-resource:earliest-possible-position-2>earliest possible position/a> (as defined below) using the established a href#media-timeline idoffsets-into-the-media-resource:media-timeline-7>media timeline/a>, is greater than or equal to zero./p> p>The a href#media-timeline idoffsets-into-the-media-resource:media-timeline-8>media timeline/a> also has an associated clock. Which clock is used is user-agent defined, and may be a href#media-resource idoffsets-into-the-media-resource:media-resource-16>media resource/a>-dependent, but it should approximate the users wall clock./p> p>a href#media-element idoffsets-into-the-media-resource:media-element>Media elements/a> have a dfn idcurrent-playback-position>current playback position/dfn>, which must initially (i.e. in the absence of a href#media-data idoffsets-into-the-media-resource:media-data-2>media data/a>) be zero seconds. The a href#current-playback-position idoffsets-into-the-media-resource:current-playback-position>current playback position/a> is a time on the a href#media-timeline idoffsets-into-the-media-resource:media-timeline-9>media timeline/a>./p> p>a href#media-element idoffsets-into-the-media-resource:media-element-2>Media elements/a> also have an dfn idofficial-playback-position>official playback position/dfn>, which must initially be set to zero seconds. The a href#official-playback-position idoffsets-into-the-media-resource:official-playback-position-2>official playback position/a> is an approximation of the a href#current-playback-position idoffsets-into-the-media-resource:current-playback-position-2>current playback position/a> that is kept stable while scripts are running./p> p>a href#media-element idoffsets-into-the-media-resource:media-element-3>Media elements/a> also have a dfn iddefault-playback-start-position>default playback start position/dfn>, which must initially be set to zero seconds. This time is used to allow the element to be seeked even before the media is loaded./p> p>Each a href#media-element idoffsets-into-the-media-resource:media-element-4>media element/a> has a dfn idshow-poster-flag>show poster flag/dfn>. When a a href#media-element idoffsets-into-the-media-resource:media-element-5>media element/a> is created, this flag must be set to true. This flag is used to control when the user agent is to show a poster frame for a code idoffsets-into-the-media-resource:the-video-element>a href#the-video-element>video/a>/code> element instead of showing the video contents./p> p>The dfn iddom-media-currenttime>code>currentTime/code>/dfn> attribute must, on getting, return the a href#media-element idoffsets-into-the-media-resource:media-element-6>media element/a>s a href#default-playback-start-position idoffsets-into-the-media-resource:default-playback-start-position>default playback start position/a>, unless that is zero, in which case it must return the elements a href#official-playback-position idoffsets-into-the-media-resource:official-playback-position-3>official playback position/a>. The returned value must be expressed in seconds. On setting, if the a href#media-element idoffsets-into-the-media-resource:media-element-7>media element/a>s code idoffsets-into-the-media-resource:dom-media-readystate>a href#dom-media-readystate>readyState/a>/code> is code idoffsets-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 idoffsets-into-the-media-resource:media-element-8>media element/a>s a href#default-playback-start-position idoffsets-into-the-media-resource:default-playback-start-position-2>default playback start position/a> to the new value; otherwise, it must set the a href#official-playback-position idoffsets-into-the-media-resource:official-playback-position-4>official playback position/a> to the new value and then a href#dom-media-seek idoffsets-into-the-media-resource:dom-media-seek>seek/a> to the new value. The new value must be interpreted as being in seconds./p> p>If the a href#media-resource idoffsets-into-the-media-resource:media-resource-17>media resource/a> is a streaming resource, then the user agent might be unable to obtain certain parts of the resource after it has expired from its buffer. Similarly, some a href#media-resource idoffsets-into-the-media-resource:media-resource-18>media resources/a> might have a a href#media-timeline idoffsets-into-the-media-resource:media-timeline-10>media timeline/a> that doesnt start at zero. The dfn idearliest-possible-position>earliest possible position/dfn> is the earliest position in the stream or resource that the user agent can ever obtain again. It is also a time on the a href#media-timeline idoffsets-into-the-media-resource:media-timeline-11>media timeline/a>./p> p classnote>The a href#earliest-possible-position idoffsets-into-the-media-resource:earliest-possible-position-3>earliest possible position/a> is not explicitly exposed in the API; it corresponds to the start time of the first range in the code idoffsets-into-the-media-resource:dom-media-seekable-2>a href#dom-media-seekable>seekable/a>/code> attributes code idoffsets-into-the-media-resource:timeranges>a href#timeranges>TimeRanges/a>/code> object, if any, or the a href#current-playback-position idoffsets-into-the-media-resource:current-playback-position-3>current playback position/a> otherwise./p> p>When the a href#earliest-possible-position idoffsets-into-the-media-resource:earliest-possible-position-4>earliest possible position/a> changes, then: if the a href#current-playback-position idoffsets-into-the-media-resource:current-playback-position-4>current playback position/a> is before the a href#earliest-possible-position idoffsets-into-the-media-resource:earliest-possible-position-5>earliest possible position/a>, the user agent must a href#dom-media-seek idoffsets-into-the-media-resource:dom-media-seek-2>seek/a> to the a href#earliest-possible-position idoffsets-into-the-media-resource:earliest-possible-position-6>earliest possible position/a>; otherwise, if the user agent has not fired a code idoffsets-into-the-media-resource:event-media-timeupdate>a href#event-media-timeupdate>timeupdate/a>/code> event at the element in the past 15 to 250ms and is not still running event handlers for such an event, then the user agent must a href#queue-a-task idoffsets-into-the-media-resource:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idoffsets-into-the-media-resource:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idoffsets-into-the-media-resource:event-media-timeupdate-2>a href#event-media-timeupdate>timeupdate/a>/code> at the element./p> p classnote>Because of the above requirement and the requirement in the a href#concept-media-load-resource idoffsets-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 idoffsets-into-the-media-resource:current-playback-position-5>current playback position/a> can never be less than the a href#earliest-possible-position idoffsets-into-the-media-resource:earliest-possible-position-7>earliest possible position/a>./p> p>If at any time the user agent learns that an audio or video track has ended and all a href#media-data idoffsets-into-the-media-resource:media-data-3>media data/a> relating to that track corresponds to parts of the a href#media-timeline idoffsets-into-the-media-resource:media-timeline-12>media timeline/a> that are em>before/em> the a href#earliest-possible-position idoffsets-into-the-media-resource:earliest-possible-position-8>earliest possible position/a>, the user agent may a href#queue-a-task idoffsets-into-the-media-resource:queue-a-task-2>queue a task/a> to run these steps:/p> ol>li>p>Remove the track from the code idoffsets-into-the-media-resource:dom-media-audiotracks>a href#dom-media-audiotracks>audioTracks/a>/code> attributes code idoffsets-into-the-media-resource:audiotracklist>a href#audiotracklist>AudioTrackList/a>/code> object or the code idoffsets-into-the-media-resource:dom-media-videotracks>a href#dom-media-videotracks>videoTracks/a>/code> attributes code idoffsets-into-the-media-resource:videotracklist>a href#videotracklist>VideoTrackList/a>/code> object as appropriate.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idoffsets-into-the-media-resource:concept-event-fire-2 data-x-internalconcept-event-fire>Fire an event/a> named code idoffsets-into-the-media-resource:event-media-removetrack>a href#event-media-removetrack>removetrack/a>/code> at the a href#media-element idoffsets-into-the-media-resource:media-element-9>media element/a>s aforementioned code idoffsets-into-the-media-resource:audiotracklist-2>a href#audiotracklist>AudioTrackList/a>/code> or code idoffsets-into-the-media-resource:videotracklist-2>a href#videotracklist>VideoTrackList/a>/code> object, using code idoffsets-into-the-media-resource:trackevent>a href#trackevent>TrackEvent/a>/code>, with the code idoffsets-into-the-media-resource:dom-trackevent-track>a href#dom-trackevent-track>track/a>/code> attribute initialized to the code idoffsets-into-the-media-resource:audiotrack>a href#audiotrack>AudioTrack/a>/code> or code idoffsets-into-the-media-resource:videotrack>a href#videotrack>VideoTrack/a>/code> object representing the track./ol> p>The dfn iddom-media-duration>code>duration/code>/dfn> attribute must return the time of the end of the a href#media-resource idoffsets-into-the-media-resource:media-resource-19>media resource/a>, in seconds, on the a href#media-timeline idoffsets-into-the-media-resource:media-timeline-13>media timeline/a>. If no a href#media-data idoffsets-into-the-media-resource:media-data-4>media data/a> is available, then the attributes must return the Not-a-Number (NaN) value. If the a href#media-resource idoffsets-into-the-media-resource:media-resource-20>media resource/a> is not known to be bounded (e.g. streaming radio, or a live event with no announced end time), then the attribute must return the positive Infinity value./p> p>The user agent must determine the duration of the a href#media-resource idoffsets-into-the-media-resource:media-resource-21>media resource/a> before playing any part of the a href#media-data idoffsets-into-the-media-resource:media-data-5>media data/a> and before setting code idoffsets-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 idoffsets-into-the-media-resource:dom-media-have_metadata>a href#dom-media-have_metadata>HAVE_METADATA/a>/code>, even if doing so requires fetching multiple parts of the resource./p> p iddurationChange>When the length of the a href#media-resource idoffsets-into-the-media-resource:media-resource-22>media resource/a> changes to a known value (e.g. from being unknown to known, or from a previously established length to a new length) the user agent must a href#queue-a-task idoffsets-into-the-media-resource:queue-a-task-3>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idoffsets-into-the-media-resource:concept-event-fire-3 data-x-internalconcept-event-fire>fire an event/a> named code idoffsets-into-the-media-resource:event-media-durationchange>a href#event-media-durationchange>durationchange/a>/code> at the a href#media-element idoffsets-into-the-media-resource:media-element-10>media element/a>. (The event is not fired when the duration is reset as part of loading a new media resource.) If the duration is changed such that the a href#current-playback-position idoffsets-into-the-media-resource:current-playback-position-6>current playback position/a> ends up being greater than the time of the end of the a href#media-resource idoffsets-into-the-media-resource:media-resource-23>media resource/a>, then the user agent must also a href#dom-media-seek idoffsets-into-the-media-resource:dom-media-seek-3>seek/a> to the time of the end of the a href#media-resource idoffsets-into-the-media-resource:media-resource-24>media resource/a>./p> p classexample>If an infinite stream ends for some reason, then the duration would change from positive Infinity to the time of the last frame or sample in the stream, and the code idoffsets-into-the-media-resource:event-media-durationchange-2>a href#event-media-durationchange>durationchange/a>/code> event would be fired. Similarly, if the user agent initially estimated the a href#media-resource idoffsets-into-the-media-resource:media-resource-25>media resource/a>s duration instead of determining it precisely, and later revises the estimate based on new information, then the duration would change and the code idoffsets-into-the-media-resource:event-media-durationchange-3>a href#event-media-durationchange>durationchange/a>/code> event would be fired./p> p>Some video files also have an explicit date and time corresponding to the zero time in the a href#media-timeline idoffsets-into-the-media-resource:media-timeline-14>media timeline/a>, known as the dfn idtimeline-offset>timeline offset/dfn>. Initially, the a href#timeline-offset idoffsets-into-the-media-resource:timeline-offset-2>timeline offset/a> must be set to Not-a-Number (NaN)./p> p>The dfn iddom-media-getstartdate>code>getStartDate()/code>/dfn> method must return a href#create-a-date-object idoffsets-into-the-media-resource:create-a-date-object>a new code>Date/code> object/a> representing the current a href#timeline-offset idoffsets-into-the-media-resource:timeline-offset-3>timeline offset/a>./p> hr> p>The dfn idattr-media-loop>code>loop/code>/dfn> attribute is a a href#boolean-attribute idoffsets-into-the-media-resource:boolean-attribute>boolean attribute/a> that, if specified, indicates that the a href#media-element idoffsets-into-the-media-resource:media-element-11>media element/a> is to seek back to the start of the a href#media-resource idoffsets-into-the-media-resource:media-resource-26>media resource/a> upon reaching the end./p> p>The dfn iddom-media-loop>code>loop/code>/dfn> IDL attribute must a href#reflect idoffsets-into-the-media-resource:reflect>reflect/a> the content attribute of the same name./p> h5 idready-states>span classsecno>4.8.12.7/span> Ready statesa href#ready-states classself-link>/a>/h5> dl classdomintro>dt>var>media/var> . code idready-states:dom-media-readystate>a href#dom-media-readystate>readyState/a>/code>dd> p>Returns a value that expresses the current state of the element with respect to rendering the a href#current-playback-position idready-states:current-playback-position>current playback position/a>, from the codes in the list below./p> /dl> p>a href#media-element idready-states:media-element>Media elements/a> have a i>ready state/i>, which describes to what degree they are ready to be rendered at the a href#current-playback-position idready-states:current-playback-position-2>current playback position/a>. The possible values are as follows; the ready state of a media element at any particular time is the greatest value describing the state of the element:/p> dl>dt>dfn iddom-media-have_nothing>code>HAVE_NOTHING/code>/dfn> (numeric value 0)dd>p>No information regarding the a href#media-resource idready-states:media-resource>media resource/a> is available. No data for the a href#current-playback-position idready-states:current-playback-position-3>current playback position/a> is available. a href#media-element idready-states:media-element-2>Media elements/a> whose code idready-states:dom-media-networkstate>a href#dom-media-networkstate>networkState/a>/code> attribute are set to code idready-states:dom-media-network_empty>a href#dom-media-network_empty>NETWORK_EMPTY/a>/code> are always in the code idready-states:dom-media-have_nothing>a href#dom-media-have_nothing>HAVE_NOTHING/a>/code> state.dt>dfn iddom-media-have_metadata>code>HAVE_METADATA/code>/dfn> (numeric value 1)dd>p>Enough of the resource has been obtained that the duration of the resource is available. In the case of a code idready-states:the-video-element>a href#the-video-element>video/a>/code> element, the dimensions of the video are also available. No a href#media-data idready-states:media-data>media data/a> is available for the immediate a href#current-playback-position idready-states:current-playback-position-4>current playback position/a>.dt>dfn iddom-media-have_current_data>code>HAVE_CURRENT_DATA/code>/dfn> (numeric value 2)dd>p>Data for the immediate a href#current-playback-position idready-states:current-playback-position-5>current playback position/a> is available, but either not enough data is available that the user agent could successfully advance the a href#current-playback-position idready-states:current-playback-position-6>current playback position/a> in the a href#direction-of-playback idready-states:direction-of-playback>direction of playback/a> at all without immediately reverting to the code idready-states:dom-media-have_metadata>a href#dom-media-have_metadata>HAVE_METADATA/a>/code> state, or there is no more data to obtain in the a href#direction-of-playback idready-states:direction-of-playback-2>direction of playback/a>. For example, in video this corresponds to the user agent having data from the current frame, but not the next frame, when the a href#current-playback-position idready-states:current-playback-position-7>current playback position/a> is at the end of the current frame; and to when a href#ended-playback idready-states:ended-playback>playback has ended/a>.dt>dfn iddom-media-have_future_data>code>HAVE_FUTURE_DATA/code>/dfn> (numeric value 3)dd>p>Data for the immediate a href#current-playback-position idready-states:current-playback-position-8>current playback position/a> is available, as well as enough data for the user agent to advance the a href#current-playback-position idready-states:current-playback-position-9>current playback position/a> in the a href#direction-of-playback idready-states:direction-of-playback-3>direction of playback/a> at least a little without immediately reverting to the code idready-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 idready-states:the-text-tracks-are-ready>the text tracks are ready/a>. For example, in video this corresponds to the user agent having data for at least the current frame and the next frame when the a href#current-playback-position idready-states:current-playback-position-10>current playback position/a> is at the instant in time between the two frames, or to the user agent having the video data for the current frame and audio data to keep playing at least a little when the a href#current-playback-position idready-states:current-playback-position-11>current playback position/a> is in the middle of a frame. The user agent cannot be in this state if a href#ended-playback idready-states:ended-playback-2>playback has ended/a>, as the a href#current-playback-position idready-states:current-playback-position-12>current playback position/a> can never advance in this case.dt>dfn iddom-media-have_enough_data>code>HAVE_ENOUGH_DATA/code>/dfn> (numeric value 4)dd> p>All the conditions described for the code idready-states:dom-media-have_future_data>a href#dom-media-have_future_data>HAVE_FUTURE_DATA/a>/code> state are met, and, in addition, either of the following conditions is also true:/p> ul>li>The user agent estimates that data is being fetched at a rate where the a href#current-playback-position idready-states:current-playback-position-13>current playback position/a>, if it were to advance at the elements code idready-states:dom-media-playbackrate>a href#dom-media-playbackrate>playbackRate/a>/code>, would not overtake the available data before playback reaches the end of the a href#media-resource idready-states:media-resource-2>media resource/a>.li>The user agent has entered a state where waiting longer will not result in further data being obtained, and therefore nothing would be gained by delaying playback any further. (For example, the buffer might be full.)/ul> /dl> p classnote>In practice, the difference between code idready-states:dom-media-have_metadata-3>a href#dom-media-have_metadata>HAVE_METADATA/a>/code> and code idready-states:dom-media-have_current_data>a href#dom-media-have_current_data>HAVE_CURRENT_DATA/a>/code> is negligible. Really the only time the difference is relevant is when painting a code idready-states:the-video-element-2>a href#the-video-element>video/a>/code> element onto a code idready-states:the-canvas-element>a href#the-canvas-element>canvas/a>/code>, where it distinguishes the case where something will be drawn (code idready-states:dom-media-have_current_data-2>a href#dom-media-have_current_data>HAVE_CURRENT_DATA/a>/code> or greater) from the case where nothing is drawn (code idready-states:dom-media-have_metadata-4>a href#dom-media-have_metadata>HAVE_METADATA/a>/code> or less). Similarly, the difference between code idready-states:dom-media-have_current_data-3>a href#dom-media-have_current_data>HAVE_CURRENT_DATA/a>/code> (only the current frame) and code idready-states:dom-media-have_future_data-2>a href#dom-media-have_future_data>HAVE_FUTURE_DATA/a>/code> (at least this frame and the next) can be negligible (in the extreme, only one frame). The only time that distinction really matters is when a page provides an interface for frame-by-frame navigation./p> p>When the ready state of a a href#media-element idready-states:media-element-3>media element/a> whose code idready-states:dom-media-networkstate-2>a href#dom-media-networkstate>networkState/a>/code> is not code idready-states:dom-media-network_empty-2>a href#dom-media-network_empty>NETWORK_EMPTY/a>/code> changes, the user agent must follow the steps given below:/p> ol>li> p>Apply the first applicable set of substeps from the following list:/p> dl classswitch>dt>If the previous ready state was code idready-states:dom-media-have_nothing-2>a href#dom-media-have_nothing>HAVE_NOTHING/a>/code>, and the new ready state is code idready-states:dom-media-have_metadata-5>a href#dom-media-have_metadata>HAVE_METADATA/a>/code>dd idfire-loadedmetadata> p>a href#queue-a-task idready-states:queue-a-task>Queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idready-states:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idready-states:event-media-loadedmetadata>a href#event-media-loadedmetadata>loadedmetadata/a>/code> at the element./p> p classnote>Before this task is run, as part of the a href#event-loop idready-states:event-loop>event loop/a> mechanism, the rendering will have been updated to resize the code idready-states:the-video-element-3>a href#the-video-element>video/a>/code> element if appropriate./p> dt idhandling-first-frame-available>If the previous ready state was code idready-states:dom-media-have_metadata-6>a href#dom-media-have_metadata>HAVE_METADATA/a>/code> and the new ready state is code idready-states:dom-media-have_current_data-4>a href#dom-media-have_current_data>HAVE_CURRENT_DATA/a>/code> or greaterdd> p idfire-loadeddata>If this is the first time this occurs for this a href#media-element idready-states:media-element-4>media element/a> since the code idready-states:dom-media-load>a href#dom-media-load>load()/a>/code> algorithm was last invoked, the user agent must a href#queue-a-task idready-states:queue-a-task-2>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idready-states:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idready-states:event-media-loadeddata>a href#event-media-loadeddata>loadeddata/a>/code> at the element./p> p>If the new ready state is code idready-states:dom-media-have_future_data-3>a href#dom-media-have_future_data>HAVE_FUTURE_DATA/a>/code> or code idready-states:dom-media-have_enough_data>a href#dom-media-have_enough_data>HAVE_ENOUGH_DATA/a>/code>, then the relevant steps below must then be run also./p> dt>If the previous ready state was code idready-states:dom-media-have_future_data-4>a href#dom-media-have_future_data>HAVE_FUTURE_DATA/a>/code> or more, and the new ready state is code idready-states:dom-media-have_current_data-5>a href#dom-media-have_current_data>HAVE_CURRENT_DATA/a>/code> or lessdd> p idfire-waiting-when-waiting>If the a href#media-element idready-states:media-element-5>media element/a> was a href#potentially-playing idready-states:potentially-playing>potentially playing/a> before its code idready-states:dom-media-readystate-2>a href#dom-media-readystate>readyState/a>/code> attribute changed to a value lower than code idready-states:dom-media-have_future_data-5>a href#dom-media-have_future_data>HAVE_FUTURE_DATA/a>/code>, and the element has not a href#ended-playback idready-states:ended-playback-3>ended playback/a>, and playback has not a href#stopped-due-to-errors idready-states:stopped-due-to-errors>stopped due to errors/a>, a href#paused-for-user-interaction idready-states:paused-for-user-interaction>paused for user interaction/a>, or a href#paused-for-in-band-content idready-states:paused-for-in-band-content>paused for in-band content/a>, the user agent must a href#queue-a-task idready-states:queue-a-task-3>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idready-states:concept-event-fire-3 data-x-internalconcept-event-fire>fire an event/a> named code idready-states:event-media-timeupdate>a href#event-media-timeupdate>timeupdate/a>/code> at the element, and a href#queue-a-task idready-states:queue-a-task-4>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idready-states:concept-event-fire-4 data-x-internalconcept-event-fire>fire an event/a> named code idready-states:event-media-waiting>a href#event-media-waiting>waiting/a>/code> at the element./p> dt>If the previous ready state was code idready-states:dom-media-have_current_data-6>a href#dom-media-have_current_data>HAVE_CURRENT_DATA/a>/code> or less, and the new ready state is code idready-states:dom-media-have_future_data-6>a href#dom-media-have_future_data>HAVE_FUTURE_DATA/a>/code>dd> p>The user agent must a href#queue-a-task idready-states:queue-a-task-5>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idready-states:concept-event-fire-5 data-x-internalconcept-event-fire>fire an event/a> named code idready-states:event-media-canplay>a href#event-media-canplay>canplay/a>/code> at the element./p> p>If the elements code idready-states:dom-media-paused>a href#dom-media-paused>paused/a>/code> attribute is false, the user agent must a href#notify-about-playing idready-states:notify-about-playing>notify about playing/a> for the element./p> dt>If the new ready state is code idready-states:dom-media-have_enough_data-2>a href#dom-media-have_enough_data>HAVE_ENOUGH_DATA/a>/code>dd> p>If the previous ready state was code idready-states:dom-media-have_current_data-7>a href#dom-media-have_current_data>HAVE_CURRENT_DATA/a>/code> or less, the user agent must a href#queue-a-task idready-states:queue-a-task-6>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idready-states:concept-event-fire-6 data-x-internalconcept-event-fire>fire an event/a> named code idready-states:event-media-canplay-2>a href#event-media-canplay>canplay/a>/code> at the element, and, if the elements code idready-states:dom-media-paused-2>a href#dom-media-paused>paused/a>/code> attribute is false, a href#notify-about-playing idready-states:notify-about-playing-2>notify about playing/a> for the element./p> p>The user agent must a href#queue-a-task idready-states:queue-a-task-7>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idready-states:concept-event-fire-7 data-x-internalconcept-event-fire>fire an event/a> named code idready-states:event-media-canplaythrough>a href#event-media-canplaythrough>canplaythrough/a>/code> at the element./p> p>If the element is not a href#eligible-for-autoplay idready-states:eligible-for-autoplay>eligible for autoplay/a>, then the user agent must abort these substeps./p> p>The user agent may run the following substeps:/p> p classnote>This specification doesnt define the precise timing for when the intersection is tested, but it is suggested that the timing match that of the Intersection Observer API. a href#refsINTERSECTIONOBSERVER>INTERSECTIONOBSERVER/a>/p> ol>li>Set the code idready-states:dom-media-paused-3>a href#dom-media-paused>paused/a>/code> attribute to false.li>If the elements a href#show-poster-flag idready-states:show-poster-flag>show poster flag/a> is true, set it to false and run the i idready-states:time-marches-on>a href#time-marches-on>time marches on/a>/i> steps.li>a href#queue-a-task idready-states:queue-a-task-8>Queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idready-states:concept-event-fire-8 data-x-internalconcept-event-fire>fire an event/a> named code idready-states:event-media-play>a href#event-media-play>play/a>/code> at the element.li>a href#notify-about-playing idready-states:notify-about-playing-3>Notify about playing/a> for the element./ol> p>Alternatively, if the element is a code idready-states:the-video-element-4>a href#the-video-element>video/a>/code> element, the user agent may start observing whether the element a href#intersect-the-viewport idready-states:intersect-the-viewport>intersects the viewport/a>. When the element starts a href#intersect-the-viewport idready-states:intersect-the-viewport-2>intersecting the viewport/a>, if the element is still a href#eligible-for-autoplay idready-states:eligible-for-autoplay-2>eligible for autoplay/a>, run the substeps above. Optionally, when the element stops a href#intersect-the-viewport idready-states:intersect-the-viewport-3>intersecting the viewport/a>, if the a href#can-autoplay-flag idready-states:can-autoplay-flag>can autoplay flag/a> is still true and the code idready-states:attr-media-autoplay>a href#attr-media-autoplay>autoplay/a>/code> attribute is still specified, run the following substeps:/p> p classnote>This specification doesnt define the precise timing for when the intersection is tested, but it is suggested that the timing match that of the Intersection Observer API. a href#refsINTERSECTIONOBSERVER>INTERSECTIONOBSERVER/a>/p> ol>li>Run the a href#internal-pause-steps idready-states:internal-pause-steps>internal pause steps/a> and set the a href#can-autoplay-flag idready-states:can-autoplay-flag-2>can autoplay flag/a> to true.li>a href#queue-a-task idready-states:queue-a-task-9>Queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idready-states:concept-event-fire-9 data-x-internalconcept-event-fire>fire an event/a> named code idready-states:event-media-pause>a href#event-media-pause>pause/a>/code> at the element./ol> p classnote>The substeps for playing and pausing can run multiple times as the element starts or stops a href#intersect-the-viewport idready-states:intersect-the-viewport-4>intersecting the viewport/a>, as long as the a href#can-autoplay-flag idready-states:can-autoplay-flag-3>can autoplay flag/a> is true./p> p classnote>User agents do not need to support autoplay, and it is suggested that user agents honor user preferences on the matter. Authors are urged to use the code idready-states:attr-media-autoplay-2>a href#attr-media-autoplay>autoplay/a>/code> attribute rather than using script to force the video to play, so as to allow the user to override the behavior if so desired./p> /dl> /ol> p classnote>It is possible for the ready state of a media element to jump between these states discontinuously. For example, the state of a media element can jump straight from code idready-states:dom-media-have_metadata-7>a href#dom-media-have_metadata>HAVE_METADATA/a>/code> to code idready-states:dom-media-have_enough_data-3>a href#dom-media-have_enough_data>HAVE_ENOUGH_DATA/a>/code> without passing through the code idready-states:dom-media-have_current_data-8>a href#dom-media-have_current_data>HAVE_CURRENT_DATA/a>/code> and code idready-states:dom-media-have_future_data-7>a href#dom-media-have_future_data>HAVE_FUTURE_DATA/a>/code> states./p> p>The dfn iddom-media-readystate>code>readyState/code>/dfn> IDL attribute must, on getting, return the value described above that describes the current ready state of the a href#media-element idready-states:media-element-6>media element/a>./p> p>The dfn idattr-media-autoplay>code>autoplay/code>/dfn> attribute is a a href#boolean-attribute idready-states:boolean-attribute>boolean attribute/a>. When present, the user agent (as described in the algorithm described herein) will automatically begin playback of the a href#media-resource idready-states:media-resource-3>media resource/a> as soon as it can do so without stopping./p> p classnote>Authors are urged to use the code idready-states:attr-media-autoplay-3>a href#attr-media-autoplay>autoplay/a>/code> attribute rather than using script to trigger automatic playback, as this allows the user to override the automatic playback when it is not desired, e.g. when using a screen reader. Authors are also encouraged to consider not using the automatic playback behavior at all, and instead to let the user agent wait for the user to start playback explicitly./p> p>The dfn iddom-media-autoplay>code>autoplay/code>/dfn> IDL attribute must a href#reflect idready-states:reflect>reflect/a> the content attribute of the same name./p> h5 idplaying-the-media-resource>span classsecno>4.8.12.8/span> Playing the media resourcea href#playing-the-media-resource classself-link>/a>/h5>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id28032 titleDefinition of "ended playback" prevents looping when loop attribute is added after playback has ended>28032/a>/div> dl classdomintro>dt>var>media/var> . code idplaying-the-media-resource:dom-media-paused>a href#dom-media-paused>paused/a>/code>dd> p>Returns true if playback is paused; false otherwise./p> dt>var>media/var> . code idplaying-the-media-resource:dom-media-ended>a href#dom-media-ended>ended/a>/code>dd> p>Returns true if playback has reached the end of the a href#media-resource idplaying-the-media-resource:media-resource>media resource/a>./p> dt>var>media/var> . code idplaying-the-media-resource:dom-media-defaultplaybackrate>a href#dom-media-defaultplaybackrate>defaultPlaybackRate/a>/code> var>value/var> dd> p>Returns the default rate of playback, for when the user is not fast-forwarding or reversing through the a href#media-resource idplaying-the-media-resource:media-resource-2>media resource/a>./p> p>Can be set, to change the default rate of playback./p> p>The default rate has no direct effect on playback, but if the user switches to a fast-forward mode, when they return to the normal playback mode, it is expected that the rate of playback will be returned to the default rate of playback./p> dt>var>media/var> . code idplaying-the-media-resource:dom-media-playbackrate>a href#dom-media-playbackrate>playbackRate/a>/code> var>value/var> dd> p>Returns the current rate playback, where 1.0 is normal speed./p> p>Can be set, to change the rate of playback./p> dt>var>media/var> . code idplaying-the-media-resource:dom-media-played>a href#dom-media-played>played/a>/code>dd> p>Returns a code idplaying-the-media-resource:timeranges>a href#timeranges>TimeRanges/a>/code> object that represents the ranges of the a href#media-resource idplaying-the-media-resource:media-resource-3>media resource/a> that the user agent has played./p> dt>var>media/var> . code idplaying-the-media-resource:dom-media-play>a href#dom-media-play>play/a>/code>()dd> p>Sets the code idplaying-the-media-resource:dom-media-paused-2>a href#dom-media-paused>paused/a>/code> attribute to false, loading the a href#media-resource idplaying-the-media-resource:media-resource-4>media resource/a> and beginning playback if necessary. If the playback had ended, will restart it from the start./p> dt>var>media/var> . code idplaying-the-media-resource:dom-media-pause>a href#dom-media-pause>pause/a>/code>()dd> p>Sets the code idplaying-the-media-resource:dom-media-paused-3>a href#dom-media-paused>paused/a>/code> attribute to true, loading the a href#media-resource idplaying-the-media-resource:media-resource-5>media resource/a> if necessary./p> /dl> p>The dfn iddom-media-paused>code>paused/code>/dfn> attribute represents whether the a href#media-element idplaying-the-media-resource:media-element>media element/a> is paused or not. The attribute must initially be true./p> p>A a href#media-element idplaying-the-media-resource:media-element-2>media element/a> is a dfn idblocked-media-element>blocked media element/dfn> if its code idplaying-the-media-resource:dom-media-readystate>a href#dom-media-readystate>readyState/a>/code> attribute is in the code idplaying-the-media-resource:dom-media-have_nothing>a href#dom-media-have_nothing>HAVE_NOTHING/a>/code> state, the code idplaying-the-media-resource:dom-media-have_metadata>a href#dom-media-have_metadata>HAVE_METADATA/a>/code> state, or the code idplaying-the-media-resource:dom-media-have_current_data>a href#dom-media-have_current_data>HAVE_CURRENT_DATA/a>/code> state, or if the element has a href#paused-for-user-interaction idplaying-the-media-resource:paused-for-user-interaction>paused for user interaction/a> or a href#paused-for-in-band-content idplaying-the-media-resource:paused-for-in-band-content>paused for in-band content/a>./p> p>A a href#media-element idplaying-the-media-resource:media-element-3>media element/a> is said to be dfn idpotentially-playing>potentially playing/dfn> when its code idplaying-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 idplaying-the-media-resource:ended-playback>ended playback/a>, playback has not a href#stopped-due-to-errors idplaying-the-media-resource:stopped-due-to-errors>stopped due to errors/a>, and the element is not a a href#blocked-media-element idplaying-the-media-resource:blocked-media-element>blocked media element/a>./p> p classnote>A code idplaying-the-media-resource:event-media-waiting>a href#event-media-waiting>waiting/a>/code> DOM event a href#fire-waiting-when-waiting>can be fired/a> as a result of an element that is a href#potentially-playing idplaying-the-media-resource:potentially-playing>potentially playing/a> stopping playback due to its code idplaying-the-media-resource:dom-media-readystate-2>a href#dom-media-readystate>readyState/a>/code> attribute changing to a value lower than code idplaying-the-media-resource:dom-media-have_future_data>a href#dom-media-have_future_data>HAVE_FUTURE_DATA/a>/code>./p> p>A a href#media-element idplaying-the-media-resource:media-element-4>media element/a> is said to be dfn ideligible-for-autoplay>eligible for autoplay/dfn> when its a href#can-autoplay-flag idplaying-the-media-resource:can-autoplay-flag>can autoplay flag/a> is true, its code idplaying-the-media-resource:dom-media-paused-5>a href#dom-media-paused>paused/a>/code> attribute is true, the element has an code idplaying-the-media-resource:attr-media-autoplay>a href#attr-media-autoplay>autoplay/a>/code> attribute specified, and the elements a idplaying-the-media-resource:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#active-sandboxing-flag-set idplaying-the-media-resource:active-sandboxing-flag-set>active sandboxing flag set/a> does not have the a href#sandboxed-automatic-features-browsing-context-flag idplaying-the-media-resource:sandboxed-automatic-features-browsing-context-flag>sandboxed automatic features browsing context flag/a> set./p> p>A a href#media-element idplaying-the-media-resource:media-element-5>media element/a> is said to be dfn idallowed-to-play>allowed to play/dfn> if the user agent and the system allow media playback in the current context./p> p classnote>For example, a user agent could require that playback is a href#triggered-by-user-activation idplaying-the-media-resource:triggered-by-user-activation>triggered by user activation/a>, but an exception could be made to allow playback while a href#concept-media-muted idplaying-the-media-resource:concept-media-muted>muted/a>./p> p>A a href#media-element idplaying-the-media-resource:media-element-6>media element/a> is said to have dfn idended-playback>ended playback/dfn> when:/p> ul>li>The elements code idplaying-the-media-resource:dom-media-readystate-3>a href#dom-media-readystate>readyState/a>/code> attribute is code idplaying-the-media-resource:dom-media-have_metadata-2>a href#dom-media-have_metadata>HAVE_METADATA/a>/code> or greater, and li> p>Either: ul>li>The a href#current-playback-position idplaying-the-media-resource:current-playback-position>current playback position/a> is the end of the a href#media-resource idplaying-the-media-resource:media-resource-6>media resource/a>, and li>The a href#direction-of-playback idplaying-the-media-resource:direction-of-playback>direction of playback/a> is forwards, and li>The a href#media-element idplaying-the-media-resource:media-element-7>media element/a> does not have a code idplaying-the-media-resource:attr-media-loop>a href#attr-media-loop>loop/a>/code> attribute specified. /ul> p>Or: ul>li>The a href#current-playback-position idplaying-the-media-resource:current-playback-position-2>current playback position/a> is the a href#earliest-possible-position idplaying-the-media-resource:earliest-possible-position>earliest possible position/a>, and li>The a href#direction-of-playback idplaying-the-media-resource:direction-of-playback-2>direction of playback/a> is backwards. /ul> /ul> p>The dfn iddom-media-ended>code>ended/code>/dfn> attribute must return true if, the last time the a href#event-loop idplaying-the-media-resource:event-loop>event loop/a> reached a href#step1>step 1/a>, the a href#media-element idplaying-the-media-resource:media-element-8>media element/a> had a href#ended-playback idplaying-the-media-resource:ended-playback-2>ended playback/a> and the a href#direction-of-playback idplaying-the-media-resource:direction-of-playback-3>direction of playback/a> was forwards, and false otherwise./p> p>A a href#media-element idplaying-the-media-resource:media-element-9>media element/a> is said to have dfn idstopped-due-to-errors>stopped due to errors/dfn> when the elements code idplaying-the-media-resource:dom-media-readystate-4>a href#dom-media-readystate>readyState/a>/code> attribute is code idplaying-the-media-resource:dom-media-have_metadata-3>a href#dom-media-have_metadata>HAVE_METADATA/a>/code> or greater, and the user agent a href#non-fatal-media-error>encounters a non-fatal error/a> during the processing of the a href#media-data idplaying-the-media-resource:media-data>media data/a>, and due to that error, is not able to play the content at the a href#current-playback-position idplaying-the-media-resource:current-playback-position-3>current playback position/a>./p> p>A a href#media-element idplaying-the-media-resource:media-element-10>media element/a> is said to have dfn idpaused-for-user-interaction>paused for user interaction/dfn> when its code idplaying-the-media-resource:dom-media-paused-6>a href#dom-media-paused>paused/a>/code> attribute is false, the code idplaying-the-media-resource:dom-media-readystate-5>a href#dom-media-readystate>readyState/a>/code> attribute is either code idplaying-the-media-resource:dom-media-have_future_data-2>a href#dom-media-have_future_data>HAVE_FUTURE_DATA/a>/code> or code idplaying-the-media-resource:dom-media-have_enough_data>a href#dom-media-have_enough_data>HAVE_ENOUGH_DATA/a>/code> and the user agent has reached a point in the a href#media-resource idplaying-the-media-resource:media-resource-7>media resource/a> where the user has to make a selection for the resource to continue./p> p>It is possible for a a href#media-element idplaying-the-media-resource:media-element-11>media element/a> to have both a href#ended-playback idplaying-the-media-resource:ended-playback-3>ended playback/a> and a href#paused-for-user-interaction idplaying-the-media-resource:paused-for-user-interaction-2>paused for user interaction/a> at the same time./p> p>When a a href#media-element idplaying-the-media-resource:media-element-12>media element/a> that is a href#potentially-playing idplaying-the-media-resource:potentially-playing-2>potentially playing/a> stops playing because it has a href#paused-for-user-interaction idplaying-the-media-resource:paused-for-user-interaction-3>paused for user interaction/a>, the user agent must a href#queue-a-task idplaying-the-media-resource:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idplaying-the-media-resource:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idplaying-the-media-resource:event-media-timeupdate>a href#event-media-timeupdate>timeupdate/a>/code> at the element./p> p>A a href#media-element idplaying-the-media-resource:media-element-13>media element/a> is said to have dfn idpaused-for-in-band-content>paused for in-band content/dfn> when its code idplaying-the-media-resource:dom-media-paused-7>a href#dom-media-paused>paused/a>/code> attribute is false, the code idplaying-the-media-resource:dom-media-readystate-6>a href#dom-media-readystate>readyState/a>/code> attribute is either code idplaying-the-media-resource:dom-media-have_future_data-3>a href#dom-media-have_future_data>HAVE_FUTURE_DATA/a>/code> or code idplaying-the-media-resource:dom-media-have_enough_data-2>a href#dom-media-have_enough_data>HAVE_ENOUGH_DATA/a>/code> and the user agent has suspended playback of the a href#media-resource idplaying-the-media-resource:media-resource-8>media resource/a> in order to play content that is temporally anchored to the a href#media-resource idplaying-the-media-resource:media-resource-9>media resource/a> and has a nonzero length, or to play content that is temporally anchored to a segment of the a href#media-resource idplaying-the-media-resource:media-resource-10>media resource/a> but has a length longer than that segment./p> p classexample>One example of when a a href#media-element idplaying-the-media-resource:media-element-14>media element/a> would be a href#paused-for-in-band-content idplaying-the-media-resource:paused-for-in-band-content-2>paused for in-band content/a> is when the user agent is playing a href#attr-track-kind-descriptions idplaying-the-media-resource:attr-track-kind-descriptions>audio descriptions/a> from an external WebVTT file, and the synthesized speech generated for a cue is longer than the time between the a href#text-track-cue-start-time idplaying-the-media-resource:text-track-cue-start-time>text track cue start time/a> and the a href#text-track-cue-end-time idplaying-the-media-resource:text-track-cue-end-time>text track cue end time/a>./p> hr> p idreaches-the-end>When the a href#current-playback-position idplaying-the-media-resource:current-playback-position-4>current playback position/a> reaches the end of the a href#media-resource idplaying-the-media-resource:media-resource-11>media resource/a> when the a href#direction-of-playback idplaying-the-media-resource:direction-of-playback-4>direction of playback/a> is forwards, then the user agent must follow these steps:/p> ol>li>p>If the a href#media-element idplaying-the-media-resource:media-element-15>media element/a> has a code idplaying-the-media-resource:attr-media-loop-2>a href#attr-media-loop>loop/a>/code> attribute specified, then a href#dom-media-seek idplaying-the-media-resource:dom-media-seek>seek/a> to the a href#earliest-possible-position idplaying-the-media-resource:earliest-possible-position-2>earliest possible position/a> of the a href#media-resource idplaying-the-media-resource:media-resource-12>media resource/a> and abort these steps.li>p>As defined above, the code idplaying-the-media-resource:dom-media-ended-2>a href#dom-media-ended>ended/a>/code> IDL attribute starts returning true once the a href#event-loop idplaying-the-media-resource:event-loop-2>event loop/a> returns to a href#step1>step 1/a>.li> p>a href#queue-a-task idplaying-the-media-resource:queue-a-task-2>Queue a task/a> to run these steps:/p> ol>li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idplaying-the-media-resource:concept-event-fire-2 data-x-internalconcept-event-fire>Fire an event/a> named code idplaying-the-media-resource:event-media-timeupdate-2>a href#event-media-timeupdate>timeupdate/a>/code> at the a href#media-element idplaying-the-media-resource:media-element-16>media element/a>.li> p>If the a href#media-element idplaying-the-media-resource:media-element-17>media element/a> has a href#ended-playback idplaying-the-media-resource:ended-playback-4>ended playback/a>, the a href#direction-of-playback idplaying-the-media-resource:direction-of-playback-5>direction of playback/a> is forwards, and a href#dom-media-paused idplaying-the-media-resource:dom-media-paused-8>paused/a> is false, then:/p> ol>li>p>Set the code idplaying-the-media-resource:dom-media-paused-9>a href#dom-media-paused>paused/a>/code> attribute to true.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idplaying-the-media-resource:concept-event-fire-3 data-x-internalconcept-event-fire>Fire an event/a> named code idplaying-the-media-resource:event-media-pause>a href#event-media-pause>pause/a>/code> at the a href#media-element idplaying-the-media-resource:media-element-18>media element/a>.li>p>a href#take-pending-play-promises idplaying-the-media-resource:take-pending-play-promises>Take pending play promises/a> and a href#reject-pending-play-promises idplaying-the-media-resource:reject-pending-play-promises>reject pending play promises/a> with the result and an a idplaying-the-media-resource:aborterror hrefhttps://heycam.github.io/webidl/#aborterror data-x-internalaborterror>code>AbortError/code>/a> code idplaying-the-media-resource:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./ol> li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idplaying-the-media-resource:concept-event-fire-4 data-x-internalconcept-event-fire>Fire an event/a> named code idplaying-the-media-resource:event-media-ended>a href#event-media-ended>ended/a>/code> at the a href#media-element idplaying-the-media-resource:media-element-19>media element/a>./ol> /ol> p>When the a href#current-playback-position idplaying-the-media-resource:current-playback-position-5>current playback position/a> reaches the a href#earliest-possible-position idplaying-the-media-resource:earliest-possible-position-3>earliest possible position/a> of the a href#media-resource idplaying-the-media-resource:media-resource-13>media resource/a> when the a href#direction-of-playback idplaying-the-media-resource:direction-of-playback-6>direction of playback/a> is backwards, then the user agent must only a href#queue-a-task idplaying-the-media-resource:queue-a-task-3>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idplaying-the-media-resource:concept-event-fire-5 data-x-internalconcept-event-fire>fire an event/a> named code idplaying-the-media-resource:event-media-timeupdate-3>a href#event-media-timeupdate>timeupdate/a>/code> at the element./p> p classnote>The word reaches here does not imply that the a href#current-playback-position idplaying-the-media-resource:current-playback-position-6>current playback position/a> needs to have changed during normal playback; it could be via a href#dom-media-seek idplaying-the-media-resource:dom-media-seek-2>seeking/a>, for instance./p> hr> p>The dfn iddom-media-defaultplaybackrate>code>defaultPlaybackRate/code>/dfn> attribute gives the desired speed at which the a href#media-resource idplaying-the-media-resource:media-resource-14>media resource/a> is to play, as a multiple of its intrinsic speed. The attribute is mutable: on getting it must return the last value it was set to, or 1.0 if it hasnt yet been set; on setting the attribute must be set to the new value./p> p classnote>The code idplaying-the-media-resource:dom-media-defaultplaybackrate-2>a href#dom-media-defaultplaybackrate>defaultPlaybackRate/a>/code> is used by the user agent when it a href#expose-a-user-interface-to-the-user idplaying-the-media-resource:expose-a-user-interface-to-the-user>exposes a user interface to the user/a>./p> p>The dfn iddom-media-playbackrate>code>playbackRate/code>/dfn> attribute gives the effective playback rate, which is the speed at which the a href#media-resource idplaying-the-media-resource:media-resource-15>media resource/a> plays, as a multiple of its intrinsic speed. If it is not equal to the code idplaying-the-media-resource:dom-media-defaultplaybackrate-3>a href#dom-media-defaultplaybackrate>defaultPlaybackRate/a>/code>, then the implication is that the user is using a feature such as fast forward or slow motion playback. The attribute is mutable: on getting it must return the last value it was set to, or 1.0 if it hasnt yet been set; on setting, the user agent must follow these steps:/p> ol>li>p>If the given value is not supported by the user agent, then throw a a idplaying-the-media-resource:notsupportederror hrefhttps://heycam.github.io/webidl/#notsupportederror data-x-internalnotsupportederror>code>NotSupportedError/code>/a> code idplaying-the-media-resource:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Set code idplaying-the-media-resource:dom-media-playbackrate-2>a href#dom-media-playbackrate>playbackRate/a>/code> to the new value, and if the element is a href#potentially-playing idplaying-the-media-resource:potentially-playing-3>potentially playing/a>, change the playback speed./ol> p idrateUpdate>When the code idplaying-the-media-resource:dom-media-defaultplaybackrate-4>a href#dom-media-defaultplaybackrate>defaultPlaybackRate/a>/code> or code idplaying-the-media-resource:dom-media-playbackrate-3>a href#dom-media-playbackrate>playbackRate/a>/code> attributes change value (either by being set by script or by being changed directly by the user agent, e.g. in response to user control) the user agent must a href#queue-a-task idplaying-the-media-resource:queue-a-task-4>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idplaying-the-media-resource:concept-event-fire-6 data-x-internalconcept-event-fire>fire an event/a> named code idplaying-the-media-resource:event-media-ratechange>a href#event-media-ratechange>ratechange/a>/code> at the a href#media-element idplaying-the-media-resource:media-element-20>media element/a>./p> hr> p>The dfn iddom-media-played>code>played/code>/dfn> attribute must return a new static a href#normalised-timeranges-object idplaying-the-media-resource:normalised-timeranges-object>normalized code>TimeRanges/code> object/a> that represents the ranges of points on the a href#media-timeline idplaying-the-media-resource:media-timeline>media timeline/a> of the a href#media-resource idplaying-the-media-resource:media-resource-16>media resource/a> reached through the usual monotonic increase of the a href#current-playback-position idplaying-the-media-resource:current-playback-position-7>current playback position/a> during normal playback, if any, at the time the attribute is evaluated./p> p classwarning>Returning a new object each time is a bad pattern for attribute getters and is only enshrined here as it would be costly to change it. It is not to be copied to new APIs./p> hr> p>Each a href#media-element idplaying-the-media-resource:media-element-21>media element/a> has a dfn idlist-of-pending-play-promises>list of pending play promises/dfn>, which must initially be empty./p> p>To dfn idtake-pending-play-promises>take pending play promises/dfn> for a a href#media-element idplaying-the-media-resource:media-element-22>media element/a>, the user agent must run the following steps:/p> ol>li>p>Let var>promises/var> be an empty list of promises.li>p>Copy the a href#media-element idplaying-the-media-resource:media-element-23>media element/a>s a href#list-of-pending-play-promises idplaying-the-media-resource:list-of-pending-play-promises>list of pending play promises/a> to var>promises/var>.li>p>Clear the a href#media-element idplaying-the-media-resource:media-element-24>media element/a>s a href#list-of-pending-play-promises idplaying-the-media-resource:list-of-pending-play-promises-2>list of pending play promises/a>.li>Return var>promises/var>./ol> p>To dfn idresolve-pending-play-promises>resolve pending play promises/dfn> for a a href#media-element idplaying-the-media-resource:media-element-25>media element/a> with a list of promises var>promises/var>, the user agent must resolve each promise in var>promises/var> with undefined./p> p>To dfn idreject-pending-play-promises>reject pending play promises/dfn> for a a href#media-element idplaying-the-media-resource:media-element-26>media element/a> with a list of promise var>promises/var> and an exception name var>error/var>, the user agent must reject each promise in var>promises/var> with var>error/var>./p> p>To dfn idnotify-about-playing>notify about playing/dfn> for a a href#media-element idplaying-the-media-resource:media-element-27>media element/a>, the user agent must run the following steps:/p> ol>li>p>a href#take-pending-play-promises idplaying-the-media-resource:take-pending-play-promises-2>Take pending play promises/a> and let var>promises/var> be the result.li> p>a href#queue-a-task idplaying-the-media-resource:queue-a-task-5>Queue a task/a> to run these steps:/p> ol>li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idplaying-the-media-resource:concept-event-fire-7 data-x-internalconcept-event-fire>Fire an event/a> named code idplaying-the-media-resource:event-media-playing>a href#event-media-playing>playing/a>/code> at the element.li>p>a href#resolve-pending-play-promises idplaying-the-media-resource:resolve-pending-play-promises>Resolve pending play promises/a> with var>promises/var>./ol> /ol> p>When the dfn iddom-media-play>code>play()/code>/dfn> method on a a href#media-element idplaying-the-media-resource:media-element-28>media element/a> is invoked, the user agent must run the following steps./p> ol>li>p>If the a href#media-element idplaying-the-media-resource:media-element-29>media element/a> is not a href#allowed-to-play idplaying-the-media-resource:allowed-to-play>allowed to play/a>, return a promise rejected with a a idplaying-the-media-resource:notallowederror hrefhttps://heycam.github.io/webidl/#notallowederror data-x-internalnotallowederror>code>NotAllowedError/code>/a> code idplaying-the-media-resource:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li> p>If the a href#media-element idplaying-the-media-resource:media-element-30>media element/a>s code idplaying-the-media-resource:dom-media-error>a href#dom-media-error>error/a>/code> attribute is not null and its a href#concept-mediaerror-code idplaying-the-media-resource:concept-mediaerror-code>code/a> is code idplaying-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>, return a promise rejected with a a idplaying-the-media-resource:notsupportederror-2 hrefhttps://heycam.github.io/webidl/#notsupportederror data-x-internalnotsupportederror>code>NotSupportedError/code>/a> code idplaying-the-media-resource:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps./p> p classnote>This means that the a href#dedicated-media-source-failure-steps idplaying-the-media-resource:dedicated-media-source-failure-steps>dedicated media source failure steps/a> have run. Playback is not possible until the a href#media-element-load-algorithm idplaying-the-media-resource:media-element-load-algorithm>media element load algorithm/a> clears the code idplaying-the-media-resource:dom-media-error-2>a href#dom-media-error>error/a>/code> attribute./p> li>p>Let var>promise/var> be a new promise and append var>promise/var> to the a href#list-of-pending-play-promises idplaying-the-media-resource:list-of-pending-play-promises-3>list of pending play promises/a>.li>p>If the a href#media-element idplaying-the-media-resource:media-element-31>media element/a>s code idplaying-the-media-resource:dom-media-networkstate>a href#dom-media-networkstate>networkState/a>/code> attribute has the value code idplaying-the-media-resource:dom-media-network_empty>a href#dom-media-network_empty>NETWORK_EMPTY/a>/code>, invoke the a href#media-element idplaying-the-media-resource:media-element-32>media element/a>s a href#concept-media-load-algorithm idplaying-the-media-resource:concept-media-load-algorithm>resource selection algorithm/a>.li> p>If the a href#ended-playback idplaying-the-media-resource:ended-playback-5>playback has ended/a> and the a href#direction-of-playback idplaying-the-media-resource:direction-of-playback-7>direction of playback/a> is forwards, a href#dom-media-seek idplaying-the-media-resource:dom-media-seek-3>seek/a> to the a href#earliest-possible-position idplaying-the-media-resource:earliest-possible-position-4>earliest possible position/a> of the a href#media-resource idplaying-the-media-resource:media-resource-17>media resource/a>./p> p classnote>This a href#seekUpdate>will cause/a> the user agent to a href#queue-a-task idplaying-the-media-resource:queue-a-task-6>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idplaying-the-media-resource:concept-event-fire-8 data-x-internalconcept-event-fire>fire an event/a> named code idplaying-the-media-resource:event-media-timeupdate-4>a href#event-media-timeupdate>timeupdate/a>/code> at the a href#media-element idplaying-the-media-resource:media-element-33>media element/a>./p> li> p>If the a href#media-element idplaying-the-media-resource:media-element-34>media element/a>s code idplaying-the-media-resource:dom-media-paused-10>a href#dom-media-paused>paused/a>/code> attribute is true, then:/p> ol>li>p>Change the value of code idplaying-the-media-resource:dom-media-paused-11>a href#dom-media-paused>paused/a>/code> to false.li>p>If the a href#show-poster-flag idplaying-the-media-resource:show-poster-flag>show poster flag/a> is true, set the elements a href#show-poster-flag idplaying-the-media-resource:show-poster-flag-2>show poster flag/a> to false and run the i idplaying-the-media-resource:time-marches-on>a href#time-marches-on>time marches on/a>/i> steps.li>p>a href#queue-a-task idplaying-the-media-resource:queue-a-task-7>Queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idplaying-the-media-resource:concept-event-fire-9 data-x-internalconcept-event-fire>fire an event/a> named code idplaying-the-media-resource:event-media-play>a href#event-media-play>play/a>/code> at the element.li> p>If the a href#media-element idplaying-the-media-resource:media-element-35>media element/a>s code idplaying-the-media-resource:dom-media-readystate-7>a href#dom-media-readystate>readyState/a>/code> attribute has the value code idplaying-the-media-resource:dom-media-have_nothing-2>a href#dom-media-have_nothing>HAVE_NOTHING/a>/code>, code idplaying-the-media-resource:dom-media-have_metadata-4>a href#dom-media-have_metadata>HAVE_METADATA/a>/code>, or code idplaying-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 idplaying-the-media-resource:queue-a-task-8>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idplaying-the-media-resource:concept-event-fire-10 data-x-internalconcept-event-fire>fire an event/a> named code idplaying-the-media-resource:event-media-waiting-2>a href#event-media-waiting>waiting/a>/code> at the element./p> p>Otherwise, the a href#media-element idplaying-the-media-resource:media-element-36>media element/a>s code idplaying-the-media-resource:dom-media-readystate-8>a href#dom-media-readystate>readyState/a>/code> attribute has the value code idplaying-the-media-resource:dom-media-have_future_data-4>a href#dom-media-have_future_data>HAVE_FUTURE_DATA/a>/code> or code idplaying-the-media-resource:dom-media-have_enough_data-3>a href#dom-media-have_enough_data>HAVE_ENOUGH_DATA/a>/code>: a href#notify-about-playing idplaying-the-media-resource:notify-about-playing>notify about playing/a> for the element./p> /ol> li> p>Otherwise, if the a href#media-element idplaying-the-media-resource:media-element-37>media element/a>s code idplaying-the-media-resource:dom-media-readystate-9>a href#dom-media-readystate>readyState/a>/code> attribute has the value code idplaying-the-media-resource:dom-media-have_future_data-5>a href#dom-media-have_future_data>HAVE_FUTURE_DATA/a>/code> or code idplaying-the-media-resource:dom-media-have_enough_data-4>a href#dom-media-have_enough_data>HAVE_ENOUGH_DATA/a>/code>, a href#take-pending-play-promises idplaying-the-media-resource:take-pending-play-promises-3>take pending play promises/a> and a href#queue-a-task idplaying-the-media-resource:queue-a-task-9>queue a task/a> to a href#resolve-pending-play-promises idplaying-the-media-resource:resolve-pending-play-promises-2>resolve pending play promises/a> with the result./p> p classnote>The media element is already playing. However, its possible that var>promise/var> will be a href#reject-pending-play-promises idplaying-the-media-resource:reject-pending-play-promises-2>rejected/a> before the queued task is run./p> li>p>Set the a href#media-element idplaying-the-media-resource:media-element-38>media element/a>s a href#can-autoplay-flag idplaying-the-media-resource:can-autoplay-flag-2>can autoplay flag/a> to false.li>p>Return var>promise/var>./ol> hr> p>When the dfn iddom-media-pause>code>pause()/code>/dfn> method is invoked, and when the user agent is required to pause the a href#media-element idplaying-the-media-resource:media-element-39>media element/a>, the user agent must run the following steps:/p> ol>li>p>If the a href#media-element idplaying-the-media-resource:media-element-40>media element/a>s code idplaying-the-media-resource:dom-media-networkstate-2>a href#dom-media-networkstate>networkState/a>/code> attribute has the value code idplaying-the-media-resource:dom-media-network_empty-2>a href#dom-media-network_empty>NETWORK_EMPTY/a>/code>, invoke the a href#media-element idplaying-the-media-resource:media-element-41>media element/a>s a href#concept-media-load-algorithm idplaying-the-media-resource:concept-media-load-algorithm-2>resource selection algorithm/a>.li>p>Run the a href#internal-pause-steps idplaying-the-media-resource:internal-pause-steps>internal pause steps/a> for the a href#media-element idplaying-the-media-resource:media-element-42>media element/a>./ol> p>The dfn idinternal-pause-steps>internal pause steps/dfn> for a a href#media-element idplaying-the-media-resource:media-element-43>media element/a> are as follows:/p> ol>li>p>Set the a href#media-element idplaying-the-media-resource:media-element-44>media element/a>s a href#can-autoplay-flag idplaying-the-media-resource:can-autoplay-flag-3>can autoplay flag/a> to false.li>p>If the a href#media-element idplaying-the-media-resource:media-element-45>media element/a>s code idplaying-the-media-resource:dom-media-paused-12>a href#dom-media-paused>paused/a>/code> attribute is false, run the following steps:/p> ol>li>p>Change the value of code idplaying-the-media-resource:dom-media-paused-13>a href#dom-media-paused>paused/a>/code> to true.li>p>a href#take-pending-play-promises idplaying-the-media-resource:take-pending-play-promises-4>Take pending play promises/a> and let var>promises/var> be the result.li> p>a href#queue-a-task idplaying-the-media-resource:queue-a-task-10>Queue a task/a> to run these steps:/p> ol>li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idplaying-the-media-resource:concept-event-fire-11 data-x-internalconcept-event-fire>Fire an event/a> named code idplaying-the-media-resource:event-media-timeupdate-5>a href#event-media-timeupdate>timeupdate/a>/code> at the element.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idplaying-the-media-resource:concept-event-fire-12 data-x-internalconcept-event-fire>Fire an event/a> named code idplaying-the-media-resource:event-media-pause-2>a href#event-media-pause>pause/a>/code> at the element.li>p>a href#reject-pending-play-promises idplaying-the-media-resource:reject-pending-play-promises-3>Reject pending play promises/a> with var>promises/var> and an a idplaying-the-media-resource:aborterror-2 hrefhttps://heycam.github.io/webidl/#aborterror data-x-internalaborterror>code>AbortError/code>/a> code idplaying-the-media-resource:domexception-5>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./ol> li>p>Set the a href#official-playback-position idplaying-the-media-resource:official-playback-position>official playback position/a> to the a href#current-playback-position idplaying-the-media-resource:current-playback-position-8>current playback position/a>./ol> /ol> hr> p>If the elements code idplaying-the-media-resource:dom-media-playbackrate-4>a href#dom-media-playbackrate>playbackRate/a>/code> is positive or zero, then the dfn iddirection-of-playback>direction of playback/dfn> is forwards. Otherwise, it is backwards./p> p idmedia-playback>When a a href#media-element idplaying-the-media-resource:media-element-46>media element/a> is a href#potentially-playing idplaying-the-media-resource:potentially-playing-4>potentially playing/a> and its code idplaying-the-media-resource:document>a href#document>Document/a>/code> is a a href#fully-active idplaying-the-media-resource:fully-active>fully active/a> code idplaying-the-media-resource:document-2>a href#document>Document/a>/code>, its a href#current-playback-position idplaying-the-media-resource:current-playback-position-9>current playback position/a> must increase monotonically at the elements code idplaying-the-media-resource:dom-media-playbackrate-5>a href#dom-media-playbackrate>playbackRate/a>/code> units of media time per unit time of the a href#media-timeline idplaying-the-media-resource:media-timeline-2>media timeline/a>s clock. (This specification always refers to this as an i>increase/i>, but that increase could actually be a em>de/em>crease if the elements code idplaying-the-media-resource:dom-media-playbackrate-6>a href#dom-media-playbackrate>playbackRate/a>/code> is negative.)div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id28236 titleThe "rules for updating the text track rendering" are not run when mode changes from hidden to showing>28236/a>/div> p classnote>The elements code idplaying-the-media-resource:dom-media-playbackrate-7>a href#dom-media-playbackrate>playbackRate/a>/code> can be 0.0, in which case the a href#current-playback-position idplaying-the-media-resource:current-playback-position-10>current playback position/a> doesnt move, despite playback not being paused (code idplaying-the-media-resource:dom-media-paused-14>a href#dom-media-paused>paused/a>/code> doesnt become true, and the code idplaying-the-media-resource:event-media-pause-3>a href#event-media-pause>pause/a>/code> event doesnt fire)./p> p classnote>This specification doesnt define how the user agent achieves the appropriate playback rate — depending on the protocol and media available, it is plausible that the user agent could negotiate with the server to have the server provide the media data at the appropriate rate, so that (except for the period between when the rate is changed and when the server updates the streams playback rate) the client doesnt actually have to drop or interpolate any frames./p> p>Any time the user agent a href#await-a-stable-state idplaying-the-media-resource:await-a-stable-state>provides a stable state/a>, the a href#official-playback-position idplaying-the-media-resource:official-playback-position-2>official playback position/a> must be set to the a href#current-playback-position idplaying-the-media-resource:current-playback-position-11>current playback position/a>./p> p>While the a href#direction-of-playback idplaying-the-media-resource:direction-of-playback-8>direction of playback/a> is backwards, any corresponding audio must be a href#concept-media-muted idplaying-the-media-resource:concept-media-muted-2>muted/a>. While the elements code idplaying-the-media-resource:dom-media-playbackrate-8>a href#dom-media-playbackrate>playbackRate/a>/code> is so low or so high that the user agent cannot play audio usefully, the corresponding audio must also be a href#concept-media-muted idplaying-the-media-resource:concept-media-muted-3>muted/a>. If the elements code idplaying-the-media-resource:dom-media-playbackrate-9>a href#dom-media-playbackrate>playbackRate/a>/code> is not 1.0, the user agent may apply pitch adjustments to the audio as necessary to render it faithfully./p> p>a href#media-element idplaying-the-media-resource:media-element-47>Media elements/a> that are a href#potentially-playing idplaying-the-media-resource:potentially-playing-5>potentially playing/a> while not a idplaying-the-media-resource:in-a-document hrefhttps://dom.spec.whatwg.org/#in-a-document data-x-internalin-a-document>in a document/a> must not play any video, but should play any audio component. Media elements must not stop playing just because all references to them have been removed; only once a media element is in a state where no further audio could ever be played by that element may the element be garbage collected./p> p classnote>It is possible for an element to which no explicit references exist to play audio, even if such an element is not still actively playing: for instance, it could be unpaused but stalled waiting for content to buffer, or it could be still buffering, but with a code idplaying-the-media-resource:event-media-suspend>a href#event-media-suspend>suspend/a>/code> event listener that begins playback. Even a media element whose a href#media-resource idplaying-the-media-resource:media-resource-18>media resource/a> has no audio tracks could eventually play audio again if it had an event listener that changes the a href#media-resource idplaying-the-media-resource:media-resource-19>media resource/a>./p> hr> p>Each a href#media-element idplaying-the-media-resource:media-element-48>media element/a> has a dfn idlist-of-newly-introduced-cues>list of newly introduced cues/dfn>, which must be initially empty. Whenever a a href#text-track-cue idplaying-the-media-resource:text-track-cue>text track cue/a> is added to the a href#text-track-list-of-cues idplaying-the-media-resource:text-track-list-of-cues>list of cues/a> of a a href#text-track idplaying-the-media-resource:text-track>text track/a> that is in the a href#list-of-text-tracks idplaying-the-media-resource:list-of-text-tracks>list of text tracks/a> for a a href#media-element idplaying-the-media-resource:media-element-49>media element/a>, that a href#text-track-cue idplaying-the-media-resource:text-track-cue-2>cue/a> must be added to the a href#media-element idplaying-the-media-resource:media-element-50>media element/a>s a href#list-of-newly-introduced-cues idplaying-the-media-resource:list-of-newly-introduced-cues>list of newly introduced cues/a>. Whenever a a href#text-track idplaying-the-media-resource:text-track-2>text track/a> is added to the a href#list-of-text-tracks idplaying-the-media-resource:list-of-text-tracks-2>list of text tracks/a> for a a href#media-element idplaying-the-media-resource:media-element-51>media element/a>, all of the a href#text-track-cue idplaying-the-media-resource:text-track-cue-3>cues/a> in that a href#text-track idplaying-the-media-resource:text-track-3>text track/a>s a href#text-track-list-of-cues idplaying-the-media-resource:text-track-list-of-cues-2>list of cues/a> must be added to the a href#media-element idplaying-the-media-resource:media-element-52>media element/a>s a href#list-of-newly-introduced-cues idplaying-the-media-resource:list-of-newly-introduced-cues-2>list of newly introduced cues/a>. When a a href#media-element idplaying-the-media-resource:media-element-53>media element/a>s a href#list-of-newly-introduced-cues idplaying-the-media-resource:list-of-newly-introduced-cues-3>list of newly introduced cues/a> has new cues added while the a href#media-element idplaying-the-media-resource:media-element-54>media element/a>s a href#show-poster-flag idplaying-the-media-resource:show-poster-flag-3>show poster flag/a> is not set, then the user agent must run the i idplaying-the-media-resource:time-marches-on-2>a href#time-marches-on>time marches on/a>/i> steps./p> p>When a a href#text-track-cue idplaying-the-media-resource:text-track-cue-4>text track cue/a> is removed from the a href#text-track-list-of-cues idplaying-the-media-resource:text-track-list-of-cues-3>list of cues/a> of a a href#text-track idplaying-the-media-resource:text-track-4>text track/a> that is in the a href#list-of-text-tracks idplaying-the-media-resource:list-of-text-tracks-3>list of text tracks/a> for a a href#media-element idplaying-the-media-resource:media-element-55>media element/a>, and whenever a a href#text-track idplaying-the-media-resource:text-track-5>text track/a> is removed from the a href#list-of-text-tracks idplaying-the-media-resource:list-of-text-tracks-4>list of text tracks/a> of a a href#media-element idplaying-the-media-resource:media-element-56>media element/a>, if the a href#media-element idplaying-the-media-resource:media-element-57>media element/a>s a href#show-poster-flag idplaying-the-media-resource:show-poster-flag-4>show poster flag/a> is not set, then the user agent must run the i idplaying-the-media-resource:time-marches-on-3>a href#time-marches-on>time marches on/a>/i> steps./p> p>When the a href#current-playback-position idplaying-the-media-resource:current-playback-position-12>current playback position/a> of a a href#media-element idplaying-the-media-resource:media-element-58>media element/a> changes (e.g. due to playback or seeking), the user agent must run the i idplaying-the-media-resource:time-marches-on-4>a href#time-marches-on>time marches on/a>/i> steps. If the a href#current-playback-position idplaying-the-media-resource:current-playback-position-13>current playback position/a> changes while the steps are running, then the user agent must wait for the steps to complete, and then must immediately rerun the steps. (These steps are thus run as often as possible or needed — if one iteration takes a long time, this can cause certain a href#text-track-cue idplaying-the-media-resource:text-track-cue-5>cues/a> to be skipped over as the user agent rushes ahead to catch up.)/p> p>The dfn idtime-marches-on>i>time marches on/i>/dfn> steps are as follows:/p> ol>li>p>Let var>current cues/var> be a list of a href#text-track-cue idplaying-the-media-resource:text-track-cue-6>cues/a>, initialized to contain all the a href#text-track-cue idplaying-the-media-resource:text-track-cue-7>cues/a> of all the a href#text-track-hidden idplaying-the-media-resource:text-track-hidden>hidden/a> or a href#text-track-showing idplaying-the-media-resource:text-track-showing>showing/a> a href#text-track idplaying-the-media-resource:text-track-6>text tracks/a> of the a href#media-element idplaying-the-media-resource:media-element-59>media element/a> (not the a href#text-track-disabled idplaying-the-media-resource:text-track-disabled>disabled/a> ones) whose a href#text-track-cue-start-time idplaying-the-media-resource:text-track-cue-start-time-2>start times/a> are less than or equal to the a href#current-playback-position idplaying-the-media-resource:current-playback-position-14>current playback position/a> and whose a href#text-track-cue-end-time idplaying-the-media-resource:text-track-cue-end-time-2>end times/a> are greater than the a href#current-playback-position idplaying-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 idplaying-the-media-resource:text-track-cue-8>cues/a>, initialized to contain all the a href#text-track-cue idplaying-the-media-resource:text-track-cue-9>cues/a> of a href#text-track-hidden idplaying-the-media-resource:text-track-hidden-2>hidden/a> and a href#text-track-showing idplaying-the-media-resource:text-track-showing-2>showing/a> a href#text-track idplaying-the-media-resource:text-track-7>text tracks/a> of the a href#media-element idplaying-the-media-resource:media-element-60>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 idplaying-the-media-resource:current-playback-position-16>current playback position/a> at the time this algorithm was last run for this a href#media-element idplaying-the-media-resource:media-element-61>media element/a>, if this is not the first time it has run.li>p>If the a href#current-playback-position idplaying-the-media-resource:current-playback-position-17>current playback position/a> has, since the last time this algorithm was run, only changed through its usual monotonic increase during normal playback, then let var>missed cues/var> be the list of a href#text-track-cue idplaying-the-media-resource:text-track-cue-10>cues/a> in var>other cues/var> whose a href#text-track-cue-start-time idplaying-the-media-resource:text-track-cue-start-time-3>start times/a> are greater than or equal to var>last time/var> and whose a href#text-track-cue-end-time idplaying-the-media-resource:text-track-cue-end-time-3>end times/a> are less than or equal to the a href#current-playback-position idplaying-the-media-resource:current-playback-position-18>current playback position/a>. Otherwise, let var>missed cues/var> be an empty list.li>p>Remove all the a href#text-track-cue idplaying-the-media-resource:text-track-cue-11>cues/a> in var>missed cues/var> that are also in the a href#media-element idplaying-the-media-resource:media-element-62>media element/a>s a href#list-of-newly-introduced-cues idplaying-the-media-resource:list-of-newly-introduced-cues-4>list of newly introduced cues/a>, and then empty the elements a href#list-of-newly-introduced-cues idplaying-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 idplaying-the-media-resource:current-playback-position-19>current playback position/a> during normal playback, and if the user agent has not fired a code idplaying-the-media-resource:event-media-timeupdate-6>a href#event-media-timeupdate>timeupdate/a>/code> event at the element in the past 15 to 250ms and is not still running event handlers for such an event, then the user agent must a href#queue-a-task idplaying-the-media-resource:queue-a-task-11>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idplaying-the-media-resource:concept-event-fire-13 data-x-internalconcept-event-fire>fire an event/a> named code idplaying-the-media-resource:event-media-timeupdate-7>a href#event-media-timeupdate>timeupdate/a>/code> at the element. (In the other cases, such as explicit seeks, relevant events get fired as part of the overall process of changing the a href#current-playback-position idplaying-the-media-resource:current-playback-position-20>current playback position/a>.)/p> p classnote>The event thus is not to be fired faster than about 66Hz or slower than 4Hz (assuming the event handlers dont take longer than 250ms to run). User agents are encouraged to vary the frequency of the event based on the system load and the average cost of processing the event each time, so that the UI updates are not any more frequent than the user agent can comfortably handle while decoding the video.li>p>If all of the a href#text-track-cue idplaying-the-media-resource:text-track-cue-12>cues/a> in var>current cues/var> have their a href#text-track-cue-active-flag idplaying-the-media-resource:text-track-cue-active-flag>text track cue active flag/a> set, none of the a href#text-track-cue idplaying-the-media-resource:text-track-cue-13>cues/a> in var>other cues/var> have their a href#text-track-cue-active-flag idplaying-the-media-resource:text-track-cue-active-flag-2>text track cue active flag/a> set, and var>missed cues/var> is empty, then abort these steps.li> p>If the time was reached through the usual monotonic increase of the a href#current-playback-position idplaying-the-media-resource:current-playback-position-21>current playback position/a> during normal playback, and there are a href#text-track-cue idplaying-the-media-resource:text-track-cue-14>cues/a> in var>other cues/var> that have their a href#text-track-cue-pause-on-exit-flag idplaying-the-media-resource:text-track-cue-pause-on-exit-flag>text track cue pause-on-exit flag/a> set and that either have their a href#text-track-cue-active-flag idplaying-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 a href#immediately idplaying-the-media-resource:immediately>immediately/a> a href#dom-media-pause idplaying-the-media-resource:dom-media-pause-2>pause/a> the a href#media-element idplaying-the-media-resource:media-element-63>media element/a>. /p> p classnote>In the other cases, such as explicit seeks, playback is not paused by going past the end time of a a href#text-track-cue idplaying-the-media-resource:text-track-cue-15>cue/a>, even if that a href#text-track-cue idplaying-the-media-resource:text-track-cue-16>cue/a> has its a href#text-track-cue-pause-on-exit-flag idplaying-the-media-resource:text-track-cue-pause-on-exit-flag-2>text track cue pause-on-exit flag/a> set./p> li> p>Let var>events/var> be a list of a href#concept-task idplaying-the-media-resource:concept-task>tasks/a>, initially empty. Each a href#concept-task idplaying-the-media-resource:concept-task-2>task/a> in this list will be associated with a a href#text-track idplaying-the-media-resource:text-track-8>text track/a>, a a href#text-track-cue idplaying-the-media-resource:text-track-cue-17>text track cue/a>, and a time, which are used to sort the list before the a href#concept-task idplaying-the-media-resource:concept-task-3>tasks/a> are queued./p> p>Let var>affected tracks/var> be a list of a href#text-track idplaying-the-media-resource:text-track-9>text tracks/a>, initially empty./p> p>When the steps below say to dfn idprepare-an-event>prepare an event/dfn> named var>event/var> for a a href#text-track-cue idplaying-the-media-resource:text-track-cue-18>text track cue/a> var>target/var> with a time var>time/var>, the user agent must run these steps:/p> ol>li>p>Let var>track/var> be the a href#text-track idplaying-the-media-resource:text-track-10>text track/a> with which the a href#text-track-cue idplaying-the-media-resource:text-track-cue-19>text track cue/a> var>target/var> is associated.li>p>Create a a href#concept-task idplaying-the-media-resource:concept-task-4>task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idplaying-the-media-resource:concept-event-fire-14 data-x-internalconcept-event-fire>fire an event/a> named var>event/var> at var>target/var>.li>p>Add the newly created a href#concept-task idplaying-the-media-resource:concept-task-5>task/a> to var>events/var>, associated with the time var>time/var>, the a href#text-track idplaying-the-media-resource:text-track-11>text track/a> var>track/var>, and the a href#text-track-cue idplaying-the-media-resource:text-track-cue-20>text track cue/a> var>target/var>.li>p>Add var>track/var> to var>affected tracks/var>./ol> li>p>For each a href#text-track-cue idplaying-the-media-resource:text-track-cue-21>text track cue/a> in var>missed cues/var>, a href#prepare-an-event idplaying-the-media-resource:prepare-an-event>prepare an event/a> named code idplaying-the-media-resource:event-media-enter>a href#event-media-enter>enter/a>/code> for the code idplaying-the-media-resource:texttrackcue>a href#texttrackcue>TextTrackCue/a>/code> object with the a href#text-track-cue-start-time idplaying-the-media-resource:text-track-cue-start-time-4>text track cue start time/a>.li>p>For each a href#text-track-cue idplaying-the-media-resource:text-track-cue-22>text track cue/a> in var>other cues/var> that either has its a href#text-track-cue-active-flag idplaying-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 idplaying-the-media-resource:prepare-an-event-2>prepare an event/a> named code idplaying-the-media-resource:event-media-exit>a href#event-media-exit>exit/a>/code> for the code idplaying-the-media-resource:texttrackcue-2>a href#texttrackcue>TextTrackCue/a>/code> object with the later of the a href#text-track-cue-end-time idplaying-the-media-resource:text-track-cue-end-time-4>text track cue end time/a> and the a href#text-track-cue-start-time idplaying-the-media-resource:text-track-cue-start-time-5>text track cue start time/a>.li>p>For each a href#text-track-cue idplaying-the-media-resource:text-track-cue-23>text track cue/a> in var>current cues/var> that does not have its a href#text-track-cue-active-flag idplaying-the-media-resource:text-track-cue-active-flag-5>text track cue active flag/a> set, a href#prepare-an-event idplaying-the-media-resource:prepare-an-event-3>prepare an event/a> named code idplaying-the-media-resource:event-media-enter-2>a href#event-media-enter>enter/a>/code> for the code idplaying-the-media-resource:texttrackcue-3>a href#texttrackcue>TextTrackCue/a>/code> object with the a href#text-track-cue-start-time idplaying-the-media-resource:text-track-cue-start-time-6>text track cue start time/a>.li> p>Sort the a href#concept-task idplaying-the-media-resource:concept-task-6>tasks/a> in var>events/var> in ascending time order (a href#concept-task idplaying-the-media-resource:concept-task-7>tasks/a> with earlier times first)./p> p>Further sort a href#concept-task idplaying-the-media-resource:concept-task-8>tasks/a> in var>events/var> that have the same time by the relative a href#text-track-cue-order idplaying-the-media-resource:text-track-cue-order>text track cue order/a> of the a href#text-track-cue idplaying-the-media-resource:text-track-cue-24>text track cues/a> associated with these a href#concept-task idplaying-the-media-resource:concept-task-9>tasks/a>./p> p>Finally, sort a href#concept-task idplaying-the-media-resource:concept-task-10>tasks/a> in var>events/var> that have the same time and same a href#text-track-cue-order idplaying-the-media-resource:text-track-cue-order-2>text track cue order/a> by placing a href#concept-task idplaying-the-media-resource:concept-task-11>tasks/a> that fire code idplaying-the-media-resource:event-media-enter-3>a href#event-media-enter>enter/a>/code> events before those that fire code idplaying-the-media-resource:event-media-exit-2>a href#event-media-exit>exit/a>/code> events./p> li>p>a href#queue-a-task idplaying-the-media-resource:queue-a-task-12>Queue/a> each a href#concept-task idplaying-the-media-resource:concept-task-12>task/a> in var>events/var>, in list order.li>p>Sort var>affected tracks/var> in the same order as the a href#text-track idplaying-the-media-resource:text-track-12>text tracks/a> appear in the a href#media-element idplaying-the-media-resource:media-element-64>media element/a>s a href#list-of-text-tracks idplaying-the-media-resource:list-of-text-tracks-5>list of text tracks/a>, and remove duplicates./p> li>p>For each a href#text-track idplaying-the-media-resource:text-track-13>text track/a> in var>affected tracks/var>, in the list order, a href#queue-a-task idplaying-the-media-resource:queue-a-task-13>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idplaying-the-media-resource:concept-event-fire-15 data-x-internalconcept-event-fire>fire an event/a> named code idplaying-the-media-resource:event-media-cuechange>a href#event-media-cuechange>cuechange/a>/code> at the code idplaying-the-media-resource:texttrack>a href#texttrack>TextTrack/a>/code> object, and, if the a href#text-track idplaying-the-media-resource:text-track-14>text track/a> has a corresponding code idplaying-the-media-resource:the-track-element>a href#the-track-element>track/a>/code> element, to then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idplaying-the-media-resource:concept-event-fire-16 data-x-internalconcept-event-fire>fire an event/a> named code idplaying-the-media-resource:event-media-cuechange-2>a href#event-media-cuechange>cuechange/a>/code> at the code idplaying-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 idplaying-the-media-resource:text-track-cue-active-flag-6>text track cue active flag/a> of all the a href#text-track-cue idplaying-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 idplaying-the-media-resource:text-track-cue-active-flag-7>text track cue active flag/a> of all the a href#text-track-cue idplaying-the-media-resource:text-track-cue-26>cues/a> in the var>other cues/var>.li>p>Run the a href#rules-for-updating-the-text-track-rendering idplaying-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 idplaying-the-media-resource:text-track-15>text tracks/a> in var>affected tracks/var> that are a href#text-track-showing idplaying-the-media-resource:text-track-showing-3>showing/a>, providing the a href#text-track idplaying-the-media-resource:text-track-16>text track/a>s a href#text-track-language idplaying-the-media-resource:text-track-language>text track language/a> as the fallback language if it is not the empty string. For example, for a href#text-track idplaying-the-media-resource:text-track-17>text tracks/a> based on WebVTT, the a idplaying-the-media-resource:rules-for-updating-the-display-of-webvtt-text-tracks hrefhttps://w3c.github.io/webvtt/#rules-for-updating-the-display-of-webvtt-text-tracks data-x-internalrules-for-updating-the-display-of-webvtt-text-tracks>rules for updating the display of WebVTT text tracks/a>. a href#refsWEBVTT>WEBVTT/a>/ol> p>For the purposes of the algorithm above, a a href#text-track-cue idplaying-the-media-resource:text-track-cue-27>text track cue/a> is considered to be part of a a href#text-track idplaying-the-media-resource:text-track-18>text track/a> only if it is listed in the a href#text-track-list-of-cues idplaying-the-media-resource:text-track-list-of-cues-4>text track list of cues/a>, not merely if it is associated with the a href#text-track idplaying-the-media-resource:text-track-19>text track/a>./p> p classnote>If the a href#media-element idplaying-the-media-resource:media-element-65>media element/a>s a idplaying-the-media-resource:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> stops being a a href#fully-active idplaying-the-media-resource:fully-active-2>fully active/a> document, then the playback will a href#media-playback>stop/a> until the document is active again./p> p>When a a href#media-element idplaying-the-media-resource:media-element-66>media element/a> is a href#remove-an-element-from-a-document idplaying-the-media-resource:remove-an-element-from-a-document>removed from a code>Document/code>/a>, the user agent must run the following steps:/p> ol>li>p>a href#await-a-stable-state idplaying-the-media-resource:await-a-stable-state-2>Await a stable state/a>, allowing the a href#concept-task idplaying-the-media-resource:concept-task-13>task/a> that removed the a href#media-element idplaying-the-media-resource:media-element-67>media element/a> from the code idplaying-the-media-resource:document-3>a href#document>Document/a>/code> to continue. The a href#synchronous-section idplaying-the-media-resource:synchronous-section>synchronous section/a> consists of all the remaining steps of this algorithm. (Steps in the a href#synchronous-section idplaying-the-media-resource:synchronous-section-2>synchronous section/a> are marked with ⌛.)li>p>⌛ If the a href#media-element idplaying-the-media-resource:media-element-68>media element/a> is a idplaying-the-media-resource:in-a-document-2 hrefhttps://dom.spec.whatwg.org/#in-a-document data-x-internalin-a-document>in a document/a>, abort these steps.li>p>⌛ Run the a href#internal-pause-steps idplaying-the-media-resource:internal-pause-steps-2>internal pause steps/a> for the a href#media-element idplaying-the-media-resource:media-element-69>media element/a>./p> /ol> h5 idseeking>span classsecno>4.8.12.9/span> Seekinga href#seeking classself-link>/a>/h5> dl classdomintro>dt>var>media/var> . code idseeking:dom-media-seeking>a href#dom-media-seeking>seeking/a>/code>dd> p>Returns true if the user agent is currently seeking./p> dt>var>media/var> . code idseeking:dom-media-seekable>a href#dom-media-seekable>seekable/a>/code>dd> p>Returns a code idseeking:timeranges>a href#timeranges>TimeRanges/a>/code> object that represents the ranges of the a href#media-resource idseeking:media-resource>media resource/a> to which it is possible for the user agent to seek./p> dt>var>media/var> . code idseeking:dom-media-fastseek>a href#dom-media-fastseek>fastSeek/a>/code>( var>time/var> )dd> p>Seeks to near the given var>time/var> as fast as possible, trading precision for speed. (To seek to a precise time, use the code idseeking:dom-media-currenttime>a href#dom-media-currenttime>currentTime/a>/code> attribute.)/p> p>This does nothing if the media resource has not been loaded./p> /dl> p>The dfn iddom-media-seeking>code>seeking/code>/dfn> attribute must initially have the value false./p> p>The dfn iddom-media-fastseek>code>fastSeek()/code>/dfn> method must a href#dom-media-seek idseeking:dom-media-seek>seek/a> to the time given by the methods argument, with the i>approximate-for-speed/i> flag set./p> p>When the user agent is required to dfn iddom-media-seek>seek/dfn> to a particular var>new playback position/var> in the a href#media-resource idseeking:media-resource-2>media resource/a>, optionally with the i>approximate-for-speed/i> flag set, it means that the user agent must run the following steps. This algorithm interacts closely with the a href#event-loop idseeking:event-loop>event loop/a> mechanism; in particular, it has a a href#synchronous-section idseeking:synchronous-section>synchronous section/a> (which is triggered as part of the a href#event-loop idseeking:event-loop-2>event loop/a> algorithm). Steps in that section are marked with ⌛.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id28929 titleSetting video.currentTime (seeking) should synchronously update the attributes value>28929/a>/div> ol>li>p>Set the a href#media-element idseeking:media-element>media element/a>s a href#show-poster-flag idseeking:show-poster-flag>show poster flag/a> to false.li>p>If the a href#media-element idseeking:media-element-2>media element/a>s code idseeking:dom-media-readystate>a href#dom-media-readystate>readyState/a>/code> is code idseeking:dom-media-have_nothing>a href#dom-media-have_nothing>HAVE_NOTHING/a>/code>, abort these steps.li>p>If the elements code idseeking:dom-media-seeking-2>a href#dom-media-seeking>seeking/a>/code> IDL attribute is true, then another instance of this algorithm is already running. Abort that other instance of the algorithm without waiting for the step that it is running to complete.li>p>Set the code idseeking:dom-media-seeking-3>a href#dom-media-seeking>seeking/a>/code> IDL attribute to true.li>p>If the seek was in response to a DOM method call or setting of an IDL attribute, then continue the script. The remainder of these steps must be run a href#in-parallel idseeking:in-parallel>in parallel/a>. With the exception of the steps marked with ⌛, they could be aborted at any time by another instance of this algorithm being invoked.li>p>If the var>new playback position/var> is later than the end of the a href#media-resource idseeking:media-resource-3>media resource/a>, then let it be the end of the a href#media-resource idseeking: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 idseeking:earliest-possible-position>earliest possible position/a>, let it be that position instead.li>p>If the (possibly now changed) var>new playback position/var> is not in one of the ranges given in the code idseeking:dom-media-seekable-2>a href#dom-media-seekable>seekable/a>/code> attribute, then let it be the position in one of the ranges given in the code idseeking:dom-media-seekable-3>a href#dom-media-seekable>seekable/a>/code> attribute that is the nearest to the var>new playback position/var>. If two positions both satisfy that constraint (i.e. the var>new playback position/var> is exactly in the middle between two ranges in the code idseeking:dom-media-seekable-4>a href#dom-media-seekable>seekable/a>/code> attribute) then use the position that is closest to the a href#current-playback-position idseeking:current-playback-position>current playback position/a>. If there are no ranges given in the code idseeking:dom-media-seekable-5>a href#dom-media-seekable>seekable/a>/code> attribute then set the code idseeking:dom-media-seeking-4>a href#dom-media-seeking>seeking/a>/code> IDL attribute to false and abort these steps.li> p>If the i>approximate-for-speed/i> flag is set, adjust the var>new playback position/var> to a value that will allow for playback to resume promptly. If var>new playback position/var> before this step is before a href#current-playback-position idseeking:current-playback-position-2>current playback position/a>, then the adjusted var>new playback position/var> must also be before the a href#current-playback-position idseeking:current-playback-position-3>current playback position/a>. Similarly, if the var>new playback position/var> before this step is after a href#current-playback-position idseeking:current-playback-position-4>current playback position/a>, then the adjusted var>new playback position/var> must also be after the a href#current-playback-position idseeking:current-playback-position-5>current playback position/a>./p> p classexample>For example, the user agent could snap to a nearby key frame, so that it doesnt have to spend time decoding then discarding intermediate frames before resuming playback./p> li>p>a href#queue-a-task idseeking:queue-a-task>Queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idseeking:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idseeking:event-media-seeking>a href#event-media-seeking>seeking/a>/code> at the element.li> p>Set the a href#current-playback-position idseeking:current-playback-position-6>current playback position/a> to the var>new playback position/var>./p> p classnote>If the a href#media-element idseeking:media-element-3>media element/a> was a href#potentially-playing idseeking:potentially-playing>potentially playing/a> immediately before it started seeking, but seeking caused its code idseeking:dom-media-readystate-2>a href#dom-media-readystate>readyState/a>/code> attribute to change to a value lower than code idseeking:dom-media-have_future_data>a href#dom-media-have_future_data>HAVE_FUTURE_DATA/a>/code>, then a code idseeking:event-media-waiting>a href#event-media-waiting>waiting/a>/code> event a href#fire-waiting-when-waiting>will be fired/a> at the element./p> p classnote>This step sets the a href#current-playback-position idseeking:current-playback-position-7>current playback position/a>, and thus can immediately trigger other conditions, such as the rules regarding when playback a href#reaches-the-end>reaches the end of the media resource/a> (part of the logic that handles looping), even before the user agent is actually able to render the media data for that position (as determined in the next step)./p> p classnote>The code idseeking:dom-media-currenttime-2>a href#dom-media-currenttime>currentTime/a>/code> attribute returns the a href#official-playback-position idseeking:official-playback-position>official playback position/a>, not the a href#current-playback-position idseeking:current-playback-position-8>current playback position/a>, and therefore gets updated before script execution, separate from this algorithm./p> li>p>Wait until the user agent has established whether or not the a href#media-data idseeking:media-data>media data/a> for the var>new playback position/var> is available, and, if it is, until it has decoded enough data to play back that position.li>p>a href#await-a-stable-state idseeking:await-a-stable-state>Await a stable state/a>. The a href#synchronous-section idseeking:synchronous-section-2>synchronous section/a> consists of all the remaining steps of this algorithm. (Steps in the a href#synchronous-section idseeking:synchronous-section-3>synchronous section/a> are marked with ⌛.)li>p>⌛ Set the code idseeking:dom-media-seeking-5>a href#dom-media-seeking>seeking/a>/code> IDL attribute to false.li>p>⌛ Run the a href#time-marches-on idseeking:time-marches-on>time marches on/a> steps.li idseekUpdate>p>⌛ a href#queue-a-task idseeking:queue-a-task-2>Queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idseeking:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idseeking:event-media-timeupdate>a href#event-media-timeupdate>timeupdate/a>/code> at the element.li>p>⌛ a href#queue-a-task idseeking:queue-a-task-3>Queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idseeking:concept-event-fire-3 data-x-internalconcept-event-fire>fire an event/a> named code idseeking:event-media-seeked>a href#event-media-seeked>seeked/a>/code> at the element./ol> hr> p>The dfn iddom-media-seekable>code>seekable/code>/dfn> attribute must return a new static a href#normalised-timeranges-object idseeking:normalised-timeranges-object>normalized code>TimeRanges/code> object/a> that represents the ranges of the a href#media-resource idseeking:media-resource-5>media resource/a>, if any, that the user agent is able to seek to, at the time the attribute is evaluated./p> p classnote>If the user agent can seek to anywhere in the a href#media-resource idseeking:media-resource-6>media resource/a>, e.g. because it is a simple movie file and the user agent and the server support HTTP Range requests, then the attribute would return an object with one range, whose start is the time of the first frame (the a href#earliest-possible-position idseeking:earliest-possible-position-2>earliest possible position/a>, typically zero), and whose end is the same as the time of the first frame plus the code idseeking:dom-media-duration>a href#dom-media-duration>duration/a>/code> attributes value (which would equal the time of the last frame, and might be positive Infinity)./p> p classnote>The range might be continuously changing, e.g. if the user agent is buffering a sliding window on an infinite stream. This is the behavior seen with DVRs viewing live TV, for instance./p> p classwarning>Returning a new object each time is a bad pattern for attribute getters and is only enshrined here as it would be costly to change it. It is not to be copied to new APIs./p> p>User agents should adopt a very liberal and optimistic view of what is seekable. User agents should also buffer recent content where possible to enable seeking to be fast./p> p classexample>For instance, consider a large video file served on an HTTP server without support for HTTP Range requests. A browser em>could/em> implement this by only buffering the current frame and data obtained for subsequent frames, never allow seeking, except for seeking to the very start by restarting the playback. However, this would be a poor implementation. A high quality implementation would buffer the last few minutes of content (or more, if sufficient storage space is available), allowing the user to jump back and rewatch something surprising without any latency, and would in addition allow arbitrary seeking by reloading the file from the start if necessary, which would be slower but still more convenient than having to literally restart the video and watch it all the way through just to get to an earlier unbuffered spot./p> p>a href#media-resource idseeking:media-resource-7>Media resources/a> might be internally scripted or interactive. Thus, a a href#media-element idseeking:media-element-4>media element/a> could play in a non-linear fashion. If this happens, the user agent must act as if the algorithm for a href#dom-media-seek idseeking:dom-media-seek-2>seeking/a> was used whenever the a href#current-playback-position idseeking:current-playback-position-9>current playback position/a> changes in a discontinuous fashion (so that the relevant events fire)./p> h5 idmedia-resources-with-multiple-media-tracks>span classsecno>4.8.12.10/span> Media resources with multiple media tracksa href#media-resources-with-multiple-media-tracks classself-link>/a>/h5> p>A a href#media-resource idmedia-resources-with-multiple-media-tracks:media-resource>media resource/a> can have multiple embedded audio and video tracks. For example, in addition to the primary video and audio tracks, a a href#media-resource idmedia-resources-with-multiple-media-tracks:media-resource-2>media resource/a> could have foreign-language dubbed dialogues, directors commentaries, audio descriptions, alternative angles, or sign-language overlays./p> dl classdomintro>dt>var>media/var> . code idmedia-resources-with-multiple-media-tracks:dom-media-audiotracks>a href#dom-media-audiotracks>audioTracks/a>/code>dd> p>Returns an code idmedia-resources-with-multiple-media-tracks:audiotracklist>a href#audiotracklist>AudioTrackList/a>/code> object representing the audio tracks available in the a href#media-resource idmedia-resources-with-multiple-media-tracks:media-resource-3>media resource/a>./p> dt>var>media/var> . code idmedia-resources-with-multiple-media-tracks:dom-media-videotracks>a href#dom-media-videotracks>videoTracks/a>/code>dd> p>Returns a code idmedia-resources-with-multiple-media-tracks:videotracklist>a href#videotracklist>VideoTrackList/a>/code> object representing the video tracks available in the a href#media-resource idmedia-resources-with-multiple-media-tracks:media-resource-4>media resource/a>./p> /dl> p>The dfn iddom-media-audiotracks>code>audioTracks/code>/dfn> attribute of a a href#media-element idmedia-resources-with-multiple-media-tracks:media-element>media element/a> must return a a href#live idmedia-resources-with-multiple-media-tracks:live>live/a> code idmedia-resources-with-multiple-media-tracks:audiotracklist-2>a href#audiotracklist>AudioTrackList/a>/code> object representing the audio tracks available in the a href#media-element idmedia-resources-with-multiple-media-tracks:media-element-2>media element/a>s a href#media-resource idmedia-resources-with-multiple-media-tracks:media-resource-5>media resource/a>./p> p>The dfn iddom-media-videotracks>code>videoTracks/code>/dfn> attribute of a a href#media-element idmedia-resources-with-multiple-media-tracks:media-element-3>media element/a> must return a a href#live idmedia-resources-with-multiple-media-tracks:live-2>live/a> code idmedia-resources-with-multiple-media-tracks:videotracklist-2>a href#videotracklist>VideoTrackList/a>/code> object representing the video tracks available in the a href#media-element idmedia-resources-with-multiple-media-tracks:media-element-4>media element/a>s a href#media-resource idmedia-resources-with-multiple-media-tracks:media-resource-6>media resource/a>./p> p classnote>There are only ever one code idmedia-resources-with-multiple-media-tracks:audiotracklist-3>a href#audiotracklist>AudioTrackList/a>/code> object and one code idmedia-resources-with-multiple-media-tracks:videotracklist-3>a href#videotracklist>VideoTrackList/a>/code> object per a href#media-element idmedia-resources-with-multiple-media-tracks:media-element-5>media element/a>, even if another a href#media-resource idmedia-resources-with-multiple-media-tracks:media-resource-7>media resource/a> is loaded into the element: the objects are reused. (The code idmedia-resources-with-multiple-media-tracks:audiotrack>a href#audiotrack>AudioTrack/a>/code> and code idmedia-resources-with-multiple-media-tracks:videotrack>a href#videotrack>VideoTrack/a>/code> objects are not, though.)/p> h6 idaudiotracklist-and-videotracklist-objects>span classsecno>4.8.12.10.1/span> code idaudiotracklist-and-videotracklist-objects:audiotracklist>a href#audiotracklist>AudioTrackList/a>/code> and code idaudiotracklist-and-videotracklist-objects:videotracklist>a href#videotracklist>VideoTrackList/a>/code> objectsa href#audiotracklist-and-videotracklist-objects classself-link>/a>/h6>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> audiotracksspan classand_chr no>span>Chrome for Android/span> span>None/span>/span>span classchrome no>span>Chrome/span> span>None/span>/span>span classios_saf yes>span>iOS Safari/span> span>7.0+/span>/span>span classand_uc no>span>UC Browser for Android/span> span>None/span>/span>span classfirefox no>span>Firefox/span> span>None/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung no>span>Samsung Internet/span> span>None/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>6.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid no>span>Android Browser/span> span>None/span>/span>span classopera no>span>Opera/span> span>None/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#feataudiotracks>caniuse.com/a>/div> p>The code idaudiotracklist-and-videotracklist-objects:audiotracklist-2>a href#audiotracklist>AudioTrackList/a>/code> and code idaudiotracklist-and-videotracklist-objects:videotracklist-2>a href#videotracklist>VideoTrackList/a>/code> interfaces are used by attributes defined in the previous section./p> pre classidl>ExposedWindowinterface dfn idaudiotracklist>AudioTrackList/dfn> : a idaudiotracklist-and-videotracklist-objects:eventtarget hrefhttps://dom.spec.whatwg.org/#interface-eventtarget data-x-internaleventtarget>EventTarget/a> { readonly attribute unsigned long a href#dom-audiotracklist-length idaudiotracklist-and-videotracklist-objects:dom-audiotracklist-length>length/a>; a href#dom-tracklist-item>getter/a> a href#audiotrack idaudiotracklist-and-videotracklist-objects:audiotrack>AudioTrack/a> (unsigned long index); a href#audiotrack idaudiotracklist-and-videotracklist-objects:audiotrack-2>AudioTrack/a>? a href#dom-audiotracklist-gettrackbyid idaudiotracklist-and-videotracklist-objects:dom-audiotracklist-gettrackbyid>getTrackById/a>(DOMString id); attribute a href#eventhandler idaudiotracklist-and-videotracklist-objects:eventhandler>EventHandler/a> a href#handler-tracklist-onchange idaudiotracklist-and-videotracklist-objects:handler-tracklist-onchange>onchange/a>; attribute a href#eventhandler idaudiotracklist-and-videotracklist-objects:eventhandler-2>EventHandler/a> a href#handler-tracklist-onaddtrack idaudiotracklist-and-videotracklist-objects:handler-tracklist-onaddtrack>onaddtrack/a>; attribute a href#eventhandler idaudiotracklist-and-videotracklist-objects:eventhandler-3>EventHandler/a> a href#handler-tracklist-onremovetrack idaudiotracklist-and-videotracklist-objects:handler-tracklist-onremovetrack>onremovetrack/a>;};ExposedWindowinterface dfn idaudiotrack>AudioTrack/dfn> { readonly attribute DOMString a href#dom-audiotrack-id idaudiotracklist-and-videotracklist-objects:dom-audiotrack-id>id/a>; readonly attribute DOMString a href#dom-audiotrack-kind idaudiotracklist-and-videotracklist-objects:dom-audiotrack-kind>kind/a>; readonly attribute DOMString a href#dom-audiotrack-label idaudiotracklist-and-videotracklist-objects:dom-audiotrack-label>label/a>; readonly attribute DOMString a href#dom-audiotrack-language idaudiotracklist-and-videotracklist-objects:dom-audiotrack-language>language/a>; attribute boolean a href#dom-audiotrack-enabled idaudiotracklist-and-videotracklist-objects:dom-audiotrack-enabled>enabled/a>;};ExposedWindowinterface dfn idvideotracklist>VideoTrackList/dfn> : a idaudiotracklist-and-videotracklist-objects:eventtarget-2 hrefhttps://dom.spec.whatwg.org/#interface-eventtarget data-x-internaleventtarget>EventTarget/a> { readonly attribute unsigned long a href#dom-videotracklist-length idaudiotracklist-and-videotracklist-objects:dom-videotracklist-length>length/a>; a href#dom-tracklist-item>getter/a> a href#videotrack idaudiotracklist-and-videotracklist-objects:videotrack>VideoTrack/a> (unsigned long index); a href#videotrack idaudiotracklist-and-videotracklist-objects:videotrack-2>VideoTrack/a>? a href#dom-videotracklist-gettrackbyid idaudiotracklist-and-videotracklist-objects:dom-videotracklist-gettrackbyid>getTrackById/a>(DOMString id); readonly attribute long a href#dom-videotracklist-selectedindex idaudiotracklist-and-videotracklist-objects:dom-videotracklist-selectedindex>selectedIndex/a>; attribute a href#eventhandler idaudiotracklist-and-videotracklist-objects:eventhandler-4>EventHandler/a> a href#handler-tracklist-onchange idaudiotracklist-and-videotracklist-objects:handler-tracklist-onchange-2>onchange/a>; attribute a href#eventhandler idaudiotracklist-and-videotracklist-objects:eventhandler-5>EventHandler/a> a href#handler-tracklist-onaddtrack idaudiotracklist-and-videotracklist-objects:handler-tracklist-onaddtrack-2>onaddtrack/a>; attribute a href#eventhandler idaudiotracklist-and-videotracklist-objects:eventhandler-6>EventHandler/a> a href#handler-tracklist-onremovetrack idaudiotracklist-and-videotracklist-objects:handler-tracklist-onremovetrack-2>onremovetrack/a>;};ExposedWindowinterface dfn idvideotrack>VideoTrack/dfn> { readonly attribute DOMString a href#dom-videotrack-id idaudiotracklist-and-videotracklist-objects:dom-videotrack-id>id/a>; readonly attribute DOMString a href#dom-videotrack-kind idaudiotracklist-and-videotracklist-objects:dom-videotrack-kind>kind/a>; readonly attribute DOMString a href#dom-videotrack-label idaudiotracklist-and-videotracklist-objects:dom-videotrack-label>label/a>; readonly attribute DOMString a href#dom-videotrack-language idaudiotracklist-and-videotracklist-objects:dom-videotrack-language>language/a>; attribute boolean a href#dom-videotrack-selected idaudiotracklist-and-videotracklist-objects:dom-videotrack-selected>selected/a>;};/pre> dl classdomintro>dt>var>media/var> . code idaudiotracklist-and-videotracklist-objects:dom-media-audiotracks>a href#dom-media-audiotracks>audioTracks/a>/code> . code idaudiotracklist-and-videotracklist-objects:dom-audiotracklist-length-2>a href#dom-audiotracklist-length>length/a>/code>dt>var>media/var> . code idaudiotracklist-and-videotracklist-objects:dom-media-videotracks>a href#dom-media-videotracks>videoTracks/a>/code> . code idaudiotracklist-and-videotracklist-objects:dom-videotracklist-length-2>a href#dom-videotracklist-length>length/a>/code>dd> p>Returns the number of tracks in the list./p> dt>var>audioTrack/var> var>media/var> . code idaudiotracklist-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 idaudiotracklist-and-videotracklist-objects:dom-media-videotracks-2>a href#dom-media-videotracks>videoTracks/a>/code>var>index/var>dd> p>Returns the specified code idaudiotracklist-and-videotracklist-objects:audiotrack-3>a href#audiotrack>AudioTrack/a>/code> or code idaudiotracklist-and-videotracklist-objects:videotrack-3>a href#videotrack>VideoTrack/a>/code> object./p> dt>var>audioTrack/var> var>media/var> . code idaudiotracklist-and-videotracklist-objects:dom-media-audiotracks-3>a href#dom-media-audiotracks>audioTracks/a>/code> . code idaudiotracklist-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 idaudiotracklist-and-videotracklist-objects:dom-media-videotracks-3>a href#dom-media-videotracks>videoTracks/a>/code> . code idaudiotracklist-and-videotracklist-objects:dom-videotracklist-gettrackbyid-2>a href#dom-videotracklist-gettrackbyid>getTrackById/a>/code>( var>id/var> )dd> p>Returns the code idaudiotracklist-and-videotracklist-objects:audiotrack-4>a href#audiotrack>AudioTrack/a>/code> or code idaudiotracklist-and-videotracklist-objects:videotrack-4>a href#videotrack>VideoTrack/a>/code> object with the given identifier, or null if no track has that identifier./p> dt>var>audioTrack/var> . code idaudiotracklist-and-videotracklist-objects:dom-audiotrack-id-2>a href#dom-audiotrack-id>id/a>/code>dt>var>videoTrack/var> . code idaudiotracklist-and-videotracklist-objects:dom-videotrack-id-2>a href#dom-videotrack-id>id/a>/code>dd> p>Returns the ID of the given track. This is the ID that can be used with a a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idaudiotracklist-and-videotracklist-objects:concept-url-fragment data-x-internalconcept-url-fragment>fragment/a> if the format supports a idaudiotracklist-and-videotracklist-objects:media-fragment-syntax hrefhttps://www.w3.org/TR/media-frags/#media-fragment-syntax data-x-internalmedia-fragment-syntax>media fragment syntax/a>, and that can be used with the code>getTrackById()/code> method./p> dt>var>audioTrack/var> . code idaudiotracklist-and-videotracklist-objects:dom-audiotrack-kind-2>a href#dom-audiotrack-kind>kind/a>/code>dt>var>videoTrack/var> . code idaudiotracklist-and-videotracklist-objects:dom-videotrack-kind-2>a href#dom-videotrack-kind>kind/a>/code>dd> p>Returns the category the given track falls into. The a href#dom-TrackList-getKind-categories>possible track categories/a> are given below./p> dt>var>audioTrack/var> . code idaudiotracklist-and-videotracklist-objects:dom-audiotrack-label-2>a href#dom-audiotrack-label>label/a>/code>dt>var>videoTrack/var> . code idaudiotracklist-and-videotracklist-objects:dom-videotrack-label-2>a href#dom-videotrack-label>label/a>/code>dd> p>Returns the label of the given track, if known, or the empty string otherwise./p> dt>var>audioTrack/var> . code idaudiotracklist-and-videotracklist-objects:dom-audiotrack-language-2>a href#dom-audiotrack-language>language/a>/code>dt>var>videoTrack/var> . code idaudiotracklist-and-videotracklist-objects:dom-videotrack-language-2>a href#dom-videotrack-language>language/a>/code>dd> p>Returns the language of the given track, if known, or the empty string otherwise./p> dt>var>audioTrack/var> . code idaudiotracklist-and-videotracklist-objects:dom-audiotrack-enabled-2>a href#dom-audiotrack-enabled>enabled/a>/code> var>value/var> dd> p>Returns true if the given track is active, and false otherwise./p> p>Can be set, to change whether the track is enabled or not. If multiple audio tracks are enabled simultaneously, they are mixed./p> dt>var>media/var> . code idaudiotracklist-and-videotracklist-objects:dom-media-videotracks-4>a href#dom-media-videotracks>videoTracks/a>/code> . code idaudiotracklist-and-videotracklist-objects:dom-videotracklist-selectedindex-2>a href#dom-videotracklist-selectedindex>selectedIndex/a>/code>dd> p>Returns the index of the currently selected track, if any, or −1 otherwise./p> dt>var>videoTrack/var> . code idaudiotracklist-and-videotracklist-objects:dom-videotrack-selected-2>a href#dom-videotrack-selected>selected/a>/code> var>value/var> dd> p>Returns true if the given track is active, and false otherwise./p> p>Can be set, to change whether the track is selected or not. Either zero or one video track is selected; selecting a new track while a previous one is selected will unselect the previous one./p> /dl> p>An code idaudiotracklist-and-videotracklist-objects:audiotracklist-3>a href#audiotracklist>AudioTrackList/a>/code> object represents a dynamic list of zero or more audio tracks, of which zero or more can be enabled at a time. Each audio track is represented by an code idaudiotracklist-and-videotracklist-objects:audiotrack-5>a href#audiotrack>AudioTrack/a>/code> object./p> p>A code idaudiotracklist-and-videotracklist-objects:videotracklist-3>a href#videotracklist>VideoTrackList/a>/code> object represents a dynamic list of zero or more video tracks, of which zero or one can be selected at a time. Each video track is represented by a code idaudiotracklist-and-videotracklist-objects:videotrack-5>a href#videotrack>VideoTrack/a>/code> object./p> p>Tracks in code idaudiotracklist-and-videotracklist-objects:audiotracklist-4>a href#audiotracklist>AudioTrackList/a>/code> and code idaudiotracklist-and-videotracklist-objects:videotracklist-4>a href#videotracklist>VideoTrackList/a>/code> objects must be consistently ordered. If the a href#media-resource idaudiotracklist-and-videotracklist-objects:media-resource>media resource/a> is in a format that defines an order, then that order must be used; otherwise, the order must be the relative order in which the tracks are declared in the a href#media-resource idaudiotracklist-and-videotracklist-objects:media-resource-2>media resource/a>. The order used is called the i>natural order/i> of the list./p> p classnote>Each track in one of these objects thus has an index; the first has the index 0, and each subsequent track is numbered one higher than the previous one. If a a href#media-resource idaudiotracklist-and-videotracklist-objects:media-resource-3>media resource/a> dynamically adds or removes audio or video tracks, then the indices of the tracks will change dynamically. If the a href#media-resource idaudiotracklist-and-videotracklist-objects:media-resource-4>media resource/a> changes entirely, then all the previous tracks will be removed and replaced with new tracks./p> p>The dfn iddom-audiotracklist-length>code>AudioTrackList.length/code>/dfn> and dfn iddom-videotracklist-length>code>VideoTrackList.length/code>/dfn> attributes must return the number of tracks represented by their objects at the time of getting./p> p>The a idaudiotracklist-and-videotracklist-objects:supported-property-indices hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a> of code idaudiotracklist-and-videotracklist-objects:audiotracklist-5>a href#audiotracklist>AudioTrackList/a>/code> and code idaudiotracklist-and-videotracklist-objects:videotracklist-5>a href#videotracklist>VideoTrackList/a>/code> objects at any instant are the numbers from zero to the number of tracks represented by the respective object minus one, if any tracks are represented. If an code idaudiotracklist-and-videotracklist-objects:audiotracklist-6>a href#audiotracklist>AudioTrackList/a>/code> or code idaudiotracklist-and-videotracklist-objects:videotracklist-6>a href#videotracklist>VideoTrackList/a>/code> object represents no tracks, it has no a idaudiotracklist-and-videotracklist-objects:supported-property-indices-2 hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a>./p> p iddom-tracklist-item>To a idaudiotracklist-and-videotracklist-objects:determine-the-value-of-an-indexed-property hrefhttps://heycam.github.io/webidl/#dfn-determine-the-value-of-an-indexed-property data-x-internaldetermine-the-value-of-an-indexed-property>determine the value of an indexed property/a> for a given index var>index/var> in an code idaudiotracklist-and-videotracklist-objects:audiotracklist-7>a href#audiotracklist>AudioTrackList/a>/code> or code idaudiotracklist-and-videotracklist-objects:videotracklist-7>a href#videotracklist>VideoTrackList/a>/code> object var>list/var>, the user agent must return the code idaudiotracklist-and-videotracklist-objects:audiotrack-6>a href#audiotrack>AudioTrack/a>/code> or code idaudiotracklist-and-videotracklist-objects:videotrack-6>a href#videotrack>VideoTrack/a>/code> object that represents the var>index/var>th track in var>list/var>./p> p>The dfn iddom-audiotracklist-gettrackbyid>code>AudioTrackList.getTrackById(var>id/var>)/code>/dfn> and dfn iddom-videotracklist-gettrackbyid>code>VideoTrackList.getTrackById(var>id/var>)/code>/dfn> methods must return the first code idaudiotracklist-and-videotracklist-objects:audiotrack-7>a href#audiotrack>AudioTrack/a>/code> or code idaudiotracklist-and-videotracklist-objects:videotrack-7>a href#videotrack>VideoTrack/a>/code> object (respectively) in the code idaudiotracklist-and-videotracklist-objects:audiotracklist-8>a href#audiotracklist>AudioTrackList/a>/code> or code idaudiotracklist-and-videotracklist-objects:videotracklist-8>a href#videotracklist>VideoTrackList/a>/code> object (respectively) whose identifier is equal to the value of the var>id/var> argument (in the natural order of the list, as defined above). When no tracks match the given argument, the methods must return null./p> p>The code idaudiotracklist-and-videotracklist-objects:audiotrack-8>a href#audiotrack>AudioTrack/a>/code> and code idaudiotracklist-and-videotracklist-objects:videotrack-8>a href#videotrack>VideoTrack/a>/code> objects represent specific tracks of a a href#media-resource idaudiotracklist-and-videotracklist-objects:media-resource-5>media resource/a>. Each track can have an identifier, category, label, and language. These aspects of a track are permanent for the lifetime of the track; even if a track is removed from a a href#media-resource idaudiotracklist-and-videotracklist-objects:media-resource-6>media resource/a>s code idaudiotracklist-and-videotracklist-objects:audiotracklist-9>a href#audiotracklist>AudioTrackList/a>/code> or code idaudiotracklist-and-videotracklist-objects:videotracklist-9>a href#videotracklist>VideoTrackList/a>/code> objects, those aspects do not change./p> p>In addition, code idaudiotracklist-and-videotracklist-objects:audiotrack-9>a href#audiotrack>AudioTrack/a>/code> objects can each be enabled or disabled; this is the audio tracks i>enabled state/i>. When an code idaudiotracklist-and-videotracklist-objects:audiotrack-10>a href#audiotrack>AudioTrack/a>/code> is created, its i>enabled state/i> must be set to false (disabled). The a href#concept-media-load-resource idaudiotracklist-and-videotracklist-objects:concept-media-load-resource>resource fetch algorithm/a> can override this./p> p>Similarly, a single code idaudiotracklist-and-videotracklist-objects:videotrack-9>a href#videotrack>VideoTrack/a>/code> object per code idaudiotracklist-and-videotracklist-objects:videotracklist-10>a href#videotracklist>VideoTrackList/a>/code> object can be selected, this is the video tracks i>selection state/i>. When a code idaudiotracklist-and-videotracklist-objects:videotrack-10>a href#videotrack>VideoTrack/a>/code> is created, its i>selection state/i> must be set to false (not selected). The a href#concept-media-load-resource idaudiotracklist-and-videotracklist-objects:concept-media-load-resource-2>resource fetch algorithm/a> can override this./p> p>The dfn iddom-audiotrack-id>code>AudioTrack.id/code>/dfn> and dfn iddom-videotrack-id>code>VideoTrack.id/code>/dfn> attributes must return the identifier of the track, if it has one, or the empty string otherwise. If the a href#media-resource idaudiotracklist-and-videotracklist-objects:media-resource-7>media resource/a> is in a format that supports a idaudiotracklist-and-videotracklist-objects:media-fragment-syntax-2 hrefhttps://www.w3.org/TR/media-frags/#media-fragment-syntax data-x-internalmedia-fragment-syntax>media fragment syntax/a>, the identifier returned for a particular track must be the same identifier that would enable the track if used as the name of a track in the track dimension of such a a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idaudiotracklist-and-videotracklist-objects:concept-url-fragment-2 data-x-internalconcept-url-fragment>fragment/a>. a href#refsINBAND>INBAND/a>/p> p classexample>For example, in Ogg files, this would be the Name header field of the track. a href#refsOGGSKELETONHEADERS>OGGSKELETONHEADERS/a>/p> p>The dfn iddom-audiotrack-kind>code>AudioTrack.kind/code>/dfn> and dfn iddom-videotrack-kind>code>VideoTrack.kind/code>/dfn> attributes must return the category of the track, if it has one, or the empty string otherwise./p> p>The category of a track is the string given in the first column of the table below that is the most appropriate for the track based on the definitions in the tables second and third columns, as determined by the metadata included in the track in the a href#media-resource idaudiotracklist-and-videotracklist-objects:media-resource-8>media resource/a>. The cell in the third column of a row says what the category given in the cell in the first column of that row applies to; a category is only appropriate for an audio track if it applies to audio tracks, and a category is only appropriate for video tracks if it applies to video tracks. Categories must only be returned for code idaudiotracklist-and-videotracklist-objects:audiotrack-11>a href#audiotrack>AudioTrack/a>/code> objects if they are appropriate for audio, and must only be returned for code idaudiotracklist-and-videotracklist-objects:videotrack-11>a href#videotrack>VideoTrack/a>/code> objects if they are appropriate for video./p> p>For Ogg files, the Role header field of the track gives the relevant metadata. For DASH media resources, the code>Role/code> element conveys the information. For WebM, only the code>FlagDefault/code> element currently maps to a value. The cite>Sourcing In-band Media Resource Tracks from Media Containers into HTML/cite> specification has further details. a href#refsOGGSKELETONHEADERS>OGGSKELETONHEADERS/a> a href#refsDASH>DASH/a> a href#refsWEBMCG>WEBMCG/a> a href#refsINBAND>INBAND/a>/p> table iddom-TrackList-getKind-categories>caption>Return values for code idaudiotracklist-and-videotracklist-objects:dom-audiotrack-kind-3>a href#dom-audiotrack-kind>AudioTrack.kind/a>/code> and code idaudiotracklist-and-videotracklist-objects:dom-videotrack-kind-3>a href#dom-videotrack-kind>VideoTrack.kind/a>/code>/caption>thead>tr>th>Category th>Definition th>Applies to...th>Examples tbody>tr>td>dfn idvalue-track-kind-alternate>code>alternative/code>/dfn> td>A possible alternative to the main track, e.g. a different take of a song (audio), or a different angle (video). td>Audio and video. td>Ogg: audio/alternate or video/alternate; DASH: alternate without main and commentary roles, and, for audio, without the dub role (other roles ignored). tr>td>dfn idvalue-track-kind-caption>code>captions/code>/dfn> td>A version of the main video track with captions burnt in. (For legacy content; new content would use text tracks.) td>Video only. td>DASH: caption and main roles together (other roles ignored). tr>td>dfn idvalue-track-kind-descriptions>code>descriptions/code>/dfn> td>An audio description of a video track. td>Audio only. td>Ogg: audio/audiodesc. tr>td>dfn idvalue-track-kind-main>code>main/code>/dfn> td>The primary audio or video track. td>Audio and video. td>Ogg: audio/main or video/main; WebM: the FlagDefault element is set; DASH: main role without caption, subtitle, and dub roles (other roles ignored). tr>td>dfn idvalue-track-kind-main-desc>code>main-desc/code>/dfn> td>The primary audio track, mixed with audio descriptions. td>Audio only. td>AC3 audio in MPEG-2 TS: bsmod2 and full_svc1. tr>td>dfn idvalue-track-kind-sign>code>sign/code>/dfn> td>A sign-language interpretation of an audio track. td>Video only. td>Ogg: video/sign. tr>td>dfn idvalue-track-kind-subtitle>code>subtitles/code>/dfn> td>A version of the main video track with subtitles burnt in. (For legacy content; new content would use text tracks.) td>Video only. td>DASH: subtitle and main roles together (other roles ignored). tr>td>dfn idvalue-track-kind-translation>code>translation/code>/dfn> td>A translated version of the main audio track. td>Audio only. td>Ogg: audio/dub. DASH: dub and main roles together (other roles ignored). tr>td>dfn idvalue-track-kind-commentary>code>commentary/code>/dfn> td>Commentary on the primary audio or video track, e.g. a directors commentary. td>Audio and video. td>DASH: commentary role without main role (other roles ignored). tr>td>dfn idvalue-track-kind-none>code>/code>/dfn> (empty string) td>No explicit kind, or the kind given by the tracks metadata is not recognized by the user agent. td>Audio and video. td> /table> p>The dfn iddom-audiotrack-label>code>AudioTrack.label/code>/dfn> and dfn iddom-videotrack-label>code>VideoTrack.label/code>/dfn> attributes must return the label of the track, if it has one, or the empty string otherwise. a href#refsINBAND>INBAND/a>/p> p>The dfn iddom-audiotrack-language>code>AudioTrack.language/code>/dfn> and dfn iddom-videotrack-language>code>VideoTrack.language/code>/dfn> attributes must return the BCP 47 language tag of the language of the track, if it has one, or the empty string otherwise. If the user agent is not able to express that language as a BCP 47 language tag (for example because the language information in the a href#media-resource idaudiotracklist-and-videotracklist-objects:media-resource-9>media resource/a>s format is a free-form string without a defined interpretation), then the method must return the empty string, as if the track had no language. a href#refsINBAND>INBAND/a>/p> p>The dfn iddom-audiotrack-enabled>code>AudioTrack.enabled/code>/dfn> attribute, on getting, must return true if the track is currently enabled, and false otherwise. On setting, it must enable the track if the new value is true, and disable it otherwise. (If the track is no longer in an code idaudiotracklist-and-videotracklist-objects:audiotracklist-10>a href#audiotracklist>AudioTrackList/a>/code> object, then the track being enabled or disabled has no effect beyond changing the value of the attribute on the code idaudiotracklist-and-videotracklist-objects:audiotrack-12>a href#audiotrack>AudioTrack/a>/code> object.)/p> p idtoggle-audio-track>Whenever an audio track in an code idaudiotracklist-and-videotracklist-objects:audiotracklist-11>a href#audiotracklist>AudioTrackList/a>/code> that was disabled is enabled, and whenever one that was enabled is disabled, the user agent must a href#queue-a-task idaudiotracklist-and-videotracklist-objects:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idaudiotracklist-and-videotracklist-objects:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idaudiotracklist-and-videotracklist-objects:event-media-change>a href#event-media-change>change/a>/code> at the code idaudiotracklist-and-videotracklist-objects:audiotracklist-12>a href#audiotracklist>AudioTrackList/a>/code> object./p> p>An audio track that has no data for a particular position on the a href#media-timeline idaudiotracklist-and-videotracklist-objects:media-timeline>media timeline/a>, or that does not exist at that position, must be interpreted as being silent at that point on the timeline./p> p>The dfn iddom-videotracklist-selectedindex>code>VideoTrackList.selectedIndex/code>/dfn> attribute must return the index of the currently selected track, if any. If the code idaudiotracklist-and-videotracklist-objects:videotracklist-11>a href#videotracklist>VideoTrackList/a>/code> object does not currently represent any tracks, or if none of the tracks are selected, it must instead return −1./p> p>The dfn iddom-videotrack-selected>code>VideoTrack.selected/code>/dfn> attribute, on getting, must return true if the track is currently selected, and false otherwise. On setting, it must select the track if the new value is true, and unselect it otherwise. If the track is in a code idaudiotracklist-and-videotracklist-objects:videotracklist-12>a href#videotracklist>VideoTrackList/a>/code>, then all the other code idaudiotracklist-and-videotracklist-objects:videotrack-12>a href#videotrack>VideoTrack/a>/code> objects in that list must be unselected. (If the track is no longer in a code idaudiotracklist-and-videotracklist-objects:videotracklist-13>a href#videotracklist>VideoTrackList/a>/code> object, then the track being selected or unselected has no effect beyond changing the value of the attribute on the code idaudiotracklist-and-videotracklist-objects:videotrack-13>a href#videotrack>VideoTrack/a>/code> object.)/p> p idtoggle-video-track>Whenever a track in a code idaudiotracklist-and-videotracklist-objects:videotracklist-14>a href#videotracklist>VideoTrackList/a>/code> that was previously not selected is selected, and whenever the selected track in a code idaudiotracklist-and-videotracklist-objects:videotracklist-15>a href#videotracklist>VideoTrackList/a>/code> is unselected without a new track being selected in its stead, the user agent must a href#queue-a-task idaudiotracklist-and-videotracklist-objects:queue-a-task-2>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idaudiotracklist-and-videotracklist-objects:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idaudiotracklist-and-videotracklist-objects:event-media-change-2>a href#event-media-change>change/a>/code> at the code idaudiotracklist-and-videotracklist-objects:videotracklist-16>a href#videotracklist>VideoTrackList/a>/code> object. This a href#concept-task idaudiotracklist-and-videotracklist-objects:concept-task>task/a> must be a href#queue-a-task idaudiotracklist-and-videotracklist-objects:queue-a-task-3>queued/a> before the a href#concept-task idaudiotracklist-and-videotracklist-objects:concept-task-2>task/a> that fires the code idaudiotracklist-and-videotracklist-objects:event-media-resize>a href#event-media-resize>resize/a>/code> event, if any./p> p>A video track that has no data for a particular position on the a href#media-timeline idaudiotracklist-and-videotracklist-objects:media-timeline-2>media timeline/a> must be interpreted as being a href#transparent-black idaudiotracklist-and-videotracklist-objects:transparent-black>transparent black/a> at that point on the timeline, with the same dimensions as the last frame before that position, or, if the position is before all the data for that track, the same dimensions as the first frame for that track. A track that does not exist at all at the current position must be treated as if it existed but had no data./p> p classexample>For instance, if a video has a track that is only introduced after one hour of playback, and the user selects that track then goes back to the start, then the user agent will act as if that track started at the start of the a href#media-resource idaudiotracklist-and-videotracklist-objects:media-resource-10>media resource/a> but was simply transparent until one hour in./p> hr> p>The following are the a href#event-handlers idaudiotracklist-and-videotracklist-objects:event-handlers>event handlers/a> (and their corresponding a href#event-handler-event-type idaudiotracklist-and-videotracklist-objects:event-handler-event-type>event handler event types/a>) that must be supported, as a href#event-handler-idl-attributes idaudiotracklist-and-videotracklist-objects:event-handler-idl-attributes>event handler IDL attributes/a>, by all objects implementing the code idaudiotracklist-and-videotracklist-objects:audiotracklist-13>a href#audiotracklist>AudioTrackList/a>/code> and code idaudiotracklist-and-videotracklist-objects:videotracklist-17>a href#videotracklist>VideoTrackList/a>/code> interfaces:/p> table>thead>tr>th>a href#event-handlers idaudiotracklist-and-videotracklist-objects:event-handlers-2>Event handler/a> th>a href#event-handler-event-type idaudiotracklist-and-videotracklist-objects:event-handler-event-type-2>Event handler event type/a> tbody>tr>td>dfn idhandler-tracklist-onchange>code>onchange/code>/dfn> td> code idaudiotracklist-and-videotracklist-objects:event-media-change-3>a href#event-media-change>change/a>/code> tr>td>dfn idhandler-tracklist-onaddtrack>code>onaddtrack/code>/dfn> td> code idaudiotracklist-and-videotracklist-objects:event-media-addtrack>a href#event-media-addtrack>addtrack/a>/code> tr>td>dfn idhandler-tracklist-onremovetrack>code>onremovetrack/code>/dfn> td> code idaudiotracklist-and-videotracklist-objects:event-media-removetrack>a href#event-media-removetrack>removetrack/a>/code> /table> h6 idselecting-specific-audio-and-video-tracks-declaratively>span classsecno>4.8.12.10.2/span> Selecting specific audio and video tracks declarativelya href#selecting-specific-audio-and-video-tracks-declaratively classself-link>/a>/h6> p>The code idselecting-specific-audio-and-video-tracks-declaratively:dom-media-audiotracks>a href#dom-media-audiotracks>audioTracks/a>/code> and code idselecting-specific-audio-and-video-tracks-declaratively:dom-media-videotracks>a href#dom-media-videotracks>videoTracks/a>/code> attributes allow scripts to select which track should play, but it is also possible to select specific tracks declaratively, by specifying particular tracks in the a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idselecting-specific-audio-and-video-tracks-declaratively:concept-url-fragment data-x-internalconcept-url-fragment>fragment/a> of the a idselecting-specific-audio-and-video-tracks-declaratively:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the a href#media-resource idselecting-specific-audio-and-video-tracks-declaratively:media-resource>media resource/a>. The format of the a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idselecting-specific-audio-and-video-tracks-declaratively:concept-url-fragment-2 data-x-internalconcept-url-fragment>fragment/a> depends on the a idselecting-specific-audio-and-video-tracks-declaratively:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> of the a href#media-resource idselecting-specific-audio-and-video-tracks-declaratively:media-resource-2>media resource/a>. a href#refsRFC2046>RFC2046/a> a href#refsURL>URL/a>/p> div classexample> p>In this example, a video that uses a format that supports a idselecting-specific-audio-and-video-tracks-declaratively:media-fragment-syntax hrefhttps://www.w3.org/TR/media-frags/#media-fragment-syntax data-x-internalmedia-fragment-syntax>media fragment syntax/a> is embedded in such a way that the alternative angles labeled Alternative are enabled instead of the default video track./p> pre><video srcmyvideo#trackAlternative></video>/pre> /div> h5 idtimed-text-tracks>span classsecno>4.8.12.11/span> Timed text tracksa href#timed-text-tracks classself-link>/a>/h5> h6 idtext-track-model>span classsecno>4.8.12.11.1/span> Text track modela href#text-track-model classself-link>/a>/h6>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id28973 titletrack> elements added with their text track already showing do not run the "time marches on" steps>28973/a>/div> p>A a href#media-element idtext-track-model:media-element>media element/a> can have a group of associated dfn idtext-track>text tracks/dfn>, known as the a href#media-element idtext-track-model:media-element-2>media element/a>s dfn idlist-of-text-tracks>list of text tracks/dfn>. The a href#text-track idtext-track-model:text-track>text tracks/a> are sorted as follows:/p> ol classbrief>li>The a href#text-track idtext-track-model:text-track-2>text tracks/a> corresponding to code idtext-track-model:the-track-element>a href#the-track-element>track/a>/code> element children of the a href#media-element idtext-track-model:media-element-3>media element/a>, in a idtext-track-model:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>.li>Any a href#text-track idtext-track-model:text-track-3>text tracks/a> added using the code idtext-track-model:dom-media-addtexttrack>a href#dom-media-addtexttrack>addTextTrack()/a>/code> method, in the order they were added, oldest first.li>Any a href#media-resource-specific-text-track idtext-track-model:media-resource-specific-text-track>media-resource-specific text tracks/a> (a href#text-track idtext-track-model:text-track-4>text tracks/a> corresponding to data in the a href#media-resource idtext-track-model:media-resource>media resource/a>), in the order defined by the a href#media-resource idtext-track-model:media-resource-2>media resource/a>s format specification./ol> p>A a href#text-track idtext-track-model:text-track-5>text track/a> consists of:/p> dl>dt>dfn idtext-track-kind>The kind of text track/dfn> dd> p>This decides how the track is handled by the user agent. The kind is represented by a string. The possible strings are:/p> ul classbrief>li>dfn iddom-texttrack-kind-subtitles>code>subtitles/code>/dfn> li>dfn iddom-texttrack-kind-captions>code>captions/code>/dfn> li>dfn iddom-texttrack-kind-descriptions>code>descriptions/code>/dfn> li>dfn iddom-texttrack-kind-chapters>code>chapters/code>/dfn> li>dfn iddom-texttrack-kind-metadata>code>metadata/code>/dfn> /ul> p>The a href#text-track-kind idtext-track-model:text-track-kind>kind of track/a> can change dynamically, in the case of a a href#text-track idtext-track-model:text-track-6>text track/a> corresponding to a code idtext-track-model:the-track-element-2>a href#the-track-element>track/a>/code> element./p> dt>dfn idtext-track-label>A label/dfn> dd> p>This is a human-readable string intended to identify the track for the user./p> p>The a href#text-track-label idtext-track-model:text-track-label>label of a track/a> can change dynamically, in the case of a a href#text-track idtext-track-model:text-track-7>text track/a> corresponding to a code idtext-track-model:the-track-element-3>a href#the-track-element>track/a>/code> element./p> p>When a a href#text-track-label idtext-track-model:text-track-label-2>text track label/a> is the empty string, the user agent should automatically generate an appropriate label from the text tracks other properties (e.g. the kind of text track and the text tracks language) for use in its user interface. This automatically-generated label is not exposed in the API./p> dt>dfn idtext-track-in-band-metadata-track-dispatch-type>An in-band metadata track dispatch type/dfn> dd> p>This is a string extracted from the a href#media-resource idtext-track-model:media-resource-3>media resource/a> specifically for in-band metadata tracks to enable such tracks to be dispatched to different scripts in the document./p> p classexample>For example, a traditional TV station broadcast streamed on the Web and augmented with Web-specific interactive features could include text tracks with metadata for ad targeting, trivia game data during game shows, player states during sports games, recipe information during food programs, and so forth. As each program starts and ends, new tracks might be added or removed from the stream, and as each one is added, the user agent could bind them to dedicated script modules using the value of this attribute./p> p>Other than for in-band metadata text tracks, the a href#text-track-in-band-metadata-track-dispatch-type idtext-track-model:text-track-in-band-metadata-track-dispatch-type>in-band metadata track dispatch type/a> is the empty string. How this value is populated for different media formats is described in a href#steps-to-expose-a-media-resource-specific-text-track idtext-track-model:steps-to-expose-a-media-resource-specific-text-track>steps to expose a media-resource-specific text track/a>./p> dt>dfn idtext-track-language>A language/dfn> dd> p>This is a string (a BCP 47 language tag) representing the language of the text tracks cues. a href#refsBCP47>BCP47/a>/p> p>The a href#text-track-language idtext-track-model:text-track-language>language of a text track/a> can change dynamically, in the case of a a href#text-track idtext-track-model:text-track-8>text track/a> corresponding to a code idtext-track-model:the-track-element-4>a href#the-track-element>track/a>/code> element./p> dt>dfn idtext-track-readiness-state>A readiness state/dfn> dd> p>One of the following:/p> dl>dt>dfn idtext-track-not-loaded>Not loaded/dfn> dd> p>Indicates that the text tracks cues have not been obtained./p> dt>dfn idtext-track-loading>Loading/dfn> dd> p>Indicates that the text track is loading and there have been no fatal errors encountered so far. Further cues might still be added to the track by the parser./p> dt>dfn idtext-track-loaded>Loaded/dfn> dd> p>Indicates that the text track has been loaded with no fatal errors./p> dt>dfn idtext-track-failed-to-load>Failed to load/dfn> dd> p>Indicates that the text track was enabled, but when the user agent attempted to obtain it, this failed in some way (e.g. a idtext-track-model:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> could not be a href#parse-a-url idtext-track-model:parse-a-url>parsed/a>, network error, unknown text track format). Some or all of the cues are likely missing and will not be obtained./p> /dl> p>The a href#text-track-readiness-state idtext-track-model:text-track-readiness-state>readiness state/a> of a a href#text-track idtext-track-model:text-track-9>text track/a> changes dynamically as the track is obtained./p> dt>dfn idtext-track-mode>A mode/dfn> dd> p>One of the following:/p> dl>dt>dfn idtext-track-disabled>Disabled/dfn> dd> p>Indicates that the text track is not active. Other than for the purposes of exposing the track in the DOM, the user agent is ignoring the text track. No cues are active, no events are fired, and the user agent will not attempt to obtain the tracks cues./p> dt>dfn idtext-track-hidden>Hidden/dfn> dd> p>Indicates that the text track is active, but that the user agent is not actively displaying the cues. If no attempt has yet been made to obtain the tracks cues, the user agent will perform such an attempt momentarily. The user agent is maintaining a list of which cues are active, and events are being fired accordingly./p> dt>dfn idtext-track-showing>Showing/dfn> dd> p>Indicates that the text track is active. If no attempt has yet been made to obtain the tracks cues, the user agent will perform such an attempt momentarily. The user agent is maintaining a list of which cues are active, and events are being fired accordingly. In addition, for text tracks whose a href#text-track-kind idtext-track-model:text-track-kind-2>kind/a> is code idtext-track-model:dom-texttrack-kind-subtitles>a href#dom-texttrack-kind-subtitles>subtitles/a>/code> or code idtext-track-model:dom-texttrack-kind-captions>a href#dom-texttrack-kind-captions>captions/a>/code>, the cues are being overlaid on the video as appropriate; for text tracks whose a href#text-track-kind idtext-track-model:text-track-kind-3>kind/a> is code idtext-track-model:dom-texttrack-kind-descriptions>a href#dom-texttrack-kind-descriptions>descriptions/a>/code>, the user agent is making the cues available to the user in a non-visual fashion; and for text tracks whose a href#text-track-kind idtext-track-model:text-track-kind-4>kind/a> is code idtext-track-model:dom-texttrack-kind-chapters>a href#dom-texttrack-kind-chapters>chapters/a>/code>, the user agent is making available to the user a mechanism by which the user can navigate to any point in the a href#media-resource idtext-track-model:media-resource-4>media resource/a> by selecting a cue./p> /dl> dt>dfn idtext-track-list-of-cues>A list of zero or more cues/dfn> dd> p>A list of a href#text-track-cue idtext-track-model:text-track-cue>text track cues/a>, along with dfn idrules-for-updating-the-text-track-rendering>rules for updating the text track rendering/dfn>. For example, for WebVTT, the a idtext-track-model:rules-for-updating-the-display-of-webvtt-text-tracks hrefhttps://w3c.github.io/webvtt/#rules-for-updating-the-display-of-webvtt-text-tracks data-x-internalrules-for-updating-the-display-of-webvtt-text-tracks>rules for updating the display of WebVTT text tracks/a>. a href#refsWEBVTT>WEBVTT/a> /p> p>The a href#text-track-list-of-cues idtext-track-model:text-track-list-of-cues>list of cues of a text track/a> can change dynamically, either because the a href#text-track idtext-track-model:text-track-10>text track/a> has a href#text-track-not-loaded idtext-track-model:text-track-not-loaded>not yet been loaded/a> or is still a href#text-track-loading idtext-track-model:text-track-loading>loading/a>, or due to DOM manipulation./p> /dl> p>Each a href#text-track idtext-track-model:text-track-11>text track/a> has a corresponding code idtext-track-model:texttrack>a href#texttrack>TextTrack/a>/code> object./p> hr> p>Each a href#media-element idtext-track-model:media-element-4>media element/a> has a dfn idlist-of-pending-text-tracks>list of pending text tracks/dfn>, which must initially be empty, a dfn idblocked-on-parser>blocked-on-parser/dfn> flag, which must initially be false, and a dfn iddid-perform-automatic-track-selection>did-perform-automatic-track-selection/dfn> flag, which must also initially be false./p> p>When the user agent is required to dfn idpopulate-the-list-of-pending-text-tracks>populate the list of pending text tracks/dfn> of a a href#media-element idtext-track-model:media-element-5>media element/a>, the user agent must add to the elements a href#list-of-pending-text-tracks idtext-track-model:list-of-pending-text-tracks>list of pending text tracks/a> each a href#text-track idtext-track-model:text-track-12>text track/a> in the elements a href#list-of-text-tracks idtext-track-model:list-of-text-tracks>list of text tracks/a> whose a href#text-track-mode idtext-track-model:text-track-mode>text track mode/a> is not a href#text-track-disabled idtext-track-model:text-track-disabled>disabled/a> and whose a href#text-track-readiness-state idtext-track-model:text-track-readiness-state-2>text track readiness state/a> is a href#text-track-loading idtext-track-model:text-track-loading-2>loading/a>./p> p>Whenever a code idtext-track-model:the-track-element-5>a href#the-track-element>track/a>/code> elements parent node changes, the user agent must remove the corresponding a href#text-track idtext-track-model:text-track-13>text track/a> from any a href#list-of-pending-text-tracks idtext-track-model:list-of-pending-text-tracks-2>list of pending text tracks/a> that it is in./p> p>Whenever a a href#text-track idtext-track-model:text-track-14>text track/a>s a href#text-track-readiness-state idtext-track-model:text-track-readiness-state-3>text track readiness state/a> changes to either a href#text-track-loaded idtext-track-model:text-track-loaded>loaded/a> or a href#text-track-failed-to-load idtext-track-model:text-track-failed-to-load>failed to load/a>, the user agent must remove it from any a href#list-of-pending-text-tracks idtext-track-model:list-of-pending-text-tracks-3>list of pending text tracks/a> that it is in./p> p>When a a href#media-element idtext-track-model:media-element-6>media element/a> is created by an a href#html-parser idtext-track-model:html-parser>HTML parser/a> or a href#xml-parser idtext-track-model:xml-parser>XML parser/a>, the user agent must set the elements a href#blocked-on-parser idtext-track-model:blocked-on-parser>blocked-on-parser/a> flag to true. When a a href#media-element idtext-track-model:media-element-7>media element/a> is popped off the a href#stack-of-open-elements idtext-track-model:stack-of-open-elements>stack of open elements/a> of an a href#html-parser idtext-track-model:html-parser-2>HTML parser/a> or a href#xml-parser idtext-track-model:xml-parser-2>XML parser/a>, the user agent must a href#honor-user-preferences-for-automatic-text-track-selection idtext-track-model:honor-user-preferences-for-automatic-text-track-selection>honor user preferences for automatic text track selection/a>, a href#populate-the-list-of-pending-text-tracks idtext-track-model:populate-the-list-of-pending-text-tracks>populate the list of pending text tracks/a>, and set the elements a href#blocked-on-parser idtext-track-model:blocked-on-parser-2>blocked-on-parser/a> flag to false./p> p>The a href#text-track idtext-track-model:text-track-15>text tracks/a> of a a href#media-element idtext-track-model:media-element-8>media element/a> are dfn idthe-text-tracks-are-ready>ready/dfn> when both the elements a href#list-of-pending-text-tracks idtext-track-model:list-of-pending-text-tracks-4>list of pending text tracks/a> is empty and the elements a href#blocked-on-parser idtext-track-model:blocked-on-parser-3>blocked-on-parser/a> flag is false./p> p>Each a href#media-element idtext-track-model:media-element-9>media element/a> has a dfn idpending-text-track-change-notification-flag>pending text track change notification flag/dfn>, which must initially be unset./p> p>Whenever a a href#text-track idtext-track-model:text-track-16>text track/a> that is in a a href#media-element idtext-track-model:media-element-10>media element/a>s a href#list-of-text-tracks idtext-track-model:list-of-text-tracks-2>list of text tracks/a> has its a href#text-track-mode idtext-track-model:text-track-mode-2>text track mode/a> change value, the user agent must run the following steps for the a href#media-element idtext-track-model:media-element-11>media element/a>:/p> ol>li>p>If the a href#media-element idtext-track-model:media-element-12>media element/a>s a href#pending-text-track-change-notification-flag idtext-track-model:pending-text-track-change-notification-flag>pending text track change notification flag/a> is set, abort these steps.li>p>Set the a href#media-element idtext-track-model:media-element-13>media element/a>s a href#pending-text-track-change-notification-flag idtext-track-model:pending-text-track-change-notification-flag-2>pending text track change notification flag/a>.li> p>a href#queue-a-task idtext-track-model:queue-a-task>Queue a task/a> to run these steps:/p> ol>li>p>Unset the a href#media-element idtext-track-model:media-element-14>media element/a>s a href#pending-text-track-change-notification-flag idtext-track-model:pending-text-track-change-notification-flag-3>pending text track change notification flag/a>.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idtext-track-model:concept-event-fire data-x-internalconcept-event-fire>Fire an event/a> named code idtext-track-model:event-media-change>a href#event-media-change>change/a>/code> at the a href#media-element idtext-track-model:media-element-15>media element/a>s code idtext-track-model:dom-media-texttracks>a href#dom-media-texttracks>textTracks/a>/code> attributes code idtext-track-model:texttracklist>a href#texttracklist>TextTrackList/a>/code> object./ol> li>p>If the a href#media-element idtext-track-model:media-element-16>media element/a>s a href#show-poster-flag idtext-track-model:show-poster-flag>show poster flag/a> is not set, run the i idtext-track-model:time-marches-on>a href#time-marches-on>time marches on/a>/i> steps./ol> p>The a href#task-source idtext-track-model:task-source>task source/a> for the a href#concept-task idtext-track-model:concept-task>tasks/a> listed in this section is the a href#dom-manipulation-task-source idtext-track-model:dom-manipulation-task-source>DOM manipulation task source/a>./p> hr> p>A dfn idtext-track-cue>text track cue/dfn> is the unit of time-sensitive data in a a href#text-track idtext-track-model:text-track-17>text track/a>, corresponding for instance for subtitles and captions to the text that appears at a particular time and disappears at another time./p> p>Each a href#text-track-cue idtext-track-model:text-track-cue-2>text track cue/a> consists of:/p> dl>dt>dfn idtext-track-cue-identifier>An identifier/dfn> dd> p>An arbitrary string./p> dt>dfn idtext-track-cue-start-time>A start time/dfn> dd> p>The time, in seconds and fractions of a second, that describes the beginning of the range of the a href#media-data idtext-track-model:media-data>media data/a> to which the cue applies./p> dt>dfn idtext-track-cue-end-time>An end time/dfn> dd> p>The time, in seconds and fractions of a second, that describes the end of the range of the a href#media-data idtext-track-model:media-data-2>media data/a> to which the cue applies./p> dt>dfn idtext-track-cue-pause-on-exit-flag>A pause-on-exit flag/dfn> dd> p>A boolean indicating whether playback of the a href#media-resource idtext-track-model:media-resource-5>media resource/a> is to pause when the end of the range to which the cue applies is reached./p> dt>Some additional format-specific datadd> p>Additional fields, as needed for the format, including the actual data of the cue. For example, WebVTT has a a idtext-track-model:text-track-cue-writing-direction hrefhttps://w3c.github.io/webvtt/#webvtt-cue-writing-direction data-x-internaltext-track-cue-writing-direction>text track cue writing direction/a> and so forth. a href#refsWEBVTT>WEBVTT/a>/p> /dl> p classnote>The a href#text-track-cue-start-time idtext-track-model:text-track-cue-start-time>text track cue start time/a> and a href#text-track-cue-end-time idtext-track-model:text-track-cue-end-time>text track cue end time/a> can be negative. (The a href#current-playback-position idtext-track-model:current-playback-position>current playback position/a> can never be negative, though, so cues entirely before time zero cannot be active.)/p> p>Each a href#text-track-cue idtext-track-model:text-track-cue-3>text track cue/a> has a corresponding code idtext-track-model:texttrackcue>a href#texttrackcue>TextTrackCue/a>/code> object (or more specifically, an object that inherits from code idtext-track-model:texttrackcue-2>a href#texttrackcue>TextTrackCue/a>/code> — for example, WebVTT cues use the code idtext-track-model:vttcue>a data-x-internalvttcue hrefhttps://w3c.github.io/webvtt/#vttcue>VTTCue/a>/code> interface). A a href#text-track-cue idtext-track-model:text-track-cue-4>text track cue/a>s in-memory representation can be dynamically changed through this code idtext-track-model:texttrackcue-3>a href#texttrackcue>TextTrackCue/a>/code> API. a href#refsWEBVTT>WEBVTT/a>/p> p>A a href#text-track-cue idtext-track-model:text-track-cue-5>text track cue/a> is associated with a href#rules-for-updating-the-text-track-rendering idtext-track-model:rules-for-updating-the-text-track-rendering>rules for updating the text track rendering/a>, as defined by the specification for the specific kind of a href#text-track-cue idtext-track-model:text-track-cue-6>text track cue/a>. These rules are used specifically when the object representing the cue is added to a code idtext-track-model:texttrack-2>a href#texttrack>TextTrack/a>/code> object using the code idtext-track-model:dom-texttrack-addcue>a href#dom-texttrack-addcue>addCue()/a>/code> method./p> p>In addition, each a href#text-track-cue idtext-track-model:text-track-cue-7>text track cue/a> has two pieces of dynamic information:/p> dl>dt>The dfn idtext-track-cue-active-flag>active flag/dfn> dd> p>This flag must be initially unset. The flag is used to ensure events are fired appropriately when the cue becomes active or inactive, and to make sure the right cues are rendered./p> p>The user agent must synchronously unset this flag whenever the a href#text-track-cue idtext-track-model:text-track-cue-8>text track cue/a> is removed from its a href#text-track idtext-track-model:text-track-18>text track/a>s a href#text-track-list-of-cues idtext-track-model:text-track-list-of-cues-2>text track list of cues/a>; whenever the a href#text-track idtext-track-model:text-track-19>text track/a> itself is removed from its a href#media-element idtext-track-model:media-element-17>media element/a>s a href#list-of-text-tracks idtext-track-model:list-of-text-tracks-3>list of text tracks/a> or has its a href#text-track-mode idtext-track-model:text-track-mode-3>text track mode/a> changed to a href#text-track-disabled idtext-track-model:text-track-disabled-2>disabled/a>; and whenever the a href#media-element idtext-track-model:media-element-18>media element/a>s code idtext-track-model:dom-media-readystate>a href#dom-media-readystate>readyState/a>/code> is changed back to code idtext-track-model:dom-media-have_nothing>a href#dom-media-have_nothing>HAVE_NOTHING/a>/code>. When the flag is unset in this way for one or more cues in a href#text-track idtext-track-model:text-track-20>text tracks/a> that were a href#text-track-showing idtext-track-model:text-track-showing>showing/a> prior to the relevant incident, the user agent must, after having unset the flag for all the affected cues, apply the a href#rules-for-updating-the-text-track-rendering idtext-track-model:rules-for-updating-the-text-track-rendering-2>rules for updating the text track rendering/a> of those a href#text-track idtext-track-model:text-track-21>text tracks/a>. For example, for a href#text-track idtext-track-model:text-track-22>text tracks/a> based on WebVTT, the a idtext-track-model:rules-for-updating-the-display-of-webvtt-text-tracks-2 hrefhttps://w3c.github.io/webvtt/#rules-for-updating-the-display-of-webvtt-text-tracks data-x-internalrules-for-updating-the-display-of-webvtt-text-tracks>rules for updating the display of WebVTT text tracks/a>. a href#refsWEBVTT>WEBVTT/a>/p> dt>The dfn idtext-track-cue-display-state>display state/dfn> dd> p>This is used as part of the rendering model, to keep cues in a consistent position. It must initially be empty. Whenever the a href#text-track-cue-active-flag idtext-track-model:text-track-cue-active-flag>text track cue active flag/a> is unset, the user agent must empty the a href#text-track-cue-display-state idtext-track-model:text-track-cue-display-state>text track cue display state/a>./p> /dl> p>The a href#text-track-cue idtext-track-model:text-track-cue-9>text track cues/a> of a a href#media-element idtext-track-model:media-element-19>media element/a>s a href#text-track idtext-track-model:text-track-23>text tracks/a> are ordered relative to each other in the dfn idtext-track-cue-order>text track cue order/dfn>, which is determined as follows: first group the a href#text-track-cue idtext-track-model:text-track-cue-10>cues/a> by their a href#text-track idtext-track-model:text-track-24>text track/a>, with the groups being sorted in the same order as their a href#text-track idtext-track-model:text-track-25>text tracks/a> appear in the a href#media-element idtext-track-model:media-element-20>media element/a>s a href#list-of-text-tracks idtext-track-model:list-of-text-tracks-4>list of text tracks/a>; then, within each group, a href#text-track-cue idtext-track-model:text-track-cue-11>cues/a> must be sorted by their a href#text-track-cue-start-time idtext-track-model:text-track-cue-start-time-2>start time/a>, earliest first; then, any a href#text-track-cue idtext-track-model:text-track-cue-12>cues/a> with the same a href#text-track-cue-start-time idtext-track-model:text-track-cue-start-time-3>start time/a> must be sorted by their a href#text-track-cue-end-time idtext-track-model:text-track-cue-end-time-2>end time/a>, latest first; and finally, any a href#text-track-cue idtext-track-model:text-track-cue-13>cues/a> with identical a href#text-track-cue-end-time idtext-track-model:text-track-cue-end-time-3>end times/a> must be sorted in the order they were last added to their respective a href#text-track-list-of-cues idtext-track-model:text-track-list-of-cues-3>text track list of cues/a>, oldest first (so e.g. for cues from a WebVTT file, that would initially be the order in which the cues were listed in the file). a href#refsWEBVTT>WEBVTT/a>/p> h6 idsourcing-in-band-text-tracks>span classsecno>4.8.12.11.2/span> Sourcing in-band text tracksa href#sourcing-in-band-text-tracks classself-link>/a>/h6> p>A dfn idmedia-resource-specific-text-track>media-resource-specific text track/dfn> is a a href#text-track idsourcing-in-band-text-tracks:text-track>text track/a> that corresponds to data found in the a href#media-resource idsourcing-in-band-text-tracks:media-resource>media resource/a>./p> p>Rules for processing and rendering such data are defined by the relevant specifications, e.g. the specification of the video format if the a href#media-resource idsourcing-in-band-text-tracks:media-resource-2>media resource/a> is a video. Details for some legacy formats can be found in the cite>Sourcing In-band Media Resource Tracks from Media Containers into HTML/cite> specification. a href#refsINBAND>INBAND/a>/p> p>When a a href#media-resource idsourcing-in-band-text-tracks:media-resource-3>media resource/a> contains data that the user agent recognizes and supports as being equivalent to a a href#text-track idsourcing-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 idsteps-to-expose-a-media-resource-specific-text-track>steps to expose a media-resource-specific text track/dfn> with the relevant data, as follows./p> ol>li>p>Associate the relevant data with a new a href#text-track idsourcing-in-band-text-tracks:text-track-3>text track/a> and its corresponding new code idsourcing-in-band-text-tracks:texttrack>a href#texttrack>TextTrack/a>/code> object. The a href#text-track idsourcing-in-band-text-tracks:text-track-4>text track/a> is a a href#media-resource-specific-text-track idsourcing-in-band-text-tracks:media-resource-specific-text-track>media-resource-specific text track/a>.li>p>Set the new a href#text-track idsourcing-in-band-text-tracks:text-track-5>text track/a>s a href#text-track-kind idsourcing-in-band-text-tracks:text-track-kind>kind/a>, a href#text-track-label idsourcing-in-band-text-tracks:text-track-label>label/a>, and a href#text-track-language idsourcing-in-band-text-tracks:text-track-language>language/a> based on the semantics of the relevant data, as defined by the relevant specification. If there is no label in that data, then the a href#text-track-label idsourcing-in-band-text-tracks:text-track-label-2>label/a> must be set to the empty string.li>p>Associate the a href#text-track-list-of-cues idsourcing-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 idsourcing-in-band-text-tracks:rules-for-updating-the-text-track-rendering>rules for updating the text track rendering/a> appropriate for the format in question./p> li> p>If the new a href#text-track idsourcing-in-band-text-tracks:text-track-6>text track/a>s a href#text-track-kind idsourcing-in-band-text-tracks:text-track-kind-2>kind/a> is code idsourcing-in-band-text-tracks:dom-texttrack-kind-chapters>a href#dom-texttrack-kind-chapters>chapters/a>/code> or code idsourcing-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 idsourcing-in-band-text-tracks:text-track-in-band-metadata-track-dispatch-type>text track in-band metadata track dispatch type/a> as follows, based on the type of the a href#media-resource idsourcing-in-band-text-tracks:media-resource-4>media resource/a>:/p> dl classswitch>dt>If the a href#media-resource idsourcing-in-band-text-tracks:media-resource-5>media resource/a> is an Ogg filedd>The a href#text-track-in-band-metadata-track-dispatch-type idsourcing-in-band-text-tracks:text-track-in-band-metadata-track-dispatch-type-2>text track in-band metadata track dispatch type/a> must be set to the value of the Name header field. a href#refsOGGSKELETONHEADERS>OGGSKELETONHEADERS/a>dt>If the a href#media-resource idsourcing-in-band-text-tracks:media-resource-6>media resource/a> is a WebM filedd>The a href#text-track-in-band-metadata-track-dispatch-type idsourcing-in-band-text-tracks:text-track-in-band-metadata-track-dispatch-type-3>text track in-band metadata track dispatch type/a> must be set to the value of the code>CodecID/code> element. a href#refsWEBMCG>WEBMCG/a>dt>If the a href#media-resource idsourcing-in-band-text-tracks:media-resource-7>media resource/a> is an MPEG-2 filedd>Let var>stream type/var> be the value of the stream_type field describing the text tracks type in the files program map section, interpreted as an 8-bit unsigned integer. Let var>length/var> be the value of the ES_info_length field for the track in the same part of the program map section, interpreted as an integer as defined by the MPEG-2 specification. Let var>descriptor bytes/var> be the var>length/var> bytes following the ES_info_length field. The a href#text-track-in-band-metadata-track-dispatch-type idsourcing-in-band-text-tracks:text-track-in-band-metadata-track-dispatch-type-4>text track in-band metadata track dispatch type/a> must be set to the concatenation of the var>stream type/var> byte and the zero or more var>descriptor bytes/var> bytes, expressed in hexadecimal using a hrefhttps://infra.spec.whatwg.org/#ascii-upper-hex-digit idsourcing-in-band-text-tracks:uppercase-ascii-hex-digits data-x-internaluppercase-ascii-hex-digits>ASCII upper hex digits/a>. a href#refsMPEG2>MPEG2/a> dt>If the a href#media-resource idsourcing-in-band-text-tracks:media-resource-8>media resource/a> is an MPEG-4 filedd>Let the first code>stsd/code> box of the first code>stbl/code> box of the first code>minf/code> box of the first code>mdia/code> box of the a href#text-track idsourcing-in-band-text-tracks:text-track-7>text track/a>s code>trak/code> box in the first code>moov/code> box of the file be the i>stsd box/i>, if any. If the file has no i>stsd box/i>, or if the i>stsd box/i> has neither a code>mett/code> box nor a code>metx/code> box, then the a href#text-track-in-band-metadata-track-dispatch-type idsourcing-in-band-text-tracks:text-track-in-band-metadata-track-dispatch-type-5>text track in-band metadata track dispatch type/a> must be set to the empty string. Otherwise, if the i>stsd box/i> has a code>mett/code> box then the a href#text-track-in-band-metadata-track-dispatch-type idsourcing-in-band-text-tracks:text-track-in-band-metadata-track-dispatch-type-6>text track in-band metadata track dispatch type/a> must be set to the concatenation of the string code>mett/code>, a U+0020 SPACE character, and the value of the first code>mime_format/code> field of the first code>mett/code> box of the i>stsd box/i>, or the empty string if that field is absent in that box. Otherwise, if the i>stsd box/i> has no code>mett/code> box but has a code>metx/code> box then the a href#text-track-in-band-metadata-track-dispatch-type idsourcing-in-band-text-tracks:text-track-in-band-metadata-track-dispatch-type-7>text track in-band metadata track dispatch type/a> must be set to the concatenation of the string code>metx/code>, a U+0020 SPACE character, and the value of the first code>namespace/code> field of the first code>metx/code> box of the i>stsd box/i>, or the empty string if that field is absent in that box. a href#refsMPEG4>MPEG4/a> /dl> li>p>Populate the new a href#text-track idsourcing-in-band-text-tracks:text-track-8>text track/a>s a href#text-track-list-of-cues idsourcing-in-band-text-tracks:text-track-list-of-cues-2>list of cues/a> with the cues parsed so far, following the a href#guidelines-for-exposing-cues-in-various-formats-as-text-track-cues idsourcing-in-band-text-tracks:guidelines-for-exposing-cues-in-various-formats-as-text-track-cues>guidelines for exposing cues/a>, and begin updating it dynamically as necessary.li>p>Set the new a href#text-track idsourcing-in-band-text-tracks:text-track-9>text track/a>s a href#text-track-readiness-state idsourcing-in-band-text-tracks:text-track-readiness-state>readiness state/a> to a href#text-track-loaded idsourcing-in-band-text-tracks:text-track-loaded>loaded/a>.li>p>Set the new a href#text-track idsourcing-in-band-text-tracks:text-track-10>text track/a>s a href#text-track-mode idsourcing-in-band-text-tracks:text-track-mode>mode/a> to the mode consistent with the users preferences and the requirements of the relevant specification for the data./p> p classnote>For instance, if there are no other active subtitles, and this is a forced subtitle track (a subtitle track giving subtitles in the audio tracks primary language, but only for audio that is actually in another language), then those subtitles might be activated here./p> li>p>Add the new a href#text-track idsourcing-in-band-text-tracks:text-track-11>text track/a> to the a href#media-element idsourcing-in-band-text-tracks:media-element>media element/a>s a href#list-of-text-tracks idsourcing-in-band-text-tracks:list-of-text-tracks>list of text tracks/a>.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idsourcing-in-band-text-tracks:concept-event-fire data-x-internalconcept-event-fire>Fire an event/a> named code idsourcing-in-band-text-tracks:event-media-addtrack>a href#event-media-addtrack>addtrack/a>/code> at the a href#media-element idsourcing-in-band-text-tracks:media-element-2>media element/a>s code idsourcing-in-band-text-tracks:dom-media-texttracks>a href#dom-media-texttracks>textTracks/a>/code> attributes code idsourcing-in-band-text-tracks:texttracklist>a href#texttracklist>TextTrackList/a>/code> object, using code idsourcing-in-band-text-tracks:trackevent>a href#trackevent>TrackEvent/a>/code>, with the code idsourcing-in-band-text-tracks:dom-trackevent-track>a href#dom-trackevent-track>track/a>/code> attribute initialized to the a href#text-track idsourcing-in-band-text-tracks:text-track-12>text track/a>s code idsourcing-in-band-text-tracks:texttrack-2>a href#texttrack>TextTrack/a>/code> object./ol> h6 idsourcing-out-of-band-text-tracks>span classsecno>4.8.12.11.3/span> Sourcing out-of-band text tracksa href#sourcing-out-of-band-text-tracks classself-link>/a>/h6> p>When a code idsourcing-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 idsourcing-out-of-band-text-tracks:text-track>text track/a> (with its value set as defined below) and its corresponding new code idsourcing-out-of-band-text-tracks:texttrack>a href#texttrack>TextTrack/a>/code> object./p> p>The a href#text-track-kind idsourcing-out-of-band-text-tracks:text-track-kind>text track kind/a> is determined from the state of the elements code idsourcing-out-of-band-text-tracks:attr-track-kind>a href#attr-track-kind>kind/a>/code> attribute according to the following table; for a state given in a cell of the first column, the a href#text-track-kind idsourcing-out-of-band-text-tracks:text-track-kind-2>kind/a> is the string given in the second column:/p> table>thead>tr>th>State th>String tbody>tr>td>a href#attr-track-kind-subtitles idsourcing-out-of-band-text-tracks:attr-track-kind-subtitles>Subtitles/a> td>code idsourcing-out-of-band-text-tracks:dom-texttrack-kind-subtitles>a href#dom-texttrack-kind-subtitles>subtitles/a>/code> tr>td>a href#attr-track-kind-captions idsourcing-out-of-band-text-tracks:attr-track-kind-captions>Captions/a> td>code idsourcing-out-of-band-text-tracks:dom-texttrack-kind-captions>a href#dom-texttrack-kind-captions>captions/a>/code> tr>td>a href#attr-track-kind-descriptions idsourcing-out-of-band-text-tracks:attr-track-kind-descriptions>Descriptions/a> td>code idsourcing-out-of-band-text-tracks:dom-texttrack-kind-descriptions>a href#dom-texttrack-kind-descriptions>descriptions/a>/code> tr>td>a href#attr-track-kind-chapters idsourcing-out-of-band-text-tracks:attr-track-kind-chapters>Chapters metadata/a> td>code idsourcing-out-of-band-text-tracks:dom-texttrack-kind-chapters>a href#dom-texttrack-kind-chapters>chapters/a>/code> tr>td>a href#attr-track-kind-metadata idsourcing-out-of-band-text-tracks:attr-track-kind-metadata>Metadata/a> td>code idsourcing-out-of-band-text-tracks:dom-texttrack-kind-metadata>a href#dom-texttrack-kind-metadata>metadata/a>/code> /table> p>The a href#text-track-label idsourcing-out-of-band-text-tracks:text-track-label>text track label/a> is the elements a href#track-label idsourcing-out-of-band-text-tracks:track-label>track label/a>./p> p>The a href#text-track-language idsourcing-out-of-band-text-tracks:text-track-language>text track language/a> is the elements a href#track-language idsourcing-out-of-band-text-tracks:track-language>track language/a>, if any, or the empty string otherwise./p> p>As the code idsourcing-out-of-band-text-tracks:attr-track-kind-2>a href#attr-track-kind>kind/a>/code>, code idsourcing-out-of-band-text-tracks:attr-track-label>a href#attr-track-label>label/a>/code>, and code idsourcing-out-of-band-text-tracks:attr-track-srclang>a href#attr-track-srclang>srclang/a>/code> attributes are set, changed, or removed, the a href#text-track idsourcing-out-of-band-text-tracks:text-track-2>text track/a> must update accordingly, as per the definitions above./p> p classnote>Changes to the a href#track-url idsourcing-out-of-band-text-tracks:track-url>track URL/a> are handled in the algorithm below./p> p>The a href#text-track-readiness-state idsourcing-out-of-band-text-tracks:text-track-readiness-state>text track readiness state/a> is initially a href#text-track-not-loaded idsourcing-out-of-band-text-tracks:text-track-not-loaded>not loaded/a>, and the a href#text-track-mode idsourcing-out-of-band-text-tracks:text-track-mode>text track mode/a> is initially a href#text-track-disabled idsourcing-out-of-band-text-tracks:text-track-disabled>disabled/a>./p> p>The a href#text-track-list-of-cues idsourcing-out-of-band-text-tracks:text-track-list-of-cues>text track list of cues/a> is initially empty. It is dynamically modified when the referenced file is parsed. Associated with the list are the a href#rules-for-updating-the-text-track-rendering idsourcing-out-of-band-text-tracks:rules-for-updating-the-text-track-rendering>rules for updating the text track rendering/a> appropriate for the format in question; for WebVTT, this is the a idsourcing-out-of-band-text-tracks:rules-for-updating-the-display-of-webvtt-text-tracks hrefhttps://w3c.github.io/webvtt/#rules-for-updating-the-display-of-webvtt-text-tracks data-x-internalrules-for-updating-the-display-of-webvtt-text-tracks>rules for updating the display of WebVTT text tracks/a>. a href#refsWEBVTT>WEBVTT/a>/p> p>When a code idsourcing-out-of-band-text-tracks:the-track-element-2>a href#the-track-element>track/a>/code> elements parent element changes and the new parent is a a href#media-element idsourcing-out-of-band-text-tracks:media-element>media element/a>, then the user agent must add the code idsourcing-out-of-band-text-tracks:the-track-element-3>a href#the-track-element>track/a>/code> elements corresponding a href#text-track idsourcing-out-of-band-text-tracks:text-track-3>text track/a> to the a href#media-element idsourcing-out-of-band-text-tracks:media-element-2>media element/a>s a href#list-of-text-tracks idsourcing-out-of-band-text-tracks:list-of-text-tracks>list of text tracks/a>, and then a href#queue-a-task idsourcing-out-of-band-text-tracks:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idsourcing-out-of-band-text-tracks:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idsourcing-out-of-band-text-tracks:event-media-addtrack>a href#event-media-addtrack>addtrack/a>/code> at the a href#media-element idsourcing-out-of-band-text-tracks:media-element-3>media element/a>s code idsourcing-out-of-band-text-tracks:dom-media-texttracks>a href#dom-media-texttracks>textTracks/a>/code> attributes code idsourcing-out-of-band-text-tracks:texttracklist>a href#texttracklist>TextTrackList/a>/code> object, using code idsourcing-out-of-band-text-tracks:trackevent>a href#trackevent>TrackEvent/a>/code>, with the code idsourcing-out-of-band-text-tracks:dom-trackevent-track>a href#dom-trackevent-track>track/a>/code> attribute initialized to the a href#text-track idsourcing-out-of-band-text-tracks:text-track-4>text track/a>s code idsourcing-out-of-band-text-tracks:texttrack-2>a href#texttrack>TextTrack/a>/code> object./p> p>When a code idsourcing-out-of-band-text-tracks:the-track-element-4>a href#the-track-element>track/a>/code> elements parent element changes and the old parent was a a href#media-element idsourcing-out-of-band-text-tracks:media-element-4>media element/a>, then the user agent must remove the code idsourcing-out-of-band-text-tracks:the-track-element-5>a href#the-track-element>track/a>/code> elements corresponding a href#text-track idsourcing-out-of-band-text-tracks:text-track-5>text track/a> from the a href#media-element idsourcing-out-of-band-text-tracks:media-element-5>media element/a>s a href#list-of-text-tracks idsourcing-out-of-band-text-tracks:list-of-text-tracks-2>list of text tracks/a>, and then a href#queue-a-task idsourcing-out-of-band-text-tracks:queue-a-task-2>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idsourcing-out-of-band-text-tracks:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idsourcing-out-of-band-text-tracks:event-media-removetrack>a href#event-media-removetrack>removetrack/a>/code> at the a href#media-element idsourcing-out-of-band-text-tracks:media-element-6>media element/a>s code idsourcing-out-of-band-text-tracks:dom-media-texttracks-2>a href#dom-media-texttracks>textTracks/a>/code> attributes code idsourcing-out-of-band-text-tracks:texttracklist-2>a href#texttracklist>TextTrackList/a>/code> object, using code idsourcing-out-of-band-text-tracks:trackevent-2>a href#trackevent>TrackEvent/a>/code>, with the code idsourcing-out-of-band-text-tracks:dom-trackevent-track-2>a href#dom-trackevent-track>track/a>/code> attribute initialized to the a href#text-track idsourcing-out-of-band-text-tracks:text-track-6>text track/a>s code idsourcing-out-of-band-text-tracks:texttrack-3>a href#texttrack>TextTrack/a>/code> object./p> hr> p>When a a href#text-track idsourcing-out-of-band-text-tracks:text-track-7>text track/a> corresponding to a code idsourcing-out-of-band-text-tracks:the-track-element-6>a href#the-track-element>track/a>/code> element is added to a a href#media-element idsourcing-out-of-band-text-tracks:media-element-7>media element/a>s a href#list-of-text-tracks idsourcing-out-of-band-text-tracks:list-of-text-tracks-3>list of text tracks/a>, the user agent must a href#queue-a-task idsourcing-out-of-band-text-tracks:queue-a-task-3>queue a task/a> to run the following steps for the a href#media-element idsourcing-out-of-band-text-tracks:media-element-8>media element/a>:/p> ol>li>p>If the elements a href#blocked-on-parser idsourcing-out-of-band-text-tracks:blocked-on-parser>blocked-on-parser/a> flag is true, abort these steps.li>p>If the elements a href#did-perform-automatic-track-selection idsourcing-out-of-band-text-tracks:did-perform-automatic-track-selection>did-perform-automatic-track-selection/a> flag is true, abort these steps.li>p>a href#honor-user-preferences-for-automatic-text-track-selection idsourcing-out-of-band-text-tracks:honor-user-preferences-for-automatic-text-track-selection>Honor user preferences for automatic text track selection/a> for this element./ol> p>When the user agent is required to dfn idhonor-user-preferences-for-automatic-text-track-selection>honor user preferences for automatic text track selection/dfn> for a a href#media-element idsourcing-out-of-band-text-tracks:media-element-9>media element/a>, the user agent must run the following steps:/p> ol>li>p>a href#perform-automatic-text-track-selection idsourcing-out-of-band-text-tracks:perform-automatic-text-track-selection>Perform automatic text track selection/a> for code idsourcing-out-of-band-text-tracks:dom-texttrack-kind-subtitles-2>a href#dom-texttrack-kind-subtitles>subtitles/a>/code> and code idsourcing-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 idsourcing-out-of-band-text-tracks:perform-automatic-text-track-selection-2>Perform automatic text track selection/a> for code idsourcing-out-of-band-text-tracks:dom-texttrack-kind-descriptions-2>a href#dom-texttrack-kind-descriptions>descriptions/a>/code>.li>p>If there are any a href#text-track idsourcing-out-of-band-text-tracks:text-track-8>text tracks/a> in the a href#media-element idsourcing-out-of-band-text-tracks:media-element-10>media element/a>s a href#list-of-text-tracks idsourcing-out-of-band-text-tracks:list-of-text-tracks-4>list of text tracks/a> whose a href#text-track-kind idsourcing-out-of-band-text-tracks:text-track-kind-3>text track kind/a> is code idsourcing-out-of-band-text-tracks:dom-texttrack-kind-metadata-2>a href#dom-texttrack-kind-metadata>chapters/a>/code> or code idsourcing-out-of-band-text-tracks:dom-texttrack-kind-metadata-3>a href#dom-texttrack-kind-metadata>metadata/a>/code> that correspond to code idsourcing-out-of-band-text-tracks:the-track-element-7>a href#the-track-element>track/a>/code> elements with a code idsourcing-out-of-band-text-tracks:attr-track-default>a href#attr-track-default>default/a>/code> attribute set whose a href#text-track-mode idsourcing-out-of-band-text-tracks:text-track-mode-2>text track mode/a> is set to a href#text-track-disabled idsourcing-out-of-band-text-tracks:text-track-disabled-2>disabled/a>, then set the a href#text-track-mode idsourcing-out-of-band-text-tracks:text-track-mode-3>text track mode/a> of all such tracks to a href#text-track-hidden idsourcing-out-of-band-text-tracks:text-track-hidden>hidden/a>li>p>Set the elements a href#did-perform-automatic-track-selection idsourcing-out-of-band-text-tracks:did-perform-automatic-track-selection-2>did-perform-automatic-track-selection/a> flag to true./ol> p>When the steps above say to dfn idperform-automatic-text-track-selection>perform automatic text track selection/dfn> for one or more a href#text-track-kind idsourcing-out-of-band-text-tracks:text-track-kind-4>text track kinds/a>, it means to run the following steps:/p> ol>li>p>Let var>candidates/var> be a list consisting of the a href#text-track idsourcing-out-of-band-text-tracks:text-track-9>text tracks/a> in the a href#media-element idsourcing-out-of-band-text-tracks:media-element-11>media element/a>s a href#list-of-text-tracks idsourcing-out-of-band-text-tracks:list-of-text-tracks-5>list of text tracks/a> whose a href#text-track-kind idsourcing-out-of-band-text-tracks:text-track-kind-5>text track kind/a> is one of the kinds that were passed to the algorithm, if any, in the order given in the a href#list-of-text-tracks idsourcing-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 idsourcing-out-of-band-text-tracks:text-track-10>text tracks/a> in var>candidates/var> have a a href#text-track-mode idsourcing-out-of-band-text-tracks:text-track-mode-4>text track mode/a> set to a href#text-track-showing idsourcing-out-of-band-text-tracks:text-track-showing>showing/a>, abort these steps.li> p>If the user has expressed an interest in having a track from var>candidates/var> enabled based on its a href#text-track-kind idsourcing-out-of-band-text-tracks:text-track-kind-6>text track kind/a>, a href#text-track-language idsourcing-out-of-band-text-tracks:text-track-language-2>text track language/a>, and a href#text-track-label idsourcing-out-of-band-text-tracks:text-track-label-2>text track label/a>, then set its a href#text-track-mode idsourcing-out-of-band-text-tracks:text-track-mode-5>text track mode/a> to a href#text-track-showing idsourcing-out-of-band-text-tracks:text-track-showing-2>showing/a>./p> p classnote>For example, the user could have set a browser preference to the effect of I want French captions whenever possible, or If there is a subtitle track with Commentary in the title, enable it, or If there are audio description tracks available, enable one, ideally in Swiss German, but failing that in Standard Swiss German or Standard German./p> p>Otherwise, if there are any a href#text-track idsourcing-out-of-band-text-tracks:text-track-11>text tracks/a> in var>candidates/var> that correspond to code idsourcing-out-of-band-text-tracks:the-track-element-8>a href#the-track-element>track/a>/code> elements with a code idsourcing-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 idsourcing-out-of-band-text-tracks:text-track-mode-6>text track mode/a> is set to a href#text-track-disabled idsourcing-out-of-band-text-tracks:text-track-disabled-3>disabled/a>, then set the a href#text-track-mode idsourcing-out-of-band-text-tracks:text-track-mode-7>text track mode/a> of the first such track to a href#text-track-showing idsourcing-out-of-band-text-tracks:text-track-showing-3>showing/a>./p> /ol> p>When a a href#text-track idsourcing-out-of-band-text-tracks:text-track-12>text track/a> corresponding to a code idsourcing-out-of-band-text-tracks:the-track-element-9>a href#the-track-element>track/a>/code> element experiences any of the following circumstances, the user agent must a href#start-the-track-processing-model idsourcing-out-of-band-text-tracks:start-the-track-processing-model>start the code>track/code> processing model/a> for that a href#text-track idsourcing-out-of-band-text-tracks:text-track-13>text track/a> and its code idsourcing-out-of-band-text-tracks:the-track-element-10>a href#the-track-element>track/a>/code> element: ul>li>The code idsourcing-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 idsourcing-out-of-band-text-tracks:text-track-14>text track/a> has its a href#text-track-mode idsourcing-out-of-band-text-tracks:text-track-mode-8>text track mode/a> changed.li>The code idsourcing-out-of-band-text-tracks:the-track-element-12>a href#the-track-element>track/a>/code> elements parent element changes and the new parent is a a href#media-element idsourcing-out-of-band-text-tracks:media-element-12>media element/a>./ul> p>When a user agent is to dfn idstart-the-track-processing-model>start the code>track/code> processing model/dfn> for a a href#text-track idsourcing-out-of-band-text-tracks:text-track-15>text track/a> and its code idsourcing-out-of-band-text-tracks:the-track-element-13>a href#the-track-element>track/a>/code> element, it must run the following algorithm. This algorithm interacts closely with the a href#event-loop idsourcing-out-of-band-text-tracks:event-loop>event loop/a> mechanism; in particular, it has a a href#synchronous-section idsourcing-out-of-band-text-tracks:synchronous-section>synchronous section/a> (which is triggered as part of the a href#event-loop idsourcing-out-of-band-text-tracks:event-loop-2>event loop/a> algorithm). The steps in that section are marked with ⌛./p> ol>li>p>If another occurrence of this algorithm is already running for this a href#text-track idsourcing-out-of-band-text-tracks:text-track-16>text track/a> and its code idsourcing-out-of-band-text-tracks:the-track-element-14>a href#the-track-element>track/a>/code> element, abort these steps, letting that other algorithm take care of this element.li>p>If the a href#text-track idsourcing-out-of-band-text-tracks:text-track-17>text track/a>s a href#text-track-mode idsourcing-out-of-band-text-tracks:text-track-mode-9>text track mode/a> is not set to one of a href#text-track-hidden idsourcing-out-of-band-text-tracks:text-track-hidden-2>hidden/a> or a href#text-track-showing idsourcing-out-of-band-text-tracks:text-track-showing-4>showing/a>, abort these steps.li>p>If the a href#text-track idsourcing-out-of-band-text-tracks:text-track-18>text track/a>s code idsourcing-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 idsourcing-out-of-band-text-tracks:media-element-13>media element/a> as a parent, abort these steps.li>p>Run the remainder of these steps a href#in-parallel idsourcing-out-of-band-text-tracks:in-parallel>in parallel/a>, allowing whatever caused these steps to run to continue.li>p>i>Top/i>: a href#await-a-stable-state idsourcing-out-of-band-text-tracks:await-a-stable-state>Await a stable state/a>. The a href#synchronous-section idsourcing-out-of-band-text-tracks:synchronous-section-2>synchronous section/a> consists of the following steps. (The steps in the a href#synchronous-section idsourcing-out-of-band-text-tracks:synchronous-section-3>synchronous section/a> are marked with ⌛.)li>p>⌛ Set the a href#text-track-readiness-state idsourcing-out-of-band-text-tracks:text-track-readiness-state-2>text track readiness state/a> to a href#text-track-loading idsourcing-out-of-band-text-tracks:text-track-loading>loading/a>.li>p>⌛ Let var>URL/var> be the a href#track-url idsourcing-out-of-band-text-tracks:track-url-2>track URL/a> of the code idsourcing-out-of-band-text-tracks:the-track-element-16>a href#the-track-element>track/a>/code> element.li>p>⌛ If the code idsourcing-out-of-band-text-tracks:the-track-element-17>a href#the-track-element>track/a>/code> elements parent is a a href#media-element idsourcing-out-of-band-text-tracks:media-element-14>media element/a> then let var>corsAttributeState/var> be the state of the parent a href#media-element idsourcing-out-of-band-text-tracks:media-element-15>media element/a>s code idsourcing-out-of-band-text-tracks:attr-media-crossorigin>a href#attr-media-crossorigin>crossorigin/a>/code> content attribute. Otherwise, let var>corsAttributeState/var> be a href#attr-crossorigin-none idsourcing-out-of-band-text-tracks:attr-crossorigin-none>No CORS/a>.li>p>End the a href#synchronous-section idsourcing-out-of-band-text-tracks:synchronous-section-4>synchronous section/a>, continuing the remaining steps a href#in-parallel idsourcing-out-of-band-text-tracks:in-parallel-2>in parallel/a>.li> p>If var>URL/var> is not the empty string, then: ol>li>p>Let var>request/var> be the result of a href#create-a-potential-cors-request idsourcing-out-of-band-text-tracks:create-a-potential-cors-request>creating a potential-CORS request/a> given var>URL/var>, code>track/code>, and var>corsAttributeState/var>, and with the i>same-origin fallback flag/i> set.li>p>Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-client idsourcing-out-of-band-text-tracks:concept-request-client data-x-internalconcept-request-client>client/a> to the code idsourcing-out-of-band-text-tracks:the-track-element-18>a href#the-track-element>track/a>/code> elements a idsourcing-out-of-band-text-tracks:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s code idsourcing-out-of-band-text-tracks:window>a href#window>Window/a>/code> objects a href#environment-settings-object idsourcing-out-of-band-text-tracks:environment-settings-object>environment settings object/a>.li>p>a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idsourcing-out-of-band-text-tracks:concept-fetch data-x-internalconcept-fetch>Fetch/a> var>request/var>./ol> p>The a href#concept-task idsourcing-out-of-band-text-tracks:concept-task>tasks/a> a href#queue-a-task idsourcing-out-of-band-text-tracks:queue-a-task-4>queued/a> by the fetching algorithm on the a href#networking-task-source idsourcing-out-of-band-text-tracks:networking-task-source>networking task source/a> to process the data as it is being fetched must determine the type of the resource. If the type of the resource is not a supported text track format, the load will fail, as described below. Otherwise, the resources data must be passed to the appropriate parser (e.g., the a idsourcing-out-of-band-text-tracks:webvtt-parser hrefhttps://w3c.github.io/webvtt/#webvtt-parser data-x-internalwebvtt-parser>WebVTT parser/a>) as it is received, with the a href#text-track-list-of-cues idsourcing-out-of-band-text-tracks:text-track-list-of-cues-2>text track list of cues/a> being used for that parsers output. a href#refsWEBVTT>WEBVTT/a>/p> p classnote>The appropriate parser will incrementally update the a href#text-track-list-of-cues idsourcing-out-of-band-text-tracks:text-track-list-of-cues-3>text track list of cues/a> during these a href#networking-task-source idsourcing-out-of-band-text-tracks:networking-task-source-2>networking task source/a> a href#concept-task idsourcing-out-of-band-text-tracks:concept-task-2>tasks/a>, as each such task is run with whatever data has been received from the network)./p> p classcritical>This specification does not currently say whether or how to check the MIME types of text tracks, or whether or how to perform file type sniffing using the actual file data. Implementors differ in their intentions on this matter and it is therefore unclear what the right solution is. In the absence of any requirement here, the HTTP specifications strict requirement to follow the Content-Type header prevails (Content-Type specifies the media type of the underlying data. ... If and only if the media type is not given by a Content-Type field, the recipient MAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the resource.)./p> p>If fetching fails for any reason (network error, the server returns an error code, CORS fails, etc), or if var>URL/var> is the empty string, then a href#queue-a-task idsourcing-out-of-band-text-tracks:queue-a-task-5>queue a task/a> to first change the a href#text-track-readiness-state idsourcing-out-of-band-text-tracks:text-track-readiness-state-3>text track readiness state/a> to a href#text-track-failed-to-load idsourcing-out-of-band-text-tracks:text-track-failed-to-load>failed to load/a> and then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idsourcing-out-of-band-text-tracks:concept-event-fire-3 data-x-internalconcept-event-fire>fire an event/a> named code idsourcing-out-of-band-text-tracks:event-track-error>a href#event-track-error>error/a>/code> at the code idsourcing-out-of-band-text-tracks:the-track-element-19>a href#the-track-element>track/a>/code> element. This a href#concept-task idsourcing-out-of-band-text-tracks:concept-task-3>task/a> must use the a href#dom-manipulation-task-source idsourcing-out-of-band-text-tracks:dom-manipulation-task-source>DOM manipulation task source/a>./p> p>If fetching does not fail, but the type of the resource is not a supported text track format, or the file was not successfully processed (e.g., the format in question is an XML format and the file contained a well-formedness error that the XML specification requires be detected and reported to the application), then the a href#concept-task idsourcing-out-of-band-text-tracks:concept-task-4>task/a> that is a href#queue-a-task idsourcing-out-of-band-text-tracks:queue-a-task-6>queued/a> by the a href#networking-task-source idsourcing-out-of-band-text-tracks:networking-task-source-3>networking task source/a> in which the aforementioned problem is found must change the a href#text-track-readiness-state idsourcing-out-of-band-text-tracks:text-track-readiness-state-4>text track readiness state/a> to a href#text-track-failed-to-load idsourcing-out-of-band-text-tracks:text-track-failed-to-load-2>failed to load/a> and a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idsourcing-out-of-band-text-tracks:concept-event-fire-4 data-x-internalconcept-event-fire>fire an event/a> named code idsourcing-out-of-band-text-tracks:event-track-error-2>a href#event-track-error>error/a>/code> at the code idsourcing-out-of-band-text-tracks:the-track-element-20>a href#the-track-element>track/a>/code> element./p> p>If fetching does not fail, and the file was successfully processed, then the final a href#concept-task idsourcing-out-of-band-text-tracks:concept-task-5>task/a> that is a href#queue-a-task idsourcing-out-of-band-text-tracks:queue-a-task-7>queued/a> by the a href#networking-task-source idsourcing-out-of-band-text-tracks:networking-task-source-4>networking task source/a>, after it has finished parsing the data, must change the a href#text-track-readiness-state idsourcing-out-of-band-text-tracks:text-track-readiness-state-5>text track readiness state/a> to a href#text-track-loaded idsourcing-out-of-band-text-tracks:text-track-loaded>loaded/a>, and a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idsourcing-out-of-band-text-tracks:concept-event-fire-5 data-x-internalconcept-event-fire>fire an event/a> named code idsourcing-out-of-band-text-tracks:event-track-load>a href#event-track-load>load/a>/code> at the code idsourcing-out-of-band-text-tracks:the-track-element-21>a href#the-track-element>track/a>/code> element./p> p>If, while fetching is ongoing, either:/p> ul>li>the a href#track-url idsourcing-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 idsourcing-out-of-band-text-tracks:text-track-mode-10>text track mode/a> is set to a href#text-track-hidden idsourcing-out-of-band-text-tracks:text-track-hidden-3>hidden/a> or a href#text-track-showing idsourcing-out-of-band-text-tracks:text-track-showing-5>showing/a>; orli>the a href#text-track-mode idsourcing-out-of-band-text-tracks:text-track-mode-11>text track mode/a> changes to a href#text-track-hidden idsourcing-out-of-band-text-tracks:text-track-hidden-4>hidden/a> or a href#text-track-showing idsourcing-out-of-band-text-tracks:text-track-showing-6>showing/a>, while the a href#track-url idsourcing-out-of-band-text-tracks:track-url-4>track URL/a> is not equal to var>URL/var>/ul> p>...then the user agent must abort a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idsourcing-out-of-band-text-tracks:concept-fetch-2 data-x-internalconcept-fetch>fetching/a>, discarding any pending a href#concept-task idsourcing-out-of-band-text-tracks:concept-task-6>tasks/a> generated by that algorithm (and in particular, not adding any cues to the a href#text-track-list-of-cues idsourcing-out-of-band-text-tracks:text-track-list-of-cues-4>text track list of cues/a> after the moment the URL changed), and then a href#queue-a-task idsourcing-out-of-band-text-tracks:queue-a-task-8>queue a task/a> that first changes the a href#text-track-readiness-state idsourcing-out-of-band-text-tracks:text-track-readiness-state-6>text track readiness state/a> to a href#text-track-failed-to-load idsourcing-out-of-band-text-tracks:text-track-failed-to-load-3>failed to load/a> and then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idsourcing-out-of-band-text-tracks:concept-event-fire-6 data-x-internalconcept-event-fire>fires an event/a> named code idsourcing-out-of-band-text-tracks:event-track-error-3>a href#event-track-error>error/a>/code> at the code idsourcing-out-of-band-text-tracks:the-track-element-22>a href#the-track-element>track/a>/code> element. This a href#concept-task idsourcing-out-of-band-text-tracks:concept-task-7>task/a> must use the a href#dom-manipulation-task-source idsourcing-out-of-band-text-tracks:dom-manipulation-task-source-2>DOM manipulation task source/a>. /p> li>p>Wait until the a href#text-track-readiness-state idsourcing-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 idsourcing-out-of-band-text-tracks:text-track-loading-2>loading/a>.li>p>Wait until the a href#track-url idsourcing-out-of-band-text-tracks:track-url-5>track URL/a> is no longer equal to var>URL/var>, at the same time as the a href#text-track-mode idsourcing-out-of-band-text-tracks:text-track-mode-12>text track mode/a> is set to a href#text-track-hidden idsourcing-out-of-band-text-tracks:text-track-hidden-5>hidden/a> or a href#text-track-showing idsourcing-out-of-band-text-tracks:text-track-showing-7>showing/a>.li>p>Jump to the step labeled i>top/i>./ol> p>Whenever a code idsourcing-out-of-band-text-tracks:the-track-element-23>a href#the-track-element>track/a>/code> element has its code idsourcing-out-of-band-text-tracks:attr-track-src>a href#attr-track-src>src/a>/code> attribute set, changed, or removed, the user agent must a href#immediately idsourcing-out-of-band-text-tracks:immediately>immediately/a> empty the elements a href#text-track idsourcing-out-of-band-text-tracks:text-track-19>text track/a>s a href#text-track-list-of-cues idsourcing-out-of-band-text-tracks:text-track-list-of-cues-5>text track list of cues/a>. (This also causes the algorithm above to stop adding cues from the resource being obtained using the previously given URL, if any.)/p> h6 idguidelines-for-exposing-cues-in-various-formats-as-text-track-cues>span classsecno>4.8.12.11.4/span> dfn>Guidelines for exposing cues/dfn> in various formats as a href#text-track-cue idguidelines-for-exposing-cues-in-various-formats-as-text-track-cues:text-track-cue>text track cues/a>a href#guidelines-for-exposing-cues-in-various-formats-as-text-track-cues classself-link>/a>/h6> p>How a specific formats text track cues are to be interpreted for the purposes of processing by an HTML user agent is defined by that format. In the absence of such a specification, this section provides some constraints within which implementations can attempt to consistently expose such formats./p> p>To support the a href#text-track idguidelines-for-exposing-cues-in-various-formats-as-text-track-cues:text-track>text track/a> model of HTML, each unit of timed data is converted to a a href#text-track-cue idguidelines-for-exposing-cues-in-various-formats-as-text-track-cues:text-track-cue-2>text track cue/a>. Where the mapping of the formats features to the aspects of a a href#text-track-cue idguidelines-for-exposing-cues-in-various-formats-as-text-track-cues:text-track-cue-3>text track cue/a> as defined in this specification are not defined, implementations must ensure that the mapping is consistent with the definitions of the aspects of a a href#text-track-cue idguidelines-for-exposing-cues-in-various-formats-as-text-track-cues:text-track-cue-4>text track cue/a> as defined above, as well as with the following constraints:/p> dl>dt>The a href#text-track-cue-identifier idguidelines-for-exposing-cues-in-various-formats-as-text-track-cues:text-track-cue-identifier>text track cue identifier/a> dd> p>Should be set to the empty string if the format has no obvious analogue to a per-cue identifier./p> dt>The a href#text-track-cue-pause-on-exit-flag idguidelines-for-exposing-cues-in-various-formats-as-text-track-cues:text-track-cue-pause-on-exit-flag>text track cue pause-on-exit flag/a> dd> p>Should be set to false./p> /dl> h6 idtext-track-api>span classsecno>4.8.12.11.5/span> Text track APIa href#text-track-api classself-link>/a>/h6> pre classidl>ExposedWindowinterface dfn idtexttracklist>TextTrackList/dfn> : a idtext-track-api:eventtarget hrefhttps://dom.spec.whatwg.org/#interface-eventtarget data-x-internaleventtarget>EventTarget/a> { readonly attribute unsigned long a href#dom-texttracklist-length idtext-track-api:dom-texttracklist-length>length/a>; a href#dom-texttracklist-item>getter/a> a href#texttrack idtext-track-api:texttrack>TextTrack/a> (unsigned long index); a href#texttrack idtext-track-api:texttrack-2>TextTrack/a>? a href#dom-texttracklist-gettrackbyid idtext-track-api:dom-texttracklist-gettrackbyid>getTrackById/a>(DOMString id); attribute a href#eventhandler idtext-track-api:eventhandler>EventHandler/a> a href#handler-texttracklist-onchange idtext-track-api:handler-texttracklist-onchange>onchange/a>; attribute a href#eventhandler idtext-track-api:eventhandler-2>EventHandler/a> a href#handler-texttracklist-onaddtrack idtext-track-api:handler-texttracklist-onaddtrack>onaddtrack/a>; attribute a href#eventhandler idtext-track-api:eventhandler-3>EventHandler/a> a href#handler-texttracklist-onremovetrack idtext-track-api:handler-texttracklist-onremovetrack>onremovetrack/a>;};/pre> dl classdomintro>dt>var>media/var> . code idtext-track-api:dom-media-texttracks>a href#dom-media-texttracks>textTracks/a>/code> . code>length/code>dd> p>Returns the number of a href#text-track idtext-track-api:text-track>text tracks/a> associated with the a href#media-element idtext-track-api:media-element>media element/a> (e.g. from code idtext-track-api:the-track-element>a href#the-track-element>track/a>/code> elements). This is the number of a href#text-track idtext-track-api:text-track-2>text tracks/a> in the a href#media-element idtext-track-api:media-element-2>media element/a>s a href#list-of-text-tracks idtext-track-api:list-of-text-tracks>list of text tracks/a>./p> dt>var>media/var> . code idtext-track-api:dom-media-texttracks-2>a href#dom-media-texttracks>textTracks/a>/code> var>n/var> code>/code>dd> p>Returns the code idtext-track-api:texttrack-3>a href#texttrack>TextTrack/a>/code> object representing the var>n/var>th a href#text-track idtext-track-api:text-track-3>text track/a> in the a href#media-element idtext-track-api:media-element-3>media element/a>s a href#list-of-text-tracks idtext-track-api:list-of-text-tracks-2>list of text tracks/a>./p> dt>var>textTrack/var> var>media/var> . code idtext-track-api:dom-media-texttracks-3>a href#dom-media-texttracks>textTracks/a>/code> . code idtext-track-api:dom-texttracklist-gettrackbyid-2>a href#dom-texttracklist-gettrackbyid>getTrackById/a>/code>( var>id/var> )dd> p>Returns the code idtext-track-api:texttrack-4>a href#texttrack>TextTrack/a>/code> object with the given identifier, or null if no track has that identifier./p> /dl> p>A code idtext-track-api:texttracklist>a href#texttracklist>TextTrackList/a>/code> object represents a dynamically updating list of a href#text-track idtext-track-api:text-track-4>text tracks/a> in a given order./p> p>The dfn iddom-media-texttracks>code>textTracks/code>/dfn> attribute of a href#media-element idtext-track-api:media-element-4>media elements/a> must return a code idtext-track-api:texttracklist-2>a href#texttracklist>TextTrackList/a>/code> object representing the code idtext-track-api:texttrack-5>a href#texttrack>TextTrack/a>/code> objects of the a href#text-track idtext-track-api:text-track-5>text tracks/a> in the a href#media-element idtext-track-api:media-element-5>media element/a>s a href#list-of-text-tracks idtext-track-api:list-of-text-tracks-3>list of text tracks/a>, in the same order as in the a href#list-of-text-tracks idtext-track-api:list-of-text-tracks-4>list of text tracks/a>./p> p>The dfn iddom-texttracklist-length>code>length/code>/dfn> attribute of a code idtext-track-api:texttracklist-3>a href#texttracklist>TextTrackList/a>/code> object must return the number of a href#text-track idtext-track-api:text-track-6>text tracks/a> in the list represented by the code idtext-track-api:texttracklist-4>a href#texttracklist>TextTrackList/a>/code> object./p> p>The a idtext-track-api:supported-property-indices hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a> of a code idtext-track-api:texttracklist-5>a href#texttracklist>TextTrackList/a>/code> object at any instant are the numbers from zero to the number of a href#text-track idtext-track-api:text-track-7>text tracks/a> in the list represented by the code idtext-track-api:texttracklist-6>a href#texttracklist>TextTrackList/a>/code> object minus one, if any. If there are no a href#text-track idtext-track-api:text-track-8>text tracks/a> in the list, there are no a idtext-track-api:supported-property-indices-2 hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a>./p> p iddom-texttracklist-item>To a idtext-track-api:determine-the-value-of-an-indexed-property hrefhttps://heycam.github.io/webidl/#dfn-determine-the-value-of-an-indexed-property data-x-internaldetermine-the-value-of-an-indexed-property>determine the value of an indexed property/a> of a code idtext-track-api:texttracklist-7>a href#texttracklist>TextTrackList/a>/code> object for a given index var>index/var>, the user agent must return the var>index/var>th a href#text-track idtext-track-api:text-track-9>text track/a> in the list represented by the code idtext-track-api:texttracklist-8>a href#texttracklist>TextTrackList/a>/code> object./p> p>The dfn iddom-texttracklist-gettrackbyid>code>getTrackById(var>id/var>)/code>/dfn> method must return the first code idtext-track-api:texttrack-6>a href#texttrack>TextTrack/a>/code> in the code idtext-track-api:texttracklist-9>a href#texttracklist>TextTrackList/a>/code> object whose code idtext-track-api:dom-texttrack-id>a href#dom-texttrack-id>id/a>/code> IDL attribute would return a value equal to the value of the var>id/var> argument. When no tracks match the given argument, the method must return null./p> hr> pre classidl>enum dfn idtexttrackmode>TextTrackMode/dfn> { a href#dom-texttrack-disabled idtext-track-api:dom-texttrack-disabled>disabled/a>, a href#dom-texttrack-hidden idtext-track-api:dom-texttrack-hidden>hidden/a>, a href#dom-texttrack-showing idtext-track-api:dom-texttrack-showing>showing/a> };enum dfn idtexttrackkind>TextTrackKind/dfn> { a href#dom-texttrack-kind-subtitles idtext-track-api:dom-texttrack-kind-subtitles>subtitles/a>, a href#dom-texttrack-kind-captions idtext-track-api:dom-texttrack-kind-captions>captions/a>, a href#dom-texttrack-kind-descriptions idtext-track-api:dom-texttrack-kind-descriptions>descriptions/a>, a href#dom-texttrack-kind-chapters idtext-track-api:dom-texttrack-kind-chapters>chapters/a>, a href#dom-texttrack-kind-metadata idtext-track-api:dom-texttrack-kind-metadata>metadata/a> };ExposedWindowinterface dfn idtexttrack>TextTrack/dfn> : a idtext-track-api:eventtarget-2 hrefhttps://dom.spec.whatwg.org/#interface-eventtarget data-x-internaleventtarget>EventTarget/a> { readonly attribute a href#texttrackkind idtext-track-api:texttrackkind>TextTrackKind/a> a href#dom-texttrack-kind idtext-track-api:dom-texttrack-kind>kind/a>; readonly attribute DOMString a href#dom-texttrack-label idtext-track-api:dom-texttrack-label>label/a>; readonly attribute DOMString a href#dom-texttrack-language idtext-track-api:dom-texttrack-language>language/a>; readonly attribute DOMString a href#dom-texttrack-id idtext-track-api:dom-texttrack-id-2>id/a>; readonly attribute DOMString a href#dom-texttrack-inbandmetadatatrackdispatchtype idtext-track-api:dom-texttrack-inbandmetadatatrackdispatchtype>inBandMetadataTrackDispatchType/a>; attribute a href#texttrackmode idtext-track-api:texttrackmode>TextTrackMode/a> a href#dom-texttrack-mode idtext-track-api:dom-texttrack-mode>mode/a>; readonly attribute a href#texttrackcuelist idtext-track-api:texttrackcuelist>TextTrackCueList/a>? a href#dom-texttrack-cues idtext-track-api:dom-texttrack-cues>cues/a>; readonly attribute a href#texttrackcuelist idtext-track-api:texttrackcuelist-2>TextTrackCueList/a>? a href#dom-texttrack-activecues idtext-track-api:dom-texttrack-activecues>activeCues/a>; void a href#dom-texttrack-addcue idtext-track-api:dom-texttrack-addcue>addCue/a>(a href#texttrackcue idtext-track-api:texttrackcue>TextTrackCue/a> cue); void a href#dom-texttrack-removecue idtext-track-api:dom-texttrack-removecue>removeCue/a>(a href#texttrackcue idtext-track-api:texttrackcue-2>TextTrackCue/a> cue); attribute a href#eventhandler idtext-track-api:eventhandler-4>EventHandler/a> a href#handler-texttrack-oncuechange idtext-track-api:handler-texttrack-oncuechange>oncuechange/a>;};/pre> dl classdomintro>dt>var>textTrack/var> var>media/var> . code idtext-track-api:dom-media-addtexttrack>a href#dom-media-addtexttrack>addTextTrack/a>/code>( var>kind/var> , var>label/var> , var>language/var> )dd> p>Creates and returns a new code idtext-track-api:texttrack-7>a href#texttrack>TextTrack/a>/code> object, which is also added to the a href#media-element idtext-track-api:media-element-6>media element/a>s a href#list-of-text-tracks idtext-track-api:list-of-text-tracks-5>list of text tracks/a>./p> dt>var>textTrack/var> . code idtext-track-api:dom-texttrack-kind-2>a href#dom-texttrack-kind>kind/a>/code>dd> p>Returns the a href#text-track-kind idtext-track-api:text-track-kind>text track kind/a> string./p> dt>var>textTrack/var> . code idtext-track-api:dom-texttrack-label-2>a href#dom-texttrack-label>label/a>/code>dd> p>Returns the a href#text-track-label idtext-track-api:text-track-label>text track label/a>, if there is one, or the empty string otherwise (indicating that a custom label probably needs to be generated from the other attributes of the object if the object is exposed to the user)./p> dt>var>textTrack/var> . code idtext-track-api:dom-texttrack-language-2>a href#dom-texttrack-language>language/a>/code>dd> p>Returns the a href#text-track-language idtext-track-api:text-track-language>text track language/a> string./p> dt>var>textTrack/var> . code idtext-track-api:dom-texttrack-id-3>a href#dom-texttrack-id>id/a>/code>dd> p>Returns the ID of the given track./p> p>For in-band tracks, this is the ID that can be used with a a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idtext-track-api:concept-url-fragment data-x-internalconcept-url-fragment>fragment/a> if the format supports a idtext-track-api:media-fragment-syntax hrefhttps://www.w3.org/TR/media-frags/#media-fragment-syntax data-x-internalmedia-fragment-syntax>media fragment syntax/a>, and that can be used with the code idtext-track-api:dom-texttracklist-gettrackbyid-3>a href#dom-texttracklist-gettrackbyid>getTrackById()/a>/code> method./p> p>For code idtext-track-api:texttrack-8>a href#texttrack>TextTrack/a>/code> objects corresponding to code idtext-track-api:the-track-element-2>a href#the-track-element>track/a>/code> elements, this is the ID of the code idtext-track-api:the-track-element-3>a href#the-track-element>track/a>/code> element./p> dt>var>textTrack/var> . code idtext-track-api:dom-texttrack-inbandmetadatatrackdispatchtype-2>a href#dom-texttrack-inbandmetadatatrackdispatchtype>inBandMetadataTrackDispatchType/a>/code>dd> p>Returns the a href#text-track-in-band-metadata-track-dispatch-type idtext-track-api:text-track-in-band-metadata-track-dispatch-type>text track in-band metadata track dispatch type/a> string./p> dt>var>textTrack/var> . code idtext-track-api:dom-texttrack-mode-2>a href#dom-texttrack-mode>mode/a>/code> var>value/var> dd> p>Returns the a href#text-track-mode idtext-track-api:text-track-mode>text track mode/a>, represented by a string from the following list:/p> dl>dt>code idtext-track-api:dom-texttrack-disabled-2>a href#dom-texttrack-disabled>disabled/a>/code>dd> p>The a href#text-track-disabled idtext-track-api:text-track-disabled>text track disabled/a> mode./p> dt>code idtext-track-api:dom-texttrack-hidden-2>a href#dom-texttrack-hidden>hidden/a>/code>dd> p>The a href#text-track-hidden idtext-track-api:text-track-hidden>text track hidden/a> mode./p> dt>code idtext-track-api:dom-texttrack-showing-2>a href#dom-texttrack-showing>showing/a>/code>dd> p>The a href#text-track-showing idtext-track-api:text-track-showing>text track showing/a> mode./p> /dl> p>Can be set, to change the mode./p> dt>var>textTrack/var> . code idtext-track-api:dom-texttrack-cues-2>a href#dom-texttrack-cues>cues/a>/code>dd> p>Returns the a href#text-track-list-of-cues idtext-track-api:text-track-list-of-cues>text track list of cues/a>, as a code idtext-track-api:texttrackcuelist-3>a href#texttrackcuelist>TextTrackCueList/a>/code> object./p> dt>var>textTrack/var> . code idtext-track-api:dom-texttrack-activecues-2>a href#dom-texttrack-activecues>activeCues/a>/code>dd> p>Returns the a href#text-track-cue idtext-track-api:text-track-cue>text track cues/a> from the a href#text-track-list-of-cues idtext-track-api:text-track-list-of-cues-2>text track list of cues/a> that are currently active (i.e. that start before the a href#current-playback-position idtext-track-api:current-playback-position>current playback position/a> and end after it), as a code idtext-track-api:texttrackcuelist-4>a href#texttrackcuelist>TextTrackCueList/a>/code> object./p> dt>var>textTrack/var> . code idtext-track-api:dom-texttrack-addcue-2>a href#dom-texttrack-addcue>addCue/a>/code>( var>cue/var> )dd> p>Adds the given cue to var>textTrack/var>s a href#text-track-list-of-cues idtext-track-api:text-track-list-of-cues-3>text track list of cues/a>./p> dt>var>textTrack/var> . code idtext-track-api:dom-texttrack-removecue-2>a href#dom-texttrack-removecue>removeCue/a>/code>( var>cue/var> )dd> p>Removes the given cue from var>textTrack/var>s a href#text-track-list-of-cues idtext-track-api:text-track-list-of-cues-4>text track list of cues/a>./p> /dl> p>The dfn iddom-media-addtexttrack>code>addTextTrack(var>kind/var>, var>label/var>, var>language/var>)/code>/dfn> method of a href#media-element idtext-track-api:media-element-7>media elements/a>, when invoked, must run the following steps:/p> ol>li> p>Create a new code idtext-track-api:texttrack-9>a href#texttrack>TextTrack/a>/code> object./p> li> p>Create a new a href#text-track idtext-track-api:text-track-10>text track/a> corresponding to the new object, and set its a href#text-track-kind idtext-track-api:text-track-kind-2>text track kind/a> to var>kind/var>, its a href#text-track-label idtext-track-api:text-track-label-2>text track label/a> to var>label/var>, its a href#text-track-language idtext-track-api:text-track-language-2>text track language/a> to var>language/var>, its a href#text-track-readiness-state idtext-track-api:text-track-readiness-state>text track readiness state/a> to the a href#text-track-loaded idtext-track-api:text-track-loaded>text track loaded/a> state, its a href#text-track-mode idtext-track-api:text-track-mode-2>text track mode/a> to the a href#text-track-hidden idtext-track-api:text-track-hidden-2>text track hidden/a> mode, and its a href#text-track-list-of-cues idtext-track-api:text-track-list-of-cues-5>text track list of cues/a> to an empty list./p> p>Initially, the a href#text-track-list-of-cues idtext-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 idtext-track-api:rules-for-updating-the-text-track-rendering>rules for updating the text track rendering/a>. When a a href#text-track-cue idtext-track-api:text-track-cue-2>text track cue/a> is added to it, the a href#text-track-list-of-cues idtext-track-api:text-track-list-of-cues-7>text track list of cues/a> has its rules permanently set accordingly./p> li> p>Add the new a href#text-track idtext-track-api:text-track-11>text track/a> to the a href#media-element idtext-track-api:media-element-8>media element/a>s a href#list-of-text-tracks idtext-track-api:list-of-text-tracks-6>list of text tracks/a>./p> li> p>a href#queue-a-task idtext-track-api:queue-a-task>Queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idtext-track-api:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idtext-track-api:event-media-addtrack>a href#event-media-addtrack>addtrack/a>/code> at the a href#media-element idtext-track-api:media-element-9>media element/a>s code idtext-track-api:dom-media-texttracks-4>a href#dom-media-texttracks>textTracks/a>/code> attributes code idtext-track-api:texttracklist-10>a href#texttracklist>TextTrackList/a>/code> object, using code idtext-track-api:trackevent>a href#trackevent>TrackEvent/a>/code>, with the code idtext-track-api:dom-trackevent-track>a href#dom-trackevent-track>track/a>/code> attribute initialized to the new a href#text-track idtext-track-api:text-track-12>text track/a>s code idtext-track-api:texttrack-10>a href#texttrack>TextTrack/a>/code> object./p> li> p>Return the new code idtext-track-api:texttrack-11>a href#texttrack>TextTrack/a>/code> object./p> /ol> hr> p>The dfn iddom-texttrack-kind>code>kind/code>/dfn> attribute must return the a href#text-track-kind idtext-track-api:text-track-kind-3>text track kind/a> of the a href#text-track idtext-track-api:text-track-13>text track/a> that the code idtext-track-api:texttrack-12>a href#texttrack>TextTrack/a>/code> object represents./p> p>The dfn iddom-texttrack-label>code>label/code>/dfn> attribute must return the a href#text-track-label idtext-track-api:text-track-label-3>text track label/a> of the a href#text-track idtext-track-api:text-track-14>text track/a> that the code idtext-track-api:texttrack-13>a href#texttrack>TextTrack/a>/code> object represents./p> p>The dfn iddom-texttrack-language>code>language/code>/dfn> attribute must return the a href#text-track-language idtext-track-api:text-track-language-3>text track language/a> of the a href#text-track idtext-track-api:text-track-15>text track/a> that the code idtext-track-api:texttrack-14>a href#texttrack>TextTrack/a>/code> object represents./p> p>The dfn iddom-texttrack-id>code>id/code>/dfn> attribute returns the tracks identifier, if it has one, or the empty string otherwise. For tracks that correspond to code idtext-track-api:the-track-element-4>a href#the-track-element>track/a>/code> elements, the tracks identifier is the value of the elements code idtext-track-api:the-id-attribute>a href#the-id-attribute>id/a>/code> attribute, if any. For in-band tracks, the tracks identifier is specified by the a href#media-resource idtext-track-api:media-resource>media resource/a>. If the a href#media-resource idtext-track-api:media-resource-2>media resource/a> is in a format that supports a idtext-track-api:media-fragment-syntax-2 hrefhttps://www.w3.org/TR/media-frags/#media-fragment-syntax data-x-internalmedia-fragment-syntax>media fragment syntax/a>, the identifier returned for a particular track must be the same identifier that would enable the track if used as the name of a track in the track dimension of such a a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idtext-track-api:concept-url-fragment-2 data-x-internalconcept-url-fragment>fragment/a>./p> p>The dfn iddom-texttrack-inbandmetadatatrackdispatchtype>code>inBandMetadataTrackDispatchType/code>/dfn> attribute must return the a href#text-track-in-band-metadata-track-dispatch-type idtext-track-api:text-track-in-band-metadata-track-dispatch-type-2>text track in-band metadata track dispatch type/a> of the a href#text-track idtext-track-api:text-track-16>text track/a> that the code idtext-track-api:texttrack-15>a href#texttrack>TextTrack/a>/code> object represents./p> p>The dfn iddom-texttrack-mode>code>mode/code>/dfn> attribute, on getting, must return the string corresponding to the a href#text-track-mode idtext-track-api:text-track-mode-3>text track mode/a> of the a href#text-track idtext-track-api:text-track-17>text track/a> that the code idtext-track-api:texttrack-16>a href#texttrack>TextTrack/a>/code> object represents, as defined by the following list:/p> dl>dt>dfn iddom-texttrack-disabled>code>disabled/code>/dfn>dd>The a href#text-track-disabled idtext-track-api:text-track-disabled-2>text track disabled/a> mode.dt>dfn iddom-texttrack-hidden>code>hidden/code>/dfn>dd>The a href#text-track-hidden idtext-track-api:text-track-hidden-3>text track hidden/a> mode.dt>dfn iddom-texttrack-showing>code>showing/code>/dfn>dd>The a href#text-track-showing idtext-track-api:text-track-showing-2>text track showing/a> mode./dl> p>On setting, if the new value isnt equal to what the attribute would currently return, the new value must be processed as follows:/p> dl classswitch>dt>If the new value is code idtext-track-api:dom-texttrack-disabled-3>a href#dom-texttrack-disabled>disabled/a>/code>dd> p>Set the a href#text-track-mode idtext-track-api:text-track-mode-4>text track mode/a> of the a href#text-track idtext-track-api:text-track-18>text track/a> that the code idtext-track-api:texttrack-17>a href#texttrack>TextTrack/a>/code> object represents to the a href#text-track-disabled idtext-track-api:text-track-disabled-3>text track disabled/a> mode./p> dt>If the new value is code idtext-track-api:dom-texttrack-hidden-3>a href#dom-texttrack-hidden>hidden/a>/code>dd> p>Set the a href#text-track-mode idtext-track-api:text-track-mode-5>text track mode/a> of the a href#text-track idtext-track-api:text-track-19>text track/a> that the code idtext-track-api:texttrack-18>a href#texttrack>TextTrack/a>/code> object represents to the a href#text-track-hidden idtext-track-api:text-track-hidden-4>text track hidden/a> mode./p> dt>If the new value is code idtext-track-api:dom-texttrack-showing-3>a href#dom-texttrack-showing>showing/a>/code>dd> p>Set the a href#text-track-mode idtext-track-api:text-track-mode-6>text track mode/a> of the a href#text-track idtext-track-api:text-track-20>text track/a> that the code idtext-track-api:texttrack-19>a href#texttrack>TextTrack/a>/code> object represents to the a href#text-track-showing idtext-track-api:text-track-showing-3>text track showing/a> mode./p> /dl> p>If the a href#text-track-mode idtext-track-api:text-track-mode-7>text track mode/a> of the a href#text-track idtext-track-api:text-track-21>text track/a> that the code idtext-track-api:texttrack-20>a href#texttrack>TextTrack/a>/code> object represents is not the a href#text-track-disabled idtext-track-api:text-track-disabled-4>text track disabled/a> mode, then the dfn iddom-texttrack-cues>code>cues/code>/dfn> attribute must return a a href#live idtext-track-api:live>live/a> code idtext-track-api:texttrackcuelist-5>a href#texttrackcuelist>TextTrackCueList/a>/code> object that represents the subset of the a href#text-track-list-of-cues idtext-track-api:text-track-list-of-cues-8>text track list of cues/a> of the a href#text-track idtext-track-api:text-track-22>text track/a> that the code idtext-track-api:texttrack-21>a href#texttrack>TextTrack/a>/code> object represents whose a href#text-track-cue-end-time idtext-track-api:text-track-cue-end-time>end times/a> occur at or after the a href#earliest-possible-position-when-the-script-started idtext-track-api:earliest-possible-position-when-the-script-started>earliest possible position when the script started/a>, in a href#text-track-cue-order idtext-track-api:text-track-cue-order>text track cue order/a>. Otherwise, it must return null. For each code idtext-track-api:texttrack-22>a href#texttrack>TextTrack/a>/code> object, when an object is returned, the same code idtext-track-api:texttrackcuelist-6>a href#texttrackcuelist>TextTrackCueList/a>/code> object must be returned each time./p> p>The dfn idearliest-possible-position-when-the-script-started>earliest possible position when the script started/dfn> is whatever the a href#earliest-possible-position idtext-track-api:earliest-possible-position>earliest possible position/a> was the last time the a href#event-loop idtext-track-api:event-loop>event loop/a> reached step 1./p> p>If the a href#text-track-mode idtext-track-api:text-track-mode-8>text track mode/a> of the a href#text-track idtext-track-api:text-track-23>text track/a> that the code idtext-track-api:texttrack-23>a href#texttrack>TextTrack/a>/code> object represents is not the a href#text-track-disabled idtext-track-api:text-track-disabled-5>text track disabled/a> mode, then the dfn iddom-texttrack-activecues>code>activeCues/code>/dfn> attribute must return a a href#live idtext-track-api:live-2>live/a> code idtext-track-api:texttrackcuelist-7>a href#texttrackcuelist>TextTrackCueList/a>/code> object that represents the subset of the a href#text-track-list-of-cues idtext-track-api:text-track-list-of-cues-9>text track list of cues/a> of the a href#text-track idtext-track-api:text-track-24>text track/a> that the code idtext-track-api:texttrack-24>a href#texttrack>TextTrack/a>/code> object represents whose a href#active-flag-was-set-when-the-script-started idtext-track-api:active-flag-was-set-when-the-script-started>active flag was set when the script started/a>, in a href#text-track-cue-order idtext-track-api:text-track-cue-order-2>text track cue order/a>. Otherwise, it must return null. For each code idtext-track-api:texttrack-25>a href#texttrack>TextTrack/a>/code> object, when an object is returned, the same code idtext-track-api:texttrackcuelist-8>a href#texttrackcuelist>TextTrackCueList/a>/code> object must be returned each time./p> p>A a href#text-track-cue idtext-track-api:text-track-cue-3>text track cue/a>s dfn idactive-flag-was-set-when-the-script-started>active flag was set when the script started/dfn> if its a href#text-track-cue-active-flag idtext-track-api:text-track-cue-active-flag>text track cue active flag/a> was set the last time the a href#event-loop idtext-track-api:event-loop-2>event loop/a> reached a href#step1>step 1/a>./p> hr> p>The dfn iddom-texttrack-addcue>code>addCue(var>cue/var>)/code>/dfn> method of code idtext-track-api:texttrack-26>a href#texttrack>TextTrack/a>/code> objects, when invoked, must run the following steps:/p> ol>li>p>If the a href#text-track-list-of-cues idtext-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 idtext-track-api:rules-for-updating-the-text-track-rendering-2>rules for updating the text track rendering/a>, then associate the a href#text-track-list-of-cues idtext-track-api:text-track-list-of-cues-11>text track list of cues/a> with the a href#rules-for-updating-the-text-track-rendering idtext-track-api:rules-for-updating-the-text-track-rendering-3>rules for updating the text track rendering/a> appropriate to var>cue/var>./p> li>p>If a href#text-track-list-of-cues idtext-track-api:text-track-list-of-cues-12>text track list of cues/a> associated a href#rules-for-updating-the-text-track-rendering idtext-track-api:rules-for-updating-the-text-track-rendering-4>rules for updating the text track rendering/a> are not the same a href#rules-for-updating-the-text-track-rendering idtext-track-api:rules-for-updating-the-text-track-rendering-5>rules for updating the text track rendering/a> as appropriate for var>cue/var>, then throw an a idtext-track-api:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idtext-track-api:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps./p> li>p>If the given var>cue/var> is in a a href#text-track-list-of-cues idtext-track-api:text-track-list-of-cues-13>text track list of cues/a>, then remove var>cue/var> from that a href#text-track-list-of-cues idtext-track-api:text-track-list-of-cues-14>text track list of cues/a>.li>p>Add var>cue/var> to the code idtext-track-api:texttrack-27>a href#texttrack>TextTrack/a>/code> objects a href#text-track idtext-track-api:text-track-25>text track/a>s a href#text-track-list-of-cues idtext-track-api:text-track-list-of-cues-15>text track list of cues/a>./ol> p>The dfn iddom-texttrack-removecue>code>removeCue(var>cue/var>)/code>/dfn> method of code idtext-track-api:texttrack-28>a href#texttrack>TextTrack/a>/code> objects, when invoked, must run the following steps:/p> ol>li>p>If the given var>cue/var> is not in the code idtext-track-api:texttrack-29>a href#texttrack>TextTrack/a>/code> objects a href#text-track idtext-track-api:text-track-26>text track/a>s a href#text-track-list-of-cues idtext-track-api:text-track-list-of-cues-16>text track list of cues/a>, then throw a a idtext-track-api:notfounderror hrefhttps://heycam.github.io/webidl/#notfounderror data-x-internalnotfounderror>code>NotFoundError/code>/a> code idtext-track-api:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Remove var>cue/var> from the code idtext-track-api:texttrack-30>a href#texttrack>TextTrack/a>/code> objects a href#text-track idtext-track-api:text-track-27>text track/a>s a href#text-track-list-of-cues idtext-track-api:text-track-list-of-cues-17>text track list of cues/a>./ol> div classexample> p>In this example, an code idtext-track-api:the-audio-element>a href#the-audio-element>audio/a>/code> element is used to play a specific sound-effect from a sound file containing many sound effects. A cue is used to pause the audio, so that it ends exactly at the end of the clip, even if the browser is busy running some script. If the page had relied on script to pause the audio, then the start of the next clip might be heard if the browser was not able to run the script at the exact time specified./p> pre>var sfx new Audio(sfx.wav);var sounds sfx.addTextTrack(metadata);// add sounds we care aboutfunction addFX(start, end, name) { var cue new VTTCue(start, end, ); cue.id name; cue.pauseOnExit true; sounds.addCue(cue);}addFX(12.783, 13.612, dog bark);addFX(13.612, 15.091, kitten mew))function playSound(id) { sfx.currentTime sounds.getCueById(id).startTime; sfx.play();}// play a bark as soon as we cansfx.oncanplaythrough function () { playSound(dog bark);}// meow when the user tries to leave,// and have the browser ask them to staywindow.onbeforeunload function (e) { playSound(kitten mew); e.preventDefault();}/pre> /div> hr> pre classidl>ExposedWindowinterface dfn idtexttrackcuelist>TextTrackCueList/dfn> { readonly attribute unsigned long a href#dom-texttrackcuelist-length idtext-track-api:dom-texttrackcuelist-length>length/a>; a href#dom-texttrackcuelist-item>getter/a> a href#texttrackcue idtext-track-api:texttrackcue-3>TextTrackCue/a> (unsigned long index); a href#texttrackcue idtext-track-api:texttrackcue-4>TextTrackCue/a>? a href#dom-texttrackcuelist-getcuebyid idtext-track-api:dom-texttrackcuelist-getcuebyid>getCueById/a>(DOMString id);};/pre> dl classdomintro>dt>var>cuelist/var> . code idtext-track-api:dom-texttrackcuelist-length-2>a href#dom-texttrackcuelist-length>length/a>/code>dd> p>Returns the number of a href#text-track-cue idtext-track-api:text-track-cue-4>cues/a> in the list./p> dt>var>cuelist/var>var>index/var>dd> p>Returns the a href#text-track-cue idtext-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 idtext-track-api:text-track-cue-order-3>text track cue order/a>./p> dt>var>cuelist/var> . code idtext-track-api:dom-texttrackcuelist-getcuebyid-2>a href#dom-texttrackcuelist-getcuebyid>getCueById/a>/code>( var>id/var> )dd> p>Returns the first a href#text-track-cue idtext-track-api:text-track-cue-6>text track cue/a> (in a href#text-track-cue-order idtext-track-api:text-track-cue-order-4>text track cue order/a>) with a href#text-track-cue-identifier idtext-track-api:text-track-cue-identifier>text track cue identifier/a> var>id/var>./p> p>Returns null if none of the cues have the given identifier or if the argument is the empty string./p> /dl> p>A code idtext-track-api:texttrackcuelist-9>a href#texttrackcuelist>TextTrackCueList/a>/code> object represents a dynamically updating list of a href#text-track-cue idtext-track-api:text-track-cue-7>text track cues/a> in a given order./p> p>The dfn iddom-texttrackcuelist-length>code>length/code>/dfn> attribute must return the number of a href#text-track-cue idtext-track-api:text-track-cue-8>cues/a> in the list represented by the code idtext-track-api:texttrackcuelist-10>a href#texttrackcuelist>TextTrackCueList/a>/code> object./p> p>The a idtext-track-api:supported-property-indices-3 hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a> of a code idtext-track-api:texttrackcuelist-11>a href#texttrackcuelist>TextTrackCueList/a>/code> object at any instant are the numbers from zero to the number of a href#text-track-cue idtext-track-api:text-track-cue-9>cues/a> in the list represented by the code idtext-track-api:texttrackcuelist-12>a href#texttrackcuelist>TextTrackCueList/a>/code> object minus one, if any. If there are no a href#text-track-cue idtext-track-api:text-track-cue-10>cues/a> in the list, there are no a idtext-track-api:supported-property-indices-4 hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a>./p> p iddom-texttrackcuelist-item>To a idtext-track-api:determine-the-value-of-an-indexed-property-2 hrefhttps://heycam.github.io/webidl/#dfn-determine-the-value-of-an-indexed-property data-x-internaldetermine-the-value-of-an-indexed-property>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 idtext-track-api:text-track-cue-11>text track cue/a> in the list represented by the code idtext-track-api:texttrackcuelist-13>a href#texttrackcuelist>TextTrackCueList/a>/code> object./p> p>The dfn iddom-texttrackcuelist-getcuebyid>code>getCueById(var>id/var>)/code>/dfn> method, when called with an argument other than the empty string, must return the first a href#text-track-cue idtext-track-api:text-track-cue-12>text track cue/a> in the list represented by the code idtext-track-api:texttrackcuelist-14>a href#texttrackcuelist>TextTrackCueList/a>/code> object whose a href#text-track-cue-identifier idtext-track-api:text-track-cue-identifier-2>text track cue identifier/a> is var>id/var>, if any, or null otherwise. If the argument is the empty string, then the method must return null./p> hr> pre classidl>ExposedWindowinterface dfn idtexttrackcue>TextTrackCue/dfn> : a idtext-track-api:eventtarget-3 hrefhttps://dom.spec.whatwg.org/#interface-eventtarget data-x-internaleventtarget>EventTarget/a> { readonly attribute a href#texttrack idtext-track-api:texttrack-31>TextTrack/a>? a href#dom-texttrackcue-track idtext-track-api:dom-texttrackcue-track>track/a>; attribute DOMString a href#dom-texttrackcue-id idtext-track-api:dom-texttrackcue-id>id/a>; attribute double a href#dom-texttrackcue-starttime idtext-track-api:dom-texttrackcue-starttime>startTime/a>; attribute double a href#dom-texttrackcue-endtime idtext-track-api:dom-texttrackcue-endtime>endTime/a>; attribute boolean a href#dom-texttrackcue-pauseonexit idtext-track-api:dom-texttrackcue-pauseonexit>pauseOnExit/a>; attribute a href#eventhandler idtext-track-api:eventhandler-5>EventHandler/a> a href#handler-texttrackcue-onenter idtext-track-api:handler-texttrackcue-onenter>onenter/a>; attribute a href#eventhandler idtext-track-api:eventhandler-6>EventHandler/a> a href#handler-texttrackcue-onexit idtext-track-api:handler-texttrackcue-onexit>onexit/a>;};/pre> dl classdomintro>dt>var>cue/var> . a href#dom-texttrackcue-track idtext-track-api:dom-texttrackcue-track-2>track/a>dd> p>Returns the code idtext-track-api:texttrack-32>a href#texttrack>TextTrack/a>/code> object to which this a href#text-track-cue idtext-track-api:text-track-cue-13>text track cue/a> belongs, if any, or null otherwise./p> dt>var>cue/var> . a href#dom-texttrackcue-id idtext-track-api:dom-texttrackcue-id-2>id/a> var>value/var> dd> p>Returns the a href#text-track-cue-identifier idtext-track-api:text-track-cue-identifier-3>text track cue identifier/a>./p> p>Can be set./p> dt>var>cue/var> . a href#dom-texttrackcue-starttime idtext-track-api:dom-texttrackcue-starttime-2>startTime/a> var>value/var> dd> p>Returns the a href#text-track-cue-start-time idtext-track-api:text-track-cue-start-time>text track cue start time/a>, in seconds./p> p>Can be set./p> dt>var>cue/var> . a href#dom-texttrackcue-endtime idtext-track-api:dom-texttrackcue-endtime-2>endTime/a> var>value/var> dd> p>Returns the a href#text-track-cue-end-time idtext-track-api:text-track-cue-end-time-2>text track cue end time/a>, in seconds./p> p>Can be set./p> dt>var>cue/var> . a href#dom-texttrackcue-pauseonexit idtext-track-api:dom-texttrackcue-pauseonexit-2>pauseOnExit/a> var>value/var> dd> p>Returns true if the a href#text-track-cue-pause-on-exit-flag idtext-track-api:text-track-cue-pause-on-exit-flag>text track cue pause-on-exit flag/a> is set, false otherwise./p> p>Can be set./p> /dl> p>The dfn iddom-texttrackcue-track>code>track/code>/dfn> attribute, on getting, must return the code idtext-track-api:texttrack-33>a href#texttrack>TextTrack/a>/code> object of the a href#text-track idtext-track-api:text-track-28>text track/a> in whose a href#text-track-list-of-cues idtext-track-api:text-track-list-of-cues-18>list of cues/a> the a href#text-track-cue idtext-track-api:text-track-cue-14>text track cue/a> that the code idtext-track-api:texttrackcue-5>a href#texttrackcue>TextTrackCue/a>/code> object represents finds itself, if any; or null otherwise./p> p>The dfn iddom-texttrackcue-id>code>id/code>/dfn> attribute, on getting, must return the a href#text-track-cue-identifier idtext-track-api:text-track-cue-identifier-4>text track cue identifier/a> of the a href#text-track-cue idtext-track-api:text-track-cue-15>text track cue/a> that the code idtext-track-api:texttrackcue-6>a href#texttrackcue>TextTrackCue/a>/code> object represents. On setting, the a href#text-track-cue-identifier idtext-track-api:text-track-cue-identifier-5>text track cue identifier/a> must be set to the new value./p> p>The dfn iddom-texttrackcue-starttime>code>startTime/code>/dfn> attribute, on getting, must return the a href#text-track-cue-start-time idtext-track-api:text-track-cue-start-time-2>text track cue start time/a> of the a href#text-track-cue idtext-track-api:text-track-cue-16>text track cue/a> that the code idtext-track-api:texttrackcue-7>a href#texttrackcue>TextTrackCue/a>/code> object represents, in seconds. On setting, the a href#text-track-cue-start-time idtext-track-api:text-track-cue-start-time-3>text track cue start time/a> must be set to the new value, interpreted in seconds; then, if the code idtext-track-api:texttrackcue-8>a href#texttrackcue>TextTrackCue/a>/code> objects a href#text-track-cue idtext-track-api:text-track-cue-17>text track cue/a> is in a a href#text-track idtext-track-api:text-track-29>text track/a>s a href#text-track-list-of-cues idtext-track-api:text-track-list-of-cues-19>list of cues/a>, and that a href#text-track idtext-track-api:text-track-30>text track/a> is in a a href#media-element idtext-track-api:media-element-10>media element/a>s a href#list-of-text-tracks idtext-track-api:list-of-text-tracks-7>list of text tracks/a>, and the a href#media-element idtext-track-api:media-element-11>media element/a>s a href#show-poster-flag idtext-track-api:show-poster-flag>show poster flag/a> is not set, then run the i idtext-track-api:time-marches-on>a href#time-marches-on>time marches on/a>/i> steps for that a href#media-element idtext-track-api:media-element-12>media element/a>./p> p>The dfn iddom-texttrackcue-endtime>code>endTime/code>/dfn> attribute, on getting, must return the a href#text-track-cue-end-time idtext-track-api:text-track-cue-end-time-3>text track cue end time/a> of the a href#text-track-cue idtext-track-api:text-track-cue-18>text track cue/a> that the code idtext-track-api:texttrackcue-9>a href#texttrackcue>TextTrackCue/a>/code> object represents, in seconds. On setting, the a href#text-track-cue-end-time idtext-track-api:text-track-cue-end-time-4>text track cue end time/a> must be set to the new value, interpreted in seconds; then, if the code idtext-track-api:texttrackcue-10>a href#texttrackcue>TextTrackCue/a>/code> objects a href#text-track-cue idtext-track-api:text-track-cue-19>text track cue/a> is in a a href#text-track idtext-track-api:text-track-31>text track/a>s a href#text-track-list-of-cues idtext-track-api:text-track-list-of-cues-20>list of cues/a>, and that a href#text-track idtext-track-api:text-track-32>text track/a> is in a a href#media-element idtext-track-api:media-element-13>media element/a>s a href#list-of-text-tracks idtext-track-api:list-of-text-tracks-8>list of text tracks/a>, and the a href#media-element idtext-track-api:media-element-14>media element/a>s a href#show-poster-flag idtext-track-api:show-poster-flag-2>show poster flag/a> is not set, then run the i idtext-track-api:time-marches-on-2>a href#time-marches-on>time marches on/a>/i> steps for that a href#media-element idtext-track-api:media-element-15>media element/a>./p> p>The dfn iddom-texttrackcue-pauseonexit>code>pauseOnExit/code>/dfn> attribute, on getting, must return true if the a href#text-track-cue-pause-on-exit-flag idtext-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 idtext-track-api:text-track-cue-20>text track cue/a> that the code idtext-track-api:texttrackcue-11>a href#texttrackcue>TextTrackCue/a>/code> object represents is set; or false otherwise. On setting, the a href#text-track-cue-pause-on-exit-flag idtext-track-api:text-track-cue-pause-on-exit-flag-3>text track cue pause-on-exit flag/a> must be set if the new value is true, and must be unset otherwise./p> h6 idcue-events>span classsecno>4.8.12.11.6/span> Event handlers for objects of the text track APIsa href#cue-events classself-link>/a>/h6> p>The following are the a href#event-handlers idcue-events:event-handlers>event handlers/a> that (and their corresponding a href#event-handler-event-type idcue-events:event-handler-event-type>event handler event types/a>) that must be supported, as a href#event-handler-idl-attributes idcue-events:event-handler-idl-attributes>event handler IDL attributes/a>, by all objects implementing the code idcue-events:texttracklist>a href#texttracklist>TextTrackList/a>/code> interface:/p> table>thead>tr>th>a href#event-handlers idcue-events:event-handlers-2>Event handler/a> th>a href#event-handler-event-type idcue-events:event-handler-event-type-2>Event handler event type/a> tbody>tr>td>dfn idhandler-texttracklist-onchange>code>onchange/code>/dfn> td> code idcue-events:event-media-change>a href#event-media-change>change/a>/code> tr>td>dfn idhandler-texttracklist-onaddtrack>code>onaddtrack/code>/dfn> td> code idcue-events:event-media-addtrack>a href#event-media-addtrack>addtrack/a>/code> tr>td>dfn idhandler-texttracklist-onremovetrack>code>onremovetrack/code>/dfn> td> code idcue-events:event-media-removetrack>a href#event-media-removetrack>removetrack/a>/code> /table> p>The following are the a href#event-handlers idcue-events:event-handlers-3>event handlers/a> that (and their corresponding a href#event-handler-event-type idcue-events:event-handler-event-type-3>event handler event types/a>) that must be supported, as a href#event-handler-idl-attributes idcue-events:event-handler-idl-attributes-2>event handler IDL attributes/a>, by all objects implementing the code idcue-events:texttrack>a href#texttrack>TextTrack/a>/code> interface:/p> table>thead>tr>th>a href#event-handlers idcue-events:event-handlers-4>Event handler/a> th>a href#event-handler-event-type idcue-events:event-handler-event-type-4>Event handler event type/a> tbody>tr>td>dfn idhandler-texttrack-oncuechange>code>oncuechange/code>/dfn> td> code idcue-events:event-media-cuechange>a href#event-media-cuechange>cuechange/a>/code> /table> p>The following are the a href#event-handlers idcue-events:event-handlers-5>event handlers/a> (and their corresponding a href#event-handler-event-type idcue-events:event-handler-event-type-5>event handler event types/a>) that must be supported, as a href#event-handler-idl-attributes idcue-events:event-handler-idl-attributes-3>event handler IDL attributes/a>, by all objects implementing the code idcue-events:texttrackcue>a href#texttrackcue>TextTrackCue/a>/code> interface:/p> table>thead>tr>th>a href#event-handlers idcue-events:event-handlers-6>Event handler/a> th>a href#event-handler-event-type idcue-events:event-handler-event-type-6>Event handler event type/a> tbody>tr>td>dfn idhandler-texttrackcue-onenter>code>onenter/code>/dfn> td> code idcue-events:event-media-enter>a href#event-media-enter>enter/a>/code> tr>td>dfn idhandler-texttrackcue-onexit>code>onexit/code>/dfn> td> code idcue-events:event-media-exit>a href#event-media-exit>exit/a>/code> /table> h6 idbest-practices-for-metadata-text-tracks>span classsecno>4.8.12.11.7/span> Best practices for metadata text tracksa href#best-practices-for-metadata-text-tracks classself-link>/a>/h6> p>i>This section is non-normative./i>/p> p>Text tracks can be used for storing data relating to the media data, for interactive or augmented views./p> p>For example, a page showing a sports broadcast could include information about the current score. Suppose a robotics competition was being streamed live. The image could be overlayed with the scores, as follows:/p> p>iframe srcdata:text/html;charsetutf-8,%3C!DOCTYPE%20html%3E%0A%3Cstyle%3E%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%3C%2Fstyle%3E%0A%3Cdiv%3E%0A%20%3Cimg%20src%3D%22https%3A%2F%2Fhtml.spec.whatwg.org%2Fimages%2Frobots.jpeg%22%3E%0A%20%3Cp%20class%3D%22score%20left%22%3E%3Cspan%3ERed%20Alliance%3C%2Fspan%3E%20%3Cspan%3E78%3C%2Fspan%3E%3C%2Fp%3E%0A%20%3Cp%20class%3D%22score%20right%22%3E%3Cspan%3EBlue%20Alliance%3C%2Fspan%3E%20%3Cspan%3E66%3C%2Fspan%3E%3C%2Fp%3E%0A%20%3Cp%20class%3D%22score%20middle%22%3E%3Cspan%3EQual%20Match%2037%3C%2Fspan%3E%20%3Cspan%3EFriday%2014%3A21%3C%2Fspan%3E%0A%3C%2Fdiv%3E width600 height400>/iframe> p>In order to make the score display render correctly whenever the user seeks to an arbitrary point in the video, the metadata text track cues need to be as long as is appropriate for the score. For example, in the frame above, there would be maybe one cue that lasts the length of the match that gives the match number, one cue that lasts until the blue alliances score changes, and one cue that lasts until the red alliances score changes. If the video is just a stream of the live event, the time in the bottom right would presumably be automatically derived from the current video time, rather than based on a cue. However, if the video was just the highlights, then that might be given in cues also./p> p>The following shows what fragments of this could look like in a WebVTT file:/p> pre>WEBVTT...05:10:00.000 --> 05:12:15.000matchtype:qualmatchnumber:37...05:11:02.251 --> 05:11:17.198red:7805:11:03.672 --> 05:11:54.198blue:6605:11:17.198 --> 05:11:25.912red:8005:11:25.912 --> 05:11:26.522red:8305:11:26.522 --> 05:11:26.982red:8605:11:26.982 --> 05:11:27.499red:89.../pre> p>The key here is to notice that the information is given in cues that span the length of time to which the relevant event applies. If, instead, the scores were given as zero-length (or very brief, nearly zero-length) cues when the score changes, for example saying red+2 at 05:11:17.198, red+3 at 05:11:25.912, etc, problems arise: primarily, seeking is much harder to implement, as the script has to walk the entire list of cues to make sure that no notifications have been missed; but also, if the cues are short its possible the script will never see that they are active unless it listens to them specifically./p> p>When using cues in this manner, authors are encouraged to use the code idbest-practices-for-metadata-text-tracks:event-media-cuechange>a href#event-media-cuechange>cuechange/a>/code> event to update the current annotations. (In particular, using the code idbest-practices-for-metadata-text-tracks:event-media-timeupdate>a href#event-media-timeupdate>timeupdate/a>/code> event would be less appropriate as it would require doing work even when the cues havent changed, and, more importantly, would introduce a higher latency between when the metadata cues become active and when the display is updated, since code idbest-practices-for-metadata-text-tracks:event-media-timeupdate-2>a href#event-media-timeupdate>timeupdate/a>/code> events are rate-limited.)/p> h5 ididentifying-a-track-kind-through-a-url>span classsecno>4.8.12.12/span> Identifying a track kind through a URLa href#identifying-a-track-kind-through-a-url classself-link>/a>/h5> p>Other specifications or formats that need a a ididentifying-a-track-kind-through-a-url:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> to identify the return values of the code ididentifying-a-track-kind-through-a-url:dom-audiotrack-kind>a href#dom-audiotrack-kind>AudioTrack.kind/a>/code> or code ididentifying-a-track-kind-through-a-url:dom-videotrack-kind>a href#dom-videotrack-kind>VideoTrack.kind/a>/code> IDL attributes, or identify the a href#text-track-kind ididentifying-a-track-kind-through-a-url:text-track-kind>kind of text track/a>, must use the code ididentifying-a-track-kind-through-a-url:about:html-kind>a href#about:html-kind>about:html-kind/a>/code> a ididentifying-a-track-kind-through-a-url:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>./p> h5 iduser-interface>span classsecno>4.8.12.13/span> User interfacea href#user-interface classself-link>/a>/h5> p>The dfn idattr-media-controls>code>controls/code>/dfn> attribute is a a href#boolean-attribute iduser-interface:boolean-attribute>boolean attribute/a>. If present, it indicates that the author has not provided a scripted controller and would like the user agent to provide its own set of controls./p> p>If the attribute is present, or if a href#concept-n-noscript iduser-interface:concept-n-noscript>scripting is disabled/a> for the a href#media-element iduser-interface:media-element>media element/a>, then the user agent should dfn idexpose-a-user-interface-to-the-user>expose a user interface to the user/dfn>. This user interface should include features to begin playback, pause playback, seek to an arbitrary position in the content (if the content supports arbitrary seeking), change the volume, change the display of closed captions or embedded sign-language tracks, select different audio tracks or turn on audio descriptions, and show the media content in manners more suitable to the user (e.g. fullscreen video or in an independent resizable window). Other controls may also be made available./p> p>Even when the attribute is absent, however, user agents may provide controls to affect playback of the media resource (e.g. play, pause, seeking, track selection, and volume controls), but such features should not interfere with the pages normal rendering. For example, such features could be exposed in the a href#media-element iduser-interface:media-element-2>media element/a>s context menu, platform media keys, or a remote control. The user agent may implement this simply by a href#expose-a-user-interface-to-the-user iduser-interface:expose-a-user-interface-to-the-user>exposing a user interface to the user/a> as described above (as if the code iduser-interface:attr-media-controls>a href#attr-media-controls>controls/a>/code> attribute was present)./p> p>If the user agent a href#expose-a-user-interface-to-the-user iduser-interface:expose-a-user-interface-to-the-user-2>exposes a user interface to the user/a> by displaying controls over the a href#media-element iduser-interface:media-element-3>media element/a>, then the user agent should suppress any user interaction events while the user agent is interacting with this interface. (For example, if the user clicks on a videos playback control, code iduser-interface:event-mousedown>a data-x-internalevent-mousedown hrefhttps://w3c.github.io/uievents/#event-type-mousedown>mousedown/a>/code> events and so forth would not simultaneously be fired at elements on the page.)/p> p>Where possible (specifically, for starting, stopping, pausing, and unpausing playback, for seeking, for changing the rate of playback, for fast-forwarding or rewinding, for listing, enabling, and disabling text tracks, and for muting or changing the volume of the audio), user interface features exposed by the user agent must be implemented in terms of the DOM API described above, so that, e.g., all the same events fire./p> p>Features such as fast-forward or rewind must be implemented by only changing the code>playbackRate/code> attribute (and not the code>defaultPlaybackRate/code> attribute)./p> p>Seeking must be implemented in terms of a href#dom-media-seek iduser-interface:dom-media-seek>seeking/a> to the requested position in the a href#media-element iduser-interface:media-element-4>media element/a>s a href#media-timeline iduser-interface:media-timeline>media timeline/a>. For media resources where seeking to an arbitrary position would be slow, user agents are encouraged to use the i>approximate-for-speed/i> flag when seeking in response to the user manipulating an approximate position interface such as a seek bar./p> p>The dfn iddom-media-controls>code>controls/code>/dfn> IDL attribute must a href#reflect iduser-interface:reflect>reflect/a> the content attribute of the same name./p> hr> dl classdomintro>dt>var>media/var> . code iduser-interface:dom-media-volume>a href#dom-media-volume>volume/a>/code> var>value/var> dd> p>Returns the current playback volume, as a number in the range 0.0 to 1.0, where 0.0 is the quietest and 1.0 the loudest./p> p>Can be set, to change the volume./p> p>Throws an a iduser-interface:indexsizeerror hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code iduser-interface:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the new value is not in the range 0.0 .. 1.0./p> dt>var>media/var> . code iduser-interface:dom-media-muted>a href#dom-media-muted>muted/a>/code> var>value/var> dd> p>Returns true if audio is muted, overriding the code iduser-interface:dom-media-volume-2>a href#dom-media-volume>volume/a>/code> attribute, and false if the code iduser-interface:dom-media-volume-3>a href#dom-media-volume>volume/a>/code> attribute is being honored./p> p>Can be set, to change whether the audio is muted or not./p> /dl> p>A a href#media-element iduser-interface:media-element-5>media element/a> has a dfn idconcept-media-volume>playback volume/dfn>, which is a fraction in the range 0.0 (silent) to 1.0 (loudest). Initially, the volume should be 1.0, but user agents may remember the last set value across sessions, on a per-site basis or otherwise, so the volume may start at other values./p> p>The dfn iddom-media-volume>code>volume/code>/dfn> IDL attribute must return the a href#concept-media-volume iduser-interface:concept-media-volume>playback volume/a> of any audio portions of the a href#media-element iduser-interface:media-element-6>media element/a>. On setting, if the new value is in the range 0.0 to 1.0 inclusive, the a href#media-element iduser-interface:media-element-7>media element/a>s a href#concept-media-volume iduser-interface:concept-media-volume-2>playback volume/a> must be set to the new value. If the new value is outside the range 0.0 to 1.0 inclusive, then, on setting, an a iduser-interface:indexsizeerror-2 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code iduser-interface:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> must be thrown instead./p> p>A a href#media-element iduser-interface:media-element-8>media element/a> can also be dfn idconcept-media-muted>muted/dfn>. If anything is muting the element, then it is muted. (For example, when the a href#direction-of-playback iduser-interface:direction-of-playback>direction of playback/a> is backwards, the element is muted.)/p> p>The dfn iddom-media-muted>code>muted/code>/dfn> IDL attribute must return the value to which it was last set. When a a href#media-element iduser-interface:media-element-9>media element/a> is created, if the element has a code iduser-interface:attr-media-muted>a href#attr-media-muted>muted/a>/code> content attribute specified, then the code iduser-interface:dom-media-muted-2>a href#dom-media-muted>muted/a>/code> IDL attribute should be set to true; otherwise, the user agents may set the value to the users preferred value (e.g. remembering the last set value across sessions, on a per-site basis or otherwise). While the code iduser-interface:dom-media-muted-3>a href#dom-media-muted>muted/a>/code> IDL attribute is set to true, the a href#media-element iduser-interface:media-element-10>media element/a> must be a href#concept-media-muted iduser-interface:concept-media-muted>muted/a>./p> p>Whenever either of the values that would be returned by the code iduser-interface:dom-media-volume-4>a href#dom-media-volume>volume/a>/code> and code iduser-interface:dom-media-muted-4>a href#dom-media-muted>muted/a>/code> IDL attributes change, the user agent must a href#queue-a-task iduser-interface:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire iduser-interface:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code iduser-interface:event-media-volumechange>a href#event-media-volumechange>volumechange/a>/code> at the a href#media-element iduser-interface:media-element-11>media element/a>. Then, if the a href#media-element iduser-interface:media-element-12>media element/a> is not a href#allowed-to-play iduser-interface:allowed-to-play>allowed to play/a>, the user agent must run the a href#internal-pause-steps iduser-interface:internal-pause-steps>internal pause steps/a> for the a href#media-element iduser-interface:media-element-13>media element/a>./p> p>An elements dfn ideffective-media-volume>effective media volume/dfn> is determined as follows:/p> ol>li>p>If the user has indicated that the user agent is to override the volume of the element, then the elements a href#effective-media-volume iduser-interface:effective-media-volume>effective media volume/a> is the volume desired by the user. Abort these steps.li>p>If the elements audio output is a href#concept-media-muted iduser-interface:concept-media-muted-2>muted/a>, the elements a href#effective-media-volume iduser-interface:effective-media-volume-2>effective media volume/a> is zero. Abort these steps.li>p>Let var>volume/var> be the a href#concept-media-volume iduser-interface:concept-media-volume-3>playback volume/a> of the audio portions of the a href#media-element iduser-interface:media-element-14>media element/a>, in range 0.0 (silent) to 1.0 (loudest).li>p>The elements a href#effective-media-volume iduser-interface:effective-media-volume-3>effective media volume/a> is var>volume/var>, interpreted relative to the range 0.0 to 1.0, with 0.0 being silent, and 1.0 being the loudest setting, values in between increasing in loudness. The range need not be linear. The loudest setting may be lower than the systems loudest possible setting; for example the user could have set a maximum volume./ol> p>The dfn idattr-media-muted>code>muted/code>/dfn> content attribute on a href#media-element iduser-interface:media-element-15>media elements/a> is a a href#boolean-attribute iduser-interface:boolean-attribute-2>boolean attribute/a> that controls the default state of the audio output of the a href#media-resource iduser-interface:media-resource>media resource/a>, potentially overriding user preferences./p> p>The dfn iddom-media-defaultmuted>code>defaultMuted/code>/dfn> IDL attribute must a href#reflect iduser-interface:reflect-2>reflect/a> the code iduser-interface:attr-media-muted-2>a href#attr-media-muted>muted/a>/code> content attribute./p> p classnote>This attribute has no dynamic effect (it only controls the default state of the element)./p> div classexample> p>This video (an advertisement) autoplays, but to avoid annoying users, it does so without sound, and allows the user to turn the sound on. The user agent can pause the video if its unmuted without a user interaction./p> pre><video srcadverts.cgi?kindvideo controls autoplay loop muted></video>/pre> /div> h5 idtime-ranges>span classsecno>4.8.12.14/span> Time rangesa href#time-ranges classself-link>/a>/h5> p>Objects implementing the code idtime-ranges:timeranges>a href#timeranges>TimeRanges/a>/code> interface represent a list of ranges (periods) of time./p> pre classidl>ExposedWindowinterface dfn idtimeranges>TimeRanges/dfn> { readonly attribute unsigned long a href#dom-timeranges-length idtime-ranges:dom-timeranges-length>length/a>; double a href#dom-timeranges-start idtime-ranges:dom-timeranges-start>start/a>(unsigned long index); double a href#dom-timeranges-end idtime-ranges:dom-timeranges-end>end/a>(unsigned long index);};/pre> dl classdomintro>dt>var>media/var> . code idtime-ranges:dom-timeranges-length-2>a href#dom-timeranges-length>length/a>/code>dd> p>Returns the number of ranges in the object./p> dt>var>time/var> var>media/var> . code idtime-ranges:dom-timeranges-start-2>a href#dom-timeranges-start>start/a>/code>(var>index/var>)dd> p>Returns the time for the start of the range with the given index./p> p>Throws an a idtime-ranges:indexsizeerror hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idtime-ranges:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the index is out of range./p> dt>var>time/var> var>media/var> . code idtime-ranges:dom-timeranges-end-2>a href#dom-timeranges-end>end/a>/code>(var>index/var>)dd> p>Returns the time for the end of the range with the given index./p> p>Throws an a idtime-ranges:indexsizeerror-2 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idtime-ranges:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the index is out of range./p> /dl> p>The dfn iddom-timeranges-length>code>length/code>/dfn> IDL attribute must return the number of ranges represented by the object./p> p>The dfn iddom-timeranges-start>code>start(var>index/var>)/code>/dfn> method must return the position of the start of the var>index/var>th range represented by the object, in seconds measured from the start of the timeline that the object covers./p> p>The dfn iddom-timeranges-end>code>end(var>index/var>)/code>/dfn> method must return the position of the end of the var>index/var>th range represented by the object, in seconds measured from the start of the timeline that the object covers./p> p>These methods must throw a idtime-ranges:indexsizeerror-3 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idtime-ranges:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>s if called with an var>index/var> argument greater than or equal to the number of ranges represented by the object./p> p>When a code idtime-ranges:timeranges-2>a href#timeranges>TimeRanges/a>/code> object is said to be a dfn idnormalised-timeranges-object>normalized code>TimeRanges/code> object/dfn>, the ranges it represents must obey the following criteria:/p> ul>li>The start of a range must be greater than the end of all earlier ranges.li>The start of a range must be less than or equal to the end of that same range./ul> p>In other words, the ranges in such an object are ordered, dont overlap, and dont touch (adjacent ranges are folded into one bigger range). A range can be empty (referencing just a single moment in time), e.g. to indicate that only one frame is currently buffered in the case that the user agent has discarded the entire a href#media-resource idtime-ranges:media-resource>media resource/a> except for the current frame, when a a href#media-element idtime-ranges:media-element>media element/a> is paused./p> p>Ranges in a code idtime-ranges:timeranges-3>a href#timeranges>TimeRanges/a>/code> object must be inclusive./p> p classexample>Thus, the end of a range would be equal to the start of a following adjacent (touching but not overlapping) range. Similarly, a range covering a whole timeline anchored at zero would have a start equal to zero and an end equal to the duration of the timeline./p> p>The timelines used by the objects returned by the code idtime-ranges:dom-media-buffered>a href#dom-media-buffered>buffered/a>/code>, code idtime-ranges:dom-media-seekable>a href#dom-media-seekable>seekable/a>/code> and code idtime-ranges:dom-media-played>a href#dom-media-played>played/a>/code> IDL attributes of a href#media-element idtime-ranges:media-element-2>media elements/a> must be that elements a href#media-timeline idtime-ranges:media-timeline>media timeline/a>./p> h5 idthe-trackevent-interface>span classsecno>4.8.12.15/span> The code idthe-trackevent-interface:trackevent>a href#trackevent>TrackEvent/a>/code> interfacea href#the-trackevent-interface classself-link>/a>/h5> pre classidl>ExposedWindow, Constructor(DOMString type, optional a href#trackeventinit idthe-trackevent-interface:trackeventinit>TrackEventInit/a> eventInitDict)interface dfn idtrackevent>TrackEvent/dfn> : a idthe-trackevent-interface:event hrefhttps://dom.spec.whatwg.org/#interface-event data-x-internalevent>Event/a> { readonly attribute (a href#videotrack idthe-trackevent-interface:videotrack>VideoTrack/a> or a href#audiotrack idthe-trackevent-interface:audiotrack>AudioTrack/a> or a href#texttrack idthe-trackevent-interface:texttrack>TextTrack/a>)? a href#dom-trackevent-track idthe-trackevent-interface:dom-trackevent-track>track/a>;};dictionary dfn idtrackeventinit>TrackEventInit/dfn> : a idthe-trackevent-interface:eventinit hrefhttps://dom.spec.whatwg.org/#dictdef-eventinit data-x-internaleventinit>EventInit/a> { (a href#videotrack idthe-trackevent-interface:videotrack-2>VideoTrack/a> or a href#audiotrack idthe-trackevent-interface:audiotrack-2>AudioTrack/a> or a href#texttrack idthe-trackevent-interface:texttrack-2>TextTrack/a>)? track null;};/pre> dl classdomintro>dt>var>event/var> . code idthe-trackevent-interface:dom-trackevent-track-2>a href#dom-trackevent-track>track/a>/code>dd> p>Returns the track object (code idthe-trackevent-interface:texttrack-3>a href#texttrack>TextTrack/a>/code>, code idthe-trackevent-interface:audiotrack-3>a href#audiotrack>AudioTrack/a>/code>, or code idthe-trackevent-interface:videotrack-3>a href#videotrack>VideoTrack/a>/code>) to which the event relates./p> /dl> p>The dfn iddom-trackevent-track>code>track/code>/dfn> attribute must return the value it was initialized to. It represents the context information for the event./p> h5 idmediaevents>span classsecno>4.8.12.16/span> Event summarya href#mediaevents classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>The following events fire on a href#media-element idmediaevents:media-element>media elements/a> as part of the processing model described above:/p> table>thead>tr>th>Event name th>Interface th>Fired when... th>Preconditions tbody>tr>td>dfn idevent-media-loadstart>code>loadstart/code>/dfn> td>code idmediaevents:event>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>The user agent begins looking for a href#media-data idmediaevents:media-data>media data/a>, as part of the a href#concept-media-load-algorithm idmediaevents:concept-media-load-algorithm>resource selection algorithm/a>. td>code idmediaevents:dom-media-networkstate>a href#dom-media-networkstate>networkState/a>/code> equals code idmediaevents:dom-media-network_loading>a href#dom-media-network_loading>NETWORK_LOADING/a>/code> tr>td>dfn idevent-media-progress>code>progress/code>/dfn> td>code idmediaevents:event-2>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>The user agent is fetching a href#media-data idmediaevents:media-data-2>media data/a>. td>code idmediaevents:dom-media-networkstate-2>a href#dom-media-networkstate>networkState/a>/code> equals code idmediaevents:dom-media-network_loading-2>a href#dom-media-network_loading>NETWORK_LOADING/a>/code> tr>td>dfn idevent-media-suspend>code>suspend/code>/dfn> td>code idmediaevents:event-3>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>The user agent is intentionally not currently fetching a href#media-data idmediaevents:media-data-3>media data/a>. td>code idmediaevents:dom-media-networkstate-3>a href#dom-media-networkstate>networkState/a>/code> equals code idmediaevents:dom-media-network_idle>a href#dom-media-network_idle>NETWORK_IDLE/a>/code> tr>td>dfn idevent-media-abort>code>abort/code>/dfn> td>code idmediaevents:event-4>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>The user agent stops fetching the a href#media-data idmediaevents:media-data-4>media data/a> before it is completely downloaded, but not due to an error. td>code idmediaevents:dom-media-error>a href#dom-media-error>error/a>/code> is an object with the code code idmediaevents:dom-mediaerror-media_err_aborted>a href#dom-mediaerror-media_err_aborted>MEDIA_ERR_ABORTED/a>/code>. code idmediaevents:dom-media-networkstate-4>a href#dom-media-networkstate>networkState/a>/code> equals either code idmediaevents:dom-media-network_empty>a href#dom-media-network_empty>NETWORK_EMPTY/a>/code> or code idmediaevents:dom-media-network_idle-2>a href#dom-media-network_idle>NETWORK_IDLE/a>/code>, depending on when the download was aborted. tr>td>dfn idevent-media-error>code>error/code>/dfn> td>code idmediaevents:event-5>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>An error occurs while fetching the a href#media-data idmediaevents:media-data-5>media data/a> or the type of the resource is not supported media format. td>code idmediaevents:dom-media-error-2>a href#dom-media-error>error/a>/code> is an object with the code code idmediaevents:dom-mediaerror-media_err_network>a href#dom-mediaerror-media_err_network>MEDIA_ERR_NETWORK/a>/code> or higher. code idmediaevents:dom-media-networkstate-5>a href#dom-media-networkstate>networkState/a>/code> equals either code idmediaevents:dom-media-network_empty-2>a href#dom-media-network_empty>NETWORK_EMPTY/a>/code> or code idmediaevents:dom-media-network_idle-3>a href#dom-media-network_idle>NETWORK_IDLE/a>/code>, depending on when the download was aborted. tr>td>dfn idevent-media-emptied>code>emptied/code>/dfn> td>code idmediaevents:event-6>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>A a href#media-element idmediaevents:media-element-2>media element/a> whose code idmediaevents:dom-media-networkstate-6>a href#dom-media-networkstate>networkState/a>/code> was previously not in the code idmediaevents:dom-media-network_empty-3>a href#dom-media-network_empty>NETWORK_EMPTY/a>/code> state has just switched to that state (either because of a fatal error during load thats about to be reported, or because the code idmediaevents:dom-media-load>a href#dom-media-load>load()/a>/code> method was invoked while the a href#concept-media-load-algorithm idmediaevents:concept-media-load-algorithm-2>resource selection algorithm/a> was already running). td>code idmediaevents:dom-media-networkstate-7>a href#dom-media-networkstate>networkState/a>/code> is code idmediaevents:dom-media-network_empty-4>a href#dom-media-network_empty>NETWORK_EMPTY/a>/code>; all the IDL attributes are in their initial states. tr>td>dfn idevent-media-stalled>code>stalled/code>/dfn> td>code idmediaevents:event-7>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>The user agent is trying to fetch a href#media-data idmediaevents:media-data-6>media data/a>, but data is unexpectedly not forthcoming. td>code idmediaevents:dom-media-networkstate-8>a href#dom-media-networkstate>networkState/a>/code> is code idmediaevents:dom-media-network_loading-3>a href#dom-media-network_loading>NETWORK_LOADING/a>/code>. tbody>tr>td>dfn idevent-media-loadedmetadata>code>loadedmetadata/code>/dfn> td>code idmediaevents:event-8>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>The user agent has just determined the duration and dimensions of the a href#media-resource idmediaevents:media-resource>media resource/a> and a href#the-text-tracks-are-ready idmediaevents:the-text-tracks-are-ready>the text tracks are ready/a>. td>code idmediaevents:dom-media-readystate>a href#dom-media-readystate>readyState/a>/code> is newly equal to code idmediaevents:dom-media-have_metadata>a href#dom-media-have_metadata>HAVE_METADATA/a>/code> or greater for the first time. tr>td>dfn idevent-media-loadeddata>code>loadeddata/code>/dfn> td>code idmediaevents:event-9>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>The user agent can render the a href#media-data idmediaevents:media-data-7>media data/a> at the a href#current-playback-position idmediaevents:current-playback-position>current playback position/a> for the first time. td>code idmediaevents:dom-media-readystate-2>a href#dom-media-readystate>readyState/a>/code> newly increased to code idmediaevents:dom-media-have_current_data>a href#dom-media-have_current_data>HAVE_CURRENT_DATA/a>/code> or greater for the first time. tr>td>dfn idevent-media-canplay>code>canplay/code>/dfn> td>code idmediaevents:event-10>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>The user agent can resume playback of the a href#media-data idmediaevents:media-data-8>media data/a>, but estimates that if playback were to be started now, the a href#media-resource idmediaevents:media-resource-2>media resource/a> could not be rendered at the current playback rate up to its end without having to stop for further buffering of content. td>code idmediaevents:dom-media-readystate-3>a href#dom-media-readystate>readyState/a>/code> newly increased to code idmediaevents:dom-media-have_future_data>a href#dom-media-have_future_data>HAVE_FUTURE_DATA/a>/code> or greater. tr>td>dfn idevent-media-canplaythrough>code>canplaythrough/code>/dfn> td>code idmediaevents:event-11>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>The user agent estimates that if playback were to be started now, the a href#media-resource idmediaevents:media-resource-3>media resource/a> could be rendered at the current playback rate all the way to its end without having to stop for further buffering. td>code idmediaevents:dom-media-readystate-4>a href#dom-media-readystate>readyState/a>/code> is newly equal to code idmediaevents:dom-media-have_enough_data>a href#dom-media-have_enough_data>HAVE_ENOUGH_DATA/a>/code>. tr>td>dfn idevent-media-playing>code>playing/code>/dfn> td>code idmediaevents:event-12>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>Playback is ready to start after having been paused or delayed due to lack of a href#media-data idmediaevents:media-data-9>media data/a>. td>code idmediaevents:dom-media-readystate-5>a href#dom-media-readystate>readyState/a>/code> is newly equal to or greater than code idmediaevents:dom-media-have_future_data-2>a href#dom-media-have_future_data>HAVE_FUTURE_DATA/a>/code> and code idmediaevents:dom-media-paused>a href#dom-media-paused>paused/a>/code> is false, or code idmediaevents:dom-media-paused-2>a href#dom-media-paused>paused/a>/code> is newly false and code idmediaevents:dom-media-readystate-6>a href#dom-media-readystate>readyState/a>/code> is equal to or greater than code idmediaevents:dom-media-have_future_data-3>a href#dom-media-have_future_data>HAVE_FUTURE_DATA/a>/code>. Even if this event fires, the element might still not be a href#potentially-playing idmediaevents:potentially-playing>potentially playing/a>, e.g. if the element is a href#paused-for-user-interaction idmediaevents:paused-for-user-interaction>paused for user interaction/a> or a href#paused-for-in-band-content idmediaevents:paused-for-in-band-content>paused for in-band content/a>. tr>td>dfn idevent-media-waiting>code>waiting/code>/dfn> td>code idmediaevents:event-13>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>Playback has stopped because the next frame is not available, but the user agent expects that frame to become available in due course. td>code idmediaevents:dom-media-readystate-7>a href#dom-media-readystate>readyState/a>/code> is equal to or less than code idmediaevents:dom-media-have_current_data-2>a href#dom-media-have_current_data>HAVE_CURRENT_DATA/a>/code>, and code idmediaevents:dom-media-paused-3>a href#dom-media-paused>paused/a>/code> is false. Either code idmediaevents:dom-media-seeking>a href#dom-media-seeking>seeking/a>/code> is true, or the a href#current-playback-position idmediaevents:current-playback-position-2>current playback position/a> is not contained in any of the ranges in code idmediaevents:dom-media-buffered>a href#dom-media-buffered>buffered/a>/code>. It is possible for playback to stop for other reasons without code idmediaevents:dom-media-paused-4>a href#dom-media-paused>paused/a>/code> being false, but those reasons do not fire this event (and when those situations resolve, a separate code idmediaevents:event-media-playing>a href#event-media-playing>playing/a>/code> event is not fired either): e.g., a href#ended-playback idmediaevents:ended-playback>playback has ended/a>, or playback a href#stopped-due-to-errors idmediaevents:stopped-due-to-errors>stopped due to errors/a>, or the element has a href#paused-for-user-interaction idmediaevents:paused-for-user-interaction-2>paused for user interaction/a> or a href#paused-for-in-band-content idmediaevents:paused-for-in-band-content-2>paused for in-band content/a>. tbody>tr>td>dfn idevent-media-seeking>code>seeking/code>/dfn> td>code idmediaevents:event-14>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>The code idmediaevents:dom-media-seeking-2>a href#dom-media-seeking>seeking/a>/code> IDL attribute changed to true, and the user agent has started seeking to a new position. td> tr>td>dfn idevent-media-seeked>code>seeked/code>/dfn> td>code idmediaevents:event-15>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>The code idmediaevents:dom-media-seeking-3>a href#dom-media-seeking>seeking/a>/code> IDL attribute changed to false after the a href#current-playback-position idmediaevents:current-playback-position-3>current playback position/a> was changed. td> tr>td>dfn idevent-media-ended>code>ended/code>/dfn> td>code idmediaevents:event-16>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>Playback has stopped because the end of the a href#media-resource idmediaevents:media-resource-4>media resource/a> was reached. td>code idmediaevents:dom-media-currenttime>a href#dom-media-currenttime>currentTime/a>/code> equals the end of the a href#media-resource idmediaevents:media-resource-5>media resource/a>; code idmediaevents:dom-media-ended>a href#dom-media-ended>ended/a>/code> is true. tbody>tr>td>dfn idevent-media-durationchange>code>durationchange/code>/dfn> td>code idmediaevents:event-17>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>The code idmediaevents:dom-media-duration>a href#dom-media-duration>duration/a>/code> attribute has just been updated. td> tr>td>dfn idevent-media-timeupdate>code>timeupdate/code>/dfn> td>code idmediaevents:event-18>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>The a href#current-playback-position idmediaevents:current-playback-position-4>current playback position/a> changed as part of normal playback or in an especially interesting way, for example discontinuously. td> tr>td>dfn idevent-media-play>code>play/code>/dfn> td>code idmediaevents:event-19>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>The element is no longer paused. Fired after the code idmediaevents:dom-media-play>a href#dom-media-play>play()/a>/code> method has returned, or when the code idmediaevents:attr-media-autoplay>a href#attr-media-autoplay>autoplay/a>/code> attribute has caused playback to begin. td>code idmediaevents:dom-media-paused-5>a href#dom-media-paused>paused/a>/code> is newly false. tr>td>dfn idevent-media-pause>code>pause/code>/dfn> td>code idmediaevents:event-20>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>The element has been paused. Fired after the code idmediaevents:dom-media-pause>a href#dom-media-pause>pause()/a>/code> method has returned. td>code idmediaevents:dom-media-paused-6>a href#dom-media-paused>paused/a>/code> is newly true. tr>td>dfn idevent-media-ratechange>code>ratechange/code>/dfn> td>code idmediaevents:event-21>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>Either the code idmediaevents:dom-media-defaultplaybackrate>a href#dom-media-defaultplaybackrate>defaultPlaybackRate/a>/code> or the code idmediaevents:dom-media-playbackrate>a href#dom-media-playbackrate>playbackRate/a>/code> attribute has just been updated. td> tbody>tr>td>dfn idevent-media-resize>code>resize/code>/dfn> td>code idmediaevents:event-22>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>One or both of the code idmediaevents:dom-video-videowidth>a href#dom-video-videowidth>videoWidth/a>/code> and code idmediaevents:dom-video-videoheight>a href#dom-video-videoheight>videoHeight/a>/code> attributes have just been updated. td>a href#media-element idmediaevents:media-element-3>Media element/a> is a code idmediaevents:the-video-element>a href#the-video-element>video/a>/code> element; code idmediaevents:dom-media-readystate-8>a href#dom-media-readystate>readyState/a>/code> is not code idmediaevents:dom-media-have_nothing>a href#dom-media-have_nothing>HAVE_NOTHING/a>/code> tr>td>dfn idevent-media-volumechange>code>volumechange/code>/dfn> td>code idmediaevents:event-23>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>Either the code idmediaevents:dom-media-volume>a href#dom-media-volume>volume/a>/code> attribute or the code idmediaevents:dom-media-muted>a href#dom-media-muted>muted/a>/code> attribute has changed. Fired after the relevant attributes setter has returned. td> /table> p>The following event fires on code idmediaevents:the-source-element>a href#the-source-element>source/a>/code> element:/p> table>thead>tr>th>Event name th>Interface th>Fired when... tbody>tr>td>dfn idevent-source-error>code>error/code>/dfn> td>code idmediaevents:event-24>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>An error occurs while fetching the a href#media-data idmediaevents:media-data-10>media data/a> or the type of the resource is not supported media format. /table> p>The following events fire on code idmediaevents:audiotracklist>a href#audiotracklist>AudioTrackList/a>/code>, code idmediaevents:videotracklist>a href#videotracklist>VideoTrackList/a>/code>, and code idmediaevents:texttracklist>a href#texttracklist>TextTrackList/a>/code> objects:/p> table>thead>tr>th>Event name th>Interface th>Fired when... tbody>tr>td>dfn idevent-media-change>code>change/code>/dfn> td>code idmediaevents:event-25>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>One or more tracks in the track list have been enabled or disabled. tr>td>dfn idevent-media-addtrack>code>addtrack/code>/dfn> td>code idmediaevents:trackevent>a href#trackevent>TrackEvent/a>/code> td>A track has been added to the track list. tr>td>dfn idevent-media-removetrack>code>removetrack/code>/dfn> td>code idmediaevents:trackevent-2>a href#trackevent>TrackEvent/a>/code> td>A track has been removed from the track list. /table> p>The following event fires on code idmediaevents:texttrack>a href#texttrack>TextTrack/a>/code> objects and code idmediaevents:the-track-element>a href#the-track-element>track/a>/code> elements:/p> table>thead>tr>th>Event name th>Interface th>Fired when... tbody>tr>td>dfn idevent-media-cuechange>code>cuechange/code>/dfn> td>code idmediaevents:event-26>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>One or more cues in the track have become active or stopped being active. /table> p>The following events fire on code idmediaevents:the-track-element-2>a href#the-track-element>track/a>/code> elements:/p> table>thead>tr>th>Event name th>Interface th>Fired when... tbody>tr>td>dfn idevent-track-error>code>error/code>/dfn> td>code idmediaevents:event-27>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>An error occurs while fetching the track data or the type of the resource is not supported text track format. tr>td>dfn idevent-track-load>code>load/code>/dfn> td>code idmediaevents:event-28>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>A track data has been fetched and successfully processed. /table> p>The following events fire on code idmediaevents:texttrackcue>a href#texttrackcue>TextTrackCue/a>/code> objects:/p> table>thead>tr>th>Event name th>Interface th>Fired when... tbody>tr>td>dfn idevent-media-enter>code>enter/code>/dfn> td>code idmediaevents:event-29>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>The cue has become active. tr>td>dfn idevent-media-exit>code>exit/code>/dfn> td>code idmediaevents:event-30>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td>The cue has stopped being active. /table> h5 idsecurity-and-privacy-considerations>span classsecno>4.8.12.17/span> Security and privacy considerationsa href#security-and-privacy-considerations classself-link>/a>/h5> p>The main security and privacy implications of the code idsecurity-and-privacy-considerations:the-video-element>a href#the-video-element>video/a>/code> and code idsecurity-and-privacy-considerations:the-audio-element>a href#the-audio-element>audio/a>/code> elements come from the ability to embed media cross-origin. There are two directions that threats can flow: from hostile content to a victim page, and from a hostile page to victim content./p> hr> p>If a victim page embeds hostile content, the threat is that the content might contain scripted code that attempts to interact with the code idsecurity-and-privacy-considerations:document>a href#document>Document/a>/code> that embeds the content. To avoid this, user agents must ensure that there is no access from the content to the embedding page. In the case of media content that uses DOM concepts, the embedded content must be treated as if it was in its own unrelated a href#top-level-browsing-context idsecurity-and-privacy-considerations:top-level-browsing-context>top-level browsing context/a>./p> p classexample>For instance, if an SVG animation was embedded in a code idsecurity-and-privacy-considerations:the-video-element-2>a href#the-video-element>video/a>/code> element, the user agent would not give it access to the DOM of the outer page. From the perspective of scripts in the SVG resource, the SVG file would appear to be in a lone top-level browsing context with no parent./p> hr> p>If a hostile page embeds victim content, the threat is that the embedding page could obtain information from the content that it would not otherwise have access to. The API does expose some information: the existence of the media, its type, its duration, its size, and the performance characteristics of its host. Such information is already potentially problematic, but in practice the same information can more or less be obtained using the code idsecurity-and-privacy-considerations:the-img-element>a href#the-img-element>img/a>/code> element, and so it has been deemed acceptable./p> p>However, significantly more sensitive information could be obtained if the user agent further exposes metadata within the content, such as subtitles. That information is therefore only exposed if the video resource uses CORS. The code idsecurity-and-privacy-considerations:attr-media-crossorigin>a href#attr-media-crossorigin>crossorigin/a>/code> attribute allows authors to enable CORS. a href#refsFETCH>FETCH/a>/p> p classexample>Without this restriction, an attacker could trick a user running within a corporate network into visiting a site that attempts to load a video from a previously leaked location on the corporations intranet. If such a video included confidential plans for a new product, then being able to read the subtitles would present a serious confidentiality breach./p> h5 idbest-practices-for-authors-using-media-elements>span classsecno>4.8.12.18/span> Best practices for authors using media elementsa href#best-practices-for-authors-using-media-elements classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>Playing audio and video resources on small devices such as set-top boxes or mobile phones is often constrained by limited hardware resources in the device. For example, a device might only support three simultaneous videos. For this reason, it is a good practice to release resources held by a href#media-element idbest-practices-for-authors-using-media-elements:media-element>media elements/a> when they are done playing, either by being very careful about removing all references to the element and allowing it to be garbage collected, or, even better, by removing the elements code idbest-practices-for-authors-using-media-elements:attr-media-src>a href#attr-media-src>src/a>/code> attribute and any code idbest-practices-for-authors-using-media-elements:the-source-element>a href#the-source-element>source/a>/code> element descendants, and invoking the elements code idbest-practices-for-authors-using-media-elements:dom-media-load>a href#dom-media-load>load()/a>/code> method./p> p>Similarly, when the playback rate is not exactly 1.0, hardware, software, or format limitations can cause video frames to be dropped and audio to be choppy or muted./p> h5 idbest-practices-for-implementors-of-media-elements>span classsecno>4.8.12.19/span> Best practices for implementors of media elementsa href#best-practices-for-implementors-of-media-elements classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>How accurately various aspects of the a href#media-element idbest-practices-for-implementors-of-media-elements:media-element>media element/a> API are implemented is considered a quality-of-implementation issue./p> p>For example, when implementing the code idbest-practices-for-implementors-of-media-elements:dom-media-buffered>a href#dom-media-buffered>buffered/a>/code> attribute, how precise an implementation reports the ranges that have been buffered depends on how carefully the user agent inspects the data. Since the API reports ranges as times, but the data is obtained in byte streams, a user agent receiving a variable-bitrate stream might only be able to determine precise times by actually decoding all of the data. User agents arent required to do this, however; they can instead return estimates (e.g. based on the average bitrate seen so far) which get revised as more information becomes available./p> p>As a general rule, user agents are urged to be conservative rather than optimistic. For example, it would be bad to report that everything had been buffered when it had not./p> p>Another quality-of-implementation issue would be playing a video backwards when the codec is designed only for forward playback (e.g. there arent many key frames, and they are far apart, and the intervening frames only have deltas from the previous frame). User agents could do a poor job, e.g. only showing key frames; however, better implementations would do more work and thus do a better job, e.g. actually decoding parts of the video forwards, storing the complete frames, and then playing the frames backwards./p> p>Similarly, while implementations are allowed to drop buffered data at any time (there is no requirement that a user agent keep all the media data obtained for the lifetime of the media element), it is again a quality of implementation issue: user agents with sufficient resources to keep all the data around are encouraged to do so, as this allows for a better user experience. For example, if the user is watching a live stream, a user agent could allow the user only to view the live video; however, a better user agent would buffer everything and allow the user to seek through the earlier material, pause it, play it forwards and backwards, etc./p> hr> p>When a a href#media-element idbest-practices-for-implementors-of-media-elements:media-element-2>media element/a> that is paused is a href#remove-an-element-from-a-document idbest-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 idbest-practices-for-implementors-of-media-elements:event-loop>event loop/a> reaches a href#step1>step 1/a>, implementations that are resource constrained are encouraged to take that opportunity to release all hardware resources (like video planes, networking resources, and data buffers) used by the a href#media-element idbest-practices-for-implementors-of-media-elements:media-element-3>media element/a>. (User agents still have to keep track of the playback position and so forth, though, in case playback is later restarted.)/p> h4 idthe-map-element>span classsecno>4.8.13/span> The dfn>code>map/code>/dfn> elementa href#the-map-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-map-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-map-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-map-element:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idthe-map-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-map-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-map-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-map-element:concept-element-content-model>Content model/a>:dd>a href#transparent idthe-map-element:transparent>Transparent/a>.dt>a href#concept-element-tag-omission idthe-map-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-map-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-map-element:global-attributes>Global attributes/a>dd>code idthe-map-element:attr-map-name>a href#attr-map-name>name/a>/code> — Name of a href#image-map idthe-map-element:image-map>image map/a> to a href#referenced idthe-map-element:referenced>reference/a> from the code idthe-map-element:attr-hyperlink-usemap>a href#attr-hyperlink-usemap>usemap/a>/code> attributedt>a href#concept-element-dom idthe-map-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-map-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlmapelement>HTMLMapElement/dfn> : a href#htmlelement idthe-map-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-map-element:cereactions>CEReactions/a> attribute DOMString a href#dom-map-name idthe-map-element:dom-map-name>name/a>; SameObject readonly attribute a idthe-map-element:htmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> a href#dom-map-areas idthe-map-element:dom-map-areas>areas/a>;};/pre> /dl> p>The code idthe-map-element:the-map-element>a href#the-map-element>map/a>/code> element, in conjunction with an code idthe-map-element:the-img-element>a href#the-img-element>img/a>/code> element and any code idthe-map-element:the-area-element>a href#the-area-element>area/a>/code> element descendants, defines an a href#image-map idthe-map-element:image-map-2>image map/a>. The element a href#represents idthe-map-element:represents>represents/a> its children./p> p>The dfn idattr-map-name>code>name/code>/dfn> attribute gives the map a name so that it can be a href#referenced idthe-map-element:referenced-2>referenced/a>. The attribute must be present and must have a non-empty value with no a idthe-map-element:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>. The value of the code idthe-map-element:attr-map-name-2>a href#attr-map-name>name/a>/code> attribute must not be equal to the value of the code idthe-map-element:attr-map-name-3>a href#attr-map-name>name/a>/code> attribute of another code idthe-map-element:the-map-element-2>a href#the-map-element>map/a>/code> element in the same a idthe-map-element:tree hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a>. If the code idthe-map-element:the-id-attribute>a href#the-id-attribute>id/a>/code> attribute is also specified, both attributes must have the same value./p> dl classdomintro>dt>var>map/var> . code idthe-map-element:dom-map-areas-2>a href#dom-map-areas>areas/a>/code>dd> p>Returns an code idthe-map-element:htmlcollection-2>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> of the code idthe-map-element:the-area-element-2>a href#the-area-element>area/a>/code> elements in the code idthe-map-element:the-map-element-3>a href#the-map-element>map/a>/code>./p> /dl> p>The dfn iddom-map-areas>code>areas/code>/dfn> attribute must return an code idthe-map-element:htmlcollection-3>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> rooted at the code idthe-map-element:the-map-element-4>a href#the-map-element>map/a>/code> element, whose filter matches only code idthe-map-element:the-area-element-3>a href#the-area-element>area/a>/code> elements./p> p>The IDL attribute dfn iddom-map-name>code>name/code>/dfn> must a href#reflect idthe-map-element:reflect>reflect/a> the content attribute of the same name./p> div classexample> p>Image maps can be defined in conjunction with other content on the page, to ease maintenance. This example is of a page with an image map at the top of the page and a corresponding set of text links at the bottom./p> pre><!DOCTYPE HTML><HTML LANGEN><TITLE>Babies™: Toys</TITLE><HEADER> <H1>Toys</H1> <IMG SRC/images/menu.gif ALTBabies™ navigation menu. Select a department to go to its page. USEMAP#NAV></HEADER> ...<FOOTER> <MAP NAMENAV> <P> <A HREF/clothes/>Clothes</A> <AREA ALTClothes COORDS0,0,100,50 HREF/clothes/> | <A HREF/toys/>Toys</A> <AREA ALTToys COORDS100,0,200,50 HREF/toys/> | <A HREF/food/>Food</A> <AREA ALTFood COORDS200,0,300,50 HREF/food/> | <A HREF/books/>Books</A> <AREA ALTBooks COORDS300,0,400,50 HREF/books/> </P> </MAP></FOOTER>/pre> /div> h4 idthe-area-element>span classsecno>4.8.14/span> The dfn>code>area/code>/dfn> elementa href#the-area-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-area-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-area-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-area-element:phrasing-content-2>Phrasing content/a>.dt>a href#concept-element-contexts idthe-area-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-area-element:phrasing-content-2-2>phrasing content/a> is expected, but only if there is a code idthe-area-element:the-map-element>a href#the-map-element>map/a>/code> element ancestor.dt>a href#concept-element-content-model idthe-area-element:concept-element-content-model>Content model/a>:dd>a href#concept-content-nothing idthe-area-element:concept-content-nothing>Nothing/a>.dt>a href#concept-element-tag-omission idthe-area-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>No a href#syntax-end-tag idthe-area-element:syntax-end-tag>end tag/a>.dt>a href#concept-element-attributes idthe-area-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-area-element:global-attributes>Global attributes/a>dd>code idthe-area-element:attr-area-alt>a href#attr-area-alt>alt/a>/code> — Replacement text for use when images are not availabledd>code idthe-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 idthe-area-element:image-map>image map/a>dd>code idthe-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 idthe-area-element:image-map-2>image map/a>dd>code idthe-area-element:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> — Address of the a href#hyperlink idthe-area-element:hyperlink>hyperlink/a>dd>code idthe-area-element:attr-hyperlink-target>a href#attr-hyperlink-target>target/a>/code> — a href#browsing-context idthe-area-element:browsing-context>Browsing context/a> for a href#hyperlink idthe-area-element:hyperlink-2>hyperlink/a> a href#navigate idthe-area-element:navigate>navigation/a>dd>code idthe-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 sodd>code idthe-area-element:ping>a href#ping>ping/a>/code> — a hrefhttps://url.spec.whatwg.org/#concept-url idthe-area-element:url data-x-internalurl>URLs/a> to pingdd>code idthe-area-element:attr-hyperlink-rel>a href#attr-hyperlink-rel>rel/a>/code> — Relationship between the location in the document containing the a href#hyperlink idthe-area-element:hyperlink-3>hyperlink/a> and the destination resourcedd>code idthe-area-element:attr-hyperlink-referrerpolicy>a href#attr-hyperlink-referrerpolicy>referrerpolicy/a>/code> — a idthe-area-element:referrer-policy hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>Referrer policy/a> for a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idthe-area-element:concept-fetch data-x-internalconcept-fetch>fetches/a> initiated by the elementdt>a href#concept-element-dom idthe-area-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-area-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlareaelement>HTMLAreaElement/dfn> : a href#htmlelement idthe-area-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-area-element:cereactions>CEReactions/a> attribute DOMString a href#dom-area-alt idthe-area-element:dom-area-alt>alt/a>; a href#cereactions idthe-area-element:cereactions-2>CEReactions/a> attribute DOMString a href#dom-area-coords idthe-area-element:dom-area-coords>coords/a>; a href#cereactions idthe-area-element:cereactions-3>CEReactions/a> attribute DOMString a href#dom-area-shape idthe-area-element:dom-area-shape>shape/a>; a href#cereactions idthe-area-element:cereactions-4>CEReactions/a> attribute DOMString a href#dom-area-target idthe-area-element:dom-area-target>target/a>; a href#cereactions idthe-area-element:cereactions-5>CEReactions/a> attribute DOMString a href#dom-area-download idthe-area-element:dom-area-download>download/a>; a href#cereactions idthe-area-element:cereactions-6>CEReactions/a> attribute USVString a href#dom-area-ping idthe-area-element:dom-area-ping>ping/a>; a href#cereactions idthe-area-element:cereactions-7>CEReactions/a> attribute DOMString a href#dom-area-rel idthe-area-element:dom-area-rel>rel/a>; SameObject, PutForwardsa hrefhttps://dom.spec.whatwg.org/#dom-domtokenlist-value idthe-area-element:dom-domtokenlist-value data-x-internaldom-domtokenlist-value>value/a> readonly attribute a idthe-area-element:domtokenlist hrefhttps://dom.spec.whatwg.org/#interface-domtokenlist data-x-internaldomtokenlist>DOMTokenList/a> a href#dom-area-rellist idthe-area-element:dom-area-rellist>relList/a>; a href#cereactions idthe-area-element:cereactions-8>CEReactions/a> attribute DOMString a href#dom-area-referrerpolicy idthe-area-element:dom-area-referrerpolicy>referrerPolicy/a>; // a href#HTMLAreaElement-partial>also has obsolete members/a>};a href#htmlareaelement idthe-area-element:htmlareaelement>HTMLAreaElement/a> implements a href#htmlhyperlinkelementutils idthe-area-element:htmlhyperlinkelementutils>HTMLHyperlinkElementUtils/a>;/pre> /dl> p>The code idthe-area-element:the-area-element>a href#the-area-element>area/a>/code> element a href#represents idthe-area-element:represents>represents/a> either a hyperlink with some text and a corresponding area on an a href#image-map idthe-area-element:image-map-3>image map/a>, or a dead area on an image map./p> p>An code idthe-area-element:the-area-element-2>a href#the-area-element>area/a>/code> element with a parent node must have a code idthe-area-element:the-map-element-2>a href#the-map-element>map/a>/code> element ancestor./p> p>If the code idthe-area-element:the-area-element-3>a href#the-area-element>area/a>/code> element has an code idthe-area-element:attr-hyperlink-href-2>a href#attr-hyperlink-href>href/a>/code> attribute, then the code idthe-area-element:the-area-element-4>a href#the-area-element>area/a>/code> element represents a a href#hyperlink idthe-area-element:hyperlink-4>hyperlink/a>. In this case, the dfn idattr-area-alt>code>alt/code>/dfn> attribute must be present. It specifies the text of the hyperlink. Its value must be text that, when presented with the texts specified for the other hyperlinks of the a href#image-map idthe-area-element:image-map-4>image map/a>, and with the alternative text of the image, but without the image itself, provides the user with the same kind of choice as the hyperlink would when used without its text but with its shape applied to the image. The code idthe-area-element:attr-area-alt-2>a href#attr-area-alt>alt/a>/code> attribute may be left blank if there is another code idthe-area-element:the-area-element-5>a href#the-area-element>area/a>/code> element in the same a href#image-map idthe-area-element:image-map-5>image map/a> that points to the same resource and has a non-blank code idthe-area-element:attr-area-alt-3>a href#attr-area-alt>alt/a>/code> attribute./p> p>If the code idthe-area-element:the-area-element-6>a href#the-area-element>area/a>/code> element has no code idthe-area-element:attr-hyperlink-href-3>a href#attr-hyperlink-href>href/a>/code> attribute, then the area represented by the element cannot be selected, and the code idthe-area-element:attr-area-alt-4>a href#attr-area-alt>alt/a>/code> attribute must be omitted./p> p>In both cases, the code idthe-area-element:attr-area-shape-2>a href#attr-area-shape>shape/a>/code> and code idthe-area-element:attr-area-coords-2>a href#attr-area-coords>coords/a>/code> attributes specify the area./p> p>The dfn idattr-area-shape>code>shape/code>/dfn> attribute is an a href#enumerated-attribute idthe-area-element:enumerated-attribute>enumerated attribute/a>. The following table lists the keywords defined for this attribute. The states given in the first cell of the rows with keywords give the states to which those keywords map. Some of the keywords are non-conforming, as noted in the last column./p> table>thead>tr>th>State th>Keywords th>Notes tbody>tr>td rowspan2>a href#attr-area-shape-circle idthe-area-element:attr-area-shape-circle>Circle state/a> td>dfn idattr-area-shape-keyword-circle>code>circle/code>/dfn> td> tr>td>dfn idattr-area-shape-keyword-circ>code>circ/code>/dfn> td>Non-conforming tr>td>a href#attr-area-shape-default idthe-area-element:attr-area-shape-default>Default state/a> td>dfn idattr-area-shape-keyword-default>code>default/code>/dfn> td> tr>td rowspan2>a href#attr-area-shape-poly idthe-area-element:attr-area-shape-poly>Polygon state/a> td>dfn idattr-area-shape-keyword-poly>code>poly/code>/dfn> td> tr>td>dfn idattr-area-shape-keyword-polygon>code>polygon/code>/dfn> td>Non-conforming tr>td rowspan2>a href#attr-area-shape-rect idthe-area-element:attr-area-shape-rect>Rectangle state/a> td>dfn idattr-area-shape-keyword-rect>code>rect/code>/dfn> td> tr>td>dfn idattr-area-shape-keyword-rectangle>code>rectangle/code>/dfn> td>Non-conforming /table> p>The attribute may be omitted. The i idthe-area-element:missing-value-default>a href#missing-value-default>missing value default/a>/i> is the a href#attr-area-shape-rect idthe-area-element:attr-area-shape-rect-2>rectangle/a> state./p> p>The dfn idattr-area-coords>code>coords/code>/dfn> attribute must, if specified, contain a a href#valid-list-of-floating-point-numbers idthe-area-element:valid-list-of-floating-point-numbers>valid list of floating-point numbers/a>. This attribute gives the coordinates for the shape described by the code idthe-area-element:attr-area-shape-3>a href#attr-area-shape>shape/a>/code> attribute. The processing for this attribute is described as part of the a href#image-map idthe-area-element:image-map-6>image map/a> processing model./p> p>In the dfn idattr-area-shape-circle>circle state/dfn>, code idthe-area-element:the-area-element-7>a href#the-area-element>area/a>/code> elements must have a code idthe-area-element:attr-area-coords-3>a href#attr-area-coords>coords/a>/code> attribute present, with three integers, the last of which must be non-negative. The first integer must be the distance in a hrefhttps://drafts.csswg.org/css-values/#px idthe-area-element:px data-x-internalpx>CSS pixels/a> from the left edge of the image to the center of the circle, the second integer must be the distance in a hrefhttps://drafts.csswg.org/css-values/#px idthe-area-element:px-2 data-x-internalpx>CSS pixels/a> from the top edge of the image to the center of the circle, and the third integer must be the radius of the circle, again in a hrefhttps://drafts.csswg.org/css-values/#px idthe-area-element:px-3 data-x-internalpx>CSS pixels/a>./p> p>In the dfn idattr-area-shape-default>default state/dfn> state, code idthe-area-element:the-area-element-8>a href#the-area-element>area/a>/code> elements must not have a code idthe-area-element:attr-area-coords-4>a href#attr-area-coords>coords/a>/code> attribute. (The area is the whole image.)/p> p>In the dfn idattr-area-shape-poly>polygon state/dfn>, code idthe-area-element:the-area-element-9>a href#the-area-element>area/a>/code> elements must have a code idthe-area-element:attr-area-coords-5>a href#attr-area-coords>coords/a>/code> attribute with at least six integers, and the number of integers must be even. Each pair of integers must represent a coordinate given as the distances from the left and the top of the image in a hrefhttps://drafts.csswg.org/css-values/#px idthe-area-element:px-4 data-x-internalpx>CSS pixels/a> respectively, and all the coordinates together must represent the points of the polygon, in order./p> p>In the dfn idattr-area-shape-rect>rectangle state/dfn>, code idthe-area-element:the-area-element-10>a href#the-area-element>area/a>/code> elements must have a code idthe-area-element:attr-area-coords-6>a href#attr-area-coords>coords/a>/code> attribute with exactly four integers, the first of which must be less than the third, and the second of which must be less than the fourth. The four points must represent, respectively, the distance from the left edge of the image to the left side of the rectangle, the distance from the top edge to the top side, the distance from the left edge to the right side, and the distance from the top edge to the bottom side, all in a hrefhttps://drafts.csswg.org/css-values/#px idthe-area-element:px-5 data-x-internalpx>CSS pixels/a>./p> p>When user agents allow users to a href#following-hyperlinks-2 idthe-area-element:following-hyperlinks-2>follow hyperlinks/a> or a href#downloading-hyperlinks idthe-area-element:downloading-hyperlinks>download hyperlinks/a> created using the code idthe-area-element:the-area-element-11>a href#the-area-element>area/a>/code> element, as described in the next section, the code idthe-area-element:attr-hyperlink-href-4>a href#attr-hyperlink-href>href/a>/code>, code idthe-area-element:attr-hyperlink-target-2>a href#attr-hyperlink-target>target/a>/code>, code idthe-area-element:attr-hyperlink-download-2>a href#attr-hyperlink-download>download/a>/code>, and code idthe-area-element:ping-2>a href#ping>ping/a>/code> attributes decide how the link is followed. The code idthe-area-element:attr-hyperlink-rel-2>a href#attr-hyperlink-rel>rel/a>/code> attribute may be used to indicate to the user the likely nature of the target resource before the user follows the link./p> p>The code idthe-area-element:attr-hyperlink-target-3>a href#attr-hyperlink-target>target/a>/code>, code idthe-area-element:attr-hyperlink-download-3>a href#attr-hyperlink-download>download/a>/code>, code idthe-area-element:ping-3>a href#ping>ping/a>/code>, code idthe-area-element:attr-hyperlink-rel-3>a href#attr-hyperlink-rel>rel/a>/code>, and code idthe-area-element:attr-hyperlink-referrerpolicy-2>a href#attr-hyperlink-referrerpolicy>referrerpolicy/a>/code> attributes must be omitted if the code idthe-area-element:attr-hyperlink-href-5>a href#attr-hyperlink-href>href/a>/code> attribute is not present./p> p>If the code idthe-area-element:names:-the-itemprop-attribute>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute is specified on an code idthe-area-element:the-area-element-12>a href#the-area-element>area/a>/code> element, then the code idthe-area-element:attr-hyperlink-href-6>a href#attr-hyperlink-href>href/a>/code> attribute must also be specified./p> p>The a idthe-area-element:activation-behaviour hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a> of code idthe-area-element:the-area-element-13>a href#the-area-element>area/a>/code> elements is to a href#following-hyperlinks-2 idthe-area-element:following-hyperlinks-2-2>follow the hyperlink/a> or a href#downloading-hyperlinks idthe-area-element:downloading-hyperlinks-2>download the hyperlink/a> created by the code idthe-area-element:the-area-element-14>a href#the-area-element>area/a>/code> element, if any, and as determined by the code idthe-area-element:attr-hyperlink-download-4>a href#attr-hyperlink-download>download/a>/code> attribute and any expressed user preference./p> p>The IDL attributes dfn iddom-area-alt>code>alt/code>/dfn>, dfn iddom-area-coords>code>coords/code>/dfn>, dfn iddom-area-target>code>target/code>/dfn>, dfn iddom-area-download>code>download/code>/dfn>, dfn iddom-area-ping>code>ping/code>/dfn>, and dfn iddom-area-rel>code>rel/code>/dfn>, each must a href#reflect idthe-area-element:reflect>reflect/a> the respective content attributes of the same name./p> p>The IDL attribute dfn iddom-area-shape>code>shape/code>/dfn> must a href#reflect idthe-area-element:reflect-2>reflect/a> the code idthe-area-element:attr-area-shape-4>a href#attr-area-shape>shape/a>/code> content attribute./p> p>The IDL attribute dfn iddom-area-rellist>code>relList/code>/dfn> must a href#reflect idthe-area-element:reflect-3>reflect/a> the code idthe-area-element:attr-hyperlink-rel-4>a href#attr-hyperlink-rel>rel/a>/code> content attribute./p> p>The IDL attribute dfn iddom-area-referrerpolicy>code>referrerPolicy/code>/dfn> must a href#reflect idthe-area-element:reflect-4>reflect/a> the code idthe-area-element:attr-hyperlink-referrerpolicy-3>a href#attr-hyperlink-referrerpolicy>referrerpolicy/a>/code> content attribute, a href#limited-to-only-known-values idthe-area-element:limited-to-only-known-values>limited to only known values/a>./p> h4 idimage-maps>span classsecno>4.8.15/span> Image mapsa href#image-maps classself-link>/a>/h4> h5 idauthoring>span classsecno>4.8.15.1/span> Authoringa href#authoring classself-link>/a>/h5> p>An dfn idimage-map>image map/dfn> allows geometric areas on an image to be associated with a href#hyperlink idauthoring:hyperlink>hyperlinks/a>./p> p>An image, in the form of an code idauthoring:the-img-element>a href#the-img-element>img/a>/code> element or an code idauthoring:the-object-element>a href#the-object-element>object/a>/code> element representing an image, may be associated with an image map (in the form of a code idauthoring:the-map-element>a href#the-map-element>map/a>/code> element) by specifying a dfn idattr-hyperlink-usemap>code>usemap/code>/dfn> attribute on the code idauthoring:the-img-element-2>a href#the-img-element>img/a>/code> or code idauthoring:the-object-element-2>a href#the-object-element>object/a>/code> element. The code idauthoring:attr-hyperlink-usemap>a href#attr-hyperlink-usemap>usemap/a>/code> attribute, if specified, must be a a href#valid-hash-name-reference idauthoring:valid-hash-name-reference>valid hash-name reference/a> to a code idauthoring:the-map-element-2>a href#the-map-element>map/a>/code> element./p> div classexample> p>Consider an image that looks as follows:/p> p>img src/images/sample-usemap.png width600 altA line with four shapes in it, equally spaced: a red hollow box, a green circle, a blue triangle, and a yellow four-pointed star. height150>/p> p>If we wanted just the colored areas to be clickable, we could do it as follows:/p> pre><p> Please select a shape: <img srcshapes.png usemap#shapes altFour shapes are available: a red hollow box, a green circle, a blue triangle, and a yellow four-pointed star.> <map nameshapes> <area shaperect coords50,50,100,100> <!-- the hole in the red box --> <area shaperect coords25,25,125,125 hrefred.html altRed box.> <area shapecircle coords200,75,50 hrefgreen.html altGreen circle.> <area shapepoly coords325,25,262,125,388,125 hrefblue.html altBlue triangle.> <area shapepoly coords450,25,435,60,400,75,435,90,450,125,465,90,500,75,465,60 hrefyellow.html altYellow star.> </map></p>/pre> /div> h5 idimage-map-processing-model>span classsecno>4.8.15.2/span> span idprocessing-model>/span>Processing modela href#image-map-processing-model classself-link>/a>/h5> p>If an code idimage-map-processing-model:the-img-element>a href#the-img-element>img/a>/code> element or an code idimage-map-processing-model:the-object-element>a href#the-object-element>object/a>/code> element representing an image has a code idimage-map-processing-model:attr-hyperlink-usemap>a href#attr-hyperlink-usemap>usemap/a>/code> attribute specified, user agents must process it as follows:/p> ol>li>p>Parse the attributes value using the a href#rules-for-parsing-a-hash-name-reference idimage-map-processing-model:rules-for-parsing-a-hash-name-reference>rules for parsing a hash-name reference/a> to a code idimage-map-processing-model:the-map-element>a href#the-map-element>map/a>/code> element, with the element as the context node. This will return either an element (the var>map/var>) or null.li>p>If that returned null, then abort these steps. The image is not associated with an image map after all.li>p>Otherwise, the user agent must collect all the code idimage-map-processing-model:the-area-element>a href#the-area-element>area/a>/code> elements that are descendants of the var>map/var>. Let those be the var>areas/var>./ol> p>Having obtained the list of code idimage-map-processing-model:the-area-element-2>a href#the-area-element>area/a>/code> elements that form the image map (the var>areas/var>), interactive user agents must process the list in one of two ways./p> p>If the user agent intends to show the text that the code idimage-map-processing-model:the-img-element-2>a href#the-img-element>img/a>/code> element represents, then it must use the following steps./p> p classnote>In user agents that do not support images, or that have images disabled, code idimage-map-processing-model:the-object-element-2>a href#the-object-element>object/a>/code> elements cannot represent images, and thus this section never applies (the a href#fallback-content idimage-map-processing-model:fallback-content>fallback content/a> is shown instead). The following steps therefore only apply to code idimage-map-processing-model:the-img-element-3>a href#the-img-element>img/a>/code> elements./p> ol>li>p>Remove all the code idimage-map-processing-model:the-area-element-3>a href#the-area-element>area/a>/code> elements in var>areas/var> that have no code idimage-map-processing-model:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute.li>p>Remove all the code idimage-map-processing-model:the-area-element-4>a href#the-area-element>area/a>/code> elements in var>areas/var> that have no code idimage-map-processing-model:attr-area-alt>a href#attr-area-alt>alt/a>/code> attribute, or whose code idimage-map-processing-model:attr-area-alt-2>a href#attr-area-alt>alt/a>/code> attributes value is the empty string, em>if/em> there is another code idimage-map-processing-model:the-area-element-5>a href#the-area-element>area/a>/code> element in var>areas/var> with the same value in the code idimage-map-processing-model:attr-hyperlink-href-2>a href#attr-hyperlink-href>href/a>/code> attribute and with a non-empty code idimage-map-processing-model:attr-area-alt-3>a href#attr-area-alt>alt/a>/code> attribute.li>p>Each remaining code idimage-map-processing-model:the-area-element-6>a href#the-area-element>area/a>/code> element in var>areas/var> represents a a href#hyperlink idimage-map-processing-model:hyperlink>hyperlink/a>. Those hyperlinks should all be made available to the user in a manner associated with the text of the code idimage-map-processing-model:the-img-element-4>a href#the-img-element>img/a>/code>./p> p>In this context, user agents may represent code idimage-map-processing-model:the-area-element-7>a href#the-area-element>area/a>/code> and code idimage-map-processing-model:the-img-element-5>a href#the-img-element>img/a>/code> elements with no specified code>alt/code> attributes, or whose code>alt/code> attributes are the empty string or some other non-visible text, in a user-agent-defined fashion intended to indicate the lack of suitable author-provided text./ol> p>If the user agent intends to show the image and allow interaction with the image to select hyperlinks, then the image must be associated with a set of layered shapes, taken from the code idimage-map-processing-model:the-area-element-8>a href#the-area-element>area/a>/code> elements in var>areas/var>, in reverse a idimage-map-processing-model:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> (so the last specified code idimage-map-processing-model:the-area-element-9>a href#the-area-element>area/a>/code> element in the var>map/var> is the bottom-most shape, and the first element in the var>map/var>, in a idimage-map-processing-model:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>, is the top-most shape)./p> p>Each code idimage-map-processing-model:the-area-element-10>a href#the-area-element>area/a>/code> element in var>areas/var> must be processed as follows to obtain a shape to layer onto the image:/p> ol>li>p>Find the state that the elements code idimage-map-processing-model:attr-area-shape>a href#attr-area-shape>shape/a>/code> attribute represents.li>p>Use the a href#rules-for-parsing-a-list-of-floating-point-numbers idimage-map-processing-model:rules-for-parsing-a-list-of-floating-point-numbers>rules for parsing a list of floating-point numbers/a> to parse the elements code idimage-map-processing-model:attr-area-coords>a href#attr-area-coords>coords/a>/code> attribute, if it is present, and let the result be the var>coords/var> list. If the attribute is absent, let the var>coords/var> list be the empty list.li> p>If the number of items in the var>coords/var> list is less than the minimum number given for the code idimage-map-processing-model:the-area-element-11>a href#the-area-element>area/a>/code> elements current state, as per the following table, then the shape is empty; abort these steps./p> table>thead>tr>th>State th>Minimum number of items tbody>tr>td>a href#attr-area-shape-circle idimage-map-processing-model:attr-area-shape-circle>Circle state/a> td>3 tr>td>a href#attr-area-shape-default idimage-map-processing-model:attr-area-shape-default>Default state/a> td>0 tr>td>a href#attr-area-shape-poly idimage-map-processing-model:attr-area-shape-poly>Polygon state/a> td>6 tr>td>a href#attr-area-shape-rect idimage-map-processing-model:attr-area-shape-rect>Rectangle state/a> td>4 /table> li> p>Check for excess items in the var>coords/var> list as per the entry in the following list corresponding to the code idimage-map-processing-model:attr-area-shape-2>a href#attr-area-shape>shape/a>/code> attributes state:/p> dl classswitch>dt>a href#attr-area-shape-circle idimage-map-processing-model: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 idimage-map-processing-model:attr-area-shape-default-2>Default state/a>dd>Drop all items in the list.dt>a href#attr-area-shape-poly idimage-map-processing-model:attr-area-shape-poly-2>Polygon state/a>dd>Drop the last item if theres an odd number of items.dt>a href#attr-area-shape-rect idimage-map-processing-model:attr-area-shape-rect-2>Rectangle state/a>dd>Drop any items in the list beyond the fourth./dl> li>p>If the code idimage-map-processing-model:attr-area-shape-3>a href#attr-area-shape>shape/a>/code> attribute represents the a href#attr-area-shape-rect idimage-map-processing-model:attr-area-shape-rect-3>rectangle state/a>, and the first number in the list is numerically greater than the third number in the list, then swap those two numbers around.li>p>If the code idimage-map-processing-model:attr-area-shape-4>a href#attr-area-shape>shape/a>/code> attribute represents the a href#attr-area-shape-rect idimage-map-processing-model:attr-area-shape-rect-4>rectangle state/a>, and the second number in the list is numerically greater than the fourth number in the list, then swap those two numbers around.li>p>If the code idimage-map-processing-model:attr-area-shape-5>a href#attr-area-shape>shape/a>/code> attribute represents the a href#attr-area-shape-circle idimage-map-processing-model:attr-area-shape-circle-3>circle state/a>, and the third number in the list is less than or equal to zero, then the shape is empty; abort these steps.li>p>Now, the shape represented by the element is the one described for the entry in the list below corresponding to the state of the code idimage-map-processing-model:attr-area-shape-6>a href#attr-area-shape>shape/a>/code> attribute:/p> dl classswitch>dt>a href#attr-area-shape-circle idimage-map-processing-model:attr-area-shape-circle-4>Circle state/a>dd> p>Let var>x/var> be the first number in var>coords/var>, var>y/var> be the second number, and var>r/var> be the third number./p> p>The shape is a circle whose center is var>x/var> a hrefhttps://drafts.csswg.org/css-values/#px idimage-map-processing-model:px data-x-internalpx>CSS pixels/a> from the left edge of the image and var>y/var> a hrefhttps://drafts.csswg.org/css-values/#px idimage-map-processing-model:px-2 data-x-internalpx>CSS pixels/a> from the top edge of the image, and whose radius is var>r/var> a hrefhttps://drafts.csswg.org/css-values/#px idimage-map-processing-model:px-3 data-x-internalpx>CSS pixels/a>./p> dt>a href#attr-area-shape-default idimage-map-processing-model:attr-area-shape-default-3>Default state/a>dd> p>The shape is a rectangle that exactly covers the entire image./p> dt>a href#attr-area-shape-poly idimage-map-processing-model:attr-area-shape-poly-3>Polygon state/a>dd> p>Let var>xsub>var>i/var>/sub>/var> be the span>(2var>i/var>)/span>th entry in var>coords/var>, and var>ysub>var>i/var>/sub>/var> be the span>(2var>i/var>+1)/span>th entry in var>coords/var> (the first entry in var>coords/var> being the one with index 0)./p> p>Let var>the coordinates/var> be (var>xsub>var>i/var>/sub>/var>, var>ysub>var>i/var>/sub>/var>), interpreted in a hrefhttps://drafts.csswg.org/css-values/#px idimage-map-processing-model:px-4 data-x-internalpx>CSS pixels/a> measured from the top left of the image, for all integer values of var>i/var> from 0 to span>(var>N/var>/2)-1/span>, where var>N/var> is the number of items in var>coords/var>./p> p>The shape is a polygon whose vertices are given by var>the coordinates/var>, and whose interior is established using the even-odd rule. a href#refsGRAPHICS>GRAPHICS/a>/p> dt>a href#attr-area-shape-rect idimage-map-processing-model:attr-area-shape-rect-5>Rectangle state/a>dd> p>Let var>xsub>1/sub>/var> be the first number in var>coords/var>, var>ysub>1/sub>/var> be the second number, var>xsub>2/sub>/var> be the third number, and var>ysub>2/sub>/var> be the fourth number./p> p>The shape is a rectangle whose top-left corner is given by the coordinate (var>xsub>1/sub>/var>, var>ysub>1/sub>/var>) and whose bottom right corner is given by the coordinate (var>xsub>2/sub>/var>, var>ysub>2/sub>/var>), those coordinates being interpreted as a hrefhttps://drafts.csswg.org/css-values/#px idimage-map-processing-model:px-5 data-x-internalpx>CSS pixels/a> from the top left corner of the image./p> /dl> p>For historical reasons, the coordinates must be interpreted relative to the em>displayed/em> image after any stretching caused by the CSS a idimage-map-processing-model:width hrefhttps://drafts.csswg.org/css2/visudet.html#the-width-property data-x-internalwidth>width/a> and a idimage-map-processing-model:height hrefhttps://drafts.csswg.org/css2/visudet.html#the-height-property data-x-internalheight>height/a> properties (or, for non-CSS browsers, the image elements code>width/code> and code>height/code> attributes — CSS browsers map those attributes to the aforementioned CSS properties)./p> p classnote>Browser zoom features and transforms applied using CSS or SVG do not affect the coordinates./p> /ol> p>Pointing device interaction with an image associated with a set of layered shapes per the above algorithm must result in the relevant user interaction events being first fired to the top-most shape covering the point that the pointing device indicated, if any, or to the image element itself, if there is no shape covering that point. User agents may also allow individual code idimage-map-processing-model:the-area-element-12>a href#the-area-element>area/a>/code> elements representing a href#hyperlink idimage-map-processing-model:hyperlink-2>hyperlinks/a> to be selected and activated (e.g. using a keyboard)./p> p classnote>Because a code idimage-map-processing-model:the-map-element-2>a href#the-map-element>map/a>/code> element (and its code idimage-map-processing-model:the-area-element-13>a href#the-area-element>area/a>/code> elements) can be associated with multiple code idimage-map-processing-model:the-img-element-6>a href#the-img-element>img/a>/code> and code idimage-map-processing-model:the-object-element-3>a href#the-object-element>object/a>/code> elements, it is possible for an code idimage-map-processing-model:the-area-element-14>a href#the-area-element>area/a>/code> element to correspond to multiple i idimage-map-processing-model:focusable-area>a href#focusable-area>focusable areas/a>/i> of the document./p> p>Image maps are a href#live idimage-map-processing-model:live>live/a>; if the DOM is mutated, then the user agent must act as if it had rerun the algorithms for image maps./p> h4 idmathml>span classsecno>4.8.16/span> MathMLa href#mathml classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> mathmlspan classchrome no>span>Chrome (removed)/span> span>-24/span>/span>span classios_saf yes>span>iOS Safari/span> span>5.0+/span>/span>span classand_uc partial>span>UC Browser for Android (limited)/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>2+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>10+/span>/span>span classedge no>span>Edge/span> span>None/span>/span>span classopera no>span>Opera (removed)/span> span>-12.1/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featmathml>caniuse.com/a>/div> p>The a idmathml:mathml-math hrefhttps://www.w3.org/Math/draft-spec/chapter2.html#interf.toplevel data-x-internalmathml-math>MathML code>math/code>/a> element falls into the a href#embedded-content-category idmathml:embedded-content-category>embedded content/a>, a href#phrasing-content-2 idmathml:phrasing-content-2>phrasing content/a>, a href#flow-content-2 idmathml:flow-content-2>flow content/a>, and a href#palpable-content-2 idmathml:palpable-content-2>palpable content/a> categories for the purposes of the content models in this specification./p> p>When the a idmathml:mathml-annotation-xml hrefhttps://www.w3.org/Math/draft-spec/chapter5.html#mixing.elements.annotation.xml data-x-internalmathml-annotation-xml>MathML code>annotation-xml/code>/a> element contains elements from the a idmathml:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>, such elements must all be a href#flow-content-2 idmathml:flow-content-2-2>flow content/a>./p> p>When the MathML token elements (code idmathml:mathml-mi>a data-x-internalmathml-mi hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mi>mi/a>/code>, code idmathml:mathml-mo>a data-x-internalmathml-mo hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mo>mo/a>/code>, code idmathml:mathml-mn>a data-x-internalmathml-mn hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mn>mn/a>/code>, code idmathml:mathml-ms>a data-x-internalmathml-ms hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.ms>ms/a>/code>, and code idmathml:mathml-mtext>a data-x-internalmathml-mtext hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mtext>mtext/a>/code>) are descendants of HTML elements, they may contain a href#phrasing-content-2 idmathml:phrasing-content-2-2>phrasing content/a> elements from the a idmathml:html-namespace-2-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>./p> p>User agents must handle text other than a href#inter-element-whitespace idmathml:inter-element-whitespace>inter-element whitespace/a> found in MathML elements whose content models do not allow straight text by pretending for the purposes of MathML content models, layout, and rendering that the text is actually wrapped in a a idmathml:mathml-mtext-2 hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mtext data-x-internalmathml-mtext>MathML code>mtext/code>/a> element. (Such text is not, however, conforming.)/p> p>User agents must act as if any MathML element whose contents does not match the elements content model was replaced, for the purposes of MathML layout and rendering, by a a idmathml:mathml-merror hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.merror data-x-internalmathml-merror>MathML code>merror/code>/a> element containing some appropriate error message./p> p>To enable authors to use MathML tools that only accept MathML in its XML form, interactive HTML user agents are encouraged to provide a way to export any MathML fragment as an XML namespace-well-formed XML fragment./p> p>The semantics of MathML elements are defined by the MathML specification and a href#other-applicable-specifications idmathml:other-applicable-specifications>other applicable specifications/a>. a href#refsMATHML>MATHML/a>/p> div classexample> p>Here is an example of the use of MathML in an HTML document:/p> pre><!DOCTYPE html><html langen> <head> <title>The quadratic formula</title> </head> <body> <h1>The quadratic formula</h1> <p> <math> <mi>x</mi> <mo></mo> <mfrac> <mrow> <mo formprefix>−</mo> <mi>b</mi> <mo>±</mo> <msqrt> <msup> <mi>b</mi> <mn>2</mn> </msup> <mo>−</mo> <mn>4</mn> <mo></mo> <mi>a</mi> <mo></mo> <mi>c</mi> </msqrt> </mrow> <mrow> <mn>2</mn> <mo></mo> <mi>a</mi> </mrow> </mfrac> </math> </p> </body></html>/pre> /div> h4 idsvg-0>span classsecno>4.8.17/span> SVGa href#svg-0 classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> svg-html5span classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>7+/span>/span>span classios_saf yes>span>iOS Safari/span> span>5.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>4+/span>/span>span classie yes>span>IE/span> span>9+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>5.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>3+/span>/span>span classopera yes>span>Opera/span> span>11.6+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featsvg-html5>caniuse.com/a>/div> p>The a idsvg-0:svg-svg hrefhttps://www.w3.org/TR/SVG11/struct.html#SVGElement data-x-internalsvg-svg>SVG code>svg/code>/a> element falls into the a href#embedded-content-category idsvg-0:embedded-content-category>embedded content/a>, a href#phrasing-content-2 idsvg-0:phrasing-content-2>phrasing content/a>, a href#flow-content-2 idsvg-0:flow-content-2>flow content/a>, and a href#palpable-content-2 idsvg-0:palpable-content-2>palpable content/a> categories for the purposes of the content models in this specification./p> p>To enable authors to use SVG tools that only accept SVG in its XML form, interactive HTML user agents are encouraged to provide a way to export any SVG fragment as an XML namespace-well-formed XML fragment./p> p>When the a idsvg-0:svg-foreignobject hrefhttps://www.w3.org/TR/SVG11/extend.html#ForeignObjectElement data-x-internalsvg-foreignobject>SVG code>foreignObject/code>/a> element contains elements from the a idsvg-0:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>, such elements must all be a href#flow-content-2 idsvg-0:flow-content-2-2>flow content/a>./p> p>The content model for the a idsvg-0:svg-title hrefhttps://www.w3.org/TR/SVG11/struct.html#TitleElement data-x-internalsvg-title>SVG code>title/code>/a> element inside a idsvg-0:html-documents hrefhttps://dom.spec.whatwg.org/#html-document data-x-internalhtml-documents>HTML documents/a> is a href#phrasing-content-2 idsvg-0:phrasing-content-2-2>phrasing content/a>. (This further constrains the requirements given in the SVG specification.)/p> p>The semantics of SVG elements are defined by the SVG specification and a href#other-applicable-specifications idsvg-0:other-applicable-specifications>other applicable specifications/a>. a href#refsSVG>SVG/a>/p> hr> dl classdomintro>dt>var>doc/var> var>iframe/var> . code idsvg-0:dom-media-getsvgdocument>a href#dom-media-getsvgdocument>getSVGDocument/a>/code>()dt>var>doc/var> var>embed/var> . code idsvg-0:dom-media-getsvgdocument-2>a href#dom-media-getsvgdocument>getSVGDocument/a>/code>()dt>var>doc/var> var>object/var> . code idsvg-0:dom-media-getsvgdocument-3>a href#dom-media-getsvgdocument>getSVGDocument/a>/code>()dd> p>Returns the code idsvg-0:document>a href#document>Document/a>/code> object, in the case of code idsvg-0:the-iframe-element>a href#the-iframe-element>iframe/a>/code>, code idsvg-0:the-embed-element>a href#the-embed-element>embed/a>/code>, or code idsvg-0:the-object-element>a href#the-object-element>object/a>/code> elements being used to embed SVG images./p> /dl> p>The dfn iddom-media-getsvgdocument>code>getSVGDocument()/code>/dfn> method must run the following steps:/p> ol>li>p>If the elements a href#nested-browsing-context idsvg-0:nested-browsing-context>nested browsing context/a> is null, then return null.li>p>If the a href#concept-origin idsvg-0:concept-origin>origin/a> of the a href#active-document idsvg-0:active-document>active document/a> of the a href#nested-browsing-context idsvg-0:nested-browsing-context-2>nested browsing context/a> is not a href#same-origin-domain idsvg-0:same-origin-domain>same origin-domain/a> with the elements a idsvg-0:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#concept-origin idsvg-0:concept-origin-2>origin/a>, then return null.li>p>If the a href#nested-browsing-context idsvg-0:nested-browsing-context-3>nested browsing context/a>s a href#active-document idsvg-0:active-document-2>active document/a> was created by the a href#read-xml idsvg-0:read-xml>page load processing model for XML files/a> section because the a hrefhttps://mimesniff.spec.whatwg.org/#computed-mime-type idsvg-0:content-type-sniffing-2 data-x-internalcontent-type-sniffing-2>computed type of the resource/a> in the a href#navigate idsvg-0:navigate>navigate/a> algorithm was code idsvg-0:image/svg+xml>a href#image/svg+xml>image/svg+xml/a>/code>, then return that code idsvg-0:document-2>a href#document>Document/a>/code> object.li>p>Otherwise, return null./ol> h4 iddimension-attributes>span classsecno>4.8.18/span> dfn>Dimension attributes/dfn>a href#dimension-attributes classself-link>/a>/h4> p>strong>Author requirements/strong>: The dfn idattr-dim-width>code>width/code>/dfn> and dfn idattr-dim-height>code>height/code>/dfn> attributes on code iddimension-attributes:the-img-element>a href#the-img-element>img/a>/code>, code iddimension-attributes:the-iframe-element>a href#the-iframe-element>iframe/a>/code>, code iddimension-attributes:the-embed-element>a href#the-embed-element>embed/a>/code>, code iddimension-attributes:the-object-element>a href#the-object-element>object/a>/code>, code iddimension-attributes:the-video-element>a href#the-video-element>video/a>/code>, and, when their code iddimension-attributes:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#image-button-state-(typeimage) iddimension-attributes:image-button-state-(typeimage)>Image Button/a> state, code iddimension-attributes:the-input-element>a href#the-input-element>input/a>/code> elements may be specified to give the dimensions of the visual content of the element (the width and height respectively, relative to the nominal direction of the output medium), in a hrefhttps://drafts.csswg.org/css-values/#px iddimension-attributes:px data-x-internalpx>CSS pixels/a>. The attributes, if specified, must have values that are a href#valid-non-negative-integer iddimension-attributes:valid-non-negative-integer>valid non-negative integers/a>./p> p>The specified dimensions given may differ from the dimensions specified in the resource itself, since the resource may have a resolution that differs from the CSS pixel resolution. (On screens, a hrefhttps://drafts.csswg.org/css-values/#px iddimension-attributes:px-2 data-x-internalpx>CSS pixels/a> have a resolution of 96ppi, but in general the CSS pixel resolution depends on the reading distance.) If both attributes are specified, then one of the following statements must be true:/p> ul>li>var>specified width/var> - 0.5 ≤ var>specified height/var> * var>target ratio/var> ≤ var>specified width/var> + 0.5li>var>specified height/var> - 0.5 ≤ var>specified width/var> / var>target ratio/var> ≤ var>specified height/var> + 0.5li>var>specified height/var> var>specified width/var> 0/ul> p>The var>target ratio/var> is the ratio of the a href#intrinsic-width iddimension-attributes:intrinsic-width>intrinsic width/a> to the a href#intrinsic-height iddimension-attributes:intrinsic-height>intrinsic height/a> in the resource. The var>specified width/var> and var>specified height/var> are the values of the code iddimension-attributes:attr-dim-width>a href#attr-dim-width>width/a>/code> and code iddimension-attributes:attr-dim-height>a href#attr-dim-height>height/a>/code> attributes respectively./p> p>The two attributes must be omitted if the resource in question does not have both an a href#intrinsic-width iddimension-attributes:intrinsic-width-2>intrinsic width/a> and an a href#intrinsic-height iddimension-attributes:intrinsic-height-2>intrinsic height/a>./p> p>If the two attributes are both zero, it indicates that the element is not intended for the user (e.g. it might be a part of a service to count page views)./p> p classnote>The dimension attributes are not intended to be used to stretch the image./p> p>strong>User agent requirements/strong>: User agents are expected to use these attributes a href#dimRendering>as hints for the rendering/a>./p> p>The dfn iddom-dim-width>code>width/code>/dfn> and dfn iddom-dim-height>code>height/code>/dfn> IDL attributes on the code iddimension-attributes:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code>, code iddimension-attributes:the-embed-element-2>a href#the-embed-element>embed/a>/code>, code iddimension-attributes:the-object-element-2>a href#the-object-element>object/a>/code>, and code iddimension-attributes:the-video-element-2>a href#the-video-element>video/a>/code> elements must a href#reflect iddimension-attributes:reflect>reflect/a> the respective content attributes of the same name./p> p classnote>For code iddimension-attributes:the-iframe-element-3>a href#the-iframe-element>iframe/a>/code>, code iddimension-attributes:the-embed-element-3>a href#the-embed-element>embed/a>/code>, and code iddimension-attributes:the-object-element-3>a href#the-object-element>object/a>/code> the IDL attributes are code iddimension-attributes:idl-domstring>a data-x-internalidl-domstring hrefhttps://heycam.github.io/webidl/#idl-DOMString>DOMString/a>/code>; for code iddimension-attributes:the-video-element-3>a href#the-video-element>video/a>/code> the IDL attributes are code iddimension-attributes:idl-unsigned-long>a data-x-internalidl-unsigned-long hrefhttps://heycam.github.io/webidl/#idl-unsigned-long>unsigned long/a>/code>./p> p classnote>The corresponding IDL attributes for code iddimension-attributes:dom-img-height>a href#dom-img-height>img/a>/code> and code iddimension-attributes:dom-input-height>a href#dom-input-height>input/a>/code> elements are defined in those respective elements sections, as they are slightly more specific to those elements other behaviors./p> h3 idtables>span classsecno>4.9/span> Tabular dataa href#tables classself-link>/a>/h3> h4 idthe-table-element>span classsecno>4.9.1/span> The dfn>code>table/code>/dfn> elementa href#the-table-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-table-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-table-element:flow-content-2>Flow content/a>.dd>a href#palpable-content-2 idthe-table-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-table-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-table-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-table-element:concept-element-content-model>Content model/a>:dd>In this order: optionally a code idthe-table-element:the-caption-element>a href#the-caption-element>caption/a>/code> element, followed by zero or more code idthe-table-element:the-colgroup-element>a href#the-colgroup-element>colgroup/a>/code> elements, followed optionally by a code idthe-table-element:the-thead-element>a href#the-thead-element>thead/a>/code> element, followed by either zero or more code idthe-table-element:the-tbody-element>a href#the-tbody-element>tbody/a>/code> elements or one or more code idthe-table-element:the-tr-element>a href#the-tr-element>tr/a>/code> elements, followed optionally by a code idthe-table-element:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code> element, optionally intermixed with one or more a href#script-supporting-elements-2 idthe-table-element:script-supporting-elements-2>script-supporting elements/a>.dt>a href#concept-element-tag-omission idthe-table-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-table-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-table-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-table-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-table-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmltableelement>HTMLTableElement/dfn> : a href#htmlelement idthe-table-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-table-element:cereactions>CEReactions/a> attribute a href#htmltablecaptionelement idthe-table-element:htmltablecaptionelement>HTMLTableCaptionElement/a>? a href#dom-table-caption idthe-table-element:dom-table-caption>caption/a>; a href#htmltablecaptionelement idthe-table-element:htmltablecaptionelement-2>HTMLTableCaptionElement/a> a href#dom-table-createcaption idthe-table-element:dom-table-createcaption>createCaption/a>(); a href#cereactions idthe-table-element:cereactions-2>CEReactions/a> void a href#dom-table-deletecaption idthe-table-element:dom-table-deletecaption>deleteCaption/a>(); a href#cereactions idthe-table-element:cereactions-3>CEReactions/a> attribute a href#htmltablesectionelement idthe-table-element:htmltablesectionelement>HTMLTableSectionElement/a>? a href#dom-table-thead idthe-table-element:dom-table-thead>tHead/a>; a href#htmltablesectionelement idthe-table-element:htmltablesectionelement-2>HTMLTableSectionElement/a> a href#dom-table-createthead idthe-table-element:dom-table-createthead>createTHead/a>(); a href#cereactions idthe-table-element:cereactions-4>CEReactions/a> void a href#dom-table-deletethead idthe-table-element:dom-table-deletethead>deleteTHead/a>(); a href#cereactions idthe-table-element:cereactions-5>CEReactions/a> attribute a href#htmltablesectionelement idthe-table-element:htmltablesectionelement-3>HTMLTableSectionElement/a>? a href#dom-table-tfoot idthe-table-element:dom-table-tfoot>tFoot/a>; a href#htmltablesectionelement idthe-table-element:htmltablesectionelement-4>HTMLTableSectionElement/a> a href#dom-table-createtfoot idthe-table-element:dom-table-createtfoot>createTFoot/a>(); a href#cereactions idthe-table-element:cereactions-6>CEReactions/a> void a href#dom-table-deletetfoot idthe-table-element:dom-table-deletetfoot>deleteTFoot/a>(); SameObject readonly attribute a idthe-table-element:htmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> a href#dom-table-tbodies idthe-table-element:dom-table-tbodies>tBodies/a>; a href#htmltablesectionelement idthe-table-element:htmltablesectionelement-5>HTMLTableSectionElement/a> a href#dom-table-createtbody idthe-table-element:dom-table-createtbody>createTBody/a>(); SameObject readonly attribute a idthe-table-element:htmlcollection-2 hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> a href#dom-table-rows idthe-table-element:dom-table-rows>rows/a>; a href#htmltablerowelement idthe-table-element:htmltablerowelement>HTMLTableRowElement/a> a href#dom-table-insertrow idthe-table-element:dom-table-insertrow>insertRow/a>(optional long index -1); a href#cereactions idthe-table-element:cereactions-7>CEReactions/a> void a href#dom-table-deleterow idthe-table-element:dom-table-deleterow>deleteRow/a>(long index); // a href#HTMLTableElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-table-element:the-table-element>a href#the-table-element>table/a>/code> element a href#represents idthe-table-element:represents>represents/a> data with more than one dimension, in the form of a a href#concept-table idthe-table-element:concept-table>table/a>./p> p>The code idthe-table-element:the-table-element-2>a href#the-table-element>table/a>/code> element takes part in the a href#table-model idthe-table-element:table-model>table model/a>. Tables have rows, columns, and cells given by their descendants. The rows and columns form a grid; a tables cells must completely cover that grid without overlap./p> p classnote>Precise rules for determining whether this conformance requirement is met are described in the description of the a href#table-model idthe-table-element:table-model-2>table model/a>./p> p>Authors are encouraged to provide information describing how to interpret complex tables. Guidance on how to a href#table-descriptions-techniques>provide such information/a> is given below./p> p>Tables must not be used as layout aids. Historically, some Web authors have misused tables in HTML as a way to control their page layout. This usage is non-conforming, because tools attempting to extract tabular data from such documents would obtain very confusing results. In particular, users of accessibility tools like screen readers are likely to find it very difficult to navigate pages with tables used for layout./p> p classnote>There are a variety of alternatives to using HTML tables for layout, primarily using CSS positioning and the CSS table model. a href#refsCSS>CSS/a>/p> hr> p>Tables can be complicated to understand and navigate. To help users with this, user agents should clearly delineate cells in a table from each other, unless the user agent has classified the table as a (non-conforming) layout table./p> p classnote>Authors and implementors are encouraged to consider using some of the a href#table-layout-techniques>table design techniques/a> described below to make tables easier to navigate for users./p> p>User agents, especially those that do table analysis on arbitrary content, are encouraged to find heuristics to determine which tables actually contain data and which are merely being used for layout. This specification does not define a precise heuristic, but the following are suggested as possible indicators:/p> table>thead>tr>th>Feature th>Indication tbody>tr>td>The use of the code idthe-table-element:attr-aria-role>a href#attr-aria-role>role/a>/code> attribute with the value code idthe-table-element:attr-aria-role-presentation>a data-x-internalattr-aria-role-presentation hrefhttps://w3c.github.io/aria/aria/aria.html#presentation>presentation/a>/code> td>Probably a layout table tr>td>The use of the non-conforming code idthe-table-element:attr-table-border>a href#attr-table-border>border/a>/code> attribute with the non-conforming value 0 td>Probably a layout table tr>td>The use of the non-conforming code idthe-table-element:attr-table-cellspacing>a href#attr-table-cellspacing>cellspacing/a>/code> and code idthe-table-element:attr-table-cellpadding>a href#attr-table-cellpadding>cellpadding/a>/code> attributes with the value 0 td>Probably a layout table tbody>tr>td>The use of code idthe-table-element:the-caption-element-2>a href#the-caption-element>caption/a>/code>, code idthe-table-element:the-thead-element-2>a href#the-thead-element>thead/a>/code>, or code idthe-table-element:the-th-element>a href#the-th-element>th/a>/code> elements td>Probably a non-layout table tr>td>The use of the code idthe-table-element:attr-tdth-headers>a href#attr-tdth-headers>headers/a>/code> and code idthe-table-element:attr-th-scope>a href#attr-th-scope>scope/a>/code> attributes td>Probably a non-layout table tr>td>The use of the non-conforming code idthe-table-element:attr-table-border-2>a href#attr-table-border>border/a>/code> attribute with a value other than 0 td>Probably a non-layout table tr>td>Explicit visible borders set using CSS td>Probably a non-layout table tbody>tr>td>The use of the code idthe-table-element:attr-table-summary>a href#attr-table-summary>summary/a>/code> attribute td>Not a good indicator (both layout and non-layout tables have historically been given this attribute) /table> p classnote>It is quite possible that the above suggestions are wrong. Implementors are urged to provide feedback elaborating on their experiences with trying to create a layout table detection heuristic./p> p>If a code idthe-table-element:the-table-element-3>a href#the-table-element>table/a>/code> element has a (non-conforming) code idthe-table-element:attr-table-summary-2>a href#attr-table-summary>summary/a>/code> attribute, and the user agent has not classified the table as a layout table, the user agent may report the contents of that attribute to the user./p> hr> dl classdomintro>dt>var>table/var> . code idthe-table-element:dom-table-caption-2>a href#dom-table-caption>caption/a>/code> var>value/var> dd> p>Returns the tables code idthe-table-element:the-caption-element-3>a href#the-caption-element>caption/a>/code> element./p> p>Can be set, to replace the code idthe-table-element:the-caption-element-4>a href#the-caption-element>caption/a>/code> element./p> dt>var>caption/var> var>table/var> . code idthe-table-element:dom-table-createcaption-2>a href#dom-table-createcaption>createCaption/a>/code>()dd> p>Ensures the table has a code idthe-table-element:the-caption-element-5>a href#the-caption-element>caption/a>/code> element, and returns it./p> dt>var>table/var> . code idthe-table-element:dom-table-deletecaption-2>a href#dom-table-deletecaption>deleteCaption/a>/code>()dd> p>Ensures the table does not have a code idthe-table-element:the-caption-element-6>a href#the-caption-element>caption/a>/code> element./p> dt>var>table/var> . code idthe-table-element:dom-table-thead-2>a href#dom-table-thead>tHead/a>/code> var>value/var> dd> p>Returns the tables code idthe-table-element:the-thead-element-3>a href#the-thead-element>thead/a>/code> element./p> p>Can be set, to replace the code idthe-table-element:the-thead-element-4>a href#the-thead-element>thead/a>/code> element. If the new value is not a code idthe-table-element:the-thead-element-5>a href#the-thead-element>thead/a>/code> element, throws a a idthe-table-element:hierarchyrequesterror hrefhttps://heycam.github.io/webidl/#hierarchyrequesterror data-x-internalhierarchyrequesterror>code>HierarchyRequestError/code>/a> code idthe-table-element:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> dt>var>thead/var> var>table/var> . code idthe-table-element:dom-table-createthead-2>a href#dom-table-createthead>createTHead/a>/code>()dd> p>Ensures the table has a code idthe-table-element:the-thead-element-6>a href#the-thead-element>thead/a>/code> element, and returns it./p> dt>var>table/var> . code idthe-table-element:dom-table-deletethead-2>a href#dom-table-deletethead>deleteTHead/a>/code>()dd> p>Ensures the table does not have a code idthe-table-element:the-thead-element-7>a href#the-thead-element>thead/a>/code> element./p> dt>var>table/var> . code idthe-table-element:dom-table-tfoot-2>a href#dom-table-tfoot>tFoot/a>/code> var>value/var> dd> p>Returns the tables code idthe-table-element:the-tfoot-element-2>a href#the-tfoot-element>tfoot/a>/code> element./p> p>Can be set, to replace the code idthe-table-element:the-tfoot-element-3>a href#the-tfoot-element>tfoot/a>/code> element. If the new value is not a code idthe-table-element:the-tfoot-element-4>a href#the-tfoot-element>tfoot/a>/code> element, throws a a idthe-table-element:hierarchyrequesterror-2 hrefhttps://heycam.github.io/webidl/#hierarchyrequesterror data-x-internalhierarchyrequesterror>code>HierarchyRequestError/code>/a> code idthe-table-element:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> dt>var>tfoot/var> var>table/var> . code idthe-table-element:dom-table-createtfoot-2>a href#dom-table-createtfoot>createTFoot/a>/code>()dd> p>Ensures the table has a code idthe-table-element:the-tfoot-element-5>a href#the-tfoot-element>tfoot/a>/code> element, and returns it./p> dt>var>table/var> . code idthe-table-element:dom-table-deletetfoot-2>a href#dom-table-deletetfoot>deleteTFoot/a>/code>()dd> p>Ensures the table does not have a code idthe-table-element:the-tfoot-element-6>a href#the-tfoot-element>tfoot/a>/code> element./p> dt>var>table/var> . code idthe-table-element:dom-table-tbodies-2>a href#dom-table-tbodies>tBodies/a>/code>dd> p>Returns an code idthe-table-element:htmlcollection-3>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> of the code idthe-table-element:the-tbody-element-2>a href#the-tbody-element>tbody/a>/code> elements of the table./p> dt>var>tbody/var> var>table/var> . code idthe-table-element:dom-table-createtbody-2>a href#dom-table-createtbody>createTBody/a>/code>()dd> p>Creates a code idthe-table-element:the-tbody-element-3>a href#the-tbody-element>tbody/a>/code> element, inserts it into the table, and returns it./p> dt>var>table/var> . code idthe-table-element:dom-table-rows-2>a href#dom-table-rows>rows/a>/code>dd> p>Returns an code idthe-table-element:htmlcollection-4>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> of the code idthe-table-element:the-tr-element-2>a href#the-tr-element>tr/a>/code> elements of the table./p> dt>var>tr/var> var>table/var> . code idthe-table-element:dom-table-insertrow-2>a href#dom-table-insertrow>insertRow/a>/code>( var>index/var> )dd> p>Creates a code idthe-table-element:the-tr-element-3>a href#the-tr-element>tr/a>/code> element, along with a code idthe-table-element:the-tbody-element-4>a href#the-tbody-element>tbody/a>/code> if required, inserts them into the table at the position given by the argument, and returns the code idthe-table-element:the-tr-element-4>a href#the-tr-element>tr/a>/code>./p> p>The position is relative to the rows in the table. The index −1, which is the default if the argument is omitted, is equivalent to inserting at the end of the table./p> p>If the given position is less than −1 or greater than the number of rows, throws an a idthe-table-element:indexsizeerror hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idthe-table-element:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> dt>var>table/var> . code idthe-table-element:dom-table-deleterow-2>a href#dom-table-deleterow>deleteRow/a>/code>(var>index/var>)dd> p>Removes the code idthe-table-element:the-tr-element-5>a href#the-tr-element>tr/a>/code> element with the given position in the table./p> p>The position is relative to the rows in the table. The index −1 is equivalent to deleting the last row of the table./p> p>If the given position is less than −1 or greater than the index of the last row, or if there are no rows, throws an a idthe-table-element:indexsizeerror-2 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idthe-table-element:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> /dl> p>In all of the following attribute and method definitions, when an element is to be dfn idtable-created>table-created/dfn>, that means to a idthe-table-element:create-an-element hrefhttps://dom.spec.whatwg.org/#concept-create-element data-x-internalcreate-an-element>create an element/a> given the code idthe-table-element:the-table-element-4>a href#the-table-element>table/a>/code> elements a idthe-table-element:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, the given local name, and the a idthe-table-element:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>./p> p>The dfn iddom-table-caption>code>caption/code>/dfn> IDL attribute must return, on getting, the first code idthe-table-element:the-caption-element-7>a href#the-caption-element>caption/a>/code> element child of the code idthe-table-element:the-table-element-5>a href#the-table-element>table/a>/code> element, if any, or null otherwise. On setting, the first code idthe-table-element:the-caption-element-8>a href#the-caption-element>caption/a>/code> element child of the code idthe-table-element:the-table-element-6>a href#the-table-element>table/a>/code> element, if any, must be removed, and the new value, if not null, must be inserted as the first node of the code idthe-table-element:the-table-element-7>a href#the-table-element>table/a>/code> element./p> p>The dfn iddom-table-createcaption>code>createCaption()/code>/dfn> method must return the first code idthe-table-element:the-caption-element-9>a href#the-caption-element>caption/a>/code> element child of the code idthe-table-element:the-table-element-8>a href#the-table-element>table/a>/code> element, if any; otherwise a new code idthe-table-element:the-caption-element-10>a href#the-caption-element>caption/a>/code> element must be a href#table-created idthe-table-element:table-created>table-created/a>, inserted as the first node of the code idthe-table-element:the-table-element-9>a href#the-table-element>table/a>/code> element, and then returned./p> p>The dfn iddom-table-deletecaption>code>deleteCaption()/code>/dfn> method must remove the first code idthe-table-element:the-caption-element-11>a href#the-caption-element>caption/a>/code> element child of the code idthe-table-element:the-table-element-10>a href#the-table-element>table/a>/code> element, if any./p> p>The dfn iddom-table-thead>code>tHead/code>/dfn> IDL attribute must return, on getting, the first code idthe-table-element:the-thead-element-8>a href#the-thead-element>thead/a>/code> element child of the code idthe-table-element:the-table-element-11>a href#the-table-element>table/a>/code> element, if any, or null otherwise. On setting, if the new value is null or a code idthe-table-element:the-thead-element-9>a href#the-thead-element>thead/a>/code> element, the first code idthe-table-element:the-thead-element-10>a href#the-thead-element>thead/a>/code> element child of the code idthe-table-element:the-table-element-12>a href#the-table-element>table/a>/code> element, if any, must be removed, and the new value, if not null, must be inserted immediately before the first element in the code idthe-table-element:the-table-element-13>a href#the-table-element>table/a>/code> element that is neither a code idthe-table-element:the-caption-element-12>a href#the-caption-element>caption/a>/code> element nor a code idthe-table-element:the-colgroup-element-2>a href#the-colgroup-element>colgroup/a>/code> element, if any, or at the end of the table if there are no such elements. If the new value is neither null nor a code idthe-table-element:the-thead-element-11>a href#the-thead-element>thead/a>/code> element, then a a idthe-table-element:hierarchyrequesterror-3 hrefhttps://heycam.github.io/webidl/#hierarchyrequesterror data-x-internalhierarchyrequesterror>code>HierarchyRequestError/code>/a> code idthe-table-element:domexception-5>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> must be thrown instead./p> p>The dfn iddom-table-createthead>code>createTHead()/code>/dfn> method must return the first code idthe-table-element:the-thead-element-12>a href#the-thead-element>thead/a>/code> element child of the code idthe-table-element:the-table-element-14>a href#the-table-element>table/a>/code> element, if any; otherwise a new code idthe-table-element:the-thead-element-13>a href#the-thead-element>thead/a>/code> element must be a href#table-created idthe-table-element:table-created-2>table-created/a> and inserted immediately before the first element in the code idthe-table-element:the-table-element-15>a href#the-table-element>table/a>/code> element that is neither a code idthe-table-element:the-caption-element-13>a href#the-caption-element>caption/a>/code> element nor a code idthe-table-element:the-colgroup-element-3>a href#the-colgroup-element>colgroup/a>/code> element, if any, or at the end of the table if there are no such elements, and then that new element must be returned./p> p>The dfn iddom-table-deletethead>code>deleteTHead()/code>/dfn> method must remove the first code idthe-table-element:the-thead-element-14>a href#the-thead-element>thead/a>/code> element child of the code idthe-table-element:the-table-element-16>a href#the-table-element>table/a>/code> element, if any./p> p>The dfn iddom-table-tfoot>code>tFoot/code>/dfn> IDL attribute must return, on getting, the first code idthe-table-element:the-tfoot-element-7>a href#the-tfoot-element>tfoot/a>/code> element child of the code idthe-table-element:the-table-element-17>a href#the-table-element>table/a>/code> element, if any, or null otherwise. On setting, if the new value is null or a code idthe-table-element:the-tfoot-element-8>a href#the-tfoot-element>tfoot/a>/code> element, the first code idthe-table-element:the-tfoot-element-9>a href#the-tfoot-element>tfoot/a>/code> element child of the code idthe-table-element:the-table-element-18>a href#the-table-element>table/a>/code> element, if any, must be removed, and the new value, if not null, must be inserted at the end of the table. If the new value is neither null nor a code idthe-table-element:the-tfoot-element-10>a href#the-tfoot-element>tfoot/a>/code> element, then a a idthe-table-element:hierarchyrequesterror-4 hrefhttps://heycam.github.io/webidl/#hierarchyrequesterror data-x-internalhierarchyrequesterror>code>HierarchyRequestError/code>/a> code idthe-table-element:domexception-6>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> must be thrown instead./p> p>The dfn iddom-table-createtfoot>code>createTFoot()/code>/dfn> method must return the first code idthe-table-element:the-tfoot-element-11>a href#the-tfoot-element>tfoot/a>/code> element child of the code idthe-table-element:the-table-element-19>a href#the-table-element>table/a>/code> element, if any; otherwise a new code idthe-table-element:the-tfoot-element-12>a href#the-tfoot-element>tfoot/a>/code> element must be a href#table-created idthe-table-element:table-created-3>table-created/a> and inserted at the end of the table, and then that new element must be returned./p> p>The dfn iddom-table-deletetfoot>code>deleteTFoot()/code>/dfn> method must remove the first code idthe-table-element:the-tfoot-element-13>a href#the-tfoot-element>tfoot/a>/code> element child of the code idthe-table-element:the-table-element-20>a href#the-table-element>table/a>/code> element, if any./p> p>The dfn iddom-table-tbodies>code>tBodies/code>/dfn> attribute must return an code idthe-table-element:htmlcollection-5>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> rooted at the code idthe-table-element:the-table-element-21>a href#the-table-element>table/a>/code> node, whose filter matches only code idthe-table-element:the-tbody-element-5>a href#the-tbody-element>tbody/a>/code> elements that are children of the code idthe-table-element:the-table-element-22>a href#the-table-element>table/a>/code> element./p> p>The dfn iddom-table-createtbody>code>createTBody()/code>/dfn> method must a href#table-created idthe-table-element:table-created-4>table-create/a> a new code idthe-table-element:the-tbody-element-6>a href#the-tbody-element>tbody/a>/code> element, insert it immediately after the last code idthe-table-element:the-tbody-element-7>a href#the-tbody-element>tbody/a>/code> element child in the code idthe-table-element:the-table-element-23>a href#the-table-element>table/a>/code> element, if any, or at the end of the code idthe-table-element:the-table-element-24>a href#the-table-element>table/a>/code> element if the code idthe-table-element:the-table-element-25>a href#the-table-element>table/a>/code> element has no code idthe-table-element:the-tbody-element-8>a href#the-tbody-element>tbody/a>/code> element children, and then must return the new code idthe-table-element:the-tbody-element-9>a href#the-tbody-element>tbody/a>/code> element./p> p>The dfn iddom-table-rows>code>rows/code>/dfn> attribute must return an code idthe-table-element:htmlcollection-6>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> rooted at the code idthe-table-element:the-table-element-26>a href#the-table-element>table/a>/code> node, whose filter matches only code idthe-table-element:the-tr-element-6>a href#the-tr-element>tr/a>/code> elements that are either children of the code idthe-table-element:the-table-element-27>a href#the-table-element>table/a>/code> element, or children of code idthe-table-element:the-thead-element-15>a href#the-thead-element>thead/a>/code>, code idthe-table-element:the-tbody-element-10>a href#the-tbody-element>tbody/a>/code>, or code idthe-table-element:the-tfoot-element-14>a href#the-tfoot-element>tfoot/a>/code> elements that are themselves children of the code idthe-table-element:the-table-element-28>a href#the-table-element>table/a>/code> element. The elements in the collection must be ordered such that those elements whose parent is a code idthe-table-element:the-thead-element-16>a href#the-thead-element>thead/a>/code> are included first, in a idthe-table-element:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>, followed by those elements whose parent is either a code idthe-table-element:the-table-element-29>a href#the-table-element>table/a>/code> or code idthe-table-element:the-tbody-element-11>a href#the-tbody-element>tbody/a>/code> element, again in a idthe-table-element:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>, followed finally by those elements whose parent is a code idthe-table-element:the-tfoot-element-15>a href#the-tfoot-element>tfoot/a>/code> element, still in a idthe-table-element:tree-order-3 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>./p> p>The behavior of the dfn iddom-table-insertrow>code>insertRow(var>index/var>)/code>/dfn> method depends on the state of the table. When it is called, the method must act as required by the first item in the following list of conditions that describes the state of the table and the var>index/var> argument:/p> dl classswitch>dt>If var>index/var> is less than −1 or greater than the number of elements in code idthe-table-element:dom-table-rows-3>a href#dom-table-rows>rows/a>/code> collection:dd>The method must throw an a idthe-table-element:indexsizeerror-3 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idthe-table-element:domexception-7>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.dt>If the code idthe-table-element:dom-table-rows-4>a href#dom-table-rows>rows/a>/code> collection has zero elements in it, and the code idthe-table-element:the-table-element-30>a href#the-table-element>table/a>/code> has no code idthe-table-element:the-tbody-element-12>a href#the-tbody-element>tbody/a>/code> elements in it:dd>The method must a href#table-created idthe-table-element:table-created-5>table-create/a> a code idthe-table-element:the-tbody-element-13>a href#the-tbody-element>tbody/a>/code> element, then a href#table-created idthe-table-element:table-created-6>table-create/a> a code idthe-table-element:the-tr-element-7>a href#the-tr-element>tr/a>/code> element, then append the code idthe-table-element:the-tr-element-8>a href#the-tr-element>tr/a>/code> element to the code idthe-table-element:the-tbody-element-14>a href#the-tbody-element>tbody/a>/code> element, then append the code idthe-table-element:the-tbody-element-15>a href#the-tbody-element>tbody/a>/code> element to the code idthe-table-element:the-table-element-31>a href#the-table-element>table/a>/code> element, and finally return the code idthe-table-element:the-tr-element-9>a href#the-tr-element>tr/a>/code> element.dt>If the code idthe-table-element:dom-table-rows-5>a href#dom-table-rows>rows/a>/code> collection has zero elements in it:dd>The method must a href#table-created idthe-table-element:table-created-7>table-create/a> a code idthe-table-element:the-tr-element-10>a href#the-tr-element>tr/a>/code> element, append it to the last code idthe-table-element:the-tbody-element-16>a href#the-tbody-element>tbody/a>/code> element in the table, and return the code idthe-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 idthe-table-element:dom-table-rows-6>a href#dom-table-rows>rows/a>/code> collection:dd>The method must a href#table-created idthe-table-element:table-created-8>table-create/a> a code idthe-table-element:the-tr-element-12>a href#the-tr-element>tr/a>/code> element, and append it to the parent of the last code idthe-table-element:the-tr-element-13>a href#the-tr-element>tr/a>/code> element in the code idthe-table-element:dom-table-rows-7>a href#dom-table-rows>rows/a>/code> collection. Then, the newly created code idthe-table-element:the-tr-element-14>a href#the-tr-element>tr/a>/code> element must be returned.dt>Otherwise:dd>The method must a href#table-created idthe-table-element:table-created-9>table-create/a> a code idthe-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 idthe-table-element:the-tr-element-16>a href#the-tr-element>tr/a>/code> element in the code idthe-table-element:dom-table-rows-8>a href#dom-table-rows>rows/a>/code> collection, in the same parent, and finally must return the newly created code idthe-table-element:the-tr-element-17>a href#the-tr-element>tr/a>/code> element./dl> p>When the dfn iddom-table-deleterow>code>deleteRow(var>index/var>)/code>/dfn> method is called, the user agent must run the following steps:/p> ol>li>p>If var>index/var> is less than −1 or greater than or equal to the number of elements in the code idthe-table-element:dom-table-rows-9>a href#dom-table-rows>rows/a>/code> collection, then throw an a idthe-table-element:indexsizeerror-4 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idthe-table-element:domexception-8>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If var>index/var> is −1, then a hrefhttps://dom.spec.whatwg.org/#concept-node-remove idthe-table-element:concept-node-remove data-x-internalconcept-node-remove>remove/a> the last element in the code idthe-table-element:dom-table-rows-10>a href#dom-table-rows>rows/a>/code> collection from its parent, or do nothing if the code idthe-table-element:dom-table-rows-11>a href#dom-table-rows>rows/a>/code> collection is empty.li>p>Otherwise, a hrefhttps://dom.spec.whatwg.org/#concept-node-remove idthe-table-element:concept-node-remove-2 data-x-internalconcept-node-remove>remove/a> the var>index/var>th element in the code idthe-table-element:dom-table-rows-12>a href#dom-table-rows>rows/a>/code> collection from its parent./ol> div classexample> p>Here is an example of a table being used to mark up a Sudoku puzzle. Observe the lack of headers, which are not necessary in such a table./p> pre><style> #sudoku { border-collapse: collapse; border: solid thick; } #sudoku colgroup, table#sudoku tbody { border: solid medium; } #sudoku td { border: solid thin; height: 1.4em; width: 1.4em; text-align: center; padding: 0; }</style><h1>Todays Sudoku</h1><table idsudoku> <colgroup><col><col><col> <colgroup><col><col><col> <colgroup><col><col><col> <tbody> <tr> <td> 1 <td> <td> 3 <td> 6 <td> <td> 4 <td> 7 <td> <td> 9 <tr> <td> <td> 2 <td> <td> <td> 9 <td> <td> <td> 1 <td> <tr> <td> 7 <td> <td> <td> <td> <td> <td> <td> <td> 6 <tbody> <tr> <td> 2 <td> <td> 4 <td> <td> 3 <td> <td> 9 <td> <td> 8 <tr> <td> <td> <td> <td> <td> <td> <td> <td> <td> <tr> <td> 5 <td> <td> <td> 9 <td> <td> 7 <td> <td> <td> 1 <tbody> <tr> <td> 6 <td> <td> <td> <td> 5 <td> <td> <td> <td> 2 <tr> <td> <td> <td> <td> <td> 7 <td> <td> <td> <td> <tr> <td> 9 <td> <td> <td> 8 <td> <td> 2 <td> <td> <td> 5</table>/pre> /div> h5 idtable-descriptions-techniques>span classsecno>4.9.1.1/span> Techniques for describing tablesa href#table-descriptions-techniques classself-link>/a>/h5> p idtable-descriptions>For tables that consist of more than just a grid of cells with headers in the first row and headers in the first column, and for any table in general where the reader might have difficulty understanding the content, authors should include explanatory information introducing the table. This information is useful for all users, but is especially useful for users who cannot see the table, e.g. users of screen readers./p> p>Such explanatory information should introduce the purpose of the table, outline its basic cell structure, highlight any trends or patterns, and generally teach the user how to use the table./p> p>For instance, the following table:/p> table>caption>Characteristics with positive and negative sides/caption>thead>tr>th idn> Negative th> Characteristic th> Positive tbody>tr>td headersn r1> Sad th idr1> Mood td> Happy tr>td headersn r2> Failing th idr2> Grade td> Passing /table> p>...might benefit from a description explaining the way the table is laid out, something like Characteristics are given in the second column, with the negative side in the left column and the positive side in the right column./p> p>There are a variety of ways to include this information, such as:/p> dl>dt>In prose, surrounding the tabledd> div classexample>pre>strong><p>In the following table, characteristics are given in the secondcolumn, with the negative side in the left column and the positiveside in the right column.</p>/strong><table> <caption>Characteristics with positive and negative sides</caption> <thead> <tr> <th idn> Negative <th> Characteristic <th> Positive <tbody> <tr> <td headersn r1> Sad <th idr1> Mood <td> Happy <tr> <td headersn r2> Failing <th idr2> Grade <td> Passing</table>/pre>/div> dt>In the tables code idtable-descriptions-techniques:the-caption-element>a href#the-caption-element>caption/a>/code>dd> div classexample>pre><table>strong> <caption> <strong>Characteristics with positive and negative sides.</strong> <p>Characteristics are given in the second column, with the negative side in the left column and the positive side in the right column.</p>/strong> </caption> <thead> <tr> <th idn> Negative <th> Characteristic <th> Positive <tbody> <tr> <td headersn r1> Sad <th idr1> Mood <td> Happy <tr> <td headersn r2> Failing <th idr2> Grade <td> Passing</table>/pre>/div> dt>In the tables code idtable-descriptions-techniques:the-caption-element-2>a href#the-caption-element>caption/a>/code>, in a code idtable-descriptions-techniques:the-details-element>a href#the-details-element>details/a>/code> elementdd> div classexample>pre><table> <caption> <strong>Characteristics with positive and negative sides.</strong>strong> <details> <summary>Help</summary> <p>Characteristics are given in the second column, with the negative side in the left column and the positive side in the right column.</p> </details>/strong> </caption> <thead> <tr> <th idn> Negative <th> Characteristic <th> Positive <tbody> <tr> <td headersn r1> Sad <th idr1> Mood <td> Happy <tr> <td headersn r2> Failing <th idr2> Grade <td> Passing</table>/pre>/div> dt>Next to the table, in the same code idtable-descriptions-techniques:the-figure-element>a href#the-figure-element>figure/a>/code>dd> div classexample>pre><figure> <figcaption>Characteristics with positive and negative sides</figcaption>strong> <p>Characteristics are given in the second column, with the negative side in the left column and the positive side in the right column.</p>/strong> <table> <thead> <tr> <th idn> Negative <th> Characteristic <th> Positive <tbody> <tr> <td headersn r1> Sad <th idr1> Mood <td> Happy <tr> <td headersn r2> Failing <th idr2> Grade <td> Passing </table></figure>/pre>/div> dt>Next to the table, in a code idtable-descriptions-techniques:the-figure-element-2>a href#the-figure-element>figure/a>/code>s code idtable-descriptions-techniques:the-figcaption-element>a href#the-figcaption-element>figcaption/a>/code>dd> div classexample>pre><figure> <figcaption> <strong>Characteristics with positive and negative sides</strong>strong> <p>Characteristics are given in the second column, with the negative side in the left column and the positive side in the right column.</p>/strong> </figcaption> <table> <thead> <tr> <th idn> Negative <th> Characteristic <th> Positive <tbody> <tr> <td headersn r1> Sad <th idr1> Mood <td> Happy <tr> <td headersn r2> Failing <th idr2> Grade <td> Passing </table></figure>/pre>/div> /dl> p>Authors may also use other techniques, or combinations of the above techniques, as appropriate./p> p>The best option, of course, rather than writing a description explaining the way the table is laid out, is to adjust the table such that no explanation is needed./p> div classexample> p>In the case of the table used in the examples above, a simple rearrangement of the table so that the headers are on the top and left sides removes the need for an explanation as well as removing the need for the use of code idtable-descriptions-techniques:attr-tdth-headers>a href#attr-tdth-headers>headers/a>/code> attributes:/p> pre><table> <caption>Characteristics with positive and negative sides</caption> <thead> <tr> <th> Characteristic <th> Negative <th> Positive <tbody> <tr> <th> Mood <td> Sad <td> Happy <tr> <th> Grade <td> Failing <td> Passing</table>/pre> /div> h5 idtable-layout-techniques>span classsecno>4.9.1.2/span> Techniques for table designa href#table-layout-techniques classself-link>/a>/h5> p>Good table design is key to making tables more readable and usable./p> p>In visual media, providing column and row borders and alternating row backgrounds can be very effective to make complicated tables more readable./p> p>For tables with large volumes of numeric content, using monospaced fonts can help users see patterns, especially in situations where a user agent does not render the borders. (Unfortunately, for historical reasons, not rendering borders on tables is a common default.)/p> p>In speech media, table cells can be distinguished by reporting the corresponding headers before reading the cells contents, and by allowing users to navigate the table in a grid fashion, rather than serializing the entire contents of the table in source order./p> p>Authors are encouraged to use CSS to achieve these effects./p> p>User agents are encouraged to render tables using these techniques whenever the page does not use CSS and the table is not classified as a layout table./p> h4 idthe-caption-element>span classsecno>4.9.2/span> The dfn>code>caption/code>/dfn> elementa href#the-caption-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-caption-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-caption-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As the first element child of a code idthe-caption-element:the-table-element>a href#the-table-element>table/a>/code> element.dt>a href#concept-element-content-model idthe-caption-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-caption-element:flow-content-2>Flow content/a>, but with no descendant code idthe-caption-element:the-table-element-2>a href#the-table-element>table/a>/code> elements.dt>a href#concept-element-tag-omission idthe-caption-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>A code idthe-caption-element:the-caption-element>a href#the-caption-element>caption/a>/code> elements a href#syntax-end-tag idthe-caption-element:syntax-end-tag>end tag/a> can be omitted if the code idthe-caption-element:the-caption-element-2>a href#the-caption-element>caption/a>/code> element is not immediately followed by a idthe-caption-element:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> or a a href#syntax-comments idthe-caption-element:syntax-comments>comment/a>.dt>a href#concept-element-attributes idthe-caption-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-caption-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-caption-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-caption-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmltablecaptionelement>HTMLTableCaptionElement/dfn> : a href#htmlelement idthe-caption-element:htmlelement>HTMLElement/a> { // a href#HTMLTableCaptionElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-caption-element:the-caption-element-3>a href#the-caption-element>caption/a>/code> element a href#represents idthe-caption-element:represents>represents/a> the title of the code idthe-caption-element:the-table-element-3>a href#the-table-element>table/a>/code> that is its parent, if it has a parent and that is a code idthe-caption-element:the-table-element-4>a href#the-table-element>table/a>/code> element./p> p>The code idthe-caption-element:the-caption-element-4>a href#the-caption-element>caption/a>/code> element takes part in the a href#table-model idthe-caption-element:table-model>table model/a>./p> p>When a code idthe-caption-element:the-table-element-5>a href#the-table-element>table/a>/code> element is the only content in a code idthe-caption-element:the-figure-element>a href#the-figure-element>figure/a>/code> element other than the code idthe-caption-element:the-figcaption-element>a href#the-figcaption-element>figcaption/a>/code>, the code idthe-caption-element:the-caption-element-5>a href#the-caption-element>caption/a>/code> element should be omitted in favor of the code idthe-caption-element:the-figcaption-element-2>a href#the-figcaption-element>figcaption/a>/code>./p> p>A caption can introduce context for a table, making it significantly easier to understand./p> div classexample> p>Consider, for instance, the following table:/p> table classdice-example>tr>th> th> 1 th> 2 th> 3 th> 4 th> 5 th> 6 tr>th> 1 td> 2 td> 3 td> 4 td> 5 td> 6 td> 7 tr>th> 2 td> 3 td> 4 td> 5 td> 6 td> 7 td> 8 tr>th> 3 td> 4 td> 5 td> 6 td> 7 td> 8 td> 9 tr>th> 4 td> 5 td> 6 td> 7 td> 8 td> 9 td> 10 tr>th> 5 td> 6 td> 7 td> 8 td> 9 td> 10 td> 11 tr>th> 6 td> 7 td> 8 td> 9 td> 10 td> 11 td> 12 /table> p>In the abstract, this table is not clear. However, with a caption giving the tables number (for a href#referenced idthe-caption-element:referenced>reference/a> in the main prose) and explaining its use, it makes more sense:/p> pre><caption><p>Table 1.<p>This table shows the total score obtained from rolling twosix-sided dice. The first row represents the value of the first die,the first column the value of the second die. The total is given inthe cell that corresponds to the values of the two dice.</caption>/pre> p>This provides the user with more context:/p> table classdice-example>caption> p>Table 1. p>This table shows the total score obtained from rolling two six-sided dice. The first row represents the value of the first die, the first column the value of the second die. The total is given in the cell that corresponds to the values of the two dice. /caption>tr>th> th> 1 th> 2 th> 3 th> 4 th> 5 th> 6 tr>th> 1 td> 2 td> 3 td> 4 td> 5 td> 6 td> 7 tr>th> 2 td> 3 td> 4 td> 5 td> 6 td> 7 td> 8 tr>th> 3 td> 4 td> 5 td> 6 td> 7 td> 8 td> 9 tr>th> 4 td> 5 td> 6 td> 7 td> 8 td> 9 td> 10 tr>th> 5 td> 6 td> 7 td> 8 td> 9 td> 10 td> 11 tr>th> 6 td> 7 td> 8 td> 9 td> 10 td> 11 td> 12 /table> /div> h4 idthe-colgroup-element>span classsecno>4.9.3/span> The dfn>code>colgroup/code>/dfn> elementa href#the-colgroup-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-colgroup-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-colgroup-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As a child of a code idthe-colgroup-element:the-table-element>a href#the-table-element>table/a>/code> element, after any code idthe-colgroup-element:the-caption-element>a href#the-caption-element>caption/a>/code> elements and before any code idthe-colgroup-element:the-thead-element>a href#the-thead-element>thead/a>/code>, code idthe-colgroup-element:the-tbody-element>a href#the-tbody-element>tbody/a>/code>, code idthe-colgroup-element:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code>, and code idthe-colgroup-element:the-tr-element>a href#the-tr-element>tr/a>/code> elements.dt>a href#concept-element-content-model idthe-colgroup-element:concept-element-content-model>Content model/a>:dd>If the code idthe-colgroup-element:attr-colgroup-span>a href#attr-colgroup-span>span/a>/code> attribute is present: a href#concept-content-nothing idthe-colgroup-element:concept-content-nothing>Nothing/a>.dd>If the code idthe-colgroup-element:attr-colgroup-span-2>a href#attr-colgroup-span>span/a>/code> attribute is absent: Zero or more code idthe-colgroup-element:the-col-element>a href#the-col-element>col/a>/code> and code idthe-colgroup-element:the-template-element>a href#the-template-element>template/a>/code> elements.dt>a href#concept-element-tag-omission idthe-colgroup-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>A code idthe-colgroup-element:the-colgroup-element>a href#the-colgroup-element>colgroup/a>/code> elements a href#syntax-start-tag idthe-colgroup-element:syntax-start-tag>start tag/a> can be omitted if the first thing inside the code idthe-colgroup-element:the-colgroup-element-2>a href#the-colgroup-element>colgroup/a>/code> element is a code idthe-colgroup-element:the-col-element-2>a href#the-col-element>col/a>/code> element, and if the element is not immediately preceded by another code idthe-colgroup-element:the-colgroup-element-3>a href#the-colgroup-element>colgroup/a>/code> element whose a href#syntax-end-tag idthe-colgroup-element:syntax-end-tag>end tag/a> has been omitted. (It cant be omitted if the element is empty.)dd>A code idthe-colgroup-element:the-colgroup-element-4>a href#the-colgroup-element>colgroup/a>/code> elements a href#syntax-end-tag idthe-colgroup-element:syntax-end-tag-2>end tag/a> can be omitted if the code idthe-colgroup-element:the-colgroup-element-5>a href#the-colgroup-element>colgroup/a>/code> element is not immediately followed by a idthe-colgroup-element:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> or a a href#syntax-comments idthe-colgroup-element:syntax-comments>comment/a>.dt>a href#concept-element-attributes idthe-colgroup-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-colgroup-element:global-attributes>Global attributes/a>dd>code idthe-colgroup-element:attr-colgroup-span-3>a href#attr-colgroup-span>span/a>/code> — Number of columns spanned by the elementdt>a href#concept-element-dom idthe-colgroup-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-colgroup-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmltablecolelement>HTMLTableColElement/dfn> : a href#htmlelement idthe-colgroup-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-colgroup-element:cereactions>CEReactions/a> attribute unsigned long a href#dom-colgroup-span idthe-colgroup-element:dom-colgroup-span>span/a>; // a href#HTMLTableColElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-colgroup-element:the-colgroup-element-6>a href#the-colgroup-element>colgroup/a>/code> element a href#represents idthe-colgroup-element:represents>represents/a> a a href#concept-column-group idthe-colgroup-element:concept-column-group>group/a> of one or more a href#concept-column idthe-colgroup-element:concept-column>columns/a> in the code idthe-colgroup-element:the-table-element-2>a href#the-table-element>table/a>/code> that is its parent, if it has a parent and that is a code idthe-colgroup-element:the-table-element-3>a href#the-table-element>table/a>/code> element./p> p>If the code idthe-colgroup-element:the-colgroup-element-7>a href#the-colgroup-element>colgroup/a>/code> element contains no code idthe-colgroup-element:the-col-element-3>a href#the-col-element>col/a>/code> elements, then the element may have a dfn idattr-colgroup-span>code>span/code>/dfn> content attribute specified, whose value must be a a href#valid-non-negative-integer idthe-colgroup-element:valid-non-negative-integer>valid non-negative integer/a> greater than zero and less than or equal to 1000./p> p>The code idthe-colgroup-element:the-colgroup-element-8>a href#the-colgroup-element>colgroup/a>/code> element and its code idthe-colgroup-element:attr-colgroup-span-4>a href#attr-colgroup-span>span/a>/code> attribute take part in the a href#table-model idthe-colgroup-element:table-model>table model/a>./p> p>The dfn iddom-colgroup-span>code>span/code>/dfn> IDL attribute must a href#reflect idthe-colgroup-element:reflect>reflect/a> the content attribute of the same name. It is a href#clamped-to-the-range idthe-colgroup-element:clamped-to-the-range>clamped to the range/a> 1, 1000, and its default value is 1./p> h4 idthe-col-element>span classsecno>4.9.4/span> The dfn>code>col/code>/dfn> elementa href#the-col-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-col-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-col-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As a child of a code idthe-col-element:the-colgroup-element>a href#the-colgroup-element>colgroup/a>/code> element that doesnt have a code idthe-col-element:attr-col-span>a href#attr-col-span>span/a>/code> attribute.dt>a href#concept-element-content-model idthe-col-element:concept-element-content-model>Content model/a>:dd>a href#concept-content-nothing idthe-col-element:concept-content-nothing>Nothing/a>.dt>a href#concept-element-tag-omission idthe-col-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>No a href#syntax-end-tag idthe-col-element:syntax-end-tag>end tag/a>.dt>a href#concept-element-attributes idthe-col-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-col-element:global-attributes>Global attributes/a>dd>code idthe-col-element:attr-col-span-2>a href#attr-col-span>span/a>/code> — Number of columns spanned by the elementdt>a href#concept-element-dom idthe-col-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-col-element:htmltablecolelement>a href#htmltablecolelement>HTMLTableColElement/a>/code>, as defined for code idthe-col-element:the-colgroup-element-2>a href#the-colgroup-element>colgroup/a>/code> elements./dl> p>If a code idthe-col-element:the-col-element>a href#the-col-element>col/a>/code> element has a parent and that is a code idthe-col-element:the-colgroup-element-3>a href#the-colgroup-element>colgroup/a>/code> element that itself has a parent that is a code idthe-col-element:the-table-element>a href#the-table-element>table/a>/code> element, then the code idthe-col-element:the-col-element-2>a href#the-col-element>col/a>/code> element a href#represents idthe-col-element:represents>represents/a> one or more a href#concept-column idthe-col-element:concept-column>columns/a> in the a href#concept-column-group idthe-col-element:concept-column-group>column group/a> represented by that code idthe-col-element:the-colgroup-element-4>a href#the-colgroup-element>colgroup/a>/code>./p> p>The element may have a dfn idattr-col-span>code>span/code>/dfn> content attribute specified, whose value must be a a href#valid-non-negative-integer idthe-col-element:valid-non-negative-integer>valid non-negative integer/a> greater than zero and less than or equal to 1000./p> p>The code idthe-col-element:the-col-element-3>a href#the-col-element>col/a>/code> element and its code idthe-col-element:attr-col-span-3>a href#attr-col-span>span/a>/code> attribute take part in the a href#table-model idthe-col-element:table-model>table model/a>./p> p>The dfn iddom-col-span>code>span/code>/dfn> IDL attribute must a href#reflect idthe-col-element:reflect>reflect/a> the content attribute of the same name. It is a href#clamped-to-the-range idthe-col-element:clamped-to-the-range>clamped to the range/a> 1, 1000, and its default value is 1./p> h4 idthe-tbody-element>span classsecno>4.9.5/span> The dfn>code>tbody/code>/dfn> elementa href#the-tbody-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-tbody-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-tbody-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As a child of a code idthe-tbody-element:the-table-element>a href#the-table-element>table/a>/code> element, after any code idthe-tbody-element:the-caption-element>a href#the-caption-element>caption/a>/code>, code idthe-tbody-element:the-colgroup-element>a href#the-colgroup-element>colgroup/a>/code>, and code idthe-tbody-element:the-thead-element>a href#the-thead-element>thead/a>/code> elements, but only if there are no code idthe-tbody-element:the-tr-element>a href#the-tr-element>tr/a>/code> elements that are children of the code idthe-tbody-element:the-table-element-2>a href#the-table-element>table/a>/code> element.dt>a href#concept-element-content-model idthe-tbody-element:concept-element-content-model>Content model/a>:dd>Zero or more code idthe-tbody-element:the-tr-element-2>a href#the-tr-element>tr/a>/code> and a href#script-supporting-elements-2 idthe-tbody-element:script-supporting-elements-2>script-supporting/a> elements.dt>a href#concept-element-tag-omission idthe-tbody-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>A code idthe-tbody-element:the-tbody-element>a href#the-tbody-element>tbody/a>/code> elements a href#syntax-start-tag idthe-tbody-element:syntax-start-tag>start tag/a> can be omitted if the first thing inside the code idthe-tbody-element:the-tbody-element-2>a href#the-tbody-element>tbody/a>/code> element is a code idthe-tbody-element:the-tr-element-3>a href#the-tr-element>tr/a>/code> element, and if the element is not immediately preceded by a code idthe-tbody-element:the-tbody-element-3>a href#the-tbody-element>tbody/a>/code>, code idthe-tbody-element:the-thead-element-2>a href#the-thead-element>thead/a>/code>, or code idthe-tbody-element:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code> element whose a href#syntax-end-tag idthe-tbody-element:syntax-end-tag>end tag/a> has been omitted. (It cant be omitted if the element is empty.)dd>A code idthe-tbody-element:the-tbody-element-4>a href#the-tbody-element>tbody/a>/code> elements a href#syntax-end-tag idthe-tbody-element:syntax-end-tag-2>end tag/a> can be omitted if the code idthe-tbody-element:the-tbody-element-5>a href#the-tbody-element>tbody/a>/code> element is immediately followed by a code idthe-tbody-element:the-tbody-element-6>a href#the-tbody-element>tbody/a>/code> or code idthe-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 idthe-tbody-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-tbody-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-tbody-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-tbody-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmltablesectionelement>HTMLTableSectionElement/dfn> : a href#htmlelement idthe-tbody-element:htmlelement>HTMLElement/a> { SameObject readonly attribute a idthe-tbody-element:htmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> a href#dom-tbody-rows idthe-tbody-element:dom-tbody-rows>rows/a>; a href#htmlelement idthe-tbody-element:htmlelement-2>HTMLElement/a> a href#dom-tbody-insertrow idthe-tbody-element:dom-tbody-insertrow>insertRow/a>(optional long index -1); a href#cereactions idthe-tbody-element:cereactions>CEReactions/a> void a href#dom-tbody-deleterow idthe-tbody-element:dom-tbody-deleterow>deleteRow/a>(long index); // a href#HTMLTableSectionElement-partial>also has obsolete members/a>};/pre> p>The code idthe-tbody-element:htmltablesectionelement>a href#htmltablesectionelement>HTMLTableSectionElement/a>/code> interface is also used for code idthe-tbody-element:the-thead-element-3>a href#the-thead-element>thead/a>/code> and code idthe-tbody-element:the-tfoot-element-3>a href#the-tfoot-element>tfoot/a>/code> elements./p> /dl> p>The code idthe-tbody-element:the-tbody-element-7>a href#the-tbody-element>tbody/a>/code> element a href#represents idthe-tbody-element:represents>represents/a> a a href#concept-row-group idthe-tbody-element:concept-row-group>block/a> of a href#concept-row idthe-tbody-element:concept-row>rows/a> that consist of a body of data for the parent code idthe-tbody-element:the-table-element-3>a href#the-table-element>table/a>/code> element, if the code idthe-tbody-element:the-tbody-element-8>a href#the-tbody-element>tbody/a>/code> element has a parent and it is a code idthe-tbody-element:the-table-element-4>a href#the-table-element>table/a>/code>./p> p>The code idthe-tbody-element:the-tbody-element-9>a href#the-tbody-element>tbody/a>/code> element takes part in the a href#table-model idthe-tbody-element:table-model>table model/a>./p> dl classdomintro>dt>var>tbody/var> . code idthe-tbody-element:dom-tbody-rows-2>a href#dom-tbody-rows>rows/a>/code>dd> p>Returns an code idthe-tbody-element:htmlcollection-2>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> of the code idthe-tbody-element:the-tr-element-4>a href#the-tr-element>tr/a>/code> elements of the table section./p> dt>var>tr/var> var>tbody/var> . code idthe-tbody-element:dom-tbody-insertrow-2>a href#dom-tbody-insertrow>insertRow/a>/code>( var>index/var> )dd> p>Creates a code idthe-tbody-element:the-tr-element-5>a href#the-tr-element>tr/a>/code> element, inserts it into the table section at the position given by the argument, and returns the code idthe-tbody-element:the-tr-element-6>a href#the-tr-element>tr/a>/code>./p> p>The position is relative to the rows in the table section. The index −1, which is the default if the argument is omitted, is equivalent to inserting at the end of the table section./p> p>If the given position is less than −1 or greater than the number of rows, throws an a idthe-tbody-element:indexsizeerror hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idthe-tbody-element:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> dt>var>tbody/var> . code idthe-tbody-element:dom-tbody-deleterow-2>a href#dom-tbody-deleterow>deleteRow/a>/code>(var>index/var>)dd> p>Removes the code idthe-tbody-element:the-tr-element-7>a href#the-tr-element>tr/a>/code> element with the given position in the table section./p> p>The position is relative to the rows in the table section. The index −1 is equivalent to deleting the last row of the table section./p> p>If the given position is less than −1 or greater than the index of the last row, or if there are no rows, throws an a idthe-tbody-element:indexsizeerror-2 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idthe-tbody-element:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> /dl> p>The dfn iddom-tbody-rows>code>rows/code>/dfn> attribute must return an code idthe-tbody-element:htmlcollection-3>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> rooted at this element, whose filter matches only code idthe-tbody-element:the-tr-element-8>a href#the-tr-element>tr/a>/code> elements that are children of this element./p> p>The dfn iddom-tbody-insertrow>code>insertRow(var>index/var>)/code>/dfn> method must act as follows:/p> ol>li>p>If var>index/var> is less than −1 or greater than the number of elements in the code idthe-tbody-element:dom-tbody-rows-3>a href#dom-tbody-rows>rows/a>/code> collection, throw an a idthe-tbody-element:indexsizeerror-3 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idthe-tbody-element:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Let var>table row/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-create-element idthe-tbody-element:create-an-element data-x-internalcreate-an-element>creating an element/a> given this elements a idthe-tbody-element:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, code idthe-tbody-element:the-tr-element-9>a href#the-tr-element>tr/a>/code>, and the a idthe-tbody-element:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>.li>p>If var>index/var> is −1 or equal to the number of items in the code idthe-tbody-element:dom-tbody-rows-4>a href#dom-tbody-rows>rows/a>/code> collection, then a hrefhttps://dom.spec.whatwg.org/#concept-node-append idthe-tbody-element:concept-node-append data-x-internalconcept-node-append>append/a> var>table row/var> to this element.li>p>Otherwise, a hrefhttps://dom.spec.whatwg.org/#concept-node-insert idthe-tbody-element:concept-node-insert data-x-internalconcept-node-insert>insert/a> var>table row/var> as a child of this element, immediately before the var>index/var>th code idthe-tbody-element:the-tr-element-10>a href#the-tr-element>tr/a>/code> element in the code idthe-tbody-element:dom-tbody-rows-5>a href#dom-tbody-rows>rows/a>/code> collection.li>p>Return var>table row/var>./ol> p>The dfn iddom-tbody-deleterow>code>deleteRow(var>index/var>)/code>/dfn> method must, when invoked, act as follows: ol>li>p>If var>index/var> is less than −1 or greater than or equal to the number of elements in the code idthe-tbody-element:dom-tbody-rows-6>a href#dom-tbody-rows>rows/a>/code> collection, then throw an a idthe-tbody-element:indexsizeerror-4 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idthe-tbody-element:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If var>index/var> is −1, then a hrefhttps://dom.spec.whatwg.org/#concept-node-remove idthe-tbody-element:concept-node-remove data-x-internalconcept-node-remove>remove/a> the last element in the code idthe-tbody-element:dom-tbody-rows-7>a href#dom-tbody-rows>rows/a>/code> collection from this element, or do nothing if the code idthe-tbody-element:dom-tbody-rows-8>a href#dom-tbody-rows>rows/a>/code> collection is empty.li>p>Otherwise, a hrefhttps://dom.spec.whatwg.org/#concept-node-remove idthe-tbody-element:concept-node-remove-2 data-x-internalconcept-node-remove>remove/a> the var>index/var>th element in the code idthe-tbody-element:dom-tbody-rows-9>a href#dom-tbody-rows>rows/a>/code> collection from this element./ol> h4 idthe-thead-element>span classsecno>4.9.6/span> The dfn>code>thead/code>/dfn> elementa href#the-thead-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-thead-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-thead-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As a child of a code idthe-thead-element:the-table-element>a href#the-table-element>table/a>/code> element, after any code idthe-thead-element:the-caption-element>a href#the-caption-element>caption/a>/code>, and code idthe-thead-element:the-colgroup-element>a href#the-colgroup-element>colgroup/a>/code> elements and before any code idthe-thead-element:the-tbody-element>a href#the-tbody-element>tbody/a>/code>, code idthe-thead-element:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code>, and code idthe-thead-element:the-tr-element>a href#the-tr-element>tr/a>/code> elements, but only if there are no other code idthe-thead-element:the-thead-element>a href#the-thead-element>thead/a>/code> elements that are children of the code idthe-thead-element:the-table-element-2>a href#the-table-element>table/a>/code> element.dt>a href#concept-element-content-model idthe-thead-element:concept-element-content-model>Content model/a>:dd>Zero or more code idthe-thead-element:the-tr-element-2>a href#the-tr-element>tr/a>/code> and a href#script-supporting-elements-2 idthe-thead-element:script-supporting-elements-2>script-supporting/a> elements.dt>a href#concept-element-tag-omission idthe-thead-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>A code idthe-thead-element:the-thead-element-2>a href#the-thead-element>thead/a>/code> elements a href#syntax-end-tag idthe-thead-element:syntax-end-tag>end tag/a> can be omitted if the code idthe-thead-element:the-thead-element-3>a href#the-thead-element>thead/a>/code> element is immediately followed by a code idthe-thead-element:the-tbody-element-2>a href#the-tbody-element>tbody/a>/code> or code idthe-thead-element:the-tfoot-element-2>a href#the-tfoot-element>tfoot/a>/code> element.dt>a href#concept-element-attributes idthe-thead-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-thead-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-thead-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-thead-element:htmltablesectionelement>a href#htmltablesectionelement>HTMLTableSectionElement/a>/code>, as defined for code idthe-thead-element:the-tbody-element-3>a href#the-tbody-element>tbody/a>/code> elements./dl> p>The code idthe-thead-element:the-thead-element-4>a href#the-thead-element>thead/a>/code> element a href#represents idthe-thead-element:represents>represents/a> the a href#concept-row-group idthe-thead-element:concept-row-group>block/a> of a href#concept-row idthe-thead-element:concept-row>rows/a> that consist of the column labels (headers) for the parent code idthe-thead-element:the-table-element-3>a href#the-table-element>table/a>/code> element, if the code idthe-thead-element:the-thead-element-5>a href#the-thead-element>thead/a>/code> element has a parent and it is a code idthe-thead-element:the-table-element-4>a href#the-table-element>table/a>/code>./p> p>The code idthe-thead-element:the-thead-element-6>a href#the-thead-element>thead/a>/code> element takes part in the a href#table-model idthe-thead-element:table-model>table model/a>./p> div classexample> p>This example shows a code idthe-thead-element:the-thead-element-7>a href#the-thead-element>thead/a>/code> element being used. Notice the use of both code idthe-thead-element:the-th-element>a href#the-th-element>th/a>/code> and code idthe-thead-element:the-td-element>a href#the-td-element>td/a>/code> elements in the code idthe-thead-element:the-thead-element-8>a href#the-thead-element>thead/a>/code> element: the first row is the headers, and the second row is an explanation of how to fill in the table./p> pre><table> <caption> School auction sign-up sheet </caption>strong> <thead> <tr> <th><label fore1>Name</label> <th><label fore2>Product</label> <th><label fore3>Picture</label> <th><label fore4>Price</label> <tr> <td>Your name here <td>What are you selling? <td>Link to a picture <td>Your reserve price/strong> <tbody> <tr> <td>Ms Danus <td>Doughnuts <td><img srchttps://example.com/mydoughnuts.png titleDoughnuts from Ms Danus> <td>$45 <tr> <td><input ide1 typetext namewho required formf> <td><input ide2 typetext namewhat required formf> <td><input ide3 typeurl namepic formf> <td><input ide4 typenumber step0.01 min0 value0 required formf></table><form idf action/auction.cgi> <input typebutton nameadd valueSubmit></form>/pre> /div> h4 idthe-tfoot-element>span classsecno>4.9.7/span> The dfn>code>tfoot/code>/dfn> elementa href#the-tfoot-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-tfoot-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-tfoot-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As a child of a code idthe-tfoot-element:the-table-element>a href#the-table-element>table/a>/code> element, after any code idthe-tfoot-element:the-caption-element>a href#the-caption-element>caption/a>/code>, code idthe-tfoot-element:the-colgroup-element>a href#the-colgroup-element>colgroup/a>/code>, code idthe-tfoot-element:the-thead-element>a href#the-thead-element>thead/a>/code>, code idthe-tfoot-element:the-tbody-element>a href#the-tbody-element>tbody/a>/code>, and code idthe-tfoot-element:the-tr-element>a href#the-tr-element>tr/a>/code> elements, but only if there are no other code idthe-tfoot-element:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code> elements that are children of the code idthe-tfoot-element:the-table-element-2>a href#the-table-element>table/a>/code> element.dt>a href#concept-element-content-model idthe-tfoot-element:concept-element-content-model>Content model/a>:dd>Zero or more code idthe-tfoot-element:the-tr-element-2>a href#the-tr-element>tr/a>/code> and a href#script-supporting-elements-2 idthe-tfoot-element:script-supporting-elements-2>script-supporting/a> elements.dt>a href#concept-element-tag-omission idthe-tfoot-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>A code idthe-tfoot-element:the-tfoot-element-2>a href#the-tfoot-element>tfoot/a>/code> elements a href#syntax-end-tag idthe-tfoot-element:syntax-end-tag>end tag/a> can be omitted if there is no more content in the parent element.dt>a href#concept-element-attributes idthe-tfoot-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-tfoot-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-tfoot-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-tfoot-element:htmltablesectionelement>a href#htmltablesectionelement>HTMLTableSectionElement/a>/code>, as defined for code idthe-tfoot-element:the-tbody-element-2>a href#the-tbody-element>tbody/a>/code> elements./dl> p>The code idthe-tfoot-element:the-tfoot-element-3>a href#the-tfoot-element>tfoot/a>/code> element a href#represents idthe-tfoot-element:represents>represents/a> the a href#concept-row-group idthe-tfoot-element:concept-row-group>block/a> of a href#concept-row idthe-tfoot-element:concept-row>rows/a> that consist of the column summaries (footers) for the parent code idthe-tfoot-element:the-table-element-3>a href#the-table-element>table/a>/code> element, if the code idthe-tfoot-element:the-tfoot-element-4>a href#the-tfoot-element>tfoot/a>/code> element has a parent and it is a code idthe-tfoot-element:the-table-element-4>a href#the-table-element>table/a>/code>./p> p>The code idthe-tfoot-element:the-tfoot-element-5>a href#the-tfoot-element>tfoot/a>/code> element takes part in the a href#table-model idthe-tfoot-element:table-model>table model/a>./p> h4 idthe-tr-element>span classsecno>4.9.8/span> The dfn>code>tr/code>/dfn> elementa href#the-tr-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-tr-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-tr-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As a child of a code idthe-tr-element:the-thead-element>a href#the-thead-element>thead/a>/code> element.dd>As a child of a code idthe-tr-element:the-tbody-element>a href#the-tbody-element>tbody/a>/code> element.dd>As a child of a code idthe-tr-element:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code> element.dd>As a child of a code idthe-tr-element:the-table-element>a href#the-table-element>table/a>/code> element, after any code idthe-tr-element:the-caption-element>a href#the-caption-element>caption/a>/code>, code idthe-tr-element:the-colgroup-element>a href#the-colgroup-element>colgroup/a>/code>, and code idthe-tr-element:the-thead-element-2>a href#the-thead-element>thead/a>/code> elements, but only if there are no code idthe-tr-element:the-tbody-element-2>a href#the-tbody-element>tbody/a>/code> elements that are children of the code idthe-tr-element:the-table-element-2>a href#the-table-element>table/a>/code> element.dt>a href#concept-element-content-model idthe-tr-element:concept-element-content-model>Content model/a>:dd>Zero or more code idthe-tr-element:the-td-element>a href#the-td-element>td/a>/code>, code idthe-tr-element:the-th-element>a href#the-th-element>th/a>/code>, and a href#script-supporting-elements-2 idthe-tr-element:script-supporting-elements-2>script-supporting/a> elements.dt>a href#concept-element-tag-omission idthe-tr-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>A code idthe-tr-element:the-tr-element>a href#the-tr-element>tr/a>/code> elements a href#syntax-end-tag idthe-tr-element:syntax-end-tag>end tag/a> can be omitted if the code idthe-tr-element:the-tr-element-2>a href#the-tr-element>tr/a>/code> element is immediately followed by another code idthe-tr-element:the-tr-element-3>a href#the-tr-element>tr/a>/code> element, or if there is no more content in the parent element.dt>a href#concept-element-attributes idthe-tr-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-tr-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-tr-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-tr-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmltablerowelement>HTMLTableRowElement/dfn> : a href#htmlelement idthe-tr-element:htmlelement>HTMLElement/a> { readonly attribute long a href#dom-tr-rowindex idthe-tr-element:dom-tr-rowindex>rowIndex/a>; readonly attribute long a href#dom-tr-sectionrowindex idthe-tr-element:dom-tr-sectionrowindex>sectionRowIndex/a>; SameObject readonly attribute a idthe-tr-element:htmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> a href#dom-tr-cells idthe-tr-element:dom-tr-cells>cells/a>; a href#htmltablecellelement idthe-tr-element:htmltablecellelement>HTMLTableCellElement/a> a href#dom-tr-insertcell idthe-tr-element:dom-tr-insertcell>insertCell/a>(optional long index -1); a href#cereactions idthe-tr-element:cereactions>CEReactions/a> void a href#dom-tr-deletecell idthe-tr-element:dom-tr-deletecell>deleteCell/a>(long index); // a href#HTMLTableRowElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-tr-element:the-tr-element-4>a href#the-tr-element>tr/a>/code> element a href#represents idthe-tr-element:represents>represents/a> a a href#concept-row idthe-tr-element:concept-row>row/a> of a href#concept-cell idthe-tr-element:concept-cell>cells/a> in a a href#concept-table idthe-tr-element:concept-table>table/a>./p> p>The code idthe-tr-element:the-tr-element-5>a href#the-tr-element>tr/a>/code> element takes part in the a href#table-model idthe-tr-element:table-model>table model/a>./p> dl classdomintro>dt>var>tr/var> . code idthe-tr-element:dom-tr-rowindex-2>a href#dom-tr-rowindex>rowIndex/a>/code>dd> p>Returns the position of the row in the tables code idthe-tr-element:dom-table-rows>a href#dom-table-rows>rows/a>/code> list./p> p>Returns −1 if the element isnt in a table./p> dt>var>tr/var> . code idthe-tr-element:dom-tr-sectionrowindex-2>a href#dom-tr-sectionrowindex>sectionRowIndex/a>/code>dd> p>Returns the position of the row in the table sections code idthe-tr-element:dom-tbody-rows>a href#dom-tbody-rows>rows/a>/code> list./p> p>Returns −1 if the element isnt in a table section./p> dt>var>tr/var> . code idthe-tr-element:dom-tr-cells-2>a href#dom-tr-cells>cells/a>/code>dd> p>Returns an code idthe-tr-element:htmlcollection-2>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> of the code idthe-tr-element:the-td-element-2>a href#the-td-element>td/a>/code> and code idthe-tr-element:the-th-element-2>a href#the-th-element>th/a>/code> elements of the row./p> dt>var>cell/var> var>tr/var> . code idthe-tr-element:dom-tr-insertcell-2>a href#dom-tr-insertcell>insertCell/a>/code>( var>index/var> )dd> p>Creates a code idthe-tr-element:the-td-element-3>a href#the-td-element>td/a>/code> element, inserts it into the table row at the position given by the argument, and returns the code idthe-tr-element:the-td-element-4>a href#the-td-element>td/a>/code>./p> p>The position is relative to the cells in the row. The index −1, which is the default if the argument is omitted, is equivalent to inserting at the end of the row./p> p>If the given position is less than −1 or greater than the number of cells, throws an a idthe-tr-element:indexsizeerror hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idthe-tr-element:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> dt>var>tr/var> . code idthe-tr-element:dom-tr-deletecell-2>a href#dom-tr-deletecell>deleteCell/a>/code>(var>index/var>)dd> p>Removes the code idthe-tr-element:the-td-element-5>a href#the-td-element>td/a>/code> or code idthe-tr-element:the-th-element-3>a href#the-th-element>th/a>/code> element with the given position in the row./p> p>The position is relative to the cells in the row. The index −1 is equivalent to deleting the last cell of the row./p> p>If the given position is less than −1 or greater than the index of the last cell, or if there are no cells, throws an a idthe-tr-element:indexsizeerror-2 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idthe-tr-element:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> /dl> p>The dfn iddom-tr-rowindex>code>rowIndex/code>/dfn> attribute must, if this element has a parent code idthe-tr-element:the-table-element-3>a href#the-table-element>table/a>/code> element, or a parent code idthe-tr-element:the-tbody-element-3>a href#the-tbody-element>tbody/a>/code>, code idthe-tr-element:the-thead-element-3>a href#the-thead-element>thead/a>/code>, or code idthe-tr-element:the-tfoot-element-2>a href#the-tfoot-element>tfoot/a>/code> element and a em>grandparent/em> code idthe-tr-element:the-table-element-4>a href#the-table-element>table/a>/code> element, return the index of this code idthe-tr-element:the-tr-element-6>a href#the-tr-element>tr/a>/code> element in that code idthe-tr-element:the-table-element-5>a href#the-table-element>table/a>/code> elements code idthe-tr-element:dom-table-rows-2>a href#dom-table-rows>rows/a>/code> collection. If there is no such code idthe-tr-element:the-table-element-6>a href#the-table-element>table/a>/code> element, then the attribute must return −1./p> p>The dfn iddom-tr-sectionrowindex>code>sectionRowIndex/code>/dfn> attribute must, if this element has a parent code idthe-tr-element:the-table-element-7>a href#the-table-element>table/a>/code>, code idthe-tr-element:the-tbody-element-4>a href#the-tbody-element>tbody/a>/code>, code idthe-tr-element:the-thead-element-4>a href#the-thead-element>thead/a>/code>, or code idthe-tr-element:the-tfoot-element-3>a href#the-tfoot-element>tfoot/a>/code> element, return the index of the code idthe-tr-element:the-tr-element-7>a href#the-tr-element>tr/a>/code> element in the parent elements code>rows/code> collection (for tables, thats code idthe-tr-element:htmltableelement>a href#htmltableelement>HTMLTableElement/a>/code>s code idthe-tr-element:dom-table-rows-3>a href#dom-table-rows>rows/a>/code> collection; for table sections, thats code idthe-tr-element:htmltablesectionelement>a href#htmltablesectionelement>HTMLTableSectionElement/a>/code>s code idthe-tr-element:dom-tbody-rows-2>a href#dom-tbody-rows>rows/a>/code> collection). If there is no such parent element, then the attribute must return −1./p> p>The dfn iddom-tr-cells>code>cells/code>/dfn> attribute must return an code idthe-tr-element:htmlcollection-3>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> rooted at this code idthe-tr-element:the-tr-element-8>a href#the-tr-element>tr/a>/code> element, whose filter matches only code idthe-tr-element:the-td-element-6>a href#the-td-element>td/a>/code> and code idthe-tr-element:the-th-element-4>a href#the-th-element>th/a>/code> elements that are children of the code idthe-tr-element:the-tr-element-9>a href#the-tr-element>tr/a>/code> element./p> p>The dfn iddom-tr-insertcell>code>insertCell(var>index/var>)/code>/dfn> method must act as follows:/p> ol>li>p>If var>index/var> is less than −1 or greater than the number of elements in the code idthe-tr-element:dom-tr-cells-3>a href#dom-tr-cells>cells/a>/code> collection, then throw an a idthe-tr-element:indexsizeerror-3 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idthe-tr-element:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Let var>table cell/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-create-element idthe-tr-element:create-an-element data-x-internalcreate-an-element>creating an element/a> given this code idthe-tr-element:the-tr-element-10>a href#the-tr-element>tr/a>/code> elements a idthe-tr-element:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, code idthe-tr-element:the-td-element-7>a href#the-td-element>td/a>/code>, and the a idthe-tr-element:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>.li>p>If var>index/var> is equal to −1 or equal to the number of items in code idthe-tr-element:dom-tr-cells-4>a href#dom-tr-cells>cells/a>/code> collection, then a hrefhttps://dom.spec.whatwg.org/#concept-node-append idthe-tr-element:concept-node-append data-x-internalconcept-node-append>append/a> var>table cell/var> to this code idthe-tr-element:the-tr-element-11>a href#the-tr-element>tr/a>/code> element.li>p>Otherwise, a hrefhttps://dom.spec.whatwg.org/#concept-node-insert idthe-tr-element:concept-node-insert data-x-internalconcept-node-insert>insert/a> var>table cell/var> as a child of this code idthe-tr-element:the-tr-element-12>a href#the-tr-element>tr/a>/code> element, immediately before the var>index/var>th code idthe-tr-element:the-td-element-8>a href#the-td-element>td/a>/code> or code idthe-tr-element:the-th-element-5>a href#the-th-element>th/a>/code> element in the code idthe-tr-element:dom-tr-cells-5>a href#dom-tr-cells>cells/a>/code> collection.li>p>Return var>table cell/var>./ol> p>The dfn iddom-tr-deletecell>code>deleteCell(var>index/var>)/code>/dfn> method must act as follows:/p> ol>li>p>If var>index/var> is less than −1 or greater than or equal to the number of elements in the code idthe-tr-element:dom-tr-cells-6>a href#dom-tr-cells>cells/a>/code> collection, then throw an a idthe-tr-element:indexsizeerror-4 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idthe-tr-element:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If var>index/var> is −1, then a hrefhttps://dom.spec.whatwg.org/#concept-node-remove idthe-tr-element:concept-node-remove data-x-internalconcept-node-remove>remove/a> the last element in the code idthe-tr-element:dom-tr-cells-7>a href#dom-tr-cells>cells/a>/code> collection from its parent, or do nothing if the code idthe-tr-element:dom-tr-cells-8>a href#dom-tr-cells>cells/a>/code> collection is empty.li>p>Otherwise, a hrefhttps://dom.spec.whatwg.org/#concept-node-remove idthe-tr-element:concept-node-remove-2 data-x-internalconcept-node-remove>remove/a> the var>index/var>th element in the code idthe-tr-element:dom-tr-cells-9>a href#dom-tr-cells>cells/a>/code> collection from its parent./ol> h4 idthe-td-element>span classsecno>4.9.9/span> The dfn>code>td/code>/dfn> elementa href#the-td-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-td-element:concept-element-categories>Categories/a>:dd>a href#sectioning-root idthe-td-element:sectioning-root>Sectioning root/a>.dt>a href#concept-element-contexts idthe-td-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As a child of a code idthe-td-element:the-tr-element>a href#the-tr-element>tr/a>/code> element.dt>a href#concept-element-content-model idthe-td-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-td-element:flow-content-2>Flow content/a>.dt>a href#concept-element-tag-omission idthe-td-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>A code idthe-td-element:the-td-element>a href#the-td-element>td/a>/code> elements a href#syntax-end-tag idthe-td-element:syntax-end-tag>end tag/a> can be omitted if the code idthe-td-element:the-td-element-2>a href#the-td-element>td/a>/code> element is immediately followed by a code idthe-td-element:the-td-element-3>a href#the-td-element>td/a>/code> or code idthe-td-element:the-th-element>a href#the-th-element>th/a>/code> element, or if there is no more content in the parent element.dt>a href#concept-element-attributes idthe-td-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-td-element:global-attributes>Global attributes/a>dd>code idthe-td-element:attr-tdth-colspan>a href#attr-tdth-colspan>colspan/a>/code> — Number of columns that the cell is to spandd>code idthe-td-element:attr-tdth-rowspan>a href#attr-tdth-rowspan>rowspan/a>/code> — Number of rows that the cell is to spandd>code idthe-td-element:attr-tdth-headers>a href#attr-tdth-headers>headers/a>/code> — The header cells for this celldt>a href#concept-element-dom idthe-td-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-td-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmltablecellelement>HTMLTableCellElement/dfn> : a href#htmlelement idthe-td-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-td-element:cereactions>CEReactions/a> attribute unsigned long a href#dom-tdth-colspan idthe-td-element:dom-tdth-colspan>colSpan/a>; a href#cereactions idthe-td-element:cereactions-2>CEReactions/a> attribute unsigned long a href#dom-tdth-rowspan idthe-td-element:dom-tdth-rowspan>rowSpan/a>; a href#cereactions idthe-td-element:cereactions-3>CEReactions/a> attribute DOMString a href#dom-tdth-headers idthe-td-element:dom-tdth-headers>headers/a>; readonly attribute long a href#dom-tdth-cellindex idthe-td-element:dom-tdth-cellindex>cellIndex/a>; a href#cereactions idthe-td-element:cereactions-4>CEReactions/a> attribute DOMString a href#dom-th-scope idthe-td-element:dom-th-scope>scope/a>; // only conforming for th elements a href#cereactions idthe-td-element:cereactions-5>CEReactions/a> attribute DOMString a href#dom-th-abbr idthe-td-element:dom-th-abbr>abbr/a>; // only conforming for th elements // a href#HTMLTableCellElement-partial>also has obsolete members/a>};/pre> p>The code idthe-td-element:htmltablecellelement>a href#htmltablecellelement>HTMLTableCellElement/a>/code> interface is also used for code idthe-td-element:the-th-element-2>a href#the-th-element>th/a>/code> elements./p> /dl> p>The code idthe-td-element:the-td-element-4>a href#the-td-element>td/a>/code> element a href#represents idthe-td-element:represents>represents/a> a data a href#concept-cell idthe-td-element:concept-cell>cell/a> in a table./p> p>The code idthe-td-element:the-td-element-5>a href#the-td-element>td/a>/code> element and its code idthe-td-element:attr-tdth-colspan-2>a href#attr-tdth-colspan>colspan/a>/code>, code idthe-td-element:attr-tdth-rowspan-2>a href#attr-tdth-rowspan>rowspan/a>/code>, and code idthe-td-element:attr-tdth-headers-2>a href#attr-tdth-headers>headers/a>/code> attributes take part in the a href#table-model idthe-td-element:table-model>table model/a>./p> p>User agents, especially in non-visual environments or where displaying the table as a 2D grid is impractical, may give the user context for the cell when rendering the contents of a cell; for instance, giving its position in the a href#table-model idthe-td-element:table-model-2>table model/a>, or listing the cells header cells (as determined by the a href#algorithm-for-assigning-header-cells idthe-td-element:algorithm-for-assigning-header-cells>algorithm for assigning header cells/a>). When a cells header cells are being listed, user agents may use the value of code idthe-td-element:attr-th-abbr>a href#attr-th-abbr>abbr/a>/code> attributes on those header cells, if any, instead of the contents of the header cells themselves./p> div classexample> p>In this example, we see a snippet of a Web application consisting of a grid of editable cells (essentially a simple spreadsheet). One of the cells has been configured to show the sum of the cells above it. Three have been marked as headings, which use code idthe-td-element:the-th-element-3>a href#the-th-element>th/a>/code> elements instead of code idthe-td-element:the-td-element-6>a href#the-td-element>td/a>/code> elements. A script would attach event handlers to these elements to maintain the total./p> pre><table> <tr> <th><input valueName> <th><input valuePaid ($)> <tr> <td><input valueJeff> <td><input value14> <tr> <td><input valueBritta> <td><input value9> <tr> <td><input valueAbed> <td><input value25> <tr> <td><input valueShirley> <td><input value2> <tr> <td><input valueAnnie> <td><input value5> <tr> <td><input valueTroy> <td><input value5> <tr> <td><input valuePierce> <td><input value1000> <tr> <th><input valueTotal> <td><output value1060></table>/pre> /div> h4 idthe-th-element>span classsecno>4.9.10/span> The dfn>code>th/code>/dfn> elementa href#the-th-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-th-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-th-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As a child of a code idthe-th-element:the-tr-element>a href#the-tr-element>tr/a>/code> element.dt>a href#concept-element-content-model idthe-th-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-th-element:flow-content-2>Flow content/a>, but with no code idthe-th-element:the-header-element>a href#the-header-element>header/a>/code>, code idthe-th-element:the-footer-element>a href#the-footer-element>footer/a>/code>, a href#sectioning-content-2 idthe-th-element:sectioning-content-2>sectioning content/a>, or a href#heading-content-2 idthe-th-element:heading-content-2>heading content/a> descendants.dt>a href#concept-element-tag-omission idthe-th-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>A code idthe-th-element:the-th-element>a href#the-th-element>th/a>/code> elements a href#syntax-end-tag idthe-th-element:syntax-end-tag>end tag/a> can be omitted if the code idthe-th-element:the-th-element-2>a href#the-th-element>th/a>/code> element is immediately followed by a code idthe-th-element:the-td-element>a href#the-td-element>td/a>/code> or code idthe-th-element:the-th-element-3>a href#the-th-element>th/a>/code> element, or if there is no more content in the parent element.dt>a href#concept-element-attributes idthe-th-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-th-element:global-attributes>Global attributes/a>dd>code idthe-th-element:attr-tdth-colspan>a href#attr-tdth-colspan>colspan/a>/code> — Number of columns that the cell is to spandd>code idthe-th-element:attr-tdth-rowspan>a href#attr-tdth-rowspan>rowspan/a>/code> — Number of rows that the cell is to spandd>code idthe-th-element:attr-tdth-headers>a href#attr-tdth-headers>headers/a>/code> — The header cells for this celldd>code idthe-th-element:attr-th-scope>a href#attr-th-scope>scope/a>/code> — Specifies which cells the header cell applies todd>code idthe-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 contextsdt>a href#concept-element-dom idthe-th-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-th-element:htmltablecellelement>a href#htmltablecellelement>HTMLTableCellElement/a>/code>, as defined for code idthe-th-element:the-td-element-2>a href#the-td-element>td/a>/code> elements./dl> p>The code idthe-th-element:the-th-element-4>a href#the-th-element>th/a>/code> element a href#represents idthe-th-element:represents>represents/a> a header a href#concept-cell idthe-th-element:concept-cell>cell/a> in a table./p> p>The code idthe-th-element:the-th-element-5>a href#the-th-element>th/a>/code> element may have a dfn idattr-th-scope>code>scope/code>/dfn> content attribute specified. The code idthe-th-element:attr-th-scope-2>a href#attr-th-scope>scope/a>/code> attribute is an a href#enumerated-attribute idthe-th-element:enumerated-attribute>enumerated attribute/a> with five states, four of which have explicit keywords:/p> dl>dt>The dfn idattr-th-scope-row>code>row/code>/dfn> keyword, which maps to the i>row/i> statedd>The i>row/i> state means the header cell applies to some of the subsequent cells in the same row(s).dt>The dfn idattr-th-scope-col>code>col/code>/dfn> keyword, which maps to the i>column/i> statedd>The i>column/i> state means the header cell applies to some of the subsequent cells in the same column(s).dt>The dfn idattr-th-scope-rowgroup>code>rowgroup/code>/dfn> keyword, which maps to the i>row group/i> statedd>The i>row group/i> state means the header cell applies to all the remaining cells in the row group. A code idthe-th-element:the-th-element-6>a href#the-th-element>th/a>/code> elements code idthe-th-element:attr-th-scope-3>a href#attr-th-scope>scope/a>/code> attribute must not be in the a href#attr-th-scope-rowgroup idthe-th-element:attr-th-scope-rowgroup>row group/a> state if the element is not anchored in a a href#concept-row-group idthe-th-element:concept-row-group>row group/a>.dt>The dfn idattr-th-scope-colgroup>code>colgroup/code>/dfn> keyword, which maps to the i>column group/i> statedd>The i>column group/i> state means the header cell applies to all the remaining cells in the column group. A code idthe-th-element:the-th-element-7>a href#the-th-element>th/a>/code> elements code idthe-th-element:attr-th-scope-4>a href#attr-th-scope>scope/a>/code> attribute must not be in the a href#attr-th-scope-colgroup idthe-th-element:attr-th-scope-colgroup>column group/a> state if the element is not anchored in a a href#concept-column-group idthe-th-element:concept-column-group>column group/a>.dt>The dfn idattr-th-scope-auto>auto/dfn> statedd>The i>auto/i> state makes the header cell apply to a set of cells selected based on context./dl> p>The code idthe-th-element:attr-th-scope-5>a href#attr-th-scope>scope/a>/code> attributes i idthe-th-element:missing-value-default>a href#missing-value-default>missing value default/a>/i> is the i>auto/i> state./p> p>The code idthe-th-element:the-th-element-8>a href#the-th-element>th/a>/code> element may have an dfn idattr-th-abbr>code>abbr/code>/dfn> content attribute specified. Its value must be an alternative label for the header cell, to be used when referencing the cell in other contexts (e.g. when describing the header cells that apply to a data cell). It is typically an abbreviated form of the full header cell, but can also be an expansion, or merely a different phrasing./p> p>The code idthe-th-element:the-th-element-9>a href#the-th-element>th/a>/code> element and its code idthe-th-element:attr-tdth-colspan-2>a href#attr-tdth-colspan>colspan/a>/code>, code idthe-th-element:attr-tdth-rowspan-2>a href#attr-tdth-rowspan>rowspan/a>/code>, code idthe-th-element:attr-tdth-headers-2>a href#attr-tdth-headers>headers/a>/code>, and code idthe-th-element:attr-th-scope-6>a href#attr-th-scope>scope/a>/code> attributes take part in the a href#table-model idthe-th-element:table-model>table model/a>./p> div classexample> p>The following example shows how the code idthe-th-element:attr-th-scope-7>a href#attr-th-scope>scope/a>/code> attributes code idthe-th-element:attr-th-scope-rowgroup-2>a href#attr-th-scope-rowgroup>rowgroup/a>/code> value affects which data cells a header cell applies to./p> p>Here is a markup fragment showing a table:/p> pre><table> <thead> <tr> <th> ID <th> Measurement <th> Average <th> Maximum <tbody> <tr> <td> <th scoperowgroup> Cats <td> <td> <tr> <td> 93 <th scoperow> Legs <td> 3.5 <td> 4 <tr> <td> 10 <th scoperow> Tails <td> 1 <td> 1 <tbody> <tr> <td> <th scoperowgroup> English speakers <td> <td> <tr> <td> 32 <th scoperow> Legs <td> 2.67 <td> 4 <tr> <td> 35 <th scoperow> Tails <td> 0.33 <td> 1</table>/pre> p>This would result in the following table:/p> table>thead>tr>th> ID th> Measurement th> Average th> Maximum tbody>tr>td> th scoperowgroup> Cats td> td> tr>td> 93 th scoperow> Legs td> 3.5 td> 4 tr>td> 10 th scoperow> Tails td> 1 td> 1 tbody>tr>td> th scoperowgroup> English speakers td> td> tr>td> 32 th scoperow> Legs td> 2.67 td> 4 tr>td> 35 th scoperow> Tails td> 0.33 td> 1 /table> p>The headers in the first row all apply directly down to the rows in their column./p> p>The headers with the explicit code idthe-th-element:attr-th-scope-8>a href#attr-th-scope>scope/a>/code> attributes apply to all the cells in their row group other than the cells in the first column./p> p>The remaining headers apply just to the cells to the right of them./p> img src/images/table-scope-diagram.png width459 alt height256> /div> h4 idattributes-common-to-td-and-th-elements>span classsecno>4.9.11/span> Attributes common to code idattributes-common-to-td-and-th-elements:the-td-element>a href#the-td-element>td/a>/code> and code idattributes-common-to-td-and-th-elements:the-th-element>a href#the-th-element>th/a>/code> elementsa href#attributes-common-to-td-and-th-elements classself-link>/a>/h4> p>The code idattributes-common-to-td-and-th-elements:the-td-element-2>a href#the-td-element>td/a>/code> and code idattributes-common-to-td-and-th-elements:the-th-element-2>a href#the-th-element>th/a>/code> elements may have a dfn idattr-tdth-colspan>code>colspan/code>/dfn> content attribute specified, whose value must be a a href#valid-non-negative-integer idattributes-common-to-td-and-th-elements:valid-non-negative-integer>valid non-negative integer/a> greater than zero and less than or equal to 1000./p> p>The code idattributes-common-to-td-and-th-elements:the-td-element-3>a href#the-td-element>td/a>/code> and code idattributes-common-to-td-and-th-elements:the-th-element-3>a href#the-th-element>th/a>/code> elements may also have a dfn idattr-tdth-rowspan>code>rowspan/code>/dfn> content attribute specified, whose value must be a a href#valid-non-negative-integer idattributes-common-to-td-and-th-elements:valid-non-negative-integer-2>valid non-negative integer/a> less than or equal to 65534. For this attribute, the value zero means that the cell is to span all the remaining rows in the row group./p> p>These attributes give the number of columns and rows respectively that the cell is to span. These attributes must not be used to overlap cells, as described in the description of the a href#table-model idattributes-common-to-td-and-th-elements:table-model>table model/a>./p> hr> p>The code idattributes-common-to-td-and-th-elements:the-td-element-4>a href#the-td-element>td/a>/code> and code idattributes-common-to-td-and-th-elements:the-th-element-4>a href#the-th-element>th/a>/code> element may have a dfn idattr-tdth-headers>code>headers/code>/dfn> content attribute specified. The code idattributes-common-to-td-and-th-elements:attr-tdth-headers>a href#attr-tdth-headers>headers/a>/code> attribute, if specified, must contain a string consisting of an a href#unordered-set-of-unique-space-separated-tokens idattributes-common-to-td-and-th-elements:unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens/a> that are a href#case-sensitive idattributes-common-to-td-and-th-elements:case-sensitive>case-sensitive/a>, each of which must have the value of an a hrefhttps://dom.spec.whatwg.org/#concept-id idattributes-common-to-td-and-th-elements:concept-id data-x-internalconcept-id>ID/a> of a code idattributes-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 idattributes-common-to-td-and-th-elements:concept-table>table/a> as the code idattributes-common-to-td-and-th-elements:the-td-element-5>a href#the-td-element>td/a>/code> or code idattributes-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 idattributes-common-to-td-and-th-elements:table-model-2>table model/a>)./p> p>A code idattributes-common-to-td-and-th-elements:the-th-element-7>a href#the-th-element>th/a>/code> element with a hrefhttps://dom.spec.whatwg.org/#concept-id idattributes-common-to-td-and-th-elements:concept-id-2 data-x-internalconcept-id>ID/a> var>id/var> is said to be i>directly targeted/i> by all code idattributes-common-to-td-and-th-elements:the-td-element-6>a href#the-td-element>td/a>/code> and code idattributes-common-to-td-and-th-elements:the-th-element-8>a href#the-th-element>th/a>/code> elements in the same a href#concept-table idattributes-common-to-td-and-th-elements:concept-table-2>table/a> that have code idattributes-common-to-td-and-th-elements:attr-tdth-headers-2>a href#attr-tdth-headers>headers/a>/code> attributes whose values include as one of their tokens the a hrefhttps://dom.spec.whatwg.org/#concept-id idattributes-common-to-td-and-th-elements:concept-id-3 data-x-internalconcept-id>ID/a> var>id/var>. A code idattributes-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 idattributes-common-to-td-and-th-elements:the-th-element-10>a href#the-th-element>th/a>/code> or code idattributes-common-to-td-and-th-elements:the-td-element-7>a href#the-td-element>td/a>/code> element var>B/var> if either var>A/var> is i>directly targeted/i> by var>B/var> or if there exists an element var>C/var> that is itself i>targeted/i> by the element var>B/var> and var>A/var> is i>directly targeted/i> by var>C/var>./p> p>A code idattributes-common-to-td-and-th-elements:the-th-element-11>a href#the-th-element>th/a>/code> element must not be i>targeted/i> by itself./p> p>The code idattributes-common-to-td-and-th-elements:attr-tdth-colspan>a href#attr-tdth-colspan>colspan/a>/code>, code idattributes-common-to-td-and-th-elements:attr-tdth-rowspan>a href#attr-tdth-rowspan>rowspan/a>/code>, and code idattributes-common-to-td-and-th-elements:attr-tdth-headers-3>a href#attr-tdth-headers>headers/a>/code> attributes take part in the a href#table-model idattributes-common-to-td-and-th-elements:table-model-3>table model/a>./p> hr> dl classdomintro>dt>var>cell/var> . code idattributes-common-to-td-and-th-elements:dom-tdth-cellindex>a href#dom-tdth-cellindex>cellIndex/a>/code>dd> p>Returns the position of the cell in the rows code idattributes-common-to-td-and-th-elements:dom-tr-cells>a href#dom-tr-cells>cells/a>/code> list. This does not necessarily correspond to the var>x/var>-position of the cell in the table, since earlier cells might cover multiple rows or columns./p> p>Returns −1 if the element isnt in a row./p> /dl> p>The dfn iddom-tdth-colspan>code>colSpan/code>/dfn> IDL attribute must a href#reflect idattributes-common-to-td-and-th-elements:reflect>reflect/a> the code idattributes-common-to-td-and-th-elements:attr-tdth-colspan-2>a href#attr-tdth-colspan>colspan/a>/code> content attribute. It is a href#clamped-to-the-range idattributes-common-to-td-and-th-elements:clamped-to-the-range>clamped to the range/a> 1, 1000, and its default value is 1./p> p>The dfn iddom-tdth-rowspan>code>rowSpan/code>/dfn> IDL attribute must a href#reflect idattributes-common-to-td-and-th-elements:reflect-2>reflect/a> the code idattributes-common-to-td-and-th-elements:attr-tdth-rowspan-2>a href#attr-tdth-rowspan>rowspan/a>/code> content attribute. It is a href#clamped-to-the-range idattributes-common-to-td-and-th-elements:clamped-to-the-range-2>clamped to the range/a> 0, 65534, and its default value is 1./p> p>The dfn iddom-tdth-headers>code>headers/code>/dfn> IDL attribute must a href#reflect idattributes-common-to-td-and-th-elements:reflect-3>reflect/a> the content attribute of the same name./p> p>The dfn iddom-tdth-cellindex>code>cellIndex/code>/dfn> IDL attribute must, if the element has a parent code idattributes-common-to-td-and-th-elements:the-tr-element>a href#the-tr-element>tr/a>/code> element, return the index of the cells element in the parent elements code idattributes-common-to-td-and-th-elements:dom-tr-cells-2>a href#dom-tr-cells>cells/a>/code> collection. If there is no such parent element, then the attribute must return −1./p> p>The dfn iddom-th-scope>code>scope/code>/dfn> IDL attribute must a href#reflect idattributes-common-to-td-and-th-elements:reflect-4>reflect/a> the content attribute of the same name, a href#limited-to-only-known-values idattributes-common-to-td-and-th-elements:limited-to-only-known-values>limited to only known values/a>./p> p>The dfn iddom-th-abbr>code>abbr/code>/dfn> IDL attribute must a href#reflect idattributes-common-to-td-and-th-elements:reflect-5>reflect/a> the content attribute of the same name./p> h4 idtable-processing-model>span classsecno>4.9.12/span> span idprocessing-model-2>/span>Processing modela href#table-processing-model classself-link>/a>/h4> p>The various table elements and their content attributes together define the dfn idtable-model>table model/dfn>./p> p>A dfn idconcept-table>table/dfn> consists of cells aligned on a two-dimensional grid of dfn idconcept-slots>slots/dfn> with coordinates (var>x/var>, var>y/var>). The grid is finite, and is either empty or has one or more slots. If the grid has one or more slots, then the var>x/var> coordinates are always in the range span>0 ≤ var>x/var> < var>xsub>width/sub>/var>/span>, and the var>y/var> coordinates are always in the range span>0 ≤ var>y/var> < var>ysub>height/sub>/var>/span>. If one or both of var>xsub>width/sub>/var> and var>ysub>height/sub>/var> are zero, then the table is empty (has no slots). Tables correspond to code idtable-processing-model:the-table-element>a href#the-table-element>table/a>/code> elements./p> p>A dfn idconcept-cell>cell/dfn> is a set of slots anchored at a slot (var>cellsub>x/sub>/var>, var>cellsub>y/sub>/var>), and with a particular var>width/var> and var>height/var> such that the cell covers all the slots with coordinates (var>x/var>, var>y/var>) where span>var>cellsub>x/sub>/var> ≤ var>x/var> < var>cellsub>x/sub>/var>+var>width/var>/span> and var>cellsub>y/sub>/var> ≤ var>y/var> < var>cellsub>y/sub>/var>+var>height/var>. Cells can either be em>data cells/em> or em>header cells/em>. Data cells correspond to code idtable-processing-model:the-td-element>a href#the-td-element>td/a>/code> elements, and header cells correspond to code idtable-processing-model:the-th-element>a href#the-th-element>th/a>/code> elements. Cells of both types can have zero or more associated header cells./p> p>It is possible, in certain error cases, for two cells to occupy the same slot./p> p>A dfn idconcept-row>row/dfn> is a complete set of slots from var>x/var>0 to var>x/var>var>xsub>width/sub>/var>-1, for a particular value of var>y/var>. Rows usually correspond to code idtable-processing-model:the-tr-element>a href#the-tr-element>tr/a>/code> elements, though a a href#concept-row-group idtable-processing-model:concept-row-group>row group/a> can have some implied a href#concept-row idtable-processing-model:concept-row>rows/a> at the end in some cases involving a href#concept-cell idtable-processing-model:concept-cell>cells/a> spanning multiple rows./p> p>A dfn idconcept-column>column/dfn> is a complete set of slots from var>y/var>0 to var>y/var>var>ysub>height/sub>/var>-1, for a particular value of var>x/var>. Columns can correspond to code idtable-processing-model:the-col-element>a href#the-col-element>col/a>/code> elements. In the absence of code idtable-processing-model:the-col-element-2>a href#the-col-element>col/a>/code> elements, columns are implied./p> p>A dfn idconcept-row-group>row group/dfn> is a set of a href#concept-row idtable-processing-model:concept-row-2>rows/a> anchored at a slot (0, var>groupsub>y/sub>/var>) with a particular var>height/var> such that the row group covers all the slots with coordinates (var>x/var>, var>y/var>) where span>0 ≤ var>x/var> < var>xsub>width/sub>/var>/span> and var>groupsub>y/sub>/var> ≤ var>y/var> < var>groupsub>y/sub>/var>+var>height/var>. Row groups correspond to code idtable-processing-model:the-tbody-element>a href#the-tbody-element>tbody/a>/code>, code idtable-processing-model:the-thead-element>a href#the-thead-element>thead/a>/code>, and code idtable-processing-model:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code> elements. Not every row is necessarily in a row group./p> p>A dfn idconcept-column-group>column group/dfn> is a set of a href#concept-column idtable-processing-model:concept-column>columns/a> anchored at a slot (var>groupsub>x/sub>/var>, 0) with a particular var>width/var> such that the column group covers all the slots with coordinates (var>x/var>, var>y/var>) where span>var>groupsub>x/sub>/var> ≤ var>x/var> < var>groupsub>x/sub>/var>+var>width/var>/span> and span>0 ≤ var>y/var> < var>ysub>height/sub>/var>/span>. Column groups correspond to code idtable-processing-model:the-colgroup-element>a href#the-colgroup-element>colgroup/a>/code> elements. Not every column is necessarily in a column group./p> p>a href#concept-row-group idtable-processing-model:concept-row-group-2>Row groups/a> cannot overlap each other. Similarly, a href#concept-column-group idtable-processing-model:concept-column-group>column groups/a> cannot overlap each other./p> p>A a href#concept-cell idtable-processing-model:concept-cell-2>cell/a> cannot cover slots that are from two or more a href#concept-row-group idtable-processing-model:concept-row-group-3>row groups/a>. It is, however, possible for a cell to be in multiple a href#concept-column-group idtable-processing-model:concept-column-group-2>column groups/a>. All the slots that form part of one cell are part of zero or one a href#concept-row-group idtable-processing-model:concept-row-group-4>row groups/a> and zero or more a href#concept-column-group idtable-processing-model:concept-column-group-3>column groups/a>./p> p>In addition to a href#concept-cell idtable-processing-model:concept-cell-3>cells/a>, a href#concept-column idtable-processing-model:concept-column-2>columns/a>, a href#concept-row idtable-processing-model:concept-row-3>rows/a>, a href#concept-row-group idtable-processing-model:concept-row-group-5>row groups/a>, and a href#concept-column-group idtable-processing-model:concept-column-group-4>column groups/a>, a href#concept-table idtable-processing-model:concept-table>tables/a> can have a code idtable-processing-model:the-caption-element>a href#the-caption-element>caption/a>/code> element associated with them. This gives the table a heading, or legend./p> p>A dfn idtable-model-error>table model error/dfn> is an error with the data represented by code idtable-processing-model:the-table-element-2>a href#the-table-element>table/a>/code> elements and their descendants. Documents must not have table model errors./p> h5 idforming-a-table>span classsecno>4.9.12.1/span> Forming a tablea href#forming-a-table classself-link>/a>/h5> p>To determine which elements correspond to which slots in a a href#concept-table idforming-a-table:concept-table>table/a> associated with a code idforming-a-table:the-table-element>a href#the-table-element>table/a>/code> element, to determine the dimensions of the table (var>xsub>width/sub>/var> and var>ysub>height/sub>/var>), and to determine if there are any a href#table-model-error idforming-a-table:table-model-error>table model errors/a>, user agents must use the following algorithm:/p> ol>li> p>Let var>xsub>width/sub>/var> be zero./p> li> p>Let var>ysub>height/sub>/var> be zero./p> li> p>Let var>pending code idforming-a-table:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code> elements/var> be a list of code idforming-a-table:the-tfoot-element-2>a href#the-tfoot-element>tfoot/a>/code> elements, initially empty./p> li> p>Let var>the table/var> be the a href#concept-table idforming-a-table:concept-table-2>table/a> represented by the code idforming-a-table:the-table-element-2>a href#the-table-element>table/a>/code> element. The var>xsub>width/sub>/var> and var>ysub>height/sub>/var> variables give var>the table/var>s dimensions. var>The table/var> is initially empty./p> li> p>If the code idforming-a-table:the-table-element-3>a href#the-table-element>table/a>/code> element has no children elements, then return var>the table/var> (which will be empty), and abort these steps./p> li> p>Associate the first code idforming-a-table:the-caption-element>a href#the-caption-element>caption/a>/code> element child of the code idforming-a-table:the-table-element-4>a href#the-table-element>table/a>/code> element with var>the table/var>. If there are no such children, then it has no associated code idforming-a-table:the-caption-element-2>a href#the-caption-element>caption/a>/code> element./p> li> p>Let the var>current element/var> be the first element child of the code idforming-a-table:the-table-element-5>a href#the-table-element>table/a>/code> element./p> p>If a step in this algorithm ever requires the var>current element/var> to be dfn idconcept-table-advance>advanced to the next child of the code>table/code>/dfn> when there is no such next child, then the user agent must jump to the step labeled i>end/i>, near the end of this algorithm./p> li> p>While the var>current element/var> is not one of the following elements, a href#concept-table-advance idforming-a-table:concept-table-advance>advance/a> the var>current element/var> to the next child of the code idforming-a-table:the-table-element-6>a href#the-table-element>table/a>/code>:/p> ul classbrief>li>code idforming-a-table:the-colgroup-element>a href#the-colgroup-element>colgroup/a>/code>li>code idforming-a-table:the-thead-element>a href#the-thead-element>thead/a>/code>li>code idforming-a-table:the-tbody-element>a href#the-tbody-element>tbody/a>/code>li>code idforming-a-table:the-tfoot-element-3>a href#the-tfoot-element>tfoot/a>/code>li>code idforming-a-table:the-tr-element>a href#the-tr-element>tr/a>/code>/ul> li> p>If the var>current element/var> is a code idforming-a-table:the-colgroup-element-2>a href#the-colgroup-element>colgroup/a>/code>, follow these substeps:/p> ol>li> p>i>Column groups/i>: Process the var>current element/var> according to the appropriate case below:/p> dl classswitch>dt>If the var>current element/var> has any code idforming-a-table:the-col-element>a href#the-col-element>col/a>/code> element childrendd> p>Follow these steps:/p> ol>li> p>Let var>xsub>start/sub>/var> have the value of span>var>xsub>width/sub>/var>/span>./p> li> p>Let the var>current column/var> be the first code idforming-a-table:the-col-element-2>a href#the-col-element>col/a>/code> element child of the code idforming-a-table:the-colgroup-element-3>a href#the-colgroup-element>colgroup/a>/code> element./p> li> p>i>Columns/i>: If the var>current column/var> code idforming-a-table:the-col-element-3>a href#the-col-element>col/a>/code> element has a code idforming-a-table:attr-col-span>a href#attr-col-span>span/a>/code> attribute, then parse its value using the a href#rules-for-parsing-non-negative-integers idforming-a-table:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers/a>./p> p>If the result of parsing the value is not an error or zero, then let var>span/var> be that value./p> p>Otherwise, if the code idforming-a-table:the-col-element-4>a href#the-col-element>col/a>/code> element has no code idforming-a-table:attr-col-span-2>a href#attr-col-span>span/a>/code> attribute, or if trying to parse the attributes value resulted in an error or zero, then let var>span/var> be 1./p> p>If var>span/var> is greater than 1000, let it be 1000 instead./p> li> p>Increase var>xsub>width/sub>/var> by var>span/var>./p> li> p>Let the last var>span/var> a href#concept-column idforming-a-table:concept-column>columns/a> in var>the table/var> correspond to the var>current column/var> code idforming-a-table:the-col-element-5>a href#the-col-element>col/a>/code> element./p> li> p>If var>current column/var> is not the last code idforming-a-table:the-col-element-6>a href#the-col-element>col/a>/code> element child of the code idforming-a-table:the-colgroup-element-4>a href#the-colgroup-element>colgroup/a>/code> element, then let the var>current column/var> be the next code idforming-a-table:the-col-element-7>a href#the-col-element>col/a>/code> element child of the code idforming-a-table:the-colgroup-element-5>a href#the-colgroup-element>colgroup/a>/code> element, and return to the step labeled i>columns/i>./p> li> p>Let all the last a href#concept-column idforming-a-table:concept-column-2>columns/a> in var>the table/var> from span>xvar>xsub>start/sub>/var>/span> to span>xvar>xsub>width/sub>/var>-1/span> form a new a href#concept-column-group idforming-a-table:concept-column-group>column group/a>, anchored at the slot (var>xsub>start/sub>/var>, 0), with width var>xsub>width/sub>/var>-var>xsub>start/sub>/var>, corresponding to the code idforming-a-table:the-colgroup-element-6>a href#the-colgroup-element>colgroup/a>/code> element./p> /ol> dt>If the var>current element/var> has no code idforming-a-table:the-col-element-8>a href#the-col-element>col/a>/code> element childrendd> ol>li> p>If the code idforming-a-table:the-colgroup-element-7>a href#the-colgroup-element>colgroup/a>/code> element has a code idforming-a-table:attr-colgroup-span>a href#attr-colgroup-span>span/a>/code> attribute, then parse its value using the a href#rules-for-parsing-non-negative-integers idforming-a-table:rules-for-parsing-non-negative-integers-2>rules for parsing non-negative integers/a>./p> p>If the result of parsing the value is not an error or zero, then let var>span/var> be that value./p> p>Otherwise, if the code idforming-a-table:the-colgroup-element-8>a href#the-colgroup-element>colgroup/a>/code> element has no code idforming-a-table:attr-colgroup-span-2>a href#attr-colgroup-span>span/a>/code> attribute, or if trying to parse the attributes value resulted in an error or zero, then let var>span/var> be 1./p> p>If var>span/var> is greater than 1000, let it be 1000 instead./p> li> p>Increase var>xsub>width/sub>/var> by var>span/var>./p> li> p>Let the last var>span/var> a href#concept-column idforming-a-table:concept-column-3>columns/a> in var>the table/var> form a new a href#concept-column-group idforming-a-table:concept-column-group-2>column group/a>, anchored at the slot (var>xsub>width/sub>/var>-var>span/var>, 0), with width var>span/var>, corresponding to the code idforming-a-table:the-colgroup-element-9>a href#the-colgroup-element>colgroup/a>/code> element./p> /ol> /dl> li> p>a href#concept-table-advance idforming-a-table:concept-table-advance-2>Advance/a> the var>current element/var> to the next child of the code idforming-a-table:the-table-element-7>a href#the-table-element>table/a>/code>./p> li> p>While the var>current element/var> is not one of the following elements, a href#concept-table-advance idforming-a-table:concept-table-advance-3>advance/a> the var>current element/var> to the next child of the code idforming-a-table:the-table-element-8>a href#the-table-element>table/a>/code>:/p> ul classbrief>li>code idforming-a-table:the-colgroup-element-10>a href#the-colgroup-element>colgroup/a>/code>li>code idforming-a-table:the-thead-element-2>a href#the-thead-element>thead/a>/code>li>code idforming-a-table:the-tbody-element-2>a href#the-tbody-element>tbody/a>/code>li>code idforming-a-table:the-tfoot-element-4>a href#the-tfoot-element>tfoot/a>/code>li>code idforming-a-table:the-tr-element-2>a href#the-tr-element>tr/a>/code>/ul> li> p>If the var>current element/var> is a code idforming-a-table:the-colgroup-element-11>a href#the-colgroup-element>colgroup/a>/code> element, jump to the step labeled i>column groups/i> above./p> /ol> li> p>Let var>ysub>current/sub>/var> be zero./p> li> p>Let the var>list of downward-growing cells/var> be an empty list./p> li> p>i>Rows/i>: While the var>current element/var> is not one of the following elements, a href#concept-table-advance idforming-a-table:concept-table-advance-4>advance/a> the var>current element/var> to the next child of the code idforming-a-table:the-table-element-9>a href#the-table-element>table/a>/code>:/p> ul classbrief>li>code idforming-a-table:the-thead-element-3>a href#the-thead-element>thead/a>/code>li>code idforming-a-table:the-tbody-element-3>a href#the-tbody-element>tbody/a>/code>li>code idforming-a-table:the-tfoot-element-5>a href#the-tfoot-element>tfoot/a>/code>li>code idforming-a-table:the-tr-element-3>a href#the-tr-element>tr/a>/code>/ul> li> p>If the var>current element/var> is a code idforming-a-table:the-tr-element-4>a href#the-tr-element>tr/a>/code>, then run the a href#algorithm-for-processing-rows idforming-a-table:algorithm-for-processing-rows>algorithm for processing rows/a>, a href#concept-table-advance idforming-a-table:concept-table-advance-5>advance/a> the var>current element/var> to the next child of the code idforming-a-table:the-table-element-10>a href#the-table-element>table/a>/code>, and return to the step labeled i>rows/i>./p> li> p>Run the a href#algorithm-for-ending-a-row-group idforming-a-table:algorithm-for-ending-a-row-group>algorithm for ending a row group/a>./p> li> p>If the var>current element/var> is a code idforming-a-table:the-tfoot-element-6>a href#the-tfoot-element>tfoot/a>/code>, then add that element to the list of var>pending code idforming-a-table:the-tfoot-element-7>a href#the-tfoot-element>tfoot/a>/code> elements/var>, a href#concept-table-advance idforming-a-table:concept-table-advance-6>advance/a> the var>current element/var> to the next child of the code idforming-a-table:the-table-element-11>a href#the-table-element>table/a>/code>, and return to the step labeled i>rows/i>./p> li> p>The var>current element/var> is either a code idforming-a-table:the-thead-element-4>a href#the-thead-element>thead/a>/code> or a code idforming-a-table:the-tbody-element-4>a href#the-tbody-element>tbody/a>/code>./p> p>Run the a href#algorithm-for-processing-row-groups idforming-a-table:algorithm-for-processing-row-groups>algorithm for processing row groups/a>./p> li> p>a href#concept-table-advance idforming-a-table:concept-table-advance-7>Advance/a> the var>current element/var> to the next child of the code idforming-a-table:the-table-element-12>a href#the-table-element>table/a>/code>./p> li> p>Return to the step labeled i>rows/i>./p> li> p>i>End/i>: For each code idforming-a-table:the-tfoot-element-8>a href#the-tfoot-element>tfoot/a>/code> element in the list of var>pending code idforming-a-table:the-tfoot-element-9>a href#the-tfoot-element>tfoot/a>/code> elements/var>, in a idforming-a-table:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>, run the a href#algorithm-for-processing-row-groups idforming-a-table:algorithm-for-processing-row-groups-2>algorithm for processing row groups/a>./p> li> p>If there exists a a href#concept-row idforming-a-table:concept-row>row/a> or a href#concept-column idforming-a-table:concept-column-4>column/a> in var>the table/var> containing only a href#concept-slots idforming-a-table:concept-slots>slots/a> that do not have a a href#concept-cell idforming-a-table:concept-cell>cell/a> anchored to them, then this is a a href#table-model-error idforming-a-table:table-model-error-2>table model error/a>./p> li> p>Return var>the table/var>./p> /ol> p>The dfn idalgorithm-for-processing-row-groups>algorithm for processing row groups/dfn>, which is invoked by the set of steps above for processing code idforming-a-table:the-thead-element-5>a href#the-thead-element>thead/a>/code>, code idforming-a-table:the-tbody-element-5>a href#the-tbody-element>tbody/a>/code>, and code idforming-a-table:the-tfoot-element-10>a href#the-tfoot-element>tfoot/a>/code> elements, is:/p> ol>li> p>Let var>ysub>start/sub>/var> have the value of var>ysub>height/sub>/var>./p> li> p>For each code idforming-a-table:the-tr-element-5>a href#the-tr-element>tr/a>/code> element that is a child of the element being processed, in tree order, run the a href#algorithm-for-processing-rows idforming-a-table:algorithm-for-processing-rows-2>algorithm for processing rows/a>./p> li> p>If var>ysub>height/sub>/var> > var>ysub>start/sub>/var>, then let all the last a href#concept-row idforming-a-table:concept-row-2>rows/a> in var>the table/var> from span>yvar>ysub>start/sub>/var>/span> to span>yvar>ysub>height/sub>/var>-1/span> form a new a href#concept-row-group idforming-a-table:concept-row-group>row group/a>, anchored at the slot with coordinate (0, var>ysub>start/sub>/var>), with height var>ysub>height/sub>/var>-var>ysub>start/sub>/var>, corresponding to the element being processed./p> li> p>Run the a href#algorithm-for-ending-a-row-group idforming-a-table:algorithm-for-ending-a-row-group-2>algorithm for ending a row group/a>./p> /ol> p>The dfn idalgorithm-for-ending-a-row-group>algorithm for ending a row group/dfn>, which is invoked by the set of steps above when starting and ending a block of rows, is:/p> ol>li> p>While var>ysub>current/sub>/var> is less than var>ysub>height/sub>/var>, follow these steps:/p> ol>li> p>Run the a href#algorithm-for-growing-downward-growing-cells idforming-a-table:algorithm-for-growing-downward-growing-cells>algorithm for growing downward-growing cells/a>./p> li> p>Increase var>ysub>current/sub>/var> by 1./p> /ol> li> p>Empty the var>list of downward-growing cells/var>./p> /ol> p>The dfn idalgorithm-for-processing-rows>algorithm for processing rows/dfn>, which is invoked by the set of steps above for processing code idforming-a-table:the-tr-element-6>a href#the-tr-element>tr/a>/code> elements, is:/p> ol>li> p>If var>ysub>height/sub>/var> is equal to var>ysub>current/sub>/var>, then increase var>ysub>height/sub>/var> by 1. (var>ysub>current/sub>/var> is never em>greater/em> than var>ysub>height/sub>/var>.)/p> li> p>Let var>xsub>current/sub>/var> be 0./p> li> p>Run the a href#algorithm-for-growing-downward-growing-cells idforming-a-table:algorithm-for-growing-downward-growing-cells-2>algorithm for growing downward-growing cells/a>./p> li> p>If the code idforming-a-table:the-tr-element-7>a href#the-tr-element>tr/a>/code> element being processed has no code idforming-a-table:the-td-element>a href#the-td-element>td/a>/code> or code idforming-a-table:the-th-element>a href#the-th-element>th/a>/code> element children, then increase var>ysub>current/sub>/var> by 1, abort this set of steps, and return to the algorithm above./p> li> p>Let var>current cell/var> be the first code idforming-a-table:the-td-element-2>a href#the-td-element>td/a>/code> or code idforming-a-table:the-th-element-2>a href#the-th-element>th/a>/code> element child in the code idforming-a-table:the-tr-element-8>a href#the-tr-element>tr/a>/code> element being processed./p> li> p>i>Cells/i>: While var>xsub>current/sub>/var> is less than var>xsub>width/sub>/var> and the slot with coordinate (var>xsub>current/sub>/var>, var>ysub>current/sub>/var>) already has a cell assigned to it, increase var>xsub>current/sub>/var> by 1./p> li> p>If var>xsub>current/sub>/var> is equal to var>xsub>width/sub>/var>, increase var>xsub>width/sub>/var> by 1. (var>xsub>current/sub>/var> is never em>greater/em> than var>xsub>width/sub>/var>.)/p> li> p>If the var>current cell/var> has a code idforming-a-table:attr-tdth-colspan>a href#attr-tdth-colspan>colspan/a>/code> attribute, then a href#rules-for-parsing-non-negative-integers idforming-a-table:rules-for-parsing-non-negative-integers-3>parse that attributes value/a>, and let var>colspan/var> be the result./p> p>If parsing that value failed, or returned zero, or if the attribute is absent, then let var>colspan/var> be 1, instead./p> p>If var>colspan/var> is greater than 1000, let it be 1000 instead./p> li> p>If the var>current cell/var> has a code idforming-a-table:attr-tdth-rowspan>a href#attr-tdth-rowspan>rowspan/a>/code> attribute, then a href#rules-for-parsing-non-negative-integers idforming-a-table:rules-for-parsing-non-negative-integers-4>parse that attributes value/a>, and let var>rowspan/var> be the result./p> p>If parsing that value failed or if the attribute is absent, then let var>rowspan/var> be 1, instead./p> p>If var>rowspan/var> is greater than 65534, let it be 65534 instead./p> li> p>If var>rowspan/var> is zero and the code idforming-a-table:the-table-element-13>a href#the-table-element>table/a>/code> elements a idforming-a-table:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is not set to a idforming-a-table:quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>, then let var>cell grows downward/var> be true, and set var>rowspan/var> to 1. Otherwise, let var>cell grows downward/var> be false./p> li> p>If var>xsub>width/sub>/var> < var>xsub>current/sub>/var>+var>colspan/var>, then let var>xsub>width/sub>/var> be var>xsub>current/sub>/var>+var>colspan/var>./p> li> p>If var>ysub>height/sub>/var> < var>ysub>current/sub>/var>+var>rowspan/var>, then let var>ysub>height/sub>/var> be var>ysub>current/sub>/var>+var>rowspan/var>./p> li> p>Let the slots with coordinates (var>x/var>, var>y/var>) such that span>var>xsub>current/sub>/var> ≤ var>x/var> < var>xsub>current/sub>/var>+var>colspan/var>/span> and var>ysub>current/sub>/var> ≤ var>y/var> < var>ysub>current/sub>/var>+var>rowspan/var> be covered by a new a href#concept-cell idforming-a-table:concept-cell-2>cell/a> var>c/var>, anchored at (var>xsub>current/sub>/var>, var>ysub>current/sub>/var>), which has width var>colspan/var> and height var>rowspan/var>, corresponding to the var>current cell/var> element./p> p>If the var>current cell/var> element is a code idforming-a-table:the-th-element-3>a href#the-th-element>th/a>/code> element, let this new cell var>c/var> be a header cell; otherwise, let it be a data cell./p> p>To establish which header cells apply to the var>current cell/var> element, use the a href#algorithm-for-assigning-header-cells idforming-a-table:algorithm-for-assigning-header-cells>algorithm for assigning header cells/a> described in the next section./p> p>If any of the slots involved already had a a href#concept-cell idforming-a-table:concept-cell-3>cell/a> covering them, then this is a a href#table-model-error idforming-a-table:table-model-error-3>table model error/a>. Those slots now have two cells overlapping./p> li> p>If var>cell grows downward/var> is true, then add the tuple {var>c/var>, var>xsub>current/sub>/var>, var>colspan/var>} to the var>list of downward-growing cells/var>./p> li> p>Increase var>xsub>current/sub>/var> by var>colspan/var>./p> li> p>If var>current cell/var> is the last code idforming-a-table:the-td-element-3>a href#the-td-element>td/a>/code> or code idforming-a-table:the-th-element-4>a href#the-th-element>th/a>/code> element child in the code idforming-a-table:the-tr-element-9>a href#the-tr-element>tr/a>/code> element being processed, then increase var>ysub>current/sub>/var> by 1, abort this set of steps, and return to the algorithm above./p> li> p>Let var>current cell/var> be the next code idforming-a-table:the-td-element-4>a href#the-td-element>td/a>/code> or code idforming-a-table:the-th-element-5>a href#the-th-element>th/a>/code> element child in the code idforming-a-table:the-tr-element-10>a href#the-tr-element>tr/a>/code> element being processed./p> li> p>Return to the step labeled i>cells/i>./p> /ol> p>When the algorithms above require the user agent to run the dfn idalgorithm-for-growing-downward-growing-cells>algorithm for growing downward-growing cells/dfn>, the user agent must, for each {var>cell/var>, var>cellsub>x/sub>/var>, var>width/var>} tuple in the var>list of downward-growing cells/var>, if any, extend the a href#concept-cell idforming-a-table:concept-cell-4>cell/a> var>cell/var> so that it also covers the slots with coordinates (var>x/var>, var>ysub>current/sub>/var>), where span>var>cellsub>x/sub>/var> ≤ var>x/var> < var>cellsub>x/sub>/var>+var>width/var>/span>./p> h5 idheader-and-data-cell-semantics>span classsecno>4.9.12.2/span> Forming relationships between data cells and header cellsa href#header-and-data-cell-semantics classself-link>/a>/h5> p>Each cell can be assigned zero or more header cells. The dfn idalgorithm-for-assigning-header-cells>algorithm for assigning header cells/dfn> to a cell var>principal cell/var> is as follows./p> ol>li> p>Let var>header list/var> be an empty list of cells./p> li> p>Let (var>principalsub>x/sub>/var>, var>principalsub>y/sub>/var>) be the coordinate of the slot to which the var>principal cell/var> is anchored./p> li> dl classswitch>dt>If the var>principal cell/var> has a code idheader-and-data-cell-semantics:attr-tdth-headers>a href#attr-tdth-headers>headers/a>/code> attribute specifieddd> ol>li> p>Take the value of the var>principal cell/var>s code idheader-and-data-cell-semantics:attr-tdth-headers-2>a href#attr-tdth-headers>headers/a>/code> attribute and a hrefhttps://infra.spec.whatwg.org/#split-on-ascii-whitespace idheader-and-data-cell-semantics:split-a-string-on-spaces data-x-internalsplit-a-string-on-spaces>split it on ASCII whitespace/a>, letting var>id list/var> be the list of tokens obtained./p> li> p>For each token in the var>id list/var>, if the first element in the code idheader-and-data-cell-semantics:document>a href#document>Document/a>/code> with an a hrefhttps://dom.spec.whatwg.org/#concept-id idheader-and-data-cell-semantics:concept-id data-x-internalconcept-id>ID/a> equal to the token is a cell in the same a href#concept-table idheader-and-data-cell-semantics:concept-table>table/a>, and that cell is not the var>principal cell/var>, then add that cell to var>header list/var>./p> /ol> dt>If var>principal cell/var> does not have a code idheader-and-data-cell-semantics:attr-tdth-headers-3>a href#attr-tdth-headers>headers/a>/code> attribute specifieddd> ol>li> p>Let var>principalsub>width/sub>/var> be the width of the var>principal cell/var>./p> li> p>Let var>principalsub>height/sub>/var> be the height of the var>principal cell/var>./p> li> p>For each value of var>y/var> from var>principalsub>y/sub>/var> to var>principalsub>y/sub>/var>+var>principalsub>height/sub>/var>-1, run the a href#internal-algorithm-for-scanning-and-assigning-header-cells idheader-and-data-cell-semantics:internal-algorithm-for-scanning-and-assigning-header-cells>internal algorithm for scanning and assigning header cells/a>, with the var>principal cell/var>, the var>header list/var>, the initial coordinate (var>principalsub>x/sub>/var>,var>y/var>), and the increments span>Δvar>x/var>−1/span> and span>Δvar>y/var>0/span>./p> li> p>For each value of var>x/var> from var>principalsub>x/sub>/var> to var>principalsub>x/sub>/var>+var>principalsub>width/sub>/var>-1, run the a href#internal-algorithm-for-scanning-and-assigning-header-cells idheader-and-data-cell-semantics:internal-algorithm-for-scanning-and-assigning-header-cells-2>internal algorithm for scanning and assigning header cells/a>, with the var>principal cell/var>, the var>header list/var>, the initial coordinate (var>x/var>,var>principalsub>y/sub>/var>), and the increments span>Δvar>x/var>0/span> and span>Δvar>y/var>−1/span>./p> li> p>If the var>principal cell/var> is anchored in a a href#concept-row-group idheader-and-data-cell-semantics:concept-row-group>row group/a>, then add all header cells that are a href#row-group-header idheader-and-data-cell-semantics:row-group-header>row group headers/a> and are anchored in the same row group with an var>x/var>-coordinate less than or equal to var>principalsub>x/sub>/var>+var>principalsub>width/sub>/var>-1 and a var>y/var>-coordinate less than or equal to var>principalsub>y/sub>/var>+var>principalsub>height/sub>/var>-1 to var>header list/var>./p> li> p>If the var>principal cell/var> is anchored in a a href#concept-column-group idheader-and-data-cell-semantics:concept-column-group>column group/a>, then add all header cells that are a href#column-group-header idheader-and-data-cell-semantics:column-group-header>column group headers/a> and are anchored in the same column group with an var>x/var>-coordinate less than or equal to var>principalsub>x/sub>/var>+var>principalsub>width/sub>/var>-1 and a var>y/var>-coordinate less than or equal to var>principalsub>y/sub>/var>+var>principalsub>height/sub>/var>-1 to var>header list/var>./p> /ol> /dl> li> p>Remove all the a href#empty-cell idheader-and-data-cell-semantics:empty-cell>empty cells/a> from the var>header list/var>./p> li> p>Remove any duplicates from the var>header list/var>./p> li> p>Remove var>principal cell/var> from the var>header list/var> if it is there./p> li> p>Assign the headers in the var>header list/var> to the var>principal cell/var>./p> /ol> p>The dfn idinternal-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>initialsub>x/sub>/var>, var>initialsub>y/sub>/var>), and Δvar>x/var> and Δvar>y/var> increments, is as follows:/p> ol>li> p>Let var>x/var> equal var>initialsub>x/sub>/var>./p> li> p>Let var>y/var> equal var>initialsub>y/sub>/var>./p> li> p>Let var>opaque headers/var> be an empty list of cells./p> li> dl classswitch>dt>If var>principal cell/var> is a header celldd>p>Let var>in header block/var> be true, and let var>headers from current header block/var> be a list of cells containing just the var>principal cell/var>.dt>Otherwisedd>p>Let var>in header block/var> be false and let var>headers from current header block/var> be an empty list of cells./p> /dl> li> p>i>Loop/i>: Increment var>x/var> by Δvar>x/var>; increment var>y/var> by Δvar>y/var>./p> p classnote>For each invocation of this algorithm, one of Δvar>x/var> and Δvar>y/var> will be −1, and the other will be 0./p> li> p>If either var>x/var> or var>y/var> are less than 0, then abort this internal algorithm./p> li> p>If there is no cell covering slot (var>x/var>, var>y/var>), or if there is more than one cell covering slot (var>x/var>, var>y/var>), return to the substep labeled i>loop/i>./p> li> p>Let var>current cell/var> be the cell covering slot (var>x/var>, var>y/var>)./p> li> dl classswitch>dt>If var>current cell/var> is a header celldd> ol>li>p>Set var>in header block/var> to true.li>p>Add var>current cell/var> to var>headers from current header block/var>.li>p>Let var>blocked/var> be false.li> dl classswitch>dt>If Δvar>x/var> is 0dd> p>If there are any cells in the var>opaque headers/var> list anchored with the same var>x/var>-coordinate as the var>current cell/var>, and with the same width as var>current cell/var>, then let var>blocked/var> be true./p> p>If the var>current cell/var> is not a a href#column-header idheader-and-data-cell-semantics:column-header>column header/a>, then let var>blocked/var> be true./p> dt>If Δvar>y/var> is 0dd> p>If there are any cells in the var>opaque headers/var> list anchored with the same var>y/var>-coordinate as the var>current cell/var>, and with the same height as var>current cell/var>, then let var>blocked/var> be true./p> p>If the var>current cell/var> is not a a href#row-header idheader-and-data-cell-semantics:row-header>row header/a>, then let var>blocked/var> be true./p> /dl> li>p>If var>blocked/var> is false, then add the var>current cell/var> to the var>headers list/var>./ol> dt>If var>current cell/var> is a data cell and var>in header block/var> is truedd>p>Set var>in header block/var> to false. Add all the cells in var>headers from current header block/var> to the var>opaque headers/var> list, and empty the var>headers from current header block/var> list./p> /dl> li> p>Return to the step labeled i>loop/i>./p> /ol> p>A header cell anchored at the slot with coordinate (var>x/var>, var>y/var>) with width var>width/var> and height var>height/var> is said to be a dfn idcolumn-header>column header/dfn> if any of the following conditions are true:/p> ul>li>The cells code idheader-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 idheader-and-data-cell-semantics:attr-th-scope-col>column/a> state, orli>The cells code idheader-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 idheader-and-data-cell-semantics:attr-th-scope-auto>auto/a> state, and there are no data cells in any of the cells covering slots with var>y/var>-coordinates var>y/var> .. span>var>y/var>+var>height/var>-1/span>./ul> p>A header cell anchored at the slot with coordinate (var>x/var>, var>y/var>) with width var>width/var> and height var>height/var> is said to be a dfn idrow-header>row header/dfn> if any of the following conditions are true:/p> ul>li>The cells code idheader-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 idheader-and-data-cell-semantics:attr-th-scope-row>row/a> state, orli>The cells code idheader-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 idheader-and-data-cell-semantics:attr-th-scope-auto-2>auto/a> state, the cell is not a a href#column-header idheader-and-data-cell-semantics:column-header-2>column header/a>, and there are no data cells in any of the cells covering slots with var>x/var>-coordinates var>x/var> .. var>x/var>+var>width/var>-1./ul> p>A header cell is said to be a dfn idcolumn-group-header>column group header/dfn> if its code idheader-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 idheader-and-data-cell-semantics:attr-th-scope-colgroup>column group/a> state./p> p>A header cell is said to be a dfn idrow-group-header>row group header/dfn> if its code idheader-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 idheader-and-data-cell-semantics:attr-th-scope-rowgroup>row group/a> state./p> p>A cell is said to be an dfn idempty-cell>empty cell/dfn> if it contains no elements and its text content, if any, consists only of a href#white_space idheader-and-data-cell-semantics:white_space>White_Space/a> characters./p> h4 idtable-examples>span classsecno>4.9.13/span> Examplesa href#table-examples classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>The following shows how might one mark up the bottom part of table 45 of the cite>Smithsonian physical tables, Volume 71/cite>:/p> pre><table> <caption>Specification values: <b>Steel</b>, <b>Castings</b>, Ann. A.S.T.M. A27-16, Class B;* P max. 0.06; S max. 0.05.</caption> <thead> <tr> <th rowspan2>Grade.</th> <th rowspan2>Yield Point.</th> <th colspan2>Ultimate tensile strength</th> <th rowspan2>Per cent elong. 50.8mm or 2 in.</th> <th rowspan2>Per cent reduct. area.</th> </tr> <tr> <th>kg/mm<sup>2</sup></th> <th>lb/in<sup>2</sup></th> </tr> </thead> <tbody> <tr> <td>Hard</td> <td>0.45 ultimate</td> <td>56.2</td> <td>80,000</td> <td>15</td> <td>20</td> </tr> <tr> <td>Medium</td> <td>0.45 ultimate</td> <td>49.2</td> <td>70,000</td> <td>18</td> <td>25</td> </tr> <tr> <td>Soft</td> <td>0.45 ultimate</td> <td>42.2</td> <td>60,000</td> <td>22</td> <td>30</td> </tr> </tbody></table>/pre> p>This table could look like this:/p> table idtable-example-1>caption>Specification values: b>Steel/b>, b>Castings/b>, Ann. A.S.T.M. A27-16, Class B;* P max. 0.06; S max. 0.05./caption>thead>tr>th rowspan2>Grade.th rowspan2>Yield Point.th colspan2>Ultimate tensile strengthth rowspan2>Per cent elong. 50.8 mm or 2 in.th rowspan2>Per cent reduct. area.tr>th>kg/mmsup>2/sup>th>lb/insup>2/sup>tbody>tr>td>Hardtd>0.45 ultimatetd>56.2td>80,000td>15td>20tr>td>Mediumtd>0.45 ultimatetd>49.2td>70,000td>18td>25tr>td>Softtd>0.45 ultimatetd>42.2td>60,000td>22td>30/table> hr> p>The following shows how one might mark up the gross margin table on page 46 of Apple, Incs 10-K filing for fiscal year 2008:/p> pre><table> <thead> <tr> <th> <th>2008 <th>2007 <th>2006 <tbody> <tr> <th>Net sales <td>$ 32,479 <td>$ 24,006 <td>$ 19,315 <tr> <th>Cost of sales <td> 21,334 <td> 15,852 <td> 13,717 <tbody> <tr> <th>Gross margin <td>$ 11,145 <td>$ 8,154 <td>$ 5,598 <tfoot> <tr> <th>Gross margin percentage <td>34.3% <td>34.0% <td>29.0%</table>/pre> p>This table could look like this:/p> table classapple-table-examples e1>thead>tr>th> th>2008 th>2007 th>2006 tbody>tr>th>Net sales td>$ 32,479 td>$ 24,006 td>$ 19,315 tr>th>Cost of sales td> 21,334 td> 15,852 td> 13,717 tbody>tr>th>Gross margin td>$ 11,145 td>$ 8,154 td>$ 5,598 tfoot>tr>th>Gross margin percentage td>34.3% td>34.0% td>29.0% /table> hr> p>The following shows how one might mark up the operating expenses table from lower on the same page of that document:/p> pre><table> <colgroup> <col> <colgroup> <col> <col> <col> <thead> <tr> <th> <th>2008 <th>2007 <th>2006 <tbody> <tr> <th scoperowgroup> Research and development <td> $ 1,109 <td> $ 782 <td> $ 712 <tr> <th scoperow> Percentage of net sales <td> 3.4% <td> 3.3% <td> 3.7% <tbody> <tr> <th scoperowgroup> Selling, general, and administrative <td> $ 3,761 <td> $ 2,963 <td> $ 2,433 <tr> <th scoperow> Percentage of net sales <td> 11.6% <td> 12.3% <td> 12.6%</table>/pre> p>This table could look like this:/p> table classapple-table-examples e2>thead>tr>th> th>2008 th>2007 th>2006 tbody>tr>th scoperowgroup> Research and development td> $ 1,109 td> $ 782 td> $ 712 tr>th scoperow> Percentage of net sales td> 3.4% td> 3.3% td> 3.7% tbody>tr>th scoperowgroup> Selling, general, and administrative td> $ 3,761 td> $ 2,963 td> $ 2,433 tr>th scoperow> Percentage of net sales td> 11.6% td> 12.3% td> 12.6% /table> h3 idforms>span classsecno>4.10/span> Formsa href#forms classself-link>/a>/h3>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id12271 titleforms: input list""> needs an event triggered on selection of suggestion>12271/a>p classsupport>strong>Support:/strong> formsspan classand_chr partial>span>Chrome for Android (limited)/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>61+/span>/span>span classios_saf partial>span>iOS Safari (limited)/span> span>4.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox partial>span>Firefox (limited)/span> span>4+/span>/span>span classie partial>span>IE (limited)/span> span>10+/span>/span>span classsamsung partial>span>Samsung Internet (limited)/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari partial>span>Safari (limited)/span> span>4+/span>/span>span classedge partial>span>Edge (limited)/span> span>12+/span>/span>span classandroid partial>span>Android Browser (limited)/span> span>4.4+/span>/span>span classopera partial>span>Opera (limited)/span> span>15+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featforms>caniuse.com/a>/div> h4 idintroduction-4>span classsecno>4.10.1/span> Introductiona href#introduction-4 classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>A form is a component of a Web page that has form controls, such as text, buttons, checkboxes, range, or color picker controls. A user can interact with such a form, providing data that can then be sent to the server for further processing (e.g. returning the results of a search or calculation). No client-side scripting is needed in many cases, though an API is available so that scripts can augment the user experience or use forms for purposes other than submitting data to a server./p> p>Writing a form consists of several steps, which can be performed in any order: writing the user interface, implementing the server-side processing, and configuring the user interface to communicate with the server./p> h5 idwriting-a-forms-user-interface>span classsecno>4.10.1.1/span> Writing a forms user interfacea href#writing-a-forms-user-interface classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>For the purposes of this brief introduction, we will create a pizza ordering form./p> p>Any form starts with a code idwriting-a-forms-user-interface:the-form-element>a href#the-form-element>form/a>/code> element, inside which are placed the controls. Most controls are represented by the code idwriting-a-forms-user-interface:the-input-element>a href#the-input-element>input/a>/code> element, which by default provides a text control. To label a control, the code idwriting-a-forms-user-interface:the-label-element>a href#the-label-element>label/a>/code> element is used; the label text and the control itself go inside the code idwriting-a-forms-user-interface:the-label-element-2>a href#the-label-element>label/a>/code> element. Each part of a form is considered a a href#paragraph idwriting-a-forms-user-interface:paragraph>paragraph/a>, and is typically separated from other parts using code idwriting-a-forms-user-interface:the-p-element>a href#the-p-element>p/a>/code> elements. Putting this together, here is how one might ask for the customers name:/p> pre>strong><form> <p><label>Customer name: <input></label></p></form>/strong>/pre> p>To let the user select the size of the pizza, we can use a set of radio buttons. Radio buttons also use the code idwriting-a-forms-user-interface:the-input-element-2>a href#the-input-element>input/a>/code> element, this time with a code idwriting-a-forms-user-interface:attr-input-type>a href#attr-input-type>type/a>/code> attribute with the value code idwriting-a-forms-user-interface:radio-button-state-(typeradio)>a href#radio-button-state-(typeradio)>radio/a>/code>. To make the radio buttons work as a group, they are given a common name using the code idwriting-a-forms-user-interface:attr-fe-name>a href#attr-fe-name>name/a>/code> attribute. To group a batch of controls together, such as, in this case, the radio buttons, one can use the code idwriting-a-forms-user-interface:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code> element. The title of such a group of controls is given by the first element in the code idwriting-a-forms-user-interface:the-fieldset-element-2>a href#the-fieldset-element>fieldset/a>/code>, which has to be a code idwriting-a-forms-user-interface:the-legend-element>a href#the-legend-element>legend/a>/code> element./p> pre><form> <p><label>Customer name: <input></label></p>strong> <fieldset> <legend> Pizza Size </legend> <p><label> <input typeradio namesize> Small </label></p> <p><label> <input typeradio namesize> Medium </label></p> <p><label> <input typeradio namesize> Large </label></p> </fieldset>/strong></form>/pre> p classnote>Changes from the previous step are highlighted./p> p>To pick toppings, we can use checkboxes. These use the code idwriting-a-forms-user-interface:the-input-element-3>a href#the-input-element>input/a>/code> element with a code idwriting-a-forms-user-interface:attr-input-type-2>a href#attr-input-type>type/a>/code> attribute with the value code idwriting-a-forms-user-interface:checkbox-state-(typecheckbox)>a href#checkbox-state-(typecheckbox)>checkbox/a>/code>:/p> pre><form> <p><label>Customer name: <input></label></p> <fieldset> <legend> Pizza Size </legend> <p><label> <input typeradio namesize> Small </label></p> <p><label> <input typeradio namesize> Medium </label></p> <p><label> <input typeradio namesize> Large </label></p> </fieldset>strong> <fieldset> <legend> Pizza Toppings </legend> <p><label> <input typecheckbox> Bacon </label></p> <p><label> <input typecheckbox> Extra Cheese </label></p> <p><label> <input typecheckbox> Onion </label></p> <p><label> <input typecheckbox> Mushroom </label></p> </fieldset>/strong></form>/pre> p>The pizzeria for which this form is being written is always making mistakes, so it needs a way to contact the customer. For this purpose, we can use form controls specifically for telephone numbers (code idwriting-a-forms-user-interface:the-input-element-4>a href#the-input-element>input/a>/code> elements with their code idwriting-a-forms-user-interface:attr-input-type-3>a href#attr-input-type>type/a>/code> attribute set to code idwriting-a-forms-user-interface:telephone-state-(typetel)>a href#telephone-state-(typetel)>tel/a>/code>) and e-mail addresses (code idwriting-a-forms-user-interface:the-input-element-5>a href#the-input-element>input/a>/code> elements with their code idwriting-a-forms-user-interface:attr-input-type-4>a href#attr-input-type>type/a>/code> attribute set to code idwriting-a-forms-user-interface:e-mail-state-(typeemail)>a href#e-mail-state-(typeemail)>email/a>/code>):/p> pre><form> <p><label>Customer name: <input></label></p>strong> <p><label>Telephone: <input typetel></label></p> <p><label>E-mail address: <input typeemail></label></p>/strong> <fieldset> <legend> Pizza Size </legend> <p><label> <input typeradio namesize> Small </label></p> <p><label> <input typeradio namesize> Medium </label></p> <p><label> <input typeradio namesize> Large </label></p> </fieldset> <fieldset> <legend> Pizza Toppings </legend> <p><label> <input typecheckbox> Bacon </label></p> <p><label> <input typecheckbox> Extra Cheese </label></p> <p><label> <input typecheckbox> Onion </label></p> <p><label> <input typecheckbox> Mushroom </label></p> </fieldset></form>/pre> p>We can use an code idwriting-a-forms-user-interface:the-input-element-6>a href#the-input-element>input/a>/code> element with its code idwriting-a-forms-user-interface:attr-input-type-5>a href#attr-input-type>type/a>/code> attribute set to code idwriting-a-forms-user-interface:time-state-(typetime)>a href#time-state-(typetime)>time/a>/code> to ask for a delivery time. Many of these form controls have attributes to control exactly what values can be specified; in this case, three attributes of particular interest are code idwriting-a-forms-user-interface:attr-input-min>a href#attr-input-min>min/a>/code>, code idwriting-a-forms-user-interface:attr-input-max>a href#attr-input-max>max/a>/code>, and code idwriting-a-forms-user-interface:attr-input-step>a href#attr-input-step>step/a>/code>. These set the minimum time, the maximum time, and the interval between allowed values (in seconds). This pizzeria only delivers between 11am and 9pm, and doesnt promise anything better than 15 minute increments, which we can mark up as follows:/p> pre><form> <p><label>Customer name: <input></label></p> <p><label>Telephone: <input typetel></label></p> <p><label>E-mail address: <input typeemail></label></p> <fieldset> <legend> Pizza Size </legend> <p><label> <input typeradio namesize> Small </label></p> <p><label> <input typeradio namesize> Medium </label></p> <p><label> <input typeradio namesize> Large </label></p> </fieldset> <fieldset> <legend> Pizza Toppings </legend> <p><label> <input typecheckbox> Bacon </label></p> <p><label> <input typecheckbox> Extra Cheese </label></p> <p><label> <input typecheckbox> Onion </label></p> <p><label> <input typecheckbox> Mushroom </label></p> </fieldset>strong> <p><label>Preferred delivery time: <input typetime min11:00 max21:00 step900></label></p>/strong></form>/pre> p>The code idwriting-a-forms-user-interface:the-textarea-element>a href#the-textarea-element>textarea/a>/code> element can be used to provide a multiline text control. In this instance, we are going to use it to provide a space for the customer to give delivery instructions:/p> pre><form> <p><label>Customer name: <input></label></p> <p><label>Telephone: <input typetel></label></p> <p><label>E-mail address: <input typeemail></label></p> <fieldset> <legend> Pizza Size </legend> <p><label> <input typeradio namesize> Small </label></p> <p><label> <input typeradio namesize> Medium </label></p> <p><label> <input typeradio namesize> Large </label></p> </fieldset> <fieldset> <legend> Pizza Toppings </legend> <p><label> <input typecheckbox> Bacon </label></p> <p><label> <input typecheckbox> Extra Cheese </label></p> <p><label> <input typecheckbox> Onion </label></p> <p><label> <input typecheckbox> Mushroom </label></p> </fieldset> <p><label>Preferred delivery time: <input typetime min11:00 max21:00 step900></label></p>strong> <p><label>Delivery instructions: <textarea></textarea></label></p>/strong></form>/pre> p>Finally, to make the form submittable we use the code idwriting-a-forms-user-interface:the-button-element>a href#the-button-element>button/a>/code> element:/p> pre><form> <p><label>Customer name: <input></label></p> <p><label>Telephone: <input typetel></label></p> <p><label>E-mail address: <input typeemail></label></p> <fieldset> <legend> Pizza Size </legend> <p><label> <input typeradio namesize> Small </label></p> <p><label> <input typeradio namesize> Medium </label></p> <p><label> <input typeradio namesize> Large </label></p> </fieldset> <fieldset> <legend> Pizza Toppings </legend> <p><label> <input typecheckbox> Bacon </label></p> <p><label> <input typecheckbox> Extra Cheese </label></p> <p><label> <input typecheckbox> Onion </label></p> <p><label> <input typecheckbox> Mushroom </label></p> </fieldset> <p><label>Preferred delivery time: <input typetime min11:00 max21:00 step900></label></p> <p><label>Delivery instructions: <textarea></textarea></label></p>strong> <p><button>Submit order</button></p>/strong></form>/pre> h5 idimplementing-the-server-side-processing-for-a-form>span classsecno>4.10.1.2/span> Implementing the server-side processing for a forma href#implementing-the-server-side-processing-for-a-form classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>The exact details for writing a server-side processor are out of scope for this specification. For the purposes of this introduction, we will assume that the script at code>https://pizza.example.com/order.cgi/code> is configured to accept submissions using the code idimplementing-the-server-side-processing-for-a-form:attr-fs-enctype-urlencoded>a href#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded/a>/code> format, expecting the following parameters sent in an HTTP POST body:/p> dl>dt>code>custname/code>dd>Customers namedt>code>custtel/code>dd>Customers telephone numberdt>code>custemail/code>dd>Customers e-mail addressdt>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 timedt>code>comments/code>dd>The delivery instructions/dl> h5 idconfiguring-a-form-to-communicate-with-a-server>span classsecno>4.10.1.3/span> Configuring a form to communicate with a servera href#configuring-a-form-to-communicate-with-a-server classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>Form submissions are exposed to servers in a variety of ways, most commonly as HTTP GET or POST requests. To specify the exact method used, the code idconfiguring-a-form-to-communicate-with-a-server:attr-fs-method>a href#attr-fs-method>method/a>/code> attribute is specified on the code idconfiguring-a-form-to-communicate-with-a-server:the-form-element>a href#the-form-element>form/a>/code> element. This doesnt specify how the form data is encoded, though; to specify that, you use the code idconfiguring-a-form-to-communicate-with-a-server:attr-fs-enctype>a href#attr-fs-enctype>enctype/a>/code> attribute. You also have to specify the a idconfiguring-a-form-to-communicate-with-a-server:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the service that will handle the submitted data, using the code idconfiguring-a-form-to-communicate-with-a-server:attr-fs-action>a href#attr-fs-action>action/a>/code> attribute./p> p>For each form control you want submitted, you then have to give a name that will be used to refer to the data in the submission. We already specified the name for the group of radio buttons; the same attribute (code idconfiguring-a-form-to-communicate-with-a-server:attr-fe-name>a href#attr-fe-name>name/a>/code>) also specifies the submission name. Radio buttons can be distinguished from each other in the submission by giving them different values, using the code idconfiguring-a-form-to-communicate-with-a-server:attr-input-value>a href#attr-input-value>value/a>/code> attribute./p> p>Multiple controls can have the same name; for example, here we give all the checkboxes the same name, and the server distinguishes which checkbox was checked by seeing which values are submitted with that name — like the radio buttons, they are also given unique values with the code idconfiguring-a-form-to-communicate-with-a-server:attr-input-value-2>a href#attr-input-value>value/a>/code> attribute./p> p>Given the settings in the previous section, this all becomes:/p> pre><formstrong> methodpost enctypeapplication/x-www-form-urlencoded actionhttps://pizza.example.com/order.cgi/strong>> <p><label>Customer name: <inputstrong> namecustname/strong>></label></p> <p><label>Telephone: <input typetelstrong> namecusttel/strong>></label></p> <p><label>E-mail address: <input typeemailstrong> namecustemail/strong>></label></p> <fieldset> <legend> Pizza Size </legend> <p><label> <input typeradio namesizestrong> valuesmall/strong>> Small </label></p> <p><label> <input typeradio namesizestrong> valuemedium/strong>> Medium </label></p> <p><label> <input typeradio namesizestrong> valuelarge/strong>> Large </label></p> </fieldset> <fieldset> <legend> Pizza Toppings </legend> <p><label> <input typecheckboxstrong> nametopping valuebacon/strong>> Bacon </label></p> <p><label> <input typecheckboxstrong> nametopping valuecheese/strong>> Extra Cheese </label></p> <p><label> <input typecheckboxstrong> nametopping valueonion/strong>> Onion </label></p> <p><label> <input typecheckboxstrong> nametopping valuemushroom/strong>> Mushroom </label></p> </fieldset> <p><label>Preferred delivery time: <input typetime min11:00 max21:00 step900strong> namedelivery/strong>></label></p> <p><label>Delivery instructions: <textareastrong> namecomments/strong>></textarea></label></p> <p><button>Submit order</button></p></form>/pre> p classnote>There is no particular significance to the way some of the attributes have their values quoted and others dont. The HTML syntax allows a variety of equally valid ways to specify attributes, as discussed a href#syntax-attributes idconfiguring-a-form-to-communicate-with-a-server:syntax-attributes>in the syntax section/a>./p> p>For example, if the customer entered Denise Lawrence as their name, 555-321-8642 as their telephone number, did not specify an e-mail address, asked for a medium-sized pizza, selected the Extra Cheese and Mushroom toppings, entered a delivery time of 7pm, and left the delivery instructions text control blank, the user agent would submit the following to the online Web service:/p> pre>custnameDenise+Lawrence&custtel555-321-8642&custemail&sizemedium&toppingcheese&toppingmushroom&delivery19%3A00&comments/pre> h5 idclient-side-form-validation>span classsecno>4.10.1.4/span> Client-side form validationa href#client-side-form-validation classself-link>/a>/h5>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> form-validationspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>10+/span>/span>span classios_saf yes>span>iOS Safari/span> span>10.3+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>4+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini partial>span>Opera Mini (limited)/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>10.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>4.4.3+/span>/span>span classopera yes>span>Opera/span> span>10.0+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featform-validation>caniuse.com/a>/div> p>i>This section is non-normative./i>/p> p>Forms can be annotated in such a way that the user agent will check the users input before the form is submitted. The server still has to verify the input is valid (since hostile users can easily bypass the form validation), but it allows the user to avoid the wait incurred by having the server be the sole checker of the users input./p> p>The simplest annotation is the code idclient-side-form-validation:attr-input-required>a href#attr-input-required>required/a>/code> attribute, which can be specified on code idclient-side-form-validation:the-input-element>a href#the-input-element>input/a>/code> elements to indicate that the form is not to be submitted until a value is given. By adding this attribute to the customer name, pizza size, and delivery time fields, we allow the user agent to notify the user when the user submits the form without filling in those fields:/p> pre><form methodpost enctypeapplication/x-www-form-urlencoded actionhttps://pizza.example.com/order.cgi> <p><label>Customer name: <input namecustnamestrong> required/strong>></label></p> <p><label>Telephone: <input typetel namecusttel></label></p> <p><label>E-mail address: <input typeemail namecustemail></label></p> <fieldset> <legend> Pizza Size </legend> <p><label> <input typeradio namesizestrong> required/strong> valuesmall> Small </label></p> <p><label> <input typeradio namesizestrong> required/strong> valuemedium> Medium </label></p> <p><label> <input typeradio namesizestrong> required/strong> valuelarge> Large </label></p> </fieldset> <fieldset> <legend> Pizza Toppings </legend> <p><label> <input typecheckbox nametopping valuebacon> Bacon </label></p> <p><label> <input typecheckbox nametopping valuecheese> Extra Cheese </label></p> <p><label> <input typecheckbox nametopping valueonion> Onion </label></p> <p><label> <input typecheckbox nametopping valuemushroom> Mushroom </label></p> </fieldset> <p><label>Preferred delivery time: <input typetime min11:00 max21:00 step900 namedeliverystrong> required/strong>></label></p> <p><label>Delivery instructions: <textarea namecomments></textarea></label></p> <p><button>Submit order</button></p></form>/pre> p>It is also possible to limit the length of the input, using the code idclient-side-form-validation:attr-fe-maxlength>a href#attr-fe-maxlength>maxlength/a>/code> attribute. By adding this to the code idclient-side-form-validation:the-textarea-element>a href#the-textarea-element>textarea/a>/code> element, we can limit users to 1000 characters, preventing them from writing huge essays to the busy delivery drivers instead of staying focused and to the point:/p> pre><form methodpost enctypeapplication/x-www-form-urlencoded actionhttps://pizza.example.com/order.cgi> <p><label>Customer name: <input namecustname required></label></p> <p><label>Telephone: <input typetel namecusttel></label></p> <p><label>E-mail address: <input typeemail namecustemail></label></p> <fieldset> <legend> Pizza Size </legend> <p><label> <input typeradio namesize required valuesmall> Small </label></p> <p><label> <input typeradio namesize required valuemedium> Medium </label></p> <p><label> <input typeradio namesize required valuelarge> Large </label></p> </fieldset> <fieldset> <legend> Pizza Toppings </legend> <p><label> <input typecheckbox nametopping valuebacon> Bacon </label></p> <p><label> <input typecheckbox nametopping valuecheese> Extra Cheese </label></p> <p><label> <input typecheckbox nametopping valueonion> Onion </label></p> <p><label> <input typecheckbox nametopping valuemushroom> Mushroom </label></p> </fieldset> <p><label>Preferred delivery time: <input typetime min11:00 max21:00 step900 namedelivery required></label></p> <p><label>Delivery instructions: <textarea namecommentsstrong> maxlength1000/strong>></textarea></label></p> <p><button>Submit order</button></p></form>/pre> p classnote>When a form is submitted, code idclient-side-form-validation:event-invalid>a href#event-invalid>invalid/a>/code> events are fired at each form control that is invalid, and then at the code idclient-side-form-validation:the-form-element>a href#the-form-element>form/a>/code> element itself. This can be useful for displaying a summary of the problems with the form, since typically the browser itself will only report one problem at a time./p> h5 idenabling-client-side-automatic-filling-of-form-controls>span classsecno>4.10.1.5/span> Enabling client-side automatic filling of form controlsa href#enabling-client-side-automatic-filling-of-form-controls classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>Some browsers attempt to aid the user by automatically filling form controls rather than having the user reenter their information each time. For example, a field asking for the users telephone number can be automatically filled with the users phone number./p> p>To help the user agent with this, the code idenabling-client-side-automatic-filling-of-form-controls:attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code> attribute can be used to describe the fields purpose. In the case of this form, we have three fields that can be usefully annotated in this way: the information about who the pizza is to be delivered to. Adding this information looks like this:/p> pre><form methodpost enctypeapplication/x-www-form-urlencoded actionhttps://pizza.example.com/order.cgi> <p><label>Customer name: <input namecustname required strong>autocompleteshipping name/strong>></label></p> <p><label>Telephone: <input typetel namecusttel strong>autocompleteshipping tel/strong>></label></p> <p><label>E-mail address: <input typeemail namecustemail strong>autocompleteshipping email/strong>></label></p> <fieldset> <legend> Pizza Size </legend> <p><label> <input typeradio namesize required valuesmall> Small </label></p> <p><label> <input typeradio namesize required valuemedium> Medium </label></p> <p><label> <input typeradio namesize required valuelarge> Large </label></p> </fieldset> <fieldset> <legend> Pizza Toppings </legend> <p><label> <input typecheckbox nametopping valuebacon> Bacon </label></p> <p><label> <input typecheckbox nametopping valuecheese> Extra Cheese </label></p> <p><label> <input typecheckbox nametopping valueonion> Onion </label></p> <p><label> <input typecheckbox nametopping valuemushroom> Mushroom </label></p> </fieldset> <p><label>Preferred delivery time: <input typetime min11:00 max21:00 step900 namedelivery required></label></p> <p><label>Delivery instructions: <textarea namecomments maxlength1000></textarea></label></p> <p><button>Submit order</button></p></form>/pre> h5 idimproving-the-user-experience-on-mobile-devices>span classsecno>4.10.1.6/span> Improving the user experience on mobile devicesa href#improving-the-user-experience-on-mobile-devices classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>Some devices, in particular those with on-screen keyboards and those in locales with languages with many characters (e.g. Japanese), can provide the user with multiple input modalities. For example, when typing in a credit card number the user may wish to only see keys for digits 0-9, while when typing in their name they may wish to see a form field that by default capitalises each word./p> p>Using the code idimproving-the-user-experience-on-mobile-devices:attr-fe-inputmode>a href#attr-fe-inputmode>inputmode/a>/code> attribute we can select appropriate input modalities:/p> pre><form methodpost enctypeapplication/x-www-form-urlencoded actionhttps://pizza.example.com/order.cgi> <p><label>Customer name: <input namecustname required autocompleteshipping name strong>inputmodelatin-name/strong>></label></p> <p><label>Telephone: <input typetel namecusttel autocompleteshipping tel></label></p> <p><label>E-mail address: <input typeemail namecustemail autocompleteshipping email></label></p> <fieldset> <legend> Pizza Size </legend> <p><label> <input typeradio namesize required valuesmall> Small </label></p> <p><label> <input typeradio namesize required valuemedium> Medium </label></p> <p><label> <input typeradio namesize required valuelarge> Large </label></p> </fieldset> <fieldset> <legend> Pizza Toppings </legend> <p><label> <input typecheckbox nametopping valuebacon> Bacon </label></p> <p><label> <input typecheckbox nametopping valuecheese> Extra Cheese </label></p> <p><label> <input typecheckbox nametopping valueonion> Onion </label></p> <p><label> <input typecheckbox nametopping valuemushroom> Mushroom </label></p> </fieldset> <p><label>Preferred delivery time: <input typetime min11:00 max21:00 step900 namedelivery required></label></p> <p><label>Delivery instructions: <textarea namecomments maxlength1000 strong>inputmodelatin-prose/strong>></textarea></label></p> <p><button>Submit order</button></p></form>/pre> h5 idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality>span classsecno>4.10.1.7/span> The difference between the field type, the autofill field name, and the input modalitya href#the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>The code idthe-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 idthe-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 idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-inputmode>a href#attr-fe-inputmode>inputmode/a>/code> attributes can seem confusingly similar. For instance, in all three cases, the string code>email/code> is a valid value. This section attempts to illustrate the difference between the three attributes and provides advice suggesting how to use them./p> p>The code idthe-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 idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:the-input-element>a href#the-input-element>input/a>/code> elements decides what kind of control the user agent will use to expose the field. Choosing between different values of this attribute is the same choice as choosing whether to use an code idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:the-input-element-2>a href#the-input-element>input/a>/code> element, a code idthe-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 idthe-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, etc./p> p>The code idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete-2>a href#attr-fe-autocomplete>autocomplete/a>/code> attribute, in contrast, describes what the value that the user will enter actually represents. Choosing between different values of this attribute is the same choice as choosing what the label for the element will be./p> p>First, consider telephone numbers. If a page is asking for a telephone number from the user, the right form control to use is code idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:telephone-state-(typetel)>a href#telephone-state-(typetel)><input typetel>/a>/code>. However, which code idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete-3>a href#attr-fe-autocomplete>autocomplete/a>/code> value to use depends on which phone number the page is asking for, whether they expect a telephone number in the international format or just the local format, and so forth./p> p>For example, a page that forms part of a checkout process on an e-commerce site for a customer buying a gift to be shipped to a friend might need both the buyers telephone number (in case of payment issues) and the friends telephone number (in case of delivery issues). If the site expects international phone numbers (with the country code prefix), this could thus look like this:/p> pre><p><label>Your phone number: <input typetel namecusttel autocompletebilling tel></label><p><label>Recipients phone number: <input typetel nameshiptel autocompleteshipping tel></label><p>Please enter complete phone numbers including the country code prefix, as in +1 555 123 4567./pre> p>But if the site only supports British customers and recipients, it might instead look like this (notice the use of code idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete-tel-national>a href#attr-fe-autocomplete-tel-national>tel-national/a>/code> rather than code idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete-tel>a href#attr-fe-autocomplete-tel>tel/a>/code>):/p> pre><p><label>Your phone number: <input typetel namecusttel autocompletebilling tel-national></label><p><label>Recipients phone number: <input typetel nameshiptel autocompleteshipping tel-national></label><p>Please enter complete UK phone numbers, as in (01632) 960 123./pre> p>Now, consider a persons preferred languages. The right code idthe-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 idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete-language>a href#attr-fe-autocomplete-language>language/a>/code>. However, there could be a number of different form controls used for the purpose: a text control (code idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:text-(typetext)-state-and-search-state-(typesearch)>a href#text-(typetext)-state-and-search-state-(typesearch)><input typetext>/a>/code>), a drop-down list (code idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:the-select-element-2>a href#the-select-element><select>/a>/code>), radio buttons (code idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:radio-button-state-(typeradio)>a href#radio-button-state-(typeradio)><input typeradio>/a>/code>), etc. It only depends on what kind of interface is desired./p> p>The code idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-inputmode-2>a href#attr-fe-inputmode>inputmode/a>/code> decides what kind of input modality (e.g. keyboard) to use, when the control is a text control./p> p>Consider names. If a page just wants one name from the user, then the relevant control is code idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:text-(typetext)-state-and-search-state-(typesearch)-2>a href#text-(typetext)-state-and-search-state-(typesearch)><input typetext>/a>/code>. If the page is asking for the users full name, then the relevant code idthe-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 idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete-name>a href#attr-fe-autocomplete-name>name/a>/code>. But if the user is Japanese, and the page is asking for the users Japanese name and the users romanized name, then it would be helpful to the user if the first field defaulted to a Japanese input modality, while the second defaulted to a Latin input modality (ideally with automatic capitalization of each word). This is where the code idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-inputmode-3>a href#attr-fe-inputmode>inputmode/a>/code> attribute can help:/p> pre><p><label>Japanese name: <input namej typetext autocompletesection-jp name inputmodekana></label><label>Romanized name: <input namee typetext autocompletesection-en name inputmodelatin-name></label>/pre> p>In this example, the code idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete-section>a href#attr-fe-autocomplete-section>section-*/a>/code> keywords in the code idthe-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete-6>a href#attr-fe-autocomplete>autocomplete/a>/code> attributes values tell the user agent that the two fields expect em>different/em> names. Without them, the user agent could automatically fill the second field with the value given in the first field when the user gave a value to the first field./p> p classnote>The code>-jp/code> and code>-en/code> parts of the keywords are opaque to the user agent; the user agent cannot guess, from those, that the two names are expected to be in Japanese and English respectively./p> h5 idinput-author-notes>span classsecno>4.10.1.8/span> Date, time, and number formatsa href#input-author-notes classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>In this pizza delivery example, the times are specified in the format HH:MM: two digits for the hour, in 24-hour format, and two digits for the time. (Seconds could also be specified, though they are not necessary in this example.)/p> p>In some locales, however, times are often expressed differently when presented to users. For example, in the United States, it is still common to use the 12-hour clock with an am/pm indicator, as in 2pm. In France, it is common to separate the hours from the minutes using an h character, as in 14h00./p> p>Similar issues exist with dates, with the added complication that even the order of the components is not always consistent — for example, in Cyprus the first of February 2003 would typically be written 1/2/03, while that same date in Japan would typically be written as 2003年02月01日 — and even with numbers, where locales differ, for example, in what punctuation is used as the decimal separator and the thousands separator./p> p>It is therefore important to distinguish the time, date, and number formats used in HTML and in form submissions, which are always the formats defined in this specification (and based on the well-established ISO 8601 standard for computer-readable date and time formats), from the time, date, and number formats presented to the user by the browser and accepted as input from the user by the browser./p> p>The format used on the wire, i.e. in HTML markup and in form submissions, is intended to be computer-readable and consistent irrespective of the users locale. Dates, for instance, are always written in the format YYYY-MM-DD, as in 2003-02-01. Users are not expected to ever see this format./p> p>The time, date, or number given by the page in the wire format is then translated to the users preferred presentation (based on user preferences or on the locale of the page itself), before being displayed to the user. Similarly, after the user inputs a time, date, or number using their preferred format, the user agent converts it back to the wire format before putting it in the DOM or submitting it./p> p>This allows scripts in pages and on servers to process times, dates, and numbers in a consistent manner without needing to support dozens of different formats, while still supporting the users needs./p> p classnote>See also the a href#input-impl-notes>implementation notes/a> regarding localization of form controls./p> h4 idcategories>span classsecno>4.10.2/span> Categoriesa href#categories classself-link>/a>/h4> p>Mostly for historical reasons, elements in this section fall into several overlapping (but subtly different) categories in addition to the usual ones like a href#flow-content-2 idcategories:flow-content-2>flow content/a>, a href#phrasing-content-2 idcategories:phrasing-content-2>phrasing content/a>, and a href#interactive-content-2 idcategories:interactive-content-2>interactive content/a>./p> p>A number of the elements are dfn idform-associated-element>form-associated elements/dfn>, which means they can have a a href#form-owner idcategories:form-owner>form owner/a>. ul classbrief category-list>li>code idcategories:the-button-element>a href#the-button-element>button/a>/code>li>code idcategories:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code>li>code idcategories:the-input-element>a href#the-input-element>input/a>/code>li>code idcategories:the-object-element>a href#the-object-element>object/a>/code>li>code idcategories:the-output-element>a href#the-output-element>output/a>/code>li>code idcategories:the-select-element>a href#the-select-element>select/a>/code>li>code idcategories:the-textarea-element>a href#the-textarea-element>textarea/a>/code>li>code idcategories:the-img-element>a href#the-img-element>img/a>/code>/ul> p>The a href#form-associated-element idcategories:form-associated-element>form-associated elements/a> fall into several subcategories:/p> dl>dt>dfn idcategory-listed>Listed elements/dfn>dd> p>Denotes elements that are listed in the code idcategories:dom-form-elements>a href#dom-form-elements>var>form/var>.elements/a>/code> and code idcategories:dom-fieldset-elements>a href#dom-fieldset-elements>var>fieldset/var>.elements/a>/code> APIs. These elements also have a code idcategories:attr-fae-form>a href#attr-fae-form>form/a>/code> content attribute, and a matching code idcategories:dom-fae-form>a href#dom-fae-form>form/a>/code> IDL attribute, that allow authors to specify an explicit a href#form-owner idcategories:form-owner-2>form owner/a>./p> ul classbrief category-list>li>code idcategories:the-button-element-2>a href#the-button-element>button/a>/code>li>code idcategories:the-fieldset-element-2>a href#the-fieldset-element>fieldset/a>/code>li>code idcategories:the-input-element-2>a href#the-input-element>input/a>/code>li>code idcategories:the-object-element-2>a href#the-object-element>object/a>/code>li>code idcategories:the-output-element-2>a href#the-output-element>output/a>/code>li>code idcategories:the-select-element-2>a href#the-select-element>select/a>/code>li>code idcategories:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code>/ul> dt>dfn idcategory-submit>Submittable elements/dfn>dd> p>Denotes elements that can be used for a href#constructing-form-data-set>constructing the form data set/a> when a code idcategories:the-form-element>a href#the-form-element>form/a>/code> element is a href#concept-form-submit idcategories:concept-form-submit>submitted/a>./p> ul classbrief category-list>li>code idcategories:the-button-element-3>a href#the-button-element>button/a>/code>li>code idcategories:the-input-element-3>a href#the-input-element>input/a>/code>li>code idcategories:the-object-element-3>a href#the-object-element>object/a>/code>li>code idcategories:the-select-element-3>a href#the-select-element>select/a>/code>li>code idcategories:the-textarea-element-3>a href#the-textarea-element>textarea/a>/code>/ul> p>Some a href#category-submit idcategories:category-submit>submittable elements/a> can be, depending on their attributes, dfn idconcept-button>buttons/dfn>. The prose below defines when an element is a button. Some buttons are specifically dfn idconcept-submit-button>submit buttons/dfn>./p> dt>dfn idcategory-reset>Resettable elements/dfn>dd> p>Denotes elements that can be affected when a code idcategories:the-form-element-2>a href#the-form-element>form/a>/code> element is a href#concept-form-reset idcategories:concept-form-reset>reset/a>./p> ul classbrief category-list>li>code idcategories:the-input-element-4>a href#the-input-element>input/a>/code>li>code idcategories:the-output-element-3>a href#the-output-element>output/a>/code>li>code idcategories:the-select-element-4>a href#the-select-element>select/a>/code>li>code idcategories:the-textarea-element-4>a href#the-textarea-element>textarea/a>/code>/ul> /dl> p>Some elements, not all of them a href#form-associated-element idcategories:form-associated-element-2>form-associated/a>, are categorized as dfn idcategory-label>labelable elements/dfn>. These are elements that can be associated with a code idcategories:the-label-element>a href#the-label-element>label/a>/code> element. ul classbrief category-list>li>code idcategories:the-button-element-4>a href#the-button-element>button/a>/code>li>code idcategories:the-input-element-5>a href#the-input-element>input/a>/code> (if the code idcategories:attr-input-type>a href#attr-input-type>type/a>/code> attribute is em>not/em> in the a href#hidden-state-(typehidden) idcategories:hidden-state-(typehidden)>Hidden/a> state)li>code idcategories:the-meter-element>a href#the-meter-element>meter/a>/code>li>code idcategories:the-output-element-4>a href#the-output-element>output/a>/code>li>code idcategories:the-progress-element>a href#the-progress-element>progress/a>/code>li>code idcategories:the-select-element-5>a href#the-select-element>select/a>/code>li>code idcategories:the-textarea-element-5>a href#the-textarea-element>textarea/a>/code>/ul> h4 idthe-form-element data-dfn-typeelement data-ltform>span classsecno>4.10.3/span> The dfn>code>form/code>/dfn> elementa href#the-form-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-form-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-form-element:flow-content-2>Flow content/a>.dd>a href#palpable-content-2 idthe-form-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-form-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-form-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-form-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-form-element:flow-content-2-3>Flow content/a>, but with no code idthe-form-element:the-form-element>a href#the-form-element>form/a>/code> element descendants.dt>a href#concept-element-tag-omission idthe-form-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-form-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-form-element:global-attributes>Global attributes/a>dd>code idthe-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 idthe-form-element:form-submission-2>form submission/a>dd>code idthe-form-element:attr-fs-action>a href#attr-fs-action>action/a>/code> — a idthe-form-element:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> to use for a href#form-submission-2 idthe-form-element:form-submission-2-2>form submission/a>dd>code idthe-form-element:attr-form-autocomplete>a href#attr-form-autocomplete>autocomplete/a>/code> — Default setting for autofill feature for controls in the formdd>code idthe-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 idthe-form-element:form-submission-2-3>form submission/a>dd>code idthe-form-element:attr-fs-method>a href#attr-fs-method>method/a>/code> — HTTP method to use for a href#form-submission-2 idthe-form-element:form-submission-2-4>form submission/a>dd>code idthe-form-element:attr-form-name>a href#attr-form-name>name/a>/code> — Name of form to use in the code idthe-form-element:dom-document-forms>a href#dom-document-forms>document.forms/a>/code> APIdd>code idthe-form-element:attr-fs-novalidate>a href#attr-fs-novalidate>novalidate/a>/code> — Bypass form control validation for a href#form-submission-2 idthe-form-element:form-submission-2-5>form submission/a>dd>code idthe-form-element:attr-fs-target>a href#attr-fs-target>target/a>/code> — a href#browsing-context idthe-form-element:browsing-context>Browsing context/a> for a href#form-submission-2 idthe-form-element:form-submission-2-6>form submission/a>dt>a href#concept-element-dom idthe-form-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, OverrideBuiltins, LegacyUnenumerableNamedProperties, a href#htmlconstructor idthe-form-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlformelement>HTMLFormElement/dfn> : a href#htmlelement idthe-form-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-form-element:cereactions>CEReactions/a> attribute DOMString a href#dom-form-acceptcharset idthe-form-element:dom-form-acceptcharset>acceptCharset/a>; a href#cereactions idthe-form-element:cereactions-2>CEReactions/a> attribute USVString a href#dom-fs-action idthe-form-element:dom-fs-action>action/a>; a href#cereactions idthe-form-element:cereactions-3>CEReactions/a> attribute DOMString a href#dom-form-autocomplete idthe-form-element:dom-form-autocomplete>autocomplete/a>; a href#cereactions idthe-form-element:cereactions-4>CEReactions/a> attribute DOMString a href#dom-fs-enctype idthe-form-element:dom-fs-enctype>enctype/a>; a href#cereactions idthe-form-element:cereactions-5>CEReactions/a> attribute DOMString a href#dom-fs-encoding idthe-form-element:dom-fs-encoding>encoding/a>; a href#cereactions idthe-form-element:cereactions-6>CEReactions/a> attribute DOMString a href#dom-fs-method idthe-form-element:dom-fs-method>method/a>; a href#cereactions idthe-form-element:cereactions-7>CEReactions/a> attribute DOMString a href#dom-form-name idthe-form-element:dom-form-name>name/a>; a href#cereactions idthe-form-element:cereactions-8>CEReactions/a> attribute boolean a href#dom-fs-novalidate idthe-form-element:dom-fs-novalidate>noValidate/a>; a href#cereactions idthe-form-element:cereactions-9>CEReactions/a> attribute DOMString a href#dom-fs-target idthe-form-element:dom-fs-target>target/a>; SameObject readonly attribute a href#htmlformcontrolscollection idthe-form-element:htmlformcontrolscollection>HTMLFormControlsCollection/a> a href#dom-form-elements idthe-form-element:dom-form-elements>elements/a>; readonly attribute unsigned long a href#dom-form-length idthe-form-element:dom-form-length>length/a>; a href#dom-form-item>getter/a> a idthe-form-element:element hrefhttps://dom.spec.whatwg.org/#interface-element data-x-internalelement>Element/a> (unsigned long index); a href#dom-form-nameditem>getter/a> (a href#radionodelist idthe-form-element:radionodelist>RadioNodeList/a> or a idthe-form-element:element-2 hrefhttps://dom.spec.whatwg.org/#interface-element data-x-internalelement>Element/a>) (DOMString name); void a href#dom-form-submit idthe-form-element:dom-form-submit>submit/a>(); a href#cereactions idthe-form-element:cereactions-10>CEReactions/a> void a href#dom-form-reset idthe-form-element:dom-form-reset>reset/a>(); boolean a href#dom-form-checkvalidity idthe-form-element:dom-form-checkvalidity>checkValidity/a>(); boolean a href#dom-form-reportvalidity idthe-form-element:dom-form-reportvalidity>reportValidity/a>();};/pre> /dl> p>The code idthe-form-element:the-form-element-2>a href#the-form-element>form/a>/code> element a href#represents idthe-form-element:represents>represents/a> a collection of a href#form-associated-element idthe-form-element:form-associated-element>form-associated elements/a>, some of which can represent editable values that can be submitted to a server for processing./p> p>The dfn idattr-form-accept-charset>code>accept-charset/code>/dfn> attribute gives the character encodings that are to be used for the submission. If specified, the value must be an a href#ordered-set-of-unique-space-separated-tokens idthe-form-element:ordered-set-of-unique-space-separated-tokens>ordered set of unique space-separated tokens/a> that are a idthe-form-element:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a>, and each token must be an a idthe-form-element:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for one of the a hrefhttps://encoding.spec.whatwg.org/#label idthe-form-element:encoding-label data-x-internalencoding-label>labels/a> of an a href#ascii-compatible-encoding idthe-form-element:ascii-compatible-encoding>ASCII-compatible encoding/a>. a href#refsENCODING>ENCODING/a>/p> p>The dfn idattr-form-name>code>name/code>/dfn> attribute represents the code idthe-form-element:the-form-element-3>a href#the-form-element>form/a>/code>s name within the code idthe-form-element:dom-document-forms-2>a href#dom-document-forms>forms/a>/code> collection. The value must not be the empty string, and the value must be unique amongst the code idthe-form-element:the-form-element-4>a href#the-form-element>form/a>/code> elements in the code idthe-form-element:dom-document-forms-3>a href#dom-document-forms>forms/a>/code> collection that it is in, if any./p> p>The dfn idattr-form-autocomplete>code>autocomplete/code>/dfn> attribute is an a href#enumerated-attribute idthe-form-element:enumerated-attribute>enumerated attribute/a>. The attribute has two states. The dfn idattr-form-autocomplete-on>code>on/code>/dfn> keyword maps to the dfn idattr-form-autocomplete-on-state>on/dfn> state, and the dfn idattr-form-autocomplete-off>code>off/code>/dfn> keyword maps to the dfn idattr-form-autocomplete-off-state>off/dfn> state. The attribute may also be omitted. The i idthe-form-element:missing-value-default>a href#missing-value-default>missing value default/a>/i> is the a href#attr-form-autocomplete-on-state idthe-form-element:attr-form-autocomplete-on-state>on/a> state. The a href#attr-form-autocomplete-off-state idthe-form-element:attr-form-autocomplete-off-state>off/a> state indicates that by default, form controls in the form will have their a href#autofill-field-name idthe-form-element:autofill-field-name>autofill field name/a> set to code idthe-form-element:attr-fe-autocomplete-off>a href#attr-fe-autocomplete-off>off/a>/code>; the a href#attr-form-autocomplete-on-state idthe-form-element:attr-form-autocomplete-on-state-2>on/a> state indicates that by default, form controls in the form will have their a href#autofill-field-name idthe-form-element:autofill-field-name-2>autofill field name/a> set to code idthe-form-element:attr-fe-autocomplete-on>a href#attr-fe-autocomplete-on>on/a>/code>./p> p>The code idthe-form-element:attr-fs-action-2>a href#attr-fs-action>action/a>/code>, code idthe-form-element:attr-fs-enctype-2>a href#attr-fs-enctype>enctype/a>/code>, code idthe-form-element:attr-fs-method-2>a href#attr-fs-method>method/a>/code>, code idthe-form-element:attr-fs-novalidate-2>a href#attr-fs-novalidate>novalidate/a>/code>, and code idthe-form-element:attr-fs-target-2>a href#attr-fs-target>target/a>/code> attributes are a href#attributes-for-form-submission idthe-form-element:attributes-for-form-submission>attributes for form submission/a>./p> dl classdomintro>dt>var>form/var> . code idthe-form-element:dom-form-elements-2>a href#dom-form-elements>elements/a>/code>dd> p>Returns an code idthe-form-element:htmlformcontrolscollection-2>a href#htmlformcontrolscollection>HTMLFormControlsCollection/a>/code> of the form controls in the form (excluding image buttons for historical reasons)./p> dt>var>form/var> . code idthe-form-element:dom-form-length-2>a href#dom-form-length>length/a>/code>dd> p>Returns the number of form controls in the form (excluding image buttons for historical reasons)./p> dt>var>form/var>var>index/var>dd> p>Returns the var>index/var>th element in the form (excluding image buttons for historical reasons)./p> dt>var>form/var>var>name/var>dd> p>Returns the form control (or, if there are several, a code idthe-form-element:radionodelist-2>a href#radionodelist>RadioNodeList/a>/code> of the form controls) in the form with the given a hrefhttps://dom.spec.whatwg.org/#concept-id idthe-form-element:concept-id data-x-internalconcept-id>ID/a> or code idthe-form-element:attr-fe-name>a href#attr-fe-name>name/a>/code> (excluding image buttons for historical reasons); or, if there are none, returns the code idthe-form-element:the-img-element>a href#the-img-element>img/a>/code> element with the given ID./p> p>Once an element has been referenced using a particular name, that name will continue being available as a way to reference that element in this method, even if the elements actual a hrefhttps://dom.spec.whatwg.org/#concept-id idthe-form-element:concept-id-2 data-x-internalconcept-id>ID/a> or code idthe-form-element:attr-fe-name-2>a href#attr-fe-name>name/a>/code> changes, for as long as the element remains in the a idthe-form-element:tree hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a>./p> p>If there are multiple matching items, then a code idthe-form-element:radionodelist-3>a href#radionodelist>RadioNodeList/a>/code> object containing all those elements is returned./p> dt>var>form/var> . code idthe-form-element:dom-form-submit-2>a href#dom-form-submit>submit/a>/code>()dd> p>Submits the form./p> dt>var>form/var> . code idthe-form-element:dom-form-reset-2>a href#dom-form-reset>reset/a>/code>()dd> p>Resets the form./p> dt>var>form/var> . code idthe-form-element:dom-form-checkvalidity-2>a href#dom-form-checkvalidity>checkValidity/a>/code>()dd> p>Returns true if the forms controls are all valid; otherwise, returns false./p> dt>var>form/var> . code idthe-form-element:dom-form-reportvalidity-2>a href#dom-form-reportvalidity>reportValidity/a>/code>()dd> p>Returns true if the forms controls are all valid; otherwise, returns false and informs the user./p> /dl> p>The dfn iddom-form-autocomplete>code>autocomplete/code>/dfn> IDL attribute must a href#reflect idthe-form-element:reflect>reflect/a> the content attribute of the same name, a href#limited-to-only-known-values idthe-form-element:limited-to-only-known-values>limited to only known values/a>./p> p>The dfn iddom-form-name>code>name/code>/dfn> IDL attribute must a href#reflect idthe-form-element:reflect-2>reflect/a> the content attribute of the same name./p> p>The dfn iddom-form-acceptcharset>code>acceptCharset/code>/dfn> IDL attribute must a href#reflect idthe-form-element:reflect-3>reflect/a> the code idthe-form-element:attr-form-accept-charset-2>a href#attr-form-accept-charset>accept-charset/a>/code> content attribute./p> hr> p>The dfn iddom-form-elements>code>elements/code>/dfn> IDL attribute must return an code idthe-form-element:htmlformcontrolscollection-3>a href#htmlformcontrolscollection>HTMLFormControlsCollection/a>/code> rooted at the code idthe-form-element:the-form-element-5>a href#the-form-element>form/a>/code> elements a idthe-form-element:root hrefhttps://dom.spec.whatwg.org/#concept-tree-root data-x-internalroot>root/a>, whose filter matches a href#category-listed idthe-form-element:category-listed>listed elements/a> whose a href#form-owner idthe-form-element:form-owner>form owner/a> is the code idthe-form-element:the-form-element-6>a href#the-form-element>form/a>/code> element, with the exception of code idthe-form-element:the-input-element>a href#the-input-element>input/a>/code> elements whose code idthe-form-element:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#image-button-state-(typeimage) idthe-form-element:image-button-state-(typeimage)>Image Button/a> state, which must, for historical reasons, be excluded from this particular collection./p> p>The dfn iddom-form-length>code>length/code>/dfn> IDL attribute must return the number of nodes a hrefhttps://dom.spec.whatwg.org/#represented-by-the-collection idthe-form-element:represented-by-the-collection data-x-internalrepresented-by-the-collection>represented/a> by the code idthe-form-element:dom-form-elements-3>a href#dom-form-elements>elements/a>/code> collection./p> p>The a idthe-form-element:supported-property-indices hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a> at any instant are the indices supported by the object returned by the code idthe-form-element:dom-form-elements-4>a href#dom-form-elements>elements/a>/code> attribute at that instant./p> p iddom-form-item>To a idthe-form-element:determine-the-value-of-an-indexed-property hrefhttps://heycam.github.io/webidl/#dfn-determine-the-value-of-an-indexed-property data-x-internaldetermine-the-value-of-an-indexed-property>determine the value of an indexed property/a> for a code idthe-form-element:the-form-element-7>a href#the-form-element>form/a>/code> element, the user agent must return the value returned by the code idthe-form-element:dom-htmlcollection-item>a data-x-internaldom-htmlcollection-item hrefhttps://dom.spec.whatwg.org/#dom-htmlcollection-item>item/a>/code> method on the code idthe-form-element:dom-form-elements-5>a href#dom-form-elements>elements/a>/code> collection, when invoked with the given index as its argument./p> hr> p>Each code idthe-form-element:the-form-element-8>a href#the-form-element>form/a>/code> element has a mapping of names to elements called the dfn idpast-names-map>past names map/dfn>. It is used to persist names of controls even when they change names./p> p>The a idthe-form-element:supported-property-names hrefhttps://heycam.github.io/webidl/#dfn-supported-property-names data-x-internalsupported-property-names>supported property names/a> consist of the names obtained from the following algorithm, in the order obtained from this algorithm:/p> ol>li>p>Let var>sourced names/var> be an initially empty ordered list of tuples consisting of a string, an element, a source, where the source is either i>id/i>, i>name/i>, or i>past/i>, and, if the source is i>past/i>, an age.li> p>For each a href#category-listed idthe-form-element:category-listed-2>listed element/a> var>candidate/var> whose a href#form-owner idthe-form-element:form-owner-2>form owner/a> is the code idthe-form-element:the-form-element-9>a href#the-form-element>form/a>/code> element, with the exception of any code idthe-form-element:the-input-element-2>a href#the-input-element>input/a>/code> elements whose code idthe-form-element:attr-input-type-2>a href#attr-input-type>type/a>/code> attribute is in the a href#image-button-state-(typeimage) idthe-form-element:image-button-state-(typeimage)-2>Image Button/a> state:/p> ol>li>p>If var>candidate/var> has an code idthe-form-element:the-id-attribute>a href#the-id-attribute>id/a>/code> attribute, add an entry to var>sourced names/var> with that code idthe-form-element:the-id-attribute-2>a href#the-id-attribute>id/a>/code> attributes value as the string, var>candidate/var> as the element, and i>id/i> as the source.li>p>If var>candidate/var> has a code idthe-form-element:attr-fe-name-3>a href#attr-fe-name>name/a>/code> attribute, add an entry to var>sourced names/var> with that code idthe-form-element:attr-fe-name-4>a href#attr-fe-name>name/a>/code> attributes value as the string, var>candidate/var> as the element, and i>name/i> as the source./ol> li> p>For each code idthe-form-element:the-img-element-2>a href#the-img-element>img/a>/code> element var>candidate/var> whose a href#form-owner idthe-form-element:form-owner-3>form owner/a> is the code idthe-form-element:the-form-element-10>a href#the-form-element>form/a>/code> element:/p> ol>li>p>If var>candidate/var> has an code idthe-form-element:the-id-attribute-3>a href#the-id-attribute>id/a>/code> attribute, add an entry to var>sourced names/var> with that code idthe-form-element:the-id-attribute-4>a href#the-id-attribute>id/a>/code> attributes value as the string, var>candidate/var> as the element, and i>id/i> as the source.li>p>If var>candidate/var> has a code idthe-form-element:attr-img-name>a href#attr-img-name>name/a>/code> attribute, add an entry to var>sourced names/var> with that code idthe-form-element:attr-img-name-2>a href#attr-img-name>name/a>/code> attributes value as the string, var>candidate/var> as the element, and i>name/i> as the source./ol> li> p>For each entry var>past entry/var> in the a href#past-names-map idthe-form-element:past-names-map>past names map/a> add an entry to var>sourced names/var> with the var>past entry/var>s name as the string, var>past entry/var>s element as the element, i>past/i> as the source, and the length of time var>past entry/var> has been in the a href#past-names-map idthe-form-element:past-names-map-2>past names map/a> as the age./p> li>p>Sort var>sourced names/var> by a idthe-form-element:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> of the element entry of each tuple, sorting entries with the same element by putting entries whose source is i>id/i> first, then entries whose source is i>name/i>, and finally entries whose source is i>past/i>, and sorting entries with the same element and source by their age, oldest first.li>p>Remove any entries in var>sourced names/var> that have the empty string as their name.li>p>Remove any entries in var>sourced names/var> that have the same name as an earlier entry in the map.li>p>Return the list of names from var>sourced names/var>, maintaining their relative order./ol> p iddom-form-nameditem>To a idthe-form-element:determine-the-value-of-a-named-property hrefhttps://heycam.github.io/webidl/#dfn-determine-the-value-of-a-named-property data-x-internaldetermine-the-value-of-a-named-property>determine the value of a named property/a> var>name/var> for a code idthe-form-element:the-form-element-11>a href#the-form-element>form/a>/code> element, the user agent must run the following steps:/p> ol>li>p>Let var>candidates/var> be a a href#live idthe-form-element:live>live/a> code idthe-form-element:radionodelist-4>a href#radionodelist>RadioNodeList/a>/code> object containing all the a href#category-listed idthe-form-element:category-listed-3>listed elements/a>, whose a href#form-owner idthe-form-element:form-owner-4>form owner/a> is the code idthe-form-element:the-form-element-12>a href#the-form-element>form/a>/code> element, that have either an code idthe-form-element:the-id-attribute-5>a href#the-id-attribute>id/a>/code> attribute or a code idthe-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 idthe-form-element:the-input-element-3>a href#the-input-element>input/a>/code> elements whose code idthe-form-element:attr-input-type-3>a href#attr-input-type>type/a>/code> attribute is in the a href#image-button-state-(typeimage) idthe-form-element:image-button-state-(typeimage)-3>Image Button/a> state, in a idthe-form-element:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>.li>p>If var>candidates/var> is empty, let var>candidates/var> be a a href#live idthe-form-element:live-2>live/a> code idthe-form-element:radionodelist-5>a href#radionodelist>RadioNodeList/a>/code> object containing all the code idthe-form-element:the-img-element-3>a href#the-img-element>img/a>/code> elements, whose a href#form-owner idthe-form-element:form-owner-5>form owner/a> is the code idthe-form-element:the-form-element-13>a href#the-form-element>form/a>/code> element, that have either an code idthe-form-element:the-id-attribute-6>a href#the-id-attribute>id/a>/code> attribute or a code idthe-form-element:attr-img-name-3>a href#attr-img-name>name/a>/code> attribute equal to var>name/var>, in a idthe-form-element:tree-order-3 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>.li>p>If var>candidates/var> is empty, var>name/var> is the name of one of the entries in the code idthe-form-element:the-form-element-14>a href#the-form-element>form/a>/code> elements a href#past-names-map idthe-form-element:past-names-map-3>past names map/a>: return the object associated with var>name/var> in that map.li>p>If var>candidates/var> contains more than one node, return var>candidates/var> and abort these steps.li>p>Otherwise, var>candidates/var> contains exactly one node. Add a mapping from var>name/var> to the node in var>candidates/var> in the code idthe-form-element:the-form-element-15>a href#the-form-element>form/a>/code> elements a href#past-names-map idthe-form-element:past-names-map-4>past names map/a>, replacing the previous entry with the same name, if any.li>p>Return the node in var>candidates/var>./ol> p>If an element listed in a code idthe-form-element:the-form-element-16>a href#the-form-element>form/a>/code> elements a href#past-names-map idthe-form-element:past-names-map-5>past names map/a> changes a href#form-owner idthe-form-element:form-owner-6>form owner/a>, then its entries must be removed from that map./p> hr> p>The dfn iddom-form-submit>code>submit()/code>/dfn> method, when invoked, must a href#concept-form-submit idthe-form-element:concept-form-submit>submit/a> the code idthe-form-element:the-form-element-17>a href#the-form-element>form/a>/code> element from the code idthe-form-element:the-form-element-18>a href#the-form-element>form/a>/code> element itself, with the var>submitted from code idthe-form-element:dom-form-submit-3>a href#dom-form-submit>submit()/a>/code> method/var> flag set./p> p>The dfn iddom-form-reset>code>reset()/code>/dfn> method, when invoked, must run the following steps:/p> ol>li>p>If the code idthe-form-element:the-form-element-19>a href#the-form-element>form/a>/code> element is marked as i idthe-form-element:locked-for-reset>a href#locked-for-reset>locked for reset/a>/i>, then abort these steps.li>p>Mark the code idthe-form-element:the-form-element-20>a href#the-form-element>form/a>/code> element as dfn idlocked-for-reset>locked for reset/dfn>.li>p>a href#concept-form-reset idthe-form-element:concept-form-reset>Reset/a> the code idthe-form-element:the-form-element-21>a href#the-form-element>form/a>/code> element.li>p>Unmark the code idthe-form-element:the-form-element-22>a href#the-form-element>form/a>/code> element as i idthe-form-element:locked-for-reset-2>a href#locked-for-reset>locked for reset/a>/i>./ol> p>If the dfn iddom-form-checkvalidity>code>checkValidity()/code>/dfn> method is invoked, the user agent must a href#statically-validate-the-constraints idthe-form-element:statically-validate-the-constraints>statically validate the constraints/a> of the code idthe-form-element:the-form-element-23>a href#the-form-element>form/a>/code> element, and return true if the constraint validation return a i>positive/i> result, and false if it returned a i>negative/i> result./p> p>If the dfn iddom-form-reportvalidity>code>reportValidity()/code>/dfn> method is invoked, the user agent must a href#interactively-validate-the-constraints idthe-form-element:interactively-validate-the-constraints>interactively validate the constraints/a> of the code idthe-form-element:the-form-element-24>a href#the-form-element>form/a>/code> element, and return true if the constraint validation return a i>positive/i> result, and false if it returned a i>negative/i> result./p> div classexample> p>This example shows two search forms:/p> pre><form actionhttps://www.google.com/search methodget> <label>Google: <input typesearch nameq></label> <input typesubmit valueSearch...></form><form actionhttps://www.bing.com/search methodget> <label>Bing: <input typesearch nameq></label> <input typesubmit valueSearch...></form>/pre> /div> h4 idthe-label-element>span classsecno>4.10.4/span> The dfn>code>label/code>/dfn> elementa href#the-label-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-label-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-label-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-label-element:phrasing-content-2>Phrasing content/a>.dd>a href#interactive-content-2 idthe-label-element:interactive-content-2>Interactive content/a>.dd>a href#palpable-content-2 idthe-label-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-label-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-label-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-label-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-label-element:phrasing-content-2-3>Phrasing content/a>, but with no descendant a href#category-label idthe-label-element:category-label>labelable elements/a> unless it is the elements a href#labeled-control idthe-label-element:labeled-control>labeled control/a>, and no descendant code idthe-label-element:the-label-element>a href#the-label-element>label/a>/code> elements.dt>a href#concept-element-tag-omission idthe-label-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-label-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-label-element:global-attributes>Global attributes/a>dd>code idthe-label-element:attr-label-for>a href#attr-label-for>for/a>/code> — Associate the label with form controldt>a href#concept-element-dom idthe-label-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-label-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmllabelelement>HTMLLabelElement/dfn> : a href#htmlelement idthe-label-element:htmlelement>HTMLElement/a> { readonly attribute a href#htmlformelement idthe-label-element:htmlformelement>HTMLFormElement/a>? a href#dom-label-form idthe-label-element:dom-label-form>form/a>; a href#cereactions idthe-label-element:cereactions>CEReactions/a> attribute DOMString a href#dom-label-htmlfor idthe-label-element:dom-label-htmlfor>htmlFor/a>; readonly attribute a href#htmlelement idthe-label-element:htmlelement-2>HTMLElement/a>? a href#dom-label-control idthe-label-element:dom-label-control>control/a>;};/pre> /dl> p>The code idthe-label-element:the-label-element-2>a href#the-label-element>label/a>/code> element a href#represents idthe-label-element:represents>represents/a> a caption in a user interface. The caption can be associated with a specific form control, known as the code idthe-label-element:the-label-element-3>a href#the-label-element>label/a>/code> elements dfn idlabeled-control>labeled control/dfn>, either using the code idthe-label-element:attr-label-for-2>a href#attr-label-for>for/a>/code> attribute, or by putting the form control inside the code idthe-label-element:the-label-element-4>a href#the-label-element>label/a>/code> element itself./p> p>Except where otherwise specified by the following rules, a code idthe-label-element:the-label-element-5>a href#the-label-element>label/a>/code> element has no a href#labeled-control idthe-label-element:labeled-control-2>labeled control/a>./p> p>The dfn idattr-label-for>code>for/code>/dfn> attribute may be specified to indicate a form control with which the caption is to be associated. If the attribute is specified, the attributes value must be the a hrefhttps://dom.spec.whatwg.org/#concept-id idthe-label-element:concept-id data-x-internalconcept-id>ID/a> of a a href#category-label idthe-label-element:category-label-2>labelable element/a> in the same a idthe-label-element:tree hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a> as the code idthe-label-element:the-label-element-6>a href#the-label-element>label/a>/code> element. If the attribute is specified and there is an element in the a idthe-label-element:tree-2 hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a> whose a hrefhttps://dom.spec.whatwg.org/#concept-id idthe-label-element:concept-id-2 data-x-internalconcept-id>ID/a> is equal to the value of the code idthe-label-element:attr-label-for-3>a href#attr-label-for>for/a>/code> attribute, and the first such element in a idthe-label-element:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> is a a href#category-label idthe-label-element:category-label-3>labelable element/a>, then that element is the code idthe-label-element:the-label-element-7>a href#the-label-element>label/a>/code> elements a href#labeled-control idthe-label-element:labeled-control-3>labeled control/a>./p> p>If the code idthe-label-element:attr-label-for-4>a href#attr-label-for>for/a>/code> attribute is not specified, but the code idthe-label-element:the-label-element-8>a href#the-label-element>label/a>/code> element has a a href#category-label idthe-label-element:category-label-4>labelable element/a> descendant, then the first such descendant in a idthe-label-element:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> is the code idthe-label-element:the-label-element-9>a href#the-label-element>label/a>/code> elements a href#labeled-control idthe-label-element:labeled-control-4>labeled control/a>./p> p>The code idthe-label-element:the-label-element-10>a href#the-label-element>label/a>/code> elements exact default presentation and behavior, in particular what its a idthe-label-element:activation-behaviour hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a> might be, if anything, should match the platforms label behavior. The a idthe-label-element:activation-behaviour-2 hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a> of a code idthe-label-element:the-label-element-11>a href#the-label-element>label/a>/code> element for events targeted at a href#interactive-content-2 idthe-label-element:interactive-content-2-2>interactive content/a> descendants of a code idthe-label-element:the-label-element-12>a href#the-label-element>label/a>/code> element, and any descendants of those a href#interactive-content-2 idthe-label-element:interactive-content-2-3>interactive content/a> descendants, must be to do nothing./p> div classexample> p>For example, on platforms where clicking a checkbox label checks the checkbox, clicking the code idthe-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#fire-a-click-event idthe-label-element:fire-a-click-event>fire a code>click/code> event/a> at the code idthe-label-element:the-input-element>a href#the-input-element>input/a>/code> element, as if the element itself had been triggered by the user:/p> pre><label><input typecheckbox namelost> Lost</label>/pre> p>On other platforms, the behavior might be just to focus the control, or do nothing./p> /div> div classexample> p>The following example shows three form controls each with a label, two of which have small text showing the right format for users to use./p> pre><p><label>Full name: <input namefn> <small>Format: First Last</small></label></p><p><label>Age: <input nameage typenumber min0></label></p><p><label>Post code: <input namepc> <small>Format: AB12 3CD</small></label></p>/pre> /div> dl classdomintro>dt>var>label/var> . code idthe-label-element:dom-label-control-2>a href#dom-label-control>control/a>/code>dd> p>Returns the form control that is associated with this element./p> dt>var>label/var> . code idthe-label-element:dom-label-form-2>a href#dom-label-form>form/a>/code>dd> p>Returns the a href#form-owner idthe-label-element:form-owner>form owner/a> of the form control that is associated with this element./p> p>Returns null if there isnt one./p> /dl> p>The dfn iddom-label-htmlfor>code>htmlFor/code>/dfn> IDL attribute must a href#reflect idthe-label-element:reflect>reflect/a> the code idthe-label-element:attr-label-for-5>a href#attr-label-for>for/a>/code> content attribute./p> p>The dfn iddom-label-control>code>control/code>/dfn> IDL attribute must return the code idthe-label-element:the-label-element-14>a href#the-label-element>label/a>/code> elements a href#labeled-control idthe-label-element:labeled-control-5>labeled control/a>, if any, or null if there isnt one./p> p>The dfn iddom-label-form>code>form/code>/dfn> IDL attribute must run the following steps:/p> ol>li>p>If the code idthe-label-element:the-label-element-15>a href#the-label-element>label/a>/code> element has no a href#labeled-control idthe-label-element:labeled-control-6>labeled control/a>, then return null.li>p>If the code idthe-label-element:the-label-element-16>a href#the-label-element>label/a>/code> elements a href#labeled-control idthe-label-element:labeled-control-7>labeled control/a> is not a a href#form-associated-element idthe-label-element:form-associated-element>form-associated element/a>, then return null.li>p>Return the code idthe-label-element:the-label-element-17>a href#the-label-element>label/a>/code> elements a href#labeled-control idthe-label-element:labeled-control-8>labeled control/a>s a href#form-owner idthe-label-element:form-owner-2>form owner/a> (which can still be null)./ol> p classnote>The code idthe-label-element:dom-label-form-3>a href#dom-label-form>form/a>/code> IDL attribute on the code idthe-label-element:the-label-element-18>a href#the-label-element>label/a>/code> element is different from the code idthe-label-element:attr-fae-form>a href#attr-fae-form>form/a>/code> IDL attribute on a href#category-listed idthe-label-element:category-listed>listed/a> a href#form-associated-element idthe-label-element:form-associated-element-2>form-associated elements/a>, and the code idthe-label-element:the-label-element-19>a href#the-label-element>label/a>/code> element does not have a code idthe-label-element:attr-fae-form-2>a href#attr-fae-form>form/a>/code> content attribute./p> hr> dl classdomintro>dt>var>control/var> . code idthe-label-element:dom-lfe-labels>a href#dom-lfe-labels>labels/a>/code>dd> p>Returns a code idthe-label-element:nodelist>a data-x-internalnodelist hrefhttps://dom.spec.whatwg.org/#interface-nodelist>NodeList/a>/code> of all the code idthe-label-element:the-label-element-20>a href#the-label-element>label/a>/code> elements that the form control is associated with./p> /dl> p>a href#category-label idthe-label-element:category-label-5>Labelable elements/a> and all code idthe-label-element:the-input-element-2>a href#the-input-element>input/a>/code> elements have a a href#live idthe-label-element:live>live/a> code idthe-label-element:nodelist-2>a data-x-internalnodelist hrefhttps://dom.spec.whatwg.org/#interface-nodelist>NodeList/a>/code> object associated with them that represents the list of code idthe-label-element:the-label-element-21>a href#the-label-element>label/a>/code> elements, in a idthe-label-element:tree-order-3 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>, whose a href#labeled-control idthe-label-element:labeled-control-9>labeled control/a> is the element in question. The dfn iddom-lfe-labels>code>labels/code>/dfn> IDL attribute of a href#category-label idthe-label-element:category-label-6>labelable elements/a> and code idthe-label-element:the-input-element-3>a href#the-input-element>input/a>/code> elements, on getting, must return that code idthe-label-element:nodelist-3>a data-x-internalnodelist hrefhttps://dom.spec.whatwg.org/#interface-nodelist>NodeList/a>/code> object, and that same value must always be returned, unless this element is an code idthe-label-element:the-input-element-4>a href#the-input-element>input/a>/code> element whose code idthe-label-element:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#hidden-state-(typehidden) idthe-label-element:hidden-state-(typehidden)>Hidden/a> state, in which case it must instead return null./p> div classexample> p>This (non-conforming) example shows what happens to the code idthe-label-element:nodelist-4>a data-x-internalnodelist hrefhttps://dom.spec.whatwg.org/#interface-nodelist>NodeList/a>/code> and what code idthe-label-element:dom-lfe-labels-2>a href#dom-lfe-labels>labels/a>/code> returns when an code idthe-label-element:the-input-element-5>a href#the-input-element>input/a>/code> element has its code idthe-label-element:attr-input-type-2>a href#attr-input-type>type/a>/code> attribute changed./p> pre><!doctype html><p><label><input></label></p><script> const input document.querySelector(input); const labels input.labels; console.assert(labels.length 1); input.type hidden; console.assert(labels.length 0); // the input is no longer the labels a href#labeled-control idthe-label-element:labeled-control-10>labeled control/a> console.assert(input.labels null); input.type checkbox; console.assert(labels.length 1); // the input is once again the labels a href#labeled-control idthe-label-element:labeled-control-11>labeled control/a> console.assert(input.labels labels); // same value as returned originally</script>/pre> /div> h4 idthe-input-element data-dfn-typeelement data-ltinput>span classsecno>4.10.5/span> The dfn>code>input/code>/dfn> elementa href#the-input-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-input-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-input-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-input-element:phrasing-content-2>Phrasing content/a>.dd>If the code idthe-input-element:attr-input-type>a href#attr-input-type>type/a>/code> attribute is em>not/em> in the a href#hidden-state-(typehidden) idthe-input-element:hidden-state-(typehidden)>Hidden/a> state: a href#interactive-content-2 idthe-input-element:interactive-content-2>Interactive content/a>.dd>If the code idthe-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-(typehidden) idthe-input-element:hidden-state-(typehidden)-2>Hidden/a> state: a href#category-listed idthe-input-element:category-listed>Listed/a>, a href#category-label idthe-input-element:category-label>labelable/a>, a href#category-submit idthe-input-element:category-submit>submittable/a>, and a href#category-reset idthe-input-element:category-reset>resettable/a> a href#form-associated-element idthe-input-element:form-associated-element>form-associated element/a>.dd>If the code idthe-input-element:attr-input-type-3>a href#attr-input-type>type/a>/code> attribute is in the a href#hidden-state-(typehidden) idthe-input-element:hidden-state-(typehidden)-3>Hidden/a> state: a href#category-listed idthe-input-element:category-listed-2>Listed/a>, a href#category-submit idthe-input-element:category-submit-2>submittable/a>, and a href#category-reset idthe-input-element:category-reset-2>resettable/a> a href#form-associated-element idthe-input-element:form-associated-element-2>form-associated element/a>.dd>If the code idthe-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-(typehidden) idthe-input-element:hidden-state-(typehidden)-4>Hidden/a> state: a href#palpable-content-2 idthe-input-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-input-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-input-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-input-element:concept-element-content-model>Content model/a>:dd>a href#concept-content-nothing idthe-input-element:concept-content-nothing>Nothing/a>.dt>a href#concept-element-tag-omission idthe-input-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>No a href#syntax-end-tag idthe-input-element:syntax-end-tag>end tag/a>.dt>a href#concept-element-attributes idthe-input-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-input-element:global-attributes>Global attributes/a>dd>code idthe-input-element:attr-input-accept>a href#attr-input-accept>accept/a>/code> — Hint for expected file type in a href#file-upload-state-(typefile) idthe-input-element:file-upload-state-(typefile)>file upload controls/a>dd>code idthe-input-element:attr-input-alt>a href#attr-input-alt>alt/a>/code> — Replacement text for use when images are not availabledd>code idthe-input-element:attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code> — Hint for form autofill featuredd>code idthe-input-element:attr-fe-autofocus>a href#attr-fe-autofocus>autofocus/a>/code> — Automatically focus the form control when the page is loadeddd>code idthe-input-element:attr-input-checked>a href#attr-input-checked>checked/a>/code> — Whether the control is checkeddd>code idthe-input-element:attr-fe-dirname>a href#attr-fe-dirname>dirname/a>/code> — Name of form control to use for sending the elements a href#the-directionality idthe-input-element:the-directionality>directionality/a> in a href#form-submission-2 idthe-input-element:form-submission-2>form submission/a>dd>code idthe-input-element:attr-fe-disabled>a href#attr-fe-disabled>disabled/a>/code> — Whether the form control is disableddd>code idthe-input-element:attr-fae-form>a href#attr-fae-form>form/a>/code> — Associates the control with a code idthe-input-element:the-form-element>a href#the-form-element>form/a>/code> elementdd>code idthe-input-element:attr-fs-formaction>a href#attr-fs-formaction>formaction/a>/code> — a idthe-input-element:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> to use for a href#form-submission-2 idthe-input-element:form-submission-2-2>form submission/a>dd>code idthe-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 idthe-input-element:form-submission-2-3>form submission/a>dd>code idthe-input-element:attr-fs-formmethod>a href#attr-fs-formmethod>formmethod/a>/code> — HTTP method to use for a href#form-submission-2 idthe-input-element:form-submission-2-4>form submission/a>dd>code idthe-input-element:attr-fs-formnovalidate>a href#attr-fs-formnovalidate>formnovalidate/a>/code> — Bypass form control validation for a href#form-submission-2 idthe-input-element:form-submission-2-5>form submission/a>dd>code idthe-input-element:attr-fs-formtarget>a href#attr-fs-formtarget>formtarget/a>/code> — a href#browsing-context idthe-input-element:browsing-context>Browsing context/a> for a href#form-submission-2 idthe-input-element:form-submission-2-6>form submission/a>dd>code idthe-input-element:attr-dim-height>a href#attr-dim-height>height/a>/code> — Vertical dimensiondd>code idthe-input-element:attr-fe-inputmode>a href#attr-fe-inputmode>inputmode/a>/code> — Hint for selecting an input modalitydd>code idthe-input-element:attr-input-list>a href#attr-input-list>list/a>/code> — List of autocomplete optionsdd>code idthe-input-element:attr-input-max>a href#attr-input-max>max/a>/code> — Maximum valuedd>code idthe-input-element:attr-input-maxlength>a href#attr-input-maxlength>maxlength/a>/code> — Maximum length of valuedd>code idthe-input-element:attr-input-min>a href#attr-input-min>min/a>/code> — Minimum valuedd>code idthe-input-element:attr-input-minlength>a href#attr-input-minlength>minlength/a>/code> — Minimum length of valuedd>code idthe-input-element:attr-input-multiple>a href#attr-input-multiple>multiple/a>/code> — Whether to allow multiple valuesdd>code idthe-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 idthe-input-element:form-submission-2-7>form submission/a> and in the code idthe-input-element:dom-form-elements>a href#dom-form-elements>form.elements/a>/code> API dd>code idthe-input-element:attr-input-pattern>a href#attr-input-pattern>pattern/a>/code> — Pattern to be matched by the form controls valuedd>code idthe-input-element:attr-input-placeholder>a href#attr-input-placeholder>placeholder/a>/code> — User-visible label to be placed within the form controldd>code idthe-input-element:attr-input-readonly>a href#attr-input-readonly>readonly/a>/code> — Whether to allow the value to be edited by the userdd>code idthe-input-element:attr-input-required>a href#attr-input-required>required/a>/code> — Whether the control is required for a href#form-submission-2 idthe-input-element:form-submission-2-8>form submission/a>dd>code idthe-input-element:attr-input-size>a href#attr-input-size>size/a>/code> — Size of the controldd>code idthe-input-element:attr-input-src>a href#attr-input-src>src/a>/code> — Address of the resourcedd>code idthe-input-element:attr-input-step>a href#attr-input-step>step/a>/code> — Granularity to be matched by the form controls valuedd>code idthe-input-element:attr-input-type-5>a href#attr-input-type>type/a>/code> — Type of form controldd>code idthe-input-element:attr-input-value>a href#attr-input-value>value/a>/code> — Value of the form controldd>code idthe-input-element:attr-dim-width>a href#attr-dim-width>width/a>/code> — Horizontal dimensiondd>Also, the code idthe-input-element:attr-input-title>a href#attr-input-title>title/a>/code> attribute a href#attr-input-title idthe-input-element:attr-input-title-2>has special semantics/a> on this element: Description of pattern (when used with code idthe-input-element:attr-input-pattern-2>a href#attr-input-pattern>pattern/a>/code> attribute).dt>a href#concept-element-dom idthe-input-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-input-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlinputelement>HTMLInputElement/dfn> : a href#htmlelement idthe-input-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-input-element:cereactions>CEReactions/a> attribute DOMString a href#dom-input-accept idthe-input-element:dom-input-accept>accept/a>; a href#cereactions idthe-input-element:cereactions-2>CEReactions/a> attribute DOMString a href#dom-input-alt idthe-input-element:dom-input-alt>alt/a>; a href#cereactions idthe-input-element:cereactions-3>CEReactions/a> attribute DOMString a href#dom-fe-autocomplete idthe-input-element:dom-fe-autocomplete>autocomplete/a>; a href#cereactions idthe-input-element:cereactions-4>CEReactions/a> attribute boolean a href#dom-fe-autofocus idthe-input-element:dom-fe-autofocus>autofocus/a>; a href#cereactions idthe-input-element:cereactions-5>CEReactions/a> attribute boolean a href#dom-input-defaultchecked idthe-input-element:dom-input-defaultchecked>defaultChecked/a>; attribute boolean a href#dom-input-checked idthe-input-element:dom-input-checked>checked/a>; a href#cereactions idthe-input-element:cereactions-6>CEReactions/a> attribute DOMString a href#dom-input-dirname idthe-input-element:dom-input-dirname>dirName/a>; a href#cereactions idthe-input-element:cereactions-7>CEReactions/a> attribute boolean a href#dom-fe-disabled idthe-input-element:dom-fe-disabled>disabled/a>; readonly attribute a href#htmlformelement idthe-input-element:htmlformelement>HTMLFormElement/a>? a href#dom-fae-form idthe-input-element:dom-fae-form>form/a>; attribute a idthe-input-element:filelist hrefhttps://w3c.github.io/FileAPI/#filelist-section data-x-internalfilelist>FileList/a>? a href#dom-input-files idthe-input-element:dom-input-files>files/a>; a href#cereactions idthe-input-element:cereactions-8>CEReactions/a> attribute USVString a href#dom-fs-formaction idthe-input-element:dom-fs-formaction>formAction/a>; a href#cereactions idthe-input-element:cereactions-9>CEReactions/a> attribute DOMString a href#dom-fs-formenctype idthe-input-element:dom-fs-formenctype>formEnctype/a>; a href#cereactions idthe-input-element:cereactions-10>CEReactions/a> attribute DOMString a href#dom-fs-formmethod idthe-input-element:dom-fs-formmethod>formMethod/a>; a href#cereactions idthe-input-element:cereactions-11>CEReactions/a> attribute boolean a href#dom-fs-formnovalidate idthe-input-element:dom-fs-formnovalidate>formNoValidate/a>; a href#cereactions idthe-input-element:cereactions-12>CEReactions/a> attribute DOMString a href#dom-fs-formtarget idthe-input-element:dom-fs-formtarget>formTarget/a>; a href#cereactions idthe-input-element:cereactions-13>CEReactions/a> attribute unsigned long a href#dom-input-height idthe-input-element:dom-input-height>height/a>; attribute boolean a href#dom-input-indeterminate idthe-input-element:dom-input-indeterminate>indeterminate/a>; a href#cereactions idthe-input-element:cereactions-14>CEReactions/a> attribute DOMString a href#dom-input-inputmode idthe-input-element:dom-input-inputmode>inputMode/a>; readonly attribute a href#htmlelement idthe-input-element:htmlelement-2>HTMLElement/a>? a href#dom-input-list idthe-input-element:dom-input-list>list/a>; a href#cereactions idthe-input-element:cereactions-15>CEReactions/a> attribute DOMString a href#dom-input-max idthe-input-element:dom-input-max>max/a>; a href#cereactions idthe-input-element:cereactions-16>CEReactions/a> attribute long a href#dom-input-maxlength idthe-input-element:dom-input-maxlength>maxLength/a>; a href#cereactions idthe-input-element:cereactions-17>CEReactions/a> attribute DOMString a href#dom-input-min idthe-input-element:dom-input-min>min/a>; a href#cereactions idthe-input-element:cereactions-18>CEReactions/a> attribute long a href#dom-input-minlength idthe-input-element:dom-input-minlength>minLength/a>; a href#cereactions idthe-input-element:cereactions-19>CEReactions/a> attribute boolean a href#dom-input-multiple idthe-input-element:dom-input-multiple>multiple/a>; a href#cereactions idthe-input-element:cereactions-20>CEReactions/a> attribute DOMString a href#dom-fe-name idthe-input-element:dom-fe-name>name/a>; a href#cereactions idthe-input-element:cereactions-21>CEReactions/a> attribute DOMString a href#dom-input-pattern idthe-input-element:dom-input-pattern>pattern/a>; a href#cereactions idthe-input-element:cereactions-22>CEReactions/a> attribute DOMString a href#dom-input-placeholder idthe-input-element:dom-input-placeholder>placeholder/a>; a href#cereactions idthe-input-element:cereactions-23>CEReactions/a> attribute boolean a href#dom-input-readonly idthe-input-element:dom-input-readonly>readOnly/a>; a href#cereactions idthe-input-element:cereactions-24>CEReactions/a> attribute boolean a href#dom-input-required idthe-input-element:dom-input-required>required/a>; a href#cereactions idthe-input-element:cereactions-25>CEReactions/a> attribute unsigned long a href#dom-input-size idthe-input-element:dom-input-size>size/a>; a href#cereactions idthe-input-element:cereactions-26>CEReactions/a> attribute USVString a href#dom-input-src idthe-input-element:dom-input-src>src/a>; a href#cereactions idthe-input-element:cereactions-27>CEReactions/a> attribute DOMString a href#dom-input-step idthe-input-element:dom-input-step>step/a>; a href#cereactions idthe-input-element:cereactions-28>CEReactions/a> attribute DOMString a href#dom-input-type idthe-input-element:dom-input-type>type/a>; a href#cereactions idthe-input-element:cereactions-29>CEReactions/a> attribute DOMString a href#dom-input-defaultvalue idthe-input-element:dom-input-defaultvalue>defaultValue/a>; a href#cereactions idthe-input-element:cereactions-30>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-input-value idthe-input-element:dom-input-value>value/a>; attribute a hrefhttps://heycam.github.io/webidl/#idl-object idthe-input-element:idl-object data-x-internalidl-object>object/a>? a href#dom-input-valueasdate idthe-input-element:dom-input-valueasdate>valueAsDate/a>; attribute unrestricted double a href#dom-input-valueasnumber idthe-input-element:dom-input-valueasnumber>valueAsNumber/a>; a href#cereactions idthe-input-element:cereactions-31>CEReactions/a> attribute unsigned long a href#dom-input-width idthe-input-element:dom-input-width>width/a>; void a href#dom-input-stepup idthe-input-element:dom-input-stepup>stepUp/a>(optional long n 1); void a href#dom-input-stepdown idthe-input-element:dom-input-stepdown>stepDown/a>(optional long n 1); readonly attribute boolean a href#dom-cva-willvalidate idthe-input-element:dom-cva-willvalidate>willValidate/a>; readonly attribute a href#validitystate idthe-input-element:validitystate>ValidityState/a> a href#dom-cva-validity idthe-input-element:dom-cva-validity>validity/a>; readonly attribute DOMString a href#dom-cva-validationmessage idthe-input-element:dom-cva-validationmessage>validationMessage/a>; boolean a href#dom-cva-checkvalidity idthe-input-element:dom-cva-checkvalidity>checkValidity/a>(); boolean a href#dom-cva-reportvalidity idthe-input-element:dom-cva-reportvalidity>reportValidity/a>(); void a href#dom-cva-setcustomvalidity idthe-input-element:dom-cva-setcustomvalidity>setCustomValidity/a>(DOMString error); readonly attribute a idthe-input-element:nodelist hrefhttps://dom.spec.whatwg.org/#interface-nodelist data-x-internalnodelist>NodeList/a>? a href#dom-lfe-labels idthe-input-element:dom-lfe-labels>labels/a>; void a href#dom-textarea/input-select idthe-input-element:dom-textarea/input-select>select/a>(); attribute unsigned long? a href#dom-textarea/input-selectionstart idthe-input-element:dom-textarea/input-selectionstart>selectionStart/a>; attribute unsigned long? a href#dom-textarea/input-selectionend idthe-input-element:dom-textarea/input-selectionend>selectionEnd/a>; attribute DOMString? a href#dom-textarea/input-selectiondirection idthe-input-element:dom-textarea/input-selectiondirection>selectionDirection/a>; void a href#dom-textarea/input-setrangetext idthe-input-element:dom-textarea/input-setrangetext>setRangeText/a>(DOMString replacement); void a href#dom-textarea/input-setrangetext idthe-input-element:dom-textarea/input-setrangetext-2>setRangeText/a>(DOMString replacement, unsigned long start, unsigned long end, optional a href#selectionmode idthe-input-element:selectionmode>SelectionMode/a> selectionMode preserve); void a href#dom-textarea/input-setselectionrange idthe-input-element:dom-textarea/input-setselectionrange>setSelectionRange/a>(unsigned long start, unsigned long end, optional DOMString direction); // a href#HTMLInputElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-input-element:the-input-element>a href#the-input-element>input/a>/code> element a href#represents idthe-input-element:represents>represents/a> a typed data field, usually with a form control to allow the user to edit the data./p> p>The dfn idattr-input-type>code>type/code>/dfn> attribute controls the data type (and associated control) of the element. It is an a href#enumerated-attribute idthe-input-element:enumerated-attribute>enumerated attribute/a>. The following table lists the keywords and states for the attribute — the keywords in the left column map to the states in the cell in the second column on the same row as the keyword./p> table idattr-input-type-keywords>thead>tr>th> Keyword th> State th> Data type th> Control type tbody>tr>td> dfn idattr-input-type-hidden-keyword>code>hidden/code>/dfn> td> a href#hidden-state-(typehidden) idthe-input-element:hidden-state-(typehidden)-5>Hidden/a> td> An arbitrary string td> n/a tr>td> dfn idattr-input-type-text-keyword>code>text/code>/dfn> td> a href#text-(typetext)-state-and-search-state-(typesearch) idthe-input-element:text-(typetext)-state-and-search-state-(typesearch)>Text/a> td> Text with no line breaks td> A text control tr>td> dfn idattr-input-type-search-keyword>code>search/code>/dfn> td> a href#text-(typetext)-state-and-search-state-(typesearch) idthe-input-element:text-(typetext)-state-and-search-state-(typesearch)-2>Search/a> td> Text with no line breaks td> Search control tr>td> dfn idattr-input-type-tel-keyword>code>tel/code>/dfn> td> a href#telephone-state-(typetel) idthe-input-element:telephone-state-(typetel)>Telephone/a> td> Text with no line breaks td> A text control tr>td> dfn idattr-input-type-url-keyword>code>url/code>/dfn> td> a href#url-state-(typeurl) idthe-input-element:url-state-(typeurl)>URL/a> td> An absolute URL td> A text control tr>td> dfn idattr-input-type-email-keyword>code>email/code>/dfn> td> a href#e-mail-state-(typeemail) idthe-input-element:e-mail-state-(typeemail)>E-mail/a> td> An e-mail address or list of e-mail addresses td> A text control tr>td> dfn idattr-input-type-password-keyword>code>password/code>/dfn> td> a href#password-state-(typepassword) idthe-input-element:password-state-(typepassword)>Password/a> td> Text with no line breaks (sensitive information) td> A text control that obscures data entry tr>td> dfn idattr-input-type-date-keyword>code>date/code>/dfn> td> a href#date-state-(typedate) idthe-input-element:date-state-(typedate)>Date/a> td> A date (year, month, day) with no time zone td> A date control tr>td> dfn idattr-input-type-month-keyword>code>month/code>/dfn> td> a href#month-state-(typemonth) idthe-input-element:month-state-(typemonth)>Month/a> td> A date consisting of a year and a month with no time zone td> A month control tr>td> dfn idattr-input-type-week-keyword>code>week/code>/dfn> td> a href#week-state-(typeweek) idthe-input-element:week-state-(typeweek)>Week/a> td> A date consisting of a week-year number and a week number with no time zone td> A week control tr>td> dfn idattr-input-type-time-keyword>code>time/code>/dfn> td> a href#time-state-(typetime) idthe-input-element:time-state-(typetime)>Time/a> td> A time (hour, minute, seconds, fractional seconds) with no time zone td> A time control tr>td> dfn idattr-input-type-datetime-local-keyword>code>datetime-local/code>/dfn> td> a href#local-date-and-time-state-(typedatetime-local) idthe-input-element:local-date-and-time-state-(typedatetime-local)>Local Date and Time/a> td> A date and time (year, month, day, hour, minute, second, fraction of a second) with no time zone td> A date and time control tr>td> dfn idattr-input-type-number-keyword>code>number/code>/dfn> td> a href#number-state-(typenumber) idthe-input-element:number-state-(typenumber)>Number/a> td> A numerical value td> A text control or spinner control tr>td> dfn idattr-input-type-range-keyword>code>range/code>/dfn> td> a href#range-state-(typerange) idthe-input-element:range-state-(typerange)>Range/a> td> A numerical value, with the extra semantic that the exact value is not important td> A slider control or similar tr>td> dfn idattr-input-type-color-keyword>code>color/code>/dfn> td> a href#color-state-(typecolor) idthe-input-element:color-state-(typecolor)>Color/a> td> An sRGB color with 8-bit red, green, and blue components td> A color picker tr>td> dfn idattr-input-type-checkbox-keyword>code>checkbox/code>/dfn> td> a href#checkbox-state-(typecheckbox) idthe-input-element:checkbox-state-(typecheckbox)>Checkbox/a> td> A set of zero or more values from a predefined list td> A checkbox tr>td> dfn idattr-input-type-radio-keyword>code>radio/code>/dfn> td> a href#radio-button-state-(typeradio) idthe-input-element:radio-button-state-(typeradio)>Radio Button/a> td> An enumerated value td> A radio button tr>td> dfn idattr-input-type-file-keyword>code>file/code>/dfn> td> a href#file-upload-state-(typefile) idthe-input-element:file-upload-state-(typefile)-2>File Upload/a> td> Zero or more files each with a a idthe-input-element:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> and optionally a file name td> A label and a button tr>td> dfn idattr-input-type-submit-keyword>code>submit/code>/dfn> td> a href#submit-button-state-(typesubmit) idthe-input-element:submit-button-state-(typesubmit)>Submit Button/a> td> An enumerated value, with the extra semantic that it must be the last value selected and initiates form submission td> A button tr>td> dfn idattr-input-type-image-keyword>code>image/code>/dfn> td> a href#image-button-state-(typeimage) idthe-input-element:image-button-state-(typeimage)>Image Button/a> td> A coordinate, relative to a particular images size, with the extra semantic that it must be the last value selected and initiates form submission td> Either a clickable image, or a button tr>td> dfn idattr-input-type-reset-keyword>code>reset/code>/dfn> td> a href#reset-button-state-(typereset) idthe-input-element:reset-button-state-(typereset)>Reset Button/a> td> n/a td> A button tr>td> dfn idattr-input-type-button-keyword>code>button/code>/dfn> td> a href#button-state-(typebutton) idthe-input-element:button-state-(typebutton)>Button/a> td> n/a td> A button /table> p>The i idthe-input-element:missing-value-default>a href#missing-value-default>missing value default/a>/i> is the a href#text-(typetext)-state-and-search-state-(typesearch) idthe-input-element:text-(typetext)-state-and-search-state-(typesearch)-3>Text/a> state./p> p>Which of the code idthe-input-element:attr-input-accept-2>a href#attr-input-accept>accept/a>/code>, code idthe-input-element:attr-input-alt-2>a href#attr-input-alt>alt/a>/code>, code idthe-input-element:attr-fe-autocomplete-2>a href#attr-fe-autocomplete>autocomplete/a>/code>, code idthe-input-element:attr-input-checked-2>a href#attr-input-checked>checked/a>/code>, code idthe-input-element:attr-fe-dirname-2>a href#attr-fe-dirname>dirname/a>/code>, code idthe-input-element:attr-fs-formaction-2>a href#attr-fs-formaction>formaction/a>/code>, code idthe-input-element:attr-fs-formenctype-2>a href#attr-fs-formenctype>formenctype/a>/code>, code idthe-input-element:attr-fs-formmethod-2>a href#attr-fs-formmethod>formmethod/a>/code>, code idthe-input-element:attr-fs-formnovalidate-2>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idthe-input-element:attr-fs-formtarget-2>a href#attr-fs-formtarget>formtarget/a>/code>, code idthe-input-element:attr-dim-height-2>a href#attr-dim-height>height/a>/code>, code idthe-input-element:attr-fe-inputmode-2>a href#attr-fe-inputmode>inputmode/a>/code>, code idthe-input-element:attr-input-list-2>a href#attr-input-list>list/a>/code>, code idthe-input-element:attr-input-max-2>a href#attr-input-max>max/a>/code>, code idthe-input-element:attr-input-maxlength-2>a href#attr-input-maxlength>maxlength/a>/code>, code idthe-input-element:attr-input-min-2>a href#attr-input-min>min/a>/code>, code idthe-input-element:attr-input-minlength-2>a href#attr-input-minlength>minlength/a>/code>, code idthe-input-element:attr-input-multiple-2>a href#attr-input-multiple>multiple/a>/code>, code idthe-input-element:attr-input-pattern-3>a href#attr-input-pattern>pattern/a>/code>, code idthe-input-element:attr-input-placeholder-2>a href#attr-input-placeholder>placeholder/a>/code>, code idthe-input-element:attr-input-readonly-2>a href#attr-input-readonly>readonly/a>/code>, code idthe-input-element:attr-input-required-2>a href#attr-input-required>required/a>/code>, code idthe-input-element:attr-input-size-2>a href#attr-input-size>size/a>/code>, code idthe-input-element:attr-input-src-2>a href#attr-input-src>src/a>/code>, code idthe-input-element:attr-input-step-2>a href#attr-input-step>step/a>/code>, and code idthe-input-element:attr-dim-width-2>a href#attr-dim-width>width/a>/code> content attributes, the code idthe-input-element:dom-input-checked-2>a href#dom-input-checked>checked/a>/code>, code idthe-input-element:dom-input-files-2>a href#dom-input-files>files/a>/code>, code idthe-input-element:dom-input-valueasdate-2>a href#dom-input-valueasdate>valueAsDate/a>/code>, code idthe-input-element:dom-input-valueasnumber-2>a href#dom-input-valueasnumber>valueAsNumber/a>/code>, and code idthe-input-element:dom-input-list-2>a href#dom-input-list>list/a>/code> IDL attributes, the code idthe-input-element:dom-textarea/input-select-2>a href#dom-textarea/input-select>select()/a>/code> method, the code idthe-input-element:dom-textarea/input-selectionstart-2>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idthe-input-element:dom-textarea/input-selectionend-2>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, and code idthe-input-element:dom-textarea/input-selectiondirection-2>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, IDL attributes, the code idthe-input-element:dom-textarea/input-setrangetext-3>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code> and code idthe-input-element:dom-textarea/input-setselectionrange-2>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code> methods, the code idthe-input-element:dom-input-stepup-2>a href#dom-input-stepup>stepUp()/a>/code> and code idthe-input-element:dom-input-stepdown-2>a href#dom-input-stepdown>stepDown()/a>/code> methods, and the code idthe-input-element:event-input>a href#event-input>input/a>/code> and code idthe-input-element:event-change>a href#event-change>change/a>/code> events dfn idconcept-input-apply>apply/dfn> to an code idthe-input-element:the-input-element-2>a href#the-input-element>input/a>/code> element depends on the state of its code idthe-input-element:attr-input-type-6>a href#attr-input-type>type/a>/code> attribute. The subsections that define each type also clearly define in normative bookkeeping sections which of these feature apply, and which dfn iddo-not-apply>do not apply/dfn>, to each type. The behavior of these features depends on whether they apply or not, as defined in their various sections (q.v. for a href#common-input-element-attributes>content attributes/a>, for a href#common-input-element-apis>APIs/a>, for a href#common-input-element-events>events/a>)./p> p>The following table is non-normative and summarizes which of those content attributes, IDL attributes, methods, and events a href#concept-input-apply idthe-input-element:concept-input-apply>apply/a> to each state:/p> table idinput-type-attr-summary classapplies>thead>tr>th> th> span>a href#hidden-state-(typehidden) idthe-input-element:hidden-state-(typehidden)-6>Hidden/a>/span> th> span>a href#text-(typetext)-state-and-search-state-(typesearch) idthe-input-element:text-(typetext)-state-and-search-state-(typesearch)-4>Text/a>,/span> span>a href#text-(typetext)-state-and-search-state-(typesearch) idthe-input-element:text-(typetext)-state-and-search-state-(typesearch)-5>Search/a>/span> th> span>a href#url-state-(typeurl) idthe-input-element:url-state-(typeurl)-2>URL/a>,/span> span>a href#telephone-state-(typetel) idthe-input-element:telephone-state-(typetel)-2>Telephone/a>/span> th> span>a href#e-mail-state-(typeemail) idthe-input-element:e-mail-state-(typeemail)-2>E-mail/a>/span> th> span>a href#password-state-(typepassword) idthe-input-element:password-state-(typepassword)-2>Password/a>/span> th> span>a href#date-state-(typedate) idthe-input-element:date-state-(typedate)-2>Date/a>,/span> span>a href#month-state-(typemonth) idthe-input-element:month-state-(typemonth)-2>Month/a>,/span> span>a href#week-state-(typeweek) idthe-input-element:week-state-(typeweek)-2>Week/a>,/span> span>a href#time-state-(typetime) idthe-input-element:time-state-(typetime)-2>Time/a>/span> th> span>a href#local-date-and-time-state-(typedatetime-local) idthe-input-element:local-date-and-time-state-(typedatetime-local)-2>Local Date and Time/a>/span> th> span>a href#number-state-(typenumber) idthe-input-element:number-state-(typenumber)-2>Number/a>/span> th> span>a href#range-state-(typerange) idthe-input-element:range-state-(typerange)-2>Range/a>/span> th> span>a href#color-state-(typecolor) idthe-input-element:color-state-(typecolor)-2>Color/a>/span> th> span>a href#checkbox-state-(typecheckbox) idthe-input-element:checkbox-state-(typecheckbox)-2>Checkbox/a>,/span> span>a href#radio-button-state-(typeradio) idthe-input-element:radio-button-state-(typeradio)-2>Radio Button/a>/span> th> span>a href#file-upload-state-(typefile) idthe-input-element:file-upload-state-(typefile)-3>File Upload/a>/span> th> span>a href#submit-button-state-(typesubmit) idthe-input-element:submit-button-state-(typesubmit)-2>Submit Button/a>/span> th> span>a href#image-button-state-(typeimage) idthe-input-element:image-button-state-(typeimage)-2>Image Button/a>/span> th> span>a href#reset-button-state-(typereset) idthe-input-element:reset-button-state-(typereset)-2>Reset Button/a>,/span> span>a href#button-state-(typebutton) idthe-input-element:button-state-(typebutton)-2>Button/a>/span> tbody>tr>th colspan16 scoperowgroup>Content attributes tr>th> code idthe-input-element:attr-input-accept-3>a href#attr-input-accept>accept/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classno> · td classno> · td classno> · tr>th> code idthe-input-element:attr-input-alt-3>a href#attr-input-alt>alt/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classno> · tr>th> code idthe-input-element:attr-fe-autocomplete-3>a href#attr-fe-autocomplete>autocomplete/a>/code> td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:attr-input-checked-3>a href#attr-input-checked>checked/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:attr-fe-dirname-3>a href#attr-fe-dirname>dirname/a>/code> td classno> · td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:attr-fs-formaction-3>a href#attr-fs-formaction>formaction/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classyes> Yes td classno> · tr>th> code idthe-input-element:attr-fs-formenctype-3>a href#attr-fs-formenctype>formenctype/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classyes> Yes td classno> · tr>th> code idthe-input-element:attr-fs-formmethod-3>a href#attr-fs-formmethod>formmethod/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classyes> Yes td classno> · tr>th> code idthe-input-element:attr-fs-formnovalidate-3>a href#attr-fs-formnovalidate>formnovalidate/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classyes> Yes td classno> · tr>th> code idthe-input-element:attr-fs-formtarget-3>a href#attr-fs-formtarget>formtarget/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classyes> Yes td classno> · tr>th> code idthe-input-element:attr-dim-height-3>a href#attr-dim-height>height/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classno> · tr>th> code idthe-input-element:attr-fe-inputmode-3>a href#attr-fe-inputmode>inputmode/a>/code> td classno> · td classyes> Yes td classno> · td classno> · td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:attr-input-list-3>a href#attr-input-list>list/a>/code> td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:attr-input-max-3>a href#attr-input-max>max/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:attr-input-maxlength-3>a href#attr-input-maxlength>maxlength/a>/code> td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:attr-input-min-3>a href#attr-input-min>min/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:attr-input-minlength-3>a href#attr-input-minlength>minlength/a>/code> td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:attr-input-multiple-3>a href#attr-input-multiple>multiple/a>/code> td classno> · td classno> · td classno> · td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classno> · td classno> · td classno> · tr>th> code idthe-input-element:attr-input-pattern-4>a href#attr-input-pattern>pattern/a>/code> td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:attr-input-placeholder-3>a href#attr-input-placeholder>placeholder/a>/code> td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classno> · td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:attr-input-readonly-3>a href#attr-input-readonly>readonly/a>/code> td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:attr-input-required-3>a href#attr-input-required>required/a>/code> td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classno> · td classyes> Yes td classyes> Yes td classno> · td classno> · td classno> · tr>th> code idthe-input-element:attr-input-size-3>a href#attr-input-size>size/a>/code> td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:attr-input-src-3>a href#attr-input-src>src/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classno> · tr>th> code idthe-input-element:attr-input-step-3>a href#attr-input-step>step/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:attr-dim-width-3>a href#attr-dim-width>width/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classno> · tbody>tr>th colspan16 scoperowgroup>IDL attributes and methods tr>th> code idthe-input-element:dom-input-checked-3>a href#dom-input-checked>checked/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:dom-input-files-3>a href#dom-input-files>files/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classno> · td classno> · td classno> · tr>th> code idthe-input-element:dom-input-value-2>a href#dom-input-value>value/a>/code> td classyes> a href#dom-input-value-default idthe-input-element:dom-input-value-default>default/a> td classyes> a href#dom-input-value-value idthe-input-element:dom-input-value-value>value/a> td classyes> a href#dom-input-value-value idthe-input-element:dom-input-value-value-2>value/a> td classyes> a href#dom-input-value-value idthe-input-element:dom-input-value-value-3>value/a> td classyes> a href#dom-input-value-value idthe-input-element:dom-input-value-value-4>value/a> td classyes> a href#dom-input-value-value idthe-input-element:dom-input-value-value-5>value/a> td classyes> a href#dom-input-value-value idthe-input-element:dom-input-value-value-6>value/a> td classyes> a href#dom-input-value-value idthe-input-element:dom-input-value-value-7>value/a> td classyes> a href#dom-input-value-value idthe-input-element:dom-input-value-value-8>value/a> td classyes> a href#dom-input-value-value idthe-input-element:dom-input-value-value-9>value/a> td classyes> a href#dom-input-value-default-on idthe-input-element:dom-input-value-default-on>default/on/a> td classyes> a href#dom-input-value-filename idthe-input-element:dom-input-value-filename>filename/a> td classyes> a href#dom-input-value-default idthe-input-element:dom-input-value-default-2>default/a> td classyes> a href#dom-input-value-default idthe-input-element:dom-input-value-default-3>default/a> td classyes> a href#dom-input-value-default idthe-input-element:dom-input-value-default-4>default/a> tr>th> code idthe-input-element:dom-input-valueasdate-3>a href#dom-input-valueasdate>valueAsDate/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:dom-input-valueasnumber-3>a href#dom-input-valueasnumber>valueAsNumber/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:dom-input-list-3>a href#dom-input-list>list/a>/code> td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:dom-textarea/input-select-3>a href#dom-textarea/input-select>select()/a>/code> td classno> · td classyes> Yes td classyes> Yes td classyes> Yes† td classyes> Yes td classyes> Yes† td classyes> Yes† td classyes> Yes† td classno> · td classyes> Yes† td classno> · td classyes> Yes† td classno> · td classno> · td classno> · tr>th> code idthe-input-element:dom-textarea/input-selectionstart-3>a href#dom-textarea/input-selectionstart>selectionStart/a>/code> td classno> · td classyes> Yes td classyes> Yes td classno> · td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:dom-textarea/input-selectionend-3>a href#dom-textarea/input-selectionend>selectionEnd/a>/code> td classno> · td classyes> Yes td classyes> Yes td classno> · td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:dom-textarea/input-selectiondirection-3>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code> td classno> · td classyes> Yes td classyes> Yes td classno> · td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:dom-textarea/input-setrangetext-4>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code> td classno> · td classyes> Yes td classyes> Yes td classno> · td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:dom-textarea/input-setselectionrange-3>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code> td classno> · td classyes> Yes td classyes> Yes td classno> · td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:dom-input-stepdown-3>a href#dom-input-stepdown>stepDown()/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tr>th> code idthe-input-element:dom-input-stepup-3>a href#dom-input-stepup>stepUp()/a>/code> td classno> · td classno> · td classno> · td classno> · td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classno> · td classno> · td classno> · td classno> · td classno> · tbody>tr>th colspan16 scoperowgroup>Events tr>th> span>code idthe-input-element:event-input-2>a href#event-input>input/a>/code> event/span> td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classno> · td classno> · tr>th> span>code idthe-input-element:event-change-2>a href#event-change>change/a>/code> event/span> td classno> · td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classyes> Yes td classno> · td classno> · td classno> · /table> p classtablenote>small>† If the control has no selectable text, the code idthe-input-element:dom-textarea/input-select-4>a href#dom-textarea/input-select>select()/a>/code> method results in a no-op, with no a idthe-input-element:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idthe-input-element:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./small>/p> p>Some states of the code idthe-input-element:attr-input-type-7>a href#attr-input-type>type/a>/code> attribute define a dfn idvalue-sanitization-algorithm>value sanitization algorithm/dfn>./p> p>Each code idthe-input-element:the-input-element-3>a href#the-input-element>input/a>/code> element has a a href#concept-fe-value idthe-input-element:concept-fe-value>value/a>, which is exposed by the code idthe-input-element:dom-input-value-3>a href#dom-input-value>value/a>/code> IDL attribute. Some states define an dfn idconcept-input-value-string-number>algorithm to convert a string to a number/dfn>, an dfn idconcept-input-value-number-string>algorithm to convert a number to a string/dfn>, an dfn idconcept-input-value-string-date>algorithm to convert a string to a code>Date/code> object/dfn>, and an dfn idconcept-input-value-date-string>algorithm to convert a code>Date/code> object to a string/dfn>, which are used by code idthe-input-element:attr-input-max-4>a href#attr-input-max>max/a>/code>, code idthe-input-element:attr-input-min-4>a href#attr-input-min>min/a>/code>, code idthe-input-element:attr-input-step-4>a href#attr-input-step>step/a>/code>, code idthe-input-element:dom-input-valueasdate-4>a href#dom-input-valueasdate>valueAsDate/a>/code>, code idthe-input-element:dom-input-valueasnumber-4>a href#dom-input-valueasnumber>valueAsNumber/a>/code>, and code idthe-input-element:dom-input-stepup-4>a href#dom-input-stepup>stepUp()/a>/code>./p> p>An code idthe-input-element:the-input-element-4>a href#the-input-element>input/a>/code> elements a href#concept-fe-dirty idthe-input-element:concept-fe-dirty>dirty value flag/a> must be set to true whenever the user interacts with the control in a way that changes the a href#concept-fe-value idthe-input-element:concept-fe-value-2>value/a>. (It is also set to true when the value is programmatically changed, as described in the definition of the code idthe-input-element:dom-input-value-4>a href#dom-input-value>value/a>/code> IDL attribute.)/p> p>The dfn idattr-input-value>code>value/code>/dfn> content attribute gives the default a href#concept-fe-value idthe-input-element:concept-fe-value-3>value/a> of the code idthe-input-element:the-input-element-5>a href#the-input-element>input/a>/code> element. When the code idthe-input-element:attr-input-value-2>a href#attr-input-value>value/a>/code> content attribute is added, set, or removed, if the controls a href#concept-fe-dirty idthe-input-element:concept-fe-dirty-2>dirty value flag/a> is false, the user agent must set the a href#concept-fe-value idthe-input-element:concept-fe-value-4>value/a> of the element to the value of the code idthe-input-element:attr-input-value-3>a href#attr-input-value>value/a>/code> content attribute, if there is one, or the empty string otherwise, and then run the current a href#value-sanitization-algorithm idthe-input-element:value-sanitization-algorithm>value sanitization algorithm/a>, if one is defined./p> p>Each code idthe-input-element:the-input-element-6>a href#the-input-element>input/a>/code> element has a a href#concept-fe-checked idthe-input-element:concept-fe-checked>checkedness/a>, which is exposed by the code idthe-input-element:dom-input-checked-4>a href#dom-input-checked>checked/a>/code> IDL attribute./p> p>Each code idthe-input-element:the-input-element-7>a href#the-input-element>input/a>/code> element has a boolean dfn idconcept-input-checked-dirty-flag>dirty checkedness flag/dfn>. When it is true, the element is said to have a dfn idconcept-input-checked-dirty>i>dirty checkedness/i>/dfn>. The a href#concept-input-checked-dirty-flag idthe-input-element:concept-input-checked-dirty-flag>dirty checkedness flag/a> must be initially set to false when the element is created, and must be set to true whenever the user interacts with the control in a way that changes the a href#concept-fe-checked idthe-input-element:concept-fe-checked-2>checkedness/a>./p> p>The dfn idattr-input-checked>code>checked/code>/dfn> content attribute is a a href#boolean-attribute idthe-input-element:boolean-attribute>boolean attribute/a> that gives the default a href#concept-fe-checked idthe-input-element:concept-fe-checked-3>checkedness/a> of the code idthe-input-element:the-input-element-8>a href#the-input-element>input/a>/code> element. When the code idthe-input-element:attr-input-checked-4>a href#attr-input-checked>checked/a>/code> content attribute is added, if the control does not have i idthe-input-element:concept-input-checked-dirty>a href#concept-input-checked-dirty>dirty checkedness/a>/i>, the user agent must set the a href#concept-fe-checked idthe-input-element:concept-fe-checked-4>checkedness/a> of the element to true; when the code idthe-input-element:attr-input-checked-5>a href#attr-input-checked>checked/a>/code> content attribute is removed, if the control does not have i idthe-input-element:concept-input-checked-dirty-2>a href#concept-input-checked-dirty>dirty checkedness/a>/i>, the user agent must set the a href#concept-fe-checked idthe-input-element:concept-fe-checked-5>checkedness/a> of the element to false./p> p>The a href#concept-form-reset-control idthe-input-element:concept-form-reset-control>reset algorithm/a> for code idthe-input-element:the-input-element-9>a href#the-input-element>input/a>/code> elements is to set the a href#concept-fe-dirty idthe-input-element:concept-fe-dirty-3>dirty value flag/a> and a href#concept-input-checked-dirty-flag idthe-input-element:concept-input-checked-dirty-flag-2>dirty checkedness flag/a> back to false, set the a href#concept-fe-value idthe-input-element:concept-fe-value-5>value/a> of the element to the value of the code idthe-input-element:attr-input-value-4>a href#attr-input-value>value/a>/code> content attribute, if there is one, or the empty string otherwise, set the a href#concept-fe-checked idthe-input-element:concept-fe-checked-6>checkedness/a> of the element to true if the element has a code idthe-input-element:attr-input-checked-6>a href#attr-input-checked>checked/a>/code> content attribute and false if it does not, empty the list of a href#concept-input-type-file-selected idthe-input-element:concept-input-type-file-selected>selected files/a>, and then invoke the a href#value-sanitization-algorithm idthe-input-element:value-sanitization-algorithm-2>value sanitization algorithm/a>, if the code idthe-input-element:attr-input-type-8>a href#attr-input-type>type/a>/code> attributes current state defines one./p> p>Each code idthe-input-element:the-input-element-10>a href#the-input-element>input/a>/code> element can be i idthe-input-element:concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i>. Except where otherwise specified, an code idthe-input-element:the-input-element-11>a href#the-input-element>input/a>/code> element is always i idthe-input-element:concept-fe-mutable-2>a href#concept-fe-mutable>mutable/a>/i>. Similarly, except where otherwise specified, the user agent should not allow the user to modify the elements a href#concept-fe-value idthe-input-element:concept-fe-value-6>value/a> or a href#concept-fe-checked idthe-input-element:concept-fe-checked-7>checkedness/a>./p> p>When an code idthe-input-element:the-input-element-12>a href#the-input-element>input/a>/code> element is a href#concept-fe-disabled idthe-input-element:concept-fe-disabled>disabled/a>, it is not i idthe-input-element:concept-fe-mutable-3>a href#concept-fe-mutable>mutable/a>/i>./p> p classnote>The code idthe-input-element:attr-input-readonly-4>a href#attr-input-readonly>readonly/a>/code> attribute can also in some cases (e.g. for the a href#date-state-(typedate) idthe-input-element:date-state-(typedate)-3>Date/a> state, but not the a href#checkbox-state-(typecheckbox) idthe-input-element:checkbox-state-(typecheckbox)-3>Checkbox/a> state) stop an code idthe-input-element:the-input-element-13>a href#the-input-element>input/a>/code> element from being i idthe-input-element:concept-fe-mutable-4>a href#concept-fe-mutable>mutable/a>/i>./p> p>The a hrefhttps://dom.spec.whatwg.org/#concept-node-clone-ext idthe-input-element:concept-node-clone-ext data-x-internalconcept-node-clone-ext>cloning steps/a> for code idthe-input-element:the-input-element-14>a href#the-input-element>input/a>/code> elements must propagate the a href#concept-fe-value idthe-input-element:concept-fe-value-7>value/a>, a href#concept-fe-dirty idthe-input-element:concept-fe-dirty-4>dirty value flag/a>, a href#concept-fe-checked idthe-input-element:concept-fe-checked-8>checkedness/a>, and a href#concept-input-checked-dirty-flag idthe-input-element:concept-input-checked-dirty-flag-3>dirty checkedness flag/a> from the node being cloned to the copy./p> p>The a idthe-input-element:activation-behaviour hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a> for code idthe-input-element:the-input-element-15>a href#the-input-element>input/a>/code> elements are these steps:/p> ol>li>p>If this element is not i idthe-input-element:concept-fe-mutable-5>a href#concept-fe-mutable>mutable/a>/i>, then abort these steps.li>p>Run this elements dfn idinput-activation-behavior>input activation behavior/dfn>, if any, and do nothing otherwise./ol> p>The a idthe-input-element:legacy-pre-activation-behavior hrefhttps://dom.spec.whatwg.org/#eventtarget-legacy-pre-activation-behavior data-x-internallegacy-pre-activation-behavior>legacy-pre-activation behavior/a> for code idthe-input-element:the-input-element-16>a href#the-input-element>input/a>/code> elements are these steps:/p> ol>li>p>If this element is not i idthe-input-element:concept-fe-mutable-6>a href#concept-fe-mutable>mutable/a>/i>, then abort these steps.li>p>If this elements code idthe-input-element:attr-input-type-9>a href#attr-input-type>type/a>/code> attribute is in the a href#checkbox-state-(typecheckbox) idthe-input-element:checkbox-state-(typecheckbox)-4>Checkbox state/a>, then set this elements a href#concept-fe-checked idthe-input-element:concept-fe-checked-9>checkedness/a> to its opposite value (i.e. true if it is false, false if it is true) and set this elements code idthe-input-element:dom-input-indeterminate-2>a href#dom-input-indeterminate>indeterminate/a>/code> IDL attribute to false.li>p>If this elements code idthe-input-element:attr-input-type-10>a href#attr-input-type>type/a>/code> attribute is in the a href#radio-button-state-(typeradio) idthe-input-element:radio-button-state-(typeradio)-3>Radio Button state/a>, then get a reference to the element in this elements a href#radio-button-group idthe-input-element:radio-button-group>radio button group/a> that has its a href#concept-fe-checked idthe-input-element:concept-fe-checked-10>checkedness/a> set to true, if any, and then set this elements a href#concept-fe-checked idthe-input-element:concept-fe-checked-11>checkedness/a> to true./ol> p>The a idthe-input-element:legacy-canceled-activation-behavior hrefhttps://dom.spec.whatwg.org/#eventtarget-legacy-canceled-activation-behavior data-x-internallegacy-canceled-activation-behavior>legacy-canceled-activation behavior/a> for code idthe-input-element:the-input-element-17>a href#the-input-element>input/a>/code> elements are these steps:/p> ol>li>p>If the element is not i idthe-input-element:concept-fe-mutable-7>a href#concept-fe-mutable>mutable/a>/i>, then abort these steps.li>p>If the elements code idthe-input-element:attr-input-type-11>a href#attr-input-type>type/a>/code> attribute is in the a href#checkbox-state-(typecheckbox) idthe-input-element:checkbox-state-(typecheckbox)-5>Checkbox state/a>, then set the elements a href#concept-fe-checked idthe-input-element:concept-fe-checked-12>checkedness/a> and the elements code idthe-input-element:dom-input-indeterminate-3>a href#dom-input-indeterminate>indeterminate/a>/code> IDL attribute back to the values they had before the a idthe-input-element:legacy-pre-activation-behavior-2 hrefhttps://dom.spec.whatwg.org/#eventtarget-legacy-pre-activation-behavior data-x-internallegacy-pre-activation-behavior>legacy-pre-activation behavior/a> was run.li>p>If this elements code idthe-input-element:attr-input-type-12>a href#attr-input-type>type/a>/code> attribute is in the a href#radio-button-state-(typeradio) idthe-input-element:radio-button-state-(typeradio)-4>Radio Button state/a>, then if the element to which a reference was obtained in the a idthe-input-element:legacy-pre-activation-behavior-3 hrefhttps://dom.spec.whatwg.org/#eventtarget-legacy-pre-activation-behavior data-x-internallegacy-pre-activation-behavior>legacy-pre-activation behavior/a>, if any, is still in what is now this elements a href#radio-button-group idthe-input-element:radio-button-group-2>radio button group/a>, if it still has one, and if so, setting that elements a href#concept-fe-checked idthe-input-element:concept-fe-checked-13>checkedness/a> to true; or else, if there was no such element, or that element is no longer in this elements a href#radio-button-group idthe-input-element:radio-button-group-3>radio button group/a>, or if this element no longer has a a href#radio-button-group idthe-input-element:radio-button-group-4>radio button group/a>, setting this elements a href#concept-fe-checked idthe-input-element:concept-fe-checked-14>checkedness/a> to false. /ol> hr> p>When an code idthe-input-element:the-input-element-18>a href#the-input-element>input/a>/code> element is first created, the elements rendering and behavior must be set to the rendering and behavior defined for the code idthe-input-element:attr-input-type-13>a href#attr-input-type>type/a>/code> attributes state, and the a href#value-sanitization-algorithm idthe-input-element:value-sanitization-algorithm-3>value sanitization algorithm/a>, if one is defined for the code idthe-input-element:attr-input-type-14>a href#attr-input-type>type/a>/code> attributes state, must be invoked./p> div idinput-type-change> p>When an code idthe-input-element:the-input-element-19>a href#the-input-element>input/a>/code> elements code idthe-input-element:attr-input-type-15>a href#attr-input-type>type/a>/code> attribute changes state, the user agent must run the following steps:/p> ol>li>p>If the previous state of the elements code idthe-input-element:attr-input-type-16>a href#attr-input-type>type/a>/code> attribute put the code idthe-input-element:dom-input-value-5>a href#dom-input-value>value/a>/code> IDL attribute in the i idthe-input-element:dom-input-value-value-10>a href#dom-input-value-value>value/a>/i> mode, and the elements a href#concept-fe-value idthe-input-element:concept-fe-value-8>value/a> is not the empty string, and the new state of the elements code idthe-input-element:attr-input-type-17>a href#attr-input-type>type/a>/code> attribute puts the code idthe-input-element:dom-input-value-6>a href#dom-input-value>value/a>/code> IDL attribute in either the i idthe-input-element:dom-input-value-default-5>a href#dom-input-value-default>default/a>/i> mode or the i idthe-input-element:dom-input-value-default-on-2>a href#dom-input-value-default-on>default/on/a>/i> mode, then set the elements code idthe-input-element:attr-input-value-5>a href#attr-input-value>value/a>/code> content attribute to the elements a href#concept-fe-value idthe-input-element:concept-fe-value-9>value/a>.li>p>Otherwise, if the previous state of the elements code idthe-input-element:attr-input-type-18>a href#attr-input-type>type/a>/code> attribute put the code idthe-input-element:dom-input-value-7>a href#dom-input-value>value/a>/code> IDL attribute in any mode other than the i idthe-input-element:dom-input-value-value-11>a href#dom-input-value-value>value/a>/i> mode, and the new state of the elements code idthe-input-element:attr-input-type-19>a href#attr-input-type>type/a>/code> attribute puts the code idthe-input-element:dom-input-value-8>a href#dom-input-value>value/a>/code> IDL attribute in the i idthe-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 idthe-input-element:concept-fe-value-10>value/a> of the element to the value of the code idthe-input-element:attr-input-value-6>a href#attr-input-value>value/a>/code> content attribute, if there is one, or the empty string otherwise, and then set the controls a href#concept-fe-dirty idthe-input-element:concept-fe-dirty-5>dirty value flag/a> to false.li>p>Otherwise, if the previous state of the elements code idthe-input-element:attr-input-type-20>a href#attr-input-type>type/a>/code> attribute put the code idthe-input-element:dom-input-value-9>a href#dom-input-value>value/a>/code> IDL attribute in any mode other than the i idthe-input-element:dom-input-value-filename-2>a href#dom-input-value-filename>filename/a>/i> mode, and the new state of the elements code idthe-input-element:attr-input-type-21>a href#attr-input-type>type/a>/code> attribute puts the code idthe-input-element:dom-input-value-10>a href#dom-input-value>value/a>/code> IDL attribute in the i idthe-input-element:dom-input-value-filename-3>a href#dom-input-value-filename>filename/a>/i> mode, then set the a href#concept-fe-value idthe-input-element:concept-fe-value-11>value/a> of the element to the empty string.li>p>Update the elements rendering and behavior to the new states.li>p>dfn idsignal-a-type-change>Signal a type change/dfn> for the element. (The a href#radio-button-state-(typeradio) idthe-input-element:radio-button-state-(typeradio)-5>Radio Button/a> state uses this, in particular.)li>p>Invoke the a href#value-sanitization-algorithm idthe-input-element:value-sanitization-algorithm-4>value sanitization algorithm/a>, if one is defined for the code idthe-input-element:attr-input-type-22>a href#attr-input-type>type/a>/code> attributes new state.li>p>Let var>previouslySelectable/var> be true if code idthe-input-element:dom-textarea/input-setrangetext-5>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code> previously a href#concept-input-apply idthe-input-element:concept-input-apply-2>applied/a> to the element, and false otherwise.li>p>Let var>nowSelectable/var> be true if code idthe-input-element:dom-textarea/input-setrangetext-6>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code> now a href#concept-input-apply idthe-input-element:concept-input-apply-3>applies/a> to the element, and false otherwise.li>p>If var>previouslySelectable/var> is false and var>nowSelectable/var> is true, set the elements text entry cursor position to the beginning of the text control, and a href#set-the-selection-direction idthe-input-element:set-the-selection-direction>set its selection direction/a> to code>none/code>./ol> /div> hr> p> The code idthe-input-element:attr-fe-name-2>a href#attr-fe-name>name/a>/code> attribute represents the elements name. The code idthe-input-element:attr-fe-dirname-4>a href#attr-fe-dirname>dirname/a>/code> attribute controls how the elements a href#the-directionality idthe-input-element:the-directionality-2>directionality/a> is submitted. The code idthe-input-element:attr-fe-disabled-2>a href#attr-fe-disabled>disabled/a>/code> attribute is used to make the control non-interactive and to prevent its value from being submitted. The code idthe-input-element:attr-fae-form-2>a href#attr-fae-form>form/a>/code> attribute is used to explicitly associate the code idthe-input-element:the-input-element-20>a href#the-input-element>input/a>/code> element with its a href#form-owner idthe-input-element:form-owner>form owner/a>. The code idthe-input-element:attr-fe-autofocus-2>a href#attr-fe-autofocus>autofocus/a>/code> attribute controls focus. The code idthe-input-element:attr-fe-inputmode-4>a href#attr-fe-inputmode>inputmode/a>/code> attribute controls the user interfaces input modality for the control. The code idthe-input-element:attr-fe-autocomplete-4>a href#attr-fe-autocomplete>autocomplete/a>/code> attribute controls how the user agent provides autofill behavior. /p> p>The dfn iddom-input-indeterminate>code>indeterminate/code>/dfn> IDL attribute must initially be set to false. On getting, it must return the last value it was set to. On setting, it must be set to the new value. It has no effect except for changing the appearance of a href#checkbox-state-(typecheckbox) idthe-input-element:checkbox-state-(typecheckbox)-6>checkbox/a> controls.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> indeterminate-checkboxspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>28+/span>/span>span classios_saf no>span>iOS Safari/span> span>None/span>/span>span classand_uc no>span>UC Browser for Android/span> span>None/span>/span>span classfirefox yes>span>Firefox/span> span>3.6+/span>/span>span classie yes>span>IE/span> span>6+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>6+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>4.4+/span>/span>span classopera yes>span>Opera/span> span>11.6+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featindeterminate-checkbox>caniuse.com/a>/div> p>The dfn iddom-input-accept>code>accept/code>/dfn>, dfn iddom-input-alt>code>alt/code>/dfn>, dfn iddom-input-max>code>max/code>/dfn>, dfn iddom-input-min>code>min/code>/dfn>, dfn iddom-input-multiple>code>multiple/code>/dfn>, dfn iddom-input-pattern>code>pattern/code>/dfn>, dfn iddom-input-placeholder>code>placeholder/code>/dfn>, dfn iddom-input-required>code>required/code>/dfn>, dfn iddom-input-size>code>size/code>/dfn>, dfn iddom-input-src>code>src/code>/dfn>, and dfn iddom-input-step>code>step/code>/dfn> IDL attributes must a href#reflect idthe-input-element:reflect>reflect/a> the respective content attributes of the same name. The dfn iddom-input-dirname>code>dirName/code>/dfn> IDL attribute must a href#reflect idthe-input-element:reflect-2>reflect/a> the code idthe-input-element:attr-fe-dirname-5>a href#attr-fe-dirname>dirname/a>/code> content attribute. The dfn iddom-input-readonly>code>readOnly/code>/dfn> IDL attribute must a href#reflect idthe-input-element:reflect-3>reflect/a> the code idthe-input-element:attr-input-readonly-5>a href#attr-input-readonly>readonly/a>/code> content attribute. The dfn iddom-input-defaultchecked>code>defaultChecked/code>/dfn> IDL attribute must a href#reflect idthe-input-element:reflect-4>reflect/a> the code idthe-input-element:attr-input-checked-7>a href#attr-input-checked>checked/a>/code> content attribute. The dfn iddom-input-defaultvalue>code>defaultValue/code>/dfn> IDL attribute must a href#reflect idthe-input-element:reflect-5>reflect/a> the code idthe-input-element:attr-input-value-7>a href#attr-input-value>value/a>/code> content attribute./p> p>The dfn iddom-input-type>code>type/code>/dfn> IDL attribute must a href#reflect idthe-input-element:reflect-6>reflect/a> the respective content attribute of the same name, a href#limited-to-only-known-values idthe-input-element:limited-to-only-known-values>limited to only known values/a>. The dfn iddom-input-inputmode>code>inputMode/code>/dfn> IDL attribute must a href#reflect idthe-input-element:reflect-7>reflect/a> the code idthe-input-element:attr-fe-inputmode-5>a href#attr-fe-inputmode>inputmode/a>/code> content attribute, a href#limited-to-only-known-values idthe-input-element:limited-to-only-known-values-2>limited to only known values/a>. The dfn iddom-input-maxlength>code>maxLength/code>/dfn> IDL attribute must a href#reflect idthe-input-element:reflect-8>reflect/a> the code idthe-input-element:attr-input-maxlength-4>a href#attr-input-maxlength>maxlength/a>/code> content attribute, a href#limited-to-only-non-negative-numbers idthe-input-element:limited-to-only-non-negative-numbers>limited to only non-negative numbers/a>. The dfn iddom-input-minlength>code>minLength/code>/dfn> IDL attribute must a href#reflect idthe-input-element:reflect-9>reflect/a> the code idthe-input-element:attr-input-minlength-4>a href#attr-input-minlength>minlength/a>/code> content attribute, a href#limited-to-only-non-negative-numbers idthe-input-element:limited-to-only-non-negative-numbers-2>limited to only non-negative numbers/a>./p> p>The IDL attributes dfn iddom-input-width>code>width/code>/dfn> and dfn iddom-input-height>code>height/code>/dfn> must return the rendered width and height of the image, in a hrefhttps://drafts.csswg.org/css-values/#px idthe-input-element:px data-x-internalpx>CSS pixels/a>, if an image is a href#being-rendered idthe-input-element:being-rendered>being rendered/a>, and is being rendered to a visual medium; or else the a hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic idthe-input-element:intrinsic-dimensions data-x-internalintrinsic-dimensions>intrinsic width and height/a> of the image, in a hrefhttps://drafts.csswg.org/css-values/#px idthe-input-element:px-2 data-x-internalpx>CSS pixels/a>, if an image is i idthe-input-element:input-img-available>a href#input-img-available>available/a>/i> but not being rendered to a visual medium; or else 0, if no image is i idthe-input-element:input-img-available-2>a href#input-img-available>available/a>/i>. When the code idthe-input-element:the-input-element-21>a href#the-input-element>input/a>/code> elements code idthe-input-element:attr-input-type-23>a href#attr-input-type>type/a>/code> attribute is not in the a href#image-button-state-(typeimage) idthe-input-element:image-button-state-(typeimage)-3>Image Button/a> state, then no image is i idthe-input-element:input-img-available-3>a href#input-img-available>available/a>/i>. a href#refsCSS>CSS/a>/p> p>On setting, they must act as if they a href#reflect idthe-input-element:reflect-10>reflected/a> the respective content attributes of the same name./p> p>The code idthe-input-element:dom-cva-willvalidate-2>a href#dom-cva-willvalidate>willValidate/a>/code>, code idthe-input-element:dom-cva-validity-2>a href#dom-cva-validity>validity/a>/code>, and code idthe-input-element:dom-cva-validationmessage-2>a href#dom-cva-validationmessage>validationMessage/a>/code> IDL attributes, and the code idthe-input-element:dom-cva-checkvalidity-2>a href#dom-cva-checkvalidity>checkValidity()/a>/code>, code idthe-input-element:dom-cva-reportvalidity-2>a href#dom-cva-reportvalidity>reportValidity()/a>/code>, and code idthe-input-element:dom-cva-setcustomvalidity-2>a href#dom-cva-setcustomvalidity>setCustomValidity()/a>/code> methods, are part of the a href#the-constraint-validation-api idthe-input-element:the-constraint-validation-api>constraint validation API/a>. The code idthe-input-element:dom-lfe-labels-2>a href#dom-lfe-labels>labels/a>/code> IDL attribute provides a list of the elements code idthe-input-element:the-label-element>a href#the-label-element>label/a>/code>s. The code idthe-input-element:dom-textarea/input-select-5>a href#dom-textarea/input-select>select()/a>/code>, code idthe-input-element:dom-textarea/input-selectionstart-4>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idthe-input-element:dom-textarea/input-selectionend-4>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code idthe-input-element:dom-textarea/input-selectiondirection-4>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, code idthe-input-element:dom-textarea/input-setrangetext-7>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, and code idthe-input-element:dom-textarea/input-setselectionrange-4>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code> methods and IDL attributes expose the elements text selection. The code idthe-input-element:dom-fe-autofocus-2>a href#dom-fe-autofocus>autofocus/a>/code>, code idthe-input-element:dom-fe-disabled-2>a href#dom-fe-disabled>disabled/a>/code>, code idthe-input-element:dom-fae-form-2>a href#dom-fae-form>form/a>/code>, and code idthe-input-element:dom-fe-name-2>a href#dom-fe-name>name/a>/code> IDL attributes are part of the elements forms API./p> h5 idstates-of-the-type-attribute>span classsecno>4.10.5.1/span> States of the code idstates-of-the-type-attribute:attr-input-type>a href#attr-input-type>type/a>/code> attributea href#states-of-the-type-attribute classself-link>/a>/h5> h6 idhidden-state-(typehidden)>span classsecno>4.10.5.1.1/span> dfn>Hidden/dfn> state (code>typehidden/code>)a href#hidden-state-(typehidden) classself-link>/a>/h6> p>When an code idhidden-state-(typehidden):the-input-element>a href#the-input-element>input/a>/code> elements code idhidden-state-(typehidden):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#hidden-state-(typehidden) idhidden-state-(typehidden):hidden-state-(typehidden)>Hidden/a> state, the rules in this section apply./p> p>The code idhidden-state-(typehidden):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idhidden-state-(typehidden):represents>represents/a> a value that is not intended to be examined or manipulated by the user./p> p>strong>Constraint validation/strong>: If an code idhidden-state-(typehidden):the-input-element-3>a href#the-input-element>input/a>/code> elements code idhidden-state-(typehidden):attr-input-type-2>a href#attr-input-type>type/a>/code> attribute is in the a href#hidden-state-(typehidden) idhidden-state-(typehidden):hidden-state-(typehidden)-2>Hidden/a> state, it is a href#barred-from-constraint-validation idhidden-state-(typehidden):barred-from-constraint-validation>barred from constraint validation/a>./p> p>If the code idhidden-state-(typehidden):attr-fe-name>a href#attr-fe-name>name/a>/code> attribute is present and has a value that is a a href#case-sensitive idhidden-state-(typehidden):case-sensitive>case-sensitive/a> match for the string code idhidden-state-(typehidden):attr-fe-name-charset>a href#attr-fe-name-charset>_charset_/a>/code>, then the elements code idhidden-state-(typehidden):attr-input-value>a href#attr-input-value>value/a>/code> attribute must be omitted./p> div classbookkeeping> p>The code idhidden-state-(typehidden):attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code> content attribute a href#concept-input-apply idhidden-state-(typehidden):concept-input-apply>applies/a> to this element./p> p>The code idhidden-state-(typehidden):dom-input-value>a href#dom-input-value>value/a>/code> IDL attribute a href#concept-input-apply idhidden-state-(typehidden):concept-input-apply-2>applies/a> to this element and is in mode a href#dom-input-value-default idhidden-state-(typehidden):dom-input-value-default>default/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idhidden-state-(typehidden):do-not-apply>do not apply/a> to the element: code idhidden-state-(typehidden):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code idhidden-state-(typehidden):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code idhidden-state-(typehidden):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code idhidden-state-(typehidden):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code idhidden-state-(typehidden):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code idhidden-state-(typehidden):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code idhidden-state-(typehidden):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code idhidden-state-(typehidden):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idhidden-state-(typehidden):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code idhidden-state-(typehidden):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code idhidden-state-(typehidden):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code idhidden-state-(typehidden):attr-input-list classno-backref>a href#attr-input-list>list/a>/code>, code idhidden-state-(typehidden):attr-input-max classno-backref>a href#attr-input-max>max/a>/code>, code idhidden-state-(typehidden):attr-input-maxlength classno-backref>a href#attr-input-maxlength>maxlength/a>/code>, code idhidden-state-(typehidden):attr-input-min classno-backref>a href#attr-input-min>min/a>/code>, code idhidden-state-(typehidden):attr-input-minlength classno-backref>a href#attr-input-minlength>minlength/a>/code>, code idhidden-state-(typehidden):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code idhidden-state-(typehidden):attr-input-pattern classno-backref>a href#attr-input-pattern>pattern/a>/code>, code idhidden-state-(typehidden):attr-input-placeholder classno-backref>a href#attr-input-placeholder>placeholder/a>/code>, code idhidden-state-(typehidden):attr-input-readonly classno-backref>a href#attr-input-readonly>readonly/a>/code>, code idhidden-state-(typehidden):attr-input-required classno-backref>a href#attr-input-required>required/a>/code>, code idhidden-state-(typehidden):attr-input-size classno-backref>a href#attr-input-size>size/a>/code>, code idhidden-state-(typehidden):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, code idhidden-state-(typehidden):attr-input-step classno-backref>a href#attr-input-step>step/a>/code>, and code idhidden-state-(typehidden):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply idhidden-state-(typehidden):do-not-apply-2>do not apply/a> to the element: code idhidden-state-(typehidden):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code idhidden-state-(typehidden):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code idhidden-state-(typehidden):dom-input-list classno-backref>a href#dom-input-list>list/a>/code>, code idhidden-state-(typehidden):dom-textarea/input-selectionstart classno-backref>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idhidden-state-(typehidden):dom-textarea/input-selectionend classno-backref>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code idhidden-state-(typehidden):dom-textarea/input-selectiondirection classno-backref>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, code idhidden-state-(typehidden):dom-input-valueasdate classno-backref>a href#dom-input-valueasdate>valueAsDate/a>/code>, and code idhidden-state-(typehidden):dom-input-valueasnumber classno-backref>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idhidden-state-(typehidden):dom-textarea/input-select classno-backref>a href#dom-textarea/input-select>select()/a>/code>, code idhidden-state-(typehidden):dom-textarea/input-setrangetext classno-backref>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, code idhidden-state-(typehidden):dom-textarea/input-setselectionrange classno-backref>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code>, code idhidden-state-(typehidden):dom-input-stepdown classno-backref>a href#dom-input-stepdown>stepDown()/a>/code>, and code idhidden-state-(typehidden):dom-input-stepup classno-backref>a href#dom-input-stepup>stepUp()/a>/code> methods./p> p>The code idhidden-state-(typehidden):event-input classno-backref>a href#event-input>input/a>/code> and code idhidden-state-(typehidden):event-change classno-backref>a href#event-change>change/a>/code> events a href#do-not-apply idhidden-state-(typehidden):do-not-apply-3>do not apply/a>./p> /div> h6 idtext-(typetext)-state-and-search-state-(typesearch)>span classsecno>4.10.5.1.2/span> dfn>Text/dfn> (code>typetext/code>) state and dfn>Search/dfn> state (code>typesearch/code>)a href#text-(typetext)-state-and-search-state-(typesearch) classself-link>/a>/h6>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> input-searchspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>15+/span>/span>span classios_saf yes>span>iOS Safari/span> span>5.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>4+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>5.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.3+/span>/span>span classopera yes>span>Opera/span> span>11.6+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featinput-search>caniuse.com/a>/div> p>When an code idtext-(typetext)-state-and-search-state-(typesearch):the-input-element>a href#the-input-element>input/a>/code> elements code idtext-(typetext)-state-and-search-state-(typesearch):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#text-(typetext)-state-and-search-state-(typesearch) idtext-(typetext)-state-and-search-state-(typesearch):text-(typetext)-state-and-search-state-(typesearch)>Text/a> state or the a href#text-(typetext)-state-and-search-state-(typesearch) idtext-(typetext)-state-and-search-state-(typesearch):text-(typetext)-state-and-search-state-(typesearch)-2>Search/a> state, the rules in this section apply./p> p>The code idtext-(typetext)-state-and-search-state-(typesearch):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idtext-(typetext)-state-and-search-state-(typesearch):represents>represents/a> a one line plain text edit control for the elements a href#concept-fe-value idtext-(typetext)-state-and-search-state-(typesearch):concept-fe-value>value/a>./p> p classnote>The difference between the a href#text-(typetext)-state-and-search-state-(typesearch) idtext-(typetext)-state-and-search-state-(typesearch):text-(typetext)-state-and-search-state-(typesearch)-3>Text/a> state and the a href#text-(typetext)-state-and-search-state-(typesearch) idtext-(typetext)-state-and-search-state-(typesearch):text-(typetext)-state-and-search-state-(typesearch)-4>Search/a> state is primarily stylistic: on platforms where search controls are distinguished from regular text controls, the a href#text-(typetext)-state-and-search-state-(typesearch) idtext-(typetext)-state-and-search-state-(typesearch):text-(typetext)-state-and-search-state-(typesearch)-5>Search/a> state might result in an appearance consistent with the platforms search controls rather than appearing like a regular text control./p> p>If the element is i idtext-(typetext)-state-and-search-state-(typesearch):concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i>, its a href#concept-fe-value idtext-(typetext)-state-and-search-state-(typesearch):concept-fe-value-2>value/a> should be editable by the user. User agents must not allow users to insert U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters into the elements a href#concept-fe-value idtext-(typetext)-state-and-search-state-(typesearch):concept-fe-value-3>value/a>./p> p>If the element is i idtext-(typetext)-state-and-search-state-(typesearch):concept-fe-mutable-2>a href#concept-fe-mutable>mutable/a>/i>, the user agent should allow the user to change the writing direction of the element, setting it either to a left-to-right writing direction or a right-to-left writing direction. If the user does so, the user agent must then run the following steps:/p> ol>li>p>Set the elements code idtext-(typetext)-state-and-search-state-(typesearch):the-dir-attribute>a href#the-dir-attribute>dir/a>/code> attribute to code idtext-(typetext)-state-and-search-state-(typesearch):attr-dir-ltr>a href#attr-dir-ltr>ltr/a>/code> if the user selected a left-to-right writing direction, and code idtext-(typetext)-state-and-search-state-(typesearch):attr-dir-rtl>a href#attr-dir-rtl>rtl/a>/code> if the user selected a right-to-left writing direction.li>p>a href#queue-a-task idtext-(typetext)-state-and-search-state-(typesearch):queue-a-task>Queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idtext-(typetext)-state-and-search-state-(typesearch):concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idtext-(typetext)-state-and-search-state-(typesearch):event-input>a href#event-input>input/a>/code> at the code idtext-(typetext)-state-and-search-state-(typesearch):the-input-element-3>a href#the-input-element>input/a>/code> element, with the code idtext-(typetext)-state-and-search-state-(typesearch):dom-event-bubbles>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true./ol> p>The code idtext-(typetext)-state-and-search-state-(typesearch):attr-input-value>a href#attr-input-value>value/a>/code> attribute, if specified, must have a value that contains no U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters./p> p>strong>The a href#value-sanitization-algorithm idtext-(typetext)-state-and-search-state-(typesearch):value-sanitization-algorithm>value sanitization algorithm/a> is as follows/strong>: a idtext-(typetext)-state-and-search-state-(typesearch):strip-newlines hrefhttps://infra.spec.whatwg.org/#strip-newlines data-x-internalstrip-newlines>Strip newlines/a> from the a href#concept-fe-value idtext-(typetext)-state-and-search-state-(typesearch):concept-fe-value-4>value/a>./p> div classbookkeeping> p>The following common code idtext-(typetext)-state-and-search-state-(typesearch):the-input-element-4>a href#the-input-element>input/a>/code> element content attributes, IDL attributes, and methods a href#concept-input-apply idtext-(typetext)-state-and-search-state-(typesearch):concept-input-apply>apply/a> to the element: code idtext-(typetext)-state-and-search-state-(typesearch):attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-fe-dirname>a href#attr-fe-dirname>dirname/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-fe-inputmode>a href#attr-fe-inputmode>inputmode/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-input-list>a href#attr-input-list>list/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-input-maxlength>a href#attr-input-maxlength>maxlength/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-input-minlength>a href#attr-input-minlength>minlength/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-input-pattern>a href#attr-input-pattern>pattern/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-input-placeholder>a href#attr-input-placeholder>placeholder/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-input-readonly>a href#attr-input-readonly>readonly/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-input-required>a href#attr-input-required>required/a>/code>, and code idtext-(typetext)-state-and-search-state-(typesearch):attr-input-size>a href#attr-input-size>size/a>/code> content attributes; code idtext-(typetext)-state-and-search-state-(typesearch):dom-input-list>a href#dom-input-list>list/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):dom-textarea/input-selectionstart>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):dom-textarea/input-selectionend>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):dom-textarea/input-selectiondirection>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, and code idtext-(typetext)-state-and-search-state-(typesearch):dom-input-value>a href#dom-input-value>value/a>/code> IDL attributes; code idtext-(typetext)-state-and-search-state-(typesearch):dom-textarea/input-select>a href#dom-textarea/input-select>select()/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):dom-textarea/input-setrangetext>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, and code idtext-(typetext)-state-and-search-state-(typesearch):dom-textarea/input-setselectionrange>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code> methods./p> p>The code idtext-(typetext)-state-and-search-state-(typesearch):dom-input-value-2>a href#dom-input-value>value/a>/code> IDL attribute is in mode a href#dom-input-value-value idtext-(typetext)-state-and-search-state-(typesearch):dom-input-value-value>value/a>./p> p>The code idtext-(typetext)-state-and-search-state-(typesearch):event-input-2>a href#event-input>input/a>/code> and code idtext-(typetext)-state-and-search-state-(typesearch):event-change>a href#event-change>change/a>/code> events a href#concept-input-apply idtext-(typetext)-state-and-search-state-(typesearch):concept-input-apply-2>apply/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idtext-(typetext)-state-and-search-state-(typesearch):do-not-apply>do not apply/a> to the element: code idtext-(typetext)-state-and-search-state-(typesearch):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-input-max classno-backref>a href#attr-input-max>max/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-input-min classno-backref>a href#attr-input-min>min/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):attr-input-step classno-backref>a href#attr-input-step>step/a>/code>, and code idtext-(typetext)-state-and-search-state-(typesearch):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply idtext-(typetext)-state-and-search-state-(typesearch):do-not-apply-2>do not apply/a> to the element: code idtext-(typetext)-state-and-search-state-(typesearch):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code idtext-(typetext)-state-and-search-state-(typesearch):dom-input-valueasdate classno-backref>a href#dom-input-valueasdate>valueAsDate/a>/code>, and code idtext-(typetext)-state-and-search-state-(typesearch):dom-input-valueasnumber classno-backref>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idtext-(typetext)-state-and-search-state-(typesearch):dom-input-stepdown classno-backref>a href#dom-input-stepdown>stepDown()/a>/code> and code idtext-(typetext)-state-and-search-state-(typesearch):dom-input-stepup classno-backref>a href#dom-input-stepup>stepUp()/a>/code> methods./p> /div> h6 idtelephone-state-(typetel)>span classsecno>4.10.5.1.3/span> dfn>Telephone/dfn> state (code>typetel/code>)a href#telephone-state-(typetel) classself-link>/a>/h6>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> input-email-tel-urlspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>5+/span>/span>span classios_saf yes>span>iOS Safari/span> span>3.2+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>4+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>5+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>3+/span>/span>span classopera yes>span>Opera/span> span>9.5+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featinput-email-tel-url>caniuse.com/a>/div> p>When an code idtelephone-state-(typetel):the-input-element>a href#the-input-element>input/a>/code> elements code idtelephone-state-(typetel):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#telephone-state-(typetel) idtelephone-state-(typetel):telephone-state-(typetel)>Telephone/a> state, the rules in this section apply./p> p>The code idtelephone-state-(typetel):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idtelephone-state-(typetel):represents>represents/a> a control for editing a telephone number given in the elements a href#concept-fe-value idtelephone-state-(typetel):concept-fe-value>value/a>./p> p>If the element is i idtelephone-state-(typetel):concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i>, its a href#concept-fe-value idtelephone-state-(typetel):concept-fe-value-2>value/a> should be editable by the user. User agents may change the spacing and, with care, the punctuation of a href#concept-fe-value idtelephone-state-(typetel):concept-fe-value-3>values/a> that the user enters. User agents must not allow users to insert U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters into the elements a href#concept-fe-value idtelephone-state-(typetel):concept-fe-value-4>value/a>./p> p>The code idtelephone-state-(typetel):attr-input-value>a href#attr-input-value>value/a>/code> attribute, if specified, must have a value that contains no U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters./p> p>strong>The a href#value-sanitization-algorithm idtelephone-state-(typetel):value-sanitization-algorithm>value sanitization algorithm/a> is as follows/strong>: a idtelephone-state-(typetel):strip-newlines hrefhttps://infra.spec.whatwg.org/#strip-newlines data-x-internalstrip-newlines>Strip newlines/a> from the a href#concept-fe-value idtelephone-state-(typetel):concept-fe-value-5>value/a>./p> p classnote>Unlike the a href#url-state-(typeurl) idtelephone-state-(typetel):url-state-(typeurl)>URL/a> and a href#e-mail-state-(typeemail) idtelephone-state-(typetel):e-mail-state-(typeemail)>E-mail/a> types, the a href#telephone-state-(typetel) idtelephone-state-(typetel):telephone-state-(typetel)-2>Telephone/a> type does not enforce a particular syntax. This is intentional; in practice, telephone number fields tend to be free-form fields, because there are a wide variety of valid phone numbers. Systems that need to enforce a particular format are encouraged to use the code idtelephone-state-(typetel):attr-input-pattern>a href#attr-input-pattern>pattern/a>/code> attribute or the code idtelephone-state-(typetel):dom-cva-setcustomvalidity>a href#dom-cva-setcustomvalidity>setCustomValidity()/a>/code> method to hook into the client-side validation mechanism./p> div classbookkeeping> p>The following common code idtelephone-state-(typetel):the-input-element-3>a href#the-input-element>input/a>/code> element content attributes, IDL attributes, and methods a href#concept-input-apply idtelephone-state-(typetel):concept-input-apply>apply/a> to the element: code idtelephone-state-(typetel):attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code>, code idtelephone-state-(typetel):attr-input-list>a href#attr-input-list>list/a>/code>, code idtelephone-state-(typetel):attr-input-maxlength>a href#attr-input-maxlength>maxlength/a>/code>, code idtelephone-state-(typetel):attr-input-minlength>a href#attr-input-minlength>minlength/a>/code>, code idtelephone-state-(typetel):attr-input-pattern-2>a href#attr-input-pattern>pattern/a>/code>, code idtelephone-state-(typetel):attr-input-placeholder>a href#attr-input-placeholder>placeholder/a>/code>, code idtelephone-state-(typetel):attr-input-readonly>a href#attr-input-readonly>readonly/a>/code>, code idtelephone-state-(typetel):attr-input-required>a href#attr-input-required>required/a>/code>, and code idtelephone-state-(typetel):attr-input-size>a href#attr-input-size>size/a>/code> content attributes; code idtelephone-state-(typetel):dom-input-list>a href#dom-input-list>list/a>/code>, code idtelephone-state-(typetel):dom-textarea/input-selectionstart>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idtelephone-state-(typetel):dom-textarea/input-selectionend>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code idtelephone-state-(typetel):dom-textarea/input-selectiondirection>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, and code idtelephone-state-(typetel):dom-input-value>a href#dom-input-value>value/a>/code> IDL attributes; code idtelephone-state-(typetel):dom-textarea/input-select>a href#dom-textarea/input-select>select()/a>/code>, code idtelephone-state-(typetel):dom-textarea/input-setrangetext>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, and code idtelephone-state-(typetel):dom-textarea/input-setselectionrange>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code> methods./p> p>The code idtelephone-state-(typetel):dom-input-value-2>a href#dom-input-value>value/a>/code> IDL attribute is in mode a href#dom-input-value-value idtelephone-state-(typetel):dom-input-value-value>value/a>./p> p>The code idtelephone-state-(typetel):event-input>a href#event-input>input/a>/code> and code idtelephone-state-(typetel):event-change>a href#event-change>change/a>/code> events a href#concept-input-apply idtelephone-state-(typetel):concept-input-apply-2>apply/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idtelephone-state-(typetel):do-not-apply>do not apply/a> to the element: code idtelephone-state-(typetel):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code idtelephone-state-(typetel):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code idtelephone-state-(typetel):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code idtelephone-state-(typetel):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code idtelephone-state-(typetel):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code idtelephone-state-(typetel):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code idtelephone-state-(typetel):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code idtelephone-state-(typetel):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idtelephone-state-(typetel):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code idtelephone-state-(typetel):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code idtelephone-state-(typetel):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code idtelephone-state-(typetel):attr-input-max classno-backref>a href#attr-input-max>max/a>/code>, code idtelephone-state-(typetel):attr-input-min classno-backref>a href#attr-input-min>min/a>/code>, code idtelephone-state-(typetel):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code idtelephone-state-(typetel):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, code idtelephone-state-(typetel):attr-input-step classno-backref>a href#attr-input-step>step/a>/code>, and code idtelephone-state-(typetel):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply idtelephone-state-(typetel):do-not-apply-2>do not apply/a> to the element: code idtelephone-state-(typetel):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code idtelephone-state-(typetel):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code idtelephone-state-(typetel):dom-input-valueasdate classno-backref>a href#dom-input-valueasdate>valueAsDate/a>/code>, and code idtelephone-state-(typetel):dom-input-valueasnumber classno-backref>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idtelephone-state-(typetel):dom-input-stepdown classno-backref>a href#dom-input-stepdown>stepDown()/a>/code> and code idtelephone-state-(typetel):dom-input-stepup classno-backref>a href#dom-input-stepup>stepUp()/a>/code> methods./p> /div> h6 idurl-state-(typeurl)>span classsecno>4.10.5.1.4/span> dfn>URL/dfn> state (code>typeurl/code>)a href#url-state-(typeurl) classself-link>/a>/h6> p>When an code idurl-state-(typeurl):the-input-element>a href#the-input-element>input/a>/code> elements code idurl-state-(typeurl):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#url-state-(typeurl) idurl-state-(typeurl):url-state-(typeurl)>URL/a> state, the rules in this section apply./p> p>The code idurl-state-(typeurl):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idurl-state-(typeurl):represents>represents/a> a control for editing a single a idurl-state-(typeurl):absolute-url hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a> given in the elements a href#concept-fe-value idurl-state-(typeurl):concept-fe-value>value/a>./p> p>If the element is i idurl-state-(typeurl):concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i>, the user agent should allow the user to change the URL represented by its a href#concept-fe-value idurl-state-(typeurl):concept-fe-value-2>value/a>. User agents may allow the user to set the a href#concept-fe-value idurl-state-(typeurl):concept-fe-value-3>value/a> to a string that is not a a hrefhttps://url.spec.whatwg.org/#valid-url-string idurl-state-(typeurl):valid-url-string data-x-internalvalid-url-string>valid/a> a idurl-state-(typeurl):absolute-url-2 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>, but may also or instead automatically escape characters entered by the user so that the a href#concept-fe-value idurl-state-(typeurl):concept-fe-value-4>value/a> is always a a hrefhttps://url.spec.whatwg.org/#valid-url-string idurl-state-(typeurl):valid-url-string-2 data-x-internalvalid-url-string>valid/a> a idurl-state-(typeurl):absolute-url-3 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a> (even if that isnt the actual value seen and edited by the user in the interface). User agents should allow the user to set the a href#concept-fe-value idurl-state-(typeurl):concept-fe-value-5>value/a> to the empty string. User agents must not allow users to insert U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters into the a href#concept-fe-value idurl-state-(typeurl):concept-fe-value-6>value/a>./p> p>The code idurl-state-(typeurl):attr-input-value>a href#attr-input-value>value/a>/code> attribute, if specified and not empty, must have a value that is a a href#valid-url-potentially-surrounded-by-spaces idurl-state-(typeurl):valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by spaces/a> that is also an a idurl-state-(typeurl):absolute-url-4 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>./p> p>strong>The a href#value-sanitization-algorithm idurl-state-(typeurl):value-sanitization-algorithm>value sanitization algorithm/a> is as follows/strong>: a idurl-state-(typeurl):strip-newlines hrefhttps://infra.spec.whatwg.org/#strip-newlines data-x-internalstrip-newlines>Strip newlines/a> from the a href#concept-fe-value idurl-state-(typeurl):concept-fe-value-7>value/a>, then a idurl-state-(typeurl):strip-leading-and-trailing-ascii-whitespace hrefhttps://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace data-x-internalstrip-leading-and-trailing-ascii-whitespace>strip leading and trailing ASCII whitespace/a> from the a href#concept-fe-value idurl-state-(typeurl):concept-fe-value-8>value/a>./p> p>strong>Constraint validation/strong>: While the a href#concept-fe-value idurl-state-(typeurl):concept-fe-value-9>value/a> of the element is neither the empty string nor a a hrefhttps://url.spec.whatwg.org/#valid-url-string idurl-state-(typeurl):valid-url-string-3 data-x-internalvalid-url-string>valid/a> a idurl-state-(typeurl):absolute-url-5 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>, the element is a href#suffering-from-a-type-mismatch idurl-state-(typeurl):suffering-from-a-type-mismatch>suffering from a type mismatch/a>./p> div classbookkeeping> p>The following common code idurl-state-(typeurl):the-input-element-3>a href#the-input-element>input/a>/code> element content attributes, IDL attributes, and methods a href#concept-input-apply idurl-state-(typeurl):concept-input-apply>apply/a> to the element: code idurl-state-(typeurl):attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code>, code idurl-state-(typeurl):attr-input-list>a href#attr-input-list>list/a>/code>, code idurl-state-(typeurl):attr-input-maxlength>a href#attr-input-maxlength>maxlength/a>/code>, code idurl-state-(typeurl):attr-input-minlength>a href#attr-input-minlength>minlength/a>/code>, code idurl-state-(typeurl):attr-input-pattern>a href#attr-input-pattern>pattern/a>/code>, code idurl-state-(typeurl):attr-input-placeholder>a href#attr-input-placeholder>placeholder/a>/code>, code idurl-state-(typeurl):attr-input-readonly>a href#attr-input-readonly>readonly/a>/code>, code idurl-state-(typeurl):attr-input-required>a href#attr-input-required>required/a>/code>, and code idurl-state-(typeurl):attr-input-size>a href#attr-input-size>size/a>/code> content attributes; code idurl-state-(typeurl):dom-input-list>a href#dom-input-list>list/a>/code>, code idurl-state-(typeurl):dom-textarea/input-selectionstart>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idurl-state-(typeurl):dom-textarea/input-selectionend>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code idurl-state-(typeurl):dom-textarea/input-selectiondirection>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, and code idurl-state-(typeurl):dom-input-value>a href#dom-input-value>value/a>/code> IDL attributes; code idurl-state-(typeurl):dom-textarea/input-select>a href#dom-textarea/input-select>select()/a>/code>, code idurl-state-(typeurl):dom-textarea/input-setrangetext>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, and code idurl-state-(typeurl):dom-textarea/input-setselectionrange>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code> methods./p> p>The code idurl-state-(typeurl):dom-input-value-2>a href#dom-input-value>value/a>/code> IDL attribute is in mode a href#dom-input-value-value idurl-state-(typeurl):dom-input-value-value>value/a>./p> p>The code idurl-state-(typeurl):event-input>a href#event-input>input/a>/code> and code idurl-state-(typeurl):event-change>a href#event-change>change/a>/code> events a href#concept-input-apply idurl-state-(typeurl):concept-input-apply-2>apply/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idurl-state-(typeurl):do-not-apply>do not apply/a> to the element: code idurl-state-(typeurl):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code idurl-state-(typeurl):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code idurl-state-(typeurl):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code idurl-state-(typeurl):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code idurl-state-(typeurl):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code idurl-state-(typeurl):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code idurl-state-(typeurl):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code idurl-state-(typeurl):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idurl-state-(typeurl):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code idurl-state-(typeurl):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code idurl-state-(typeurl):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code idurl-state-(typeurl):attr-input-max classno-backref>a href#attr-input-max>max/a>/code>, code idurl-state-(typeurl):attr-input-min classno-backref>a href#attr-input-min>min/a>/code>, code idurl-state-(typeurl):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code idurl-state-(typeurl):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, code idurl-state-(typeurl):attr-input-step classno-backref>a href#attr-input-step>step/a>/code>, and code idurl-state-(typeurl):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply idurl-state-(typeurl):do-not-apply-2>do not apply/a> to the element: code idurl-state-(typeurl):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code idurl-state-(typeurl):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code idurl-state-(typeurl):dom-input-valueasdate classno-backref>a href#dom-input-valueasdate>valueAsDate/a>/code>, and code idurl-state-(typeurl):dom-input-valueasnumber classno-backref>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idurl-state-(typeurl):dom-input-stepdown classno-backref>a href#dom-input-stepdown>stepDown()/a>/code> and code idurl-state-(typeurl):dom-input-stepup classno-backref>a href#dom-input-stepup>stepUp()/a>/code> methods./p> /div> div classexample> p>If a document contained the following markup:/p> pre><input typeurl namelocation listurls><datalist idurls> <option labelMIME: Format of Internet Message Bodies valuehttps://tools.ietf.org/html/rfc2045> <option labelHTML valuehttps://html.spec.whatwg.org/> <option labelDOM valuehttps://dom.spec.whatwg.org/> <option labelFullscreen valuehttps://fullscreen.spec.whatwg.org/> <option labelMedia Session valuehttps://mediasession.spec.whatwg.org/> <option labelThe Single UNIX Specification, Version 3 valuehttp://www.unix.org/version3/></datalist>/pre> p>...and the user had typed kbd>spec.w/kbd>, and the user agent had also found that the user had visited code>https://url.spec.whatwg.org/#url-parsing/code> and code>https://streams.spec.whatwg.org//code> in the recent past, then the rendering might look like this:/p> p>img src/images/sample-url.svg width480 altA text box with an icon on the left followed by the text "spec.w" 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. height150>/p> p>The first four URLs in this sample consist of the four URLs in the author-specified list that match the text the user has entered, sorted in some UA-defined manner (maybe by how frequently the user refers to those URLs). Note how the UA is using the knowledge that the values are URLs to allow the user to omit the scheme part and perform intelligent matching on the domain name./p> p>The last two URLs (and probably many more, given the scrollbars indications of more values being available) are the matches from the user agents session history data. This data is not made available to the page DOM. In this particular case, the UA has no titles to provide for those values./p> /div> h6 ide-mail-state-(typeemail)>span classsecno>4.10.5.1.5/span> dfn>E-mail/dfn> state (code>typeemail/code>)a href#e-mail-state-(typeemail) classself-link>/a>/h6>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id15489 titleforms: input typeemail> validation needs to be updated for EAI>15489/a>/div> p>When an code ide-mail-state-(typeemail):the-input-element>a href#the-input-element>input/a>/code> elements code ide-mail-state-(typeemail):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#e-mail-state-(typeemail) ide-mail-state-(typeemail):e-mail-state-(typeemail)>E-mail/a> state, the rules in this section apply./p> p>How the a href#e-mail-state-(typeemail) ide-mail-state-(typeemail):e-mail-state-(typeemail)-2>E-mail/a> state operates depends on whether the code ide-mail-state-(typeemail):attr-input-multiple>a href#attr-input-multiple>multiple/a>/code> attribute is specified or not./p> dl classswitch>dt>When the code ide-mail-state-(typeemail):attr-input-multiple-2>a href#attr-input-multiple>multiple/a>/code> attribute is not specified on the elementdd> p>The code ide-mail-state-(typeemail):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents ide-mail-state-(typeemail):represents>represents/a> a control for editing an e-mail address given in the elements a href#concept-fe-value ide-mail-state-(typeemail):concept-fe-value>value/a>./p> p>If the element is i ide-mail-state-(typeemail):concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i>, the user agent should allow the user to change the e-mail address represented by its a href#concept-fe-value ide-mail-state-(typeemail):concept-fe-value-2>value/a>. User agents may allow the user to set the a href#concept-fe-value ide-mail-state-(typeemail):concept-fe-value-3>value/a> to a string that is not a a href#valid-e-mail-address ide-mail-state-(typeemail):valid-e-mail-address>valid e-mail address/a>. The user agent should act in a manner consistent with expecting the user to provide a single e-mail address. User agents should allow the user to set the a href#concept-fe-value ide-mail-state-(typeemail):concept-fe-value-4>value/a> to the empty string. User agents must not allow users to insert U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters into the a href#concept-fe-value ide-mail-state-(typeemail):concept-fe-value-5>value/a>. User agents may transform the a href#concept-fe-value ide-mail-state-(typeemail):concept-fe-value-6>value/a> for display and editing; in particular, user agents should convert punycode in the domain labels of the a href#concept-fe-value ide-mail-state-(typeemail):concept-fe-value-7>value/a> to IDN in the display and vice versa./p> p>strong>Constraint validation/strong>: While the user interface is representing input that the user agent cannot convert to punycode, the control is a href#suffering-from-bad-input ide-mail-state-(typeemail):suffering-from-bad-input>suffering from bad input/a>./p> p>The code ide-mail-state-(typeemail):attr-input-value>a href#attr-input-value>value/a>/code> attribute, if specified and not empty, must have a value that is a single a href#valid-e-mail-address ide-mail-state-(typeemail):valid-e-mail-address-2>valid e-mail address/a>./p> p>strong>The a href#value-sanitization-algorithm ide-mail-state-(typeemail):value-sanitization-algorithm>value sanitization algorithm/a> is as follows/strong>: a ide-mail-state-(typeemail):strip-newlines hrefhttps://infra.spec.whatwg.org/#strip-newlines data-x-internalstrip-newlines>Strip newlines/a> from the a href#concept-fe-value ide-mail-state-(typeemail):concept-fe-value-8>value/a>, then a ide-mail-state-(typeemail):strip-leading-and-trailing-ascii-whitespace hrefhttps://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace data-x-internalstrip-leading-and-trailing-ascii-whitespace>strip leading and trailing ASCII whitespace/a> from the a href#concept-fe-value ide-mail-state-(typeemail):concept-fe-value-9>value/a>./p> p>strong>Constraint validation/strong>: While the a href#concept-fe-value ide-mail-state-(typeemail):concept-fe-value-10>value/a> of the element is neither the empty string nor a single a href#valid-e-mail-address ide-mail-state-(typeemail):valid-e-mail-address-3>valid e-mail address/a>, the element is a href#suffering-from-a-type-mismatch ide-mail-state-(typeemail):suffering-from-a-type-mismatch>suffering from a type mismatch/a>./p> dt>When the code ide-mail-state-(typeemail):attr-input-multiple-3>a href#attr-input-multiple>multiple/a>/code> attribute em>is/em> specified on the elementdd> p>The code ide-mail-state-(typeemail):the-input-element-3>a href#the-input-element>input/a>/code> element a href#represents ide-mail-state-(typeemail):represents-2>represents/a> a control for adding, removing, and editing the e-mail addresses given in the elements a href#concept-fe-values ide-mail-state-(typeemail):concept-fe-values>valueem>s/em>/a>./p> p>If the element is i ide-mail-state-(typeemail):concept-fe-mutable-2>a href#concept-fe-mutable>mutable/a>/i>, the user agent should allow the user to add, remove, and edit the e-mail addresses represented by its a href#concept-fe-values ide-mail-state-(typeemail):concept-fe-values-2>values/a>. User agents may allow the user to set any individual value in the list of a href#concept-fe-value ide-mail-state-(typeemail):concept-fe-value-11>valueem>s/em>/a> to a string that is not a a href#valid-e-mail-address ide-mail-state-(typeemail):valid-e-mail-address-4>valid e-mail address/a>, but must not allow users to set any individual value to a string containing U+002C COMMA (,), U+000A LINE FEED (LF), or U+000D CARRIAGE RETURN (CR) characters. User agents should allow the user to remove all the addresses in the elements a href#concept-fe-values ide-mail-state-(typeemail):concept-fe-values-3>values/a>. User agents may transform the a href#concept-fe-values ide-mail-state-(typeemail):concept-fe-values-4>values/a> for display and editing; in particular, user agents should convert punycode in the domain labels of the a href#concept-fe-value ide-mail-state-(typeemail):concept-fe-value-12>value/a> to IDN in the display and vice versa./p> p>strong>Constraint validation/strong>: While the user interface describes a situation where an individual value contains a U+002C COMMA (,) or is representing input that the user agent cannot convert to punycode, the control is a href#suffering-from-bad-input ide-mail-state-(typeemail):suffering-from-bad-input-2>suffering from bad input/a>./p> p>Whenever the user changes the elements a href#concept-fe-value ide-mail-state-(typeemail):concept-fe-value-13>valueem>s/em>/a>, the user agent must run the following steps:/p> ol>li>p>Let var>latest values/var> be a copy of the elements a href#concept-fe-value ide-mail-state-(typeemail):concept-fe-value-14>valueem>s/em>/a>.li>p>a ide-mail-state-(typeemail):strip-leading-and-trailing-ascii-whitespace-2 hrefhttps://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace data-x-internalstrip-leading-and-trailing-ascii-whitespace>Strip leading and trailing ASCII whitespace/a> from each value in var>latest values/var>.li>p>Let the elements a href#concept-fe-value ide-mail-state-(typeemail):concept-fe-value-15>value/a> be the result of concatenating all the values in var>latest values/var>, separating each value from the next by a single U+002C COMMA character (,), maintaining the lists order./ol> p>The code ide-mail-state-(typeemail):attr-input-value-2>a href#attr-input-value>value/a>/code> attribute, if specified, must have a value that is a a href#valid-e-mail-address-list ide-mail-state-(typeemail):valid-e-mail-address-list>valid e-mail address list/a>./p> p>strong>The a href#value-sanitization-algorithm ide-mail-state-(typeemail):value-sanitization-algorithm-2>value sanitization algorithm/a> is as follows/strong>:/p> ol>li>p>a hrefhttps://infra.spec.whatwg.org/#split-on-commas ide-mail-state-(typeemail):split-a-string-on-commas data-x-internalsplit-a-string-on-commas>Split on commas/a> the elements a href#concept-fe-value ide-mail-state-(typeemail):concept-fe-value-16>value/a>, a ide-mail-state-(typeemail):strip-leading-and-trailing-ascii-whitespace-3 hrefhttps://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace data-x-internalstrip-leading-and-trailing-ascii-whitespace>strip leading and trailing ASCII whitespace/a> from each resulting token, if any, and let the elements a href#concept-fe-values ide-mail-state-(typeemail):concept-fe-values-5>values/a> be the (possibly empty) resulting list of (possibly empty) tokens, maintaining the original order.li>p>Let the elements a href#concept-fe-value ide-mail-state-(typeemail):concept-fe-value-17>value/a> be the result of concatenating the elements a href#concept-fe-values ide-mail-state-(typeemail):concept-fe-values-6>values/a>, separating each value from the next by a single U+002C COMMA character (,), maintaining the lists order./ol> p>strong>Constraint validation/strong>: While the a href#concept-fe-value ide-mail-state-(typeemail):concept-fe-value-18>value/a> of the element is not a a href#valid-e-mail-address-list ide-mail-state-(typeemail):valid-e-mail-address-list-2>valid e-mail address list/a>, the element is a href#suffering-from-a-type-mismatch ide-mail-state-(typeemail):suffering-from-a-type-mismatch-2>suffering from a type mismatch/a>./p> /dl> p>When the code ide-mail-state-(typeemail):attr-input-multiple-4>a href#attr-input-multiple>multiple/a>/code> attribute is set or removed, the user agent must run the a href#value-sanitization-algorithm ide-mail-state-(typeemail):value-sanitization-algorithm-3>value sanitization algorithm/a>./p> p>A dfn idvalid-e-mail-address>valid e-mail address/dfn> is a string that matches the code>email/code> production of the following ABNF, the character set for which is Unicode. This ABNF implements the extensions described in RFC 1123. a href#refsABNF>ABNF/a> a href#refsRFC5322>RFC5322/a> a href#refsRFC1034>RFC1034/a> a href#refsRFC1123>RFC1123/a>/p> pre>email 1*( atext / . ) @ label *( . label )label let-dig ldh-str let-dig ; limited to a length of 63 characters by a hrefhttps://tools.ietf.org/html/rfc1034#section-3.5>RFC 1034 section 3.5/a>atext < as defined in a hrefhttps://tools.ietf.org/html/rfc5322#section-3.2.3>RFC 5322 section 3.2.3/a> >let-dig < as defined in a hrefhttps://tools.ietf.org/html/rfc1034#section-3.5>RFC 1034 section 3.5/a> >ldh-str < as defined in a hrefhttps://tools.ietf.org/html/rfc1034#section-3.5>RFC 1034 section 3.5/a> >/pre> p classnote>This requirement is a a href#willful-violation ide-mail-state-(typeemail):willful-violation>willful violation/a> of RFC 5322, which defines a syntax for e-mail addresses that is simultaneously too strict (before the @ character), too vague (after the @ character), and too lax (allowing comments, whitespace characters, and quoted strings in manners unfamiliar to most users) to be of practical use here./p> div classnote> p>The following JavaScript- and Perl-compatible regular expression is an implementation of the above definition./p> pre>/^a-zA-Z0-9.!#$%&*+\/?^_`{|}~-+@a-zA-Z0-9(?:a-zA-Z0-9-{0,61}a-zA-Z0-9)?(?:\.a-zA-Z0-9(?:a-zA-Z0-9-{0,61}a-zA-Z0-9)?)*$//pre> /div> p>A dfn idvalid-e-mail-address-list>valid e-mail address list/dfn> is a a href#set-of-comma-separated-tokens ide-mail-state-(typeemail):set-of-comma-separated-tokens>set of comma-separated tokens/a>, where each token is itself a a href#valid-e-mail-address ide-mail-state-(typeemail):valid-e-mail-address-5>valid e-mail address/a>. To obtain the list of tokens from a a href#valid-e-mail-address-list ide-mail-state-(typeemail):valid-e-mail-address-list-3>valid e-mail address list/a>, an implementation must a hrefhttps://infra.spec.whatwg.org/#split-on-commas ide-mail-state-(typeemail):split-a-string-on-commas-2 data-x-internalsplit-a-string-on-commas>split the string on commas/a>./p> div classbookkeeping> p>The following common code ide-mail-state-(typeemail):the-input-element-4>a href#the-input-element>input/a>/code> element content attributes, IDL attributes, and methods a href#concept-input-apply ide-mail-state-(typeemail):concept-input-apply>apply/a> to the element: code ide-mail-state-(typeemail):attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code>, code ide-mail-state-(typeemail):attr-input-list>a href#attr-input-list>list/a>/code>, code ide-mail-state-(typeemail):attr-input-maxlength>a href#attr-input-maxlength>maxlength/a>/code>, code ide-mail-state-(typeemail):attr-input-minlength>a href#attr-input-minlength>minlength/a>/code>, code ide-mail-state-(typeemail):attr-input-multiple-5>a href#attr-input-multiple>multiple/a>/code>, code ide-mail-state-(typeemail):attr-input-pattern>a href#attr-input-pattern>pattern/a>/code>, code ide-mail-state-(typeemail):attr-input-placeholder>a href#attr-input-placeholder>placeholder/a>/code>, code ide-mail-state-(typeemail):attr-input-readonly>a href#attr-input-readonly>readonly/a>/code>, code ide-mail-state-(typeemail):attr-input-required>a href#attr-input-required>required/a>/code>, and code ide-mail-state-(typeemail):attr-input-size>a href#attr-input-size>size/a>/code> content attributes; code ide-mail-state-(typeemail):dom-input-list>a href#dom-input-list>list/a>/code> and code ide-mail-state-(typeemail):dom-input-value>a href#dom-input-value>value/a>/code> IDL attributes; code ide-mail-state-(typeemail):dom-textarea/input-select>a href#dom-textarea/input-select>select()/a>/code> method./p> p>The code ide-mail-state-(typeemail):dom-input-value-2>a href#dom-input-value>value/a>/code> IDL attribute is in mode a href#dom-input-value-value ide-mail-state-(typeemail):dom-input-value-value>value/a>./p> p>The code ide-mail-state-(typeemail):event-input>a href#event-input>input/a>/code> and code ide-mail-state-(typeemail):event-change>a href#event-change>change/a>/code> events a href#concept-input-apply ide-mail-state-(typeemail):concept-input-apply-2>apply/a>./p> p>The following content attributes must not be specified and a href#do-not-apply ide-mail-state-(typeemail):do-not-apply>do not apply/a> to the element: code ide-mail-state-(typeemail):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code ide-mail-state-(typeemail):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code ide-mail-state-(typeemail):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code ide-mail-state-(typeemail):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code ide-mail-state-(typeemail):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code ide-mail-state-(typeemail):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code ide-mail-state-(typeemail):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code ide-mail-state-(typeemail):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code ide-mail-state-(typeemail):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code ide-mail-state-(typeemail):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code ide-mail-state-(typeemail):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code ide-mail-state-(typeemail):attr-input-max classno-backref>a href#attr-input-max>max/a>/code>, code ide-mail-state-(typeemail):attr-input-min classno-backref>a href#attr-input-min>min/a>/code>, code ide-mail-state-(typeemail):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, code ide-mail-state-(typeemail):attr-input-step classno-backref>a href#attr-input-step>step/a>/code>, and code ide-mail-state-(typeemail):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply ide-mail-state-(typeemail):do-not-apply-2>do not apply/a> to the element: code ide-mail-state-(typeemail):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code ide-mail-state-(typeemail):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code ide-mail-state-(typeemail):dom-textarea/input-selectionstart classno-backref>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code ide-mail-state-(typeemail):dom-textarea/input-selectionend classno-backref>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code ide-mail-state-(typeemail):dom-textarea/input-selectiondirection classno-backref>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, code ide-mail-state-(typeemail):dom-input-valueasdate classno-backref>a href#dom-input-valueasdate>valueAsDate/a>/code>, and code ide-mail-state-(typeemail):dom-input-valueasnumber classno-backref>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code ide-mail-state-(typeemail):dom-textarea/input-setrangetext classno-backref>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, code ide-mail-state-(typeemail):dom-textarea/input-setselectionrange classno-backref>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code>, code ide-mail-state-(typeemail):dom-input-stepdown classno-backref>a href#dom-input-stepdown>stepDown()/a>/code> and code ide-mail-state-(typeemail):dom-input-stepup classno-backref>a href#dom-input-stepup>stepUp()/a>/code> methods./p> /div> h6 idpassword-state-(typepassword)>span classsecno>4.10.5.1.6/span> dfn>Password/dfn> state (code>typepassword/code>)a href#password-state-(typepassword) classself-link>/a>/h6> p>When an code idpassword-state-(typepassword):the-input-element>a href#the-input-element>input/a>/code> elements code idpassword-state-(typepassword):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#password-state-(typepassword) idpassword-state-(typepassword):password-state-(typepassword)>Password/a> state, the rules in this section apply./p> p>The code idpassword-state-(typepassword):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idpassword-state-(typepassword):represents>represents/a> a one line plain text edit control for the elements a href#concept-fe-value idpassword-state-(typepassword):concept-fe-value>value/a>. The user agent should obscure the value so that people other than the user cannot see it./p> p>If the element is i idpassword-state-(typepassword):concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i>, its a href#concept-fe-value idpassword-state-(typepassword):concept-fe-value-2>value/a> should be editable by the user. User agents must not allow users to insert U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters into the a href#concept-fe-value idpassword-state-(typepassword):concept-fe-value-3>value/a>./p> p>The code idpassword-state-(typepassword):attr-input-value>a href#attr-input-value>value/a>/code> attribute, if specified, must have a value that contains no U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters./p> p>strong>The a href#value-sanitization-algorithm idpassword-state-(typepassword):value-sanitization-algorithm>value sanitization algorithm/a> is as follows/strong>: a idpassword-state-(typepassword):strip-newlines hrefhttps://infra.spec.whatwg.org/#strip-newlines data-x-internalstrip-newlines>Strip newlines/a> from the a href#concept-fe-value idpassword-state-(typepassword):concept-fe-value-4>value/a>./p> div classbookkeeping> p>The following common code idpassword-state-(typepassword):the-input-element-3>a href#the-input-element>input/a>/code> element content attributes, IDL attributes, and methods a href#concept-input-apply idpassword-state-(typepassword):concept-input-apply>apply/a> to the element: code idpassword-state-(typepassword):attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code>, code idpassword-state-(typepassword):attr-fe-inputmode>a href#attr-fe-inputmode>inputmode/a>/code>, code idpassword-state-(typepassword):attr-input-maxlength>a href#attr-input-maxlength>maxlength/a>/code>, code idpassword-state-(typepassword):attr-input-minlength>a href#attr-input-minlength>minlength/a>/code>, code idpassword-state-(typepassword):attr-input-pattern>a href#attr-input-pattern>pattern/a>/code>, code idpassword-state-(typepassword):attr-input-placeholder>a href#attr-input-placeholder>placeholder/a>/code>, code idpassword-state-(typepassword):attr-input-readonly>a href#attr-input-readonly>readonly/a>/code>, code idpassword-state-(typepassword):attr-input-required>a href#attr-input-required>required/a>/code>, and code idpassword-state-(typepassword):attr-input-size>a href#attr-input-size>size/a>/code> content attributes; code idpassword-state-(typepassword):dom-textarea/input-selectionstart>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idpassword-state-(typepassword):dom-textarea/input-selectionend>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code idpassword-state-(typepassword):dom-textarea/input-selectiondirection>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, and code idpassword-state-(typepassword):dom-input-value>a href#dom-input-value>value/a>/code> IDL attributes; code idpassword-state-(typepassword):dom-textarea/input-select>a href#dom-textarea/input-select>select()/a>/code>, code idpassword-state-(typepassword):dom-textarea/input-setrangetext>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, and code idpassword-state-(typepassword):dom-textarea/input-setselectionrange>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code> methods./p> p>The code idpassword-state-(typepassword):dom-input-value-2>a href#dom-input-value>value/a>/code> IDL attribute is in mode a href#dom-input-value-value idpassword-state-(typepassword):dom-input-value-value>value/a>./p> p>The code idpassword-state-(typepassword):event-input>a href#event-input>input/a>/code> and code idpassword-state-(typepassword):event-change>a href#event-change>change/a>/code> events a href#concept-input-apply idpassword-state-(typepassword):concept-input-apply-2>apply/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idpassword-state-(typepassword):do-not-apply>do not apply/a> to the element: code idpassword-state-(typepassword):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code idpassword-state-(typepassword):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code idpassword-state-(typepassword):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code idpassword-state-(typepassword):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code idpassword-state-(typepassword):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code idpassword-state-(typepassword):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code idpassword-state-(typepassword):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code idpassword-state-(typepassword):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idpassword-state-(typepassword):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code idpassword-state-(typepassword):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code idpassword-state-(typepassword):attr-input-list classno-backref>a href#attr-input-list>list/a>/code>, code idpassword-state-(typepassword):attr-input-max classno-backref>a href#attr-input-max>max/a>/code>, code idpassword-state-(typepassword):attr-input-min classno-backref>a href#attr-input-min>min/a>/code>, code idpassword-state-(typepassword):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code idpassword-state-(typepassword):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, code idpassword-state-(typepassword):attr-input-step classno-backref>a href#attr-input-step>step/a>/code>, and code idpassword-state-(typepassword):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply idpassword-state-(typepassword):do-not-apply-2>do not apply/a> to the element: code idpassword-state-(typepassword):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code idpassword-state-(typepassword):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code idpassword-state-(typepassword):dom-input-list classno-backref>a href#dom-input-list>list/a>/code>, code idpassword-state-(typepassword):dom-input-valueasdate classno-backref>a href#dom-input-valueasdate>valueAsDate/a>/code>, and code idpassword-state-(typepassword):dom-input-valueasnumber classno-backref>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idpassword-state-(typepassword):dom-input-stepdown classno-backref>a href#dom-input-stepdown>stepDown()/a>/code> and code idpassword-state-(typepassword):dom-input-stepup classno-backref>a href#dom-input-stepup>stepUp()/a>/code> methods./p> /div> h6 iddate-state-(typedate)>span classsecno>4.10.5.1.7/span> dfn>Date/dfn> state (code>typedate/code>)a href#date-state-(typedate) classself-link>/a>/h6>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> input-datetimespan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>20+/span>/span>span classios_saf partial>span>iOS Safari (limited)/span> span>5.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>57+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari no>span>Safari/span> span>None/span>/span>span classedge yes>span>Edge/span> span>13+/span>/span>span classandroid yes>span>Android Browser/span> span>4.4+/span>/span>span classopera yes>span>Opera/span> span>9+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featinput-datetime>caniuse.com/a>/div> p>When an code iddate-state-(typedate):the-input-element>a href#the-input-element>input/a>/code> elements code iddate-state-(typedate):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#date-state-(typedate) iddate-state-(typedate):date-state-(typedate)>Date/a> state, the rules in this section apply./p> p>The code iddate-state-(typedate):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents iddate-state-(typedate):represents>represents/a> a control for setting the elements a href#concept-fe-value iddate-state-(typedate):concept-fe-value>value/a> to a string representing a specific a href#concept-date iddate-state-(typedate):concept-date>date/a>./p> p>If the element is i iddate-state-(typedate):concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i>, the user agent should allow the user to change the a href#concept-date iddate-state-(typedate):concept-date-2>date/a> represented by its a href#concept-fe-value iddate-state-(typedate):concept-fe-value-2>value/a>, as obtained by a href#parse-a-date-string iddate-state-(typedate):parse-a-date-string>parsing a date/a> from it. User agents must not allow the user to set the a href#concept-fe-value iddate-state-(typedate):concept-fe-value-3>value/a> to a non-empty string that is not a a href#valid-date-string iddate-state-(typedate):valid-date-string>valid date string/a>. If the user agent provides a user interface for selecting a a href#concept-date iddate-state-(typedate):concept-date-3>date/a>, then the a href#concept-fe-value iddate-state-(typedate):concept-fe-value-4>value/a> must be set to a a href#valid-date-string iddate-state-(typedate):valid-date-string-2>valid date string/a> representing the users selection. User agents should allow the user to set the a href#concept-fe-value iddate-state-(typedate):concept-fe-value-5>value/a> to the empty string./p> p>strong>Constraint validation/strong>: While the user interface describes input that the user agent cannot convert to a a href#valid-date-string iddate-state-(typedate):valid-date-string-3>valid date string/a>, the control is a href#suffering-from-bad-input iddate-state-(typedate):suffering-from-bad-input>suffering from bad input/a>./p> p classnote>See the a href#input-author-notes>introduction section/a> for a discussion of the difference between the input format and submission format for date, time, and number form controls, and the a href#input-impl-notes>implementation notes/a> regarding localization of form controls./p> p>The code iddate-state-(typedate):attr-input-value>a href#attr-input-value>value/a>/code> attribute, if specified and not empty, must have a value that is a a href#valid-date-string iddate-state-(typedate):valid-date-string-4>valid date string/a>./p> p>strong>The a href#value-sanitization-algorithm iddate-state-(typedate):value-sanitization-algorithm>value sanitization algorithm/a> is as follows/strong>: If the a href#concept-fe-value iddate-state-(typedate):concept-fe-value-6>value/a> of the element is not a a href#valid-date-string iddate-state-(typedate):valid-date-string-5>valid date string/a>, then set it to the empty string instead./p> p>The code iddate-state-(typedate):attr-input-min>a href#attr-input-min>min/a>/code> attribute, if specified, must have a value that is a a href#valid-date-string iddate-state-(typedate):valid-date-string-6>valid date string/a>. The code iddate-state-(typedate):attr-input-max>a href#attr-input-max>max/a>/code> attribute, if specified, must have a value that is a a href#valid-date-string iddate-state-(typedate):valid-date-string-7>valid date string/a>./p> p>The code iddate-state-(typedate):attr-input-step>a href#attr-input-step>step/a>/code> attribute is expressed in days. The a href#concept-input-step-scale iddate-state-(typedate):concept-input-step-scale>step scale factor/a> is 86,400,000 (which converts the days to milliseconds, as used in the other algorithms). The a href#concept-input-step-default iddate-state-(typedate):concept-input-step-default>default step/a> is 1 day./p> p>When the element is a href#suffering-from-a-step-mismatch iddate-state-(typedate):suffering-from-a-step-mismatch>suffering from a step mismatch/a>, the user agent may round the elements a href#concept-fe-value iddate-state-(typedate):concept-fe-value-7>value/a> to the nearest a href#concept-date iddate-state-(typedate):concept-date-4>date/a> for which the element would not a href#suffering-from-a-step-mismatch iddate-state-(typedate):suffering-from-a-step-mismatch-2>suffer from a step mismatch/a>./p> p>strong>The a href#concept-input-value-string-number iddate-state-(typedate):concept-input-value-string-number>algorithm to convert a string to a number/a>, given a string var>input/var>, is as follows/strong>: If a href#parse-a-date-string iddate-state-(typedate):parse-a-date-string-2>parsing a date/a> from var>input/var> results in an error, then return an error; otherwise, return the number of milliseconds elapsed from midnight UTC on the morning of 1970-01-01 (the time represented by the value code>1970-01-01T00:00:00.0Z/code>) to midnight UTC on the morning of the parsed a href#concept-date iddate-state-(typedate):concept-date-5>date/a>, ignoring leap seconds./p> p>strong>The a href#concept-input-value-number-string iddate-state-(typedate):concept-input-value-number-string>algorithm to convert a number to a string/a>, given a number var>input/var>, is as follows/strong>: Return a a href#valid-date-string iddate-state-(typedate):valid-date-string-8>valid date string/a> that represents the a href#concept-date iddate-state-(typedate):concept-date-6>date/a> that, in UTC, is current var>input/var> milliseconds after midnight UTC on the morning of 1970-01-01 (the time represented by the value code>1970-01-01T00:00:00.0Z/code>)./p> p>strong>The a href#concept-input-value-string-date iddate-state-(typedate):concept-input-value-string-date>algorithm to convert a string to a code>Date/code> object/a>, given a string var>input/var>, is as follows/strong>: If a href#parse-a-date-string iddate-state-(typedate):parse-a-date-string-3>parsing a date/a> from var>input/var> results in an error, then return an error; otherwise, return a href#create-a-date-object iddate-state-(typedate):create-a-date-object>a new code>Date/code> object/a> representing midnight UTC on the morning of the parsed a href#concept-date iddate-state-(typedate):concept-date-7>date/a>./p> p>strong>The a href#concept-input-value-date-string iddate-state-(typedate):concept-input-value-date-string>algorithm to convert a code>Date/code> object to a string/a>, given a code iddate-state-(typedate):date>a data-x-internaldate hrefhttps://tc39.github.io/ecma262/#sec-date-objects>Date/a>/code> object var>input/var>, is as follows/strong>: Return a a href#valid-date-string iddate-state-(typedate):valid-date-string-9>valid date string/a> that represents the a href#concept-date iddate-state-(typedate):concept-date-8>date/a> current at the time represented by var>input/var> in the UTC time zone./p> div idonly-contemporary-times classnote> p>The a href#date-state-(typedate) iddate-state-(typedate):date-state-(typedate)-2>Date/a> state (and other date- and time-related states described in subsequent sections) is not intended for the entry of values for which a precise date and time relative to the contemporary calendar cannot be established. For example, it would be inappropriate for the entry of times like one millisecond after the big bang, the early part of the Jurassic period, or a winter around 250 BCE./p> p>For the input of dates before the introduction of the Gregorian calendar, authors are encouraged to not use the a href#date-state-(typedate) iddate-state-(typedate):date-state-(typedate)-3>Date/a> state (and the other date- and time-related states described in subsequent sections), as user agents are not required to support converting dates and times from earlier periods to the Gregorian calendar, and asking users to do so manually puts an undue burden on users. (This is complicated by the manner in which the Gregorian calendar was phased in, which occurred at different times in different countries, ranging from partway through the 16th century all the way to early in the 20th.) Instead, authors are encouraged to provide fine-grained input controls using the code iddate-state-(typedate):the-select-element>a href#the-select-element>select/a>/code> element and code iddate-state-(typedate):the-input-element-3>a href#the-input-element>input/a>/code> elements with the a href#number-state-(typenumber) iddate-state-(typedate):number-state-(typenumber)>Number/a> state./p> /div> div classbookkeeping> p>The following common code iddate-state-(typedate):the-input-element-4>a href#the-input-element>input/a>/code> element content attributes, IDL attributes, and methods a href#concept-input-apply iddate-state-(typedate):concept-input-apply>apply/a> to the element: code iddate-state-(typedate):attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code>, code iddate-state-(typedate):attr-input-list>a href#attr-input-list>list/a>/code>, code iddate-state-(typedate):attr-input-max-2>a href#attr-input-max>max/a>/code>, code iddate-state-(typedate):attr-input-min-2>a href#attr-input-min>min/a>/code>, code iddate-state-(typedate):attr-input-readonly>a href#attr-input-readonly>readonly/a>/code>, code iddate-state-(typedate):attr-input-required>a href#attr-input-required>required/a>/code>, and code iddate-state-(typedate):attr-input-step-2>a href#attr-input-step>step/a>/code> content attributes; code iddate-state-(typedate):dom-input-list>a href#dom-input-list>list/a>/code>, code iddate-state-(typedate):dom-input-value>a href#dom-input-value>value/a>/code>, code iddate-state-(typedate):dom-input-valueasdate>a href#dom-input-valueasdate>valueAsDate/a>/code>, and code iddate-state-(typedate):dom-input-valueasnumber>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code iddate-state-(typedate):dom-textarea/input-select>a href#dom-textarea/input-select>select()/a>/code>, code iddate-state-(typedate):dom-input-stepdown>a href#dom-input-stepdown>stepDown()/a>/code>, and code iddate-state-(typedate):dom-input-stepup>a href#dom-input-stepup>stepUp()/a>/code> methods./p> p>The code iddate-state-(typedate):dom-input-value-2>a href#dom-input-value>value/a>/code> IDL attribute is in mode a href#dom-input-value-value iddate-state-(typedate):dom-input-value-value>value/a>./p> p>The code iddate-state-(typedate):event-input>a href#event-input>input/a>/code> and code iddate-state-(typedate):event-change>a href#event-change>change/a>/code> events a href#concept-input-apply iddate-state-(typedate):concept-input-apply-2>apply/a>./p> p>The following content attributes must not be specified and a href#do-not-apply iddate-state-(typedate):do-not-apply>do not apply/a> to the element: code iddate-state-(typedate):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code iddate-state-(typedate):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code iddate-state-(typedate):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code iddate-state-(typedate):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code iddate-state-(typedate):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code iddate-state-(typedate):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code iddate-state-(typedate):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code iddate-state-(typedate):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code iddate-state-(typedate):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code iddate-state-(typedate):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code iddate-state-(typedate):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code iddate-state-(typedate):attr-input-maxlength classno-backref>a href#attr-input-maxlength>maxlength/a>/code>, code iddate-state-(typedate):attr-input-minlength classno-backref>a href#attr-input-minlength>minlength/a>/code>, code iddate-state-(typedate):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code iddate-state-(typedate):attr-input-pattern classno-backref>a href#attr-input-pattern>pattern/a>/code>, code iddate-state-(typedate):attr-input-placeholder classno-backref>a href#attr-input-placeholder>placeholder/a>/code>, code iddate-state-(typedate):attr-input-size classno-backref>a href#attr-input-size>size/a>/code>, code iddate-state-(typedate):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, and code iddate-state-(typedate):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply iddate-state-(typedate):do-not-apply-2>do not apply/a> to the element: code iddate-state-(typedate):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code iddate-state-(typedate):dom-textarea/input-selectionstart classno-backref>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code iddate-state-(typedate):dom-textarea/input-selectionend classno-backref>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, and code iddate-state-(typedate):dom-textarea/input-selectiondirection classno-backref>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code> IDL attributes; code iddate-state-(typedate):dom-textarea/input-setrangetext classno-backref>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, and code iddate-state-(typedate):dom-textarea/input-setselectionrange classno-backref>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code> methods./p> /div> h6 idmonth-state-(typemonth)>span classsecno>4.10.5.1.8/span> dfn>Month/dfn> state (code>typemonth/code>)a href#month-state-(typemonth) classself-link>/a>/h6> p>When an code idmonth-state-(typemonth):the-input-element>a href#the-input-element>input/a>/code> elements code idmonth-state-(typemonth):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#month-state-(typemonth) idmonth-state-(typemonth):month-state-(typemonth)>Month/a> state, the rules in this section apply./p> p>The code idmonth-state-(typemonth):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idmonth-state-(typemonth):represents>represents/a> a control for setting the elements a href#concept-fe-value idmonth-state-(typemonth):concept-fe-value>value/a> to a string representing a specific a href#concept-month idmonth-state-(typemonth):concept-month>month/a>./p> p>If the element is i idmonth-state-(typemonth):concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i>, the user agent should allow the user to change the a href#concept-month idmonth-state-(typemonth):concept-month-2>month/a> represented by its a href#concept-fe-value idmonth-state-(typemonth):concept-fe-value-2>value/a>, as obtained by a href#parse-a-month-string idmonth-state-(typemonth):parse-a-month-string>parsing a month/a> from it. User agents must not allow the user to set the a href#concept-fe-value idmonth-state-(typemonth):concept-fe-value-3>value/a> to a non-empty string that is not a a href#valid-month-string idmonth-state-(typemonth):valid-month-string>valid month string/a>. If the user agent provides a user interface for selecting a a href#concept-month idmonth-state-(typemonth):concept-month-3>month/a>, then the a href#concept-fe-value idmonth-state-(typemonth):concept-fe-value-4>value/a> must be set to a a href#valid-month-string idmonth-state-(typemonth):valid-month-string-2>valid month string/a> representing the users selection. User agents should allow the user to set the a href#concept-fe-value idmonth-state-(typemonth):concept-fe-value-5>value/a> to the empty string./p> p>strong>Constraint validation/strong>: While the user interface describes input that the user agent cannot convert to a a href#valid-month-string idmonth-state-(typemonth):valid-month-string-3>valid month string/a>, the control is a href#suffering-from-bad-input idmonth-state-(typemonth):suffering-from-bad-input>suffering from bad input/a>./p> p classnote>See the a href#input-author-notes>introduction section/a> for a discussion of the difference between the input format and submission format for date, time, and number form controls, and the a href#input-impl-notes>implementation notes/a> regarding localization of form controls./p> p>The code idmonth-state-(typemonth):attr-input-value>a href#attr-input-value>value/a>/code> attribute, if specified and not empty, must have a value that is a a href#valid-month-string idmonth-state-(typemonth):valid-month-string-4>valid month string/a>./p> p>strong>The a href#value-sanitization-algorithm idmonth-state-(typemonth):value-sanitization-algorithm>value sanitization algorithm/a> is as follows/strong>: If the a href#concept-fe-value idmonth-state-(typemonth):concept-fe-value-6>value/a> of the element is not a a href#valid-month-string idmonth-state-(typemonth):valid-month-string-5>valid month string/a>, then set it to the empty string instead./p> p>The code idmonth-state-(typemonth):attr-input-min>a href#attr-input-min>min/a>/code> attribute, if specified, must have a value that is a a href#valid-month-string idmonth-state-(typemonth):valid-month-string-6>valid month string/a>. The code idmonth-state-(typemonth):attr-input-max>a href#attr-input-max>max/a>/code> attribute, if specified, must have a value that is a a href#valid-month-string idmonth-state-(typemonth):valid-month-string-7>valid month string/a>./p> p>The code idmonth-state-(typemonth):attr-input-step>a href#attr-input-step>step/a>/code> attribute is expressed in months. The a href#concept-input-step-scale idmonth-state-(typemonth):concept-input-step-scale>step scale factor/a> is 1 (there is no conversion needed as the algorithms use months). The a href#concept-input-step-default idmonth-state-(typemonth):concept-input-step-default>default step/a> is 1 month./p> p>When the element is a href#suffering-from-a-step-mismatch idmonth-state-(typemonth):suffering-from-a-step-mismatch>suffering from a step mismatch/a>, the user agent may round the elements a href#concept-fe-value idmonth-state-(typemonth):concept-fe-value-7>value/a> to the nearest a href#concept-month idmonth-state-(typemonth):concept-month-4>month/a> for which the element would not a href#suffering-from-a-step-mismatch idmonth-state-(typemonth):suffering-from-a-step-mismatch-2>suffer from a step mismatch/a>./p> p>strong>The a href#concept-input-value-string-number idmonth-state-(typemonth):concept-input-value-string-number>algorithm to convert a string to a number/a>, given a string var>input/var>, is as follows/strong>: If a href#parse-a-month-string idmonth-state-(typemonth):parse-a-month-string-2>parsing a month/a> from var>input/var> results in an error, then return an error; otherwise, return the number of months between January 1970 and the parsed a href#concept-month idmonth-state-(typemonth):concept-month-5>month/a>./p> p>strong>The a href#concept-input-value-number-string idmonth-state-(typemonth):concept-input-value-number-string>algorithm to convert a number to a string/a>, given a number var>input/var>, is as follows/strong>: Return a a href#valid-month-string idmonth-state-(typemonth):valid-month-string-8>valid month string/a> that represents the a href#concept-month idmonth-state-(typemonth):concept-month-6>month/a> that has var>input/var> months between it and January 1970./p> p>strong>The a href#concept-input-value-string-date idmonth-state-(typemonth):concept-input-value-string-date>algorithm to convert a string to a code>Date/code> object/a>, given a string var>input/var>, is as follows/strong>: If a href#parse-a-month-string idmonth-state-(typemonth):parse-a-month-string-3>parsing a month/a> from var>input/var> results in an error, then return an error; otherwise, return a href#create-a-date-object idmonth-state-(typemonth):create-a-date-object>a new code>Date/code> object/a> representing midnight UTC on the morning of the first day of the parsed a href#concept-month idmonth-state-(typemonth):concept-month-7>month/a>./p> p>strong>The a href#concept-input-value-date-string idmonth-state-(typemonth):concept-input-value-date-string>algorithm to convert a code>Date/code> object to a string/a>, given a code idmonth-state-(typemonth):date>a data-x-internaldate hrefhttps://tc39.github.io/ecma262/#sec-date-objects>Date/a>/code> object var>input/var>, is as follows/strong>: Return a a href#valid-month-string idmonth-state-(typemonth):valid-month-string-9>valid month string/a> that represents the a href#concept-month idmonth-state-(typemonth):concept-month-8>month/a> current at the time represented by var>input/var> in the UTC time zone./p> div classbookkeeping> p>The following common code idmonth-state-(typemonth):the-input-element-3>a href#the-input-element>input/a>/code> element content attributes, IDL attributes, and methods a href#concept-input-apply idmonth-state-(typemonth):concept-input-apply>apply/a> to the element: code idmonth-state-(typemonth):attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code>, code idmonth-state-(typemonth):attr-input-list>a href#attr-input-list>list/a>/code>, code idmonth-state-(typemonth):attr-input-max-2>a href#attr-input-max>max/a>/code>, code idmonth-state-(typemonth):attr-input-min-2>a href#attr-input-min>min/a>/code>, code idmonth-state-(typemonth):attr-input-readonly>a href#attr-input-readonly>readonly/a>/code>, code idmonth-state-(typemonth):attr-input-required>a href#attr-input-required>required/a>/code>, and code idmonth-state-(typemonth):attr-input-step-2>a href#attr-input-step>step/a>/code> content attributes; code idmonth-state-(typemonth):dom-input-list>a href#dom-input-list>list/a>/code>, code idmonth-state-(typemonth):dom-input-value>a href#dom-input-value>value/a>/code>, code idmonth-state-(typemonth):dom-input-valueasdate>a href#dom-input-valueasdate>valueAsDate/a>/code>, and code idmonth-state-(typemonth):dom-input-valueasnumber>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idmonth-state-(typemonth):dom-textarea/input-select>a href#dom-textarea/input-select>select()/a>/code>, code idmonth-state-(typemonth):dom-input-stepdown>a href#dom-input-stepdown>stepDown()/a>/code>, and code idmonth-state-(typemonth):dom-input-stepup>a href#dom-input-stepup>stepUp()/a>/code> methods./p> p>The code idmonth-state-(typemonth):dom-input-value-2>a href#dom-input-value>value/a>/code> IDL attribute is in mode a href#dom-input-value-value idmonth-state-(typemonth):dom-input-value-value>value/a>./p> p>The code idmonth-state-(typemonth):event-input>a href#event-input>input/a>/code> and code idmonth-state-(typemonth):event-change>a href#event-change>change/a>/code> events a href#concept-input-apply idmonth-state-(typemonth):concept-input-apply-2>apply/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idmonth-state-(typemonth):do-not-apply>do not apply/a> to the element: code idmonth-state-(typemonth):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code idmonth-state-(typemonth):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code idmonth-state-(typemonth):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code idmonth-state-(typemonth):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code idmonth-state-(typemonth):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code idmonth-state-(typemonth):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code idmonth-state-(typemonth):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code idmonth-state-(typemonth):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idmonth-state-(typemonth):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code idmonth-state-(typemonth):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code idmonth-state-(typemonth):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code idmonth-state-(typemonth):attr-input-maxlength classno-backref>a href#attr-input-maxlength>maxlength/a>/code>, code idmonth-state-(typemonth):attr-input-minlength classno-backref>a href#attr-input-minlength>minlength/a>/code>, code idmonth-state-(typemonth):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code idmonth-state-(typemonth):attr-input-pattern classno-backref>a href#attr-input-pattern>pattern/a>/code>, code idmonth-state-(typemonth):attr-input-placeholder classno-backref>a href#attr-input-placeholder>placeholder/a>/code>, code idmonth-state-(typemonth):attr-input-size classno-backref>a href#attr-input-size>size/a>/code>, code idmonth-state-(typemonth):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, and code idmonth-state-(typemonth):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply idmonth-state-(typemonth):do-not-apply-2>do not apply/a> to the element: code idmonth-state-(typemonth):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code idmonth-state-(typemonth):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code idmonth-state-(typemonth):dom-textarea/input-selectionstart classno-backref>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idmonth-state-(typemonth):dom-textarea/input-selectionend classno-backref>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, and code idmonth-state-(typemonth):dom-textarea/input-selectiondirection classno-backref>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code> IDL attributes; code idmonth-state-(typemonth):dom-textarea/input-setrangetext classno-backref>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, and code idmonth-state-(typemonth):dom-textarea/input-setselectionrange classno-backref>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code> methods./p> /div> h6 idweek-state-(typeweek)>span classsecno>4.10.5.1.9/span> dfn>Week/dfn> state (code>typeweek/code>)a href#week-state-(typeweek) classself-link>/a>/h6> p>When an code idweek-state-(typeweek):the-input-element>a href#the-input-element>input/a>/code> elements code idweek-state-(typeweek):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#week-state-(typeweek) idweek-state-(typeweek):week-state-(typeweek)>Week/a> state, the rules in this section apply./p> p>The code idweek-state-(typeweek):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idweek-state-(typeweek):represents>represents/a> a control for setting the elements a href#concept-fe-value idweek-state-(typeweek):concept-fe-value>value/a> to a string representing a specific a href#concept-week idweek-state-(typeweek):concept-week>week/a>./p> p>If the element is i idweek-state-(typeweek):concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i>, the user agent should allow the user to change the a href#concept-week idweek-state-(typeweek):concept-week-2>week/a> represented by its a href#concept-fe-value idweek-state-(typeweek):concept-fe-value-2>value/a>, as obtained by a href#parse-a-week-string idweek-state-(typeweek):parse-a-week-string>parsing a week/a> from it. User agents must not allow the user to set the a href#concept-fe-value idweek-state-(typeweek):concept-fe-value-3>value/a> to a non-empty string that is not a a href#valid-week-string idweek-state-(typeweek):valid-week-string>valid week string/a>. If the user agent provides a user interface for selecting a a href#concept-week idweek-state-(typeweek):concept-week-3>week/a>, then the a href#concept-fe-value idweek-state-(typeweek):concept-fe-value-4>value/a> must be set to a a href#valid-week-string idweek-state-(typeweek):valid-week-string-2>valid week string/a> representing the users selection. User agents should allow the user to set the a href#concept-fe-value idweek-state-(typeweek):concept-fe-value-5>value/a> to the empty string./p> p>strong>Constraint validation/strong>: While the user interface describes input that the user agent cannot convert to a a href#valid-week-string idweek-state-(typeweek):valid-week-string-3>valid week string/a>, the control is a href#suffering-from-bad-input idweek-state-(typeweek):suffering-from-bad-input>suffering from bad input/a>./p> p classnote>See the a href#input-author-notes>introduction section/a> for a discussion of the difference between the input format and submission format for date, time, and number form controls, and the a href#input-impl-notes>implementation notes/a> regarding localization of form controls./p> p>The code idweek-state-(typeweek):attr-input-value>a href#attr-input-value>value/a>/code> attribute, if specified and not empty, must have a value that is a a href#valid-week-string idweek-state-(typeweek):valid-week-string-4>valid week string/a>./p> p>strong>The a href#value-sanitization-algorithm idweek-state-(typeweek):value-sanitization-algorithm>value sanitization algorithm/a> is as follows/strong>: If the a href#concept-fe-value idweek-state-(typeweek):concept-fe-value-6>value/a> of the element is not a a href#valid-week-string idweek-state-(typeweek):valid-week-string-5>valid week string/a>, then set it to the empty string instead./p> p>The code idweek-state-(typeweek):attr-input-min>a href#attr-input-min>min/a>/code> attribute, if specified, must have a value that is a a href#valid-week-string idweek-state-(typeweek):valid-week-string-6>valid week string/a>. The code idweek-state-(typeweek):attr-input-max>a href#attr-input-max>max/a>/code> attribute, if specified, must have a value that is a a href#valid-week-string idweek-state-(typeweek):valid-week-string-7>valid week string/a>./p> p>The code idweek-state-(typeweek):attr-input-step>a href#attr-input-step>step/a>/code> attribute is expressed in weeks. The a href#concept-input-step-scale idweek-state-(typeweek):concept-input-step-scale>step scale factor/a> is 604,800,000 (which converts the weeks to milliseconds, as used in the other algorithms). The a href#concept-input-step-default idweek-state-(typeweek):concept-input-step-default>default step/a> is 1 week. The a href#concept-input-step-default-base idweek-state-(typeweek):concept-input-step-default-base>default step base/a> is −259,200,000 (the start of week 1970-W01)./p> p>When the element is a href#suffering-from-a-step-mismatch idweek-state-(typeweek):suffering-from-a-step-mismatch>suffering from a step mismatch/a>, the user agent may round the elements a href#concept-fe-value idweek-state-(typeweek):concept-fe-value-7>value/a> to the nearest a href#concept-week idweek-state-(typeweek):concept-week-4>week/a> for which the element would not a href#suffering-from-a-step-mismatch idweek-state-(typeweek):suffering-from-a-step-mismatch-2>suffer from a step mismatch/a>./p> p>strong>The a href#concept-input-value-string-number idweek-state-(typeweek):concept-input-value-string-number>algorithm to convert a string to a number/a>, given a string var>input/var>, is as follows/strong>: If a href#parse-a-week-string idweek-state-(typeweek):parse-a-week-string-2>parsing a week string/a> from var>input/var> results in an error, then return an error; otherwise, return the number of milliseconds elapsed from midnight UTC on the morning of 1970-01-01 (the time represented by the value code>1970-01-01T00:00:00.0Z/code>) to midnight UTC on the morning of the Monday of the parsed a href#concept-week idweek-state-(typeweek):concept-week-5>week/a>, ignoring leap seconds./p> p>strong>The a href#concept-input-value-number-string idweek-state-(typeweek):concept-input-value-number-string>algorithm to convert a number to a string/a>, given a number var>input/var>, is as follows/strong>: Return a a href#valid-week-string idweek-state-(typeweek):valid-week-string-8>valid week string/a> that represents the a href#concept-week idweek-state-(typeweek):concept-week-6>week/a> that, in UTC, is current var>input/var> milliseconds after midnight UTC on the morning of 1970-01-01 (the time represented by the value code>1970-01-01T00:00:00.0Z/code>)./p> p>strong>The a href#concept-input-value-string-date idweek-state-(typeweek):concept-input-value-string-date>algorithm to convert a string to a code>Date/code> object/a>, given a string var>input/var>, is as follows/strong>: If a href#parse-a-week-string idweek-state-(typeweek):parse-a-week-string-3>parsing a week/a> from var>input/var> results in an error, then return an error; otherwise, return a href#create-a-date-object idweek-state-(typeweek):create-a-date-object>a new code>Date/code> object/a> representing midnight UTC on the morning of the Monday of the parsed a href#concept-week idweek-state-(typeweek):concept-week-7>week/a>./p> p>strong>The a href#concept-input-value-date-string idweek-state-(typeweek):concept-input-value-date-string>algorithm to convert a code>Date/code> object to a string/a>, given a code idweek-state-(typeweek):date>a data-x-internaldate hrefhttps://tc39.github.io/ecma262/#sec-date-objects>Date/a>/code> object var>input/var>, is as follows/strong>: Return a a href#valid-week-string idweek-state-(typeweek):valid-week-string-9>valid week string/a> that represents the a href#concept-week idweek-state-(typeweek):concept-week-8>week/a> current at the time represented by var>input/var> in the UTC time zone./p> div classbookkeeping> p>The following common code idweek-state-(typeweek):the-input-element-3>a href#the-input-element>input/a>/code> element content attributes, IDL attributes, and methods a href#concept-input-apply idweek-state-(typeweek):concept-input-apply>apply/a> to the element: code idweek-state-(typeweek):attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code>, code idweek-state-(typeweek):attr-input-list>a href#attr-input-list>list/a>/code>, code idweek-state-(typeweek):attr-input-max-2>a href#attr-input-max>max/a>/code>, code idweek-state-(typeweek):attr-input-min-2>a href#attr-input-min>min/a>/code>, code idweek-state-(typeweek):attr-input-readonly>a href#attr-input-readonly>readonly/a>/code>, code idweek-state-(typeweek):attr-input-required>a href#attr-input-required>required/a>/code>, and code idweek-state-(typeweek):attr-input-step-2>a href#attr-input-step>step/a>/code> content attributes; code idweek-state-(typeweek):dom-input-list>a href#dom-input-list>list/a>/code>, code idweek-state-(typeweek):dom-input-value>a href#dom-input-value>value/a>/code>, code idweek-state-(typeweek):dom-input-valueasdate>a href#dom-input-valueasdate>valueAsDate/a>/code>, and code idweek-state-(typeweek):dom-input-valueasnumber>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idweek-state-(typeweek):dom-textarea/input-select>a href#dom-textarea/input-select>select()/a>/code>, code idweek-state-(typeweek):dom-input-stepdown>a href#dom-input-stepdown>stepDown()/a>/code>, and code idweek-state-(typeweek):dom-input-stepup>a href#dom-input-stepup>stepUp()/a>/code> methods./p> p>The code idweek-state-(typeweek):dom-input-value-2>a href#dom-input-value>value/a>/code> IDL attribute is in mode a href#dom-input-value-value idweek-state-(typeweek):dom-input-value-value>value/a>./p> p>The code idweek-state-(typeweek):event-input>a href#event-input>input/a>/code> and code idweek-state-(typeweek):event-change>a href#event-change>change/a>/code> events a href#concept-input-apply idweek-state-(typeweek):concept-input-apply-2>apply/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idweek-state-(typeweek):do-not-apply>do not apply/a> to the element: code idweek-state-(typeweek):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code idweek-state-(typeweek):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code idweek-state-(typeweek):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code idweek-state-(typeweek):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code idweek-state-(typeweek):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code idweek-state-(typeweek):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code idweek-state-(typeweek):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code idweek-state-(typeweek):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idweek-state-(typeweek):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code idweek-state-(typeweek):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code idweek-state-(typeweek):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code idweek-state-(typeweek):attr-input-maxlength classno-backref>a href#attr-input-maxlength>maxlength/a>/code>, code idweek-state-(typeweek):attr-input-minlength classno-backref>a href#attr-input-minlength>minlength/a>/code>, code idweek-state-(typeweek):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code idweek-state-(typeweek):attr-input-pattern classno-backref>a href#attr-input-pattern>pattern/a>/code>, code idweek-state-(typeweek):attr-input-placeholder classno-backref>a href#attr-input-placeholder>placeholder/a>/code>, code idweek-state-(typeweek):attr-input-size classno-backref>a href#attr-input-size>size/a>/code>, code idweek-state-(typeweek):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, and code idweek-state-(typeweek):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply idweek-state-(typeweek):do-not-apply-2>do not apply/a> to the element: code idweek-state-(typeweek):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code idweek-state-(typeweek):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code idweek-state-(typeweek):dom-textarea/input-selectionstart classno-backref>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idweek-state-(typeweek):dom-textarea/input-selectionend classno-backref>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, and code idweek-state-(typeweek):dom-textarea/input-selectiondirection classno-backref>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code> IDL attributes; code idweek-state-(typeweek):dom-textarea/input-setrangetext classno-backref>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, and code idweek-state-(typeweek):dom-textarea/input-setselectionrange classno-backref>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code> methods./p> /div> h6 idtime-state-(typetime)>span classsecno>4.10.5.1.10/span> dfn>Time/dfn> state (code>typetime/code>)a href#time-state-(typetime) classself-link>/a>/h6> p>When an code idtime-state-(typetime):the-input-element>a href#the-input-element>input/a>/code> elements code idtime-state-(typetime):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#time-state-(typetime) idtime-state-(typetime):time-state-(typetime)>Time/a> state, the rules in this section apply./p> p>The code idtime-state-(typetime):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idtime-state-(typetime):represents>represents/a> a control for setting the elements a href#concept-fe-value idtime-state-(typetime):concept-fe-value>value/a> to a string representing a specific a href#concept-time idtime-state-(typetime):concept-time>time/a>./p> p>If the element is i idtime-state-(typetime):concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i>, the user agent should allow the user to change the a href#concept-time idtime-state-(typetime):concept-time-2>time/a> represented by its a href#concept-fe-value idtime-state-(typetime):concept-fe-value-2>value/a>, as obtained by a href#parse-a-time-string idtime-state-(typetime):parse-a-time-string>parsing a time/a> from it. User agents must not allow the user to set the a href#concept-fe-value idtime-state-(typetime):concept-fe-value-3>value/a> to a non-empty string that is not a a href#valid-time-string idtime-state-(typetime):valid-time-string>valid time string/a>. If the user agent provides a user interface for selecting a a href#concept-time idtime-state-(typetime):concept-time-3>time/a>, then the a href#concept-fe-value idtime-state-(typetime):concept-fe-value-4>value/a> must be set to a a href#valid-time-string idtime-state-(typetime):valid-time-string-2>valid time string/a> representing the users selection. User agents should allow the user to set the a href#concept-fe-value idtime-state-(typetime):concept-fe-value-5>value/a> to the empty string./p> p>strong>Constraint validation/strong>: While the user interface describes input that the user agent cannot convert to a a href#valid-time-string idtime-state-(typetime):valid-time-string-3>valid time string/a>, the control is a href#suffering-from-bad-input idtime-state-(typetime):suffering-from-bad-input>suffering from bad input/a>./p> p classnote>See the a href#input-author-notes>introduction section/a> for a discussion of the difference between the input format and submission format for date, time, and number form controls, and the a href#input-impl-notes>implementation notes/a> regarding localization of form controls./p> p>The code idtime-state-(typetime):attr-input-value>a href#attr-input-value>value/a>/code> attribute, if specified and not empty, must have a value that is a a href#valid-time-string idtime-state-(typetime):valid-time-string-4>valid time string/a>./p> p>strong>The a href#value-sanitization-algorithm idtime-state-(typetime):value-sanitization-algorithm>value sanitization algorithm/a> is as follows/strong>: If the a href#concept-fe-value idtime-state-(typetime):concept-fe-value-6>value/a> of the element is not a a href#valid-time-string idtime-state-(typetime):valid-time-string-5>valid time string/a>, then set it to the empty string instead./p> p>The form control a href#has-a-periodic-domain idtime-state-(typetime):has-a-periodic-domain>has a periodic domain/a>./p> p>The code idtime-state-(typetime):attr-input-min>a href#attr-input-min>min/a>/code> attribute, if specified, must have a value that is a a href#valid-time-string idtime-state-(typetime):valid-time-string-6>valid time string/a>. The code idtime-state-(typetime):attr-input-max>a href#attr-input-max>max/a>/code> attribute, if specified, must have a value that is a a href#valid-time-string idtime-state-(typetime):valid-time-string-7>valid time string/a>./p> p>The code idtime-state-(typetime):attr-input-step>a href#attr-input-step>step/a>/code> attribute is expressed in seconds. The a href#concept-input-step-scale idtime-state-(typetime):concept-input-step-scale>step scale factor/a> is 1000 (which converts the seconds to milliseconds, as used in the other algorithms). The a href#concept-input-step-default idtime-state-(typetime):concept-input-step-default>default step/a> is 60 seconds./p> p>When the element is a href#suffering-from-a-step-mismatch idtime-state-(typetime):suffering-from-a-step-mismatch>suffering from a step mismatch/a>, the user agent may round the elements a href#concept-fe-value idtime-state-(typetime):concept-fe-value-7>value/a> to the nearest a href#concept-time idtime-state-(typetime):concept-time-4>time/a> for which the element would not a href#suffering-from-a-step-mismatch idtime-state-(typetime):suffering-from-a-step-mismatch-2>suffer from a step mismatch/a>./p> p>strong>The a href#concept-input-value-string-number idtime-state-(typetime):concept-input-value-string-number>algorithm to convert a string to a number/a>, given a string var>input/var>, is as follows/strong>: If a href#parse-a-time-string idtime-state-(typetime):parse-a-time-string-2>parsing a time/a> from var>input/var> results in an error, then return an error; otherwise, return the number of milliseconds elapsed from midnight to the parsed a href#concept-time idtime-state-(typetime):concept-time-5>time/a> on a day with no time changes./p> p>strong>The a href#concept-input-value-number-string idtime-state-(typetime):concept-input-value-number-string>algorithm to convert a number to a string/a>, given a number var>input/var>, is as follows/strong>: Return a a href#valid-time-string idtime-state-(typetime):valid-time-string-8>valid time string/a> that represents the a href#concept-time idtime-state-(typetime):concept-time-6>time/a> that is var>input/var> milliseconds after midnight on a day with no time changes./p> p>strong>The a href#concept-input-value-string-date idtime-state-(typetime):concept-input-value-string-date>algorithm to convert a string to a code>Date/code> object/a>, given a string var>input/var>, is as follows/strong>: If a href#parse-a-time-string idtime-state-(typetime):parse-a-time-string-3>parsing a time/a> from var>input/var> results in an error, then return an error; otherwise, return a href#create-a-date-object idtime-state-(typetime):create-a-date-object>a new code>Date/code> object/a> representing the parsed a href#concept-time idtime-state-(typetime):concept-time-7>time/a> in UTC on 1970-01-01./p> p>strong>The a href#concept-input-value-date-string idtime-state-(typetime):concept-input-value-date-string>algorithm to convert a code>Date/code> object to a string/a>, given a code idtime-state-(typetime):date>a data-x-internaldate hrefhttps://tc39.github.io/ecma262/#sec-date-objects>Date/a>/code> object var>input/var>, is as follows/strong>: Return a a href#valid-time-string idtime-state-(typetime):valid-time-string-9>valid time string/a> that represents the UTC a href#concept-time idtime-state-(typetime):concept-time-8>time/a> component that is represented by var>input/var>./p> div classbookkeeping> p>The following common code idtime-state-(typetime):the-input-element-3>a href#the-input-element>input/a>/code> element content attributes, IDL attributes, and methods a href#concept-input-apply idtime-state-(typetime):concept-input-apply>apply/a> to the element: code idtime-state-(typetime):attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code>, code idtime-state-(typetime):attr-input-list>a href#attr-input-list>list/a>/code>, code idtime-state-(typetime):attr-input-max-2>a href#attr-input-max>max/a>/code>, code idtime-state-(typetime):attr-input-min-2>a href#attr-input-min>min/a>/code>, code idtime-state-(typetime):attr-input-readonly>a href#attr-input-readonly>readonly/a>/code>, code idtime-state-(typetime):attr-input-required>a href#attr-input-required>required/a>/code>, and code idtime-state-(typetime):attr-input-step-2>a href#attr-input-step>step/a>/code> content attributes; code idtime-state-(typetime):dom-input-list>a href#dom-input-list>list/a>/code>, code idtime-state-(typetime):dom-input-value>a href#dom-input-value>value/a>/code>, code idtime-state-(typetime):dom-input-valueasdate>a href#dom-input-valueasdate>valueAsDate/a>/code>, and code idtime-state-(typetime):dom-input-valueasnumber>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idtime-state-(typetime):dom-textarea/input-select>a href#dom-textarea/input-select>select()/a>/code>, code idtime-state-(typetime):dom-input-stepdown>a href#dom-input-stepdown>stepDown()/a>/code>, and code idtime-state-(typetime):dom-input-stepup>a href#dom-input-stepup>stepUp()/a>/code> methods./p> p>The code idtime-state-(typetime):dom-input-value-2>a href#dom-input-value>value/a>/code> IDL attribute is in mode a href#dom-input-value-value idtime-state-(typetime):dom-input-value-value>value/a>./p> p>The code idtime-state-(typetime):event-input>a href#event-input>input/a>/code> and code idtime-state-(typetime):event-change>a href#event-change>change/a>/code> events a href#concept-input-apply idtime-state-(typetime):concept-input-apply-2>apply/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idtime-state-(typetime):do-not-apply>do not apply/a> to the element: code idtime-state-(typetime):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code idtime-state-(typetime):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code idtime-state-(typetime):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code idtime-state-(typetime):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code idtime-state-(typetime):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code idtime-state-(typetime):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code idtime-state-(typetime):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code idtime-state-(typetime):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idtime-state-(typetime):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code idtime-state-(typetime):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code idtime-state-(typetime):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code idtime-state-(typetime):attr-input-maxlength classno-backref>a href#attr-input-maxlength>maxlength/a>/code>, code idtime-state-(typetime):attr-input-minlength classno-backref>a href#attr-input-minlength>minlength/a>/code>, code idtime-state-(typetime):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code idtime-state-(typetime):attr-input-pattern classno-backref>a href#attr-input-pattern>pattern/a>/code>, code idtime-state-(typetime):attr-input-placeholder classno-backref>a href#attr-input-placeholder>placeholder/a>/code>, code idtime-state-(typetime):attr-input-size classno-backref>a href#attr-input-size>size/a>/code>, code idtime-state-(typetime):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, and code idtime-state-(typetime):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply idtime-state-(typetime):do-not-apply-2>do not apply/a> to the element: code idtime-state-(typetime):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code idtime-state-(typetime):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code idtime-state-(typetime):dom-textarea/input-selectionstart classno-backref>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idtime-state-(typetime):dom-textarea/input-selectionend classno-backref>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, and code idtime-state-(typetime):dom-textarea/input-selectiondirection classno-backref>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code> IDL attributes; code idtime-state-(typetime):dom-textarea/input-setrangetext classno-backref>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, and code idtime-state-(typetime):dom-textarea/input-setselectionrange classno-backref>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code> methods./p> /div> h6 idlocal-date-and-time-state-(typedatetime-local)>span classsecno>4.10.5.1.11/span> dfn>Local Date and Time/dfn> state (code>typedatetime-local/code>)a href#local-date-and-time-state-(typedatetime-local) classself-link>/a>/h6> p>When an code idlocal-date-and-time-state-(typedatetime-local):the-input-element>a href#the-input-element>input/a>/code> elements code idlocal-date-and-time-state-(typedatetime-local):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#local-date-and-time-state-(typedatetime-local) idlocal-date-and-time-state-(typedatetime-local):local-date-and-time-state-(typedatetime-local)>Local Date and Time/a> state, the rules in this section apply./p> p>The code idlocal-date-and-time-state-(typedatetime-local):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idlocal-date-and-time-state-(typedatetime-local):represents>represents/a> a control for setting the elements a href#concept-fe-value idlocal-date-and-time-state-(typedatetime-local):concept-fe-value>value/a> to a string representing a a href#concept-datetime-local idlocal-date-and-time-state-(typedatetime-local):concept-datetime-local>local date and time/a>, with no time-zone offset information./p> p>If the element is i idlocal-date-and-time-state-(typedatetime-local):concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i>, the user agent should allow the user to change the a href#concept-datetime-local idlocal-date-and-time-state-(typedatetime-local):concept-datetime-local-2>date and time/a> represented by its a href#concept-fe-value idlocal-date-and-time-state-(typedatetime-local):concept-fe-value-2>value/a>, as obtained by a href#parse-a-local-date-and-time-string idlocal-date-and-time-state-(typedatetime-local):parse-a-local-date-and-time-string>parsing a date and time/a> from it. User agents must not allow the user to set the a href#concept-fe-value idlocal-date-and-time-state-(typedatetime-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 idlocal-date-and-time-state-(typedatetime-local):valid-normalised-local-date-and-time-string>valid normalized local date and time string/a>. If the user agent provides a user interface for selecting a a href#concept-datetime-local idlocal-date-and-time-state-(typedatetime-local):concept-datetime-local-3>local date and time/a>, then the a href#concept-fe-value idlocal-date-and-time-state-(typedatetime-local):concept-fe-value-4>value/a> must be set to a a href#valid-normalised-local-date-and-time-string idlocal-date-and-time-state-(typedatetime-local):valid-normalised-local-date-and-time-string-2>valid normalized local date and time string/a> representing the users selection. User agents should allow the user to set the a href#concept-fe-value idlocal-date-and-time-state-(typedatetime-local):concept-fe-value-5>value/a> to the empty string./p> p>strong>Constraint validation/strong>: While the user interface describes input that the user agent cannot convert to a a href#valid-normalised-local-date-and-time-string idlocal-date-and-time-state-(typedatetime-local):valid-normalised-local-date-and-time-string-3>valid normalized local date and time string/a>, the control is a href#suffering-from-bad-input idlocal-date-and-time-state-(typedatetime-local):suffering-from-bad-input>suffering from bad input/a>./p> p classnote>See the a href#input-author-notes>introduction section/a> for a discussion of the difference between the input format and submission format for date, time, and number form controls, and the a href#input-impl-notes>implementation notes/a> regarding localization of form controls./p> p>The code idlocal-date-and-time-state-(typedatetime-local):attr-input-value>a href#attr-input-value>value/a>/code> attribute, if specified and not empty, must have a value that is a a href#valid-local-date-and-time-string idlocal-date-and-time-state-(typedatetime-local):valid-local-date-and-time-string>valid local date and time string/a>./p> p>strong>The a href#value-sanitization-algorithm idlocal-date-and-time-state-(typedatetime-local):value-sanitization-algorithm>value sanitization algorithm/a> is as follows/strong>: If the a href#concept-fe-value idlocal-date-and-time-state-(typedatetime-local):concept-fe-value-6>value/a> of the element is a a href#valid-local-date-and-time-string idlocal-date-and-time-state-(typedatetime-local):valid-local-date-and-time-string-2>valid local date and time string/a>, then set it to a a href#valid-normalised-local-date-and-time-string idlocal-date-and-time-state-(typedatetime-local):valid-normalised-local-date-and-time-string-4>valid normalized local date and time string/a> representing the same date and time; otherwise, set it to the empty string instead./p> p>The code idlocal-date-and-time-state-(typedatetime-local):attr-input-min>a href#attr-input-min>min/a>/code> attribute, if specified, must have a value that is a a href#valid-local-date-and-time-string idlocal-date-and-time-state-(typedatetime-local):valid-local-date-and-time-string-3>valid local date and time string/a>. The code idlocal-date-and-time-state-(typedatetime-local):attr-input-max>a href#attr-input-max>max/a>/code> attribute, if specified, must have a value that is a a href#valid-local-date-and-time-string idlocal-date-and-time-state-(typedatetime-local):valid-local-date-and-time-string-4>valid local date and time string/a>./p> p>The code idlocal-date-and-time-state-(typedatetime-local):attr-input-step>a href#attr-input-step>step/a>/code> attribute is expressed in seconds. The a href#concept-input-step-scale idlocal-date-and-time-state-(typedatetime-local):concept-input-step-scale>step scale factor/a> is 1000 (which converts the seconds to milliseconds, as used in the other algorithms). The a href#concept-input-step-default idlocal-date-and-time-state-(typedatetime-local):concept-input-step-default>default step/a> is 60 seconds./p> p>When the element is a href#suffering-from-a-step-mismatch idlocal-date-and-time-state-(typedatetime-local):suffering-from-a-step-mismatch>suffering from a step mismatch/a>, the user agent may round the elements a href#concept-fe-value idlocal-date-and-time-state-(typedatetime-local):concept-fe-value-7>value/a> to the nearest a href#concept-datetime-local idlocal-date-and-time-state-(typedatetime-local):concept-datetime-local-4>local date and time/a> for which the element would not a href#suffering-from-a-step-mismatch idlocal-date-and-time-state-(typedatetime-local):suffering-from-a-step-mismatch-2>suffer from a step mismatch/a>./p> p>strong>The a href#concept-input-value-string-number idlocal-date-and-time-state-(typedatetime-local):concept-input-value-string-number>algorithm to convert a string to a number/a>, given a string var>input/var>, is as follows/strong>: If a href#parse-a-local-date-and-time-string idlocal-date-and-time-state-(typedatetime-local):parse-a-local-date-and-time-string-2>parsing a date and time/a> from var>input/var> results in an error, then return an error; otherwise, return the number of milliseconds elapsed from midnight on the morning of 1970-01-01 (the time represented by the value code>1970-01-01T00:00:00.0/code>) to the parsed a href#concept-datetime-local idlocal-date-and-time-state-(typedatetime-local):concept-datetime-local-5>local date and time/a>, ignoring leap seconds./p> p>strong>The a href#concept-input-value-number-string idlocal-date-and-time-state-(typedatetime-local):concept-input-value-number-string>algorithm to convert a number to a string/a>, given a number var>input/var>, is as follows/strong>: Return a a href#valid-normalised-local-date-and-time-string idlocal-date-and-time-state-(typedatetime-local):valid-normalised-local-date-and-time-string-5>valid normalized local date and time string/a> that represents the date and time that is var>input/var> milliseconds after midnight on the morning of 1970-01-01 (the time represented by the value code>1970-01-01T00:00:00.0/code>)./p> p classnote>See a href#only-contemporary-times>the note on historical dates/a> in the a href#date-state-(typedate) idlocal-date-and-time-state-(typedatetime-local):date-state-(typedate)>Date/a> state section./p> div classbookkeeping> p>The following common code idlocal-date-and-time-state-(typedatetime-local):the-input-element-3>a href#the-input-element>input/a>/code> element content attributes, IDL attributes, and methods a href#concept-input-apply idlocal-date-and-time-state-(typedatetime-local):concept-input-apply>apply/a> to the element: code idlocal-date-and-time-state-(typedatetime-local):attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-input-list>a href#attr-input-list>list/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-input-max-2>a href#attr-input-max>max/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-input-min-2>a href#attr-input-min>min/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-input-readonly>a href#attr-input-readonly>readonly/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-input-required>a href#attr-input-required>required/a>/code>, and code idlocal-date-and-time-state-(typedatetime-local):attr-input-step-2>a href#attr-input-step>step/a>/code> content attributes; code idlocal-date-and-time-state-(typedatetime-local):dom-input-list>a href#dom-input-list>list/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):dom-input-value>a href#dom-input-value>value/a>/code>, and code idlocal-date-and-time-state-(typedatetime-local):dom-input-valueasnumber>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idlocal-date-and-time-state-(typedatetime-local):dom-textarea/input-select>a href#dom-textarea/input-select>select()/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):dom-input-stepdown>a href#dom-input-stepdown>stepDown()/a>/code>, and code idlocal-date-and-time-state-(typedatetime-local):dom-input-stepup>a href#dom-input-stepup>stepUp()/a>/code> methods./p> p>The code idlocal-date-and-time-state-(typedatetime-local):dom-input-value-2>a href#dom-input-value>value/a>/code> IDL attribute is in mode a href#dom-input-value-value idlocal-date-and-time-state-(typedatetime-local):dom-input-value-value>value/a>./p> p>The code idlocal-date-and-time-state-(typedatetime-local):event-input>a href#event-input>input/a>/code> and code idlocal-date-and-time-state-(typedatetime-local):event-change>a href#event-change>change/a>/code> events a href#concept-input-apply idlocal-date-and-time-state-(typedatetime-local):concept-input-apply-2>apply/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idlocal-date-and-time-state-(typedatetime-local):do-not-apply>do not apply/a> to the element: code idlocal-date-and-time-state-(typedatetime-local):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-input-maxlength classno-backref>a href#attr-input-maxlength>maxlength/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-input-minlength classno-backref>a href#attr-input-minlength>minlength/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-input-pattern classno-backref>a href#attr-input-pattern>pattern/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-input-placeholder classno-backref>a href#attr-input-placeholder>placeholder/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-input-size classno-backref>a href#attr-input-size>size/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, and code idlocal-date-and-time-state-(typedatetime-local):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply idlocal-date-and-time-state-(typedatetime-local):do-not-apply-2>do not apply/a> to the element: code idlocal-date-and-time-state-(typedatetime-local):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):dom-textarea/input-selectionstart classno-backref>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):dom-textarea/input-selectionend classno-backref>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code idlocal-date-and-time-state-(typedatetime-local):dom-textarea/input-selectiondirection classno-backref>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, and code idlocal-date-and-time-state-(typedatetime-local):dom-input-valueasdate classno-backref>a href#dom-input-valueasdate>valueAsDate/a>/code> IDL attributes; code idlocal-date-and-time-state-(typedatetime-local):dom-textarea/input-setrangetext classno-backref>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, and code idlocal-date-and-time-state-(typedatetime-local):dom-textarea/input-setselectionrange classno-backref>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code> methods./p> /div> div classexample> p>The following example shows part of a flight booking application. The application uses an code idlocal-date-and-time-state-(typedatetime-local):the-input-element-4>a href#the-input-element>input/a>/code> element with its code idlocal-date-and-time-state-(typedatetime-local):attr-input-type-2>a href#attr-input-type>type/a>/code> attribute set to code idlocal-date-and-time-state-(typedatetime-local):local-date-and-time-state-(typedatetime-local)-2>a href#local-date-and-time-state-(typedatetime-local)>datetime-local/a>/code>, and it then interprets the given date and time in the time zone of the selected airport./p> pre><fieldset> <legend>Destination</legend> <p><label>Airport: <input typetext nameto listairports></label></p> <p><label>Departure time: <input typedatetime-local nametotime step3600></label></p></fieldset><datalist idairports> <option valueATL labelAtlanta> <option valueMEM labelMemphis> <option valueLHR labelLondon Heathrow> <option valueLAX labelLos Angeles> <option valueFRA labelFrankfurt></datalist>/pre> /div> h6 idnumber-state-(typenumber)>span classsecno>4.10.5.1.12/span> dfn idnumber-state>Number/dfn> state (code>typenumber/code>)a href#number-state-(typenumber) classself-link>/a>/h6>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> input-numberspan classand_chr partial>span>Chrome for Android (limited)/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>6+/span>/span>span classios_saf partial>span>iOS Safari (limited)/span> span>3.2+/span>/span>span classand_uc partial>span>UC Browser for Android (limited)/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>29+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung partial>span>Samsung Internet (limited)/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>5+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid partial>span>Android Browser (limited)/span> span>4+/span>/span>span classopera yes>span>Opera/span> span>9+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featinput-number>caniuse.com/a>/div> p>When an code idnumber-state-(typenumber):the-input-element>a href#the-input-element>input/a>/code> elements code idnumber-state-(typenumber):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#number-state-(typenumber) idnumber-state-(typenumber):number-state-(typenumber)>Number/a> state, the rules in this section apply./p> p>The code idnumber-state-(typenumber):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idnumber-state-(typenumber):represents>represents/a> a control for setting the elements a href#concept-fe-value idnumber-state-(typenumber):concept-fe-value>value/a> to a string representing a number./p> p>If the element is i idnumber-state-(typenumber):concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i>, the user agent should allow the user to change the number represented by its a href#concept-fe-value idnumber-state-(typenumber):concept-fe-value-2>value/a>, as obtained from applying the a href#rules-for-parsing-floating-point-number-values idnumber-state-(typenumber):rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values/a> to it. User agents must not allow the user to set the a href#concept-fe-value idnumber-state-(typenumber):concept-fe-value-3>value/a> to a non-empty string that is not a a href#valid-floating-point-number idnumber-state-(typenumber):valid-floating-point-number>valid floating-point number/a>. If the user agent provides a user interface for selecting a number, then the a href#concept-fe-value idnumber-state-(typenumber):concept-fe-value-4>value/a> must be set to the a href#best-representation-of-the-number-as-a-floating-point-number idnumber-state-(typenumber):best-representation-of-the-number-as-a-floating-point-number>best representation of the number representing the users selection as a floating-point number/a>. User agents should allow the user to set the a href#concept-fe-value idnumber-state-(typenumber):concept-fe-value-5>value/a> to the empty string./p> p>strong>Constraint validation/strong>: While the user interface describes input that the user agent cannot convert to a a href#valid-floating-point-number idnumber-state-(typenumber):valid-floating-point-number-2>valid floating-point number/a>, the control is a href#suffering-from-bad-input idnumber-state-(typenumber):suffering-from-bad-input>suffering from bad input/a>./p> p classnote>This specification does not define what user interface user agents are to use; user agent vendors are encouraged to consider what would best serve their users needs. For example, a user agent in Persian or Arabic markets might support Persian and Arabic numeric input (converting it to the format required for submission as described above). Similarly, a user agent designed for Romans might display the value in Roman numerals rather than in decimal; or (more realistically) a user agent designed for the French market might display the value with apostrophes between thousands and commas before the decimals, and allow the user to enter a value in that manner, internally converting it to the submission format described above./p> p>The code idnumber-state-(typenumber):attr-input-value>a href#attr-input-value>value/a>/code> attribute, if specified and not empty, must have a value that is a a href#valid-floating-point-number idnumber-state-(typenumber):valid-floating-point-number-3>valid floating-point number/a>./p> p>strong>The a href#value-sanitization-algorithm idnumber-state-(typenumber):value-sanitization-algorithm>value sanitization algorithm/a> is as follows/strong>: If the a href#concept-fe-value idnumber-state-(typenumber):concept-fe-value-6>value/a> of the element is not a a href#valid-floating-point-number idnumber-state-(typenumber):valid-floating-point-number-4>valid floating-point number/a>, then set it to the empty string instead./p> p>The code idnumber-state-(typenumber):attr-input-min>a href#attr-input-min>min/a>/code> attribute, if specified, must have a value that is a a href#valid-floating-point-number idnumber-state-(typenumber):valid-floating-point-number-5>valid floating-point number/a>. The code idnumber-state-(typenumber):attr-input-max>a href#attr-input-max>max/a>/code> attribute, if specified, must have a value that is a a href#valid-floating-point-number idnumber-state-(typenumber):valid-floating-point-number-6>valid floating-point number/a>./p> p>The a href#concept-input-step-scale idnumber-state-(typenumber):concept-input-step-scale>step scale factor/a> is 1. The a href#concept-input-step-default idnumber-state-(typenumber):concept-input-step-default>default step/a> is 1 (allowing only integers to be selected by the user, unless the a href#concept-input-min-zero idnumber-state-(typenumber):concept-input-min-zero>step base/a> has a non-integer value)./p> p>When the element is a href#suffering-from-a-step-mismatch idnumber-state-(typenumber):suffering-from-a-step-mismatch>suffering from a step mismatch/a>, the user agent may round the elements a href#concept-fe-value idnumber-state-(typenumber):concept-fe-value-7>value/a> to the nearest number for which the element would not a href#suffering-from-a-step-mismatch idnumber-state-(typenumber):suffering-from-a-step-mismatch-2>suffer from a step mismatch/a>. If there are two such numbers, user agents are encouraged to pick the one nearest positive infinity./p> p>strong>The a href#concept-input-value-string-number idnumber-state-(typenumber):concept-input-value-string-number>algorithm to convert a string to a number/a>, given a string var>input/var>, is as follows/strong>: If applying the a href#rules-for-parsing-floating-point-number-values idnumber-state-(typenumber):rules-for-parsing-floating-point-number-values-2>rules for parsing floating-point number values/a> to var>input/var> results in an error, then return an error; otherwise, return the resulting number./p> p>strong>The a href#concept-input-value-number-string idnumber-state-(typenumber):concept-input-value-number-string>algorithm to convert a number to a string/a>, given a number var>input/var>, is as follows/strong>: Return a a href#valid-floating-point-number idnumber-state-(typenumber):valid-floating-point-number-7>valid floating-point number/a> that represents var>input/var>./p> div classbookkeeping> p>The following common code idnumber-state-(typenumber):the-input-element-3>a href#the-input-element>input/a>/code> element content attributes, IDL attributes, and methods a href#concept-input-apply idnumber-state-(typenumber):concept-input-apply>apply/a> to the element: code idnumber-state-(typenumber):attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code>, code idnumber-state-(typenumber):attr-input-list>a href#attr-input-list>list/a>/code>, code idnumber-state-(typenumber):attr-input-max-2>a href#attr-input-max>max/a>/code>, code idnumber-state-(typenumber):attr-input-min-2>a href#attr-input-min>min/a>/code>, code idnumber-state-(typenumber):attr-input-placeholder>a href#attr-input-placeholder>placeholder/a>/code>, code idnumber-state-(typenumber):attr-input-readonly>a href#attr-input-readonly>readonly/a>/code>, code idnumber-state-(typenumber):attr-input-required>a href#attr-input-required>required/a>/code>, and code idnumber-state-(typenumber):attr-input-step>a href#attr-input-step>step/a>/code> content attributes; code idnumber-state-(typenumber):dom-input-list>a href#dom-input-list>list/a>/code>, code idnumber-state-(typenumber):dom-input-value>a href#dom-input-value>value/a>/code>, and code idnumber-state-(typenumber):dom-input-valueasnumber>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idnumber-state-(typenumber):dom-textarea/input-select>a href#dom-textarea/input-select>select()/a>/code>, code idnumber-state-(typenumber):dom-input-stepdown>a href#dom-input-stepdown>stepDown()/a>/code>, and code idnumber-state-(typenumber):dom-input-stepup>a href#dom-input-stepup>stepUp()/a>/code> methods./p> p>The code idnumber-state-(typenumber):dom-input-value-2>a href#dom-input-value>value/a>/code> IDL attribute is in mode a href#dom-input-value-value idnumber-state-(typenumber):dom-input-value-value>value/a>./p> p>The code idnumber-state-(typenumber):event-input>a href#event-input>input/a>/code> and code idnumber-state-(typenumber):event-change>a href#event-change>change/a>/code> events a href#concept-input-apply idnumber-state-(typenumber):concept-input-apply-2>apply/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idnumber-state-(typenumber):do-not-apply>do not apply/a> to the element: code idnumber-state-(typenumber):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code idnumber-state-(typenumber):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code idnumber-state-(typenumber):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code idnumber-state-(typenumber):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code idnumber-state-(typenumber):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code idnumber-state-(typenumber):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code idnumber-state-(typenumber):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code idnumber-state-(typenumber):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idnumber-state-(typenumber):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code idnumber-state-(typenumber):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code idnumber-state-(typenumber):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code idnumber-state-(typenumber):attr-input-maxlength classno-backref>a href#attr-input-maxlength>maxlength/a>/code>, code idnumber-state-(typenumber):attr-input-minlength classno-backref>a href#attr-input-minlength>minlength/a>/code>, code idnumber-state-(typenumber):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code idnumber-state-(typenumber):attr-input-pattern classno-backref>a href#attr-input-pattern>pattern/a>/code>, code idnumber-state-(typenumber):attr-input-size classno-backref>a href#attr-input-size>size/a>/code>, code idnumber-state-(typenumber):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, and code idnumber-state-(typenumber):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply idnumber-state-(typenumber):do-not-apply-2>do not apply/a> to the element: code idnumber-state-(typenumber):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code idnumber-state-(typenumber):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code idnumber-state-(typenumber):dom-textarea/input-selectionstart classno-backref>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idnumber-state-(typenumber):dom-textarea/input-selectionend classno-backref>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code idnumber-state-(typenumber):dom-textarea/input-selectiondirection classno-backref>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, and code idnumber-state-(typenumber):dom-input-valueasdate classno-backref>a href#dom-input-valueasdate>valueAsDate/a>/code> IDL attributes; code idnumber-state-(typenumber):dom-textarea/input-setrangetext classno-backref>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, and code idnumber-state-(typenumber):dom-textarea/input-setselectionrange classno-backref>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code> methods./p> /div> div classexample> p>Here is an example of using a numeric input control:/p> pre><label>How much do you want to charge? $<input typenumber min0 step0.01 nameprice></label>/pre> p>As described above, a user agent might support numeric input in the users local format, converting it to the format required for submission as described above. This might include handling grouping separators (as in 872,000,000,000) and various decimal separators (such as 3,99 vs 3.99) or using local digits (such as those in Arabic, Devanagari, Persian, and Thai)./p> /div> p classnote>The code>typenumber/code> state is not appropriate for input that happens to only consist of numbers but isnt strictly speaking a number. For example, it would be inappropriate for credit card numbers or US postal codes. A simple way of determining whether to use code>typenumber/code> is to consider whether it would make sense for the input control to have a spinbox interface (e.g. with up and down arrows). Getting a credit card number wrong by 1 in the last digit isnt a minor mistake, its as wrong as getting every digit incorrect. So it would not make sense for the user to select a credit card number using up and down buttons. When a spinbox interface is not appropriate, code>typetext/code> is probably the right choice (possibly with a code idnumber-state-(typenumber):attr-input-pattern-2>a href#attr-input-pattern>pattern/a>/code> attribute)./p> h6 idrange-state-(typerange)>span classsecno>4.10.5.1.13/span> dfn>Range/dfn> state (code>typerange/code>)a href#range-state-(typerange) classself-link>/a>/h6>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> input-rangespan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>5.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>23+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>3.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>4.2+/span>/span>span classopera yes>span>Opera/span> span>9+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featinput-range>caniuse.com/a>/div> p>When an code idrange-state-(typerange):the-input-element>a href#the-input-element>input/a>/code> elements code idrange-state-(typerange):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#range-state-(typerange) idrange-state-(typerange):range-state-(typerange)>Range/a> state, the rules in this section apply./p> p>The code idrange-state-(typerange):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idrange-state-(typerange):represents>represents/a> a control for setting the elements a href#concept-fe-value idrange-state-(typerange):concept-fe-value>value/a> to a string representing a number, but with the caveat that the exact value is not important, letting UAs provide a simpler interface than they do for the a href#number-state-(typenumber) idrange-state-(typerange):number-state-(typenumber)>Number/a> state./p> p>If the element is i idrange-state-(typerange):concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i>, the user agent should allow the user to change the number represented by its a href#concept-fe-value idrange-state-(typerange):concept-fe-value-2>value/a>, as obtained from applying the a href#rules-for-parsing-floating-point-number-values idrange-state-(typerange):rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values/a> to it. User agents must not allow the user to set the a href#concept-fe-value idrange-state-(typerange):concept-fe-value-3>value/a> to a string that is not a a href#valid-floating-point-number idrange-state-(typerange):valid-floating-point-number>valid floating-point number/a>. If the user agent provides a user interface for selecting a number, then the a href#concept-fe-value idrange-state-(typerange):concept-fe-value-4>value/a> must be set to a a href#best-representation-of-the-number-as-a-floating-point-number idrange-state-(typerange):best-representation-of-the-number-as-a-floating-point-number>best representation of the number representing the users selection as a floating-point number/a>. User agents must not allow the user to set the a href#concept-fe-value idrange-state-(typerange):concept-fe-value-5>value/a> to the empty string./p> p>strong>Constraint validation/strong>: While the user interface describes input that the user agent cannot convert to a a href#valid-floating-point-number idrange-state-(typerange):valid-floating-point-number-2>valid floating-point number/a>, the control is a href#suffering-from-bad-input idrange-state-(typerange):suffering-from-bad-input>suffering from bad input/a>./p> p>The code idrange-state-(typerange):attr-input-value>a href#attr-input-value>value/a>/code> attribute, if specified, must have a value that is a a href#valid-floating-point-number idrange-state-(typerange):valid-floating-point-number-3>valid floating-point number/a>./p> p>strong>The a href#value-sanitization-algorithm idrange-state-(typerange):value-sanitization-algorithm>value sanitization algorithm/a> is as follows/strong>: If the a href#concept-fe-value idrange-state-(typerange):concept-fe-value-6>value/a> of the element is not a a href#valid-floating-point-number idrange-state-(typerange):valid-floating-point-number-4>valid floating-point number/a>, then set it to the a href#best-representation-of-the-number-as-a-floating-point-number idrange-state-(typerange):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 idrange-state-(typerange):concept-input-value-default-range>default value/a>./p> p>The dfn idconcept-input-value-default-range>default value/dfn> is the a href#concept-input-min idrange-state-(typerange):concept-input-min>minimum/a> plus half the difference between the a href#concept-input-min idrange-state-(typerange):concept-input-min-2>minimum/a> and the a href#concept-input-max idrange-state-(typerange):concept-input-max>maximum/a>, unless the a href#concept-input-max idrange-state-(typerange):concept-input-max-2>maximum/a> is less than the a href#concept-input-min idrange-state-(typerange):concept-input-min-3>minimum/a>, in which case the a href#concept-input-value-default-range idrange-state-(typerange):concept-input-value-default-range-2>default value/a> is the a href#concept-input-min idrange-state-(typerange):concept-input-min-4>minimum/a>./p> p>When the element is a href#suffering-from-an-underflow idrange-state-(typerange):suffering-from-an-underflow>suffering from an underflow/a>, the user agent must set the elements a href#concept-fe-value idrange-state-(typerange):concept-fe-value-7>value/a> to the a href#best-representation-of-the-number-as-a-floating-point-number idrange-state-(typerange):best-representation-of-the-number-as-a-floating-point-number-3>best representation, as a floating-point number/a>, of the a href#concept-input-min idrange-state-(typerange):concept-input-min-5>minimum/a>./p> p>When the element is a href#suffering-from-an-overflow idrange-state-(typerange):suffering-from-an-overflow>suffering from an overflow/a>, if the a href#concept-input-max idrange-state-(typerange):concept-input-max-3>maximum/a> is not less than the a href#concept-input-min idrange-state-(typerange):concept-input-min-6>minimum/a>, the user agent must set the elements a href#concept-fe-value idrange-state-(typerange):concept-fe-value-8>value/a> to a a href#valid-floating-point-number idrange-state-(typerange):valid-floating-point-number-5>valid floating-point number/a> that represents the a href#concept-input-max idrange-state-(typerange):concept-input-max-4>maximum/a>./p> p>When the element is a href#suffering-from-a-step-mismatch idrange-state-(typerange):suffering-from-a-step-mismatch>suffering from a step mismatch/a>, the user agent must round the elements a href#concept-fe-value idrange-state-(typerange):concept-fe-value-9>value/a> to the nearest number for which the element would not a href#suffering-from-a-step-mismatch idrange-state-(typerange):suffering-from-a-step-mismatch-2>suffer from a step mismatch/a>, and which is greater than or equal to the a href#concept-input-min idrange-state-(typerange):concept-input-min-7>minimum/a>, and, if the a href#concept-input-max idrange-state-(typerange):concept-input-max-5>maximum/a> is not less than the a href#concept-input-min idrange-state-(typerange):concept-input-min-8>minimum/a>, which is less than or equal to the a href#concept-input-max idrange-state-(typerange):concept-input-max-6>maximum/a>, if there is a number that matches these constraints. If two numbers match these constraints, then user agents must use the one nearest to positive infinity./p> p classexample>For example, the markup code><input typerange min0 max100 step20 value50>/code> results in a range control whose initial value is 60./p> div classexample> p>Here is an example of a range control using an autocomplete list with the code idrange-state-(typerange):attr-input-list>a href#attr-input-list>list/a>/code> attribute. This could be useful if there are values along the full range of the control that are especially important, such as preconfigured light levels or typical speed limits in a range control used as a speed control. The following markup fragment:/p> pre><input typerange min-100 max100 value0 step10 namepower listpowers><datalist idpowers><option value0><option value-30><option value30>span classbad> <option value++50>/span></datalist>/pre> p>...with the following style sheet applied:/p> pre>input { height: 75px; width: 49px; background: #D5CCBB; color: black; }/pre> p>...might render as:/p> p>img src/images/sample-range.png width49 altA vertical slider control whose primary color is black and whose background color is beige, with the slider having five tick marks, one long one at each extremity, and three short ones clustered around the midpoint. height75> p>Note how the UA determined the orientation of the control from the ratio of the style-sheet-specified height and width properties. The colors were similarly derived from the style sheet. The tick marks, however, were derived from the markup. In particular, the code idrange-state-(typerange):attr-input-step>a href#attr-input-step>step/a>/code> attribute has not affected the placement of tick marks, the UA deciding to only use the author-specified completion values and then adding longer tick marks at the extremes./p> p>Note also how the invalid value code>++50/code> was completely ignored./p> /div> div classexample> p>For another example, consider the following markup fragment:/p> pre><input namex typerange min100 max700 step9.09090909 value509.090909>/pre> p>A user agent could display in a variety of ways, for instance:/p> p>img src/images/sample-range-2a.png width231 altAs a dial. height57>/p> p>Or, alternatively, for instance:/p> p>img src/images/sample-range-2b.png width445 altAs a long horizontal slider with tick marks. height56>/p> p>The user agent could pick which one to display based on the dimensions given in the style sheet. This would allow it to maintain the same resolution for the tick marks, despite the differences in width./p> /div> div classexample> p>Finally, here is an example of a range control with two labeled values:/p> pre><input typerange namea lista-values><datalist ida-values><option value10 labelLow><option value90 labelHigh></datalist>/pre> p>With styles that make the control draw vertically, it might look as follows:/p> p>img src/images/sample-range-labels.png width103 altA vertical slider control with two tick marks, one near the top labeled High, and one near the bottom labeled Low. height164> /div> p classnote>In this state, the range and step constraints are enforced even during user input, and there is no way to set the value to the empty string./p> p>The code idrange-state-(typerange):attr-input-min>a href#attr-input-min>min/a>/code> attribute, if specified, must have a value that is a a href#valid-floating-point-number idrange-state-(typerange):valid-floating-point-number-6>valid floating-point number/a>. The a href#concept-input-min-default idrange-state-(typerange):concept-input-min-default>default minimum/a> is 0. The code idrange-state-(typerange):attr-input-max>a href#attr-input-max>max/a>/code> attribute, if specified, must have a value that is a a href#valid-floating-point-number idrange-state-(typerange):valid-floating-point-number-7>valid floating-point number/a>. The a href#concept-input-max-default idrange-state-(typerange):concept-input-max-default>default maximum/a> is 100./p> p>The a href#concept-input-step-scale idrange-state-(typerange):concept-input-step-scale>step scale factor/a> is 1. The a href#concept-input-step-default idrange-state-(typerange):concept-input-step-default>default step/a> is 1 (allowing only integers, unless the code idrange-state-(typerange):attr-input-min-2>a href#attr-input-min>min/a>/code> attribute has a non-integer value)./p> p>strong>The a href#concept-input-value-string-number idrange-state-(typerange):concept-input-value-string-number>algorithm to convert a string to a number/a>, given a string var>input/var>, is as follows/strong>: If applying the a href#rules-for-parsing-floating-point-number-values idrange-state-(typerange):rules-for-parsing-floating-point-number-values-2>rules for parsing floating-point number values/a> to var>input/var> results in an error, then return an error; otherwise, return the resulting number./p> p>strong>The a href#concept-input-value-number-string idrange-state-(typerange):concept-input-value-number-string>algorithm to convert a number to a string/a>, given a number var>input/var>, is as follows/strong>: Return the a href#best-representation-of-the-number-as-a-floating-point-number idrange-state-(typerange):best-representation-of-the-number-as-a-floating-point-number-4>best representation, as a floating-point number/a>, of var>input/var>./p> div classbookkeeping> p>The following common code idrange-state-(typerange):the-input-element-3>a href#the-input-element>input/a>/code> element content attributes, IDL attributes, and methods a href#concept-input-apply idrange-state-(typerange):concept-input-apply>apply/a> to the element: code idrange-state-(typerange):attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code>, code idrange-state-(typerange):attr-input-list-2>a href#attr-input-list>list/a>/code>, code idrange-state-(typerange):attr-input-max-2>a href#attr-input-max>max/a>/code>, code idrange-state-(typerange):attr-input-min-3>a href#attr-input-min>min/a>/code>, and code idrange-state-(typerange):attr-input-step-2>a href#attr-input-step>step/a>/code> content attributes; code idrange-state-(typerange):dom-input-list>a href#dom-input-list>list/a>/code>, code idrange-state-(typerange):dom-input-value>a href#dom-input-value>value/a>/code>, and code idrange-state-(typerange):dom-input-valueasnumber>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idrange-state-(typerange):dom-input-stepdown>a href#dom-input-stepdown>stepDown()/a>/code> and code idrange-state-(typerange):dom-input-stepup>a href#dom-input-stepup>stepUp()/a>/code> methods./p> p>The code idrange-state-(typerange):dom-input-value-2>a href#dom-input-value>value/a>/code> IDL attribute is in mode a href#dom-input-value-value idrange-state-(typerange):dom-input-value-value>value/a>./p> p>The code idrange-state-(typerange):event-input>a href#event-input>input/a>/code> and code idrange-state-(typerange):event-change>a href#event-change>change/a>/code> events a href#concept-input-apply idrange-state-(typerange):concept-input-apply-2>apply/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idrange-state-(typerange):do-not-apply>do not apply/a> to the element: code idrange-state-(typerange):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code idrange-state-(typerange):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code idrange-state-(typerange):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code idrange-state-(typerange):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code idrange-state-(typerange):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code idrange-state-(typerange):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code idrange-state-(typerange):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code idrange-state-(typerange):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idrange-state-(typerange):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code idrange-state-(typerange):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code idrange-state-(typerange):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code idrange-state-(typerange):attr-input-maxlength classno-backref>a href#attr-input-maxlength>maxlength/a>/code>, code idrange-state-(typerange):attr-input-minlength classno-backref>a href#attr-input-minlength>minlength/a>/code>, code idrange-state-(typerange):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code idrange-state-(typerange):attr-input-pattern classno-backref>a href#attr-input-pattern>pattern/a>/code>, code idrange-state-(typerange):attr-input-placeholder classno-backref>a href#attr-input-placeholder>placeholder/a>/code>, code idrange-state-(typerange):attr-input-readonly classno-backref>a href#attr-input-readonly>readonly/a>/code>, code idrange-state-(typerange):attr-input-required classno-backref>a href#attr-input-required>required/a>/code>, code idrange-state-(typerange):attr-input-size classno-backref>a href#attr-input-size>size/a>/code>, code idrange-state-(typerange):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, and code idrange-state-(typerange):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply idrange-state-(typerange):do-not-apply-2>do not apply/a> to the element: code idrange-state-(typerange):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code idrange-state-(typerange):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code idrange-state-(typerange):dom-textarea/input-selectionstart classno-backref>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idrange-state-(typerange):dom-textarea/input-selectionend classno-backref>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code idrange-state-(typerange):dom-textarea/input-selectiondirection classno-backref>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, and code idrange-state-(typerange):dom-input-valueasdate classno-backref>a href#dom-input-valueasdate>valueAsDate/a>/code> IDL attributes; code idrange-state-(typerange):dom-textarea/input-select classno-backref>a href#dom-textarea/input-select>select()/a>/code>, code idrange-state-(typerange):dom-textarea/input-setrangetext classno-backref>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, and code idrange-state-(typerange):dom-textarea/input-setselectionrange classno-backref>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code> methods./p> /div> h6 idcolor-state-(typecolor)>span classsecno>4.10.5.1.14/span> dfn>Color/dfn> state (code>typecolor/code>)a href#color-state-(typecolor) classself-link>/a>/h6>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> input-colorspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>20+/span>/span>span classios_saf no>span>iOS Safari/span> span>None/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>29+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>11+/span>/span>span classedge yes>span>Edge/span> span>14+/span>/span>span classandroid yes>span>Android Browser/span> span>4.4+/span>/span>span classopera yes>span>Opera/span> span>17+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featinput-color>caniuse.com/a>/div> p>When an code idcolor-state-(typecolor):the-input-element>a href#the-input-element>input/a>/code> elements code idcolor-state-(typecolor):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#color-state-(typecolor) idcolor-state-(typecolor):color-state-(typecolor)>Color/a> state, the rules in this section apply./p> p>The code idcolor-state-(typecolor):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idcolor-state-(typecolor):represents>represents/a> a color well control, for setting the elements a href#concept-fe-value idcolor-state-(typecolor):concept-fe-value>value/a> to a string representing a a href#simple-colour idcolor-state-(typecolor):simple-colour>simple color/a>./p> p classnote>In this state, there is always a color picked, and there is no way to set the value to the empty string./p> p>If the element is i idcolor-state-(typecolor):concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i>, the user agent should allow the user to change the color represented by its a href#concept-fe-value idcolor-state-(typecolor):concept-fe-value-2>value/a>, as obtained from applying the a href#rules-for-parsing-simple-colour-values idcolor-state-(typecolor):rules-for-parsing-simple-colour-values>rules for parsing simple color values/a> to it. User agents must not allow the user to set the a href#concept-fe-value idcolor-state-(typecolor):concept-fe-value-3>value/a> to a string that is not a a href#valid-lowercase-simple-colour idcolor-state-(typecolor):valid-lowercase-simple-colour>valid lowercase simple color/a>. If the user agent provides a user interface for selecting a color, then the a href#concept-fe-value idcolor-state-(typecolor):concept-fe-value-4>value/a> must be set to the result of using the a href#rules-for-serialising-simple-colour-values idcolor-state-(typecolor):rules-for-serialising-simple-colour-values>rules for serializing simple color values/a> to the users selection. User agents must not allow the user to set the a href#concept-fe-value idcolor-state-(typecolor):concept-fe-value-5>value/a> to the empty string./p> p>strong>Constraint validation/strong>: While the user interface describes input that the user agent cannot convert to a a href#valid-lowercase-simple-colour idcolor-state-(typecolor):valid-lowercase-simple-colour-2>valid lowercase simple color/a>, the control is a href#suffering-from-bad-input idcolor-state-(typecolor):suffering-from-bad-input>suffering from bad input/a>./p> p>The code idcolor-state-(typecolor):attr-input-value>a href#attr-input-value>value/a>/code> attribute, if specified and not empty, must have a value that is a a href#valid-simple-colour idcolor-state-(typecolor):valid-simple-colour>valid simple color/a>./p> p>strong>The a href#value-sanitization-algorithm idcolor-state-(typecolor):value-sanitization-algorithm>value sanitization algorithm/a> is as follows/strong>: If the a href#concept-fe-value idcolor-state-(typecolor):concept-fe-value-6>value/a> of the element is a a href#valid-simple-colour idcolor-state-(typecolor):valid-simple-colour-2>valid simple color/a>, then set it to the a href#concept-fe-value idcolor-state-(typecolor):concept-fe-value-7>value/a> of the element a idcolor-state-(typecolor):converted-to-ascii-lowercase hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>; otherwise, set it to the string code>#000000/code>./p> div classbookkeeping> p>The following common code idcolor-state-(typecolor):the-input-element-3>a href#the-input-element>input/a>/code> element content attributes and IDL attributes a href#concept-input-apply idcolor-state-(typecolor):concept-input-apply>apply/a> to the element: code idcolor-state-(typecolor):attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code> and code idcolor-state-(typecolor):attr-input-list>a href#attr-input-list>list/a>/code> content attributes; code idcolor-state-(typecolor):dom-input-list>a href#dom-input-list>list/a>/code> and code idcolor-state-(typecolor):dom-input-value>a href#dom-input-value>value/a>/code> IDL attributes; code idcolor-state-(typecolor):dom-textarea/input-select>a href#dom-textarea/input-select>select()/a>/code> method./p> p>The code idcolor-state-(typecolor):dom-input-value-2>a href#dom-input-value>value/a>/code> IDL attribute is in mode a href#dom-input-value-value idcolor-state-(typecolor):dom-input-value-value>value/a>./p> p>The code idcolor-state-(typecolor):event-input>a href#event-input>input/a>/code> and code idcolor-state-(typecolor):event-change>a href#event-change>change/a>/code> events a href#concept-input-apply idcolor-state-(typecolor):concept-input-apply-2>apply/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idcolor-state-(typecolor):do-not-apply>do not apply/a> to the element: code idcolor-state-(typecolor):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code idcolor-state-(typecolor):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code idcolor-state-(typecolor):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code idcolor-state-(typecolor):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code idcolor-state-(typecolor):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code idcolor-state-(typecolor):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code idcolor-state-(typecolor):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code idcolor-state-(typecolor):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idcolor-state-(typecolor):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code idcolor-state-(typecolor):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code idcolor-state-(typecolor):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code idcolor-state-(typecolor):attr-input-max classno-backref>a href#attr-input-max>max/a>/code>, code idcolor-state-(typecolor):attr-input-maxlength classno-backref>a href#attr-input-maxlength>maxlength/a>/code>, code idcolor-state-(typecolor):attr-input-min classno-backref>a href#attr-input-min>min/a>/code>, code idcolor-state-(typecolor):attr-input-minlength classno-backref>a href#attr-input-minlength>minlength/a>/code>, code idcolor-state-(typecolor):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code idcolor-state-(typecolor):attr-input-pattern classno-backref>a href#attr-input-pattern>pattern/a>/code>, code idcolor-state-(typecolor):attr-input-placeholder classno-backref>a href#attr-input-placeholder>placeholder/a>/code>, code idcolor-state-(typecolor):attr-input-readonly classno-backref>a href#attr-input-readonly>readonly/a>/code>, code idcolor-state-(typecolor):attr-input-required classno-backref>a href#attr-input-required>required/a>/code>, code idcolor-state-(typecolor):attr-input-size classno-backref>a href#attr-input-size>size/a>/code>, code idcolor-state-(typecolor):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, code idcolor-state-(typecolor):attr-input-step classno-backref>a href#attr-input-step>step/a>/code>, and code idcolor-state-(typecolor):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply idcolor-state-(typecolor):do-not-apply-2>do not apply/a> to the element: code idcolor-state-(typecolor):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code idcolor-state-(typecolor):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code idcolor-state-(typecolor):dom-textarea/input-selectionstart classno-backref>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idcolor-state-(typecolor):dom-textarea/input-selectionend classno-backref>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code idcolor-state-(typecolor):dom-textarea/input-selectiondirection classno-backref>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, code idcolor-state-(typecolor):dom-input-valueasdate classno-backref>a href#dom-input-valueasdate>valueAsDate/a>/code> and, code idcolor-state-(typecolor):dom-input-valueasnumber classno-backref>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idcolor-state-(typecolor):dom-textarea/input-setrangetext classno-backref>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, code idcolor-state-(typecolor):dom-textarea/input-setselectionrange classno-backref>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code>, code idcolor-state-(typecolor):dom-input-stepdown classno-backref>a href#dom-input-stepdown>stepDown()/a>/code>, and code idcolor-state-(typecolor):dom-input-stepup classno-backref>a href#dom-input-stepup>stepUp()/a>/code> methods./p> /div> h6 idcheckbox-state-(typecheckbox)>span classsecno>4.10.5.1.15/span> dfn>Checkbox/dfn> state (code>typecheckbox/code>)a href#checkbox-state-(typecheckbox) classself-link>/a>/h6> p>When an code idcheckbox-state-(typecheckbox):the-input-element>a href#the-input-element>input/a>/code> elements code idcheckbox-state-(typecheckbox):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#checkbox-state-(typecheckbox) idcheckbox-state-(typecheckbox):checkbox-state-(typecheckbox)>Checkbox/a> state, the rules in this section apply./p> p>The code idcheckbox-state-(typecheckbox):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idcheckbox-state-(typecheckbox):represents>represents/a> a two-state control that represents the elements a href#concept-fe-checked idcheckbox-state-(typecheckbox):concept-fe-checked>checkedness/a> state. If the elements a href#concept-fe-checked idcheckbox-state-(typecheckbox):concept-fe-checked-2>checkedness/a> state is true, the control represents a positive selection, and if it is false, a negative selection. If the elements code idcheckbox-state-(typecheckbox):dom-input-indeterminate>a href#dom-input-indeterminate>indeterminate/a>/code> IDL attribute is set to true, then the controls selection should be obscured as if the control was in a third, indeterminate, state./p> p classnote>The control is never a true tri-state control, even if the elements code idcheckbox-state-(typecheckbox):dom-input-indeterminate-2>a href#dom-input-indeterminate>indeterminate/a>/code> IDL attribute is set to true. The code idcheckbox-state-(typecheckbox):dom-input-indeterminate-3>a href#dom-input-indeterminate>indeterminate/a>/code> IDL attribute only gives the appearance of a third state./p> p>The a href#input-activation-behavior idcheckbox-state-(typecheckbox):input-activation-behavior>input activation behavior/a> is to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idcheckbox-state-(typecheckbox):concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idcheckbox-state-(typecheckbox):event-input>a href#event-input>input/a>/code> at the element, with the code idcheckbox-state-(typecheckbox):dom-event-bubbles>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true, and then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idcheckbox-state-(typecheckbox):concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idcheckbox-state-(typecheckbox):event-change>a href#event-change>change/a>/code> at the element, with the code idcheckbox-state-(typecheckbox):dom-event-bubbles-2>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true./p> p>strong>Constraint validation/strong>: If the element is i idcheckbox-state-(typecheckbox):concept-input-required>a href#concept-input-required>required/a>/i> and its a href#concept-fe-checked idcheckbox-state-(typecheckbox):concept-fe-checked-3>checkedness/a> is false, then the element is a href#suffering-from-being-missing idcheckbox-state-(typecheckbox):suffering-from-being-missing>suffering from being missing/a>./p> dl classdomintro>dt>var>input/var> . code idcheckbox-state-(typecheckbox):dom-input-indeterminate-4>a href#dom-input-indeterminate>indeterminate/a>/code> var>value/var> dd> p>When set, overrides the rendering of a href#checkbox-state-(typecheckbox) idcheckbox-state-(typecheckbox):checkbox-state-(typecheckbox)-2>checkbox/a> controls so that the current value is not visible./p> /dl> div classbookkeeping> p>The following common code idcheckbox-state-(typecheckbox):the-input-element-3>a href#the-input-element>input/a>/code> element content attributes and IDL attributes a href#concept-input-apply idcheckbox-state-(typecheckbox):concept-input-apply>apply/a> to the element: code idcheckbox-state-(typecheckbox):attr-input-checked>a href#attr-input-checked>checked/a>/code>, and code idcheckbox-state-(typecheckbox):attr-input-required>a href#attr-input-required>required/a>/code> content attributes; code idcheckbox-state-(typecheckbox):dom-input-checked>a href#dom-input-checked>checked/a>/code> and code idcheckbox-state-(typecheckbox):dom-input-value>a href#dom-input-value>value/a>/code> IDL attributes./p> p>The code idcheckbox-state-(typecheckbox):dom-input-value-2>a href#dom-input-value>value/a>/code> IDL attribute is in mode a href#dom-input-value-default-on idcheckbox-state-(typecheckbox):dom-input-value-default-on>default/on/a>./p> p>The code idcheckbox-state-(typecheckbox):event-input-2>a href#event-input>input/a>/code> and code idcheckbox-state-(typecheckbox):event-change-2>a href#event-change>change/a>/code> events a href#concept-input-apply idcheckbox-state-(typecheckbox):concept-input-apply-2>apply/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idcheckbox-state-(typecheckbox):do-not-apply>do not apply/a> to the element: code idcheckbox-state-(typecheckbox):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code idcheckbox-state-(typecheckbox):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code idcheckbox-state-(typecheckbox):attr-fe-autocomplete classno-backref>a href#attr-fe-autocomplete>autocomplete/a>/code>, code idcheckbox-state-(typecheckbox):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code idcheckbox-state-(typecheckbox):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code idcheckbox-state-(typecheckbox):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code idcheckbox-state-(typecheckbox):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code idcheckbox-state-(typecheckbox):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idcheckbox-state-(typecheckbox):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code idcheckbox-state-(typecheckbox):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code idcheckbox-state-(typecheckbox):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code idcheckbox-state-(typecheckbox):attr-input-list classno-backref>a href#attr-input-list>list/a>/code>, code idcheckbox-state-(typecheckbox):attr-input-max classno-backref>a href#attr-input-max>max/a>/code>, code idcheckbox-state-(typecheckbox):attr-input-maxlength classno-backref>a href#attr-input-maxlength>maxlength/a>/code>, code idcheckbox-state-(typecheckbox):attr-input-min classno-backref>a href#attr-input-min>min/a>/code>, code idcheckbox-state-(typecheckbox):attr-input-minlength classno-backref>a href#attr-input-minlength>minlength/a>/code>, code idcheckbox-state-(typecheckbox):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code idcheckbox-state-(typecheckbox):attr-input-pattern classno-backref>a href#attr-input-pattern>pattern/a>/code>, code idcheckbox-state-(typecheckbox):attr-input-placeholder classno-backref>a href#attr-input-placeholder>placeholder/a>/code>, code idcheckbox-state-(typecheckbox):attr-input-readonly classno-backref>a href#attr-input-readonly>readonly/a>/code>, code idcheckbox-state-(typecheckbox):attr-input-size classno-backref>a href#attr-input-size>size/a>/code>, code idcheckbox-state-(typecheckbox):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, code idcheckbox-state-(typecheckbox):attr-input-step classno-backref>a href#attr-input-step>step/a>/code>, and code idcheckbox-state-(typecheckbox):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply idcheckbox-state-(typecheckbox):do-not-apply-2>do not apply/a> to the element: code idcheckbox-state-(typecheckbox):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code idcheckbox-state-(typecheckbox):dom-input-list classno-backref>a href#dom-input-list>list/a>/code>, code idcheckbox-state-(typecheckbox):dom-textarea/input-selectionstart classno-backref>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idcheckbox-state-(typecheckbox):dom-textarea/input-selectionend classno-backref>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code idcheckbox-state-(typecheckbox):dom-textarea/input-selectiondirection classno-backref>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, code idcheckbox-state-(typecheckbox):dom-input-valueasdate classno-backref>a href#dom-input-valueasdate>valueAsDate/a>/code>, and code idcheckbox-state-(typecheckbox):dom-input-valueasnumber classno-backref>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idcheckbox-state-(typecheckbox):dom-textarea/input-select classno-backref>a href#dom-textarea/input-select>select()/a>/code>, code idcheckbox-state-(typecheckbox):dom-textarea/input-setrangetext classno-backref>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, code idcheckbox-state-(typecheckbox):dom-textarea/input-setselectionrange classno-backref>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code>, code idcheckbox-state-(typecheckbox):dom-input-stepdown classno-backref>a href#dom-input-stepdown>stepDown()/a>/code>, and code idcheckbox-state-(typecheckbox):dom-input-stepup classno-backref>a href#dom-input-stepup>stepUp()/a>/code> methods./p> /div> h6 idradio-button-state-(typeradio)>span classsecno>4.10.5.1.16/span> dfn>Radio Button/dfn> state (code>typeradio/code>)a href#radio-button-state-(typeradio) classself-link>/a>/h6> p>When an code idradio-button-state-(typeradio):the-input-element>a href#the-input-element>input/a>/code> elements code idradio-button-state-(typeradio):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#radio-button-state-(typeradio) idradio-button-state-(typeradio):radio-button-state-(typeradio)>Radio Button/a> state, the rules in this section apply./p> p>The code idradio-button-state-(typeradio):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idradio-button-state-(typeradio):represents>represents/a> a control that, when used in conjunction with other code idradio-button-state-(typeradio):the-input-element-3>a href#the-input-element>input/a>/code> elements, forms a i idradio-button-state-(typeradio):radio-button-group>a href#radio-button-group>radio button group/a>/i> in which only one control can have its a href#concept-fe-checked idradio-button-state-(typeradio):concept-fe-checked>checkedness/a> state set to true. If the elements a href#concept-fe-checked idradio-button-state-(typeradio):concept-fe-checked-2>checkedness/a> state is true, the control represents the selected control in the group, and if it is false, it indicates a control in the group that is not selected./p> p>The dfn idradio-button-group>i>radio button group/i>/dfn> that contains an code idradio-button-state-(typeradio):the-input-element-4>a href#the-input-element>input/a>/code> element var>a/var> also contains all the other code idradio-button-state-(typeradio):the-input-element-5>a href#the-input-element>input/a>/code> elements var>b/var> that fulfill all of the following conditions:/p> ul>li>The code idradio-button-state-(typeradio):the-input-element-6>a href#the-input-element>input/a>/code> element var>b/var>s code idradio-button-state-(typeradio):attr-input-type-2>a href#attr-input-type>type/a>/code> attribute is in the a href#radio-button-state-(typeradio) idradio-button-state-(typeradio):radio-button-state-(typeradio)-2>Radio Button/a> state.li>Either var>a/var> and var>b/var> have the same a href#form-owner idradio-button-state-(typeradio):form-owner>form owner/a>, or they both have no a href#form-owner idradio-button-state-(typeradio):form-owner-2>form owner/a>.li>Both var>a/var> and var>b/var> are in the same a idradio-button-state-(typeradio):tree hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a>.li>They both have a code idradio-button-state-(typeradio):attr-fe-name>a href#attr-fe-name>name/a>/code> attribute, their code idradio-button-state-(typeradio):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 idradio-button-state-(typeradio):attr-fe-name-3>a href#attr-fe-name>name/a>/code> attribute equals the value of var>b/var>s code idradio-button-state-(typeradio):attr-fe-name-4>a href#attr-fe-name>name/a>/code> attribute./ul> p>A a idradio-button-state-(typeradio):tree-2 hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a> must not contain an code idradio-button-state-(typeradio):the-input-element-7>a href#the-input-element>input/a>/code> element whose i idradio-button-state-(typeradio):radio-button-group-2>a href#radio-button-group>radio button group/a>/i> contains only that element./p> p>When any of the following phenomena occur, if the elements a href#concept-fe-checked idradio-button-state-(typeradio):concept-fe-checked-3>checkedness/a> state is true after the occurrence, the a href#concept-fe-checked idradio-button-state-(typeradio):concept-fe-checked-4>checkedness/a> state of all the other elements in the same i idradio-button-state-(typeradio):radio-button-group-3>a href#radio-button-group>radio button group/a>/i> must be set to false:/p> ul>li>The elements a href#concept-fe-checked idradio-button-state-(typeradio):concept-fe-checked-5>checkedness/a> state is set to true (for whatever reason).li>The elements code idradio-button-state-(typeradio):attr-fe-name-5>a href#attr-fe-name>name/a>/code> attribute is set, changed, or removed.li>The elements a href#form-owner idradio-button-state-(typeradio):form-owner-3>form owner/a> changes.li>a href#signal-a-type-change idradio-button-state-(typeradio):signal-a-type-change>A type change is signalled/a> for the element./ul> p>The a href#input-activation-behavior idradio-button-state-(typeradio):input-activation-behavior>input activation behavior/a> is to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idradio-button-state-(typeradio):concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idradio-button-state-(typeradio):event-input>a href#event-input>input/a>/code> at the element, with the code idradio-button-state-(typeradio):dom-event-bubbles>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true, and then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idradio-button-state-(typeradio):concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idradio-button-state-(typeradio):event-change>a href#event-change>change/a>/code> at the element, with the code idradio-button-state-(typeradio):dom-event-bubbles-2>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true./p> p>strong>Constraint validation/strong>: If an element in the i idradio-button-state-(typeradio):radio-button-group-4>a href#radio-button-group>radio button group/a>/i> is i idradio-button-state-(typeradio):concept-input-required>a href#concept-input-required>required/a>/i>, and all of the code idradio-button-state-(typeradio):the-input-element-8>a href#the-input-element>input/a>/code> elements in the i idradio-button-state-(typeradio):radio-button-group-5>a href#radio-button-group>radio button group/a>/i> have a a href#concept-fe-checked idradio-button-state-(typeradio):concept-fe-checked-6>checkedness/a> that is false, then the element is a href#suffering-from-being-missing idradio-button-state-(typeradio):suffering-from-being-missing>suffering from being missing/a>./p> div classexample> p>The following example, for some reason, has specified that puppers are both a href#concept-input-required idradio-button-state-(typeradio):concept-input-required-2>required/a> and a href#concept-fe-disabled idradio-button-state-(typeradio):concept-fe-disabled>disabled/a>:/p> pre><form> <p><label><input typeradio namedog-type valuepupper required disabled> Pupper</label> <p><label><input typeradio namedog-type valuedoggo> Doggo</label> <p><button>Make your choice</button></form>/pre> p>If the user tries to submit this form without first selecting Doggo, then em>both/em> code idradio-button-state-(typeradio):the-input-element-9>a href#the-input-element>input/a>/code> elements will be a href#suffering-from-being-missing idradio-button-state-(typeradio):suffering-from-being-missing-2>suffering from being missing/a>, since an element in the a href#radio-button-group idradio-button-state-(typeradio):radio-button-group-6>radio button group/a> is a href#concept-input-required idradio-button-state-(typeradio):concept-input-required-3>required/a> (viz. the first element), and both of the elements in the radio button group have a false a href#concept-fe-checked idradio-button-state-(typeradio):concept-fe-checked-7>checkedness/a>./p> p>On the other hand, if the user selects Doggo and then submits the form, then neither code idradio-button-state-(typeradio):the-input-element-10>a href#the-input-element>input/a>/code> element will be a href#suffering-from-being-missing idradio-button-state-(typeradio):suffering-from-being-missing-3>suffering from being missing/a>, since while one of them is a href#concept-input-required idradio-button-state-(typeradio):concept-input-required-4>required/a>, not all of them have a false a href#concept-fe-checked idradio-button-state-(typeradio):concept-fe-checked-8>checkedness/a>./p> /div> p classnote>If none of the radio buttons in a a href#radio-button-group idradio-button-state-(typeradio):radio-button-group-7>radio button group/a> are checked, then they will all be initially unchecked in the interface, until such time as one of them is checked (either by the user or by script)./p> div classbookkeeping> p>The following common code idradio-button-state-(typeradio):the-input-element-11>a href#the-input-element>input/a>/code> element content attributes and IDL attributes a href#concept-input-apply idradio-button-state-(typeradio):concept-input-apply>apply/a> to the element: code idradio-button-state-(typeradio):attr-input-checked>a href#attr-input-checked>checked/a>/code> and code idradio-button-state-(typeradio):attr-input-required>a href#attr-input-required>required/a>/code> content attributes; code idradio-button-state-(typeradio):dom-input-checked>a href#dom-input-checked>checked/a>/code> and code idradio-button-state-(typeradio):dom-input-value>a href#dom-input-value>value/a>/code> IDL attributes./p> p>The code idradio-button-state-(typeradio):dom-input-value-2>a href#dom-input-value>value/a>/code> IDL attribute is in mode a href#dom-input-value-default-on idradio-button-state-(typeradio):dom-input-value-default-on>default/on/a>./p> p>The code idradio-button-state-(typeradio):event-input-2>a href#event-input>input/a>/code> and code idradio-button-state-(typeradio):event-change-2>a href#event-change>change/a>/code> events a href#concept-input-apply idradio-button-state-(typeradio):concept-input-apply-2>apply/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idradio-button-state-(typeradio):do-not-apply>do not apply/a> to the element: code idradio-button-state-(typeradio):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code idradio-button-state-(typeradio):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code idradio-button-state-(typeradio):attr-fe-autocomplete classno-backref>a href#attr-fe-autocomplete>autocomplete/a>/code>, code idradio-button-state-(typeradio):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code idradio-button-state-(typeradio):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code idradio-button-state-(typeradio):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code idradio-button-state-(typeradio):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code idradio-button-state-(typeradio):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idradio-button-state-(typeradio):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code idradio-button-state-(typeradio):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code idradio-button-state-(typeradio):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code idradio-button-state-(typeradio):attr-input-list classno-backref>a href#attr-input-list>list/a>/code>, code idradio-button-state-(typeradio):attr-input-max classno-backref>a href#attr-input-max>max/a>/code>, code idradio-button-state-(typeradio):attr-input-maxlength classno-backref>a href#attr-input-maxlength>maxlength/a>/code>, code idradio-button-state-(typeradio):attr-input-min classno-backref>a href#attr-input-min>min/a>/code>, code idradio-button-state-(typeradio):attr-input-minlength classno-backref>a href#attr-input-minlength>minlength/a>/code>, code idradio-button-state-(typeradio):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code idradio-button-state-(typeradio):attr-input-pattern classno-backref>a href#attr-input-pattern>pattern/a>/code>, code idradio-button-state-(typeradio):attr-input-placeholder classno-backref>a href#attr-input-placeholder>placeholder/a>/code>, code idradio-button-state-(typeradio):attr-input-readonly classno-backref>a href#attr-input-readonly>readonly/a>/code>, code idradio-button-state-(typeradio):attr-input-size classno-backref>a href#attr-input-size>size/a>/code>, code idradio-button-state-(typeradio):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, code idradio-button-state-(typeradio):attr-input-step classno-backref>a href#attr-input-step>step/a>/code>, and code idradio-button-state-(typeradio):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply idradio-button-state-(typeradio):do-not-apply-2>do not apply/a> to the element: code idradio-button-state-(typeradio):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code idradio-button-state-(typeradio):dom-input-list classno-backref>a href#dom-input-list>list/a>/code>, code idradio-button-state-(typeradio):dom-textarea/input-selectionstart classno-backref>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idradio-button-state-(typeradio):dom-textarea/input-selectionend classno-backref>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code idradio-button-state-(typeradio):dom-textarea/input-selectiondirection classno-backref>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, code idradio-button-state-(typeradio):dom-input-valueasdate classno-backref>a href#dom-input-valueasdate>valueAsDate/a>/code>, and code idradio-button-state-(typeradio):dom-input-valueasnumber classno-backref>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idradio-button-state-(typeradio):dom-textarea/input-select classno-backref>a href#dom-textarea/input-select>select()/a>/code>, code idradio-button-state-(typeradio):dom-textarea/input-setrangetext classno-backref>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, code idradio-button-state-(typeradio):dom-textarea/input-setselectionrange classno-backref>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code>, code idradio-button-state-(typeradio):dom-input-stepdown classno-backref>a href#dom-input-stepdown>stepDown()/a>/code>, and code idradio-button-state-(typeradio):dom-input-stepup classno-backref>a href#dom-input-stepup>stepUp()/a>/code> methods./p> /div> h6 idfile-upload-state-(typefile)>span classsecno>4.10.5.1.17/span> dfn>File Upload/dfn> state (code>typefile/code>)a href#file-upload-state-(typefile) classself-link>/a>/h6> p>When an code idfile-upload-state-(typefile):the-input-element>a href#the-input-element>input/a>/code> elements code idfile-upload-state-(typefile):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#file-upload-state-(typefile) idfile-upload-state-(typefile):file-upload-state-(typefile)>File Upload/a> state, the rules in this section apply./p> p>The code idfile-upload-state-(typefile):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idfile-upload-state-(typefile):represents>represents/a> a list of dfn idconcept-input-type-file-selected>selected files/dfn>, each file consisting of a file name, a file type, and a file body (the contents of the file)./p> p>File names must not contain a href#concept-input-file-path idfile-upload-state-(typefile):concept-input-file-path>path components/a>, even in the case that a user has selected an entire directory hierarchy or multiple files with the same name from different directories. dfn idconcept-input-file-path>Path components/dfn>, for the purposes of the a href#file-upload-state-(typefile) idfile-upload-state-(typefile):file-upload-state-(typefile)-2>File Upload/a> state, are those parts of file names that are separated by U+005C REVERSE SOLIDUS character (\) characters./p> p>Unless the code idfile-upload-state-(typefile):attr-input-multiple>a href#attr-input-multiple>multiple/a>/code> attribute is set, there must be no more than one file in the list of a href#concept-input-type-file-selected idfile-upload-state-(typefile):concept-input-type-file-selected>selected files/a>./p> p>The elements a href#input-activation-behavior idfile-upload-state-(typefile):input-activation-behavior>input activation behavior/a> is to run the following steps:/p> ol>li>p>If the algorithm is not a href#triggered-by-user-activation idfile-upload-state-(typefile):triggered-by-user-activation>triggered by user activation/a>, then abort these steps without doing anything else.li>p>Return, but continue running these steps a href#in-parallel idfile-upload-state-(typefile):in-parallel>in parallel/a>.li>p>Optionally, wait until any prior execution of this algorithm has terminated./p> li>p>Display a prompt to the user requesting that the user specify some files. If the code idfile-upload-state-(typefile):attr-input-multiple-2>a href#attr-input-multiple>multiple/a>/code> attribute is not set, there must be no more than one file selected; otherwise, any number may be selected. Files can be from the filesystem or created on the fly, e.g. a picture taken from a camera connected to the users device./p> li>p>Wait for the user to have made their selection.li>p>a href#queue-a-task idfile-upload-state-(typefile):queue-a-task>Queue a task/a> to first update the elements a href#concept-input-type-file-selected idfile-upload-state-(typefile):concept-input-type-file-selected-2>selected files/a> so that it represents the users selection, then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idfile-upload-state-(typefile):concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idfile-upload-state-(typefile):event-input>a href#event-input>input/a>/code> at the code idfile-upload-state-(typefile):the-input-element-3>a href#the-input-element>input/a>/code> element, with the code idfile-upload-state-(typefile):dom-event-bubbles>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true, and finally a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idfile-upload-state-(typefile):concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idfile-upload-state-(typefile):event-change>a href#event-change>change/a>/code> at the code idfile-upload-state-(typefile):the-input-element-4>a href#the-input-element>input/a>/code> element, with the code idfile-upload-state-(typefile):dom-event-bubbles-2>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true./ol> p>If the element is i idfile-upload-state-(typefile):concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i>, the user agent should allow the user to change the files on the list in other ways also, e.g. adding or removing files by drag-and-drop. When the user does so, the user agent must a href#queue-a-task idfile-upload-state-(typefile):queue-a-task-2>queue a task/a> to first update the elements a href#concept-input-type-file-selected idfile-upload-state-(typefile):concept-input-type-file-selected-3>selected files/a> so that it represents the users new selection, then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idfile-upload-state-(typefile):concept-event-fire-3 data-x-internalconcept-event-fire>fire an event/a> named code idfile-upload-state-(typefile):event-input-2>a href#event-input>input/a>/code> at the code idfile-upload-state-(typefile):the-input-element-5>a href#the-input-element>input/a>/code> element, with the code idfile-upload-state-(typefile):dom-event-bubbles-3>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true, and finally a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idfile-upload-state-(typefile):concept-event-fire-4 data-x-internalconcept-event-fire>fire an event/a> named code idfile-upload-state-(typefile):event-change-2>a href#event-change>change/a>/code> at the code idfile-upload-state-(typefile):the-input-element-6>a href#the-input-element>input/a>/code> element, with the code idfile-upload-state-(typefile):dom-event-bubbles-4>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true./p> p>If the element is not i idfile-upload-state-(typefile):concept-fe-mutable-2>a href#concept-fe-mutable>mutable/a>/i>, the user agent must not allow the user to change the elements selection./p> p>strong>Constraint validation/strong>: If the element is i idfile-upload-state-(typefile):concept-input-required>a href#concept-input-required>required/a>/i> and the list of a href#concept-input-type-file-selected idfile-upload-state-(typefile):concept-input-type-file-selected-4>selected files/a> is empty, then the element is a href#suffering-from-being-missing idfile-upload-state-(typefile):suffering-from-being-missing>suffering from being missing/a>./p> hr> p>The dfn idattr-input-accept>code>accept/code>/dfn> attribute may be specified to provide user agents with a hint of what file types will be accepted.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> input-file-acceptspan classand_chr partial>span>Chrome for Android (limited)/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>26+/span>/span>span classios_saf partial>span>iOS Safari (limited)/span> span>8+/span>/span>span classand_uc no>span>UC Browser for Android/span> span>None/span>/span>span classfirefox yes>span>Firefox/span> span>37+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung partial>span>Samsung Internet (limited)/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>TP+/span>/span>span classedge no>span>Edge/span> span>None/span>/span>span classandroid no>span>Android Browser/span> span>None/span>/span>span classopera yes>span>Opera/span> span>15+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featinput-file-accept>caniuse.com/a>/div> p>If specified, the attribute must consist of a a href#set-of-comma-separated-tokens idfile-upload-state-(typefile):set-of-comma-separated-tokens>set of comma-separated tokens/a>, each of which must be an a idfile-upload-state-(typefile):ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for one of the following:/p> dl>dt>The string code>audio/*/code>dd>Indicates that sound files are accepted.dt>The string code>video/*/code>dd>Indicates that video files are accepted.dt>The string code>image/*/code>dd>Indicates that image files are accepted.dt>A a idfile-upload-state-(typefile):valid-mime-type-with-no-parameters hrefhttps://mimesniff.spec.whatwg.org/#valid-mime-type-with-no-parameters data-x-internalvalid-mime-type-with-no-parameters>valid MIME type with no parameters/a>dd>Indicates that files of the specified type are accepted.dt>A string whose first character is a U+002E FULL STOP character (.)dd>Indicates that files with the specified file extension are accepted./dl> p>The tokens must not be a idfile-upload-state-(typefile):ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> matches for any of the other tokens (i.e. duplicates are not allowed). To obtain the list of tokens from the attribute, the user agent must a hrefhttps://infra.spec.whatwg.org/#split-on-commas idfile-upload-state-(typefile):split-a-string-on-commas data-x-internalsplit-a-string-on-commas>split the attribute value on commas/a>./p> p>User agents may use the value of this attribute to display a more appropriate user interface than a generic file picker. For instance, given the value code>image/*/code>, a user agent could offer the user the option of using a local camera or selecting a photograph from their photo collection; given the value code>audio/*/code>, a user agent could offer the user the option of recording a clip using a headset microphone./p> p>User agents should prevent the user from selecting files that are not accepted by one (or more) of these tokens./p> p classnote>Authors are encouraged to specify both any MIME types and any corresponding extensions when looking for data in a specific format./p> div classexample> p>For example, consider an application that converts Microsoft Word documents to Open Document Format files. Since Microsoft Word documents are described with a wide variety of MIME types and extensions, the site can list several, as follows:/p> pre><input typefile accept.doc,.docx,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document>/pre> p>On platforms that only use file extensions to describe file types, the extensions listed here can be used to filter the allowed documents, while the MIME types can be used with the systems type registration table (mapping MIME types to extensions used by the system), if any, to determine any other extensions to allow. Similarly, on a system that does not have file names or extensions but labels documents with MIME types internally, the MIME types can be used to pick the allowed files, while the extensions can be used if the system has an extension registration table that maps known extensions to MIME types used by the system./p> /div> p classwarning>Extensions tend to be ambiguous (e.g. there are an untold number of formats that use the code>.dat/code> extension, and users can typically quite easily rename their files to have a code>.doc/code> extension even if they are not Microsoft Word documents), and MIME types tend to be unreliable (e.g. many formats have no formally registered types, and many formats are in practice labeled using a number of different MIME types). Authors are reminded that, as usual, data received from a client should be treated with caution, as it may not be in an expected format even if the user is not hostile and the user agent fully obeyed the code idfile-upload-state-(typefile):attr-input-accept>a href#attr-input-accept>accept/a>/code> attributes requirements./p> div idfakepath-srsly classexample> p>For historical reasons, the code idfile-upload-state-(typefile):dom-input-value>a href#dom-input-value>value/a>/code> IDL attribute prefixes the file name with the string code>C:\fakepath\/code>. Some legacy user agents actually included the full path (which was a security vulnerability). As a result of this, obtaining the file name from the code idfile-upload-state-(typefile):dom-input-value-2>a href#dom-input-value>value/a>/code> IDL attribute in a backwards-compatible way is non-trivial. The following function extracts the file name in a suitably compatible manner:/p> pre>function extractFilename(path) { if (path.substr(0, 12) C:\\fakepath\\) return path.substr(12); // modern browser var x; x path.lastIndexOf(/); if (x > 0) // Unix-based path return path.substr(x+1); x path.lastIndexOf(\\); if (x > 0) // Windows-based path return path.substr(x+1); return path; // just the file name}/pre> p>This can be used as follows:/p> pre><p><input typefile nameimage onchangeupdateFilename(this.value)></p><p>The name of the file you picked is: <span idfilename>(none)</span></p><script> function updateFilename(path) { var name extractFilename(path); document.getElementById(filename).textContent name; }</script>/pre> /div> hr> div classbookkeeping> p>The following common code idfile-upload-state-(typefile):the-input-element-7>a href#the-input-element>input/a>/code> element content attributes and IDL attributes a href#concept-input-apply idfile-upload-state-(typefile):concept-input-apply>apply/a> to the element: code idfile-upload-state-(typefile):attr-input-accept-2>a href#attr-input-accept>accept/a>/code>, code idfile-upload-state-(typefile):attr-input-multiple-3>a href#attr-input-multiple>multiple/a>/code>, and code idfile-upload-state-(typefile):attr-input-required>a href#attr-input-required>required/a>/code> content attributes; code idfile-upload-state-(typefile):dom-input-files>a href#dom-input-files>files/a>/code> and code idfile-upload-state-(typefile):dom-input-value-3>a href#dom-input-value>value/a>/code> IDL attributes; code idfile-upload-state-(typefile):dom-textarea/input-select>a href#dom-textarea/input-select>select()/a>/code> method./p> p>The code idfile-upload-state-(typefile):dom-input-value-4>a href#dom-input-value>value/a>/code> IDL attribute is in mode a href#dom-input-value-filename idfile-upload-state-(typefile):dom-input-value-filename>filename/a>./p> p>The code idfile-upload-state-(typefile):event-input-3>a href#event-input>input/a>/code> and code idfile-upload-state-(typefile):event-change-3>a href#event-change>change/a>/code> events a href#concept-input-apply idfile-upload-state-(typefile):concept-input-apply-2>apply/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idfile-upload-state-(typefile):do-not-apply>do not apply/a> to the element: code idfile-upload-state-(typefile):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code idfile-upload-state-(typefile):attr-fe-autocomplete classno-backref>a href#attr-fe-autocomplete>autocomplete/a>/code>, code idfile-upload-state-(typefile):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code idfile-upload-state-(typefile):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code idfile-upload-state-(typefile):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code idfile-upload-state-(typefile):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code idfile-upload-state-(typefile):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code idfile-upload-state-(typefile):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idfile-upload-state-(typefile):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code idfile-upload-state-(typefile):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code idfile-upload-state-(typefile):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code idfile-upload-state-(typefile):attr-input-list classno-backref>a href#attr-input-list>list/a>/code>, code idfile-upload-state-(typefile):attr-input-max classno-backref>a href#attr-input-max>max/a>/code>, code idfile-upload-state-(typefile):attr-input-maxlength classno-backref>a href#attr-input-maxlength>maxlength/a>/code>, code idfile-upload-state-(typefile):attr-input-min classno-backref>a href#attr-input-min>min/a>/code>, code idfile-upload-state-(typefile):attr-input-minlength classno-backref>a href#attr-input-minlength>minlength/a>/code>, code idfile-upload-state-(typefile):attr-input-pattern classno-backref>a href#attr-input-pattern>pattern/a>/code>, code idfile-upload-state-(typefile):attr-input-placeholder classno-backref>a href#attr-input-placeholder>placeholder/a>/code>, code idfile-upload-state-(typefile):attr-input-readonly classno-backref>a href#attr-input-readonly>readonly/a>/code>, code idfile-upload-state-(typefile):attr-input-size classno-backref>a href#attr-input-size>size/a>/code>, code idfile-upload-state-(typefile):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, code idfile-upload-state-(typefile):attr-input-step classno-backref>a href#attr-input-step>step/a>/code>, and code idfile-upload-state-(typefile):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The elements code idfile-upload-state-(typefile):attr-input-value>a href#attr-input-value>value/a>/code> attribute must be omitted./p> p>The following IDL attributes and methods a href#do-not-apply idfile-upload-state-(typefile):do-not-apply-2>do not apply/a> to the element: code idfile-upload-state-(typefile):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code idfile-upload-state-(typefile):dom-input-list classno-backref>a href#dom-input-list>list/a>/code>, code idfile-upload-state-(typefile):dom-textarea/input-selectionstart classno-backref>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idfile-upload-state-(typefile):dom-textarea/input-selectionend classno-backref>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code idfile-upload-state-(typefile):dom-textarea/input-selectiondirection classno-backref>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, code idfile-upload-state-(typefile):dom-input-valueasdate classno-backref>a href#dom-input-valueasdate>valueAsDate/a>/code>, and code idfile-upload-state-(typefile):dom-input-valueasnumber classno-backref>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idfile-upload-state-(typefile):dom-textarea/input-setrangetext classno-backref>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, code idfile-upload-state-(typefile):dom-textarea/input-setselectionrange classno-backref>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code>, code idfile-upload-state-(typefile):dom-input-stepdown classno-backref>a href#dom-input-stepdown>stepDown()/a>/code>, and code idfile-upload-state-(typefile):dom-input-stepup classno-backref>a href#dom-input-stepup>stepUp()/a>/code> methods./p> /div> h6 idsubmit-button-state-(typesubmit)>span classsecno>4.10.5.1.18/span> dfn>Submit Button/dfn> state (code>typesubmit/code>)a href#submit-button-state-(typesubmit) classself-link>/a>/h6> p>When an code idsubmit-button-state-(typesubmit):the-input-element>a href#the-input-element>input/a>/code> elements code idsubmit-button-state-(typesubmit):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#submit-button-state-(typesubmit) idsubmit-button-state-(typesubmit):submit-button-state-(typesubmit)>Submit Button/a> state, the rules in this section apply./p> p>The code idsubmit-button-state-(typesubmit):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idsubmit-button-state-(typesubmit):represents>represents/a> a button that, when activated, submits the form. If the element has a code idsubmit-button-state-(typesubmit):attr-input-value>a href#attr-input-value>value/a>/code> attribute, the buttons label must be the value of that attribute; otherwise, it must be an implementation-defined string that means Submit or some such. The element is a a href#concept-button idsubmit-button-state-(typesubmit):concept-button>button/a>, specifically a a href#concept-submit-button idsubmit-button-state-(typesubmit):concept-submit-button>submit button/a>. a href#fingerprinting-vector idsubmit-button-state-(typesubmit):fingerprinting-vector classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> p classnote>Since the default label is implementation-defined, and the width of the button typically depends on the buttons label, the buttons width can leak a few bits of fingerprintable information. These bits are likely to be strongly correlated to the identity of the user agent and the users locale./p> p>The elements a href#input-activation-behavior idsubmit-button-state-(typesubmit):input-activation-behavior>input activation behavior/a> is as follows: if the element has a a href#form-owner idsubmit-button-state-(typesubmit):form-owner>form owner/a>, and the elements a idsubmit-button-state-(typesubmit):node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is a href#fully-active idsubmit-button-state-(typesubmit):fully-active>fully active/a>, a href#concept-form-submit idsubmit-button-state-(typesubmit):concept-form-submit>submit/a> the a href#form-owner idsubmit-button-state-(typesubmit):form-owner-2>form owner/a> from the code idsubmit-button-state-(typesubmit):the-input-element-3>a href#the-input-element>input/a>/code> element; otherwise, do nothing./p> p>The code idsubmit-button-state-(typesubmit):attr-fs-formaction>a href#attr-fs-formaction>formaction/a>/code>, code idsubmit-button-state-(typesubmit):attr-fs-formenctype>a href#attr-fs-formenctype>formenctype/a>/code>, code idsubmit-button-state-(typesubmit):attr-fs-formmethod>a href#attr-fs-formmethod>formmethod/a>/code>, code idsubmit-button-state-(typesubmit):attr-fs-formnovalidate>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, and code idsubmit-button-state-(typesubmit):attr-fs-formtarget>a href#attr-fs-formtarget>formtarget/a>/code> attributes are a href#attributes-for-form-submission idsubmit-button-state-(typesubmit):attributes-for-form-submission>attributes for form submission/a>./p> p classnote>The code idsubmit-button-state-(typesubmit):attr-fs-formnovalidate-2>a href#attr-fs-formnovalidate>formnovalidate/a>/code> attribute can be used to make submit buttons that do not trigger the constraint validation./p> div classbookkeeping> p>The following common code idsubmit-button-state-(typesubmit):the-input-element-4>a href#the-input-element>input/a>/code> element content attributes and IDL attributes a href#concept-input-apply idsubmit-button-state-(typesubmit):concept-input-apply>apply/a> to the element: code idsubmit-button-state-(typesubmit):attr-fs-formaction-2>a href#attr-fs-formaction>formaction/a>/code>, code idsubmit-button-state-(typesubmit):attr-fs-formenctype-2>a href#attr-fs-formenctype>formenctype/a>/code>, code idsubmit-button-state-(typesubmit):attr-fs-formmethod-2>a href#attr-fs-formmethod>formmethod/a>/code>, code idsubmit-button-state-(typesubmit):attr-fs-formnovalidate-3>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, and code idsubmit-button-state-(typesubmit):attr-fs-formtarget-2>a href#attr-fs-formtarget>formtarget/a>/code> content attributes; code idsubmit-button-state-(typesubmit):dom-input-value>a href#dom-input-value>value/a>/code> IDL attribute./p> p>The code idsubmit-button-state-(typesubmit):dom-input-value-2>a href#dom-input-value>value/a>/code> IDL attribute is in mode a href#dom-input-value-default idsubmit-button-state-(typesubmit):dom-input-value-default>default/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idsubmit-button-state-(typesubmit):do-not-apply>do not apply/a> to the element: code idsubmit-button-state-(typesubmit):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code idsubmit-button-state-(typesubmit):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code idsubmit-button-state-(typesubmit):attr-fe-autocomplete classno-backref>a href#attr-fe-autocomplete>autocomplete/a>/code>, code idsubmit-button-state-(typesubmit):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code idsubmit-button-state-(typesubmit):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code idsubmit-button-state-(typesubmit):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code idsubmit-button-state-(typesubmit):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code idsubmit-button-state-(typesubmit):attr-input-list classno-backref>a href#attr-input-list>list/a>/code>, code idsubmit-button-state-(typesubmit):attr-input-max classno-backref>a href#attr-input-max>max/a>/code>, code idsubmit-button-state-(typesubmit):attr-input-maxlength classno-backref>a href#attr-input-maxlength>maxlength/a>/code>, code idsubmit-button-state-(typesubmit):attr-input-min classno-backref>a href#attr-input-min>min/a>/code>, code idsubmit-button-state-(typesubmit):attr-input-minlength classno-backref>a href#attr-input-minlength>minlength/a>/code>, code idsubmit-button-state-(typesubmit):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code idsubmit-button-state-(typesubmit):attr-input-pattern classno-backref>a href#attr-input-pattern>pattern/a>/code>, code idsubmit-button-state-(typesubmit):attr-input-placeholder classno-backref>a href#attr-input-placeholder>placeholder/a>/code>, code idsubmit-button-state-(typesubmit):attr-input-readonly classno-backref>a href#attr-input-readonly>readonly/a>/code>, code idsubmit-button-state-(typesubmit):attr-input-required classno-backref>a href#attr-input-required>required/a>/code>, code idsubmit-button-state-(typesubmit):attr-input-size classno-backref>a href#attr-input-size>size/a>/code>, code idsubmit-button-state-(typesubmit):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, code idsubmit-button-state-(typesubmit):attr-input-step classno-backref>a href#attr-input-step>step/a>/code>, and code idsubmit-button-state-(typesubmit):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply idsubmit-button-state-(typesubmit):do-not-apply-2>do not apply/a> to the element: code idsubmit-button-state-(typesubmit):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code idsubmit-button-state-(typesubmit):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code idsubmit-button-state-(typesubmit):dom-input-list classno-backref>a href#dom-input-list>list/a>/code>, code idsubmit-button-state-(typesubmit):dom-textarea/input-selectionstart classno-backref>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idsubmit-button-state-(typesubmit):dom-textarea/input-selectionend classno-backref>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code idsubmit-button-state-(typesubmit):dom-textarea/input-selectiondirection classno-backref>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, code idsubmit-button-state-(typesubmit):dom-input-valueasdate classno-backref>a href#dom-input-valueasdate>valueAsDate/a>/code>, and code idsubmit-button-state-(typesubmit):dom-input-valueasnumber classno-backref>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idsubmit-button-state-(typesubmit):dom-textarea/input-select classno-backref>a href#dom-textarea/input-select>select()/a>/code>, code idsubmit-button-state-(typesubmit):dom-textarea/input-setrangetext classno-backref>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, code idsubmit-button-state-(typesubmit):dom-textarea/input-setselectionrange classno-backref>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code>, code idsubmit-button-state-(typesubmit):dom-input-stepdown classno-backref>a href#dom-input-stepdown>stepDown()/a>/code>, and code idsubmit-button-state-(typesubmit):dom-input-stepup classno-backref>a href#dom-input-stepup>stepUp()/a>/code> methods./p> p>The code idsubmit-button-state-(typesubmit):event-input classno-backref>a href#event-input>input/a>/code> and code idsubmit-button-state-(typesubmit):event-change classno-backref>a href#event-change>change/a>/code> events a href#do-not-apply idsubmit-button-state-(typesubmit):do-not-apply-3>do not apply/a>./p> /div> h6 idimage-button-state-(typeimage)>span classsecno>4.10.5.1.19/span> dfn>Image Button/dfn> state (code>typeimage/code>)a href#image-button-state-(typeimage) classself-link>/a>/h6> p>When an code idimage-button-state-(typeimage):the-input-element>a href#the-input-element>input/a>/code> elements code idimage-button-state-(typeimage):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#image-button-state-(typeimage) idimage-button-state-(typeimage):image-button-state-(typeimage)>Image Button/a> state, the rules in this section apply./p> p>The code idimage-button-state-(typeimage):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idimage-button-state-(typeimage):represents>represents/a> either an image from which a user can select a coordinate and submit the form, or alternatively a button from which the user can submit the form. The element is a a href#concept-button idimage-button-state-(typeimage):concept-button>button/a>, specifically a a href#concept-submit-button idimage-button-state-(typeimage):concept-submit-button>submit button/a>./p> p classnote>The coordinate is sent to the server a href#constructing-the-form-data-set idimage-button-state-(typeimage):constructing-the-form-data-set>during form submission/a> by sending two entries for the element, derived from the name of the control but with code>.x/code> and code>.y/code> appended to the name with the var>x/var> and var>y/var> components of the coordinate respectively./p> hr> p>The image is given by the dfn idattr-input-src>code>src/code>/dfn> attribute. The code idimage-button-state-(typeimage):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 idimage-button-state-(typeimage):valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces/a> referencing a non-interactive, optionally animated, image resource that is neither paged nor scripted./p> p>When any of the these events occur ul>li>the code idimage-button-state-(typeimage):the-input-element-3>a href#the-input-element>input/a>/code> elements code idimage-button-state-(typeimage):attr-input-type-2>a href#attr-input-type>type/a>/code> attribute is first set to the a href#image-button-state-(typeimage) idimage-button-state-(typeimage):image-button-state-(typeimage)-2>Image Button/a> state (possibly when the element is first created), and the code idimage-button-state-(typeimage):attr-input-src-2>a href#attr-input-src>src/a>/code> attribute is presentli>the code idimage-button-state-(typeimage):the-input-element-4>a href#the-input-element>input/a>/code> elements code idimage-button-state-(typeimage):attr-input-type-3>a href#attr-input-type>type/a>/code> attribute is changed back to the a href#image-button-state-(typeimage) idimage-button-state-(typeimage):image-button-state-(typeimage)-3>Image Button/a> state, and the code idimage-button-state-(typeimage):attr-input-src-3>a href#attr-input-src>src/a>/code> attribute is present, and its value has changed since the last time the code idimage-button-state-(typeimage):attr-input-type-4>a href#attr-input-type>type/a>/code> attribute was in the a href#image-button-state-(typeimage) idimage-button-state-(typeimage):image-button-state-(typeimage)-4>Image Button/a> stateli>the code idimage-button-state-(typeimage):the-input-element-5>a href#the-input-element>input/a>/code> elements code idimage-button-state-(typeimage):attr-input-type-5>a href#attr-input-type>type/a>/code> attribute is in the a href#image-button-state-(typeimage) idimage-button-state-(typeimage):image-button-state-(typeimage)-5>Image Button/a> state, and the code idimage-button-state-(typeimage):attr-input-src-4>a href#attr-input-src>src/a>/code> attribute is set or changed/ul> p>then unless the user agent cannot support images, or its support for images has been disabled, or the user agent only fetches images on demand, or the code idimage-button-state-(typeimage):attr-input-src-5>a href#attr-input-src>src/a>/code> attributes value is the empty string, the user agent must a href#parse-a-url idimage-button-state-(typeimage):parse-a-url>parse/a> the value of the code idimage-button-state-(typeimage):attr-input-src-6>a href#attr-input-src>src/a>/code> attribute value, relative to the elements a idimage-button-state-(typeimage):node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, and if that is successful, then:/p> ol>li>p>Let var>request/var> be a new a hrefhttps://fetch.spec.whatwg.org/#concept-request idimage-button-state-(typeimage):concept-request data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idimage-button-state-(typeimage):concept-request-url data-x-internalconcept-request-url>url/a> is the a href#resulting-url-record idimage-button-state-(typeimage):resulting-url-record>resulting URL record/a>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-client idimage-button-state-(typeimage):concept-request-client data-x-internalconcept-request-client>client/a> is the elements a idimage-button-state-(typeimage):node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#relevant-settings-object idimage-button-state-(typeimage):relevant-settings-object>relevant settings object/a>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination idimage-button-state-(typeimage):concept-request-destination data-x-internalconcept-request-destination>destination/a> is code>image/code>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode idimage-button-state-(typeimage):concept-request-credentials-mode data-x-internalconcept-request-credentials-mode>credentials mode/a> is code>include/code>, and whose a idimage-button-state-(typeimage):use-url-credentials-flag hrefhttps://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag data-x-internaluse-url-credentials-flag>use-URL-credentials flag/a> is set.li>p>a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idimage-button-state-(typeimage):concept-fetch data-x-internalconcept-fetch>Fetch/a> var>request/var>./ol> p>Fetching the image must a href#delay-the-load-event idimage-button-state-(typeimage):delay-the-load-event>delay the load event/a> of the elements a idimage-button-state-(typeimage):node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> until the a href#concept-task idimage-button-state-(typeimage):concept-task>task/a> that is a href#queue-a-task idimage-button-state-(typeimage):queue-a-task>queued/a> by the a href#networking-task-source idimage-button-state-(typeimage):networking-task-source>networking task source/a> once the resource has been fetched (defined below) has been run./p> p>If the image was successfully obtained, with no network errors, and the images type is a supported image type, and the image is a valid image of that type, then the image is said to be dfn idinput-img-available>i>available/i>/dfn>. If this is true before the image is completely downloaded, each a href#concept-task idimage-button-state-(typeimage):concept-task-2>task/a> that is a href#queue-a-task idimage-button-state-(typeimage):queue-a-task-2>queued/a> by the a href#networking-task-source idimage-button-state-(typeimage):networking-task-source-2>networking task source/a> while the image is being fetched must update the presentation of the image appropriately./p> p>The user agent should apply the a hrefhttps://mimesniff.spec.whatwg.org/#rules-for-sniffing-images-specifically idimage-button-state-(typeimage):content-type-sniffing:-image data-x-internalcontent-type-sniffing:-image>image sniffing rules/a> to determine the type of the image, with the images a href#content-type idimage-button-state-(typeimage):content-type>associated Content-Type headers/a> giving the var>official type/var>. If these rules are not applied, then the type of the image must be the type given by the images a href#content-type idimage-button-state-(typeimage):content-type-2>associated Content-Type headers/a>./p> p>User agents must not support non-image resources with the code idimage-button-state-(typeimage):the-input-element-6>a href#the-input-element>input/a>/code> element. User agents must not run executable code embedded in the image resource. User agents must only display the first page of a multipage resource. User agents must not allow the resource to act in an interactive fashion, but should honor any animation in the resource./p> p>The a href#concept-task idimage-button-state-(typeimage):concept-task-3>task/a> that is a href#queue-a-task idimage-button-state-(typeimage):queue-a-task-3>queued/a> by the a href#networking-task-source idimage-button-state-(typeimage):networking-task-source-3>networking task source/a> once the resource has been fetched, must, if the download was successful and the image is i idimage-button-state-(typeimage):input-img-available>a href#input-img-available>available/a>/i>, a href#queue-a-task idimage-button-state-(typeimage):queue-a-task-4>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idimage-button-state-(typeimage):concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idimage-button-state-(typeimage):event-load>a href#event-load>load/a>/code> at the code idimage-button-state-(typeimage):the-input-element-7>a href#the-input-element>input/a>/code> element; and otherwise, if the fetching process fails without a response from the remote server, or completes but the image is not a valid or supported image, a href#queue-a-task idimage-button-state-(typeimage):queue-a-task-5>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idimage-button-state-(typeimage):concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idimage-button-state-(typeimage):event-error>a href#event-error>error/a>/code> on the code idimage-button-state-(typeimage):the-input-element-8>a href#the-input-element>input/a>/code> element./p> hr> p>The dfn idattr-input-alt>code>alt/code>/dfn> attribute provides the textual label for the button for users and user agents who cannot use the image. The code idimage-button-state-(typeimage):attr-input-alt>a href#attr-input-alt>alt/a>/code> attribute must be present, and must contain a non-empty string giving the label that would be appropriate for an equivalent button if the image was unavailable./p> p>The code idimage-button-state-(typeimage):the-input-element-9>a href#the-input-element>input/a>/code> element supports a href#dimension-attributes idimage-button-state-(typeimage):dimension-attributes>dimension attributes/a>./p> hr> p>If the code idimage-button-state-(typeimage):attr-input-src-7>a href#attr-input-src>src/a>/code> attribute is set, and the image is i idimage-button-state-(typeimage):input-img-available-2>a href#input-img-available>available/a>/i> and the user agent is configured to display that image, then: The element a href#represents idimage-button-state-(typeimage):represents-2>represents/a> a control for selecting a a href#concept-input-type-image-coordinate idimage-button-state-(typeimage):concept-input-type-image-coordinate>coordinate/a> from the image specified by the code idimage-button-state-(typeimage):attr-input-src-8>a href#attr-input-src>src/a>/code> attribute; if the element is i idimage-button-state-(typeimage):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 idimage-button-state-(typeimage):concept-input-type-image-coordinate-2>coordinate/a>, and the elements a href#input-activation-behavior idimage-button-state-(typeimage):input-activation-behavior>input activation behavior/a> is as follows: if the element has a a href#form-owner idimage-button-state-(typeimage):form-owner>form owner/a>, and the elements a idimage-button-state-(typeimage):node-document-4 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is a href#fully-active idimage-button-state-(typeimage):fully-active>fully active/a>, take the users selected a href#concept-input-type-image-coordinate idimage-button-state-(typeimage):concept-input-type-image-coordinate-3>coordinate/a>, and a href#concept-form-submit idimage-button-state-(typeimage):concept-form-submit>submit/a> the code idimage-button-state-(typeimage):the-input-element-10>a href#the-input-element>input/a>/code> elements a href#form-owner idimage-button-state-(typeimage):form-owner-2>form owner/a> from the code idimage-button-state-(typeimage):the-input-element-11>a href#the-input-element>input/a>/code> element. If the user activates the control without explicitly selecting a coordinate, then the coordinate (0,0) must be assumed./p> p>Otherwise, the element a href#represents idimage-button-state-(typeimage):represents-3>represents/a> a submit button whose label is given by the value of the code idimage-button-state-(typeimage):attr-input-alt-2>a href#attr-input-alt>alt/a>/code> attribute; the elements a href#input-activation-behavior idimage-button-state-(typeimage):input-activation-behavior-2>input activation behavior/a> is as follows: if the element has a a href#form-owner idimage-button-state-(typeimage):form-owner-3>form owner/a>, and the elements a idimage-button-state-(typeimage):node-document-5 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is a href#fully-active idimage-button-state-(typeimage):fully-active-2>fully active/a>, set the a href#concept-input-type-image-coordinate idimage-button-state-(typeimage):concept-input-type-image-coordinate-4>selected coordinate/a> to (0,0), and a href#concept-form-submit idimage-button-state-(typeimage):concept-form-submit-2>submit/a> the code idimage-button-state-(typeimage):the-input-element-12>a href#the-input-element>input/a>/code> elements a href#form-owner idimage-button-state-(typeimage):form-owner-4>form owner/a> from the code idimage-button-state-(typeimage):the-input-element-13>a href#the-input-element>input/a>/code> element./p> p>In either case, if the element has no a href#form-owner idimage-button-state-(typeimage):form-owner-5>form owner/a> or the elements a idimage-button-state-(typeimage):node-document-6 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is not a href#fully-active idimage-button-state-(typeimage):fully-active-3>fully active/a>, then its a href#input-activation-behavior idimage-button-state-(typeimage):input-activation-behavior-3>input activation behavior/a> must be to do nothing../p> p>The dfn idconcept-input-type-image-coordinate>selected coordinate/dfn> must consist of an var>x/var>-component and a var>y/var>-component. The coordinates represent the position relative to the edge of the image, with the coordinate space having the positive var>x/var> direction to the right, and the positive var>y/var> direction downwards./p> p>The var>x/var>-component must be a a href#valid-integer idimage-button-state-(typeimage):valid-integer>valid integer/a> representing a number var>x/var> in the range span>−(var>bordersub>left/sub>/var>+var>paddingsub>left/sub>/var>) ≤ var>x/var> ≤ var>width/var>+var>bordersub>right/sub>/var>+var>paddingsub>right/sub>/var>/span>, where var>width/var> is the rendered width of the image, var>bordersub>left/sub>/var> is the width of the border on the left of the image, var>paddingsub>left/sub>/var> is the width of the padding on the left of the image, var>bordersub>right/sub>/var> is the width of the border on the right of the image, and var>paddingsub>right/sub>/var> is the width of the padding on the right of the image, with all dimensions given in a hrefhttps://drafts.csswg.org/css-values/#px idimage-button-state-(typeimage):px data-x-internalpx>CSS pixels/a>./p> p>The var>y/var>-component must be a a href#valid-integer idimage-button-state-(typeimage):valid-integer-2>valid integer/a> representing a number var>y/var> in the range span>−(var>bordersub>top/sub>/var>+var>paddingsub>top/sub>/var>) ≤ var>y/var> ≤ var>height/var>+var>bordersub>bottom/sub>/var>+var>paddingsub>bottom/sub>/var>/span>, where var>height/var> is the rendered height of the image, var>bordersub>top/sub>/var> is the width of the border above the image, var>paddingsub>top/sub>/var> is the width of the padding above the image, var>bordersub>bottom/sub>/var> is the width of the border below the image, and var>paddingsub>bottom/sub>/var> is the width of the padding below the image, with all dimensions given in a hrefhttps://drafts.csswg.org/css-values/#px idimage-button-state-(typeimage):px-2 data-x-internalpx>CSS pixels/a>./p> p>Where a border or padding is missing, its width is zero a hrefhttps://drafts.csswg.org/css-values/#px idimage-button-state-(typeimage):px-3 data-x-internalpx>CSS pixels/a>./p> hr> p>The code idimage-button-state-(typeimage):attr-fs-formaction>a href#attr-fs-formaction>formaction/a>/code>, code idimage-button-state-(typeimage):attr-fs-formenctype>a href#attr-fs-formenctype>formenctype/a>/code>, code idimage-button-state-(typeimage):attr-fs-formmethod>a href#attr-fs-formmethod>formmethod/a>/code>, code idimage-button-state-(typeimage):attr-fs-formnovalidate>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, and code idimage-button-state-(typeimage):attr-fs-formtarget>a href#attr-fs-formtarget>formtarget/a>/code> attributes are a href#attributes-for-form-submission idimage-button-state-(typeimage):attributes-for-form-submission>attributes for form submission/a>./p> dl classdomintro>dt>var>image/var> . code idimage-button-state-(typeimage):dom-input-width>a href#dom-input-width>width/a>/code> var>value/var> dt>var>image/var> . code idimage-button-state-(typeimage):dom-input-height>a href#dom-input-height>height/a>/code> var>value/var> dd> p>These attributes return the actual rendered dimensions of the image, or zero if the dimensions are not known./p> p>They can be set, to change the corresponding content attributes./p> /dl> div classbookkeeping> p>The following common code idimage-button-state-(typeimage):the-input-element-14>a href#the-input-element>input/a>/code> element content attributes and IDL attributes a href#concept-input-apply idimage-button-state-(typeimage):concept-input-apply>apply/a> to the element: code idimage-button-state-(typeimage):attr-input-alt-3>a href#attr-input-alt>alt/a>/code>, code idimage-button-state-(typeimage):attr-fs-formaction-2>a href#attr-fs-formaction>formaction/a>/code>, code idimage-button-state-(typeimage):attr-fs-formenctype-2>a href#attr-fs-formenctype>formenctype/a>/code>, code idimage-button-state-(typeimage):attr-fs-formmethod-2>a href#attr-fs-formmethod>formmethod/a>/code>, code idimage-button-state-(typeimage):attr-fs-formnovalidate-2>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idimage-button-state-(typeimage):attr-fs-formtarget-2>a href#attr-fs-formtarget>formtarget/a>/code>, code idimage-button-state-(typeimage):attr-dim-height>a href#attr-dim-height>height/a>/code>, code idimage-button-state-(typeimage):attr-input-src-9>a href#attr-input-src>src/a>/code>, and code idimage-button-state-(typeimage):attr-dim-width>a href#attr-dim-width>width/a>/code> content attributes; code idimage-button-state-(typeimage):dom-input-value>a href#dom-input-value>value/a>/code> IDL attribute./p> p>The code idimage-button-state-(typeimage):dom-input-value-2>a href#dom-input-value>value/a>/code> IDL attribute is in mode a href#dom-input-value-default idimage-button-state-(typeimage):dom-input-value-default>default/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idimage-button-state-(typeimage):do-not-apply>do not apply/a> to the element: code idimage-button-state-(typeimage):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code idimage-button-state-(typeimage):attr-fe-autocomplete classno-backref>a href#attr-fe-autocomplete>autocomplete/a>/code>, code idimage-button-state-(typeimage):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code idimage-button-state-(typeimage):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code idimage-button-state-(typeimage):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code idimage-button-state-(typeimage):attr-input-list classno-backref>a href#attr-input-list>list/a>/code>, code idimage-button-state-(typeimage):attr-input-max classno-backref>a href#attr-input-max>max/a>/code>, code idimage-button-state-(typeimage):attr-input-maxlength classno-backref>a href#attr-input-maxlength>maxlength/a>/code>, code idimage-button-state-(typeimage):attr-input-min classno-backref>a href#attr-input-min>min/a>/code>, code idimage-button-state-(typeimage):attr-input-minlength classno-backref>a href#attr-input-minlength>minlength/a>/code>, code idimage-button-state-(typeimage):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code idimage-button-state-(typeimage):attr-input-pattern classno-backref>a href#attr-input-pattern>pattern/a>/code>, code idimage-button-state-(typeimage):attr-input-placeholder classno-backref>a href#attr-input-placeholder>placeholder/a>/code>, code idimage-button-state-(typeimage):attr-input-readonly classno-backref>a href#attr-input-readonly>readonly/a>/code>, code idimage-button-state-(typeimage):attr-input-required classno-backref>a href#attr-input-required>required/a>/code>, code idimage-button-state-(typeimage):attr-input-size classno-backref>a href#attr-input-size>size/a>/code>, and code idimage-button-state-(typeimage):attr-input-step classno-backref>a href#attr-input-step>step/a>/code>./p> p>The elements code idimage-button-state-(typeimage):attr-input-value>a href#attr-input-value>value/a>/code> attribute must be omitted./p> p>The following IDL attributes and methods a href#do-not-apply idimage-button-state-(typeimage):do-not-apply-2>do not apply/a> to the element: code idimage-button-state-(typeimage):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code idimage-button-state-(typeimage):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code idimage-button-state-(typeimage):dom-input-list classno-backref>a href#dom-input-list>list/a>/code>, code idimage-button-state-(typeimage):dom-textarea/input-selectionstart classno-backref>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idimage-button-state-(typeimage):dom-textarea/input-selectionend classno-backref>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code idimage-button-state-(typeimage):dom-textarea/input-selectiondirection classno-backref>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, code idimage-button-state-(typeimage):dom-input-valueasdate classno-backref>a href#dom-input-valueasdate>valueAsDate/a>/code>, and code idimage-button-state-(typeimage):dom-input-valueasnumber classno-backref>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idimage-button-state-(typeimage):dom-textarea/input-select classno-backref>a href#dom-textarea/input-select>select()/a>/code>, code idimage-button-state-(typeimage):dom-textarea/input-setrangetext classno-backref>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, code idimage-button-state-(typeimage):dom-textarea/input-setselectionrange classno-backref>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code>, code idimage-button-state-(typeimage):dom-input-stepdown classno-backref>a href#dom-input-stepdown>stepDown()/a>/code>, and code idimage-button-state-(typeimage):dom-input-stepup classno-backref>a href#dom-input-stepup>stepUp()/a>/code> methods./p> p>The code idimage-button-state-(typeimage):event-input classno-backref>a href#event-input>input/a>/code> and code idimage-button-state-(typeimage):event-change classno-backref>a href#event-change>change/a>/code> events a href#do-not-apply idimage-button-state-(typeimage):do-not-apply-3>do not apply/a>./p> /div> p classnote>Many aspects of this states behavior are similar to the behavior of the code idimage-button-state-(typeimage):the-img-element>a href#the-img-element>img/a>/code> element. Readers are encouraged to read that section, where many of the same requirements are described in more detail./p> div classexample> p>Take the following form:/p> pre><form actionprocess.cgi> <input typeimage srcmap.png namewhere altShow location list></form>/pre> p>If the user clicked on the image at coordinate (127,40) then the URL used to submit the form would be code>process.cgi?where.x127&where.y40/code>./p> p>(In this example, its assumed that for users who dont see the map, and who instead just see a button labeled Show location list, clicking the button will cause the server to show a list of locations to pick from instead of the map.)/p> /div> h6 idreset-button-state-(typereset)>span classsecno>4.10.5.1.20/span> dfn>Reset Button/dfn> state (code>typereset/code>)a href#reset-button-state-(typereset) classself-link>/a>/h6> p>When an code idreset-button-state-(typereset):the-input-element>a href#the-input-element>input/a>/code> elements code idreset-button-state-(typereset):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#reset-button-state-(typereset) idreset-button-state-(typereset):reset-button-state-(typereset)>Reset Button/a> state, the rules in this section apply./p> p>The code idreset-button-state-(typereset):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idreset-button-state-(typereset):represents>represents/a> a button that, when activated, resets the form. If the element has a code idreset-button-state-(typereset):attr-input-value>a href#attr-input-value>value/a>/code> attribute, the buttons label must be the value of that attribute; otherwise, it must be an implementation-defined string that means Reset or some such. The element is a a href#concept-button idreset-button-state-(typereset):concept-button>button/a>. a href#fingerprinting-vector idreset-button-state-(typereset):fingerprinting-vector classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> p classnote>Since the default label is implementation-defined, and the width of the button typically depends on the buttons label, the buttons width can leak a few bits of fingerprintable information. These bits are likely to be strongly correlated to the identity of the user agent and the users locale./p> p>The elements a href#input-activation-behavior idreset-button-state-(typereset):input-activation-behavior>input activation behavior/a>, if the element has a a href#form-owner idreset-button-state-(typereset):form-owner>form owner/a> and the elements a idreset-button-state-(typereset):node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is a href#fully-active idreset-button-state-(typereset):fully-active>fully active/a>, is to a href#concept-form-reset idreset-button-state-(typereset):concept-form-reset>reset/a> the a href#form-owner idreset-button-state-(typereset):form-owner-2>form owner/a>; otherwise, it is to do nothing./p> p>strong>Constraint validation/strong>: The element is a href#barred-from-constraint-validation idreset-button-state-(typereset):barred-from-constraint-validation>barred from constraint validation/a>./p> div classbookkeeping> p>The code idreset-button-state-(typereset):dom-input-value>a href#dom-input-value>value/a>/code> IDL attribute a href#concept-input-apply idreset-button-state-(typereset):concept-input-apply>applies/a> to this element and is in mode a href#dom-input-value-default idreset-button-state-(typereset):dom-input-value-default>default/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idreset-button-state-(typereset):do-not-apply>do not apply/a> to the element: code idreset-button-state-(typereset):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code idreset-button-state-(typereset):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code idreset-button-state-(typereset):attr-fe-autocomplete classno-backref>a href#attr-fe-autocomplete>autocomplete/a>/code>, code idreset-button-state-(typereset):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code idreset-button-state-(typereset):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code idreset-button-state-(typereset):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code idreset-button-state-(typereset):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code idreset-button-state-(typereset):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code idreset-button-state-(typereset):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idreset-button-state-(typereset):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code idreset-button-state-(typereset):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code idreset-button-state-(typereset):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code idreset-button-state-(typereset):attr-input-list classno-backref>a href#attr-input-list>list/a>/code>, code idreset-button-state-(typereset):attr-input-max classno-backref>a href#attr-input-max>max/a>/code>, code idreset-button-state-(typereset):attr-input-maxlength classno-backref>a href#attr-input-maxlength>maxlength/a>/code>, code idreset-button-state-(typereset):attr-input-min classno-backref>a href#attr-input-min>min/a>/code>, code idreset-button-state-(typereset):attr-input-minlength classno-backref>a href#attr-input-minlength>minlength/a>/code>, code idreset-button-state-(typereset):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code idreset-button-state-(typereset):attr-input-pattern classno-backref>a href#attr-input-pattern>pattern/a>/code>, code idreset-button-state-(typereset):attr-input-placeholder classno-backref>a href#attr-input-placeholder>placeholder/a>/code>, code idreset-button-state-(typereset):attr-input-readonly classno-backref>a href#attr-input-readonly>readonly/a>/code>, code idreset-button-state-(typereset):attr-input-required classno-backref>a href#attr-input-required>required/a>/code>, code idreset-button-state-(typereset):attr-input-size classno-backref>a href#attr-input-size>size/a>/code>, code idreset-button-state-(typereset):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, code idreset-button-state-(typereset):attr-input-step classno-backref>a href#attr-input-step>step/a>/code>, and code idreset-button-state-(typereset):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply idreset-button-state-(typereset):do-not-apply-2>do not apply/a> to the element: code idreset-button-state-(typereset):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code idreset-button-state-(typereset):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code idreset-button-state-(typereset):dom-input-list classno-backref>a href#dom-input-list>list/a>/code>, code idreset-button-state-(typereset):dom-textarea/input-selectionstart classno-backref>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idreset-button-state-(typereset):dom-textarea/input-selectionend classno-backref>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code idreset-button-state-(typereset):dom-textarea/input-selectiondirection classno-backref>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, code idreset-button-state-(typereset):dom-input-valueasdate classno-backref>a href#dom-input-valueasdate>valueAsDate/a>/code>, and code idreset-button-state-(typereset):dom-input-valueasnumber classno-backref>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idreset-button-state-(typereset):dom-textarea/input-select classno-backref>a href#dom-textarea/input-select>select()/a>/code>, code idreset-button-state-(typereset):dom-textarea/input-setrangetext classno-backref>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, code idreset-button-state-(typereset):dom-textarea/input-setselectionrange classno-backref>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code>, code idreset-button-state-(typereset):dom-input-stepdown classno-backref>a href#dom-input-stepdown>stepDown()/a>/code>, and code idreset-button-state-(typereset):dom-input-stepup classno-backref>a href#dom-input-stepup>stepUp()/a>/code> methods./p> p>The code idreset-button-state-(typereset):event-input classno-backref>a href#event-input>input/a>/code> and code idreset-button-state-(typereset):event-change classno-backref>a href#event-change>change/a>/code> events a href#do-not-apply idreset-button-state-(typereset):do-not-apply-3>do not apply/a>./p> /div> h6 idbutton-state-(typebutton)>span classsecno>4.10.5.1.21/span> dfn>Button/dfn> state (code>typebutton/code>)a href#button-state-(typebutton) classself-link>/a>/h6> p>When an code idbutton-state-(typebutton):the-input-element>a href#the-input-element>input/a>/code> elements code idbutton-state-(typebutton):attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#button-state-(typebutton) idbutton-state-(typebutton):button-state-(typebutton)>Button/a> state, the rules in this section apply./p> p>The code idbutton-state-(typebutton):the-input-element-2>a href#the-input-element>input/a>/code> element a href#represents idbutton-state-(typebutton):represents>represents/a> a button with no default behavior. A label for the button must be provided in the code idbutton-state-(typebutton):attr-input-value>a href#attr-input-value>value/a>/code> attribute, though it may be the empty string. If the element has a code idbutton-state-(typebutton):attr-input-value-2>a href#attr-input-value>value/a>/code> attribute, the buttons label must be the value of that attribute; otherwise, it must be the empty string. The element is a a href#concept-button idbutton-state-(typebutton):concept-button>button/a>./p> p>The element has no a href#input-activation-behavior idbutton-state-(typebutton):input-activation-behavior>input activation behavior/a>./p> p>strong>Constraint validation/strong>: The element is a href#barred-from-constraint-validation idbutton-state-(typebutton):barred-from-constraint-validation>barred from constraint validation/a>./p> div classbookkeeping> p>The code idbutton-state-(typebutton):dom-input-value>a href#dom-input-value>value/a>/code> IDL attribute a href#concept-input-apply idbutton-state-(typebutton):concept-input-apply>applies/a> to this element and is in mode a href#dom-input-value-default idbutton-state-(typebutton):dom-input-value-default>default/a>./p> p>The following content attributes must not be specified and a href#do-not-apply idbutton-state-(typebutton):do-not-apply>do not apply/a> to the element: code idbutton-state-(typebutton):attr-input-accept classno-backref>a href#attr-input-accept>accept/a>/code>, code idbutton-state-(typebutton):attr-input-alt classno-backref>a href#attr-input-alt>alt/a>/code>, code idbutton-state-(typebutton):attr-fe-autocomplete classno-backref>a href#attr-fe-autocomplete>autocomplete/a>/code>, code idbutton-state-(typebutton):attr-input-checked classno-backref>a href#attr-input-checked>checked/a>/code>, code idbutton-state-(typebutton):attr-fe-dirname classno-backref>a href#attr-fe-dirname>dirname/a>/code>, code idbutton-state-(typebutton):attr-fs-formaction classno-backref>a href#attr-fs-formaction>formaction/a>/code>, code idbutton-state-(typebutton):attr-fs-formenctype classno-backref>a href#attr-fs-formenctype>formenctype/a>/code>, code idbutton-state-(typebutton):attr-fs-formmethod classno-backref>a href#attr-fs-formmethod>formmethod/a>/code>, code idbutton-state-(typebutton):attr-fs-formnovalidate classno-backref>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, code idbutton-state-(typebutton):attr-fs-formtarget classno-backref>a href#attr-fs-formtarget>formtarget/a>/code>, code idbutton-state-(typebutton):attr-dim-height classno-backref>a href#attr-dim-height>height/a>/code>, code idbutton-state-(typebutton):attr-fe-inputmode classno-backref>a href#attr-fe-inputmode>inputmode/a>/code>, code idbutton-state-(typebutton):attr-input-list classno-backref>a href#attr-input-list>list/a>/code>, code idbutton-state-(typebutton):attr-input-max classno-backref>a href#attr-input-max>max/a>/code>, code idbutton-state-(typebutton):attr-input-maxlength classno-backref>a href#attr-input-maxlength>maxlength/a>/code>, code idbutton-state-(typebutton):attr-input-min classno-backref>a href#attr-input-min>min/a>/code>, code idbutton-state-(typebutton):attr-input-minlength classno-backref>a href#attr-input-minlength>minlength/a>/code>, code idbutton-state-(typebutton):attr-input-multiple classno-backref>a href#attr-input-multiple>multiple/a>/code>, code idbutton-state-(typebutton):attr-input-pattern classno-backref>a href#attr-input-pattern>pattern/a>/code>, code idbutton-state-(typebutton):attr-input-placeholder classno-backref>a href#attr-input-placeholder>placeholder/a>/code>, code idbutton-state-(typebutton):attr-input-readonly classno-backref>a href#attr-input-readonly>readonly/a>/code>, code idbutton-state-(typebutton):attr-input-required classno-backref>a href#attr-input-required>required/a>/code>, code idbutton-state-(typebutton):attr-input-size classno-backref>a href#attr-input-size>size/a>/code>, code idbutton-state-(typebutton):attr-input-src classno-backref>a href#attr-input-src>src/a>/code>, code idbutton-state-(typebutton):attr-input-step classno-backref>a href#attr-input-step>step/a>/code>, and code idbutton-state-(typebutton):attr-dim-width classno-backref>a href#attr-dim-width>width/a>/code>./p> p>The following IDL attributes and methods a href#do-not-apply idbutton-state-(typebutton):do-not-apply-2>do not apply/a> to the element: code idbutton-state-(typebutton):dom-input-checked classno-backref>a href#dom-input-checked>checked/a>/code>, code idbutton-state-(typebutton):dom-input-files classno-backref>a href#dom-input-files>files/a>/code>, code idbutton-state-(typebutton):dom-input-list classno-backref>a href#dom-input-list>list/a>/code>, code idbutton-state-(typebutton):dom-textarea/input-selectionstart classno-backref>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idbutton-state-(typebutton):dom-textarea/input-selectionend classno-backref>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code idbutton-state-(typebutton):dom-textarea/input-selectiondirection classno-backref>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, code idbutton-state-(typebutton):dom-input-valueasdate classno-backref>a href#dom-input-valueasdate>valueAsDate/a>/code>, and code idbutton-state-(typebutton):dom-input-valueasnumber classno-backref>a href#dom-input-valueasnumber>valueAsNumber/a>/code> IDL attributes; code idbutton-state-(typebutton):dom-textarea/input-select classno-backref>a href#dom-textarea/input-select>select()/a>/code>, code idbutton-state-(typebutton):dom-textarea/input-setrangetext classno-backref>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, code idbutton-state-(typebutton):dom-textarea/input-setselectionrange classno-backref>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code>, code idbutton-state-(typebutton):dom-input-stepdown classno-backref>a href#dom-input-stepdown>stepDown()/a>/code>, and code idbutton-state-(typebutton):dom-input-stepup classno-backref>a href#dom-input-stepup>stepUp()/a>/code> methods./p> p>The code idbutton-state-(typebutton):event-input classno-backref>a href#event-input>input/a>/code> and code idbutton-state-(typebutton):event-change classno-backref>a href#event-change>change/a>/code> events a href#do-not-apply idbutton-state-(typebutton):do-not-apply-3>do not apply/a>./p> /div> h5 idinput-impl-notes>span classsecno>4.10.5.2/span> Implementation notes regarding localization of form controlsa href#input-impl-notes classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>The formats shown to the user in date, time, and number controls is independent of the format used for form submission./p> p>Browsers are encouraged to use user interfaces that present dates, times, and numbers according to the conventions of either the locale implied by the code idinput-impl-notes:the-input-element>a href#the-input-element>input/a>/code> elements a href#language idinput-impl-notes:language>language/a> or the users preferred locale. Using the pages locale will ensure consistency with page-provided data. p classexample>For example, it would be confusing to users if an American English page claimed that a Cirque De Soleil show was going to be showing on 02/03, but their browser, configured to use the British English locale, only showed the date 03/02 in the ticket purchase date picker. Using the pages locale would at least ensure that the date was presented in the same format everywhere. (Theres still a risk that the user would end up arriving a month late, of course, but theres only so much that can be done about such cultural differences...)/p> h5 idcommon-input-element-attributes>span classsecno>4.10.5.3/span> Common code idcommon-input-element-attributes:the-input-element>a href#the-input-element>input/a>/code> element attributesa href#common-input-element-attributes classself-link>/a>/h5> p>These attributes only a href#concept-input-apply idcommon-input-element-attributes:concept-input-apply>apply/a> to an code idcommon-input-element-attributes:the-input-element-2>a href#the-input-element>input/a>/code> element if its code idcommon-input-element-attributes:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in a state whose definition declares that the attribute a href#concept-input-apply idcommon-input-element-attributes:concept-input-apply-2>applies/a>. When an attribute a href#do-not-apply idcommon-input-element-attributes:do-not-apply>doesnt apply/a> to an code idcommon-input-element-attributes:the-input-element-3>a href#the-input-element>input/a>/code> element, user agents must a href#ignore idcommon-input-element-attributes:ignore>ignore/a> the attribute, regardless of the requirements and definitions below./p> h6 idthe-maxlength-and-minlength-attributes>span classsecno>4.10.5.3.1/span> The code idthe-maxlength-and-minlength-attributes:attr-input-maxlength>a href#attr-input-maxlength>maxlength/a>/code> and code idthe-maxlength-and-minlength-attributes:attr-input-minlength>a href#attr-input-minlength>minlength/a>/code> attributesa href#the-maxlength-and-minlength-attributes classself-link>/a>/h6>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> input-minlengthspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>40+/span>/span>span classios_saf yes>span>iOS Safari/span> span>10.3+/span>/span>span classand_uc no>span>UC Browser for Android/span> span>None/span>/span>span classfirefox yes>span>Firefox/span> span>51+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>5+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>10.1+/span>/span>span classedge no>span>Edge/span> span>None/span>/span>span classandroid yes>span>Android Browser/span> span>56+/span>/span>span classopera yes>span>Opera/span> span>27+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featinput-minlength>caniuse.com/a>/div> p>The dfn idattr-input-maxlength>code>maxlength/code>/dfn> attribute, when it a href#concept-input-apply idthe-maxlength-and-minlength-attributes:concept-input-apply>applies/a>, is a a href#attr-fe-maxlength idthe-maxlength-and-minlength-attributes:attr-fe-maxlength>form control code>maxlength/code> attribute/a>.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> maxlengthspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>9.0+/span>/span>span classand_uc partial>span>UC Browser for Android (limited)/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>4+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini partial>span>Opera Mini (limited)/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>5.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.3+/span>/span>span classopera yes>span>Opera/span> span>15+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featmaxlength>caniuse.com/a>/div> p>The dfn idattr-input-minlength>code>minlength/code>/dfn> attribute, when it a href#concept-input-apply idthe-maxlength-and-minlength-attributes:concept-input-apply-2>applies/a>, is a a href#attr-fe-minlength idthe-maxlength-and-minlength-attributes:attr-fe-minlength>form control code>minlength/code> attribute/a>./p> p>If the code idthe-maxlength-and-minlength-attributes:the-input-element>a href#the-input-element>input/a>/code> element has a a href#maximum-allowed-value-length idthe-maxlength-and-minlength-attributes:maximum-allowed-value-length>maximum allowed value length/a>, then the a idthe-maxlength-and-minlength-attributes:javascript-string-length hrefhttps://infra.spec.whatwg.org/#javascript-string-length data-x-internaljavascript-string-length>JavaScript string length/a> of the value of the elements code idthe-maxlength-and-minlength-attributes:attr-input-value>a href#attr-input-value>value/a>/code> attribute must be equal to or less than the elements a href#maximum-allowed-value-length idthe-maxlength-and-minlength-attributes:maximum-allowed-value-length-2>maximum allowed value length/a>./p> div classexample> p>The following extract shows how a messaging clients text entry could be arbitrarily restricted to a fixed number of characters, thus forcing any conversation through this medium to be terse and discouraging intelligent discourse./p> pre><label>What are you doing? <input namestatus maxlength140></label>/pre> /div> div classexample> p>Here, a password is given a minimum length:/p> pre><p><label>Username: <input nameu required></label><p><label>Password: <input namep required minlength12></label>/pre> /div> h6 idthe-size-attribute>span classsecno>4.10.5.3.2/span> The code idthe-size-attribute:attr-input-size>a href#attr-input-size>size/a>/code> attributea href#the-size-attribute classself-link>/a>/h6> p>The dfn idattr-input-size>code>size/code>/dfn> attribute gives the number of characters that, in a visual rendering, the user agent is to allow the user to see while editing the elements a href#concept-fe-value idthe-size-attribute:concept-fe-value>value/a>./p> p>The code idthe-size-attribute:attr-input-size-2>a href#attr-input-size>size/a>/code> attribute, if specified, must have a value that is a a href#valid-non-negative-integer idthe-size-attribute:valid-non-negative-integer>valid non-negative integer/a> greater than zero./p> p>If the attribute is present, then its value must be parsed using the a href#rules-for-parsing-non-negative-integers idthe-size-attribute:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers/a>, and if the result is a number greater than zero, then the user agent should ensure that at least that many characters are visible./p> p>The code idthe-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 idthe-size-attribute:limited-to-only-non-negative-numbers-greater-than-zero>limited to only non-negative numbers greater than zero/a> and has a default value of 20./p> h6 idthe-readonly-attribute>span classsecno>4.10.5.3.3/span> The code idthe-readonly-attribute:attr-input-readonly>a href#attr-input-readonly>readonly/a>/code> attributea href#the-readonly-attribute classself-link>/a>/h6> p>The dfn idattr-input-readonly>code>readonly/code>/dfn> attribute is a a href#boolean-attribute idthe-readonly-attribute:boolean-attribute>boolean attribute/a> that controls whether or not the user can edit the form control. When specified, the element is not i idthe-readonly-attribute:concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i>.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> readonly-attrspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>26+/span>/span>span classios_saf yes>span>iOS Safari/span> span>7.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>4+/span>/span>span classie yes>span>IE/span> span>6+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>5.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.3+/span>/span>span classopera yes>span>Opera/span> span>15+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featreadonly-attr>caniuse.com/a>/div> p>strong>Constraint validation/strong>: If the code idthe-readonly-attribute:attr-input-readonly-2>a href#attr-input-readonly>readonly/a>/code> attribute is specified on an code idthe-readonly-attribute:the-input-element>a href#the-input-element>input/a>/code> element, the element is a href#barred-from-constraint-validation idthe-readonly-attribute:barred-from-constraint-validation>barred from constraint validation/a>./p> div classnote> p>The difference between code idthe-readonly-attribute:attr-fe-disabled>a href#attr-fe-disabled>disabled/a>/code> and code idthe-readonly-attribute:attr-input-readonly-3>a href#attr-input-readonly>readonly/a>/code> is that read-only controls can still function, whereas disabled controls generally do not function as controls until they are enabled. This is spelled out in more detail elsewhere in this specification with normative requirements that refer to the a href#concept-fe-disabled idthe-readonly-attribute:concept-fe-disabled>disabled/a> concept (for example, the elements a idthe-readonly-attribute:activation-behaviour hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a>, whether or not it is a a href#focusable-area idthe-readonly-attribute:focusable-area>focusable area/a>, or when a href#constructing-the-form-data-set idthe-readonly-attribute:constructing-the-form-data-set>constructing the form data set/a>). Any other behavior related to user interaction with disabled controls, such as whether text can be selected or copied, is not defined in this specification./p> p>Only text controls can be made read-only, since for other controls (such as checkboxes and buttons) there is no useful distinction between being read-only and being disabled, so the code idthe-readonly-attribute:attr-input-readonly-4>a href#attr-input-readonly>readonly/a>/code> attribute a href#do-not-apply idthe-readonly-attribute:do-not-apply>does not apply/a>./p> /div> div classexample> p>In the following example, the existing product identifiers cannot be modified, but they are still displayed as part of the form, for consistency with the row representing a new product (where the identifier is not yet filled in)./p> pre><form actionproducts.cgi methodpost enctypemultipart/form-data> <table> <tr> <th> Product ID <th> Product name <th> Price <th> Action <tr> <td> <input readonlyreadonly name1.pid valueH412> <td> <input requiredrequired name1.pname valueFloor lamp Ulke> <td> $<input requiredrequired typenumber min0 step0.01 name1.pprice value49.99> <td> <button formnovalidateformnovalidate nameaction valuedelete:1>Delete</button> <tr> <td> <input readonlyreadonly name2.pid valueFG28> <td> <input requiredrequired name2.pname valueTable lamp Ulke> <td> $<input requiredrequired typenumber min0 step0.01 name2.pprice value24.99> <td> <button formnovalidateformnovalidate nameaction valuedelete:2>Delete</button> <tr> <td> <input requiredrequired name3.pid value patternA-Z0-9+> <td> <input requiredrequired name3.pname value> <td> $<input requiredrequired typenumber min0 step0.01 name3.pprice value> <td> <button formnovalidateformnovalidate nameaction valuedelete:3>Delete</button> </table> <p> <button formnovalidateformnovalidate nameaction valueadd>Add</button> </p> <p> <button nameaction valueupdate>Save</button> </p></form>/pre> /div> h6 idthe-required-attribute>span classsecno>4.10.5.3.4/span> The code idthe-required-attribute:attr-input-required>a href#attr-input-required>required/a>/code> attributea href#the-required-attribute classself-link>/a>/h6> p>The dfn idattr-input-required>code>required/code>/dfn> attribute is a a href#boolean-attribute idthe-required-attribute:boolean-attribute>boolean attribute/a>. When specified, the element is dfn idconcept-input-required>i>required/i>/dfn>./p> p>strong>Constraint validation/strong>: If the element is i idthe-required-attribute:concept-input-required>a href#concept-input-required>required/a>/i>, and its code idthe-required-attribute:dom-input-value>a href#dom-input-value>value/a>/code> IDL attribute a href#concept-input-apply idthe-required-attribute:concept-input-apply>applies/a> and is in the mode a href#dom-input-value-value idthe-required-attribute:dom-input-value-value>value/a>, and the element is i idthe-required-attribute:concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i>, and the elements a href#concept-fe-value idthe-required-attribute:concept-fe-value>value/a> is the empty string, then the element is a href#suffering-from-being-missing idthe-required-attribute:suffering-from-being-missing>suffering from being missing/a>./p> div classexample> p>The following form has two required fields, one for an e-mail address and one for a password. It also has a third field that is only considered valid if the user types the same password in the password field and this third field./p> pre><h1>Create new account</h1><form action/newaccount methodpost oninputup2.setCustomValidity(up2.value ! up.value ? Passwords do not match. : )> <p> <label forusername>E-mail address:</label> <input idusername typeemail required nameun> <p> <label forpassword1>Password:</label> <input idpassword1 typepassword required nameup> <p> <label forpassword2>Confirm password:</label> <input idpassword2 typepassword nameup2> <p> <input typesubmit valueCreate account></form>/pre> /div> div classexample> p>For radio buttons, the code idthe-required-attribute:attr-input-required-2>a href#attr-input-required>required/a>/code> attribute is satisfied if any of the radio buttons in the a href#radio-button-group idthe-required-attribute:radio-button-group>group/a> is selected. Thus, in the following example, any of the radio buttons can be checked, not just the one marked as required:/p> pre><fieldset> <legend>Did the movie pass the Bechdel test?</legend> <p><label><input typeradio namebechdel valueno-characters> No, there are not even two female characters in the movie. </label> <p><label><input typeradio namebechdel valueno-names> No, the female characters never talk to each other. </label> <p><label><input typeradio namebechdel valueno-topic> No, when female characters talk to each other its always about a male character. </label> <p><label><input typeradio namebechdel valueyes strong>required/strong>> Yes. </label> <p><label><input typeradio namebechdel valueunknown> I dont know. </label></fieldset>/pre> p>To avoid confusion as to whether a a href#radio-button-group idthe-required-attribute:radio-button-group-2>radio button group/a> is required or not, authors are encouraged to specify the attribute on all the radio buttons in a group. Indeed, in general, authors are encouraged to avoid having radio button groups that do not have any initially checked controls in the first place, as this is a state that the user cannot return to, and is therefore generally considered a poor user interface./p> /div> h6 idthe-multiple-attribute>span classsecno>4.10.5.3.5/span> The code idthe-multiple-attribute:attr-input-multiple>a href#attr-input-multiple>multiple/a>/code> attributea href#the-multiple-attribute classself-link>/a>/h6> p>The dfn idattr-input-multiple>code>multiple/code>/dfn> attribute is a a href#boolean-attribute idthe-multiple-attribute:boolean-attribute>boolean attribute/a> that indicates whether the user is to be allowed to specify more than one value.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> input-file-multiplespan classand_chr partial>span>Chrome for Android (limited)/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>5+/span>/span>span classios_saf yes>span>iOS Safari/span> span>6.0+/span>/span>span classand_uc no>span>UC Browser for Android/span> span>None/span>/span>span classfirefox yes>span>Firefox/span> span>3.6+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung partial>span>Samsung Internet (limited)/span> span>5+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>4+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid no>span>Android Browser/span> span>None/span>/span>span classopera yes>span>Opera/span> span>10.6+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featinput-file-multiple>caniuse.com/a>/div> div classexample> p>The following extract shows how an e-mail clients To field could accept multiple e-mail addresses./p> pre><label>To: <input typeemail multiple nameto></label>/pre> p>If the user had, amongst many friends in their user contacts database, two friends Spider-Man (with address spider@parker.example.net) and Scarlet Witch (with address scarlet@avengers.example.net), then, after the user has typed kbd>s/kbd>, the user agent might suggest these two e-mail addresses to the user./p> p>img src/images/sample-email-1.svg width330 alt height100>/p> p>The page could also link in the users contacts database from the site:/p> pre><label>To: <input typeemail multiple nameto listcontacts></label>...<datalist idcontacts> <option valuehedral@damowmow.com> <option valuepillar@example.com> <option valueastrophy@cute.example> <option valueastronomy@science.example.org></datalist>/pre> p>Suppose the user had entered kbd>bob@example.net/kbd> into this text control, and then started typing a second e-mail address starting with kbd>s/kbd>. The user agent might show both the two friends mentioned earlier, as well as the astrophy and astronomy values given in the code idthe-multiple-attribute:the-datalist-element>a href#the-datalist-element>datalist/a>/code> element./p> p>img src/images/sample-email-2.svg width330 alt height140>/p> /div> div classexample> p>The following extract shows how an e-mail clients Attachments field could accept multiple files for upload./p> pre><label>Attachments: <input typefile multiple nameatt></label>/pre> /div> h6 idthe-pattern-attribute>span classsecno>4.10.5.3.6/span> The code idthe-pattern-attribute:attr-input-pattern>a href#attr-input-pattern>pattern/a>/code> attributea href#the-pattern-attribute classself-link>/a>/h6>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> input-patternspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>10+/span>/span>span classios_saf yes>span>iOS Safari/span> span>10.3+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>4+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>10.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>4.4.3+/span>/span>span classopera yes>span>Opera/span> span>9.5+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featinput-pattern>caniuse.com/a>/div> p>The dfn idattr-input-pattern>code>pattern/code>/dfn> attribute specifies a regular expression against which the controls a href#concept-fe-value idthe-pattern-attribute:concept-fe-value>value/a>, or, when the code idthe-pattern-attribute:attr-input-multiple>a href#attr-input-multiple>multiple/a>/code> attribute a href#concept-input-apply idthe-pattern-attribute:concept-input-apply>applies/a> and is set, the controls a href#concept-fe-values idthe-pattern-attribute:concept-fe-values>values/a>, are to be checked./p> p>If specified, the attributes value must match the JavaScript i idthe-pattern-attribute:js-prod-pattern>a data-x-internaljs-prod-pattern hrefhttps://tc39.github.io/ecma262/#prod-Pattern>Pattern/a>/i> production./p> p>If an code idthe-pattern-attribute:the-input-element>a href#the-input-element>input/a>/code> element has a code idthe-pattern-attribute:attr-input-pattern-2>a href#attr-input-pattern>pattern/a>/code> attribute specified, and the attributes value, when compiled as a JavaScript regular expression with only the code>u/code> flag specified, compiles successfully, then the resulting regular expression is the elements dfn idcompiled-pattern-regular-expression>compiled pattern regular expression/dfn>. If the element has no such attribute, or if the value doesnt compile successfully, then the element has no a href#compiled-pattern-regular-expression idthe-pattern-attribute:compiled-pattern-regular-expression>compiled pattern regular expression/a>. a href#refsJAVASCRIPT>JAVASCRIPT/a>/p> p classnote>If the value doesnt compile successfully, user agents are encouraged to log this fact in a developer console, to aid debugging./p> p>strong>Constraint validation/strong>: If the elements a href#concept-fe-value idthe-pattern-attribute:concept-fe-value-2>value/a> is not the empty string, and either the elements code idthe-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 idthe-pattern-attribute:do-not-apply>does not apply/a> to the code idthe-pattern-attribute:the-input-element-2>a href#the-input-element>input/a>/code> element given its code idthe-pattern-attribute:attr-input-type>a href#attr-input-type>type/a>/code> attributes current state, and the element has a a href#compiled-pattern-regular-expression idthe-pattern-attribute:compiled-pattern-regular-expression-2>compiled pattern regular expression/a> but that regular expression does not match the entirety of the elements a href#concept-fe-value idthe-pattern-attribute:concept-fe-value-3>value/a>, then the element is a href#suffering-from-a-pattern-mismatch idthe-pattern-attribute:suffering-from-a-pattern-mismatch>suffering from a pattern mismatch/a>./p> p>strong>Constraint validation/strong>: If the elements a href#concept-fe-value idthe-pattern-attribute:concept-fe-value-4>value/a> is not the empty string, and the elements code idthe-pattern-attribute:attr-input-multiple-3>a href#attr-input-multiple>multiple/a>/code> attribute is specified and a href#concept-input-apply idthe-pattern-attribute:concept-input-apply-2>applies/a> to the code idthe-pattern-attribute:the-input-element-3>a href#the-input-element>input/a>/code> element, and the element has a a href#compiled-pattern-regular-expression idthe-pattern-attribute:compiled-pattern-regular-expression-3>compiled pattern regular expression/a> but that regular expression does not match the entirety of each of the elements a href#concept-fe-values idthe-pattern-attribute:concept-fe-values-2>values/a>, then the element is a href#suffering-from-a-pattern-mismatch idthe-pattern-attribute:suffering-from-a-pattern-mismatch-2>suffering from a pattern mismatch/a>./p> p>The a href#compiled-pattern-regular-expression idthe-pattern-attribute:compiled-pattern-regular-expression-4>compiled pattern regular expression/a>, when matched against a string, must have its start anchored to the start of the string and its end anchored to the end of the string./p> p classnote>This implies that the regular expression language used for this attribute is the same as that used in JavaScript, except that the code idthe-pattern-attribute:attr-input-pattern-3>a href#attr-input-pattern>pattern/a>/code> attribute is matched against the entire value, not just any subset (somewhat as if it implied a code>^(?:/code> at the start of the pattern and a code>)$/code> at the end)./p> p>When an code idthe-pattern-attribute:the-input-element-4>a href#the-input-element>input/a>/code> element has a code idthe-pattern-attribute:attr-input-pattern-4>a href#attr-input-pattern>pattern/a>/code> attribute specified, authors should include a dfn idattr-input-title>code>title/code>/dfn> attribute to give a description of the pattern. User agents may use the contents of this attribute, if it is present, when informing the user that the pattern is not matched, or at any other suitable time, such as in a tooltip or read out by assistive technology when the control a href#gains-focus idthe-pattern-attribute:gains-focus>gains focus/a>./p> div classexample> p>For example, the following snippet:/p> pre><label> Part number: <input pattern0-9A-Z{3} namepart titleA part number is a digit followed by three uppercase letters./></label>/pre> p>...could cause the UA to display an alert such as:/p> pre>samp>A part number is a digit followed by three uppercase letters.You cannot submit this form when the field is incorrect./samp>/pre> /div> p>When a control has a code idthe-pattern-attribute:attr-input-pattern-5>a href#attr-input-pattern>pattern/a>/code> attribute, the code idthe-pattern-attribute:attr-input-title>a href#attr-input-title>title/a>/code> attribute, if used, must describe the pattern. Additional information could also be included, so long as it assists the user in filling in the control. Otherwise, assistive technology would be impaired./p> p classexample>For instance, if the title attribute contained the caption of the control, assistive technology could end up saying something like samp>The text you have entered does not match the required pattern. Birthday/samp>, which is not useful./p> p>UAs may still show the code idthe-pattern-attribute:attr-title>a href#attr-title>title/a>/code> in non-error situations (for example, as a tooltip when hovering over the control), so authors should be careful not to word code idthe-pattern-attribute:attr-input-title-2>a href#attr-input-title>title/a>/code>s as if an error has necessarily occurred./p> h6 idthe-min-and-max-attributes>span classsecno>4.10.5.3.7/span> The code idthe-min-and-max-attributes:attr-input-min>a href#attr-input-min>min/a>/code> and code idthe-min-and-max-attributes:attr-input-max>a href#attr-input-max>max/a>/code> attributesa href#the-min-and-max-attributes classself-link>/a>/h6> p>Some form controls can have explicit constraints applied limiting the allowed range of values that the user can provide. Normally, such a range would be linear and continuous. A form control can dfn idhas-a-periodic-domain>have a periodic domain/dfn>, however, in which case the form controls broadest possible range is finite, and authors can specify explicit ranges within it that span the boundaries./p> p classexample>Specifically, the broadest range of a code idthe-min-and-max-attributes:time-state-(typetime)>a href#time-state-(typetime)>typetime/a>/code> control is midnight to midnight (24 hours), and authors can set both continuous linear ranges (such as 9pm to 11pm) and discontinuous ranges spanning midnight (such as 11pm to 1am)./p> p>The dfn idattr-input-min>code>min/code>/dfn> and dfn idattr-input-max>code>max/code>/dfn> attributes indicate the allowed range of values for the element./p> p>Their syntax is defined by the section that defines the code idthe-min-and-max-attributes:attr-input-type>a href#attr-input-type>type/a>/code> attributes current state./p> p>If the element has a code idthe-min-and-max-attributes:attr-input-min-2>a href#attr-input-min>min/a>/code> attribute, and the result of applying the a href#concept-input-value-string-number idthe-min-and-max-attributes:concept-input-value-string-number>algorithm to convert a string to a number/a> to the value of the code idthe-min-and-max-attributes:attr-input-min-3>a href#attr-input-min>min/a>/code> attribute is a number, then that number is the elements dfn idconcept-input-min>minimum/dfn>; otherwise, if the code idthe-min-and-max-attributes:attr-input-type-2>a href#attr-input-type>type/a>/code> attributes current state defines a dfn idconcept-input-min-default>default minimum/dfn>, then that is the a href#concept-input-min idthe-min-and-max-attributes:concept-input-min>minimum/a>; otherwise, the element has no a href#concept-input-min idthe-min-and-max-attributes:concept-input-min-2>minimum/a>./p> p>The code idthe-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 idthe-min-and-max-attributes:concept-input-min-zero>step base/a>./p> p>If the element has a code idthe-min-and-max-attributes:attr-input-max-2>a href#attr-input-max>max/a>/code> attribute, and the result of applying the a href#concept-input-value-string-number idthe-min-and-max-attributes:concept-input-value-string-number-2>algorithm to convert a string to a number/a> to the value of the code idthe-min-and-max-attributes:attr-input-max-3>a href#attr-input-max>max/a>/code> attribute is a number, then that number is the elements dfn idconcept-input-max>maximum/dfn>; otherwise, if the code idthe-min-and-max-attributes:attr-input-type-3>a href#attr-input-type>type/a>/code> attributes current state defines a dfn idconcept-input-max-default>default maximum/dfn>, then that is the a href#concept-input-max idthe-min-and-max-attributes:concept-input-max>maximum/a>; otherwise, the element has no a href#concept-input-max idthe-min-and-max-attributes:concept-input-max-2>maximum/a>./p> p>If the element does not a href#has-a-periodic-domain idthe-min-and-max-attributes:has-a-periodic-domain>have a periodic domain/a>, the code idthe-min-and-max-attributes:attr-input-max-4>a href#attr-input-max>max/a>/code> attributes value (the a href#concept-input-max idthe-min-and-max-attributes:concept-input-max-3>maximum/a>) must not be less than the code idthe-min-and-max-attributes:attr-input-min-5>a href#attr-input-min>min/a>/code> attributes value (its a href#concept-input-min idthe-min-and-max-attributes:concept-input-min-3>minimum/a>)./p> p classnote>If an element that does not a href#has-a-periodic-domain idthe-min-and-max-attributes:has-a-periodic-domain-2>have a periodic domain/a> has a a href#attr-input-max idthe-min-and-max-attributes:attr-input-max-5>maximum/a> that is less than its a href#attr-input-min idthe-min-and-max-attributes:attr-input-min-6>minimum/a>, then so long as the element has a a href#concept-fe-value idthe-min-and-max-attributes:concept-fe-value>value/a>, it will either be a href#suffering-from-an-underflow idthe-min-and-max-attributes:suffering-from-an-underflow>suffering from an underflow/a> or a href#suffering-from-an-overflow idthe-min-and-max-attributes:suffering-from-an-overflow>suffering from an overflow/a>./p> p>An element dfn idhas-a-reversed-range>has a reversed range/dfn> if it a href#has-a-periodic-domain idthe-min-and-max-attributes:has-a-periodic-domain-3>has a periodic domain/a> and its a href#concept-input-max idthe-min-and-max-attributes:concept-input-max-4>maximum/a> is less than its a href#concept-input-min idthe-min-and-max-attributes:concept-input-min-4>minimum/a>./p> p>An element dfn idhave-range-limitations>has range limitations/dfn> if it has a defined a href#concept-input-min idthe-min-and-max-attributes:concept-input-min-5>minimum/a> or a defined a href#concept-input-max idthe-min-and-max-attributes:concept-input-max-5>maximum/a>./p> p>strong>Constraint validation/strong>: When the element has a a href#attr-input-min idthe-min-and-max-attributes:attr-input-min-7>minimum/a> and does not a href#has-a-reversed-range idthe-min-and-max-attributes:has-a-reversed-range>have a reversed range/a>, and the result of applying the a href#concept-input-value-string-number idthe-min-and-max-attributes:concept-input-value-string-number-3>algorithm to convert a string to a number/a> to the string given by the elements a href#concept-fe-value idthe-min-and-max-attributes:concept-fe-value-2>value/a> is a number, and the number obtained from that algorithm is less than the a href#attr-input-min idthe-min-and-max-attributes:attr-input-min-8>minimum/a>, the element is a href#suffering-from-an-underflow idthe-min-and-max-attributes:suffering-from-an-underflow-2>suffering from an underflow/a>./p> p>strong>Constraint validation/strong>: When the element has a a href#attr-input-max idthe-min-and-max-attributes:attr-input-max-6>maximum/a> and does not a href#has-a-reversed-range idthe-min-and-max-attributes:has-a-reversed-range-2>have a reversed range/a>, and the result of applying the a href#concept-input-value-string-number idthe-min-and-max-attributes:concept-input-value-string-number-4>algorithm to convert a string to a number/a> to the string given by the elements a href#concept-fe-value idthe-min-and-max-attributes:concept-fe-value-3>value/a> is a number, and the number obtained from that algorithm is more than the a href#attr-input-max idthe-min-and-max-attributes:attr-input-max-7>maximum/a>, the element is a href#suffering-from-an-overflow idthe-min-and-max-attributes:suffering-from-an-overflow-2>suffering from an overflow/a>./p> p>strong>Constraint validation/strong>: When an element a href#has-a-reversed-range idthe-min-and-max-attributes:has-a-reversed-range-3>has a reversed range/a>, and the result of applying the a href#concept-input-value-string-number idthe-min-and-max-attributes:concept-input-value-string-number-5>algorithm to convert a string to a number/a> to the string given by the elements a href#concept-fe-value idthe-min-and-max-attributes:concept-fe-value-4>value/a> is a number, and the number obtained from that algorithm is more than the a href#attr-input-max idthe-min-and-max-attributes:attr-input-max-8>maximum/a> em>and/em> less than the a href#attr-input-min idthe-min-and-max-attributes:attr-input-min-9>minimum/a>, the element is simultaneously a href#suffering-from-an-underflow idthe-min-and-max-attributes:suffering-from-an-underflow-3>suffering from an underflow/a> and a href#suffering-from-an-overflow idthe-min-and-max-attributes:suffering-from-an-overflow-3>suffering from an overflow/a>./p> div classexample> p>The following date control limits input to dates that are before the 1980s:/p> pre><input namebday typedate max1979-12-31>/pre> /div> div classexample> p>The following number control limits input to whole numbers greater than zero:/p> pre><input namequantity required typenumber min1 value1>/pre> /div> div classexample> p>The following time control limits input to those minutes that occur between 9pm and 6am, defaulting to midnight:/p> pre><input namesleepStart typetime min21:00 max06:00 step60 value00:00>/pre> /div> h6 idthe-step-attribute>span classsecno>4.10.5.3.8/span> The code idthe-step-attribute:attr-input-step>a href#attr-input-step>step/a>/code> attributea href#the-step-attribute classself-link>/a>/h6> p>The dfn idattr-input-step>code>step/code>/dfn> attribute indicates the granularity that is expected (and required) of the a href#concept-fe-value idthe-step-attribute:concept-fe-value>value/a> or a href#concept-fe-values idthe-step-attribute:concept-fe-values>values/a>, by limiting the allowed values. The section that defines the code idthe-step-attribute:attr-input-type>a href#attr-input-type>type/a>/code> attributes current state also defines the dfn idconcept-input-step-default>default step/dfn>, the dfn idconcept-input-step-scale>step scale factor/dfn>, and in some cases the dfn idconcept-input-step-default-base>default step base/dfn>, which are used in processing the attribute as described below./p> p>The code idthe-step-attribute:attr-input-step-2>a href#attr-input-step>step/a>/code> attribute, if specified, must either have a value that is a a href#valid-floating-point-number idthe-step-attribute:valid-floating-point-number>valid floating-point number/a> that a href#rules-for-parsing-floating-point-number-values idthe-step-attribute:rules-for-parsing-floating-point-number-values>parses/a> to a number that is greater than zero, or must have a value that is an a idthe-step-attribute:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>any/code>./p> p>The attribute provides the dfn idconcept-input-step>allowed value step/dfn> for the element, as follows:/p> ol>li>If the attribute is absent, then the a href#concept-input-step idthe-step-attribute:concept-input-step>allowed value step/a> is the a href#concept-input-step-default idthe-step-attribute:concept-input-step-default>default step/a> multiplied by the a href#concept-input-step-scale idthe-step-attribute:concept-input-step-scale>step scale factor/a>.li>Otherwise, if the attributes value is an a idthe-step-attribute:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>any/code>, then there is no a href#concept-input-step idthe-step-attribute:concept-input-step-2>allowed value step/a>.li>Otherwise, if the a href#rules-for-parsing-floating-point-number-values idthe-step-attribute:rules-for-parsing-floating-point-number-values-2>rules for parsing floating-point number values/a>, when they are applied to the attributes value, return an error, zero, or a number less than zero, then the a href#concept-input-step idthe-step-attribute:concept-input-step-3>allowed value step/a> is the a href#concept-input-step-default idthe-step-attribute:concept-input-step-default-2>default step/a> multiplied by the a href#concept-input-step-scale idthe-step-attribute:concept-input-step-scale-2>step scale factor/a>.li>Otherwise, the a href#concept-input-step idthe-step-attribute:concept-input-step-4>allowed value step/a> is the number returned by the a href#rules-for-parsing-floating-point-number-values idthe-step-attribute:rules-for-parsing-floating-point-number-values-3>rules for parsing floating-point number values/a> when they are applied to the attributes value, multiplied by the a href#concept-input-step-scale idthe-step-attribute:concept-input-step-scale-3>step scale factor/a>./ol> p>The dfn idconcept-input-min-zero>step base/dfn> is the value returned by the following algorithm:/p> ol>li>p>If the element has a code idthe-step-attribute:attr-input-min>a href#attr-input-min>min/a>/code> content attribute, and the result of applying the a href#concept-input-value-string-number idthe-step-attribute:concept-input-value-string-number>algorithm to convert a string to a number/a> to the value of the code idthe-step-attribute:attr-input-min-2>a href#attr-input-min>min/a>/code> content attribute is not an error, then return that result and abort these steps.li>p>If the element has a code idthe-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 idthe-step-attribute:concept-input-value-string-number-2>algorithm to convert a string to a number/a> to the value of the code idthe-step-attribute:attr-input-value-2>a href#attr-input-value>value/a>/code> content attribute is not an error, then return that result and abort these steps.li>p>If a a href#concept-input-step-default-base idthe-step-attribute:concept-input-step-default-base>default step base/a> is defined for this element given its code idthe-step-attribute:attr-input-type-2>a href#attr-input-type>type/a>/code> attributes state, then return it and abort these steps./p> li>p>Return zero./ol> p>strong>Constraint validation/strong>: When the element has an a href#concept-input-step idthe-step-attribute:concept-input-step-5>allowed value step/a>, and the result of applying the a href#concept-input-value-string-number idthe-step-attribute:concept-input-value-string-number-3>algorithm to convert a string to a number/a> to the string given by the elements a href#concept-fe-value idthe-step-attribute:concept-fe-value-2>value/a> is a number, and that number subtracted from the a href#concept-input-min-zero idthe-step-attribute:concept-input-min-zero>step base/a> is not an integral multiple of the a href#concept-input-step idthe-step-attribute:concept-input-step-6>allowed value step/a>, the element is a href#suffering-from-a-step-mismatch idthe-step-attribute:suffering-from-a-step-mismatch>suffering from a step mismatch/a>./p> div classexample> p>The following range control only accepts values in the range 0..1, and allows 256 steps in that range:/p> pre><input nameopacity typerange min0 max1 step0.00392156863>/pre> /div> div classexample> p>The following control allows any time in the day to be selected, with any accuracy (e.g. thousandth-of-a-second accuracy or more):/p> pre><input namefavtime typetime stepany>/pre> p>Normally, time controls are limited to an accuracy of one minute./p> /div> h6 idthe-list-attribute>span classsecno>4.10.5.3.9/span> The code idthe-list-attribute:attr-input-list>a href#attr-input-list>list/a>/code> attributea href#the-list-attribute classself-link>/a>/h6> p>The dfn idattr-input-list>code>list/code>/dfn> attribute is used to identify an element that lists predefined options suggested to the user./p> p>If present, its value must be the a hrefhttps://dom.spec.whatwg.org/#concept-id idthe-list-attribute:concept-id data-x-internalconcept-id>ID/a> of a code idthe-list-attribute:the-datalist-element>a href#the-datalist-element>datalist/a>/code> element in the same a idthe-list-attribute:tree hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a>./p> p>The dfn idconcept-input-list>suggestions source element/dfn> is the first element in the a idthe-list-attribute:tree-2 hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a> in a idthe-list-attribute:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> to have an a hrefhttps://dom.spec.whatwg.org/#concept-id idthe-list-attribute:concept-id-2 data-x-internalconcept-id>ID/a> equal to the value of the code idthe-list-attribute:attr-input-list-2>a href#attr-input-list>list/a>/code> attribute, if that element is a code idthe-list-attribute:the-datalist-element-2>a href#the-datalist-element>datalist/a>/code> element. If there is no code idthe-list-attribute:attr-input-list-3>a href#attr-input-list>list/a>/code> attribute, or if there is no element with that a hrefhttps://dom.spec.whatwg.org/#concept-id idthe-list-attribute:concept-id-3 data-x-internalconcept-id>ID/a>, or if the first element with that a hrefhttps://dom.spec.whatwg.org/#concept-id idthe-list-attribute:concept-id-4 data-x-internalconcept-id>ID/a> is not a code idthe-list-attribute:the-datalist-element-3>a href#the-datalist-element>datalist/a>/code> element, then there is no a href#concept-input-list idthe-list-attribute:concept-input-list>suggestions source element/a>./p> p>If there is a a href#concept-input-list idthe-list-attribute:concept-input-list-2>suggestions source element/a>, then, when the user agent is allowing the user to edit the code idthe-list-attribute:the-input-element>a href#the-input-element>input/a>/code> elements a href#concept-fe-value idthe-list-attribute:concept-fe-value>value/a>, the user agent should offer the suggestions represented by the a href#concept-input-list idthe-list-attribute:concept-input-list-3>suggestions source element/a> to the user in a manner suitable for the type of control used. If appropriate, the user agent should use the suggestions a href#concept-option-label idthe-list-attribute:concept-option-label>label/a> and a href#concept-option-value idthe-list-attribute:concept-option-value>value/a> to identify the suggestion to the user./p> p>User agents are encouraged to filter the suggestions represented by the a href#concept-input-list idthe-list-attribute:concept-input-list-4>suggestions source element/a> when the number of suggestions is large, including only the most relevant ones (e.g. based on the users input so far). No precise threshold is defined, but capping the list at four to seven values is reasonable. If filtering based on the users input, user agents should use substring matching against both the suggestions a href#concept-option-label idthe-list-attribute:concept-option-label-2>label/a> and a href#concept-option-value idthe-list-attribute:concept-option-value-2>value/a>./p> div classexample> p>This text field allows you to choose a type of JavaScript function./p> pre><input typetext listfunction-types><datalist idfunction-types> <option valuefunction>function</option> <option valueasync function>async function</option> <option valuefunction*>generator function</option> <option value>>arrow function</option> <option valueasync >>async arrow function</option> <option valueasync function*>async generator function</option></datalist>/pre> p>For user agents that follow the above suggestions, both the a href#concept-option-label idthe-list-attribute:concept-option-label-3>label/a> and a href#concept-option-value idthe-list-attribute:concept-option-value-3>value/a> would be shown:/p> p>img src/images/sample-datalist.svg width280 altA text box with a drop down button on the right hand side; with, below, a drop down box containing a list of the six values the left and the six labels on the right. height150>/p> p>Then, typing kbd>arrow/kbd> or kbd>>/kbd> would filter the list to the entries with labels arrow function and async arrow function. Typing kbd>generator/kbd> or kbd>*/kbd> would filter the list to the entries with labels generator function and async generator function./p> /div> p classnote>As always, user agents are free to make user interface decisions which are appropriate for their particular requirements and for the users particular circumstances. However, this has historically been an area of confusion for implementers, web developers, and users alike, so weve given some should suggestions above./p> p>How user selections of suggestions are handled depends on whether the element is a control accepting a single value only, or whether it accepts multiple values:/p> dl classswitch>dt>If the element does not have a code idthe-list-attribute:attr-input-multiple>a href#attr-input-multiple>multiple/a>/code> attribute specified or if the code idthe-list-attribute:attr-input-multiple-2>a href#attr-input-multiple>multiple/a>/code> attribute a href#do-not-apply idthe-list-attribute:do-not-apply>does not apply/a>dd> p>When the user selects a suggestion, the code idthe-list-attribute:the-input-element-2>a href#the-input-element>input/a>/code> elements a href#concept-fe-value idthe-list-attribute:concept-fe-value-2>value/a> must be set to the selected suggestions a href#concept-option-value idthe-list-attribute:concept-option-value-4>value/a>, as if the user had written that value themself./p> dt>If the elements code idthe-list-attribute:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#e-mail-state-(typeemail) idthe-list-attribute:e-mail-state-(typeemail)>Email/a> state and the element has a code idthe-list-attribute:attr-input-multiple-3>a href#attr-input-multiple>multiple/a>/code> attribute specifieddd> p>When the user selects a suggestion, the user agent must either add a new entry to the code idthe-list-attribute:the-input-element-3>a href#the-input-element>input/a>/code> elements a href#concept-fe-values idthe-list-attribute:concept-fe-values>values/a>, whose value is the selected suggestions a href#concept-option-value idthe-list-attribute:concept-option-value-5>value/a>, or change an existing entry in the code idthe-list-attribute:the-input-element-4>a href#the-input-element>input/a>/code> elements a href#concept-fe-values idthe-list-attribute:concept-fe-values-2>values/a> to have the value given by the selected suggestions a href#concept-option-value idthe-list-attribute:concept-option-value-6>value/a>, as if the user had themself added an entry with that value, or edited an existing entry to be that value. Which behavior is to be applied depends on the user interface in a user-agent-defined manner./p> /dl> hr> p>If the code idthe-list-attribute:attr-input-list-4>a href#attr-input-list>list/a>/code> attribute a href#do-not-apply idthe-list-attribute:do-not-apply-2>does not apply/a>, there is no a href#concept-input-list idthe-list-attribute:concept-input-list-5>suggestions source element/a>./p> div classexample> p>This URL field offers some suggestions./p> pre><label>Homepage: <input namehp typeurl listhpurls></label><datalist idhpurls> <option valuehttps://www.google.com/ labelGoogle> <option valuehttps://www.reddit.com/ labelReddit></datalist>/pre> p>Other URLs from the users history might show also; this is up to the user agent./p> /div> div classexample> p>This example demonstrates how to design a form that uses the autocompletion list feature while still degrading usefully in legacy user agents./p> p>If the autocompletion list is merely an aid, and is not important to the content, then simply using a code idthe-list-attribute:the-datalist-element-4>a href#the-datalist-element>datalist/a>/code> element with children code idthe-list-attribute:the-option-element>a href#the-option-element>option/a>/code> elements is enough. To prevent the values from being rendered in legacy user agents, they need to be placed inside the code idthe-list-attribute:attr-option-value>a href#attr-option-value>value/a>/code> attribute instead of inline./p> pre><p> <label> Enter a breed: <input typetext namebreed listbreeds> <datalist idbreeds> <option valueAbyssinian> <option valueAlpaca> <!-- ... --> </datalist> </label></p>/pre> p>However, if the values need to be shown in legacy UAs, then fallback content can be placed inside the code idthe-list-attribute:the-datalist-element-5>a href#the-datalist-element>datalist/a>/code> element, as follows:/p> pre><p> <label> Enter a breed: <input typetext namebreed listbreeds> </label> <datalist idbreeds> <label> or select one from the list: <select namebreed> <option value> (none selected) <option>Abyssinian <option>Alpaca <!-- ... --> </select> </label> </datalist></p>/pre> p>The fallback content will only be shown in UAs that dont support code idthe-list-attribute:the-datalist-element-6>a href#the-datalist-element>datalist/a>/code>. The options, on the other hand, will be detected by all UAs, even though they are not children of the code idthe-list-attribute:the-datalist-element-7>a href#the-datalist-element>datalist/a>/code> element./p> p>Note that if an code idthe-list-attribute:the-option-element-2>a href#the-option-element>option/a>/code> element used in a code idthe-list-attribute:the-datalist-element-8>a href#the-datalist-element>datalist/a>/code> is code idthe-list-attribute:attr-option-selected>a href#attr-option-selected>selected/a>/code>, it will be selected by default by legacy UAs (because it affects the code idthe-list-attribute:the-select-element>a href#the-select-element>select/a>/code>), but it will not have any effect on the code idthe-list-attribute:the-input-element-5>a href#the-input-element>input/a>/code> element in UAs that support code idthe-list-attribute:the-datalist-element-9>a href#the-datalist-element>datalist/a>/code>./p> /div> h6 idthe-placeholder-attribute>span classsecno>4.10.5.3.10/span> The code idthe-placeholder-attribute:attr-input-placeholder>a href#attr-input-placeholder>placeholder/a>/code> attributea href#the-placeholder-attribute classself-link>/a>/h6> p>The dfn idattr-input-placeholder>code>placeholder/code>/dfn> attribute represents a em>short/em> hint (a word or short phrase) intended to aid the user with data entry when the control has no value. A hint could be a sample value or a brief description of the expected format. The attribute, if specified, must have a value that contains no U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> input-placeholderspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>3.2+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>4+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>5+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>4.2+/span>/span>span classopera yes>span>Opera/span> span>11.5+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featinput-placeholder>caniuse.com/a>/div> p>The code idthe-placeholder-attribute:attr-input-placeholder-2>a href#attr-input-placeholder>placeholder/a>/code> attribute should not be used as an alternative to a code idthe-placeholder-attribute:the-label-element>a href#the-label-element>label/a>/code>. For a longer hint or other advisory text, the code idthe-placeholder-attribute:attr-title>a href#attr-title>title/a>/code> attribute is more appropriate./p> p classnote>These mechanisms are very similar but subtly different: the hint given by the controls code idthe-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 idthe-placeholder-attribute:attr-input-placeholder-3>a href#attr-input-placeholder>placeholder/a>/code> attribute is shown before the user enters a value; and the hint in the code idthe-placeholder-attribute:attr-title-2>a href#attr-title>title/a>/code> attribute is shown when the user requests further help./p> p>User agents should present this hint to the user, after having a hrefhttps://infra.spec.whatwg.org/#strip-newlines idthe-placeholder-attribute:strip-newlines data-x-internalstrip-newlines>stripped newlines/a> from it, when the elements a href#concept-fe-value idthe-placeholder-attribute:concept-fe-value>value/a> is the empty string, especially if the control is not a href#focused idthe-placeholder-attribute:focused>focused/a>./p> p>If a user agent normally doesnt show this hint to the user when the control is a href#focused idthe-placeholder-attribute:focused-2>focused/a>, then the user agent should nonetheless show the hint for the control if it was focused as a result of the code idthe-placeholder-attribute:attr-fe-autofocus>a href#attr-fe-autofocus>autofocus/a>/code> attribute, since in that case the user will not have had an opportunity to examine the control before focusing it./p> div classexample> p>Here is an example of a mail configuration user interface that uses the code idthe-placeholder-attribute:attr-input-placeholder-4>a href#attr-input-placeholder>placeholder/a>/code> attribute:/p> pre><fieldset> <legend>Mail Account</legend> <p><label>Name: <input typetext namefullname placeholderJohn Ratzenberger></label></p> <p><label>Address: <input typeemail nameaddress placeholderjohn@example.net></label></p> <p><label>Password: <input typepassword namepassword></label></p> <p><label>Description: <input typetext namedesc placeholderMy Email Account></label></p></fieldset>/pre> /div> div classexample> p>In situations where the controls content has one directionality but the placeholder needs to have a different directionality, Unicodes bidirectional-algorithm formatting characters can be used in the attribute value:/p> pre><input namet1 typetel placeholderstrong>‫/strong> bdo dirrtl>رقم الهاتف 1/bdo> strong>‮/strong>><input namet2 typetel placeholderstrong>‫/strong> bdo dirrtl>رقم الهاتف 2/bdo> strong>‮/strong>>/pre> p>For slightly more clarity, heres the same example using numeric character references instead of inline Arabic:/p> pre><input namet1 typetel placeholderstrong>‫/strong>رقم الهاتف 1strong>‮/strong>><input namet2 typetel placeholderstrong>‫/strong>رقم الهاتف 2strong>‮/strong>>/pre> /div> h5 idcommon-input-element-apis>span classsecno>4.10.5.4/span> Common code idcommon-input-element-apis:the-input-element>a href#the-input-element>input/a>/code> element APIsa href#common-input-element-apis classself-link>/a>/h5> dl classdomintro>dt>var>input/var> . code idcommon-input-element-apis:dom-input-value>a href#dom-input-value>value/a>/code> var>value/var> dd> p>Returns the current a href#concept-fe-value idcommon-input-element-apis:concept-fe-value>value/a> of the form control./p> p>Can be set, to change the value./p> p>Throws an a idcommon-input-element-apis:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idcommon-input-element-apis:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if it is set to any value other than the empty string when the control is a file upload control./p> dt>var>input/var> . code idcommon-input-element-apis:dom-input-checked>a href#dom-input-checked>checked/a>/code> var>value/var> dd> p>Returns the current a href#concept-fe-checked idcommon-input-element-apis:concept-fe-checked>checkedness/a> of the form control./p> p>Can be set, to change the a href#concept-fe-checked idcommon-input-element-apis:concept-fe-checked-2>checkedness/a>./p> dt>var>input/var> . code idcommon-input-element-apis:dom-input-files>a href#dom-input-files>files/a>/code> var>files/var> dd> p>Returns a code idcommon-input-element-apis:filelist>a data-x-internalfilelist hrefhttps://w3c.github.io/FileAPI/#filelist-section>FileList/a>/code> object listing the a href#concept-input-type-file-selected idcommon-input-element-apis:concept-input-type-file-selected>selected files/a> of the form control./p> p>Returns null if the control isnt a file control./p> p>Can be set to a code idcommon-input-element-apis:filelist-2>a data-x-internalfilelist hrefhttps://w3c.github.io/FileAPI/#filelist-section>FileList/a>/code> object to change the a href#concept-input-type-file-selected idcommon-input-element-apis:concept-input-type-file-selected-2>selected files/a> of the form control. For instance, as the result of a drag-and-drop operation./p> dt>var>input/var> . code idcommon-input-element-apis:dom-input-valueasdate>a href#dom-input-valueasdate>valueAsDate/a>/code> var>value/var> dd> p>Returns a code idcommon-input-element-apis:date>a data-x-internaldate hrefhttps://tc39.github.io/ecma262/#sec-date-objects>Date/a>/code> object representing the form controls a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-2>value/a>, if applicable; otherwise, returns null./p> p>Can be set, to change the value./p> p>Throws an a idcommon-input-element-apis:invalidstateerror-2 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idcommon-input-element-apis:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the control isnt date- or time-based./p> dt>var>input/var> . code idcommon-input-element-apis:dom-input-valueasnumber>a href#dom-input-valueasnumber>valueAsNumber/a>/code> var>value/var> dd> p>Returns a number representing the form controls a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-3>value/a>, if applicable; otherwise, returns NaN./p> p>Can be set, to change the value. Setting this to NaN will set the underlying value to the empty string./p> p>Throws an a idcommon-input-element-apis:invalidstateerror-3 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idcommon-input-element-apis:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the control is neither date- or time-based nor numeric./p> dt>var>input/var> . code idcommon-input-element-apis:dom-input-stepup>a href#dom-input-stepup>stepUp/a>/code>( var>n/var> )dt>var>input/var> . code idcommon-input-element-apis:dom-input-stepdown>a href#dom-input-stepdown>stepDown/a>/code>( var>n/var> )dd> p>Changes the form controls a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-4>value/a> by the value given in the code idcommon-input-element-apis:attr-input-step>a href#attr-input-step>step/a>/code> attribute, multiplied by var>n/var>. The default value for var>n/var> is 1./p> p>Throws a idcommon-input-element-apis:invalidstateerror-4 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idcommon-input-element-apis:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the control is neither date- or time-based nor numeric, or if the code idcommon-input-element-apis:attr-input-step-2>a href#attr-input-step>step/a>/code> attributes value is code>any/code>./p> dt>var>input/var> . code idcommon-input-element-apis:dom-input-list>a href#dom-input-list>list/a>/code>dd> p>Returns the code idcommon-input-element-apis:the-datalist-element>a href#the-datalist-element>datalist/a>/code> element indicated by the code idcommon-input-element-apis:attr-input-list>a href#attr-input-list>list/a>/code> attribute./p> /dl> p>The dfn iddom-input-value>code>value/code>/dfn> IDL attribute allows scripts to manipulate the a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-5>value/a> of an code idcommon-input-element-apis:the-input-element-2>a href#the-input-element>input/a>/code> element. The attribute is in one of the following modes, which define its behavior:/p> dl>dt>dfn iddom-input-value-value>value/dfn> dd> p>On getting, return the current a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-6>value/a> of the element./p> p>On setting:/p> ol>li>p>Let var>oldValue/var> be the elements a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-7>value/a>.li>p>Set the elements a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-8>value/a> to the new value.li>p>Set the elements a href#concept-fe-dirty idcommon-input-element-apis:concept-fe-dirty>dirty value flag/a> to true.li>p>Invoke the a href#value-sanitization-algorithm idcommon-input-element-apis:value-sanitization-algorithm>value sanitization algorithm/a>, if the elements code idcommon-input-element-apis:attr-input-type>a href#attr-input-type>type/a>/code> attributes current state defines one.li>p>If the elements a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-9>value/a> (after applying the a href#value-sanitization-algorithm idcommon-input-element-apis:value-sanitization-algorithm-2>value sanitization algorithm/a>) is different from var>oldValue/var>, and the element has a text entry cursor position, move the text entry cursor position to the end of the text control, unselecting any selected text and a href#set-the-selection-direction idcommon-input-element-apis:set-the-selection-direction>resetting the selection direction/a> to code>none/code>./ol> dt>dfn iddom-input-value-default>default/dfn> dd> p>On getting, if the element has a code idcommon-input-element-apis:attr-input-value>a href#attr-input-value>value/a>/code> content attribute, return that attributes value; otherwise, return the empty string./p> p>On setting, set the value of the elements code idcommon-input-element-apis:attr-input-value-2>a href#attr-input-value>value/a>/code> content attribute to the new value./p> dt>dfn iddom-input-value-default-on>default/on/dfn> dd> p>On getting, if the element has a code idcommon-input-element-apis:attr-input-value-3>a href#attr-input-value>value/a>/code> content attribute, return that attributes value; otherwise, return the string code>on/code>./p> p>On setting, set the value of the elements code idcommon-input-element-apis:attr-input-value-4>a href#attr-input-value>value/a>/code> content attribute to the new value./p> dt>dfn iddom-input-value-filename>filename/dfn> dd idfakepath-orly> p>On getting, return the string code>C:\fakepath\/code> followed by the name of the first file in the list of a href#concept-input-type-file-selected idcommon-input-element-apis:concept-input-type-file-selected-3>selected files/a>, if any, or the empty string if the list is empty./p> p>On setting, if the new value is the empty string, empty the list of a href#concept-input-type-file-selected idcommon-input-element-apis:concept-input-type-file-selected-4>selected files/a>; otherwise, throw an a idcommon-input-element-apis:invalidstateerror-5 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idcommon-input-element-apis:domexception-5>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> p classnote>This fakepath requirement is a sad accident of history. See a href#fakepath-srsly>the example in the File Upload state section/a> for more information./p> p classnote>Since a href#concept-input-file-path idcommon-input-element-apis:concept-input-file-path>path components/a> are not permitted in file names in the list of a href#concept-input-type-file-selected idcommon-input-element-apis:concept-input-type-file-selected-5>selected files/a>, the \fakepath\ cannot be mistaken for a path component./p> /dl> hr> p>The dfn iddom-input-checked>code>checked/code>/dfn> IDL attribute allows scripts to manipulate the a href#concept-fe-checked idcommon-input-element-apis:concept-fe-checked-3>checkedness/a> of an code idcommon-input-element-apis:the-input-element-3>a href#the-input-element>input/a>/code> element. On getting, it must return the current a href#concept-fe-checked idcommon-input-element-apis:concept-fe-checked-4>checkedness/a> of the element; and on setting, it must set the elements a href#concept-fe-checked idcommon-input-element-apis:concept-fe-checked-5>checkedness/a> to the new value and set the elements a href#concept-input-checked-dirty-flag idcommon-input-element-apis:concept-input-checked-dirty-flag>dirty checkedness flag/a> to true./p> hr> p>The dfn iddom-input-files>code>files/code>/dfn> IDL attribute allows scripts to access the elements a href#concept-input-type-file-selected idcommon-input-element-apis:concept-input-type-file-selected-6>selected files/a>. p>On getting, if the IDL attribute a href#concept-input-apply idcommon-input-element-apis:concept-input-apply>applies/a>, it must return a code idcommon-input-element-apis:filelist-3>a data-x-internalfilelist hrefhttps://w3c.github.io/FileAPI/#filelist-section>FileList/a>/code> object that represents the current a href#concept-input-type-file-selected idcommon-input-element-apis:concept-input-type-file-selected-7>selected files/a>. The same object must be returned until the list of a href#concept-input-type-file-selected idcommon-input-element-apis:concept-input-type-file-selected-8>selected files/a> changes. If the IDL attribute a href#do-not-apply idcommon-input-element-apis:do-not-apply>does not apply/a>, then it must instead return null. a href#refsFILEAPI>FILEAPI/a>/p> p>On setting, it must run these steps: ol>li>p>If the IDL attribute a href#do-not-apply idcommon-input-element-apis:do-not-apply-2>does not apply/a> or the given value is null, then return.li>p>Replace the elements a href#concept-input-type-file-selected idcommon-input-element-apis:concept-input-type-file-selected-9>selected files/a> with the given value./ol> hr> p>The dfn iddom-input-valueasdate>code>valueAsDate/code>/dfn> IDL attribute represents the a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-10>value/a> of the element, interpreted as a date./p> p>On getting, if the code idcommon-input-element-apis:dom-input-valueasdate-2>a href#dom-input-valueasdate>valueAsDate/a>/code> attribute a href#do-not-apply idcommon-input-element-apis:do-not-apply-3>does not apply/a>, as defined for the code idcommon-input-element-apis:the-input-element-4>a href#the-input-element>input/a>/code> elements code idcommon-input-element-apis:attr-input-type-2>a href#attr-input-type>type/a>/code> attributes current state, then return null. Otherwise, run the a href#concept-input-value-string-date idcommon-input-element-apis:concept-input-value-string-date>algorithm to convert a string to a code>Date/code> object/a> defined for that state to the elements a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-11>value/a>; if the algorithm returned a code idcommon-input-element-apis:date-2>a data-x-internaldate hrefhttps://tc39.github.io/ecma262/#sec-date-objects>Date/a>/code> object, then return it, otherwise, return null./p> p>On setting, if the code idcommon-input-element-apis:dom-input-valueasdate-3>a href#dom-input-valueasdate>valueAsDate/a>/code> attribute a href#do-not-apply idcommon-input-element-apis:do-not-apply-4>does not apply/a>, as defined for the code idcommon-input-element-apis:the-input-element-5>a href#the-input-element>input/a>/code> elements code idcommon-input-element-apis:attr-input-type-3>a href#attr-input-type>type/a>/code> attributes current state, then throw an a idcommon-input-element-apis:invalidstateerror-6 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idcommon-input-element-apis:domexception-6>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>; otherwise, if the new value is not null and not a code idcommon-input-element-apis:date-3>a data-x-internaldate hrefhttps://tc39.github.io/ecma262/#sec-date-objects>Date/a>/code> object throw a code idcommon-input-element-apis:typeerror>a data-x-internaltypeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror>TypeError/a>/code> exception; otherwise if the new value is null or a code idcommon-input-element-apis:date-4>a data-x-internaldate hrefhttps://tc39.github.io/ecma262/#sec-date-objects>Date/a>/code> object representing the NaN time value, then set the a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-12>value/a> of the element to the empty string; otherwise, run the a href#concept-input-value-date-string idcommon-input-element-apis:concept-input-value-date-string>algorithm to convert a code>Date/code> object to a string/a>, as defined for that state, on the new value, and set the a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-13>value/a> of the element to the resulting string./p> hr> p>The dfn iddom-input-valueasnumber>code>valueAsNumber/code>/dfn> IDL attribute represents the a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-14>value/a> of the element, interpreted as a number./p> p>On getting, if the code idcommon-input-element-apis:dom-input-valueasnumber-2>a href#dom-input-valueasnumber>valueAsNumber/a>/code> attribute a href#do-not-apply idcommon-input-element-apis:do-not-apply-5>does not apply/a>, as defined for the code idcommon-input-element-apis:the-input-element-6>a href#the-input-element>input/a>/code> elements code idcommon-input-element-apis:attr-input-type-4>a href#attr-input-type>type/a>/code> attributes current state, then return a Not-a-Number (NaN) value. Otherwise, run the a href#concept-input-value-string-number idcommon-input-element-apis:concept-input-value-string-number>algorithm to convert a string to a number/a> defined for that state to the elements a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-15>value/a>; if the algorithm returned a number, then return it, otherwise, return a Not-a-Number (NaN) value./p> p>On setting, if the new value is infinite, then throw a code idcommon-input-element-apis:typeerror-2>a data-x-internaltypeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror>TypeError/a>/code> exception. Otherwise, if the code idcommon-input-element-apis:dom-input-valueasnumber-3>a href#dom-input-valueasnumber>valueAsNumber/a>/code> attribute a href#do-not-apply idcommon-input-element-apis:do-not-apply-6>does not apply/a>, as defined for the code idcommon-input-element-apis:the-input-element-7>a href#the-input-element>input/a>/code> elements code idcommon-input-element-apis:attr-input-type-5>a href#attr-input-type>type/a>/code> attributes current state, then throw an a idcommon-input-element-apis:invalidstateerror-7 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idcommon-input-element-apis:domexception-7>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>. Otherwise, if the new value is a Not-a-Number (NaN) value, then set the a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-16>value/a> of the element to the empty string. Otherwise, run the a href#concept-input-value-number-string idcommon-input-element-apis:concept-input-value-number-string>algorithm to convert a number to a string/a>, as defined for that state, on the new value, and set the a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-17>value/a> of the element to the resulting string./p> hr> p>The dfn iddom-input-stepdown>code>stepDown(var>n/var>)/code>/dfn> and dfn iddom-input-stepup>code>stepUp(var>n/var>)/code>/dfn> methods, when invoked, must run the following algorithm:/p> ol>li>p>If the code idcommon-input-element-apis:dom-input-stepdown-2>a href#dom-input-stepdown>stepDown()/a>/code> and code idcommon-input-element-apis:dom-input-stepup-2>a href#dom-input-stepup>stepUp()/a>/code> methods a href#do-not-apply idcommon-input-element-apis:do-not-apply-7>do not apply/a>, as defined for the code idcommon-input-element-apis:the-input-element-8>a href#the-input-element>input/a>/code> elements code idcommon-input-element-apis:attr-input-type-6>a href#attr-input-type>type/a>/code> attributes current state, then throw an a idcommon-input-element-apis:invalidstateerror-8 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idcommon-input-element-apis:domexception-8>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>, and abort these steps.li>p>If the element has no a href#concept-input-step idcommon-input-element-apis:concept-input-step>allowed value step/a>, then throw an a idcommon-input-element-apis:invalidstateerror-9 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idcommon-input-element-apis:domexception-9>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>, and abort these steps.li>p>If the element has a a href#concept-input-min idcommon-input-element-apis:concept-input-min>minimum/a> and a a href#concept-input-max idcommon-input-element-apis:concept-input-max>maximum/a> and the a href#concept-input-min idcommon-input-element-apis:concept-input-min-2>minimum/a> is greater than the a href#concept-input-max idcommon-input-element-apis:concept-input-max-2>maximum/a>, then abort these steps./p> li>p>If the element has a a href#concept-input-min idcommon-input-element-apis:concept-input-min-3>minimum/a> and a a href#concept-input-max idcommon-input-element-apis:concept-input-max-3>maximum/a> and there is no value greater than or equal to the elements a href#concept-input-min idcommon-input-element-apis:concept-input-min-4>minimum/a> and less than or equal to the elements a href#concept-input-max idcommon-input-element-apis:concept-input-max-4>maximum/a> that, when subtracted from the a href#concept-input-min-zero idcommon-input-element-apis:concept-input-min-zero>step base/a>, is an integral multiple of the a href#concept-input-step idcommon-input-element-apis:concept-input-step-2>allowed value step/a>, then abort these steps./p> li>p>If applying the a href#concept-input-value-string-number idcommon-input-element-apis:concept-input-value-string-number-2>algorithm to convert a string to a number/a> to the string given by the elements a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-18>value/a> does not result in an error, then let var>value/var> be the result of that algorithm. Otherwise, let var>value/var> be zero.li>p>Let var>valueBeforeStepping/var> be var>value/var>.li> p>If var>value/var> subtracted from the a href#concept-input-min-zero idcommon-input-element-apis:concept-input-min-zero-2>step base/a> is not an integral multiple of the a href#concept-input-step idcommon-input-element-apis:concept-input-step-3>allowed value step/a>, then set var>value/var> to the nearest value that, when subtracted from the a href#concept-input-min-zero idcommon-input-element-apis:concept-input-min-zero-3>step base/a>, is an integral multiple of the a href#concept-input-step idcommon-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 idcommon-input-element-apis:dom-input-stepdown-3>a href#dom-input-stepdown>stepDown()/a>/code> method, and more than var>value/var> otherwise./p> p>Otherwise (var>value/var> subtracted from the a href#concept-input-min-zero idcommon-input-element-apis:concept-input-min-zero-4>step base/a> is an integral multiple of the a href#concept-input-step idcommon-input-element-apis:concept-input-step-5>allowed value step/a>):/p> ol>li>p>Let var>n/var> be the argument.li>p>Let var>delta/var> be the a href#concept-input-step idcommon-input-element-apis:concept-input-step-6>allowed value step/a> multiplied by var>n/var>.li>p>If the method invoked was the code idcommon-input-element-apis:dom-input-stepdown-4>a href#dom-input-stepdown>stepDown()/a>/code> method, negate var>delta/var>.li>p>Let var>value/var> be the result of adding var>delta/var> to var>value/var>./ol> li>p>If the element has a a href#concept-input-min idcommon-input-element-apis:concept-input-min-5>minimum/a>, and var>value/var> is less than that a href#concept-input-min idcommon-input-element-apis:concept-input-min-6>minimum/a>, then set var>value/var> to the smallest value that, when subtracted from the a href#concept-input-min-zero idcommon-input-element-apis:concept-input-min-zero-5>step base/a>, is an integral multiple of the a href#concept-input-step idcommon-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 idcommon-input-element-apis:concept-input-min-7>maximum/a>, and var>value/var> is greater than that a href#concept-input-min idcommon-input-element-apis:concept-input-min-8>maximum/a>, then set var>value/var> to the largest value that, when subtracted from the a href#concept-input-min-zero idcommon-input-element-apis:concept-input-min-zero-6>step base/a>, is an integral multiple of the a href#concept-input-step idcommon-input-element-apis:concept-input-step-8>allowed value step/a>, and that is less than or equal to var>maximum/var>.li> p>If either the method invoked was the code idcommon-input-element-apis:dom-input-stepdown-5>a href#dom-input-stepdown>stepDown()/a>/code> method and var>value/var> is greater than var>valueBeforeStepping/var>, or the method invoked was the code idcommon-input-element-apis:dom-input-stepup-3>a href#dom-input-stepup>stepUp()/a>/code> method and var>value/var> is less than var>valueBeforeStepping/var>, then abort these steps./p> div classexample> p>This ensures that invoking the code idcommon-input-element-apis:dom-input-stepup-4>a href#dom-input-stepup>stepUp()/a>/code> method on the code idcommon-input-element-apis:the-input-element-9>a href#the-input-element>input/a>/code> element in the following example does not change the a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-19>value/a> of that element:/p> pre><input typenumber value1 max0>/pre> /div> li>p>Let var>value as string/var> be the result of running the a href#concept-input-value-number-string idcommon-input-element-apis:concept-input-value-number-string-2>algorithm to convert a number to a string/a>, as defined for the code idcommon-input-element-apis:the-input-element-10>a href#the-input-element>input/a>/code> elements code idcommon-input-element-apis:attr-input-type-7>a href#attr-input-type>type/a>/code> attributes current state, on var>value/var>.li>p>Set the a href#concept-fe-value idcommon-input-element-apis:concept-fe-value-20>value/a> of the element to var>value as string/var>./ol> hr> p>The dfn iddom-input-list>code>list/code>/dfn> IDL attribute must return the current a href#concept-input-list idcommon-input-element-apis:concept-input-list>suggestions source element/a>, if any, or null otherwise./p> h5 idcommon-input-element-events>span classsecno>4.10.5.5/span> Common event behaviorsa href#common-input-element-events classself-link>/a>/h5> p>When the code idcommon-input-element-events:event-input>a href#event-input>input/a>/code> and code idcommon-input-element-events:event-change>a href#event-change>change/a>/code> events a href#concept-input-apply idcommon-input-element-events:concept-input-apply>apply/a> (which is the case for all code idcommon-input-element-events:the-input-element>a href#the-input-element>input/a>/code> controls other than a href#concept-button idcommon-input-element-events:concept-button>buttons/a> and those with the code idcommon-input-element-events:attr-input-type>a href#attr-input-type>type/a>/code> attribute in the a href#hidden-state-(typehidden) idcommon-input-element-events:hidden-state-(typehidden)>Hidden/a> state), the events are fired to indicate that the user has interacted with the control. The code idcommon-input-element-events:event-input-2>a href#event-input>input/a>/code> event fires whenever the user has modified the data of the control. The code idcommon-input-element-events:event-change-2>a href#event-change>change/a>/code> event fires when the value is committed, if that makes sense for the control, or else when the control a href#unfocus-causes-change-event>loses focus/a>. In all cases, the code idcommon-input-element-events:event-input-3>a href#event-input>input/a>/code> event comes before the corresponding code idcommon-input-element-events:event-change-3>a href#event-change>change/a>/code> event (if any)./p> p>When an code idcommon-input-element-events:the-input-element-2>a href#the-input-element>input/a>/code> element has a defined a href#input-activation-behavior idcommon-input-element-events:input-activation-behavior>input activation behavior/a>, the rules for dispatching these events, if they a href#concept-input-apply idcommon-input-element-events:concept-input-apply-2>apply/a>, are given in the section above that defines the code idcommon-input-element-events:attr-input-type-2>a href#attr-input-type>type/a>/code> attributes state. (This is the case for all code idcommon-input-element-events:the-input-element-3>a href#the-input-element>input/a>/code> controls with the code idcommon-input-element-events:attr-input-type-3>a href#attr-input-type>type/a>/code> attribute in the a href#checkbox-state-(typecheckbox) idcommon-input-element-events:checkbox-state-(typecheckbox)>Checkbox/a> state, the a href#radio-button-state-(typeradio) idcommon-input-element-events:radio-button-state-(typeradio)>Radio Button/a> state, or the a href#file-upload-state-(typefile) idcommon-input-element-events:file-upload-state-(typefile)>File Upload/a> state.)/p> p>For code idcommon-input-element-events:the-input-element-4>a href#the-input-element>input/a>/code> elements without a defined a href#input-activation-behavior idcommon-input-element-events:input-activation-behavior-2>input activation behavior/a>, but to which these events a href#concept-input-apply idcommon-input-element-events:concept-input-apply-3>apply/a>, and for which the user interface involves both interactive manipulation and an explicit commit action, then when the user changes the elements a href#concept-fe-value idcommon-input-element-events:concept-fe-value>value/a>, the user agent must a href#queue-a-task idcommon-input-element-events:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idcommon-input-element-events:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idcommon-input-element-events:event-input-4>a href#event-input>input/a>/code> at the code idcommon-input-element-events:the-input-element-5>a href#the-input-element>input/a>/code> element, with the code idcommon-input-element-events:dom-event-bubbles>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true, and any time the user commits the change, the user agent must a href#queue-a-task idcommon-input-element-events:queue-a-task-2>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idcommon-input-element-events:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idcommon-input-element-events:event-change-4>a href#event-change>change/a>/code> at the code idcommon-input-element-events:the-input-element-6>a href#the-input-element>input/a>/code> element, with the code idcommon-input-element-events:dom-event-bubbles-2>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true./p> p classexample>An example of a user interface involving both interactive manipulation and a commit action would be a a href#range-state-(typerange) idcommon-input-element-events:range-state-(typerange)>Range/a> controls that use a slider, when manipulated using a pointing device. While the user is dragging the controls knob, code idcommon-input-element-events:event-input-5>a href#event-input>input/a>/code> events would fire whenever the position changed, whereas the code idcommon-input-element-events:event-change-5>a href#event-change>change/a>/code> event would only fire when the user let go of the knob, committing to a specific value./p> p>For code idcommon-input-element-events:the-input-element-7>a href#the-input-element>input/a>/code> elements without a defined a href#input-activation-behavior idcommon-input-element-events:input-activation-behavior-3>input activation behavior/a>, but to which these events a href#concept-input-apply idcommon-input-element-events:concept-input-apply-4>apply/a>, and for which the user interface involves an explicit commit action but no intermediate manipulation, then any time the user commits a change to the elements a href#concept-fe-value idcommon-input-element-events:concept-fe-value-2>value/a>, the user agent must a href#queue-a-task idcommon-input-element-events:queue-a-task-3>queue a task/a> to first a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idcommon-input-element-events:concept-event-fire-3 data-x-internalconcept-event-fire>fire an event/a> named code idcommon-input-element-events:event-input-6>a href#event-input>input/a>/code> at the code idcommon-input-element-events:the-input-element-8>a href#the-input-element>input/a>/code> element, with the code idcommon-input-element-events:dom-event-bubbles-3>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true, and then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idcommon-input-element-events:concept-event-fire-4 data-x-internalconcept-event-fire>fire an event/a> named code idcommon-input-element-events:event-change-6>a href#event-change>change/a>/code> at the code idcommon-input-element-events:the-input-element-9>a href#the-input-element>input/a>/code> element, with the code idcommon-input-element-events:dom-event-bubbles-4>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true./p> p classexample>An example of a user interface with a commit action would be a a href#color-state-(typecolor) idcommon-input-element-events:color-state-(typecolor)>Color/a> control that consists of a single button that brings up a color wheel: if the a href#concept-fe-value idcommon-input-element-events:concept-fe-value-3>value/a> only changes when the dialog is closed, then that would be the explicit commit action. On the other hand, if manipulating the control changes the color interactively, then there might be no commit action./p> p classexample>Another example of a user interface with a commit action would be a a href#date-state-(typedate) idcommon-input-element-events:date-state-(typedate)>Date/a> control that allows both text-based user input and user selection from a drop-down calendar: while text input might not have an explicit commit step, selecting a date from the drop down calendar and then dismissing the drop down would be a commit action./p> p>For code idcommon-input-element-events:the-input-element-10>a href#the-input-element>input/a>/code> elements without a defined a href#input-activation-behavior idcommon-input-element-events:input-activation-behavior-4>input activation behavior/a>, but to which these events a href#concept-input-apply idcommon-input-element-events:concept-input-apply-5>apply/a>, any time the user causes the elements a href#concept-fe-value idcommon-input-element-events:concept-fe-value-4>value/a> to change without an explicit commit action, the user agent must a href#queue-a-task idcommon-input-element-events:queue-a-task-4>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idcommon-input-element-events:concept-event-fire-5 data-x-internalconcept-event-fire>fire an event/a> named code idcommon-input-element-events:event-input-7>a href#event-input>input/a>/code> at the code idcommon-input-element-events:the-input-element-11>a href#the-input-element>input/a>/code> element, with the code idcommon-input-element-events:dom-event-bubbles-5>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true. The corresponding code idcommon-input-element-events:event-change-7>a href#event-change>change/a>/code> event, if any, will be fired when the control a href#unfocus-causes-change-event>loses focus/a>./p> p classexample>Examples of a user changing the elements a href#concept-fe-value idcommon-input-element-events:concept-fe-value-5>value/a> would include the user typing into a text control, pasting a new value into the control, or undoing an edit in that control. Some user interactions do not cause changes to the value, e.g., hitting the delete key in an empty text control, or replacing some text in the control with text from the clipboard that happens to be exactly the same text./p> p classexample>A a href#range-state-(typerange) idcommon-input-element-events:range-state-(typerange)-2>Range/a> control in the form of a slider that the user has a href#focused idcommon-input-element-events:focused>focused/a> and is interacting with using a keyboard would be another example of the user changing the elements a href#concept-fe-value idcommon-input-element-events:concept-fe-value-6>value/a> without a commit step./p> p>In the case of a href#concept-task idcommon-input-element-events:concept-task>tasks/a> that just fire an code idcommon-input-element-events:event-input-8>a href#event-input>input/a>/code> event, user agents may wait for a suitable break in the users interaction before a href#queue-a-task idcommon-input-element-events:queue-a-task-5>queuing/a> the tasks; for example, a user agent could wait for the user to have not hit a key for 100ms, so as to only fire the event when the user pauses, instead of continuously for each keystroke. p>When the user agent is to change an code idcommon-input-element-events:the-input-element-12>a href#the-input-element>input/a>/code> elements a href#concept-fe-value idcommon-input-element-events:concept-fe-value-7>value/a> on behalf of the user (e.g. as part of a form prefilling feature), the user agent must a href#queue-a-task idcommon-input-element-events:queue-a-task-6>queue a task/a> to first update the a href#concept-fe-value idcommon-input-element-events:concept-fe-value-8>value/a> accordingly, then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idcommon-input-element-events:concept-event-fire-6 data-x-internalconcept-event-fire>fire an event/a> named code idcommon-input-element-events:event-input-9>a href#event-input>input/a>/code> at the code idcommon-input-element-events:the-input-element-13>a href#the-input-element>input/a>/code> element, with the code idcommon-input-element-events:dom-event-bubbles-6>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true, then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idcommon-input-element-events:concept-event-fire-7 data-x-internalconcept-event-fire>fire an event/a> named code idcommon-input-element-events:event-change-8>a href#event-change>change/a>/code> at the code idcommon-input-element-events:the-input-element-14>a href#the-input-element>input/a>/code> element, with the code idcommon-input-element-events:dom-event-bubbles-7>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true./p> p classnote>These events are not fired in response to changes made to the values of form controls by scripts. (This is to make it easier to update the values of form controls in response to the user manipulating the controls, without having to then filter out the scripts own changes to avoid an infinite loop.)/p> p>The a href#task-source idcommon-input-element-events:task-source>task source/a> for these a href#concept-task idcommon-input-element-events:concept-task-2>tasks/a> is the a href#user-interaction-task-source idcommon-input-element-events:user-interaction-task-source>user interaction task source/a>./p> h4 idthe-button-element>span classsecno>4.10.6/span> The dfn>code>button/code>/dfn> elementa href#the-button-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-button-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-button-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-button-element:phrasing-content-2>Phrasing content/a>.dd>a href#interactive-content-2 idthe-button-element:interactive-content-2>Interactive content/a>.dd>a href#category-listed idthe-button-element:category-listed>Listed/a>, a href#category-label idthe-button-element:category-label>labelable/a>, and a href#category-submit idthe-button-element:category-submit>submittable/a> a href#form-associated-element idthe-button-element:form-associated-element>form-associated element/a>.dd>a href#palpable-content-2 idthe-button-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-button-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-button-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-button-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-button-element:phrasing-content-2-3>Phrasing content/a>, but there must be no a href#interactive-content-2 idthe-button-element:interactive-content-2-2>interactive content/a> descendant.dt>a href#concept-element-tag-omission idthe-button-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-button-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-button-element:global-attributes>Global attributes/a>dd>code idthe-button-element:attr-fe-autofocus>a href#attr-fe-autofocus>autofocus/a>/code> — Automatically focus the form control when the page is loadeddd>code idthe-button-element:attr-fe-disabled>a href#attr-fe-disabled>disabled/a>/code> — Whether the form control is disableddd>code idthe-button-element:attr-fae-form>a href#attr-fae-form>form/a>/code> — Associates the control with a code idthe-button-element:the-form-element>a href#the-form-element>form/a>/code> elementdd>code idthe-button-element:attr-fs-formaction>a href#attr-fs-formaction>formaction/a>/code> — a idthe-button-element:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> to use for a href#form-submission-2 idthe-button-element:form-submission-2>form submission/a>dd>code idthe-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 idthe-button-element:form-submission-2-2>form submission/a>dd>code idthe-button-element:attr-fs-formmethod>a href#attr-fs-formmethod>formmethod/a>/code> — HTTP method to use for a href#form-submission-2 idthe-button-element:form-submission-2-3>form submission/a>dd>code idthe-button-element:attr-fs-formnovalidate>a href#attr-fs-formnovalidate>formnovalidate/a>/code> — Bypass form control validation for a href#form-submission-2 idthe-button-element:form-submission-2-4>form submission/a>dd>code idthe-button-element:attr-fs-formtarget>a href#attr-fs-formtarget>formtarget/a>/code> — a href#browsing-context idthe-button-element:browsing-context>Browsing context/a> for a href#form-submission-2 idthe-button-element:form-submission-2-5>form submission/a>dd>code idthe-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 idthe-button-element:form-submission-2-6>form submission/a> and in the code idthe-button-element:dom-form-elements>a href#dom-form-elements>form.elements/a>/code> API dd>code idthe-button-element:attr-button-type>a href#attr-button-type>type/a>/code> — Type of buttondd>code idthe-button-element:attr-button-value>a href#attr-button-value>value/a>/code> — Value to be used for a href#form-submission-2 idthe-button-element:form-submission-2-7>form submission/a>dt>a href#concept-element-dom idthe-button-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-button-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlbuttonelement>HTMLButtonElement/dfn> : a href#htmlelement idthe-button-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-button-element:cereactions>CEReactions/a> attribute boolean a href#dom-fe-autofocus idthe-button-element:dom-fe-autofocus>autofocus/a>; a href#cereactions idthe-button-element:cereactions-2>CEReactions/a> attribute boolean a href#dom-fe-disabled idthe-button-element:dom-fe-disabled>disabled/a>; readonly attribute a href#htmlformelement idthe-button-element:htmlformelement>HTMLFormElement/a>? a href#dom-fae-form idthe-button-element:dom-fae-form>form/a>; a href#cereactions idthe-button-element:cereactions-3>CEReactions/a> attribute USVString a href#dom-fs-formaction idthe-button-element:dom-fs-formaction>formAction/a>; a href#cereactions idthe-button-element:cereactions-4>CEReactions/a> attribute DOMString a href#dom-fs-formenctype idthe-button-element:dom-fs-formenctype>formEnctype/a>; a href#cereactions idthe-button-element:cereactions-5>CEReactions/a> attribute DOMString a href#dom-fs-formmethod idthe-button-element:dom-fs-formmethod>formMethod/a>; a href#cereactions idthe-button-element:cereactions-6>CEReactions/a> attribute boolean a href#dom-fs-formnovalidate idthe-button-element:dom-fs-formnovalidate>formNoValidate/a>; a href#cereactions idthe-button-element:cereactions-7>CEReactions/a> attribute DOMString a href#dom-fs-formtarget idthe-button-element:dom-fs-formtarget>formTarget/a>; a href#cereactions idthe-button-element:cereactions-8>CEReactions/a> attribute DOMString a href#dom-fe-name idthe-button-element:dom-fe-name>name/a>; a href#cereactions idthe-button-element:cereactions-9>CEReactions/a> attribute DOMString a href#dom-button-type idthe-button-element:dom-button-type>type/a>; a href#cereactions idthe-button-element:cereactions-10>CEReactions/a> attribute DOMString a href#dom-button-value idthe-button-element:dom-button-value>value/a>; readonly attribute boolean a href#dom-cva-willvalidate idthe-button-element:dom-cva-willvalidate>willValidate/a>; readonly attribute a href#validitystate idthe-button-element:validitystate>ValidityState/a> a href#dom-cva-validity idthe-button-element:dom-cva-validity>validity/a>; readonly attribute DOMString a href#dom-cva-validationmessage idthe-button-element:dom-cva-validationmessage>validationMessage/a>; boolean a href#dom-cva-checkvalidity idthe-button-element:dom-cva-checkvalidity>checkValidity/a>(); boolean a href#dom-cva-reportvalidity idthe-button-element:dom-cva-reportvalidity>reportValidity/a>(); void a href#dom-cva-setcustomvalidity idthe-button-element:dom-cva-setcustomvalidity>setCustomValidity/a>(DOMString error); readonly attribute a idthe-button-element:nodelist hrefhttps://dom.spec.whatwg.org/#interface-nodelist data-x-internalnodelist>NodeList/a> a href#dom-lfe-labels idthe-button-element:dom-lfe-labels>labels/a>;};/pre> /dl> p>The code idthe-button-element:the-button-element>a href#the-button-element>button/a>/code> element a href#represents idthe-button-element:represents>represents/a> a button labeled by its contents./p> p>The element is a a href#concept-button idthe-button-element:concept-button>button/a>./p> p>The dfn idattr-button-type>code>type/code>/dfn> attribute controls the behavior of the button when it is activated. It is an a href#enumerated-attribute idthe-button-element:enumerated-attribute>enumerated attribute/a>. The following table lists the keywords and states for the attribute — the keywords in the left column map to the states in the cell in the second column on the same row as the keyword./p> table>thead>tr>th> Keyword th> State th> Brief description tbody>tr>td>dfn idattr-button-type-submit>code>submit/code>/dfn> td>a href#attr-button-type-submit-state idthe-button-element:attr-button-type-submit-state>Submit Button/a> td>Submits the form. tr>td>dfn idattr-button-type-reset>code>reset/code>/dfn> td>a href#attr-button-type-reset-state idthe-button-element:attr-button-type-reset-state>Reset Button/a> td>Resets the form. tr>td>dfn idattr-button-type-button>code>button/code>/dfn> td>a href#attr-button-type-button-state idthe-button-element:attr-button-type-button-state>Button/a> td>Does nothing. /table> p>The i idthe-button-element:missing-value-default>a href#missing-value-default>missing value default/a>/i> is the a href#attr-button-type-submit-state idthe-button-element:attr-button-type-submit-state-2>Submit Button/a> state./p> p>If the code idthe-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 idthe-button-element:attr-button-type-submit-state-3>Submit Button/a> state, the element is specifically a a href#concept-submit-button idthe-button-element:concept-submit-button>submit button/a>./p> p>strong>Constraint validation/strong>: If the code idthe-button-element:attr-button-type-3>a href#attr-button-type>type/a>/code> attribute is in the a href#attr-button-type-reset-state idthe-button-element:attr-button-type-reset-state-2>Reset Button/a> state or the a href#attr-button-type-button-state idthe-button-element:attr-button-type-button-state-2>Button/a> state, the element is a href#barred-from-constraint-validation idthe-button-element:barred-from-constraint-validation>barred from constraint validation/a>./p> p>A code idthe-button-element:the-button-element-2>a href#the-button-element>button/a>/code> elements a idthe-button-element:activation-behaviour hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a> is to run the steps defined in the following list for the current state of this elements code idthe-button-element:attr-button-type-4>a href#attr-button-type>type/a>/code> attribute, if this element is not a href#concept-fe-disabled idthe-button-element:concept-fe-disabled>disabled/a>, and do nothing otherwise:/p> dl>dt> dfn idattr-button-type-submit-state>Submit Button/dfn> dd>p>If the element has a a href#form-owner idthe-button-element:form-owner>form owner/a> and the elements a idthe-button-element:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is a href#fully-active idthe-button-element:fully-active>fully active/a>, the element must a href#concept-form-submit idthe-button-element:concept-form-submit>submit/a> the a href#form-owner idthe-button-element:form-owner-2>form owner/a> from the code idthe-button-element:the-button-element-3>a href#the-button-element>button/a>/code> element.dt> dfn idattr-button-type-reset-state>Reset Button/dfn> dd>p>If the element has a a href#form-owner idthe-button-element:form-owner-3>form owner/a> and the elements a idthe-button-element:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is a href#fully-active idthe-button-element:fully-active-2>fully active/a>, the element must a href#concept-form-reset idthe-button-element:concept-form-reset>reset/a> the a href#form-owner idthe-button-element:form-owner-4>form owner/a>.dt> dfn idattr-button-type-button-state>Button/dfn> dd>p>Do nothing./dl> p>The code idthe-button-element:attr-fae-form-2>a href#attr-fae-form>form/a>/code> attribute is used to explicitly associate the code idthe-button-element:the-button-element-4>a href#the-button-element>button/a>/code> element with its a href#form-owner idthe-button-element:form-owner-5>form owner/a>. The code idthe-button-element:attr-fe-name-2>a href#attr-fe-name>name/a>/code> attribute represents the elements name. The code idthe-button-element:attr-fe-disabled-2>a href#attr-fe-disabled>disabled/a>/code> attribute is used to make the control non-interactive and to prevent its value from being submitted. The code idthe-button-element:attr-fe-autofocus-2>a href#attr-fe-autofocus>autofocus/a>/code> attribute controls focus. The code idthe-button-element:attr-fs-formaction-2>a href#attr-fs-formaction>formaction/a>/code>, code idthe-button-element:attr-fs-formenctype-2>a href#attr-fs-formenctype>formenctype/a>/code>, code idthe-button-element:attr-fs-formmethod-2>a href#attr-fs-formmethod>formmethod/a>/code>, code idthe-button-element:attr-fs-formnovalidate-2>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, and code idthe-button-element:attr-fs-formtarget-2>a href#attr-fs-formtarget>formtarget/a>/code> attributes are a href#attributes-for-form-submission idthe-button-element:attributes-for-form-submission>attributes for form submission/a>./p> p classnote>The code idthe-button-element:attr-fs-formnovalidate-3>a href#attr-fs-formnovalidate>formnovalidate/a>/code> attribute can be used to make submit buttons that do not trigger the constraint validation./p> p>The code idthe-button-element:attr-fs-formaction-3>a href#attr-fs-formaction>formaction/a>/code>, code idthe-button-element:attr-fs-formenctype-3>a href#attr-fs-formenctype>formenctype/a>/code>, code idthe-button-element:attr-fs-formmethod-3>a href#attr-fs-formmethod>formmethod/a>/code>, code idthe-button-element:attr-fs-formnovalidate-4>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, and code idthe-button-element:attr-fs-formtarget-3>a href#attr-fs-formtarget>formtarget/a>/code> must not be specified if the elements code idthe-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 idthe-button-element:attr-button-type-submit-state-4>Submit Button/a> state./p> p>The dfn idattr-button-value>code>value/code>/dfn> attribute gives the elements value for the purposes of form submission. The elements a href#concept-fe-value idthe-button-element:concept-fe-value>value/a> is the value of the elements code idthe-button-element:attr-button-value-2>a href#attr-button-value>value/a>/code> attribute, if there is one, or the empty string otherwise./p> p classnote>A button (and its value) is only included in the form submission if the button itself was used to initiate the form submission./p> hr> p>The dfn iddom-button-value>code>value/code>/dfn> IDL attribute must a href#reflect idthe-button-element:reflect>reflect/a> the content attribute of the same name./p> p>The dfn iddom-button-type>code>type/code>/dfn> IDL attribute must a href#reflect idthe-button-element:reflect-2>reflect/a> the content attribute of the same name, a href#limited-to-only-known-values idthe-button-element:limited-to-only-known-values>limited to only known values/a>./p> p>The code idthe-button-element:dom-cva-willvalidate-2>a href#dom-cva-willvalidate>willValidate/a>/code>, code idthe-button-element:dom-cva-validity-2>a href#dom-cva-validity>validity/a>/code>, and code idthe-button-element:dom-cva-validationmessage-2>a href#dom-cva-validationmessage>validationMessage/a>/code> IDL attributes, and the code idthe-button-element:dom-cva-checkvalidity-2>a href#dom-cva-checkvalidity>checkValidity()/a>/code>, code idthe-button-element:dom-cva-reportvalidity-2>a href#dom-cva-reportvalidity>reportValidity()/a>/code>, and code idthe-button-element:dom-cva-setcustomvalidity-2>a href#dom-cva-setcustomvalidity>setCustomValidity()/a>/code> methods, are part of the a href#the-constraint-validation-api idthe-button-element:the-constraint-validation-api>constraint validation API/a>. The code idthe-button-element:dom-lfe-labels-2>a href#dom-lfe-labels>labels/a>/code> IDL attribute provides a list of the elements code idthe-button-element:the-label-element>a href#the-label-element>label/a>/code>s. The code idthe-button-element:dom-fe-autofocus-2>a href#dom-fe-autofocus>autofocus/a>/code>, code idthe-button-element:dom-fe-disabled-2>a href#dom-fe-disabled>disabled/a>/code>, code idthe-button-element:dom-fae-form-2>a href#dom-fae-form>form/a>/code>, and code idthe-button-element:dom-fe-name-2>a href#dom-fe-name>name/a>/code> IDL attributes are part of the elements forms API./p> div classexample> p>The following button is labeled Show hint and pops up a dialog box when activated:/p> pre><button typebutton onclickalert(This 15-20 minute piece was composed by George Gershwin.)> Show hint</button>/pre> /div> h4 idthe-select-element>span classsecno>4.10.7/span> The dfn>code>select/code>/dfn> elementa href#the-select-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id25027 titleselect> needs to not allow changing its height via line-height>25027/a>/div> dl classelement>dt>a href#concept-element-categories idthe-select-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-select-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-select-element:phrasing-content-2>Phrasing content/a>.dd>a href#interactive-content-2 idthe-select-element:interactive-content-2>Interactive content/a>.dd>a href#category-listed idthe-select-element:category-listed>Listed/a>, a href#category-label idthe-select-element:category-label>labelable/a>, a href#category-submit idthe-select-element:category-submit>submittable/a>, and a href#category-reset idthe-select-element:category-reset>resettable/a> a href#form-associated-element idthe-select-element:form-associated-element>form-associated element/a>.dd>a href#palpable-content-2 idthe-select-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-select-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-select-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-select-element:concept-element-content-model>Content model/a>:dd>Zero or more code idthe-select-element:the-option-element>a href#the-option-element>option/a>/code>, code idthe-select-element:the-optgroup-element>a href#the-optgroup-element>optgroup/a>/code>, and a href#script-supporting-elements-2 idthe-select-element:script-supporting-elements-2>script-supporting/a> elements.dt>a href#concept-element-tag-omission idthe-select-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-select-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-select-element:global-attributes>Global attributes/a>dd>code idthe-select-element:attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code> — Hint for form autofill featuredd>code idthe-select-element:attr-fe-autofocus>a href#attr-fe-autofocus>autofocus/a>/code> — Automatically focus the form control when the page is loadeddd>code idthe-select-element:attr-fe-disabled>a href#attr-fe-disabled>disabled/a>/code> — Whether the form control is disableddd>code idthe-select-element:attr-fae-form>a href#attr-fae-form>form/a>/code> — Associates the control with a code idthe-select-element:the-form-element>a href#the-form-element>form/a>/code> elementdd>code idthe-select-element:attr-select-multiple>a href#attr-select-multiple>multiple/a>/code> — Whether to allow multiple valuesdd>code idthe-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 idthe-select-element:form-submission-2>form submission/a> and in the code idthe-select-element:dom-form-elements>a href#dom-form-elements>form.elements/a>/code> API dd>code idthe-select-element:attr-select-required>a href#attr-select-required>required/a>/code> — Whether the control is required for a href#form-submission-2 idthe-select-element:form-submission-2-2>form submission/a>dd>code idthe-select-element:attr-select-size>a href#attr-select-size>size/a>/code> — Size of the controldt>a href#concept-element-dom idthe-select-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-select-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlselectelement>HTMLSelectElement/dfn> : a href#htmlelement idthe-select-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-select-element:cereactions>CEReactions/a> attribute DOMString a href#dom-fe-autocomplete idthe-select-element:dom-fe-autocomplete>autocomplete/a>; a href#cereactions idthe-select-element:cereactions-2>CEReactions/a> attribute boolean a href#dom-fe-autofocus idthe-select-element:dom-fe-autofocus>autofocus/a>; a href#cereactions idthe-select-element:cereactions-3>CEReactions/a> attribute boolean a href#dom-fe-disabled idthe-select-element:dom-fe-disabled>disabled/a>; readonly attribute a href#htmlformelement idthe-select-element:htmlformelement>HTMLFormElement/a>? a href#dom-fae-form idthe-select-element:dom-fae-form>form/a>; a href#cereactions idthe-select-element:cereactions-4>CEReactions/a> attribute boolean a href#dom-select-multiple idthe-select-element:dom-select-multiple>multiple/a>; a href#cereactions idthe-select-element:cereactions-5>CEReactions/a> attribute DOMString a href#dom-fe-name idthe-select-element:dom-fe-name>name/a>; a href#cereactions idthe-select-element:cereactions-6>CEReactions/a> attribute boolean a href#dom-select-required idthe-select-element:dom-select-required>required/a>; a href#cereactions idthe-select-element:cereactions-7>CEReactions/a> attribute unsigned long a href#dom-select-size idthe-select-element:dom-select-size>size/a>; readonly attribute DOMString a href#dom-select-type idthe-select-element:dom-select-type>type/a>; SameObject readonly attribute a href#htmloptionscollection idthe-select-element:htmloptionscollection>HTMLOptionsCollection/a> a href#dom-select-options idthe-select-element:dom-select-options>options/a>; a href#cereactions idthe-select-element:cereactions-8>CEReactions/a> attribute unsigned long a href#dom-select-length idthe-select-element:dom-select-length>length/a>; getter a idthe-select-element:element hrefhttps://dom.spec.whatwg.org/#interface-element data-x-internalelement>Element/a>? a href#dom-select-item idthe-select-element:dom-select-item>item/a>(unsigned long index); a href#htmloptionelement idthe-select-element:htmloptionelement>HTMLOptionElement/a>? a href#dom-select-nameditem idthe-select-element:dom-select-nameditem>namedItem/a>(DOMString name); a href#cereactions idthe-select-element:cereactions-9>CEReactions/a> void a href#dom-select-add idthe-select-element:dom-select-add>add/a>((a href#htmloptionelement idthe-select-element:htmloptionelement-2>HTMLOptionElement/a> or a href#htmloptgroupelement idthe-select-element:htmloptgroupelement>HTMLOptGroupElement/a>) element, optional (a href#htmlelement idthe-select-element:htmlelement-2>HTMLElement/a> or long)? before null); a href#cereactions idthe-select-element:cereactions-10>CEReactions/a> void a href#dom-select-remove idthe-select-element:dom-select-remove>remove/a>(); // ChildNode overload a href#cereactions idthe-select-element:cereactions-11>CEReactions/a> void a href#dom-select-remove idthe-select-element:dom-select-remove-2>remove/a>(long index); a href#cereactions idthe-select-element:cereactions-12>CEReactions/a> a href#dom-select-setter>setter/a> void (unsigned long index, a href#htmloptionelement idthe-select-element:htmloptionelement-3>HTMLOptionElement/a>? option); SameObject readonly attribute a idthe-select-element:htmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> a href#dom-select-selectedoptions idthe-select-element:dom-select-selectedoptions>selectedOptions/a>; attribute long a href#dom-select-selectedindex idthe-select-element:dom-select-selectedindex>selectedIndex/a>; attribute DOMString a href#dom-select-value idthe-select-element:dom-select-value>value/a>; readonly attribute boolean a href#dom-cva-willvalidate idthe-select-element:dom-cva-willvalidate>willValidate/a>; readonly attribute a href#validitystate idthe-select-element:validitystate>ValidityState/a> a href#dom-cva-validity idthe-select-element:dom-cva-validity>validity/a>; readonly attribute DOMString a href#dom-cva-validationmessage idthe-select-element:dom-cva-validationmessage>validationMessage/a>; boolean a href#dom-cva-checkvalidity idthe-select-element:dom-cva-checkvalidity>checkValidity/a>(); boolean a href#dom-cva-reportvalidity idthe-select-element:dom-cva-reportvalidity>reportValidity/a>(); void a href#dom-cva-setcustomvalidity idthe-select-element:dom-cva-setcustomvalidity>setCustomValidity/a>(DOMString error); readonly attribute a idthe-select-element:nodelist hrefhttps://dom.spec.whatwg.org/#interface-nodelist data-x-internalnodelist>NodeList/a> a href#dom-lfe-labels idthe-select-element:dom-lfe-labels>labels/a>;};/pre> /dl> p>The code idthe-select-element:the-select-element>a href#the-select-element>select/a>/code> element represents a control for selecting amongst a set of options./p> p>The dfn idattr-select-multiple>code>multiple/code>/dfn> attribute is a a href#boolean-attribute idthe-select-element:boolean-attribute>boolean attribute/a>. If the attribute is present, then the code idthe-select-element:the-select-element-2>a href#the-select-element>select/a>/code> element a href#represents idthe-select-element:represents>represents/a> a control for selecting zero or more options from the a href#concept-select-option-list idthe-select-element:concept-select-option-list>list of options/a>. If the attribute is absent, then the code idthe-select-element:the-select-element-3>a href#the-select-element>select/a>/code> element a href#represents idthe-select-element:represents-2>represents/a> a control for selecting a single option from the a href#concept-select-option-list idthe-select-element:concept-select-option-list-2>list of options/a>./p> p>The dfn idattr-select-size>code>size/code>/dfn> attribute gives the number of options to show to the user. The code idthe-select-element:attr-select-size-2>a href#attr-select-size>size/a>/code> attribute, if specified, must have a value that is a a href#valid-non-negative-integer idthe-select-element:valid-non-negative-integer>valid non-negative integer/a> greater than zero./p> p>The dfn idconcept-select-size>display size/dfn> of a code idthe-select-element:the-select-element-4>a href#the-select-element>select/a>/code> element is the result of applying the a href#rules-for-parsing-non-negative-integers idthe-select-element:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers/a> to the value of elements code idthe-select-element:attr-select-size-3>a href#attr-select-size>size/a>/code> attribute, if it has one and parsing it is successful. If applying those rules to the attributes value is not successful, or if the code idthe-select-element:attr-select-size-4>a href#attr-select-size>size/a>/code> attribute is absent, then the elements a href#concept-select-size idthe-select-element:concept-select-size>display size/a> is 4 if the elements code idthe-select-element:attr-select-multiple-2>a href#attr-select-multiple>multiple/a>/code> content attribute is present, and 1 otherwise./p> p>The dfn idconcept-select-option-list>list of options/dfn> for a code idthe-select-element:the-select-element-5>a href#the-select-element>select/a>/code> element consists of all the code idthe-select-element:the-option-element-2>a href#the-option-element>option/a>/code> element children of the code idthe-select-element:the-select-element-6>a href#the-select-element>select/a>/code> element, and all the code idthe-select-element:the-option-element-3>a href#the-option-element>option/a>/code> element children of all the code idthe-select-element:the-optgroup-element-2>a href#the-optgroup-element>optgroup/a>/code> element children of the code idthe-select-element:the-select-element-7>a href#the-select-element>select/a>/code> element, in a idthe-select-element:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>./p> p>The dfn idattr-select-required>code>required/code>/dfn> attribute is a a href#boolean-attribute idthe-select-element:boolean-attribute-2>boolean attribute/a>. When specified, the user will be required to select a value before submitting the form./p> p>If a code idthe-select-element:the-select-element-8>a href#the-select-element>select/a>/code> element has a code idthe-select-element:attr-select-required-2>a href#attr-select-required>required/a>/code> attribute specified, does not have a code idthe-select-element:attr-select-multiple-3>a href#attr-select-multiple>multiple/a>/code> attribute specified, and has a a href#concept-select-size idthe-select-element:concept-select-size-2>display size/a> of 1; and if the a href#concept-option-value idthe-select-element:concept-option-value>value/a> of the first code idthe-select-element:the-option-element-4>a href#the-option-element>option/a>/code> element in the code idthe-select-element:the-select-element-9>a href#the-select-element>select/a>/code> elements a href#concept-select-option-list idthe-select-element:concept-select-option-list-3>list of options/a> (if any) is the empty string, and that code idthe-select-element:the-option-element-5>a href#the-option-element>option/a>/code> elements parent node is the code idthe-select-element:the-select-element-10>a href#the-select-element>select/a>/code> element (and not an code idthe-select-element:the-optgroup-element-3>a href#the-optgroup-element>optgroup/a>/code> element), then that code idthe-select-element:the-option-element-6>a href#the-option-element>option/a>/code> is the code idthe-select-element:the-select-element-11>a href#the-select-element>select/a>/code> elements dfn idplaceholder-label-option>placeholder label option/dfn>./p> p>If a code idthe-select-element:the-select-element-12>a href#the-select-element>select/a>/code> element has a code idthe-select-element:attr-select-required-3>a href#attr-select-required>required/a>/code> attribute specified, does not have a code idthe-select-element:attr-select-multiple-4>a href#attr-select-multiple>multiple/a>/code> attribute specified, and has a a href#concept-select-size idthe-select-element:concept-select-size-3>display size/a> of 1, then the code idthe-select-element:the-select-element-13>a href#the-select-element>select/a>/code> element must have a a href#placeholder-label-option idthe-select-element:placeholder-label-option>placeholder label option/a>./p> p classnote>In practice, the requirement stated in the paragraph above can only apply when a code idthe-select-element:the-select-element-14>a href#the-select-element>select/a>/code> element does not have a code idthe-select-element:attr-select-size-5>a href#attr-select-size>size/a>/code> attribute with a value greater than 1./p> p>strong>Constraint validation/strong>: If the element has its code idthe-select-element:attr-select-required-4>a href#attr-select-required>required/a>/code> attribute specified, and either none of the code idthe-select-element:the-option-element-7>a href#the-option-element>option/a>/code> elements in the code idthe-select-element:the-select-element-15>a href#the-select-element>select/a>/code> elements a href#concept-select-option-list idthe-select-element:concept-select-option-list-4>list of options/a> have their a href#concept-option-selectedness idthe-select-element:concept-option-selectedness>selectedness/a> set to true, or the only code idthe-select-element:the-option-element-8>a href#the-option-element>option/a>/code> element in the code idthe-select-element:the-select-element-16>a href#the-select-element>select/a>/code> elements a href#concept-select-option-list idthe-select-element:concept-select-option-list-5>list of options/a> with its a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-2>selectedness/a> set to true is the a href#placeholder-label-option idthe-select-element:placeholder-label-option-2>placeholder label option/a>, then the element is a href#suffering-from-being-missing idthe-select-element:suffering-from-being-missing>suffering from being missing/a>./p> p>If the code idthe-select-element:attr-select-multiple-5>a href#attr-select-multiple>multiple/a>/code> attribute is absent, and the element is not a href#concept-fe-disabled idthe-select-element:concept-fe-disabled>disabled/a>, then the user agent should allow the user to pick an code idthe-select-element:the-option-element-9>a href#the-option-element>option/a>/code> element in its a href#concept-select-option-list idthe-select-element:concept-select-option-list-6>list of options/a> that is itself not a href#concept-option-disabled idthe-select-element:concept-option-disabled>disabled/a>. Upon this code idthe-select-element:the-option-element-10>a href#the-option-element>option/a>/code> element being dfn idconcept-select-pick>picked/dfn> (either through a click, or through unfocusing the element after changing its value, or through a a href#using-the-option-element-to-define-a-command idthe-select-element:using-the-option-element-to-define-a-command>menu command/a>, or through any other mechanism), and before the relevant user interaction event is queued (e.g. before the code idthe-select-element:event-click>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> event), the user agent must set the a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-3>selectedness/a> of the picked code idthe-select-element:the-option-element-11>a href#the-option-element>option/a>/code> element to true, set its a href#concept-option-dirtiness idthe-select-element:concept-option-dirtiness>dirtiness/a> to true, and then a href#send-select-update-notifications idthe-select-element:send-select-update-notifications>send code>select/code> update notifications/a>./p> p>If the code idthe-select-element:attr-select-multiple-6>a href#attr-select-multiple>multiple/a>/code> attribute is absent, whenever an code idthe-select-element:the-option-element-12>a href#the-option-element>option/a>/code> element in the code idthe-select-element:the-select-element-17>a href#the-select-element>select/a>/code> elements a href#concept-select-option-list idthe-select-element:concept-select-option-list-7>list of options/a> has its a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-4>selectedness/a> set to true, and whenever an code idthe-select-element:the-option-element-13>a href#the-option-element>option/a>/code> element with its a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-5>selectedness/a> set to true is added to the code idthe-select-element:the-select-element-18>a href#the-select-element>select/a>/code> elements a href#concept-select-option-list idthe-select-element:concept-select-option-list-8>list of options/a>, the user agent must set the a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-6>selectedness/a> of all the other code idthe-select-element:the-option-element-14>a href#the-option-element>option/a>/code> elements in its a href#concept-select-option-list idthe-select-element:concept-select-option-list-9>list of options/a> to false./p> p>If the code idthe-select-element:attr-select-multiple-7>a href#attr-select-multiple>multiple/a>/code> attribute is absent and the elements a href#concept-select-size idthe-select-element:concept-select-size-4>display size/a> is greater than 1, then the user agent should also allow the user to request that the code idthe-select-element:the-option-element-15>a href#the-option-element>option/a>/code> whose a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-7>selectedness/a> is true, if any, be unselected. Upon this request being conveyed to the user agent, and before the relevant user interaction event is queued (e.g. before the code idthe-select-element:event-click-2>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> event), the user agent must set the a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-8>selectedness/a> of that code idthe-select-element:the-option-element-16>a href#the-option-element>option/a>/code> element to false, set its a href#concept-option-dirtiness idthe-select-element:concept-option-dirtiness-2>dirtiness/a> to true, and then a href#send-select-update-notifications idthe-select-element:send-select-update-notifications-2>send code>select/code> update notifications/a>./p> p>If a href#nodes-are-inserted idthe-select-element:nodes-are-inserted>nodes are inserted/a> or a href#nodes-are-removed idthe-select-element:nodes-are-removed>nodes are removed/a> causing the a href#concept-select-option-list idthe-select-element:concept-select-option-list-10>list of options/a> to gain or lose one or more code idthe-select-element:the-option-element-17>a href#the-option-element>option/a>/code> elements, or if an code idthe-select-element:the-option-element-18>a href#the-option-element>option/a>/code> element in the a href#concept-select-option-list idthe-select-element:concept-select-option-list-11>list of options/a> dfn idask-for-a-reset>asks for a reset/dfn>, then, if the code idthe-select-element:the-select-element-19>a href#the-select-element>select/a>/code> elements code idthe-select-element:attr-select-multiple-8>a href#attr-select-multiple>multiple/a>/code> attribute is absent, the user agent must run the first applicable set of steps from the following list:/p> dl classswitch>dt>If the code idthe-select-element:the-select-element-20>a href#the-select-element>select/a>/code> elements a href#concept-select-size idthe-select-element:concept-select-size-5>display size/a> is 1, and no code idthe-select-element:the-option-element-19>a href#the-option-element>option/a>/code> elements in the code idthe-select-element:the-select-element-21>a href#the-select-element>select/a>/code> elements a href#concept-select-option-list idthe-select-element:concept-select-option-list-12>list of options/a> have their a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-9>selectedness/a> set to truedd>p>Set the a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-10>selectedness/a> of the first code idthe-select-element:the-option-element-20>a href#the-option-element>option/a>/code> element in the a href#concept-select-option-list idthe-select-element:concept-select-option-list-13>list of options/a> in a idthe-select-element:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> that is not a href#concept-option-disabled idthe-select-element:concept-option-disabled-2>disabled/a>, if any, to true.dt>If two or more code idthe-select-element:the-option-element-21>a href#the-option-element>option/a>/code> elements in the code idthe-select-element:the-select-element-22>a href#the-select-element>select/a>/code> elements a href#concept-select-option-list idthe-select-element:concept-select-option-list-14>list of options/a> have their a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-11>selectedness/a> set to truedd>p>Set the a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-12>selectedness/a> of all but the last code idthe-select-element:the-option-element-22>a href#the-option-element>option/a>/code> element with its a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-13>selectedness/a> set to true in the a href#concept-select-option-list idthe-select-element:concept-select-option-list-15>list of options/a> in a idthe-select-element:tree-order-3 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> to false./dl> p>If the code idthe-select-element:attr-select-multiple-9>a href#attr-select-multiple>multiple/a>/code> attribute is present, and the element is not a href#concept-fe-disabled idthe-select-element:concept-fe-disabled-2>disabled/a>, then the user agent should allow the user to dfn idconcept-select-toggle>toggle/dfn> the a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-14>selectedness/a> of the code idthe-select-element:the-option-element-23>a href#the-option-element>option/a>/code> elements in its a href#concept-select-option-list idthe-select-element:concept-select-option-list-16>list of options/a> that are themselves not a href#concept-option-disabled idthe-select-element:concept-option-disabled-3>disabled/a>. Upon such an element being a href#concept-select-toggle idthe-select-element:concept-select-toggle>toggled/a> (either through a click, or through a a href#using-the-option-element-to-define-a-command idthe-select-element:using-the-option-element-to-define-a-command-2>menu command/a>, or any other mechanism), and before the relevant user interaction event is queued (e.g. before a related code idthe-select-element:event-click-3>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> event), the a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-15>selectedness/a> of the code idthe-select-element:the-option-element-24>a href#the-option-element>option/a>/code> element must be changed (from true to false or false to true), the a href#concept-option-dirtiness idthe-select-element:concept-option-dirtiness-3>dirtiness/a> of the element must be set to true, and the user agent must a href#send-select-update-notifications idthe-select-element:send-select-update-notifications-3>send code>select/code> update notifications/a>./p> p>When the user agent is to dfn idsend-select-update-notifications>send code>select/code> update notifications/dfn>, a href#queue-a-task idthe-select-element:queue-a-task>queue a task/a>, using the a href#user-interaction-task-source idthe-select-element:user-interaction-task-source>user interaction task source/a>, to run these steps:/p> ol>li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-select-element:concept-event-fire data-x-internalconcept-event-fire>Fire an event/a> named code idthe-select-element:event-input>a href#event-input>input/a>/code> at the code idthe-select-element:the-select-element-23>a href#the-select-element>select/a>/code> element, with the code idthe-select-element:dom-event-bubbles>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-select-element:concept-event-fire-2 data-x-internalconcept-event-fire>Fire an event/a> named code idthe-select-element:event-change>a href#event-change>change/a>/code> at the code idthe-select-element:the-select-element-24>a href#the-select-element>select/a>/code> element, with the code idthe-select-element:dom-event-bubbles-2>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true./ol> p>The a href#concept-form-reset-control idthe-select-element:concept-form-reset-control>reset algorithm/a> for code idthe-select-element:the-select-element-25>a href#the-select-element>select/a>/code> elements is to go through all the code idthe-select-element:the-option-element-25>a href#the-option-element>option/a>/code> elements in the elements a href#concept-select-option-list idthe-select-element:concept-select-option-list-17>list of options/a>, set their a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-16>selectedness/a> to true if the code idthe-select-element:the-option-element-26>a href#the-option-element>option/a>/code> element has a code idthe-select-element:attr-option-selected>a href#attr-option-selected>selected/a>/code> attribute, and false otherwise, set their a href#concept-option-dirtiness idthe-select-element:concept-option-dirtiness-4>dirtiness/a> to false, and then have the code idthe-select-element:the-option-element-27>a href#the-option-element>option/a>/code> elements a href#ask-for-a-reset idthe-select-element:ask-for-a-reset>ask for a reset/a>./p> p> The code idthe-select-element:attr-fae-form-2>a href#attr-fae-form>form/a>/code> attribute is used to explicitly associate the code idthe-select-element:the-select-element-26>a href#the-select-element>select/a>/code> element with its a href#form-owner idthe-select-element:form-owner>form owner/a>. The code idthe-select-element:attr-fe-name-2>a href#attr-fe-name>name/a>/code> attribute represents the elements name. The code idthe-select-element:attr-fe-disabled-2>a href#attr-fe-disabled>disabled/a>/code> attribute is used to make the control non-interactive and to prevent its value from being submitted. The code idthe-select-element:attr-fe-autofocus-2>a href#attr-fe-autofocus>autofocus/a>/code> attribute controls focus. The code idthe-select-element:attr-fe-autocomplete-2>a href#attr-fe-autocomplete>autocomplete/a>/code> attribute controls how the user agent provides autofill behavior. /p> p>A code idthe-select-element:the-select-element-27>a href#the-select-element>select/a>/code> element that is not a href#concept-fe-disabled idthe-select-element:concept-fe-disabled-3>disabled/a> is i idthe-select-element:concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i>./p> dl classdomintro>dt>var>select/var> . code idthe-select-element:dom-select-type-2>a href#dom-select-type>type/a>/code>dd> p>Returns code>select-multiple/code> if the element has a code idthe-select-element:attr-select-multiple-10>a href#attr-select-multiple>multiple/a>/code> attribute, and code>select-one/code> otherwise./p> dt>var>select/var> . code idthe-select-element:dom-select-options-2>a href#dom-select-options>options/a>/code>dd> p>Returns an code idthe-select-element:htmloptionscollection-2>a href#htmloptionscollection>HTMLOptionsCollection/a>/code> of the a href#concept-select-option-list idthe-select-element:concept-select-option-list-18>list of options/a>./p> dt>var>select/var> . code idthe-select-element:dom-select-length-2>a href#dom-select-length>length/a>/code> var>value/var> dd> p>Returns the number of elements in the a href#concept-select-option-list idthe-select-element:concept-select-option-list-19>list of options/a>./p> p>When set to a smaller number, truncates the number of code idthe-select-element:the-option-element-28>a href#the-option-element>option/a>/code> elements in the code idthe-select-element:the-select-element-28>a href#the-select-element>select/a>/code>./p> p>When set to a greater number, adds new blank code idthe-select-element:the-option-element-29>a href#the-option-element>option/a>/code> elements to the code idthe-select-element:the-select-element-29>a href#the-select-element>select/a>/code>./p> dt>var>element/var> var>select/var> . code idthe-select-element:dom-select-item-2>a href#dom-select-item>item/a>/code>(var>index/var>)dt>var>select/var>var>index/var>dd> p>Returns the item with index var>index/var> from the a href#concept-select-option-list idthe-select-element:concept-select-option-list-20>list of options/a>. The items are sorted in a idthe-select-element:tree-order-4 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>./p> dt>var>element/var> var>select/var> . code idthe-select-element:dom-select-nameditem-2>a href#dom-select-nameditem>namedItem/a>/code>(var>name/var>)dd> p>Returns the first item with a hrefhttps://dom.spec.whatwg.org/#concept-id idthe-select-element:concept-id data-x-internalconcept-id>ID/a> or code idthe-select-element:attr-option-name>a href#attr-option-name>name/a>/code> var>name/var> from the a href#concept-select-option-list idthe-select-element:concept-select-option-list-21>list of options/a>./p> p>Returns null if no element with that a hrefhttps://dom.spec.whatwg.org/#concept-id idthe-select-element:concept-id-2 data-x-internalconcept-id>ID/a> could be found./p> dt>var>select/var> . code idthe-select-element:dom-select-add-2>a href#dom-select-add>add/a>/code>(var>element/var> , var>before/var> )dd> p>Inserts var>element/var> before the node given by var>before/var>./p> p>The var>before/var> argument can be a number, in which case var>element/var> is inserted before the item with that number, or an element from the a href#concept-select-option-list idthe-select-element:concept-select-option-list-22>list of options/a>, in which case var>element/var> is inserted before that element./p> p>If var>before/var> is omitted, null, or a number out of range, then var>element/var> will be added at the end of the list./p> p>This method will throw a a idthe-select-element:hierarchyrequesterror hrefhttps://heycam.github.io/webidl/#hierarchyrequesterror data-x-internalhierarchyrequesterror>code>HierarchyRequestError/code>/a> code idthe-select-element:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if var>element/var> is an ancestor of the element into which it is to be inserted./p> dt>var>select/var> . code idthe-select-element:dom-select-selectedoptions-2>a href#dom-select-selectedoptions>selectedOptions/a>/code>dd> p>Returns an code idthe-select-element:htmlcollection-2>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> of the a href#concept-select-option-list idthe-select-element:concept-select-option-list-23>list of options/a> that are selected./p> dt>var>select/var> . code idthe-select-element:dom-select-selectedindex-2>a href#dom-select-selectedindex>selectedIndex/a>/code> var>value/var> dd> p>Returns the index of the first selected item, if any, or −1 if there is no selected item./p> p>Can be set, to change the selection./p> dt>var>select/var> . code idthe-select-element:dom-select-value-2>a href#dom-select-value>value/a>/code> var>value/var> dd> p>Returns the a href#concept-option-value idthe-select-element:concept-option-value-2>value/a> of the first selected item, if any, or the empty string if there is no selected item./p> p>Can be set, to change the selection./p> /dl> p>The dfn iddom-select-type>code>type/code>/dfn> IDL attribute, on getting, must return the string code>select-one/code> if the code idthe-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 idthe-select-element:attr-select-multiple-12>a href#attr-select-multiple>multiple/a>/code> attribute is present./p> p>The dfn iddom-select-options>code>options/code>/dfn> IDL attribute must return an code idthe-select-element:htmloptionscollection-3>a href#htmloptionscollection>HTMLOptionsCollection/a>/code> rooted at the code idthe-select-element:the-select-element-30>a href#the-select-element>select/a>/code> node, whose filter matches the elements in the a href#concept-select-option-list idthe-select-element:concept-select-option-list-24>list of options/a>./p> p>The code idthe-select-element:dom-select-options-3>a href#dom-select-options>options/a>/code> collection is also mirrored on the code idthe-select-element:htmlselectelement>a href#htmlselectelement>HTMLSelectElement/a>/code> object. The a idthe-select-element:supported-property-indices hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a> at any instant are the indices supported by the object returned by the code idthe-select-element:dom-select-options-4>a href#dom-select-options>options/a>/code> attribute at that instant./p> p>The dfn iddom-select-length>code>length/code>/dfn> IDL attribute must return the number of nodes a hrefhttps://dom.spec.whatwg.org/#represented-by-the-collection idthe-select-element:represented-by-the-collection data-x-internalrepresented-by-the-collection>represented/a> by the code idthe-select-element:dom-select-options-5>a href#dom-select-options>options/a>/code> collection. On setting, it must act like the attribute of the same name on the code idthe-select-element:dom-select-options-6>a href#dom-select-options>options/a>/code> collection./p> p>The dfn iddom-select-item>code>item(var>index/var>)/code>/dfn> method must return the value returned by a hrefhttps://dom.spec.whatwg.org/#dom-htmlcollection-item idthe-select-element:dom-htmlcollection-item data-x-internaldom-htmlcollection-item>the method of the same name/a> on the code idthe-select-element:dom-select-options-7>a href#dom-select-options>options/a>/code> collection, when invoked with the same argument./p> p>The dfn iddom-select-nameditem>code>namedItem(var>name/var>)/code>/dfn> method must return the value returned by a hrefhttps://dom.spec.whatwg.org/#dom-htmlcollection-nameditem idthe-select-element:dom-htmlcollection-nameditem data-x-internaldom-htmlcollection-nameditem>the method of the same name/a> on the code idthe-select-element:dom-select-options-8>a href#dom-select-options>options/a>/code> collection, when invoked with the same argument./p> p iddom-select-setter>When the user agent is to a idthe-select-element:set-the-value-of-a-new-indexed-property hrefhttps://heycam.github.io/webidl/#dfn-set-the-value-of-a-new-indexed-property data-x-internalset-the-value-of-a-new-indexed-property>set the value of a new indexed property/a> or a idthe-select-element:set-the-value-of-an-existing-indexed-property hrefhttps://heycam.github.io/webidl/#dfn-set-the-value-of-an-existing-indexed-property data-x-internalset-the-value-of-an-existing-indexed-property>set the value of an existing indexed property/a> for a code idthe-select-element:the-select-element-31>a href#the-select-element>select/a>/code> element, it must instead run a href#dom-htmloptionscollection-setter>the corresponding algorithm/a> on the code idthe-select-element:the-select-element-32>a href#the-select-element>select/a>/code> elements code idthe-select-element:dom-select-options-9>a href#dom-select-options>options/a>/code> collection./p> p>Similarly, the dfn iddom-select-add>code>add()/code>/dfn> method must act like its namesake method on that same code idthe-select-element:dom-select-options-10>a href#dom-select-options>options/a>/code> collection./p> p>The dfn iddom-select-remove>code>remove()/code>/dfn> method must act like its namesake method on that same code idthe-select-element:dom-select-options-11>a href#dom-select-options>options/a>/code> collection when it has arguments, and like its namesake method on the code idthe-select-element:childnode>a data-x-internalchildnode hrefhttps://dom.spec.whatwg.org/#interface-childnode>ChildNode/a>/code> interface implemented by the code idthe-select-element:htmlselectelement-2>a href#htmlselectelement>HTMLSelectElement/a>/code> ancestor interface code idthe-select-element:element-2>a data-x-internalelement hrefhttps://dom.spec.whatwg.org/#interface-element>Element/a>/code> when it has no arguments./p> p>The dfn iddom-select-selectedoptions>code>selectedOptions/code>/dfn> IDL attribute must return an code idthe-select-element:htmlcollection-3>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> rooted at the code idthe-select-element:the-select-element-33>a href#the-select-element>select/a>/code> node, whose filter matches the elements in the a href#concept-select-option-list idthe-select-element:concept-select-option-list-25>list of options/a> that have their a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-17>selectedness/a> set to true./p> p>The dfn iddom-select-selectedindex>code>selectedIndex/code>/dfn> IDL attribute, on getting, must return the a href#concept-option-index idthe-select-element:concept-option-index>index/a> of the first code idthe-select-element:the-option-element-30>a href#the-option-element>option/a>/code> element in the a href#concept-select-option-list idthe-select-element:concept-select-option-list-26>list of options/a> in a idthe-select-element:tree-order-5 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> that has its a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-18>selectedness/a> set to true, if any. If there isnt one, then it must return −1./p> p>On setting, the code idthe-select-element:dom-select-selectedindex-3>a href#dom-select-selectedindex>selectedIndex/a>/code> attribute must set the a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-19>selectedness/a> of all the code idthe-select-element:the-option-element-31>a href#the-option-element>option/a>/code> elements in the a href#concept-select-option-list idthe-select-element:concept-select-option-list-27>list of options/a> to false, and then the code idthe-select-element:the-option-element-32>a href#the-option-element>option/a>/code> element in the a href#concept-select-option-list idthe-select-element:concept-select-option-list-28>list of options/a> whose a href#concept-option-index idthe-select-element:concept-option-index-2>index/a> is the given new value, if any, must have its a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-20>selectedness/a> set to true and its a href#concept-option-dirtiness idthe-select-element:concept-option-dirtiness-5>dirtiness/a> set to true./p> p classnote>This can result in no element having a a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-21>selectedness/a> set to true even in the case of the code idthe-select-element:the-select-element-34>a href#the-select-element>select/a>/code> element having no code idthe-select-element:attr-select-multiple-13>a href#attr-select-multiple>multiple/a>/code> attribute and a a href#concept-select-size idthe-select-element:concept-select-size-6>display size/a> of 1./p> p>The dfn iddom-select-value>code>value/code>/dfn> IDL attribute, on getting, must return the a href#concept-option-value idthe-select-element:concept-option-value-3>value/a> of the first code idthe-select-element:the-option-element-33>a href#the-option-element>option/a>/code> element in the a href#concept-select-option-list idthe-select-element:concept-select-option-list-29>list of options/a> in a idthe-select-element:tree-order-6 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> that has its a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-22>selectedness/a> set to true, if any. If there isnt one, then it must return the empty string./p> p>On setting, the code idthe-select-element:dom-select-value-3>a href#dom-select-value>value/a>/code> attribute must set the a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-23>selectedness/a> of all the code idthe-select-element:the-option-element-34>a href#the-option-element>option/a>/code> elements in the a href#concept-select-option-list idthe-select-element:concept-select-option-list-30>list of options/a> to false, and then the first code idthe-select-element:the-option-element-35>a href#the-option-element>option/a>/code> element in the a href#concept-select-option-list idthe-select-element:concept-select-option-list-31>list of options/a>, in a idthe-select-element:tree-order-7 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>, whose a href#concept-option-value idthe-select-element:concept-option-value-4>value/a> is equal to the given new value, if any, must have its a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-24>selectedness/a> set to true and its a href#concept-option-dirtiness idthe-select-element:concept-option-dirtiness-6>dirtiness/a> set to true./p> p classnote>This can result in no element having a a href#concept-option-selectedness idthe-select-element:concept-option-selectedness-25>selectedness/a> set to true even in the case of the code idthe-select-element:the-select-element-35>a href#the-select-element>select/a>/code> element having no code idthe-select-element:attr-select-multiple-14>a href#attr-select-multiple>multiple/a>/code> attribute and a a href#concept-select-size idthe-select-element:concept-select-size-7>display size/a> of 1./p> p>The dfn iddom-select-multiple>code>multiple/code>/dfn>, dfn iddom-select-required>code>required/code>/dfn>, and dfn iddom-select-size>code>size/code>/dfn> IDL attributes must a href#reflect idthe-select-element:reflect>reflect/a> the respective content attributes of the same name. The code idthe-select-element:dom-select-size-2>a href#dom-select-size>size/a>/code> IDL attribute has a default value of zero./p> p classnote>For historical reasons, the default value of the code idthe-select-element:dom-select-size-3>a href#dom-select-size>size/a>/code> IDL attribute does not return the actual size used, which, in the absence of the code idthe-select-element:attr-select-size-6>a href#attr-select-size>size/a>/code> content attribute, is either 1 or 4 depending on the presence of the code idthe-select-element:attr-select-multiple-15>a href#attr-select-multiple>multiple/a>/code> attribute./p> p>The code idthe-select-element:dom-cva-willvalidate-2>a href#dom-cva-willvalidate>willValidate/a>/code>, code idthe-select-element:dom-cva-validity-2>a href#dom-cva-validity>validity/a>/code>, and code idthe-select-element:dom-cva-validationmessage-2>a href#dom-cva-validationmessage>validationMessage/a>/code> IDL attributes, and the code idthe-select-element:dom-cva-checkvalidity-2>a href#dom-cva-checkvalidity>checkValidity()/a>/code>, code idthe-select-element:dom-cva-reportvalidity-2>a href#dom-cva-reportvalidity>reportValidity()/a>/code>, and code idthe-select-element:dom-cva-setcustomvalidity-2>a href#dom-cva-setcustomvalidity>setCustomValidity()/a>/code> methods, are part of the a href#the-constraint-validation-api idthe-select-element:the-constraint-validation-api>constraint validation API/a>. The code idthe-select-element:dom-lfe-labels-2>a href#dom-lfe-labels>labels/a>/code> IDL attribute provides a list of the elements code idthe-select-element:the-label-element>a href#the-label-element>label/a>/code>s. The code idthe-select-element:dom-fe-autofocus-2>a href#dom-fe-autofocus>autofocus/a>/code>, code idthe-select-element:dom-fe-disabled-2>a href#dom-fe-disabled>disabled/a>/code>, code idthe-select-element:dom-fae-form-2>a href#dom-fae-form>form/a>/code>, and code idthe-select-element:dom-fe-name-2>a href#dom-fe-name>name/a>/code> IDL attributes are part of the elements forms API./p> div classexample> p>The following example shows how a code idthe-select-element:the-select-element-36>a href#the-select-element>select/a>/code> element can be used to offer the user with a set of options from which the user can select a single option. The default option is preselected./p> pre><p> <label forunittype>Select unit type:</label> <select idunittype nameunittype> <option value1> Miner </option> <option value2> Puffer </option> <option value3 selected> Snipey </option> <option value4> Max </option> <option value5> Firebot </option> </select></p>/pre> p>When there is no default option, a placeholder can be used instead:/p> pre><select nameunittype strong>required/strong>> strong><option value> Select unit type </option>/strong> <option value1> Miner </option> <option value2> Puffer </option> <option value3> Snipey </option> <option value4> Max </option> <option value5> Firebot </option></select>/pre> /div> div classexample> p>Here, the user is offered a set of options from which they can select any number. By default, all five options are selected./p> pre><p> <label forallowedunits>Select unit types to enable on this map:</label> <select idallowedunits nameallowedunits multiple> <option value1 selected> Miner </option> <option value2 selected> Puffer </option> <option value3 selected> Snipey </option> <option value4 selected> Max </option> <option value5 selected> Firebot </option> </select></p>/pre> /div> div classexample> p>Sometimes, a user has to select one or more items. This example shows such an interface./p> pre><p>Select the songs from that you would like on your Act II Mix Tape:</p><select multiple required nameact2> <option values1>It Sucks to Be Me (Reprise) <option values2>There is Life Outside Your Apartment <option values3>The More You Ruv Someone <option values4>Schadenfreude <option values5>I Wish I Could Go Back to College <option values6>The Money Song <option values7>School for Monsters <option values8>The Money Song (Reprise) <option values9>Theres a Fine, Fine Line (Reprise) <option values10>What Do You Do With a B.A. in English? (Reprise) <option values11>For Now</select>/pre> /div> h4 idthe-datalist-element>span classsecno>4.10.8/span> The dfn>code>datalist/code>/dfn> elementa href#the-datalist-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> datalistspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>63+/span>/span>span classfirefox partial>span>Firefox (limited)/span> span>4+/span>/span>span classie partial>span>IE (limited)/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classedge partial>span>Edge (limited)/span> span>12+/span>/span>span classandroid partial>span>Android Browser (limited)/span> span>56+/span>/span>span classopera partial>span>Opera (limited)/span> span>15+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featdatalist>caniuse.com/a>/div> dl classelement>dt>a href#concept-element-categories idthe-datalist-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-datalist-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-datalist-element:phrasing-content-2>Phrasing content/a>.dt>a href#concept-element-contexts idthe-datalist-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-datalist-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-datalist-element:concept-element-content-model>Content model/a>:dd>Either: a href#phrasing-content-2 idthe-datalist-element:phrasing-content-2-3>phrasing content/a>.dd>Or: Zero or more code idthe-datalist-element:the-option-element>a href#the-option-element>option/a>/code> and a href#script-supporting-elements-2 idthe-datalist-element:script-supporting-elements-2>script-supporting/a> elements.dt>a href#concept-element-tag-omission idthe-datalist-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-datalist-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-datalist-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-datalist-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-datalist-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmldatalistelement>HTMLDataListElement/dfn> : a href#htmlelement idthe-datalist-element:htmlelement>HTMLElement/a> { SameObject readonly attribute a idthe-datalist-element:htmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> a href#dom-datalist-options idthe-datalist-element:dom-datalist-options>options/a>;};/pre> /dl> p>The code idthe-datalist-element:the-datalist-element>a href#the-datalist-element>datalist/a>/code> element represents a set of code idthe-datalist-element:the-option-element-2>a href#the-option-element>option/a>/code> elements that represent predefined options for other controls. In the rendering, the code idthe-datalist-element:the-datalist-element-2>a href#the-datalist-element>datalist/a>/code> element a href#represents idthe-datalist-element:represents>represents/a> nothing and it, along with its children, should be hidden./p> p>The code idthe-datalist-element:the-datalist-element-3>a href#the-datalist-element>datalist/a>/code> element can be used in two ways. In the simplest case, the code idthe-datalist-element:the-datalist-element-4>a href#the-datalist-element>datalist/a>/code> element has just code idthe-datalist-element:the-option-element-3>a href#the-option-element>option/a>/code> element children./p> div classexample> pre><label> Sex: <input namesex listsexes> <datalist idsexes> <option valueFemale> <option valueMale> </datalist></label>/pre> /div> p>In the more elaborate case, the code idthe-datalist-element:the-datalist-element-5>a href#the-datalist-element>datalist/a>/code> element can be given contents that are to be displayed for down-level clients that dont support code idthe-datalist-element:the-datalist-element-6>a href#the-datalist-element>datalist/a>/code>. In this case, the code idthe-datalist-element:the-option-element-4>a href#the-option-element>option/a>/code> elements are provided inside a code idthe-datalist-element:the-select-element>a href#the-select-element>select/a>/code> element inside the code idthe-datalist-element:the-datalist-element-7>a href#the-datalist-element>datalist/a>/code> element./p> div classexample> pre><label> Sex: <input namesex listsexes></label><datalist idsexes> <label> or select from the list: <select namesex> <option value> <option>Female <option>Male </select> </label></datalist>/pre> /div> p>The code idthe-datalist-element:the-datalist-element-8>a href#the-datalist-element>datalist/a>/code> element is hooked up to an code idthe-datalist-element:the-input-element>a href#the-input-element>input/a>/code> element using the code idthe-datalist-element:attr-input-list>a href#attr-input-list>list/a>/code> attribute on the code idthe-datalist-element:the-input-element-2>a href#the-input-element>input/a>/code> element./p> p>Each code idthe-datalist-element:the-option-element-5>a href#the-option-element>option/a>/code> element that is a descendant of the code idthe-datalist-element:the-datalist-element-9>a href#the-datalist-element>datalist/a>/code> element, that is not a href#concept-option-disabled idthe-datalist-element:concept-option-disabled>disabled/a>, and whose a href#concept-option-value idthe-datalist-element:concept-option-value>value/a> is a string that isnt the empty string, represents a suggestion. Each suggestion has a a href#concept-option-value idthe-datalist-element:concept-option-value-2>value/a> and a a href#concept-option-label idthe-datalist-element:concept-option-label>label/a>. dl classdomintro>dt>var>datalist/var> . code idthe-datalist-element:dom-datalist-options-2>a href#dom-datalist-options>options/a>/code>dd> p>Returns an code idthe-datalist-element:htmlcollection-2>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> of the code idthe-datalist-element:the-option-element-6>a href#the-option-element>option/a>/code> elements of the code idthe-datalist-element:the-datalist-element-10>a href#the-datalist-element>datalist/a>/code> element./p> /dl> p>The dfn iddom-datalist-options>code>options/code>/dfn> IDL attribute must return an code idthe-datalist-element:htmlcollection-3>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> rooted at the code idthe-datalist-element:the-datalist-element-11>a href#the-datalist-element>datalist/a>/code> node, whose filter matches code idthe-datalist-element:the-option-element-7>a href#the-option-element>option/a>/code> elements./p> p>strong>Constraint validation/strong>: If an element has a code idthe-datalist-element:the-datalist-element-12>a href#the-datalist-element>datalist/a>/code> element ancestor, it is a href#barred-from-constraint-validation idthe-datalist-element:barred-from-constraint-validation>barred from constraint validation/a>./p> h4 idthe-optgroup-element>span classsecno>4.10.9/span> The dfn>code>optgroup/code>/dfn> elementa href#the-optgroup-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-optgroup-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-optgroup-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As a child of a code idthe-optgroup-element:the-select-element>a href#the-select-element>select/a>/code> element.dt>a href#concept-element-content-model idthe-optgroup-element:concept-element-content-model>Content model/a>:dd>Zero or more code idthe-optgroup-element:the-option-element>a href#the-option-element>option/a>/code> and a href#script-supporting-elements-2 idthe-optgroup-element:script-supporting-elements-2>script-supporting/a> elements.dt>a href#concept-element-tag-omission idthe-optgroup-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>An code idthe-optgroup-element:the-optgroup-element>a href#the-optgroup-element>optgroup/a>/code> elements a href#syntax-end-tag idthe-optgroup-element:syntax-end-tag>end tag/a> can be omitted if the code idthe-optgroup-element:the-optgroup-element-2>a href#the-optgroup-element>optgroup/a>/code> element is immediately followed by another code idthe-optgroup-element:the-optgroup-element-3>a href#the-optgroup-element>optgroup/a>/code> element, or if there is no more content in the parent element.dt>a href#concept-element-attributes idthe-optgroup-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-optgroup-element:global-attributes>Global attributes/a>dd>code idthe-optgroup-element:attr-optgroup-disabled>a href#attr-optgroup-disabled>disabled/a>/code> — Whether the form control is disableddd>code idthe-optgroup-element:attr-optgroup-label>a href#attr-optgroup-label>label/a>/code> — User-visible labeldt>a href#concept-element-dom idthe-optgroup-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-optgroup-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmloptgroupelement>HTMLOptGroupElement/dfn> : a href#htmlelement idthe-optgroup-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-optgroup-element:cereactions>CEReactions/a> attribute boolean a href#dom-optgroup-disabled idthe-optgroup-element:dom-optgroup-disabled>disabled/a>; a href#cereactions idthe-optgroup-element:cereactions-2>CEReactions/a> attribute DOMString a href#dom-optgroup-label idthe-optgroup-element:dom-optgroup-label>label/a>;};/pre> /dl> p>The code idthe-optgroup-element:the-optgroup-element-4>a href#the-optgroup-element>optgroup/a>/code> element a href#represents idthe-optgroup-element:represents>represents/a> a group of code idthe-optgroup-element:the-option-element-2>a href#the-option-element>option/a>/code> elements with a common label./p> p>The elements group of code idthe-optgroup-element:the-option-element-3>a href#the-option-element>option/a>/code> elements consists of the code idthe-optgroup-element:the-option-element-4>a href#the-option-element>option/a>/code> elements that are children of the code idthe-optgroup-element:the-optgroup-element-5>a href#the-optgroup-element>optgroup/a>/code> element./p> p>When showing code idthe-optgroup-element:the-option-element-5>a href#the-option-element>option/a>/code> elements in code idthe-optgroup-element:the-select-element-2>a href#the-select-element>select/a>/code> elements, user agents should show the code idthe-optgroup-element:the-option-element-6>a href#the-option-element>option/a>/code> elements of such groups as being related to each other and separate from other code idthe-optgroup-element:the-option-element-7>a href#the-option-element>option/a>/code> elements./p> p>The dfn idattr-optgroup-disabled>code>disabled/code>/dfn> attribute is a a href#boolean-attribute idthe-optgroup-element:boolean-attribute>boolean attribute/a> and can be used to a href#concept-option-disabled idthe-optgroup-element:concept-option-disabled>disable/a> a group of code idthe-optgroup-element:the-option-element-8>a href#the-option-element>option/a>/code> elements together./p> p>The dfn idattr-optgroup-label>code>label/code>/dfn> attribute must be specified. Its value gives the name of the group, for the purposes of the user interface. User agents should use this attributes value when labeling the group of code idthe-optgroup-element:the-option-element-9>a href#the-option-element>option/a>/code> elements in a code idthe-optgroup-element:the-select-element-3>a href#the-select-element>select/a>/code> element./p> p>The dfn iddom-optgroup-disabled>code>disabled/code>/dfn> and dfn iddom-optgroup-label>code>label/code>/dfn> attributes must a href#reflect idthe-optgroup-element:reflect>reflect/a> the respective content attributes of the same name./p> p classnote>There is no way to select an code idthe-optgroup-element:the-optgroup-element-6>a href#the-optgroup-element>optgroup/a>/code> element. Only code idthe-optgroup-element:the-option-element-10>a href#the-option-element>option/a>/code> elements can be selected. An code idthe-optgroup-element:the-optgroup-element-7>a href#the-optgroup-element>optgroup/a>/code> element merely provides a label for a group of code idthe-optgroup-element:the-option-element-11>a href#the-option-element>option/a>/code> elements./p> div classexample> p>The following snippet shows how a set of lessons from three courses could be offered in a code idthe-optgroup-element:the-select-element-4>a href#the-select-element>select/a>/code> drop-down widget:/p> pre><form actioncourseselector.dll methodget> <p>Which course would you like to watch today? <p><label>Course: <select namec> <optgroup label8.01 Physics I: Classical Mechanics> <option value8.01.1>Lecture 01: Powers of Ten <option value8.01.2>Lecture 02: 1D Kinematics <option value8.01.3>Lecture 03: Vectors <optgroup label8.02 Electricity and Magnestism> <option value8.02.1>Lecture 01: What holds our world together? <option value8.02.2>Lecture 02: Electric Field <option value8.02.3>Lecture 03: Electric Flux <optgroup label8.03 Physics III: Vibrations and Waves> <option value8.03.1>Lecture 01: Periodic Phenomenon <option value8.03.2>Lecture 02: Beats <option value8.03.3>Lecture 03: Forced Oscillations with Damping </select> </label> <p><input typesubmit value▶ Play></form>/pre> /div> h4 idthe-option-element>span classsecno>4.10.10/span> The dfn>code>option/code>/dfn> elementa href#the-option-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-option-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-option-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As a child of a code idthe-option-element:the-select-element>a href#the-select-element>select/a>/code> element.dd>As a child of a code idthe-option-element:the-datalist-element>a href#the-datalist-element>datalist/a>/code> element.dd>As a child of an code idthe-option-element:the-optgroup-element>a href#the-optgroup-element>optgroup/a>/code> element.dt>a href#concept-element-content-model idthe-option-element:concept-element-content-model>Content model/a>:dd>If the element has a code idthe-option-element:attr-option-label>a href#attr-option-label>label/a>/code> attribute and a code idthe-option-element:attr-option-value>a href#attr-option-value>value/a>/code> attribute: a href#concept-content-nothing idthe-option-element:concept-content-nothing>Nothing/a>.dd>If the element has a code idthe-option-element:attr-option-label-2>a href#attr-option-label>label/a>/code> attribute but no code idthe-option-element:attr-option-value-2>a href#attr-option-value>value/a>/code> attribute: a href#text-content idthe-option-element:text-content>Text/a>.dd>If the element has no code idthe-option-element:attr-option-label-3>a href#attr-option-label>label/a>/code> attribute and is not a child of a code idthe-option-element:the-datalist-element-2>a href#the-datalist-element>datalist/a>/code> element: a href#text-content idthe-option-element:text-content-2>Text/a> that is not a href#inter-element-whitespace idthe-option-element:inter-element-whitespace>inter-element whitespace/a>.dd>If the element has no code idthe-option-element:attr-option-label-4>a href#attr-option-label>label/a>/code> attribute and is a child of a code idthe-option-element:the-datalist-element-3>a href#the-datalist-element>datalist/a>/code> element: a href#text-content idthe-option-element:text-content-3>Text/a>.dt>a href#concept-element-tag-omission idthe-option-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>An code idthe-option-element:the-option-element>a href#the-option-element>option/a>/code> elements a href#syntax-end-tag idthe-option-element:syntax-end-tag>end tag/a> can be omitted if the code idthe-option-element:the-option-element-2>a href#the-option-element>option/a>/code> element is immediately followed by another code idthe-option-element:the-option-element-3>a href#the-option-element>option/a>/code> element, or if it is immediately followed by an code idthe-option-element:the-optgroup-element-2>a href#the-optgroup-element>optgroup/a>/code> element, or if there is no more content in the parent element.dt>a href#concept-element-attributes idthe-option-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-option-element:global-attributes>Global attributes/a>dd>code idthe-option-element:attr-option-disabled>a href#attr-option-disabled>disabled/a>/code> — Whether the form control is disableddd>code idthe-option-element:attr-option-label-5>a href#attr-option-label>label/a>/code> — User-visible labeldd>code idthe-option-element:attr-option-selected>a href#attr-option-selected>selected/a>/code> — Whether the option is selected by defaultdd>code idthe-option-element:attr-option-value-3>a href#attr-option-value>value/a>/code> — Value to be used for a href#form-submission-2 idthe-option-element:form-submission-2>form submission/a>dt>a href#concept-element-dom idthe-option-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-option-element:htmlconstructor>HTMLConstructor/a>, NamedConstructora href#dom-option idthe-option-element:dom-option>Option/a>(optional DOMString text , optional DOMString value, optional boolean defaultSelected false, optional boolean selected false)interface dfn idhtmloptionelement>HTMLOptionElement/dfn> : a href#htmlelement idthe-option-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-option-element:cereactions>CEReactions/a> attribute boolean a href#dom-option-disabled idthe-option-element:dom-option-disabled>disabled/a>; readonly attribute a href#htmlformelement idthe-option-element:htmlformelement>HTMLFormElement/a>? a href#dom-option-form idthe-option-element:dom-option-form>form/a>; a href#cereactions idthe-option-element:cereactions-2>CEReactions/a> attribute DOMString a href#dom-option-label idthe-option-element:dom-option-label>label/a>; a href#cereactions idthe-option-element:cereactions-3>CEReactions/a> attribute boolean a href#dom-option-defaultselected idthe-option-element:dom-option-defaultselected>defaultSelected/a>; attribute boolean a href#dom-option-selected idthe-option-element:dom-option-selected>selected/a>; a href#cereactions idthe-option-element:cereactions-4>CEReactions/a> attribute DOMString a href#dom-option-value idthe-option-element:dom-option-value>value/a>; a href#cereactions idthe-option-element:cereactions-5>CEReactions/a> attribute DOMString a href#dom-option-text idthe-option-element:dom-option-text>text/a>; readonly attribute long a href#dom-option-index idthe-option-element:dom-option-index>index/a>;};/pre> /dl> p>The code idthe-option-element:the-option-element-4>a href#the-option-element>option/a>/code> element a href#represents idthe-option-element:represents>represents/a> an option in a code idthe-option-element:the-select-element-2>a href#the-select-element>select/a>/code> element or as part of a list of suggestions in a code idthe-option-element:the-datalist-element-4>a href#the-datalist-element>datalist/a>/code> element./p> p>In certain circumstances described in the definition of the code idthe-option-element:the-select-element-3>a href#the-select-element>select/a>/code> element, an code idthe-option-element:the-option-element-5>a href#the-option-element>option/a>/code> element can be a code idthe-option-element:the-select-element-4>a href#the-select-element>select/a>/code> elements a href#placeholder-label-option idthe-option-element:placeholder-label-option>placeholder label option/a>. A a href#placeholder-label-option idthe-option-element:placeholder-label-option-2>placeholder label option/a> does not represent an actual option, but instead represents a label for the code idthe-option-element:the-select-element-5>a href#the-select-element>select/a>/code> control./p> p>The dfn idattr-option-disabled>code>disabled/code>/dfn> attribute is a a href#boolean-attribute idthe-option-element:boolean-attribute>boolean attribute/a>. An code idthe-option-element:the-option-element-6>a href#the-option-element>option/a>/code> element is dfn idconcept-option-disabled>disabled/dfn> if its code idthe-option-element:attr-option-disabled-2>a href#attr-option-disabled>disabled/a>/code> attribute is present or if it is a child of an code idthe-option-element:the-optgroup-element-3>a href#the-optgroup-element>optgroup/a>/code> element whose code idthe-option-element:attr-optgroup-disabled>a href#attr-optgroup-disabled>disabled/a>/code> attribute is present./p> p>An code idthe-option-element:the-option-element-7>a href#the-option-element>option/a>/code> element that is a href#attr-option-disabled idthe-option-element:attr-option-disabled-3>disabled/a> must prevent any code idthe-option-element:event-click>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> events that are a href#queue-a-task idthe-option-element:queue-a-task>queued/a> on the a href#user-interaction-task-source idthe-option-element:user-interaction-task-source>user interaction task source/a> from being dispatched on the element./p> p>The dfn idattr-option-label>code>label/code>/dfn> attribute provides a label for element. The dfn idconcept-option-label>label/dfn> of an code idthe-option-element:the-option-element-8>a href#the-option-element>option/a>/code> element is the value of the code idthe-option-element:attr-option-label-6>a href#attr-option-label>label/a>/code> content attribute, if there is one and its value is not the empty string, or, otherwise, the value of the elements code idthe-option-element:dom-option-text-2>a href#dom-option-text>text/a>/code> IDL attribute./p> p>The code idthe-option-element:attr-option-label-7>a href#attr-option-label>label/a>/code> content attribute, if specified, must not be empty./p> p>The dfn idattr-option-value>code>value/code>/dfn> attribute provides a value for element. The dfn idconcept-option-value>value/dfn> of an code idthe-option-element:the-option-element-9>a href#the-option-element>option/a>/code> element is the value of the code idthe-option-element:attr-option-value-4>a href#attr-option-value>value/a>/code> content attribute, if there is one, or, if there is not, the value of the elements code idthe-option-element:dom-option-text-3>a href#dom-option-text>text/a>/code> IDL attribute./p> p>The dfn idattr-option-selected>code>selected/code>/dfn> attribute is a a href#boolean-attribute idthe-option-element:boolean-attribute-2>boolean attribute/a>. It represents the default a href#concept-option-selectedness idthe-option-element:concept-option-selectedness>selectedness/a> of the element./p> p>The dfn idconcept-option-dirtiness>dirtiness/dfn> of an code idthe-option-element:the-option-element-10>a href#the-option-element>option/a>/code> element is a boolean state, initially false. It controls whether adding or removing the code idthe-option-element:attr-option-selected-2>a href#attr-option-selected>selected/a>/code> content attribute has any effect./p> p>The dfn idconcept-option-selectedness>selectedness/dfn> of an code idthe-option-element:the-option-element-11>a href#the-option-element>option/a>/code> element is a boolean state, initially false. Except where otherwise specified, when the element is created, its a href#concept-option-selectedness idthe-option-element:concept-option-selectedness-2>selectedness/a> must be set to true if the element has a code idthe-option-element:attr-option-selected-3>a href#attr-option-selected>selected/a>/code> attribute. Whenever an code idthe-option-element:the-option-element-12>a href#the-option-element>option/a>/code> elements code idthe-option-element:attr-option-selected-4>a href#attr-option-selected>selected/a>/code> attribute is added, if its a href#concept-option-dirtiness idthe-option-element:concept-option-dirtiness>dirtiness/a> is false, its a href#concept-option-selectedness idthe-option-element:concept-option-selectedness-3>selectedness/a> must be set to true. Whenever an code idthe-option-element:the-option-element-13>a href#the-option-element>option/a>/code> elements code idthe-option-element:attr-option-selected-5>a href#attr-option-selected>selected/a>/code> attribute is em>removed/em>, if its a href#concept-option-dirtiness idthe-option-element:concept-option-dirtiness-2>dirtiness/a> is false, its a href#concept-option-selectedness idthe-option-element:concept-option-selectedness-4>selectedness/a> must be set to false./p> p classnote>The code idthe-option-element:dom-option-2>a href#dom-option>Option()/a>/code> constructor, when called with three or fewer arguments, overrides the initial state of the a href#concept-option-selectedness idthe-option-element:concept-option-selectedness-5>selectedness/a> state to always be false even if the third argument is true (implying that a code idthe-option-element:attr-option-selected-6>a href#attr-option-selected>selected/a>/code> attribute is to be set). The fourth argument can be used to explicitly set the initial a href#concept-option-selectedness idthe-option-element:concept-option-selectedness-6>selectedness/a> state when using the constructor./p> p>A code idthe-option-element:the-select-element-6>a href#the-select-element>select/a>/code> element whose code idthe-option-element:attr-select-multiple>a href#attr-select-multiple>multiple/a>/code> attribute is not specified must not have more than one descendant code idthe-option-element:the-option-element-14>a href#the-option-element>option/a>/code> element with its code idthe-option-element:attr-option-selected-7>a href#attr-option-selected>selected/a>/code> attribute set./p> p>An code idthe-option-element:the-option-element-15>a href#the-option-element>option/a>/code> elements dfn idconcept-option-index>index/dfn> is the number of code idthe-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 idthe-option-element:concept-select-option-list>list of options/a> but that come before it in a idthe-option-element:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>. If the code idthe-option-element:the-option-element-17>a href#the-option-element>option/a>/code> element is not in a a href#concept-select-option-list idthe-option-element:concept-select-option-list-2>list of options/a>, then the code idthe-option-element:the-option-element-18>a href#the-option-element>option/a>/code> elements a href#concept-option-index idthe-option-element:concept-option-index>index/a> is zero./p> dl classdomintro>dt>var>option/var> . code idthe-option-element:dom-option-selected-2>a href#dom-option-selected>selected/a>/code>dd> p>Returns true if the element is selected, and false otherwise./p> p>Can be set, to override the current state of the element./p> dt>var>option/var> . code idthe-option-element:dom-option-index-2>a href#dom-option-index>index/a>/code>dd> p>Returns the index of the element in its code idthe-option-element:the-select-element-7>a href#the-select-element>select/a>/code> elements code idthe-option-element:dom-select-options>a href#dom-select-options>options/a>/code> list./p> dt>var>option/var> . code idthe-option-element:dom-option-form-2>a href#dom-option-form>form/a>/code>dd> p>Returns the elements code idthe-option-element:the-form-element>a href#the-form-element>form/a>/code> element, if any, or null otherwise./p> dt>var>option/var> . code idthe-option-element:dom-option-text-4>a href#dom-option-text>text/a>/code>dd> p>Same as code idthe-option-element:textcontent>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code>, except that spaces are collapsed and code idthe-option-element:the-script-element>a href#the-script-element>script/a>/code> elements are skipped./p> dt>var>option/var> new code idthe-option-element:dom-option-3>a href#dom-option>Option/a>/code>( var>text/var> , var>value/var> , var>defaultSelected/var> , var>selected/var> )dd> p>Returns a new code idthe-option-element:the-option-element-19>a href#the-option-element>option/a>/code> element./p> p>The var>text/var> argument sets the contents of the element./p> p>The var>value/var> argument sets the code idthe-option-element:attr-option-value-5>a href#attr-option-value>value/a>/code> attribute./p> p>The var>defaultSelected/var> argument sets the code idthe-option-element:attr-option-selected-8>a href#attr-option-selected>selected/a>/code> attribute./p> p>The var>selected/var> argument sets whether or not the element is selected. If it is omitted, even if the var>defaultSelected/var> argument is true, the element is not selected./p> /dl> p>The dfn iddom-option-disabled>code>disabled/code>/dfn> IDL attribute must a href#reflect idthe-option-element:reflect>reflect/a> the content attribute of the same name. The dfn iddom-option-defaultselected>code>defaultSelected/code>/dfn> IDL attribute must a href#reflect idthe-option-element:reflect-2>reflect/a> the code idthe-option-element:attr-option-selected-9>a href#attr-option-selected>selected/a>/code> content attribute./p> p>The dfn iddom-option-label>code>label/code>/dfn> IDL attribute, on getting, if there is a code idthe-option-element:attr-option-label-8>a href#attr-option-label>label/a>/code> content attribute, must return that attributes value; otherwise, it must return the elements a href#concept-option-label idthe-option-element:concept-option-label>label/a>. On setting, the elements code idthe-option-element:attr-option-label-9>a href#attr-option-label>label/a>/code> content attribute must be set to the new value./p> p>The dfn iddom-option-value>code>value/code>/dfn> IDL attribute, on getting, must return the elements a href#concept-option-value idthe-option-element:concept-option-value>value/a>. On setting, the elements code idthe-option-element:attr-option-value-6>a href#attr-option-value>value/a>/code> content attribute must be set to the new value./p> p>The dfn iddom-option-selected>code>selected/code>/dfn> IDL attribute, on getting, must return true if the elements a href#concept-option-selectedness idthe-option-element:concept-option-selectedness-7>selectedness/a> is true, and false otherwise. On setting, it must set the elements a href#concept-option-selectedness idthe-option-element:concept-option-selectedness-8>selectedness/a> to the new value, set its a href#concept-option-dirtiness idthe-option-element:concept-option-dirtiness-3>dirtiness/a> to true, and then cause the element to a href#ask-for-a-reset idthe-option-element:ask-for-a-reset>ask for a reset/a>./p> p>The dfn iddom-option-index>code>index/code>/dfn> IDL attribute must return the elements a href#concept-option-index idthe-option-element:concept-option-index-2>index/a>./p> p>The dfn iddom-option-text>code>text/code>/dfn> IDL attribute, on getting, must return the result of a hrefhttps://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace idthe-option-element:strip-and-collapse-ascii-whitespace data-x-internalstrip-and-collapse-ascii-whitespace>stripping and collapsing ASCII whitespace/a> from the concatenation of a hrefhttps://dom.spec.whatwg.org/#concept-cd-data idthe-option-element:concept-cd-data data-x-internalconcept-cd-data>data/a> of all the code idthe-option-element:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node descendants of the code idthe-option-element:the-option-element-20>a href#the-option-element>option/a>/code> element, in a idthe-option-element:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>, excluding any that are descendants of descendants of the code idthe-option-element:the-option-element-21>a href#the-option-element>option/a>/code> element that are themselves code idthe-option-element:the-script-element-2>a href#the-script-element>script/a>/code> or a idthe-option-element:svg-script hrefhttps://www.w3.org/TR/SVG11/script.html#ScriptElement data-x-internalsvg-script>SVG code>script/code>/a> elements./p> p>On setting, the code idthe-option-element:dom-option-text-5>a href#dom-option-text>text/a>/code> attribute must act as if the code idthe-option-element:textcontent-2>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> IDL attribute on the element had been set to the new value./p> p>The dfn iddom-option-form>code>form/code>/dfn> IDL attributes behavior depends on whether the code idthe-option-element:the-option-element-22>a href#the-option-element>option/a>/code> element is in a code idthe-option-element:the-select-element-8>a href#the-select-element>select/a>/code> element or not. If the code idthe-option-element:the-option-element-23>a href#the-option-element>option/a>/code> has a code idthe-option-element:the-select-element-9>a href#the-select-element>select/a>/code> element as its parent, or has an code idthe-option-element:the-optgroup-element-4>a href#the-optgroup-element>optgroup/a>/code> element as its parent and that code idthe-option-element:the-optgroup-element-5>a href#the-optgroup-element>optgroup/a>/code> element has a code idthe-option-element:the-select-element-10>a href#the-select-element>select/a>/code> element as its parent, then the code idthe-option-element:dom-option-form-3>a href#dom-option-form>form/a>/code> IDL attribute must return the same value as the code idthe-option-element:dom-fae-form>a href#dom-fae-form>form/a>/code> IDL attribute on that code idthe-option-element:the-select-element-11>a href#the-select-element>select/a>/code> element. Otherwise, it must return null./p> p>A constructor is provided for creating code idthe-option-element:htmloptionelement>a href#htmloptionelement>HTMLOptionElement/a>/code> objects (in addition to the factory methods from DOM such as code idthe-option-element:dom-document-createelement>a data-x-internaldom-document-createelement hrefhttps://dom.spec.whatwg.org/#dom-document-createelement>createElement()/a>/code>): dfn iddom-option>code>Option(var>text/var>, var>value/var>, var>defaultSelected/var>, var>selected/var>)/code>/dfn>. When invoked, the constructor must perform the following steps:/p> ol>li>p>Let var>document/var> be the a href#current-global-object idthe-option-element:current-global-object>current global object/a>s a href#concept-document-window idthe-option-element:concept-document-window>associated code>Document/code>/a>.li>p>Let var>option/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-create-element idthe-option-element:create-an-element data-x-internalcreate-an-element>creating an element/a> given var>document/var>, code idthe-option-element:the-option-element-24>a href#the-option-element>option/a>/code>, and the a idthe-option-element:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>.li>p>If var>text/var> is not the empty string, then append to var>option/var> a new code idthe-option-element:text-2>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node whose data is var>text/var>.li>p>If var>value/var> is given, then a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-set-value idthe-option-element:concept-element-attributes-set-value data-x-internalconcept-element-attributes-set-value>set an attribute value/a> for var>option/var> using code idthe-option-element:attr-option-value-7>a href#attr-option-value>value/a>/code> and var>value/var>.li>p>If var>defaultSelected/var> is true, then a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-set-value idthe-option-element:concept-element-attributes-set-value-2 data-x-internalconcept-element-attributes-set-value>set an attribute value/a> for var>option/var> using code idthe-option-element:attr-option-selected-10>a href#attr-option-selected>selected/a>/code> and the empty string.li>p>If var>selected/var> is true, then set var>option/var>s a href#concept-option-selectedness idthe-option-element:concept-option-selectedness-9>selectedness/a> to true; otherwise set its a href#concept-option-selectedness idthe-option-element:concept-option-selectedness-10>selectedness/a> to false (even if var>defaultSelected/var> is true).li>p>Return var>option/var>./ol> h4 idthe-textarea-element>span classsecno>4.10.11/span> The dfn>code>textarea/code>/dfn> elementa href#the-textarea-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id15291 titleAllow textarea@pattern (input@pattern is specced already so why not)>15291/a>/div> dl classelement>dt>a href#concept-element-categories idthe-textarea-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-textarea-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-textarea-element:phrasing-content-2>Phrasing content/a>.dd>a href#interactive-content-2 idthe-textarea-element:interactive-content-2>Interactive content/a>.dd>a href#category-listed idthe-textarea-element:category-listed>Listed/a>, a href#category-label idthe-textarea-element:category-label>labelable/a>, a href#category-submit idthe-textarea-element:category-submit>submittable/a>, and a href#category-reset idthe-textarea-element:category-reset>resettable/a> a href#form-associated-element idthe-textarea-element:form-associated-element>form-associated element/a>.dd>a href#palpable-content-2 idthe-textarea-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-textarea-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-textarea-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-textarea-element:concept-element-content-model>Content model/a>:dd>a href#text-content idthe-textarea-element:text-content>Text/a>.dt>a href#concept-element-tag-omission idthe-textarea-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-textarea-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-textarea-element:global-attributes>Global attributes/a>dd>code idthe-textarea-element:attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code> — Hint for form autofill featuredd>code idthe-textarea-element:attr-fe-autofocus>a href#attr-fe-autofocus>autofocus/a>/code> — Automatically focus the form control when the page is loadeddd>code idthe-textarea-element:attr-textarea-cols>a href#attr-textarea-cols>cols/a>/code> — Maximum number of characters per linedd>code idthe-textarea-element:attr-fe-dirname>a href#attr-fe-dirname>dirname/a>/code> — Name of form control to use for sending the elements a href#the-directionality idthe-textarea-element:the-directionality>directionality/a> in a href#form-submission-2 idthe-textarea-element:form-submission-2>form submission/a>dd>code idthe-textarea-element:attr-fe-disabled>a href#attr-fe-disabled>disabled/a>/code> — Whether the form control is disableddd>code idthe-textarea-element:attr-fae-form>a href#attr-fae-form>form/a>/code> — Associates the control with a code idthe-textarea-element:the-form-element>a href#the-form-element>form/a>/code> elementdd>code idthe-textarea-element:attr-fe-inputmode>a href#attr-fe-inputmode>inputmode/a>/code> — Hint for selecting an input modalitydd>code idthe-textarea-element:attr-textarea-maxlength>a href#attr-textarea-maxlength>maxlength/a>/code> — Maximum length of valuedd>code idthe-textarea-element:attr-textarea-minlength>a href#attr-textarea-minlength>minlength/a>/code> — Minimum length of valuedd>code idthe-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 idthe-textarea-element:form-submission-2-2>form submission/a> and in the code idthe-textarea-element:dom-form-elements>a href#dom-form-elements>form.elements/a>/code> API dd>code idthe-textarea-element:attr-textarea-placeholder>a href#attr-textarea-placeholder>placeholder/a>/code> — User-visible label to be placed within the form controldd>code idthe-textarea-element:attr-textarea-readonly>a href#attr-textarea-readonly>readonly/a>/code> — Whether to allow the value to be edited by the userdd>code idthe-textarea-element:attr-textarea-required>a href#attr-textarea-required>required/a>/code> — Whether the control is required for a href#form-submission-2 idthe-textarea-element:form-submission-2-3>form submission/a>dd>code idthe-textarea-element:attr-textarea-rows>a href#attr-textarea-rows>rows/a>/code> — Number of lines to showdd>code idthe-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 idthe-textarea-element:form-submission-2-4>form submission/a>dt>a href#concept-element-dom idthe-textarea-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-textarea-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmltextareaelement>HTMLTextAreaElement/dfn> : a href#htmlelement idthe-textarea-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-textarea-element:cereactions>CEReactions/a> attribute DOMString a href#dom-fe-autocomplete idthe-textarea-element:dom-fe-autocomplete>autocomplete/a>; a href#cereactions idthe-textarea-element:cereactions-2>CEReactions/a> attribute boolean a href#dom-fe-autofocus idthe-textarea-element:dom-fe-autofocus>autofocus/a>; a href#cereactions idthe-textarea-element:cereactions-3>CEReactions/a> attribute unsigned long a href#dom-textarea-cols idthe-textarea-element:dom-textarea-cols>cols/a>; a href#cereactions idthe-textarea-element:cereactions-4>CEReactions/a> attribute DOMString a href#dom-textarea-dirname idthe-textarea-element:dom-textarea-dirname>dirName/a>; a href#cereactions idthe-textarea-element:cereactions-5>CEReactions/a> attribute boolean a href#dom-fe-disabled idthe-textarea-element:dom-fe-disabled>disabled/a>; readonly attribute a href#htmlformelement idthe-textarea-element:htmlformelement>HTMLFormElement/a>? a href#dom-fae-form idthe-textarea-element:dom-fae-form>form/a>; a href#cereactions idthe-textarea-element:cereactions-6>CEReactions/a> attribute DOMString a href#dom-textarea-inputmode idthe-textarea-element:dom-textarea-inputmode>inputMode/a>; a href#cereactions idthe-textarea-element:cereactions-7>CEReactions/a> attribute long a href#dom-textarea-maxlength idthe-textarea-element:dom-textarea-maxlength>maxLength/a>; a href#cereactions idthe-textarea-element:cereactions-8>CEReactions/a> attribute long a href#dom-textarea-minlength idthe-textarea-element:dom-textarea-minlength>minLength/a>; a href#cereactions idthe-textarea-element:cereactions-9>CEReactions/a> attribute DOMString a href#dom-fe-name idthe-textarea-element:dom-fe-name>name/a>; a href#cereactions idthe-textarea-element:cereactions-10>CEReactions/a> attribute DOMString a href#dom-textarea-placeholder idthe-textarea-element:dom-textarea-placeholder>placeholder/a>; a href#cereactions idthe-textarea-element:cereactions-11>CEReactions/a> attribute boolean a href#dom-textarea-readonly idthe-textarea-element:dom-textarea-readonly>readOnly/a>; a href#cereactions idthe-textarea-element:cereactions-12>CEReactions/a> attribute boolean a href#dom-textarea-required idthe-textarea-element:dom-textarea-required>required/a>; a href#cereactions idthe-textarea-element:cereactions-13>CEReactions/a> attribute unsigned long a href#dom-textarea-rows idthe-textarea-element:dom-textarea-rows>rows/a>; a href#cereactions idthe-textarea-element:cereactions-14>CEReactions/a> attribute DOMString a href#dom-textarea-wrap idthe-textarea-element:dom-textarea-wrap>wrap/a>; readonly attribute DOMString a href#dom-textarea-type idthe-textarea-element:dom-textarea-type>type/a>; a href#cereactions idthe-textarea-element:cereactions-15>CEReactions/a> attribute DOMString a href#dom-textarea-defaultvalue idthe-textarea-element:dom-textarea-defaultvalue>defaultValue/a>; a href#cereactions idthe-textarea-element:cereactions-16>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-textarea-value idthe-textarea-element:dom-textarea-value>value/a>; readonly attribute unsigned long a href#dom-textarea-textlength idthe-textarea-element:dom-textarea-textlength>textLength/a>; readonly attribute boolean a href#dom-cva-willvalidate idthe-textarea-element:dom-cva-willvalidate>willValidate/a>; readonly attribute a href#validitystate idthe-textarea-element:validitystate>ValidityState/a> a href#dom-cva-validity idthe-textarea-element:dom-cva-validity>validity/a>; readonly attribute DOMString a href#dom-cva-validationmessage idthe-textarea-element:dom-cva-validationmessage>validationMessage/a>; boolean a href#dom-cva-checkvalidity idthe-textarea-element:dom-cva-checkvalidity>checkValidity/a>(); boolean a href#dom-cva-reportvalidity idthe-textarea-element:dom-cva-reportvalidity>reportValidity/a>(); void a href#dom-cva-setcustomvalidity idthe-textarea-element:dom-cva-setcustomvalidity>setCustomValidity/a>(DOMString error); readonly attribute a idthe-textarea-element:nodelist hrefhttps://dom.spec.whatwg.org/#interface-nodelist data-x-internalnodelist>NodeList/a> a href#dom-lfe-labels idthe-textarea-element:dom-lfe-labels>labels/a>; void a href#dom-textarea/input-select idthe-textarea-element:dom-textarea/input-select>select/a>(); attribute unsigned long a href#dom-textarea/input-selectionstart idthe-textarea-element:dom-textarea/input-selectionstart>selectionStart/a>; attribute unsigned long a href#dom-textarea/input-selectionend idthe-textarea-element:dom-textarea/input-selectionend>selectionEnd/a>; attribute DOMString a href#dom-textarea/input-selectiondirection idthe-textarea-element:dom-textarea/input-selectiondirection>selectionDirection/a>; void a href#dom-textarea/input-setrangetext idthe-textarea-element:dom-textarea/input-setrangetext>setRangeText/a>(DOMString replacement); void a href#dom-textarea/input-setrangetext idthe-textarea-element:dom-textarea/input-setrangetext-2>setRangeText/a>(DOMString replacement, unsigned long start, unsigned long end, optional a href#selectionmode idthe-textarea-element:selectionmode>SelectionMode/a> selectionMode preserve); void a href#dom-textarea/input-setselectionrange idthe-textarea-element:dom-textarea/input-setselectionrange>setSelectionRange/a>(unsigned long start, unsigned long end, optional DOMString direction);};/pre> /dl> p>The code idthe-textarea-element:the-textarea-element>a href#the-textarea-element>textarea/a>/code> element a href#represents idthe-textarea-element:represents>represents/a> a multiline plain text edit control for the elements dfn idconcept-textarea-raw-value>raw value/dfn>. The contents of the control represent the controls default value./p> p>The a href#concept-textarea-raw-value idthe-textarea-element:concept-textarea-raw-value>raw value/a> of a code idthe-textarea-element:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code> control must be initially the empty string./p> p classnote>This element a href#bidireq>has rendering requirements involving the bidirectional algorithm/a>./p> p>The dfn idattr-textarea-readonly>code>readonly/code>/dfn> attribute is a a href#boolean-attribute idthe-textarea-element:boolean-attribute>boolean attribute/a> used to control whether the text can be edited by the user or not./p> div classexample> p>In this example, a text control is marked read-only because it represents a read-only file:/p> pre>Filename: <code>/etc/bash.bashrc</code><textarea namebuffer readonly># System-wide .bashrc file for interactive bash(1) shells.# To enable the settings / commands in this file for login shells as well,# this file has to be sourced in /etc/profile.# If not running interactively, dont do anything -z $PS1 && return...</textarea>/pre> /div> p>strong>Constraint validation/strong>: If the code idthe-textarea-element:attr-textarea-readonly-2>a href#attr-textarea-readonly>readonly/a>/code> attribute is specified on a code idthe-textarea-element:the-textarea-element-3>a href#the-textarea-element>textarea/a>/code> element, the element is a href#barred-from-constraint-validation idthe-textarea-element:barred-from-constraint-validation>barred from constraint validation/a>./p> p>A code idthe-textarea-element:the-textarea-element-4>a href#the-textarea-element>textarea/a>/code> element is a href#concept-fe-mutable idthe-textarea-element:concept-fe-mutable>mutable/a> if it is neither a href#concept-fe-disabled idthe-textarea-element:concept-fe-disabled>disabled/a> nor has a code idthe-textarea-element:attr-textarea-readonly-3>a href#attr-textarea-readonly>readonly/a>/code> attribute specified./p> p>When a code idthe-textarea-element:the-textarea-element-5>a href#the-textarea-element>textarea/a>/code> is a href#concept-fe-mutable idthe-textarea-element:concept-fe-mutable-2>mutable/a>, its a href#concept-textarea-raw-value idthe-textarea-element:concept-textarea-raw-value-2>raw value/a> should be editable by the user: the user agent should allow the user to edit, insert, and remove text, and to insert and remove line breaks in the form of U+000A LINE FEED (LF) characters. Any time the user causes the elements a href#concept-textarea-raw-value idthe-textarea-element:concept-textarea-raw-value-3>raw value/a> to change, the user agent must a href#queue-a-task idthe-textarea-element:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-textarea-element:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idthe-textarea-element:event-input>a href#event-input>input/a>/code> at the code idthe-textarea-element:the-textarea-element-6>a href#the-textarea-element>textarea/a>/code> element, with the code idthe-textarea-element:dom-event-bubbles>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true. User agents may wait for a suitable break in the users interaction before queuing the task; for example, a user agent could wait for the user to have not hit a key for 100ms, so as to only fire the event when the user pauses, instead of continuously for each keystroke./p> p>A code idthe-textarea-element:the-textarea-element-7>a href#the-textarea-element>textarea/a>/code> elements a href#concept-fe-dirty idthe-textarea-element:concept-fe-dirty>dirty value flag/a> must be set to true whenever the user interacts with the control in a way that changes the a href#concept-textarea-raw-value idthe-textarea-element:concept-textarea-raw-value-4>raw value/a>./p> p>The a hrefhttps://dom.spec.whatwg.org/#concept-node-clone-ext idthe-textarea-element:concept-node-clone-ext data-x-internalconcept-node-clone-ext>cloning steps/a> for code idthe-textarea-element:the-textarea-element-8>a href#the-textarea-element>textarea/a>/code> elements must propagate the a href#concept-textarea-raw-value idthe-textarea-element:concept-textarea-raw-value-5>raw value/a> and a href#concept-fe-dirty idthe-textarea-element:concept-fe-dirty-2>dirty value flag/a> from the node being cloned to the copy./p> p>The a idthe-textarea-element:child-text-content-change-steps hrefhttps://dom.spec.whatwg.org/#concept-node-adopt-ext data-x-internalchild-text-content-change-steps>child text content change steps/a> for code idthe-textarea-element:the-textarea-element-9>a href#the-textarea-element>textarea/a>/code> elements must, if the elements a href#concept-fe-dirty idthe-textarea-element:concept-fe-dirty-3>dirty value flag/a> is false, set the elements a href#concept-textarea-raw-value idthe-textarea-element:concept-textarea-raw-value-6>raw value/a> to its a idthe-textarea-element:child-text-content hrefhttps://dom.spec.whatwg.org/#concept-child-text-content data-x-internalchild-text-content>child text content/a>./p> p>The a href#concept-form-reset-control idthe-textarea-element:concept-form-reset-control>reset algorithm/a> for code idthe-textarea-element:the-textarea-element-10>a href#the-textarea-element>textarea/a>/code> elements is to set the a href#concept-fe-dirty idthe-textarea-element:concept-fe-dirty-4>dirty value flag/a> back to false, and set the a href#concept-textarea-raw-value idthe-textarea-element:concept-textarea-raw-value-7>raw value/a> of element to its a idthe-textarea-element:child-text-content-2 hrefhttps://dom.spec.whatwg.org/#concept-child-text-content data-x-internalchild-text-content>child text content/a>./p> p>When a code idthe-textarea-element:the-textarea-element-11>a href#the-textarea-element>textarea/a>/code> element is popped off the a href#stack-of-open-elements idthe-textarea-element:stack-of-open-elements>stack of open elements/a> of an a href#html-parser idthe-textarea-element:html-parser>HTML parser/a> or a href#xml-parser idthe-textarea-element:xml-parser>XML parser/a>, then the user agent must invoke the elements a href#concept-form-reset-control idthe-textarea-element:concept-form-reset-control-2>reset algorithm/a>./p> p>If the element is a href#concept-fe-mutable idthe-textarea-element:concept-fe-mutable-3>mutable/a>, the user agent should allow the user to change the writing direction of the element, setting it either to a left-to-right writing direction or a right-to-left writing direction. If the user does so, the user agent must then run the following steps:/p> ol>li>p>Set the elements code idthe-textarea-element:the-dir-attribute>a href#the-dir-attribute>dir/a>/code> attribute to code idthe-textarea-element:attr-dir-ltr>a href#attr-dir-ltr>ltr/a>/code> if the user selected a left-to-right writing direction, and code idthe-textarea-element:attr-dir-rtl>a href#attr-dir-rtl>rtl/a>/code> if the user selected a right-to-left writing direction.li>p>a href#queue-a-task idthe-textarea-element:queue-a-task-2>Queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-textarea-element:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idthe-textarea-element:event-input-2>a href#event-input>input/a>/code> at the code idthe-textarea-element:the-textarea-element-12>a href#the-textarea-element>textarea/a>/code> element, with the code idthe-textarea-element:dom-event-bubbles-2>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true./ol> p>The dfn idattr-textarea-cols>code>cols/code>/dfn> attribute specifies the expected maximum number of characters per line. If the code idthe-textarea-element:attr-textarea-cols-2>a href#attr-textarea-cols>cols/a>/code> attribute is specified, its value must be a a href#valid-non-negative-integer idthe-textarea-element:valid-non-negative-integer>valid non-negative integer/a> greater than zero. If applying the a href#rules-for-parsing-non-negative-integers idthe-textarea-element:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers/a> to the attributes value results in a number greater than zero, then the elements dfn idattr-textarea-cols-value>character width/dfn> is that value; otherwise, it is 20./p> p>The user agent may use the code idthe-textarea-element:the-textarea-element-13>a href#the-textarea-element>textarea/a>/code> elements a href#attr-textarea-cols-value idthe-textarea-element:attr-textarea-cols-value>character width/a> as a hint to the user as to how many characters the server prefers per line (e.g. for visual user agents by making the width of the control be that many characters). In visual renderings, the user agent should wrap the users input in the rendering so that each line is no wider than this number of characters./p> p>The dfn idattr-textarea-rows>code>rows/code>/dfn> attribute specifies the number of lines to show. If the code idthe-textarea-element:attr-textarea-rows-2>a href#attr-textarea-rows>rows/a>/code> attribute is specified, its value must be a a href#valid-non-negative-integer idthe-textarea-element:valid-non-negative-integer-2>valid non-negative integer/a> greater than zero. If applying the a href#rules-for-parsing-non-negative-integers idthe-textarea-element:rules-for-parsing-non-negative-integers-2>rules for parsing non-negative integers/a> to the attributes value results in a number greater than zero, then the elements dfn idattr-textarea-rows-value>character height/dfn> is that value; otherwise, it is 2./p> p>Visual user agents should set the height of the control to the number of lines given by a href#attr-textarea-rows-value idthe-textarea-element:attr-textarea-rows-value>character height/a>./p> p>The dfn idattr-textarea-wrap>code>wrap/code>/dfn> attribute is an a href#enumerated-attribute idthe-textarea-element:enumerated-attribute>enumerated attribute/a> with two keywords and states: the dfn idattr-textarea-wrap-soft>code>soft/code>/dfn> keyword which maps to the a href#attr-textarea-wrap-soft-state idthe-textarea-element:attr-textarea-wrap-soft-state>Soft/a> state, and the dfn idattr-textarea-wrap-hard>code>hard/code>/dfn> keyword which maps to the a href#attr-textarea-wrap-hard-state idthe-textarea-element:attr-textarea-wrap-hard-state>Hard/a> state. The i idthe-textarea-element:missing-value-default>a href#missing-value-default>missing value default/a>/i> is the a href#attr-textarea-wrap-soft-state idthe-textarea-element:attr-textarea-wrap-soft-state-2>Soft/a> state./p> p>The dfn idattr-textarea-wrap-soft-state>Soft/dfn> state indicates that the text in the code idthe-textarea-element:the-textarea-element-14>a href#the-textarea-element>textarea/a>/code> is not to be wrapped when it is submitted (though it can still be wrapped in the rendering)./p> p>The dfn idattr-textarea-wrap-hard-state>Hard/dfn> state indicates that the text in the code idthe-textarea-element:the-textarea-element-15>a href#the-textarea-element>textarea/a>/code> is to have newlines added by the user agent so that the text is wrapped when it is submitted./p> p>If the elements code idthe-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 idthe-textarea-element:attr-textarea-wrap-hard-state-2>Hard/a> state, the code idthe-textarea-element:attr-textarea-cols-3>a href#attr-textarea-cols>cols/a>/code> attribute must be specified./p> p>For historical reasons, the elements value is normalized in three different ways for three different purposes. The a href#concept-textarea-raw-value idthe-textarea-element:concept-textarea-raw-value-8>raw value/a> is the value as it was originally set. It is not normalized. The a href#concept-fe-api-value idthe-textarea-element:concept-fe-api-value>API value/a> is the value used in the code idthe-textarea-element:dom-textarea-value-2>a href#dom-textarea-value>value/a>/code> IDL attribute, code idthe-textarea-element:dom-textarea-textlength-2>a href#dom-textarea-textlength>textLength/a>/code> IDL attribute, and by the code idthe-textarea-element:attr-fe-maxlength>a href#attr-fe-maxlength>maxlength/a>/code> and code idthe-textarea-element:attr-fe-minlength>a href#attr-fe-minlength>minlength/a>/code> content attributes. It is normalized so that line breaks use U+000A LINE FEED (LF) characters. Finally, there is the a href#concept-fe-value idthe-textarea-element:concept-fe-value>value/a>, as used in form submission and other processing models in this specification. It is normalized so that line breaks use U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pairs, and in addition, if necessary given the elements code idthe-textarea-element:attr-textarea-wrap-3>a href#attr-textarea-wrap>wrap/a>/code> attribute, additional line breaks are inserted to wrap the text at the given width./p> p>The algorithm for obtaining the elements a href#concept-fe-api-value idthe-textarea-element:concept-fe-api-value-2>API value/a> is to return the elements a href#concept-textarea-raw-value idthe-textarea-element:concept-textarea-raw-value-9>raw value/a> with the a href#textarea-line-break-normalisation-transformation idthe-textarea-element:textarea-line-break-normalisation-transformation>textarea line break normalization transformation/a> applied. The dfn idtextarea-line-break-normalisation-transformation>textarea line break normalization transformation/dfn> is the following algorithm, as applied to a string:/p> ol>li>p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pair with a single U+000A LINE FEED (LF) character.li>p>Replace every remaining U+000D CARRIAGE RETURN character with a single U+000A LINE FEED (LF) character./ol> p>The elements a href#concept-fe-value idthe-textarea-element:concept-fe-value-2>value/a> is defined to be the elements a href#concept-textarea-raw-value idthe-textarea-element:concept-textarea-raw-value-10>raw value/a> with the a href#textarea-wrapping-transformation idthe-textarea-element:textarea-wrapping-transformation>textarea wrapping transformation/a> applied. The dfn idtextarea-wrapping-transformation>textarea wrapping transformation/dfn> is the following algorithm, as applied to a string:/p> ol>li>p>Replace every occurrence of a U+000D CARRIAGE RETURN (CR) character not followed by a U+000A LINE FEED (LF) character, and every occurrence of a U+000A LINE FEED (LF) character not preceded by a U+000D CARRIAGE RETURN (CR) character, by a two-character string consisting of a U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pair.li>p>If the elements code idthe-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 idthe-textarea-element:attr-textarea-wrap-hard-state-3>Hard/a> state, insert U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pairs into the string using a UA-defined algorithm so that each line has no more than a href#attr-textarea-cols-value idthe-textarea-element:attr-textarea-cols-value-2>character width/a> characters. For the purposes of this requirement, lines are delimited by the start of the string, the end of the string, and U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pairs./ol> p>The dfn idattr-textarea-maxlength>code>maxlength/code>/dfn> attribute is a a href#attr-fe-maxlength idthe-textarea-element:attr-fe-maxlength-2>form control code>maxlength/code> attribute/a>./p> p>If the code idthe-textarea-element:the-textarea-element-16>a href#the-textarea-element>textarea/a>/code> element has a a href#maximum-allowed-value-length idthe-textarea-element:maximum-allowed-value-length>maximum allowed value length/a>, then the elements children must be such that the a idthe-textarea-element:javascript-string-length hrefhttps://infra.spec.whatwg.org/#javascript-string-length data-x-internaljavascript-string-length>JavaScript string length/a> of the value of the elements code idthe-textarea-element:textcontent>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> IDL attribute with the a href#textarea-line-break-normalisation-transformation idthe-textarea-element:textarea-line-break-normalisation-transformation-2>textarea line break normalization transformation/a> applied is equal to or less than the elements a href#maximum-allowed-value-length idthe-textarea-element:maximum-allowed-value-length-2>maximum allowed value length/a>./p> p>The dfn idattr-textarea-minlength>code>minlength/code>/dfn> attribute is a a href#attr-fe-minlength idthe-textarea-element:attr-fe-minlength-2>form control code>minlength/code> attribute/a>./p> p>The dfn idattr-textarea-required>code>required/code>/dfn> attribute is a a href#boolean-attribute idthe-textarea-element:boolean-attribute-2>boolean attribute/a>. When specified, the user will be required to enter a value before submitting the form./p> p>strong>Constraint validation/strong>: If the element has its code idthe-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 idthe-textarea-element:concept-fe-mutable-4>mutable/a>, and the elements a href#concept-fe-value idthe-textarea-element:concept-fe-value-3>value/a> is the empty string, then the element is a href#suffering-from-being-missing idthe-textarea-element:suffering-from-being-missing>suffering from being missing/a>./p> p>The dfn idattr-textarea-placeholder>code>placeholder/code>/dfn> attribute represents a em>short/em> hint (a word or short phrase) intended to aid the user with data entry when the control has no value. A hint could be a sample value or a brief description of the expected format./p> p>The code idthe-textarea-element:attr-textarea-placeholder-2>a href#attr-textarea-placeholder>placeholder/a>/code> attribute should not be used as an alternative to a code idthe-textarea-element:the-label-element>a href#the-label-element>label/a>/code>. For a longer hint or other advisory text, the code idthe-textarea-element:attr-title>a href#attr-title>title/a>/code> attribute is more appropriate./p> p classnote>These mechanisms are very similar but subtly different: the hint given by the controls code idthe-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 idthe-textarea-element:attr-textarea-placeholder-3>a href#attr-textarea-placeholder>placeholder/a>/code> attribute is shown before the user enters a value; and the hint in the code idthe-textarea-element:attr-title-2>a href#attr-title>title/a>/code> attribute is shown when the user requests further help./p> p>User agents should present this hint to the user when the elements a href#concept-fe-value idthe-textarea-element:concept-fe-value-4>value/a> is the empty string and the control is not a href#focused idthe-textarea-element:focused>focused/a> (e.g. by displaying it inside a blank unfocused control). All U+000D CARRIAGE RETURN U+000A LINE FEED character pairs (CRLF) in the hint, as well as all other U+000D CARRIAGE RETURN (CR) and U+000A LINE FEED (LF) characters in the hint, must be treated as line breaks when rendering the hint. /p> p> The code idthe-textarea-element:attr-fe-name-2>a href#attr-fe-name>name/a>/code> attribute represents the elements name. The code idthe-textarea-element:attr-fe-dirname-2>a href#attr-fe-dirname>dirname/a>/code> attribute controls how the elements a href#the-directionality idthe-textarea-element:the-directionality-2>directionality/a> is submitted. The code idthe-textarea-element:attr-fe-disabled-2>a href#attr-fe-disabled>disabled/a>/code> attribute is used to make the control non-interactive and to prevent its value from being submitted. The code idthe-textarea-element:attr-fae-form-2>a href#attr-fae-form>form/a>/code> attribute is used to explicitly associate the code idthe-textarea-element:the-textarea-element-17>a href#the-textarea-element>textarea/a>/code> element with its a href#form-owner idthe-textarea-element:form-owner>form owner/a>. The code idthe-textarea-element:attr-fe-autofocus-2>a href#attr-fe-autofocus>autofocus/a>/code> attribute controls focus. The code idthe-textarea-element:attr-fe-inputmode-2>a href#attr-fe-inputmode>inputmode/a>/code> attribute controls the user interfaces input modality for the control. The code idthe-textarea-element:attr-fe-autocomplete-2>a href#attr-fe-autocomplete>autocomplete/a>/code> attribute controls how the user agent provides autofill behavior. /p> dl classdomintro>dt>var>textarea/var> . code idthe-textarea-element:dom-textarea-type-2>a href#dom-textarea-type>type/a>/code>dd> p>Returns the string code>textarea/code>./p> dt>var>textarea/var> . code idthe-textarea-element:dom-textarea-value-3>a href#dom-textarea-value>value/a>/code>dd> p>Returns the current value of the element./p> p>Can be set, to change the value./p> /dl> p>The dfn iddom-textarea-cols>code>cols/code>/dfn>, dfn iddom-textarea-placeholder>code>placeholder/code>/dfn>, dfn iddom-textarea-required>code>required/code>/dfn>, dfn iddom-textarea-rows>code>rows/code>/dfn>, and dfn iddom-textarea-wrap>code>wrap/code>/dfn> IDL attributes must a href#reflect idthe-textarea-element:reflect>reflect/a> the respective content attributes of the same name. The code idthe-textarea-element:dom-textarea-cols-2>a href#dom-textarea-cols>cols/a>/code> and code idthe-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-with-fallback idthe-textarea-element:limited-to-only-non-negative-numbers-greater-than-zero-with-fallback>limited to only non-negative numbers greater than zero with fallback/a>. The code idthe-textarea-element:dom-textarea-cols-3>a href#dom-textarea-cols>cols/a>/code> IDL attributes default value is 20. The code idthe-textarea-element:dom-textarea-rows-3>a href#dom-textarea-rows>rows/a>/code> IDL attributes default value is 2. The dfn iddom-textarea-dirname>code>dirName/code>/dfn> IDL attribute must a href#reflect idthe-textarea-element:reflect-2>reflect/a> the code idthe-textarea-element:attr-fe-dirname-3>a href#attr-fe-dirname>dirname/a>/code> content attribute. The dfn iddom-textarea-inputmode>code>inputMode/code>/dfn> IDL attribute must a href#reflect idthe-textarea-element:reflect-3>reflect/a> the code idthe-textarea-element:attr-fe-inputmode-3>a href#attr-fe-inputmode>inputmode/a>/code> content attribute, a href#limited-to-only-known-values idthe-textarea-element:limited-to-only-known-values>limited to only known values/a>. The dfn iddom-textarea-maxlength>code>maxLength/code>/dfn> IDL attribute must a href#reflect idthe-textarea-element:reflect-4>reflect/a> the code idthe-textarea-element:attr-textarea-maxlength-2>a href#attr-textarea-maxlength>maxlength/a>/code> content attribute, a href#limited-to-only-non-negative-numbers idthe-textarea-element:limited-to-only-non-negative-numbers>limited to only non-negative numbers/a>. The dfn iddom-textarea-minlength>code>minLength/code>/dfn> IDL attribute must a href#reflect idthe-textarea-element:reflect-5>reflect/a> the code idthe-textarea-element:attr-textarea-minlength-2>a href#attr-textarea-minlength>minlength/a>/code> content attribute, a href#limited-to-only-non-negative-numbers idthe-textarea-element:limited-to-only-non-negative-numbers-2>limited to only non-negative numbers/a>. The dfn iddom-textarea-readonly>code>readOnly/code>/dfn> IDL attribute must a href#reflect idthe-textarea-element:reflect-6>reflect/a> the code idthe-textarea-element:attr-textarea-readonly-4>a href#attr-textarea-readonly>readonly/a>/code> content attribute./p> p>The dfn iddom-textarea-type>code>type/code>/dfn> IDL attribute must return the value code>textarea/code>./p> p>The dfn iddom-textarea-defaultvalue>code>defaultValue/code>/dfn> IDL attribute must, on getting, return the elements a idthe-textarea-element:child-text-content-3 hrefhttps://dom.spec.whatwg.org/#concept-child-text-content data-x-internalchild-text-content>child text content/a>. On setting, it must act as the setter for the elements code idthe-textarea-element:textcontent-2>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> IDL attribute./p> p>The dfn iddom-textarea-value>code>value/code>/dfn> IDL attribute must, on getting, return the elements a href#concept-fe-api-value idthe-textarea-element:concept-fe-api-value-3>API value/a>. On setting, it must perform the following steps:/p> ol>li>p>Let var>oldAPIValue/var> be this elements a href#concept-fe-api-value idthe-textarea-element:concept-fe-api-value-4>API value/a>.li>p>Set this elements a href#concept-textarea-raw-value idthe-textarea-element:concept-textarea-raw-value-11>raw value/a> to the new value.li>p>Set this elements a href#concept-fe-dirty idthe-textarea-element:concept-fe-dirty-5>dirty value flag/a> to true.li>p>If the new a href#concept-fe-api-value idthe-textarea-element:concept-fe-api-value-5>API value/a> is different from var>oldAPIValue/var>, then move the text entry cursor position to the end of the text control, unselecting any selected text and a href#set-the-selection-direction idthe-textarea-element:set-the-selection-direction>resetting the selection direction/a> to code>none/code>./ol> p>The dfn iddom-textarea-textlength>code>textLength/code>/dfn> IDL attribute must return the a idthe-textarea-element:javascript-string-length-2 hrefhttps://infra.spec.whatwg.org/#javascript-string-length data-x-internaljavascript-string-length>JavaScript string length/a> of the elements a href#concept-fe-api-value idthe-textarea-element:concept-fe-api-value-6>API value/a>./p> p>The code idthe-textarea-element:dom-cva-willvalidate-2>a href#dom-cva-willvalidate>willValidate/a>/code>, code idthe-textarea-element:dom-cva-validity-2>a href#dom-cva-validity>validity/a>/code>, and code idthe-textarea-element:dom-cva-validationmessage-2>a href#dom-cva-validationmessage>validationMessage/a>/code> IDL attributes, and the code idthe-textarea-element:dom-cva-checkvalidity-2>a href#dom-cva-checkvalidity>checkValidity()/a>/code>, code idthe-textarea-element:dom-cva-reportvalidity-2>a href#dom-cva-reportvalidity>reportValidity()/a>/code>, and code idthe-textarea-element:dom-cva-setcustomvalidity-2>a href#dom-cva-setcustomvalidity>setCustomValidity()/a>/code> methods, are part of the a href#the-constraint-validation-api idthe-textarea-element:the-constraint-validation-api>constraint validation API/a>. The code idthe-textarea-element:dom-lfe-labels-2>a href#dom-lfe-labels>labels/a>/code> IDL attribute provides a list of the elements code idthe-textarea-element:the-label-element-3>a href#the-label-element>label/a>/code>s. The code idthe-textarea-element:dom-textarea/input-select-2>a href#dom-textarea/input-select>select()/a>/code>, code idthe-textarea-element:dom-textarea/input-selectionstart-2>a href#dom-textarea/input-selectionstart>selectionStart/a>/code>, code idthe-textarea-element:dom-textarea/input-selectionend-2>a href#dom-textarea/input-selectionend>selectionEnd/a>/code>, code idthe-textarea-element:dom-textarea/input-selectiondirection-2>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code>, code idthe-textarea-element:dom-textarea/input-setrangetext-3>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code>, and code idthe-textarea-element:dom-textarea/input-setselectionrange-2>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code> methods and IDL attributes expose the elements text selection. The code idthe-textarea-element:dom-fe-autofocus-2>a href#dom-fe-autofocus>autofocus/a>/code>, code idthe-textarea-element:dom-fe-disabled-2>a href#dom-fe-disabled>disabled/a>/code>, code idthe-textarea-element:dom-fae-form-2>a href#dom-fae-form>form/a>/code>, and code idthe-textarea-element:dom-fe-name-2>a href#dom-fe-name>name/a>/code> IDL attributes are part of the elements forms API./p> div classexample> p>Here is an example of a code idthe-textarea-element:the-textarea-element-18>a href#the-textarea-element>textarea/a>/code> being used for unrestricted free-form text input in a form:/p> pre><p>If you have any comments, please let us know: <textarea cols80 namecomments></textarea></p>/pre> p>To specify a maximum length for the comments, one can use the code idthe-textarea-element:attr-textarea-maxlength-3>a href#attr-textarea-maxlength>maxlength/a>/code> attribute:/p> pre><p>If you have any short comments, please let us know: <textarea cols80 namecomments maxlength200></textarea></p>/pre> p>To give a default value, text can be included inside the element:/p> pre><p>If you have any comments, please let us know: <textarea cols80 namecomments>You rock!</textarea></p>/pre> p>You can also give a minimum length. Here, a letter needs to be filled out by the user; a template (which is shorter than the minimum length) is provided, but is insufficient to submit the form:/p> pre><textarea required minlength500>Dear Madam Speaker,Regarding your letter dated ......Yours Sincerely,...</textarea>/pre> p>A placeholder can be given as well, to suggest the basic form to the user, without providing an explicit template:/p> pre><textarea placeholderDear Francine,They closed the parks this week, so we wont be able tomeet your there. Should we just have dinner?Love,Daddy></textarea>/pre> p>To have the browser submit a href#the-directionality idthe-textarea-element:the-directionality-3>the directionality/a> of the element along with the value, the code idthe-textarea-element:attr-fe-dirname-4>a href#attr-fe-dirname>dirname/a>/code> attribute can be specified:/p> pre><p>If you have any comments, please let us know (you may use either English or Hebrew for your comments):<textarea cols80 namecomments dirnamecomments.dir></textarea></p>/pre> /div> h4 idthe-output-element>span classsecno>4.10.12/span> The dfn>code>output/code>/dfn> elementa href#the-output-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-output-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-output-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-output-element:phrasing-content-2>Phrasing content/a>.dd>a href#category-listed idthe-output-element:category-listed>Listed/a>, a href#category-label idthe-output-element:category-label>labelable/a>, and a href#category-reset idthe-output-element:category-reset>resettable/a> a href#form-associated-element idthe-output-element:form-associated-element>form-associated element/a>.dd>a href#palpable-content-2 idthe-output-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-output-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-output-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-output-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-output-element:phrasing-content-2-3>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-output-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-output-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-output-element:global-attributes>Global attributes/a>dd>code idthe-output-element:attr-output-for>a href#attr-output-for>for/a>/code> — Specifies controls from which the output was calculateddd>code idthe-output-element:attr-fae-form>a href#attr-fae-form>form/a>/code> — Associates the control with a code idthe-output-element:the-form-element>a href#the-form-element>form/a>/code> elementdd>code idthe-output-element:attr-fe-name>a href#attr-fe-name>name/a>/code> — Name of form control to use in the code idthe-output-element:dom-form-elements>a href#dom-form-elements>form.elements/a>/code> API dt>a href#concept-element-dom idthe-output-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-output-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmloutputelement>HTMLOutputElement/dfn> : a href#htmlelement idthe-output-element:htmlelement>HTMLElement/a> { SameObject, PutForwardsa hrefhttps://dom.spec.whatwg.org/#dom-domtokenlist-value idthe-output-element:dom-domtokenlist-value data-x-internaldom-domtokenlist-value>value/a> readonly attribute a idthe-output-element:domtokenlist hrefhttps://dom.spec.whatwg.org/#interface-domtokenlist data-x-internaldomtokenlist>DOMTokenList/a> a href#dom-output-htmlfor idthe-output-element:dom-output-htmlfor>htmlFor/a>; readonly attribute a href#htmlformelement idthe-output-element:htmlformelement>HTMLFormElement/a>? a href#dom-fae-form idthe-output-element:dom-fae-form>form/a>; a href#cereactions idthe-output-element:cereactions>CEReactions/a> attribute DOMString a href#dom-fe-name idthe-output-element:dom-fe-name>name/a>; readonly attribute DOMString a href#dom-output-type idthe-output-element:dom-output-type>type/a>; a href#cereactions idthe-output-element:cereactions-2>CEReactions/a> attribute DOMString a href#dom-output-defaultvalue idthe-output-element:dom-output-defaultvalue>defaultValue/a>; a href#cereactions idthe-output-element:cereactions-3>CEReactions/a> attribute DOMString a href#dom-output-value idthe-output-element:dom-output-value>value/a>; readonly attribute boolean a href#dom-cva-willvalidate idthe-output-element:dom-cva-willvalidate>willValidate/a>; readonly attribute a href#validitystate idthe-output-element:validitystate>ValidityState/a> a href#dom-cva-validity idthe-output-element:dom-cva-validity>validity/a>; readonly attribute DOMString a href#dom-cva-validationmessage idthe-output-element:dom-cva-validationmessage>validationMessage/a>; boolean a href#dom-cva-checkvalidity idthe-output-element:dom-cva-checkvalidity>checkValidity/a>(); boolean a href#dom-cva-reportvalidity idthe-output-element:dom-cva-reportvalidity>reportValidity/a>(); void a href#dom-cva-setcustomvalidity idthe-output-element:dom-cva-setcustomvalidity>setCustomValidity/a>(DOMString error); readonly attribute a idthe-output-element:nodelist hrefhttps://dom.spec.whatwg.org/#interface-nodelist data-x-internalnodelist>NodeList/a> a href#dom-lfe-labels idthe-output-element:dom-lfe-labels>labels/a>;};/pre> /dl> p>The code idthe-output-element:the-output-element>a href#the-output-element>output/a>/code> element a href#represents idthe-output-element:represents>represents/a> the result of a calculation performed by the application, or the result of a user action./p> p classnote>This element can be contrasted with the code idthe-output-element:the-samp-element>a href#the-samp-element>samp/a>/code> element, which is the appropriate element for quoting the output of other programs run previously./p> p>The dfn idattr-output-for>code>for/code>/dfn> content attribute allows an explicit relationship to be made between the result of a calculation and the elements that represent the values that went into the calculation or that otherwise influenced the calculation. The code idthe-output-element:attr-output-for-2>a href#attr-output-for>for/a>/code> attribute, if specified, must contain a string consisting of an a href#unordered-set-of-unique-space-separated-tokens idthe-output-element:unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens/a> that are a href#case-sensitive idthe-output-element:case-sensitive>case-sensitive/a>, each of which must have the value of an a hrefhttps://dom.spec.whatwg.org/#concept-id idthe-output-element:concept-id data-x-internalconcept-id>ID/a> of an element in the same a idthe-output-element:tree hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a>./p> p>The code idthe-output-element:attr-fae-form-2>a href#attr-fae-form>form/a>/code> attribute is used to explicitly associate the code idthe-output-element:the-output-element-2>a href#the-output-element>output/a>/code> element with its a href#form-owner idthe-output-element:form-owner>form owner/a>. The code idthe-output-element:attr-fe-name-2>a href#attr-fe-name>name/a>/code> attribute represents the elements name. The code idthe-output-element:the-output-element-3>a href#the-output-element>output/a>/code> element is associated with a form so that it can be easily a href#referenced idthe-output-element:referenced>referenced/a> from the event handlers of form controls; the elements value itself is not submitted when the form is submitted./p> p>The element has a dfn idconcept-output-mode>value mode flag/dfn> which is either i idthe-output-element:concept-output-mode-value>a href#concept-output-mode-value>value/a>/i> or i idthe-output-element:concept-output-mode-default>a href#concept-output-mode-default>default/a>/i>. Initially, the a href#concept-output-mode idthe-output-element:concept-output-mode>value mode flag/a> must be set to i idthe-output-element:concept-output-mode-default-2>a href#concept-output-mode-default>default/a>/i>./p> p>The element also has a dfn idconcept-output-defaultvalue>default value/dfn>. Initially, the a href#concept-output-defaultvalue idthe-output-element:concept-output-defaultvalue>default value/a> must be the empty string./p> p>When the a href#concept-output-mode idthe-output-element:concept-output-mode-2>value mode flag/a> is in mode dfn idconcept-output-mode-default>i>default/i>/dfn>, the contents of the element represent both the value of the element and its a href#concept-output-defaultvalue idthe-output-element:concept-output-defaultvalue-2>default value/a>. When the a href#concept-output-mode idthe-output-element:concept-output-mode-3>value mode flag/a> is in mode dfn idconcept-output-mode-value>i>value/i>/dfn>, the contents of the element represent the value of the element only, and the a href#concept-output-defaultvalue idthe-output-element:concept-output-defaultvalue-3>default value/a> is only accessible using the code idthe-output-element:dom-output-defaultvalue-2>a href#dom-output-defaultvalue>defaultValue/a>/code> IDL attribute./p> p>Whenever the elements descendants are changed in any way, if the a href#concept-output-mode idthe-output-element:concept-output-mode-4>value mode flag/a> is in mode i idthe-output-element:concept-output-mode-default-3>a href#concept-output-mode-default>default/a>/i>, the elements a href#concept-output-defaultvalue idthe-output-element:concept-output-defaultvalue-4>default value/a> must be set to the value of the elements code idthe-output-element:textcontent>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> IDL attribute./p> p>The a href#concept-form-reset-control idthe-output-element:concept-form-reset-control>reset algorithm/a> for code idthe-output-element:the-output-element-4>a href#the-output-element>output/a>/code> elements is to set the elements a href#concept-output-mode idthe-output-element:concept-output-mode-5>value mode flag/a> to i idthe-output-element:concept-output-mode-default-4>a href#concept-output-mode-default>default/a>/i> and then to set the elements code idthe-output-element:textcontent-2>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> IDL attribute to the value of the elements a href#concept-output-defaultvalue idthe-output-element:concept-output-defaultvalue-5>default value/a> (thus replacing the elements child nodes)./p> dl classdomintro>dt>var>output/var> . code idthe-output-element:dom-output-value-2>a href#dom-output-value>value/a>/code> var>value/var> dd> p>Returns the elements current value./p> p>Can be set, to change the value./p> dt>var>output/var> . code idthe-output-element:dom-output-defaultvalue-3>a href#dom-output-defaultvalue>defaultValue/a>/code> var>value/var> dd> p>Returns the elements current default value./p> p>Can be set, to change the default value./p> dt>var>output/var> . code idthe-output-element:dom-output-type-2>a href#dom-output-type>type/a>/code>dd> p>Returns the string code>output/code>./p> /dl> p>The dfn iddom-output-value>code>value/code>/dfn> IDL attribute must act like the elements code idthe-output-element:textcontent-3>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> IDL attribute, except that on setting, in addition, before the child nodes are changed, the elements a href#concept-output-mode idthe-output-element:concept-output-mode-6>value mode flag/a> must be set to i idthe-output-element:concept-output-mode-value-2>a href#concept-output-mode-value>value/a>/i>./p> p>The dfn iddom-output-defaultvalue>code>defaultValue/code>/dfn> IDL attribute, on getting, must return the elements a href#concept-output-defaultvalue idthe-output-element:concept-output-defaultvalue-6>default value/a>. On setting, the attribute must set the elements a href#concept-output-defaultvalue idthe-output-element:concept-output-defaultvalue-7>default value/a>, and, if the elements a href#concept-output-mode idthe-output-element:concept-output-mode-7>value mode flag/a> is in the mode i idthe-output-element:concept-output-mode-default-5>a href#concept-output-mode-default>default/a>/i>, set the elements code idthe-output-element:textcontent-4>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> IDL attribute as well./p> p>The dfn iddom-output-type>code>type/code>/dfn> attribute must return the string code>output/code>./p> p>The dfn iddom-output-htmlfor>code>htmlFor/code>/dfn> IDL attribute must a href#reflect idthe-output-element:reflect>reflect/a> the code idthe-output-element:attr-output-for-3>a href#attr-output-for>for/a>/code> content attribute./p> p>The code idthe-output-element:dom-cva-willvalidate-2>a href#dom-cva-willvalidate>willValidate/a>/code>, code idthe-output-element:dom-cva-validity-2>a href#dom-cva-validity>validity/a>/code>, and code idthe-output-element:dom-cva-validationmessage-2>a href#dom-cva-validationmessage>validationMessage/a>/code> IDL attributes, and the code idthe-output-element:dom-cva-checkvalidity-2>a href#dom-cva-checkvalidity>checkValidity()/a>/code>, code idthe-output-element:dom-cva-reportvalidity-2>a href#dom-cva-reportvalidity>reportValidity()/a>/code>, and code idthe-output-element:dom-cva-setcustomvalidity-2>a href#dom-cva-setcustomvalidity>setCustomValidity()/a>/code> methods, are part of the a href#the-constraint-validation-api idthe-output-element:the-constraint-validation-api>constraint validation API/a>. The code idthe-output-element:dom-lfe-labels-2>a href#dom-lfe-labels>labels/a>/code> IDL attribute provides a list of the elements code idthe-output-element:the-label-element>a href#the-label-element>label/a>/code>s. The code idthe-output-element:dom-fae-form-2>a href#dom-fae-form>form/a>/code> and code idthe-output-element:dom-fe-name-2>a href#dom-fe-name>name/a>/code> IDL attributes are part of the elements forms API./p> div classexample> p>A simple calculator could use code idthe-output-element:the-output-element-5>a href#the-output-element>output/a>/code> for its display of calculated results:/p> pre><form onsubmitreturn false oninputo.value a.valueAsNumber + b.valueAsNumber> <input namea typenumber stepany> + <input nameb typenumber stepany> <output nameo fora b></output></form>/pre> /div> div classexample> p>In this example, an code idthe-output-element:the-output-element-6>a href#the-output-element>output/a>/code> element is used to report the results of a calculation performed by a remote server, as they come in:/p> pre><output idresult></output><script> var primeSource new WebSocket(ws://primes.example.net/); primeSource.onmessage function (event) { document.getElementById(result).value event.data; }</script>/pre> /div> h4 idthe-progress-element>span classsecno>4.10.13/span> The dfn>code>progress/code>/dfn> elementa href#the-progress-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> progressspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>8+/span>/span>span classios_saf partial>span>iOS Safari (limited)/span> span>7.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>6+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>6+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>4.4+/span>/span>span classopera yes>span>Opera/span> span>11+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featprogress>caniuse.com/a>/div> dl classelement>dt>a href#concept-element-categories idthe-progress-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-progress-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-progress-element:phrasing-content-2>Phrasing content/a>.dd>a href#category-label idthe-progress-element:category-label>Labelable element/a>.dd>a href#palpable-content-2 idthe-progress-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-progress-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-progress-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-progress-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-progress-element:phrasing-content-2-3>Phrasing content/a>, but there must be no code idthe-progress-element:the-progress-element>a href#the-progress-element>progress/a>/code> element descendants.dt>a href#concept-element-tag-omission idthe-progress-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-progress-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-progress-element:global-attributes>Global attributes/a>dd>code idthe-progress-element:attr-progress-value>a href#attr-progress-value>value/a>/code> — Current value of the elementdd>code idthe-progress-element:attr-progress-max>a href#attr-progress-max>max/a>/code> — Upper bound of rangedt>a href#concept-element-dom idthe-progress-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-progress-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlprogresselement>HTMLProgressElement/dfn> : a href#htmlelement idthe-progress-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-progress-element:cereactions>CEReactions/a> attribute double a href#dom-progress-value idthe-progress-element:dom-progress-value>value/a>; a href#cereactions idthe-progress-element:cereactions-2>CEReactions/a> attribute double a href#dom-progress-max idthe-progress-element:dom-progress-max>max/a>; readonly attribute double a href#dom-progress-position idthe-progress-element:dom-progress-position>position/a>; readonly attribute a idthe-progress-element:nodelist hrefhttps://dom.spec.whatwg.org/#interface-nodelist data-x-internalnodelist>NodeList/a> a href#dom-lfe-labels idthe-progress-element:dom-lfe-labels>labels/a>;};/pre> /dl> p>The code idthe-progress-element:the-progress-element-2>a href#the-progress-element>progress/a>/code> element a href#represents idthe-progress-element:represents>represents/a> the completion progress of a task. The progress is either indeterminate, indicating that progress is being made but that it is not clear how much more work remains to be done before the task is complete (e.g. because the task is waiting for a remote host to respond), or the progress is a number in the range zero to a maximum, giving the fraction of work that has so far been completed./p> p>There are two attributes that determine the current task completion represented by the element. The dfn idattr-progress-value>code>value/code>/dfn> attribute specifies how much of the task has been completed, and the dfn idattr-progress-max>code>max/code>/dfn> attribute specifies how much work the task requires in total. The units are arbitrary and not specified./p> p classnote>To make a determinate progress bar, add a code idthe-progress-element:attr-progress-value-2>a href#attr-progress-value>value/a>/code> attribute with the current progress (either a number from 0.0 to 1.0, or, if the code idthe-progress-element:attr-progress-max-2>a href#attr-progress-max>max/a>/code> attribute is specified, a number from 0 to the value of the code idthe-progress-element:attr-progress-max-3>a href#attr-progress-max>max/a>/code> attribute). To make an indeterminate progress bar, remove the code idthe-progress-element:attr-progress-value-3>a href#attr-progress-value>value/a>/code> attribute./p> p>Authors are encouraged to also include the current value and the maximum value inline as text inside the element, so that the progress is made available to users of legacy user agents./p> div classexample> p>Here is a snippet of a Web application that shows the progress of some automated task:/p> pre><section> <h2>Task Progress</h2> <p>Progress: <progress idp max100><span>0</span>%</progress></p> <script> var progressBar document.getElementById(p); function updateProgress(newValue) { progressBar.value newValue; progressBar.getElementsByTagName(span)0.textContent newValue; } </script></section>/pre> p>(The code>updateProgress()/code> method in this example would be called by some other code on the page to update the actual progress bar as the task progressed.)/p> /div> p>The code idthe-progress-element:attr-progress-value-4>a href#attr-progress-value>value/a>/code> and code idthe-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 idthe-progress-element:valid-floating-point-number>valid floating-point numbers/a>. The code idthe-progress-element:attr-progress-value-5>a href#attr-progress-value>value/a>/code> attribute, if present, must have a value equal to or greater than zero, and less than or equal to the value of the code idthe-progress-element:attr-progress-max-5>a href#attr-progress-max>max/a>/code> attribute, if present, or 1.0, otherwise. The code idthe-progress-element:attr-progress-max-6>a href#attr-progress-max>max/a>/code> attribute, if present, must have a value greater than zero./p> p classnote>The code idthe-progress-element:the-progress-element-3>a href#the-progress-element>progress/a>/code> element is the wrong element to use for something that is just a gauge, as opposed to task progress. For instance, indicating disk space usage using code idthe-progress-element:the-progress-element-4>a href#the-progress-element>progress/a>/code> would be inappropriate. Instead, the code idthe-progress-element:the-meter-element>a href#the-meter-element>meter/a>/code> element is available for such use cases./p> p>strong>User agent requirements/strong>: If the code idthe-progress-element:attr-progress-value-6>a href#attr-progress-value>value/a>/code> attribute is omitted, then the progress bar is an indeterminate progress bar. Otherwise, it is a determinate progress bar./p> p>If the progress bar is a determinate progress bar and the element has a code idthe-progress-element:attr-progress-max-7>a href#attr-progress-max>max/a>/code> attribute, the user agent must parse the code idthe-progress-element:attr-progress-max-8>a href#attr-progress-max>max/a>/code> attributes value according to the a href#rules-for-parsing-floating-point-number-values idthe-progress-element:rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values/a>. If this does not result in an error, and if the parsed value is greater than zero, then the dfn idconcept-progress-maximum>maximum value/dfn> of the progress bar is that value. Otherwise, if the element has no code idthe-progress-element:attr-progress-max-9>a href#attr-progress-max>max/a>/code> attribute, or if it has one but parsing it resulted in an error, or if the parsed value was less than or equal to zero, then the a href#concept-progress-maximum idthe-progress-element:concept-progress-maximum>maximum value/a> of the progress bar is 1.0./p> p>If the progress bar is a determinate progress bar, user agents must parse the code idthe-progress-element:attr-progress-value-7>a href#attr-progress-value>value/a>/code> attributes value according to the a href#rules-for-parsing-floating-point-number-values idthe-progress-element:rules-for-parsing-floating-point-number-values-2>rules for parsing floating-point number values/a>. If this does not result in an error and the parsed value is greater than zero, then the dfn idconcept-progress-value>value/dfn> of the progress bar is that parsed value. Otherwise, if parsing the code idthe-progress-element:attr-progress-value-8>a href#attr-progress-value>value/a>/code> attributes value resulted in an error or a number less than or equal to zero, then the a href#concept-progress-value idthe-progress-element:concept-progress-value>value/a> of the progress bar is zero./p> p>If the progress bar is a determinate progress bar, then the dfn idconcept-progress-current-value>current value/dfn> is the a href#concept-progress-maximum idthe-progress-element:concept-progress-maximum-2>maximum value/a>, if a href#concept-progress-value idthe-progress-element:concept-progress-value-2>value/a> is greater than the a href#concept-progress-maximum idthe-progress-element:concept-progress-maximum-3>maximum value/a>, and a href#concept-progress-value idthe-progress-element:concept-progress-value-3>value/a> otherwise./p> p>strong>UA requirements for showing the progress bar/strong>: When representing a code idthe-progress-element:the-progress-element-5>a href#the-progress-element>progress/a>/code> element to the user, the UA should indicate whether it is a determinate or indeterminate progress bar, and in the former case, should indicate the relative position of the a href#concept-progress-current-value idthe-progress-element:concept-progress-current-value>current value/a> relative to the a href#concept-progress-maximum idthe-progress-element:concept-progress-maximum-4>maximum value/a>./p> dl classdomintro>dt>var>progress/var> . code idthe-progress-element:dom-progress-position-2>a href#dom-progress-position>position/a>/code>dd> p>For a determinate progress bar (one with known current and maximum values), returns the result of dividing the current value by the maximum value./p> p>For an indeterminate progress bar, returns −1./p> /dl> p>If the progress bar is an indeterminate progress bar, then the dfn iddom-progress-position>code>position/code>/dfn> IDL attribute must return −1. Otherwise, it must return the result of dividing the a href#concept-progress-current-value idthe-progress-element:concept-progress-current-value-2>current value/a> by the a href#concept-progress-maximum idthe-progress-element:concept-progress-maximum-5>maximum value/a>./p> p>If the progress bar is an indeterminate progress bar, then the dfn iddom-progress-value>code>value/code>/dfn> IDL attribute, on getting, must return 0. Otherwise, it must return the a href#concept-progress-value idthe-progress-element:concept-progress-value-4>current value/a>. On setting, the given value must be converted to the a href#best-representation-of-the-number-as-a-floating-point-number idthe-progress-element:best-representation-of-the-number-as-a-floating-point-number>best representation of the number as a floating-point number/a> and then the code idthe-progress-element:dom-progress-value-2>a href#dom-progress-value>value/a>/code> content attribute must be set to that string./p> p classnote>Setting the code idthe-progress-element:dom-progress-value-3>a href#dom-progress-value>value/a>/code> IDL attribute to itself when the corresponding content attribute is absent would change the progress bar from an indeterminate progress bar to a determinate progress bar with no progress./p> p>The dfn iddom-progress-max>code>max/code>/dfn> IDL attribute must a href#reflect idthe-progress-element:reflect>reflect/a> the content attribute of the same name, a href#limited-to-numbers-greater-than-zero idthe-progress-element:limited-to-numbers-greater-than-zero>limited to numbers greater than zero/a>. The default value for code idthe-progress-element:dom-progress-max-2>a href#dom-progress-max>max/a>/code> is 1.0./p> p>The code idthe-progress-element:dom-lfe-labels-2>a href#dom-lfe-labels>labels/a>/code> IDL attribute provides a list of the elements code idthe-progress-element:the-label-element>a href#the-label-element>label/a>/code>s./p> h4 idthe-meter-element>span classsecno>4.10.14/span> The dfn>code>meter/code>/dfn> elementa href#the-meter-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> meterspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>8+/span>/span>span classios_saf yes>span>iOS Safari/span> span>10.3+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>16+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>6+/span>/span>span classedge yes>span>Edge/span> span>13+/span>/span>span classandroid yes>span>Android Browser/span> span>4.4+/span>/span>span classopera yes>span>Opera/span> span>11+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featmeter>caniuse.com/a>/div> dl classelement>dt>a href#concept-element-categories idthe-meter-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-meter-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-meter-element:phrasing-content-2>Phrasing content/a>.dd>a href#category-label idthe-meter-element:category-label>Labelable element/a>.dd>a href#palpable-content-2 idthe-meter-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-meter-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-meter-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-meter-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-meter-element:phrasing-content-2-3>Phrasing content/a>, but there must be no code idthe-meter-element:the-meter-element>a href#the-meter-element>meter/a>/code> element descendants.dt>a href#concept-element-tag-omission idthe-meter-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-meter-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-meter-element:global-attributes>Global attributes/a>dd>code idthe-meter-element:attr-meter-value>a href#attr-meter-value>value/a>/code> — Current value of the elementdd>code idthe-meter-element:attr-meter-min>a href#attr-meter-min>min/a>/code> — Lower bound of rangedd>code idthe-meter-element:attr-meter-max>a href#attr-meter-max>max/a>/code> — Upper bound of rangedd>code idthe-meter-element:attr-meter-low>a href#attr-meter-low>low/a>/code> — High limit of low rangedd>code idthe-meter-element:attr-meter-high>a href#attr-meter-high>high/a>/code> — Low limit of high rangedd>code idthe-meter-element:attr-meter-optimum>a href#attr-meter-optimum>optimum/a>/code> — Optimum value in gaugedt>a href#concept-element-dom idthe-meter-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-meter-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlmeterelement>HTMLMeterElement/dfn> : a href#htmlelement idthe-meter-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-meter-element:cereactions>CEReactions/a> attribute double a href#dom-meter-value idthe-meter-element:dom-meter-value>value/a>; a href#cereactions idthe-meter-element:cereactions-2>CEReactions/a> attribute double a href#dom-meter-min idthe-meter-element:dom-meter-min>min/a>; a href#cereactions idthe-meter-element:cereactions-3>CEReactions/a> attribute double a href#dom-meter-max idthe-meter-element:dom-meter-max>max/a>; a href#cereactions idthe-meter-element:cereactions-4>CEReactions/a> attribute double a href#dom-meter-low idthe-meter-element:dom-meter-low>low/a>; a href#cereactions idthe-meter-element:cereactions-5>CEReactions/a> attribute double a href#dom-meter-high idthe-meter-element:dom-meter-high>high/a>; a href#cereactions idthe-meter-element:cereactions-6>CEReactions/a> attribute double a href#dom-meter-optimum idthe-meter-element:dom-meter-optimum>optimum/a>; readonly attribute a idthe-meter-element:nodelist hrefhttps://dom.spec.whatwg.org/#interface-nodelist data-x-internalnodelist>NodeList/a> a href#dom-lfe-labels idthe-meter-element:dom-lfe-labels>labels/a>;};/pre> /dl> p>The code idthe-meter-element:the-meter-element-2>a href#the-meter-element>meter/a>/code> element a href#represents idthe-meter-element:represents>represents/a> a scalar measurement within a known range, or a fractional value; for example disk usage, the relevance of a query result, or the fraction of a voting population to have selected a particular candidate./p> p>This is also known as a gauge./p> p>The code idthe-meter-element:the-meter-element-3>a href#the-meter-element>meter/a>/code> element should not be used to indicate progress (as in a progress bar). For that role, HTML provides a separate code idthe-meter-element:the-progress-element>a href#the-progress-element>progress/a>/code> element./p> p classnote>The code idthe-meter-element:the-meter-element-4>a href#the-meter-element>meter/a>/code> element also does not represent a scalar value of arbitrary range — for example, it would be wrong to use this to report a weight, or height, unless there is a known maximum value./p> p>There are six attributes that determine the semantics of the gauge represented by the element./p> p>The dfn idattr-meter-min>code>min/code>/dfn> attribute specifies the lower bound of the range, and the dfn idattr-meter-max>code>max/code>/dfn> attribute specifies the upper bound. The dfn idattr-meter-value>code>value/code>/dfn> attribute specifies the value to have the gauge indicate as the measured value./p> p>The other three attributes can be used to segment the gauges range into low, medium, and high parts, and to indicate which part of the gauge is the optimum part. The dfn idattr-meter-low>code>low/code>/dfn> attribute specifies the range that is considered to be the low part, and the dfn idattr-meter-high>code>high/code>/dfn> attribute specifies the range that is considered to be the high part. The dfn idattr-meter-optimum>code>optimum/code>/dfn> attribute gives the position that is optimum; if that is higher than the high value then this indicates that the higher the value, the better; if its lower than the low mark then it indicates that lower values are better, and naturally if it is in between then it indicates that neither high nor low values are good./p> p>strong>Authoring requirements/strong>: The code idthe-meter-element:attr-meter-value-2>a href#attr-meter-value>value/a>/code> attribute must be specified. The code idthe-meter-element:attr-meter-value-3>a href#attr-meter-value>value/a>/code>, code idthe-meter-element:attr-meter-min-2>a href#attr-meter-min>min/a>/code>, code idthe-meter-element:attr-meter-low-2>a href#attr-meter-low>low/a>/code>, code idthe-meter-element:attr-meter-high-2>a href#attr-meter-high>high/a>/code>, code idthe-meter-element:attr-meter-max-2>a href#attr-meter-max>max/a>/code>, and code idthe-meter-element:attr-meter-optimum-2>a href#attr-meter-optimum>optimum/a>/code> attributes, when present, must have values that are a href#valid-floating-point-number idthe-meter-element:valid-floating-point-number>valid floating-point numbers/a>./p> p>In addition, the attributes values are further constrained:/p> p>Let var>value/var> be the code idthe-meter-element:attr-meter-value-4>a href#attr-meter-value>value/a>/code> attributes number./p> p>If the code idthe-meter-element:attr-meter-min-3>a href#attr-meter-min>min/a>/code> attribute is specified, then let var>minimum/var> be that attributes value; otherwise, let it be zero./p> p>If the code idthe-meter-element:attr-meter-max-3>a href#attr-meter-max>max/a>/code> attribute is specified, then let var>maximum/var> be that attributes value; otherwise, let it be 1.0./p> p>The following inequalities must hold, as applicable:/p> ul classbrief>li>var>minimum/var> ≤ var>value/var> ≤ var>maximum/var>li>var>minimum/var> ≤ code idthe-meter-element:attr-meter-low-3>a href#attr-meter-low>low/a>/code> ≤ var>maximum/var> (if code idthe-meter-element:attr-meter-low-4>a href#attr-meter-low>low/a>/code> is specified)li>var>minimum/var> ≤ code idthe-meter-element:attr-meter-high-3>a href#attr-meter-high>high/a>/code> ≤ var>maximum/var> (if code idthe-meter-element:attr-meter-high-4>a href#attr-meter-high>high/a>/code> is specified)li>var>minimum/var> ≤ code idthe-meter-element:attr-meter-optimum-3>a href#attr-meter-optimum>optimum/a>/code> ≤ var>maximum/var> (if code idthe-meter-element:attr-meter-optimum-4>a href#attr-meter-optimum>optimum/a>/code> is specified)li>code idthe-meter-element:attr-meter-low-5>a href#attr-meter-low>low/a>/code> ≤ code idthe-meter-element:attr-meter-high-5>a href#attr-meter-high>high/a>/code> (if both code idthe-meter-element:attr-meter-low-6>a href#attr-meter-low>low/a>/code> and code idthe-meter-element:attr-meter-high-6>a href#attr-meter-high>high/a>/code> are specified)/ul> p classnote>If no minimum or maximum is specified, then the range is assumed to be 0..1, and the value thus has to be within that range./p> p>Authors are encouraged to include a textual representation of the gauges state in the elements contents, for users of user agents that do not support the code idthe-meter-element:the-meter-element-5>a href#the-meter-element>meter/a>/code> element./p> p>When used with a href#microdata idthe-meter-element:microdata>microdata/a>, the code idthe-meter-element:the-meter-element-6>a href#the-meter-element>meter/a>/code> elements code idthe-meter-element:attr-meter-value-5>a href#attr-meter-value>value/a>/code> attribute provides the elements machine-readable value./p> div classexample> p>The following examples show three gauges that would all be three-quarters full:/p> pre>Storage space usage: <meter value6 max8>6 blocks used (out of 8 total)</meter>Voter turnout: <meter value0.75><img alt75% srcgraph75.png></meter>Tickets sold: <meter min0 max100 value75></meter>/pre> p>The following example is incorrect use of the element, because it doesnt give a range (and since the default maximum is 1, both of the gauges would end up looking maxed out):/p> pre classbad><p>The grapefruit pie had a radius of <meter value12>12cm</meter>and a height of <meter value2>2cm</meter>.</p> <!-- strong>BAD!/strong> -->/pre> p>Instead, one would either not include the meter element, or use the meter element with a defined range to give the dimensions in context compared to other pies:/p> pre><p>The grapefruit pie had a radius of 12cm and a height of2cm.</p><dl> <dt>Radius: <dd> <meter min0 max20 value12>12cm</meter> <dt>Height: <dd> <meter min0 max10 value2>2cm</meter></dl>/pre> /div> p>There is no explicit way to specify units in the code idthe-meter-element:the-meter-element-7>a href#the-meter-element>meter/a>/code> element, but the units may be specified in the code idthe-meter-element:attr-title>a href#attr-title>title/a>/code> attribute in free-form text./p> div classexample> p>The example above could be extended to mention the units:/p> pre><dl> <dt>Radius: <dd> <meter min0 max20 value12 titlecentimeters>12cm</meter> <dt>Height: <dd> <meter min0 max10 value2 titlecentimeters>2cm</meter></dl>/pre> /div> p>strong>User agent requirements/strong>: User agents must parse the code idthe-meter-element:attr-meter-min-4>a href#attr-meter-min>min/a>/code>, code idthe-meter-element:attr-meter-max-4>a href#attr-meter-max>max/a>/code>, code idthe-meter-element:attr-meter-value-6>a href#attr-meter-value>value/a>/code>, code idthe-meter-element:attr-meter-low-7>a href#attr-meter-low>low/a>/code>, code idthe-meter-element:attr-meter-high-7>a href#attr-meter-high>high/a>/code>, and code idthe-meter-element:attr-meter-optimum-5>a href#attr-meter-optimum>optimum/a>/code> attributes using the a href#rules-for-parsing-floating-point-number-values idthe-meter-element:rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values/a>./p> p>User agents must then use all these numbers to obtain values for six points on the gauge, as follows. (The order in which these are evaluated is important, as some of the values refer to earlier ones.)/p> dl>dt>The dfn idconcept-meter-minimum>minimum value/dfn>dd> p>If the code idthe-meter-element:attr-meter-min-5>a href#attr-meter-min>min/a>/code> attribute is specified and a value could be parsed out of it, then the minimum value is that value. Otherwise, the minimum value is zero./p> dt>The dfn idconcept-meter-maximum>maximum value/dfn>dd> p>If the code idthe-meter-element:attr-meter-max-5>a href#attr-meter-max>max/a>/code> attribute is specified and a value could be parsed out of it, then the candidate maximum value is that value. Otherwise, the candidate maximum value is 1.0./p> p>If the candidate maximum value is greater than or equal to the minimum value, then the maximum value is the candidate maximum value. Otherwise, the maximum value is the same as the minimum value./p> dt>The dfn idconcept-meter-actual>actual value/dfn>dd> p>If the code idthe-meter-element:attr-meter-value-7>a href#attr-meter-value>value/a>/code> attribute is specified and a value could be parsed out of it, then that value is the candidate actual value. Otherwise, the candidate actual value is zero./p> p>If the candidate actual value is less than the minimum value, then the actual value is the minimum value./p> p>Otherwise, if the candidate actual value is greater than the maximum value, then the actual value is the maximum value./p> p>Otherwise, the actual value is the candidate actual value./p> dt>The dfn idconcept-meter-low>low boundary/dfn>dd> p>If the code idthe-meter-element:attr-meter-low-8>a href#attr-meter-low>low/a>/code> attribute is specified and a value could be parsed out of it, then the candidate low boundary is that value. Otherwise, the candidate low boundary is the same as the minimum value./p> p>If the candidate low boundary is less than the minimum value, then the low boundary is the minimum value./p> p>Otherwise, if the candidate low boundary is greater than the maximum value, then the low boundary is the maximum value./p> p>Otherwise, the low boundary is the candidate low boundary./p> dt>The dfn idconcept-meter-high>high boundary/dfn>dd> p>If the code idthe-meter-element:attr-meter-high-8>a href#attr-meter-high>high/a>/code> attribute is specified and a value could be parsed out of it, then the candidate high boundary is that value. Otherwise, the candidate high boundary is the same as the maximum value./p> p>If the candidate high boundary is less than the low boundary, then the high boundary is the low boundary./p> p>Otherwise, if the candidate high boundary is greater than the maximum value, then the high boundary is the maximum value./p> p>Otherwise, the high boundary is the candidate high boundary./p> dt>The dfn idconcept-meter-optimum>optimum point/dfn>dd> p>If the code idthe-meter-element:attr-meter-optimum-6>a href#attr-meter-optimum>optimum/a>/code> attribute is specified and a value could be parsed out of it, then the candidate optimum point is that value. Otherwise, the candidate optimum point is the midpoint between the minimum value and the maximum value./p> p>If the candidate optimum point is less than the minimum value, then the optimum point is the minimum value./p> p>Otherwise, if the candidate optimum point is greater than the maximum value, then the optimum point is the maximum value./p> p>Otherwise, the optimum point is the candidate optimum point./p> /dl> p>All of which will result in the following inequalities all being true:/p> ul classbrief>li>minimum value ≤ actual value ≤ maximum valueli>minimum value ≤ low boundary ≤ high boundary ≤ maximum valueli>minimum value ≤ optimum point ≤ maximum value/ul> p>strong>UA requirements for regions of the gauge/strong>: If the optimum point is equal to the low boundary or the high boundary, or anywhere in between them, then the region between the low and high boundaries of the gauge must be treated as the optimum region, and the low and high parts, if any, must be treated as suboptimal. Otherwise, if the optimum point is less than the low boundary, then the region between the minimum value and the low boundary must be treated as the optimum region, the region from the low boundary up to the high boundary must be treated as a suboptimal region, and the remaining region must be treated as an even less good region. Finally, if the optimum point is higher than the high boundary, then the situation is reversed; the region between the high boundary and the maximum value must be treated as the optimum region, the region from the high boundary down to the low boundary must be treated as a suboptimal region, and the remaining region must be treated as an even less good region./p> p>strong>UA requirements for showing the gauge/strong>: When representing a code idthe-meter-element:the-meter-element-8>a href#the-meter-element>meter/a>/code> element to the user, the UA should indicate the relative position of the actual value to the minimum and maximum values, and the relationship between the actual value and the three regions of the gauge./p> div classexample> p>The following markup:/p> pre><h3>Suggested groups</h3><menu> <li><a href?cmdhsg onclickhideSuggestedGroups()>Hide suggested groups</a></li></menu><ul> <li> <p><a href/group/comp.infosystems.www.authoring.stylesheets/view>comp.infosystems.www.authoring.stylesheets</a> - <a href/group/comp.infosystems.www.authoring.stylesheets/subscribe>join</a></p> <p>Group description: <strong>Layout/presentation on the WWW.</strong></p> <p>strong><meter value0.5>Moderate activity,</meter>/strong> Usenet, 618 subscribers</p> </li> <li> <p><a href/group/netscape.public.mozilla.xpinstall/view>netscape.public.mozilla.xpinstall</a> - <a href/group/netscape.public.mozilla.xpinstall/subscribe>join</a></p> <p>Group description: <strong>Mozilla XPInstall discussion.</strong></p> <p>strong><meter value0.25>Low activity,</meter>/strong> Usenet, 22 subscribers</p> </li> <li> <p><a href/group/mozilla.dev.general/view>mozilla.dev.general</a> - <a href/group/mozilla.dev.general/subscribe>join</a></p> <p>strong><meter value0.25>Low activity,</meter>/strong> Usenet, 66 subscribers</p> </li></ul>/pre> p>Might be rendered as follows:/p> p>img src/images/sample-meter.png width332 altWith the meter> elements rendered as inline green bars of varying lengths. height178>/p> /div> p>User agents may combine the value of the code idthe-meter-element:attr-title-2>a href#attr-title>title/a>/code> attribute and the other attributes to provide context-sensitive help or inline text detailing the actual values./p> div classexample> p>For example, the following snippet:/p> pre><meter min0 max60 value23.2 titleseconds></meter>/pre> p>...might cause the user agent to display a gauge with a tooltip saying Value: 23.2 out of 60. on one line and seconds on a second line./p> /div> p>The dfn iddom-meter-value>code>value/code>/dfn> IDL attribute, on getting, must return the a href#concept-meter-actual idthe-meter-element:concept-meter-actual>actual value/a>. On setting, the given value must be converted to the a href#best-representation-of-the-number-as-a-floating-point-number idthe-meter-element:best-representation-of-the-number-as-a-floating-point-number>best representation of the number as a floating-point number/a> and then the code idthe-meter-element:dom-meter-value-2>a href#dom-meter-value>value/a>/code> content attribute must be set to that string./p> p>The dfn iddom-meter-min>code>min/code>/dfn> IDL attribute, on getting, must return the a href#concept-meter-minimum idthe-meter-element:concept-meter-minimum>minimum value/a>. On setting, the given value must be converted to the a href#best-representation-of-the-number-as-a-floating-point-number idthe-meter-element:best-representation-of-the-number-as-a-floating-point-number-2>best representation of the number as a floating-point number/a> and then the code idthe-meter-element:dom-meter-min-2>a href#dom-meter-min>min/a>/code> content attribute must be set to that string./p> p>The dfn iddom-meter-max>code>max/code>/dfn> IDL attribute, on getting, must return the a href#concept-meter-maximum idthe-meter-element:concept-meter-maximum>maximum value/a>. On setting, the given value must be converted to the a href#best-representation-of-the-number-as-a-floating-point-number idthe-meter-element:best-representation-of-the-number-as-a-floating-point-number-3>best representation of the number as a floating-point number/a> and then the code idthe-meter-element:dom-meter-max-2>a href#dom-meter-max>max/a>/code> content attribute must be set to that string./p> p>The dfn iddom-meter-low>code>low/code>/dfn> IDL attribute, on getting, must return the a href#concept-meter-low idthe-meter-element:concept-meter-low>low boundary/a>. On setting, the given value must be converted to the a href#best-representation-of-the-number-as-a-floating-point-number idthe-meter-element:best-representation-of-the-number-as-a-floating-point-number-4>best representation of the number as a floating-point number/a> and then the code idthe-meter-element:dom-meter-low-2>a href#dom-meter-low>low/a>/code> content attribute must be set to that string./p> p>The dfn iddom-meter-high>code>high/code>/dfn> IDL attribute, on getting, must return the a href#concept-meter-high idthe-meter-element:concept-meter-high>high boundary/a>. On setting, the given value must be converted to the a href#best-representation-of-the-number-as-a-floating-point-number idthe-meter-element:best-representation-of-the-number-as-a-floating-point-number-5>best representation of the number as a floating-point number/a> and then the code idthe-meter-element:dom-meter-high-2>a href#dom-meter-high>high/a>/code> content attribute must be set to that string./p> p>The dfn iddom-meter-optimum>code>optimum/code>/dfn> IDL attribute, on getting, must return the a href#concept-meter-optimum idthe-meter-element:concept-meter-optimum>optimum value/a>. On setting, the given value must be converted to the a href#best-representation-of-the-number-as-a-floating-point-number idthe-meter-element:best-representation-of-the-number-as-a-floating-point-number-6>best representation of the number as a floating-point number/a> and then the code idthe-meter-element:dom-meter-optimum-2>a href#dom-meter-optimum>optimum/a>/code> content attribute must be set to that string./p> p>The code idthe-meter-element:dom-lfe-labels-2>a href#dom-lfe-labels>labels/a>/code> IDL attribute provides a list of the elements code idthe-meter-element:the-label-element>a href#the-label-element>label/a>/code>s./p> div classexample> p>The following example shows how a gauge could fall back to localized or pretty-printed text./p> pre><p>Disk usage: <meter min0 value170261928 max233257824>170 261 928 bytes usedout of 233 257 824 bytes available</meter></p>/pre> /div> h4 idthe-fieldset-element>span classsecno>4.10.15/span> The dfn>code>fieldset/code>/dfn> elementa href#the-fieldset-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-fieldset-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-fieldset-element:flow-content-2>Flow content/a>.dd>a href#sectioning-root idthe-fieldset-element:sectioning-root>Sectioning root/a>.dd>a href#category-listed idthe-fieldset-element:category-listed>Listed/a> a href#form-associated-element idthe-fieldset-element:form-associated-element>form-associated element/a>.dd>a href#palpable-content-2 idthe-fieldset-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-fieldset-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-fieldset-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-fieldset-element:concept-element-content-model>Content model/a>:dd>Optionally a code idthe-fieldset-element:the-legend-element>a href#the-legend-element>legend/a>/code> element, followed by a href#flow-content-2 idthe-fieldset-element:flow-content-2-3>flow content/a>.dt>a href#concept-element-tag-omission idthe-fieldset-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-fieldset-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-fieldset-element:global-attributes>Global attributes/a>dd>code idthe-fieldset-element:attr-fieldset-disabled>a href#attr-fieldset-disabled>disabled/a>/code> — Whether the form control is disableddd>code idthe-fieldset-element:attr-fae-form>a href#attr-fae-form>form/a>/code> — Associates the control with a code idthe-fieldset-element:the-form-element>a href#the-form-element>form/a>/code> elementdd>code idthe-fieldset-element:attr-fe-name>a href#attr-fe-name>name/a>/code> — Name of form control to use in the code idthe-fieldset-element:dom-form-elements>a href#dom-form-elements>form.elements/a>/code> API dt>a href#concept-element-dom idthe-fieldset-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-fieldset-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlfieldsetelement>HTMLFieldSetElement/dfn> : a href#htmlelement idthe-fieldset-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-fieldset-element:cereactions>CEReactions/a> attribute boolean a href#dom-fieldset-disabled idthe-fieldset-element:dom-fieldset-disabled>disabled/a>; readonly attribute a href#htmlformelement idthe-fieldset-element:htmlformelement>HTMLFormElement/a>? a href#dom-fae-form idthe-fieldset-element:dom-fae-form>form/a>; a href#cereactions idthe-fieldset-element:cereactions-2>CEReactions/a> attribute DOMString a href#dom-fe-name idthe-fieldset-element:dom-fe-name>name/a>; readonly attribute DOMString a href#dom-fieldset-type idthe-fieldset-element:dom-fieldset-type>type/a>; SameObject readonly attribute a idthe-fieldset-element:htmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> a href#dom-fieldset-elements idthe-fieldset-element:dom-fieldset-elements>elements/a>; readonly attribute boolean a href#dom-cva-willvalidate idthe-fieldset-element:dom-cva-willvalidate>willValidate/a>; SameObject readonly attribute a href#validitystate idthe-fieldset-element:validitystate>ValidityState/a> a href#dom-cva-validity idthe-fieldset-element:dom-cva-validity>validity/a>; readonly attribute DOMString a href#dom-cva-validationmessage idthe-fieldset-element:dom-cva-validationmessage>validationMessage/a>; boolean a href#dom-cva-checkvalidity idthe-fieldset-element:dom-cva-checkvalidity>checkValidity/a>(); boolean a href#dom-cva-reportvalidity idthe-fieldset-element:dom-cva-reportvalidity>reportValidity/a>(); void a href#dom-cva-setcustomvalidity idthe-fieldset-element:dom-cva-setcustomvalidity>setCustomValidity/a>(DOMString error);};/pre> /dl> p>The code idthe-fieldset-element:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code> element a href#represents idthe-fieldset-element:represents>represents/a> a set of form controls optionally grouped under a common name./p> p>The name of the group is given by the first code idthe-fieldset-element:the-legend-element-2>a href#the-legend-element>legend/a>/code> element that is a child of the code idthe-fieldset-element:the-fieldset-element-2>a href#the-fieldset-element>fieldset/a>/code> element, if any. The remainder of the descendants form the group./p> p>The dfn idattr-fieldset-disabled>code>disabled/code>/dfn> attribute, when specified, causes all the form control descendants of the code idthe-fieldset-element:the-fieldset-element-3>a href#the-fieldset-element>fieldset/a>/code> element, excluding those that are descendants of the code idthe-fieldset-element:the-fieldset-element-4>a href#the-fieldset-element>fieldset/a>/code> elements first code idthe-fieldset-element:the-legend-element-3>a href#the-legend-element>legend/a>/code> element child, if any, to be a href#concept-fe-disabled idthe-fieldset-element:concept-fe-disabled>disabled/a>.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> fieldset-disabledspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>20+/span>/span>span classios_saf yes>span>iOS Safari/span> span>6.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>4+/span>/span>span classie partial>span>IE (limited)/span> span>6+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini partial>span>Opera Mini (limited)/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>6+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>4.4+/span>/span>span classopera yes>span>Opera/span> span>10.0+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featfieldset-disabled>caniuse.com/a>/div> p>A code idthe-fieldset-element:the-fieldset-element-5>a href#the-fieldset-element>fieldset/a>/code> element is a dfn idconcept-fieldset-disabled>disabled fieldset/dfn> if it matches any of the following conditions:/p> ul>li>Its code idthe-fieldset-element:attr-fieldset-disabled-2>a href#attr-fieldset-disabled>disabled/a>/code> attribute is specified li>It is a descendant of another code idthe-fieldset-element:the-fieldset-element-6>a href#the-fieldset-element>fieldset/a>/code> element whose code idthe-fieldset-element:attr-fieldset-disabled-3>a href#attr-fieldset-disabled>disabled/a>/code> attribute is specified, and is em>not/em> a descendant of that code idthe-fieldset-element:the-fieldset-element-7>a href#the-fieldset-element>fieldset/a>/code> elements first code idthe-fieldset-element:the-legend-element-4>a href#the-legend-element>legend/a>/code> element child, if any./ul> p>The code idthe-fieldset-element:attr-fae-form-2>a href#attr-fae-form>form/a>/code> attribute is used to explicitly associate the code idthe-fieldset-element:the-fieldset-element-8>a href#the-fieldset-element>fieldset/a>/code> element with its a href#form-owner idthe-fieldset-element:form-owner>form owner/a>. The code idthe-fieldset-element:attr-fe-name-2>a href#attr-fe-name>name/a>/code> attribute represents the elements name./p> dl classdomintro>dt>var>fieldset/var> . code idthe-fieldset-element:dom-fieldset-type-2>a href#dom-fieldset-type>type/a>/code>dd> p>Returns the string fieldset./p> dt>var>fieldset/var> . code idthe-fieldset-element:dom-fieldset-elements-2>a href#dom-fieldset-elements>elements/a>/code>dd> p>Returns an code idthe-fieldset-element:htmlcollection-2>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> of the form controls in the element./p> /dl> p>The dfn iddom-fieldset-disabled>code>disabled/code>/dfn> IDL attribute must a href#reflect idthe-fieldset-element:reflect>reflect/a> the content attribute of the same name./p> p>The dfn iddom-fieldset-type>code>type/code>/dfn> IDL attribute must return the string code>fieldset/code>./p> p>The dfn iddom-fieldset-elements>code>elements/code>/dfn> IDL attribute must return an code idthe-fieldset-element:htmlcollection-3>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> rooted at the code idthe-fieldset-element:the-fieldset-element-9>a href#the-fieldset-element>fieldset/a>/code> element, whose filter matches a href#category-listed idthe-fieldset-element:category-listed-2>listed elements/a>./p> p>The code idthe-fieldset-element:dom-cva-willvalidate-2>a href#dom-cva-willvalidate>willValidate/a>/code>, code idthe-fieldset-element:dom-cva-validity-2>a href#dom-cva-validity>validity/a>/code>, and code idthe-fieldset-element:dom-cva-validationmessage-2>a href#dom-cva-validationmessage>validationMessage/a>/code> attributes, and the code idthe-fieldset-element:dom-cva-checkvalidity-2>a href#dom-cva-checkvalidity>checkValidity()/a>/code>, code idthe-fieldset-element:dom-cva-reportvalidity-2>a href#dom-cva-reportvalidity>reportValidity()/a>/code>, and code idthe-fieldset-element:dom-cva-setcustomvalidity-2>a href#dom-cva-setcustomvalidity>setCustomValidity()/a>/code> methods, are part of the a href#the-constraint-validation-api idthe-fieldset-element:the-constraint-validation-api>constraint validation API/a>. The code idthe-fieldset-element:dom-fae-form-2>a href#dom-fae-form>form/a>/code> and code idthe-fieldset-element:dom-fe-name-2>a href#dom-fe-name>name/a>/code> IDL attributes are part of the elements forms API./p> div classexample> p>This example shows a code idthe-fieldset-element:the-fieldset-element-10>a href#the-fieldset-element>fieldset/a>/code> element being used to group a set of related controls:/p> pre><fieldset> <legend>Display</legend> <p><label><input typeradio namec value0 checked> Black on White</label> <p><label><input typeradio namec value1> White on Black</label> <p><label><input typecheckbox nameg> Use grayscale</label> <p><label>Enhance contrast <input typerange namee listcontrast min0 max100 value0 step1></label> <datalist idcontrast> <option labelNormal value0> <option labelMaximum value100> </datalist></fieldset>/pre> /div> div classexample> p>The following snippet shows a fieldset with a checkbox in the legend that controls whether or not the fieldset is enabled. The contents of the fieldset consist of two required text controls and an optional year/month control./p> pre><fieldset nameclubfields disabled> <legend> <label> <input typecheckbox nameclub onchangeform.clubfields.disabled !checked> Use Club Card </label> </legend> <p><label>Name on card: <input nameclubname required></label></p> <p><label>Card number: <input nameclubnum required pattern-0-9+></label></p> <p><label>Expiry date: <input nameclubexp typemonth></label></p></fieldset>/pre> /div> div classexample> p>You can also nest code idthe-fieldset-element:the-fieldset-element-11>a href#the-fieldset-element>fieldset/a>/code> elements. Here is an example expanding on the previous one that does so:/p> pre><fieldset nameclubfields disabled> <legend> <label> <input typecheckbox nameclub onchangeform.clubfields.disabled !checked> Use Club Card </label> </legend> <p><label>Name on card: <input nameclubname required></label></p> <fieldset namenumfields> <legend> <label> <input typeradio checked nameclubtype onchangeform.numfields.disabled !checked> My card has numbers on it </label> </legend> <p><label>Card number: <input nameclubnum required pattern-0-9+></label></p> </fieldset> <fieldset nameletfields disabled> <legend> <label> <input typeradio nameclubtype onchangeform.letfields.disabled !checked> My card has letters on it </label> </legend> <p><label>Card code: <input nameclublet required patternA-Za-z+></label></p> </fieldset></fieldset>/pre> p>In this example, if the outer Use Club Card checkbox is not checked, everything inside the outer code idthe-fieldset-element:the-fieldset-element-12>a href#the-fieldset-element>fieldset/a>/code>, including the two radio buttons in the legends of the two nested code idthe-fieldset-element:the-fieldset-element-13>a href#the-fieldset-element>fieldset/a>/code>s, will be disabled. However, if the checkbox is checked, then the radio buttons will both be enabled and will let you select which of the two inner code idthe-fieldset-element:the-fieldset-element-14>a href#the-fieldset-element>fieldset/a>/code>s is to be enabled./p> /div> h4 idthe-legend-element>span classsecno>4.10.16/span> The dfn>code>legend/code>/dfn> elementa href#the-legend-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-legend-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-legend-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As the a idthe-legend-element:first-child hrefhttps://dom.spec.whatwg.org/#concept-tree-first-child data-x-internalfirst-child>first child/a> of a code idthe-legend-element:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code> element.dt>a href#concept-element-content-model idthe-legend-element:concept-element-content-model>Content model/a>:dd>a href#phrasing-content-2 idthe-legend-element:phrasing-content-2>Phrasing content/a>.dt>a href#concept-element-tag-omission idthe-legend-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-legend-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-legend-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-legend-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-legend-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmllegendelement>HTMLLegendElement/dfn> : a href#htmlelement idthe-legend-element:htmlelement>HTMLElement/a> { readonly attribute a href#htmlformelement idthe-legend-element:htmlformelement>HTMLFormElement/a>? a href#dom-legend-form idthe-legend-element:dom-legend-form>form/a>; // a href#HTMLLegendElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-legend-element:the-legend-element>a href#the-legend-element>legend/a>/code> element a href#represents idthe-legend-element:represents>represents/a> a caption for the rest of the contents of the code idthe-legend-element:the-legend-element-2>a href#the-legend-element>legend/a>/code> elements parent code idthe-legend-element:the-fieldset-element-2>a href#the-fieldset-element>fieldset/a>/code> element, if any./p> dl classdomintro>dt>var>legend/var> . code idthe-legend-element:dom-legend-form-2>a href#dom-legend-form>form/a>/code>dd> p>Returns the elements code idthe-legend-element:the-form-element>a href#the-form-element>form/a>/code> element, if any, or null otherwise./p> /dl> p>The dfn iddom-legend-form>code>form/code>/dfn> IDL attributes behavior depends on whether the code idthe-legend-element:the-legend-element-3>a href#the-legend-element>legend/a>/code> element is in a code idthe-legend-element:the-fieldset-element-3>a href#the-fieldset-element>fieldset/a>/code> element or not. If the code idthe-legend-element:the-legend-element-4>a href#the-legend-element>legend/a>/code> has a code idthe-legend-element:the-fieldset-element-4>a href#the-fieldset-element>fieldset/a>/code> element as its parent, then the code idthe-legend-element:dom-legend-form-3>a href#dom-legend-form>form/a>/code> IDL attribute must return the same value as the code idthe-legend-element:dom-fae-form>a href#dom-fae-form>form/a>/code> IDL attribute on that code idthe-legend-element:the-fieldset-element-5>a href#the-fieldset-element>fieldset/a>/code> element. Otherwise, it must return null./p> h4 idform-control-infrastructure>span classsecno>4.10.17/span> Form control infrastructurea href#form-control-infrastructure classself-link>/a>/h4> h5 ida-form-controls-value>span classsecno>4.10.17.1/span> A form controls valuea href#a-form-controls-value classself-link>/a>/h5> p>Most form controls have a dfn idconcept-fe-value>value/dfn> and a dfn idconcept-fe-checked>checkedness/dfn>. (The latter is only used by code ida-form-controls-value:the-input-element>a href#the-input-element>input/a>/code> elements.) These are used to describe how the user interacts with the control./p> p>A controls a href#concept-fe-value ida-form-controls-value:concept-fe-value>value/a> is its internal state. As such, it might not match the users current input./p> p classexample>For instance, if a user enters the word kbd>three/kbd> into a href#number-state-(typenumber) ida-form-controls-value:number-state-(typenumber)>a numeric field/a> that expects digits, the users input would be the string three but the controls a href#concept-fe-value ida-form-controls-value:concept-fe-value-2>value/a> would remain unchanged. Or, if a user enters the email address kbd> awesome@example.com/kbd> (with leading whitespace) into a href#e-mail-state-(typeemail) ida-form-controls-value:e-mail-state-(typeemail)>an email field/a>, the users input would be the string awesome@example.com but the browsers UI for email fields might translate that into a a href#concept-fe-value ida-form-controls-value:concept-fe-value-3>value/a> of code>awesome@example.com/code> (without the leading whitespace)./p> p idconcept-input-value-dirty-flag>span idconcept-textarea-dirty>/span>code ida-form-controls-value:the-input-element-2>a href#the-input-element>input/a>/code> and code ida-form-controls-value:the-textarea-element>a href#the-textarea-element>textarea/a>/code> elements have a dfn idconcept-fe-dirty>dirty value flag/dfn>. This is used to track the interaction between the a href#concept-fe-value ida-form-controls-value:concept-fe-value-4>value/a> and default value. If it is false, a href#concept-fe-value ida-form-controls-value:concept-fe-value-5>value/a> mirrors the default value. If it is true, the default value is ignored./p> p>To define the behavior of constraint validation in the face of the code ida-form-controls-value:the-input-element-3>a href#the-input-element>input/a>/code> elements code ida-form-controls-value:attr-input-multiple>a href#attr-input-multiple>multiple/a>/code> attribute, code ida-form-controls-value:the-input-element-4>a href#the-input-element>input/a>/code> elements can also have separately defined dfn idconcept-fe-values>valueem>s/em>/dfn>./p> p>To define the behavior of the code ida-form-controls-value:attr-fe-maxlength>a href#attr-fe-maxlength>maxlength/a>/code> and code ida-form-controls-value:attr-fe-minlength>a href#attr-fe-minlength>minlength/a>/code> attributes, as well as other APIs specific to the code ida-form-controls-value:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code> element, all form control with a a href#concept-fe-value ida-form-controls-value:concept-fe-value-6>value/a> also have an algorithm for obtaining an span idconcept-textarea-api-value>/span>dfn idconcept-fe-api-value>API value/dfn>. By default this algorithm is to simply return the controls a href#concept-fe-value ida-form-controls-value:concept-fe-value-7>value/a>./p> p>The code ida-form-controls-value:the-select-element>a href#the-select-element>select/a>/code> element does not have a a href#concept-fe-value ida-form-controls-value:concept-fe-value-8>value/a>; the a href#concept-option-selectedness ida-form-controls-value:concept-option-selectedness>selectedness/a> of its code ida-form-controls-value:the-option-element>a href#the-option-element>option/a>/code> elements is what is used instead./p> h5 idmutability>span classsecno>4.10.17.2/span> Mutabilitya href#mutability classself-link>/a>/h5> p>A form control can be designated as dfn idconcept-fe-mutable>i>mutable/i>/dfn>./p> p classnote>This determines (by means of definitions and requirements in this specification that rely on whether an element is so designated) whether or not the user can modify the a href#concept-fe-value idmutability:concept-fe-value>value/a> or a href#concept-fe-checked idmutability:concept-fe-checked>checkedness/a> of a form control, or whether or not a control can be automatically prefilled./p> h5 idassociation-of-controls-and-forms>span classsecno>4.10.17.3/span> Association of controls and formsa href#association-of-controls-and-forms classself-link>/a>/h5> p>A a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element>form-associated element/a> can have a relationship with a code idassociation-of-controls-and-forms:the-form-element>a href#the-form-element>form/a>/code> element, which is called the elements dfn idform-owner>form owner/dfn>. If a a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-2>form-associated element/a> is not associated with a code idassociation-of-controls-and-forms:the-form-element-2>a href#the-form-element>form/a>/code> element, its a href#form-owner idassociation-of-controls-and-forms:form-owner>form owner/a> is said to be null./p> p>A a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-3>form-associated element/a> has an associated dfn idparser-inserted-flag>parser inserted flag/dfn>./p> p>A a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-4>form-associated element/a> is, by default, associated with its nearest ancestor code idassociation-of-controls-and-forms:the-form-element-3>a href#the-form-element>form/a>/code> element (as described below), but, if it is a href#category-listed idassociation-of-controls-and-forms:category-listed>listed/a>, may have a dfn idattr-fae-form>code>form/code>/dfn> attribute specified to override this.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> form-attributespan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>10+/span>/span>span classios_saf yes>span>iOS Safari/span> span>5.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>4+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>5.1+/span>/span>span classedge yes>span>Edge/span> span>16+/span>/span>span classandroid yes>span>Android Browser/span> span>3+/span>/span>span classopera yes>span>Opera/span> span>9.5+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featform-attribute>caniuse.com/a>/div> p classnote>This feature allows authors to work around the lack of support for nested code idassociation-of-controls-and-forms:the-form-element-4>a href#the-form-element>form/a>/code> elements./p> p>If a a href#category-listed idassociation-of-controls-and-forms:category-listed-2>listed/a> a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-5>form-associated element/a> has a code idassociation-of-controls-and-forms:attr-fae-form>a href#attr-fae-form>form/a>/code> attribute specified, then that attributes value must be the a hrefhttps://dom.spec.whatwg.org/#concept-id idassociation-of-controls-and-forms:concept-id data-x-internalconcept-id>ID/a> of a code idassociation-of-controls-and-forms:the-form-element-5>a href#the-form-element>form/a>/code> element in the elements a idassociation-of-controls-and-forms:tree hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a>./p> p classnote>The rules in this section are complicated by the fact that although conforming documents or a hrefhttps://dom.spec.whatwg.org/#concept-tree idassociation-of-controls-and-forms:tree-2 data-x-internaltree>trees/a> will never contain nested code idassociation-of-controls-and-forms:the-form-element-6>a href#the-form-element>form/a>/code> elements, it is quite possible (e.g., using a script that performs DOM manipulation) to generate a hrefhttps://dom.spec.whatwg.org/#concept-tree idassociation-of-controls-and-forms:tree-3 data-x-internaltree>trees/a> that have such nested elements. They are also complicated by rules in the HTML parser that, for historical reasons, can result in a a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-6>form-associated element/a> being associated with a code idassociation-of-controls-and-forms:the-form-element-7>a href#the-form-element>form/a>/code> element that is not its ancestor./p> p>When a a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-7>form-associated element/a> is created, its a href#form-owner idassociation-of-controls-and-forms:form-owner-2>form owner/a> must be initialized to null (no owner)./p> p>When a a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-8>form-associated element/a> is to be dfn idconcept-form-association>associated/dfn> with a form, its a href#form-owner idassociation-of-controls-and-forms:form-owner-3>form owner/a> must be set to that form./p> p>When a a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-9>form-associated element/a> or one of its ancestors a href#nodes-are-inserted idassociation-of-controls-and-forms:nodes-are-inserted>is inserted/a>, then: ol>li>p>If the a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-10>form-associated element/a>s a href#parser-inserted-flag idassociation-of-controls-and-forms:parser-inserted-flag>parser inserted flag/a> is set, then return. li>p>a href#reset-the-form-owner idassociation-of-controls-and-forms:reset-the-form-owner>Reset the form owner/a> of the a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-11>form-associated element/a>./ol> p>When a a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-12>form-associated element/a> or one of its ancestors a href#nodes-are-removed idassociation-of-controls-and-forms:nodes-are-removed>is removed/a>, then: ol>li>p>If the a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-13>form-associated element/a> has a a href#form-owner idassociation-of-controls-and-forms:form-owner-4>form owner/a> and the a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-14>form-associated element/a> and its a href#form-owner idassociation-of-controls-and-forms:form-owner-5>form owner/a> are no longer in the same a idassociation-of-controls-and-forms:tree-4 hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a>, then a href#reset-the-form-owner idassociation-of-controls-and-forms:reset-the-form-owner-2>reset the form owner/a> of the a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-15>form-associated element/a>./ol> p>When a a href#category-listed idassociation-of-controls-and-forms:category-listed-3>listed/a> a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-16>form-associated element/a>s code idassociation-of-controls-and-forms:attr-fae-form-2>a href#attr-fae-form>form/a>/code> attribute is set, changed, or removed, then the user agent must a href#reset-the-form-owner idassociation-of-controls-and-forms:reset-the-form-owner-3>reset the form owner/a> of that element./p> p>When a a href#category-listed idassociation-of-controls-and-forms:category-listed-4>listed/a> a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-17>form-associated element/a> has a code idassociation-of-controls-and-forms:attr-fae-form-3>a href#attr-fae-form>form/a>/code> attribute and the a hrefhttps://dom.spec.whatwg.org/#concept-id idassociation-of-controls-and-forms:concept-id-2 data-x-internalconcept-id>ID/a> of any of the elements in the a idassociation-of-controls-and-forms:tree-5 hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a> changes, then the user agent must a href#reset-the-form-owner idassociation-of-controls-and-forms:reset-the-form-owner-4>reset the form owner/a> of that a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-18>form-associated element/a>./p> p>When a a href#category-listed idassociation-of-controls-and-forms:category-listed-5>listed/a> a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-19>form-associated element/a> has a code idassociation-of-controls-and-forms:attr-fae-form-4>a href#attr-fae-form>form/a>/code> attribute and an element with an a hrefhttps://dom.spec.whatwg.org/#concept-id idassociation-of-controls-and-forms:concept-id-3 data-x-internalconcept-id>ID/a> is a href#insert-an-element-into-a-document idassociation-of-controls-and-forms:insert-an-element-into-a-document>inserted into/a> or a href#remove-an-element-from-a-document idassociation-of-controls-and-forms:remove-an-element-from-a-document>removed from/a> the code idassociation-of-controls-and-forms:document>a href#document>Document/a>/code>, then the user agent must a href#reset-the-form-owner idassociation-of-controls-and-forms:reset-the-form-owner-5>reset the form owner/a> of that a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-20>form-associated element/a>./p> p>When the user agent is to dfn idreset-the-form-owner>reset the form owner/dfn> of a a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-21>form-associated element/a> var>element/var>, it must run the following steps:/p> ol>li>p>Unset var>element/var>s a href#parser-inserted-flag idassociation-of-controls-and-forms:parser-inserted-flag-2>parser inserted flag/a>.li> p>If all of the following conditions are true ul classbrief>li>var>element/var>s a href#form-owner idassociation-of-controls-and-forms:form-owner-6>form owner/a> is not null li>var>element/var> is not a href#category-listed idassociation-of-controls-and-forms:category-listed-6>listed/a> or its code idassociation-of-controls-and-forms:attr-fae-form-5>a href#attr-fae-form>form/a>/code> content attribute is not present li>var>element/var>s a href#form-owner idassociation-of-controls-and-forms:form-owner-7>form owner/a> is its nearest code idassociation-of-controls-and-forms:the-form-element-8>a href#the-form-element>form/a>/code> element ancestor after the change to the ancestor chain /ul> p>then do nothing, and abort these steps./p> li>p>Set var>element/var>s a href#form-owner idassociation-of-controls-and-forms:form-owner-8>form owner/a> to null.li> p>If var>element/var> is a href#category-listed idassociation-of-controls-and-forms:category-listed-7>listed/a>, has a code idassociation-of-controls-and-forms:attr-fae-form-6>a href#attr-fae-form>form/a>/code> content attribute, and is a idassociation-of-controls-and-forms:connected hrefhttps://dom.spec.whatwg.org/#connected data-x-internalconnected>connected/a>, then:/p> ol>li>p>If the first element in var>element/var>s a idassociation-of-controls-and-forms:tree-6 hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a>, in a idassociation-of-controls-and-forms:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>, to have an a hrefhttps://dom.spec.whatwg.org/#concept-id idassociation-of-controls-and-forms:concept-id-4 data-x-internalconcept-id>ID/a> that is a href#case-sensitive idassociation-of-controls-and-forms:case-sensitive>case-sensitively/a> equal to var>element/var>s code idassociation-of-controls-and-forms:attr-fae-form-7>a href#attr-fae-form>form/a>/code> content attributes value, is a code idassociation-of-controls-and-forms:the-form-element-9>a href#the-form-element>form/a>/code> element, then a href#concept-form-association idassociation-of-controls-and-forms:concept-form-association>associate/a> the var>element/var> with that code idassociation-of-controls-and-forms:the-form-element-10>a href#the-form-element>form/a>/code> element./ol> li>p>Otherwise, if var>element/var> has an ancestor code idassociation-of-controls-and-forms:the-form-element-11>a href#the-form-element>form/a>/code> element, then a href#concept-form-association idassociation-of-controls-and-forms:concept-form-association-2>associate/a> var>element/var> with the nearest such ancestor code idassociation-of-controls-and-forms:the-form-element-12>a href#the-form-element>form/a>/code> element./ol> div classexample> p>In the following non-conforming snippet:/p> pre classbad>... <form ida> <div idb></div> </form> <script> document.getElementById(b).innerHTML <table><tr><td></form><form idc><input idd></table> + <input ide>; </script>.../pre> p>The a href#form-owner idassociation-of-controls-and-forms:form-owner-9>form owner/a> of d would be the inner nested form c, while the a href#form-owner idassociation-of-controls-and-forms:form-owner-10>form owner/a> of e would be the outer form a./p> p>This happens as follows: First, the e node gets associated with c in the a href#html-parser idassociation-of-controls-and-forms:html-parser>HTML parser/a>. Then, the code idassociation-of-controls-and-forms:dom-innerhtml>a data-x-internaldom-innerhtml hrefhttps://w3c.github.io/DOM-Parsing/#dom-element-innerhtml>innerHTML/a>/code> algorithm moves the nodes from the temporary document to the b element. At this point, the nodes see their ancestor chain change, and thus all the magic associations done by the parser are reset to normal ancestor associations./p> p>This example is a non-conforming document, though, as it is a violation of the content models to nest code idassociation-of-controls-and-forms:the-form-element-13>a href#the-form-element>form/a>/code> elements, and there is a a href#parse-errors idassociation-of-controls-and-forms:parse-errors>parse error/a> for the code></form>/code> tag./p> /div> dl classdomintro>dt>var>element/var> . code idassociation-of-controls-and-forms:dom-fae-form>a href#dom-fae-form>form/a>/code>dd> p>Returns the elements a href#form-owner idassociation-of-controls-and-forms:form-owner-11>form owner/a>./p> p>Returns null if there isnt one./p> /dl> p>a href#category-listed idassociation-of-controls-and-forms:category-listed-8>Listed/a> a href#form-associated-element idassociation-of-controls-and-forms:form-associated-element-22>form-associated elements/a> have a dfn iddom-fae-form>code>form/code>/dfn> IDL attribute, which, on getting, must return the elements a href#form-owner idassociation-of-controls-and-forms:form-owner-12>form owner/a>, or null if there isnt one./p> h4 idattributes-common-to-form-controls>span classsecno>4.10.18/span> Attributes common to form controlsa href#attributes-common-to-form-controls classself-link>/a>/h4> h5 idnaming-form-controls:-the-name-attribute>span classsecno>4.10.18.1/span> Naming form controls: the code idnaming-form-controls:-the-name-attribute:attr-fe-name>a href#attr-fe-name>name/a>/code> attributea href#naming-form-controls:-the-name-attribute classself-link>/a>/h5> p>The dfn idattr-fe-name>code>name/code>/dfn> content attribute gives the name of the form control, as used in a href#form-submission-2 idnaming-form-controls:-the-name-attribute:form-submission-2>form submission/a> and in the code idnaming-form-controls:-the-name-attribute:the-form-element>a href#the-form-element>form/a>/code> elements code idnaming-form-controls:-the-name-attribute:dom-form-elements>a href#dom-form-elements>elements/a>/code> object. If the attribute is specified, its value must not be the empty string or code>isindex/code>./p> p classnote>A number of user agents historically implemented special support for first-in-form text controls with the name code>isindex/code>, and this specification previously defined related user agent requirements for it. However, some user agents subsequently dropped that special support, and the related requirements were removed from this specification. So, to avoid problematic reinterpretations in legacy user agents, the name code>isindex/code> is no longer allowed./p> p>Other than code>isindex/code>, any non-empty value for code idnaming-form-controls:-the-name-attribute:attr-form-name>a href#attr-form-name>name/a>/code> is allowed. The name dfn idattr-fe-name-charset>code>_charset_/code>/dfn> is special: if used as the name of a a href#hidden-state-(typehidden) idnaming-form-controls:-the-name-attribute:hidden-state-(typehidden)>Hidden/a> control with no code idnaming-form-controls:-the-name-attribute:attr-input-value>a href#attr-input-value>value/a>/code> attribute, then during submission the code idnaming-form-controls:-the-name-attribute:attr-input-value-2>a href#attr-input-value>value/a>/code> attribute is automatically given a value consisting of the submission character encoding./p> p>The dfn iddom-fe-name>code>name/code>/dfn> IDL attribute must a href#reflect idnaming-form-controls:-the-name-attribute:reflect>reflect/a> the code idnaming-form-controls:-the-name-attribute:attr-fe-name-2>a href#attr-fe-name>name/a>/code> content attribute./p> h5 idsubmitting-element-directionality:-the-dirname-attribute>span classsecno>4.10.18.2/span> Submitting element directionality: the code idsubmitting-element-directionality:-the-dirname-attribute:attr-fe-dirname>a href#attr-fe-dirname>dirname/a>/code> attributea href#submitting-element-directionality:-the-dirname-attribute classself-link>/a>/h5> p>The dfn idattr-fe-dirname>code>dirname/code>/dfn> attribute on a form control element enables the submission of a href#the-directionality idsubmitting-element-directionality:-the-dirname-attribute:the-directionality>the directionality/a> of the element, and gives the name of the control that contains this value during a href#form-submission-2 idsubmitting-element-directionality:-the-dirname-attribute:form-submission-2>form submission/a>. If such an attribute is specified, its value must not be the empty string./p> div classexample> p>In this example, a form contains a text control and a submission button:/p> pre><form actionaddcomment.cgi methodpost> <p><label>Comment: <input typetext namecomment dirnamecomment.dir required></label></p> <p><button namemode typesubmit valueadd>Post Comment</button></p></form>/pre> p>When the user submits the form, the user agent includes three fields, one called comment, one called comment.dir, and one called mode; so if the user types Hello, the submission body might be something like:/p> pre>commentHello&strong>comment.dirltr/strong>&modeadd/pre> p>If the user manually switches to a right-to-left writing direction and enters span dirrtl langar>مرحبا/span>, the submission body might be something like:/p> pre>comment%D9%85%D8%B1%D8%AD%D8%A8%D8%A7&strong>comment.dirrtl/strong>&modeadd/pre> /div> h5 idlimiting-user-input-length:-the-maxlength-attribute>span classsecno>4.10.18.3/span> Limiting user input length: the code idlimiting-user-input-length:-the-maxlength-attribute:attr-fe-maxlength>a href#attr-fe-maxlength>maxlength/a>/code> attributea href#limiting-user-input-length:-the-maxlength-attribute classself-link>/a>/h5> p>A dfn idattr-fe-maxlength>form control code>maxlength/code> attribute/dfn>, controlled by the a href#concept-fe-dirty idlimiting-user-input-length:-the-maxlength-attribute:concept-fe-dirty>dirty value flag/a>, declares a limit on the number of characters a user can input. The number of characters is measured using a idlimiting-user-input-length:-the-maxlength-attribute:javascript-string-length hrefhttps://infra.spec.whatwg.org/#javascript-string-length data-x-internaljavascript-string-length>JavaScript string length/a> and, in the case of code idlimiting-user-input-length:-the-maxlength-attribute:the-textarea-element>a href#the-textarea-element>textarea/a>/code> elements, with all newlines normalized to a single character (as opposed to CRLF pairs)./p> p>If an element has its a href#attr-fe-maxlength idlimiting-user-input-length:-the-maxlength-attribute:attr-fe-maxlength-2>form control code>maxlength/code> attribute/a> specified, the attributes value must be a a href#valid-non-negative-integer idlimiting-user-input-length:-the-maxlength-attribute:valid-non-negative-integer>valid non-negative integer/a>. If the attribute is specified and applying the a href#rules-for-parsing-non-negative-integers idlimiting-user-input-length:-the-maxlength-attribute:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers/a> to its value results in a number, then that number is the elements dfn idmaximum-allowed-value-length>maximum allowed value length/dfn>. If the attribute is omitted or parsing its value results in an error, then there is no a href#maximum-allowed-value-length idlimiting-user-input-length:-the-maxlength-attribute:maximum-allowed-value-length>maximum allowed value length/a>./p> p>strong>Constraint validation/strong>: If an element has a a href#maximum-allowed-value-length idlimiting-user-input-length:-the-maxlength-attribute:maximum-allowed-value-length-2>maximum allowed value length/a>, its a href#concept-fe-dirty idlimiting-user-input-length:-the-maxlength-attribute:concept-fe-dirty-2>dirty value flag/a> is true, its a href#concept-fe-value idlimiting-user-input-length:-the-maxlength-attribute:concept-fe-value>value/a> was last changed by a user edit (as opposed to a change made by a script), and the a idlimiting-user-input-length:-the-maxlength-attribute:javascript-string-length-2 hrefhttps://infra.spec.whatwg.org/#javascript-string-length data-x-internaljavascript-string-length>JavaScript string length/a> of the elements a href#concept-fe-api-value idlimiting-user-input-length:-the-maxlength-attribute:concept-fe-api-value>API value/a> is greater than the elements a href#maximum-allowed-value-length idlimiting-user-input-length:-the-maxlength-attribute:maximum-allowed-value-length-3>maximum allowed value length/a>, then the element is a href#suffering-from-being-too-long idlimiting-user-input-length:-the-maxlength-attribute:suffering-from-being-too-long>suffering from being too long/a>./p> p>User agents may prevent the user from causing the elements a href#concept-fe-api-value idlimiting-user-input-length:-the-maxlength-attribute:concept-fe-api-value-2>API value/a> to be set to a value whose a idlimiting-user-input-length:-the-maxlength-attribute:javascript-string-length-3 hrefhttps://infra.spec.whatwg.org/#javascript-string-length data-x-internaljavascript-string-length>JavaScript string length/a> is greater than the elements a href#maximum-allowed-value-length idlimiting-user-input-length:-the-maxlength-attribute:maximum-allowed-value-length-4>maximum allowed value length/a>./p> p classnote>In the case of code idlimiting-user-input-length:-the-maxlength-attribute:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code> elements, the a href#concept-fe-api-value idlimiting-user-input-length:-the-maxlength-attribute:concept-fe-api-value-3>API value/a> and a href#concept-fe-value idlimiting-user-input-length:-the-maxlength-attribute:concept-fe-value-2>value/a> differ. In particular, the a href#textarea-line-break-normalisation-transformation idlimiting-user-input-length:-the-maxlength-attribute:textarea-line-break-normalisation-transformation>textarea line break normalization transformation/a> is applied before the a href#maximum-allowed-value-length idlimiting-user-input-length:-the-maxlength-attribute:maximum-allowed-value-length-5>maximum allowed value length/a> is checked (whereas the a href#textarea-wrapping-transformation idlimiting-user-input-length:-the-maxlength-attribute:textarea-wrapping-transformation>textarea wrapping transformation/a> is not applied)./p> h5 idsetting-minimum-input-length-requirements:-the-minlength-attribute>span classsecno>4.10.18.4/span> Setting minimum input length requirements: the code idsetting-minimum-input-length-requirements:-the-minlength-attribute:attr-fe-minlength>a href#attr-fe-minlength>minlength/a>/code> attributea href#setting-minimum-input-length-requirements:-the-minlength-attribute classself-link>/a>/h5> p>A dfn idattr-fe-minlength>form control code>minlength/code> attribute/dfn>, controlled by the a href#concept-fe-dirty idsetting-minimum-input-length-requirements:-the-minlength-attribute:concept-fe-dirty>dirty value flag/a>, declares a lower bound on the number of characters a user can input. The number of characters is measured using a idsetting-minimum-input-length-requirements:-the-minlength-attribute:javascript-string-length hrefhttps://infra.spec.whatwg.org/#javascript-string-length data-x-internaljavascript-string-length>JavaScript string length/a> and, in the case of code idsetting-minimum-input-length-requirements:-the-minlength-attribute:the-textarea-element>a href#the-textarea-element>textarea/a>/code> elements, with all newlines normalized to a single character (as opposed to CRLF pairs)./p> p classnote>The code idsetting-minimum-input-length-requirements:-the-minlength-attribute:attr-fe-minlength-2>a href#attr-fe-minlength>minlength/a>/code> attribute does not imply the code>required/code> attribute. If the form control has no code>required/code> attribute, then the value can still be omitted; the code idsetting-minimum-input-length-requirements:-the-minlength-attribute:attr-fe-minlength-3>a href#attr-fe-minlength>minlength/a>/code> attribute only kicks in once the user has entered a value at all. If the empty string is not allowed, then the code>required/code> attribute also needs to be set./p> p>If an element has its a href#attr-fe-minlength idsetting-minimum-input-length-requirements:-the-minlength-attribute:attr-fe-minlength-4>form control code>minlength/code> attribute/a> specified, the attributes value must be a a href#valid-non-negative-integer idsetting-minimum-input-length-requirements:-the-minlength-attribute:valid-non-negative-integer>valid non-negative integer/a>. If the attribute is specified and applying the a href#rules-for-parsing-non-negative-integers idsetting-minimum-input-length-requirements:-the-minlength-attribute:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers/a> to its value results in a number, then that number is the elements dfn idminimum-allowed-value-length>minimum allowed value length/dfn>. If the attribute is omitted or parsing its value results in an error, then there is no a href#minimum-allowed-value-length idsetting-minimum-input-length-requirements:-the-minlength-attribute:minimum-allowed-value-length>minimum allowed value length/a>./p> p>If an element has both a a href#maximum-allowed-value-length idsetting-minimum-input-length-requirements:-the-minlength-attribute:maximum-allowed-value-length>maximum allowed value length/a> and a a href#minimum-allowed-value-length idsetting-minimum-input-length-requirements:-the-minlength-attribute:minimum-allowed-value-length-2>minimum allowed value length/a>, the a href#minimum-allowed-value-length idsetting-minimum-input-length-requirements:-the-minlength-attribute:minimum-allowed-value-length-3>minimum allowed value length/a> must be smaller than or equal to the a href#maximum-allowed-value-length idsetting-minimum-input-length-requirements:-the-minlength-attribute:maximum-allowed-value-length-2>maximum allowed value length/a>./p> p>strong>Constraint validation/strong>: If an element has a a href#minimum-allowed-value-length idsetting-minimum-input-length-requirements:-the-minlength-attribute:minimum-allowed-value-length-4>minimum allowed value length/a>, its a href#concept-fe-dirty idsetting-minimum-input-length-requirements:-the-minlength-attribute:concept-fe-dirty-2>dirty value flag/a> is true, its a href#concept-fe-value idsetting-minimum-input-length-requirements:-the-minlength-attribute:concept-fe-value>value/a> was last changed by a user edit (as opposed to a change made by a script), its a href#concept-fe-value idsetting-minimum-input-length-requirements:-the-minlength-attribute:concept-fe-value-2>value/a> is not the empty string, and the a idsetting-minimum-input-length-requirements:-the-minlength-attribute:javascript-string-length-2 hrefhttps://infra.spec.whatwg.org/#javascript-string-length data-x-internaljavascript-string-length>JavaScript string length/a> of the elements a href#concept-fe-api-value idsetting-minimum-input-length-requirements:-the-minlength-attribute:concept-fe-api-value>API value/a> is less than the elements a href#minimum-allowed-value-length idsetting-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 idsetting-minimum-input-length-requirements:-the-minlength-attribute:suffering-from-being-too-short>suffering from being too short/a>./p> div classexample> p>In this example, there are four text controls. The first is required, and has to be at least 5 characters long. The other three are optional, but if the user fills one in, the user has to enter at least 10 characters./p> pre><form action/events/menu.cgi methodpost> <p><label>Name of Event: <input required minlength5 maxlength50 nameevent></label></p> <p><label>Describe what you would like for breakfast, if anything: <textarea namebreakfast minlength10></textarea></label></p> <p><label>Describe what you would like for lunch, if anything: <textarea namelunch minlength10></textarea></label></p> <p><label>Describe what you would like for dinner, if anything: <textarea namedinner minlength10></textarea></label></p> <p><input typesubmit valueSubmit Request></p></form>/pre> /div> h5 idenabling-and-disabling-form-controls:-the-disabled-attribute>span classsecno>4.10.18.5/span> Enabling and disabling form controls: the code idenabling-and-disabling-form-controls:-the-disabled-attribute:attr-fe-disabled>a href#attr-fe-disabled>disabled/a>/code> attributea href#enabling-and-disabling-form-controls:-the-disabled-attribute classself-link>/a>/h5> p>The dfn idattr-fe-disabled>code>disabled/code>/dfn> content attribute is a a href#boolean-attribute idenabling-and-disabling-form-controls:-the-disabled-attribute:boolean-attribute>boolean attribute/a>./p> p>A form control is dfn idconcept-fe-disabled>disabled/dfn> if any of the following conditions are met:/p> ol>li>The element is a code idenabling-and-disabling-form-controls:-the-disabled-attribute:the-button-element>a href#the-button-element>button/a>/code>, code idenabling-and-disabling-form-controls:-the-disabled-attribute:the-input-element>a href#the-input-element>input/a>/code>, code idenabling-and-disabling-form-controls:-the-disabled-attribute:the-select-element>a href#the-select-element>select/a>/code>, or code idenabling-and-disabling-form-controls:-the-disabled-attribute:the-textarea-element>a href#the-textarea-element>textarea/a>/code> element, and the code idenabling-and-disabling-form-controls:-the-disabled-attribute:attr-fe-disabled-2>a href#attr-fe-disabled>disabled/a>/code> attribute is specified on this element (regardless of its value).li>The element is a descendant of a code idenabling-and-disabling-form-controls:-the-disabled-attribute:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code> element whose code idenabling-and-disabling-form-controls:-the-disabled-attribute:attr-fieldset-disabled>a href#attr-fieldset-disabled>disabled/a>/code> attribute is specified, and is em>not/em> a descendant of that code idenabling-and-disabling-form-controls:-the-disabled-attribute:the-fieldset-element-2>a href#the-fieldset-element>fieldset/a>/code> elements first code idenabling-and-disabling-form-controls:-the-disabled-attribute:the-legend-element>a href#the-legend-element>legend/a>/code> element child, if any./ol> p>A form control that is a href#concept-fe-disabled idenabling-and-disabling-form-controls:-the-disabled-attribute:concept-fe-disabled>disabled/a> must prevent any code idenabling-and-disabling-form-controls:-the-disabled-attribute:event-click>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> events that are a href#queue-a-task idenabling-and-disabling-form-controls:-the-disabled-attribute:queue-a-task>queued/a> on the a href#user-interaction-task-source idenabling-and-disabling-form-controls:-the-disabled-attribute:user-interaction-task-source>user interaction task source/a> from being dispatched on the element./p> p>strong>Constraint validation/strong>: If an element is a href#concept-fe-disabled idenabling-and-disabling-form-controls:-the-disabled-attribute:concept-fe-disabled-2>disabled/a>, it is a href#barred-from-constraint-validation idenabling-and-disabling-form-controls:-the-disabled-attribute:barred-from-constraint-validation>barred from constraint validation/a>./p> p>The dfn iddom-fe-disabled>code>disabled/code>/dfn> IDL attribute must a href#reflect idenabling-and-disabling-form-controls:-the-disabled-attribute:reflect>reflect/a> the code idenabling-and-disabling-form-controls:-the-disabled-attribute:attr-fe-disabled-3>a href#attr-fe-disabled>disabled/a>/code> content attribute./p> h5 idform-submission>span classsecno>4.10.18.6/span> Form submissiona href#form-submission classself-link>/a>/h5> p>dfn idattributes-for-form-submission>Attributes for form submission/dfn> can be specified both on code idform-submission:the-form-element>a href#the-form-element>form/a>/code> elements and on a href#concept-submit-button idform-submission:concept-submit-button>submit buttons/a> (elements that represent buttons that submit forms, e.g. an code idform-submission:the-input-element>a href#the-input-element>input/a>/code> element whose code idform-submission:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#submit-button-state-(typesubmit) idform-submission:submit-button-state-(typesubmit)>Submit Button/a> state). div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> form-submit-attributesspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>15+/span>/span>span classios_saf yes>span>iOS Safari/span> span>5.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>4+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>5.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>4+/span>/span>span classopera yes>span>Opera/span> span>10.6+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featform-submit-attributes>caniuse.com/a>/div>p>The a href#attributes-for-form-submission idform-submission:attributes-for-form-submission>attributes for form submission/a> that may be specified on code idform-submission:the-form-element-2>a href#the-form-element>form/a>/code> elements are code idform-submission:attr-fs-action>a href#attr-fs-action>action/a>/code>, code idform-submission:attr-fs-enctype>a href#attr-fs-enctype>enctype/a>/code>, code idform-submission:attr-fs-method>a href#attr-fs-method>method/a>/code>, code idform-submission:attr-fs-novalidate>a href#attr-fs-novalidate>novalidate/a>/code>, and code idform-submission:attr-fs-target>a href#attr-fs-target>target/a>/code>./p> p>The corresponding a href#attributes-for-form-submission idform-submission:attributes-for-form-submission-2>attributes for form submission/a> that may be specified on a href#concept-submit-button idform-submission:concept-submit-button-2>submit buttons/a> are code idform-submission:attr-fs-formaction>a href#attr-fs-formaction>formaction/a>/code>, code idform-submission:attr-fs-formenctype>a href#attr-fs-formenctype>formenctype/a>/code>, code idform-submission:attr-fs-formmethod>a href#attr-fs-formmethod>formmethod/a>/code>, code idform-submission:attr-fs-formnovalidate>a href#attr-fs-formnovalidate>formnovalidate/a>/code>, and code idform-submission:attr-fs-formtarget>a href#attr-fs-formtarget>formtarget/a>/code>. When omitted, they default to the values given on the corresponding attributes on the code idform-submission:the-form-element-3>a href#the-form-element>form/a>/code> element./p> hr> p>The dfn idattr-fs-action>code>action/code>/dfn> and dfn idattr-fs-formaction>code>formaction/code>/dfn> content attributes, if specified, must have a value that is a a href#valid-non-empty-url-potentially-surrounded-by-spaces idform-submission:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces/a>./p> p>The dfn idconcept-fs-action>action/dfn> of an element is the value of the elements code idform-submission:attr-fs-formaction-2>a href#attr-fs-formaction>formaction/a>/code> attribute, if the element is a a href#concept-submit-button idform-submission:concept-submit-button-3>submit button/a> and has such an attribute, or the value of its a href#form-owner idform-submission:form-owner>form owner/a>s code idform-submission:attr-fs-action-2>a href#attr-fs-action>action/a>/code> attribute, if em>it/em> has one, or else the empty string./p> hr> p>The dfn idattr-fs-method>code>method/code>/dfn> and dfn idattr-fs-formmethod>code>formmethod/code>/dfn> content attributes are a href#enumerated-attribute idform-submission:enumerated-attribute>enumerated attributes/a> with the following keywords and states:/p> ul>li>The keyword dfn idattr-fs-method-get-keyword>code>get/code>/dfn>, mapping to the state dfn idattr-fs-method-get>GET/dfn>, indicating the HTTP GET method.li>The keyword dfn idattr-fs-method-post-keyword>code>post/code>/dfn>, mapping to the state dfn idattr-fs-method-post>POST/dfn>, indicating the HTTP POST method.li>The keyword dfn idattr-fs-method-dialog-keyword>code>dialog/code>/dfn>, mapping to the state dfn idattr-fs-method-dialog>dialog/dfn>, indicating that submitting the code idform-submission:the-form-element-4>a href#the-form-element>form/a>/code> is intended to close the code idform-submission:the-dialog-element>a href#the-dialog-element>dialog/a>/code> box in which the form finds itself, if any, and otherwise not submit./ul> p>The i idform-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 idform-submission:attr-fs-method-get>GET/a> state. The i idform-submission:missing-value-default>a href#missing-value-default>missing value default/a>/i> for the code idform-submission:attr-fs-method-2>a href#attr-fs-method>method/a>/code> attribute is also the a href#attr-fs-method-get idform-submission:attr-fs-method-get-2>GET/a> state. (There is no i idform-submission:missing-value-default-2>a href#missing-value-default>missing value default/a>/i> for the code idform-submission:attr-fs-formmethod-2>a href#attr-fs-formmethod>formmethod/a>/code> attribute.)/p> p>The dfn idconcept-fs-method>method/dfn> of an element is one of those states. If the element is a a href#concept-submit-button idform-submission:concept-submit-button-4>submit button/a> and has a code idform-submission:attr-fs-formmethod-3>a href#attr-fs-formmethod>formmethod/a>/code> attribute, then the elements a href#concept-fs-method idform-submission:concept-fs-method>method/a> is that attributes state; otherwise, it is the a href#form-owner idform-submission:form-owner-2>form owner/a>s code idform-submission:attr-fs-method-3>a href#attr-fs-method>method/a>/code> attributes state./p> div classexample> p>Here the code idform-submission:attr-fs-method-4>a href#attr-fs-method>method/a>/code> attribute is used to explicitly specify the default value, code idform-submission:attr-fs-method-get-keyword>a href#attr-fs-method-get-keyword>get/a>/code>, so that the search query is submitted in the URL:/p> pre><form methodget action/search.cgi> <p><label>Search terms: <input typesearch nameq></label></p> <p><input typesubmit></p></form>/pre> /div> div classexample> p>On the other hand, here the code idform-submission:attr-fs-method-5>a href#attr-fs-method>method/a>/code> attribute is used to specify the value code idform-submission:attr-fs-method-post-keyword>a href#attr-fs-method-post-keyword>post/a>/code>, so that the users message is submitted in the HTTP requests body:/p> pre><form methodpost action/post-message.cgi> <p><label>Message: <input typetext namem></label></p> <p><input typesubmit valueSubmit message></p></form>/pre> /div> div classexample> p>In this example, a code idform-submission:the-form-element-5>a href#the-form-element>form/a>/code> is used with a code idform-submission:the-dialog-element-2>a href#the-dialog-element>dialog/a>/code>. The code idform-submission:attr-fs-method-6>a href#attr-fs-method>method/a>/code> attributes code idform-submission:attr-fs-method-dialog-keyword>a href#attr-fs-method-dialog-keyword>dialog/a>/code> keyword is used to have the dialog automatically close when the form is submitted./p> pre langen-GB><dialog idship> <form methoddialog> <p>A ship has arrived in the harbour.</p> <button typesubmit valueboard>Board the ship</button> <button typesubmit valuecall>Call to the captain</button> </form></dialog><script> var ship document.getElementById(ship); ship.showModal(); ship.onclose function (event) { if (ship.returnValue board) { // ... } else { // ... } };</script>/pre> /div> hr> p>The dfn idattr-fs-enctype>code>enctype/code>/dfn> and dfn idattr-fs-formenctype>code>formenctype/code>/dfn> content attributes are a href#enumerated-attribute idform-submission:enumerated-attribute-2>enumerated attributes/a> with the following keywords and states:/p> ul>li>The dfn idattr-fs-enctype-urlencoded>code>application/x-www-form-urlencoded/code>/dfn> keyword and corresponding state.li>The dfn idattr-fs-enctype-formdata>code>multipart/form-data/code>/dfn> keyword and corresponding state.li>The dfn idattr-fs-enctype-text>code>text/plain/code>/dfn> keyword and corresponding state./ul> p>The i idform-submission:invalid-value-default-2>a href#invalid-value-default>invalid value default/a>/i> for these attributes is the code idform-submission:attr-fs-enctype-urlencoded>a href#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded/a>/code> state. The i idform-submission:missing-value-default-3>a href#missing-value-default>missing value default/a>/i> for the code idform-submission:attr-fs-enctype-2>a href#attr-fs-enctype>enctype/a>/code> attribute is also the code idform-submission:attr-fs-enctype-urlencoded-2>a href#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded/a>/code> state. (There is no i idform-submission:missing-value-default-4>a href#missing-value-default>missing value default/a>/i> for the code idform-submission:attr-fs-formenctype-2>a href#attr-fs-formenctype>formenctype/a>/code> attribute.)/p> p>The dfn idconcept-fs-enctype>enctype/dfn> of an element is one of those three states. If the element is a a href#concept-submit-button idform-submission:concept-submit-button-5>submit button/a> and has a code idform-submission:attr-fs-formenctype-3>a href#attr-fs-formenctype>formenctype/a>/code> attribute, then the elements a href#concept-fs-enctype idform-submission:concept-fs-enctype>enctype/a> is that attributes state; otherwise, it is the a href#form-owner idform-submission:form-owner-3>form owner/a>s code idform-submission:attr-fs-enctype-3>a href#attr-fs-enctype>enctype/a>/code> attributes state./p> hr> p>The dfn idattr-fs-target>code>target/code>/dfn> and dfn idattr-fs-formtarget>code>formtarget/code>/dfn> content attributes, if specified, must have values that are a href#valid-browsing-context-name-or-keyword idform-submission:valid-browsing-context-name-or-keyword>valid browsing context names or keywords/a>./p> hr> p>The dfn idattr-fs-novalidate>code>novalidate/code>/dfn> and dfn idattr-fs-formnovalidate>code>formnovalidate/code>/dfn> content attributes are a href#boolean-attribute idform-submission:boolean-attribute>boolean attributes/a>. If present, they indicate that the form is not to be validated during submission./p> p>The dfn idconcept-fs-novalidate>no-validate state/dfn> of an element is true if the element is a a href#concept-submit-button idform-submission:concept-submit-button-6>submit button/a> and the elements code idform-submission:attr-fs-formnovalidate-2>a href#attr-fs-formnovalidate>formnovalidate/a>/code> attribute is present, or if the elements a href#form-owner idform-submission:form-owner-4>form owner/a>s code idform-submission:attr-fs-novalidate-2>a href#attr-fs-novalidate>novalidate/a>/code> attribute is present, and false otherwise./p> div classexample> p>This attribute is useful to include save buttons on forms that have validation constraints, to allow users to save their progress even though they havent fully entered the data in the form. The following example shows a simple form that has two required fields. There are three buttons: one to submit the form, which requires both fields to be filled in; one to save the form so that the user can come back and fill it in later; and one to cancel the form altogether./p> pre><form actioneditor.cgi methodpost> <p><label>Name: <input required namefn></label></p> <p><label>Essay: <textarea required nameessay></textarea></label></p> <p><input typesubmit namesubmit valueSubmit essay></p> <p><input typesubmit formnovalidate namesave valueSave essay></p> <p><input typesubmit formnovalidate namecancel valueCancel></p></form>/pre> /div> hr> p>The dfn iddom-fs-action>code>action/code>/dfn> IDL attribute must a href#reflect idform-submission:reflect>reflect/a> the content attribute of the same name, except that on getting, when the content attribute is missing or its value is the empty string, the elements a idform-submission:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url idform-submission:the-documents-address data-x-internalthe-documents-address>URL/a> must be returned instead. The dfn iddom-fs-target>code>target/code>/dfn> IDL attribute must a href#reflect idform-submission:reflect-2>reflect/a> the content attribute of the same name. The dfn iddom-fs-method>code>method/code>/dfn> and dfn iddom-fs-enctype>code>enctype/code>/dfn> IDL attributes must a href#reflect idform-submission:reflect-3>reflect/a> the respective content attributes of the same name, a href#limited-to-only-known-values idform-submission:limited-to-only-known-values>limited to only known values/a>. The dfn iddom-fs-encoding>code>encoding/code>/dfn> IDL attribute must a href#reflect idform-submission:reflect-4>reflect/a> the code idform-submission:attr-fs-enctype-4>a href#attr-fs-enctype>enctype/a>/code> content attribute, a href#limited-to-only-known-values idform-submission:limited-to-only-known-values-2>limited to only known values/a>. The dfn iddom-fs-novalidate>code>noValidate/code>/dfn> IDL attribute must a href#reflect idform-submission:reflect-5>reflect/a> the code idform-submission:attr-fs-novalidate-3>a href#attr-fs-novalidate>novalidate/a>/code> content attribute. The dfn iddom-fs-formaction>code>formAction/code>/dfn> IDL attribute must a href#reflect idform-submission:reflect-6>reflect/a> the code idform-submission:attr-fs-formaction-3>a href#attr-fs-formaction>formaction/a>/code> content attribute, except that on getting, when the content attribute is missing or its value is the empty string, the elements a idform-submission:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url idform-submission:the-documents-address-2 data-x-internalthe-documents-address>URL/a> must be returned instead. The dfn iddom-fs-formenctype>code>formEnctype/code>/dfn> IDL attribute must a href#reflect idform-submission:reflect-7>reflect/a> the code idform-submission:attr-fs-formenctype-4>a href#attr-fs-formenctype>formenctype/a>/code> content attribute, a href#limited-to-only-known-values idform-submission:limited-to-only-known-values-3>limited to only known values/a>. The dfn iddom-fs-formmethod>code>formMethod/code>/dfn> IDL attribute must a href#reflect idform-submission:reflect-8>reflect/a> the code idform-submission:attr-fs-formmethod-4>a href#attr-fs-formmethod>formmethod/a>/code> content attribute, a href#limited-to-only-known-values idform-submission:limited-to-only-known-values-4>limited to only known values/a>. The dfn iddom-fs-formnovalidate>code>formNoValidate/code>/dfn> IDL attribute must a href#reflect idform-submission:reflect-9>reflect/a> the code idform-submission:attr-fs-formnovalidate-3>a href#attr-fs-formnovalidate>formnovalidate/a>/code> content attribute. The dfn iddom-fs-formtarget>code>formTarget/code>/dfn> IDL attribute must a href#reflect idform-submission:reflect-10>reflect/a> the code idform-submission:attr-fs-formtarget-2>a href#attr-fs-formtarget>formtarget/a>/code> content attribute. /p> h6 idautofocusing-a-form-control:-the-autofocus-attribute>span classsecno>4.10.18.6.1/span> Autofocusing a form control: the code idautofocusing-a-form-control:-the-autofocus-attribute:attr-fe-autofocus>a href#attr-fe-autofocus>autofocus/a>/code> attributea href#autofocusing-a-form-control:-the-autofocus-attribute classself-link>/a>/h6>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> autofocusspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>5+/span>/span>span classios_saf no>span>iOS Safari/span> span>None/span>/span>span classand_uc no>span>UC Browser for Android/span> span>None/span>/span>span classfirefox yes>span>Firefox/span> span>4+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>5+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>3+/span>/span>span classopera yes>span>Opera/span> span>9.5+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featautofocus>caniuse.com/a>/div> p>The dfn idattr-fe-autofocus>code>autofocus/code>/dfn> content attribute allows the author to indicate that a control is to be focused as soon as the page is loaded or as soon as the code idautofocusing-a-form-control:-the-autofocus-attribute:the-dialog-element>a href#the-dialog-element>dialog/a>/code> within which it finds itself is shown, allowing the user to just start typing without having to manually focus the main control./p> p>The code idautofocusing-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 idautofocusing-a-form-control:-the-autofocus-attribute:boolean-attribute>boolean attribute/a>./p> p>An elements dfn idnearest-ancestor-autofocus-scoping-root-element>nearest ancestor autofocus scoping root element/dfn> is the element itself if the element is a code idautofocusing-a-form-control:-the-autofocus-attribute:the-dialog-element-2>a href#the-dialog-element>dialog/a>/code> element, or else is the elements nearest ancestor code idautofocusing-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 elements last a idautofocusing-a-form-control:-the-autofocus-attribute:inclusive-ancestor hrefhttps://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor data-x-internalinclusive-ancestor>inclusive ancestor/a> element./p> p>There must not be two elements with the same a href#nearest-ancestor-autofocus-scoping-root-element idautofocusing-a-form-control:-the-autofocus-attribute:nearest-ancestor-autofocus-scoping-root-element>nearest ancestor autofocus scoping root element/a> that both have the code idautofocusing-a-form-control:-the-autofocus-attribute:attr-fe-autofocus-3>a href#attr-fe-autofocus>autofocus/a>/code> attribute specified./p> p>When an element with the code idautofocusing-a-form-control:-the-autofocus-attribute:attr-fe-autofocus-4>a href#attr-fe-autofocus>autofocus/a>/code> attribute specified is a href#insert-an-element-into-a-document idautofocusing-a-form-control:-the-autofocus-attribute:insert-an-element-into-a-document>inserted into a document/a>, user agents should run the following steps:/p> ol>li>p>Let var>target/var> be the elements a idautofocusing-a-form-control:-the-autofocus-attribute:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>.li>p>If var>target/var> has no a href#concept-document-bc idautofocusing-a-form-control:-the-autofocus-attribute:concept-document-bc>browsing context/a>, abort these steps.li>p>If var>target/var>s a href#concept-document-bc idautofocusing-a-form-control:-the-autofocus-attribute:concept-document-bc-2>browsing context/a> has no a href#top-level-browsing-context idautofocusing-a-form-control:-the-autofocus-attribute:top-level-browsing-context>top-level browsing context/a> (e.g. it is a a href#nested-browsing-context idautofocusing-a-form-control:-the-autofocus-attribute:nested-browsing-context>nested browsing context/a> with no a href#parent-browsing-context idautofocusing-a-form-control:-the-autofocus-attribute:parent-browsing-context>parent browsing context/a>), abort these steps.li>p>If var>target/var>s a href#active-sandboxing-flag-set idautofocusing-a-form-control:-the-autofocus-attribute:active-sandboxing-flag-set>active sandboxing flag set/a> has the a href#sandboxed-automatic-features-browsing-context-flag idautofocusing-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#concept-origin idautofocusing-a-form-control:-the-autofocus-attribute:concept-origin>origin/a> is not the a href#same-origin idautofocusing-a-form-control:-the-autofocus-attribute:same-origin>same/a> as the a href#concept-origin idautofocusing-a-form-control:-the-autofocus-attribute:concept-origin-2>origin/a> of the a idautofocusing-a-form-control:-the-autofocus-attribute:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> of the currently focused element in var>target/var>s a href#top-level-browsing-context idautofocusing-a-form-control:-the-autofocus-attribute:top-level-browsing-context-2>top-level browsing context/a>, abort these steps.li>p>If var>target/var>s a href#concept-origin idautofocusing-a-form-control:-the-autofocus-attribute:concept-origin-3>origin/a> is not the a href#same-origin idautofocusing-a-form-control:-the-autofocus-attribute:same-origin-2>same/a> as the a href#concept-origin idautofocusing-a-form-control:-the-autofocus-attribute:concept-origin-4>origin/a> of the a href#active-document idautofocusing-a-form-control:-the-autofocus-attribute:active-document>active document/a> of var>target/var>s a href#top-level-browsing-context idautofocusing-a-form-control:-the-autofocus-attribute:top-level-browsing-context-3>top-level browsing context/a>, abort these steps.li>p>If the user agent has already reached the last step of this list of steps in response to an element being a href#insert-an-element-into-a-document idautofocusing-a-form-control:-the-autofocus-attribute:insert-an-element-into-a-document-2>inserted/a> into a code idautofocusing-a-form-control:-the-autofocus-attribute:document>a href#document>Document/a>/code> whose a href#top-level-browsing-context idautofocusing-a-form-control:-the-autofocus-attribute:top-level-browsing-context-4>top-level browsing context/a>s a href#active-document idautofocusing-a-form-control:-the-autofocus-attribute:active-document-2>active document/a> is the same as var>target/var>s a href#top-level-browsing-context idautofocusing-a-form-control:-the-autofocus-attribute:top-level-browsing-context-5>top-level browsing context/a>s a href#active-document idautofocusing-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 they do not wish focus to be changed, then optionally abort these steps.li>p>a href#queue-a-task idautofocusing-a-form-control:-the-autofocus-attribute:queue-a-task>Queue a task/a> that runs the a href#focusing-steps idautofocusing-a-form-control:-the-autofocus-attribute:focusing-steps>focusing steps/a> for the element. User agents may also change the scrolling position of the document, or perform some other action that brings the element to the users attention. The a href#task-source idautofocusing-a-form-control:-the-autofocus-attribute:task-source>task source/a> for this task is the a href#user-interaction-task-source idautofocusing-a-form-control:-the-autofocus-attribute:user-interaction-task-source>user interaction task source/a>./ol> p classnote>This handles the automatic focusing during document load. The code idautofocusing-a-form-control:-the-autofocus-attribute:dom-dialog-show>a href#dom-dialog-show>show()/a>/code> and code idautofocusing-a-form-control:-the-autofocus-attribute:dom-dialog-showmodal>a href#dom-dialog-showmodal>showModal()/a>/code> methods of code idautofocusing-a-form-control:-the-autofocus-attribute:the-dialog-element-4>a href#the-dialog-element>dialog/a>/code> elements also processes the code idautofocusing-a-form-control:-the-autofocus-attribute:attr-fe-autofocus-5>a href#attr-fe-autofocus>autofocus/a>/code> attribute./p> p classnote>Focusing the control does not imply that the user agent has to focus the browser window if it has lost focus./p> p>The dfn iddom-fe-autofocus>code>autofocus/code>/dfn> IDL attribute must a href#reflect idautofocusing-a-form-control:-the-autofocus-attribute:reflect>reflect/a> the content attribute of the same name./p> div classexample> p>In the following snippet, the text control would be focused when the document was loaded./p> pre><input maxlength256 nameq value autofocus><input typesubmit valueSearch>/pre> /div> h5 idinput-modalities:-the-inputmode-attribute>span classsecno>4.10.18.7/span> Input modalities: the code idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode>a href#attr-fe-inputmode>inputmode/a>/code> attributea href#input-modalities:-the-inputmode-attribute classself-link>/a>/h5>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> input-inputmodespan classand_chr no>span>Chrome for Android/span> span>None/span>/span>span classchrome no>span>Chrome/span> span>None/span>/span>span classios_saf no>span>iOS Safari/span> span>None/span>/span>span classand_uc no>span>UC Browser for Android/span> span>None/span>/span>span classfirefox no>span>Firefox/span> span>None/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung no>span>Samsung Internet/span> span>None/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari no>span>Safari/span> span>None/span>/span>span classedge no>span>Edge/span> span>None/span>/span>span classandroid no>span>Android Browser/span> span>None/span>/span>span classopera no>span>Opera/span> span>None/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featinput-inputmode>caniuse.com/a>/div> p>The dfn idattr-fe-inputmode>code>inputmode/code>/dfn> content attribute is an a href#enumerated-attribute idinput-modalities:-the-inputmode-attribute:enumerated-attribute>enumerated attribute/a> that specifies what kind of input mechanism would be most helpful for users entering content into the form control./p> p>User agents must recognize all the keywords and corresponding states given below, but need not support all of the corresponding states. If a keywords state is not supported, the user agent must act as if the keyword instead mapped to the given states fallback state, as defined below. This fallback behavior is transitive./p> p classnote>For example, if a user agent with a QWERTY keyboard layout does not support text prediction and automatic capitalization, then it could treat the code idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-keyword-latin-prose>a href#attr-fe-inputmode-keyword-latin-prose>latin-prose/a>/code> keyword in the same way as the code idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-keyword-verbatim>a href#attr-fe-inputmode-keyword-verbatim>verbatim/a>/code> keyword, following the chain a href#attr-fe-inputmode-state-latin-prose idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-latin-prose>Latin Prose/a> → a href#attr-fe-inputmode-state-latin idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-latin>Latin Text/a> → a href#attr-fe-inputmode-state-verbatim idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-verbatim>Latin Verbatim/a>./p> p>The possible keywords and states for the attributes are listed in the following table. The keywords are listed in the first column. Each maps to the state given in the cell in the second column of that keywords row, and that state has the fallback state given in the cell in the third column of that row./p> table classthree-column-nowrap>thead>tr>th> Keyword th> State th> Fallback state th> Description tbody>tr>td> dfn idattr-fe-inputmode-keyword-verbatim>code>verbatim/code>/dfn> td> dfn idattr-fe-inputmode-state-verbatim>Latin Verbatim/dfn> td> a href#attr-fe-inputmode-state-default idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-default>Default/a> td> Alphanumeric Latin-script input of non-prose content, e.g. usernames, passwords, product codes. tr>td> dfn idattr-fe-inputmode-keyword-latin>code>latin/code>/dfn> td> dfn idattr-fe-inputmode-state-latin>Latin Text/dfn> td> a href#attr-fe-inputmode-state-verbatim idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-verbatim-2>Latin Verbatim/a> td> Latin-script input in the users preferred language(s), with some typing aids enabled (e.g. text prediction). Intended for human-to-computer communications, e.g. free-form text search fields. tr>td> dfn idattr-fe-inputmode-keyword-latin-name>code>latin-name/code>/dfn> td> dfn idattr-fe-inputmode-state-latin-name>Latin Name/dfn> td> a href#attr-fe-inputmode-state-latin idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-latin-2>Latin Text/a> td> Latin-script input in the users preferred language(s), with typing aids intended for entering human names enabled (e.g. text prediction from the users contact list and automatic capitalisation at every word). Intended for situations such as customer name fields. tr>td> dfn idattr-fe-inputmode-keyword-latin-prose>code>latin-prose/code>/dfn> td> dfn idattr-fe-inputmode-state-latin-prose>Latin Prose/dfn> td> a href#attr-fe-inputmode-state-latin idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-latin-3>Latin Text/a> td> Latin-script input in the users preferred language(s), with aggressive typing aids intended for human-to-human communications enabled (e.g. text prediction and automatic capitalisation at the start of sentences). Intended for situations such as e-mails and instant messaging. tr>td> dfn idattr-fe-inputmode-keyword-full-width-latin>code>full-width-latin/code>/dfn> td> dfn idattr-fe-inputmode-state-full-width-latin>Full-width Latin/dfn> td> a href#attr-fe-inputmode-state-latin-prose idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-latin-prose-2>Latin Prose/a> td> Latin-script input in the users secondary language(s), using full-width characters, with aggressive typing aids intended for human-to-human communications enabled (e.g. text prediction and automatic capitalisation at the start of sentences). Intended for latin text embedded inside CJK text. tr>td> dfn idattr-fe-inputmode-keyword-kana>code>kana/code>/dfn> td> dfn idattr-fe-inputmode-state-kana>Kana/dfn> td> a href#attr-fe-inputmode-state-default idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-default-2>Default/a> td> Kana or romaji input, typically hiragana input, using full-width characters, with support for converting to kanji. Intended for Japanese text input. tr>td> dfn idattr-fe-inputmode-keyword-kana-name>code>kana-name/code>/dfn> td> dfn idattr-fe-inputmode-state-kana-name>Kana Name/dfn> td> a href#attr-fe-inputmode-state-kana idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-kana>Kana/a> td> Kana or romaji input, typically hiragana input, using full-width characters, with support for converting to kanji, and with typing aids intended for entering human names enabled (e.g. text prediction from the users contact list). Intended for situations such as customer name fields. tr>td> dfn idattr-fe-inputmode-keyword-katakana>code>katakana/code>/dfn> td> dfn idattr-fe-inputmode-state-katakana>Katakana/dfn> td> a href#attr-fe-inputmode-state-kana idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-kana-2>Kana/a> td> Katakana input, using full-width characters, with support for converting to kanji. Intended for Japanese text input. tr>td> dfn idattr-fe-inputmode-keyword-numeric>code>numeric/code>/dfn> td> dfn idattr-fe-inputmode-state-numeric>Numeric/dfn> td> a href#attr-fe-inputmode-state-default idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-default-3>Default/a> td> Numeric input, including keys for the digits 0 to 9, the users preferred thousands separator character, and the character for indicating negative numbers. Intended for numeric codes, e.g. credit card numbers. (For numbers, prefer code idinput-modalities:-the-inputmode-attribute:number-state-(typenumber)>a href#number-state-(typenumber)><input typenumber>/a>/code>.) tr classrare>td> dfn idattr-fe-inputmode-keyword-tel>code>tel/code>/dfn> td> dfn idattr-fe-inputmode-state-telephone>Telephone/dfn> td> a href#attr-fe-inputmode-state-numeric idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-numeric>Numeric/a> td> Telephone number input, including keys for the digits 0 to 9, the # character, and the * character. In some locales, this can also include alphabetic mnemonic labels (e.g. in the US, the key labeled 2 is historically also labeled with the letters A, B, and C). a href#avoid-inputmode>Rarely necessary/a>; use code idinput-modalities:-the-inputmode-attribute:telephone-state-(typetel)>a href#telephone-state-(typetel)><input typetel>/a>/code> instead. tr classrare>td> dfn idattr-fe-inputmode-keyword-email>code>email/code>/dfn> td> dfn idattr-fe-inputmode-state-email>E-mail/dfn> td> a href#attr-fe-inputmode-state-default idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-default-4>Default/a> td> Text input in the users locale, with keys for aiding in the input of e-mail addresses, such as that for the @ character and the . character. a href#avoid-inputmode>Rarely necessary/a>; use code idinput-modalities:-the-inputmode-attribute:e-mail-state-(typeemail)>a href#e-mail-state-(typeemail)><input typeemail>/a>/code> instead. tr classrare>td> dfn idattr-fe-inputmode-keyword-url>code>url/code>/dfn> td> dfn idattr-fe-inputmode-state-url>URL/dfn> td> a href#attr-fe-inputmode-state-default idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-default-5>Default/a> td> Text input in the users locale, with keys for aiding in the input of a hrefhttps://url.spec.whatwg.org/#concept-url idinput-modalities:-the-inputmode-attribute:url data-x-internalurl>URLs/a>, such as that for the / and . characters and for quick input of strings commonly found in domain names such as www. or .co.uk. a href#avoid-inputmode>Rarely necessary/a>; use code idinput-modalities:-the-inputmode-attribute:url-state-(typeurl)>a href#url-state-(typeurl)><input typeurl>/a>/code> instead. /table> p idavoid-inputmode>The last three keywords listed above are only provided for completeness, and are rarely necessary, as dedicated input controls exist for their usual use cases (as described in the table above)./p> p>User agents must all support the dfn idattr-fe-inputmode-state-default>Default/dfn> input mode state, which corresponds to the user agents default input modality. This specification does not define how the user agents default modality is to operate. The i idinput-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 idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-default-6>default input mode/a> state./p> p>User agents should use the input modality corresponding to the state of the code idinput-modalities:-the-inputmode-attribute:attr-fe-inputmode-2>a href#attr-fe-inputmode>inputmode/a>/code> attribute when exposing a user interface for editing the value of a form control to which the attribute a href#concept-input-apply idinput-modalities:-the-inputmode-attribute:concept-input-apply>applies/a>. An input modality corresponding to a state is one designed to fit the description of the state in the table above. This value can change dynamically; user agents should update their interface as the attribute changes state, unless that would go against the users wishes./p> h5 idautofill>span classsecno>4.10.18.8/span> Autofilla href#autofill classself-link>/a>/h5>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> input-autocomplete-onoffspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome partial>span>Chrome (limited)/span> span>27+/span>/span>span classios_saf yes>span>iOS Safari/span> span>5.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox partial>span>Firefox (limited)/span> span>30+/span>/span>span classie partial>span>IE (limited)/span> span>11+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari partial>span>Safari (limited)/span> span>7+/span>/span>span classedge partial>span>Edge (limited)/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.1+/span>/span>span classopera yes>span>Opera/span> span>9+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featinput-autocomplete-onoff>caniuse.com/a>/div> h6 idautofilling-form-controls:-the-autocomplete-attribute>span classsecno>4.10.18.8.1/span> Autofilling form controls: the code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code> attributea href#autofilling-form-controls:-the-autocomplete-attribute classself-link>/a>/h6> p>User agents sometimes have features for helping users fill forms in, for example prefilling the users address based on earlier user input. The dfn idattr-fe-autocomplete>code>autocomplete/code>/dfn> content attribute can be used to hint to the user agent how to, or indeed whether to, provide such a feature./p> p>There are two ways this attribute is used. When wearing the dfn idautofill-expectation-mantle>autofill expectation mantle/dfn>, the code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-2>a href#attr-fe-autocomplete>autocomplete/a>/code> attribute describes what input is expected from users. When wearing the dfn idautofill-anchor-mantle>autofill anchor mantle/dfn>, the code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-3>a href#attr-fe-autocomplete>autocomplete/a>/code> attribute describes the meaning of the given value./p> p>On an code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element>a href#the-input-element>input/a>/code> element whose code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#hidden-state-(typehidden) idautofilling-form-controls:-the-autocomplete-attribute:hidden-state-(typehidden)>Hidden/a> state, the code idautofilling-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 idautofilling-form-controls:-the-autocomplete-attribute:autofill-anchor-mantle>autofill anchor mantle/a>. In all other cases, it wears the a href#autofill-expectation-mantle idautofilling-form-controls:-the-autocomplete-attribute:autofill-expectation-mantle>autofill expectation mantle/a>./p> p>When wearing the a href#autofill-expectation-mantle idautofilling-form-controls:-the-autocomplete-attribute:autofill-expectation-mantle-2>autofill expectation mantle/a>, the code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-5>a href#attr-fe-autocomplete>autocomplete/a>/code> attribute, if specified, must have a value that is an ordered a href#set-of-space-separated-tokens idautofilling-form-controls:-the-autocomplete-attribute:set-of-space-separated-tokens>set of space-separated tokens/a> consisting of either a single token that is an a idautofilling-form-controls:-the-autocomplete-attribute:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code idautofilling-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 idautofilling-form-controls:-the-autocomplete-attribute:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on>a href#attr-fe-autocomplete-on>on/a>/code>, or a href#autofill-detail-tokens idautofilling-form-controls:-the-autocomplete-attribute:autofill-detail-tokens>autofill detail tokens/a>./p> p>When wearing the a href#autofill-anchor-mantle idautofilling-form-controls:-the-autocomplete-attribute:autofill-anchor-mantle-2>autofill anchor mantle/a>, the code idautofilling-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 idautofilling-form-controls:-the-autocomplete-attribute:set-of-space-separated-tokens-2>set of space-separated tokens/a> consisting of just a href#autofill-detail-tokens idautofilling-form-controls:-the-autocomplete-attribute:autofill-detail-tokens-2>autofill detail tokens/a> (i.e. the code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-2>a href#attr-fe-autocomplete-on>on/a>/code> and code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-off-2>a href#attr-fe-autocomplete-off>off/a>/code> keywords are not allowed)./p> p>dfn idautofill-detail-tokens>Autofill detail tokens/dfn> are the following, in the order given below:/p> ol>li> p>Optionally, a token whose first eight characters are an a idautofilling-form-controls:-the-autocomplete-attribute:ascii-case-insensitive-3 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string dfn idattr-fe-autocomplete-section>code>section-/code>/dfn>, meaning that the field belongs to the named group./p> div classexample> p>For example, if there are two shipping addresses in the form, then they could be marked up as:/p> pre><fieldset> <legend>Ship the blue gift to...</legend> <p> <label> Address: <textarea nameba autocompletesection-blue shipping street-address></textarea> </label> <p> <label> City: <input namebc autocompletesection-blue shipping address-level2> </label> <p> <label> Postal Code: <input namebp autocompletesection-blue shipping postal-code> </label></fieldset><fieldset> <legend>Ship the red gift to...</legend> <p> <label> Address: <textarea namera autocompletesection-red shipping street-address></textarea> </label> <p> <label> City: <input namerc autocompletesection-red shipping address-level2> </label> <p> <label> Postal Code: <input namerp autocompletesection-red shipping postal-code> </label></fieldset>/pre> /div> li> p>Optionally, a token that is an a idautofilling-form-controls:-the-autocomplete-attribute:ascii-case-insensitive-4 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for one of the following strings:/p> ul classbrief>li>dfn idattr-fe-autocomplete-shipping>code>shipping/code>/dfn>, meaning the field is part of the shipping address or contact information li>dfn idattr-fe-autocomplete-billing>code>billing/code>/dfn>, meaning the field is part of the billing address or contact information /ul> li> p>Either of the following two options:/p> ul>li> p>A token that is an a idautofilling-form-controls:-the-autocomplete-attribute:ascii-case-insensitive-5 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for one of the following a href#autofill-field idautofilling-form-controls:-the-autocomplete-attribute:autofill-field>autofill field/a> names, excluding those that are a href#inappropriate-for-the-control idautofilling-form-controls:-the-autocomplete-attribute:inappropriate-for-the-control>inappropriate for the control/a>:/p> ul classbrief>li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-name>a href#attr-fe-autocomplete-name>name/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-honorific-prefix>a href#attr-fe-autocomplete-honorific-prefix>honorific-prefix/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-given-name>a href#attr-fe-autocomplete-given-name>given-name/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-additional-name>a href#attr-fe-autocomplete-additional-name>additional-name/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-family-name>a href#attr-fe-autocomplete-family-name>family-name/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-honorific-suffix>a href#attr-fe-autocomplete-honorific-suffix>honorific-suffix/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-nickname>a href#attr-fe-autocomplete-nickname>nickname/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-username>a href#attr-fe-autocomplete-username>username/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-new-password>a href#attr-fe-autocomplete-new-password>new-password/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-current-password>a href#attr-fe-autocomplete-current-password>current-password/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-organization-title>a href#attr-fe-autocomplete-organization-title>organization-title/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-organization>a href#attr-fe-autocomplete-organization>organization/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-street-address>a href#attr-fe-autocomplete-street-address>street-address/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-line1>a href#attr-fe-autocomplete-address-line1>address-line1/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-line2>a href#attr-fe-autocomplete-address-line2>address-line2/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-line3>a href#attr-fe-autocomplete-address-line3>address-line3/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-level4>a href#attr-fe-autocomplete-address-level4>address-level4/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-level3>a href#attr-fe-autocomplete-address-level3>address-level3/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-level2>a href#attr-fe-autocomplete-address-level2>address-level2/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-level1>a href#attr-fe-autocomplete-address-level1>address-level1/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-country>a href#attr-fe-autocomplete-country>country/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-country-name>a href#attr-fe-autocomplete-country-name>country-name/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-postal-code>a href#attr-fe-autocomplete-postal-code>postal-code/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-name>a href#attr-fe-autocomplete-cc-name>cc-name/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-given-name>a href#attr-fe-autocomplete-cc-given-name>cc-given-name/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-additional-name>a href#attr-fe-autocomplete-cc-additional-name>cc-additional-name/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-family-name>a href#attr-fe-autocomplete-cc-family-name>cc-family-name/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-number>a href#attr-fe-autocomplete-cc-number>cc-number/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-exp>a href#attr-fe-autocomplete-cc-exp>cc-exp/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-exp-month>a href#attr-fe-autocomplete-cc-exp-month>cc-exp-month/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-exp-year>a href#attr-fe-autocomplete-cc-exp-year>cc-exp-year/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-csc>a href#attr-fe-autocomplete-cc-csc>cc-csc/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-type>a href#attr-fe-autocomplete-cc-type>cc-type/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-transaction-currency>a href#attr-fe-autocomplete-transaction-currency>transaction-currency/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-transaction-amount>a href#attr-fe-autocomplete-transaction-amount>transaction-amount/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-language>a href#attr-fe-autocomplete-language>language/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-bday>a href#attr-fe-autocomplete-bday>bday/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-bday-day>a href#attr-fe-autocomplete-bday-day>bday-day/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-bday-month>a href#attr-fe-autocomplete-bday-month>bday-month/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-bday-year>a href#attr-fe-autocomplete-bday-year>bday-year/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-sex>a href#attr-fe-autocomplete-sex>sex/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-url>a href#attr-fe-autocomplete-url>url/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-photo>a href#attr-fe-autocomplete-photo>photo/a>/code> /ul> p>(See the table below for descriptions of these values.)/p> li> p>The following, in the given order:/p> ol>li> p>Optionally, a token that is an a idautofilling-form-controls:-the-autocomplete-attribute:ascii-case-insensitive-6 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for one of the following strings:/p> ul classbrief>li>dfn idattr-fe-autocomplete-home>code>home/code>/dfn>, meaning the field is for contacting someone at their residence li>dfn idattr-fe-autocomplete-work>code>work/code>/dfn>, meaning the field is for contacting someone at their workplace li>dfn idattr-fe-autocomplete-mobile>code>mobile/code>/dfn>, meaning the field is for contacting someone regardless of location li>dfn idattr-fe-autocomplete-fax>code>fax/code>/dfn>, meaning the field describes a fax machines contact details li>dfn idattr-fe-autocomplete-pager>code>pager/code>/dfn>, meaning the field describes a pagers or beepers contact details /ul> li> p>A token that is an a idautofilling-form-controls:-the-autocomplete-attribute:ascii-case-insensitive-7 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for one of the following a href#autofill-field idautofilling-form-controls:-the-autocomplete-attribute:autofill-field-2>autofill field/a> names, excluding those that are a href#inappropriate-for-the-control idautofilling-form-controls:-the-autocomplete-attribute:inappropriate-for-the-control-2>inappropriate for the control/a>:/p> ul classbrief>li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel>a href#attr-fe-autocomplete-tel>tel/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel-country-code>a href#attr-fe-autocomplete-tel-country-code>tel-country-code/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel-national>a href#attr-fe-autocomplete-tel-national>tel-national/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel-area-code>a href#attr-fe-autocomplete-tel-area-code>tel-area-code/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel-local>a href#attr-fe-autocomplete-tel-local>tel-local/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel-local-prefix>a href#attr-fe-autocomplete-tel-local-prefix>tel-local-prefix/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel-local-suffix>a href#attr-fe-autocomplete-tel-local-suffix>tel-local-suffix/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel-extension>a href#attr-fe-autocomplete-tel-extension>tel-extension/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-email>a href#attr-fe-autocomplete-email>email/a>/code> li>code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-impp>a href#attr-fe-autocomplete-impp>impp/a>/code> /ul> p>(See the table below for descriptions of these values.)/p> /ol> /ul> /ol> p>As noted earlier, the meaning of the attribute and its keywords depends on the mantle that the attribute is wearing./p> dl classswitch>dt>When wearing the a href#autofill-expectation-mantle idautofilling-form-controls:-the-autocomplete-attribute:autofill-expectation-mantle-3>autofill expectation mantle/a>... dd> p>The dfn idattr-fe-autocomplete-off>code>off/code>/dfn> keyword indicates either that the controls input data is particularly sensitive (for example the activation code for a nuclear weapon); or that it is a value that will never be reused (for example a one-time-key for a bank login) and the user will therefore have to explicitly enter the data each time, instead of being able to rely on the UA to prefill the value for them; or that the document provides its own autocomplete mechanism and does not want the user agent to provide autocompletion values./p> p>The dfn idattr-fe-autocomplete-on>code>on/code>/dfn> keyword indicates that the user agent is allowed to provide the user with autocompletion values, but does not provide any further information about what kind of data the user might be expected to enter. User agents would have to use heuristics to decide what autocompletion values to suggest./p> p>The a href#autofill-field idautofilling-form-controls:-the-autocomplete-attribute:autofill-field-3>autofill field/a> listed above indicate that the user agent is allowed to provide the user with autocompletion values, and specifies what kind of value is expected. The meaning of each such keyword is described in the table below./p> p>If the code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-7>a href#attr-fe-autocomplete>autocomplete/a>/code> attribute is omitted, the default value corresponding to the state of the elements a href#form-owner idautofilling-form-controls:-the-autocomplete-attribute:form-owner>form owner/a>s code idautofilling-form-controls:-the-autocomplete-attribute:attr-form-autocomplete>a href#attr-form-autocomplete>autocomplete/a>/code> attribute is used instead (either code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-3>a href#attr-fe-autocomplete-on>on/a>/code> or code idautofilling-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 idautofilling-form-controls:-the-autocomplete-attribute:form-owner-2>form owner/a>, then the value code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-4>a href#attr-fe-autocomplete-on>on/a>/code> is used./p> dt>When wearing the a href#autofill-anchor-mantle idautofilling-form-controls:-the-autocomplete-attribute:autofill-anchor-mantle-3>autofill anchor mantle/a>... dd> p>The a href#autofill-field idautofilling-form-controls:-the-autocomplete-attribute:autofill-field-4>autofill field/a> listed above indicate that the value of the particular kind of value specified is that value provided for this element. The meaning of each such keyword is described in the table below./p> div classexample> p>In this example the page has explicitly specified the currency and amount of the transaction. The form requests a credit card and other billing details. The user agent could use this information to suggest a credit card that it knows has sufficient balance and that supports the relevant currency./p> pre><form methodpost actionstep2.cgi> <input typehidden autocompletetransaction-currency valueCHF> <input typehidden autocompletetransaction-amount value15.00> <p><label>Credit card number: <input typetext inputmodenumeric autocompletecc-number></label> <p><label>Expiry Date: <input typemonth autocompletecc-exp></label> <p><input typesubmit valueContinue...></form>/pre> /div> /dl> p>The dfn idautofill-field>autofill field/dfn> keywords relate to each other as described in the table below. Each field name listed on a row of this table corresponds to the meaning given in the cell for that row in the column labeled Meaning. Some fields correspond to subparts of other fields; for example, a credit card expiry date can be expressed as one field giving both the month and year of expiry (code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-exp-2>a href#attr-fe-autocomplete-cc-exp>cc-exp/a>/code>), or as two fields, one giving the month (code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-exp-month-2>a href#attr-fe-autocomplete-cc-exp-month>cc-exp-month/a>/code>) and one the year (code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-exp-year-2>a href#attr-fe-autocomplete-cc-exp-year>cc-exp-year/a>/code>). In such cases, the names of the broader fields cover multiple rows, in which the narrower fields are defined./p> p classnote>Generally, authors are encouraged to use the broader fields rather than the narrower fields, as the narrower fields tend to expose Western biases. For example, while it is common in some Western cultures to have a given name and a family name, in that order (and thus often referred to as a i>first name/i> and a i>surname/i>), many cultures put the family name first and the given name second, and many others simply have one name (a i>mononym/i>). Having a single field is therefore more flexible./p> p>Some fields are only appropriate for certain form controls. An a href#autofill-field idautofilling-form-controls:-the-autocomplete-attribute:autofill-field-5>autofill field/a> name is dfn idinappropriate-for-the-control>inappropriate for a control/dfn> if the control does not belong to the group listed for that a href#autofill-field idautofilling-form-controls:-the-autocomplete-attribute:autofill-field-6>autofill field/a> in the fifth column of the first row describing that a href#autofill-field idautofilling-form-controls:-the-autocomplete-attribute:autofill-field-7>autofill field/a> in the table below. What controls fall into each group is described below the table./p> table>thead>tr>th colspan4> Field name th> Meaning th> Canonical Format th> Canonical Format Example th> Control group tbody>tr>td colspan4>dfn idattr-fe-autocomplete-name>code>name/code>/dfn> td>Full name td>Free-form text, no newlines td>Sir Timothy John Berners-Lee, OM, KBE, FRS, FREng, FRSA td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text>Text/a> tr>td classnon-rectangular-cell-indentation rowspan5> td colspan3>dfn idattr-fe-autocomplete-honorific-prefix>code>honorific-prefix/code>/dfn> td>Prefix or title (e.g. Mr., Ms., Dr., span langfr>Msup>lle/sup>/span>) td>Free-form text, no newlines td>Sir td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-2>Text/a> tr>td colspan3>dfn idattr-fe-autocomplete-given-name>code>given-name/code>/dfn> td>Given name (in some Western cultures, also known as the i>first name/i>) td>Free-form text, no newlines td>Timothy td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-3>Text/a> tr>td colspan3>dfn idattr-fe-autocomplete-additional-name>code>additional-name/code>/dfn> td>Additional names (in some Western cultures, also known as i>middle names/i>, forenames other than the first name) td>Free-form text, no newlines td>John td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-4>Text/a> tr>td colspan3>dfn idattr-fe-autocomplete-family-name>code>family-name/code>/dfn> td>Family name (in some Western cultures, also known as the i>last name/i> or i>surname/i>) td>Free-form text, no newlines td>Berners-Lee td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-5>Text/a> tr>td colspan3>dfn idattr-fe-autocomplete-honorific-suffix>code>honorific-suffix/code>/dfn> td>Suffix (e.g. Jr., B.Sc., MBASW, II) td>Free-form text, no newlines td>OM, KBE, FRS, FREng, FRSA td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-6>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-nickname>code>nickname/code>/dfn> td>Nickname, screen name, handle: a typically short name used instead of the full name td>Free-form text, no newlines td>Tim td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-7>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-organization-title>code>organization-title/code>/dfn> td>Job title (e.g. Software Engineer, Senior Vice President, Deputy Managing Director) td>Free-form text, no newlines td>Professor td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-8>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-username>code>username/code>/dfn> td>A username td>Free-form text, no newlines td>timbl td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-9>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-new-password>code>new-password/code>/dfn> td>A new password (e.g. when creating an account or changing a password) td>Free-form text, no newlines td>GUMFXbadyrS3 td>a href#control-group-password idautofilling-form-controls:-the-autocomplete-attribute:control-group-password>Password/a> tr>td colspan4>dfn idattr-fe-autocomplete-current-password>code>current-password/code>/dfn> td>The current password for the account identified by the code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-username-2>a href#attr-fe-autocomplete-username>username/a>/code> field (e.g. when logging in) td>Free-form text, no newlines td>qwerty td>a href#control-group-password idautofilling-form-controls:-the-autocomplete-attribute:control-group-password-2>Password/a> tbody>tr>td colspan4>dfn idattr-fe-autocomplete-organization>code>organization/code>/dfn> td>Company name corresponding to the person, address, or contact information in the other fields associated with this field td>Free-form text, no newlines td>World Wide Web Consortium td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-10>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-street-address>code>street-address/code>/dfn> td>Street address (multiple lines, newlines preserved) td>Free-form text td>32 Vassar Streetbr>MIT Room 32-G524 td>a href#control-group-multiline idautofilling-form-controls:-the-autocomplete-attribute:control-group-multiline>Multiline/a> tr>td classnon-rectangular-cell-indentation rowspan3> td colspan3>dfn idattr-fe-autocomplete-address-line1>code>address-line1/code>/dfn> td rowspan3>Street address (one line per field) td>Free-form text, no newlines td>32 Vassar Street td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-11>Text/a> tr>td colspan3>dfn idattr-fe-autocomplete-address-line2>code>address-line2/code>/dfn> td>Free-form text, no newlines td>MIT Room 32-G524 td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-12>Text/a> tr>td colspan3>dfn idattr-fe-autocomplete-address-line3>code>address-line3/code>/dfn> td>Free-form text, no newlines td> td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-13>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-address-level4>code>address-level4/code>/dfn> td>The most fine-grained a href#more-on-address-levels>administrative level/a>, in addresses with four administrative levels td>Free-form text, no newlines td> td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-14>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-address-level3>code>address-level3/code>/dfn> td>The a href#more-on-address-levels>third administrative level/a>, in addresses with three or more administrative levels td>Free-form text, no newlines td> td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-15>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-address-level2>code>address-level2/code>/dfn> td>The a href#more-on-address-levels>second administrative level/a>, in addresses with two or more administrative levels; in the countries with two administrative levels, this would typically be the city, town, village, or other locality within which the relevant street address is found td>Free-form text, no newlines td>Cambridge td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-16>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-address-level1>code>address-level1/code>/dfn> td>The broadest a href#more-on-address-levels>administrative level/a> in the address, i.e. the province within which the locality is found; for example, in the US, this would be the state; in Switzerland it would be the canton; in the UK, the post town td>Free-form text, no newlines td>MA td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-17>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-country>code>country/code>/dfn> td>Country code td>Valid a hrefhttps://www.iso.org/iso-3166-country-codes.html>ISO 3166-1-alpha-2 country code/a> a href#refsISO3166>ISO3166/a> td>US td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-18>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-country-name>code>country-name/code>/dfn> td>Country name td>Free-form text, no newlines; a href#autofill-country>derived from code>country/code> in some cases/a> td>US td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-19>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-postal-code>code>postal-code/code>/dfn> td>Postal code, post code, ZIP code, CEDEX code (if CEDEX, append CEDEX, and the i langfr>arrondissement/i>, if relevant, to the code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-level2-2>a href#attr-fe-autocomplete-address-level2>address-level2/a>/code> field) td>Free-form text, no newlines td>02139 td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-20>Text/a> tbody>tr>td colspan4>dfn idattr-fe-autocomplete-cc-name>code>cc-name/code>/dfn> td>Full name as given on the payment instrument td>Free-form text, no newlines td>Tim Berners-Lee td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-21>Text/a> tr>td classnon-rectangular-cell-indentation rowspan3> td colspan3>dfn idattr-fe-autocomplete-cc-given-name>code>cc-given-name/code>/dfn> td>Given name as given on the payment instrument (in some Western cultures, also known as the i>first name/i>) td>Free-form text, no newlines td>Tim td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-22>Text/a> tr>td colspan3>dfn idattr-fe-autocomplete-cc-additional-name>code>cc-additional-name/code>/dfn> td>Additional names given on the payment instrument (in some Western cultures, also known as i>middle names/i>, forenames other than the first name) td>Free-form text, no newlines td> td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-23>Text/a> tr>td colspan3>dfn idattr-fe-autocomplete-cc-family-name>code>cc-family-name/code>/dfn> td>Family name given on the payment instrument (in some Western cultures, also known as the i>last name/i> or i>surname/i>) td>Free-form text, no newlines td>Berners-Lee td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-24>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-cc-number>code>cc-number/code>/dfn> td>Code identifying the payment instrument (e.g. the credit card number) td>a idautofilling-form-controls:-the-autocomplete-attribute:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> td>4114360123456785 td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-25>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-cc-exp>code>cc-exp/code>/dfn> td>Expiration date of the payment instrument td>a href#valid-month-string idautofilling-form-controls:-the-autocomplete-attribute:valid-month-string>Valid month string/a> td>2014-12 td>a href#control-group-month idautofilling-form-controls:-the-autocomplete-attribute:control-group-month>Month/a> tr>td classnon-rectangular-cell-indentation rowspan2> td colspan3>dfn idattr-fe-autocomplete-cc-exp-month>code>cc-exp-month/code>/dfn> td>Month component of the expiration date of the payment instrument td>a href#valid-integer idautofilling-form-controls:-the-autocomplete-attribute:valid-integer>Valid integer/a> in the range 1..12 td>12 td>a href#control-group-numeric idautofilling-form-controls:-the-autocomplete-attribute:control-group-numeric>Numeric/a> tr>td colspan3>dfn idattr-fe-autocomplete-cc-exp-year>code>cc-exp-year/code>/dfn> td>Year component of the expiration date of the payment instrument td>a href#valid-integer idautofilling-form-controls:-the-autocomplete-attribute:valid-integer-2>Valid integer/a> greater than zero td>2014 td>a href#control-group-numeric idautofilling-form-controls:-the-autocomplete-attribute:control-group-numeric-2>Numeric/a> tr>td colspan4>dfn idattr-fe-autocomplete-cc-csc>code>cc-csc/code>/dfn> td>Security code for the payment instrument (also known as the card security code (CSC), card validation code (CVC), card verification value (CVV), signature panel code (SPC), credit card ID (CCID), etc) td>a idautofilling-form-controls:-the-autocomplete-attribute:ascii-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> td>419 td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-26>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-cc-type>code>cc-type/code>/dfn> td>Type of payment instrument td>Free-form text, no newlines td>Visa td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-27>Text/a> tbody>tr>td colspan4>dfn idattr-fe-autocomplete-transaction-currency>code>transaction-currency/code>/dfn> td>The currency that the user would prefer the transaction to use td>ISO 4217 currency code a href#refsISO4217>ISO4217/a> td>GBP td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-28>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-transaction-amount>code>transaction-amount/code>/dfn> td>The amount that the user would like for the transaction (e.g. when entering a bid or sale price) td>a href#valid-floating-point-number idautofilling-form-controls:-the-autocomplete-attribute:valid-floating-point-number>Valid floating-point number/a> td>401.00 td>a href#control-group-numeric idautofilling-form-controls:-the-autocomplete-attribute:control-group-numeric-3>Numeric/a> tbody>tr>td colspan4>dfn idattr-fe-autocomplete-language>code>language/code>/dfn> td>Preferred language td>Valid BCP 47 language tag a href#refsBCP47>BCP47/a> td>en td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-29>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-bday>code>bday/code>/dfn> td>Birthday td>a href#valid-date-string idautofilling-form-controls:-the-autocomplete-attribute:valid-date-string>Valid date string/a> td>1955-06-08 td>a href#control-group-date idautofilling-form-controls:-the-autocomplete-attribute:control-group-date>Date/a> tr>td classnon-rectangular-cell-indentation rowspan3> td colspan3>dfn idattr-fe-autocomplete-bday-day>code>bday-day/code>/dfn> td>Day component of birthday td>a href#valid-integer idautofilling-form-controls:-the-autocomplete-attribute:valid-integer-3>Valid integer/a> in the range 1..31 td>8 td>a href#control-group-numeric idautofilling-form-controls:-the-autocomplete-attribute:control-group-numeric-4>Numeric/a> tr>td colspan3>dfn idattr-fe-autocomplete-bday-month>code>bday-month/code>/dfn> td>Month component of birthday td>a href#valid-integer idautofilling-form-controls:-the-autocomplete-attribute:valid-integer-4>Valid integer/a> in the range 1..12 td>6 td>a href#control-group-numeric idautofilling-form-controls:-the-autocomplete-attribute:control-group-numeric-5>Numeric/a> tr>td colspan3>dfn idattr-fe-autocomplete-bday-year>code>bday-year/code>/dfn> td>Year component of birthday td>a href#valid-integer idautofilling-form-controls:-the-autocomplete-attribute:valid-integer-5>Valid integer/a> greater than zero td>1955 td>a href#control-group-numeric idautofilling-form-controls:-the-autocomplete-attribute:control-group-numeric-6>Numeric/a> tr>td colspan4>dfn idattr-fe-autocomplete-sex>code>sex/code>/dfn> td>Gender identity (e.g. Female, Faafafine) td>Free-form text, no newlines td>Male td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-30>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-url>code>url/code>/dfn> td>Home page or other Web page corresponding to the company, person, address, or contact information in the other fields associated with this field td>a idautofilling-form-controls:-the-autocomplete-attribute:valid-url-string hrefhttps://url.spec.whatwg.org/#valid-url-string data-x-internalvalid-url-string>Valid URL string/a> td>https://www.w3.org/People/Berners-Lee/ td>a href#control-group-url idautofilling-form-controls:-the-autocomplete-attribute:control-group-url>URL/a> tr>td colspan4>dfn idattr-fe-autocomplete-photo>code>photo/code>/dfn> td>Photograph, icon, or other image corresponding to the company, person, address, or contact information in the other fields associated with this field td> a idautofilling-form-controls:-the-autocomplete-attribute:valid-url-string-2 hrefhttps://url.spec.whatwg.org/#valid-url-string data-x-internalvalid-url-string>Valid URL string/a> td>https://www.w3.org/Press/Stock/Berners-Lee/2001-europaeum-eighth.jpg td> a href#control-group-url idautofilling-form-controls:-the-autocomplete-attribute:control-group-url-2>URL/a> tbody>tr>td colspan4>dfn idattr-fe-autocomplete-tel>code>tel/code>/dfn> td>Full telephone number, including country code td>a idautofilling-form-controls:-the-autocomplete-attribute:ascii-digits-3 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> and U+0020 SPACE characters, prefixed by a U+002B PLUS SIGN character (+) td>+1 617 253 5702 td>a href#control-group-tel idautofilling-form-controls:-the-autocomplete-attribute:control-group-tel>Tel/a> tr>td classnon-rectangular-cell-indentation rowspan6> td colspan3>dfn idattr-fe-autocomplete-tel-country-code>code>tel-country-code/code>/dfn> td>Country code component of the telephone number td>a idautofilling-form-controls:-the-autocomplete-attribute:ascii-digits-4 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> prefixed by a U+002B PLUS SIGN character (+) td>+1 td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-31>Text/a> tr>td colspan3>dfn idattr-fe-autocomplete-tel-national>code>tel-national/code>/dfn> td>Telephone number without the county code component, with a country-internal prefix applied if applicable td>a idautofilling-form-controls:-the-autocomplete-attribute:ascii-digits-5 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> and U+0020 SPACE characters td>617 253 5702 td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-32>Text/a> tr>td classnon-rectangular-cell-indentation rowspan4> td colspan2>dfn idattr-fe-autocomplete-tel-area-code>code>tel-area-code/code>/dfn> td>Area code component of the telephone number, with a country-internal prefix applied if applicable td>a idautofilling-form-controls:-the-autocomplete-attribute:ascii-digits-6 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> td>617 td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-33>Text/a> tr>td colspan2>dfn idattr-fe-autocomplete-tel-local>code>tel-local/code>/dfn> td>Telephone number without the country code and area code components td>a idautofilling-form-controls:-the-autocomplete-attribute:ascii-digits-7 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> td>2535702 td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-34>Text/a> tr>td classnon-rectangular-cell-indentation rowspan2> td>dfn idattr-fe-autocomplete-tel-local-prefix>code>tel-local-prefix/code>/dfn> td>First part of the component of the telephone number that follows the area code, when that component is split into two components td>a idautofilling-form-controls:-the-autocomplete-attribute:ascii-digits-8 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> td>253 td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-35>Text/a> tr>td>dfn idattr-fe-autocomplete-tel-local-suffix>code>tel-local-suffix/code>/dfn> td>Second part of the component of the telephone number that follows the area code, when that component is split into two components td>a idautofilling-form-controls:-the-autocomplete-attribute:ascii-digits-9 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> td>5702 td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-36>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-tel-extension>code>tel-extension/code>/dfn> td>Telephone number internal extension code td>a idautofilling-form-controls:-the-autocomplete-attribute:ascii-digits-10 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> td>1000 td>a href#control-group-text idautofilling-form-controls:-the-autocomplete-attribute:control-group-text-37>Text/a> tr>td colspan4>dfn idattr-fe-autocomplete-email>code>email/code>/dfn> td>E-mail address td>a href#valid-e-mail-address idautofilling-form-controls:-the-autocomplete-attribute:valid-e-mail-address>Valid e-mail address/a> td>timbl@w3.org td>a href#control-group-e-mail idautofilling-form-controls:-the-autocomplete-attribute:control-group-e-mail>E-mail/a> tr>td colspan4>dfn idattr-fe-autocomplete-impp>code>impp/code>/dfn> td>URL representing an instant messaging protocol endpoint (for example, code>aim:goim?screennameexample/code> or code>xmpp:fred@example.net/code>) td>a idautofilling-form-controls:-the-autocomplete-attribute:valid-url-string-3 hrefhttps://url.spec.whatwg.org/#valid-url-string data-x-internalvalid-url-string>Valid URL string/a> td>irc://example.org/timbl,isuser td>a href#control-group-url idautofilling-form-controls:-the-autocomplete-attribute:control-group-url-3>URL/a> /table> p>The groups correspond to controls as follows:/p> dl>dt>dfn idcontrol-group-text>Text/dfn> dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-2>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-2>a href#attr-input-type>type/a>/code> attribute in the a href#hidden-state-(typehidden) idautofilling-form-controls:-the-autocomplete-attribute:hidden-state-(typehidden)-2>Hidden/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-3>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-3>a href#attr-input-type>type/a>/code> attribute in the a href#text-(typetext)-state-and-search-state-(typesearch) idautofilling-form-controls:-the-autocomplete-attribute:text-(typetext)-state-and-search-state-(typesearch)>Text/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-4>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-4>a href#attr-input-type>type/a>/code> attribute in the a href#text-(typetext)-state-and-search-state-(typesearch) idautofilling-form-controls:-the-autocomplete-attribute:text-(typetext)-state-and-search-state-(typesearch)-2>Search/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-textarea-element>a href#the-textarea-element>textarea/a>/code> elements dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-select-element>a href#the-select-element>select/a>/code> elements dt>dfn idcontrol-group-multiline>Multiline/dfn> dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-5>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-5>a href#attr-input-type>type/a>/code> attribute in the a href#hidden-state-(typehidden) idautofilling-form-controls:-the-autocomplete-attribute:hidden-state-(typehidden)-3>Hidden/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code> elements dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-select-element-2>a href#the-select-element>select/a>/code> elements dt>dfn idcontrol-group-password>Password/dfn> dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-6>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-6>a href#attr-input-type>type/a>/code> attribute in the a href#hidden-state-(typehidden) idautofilling-form-controls:-the-autocomplete-attribute:hidden-state-(typehidden)-4>Hidden/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-7>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-7>a href#attr-input-type>type/a>/code> attribute in the a href#text-(typetext)-state-and-search-state-(typesearch) idautofilling-form-controls:-the-autocomplete-attribute:text-(typetext)-state-and-search-state-(typesearch)-3>Text/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-8>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-8>a href#attr-input-type>type/a>/code> attribute in the a href#text-(typetext)-state-and-search-state-(typesearch) idautofilling-form-controls:-the-autocomplete-attribute:text-(typetext)-state-and-search-state-(typesearch)-4>Search/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-9>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-9>a href#attr-input-type>type/a>/code> attribute in the a href#password-state-(typepassword) idautofilling-form-controls:-the-autocomplete-attribute:password-state-(typepassword)>Password/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-3>a href#the-textarea-element>textarea/a>/code> elements dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-select-element-3>a href#the-select-element>select/a>/code> elements dt>dfn idcontrol-group-url>URL/dfn> dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-10>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-10>a href#attr-input-type>type/a>/code> attribute in the a href#hidden-state-(typehidden) idautofilling-form-controls:-the-autocomplete-attribute:hidden-state-(typehidden)-5>Hidden/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-11>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-11>a href#attr-input-type>type/a>/code> attribute in the a href#text-(typetext)-state-and-search-state-(typesearch) idautofilling-form-controls:-the-autocomplete-attribute:text-(typetext)-state-and-search-state-(typesearch)-5>Text/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-12>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-12>a href#attr-input-type>type/a>/code> attribute in the a href#text-(typetext)-state-and-search-state-(typesearch) idautofilling-form-controls:-the-autocomplete-attribute:text-(typetext)-state-and-search-state-(typesearch)-6>Search/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-13>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-13>a href#attr-input-type>type/a>/code> attribute in the a href#url-state-(typeurl) idautofilling-form-controls:-the-autocomplete-attribute:url-state-(typeurl)>URL/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-4>a href#the-textarea-element>textarea/a>/code> elements dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-select-element-4>a href#the-select-element>select/a>/code> elements dt>dfn idcontrol-group-e-mail>E-mail/dfn> dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-14>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-14>a href#attr-input-type>type/a>/code> attribute in the a href#hidden-state-(typehidden) idautofilling-form-controls:-the-autocomplete-attribute:hidden-state-(typehidden)-6>Hidden/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-15>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-15>a href#attr-input-type>type/a>/code> attribute in the a href#text-(typetext)-state-and-search-state-(typesearch) idautofilling-form-controls:-the-autocomplete-attribute:text-(typetext)-state-and-search-state-(typesearch)-7>Text/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-16>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-16>a href#attr-input-type>type/a>/code> attribute in the a href#text-(typetext)-state-and-search-state-(typesearch) idautofilling-form-controls:-the-autocomplete-attribute:text-(typetext)-state-and-search-state-(typesearch)-8>Search/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-17>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-17>a href#attr-input-type>type/a>/code> attribute in the a href#e-mail-state-(typeemail) idautofilling-form-controls:-the-autocomplete-attribute:e-mail-state-(typeemail)>E-mail/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-5>a href#the-textarea-element>textarea/a>/code> elements dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-select-element-5>a href#the-select-element>select/a>/code> elements dt>dfn idcontrol-group-tel>Tel/dfn> dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-18>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-18>a href#attr-input-type>type/a>/code> attribute in the a href#hidden-state-(typehidden) idautofilling-form-controls:-the-autocomplete-attribute:hidden-state-(typehidden)-7>Hidden/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-19>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-19>a href#attr-input-type>type/a>/code> attribute in the a href#text-(typetext)-state-and-search-state-(typesearch) idautofilling-form-controls:-the-autocomplete-attribute:text-(typetext)-state-and-search-state-(typesearch)-9>Text/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-20>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-20>a href#attr-input-type>type/a>/code> attribute in the a href#text-(typetext)-state-and-search-state-(typesearch) idautofilling-form-controls:-the-autocomplete-attribute:text-(typetext)-state-and-search-state-(typesearch)-10>Search/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-21>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-21>a href#attr-input-type>type/a>/code> attribute in the a href#telephone-state-(typetel) idautofilling-form-controls:-the-autocomplete-attribute:telephone-state-(typetel)>Telephone/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-6>a href#the-textarea-element>textarea/a>/code> elements dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-select-element-6>a href#the-select-element>select/a>/code> elements dt>dfn idcontrol-group-numeric>Numeric/dfn> dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-22>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-22>a href#attr-input-type>type/a>/code> attribute in the a href#hidden-state-(typehidden) idautofilling-form-controls:-the-autocomplete-attribute:hidden-state-(typehidden)-8>Hidden/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-23>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-23>a href#attr-input-type>type/a>/code> attribute in the a href#text-(typetext)-state-and-search-state-(typesearch) idautofilling-form-controls:-the-autocomplete-attribute:text-(typetext)-state-and-search-state-(typesearch)-11>Text/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-24>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-24>a href#attr-input-type>type/a>/code> attribute in the a href#text-(typetext)-state-and-search-state-(typesearch) idautofilling-form-controls:-the-autocomplete-attribute:text-(typetext)-state-and-search-state-(typesearch)-12>Search/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-25>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-25>a href#attr-input-type>type/a>/code> attribute in the a href#number-state-(typenumber) idautofilling-form-controls:-the-autocomplete-attribute:number-state-(typenumber)>Number/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-7>a href#the-textarea-element>textarea/a>/code> elements dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-select-element-7>a href#the-select-element>select/a>/code> elements dt>dfn idcontrol-group-month>Month/dfn> dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-26>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-26>a href#attr-input-type>type/a>/code> attribute in the a href#hidden-state-(typehidden) idautofilling-form-controls:-the-autocomplete-attribute:hidden-state-(typehidden)-9>Hidden/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-27>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-27>a href#attr-input-type>type/a>/code> attribute in the a href#text-(typetext)-state-and-search-state-(typesearch) idautofilling-form-controls:-the-autocomplete-attribute:text-(typetext)-state-and-search-state-(typesearch)-13>Text/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-28>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-28>a href#attr-input-type>type/a>/code> attribute in the a href#text-(typetext)-state-and-search-state-(typesearch) idautofilling-form-controls:-the-autocomplete-attribute:text-(typetext)-state-and-search-state-(typesearch)-14>Search/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-29>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-29>a href#attr-input-type>type/a>/code> attribute in the a href#month-state-(typemonth) idautofilling-form-controls:-the-autocomplete-attribute:month-state-(typemonth)>Month/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-8>a href#the-textarea-element>textarea/a>/code> elements dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-select-element-8>a href#the-select-element>select/a>/code> elements dt>dfn idcontrol-group-date>Date/dfn> dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-30>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-30>a href#attr-input-type>type/a>/code> attribute in the a href#hidden-state-(typehidden) idautofilling-form-controls:-the-autocomplete-attribute:hidden-state-(typehidden)-10>Hidden/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-31>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-31>a href#attr-input-type>type/a>/code> attribute in the a href#text-(typetext)-state-and-search-state-(typesearch) idautofilling-form-controls:-the-autocomplete-attribute:text-(typetext)-state-and-search-state-(typesearch)-15>Text/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-32>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-32>a href#attr-input-type>type/a>/code> attribute in the a href#text-(typetext)-state-and-search-state-(typesearch) idautofilling-form-controls:-the-autocomplete-attribute:text-(typetext)-state-and-search-state-(typesearch)-16>Search/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-input-element-33>a href#the-input-element>input/a>/code> elements with a code idautofilling-form-controls:-the-autocomplete-attribute:attr-input-type-33>a href#attr-input-type>type/a>/code> attribute in the a href#date-state-(typedate) idautofilling-form-controls:-the-autocomplete-attribute:date-state-(typedate)>Date/a> state dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-9>a href#the-textarea-element>textarea/a>/code> elements dd>code idautofilling-form-controls:-the-autocomplete-attribute:the-select-element-9>a href#the-select-element>select/a>/code> elements /dl> p idmore-on-address-levels>strong>Address levels/strong>: The code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-level1-2>a href#attr-fe-autocomplete-address-level1>address-level1/a>/code> – code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-level4-2>a href#attr-fe-autocomplete-address-level4>address-level4/a>/code> fields are used to describe the locality of the street address. Different locales have different numbers of levels. For example, the US uses two levels (state and town), the UK uses one or two depending on the address (the post town, and in some cases the locality), and China can use three (province, city, district). The code idautofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-level1-3>a href#attr-fe-autocomplete-address-level1>address-level1/a>/code> field represents the widest administrative division. Different locales order the fields in different ways; for example, in the US the town (level 2) precedes the state (level 1); while in Japan the prefecture (level 1) precedes the city (level 2) which precedes the district (level 3). Authors are encouraged to provide forms that are presented in a way that matches the countrys conventions (hiding, showing, and rearranging fields accordingly as the user changes the country)./p> h6 idautofill-processing-model>span classsecno>4.10.18.8.2/span> span idprocessing-model-3>/span>Processing modela href#autofill-processing-model classself-link>/a>/h6> p>Each code idautofill-processing-model:the-input-element>a href#the-input-element>input/a>/code> element to which the code idautofill-processing-model:attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code> attribute a href#concept-input-apply idautofill-processing-model:concept-input-apply>applies/a>, each code idautofill-processing-model:the-select-element>a href#the-select-element>select/a>/code> element, and each code idautofill-processing-model:the-textarea-element>a href#the-textarea-element>textarea/a>/code> element, has an dfn idautofill-hint-set>autofill hint set/dfn>, an dfn idautofill-scope>autofill scope/dfn>, an dfn idautofill-field-name>autofill field name/dfn>, and an dfn ididl-exposed-autofill-value>IDL-exposed autofill value/dfn>./p> p>The a href#autofill-field-name idautofill-processing-model:autofill-field-name>autofill field name/a> specifies the specific kind of data expected in the field, e.g. code idautofill-processing-model:attr-fe-autocomplete-street-address>a href#attr-fe-autocomplete-street-address>street-address/a>/code> or code idautofill-processing-model:attr-fe-autocomplete-cc-exp>a href#attr-fe-autocomplete-cc-exp>cc-exp/a>/code>./p> p>The a href#autofill-hint-set idautofill-processing-model:autofill-hint-set>autofill hint set/a> identifies what address or contact information type the user agent is to look at, e.g. code idautofill-processing-model:attr-fe-autocomplete-shipping>a href#attr-fe-autocomplete-shipping>shipping/a>/code> code idautofill-processing-model:attr-fe-autocomplete-fax>a href#attr-fe-autocomplete-fax>fax/a>/code> or code idautofill-processing-model:attr-fe-autocomplete-billing>a href#attr-fe-autocomplete-billing>billing/a>/code>./p> p>The a href#autofill-scope idautofill-processing-model:autofill-scope>autofill scope/a> identifies the group of fields whose information concerns the same subject, and consists of the a href#autofill-hint-set idautofill-processing-model:autofill-hint-set-2>autofill hint set/a> with, if applicable, the code>section-*/code> prefix, e.g. code>billing/code>, code>section-parent shipping/code>, or code>section-child shipping home/code>./p> p>These values are defined as the result of running the following algorithm:/p> ol>li>p>If the element has no code idautofill-processing-model:attr-fe-autocomplete-2>a href#attr-fe-autocomplete>autocomplete/a>/code> attribute, then jump to the step labeled i>default/i>.li>p>Let var>tokens/var> be the result of a hrefhttps://infra.spec.whatwg.org/#split-on-ascii-whitespace idautofill-processing-model:split-a-string-on-spaces data-x-internalsplit-a-string-on-spaces>splitting the attributes value on ASCII whitespace/a>.li>p>If var>tokens/var> is empty, then jump to the step labeled i>default/i>.li>p>Let var>index/var> be the index of the last token in var>tokens/var>.li> p>If the var>index/var>th token in var>tokens/var> is not an a idautofill-processing-model:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for one of the tokens given in the first column of the following table, or if the number of tokens in var>tokens/var> is greater than the maximum number given in the cell in the second column of that tokens row, then jump to the step labeled i>default/i>. Otherwise, let var>field/var> be the string given in the cell of the first column of the matching row, and let var>category/var> be the value of the cell in the third column of that same row./p> table>thead>tr>th>Token th>Maximum number of tokens th>Category tbody>tr>td>code idautofill-processing-model:attr-fe-autocomplete-off>a href#attr-fe-autocomplete-off>off/a>/code> td>1 td>Off tr>td>code idautofill-processing-model:attr-fe-autocomplete-on>a href#attr-fe-autocomplete-on>on/a>/code> td>1 td>Automatic tbody>tr>td>code idautofill-processing-model:attr-fe-autocomplete-name>a href#attr-fe-autocomplete-name>name/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-honorific-prefix>a href#attr-fe-autocomplete-honorific-prefix>honorific-prefix/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-given-name>a href#attr-fe-autocomplete-given-name>given-name/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-additional-name>a href#attr-fe-autocomplete-additional-name>additional-name/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-family-name>a href#attr-fe-autocomplete-family-name>family-name/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-honorific-suffix>a href#attr-fe-autocomplete-honorific-suffix>honorific-suffix/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-nickname>a href#attr-fe-autocomplete-nickname>nickname/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-organization-title>a href#attr-fe-autocomplete-organization-title>organization-title/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-username>a href#attr-fe-autocomplete-username>username/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-new-password>a href#attr-fe-autocomplete-new-password>new-password/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-current-password>a href#attr-fe-autocomplete-current-password>current-password/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-organization>a href#attr-fe-autocomplete-organization>organization/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-street-address-2>a href#attr-fe-autocomplete-street-address>street-address/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-address-line1>a href#attr-fe-autocomplete-address-line1>address-line1/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-address-line2>a href#attr-fe-autocomplete-address-line2>address-line2/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-address-line3>a href#attr-fe-autocomplete-address-line3>address-line3/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-address-level4>a href#attr-fe-autocomplete-address-level4>address-level4/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-address-level3>a href#attr-fe-autocomplete-address-level3>address-level3/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-address-level2>a href#attr-fe-autocomplete-address-level2>address-level2/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-address-level1>a href#attr-fe-autocomplete-address-level1>address-level1/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-country>a href#attr-fe-autocomplete-country>country/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-country-name>a href#attr-fe-autocomplete-country-name>country-name/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-postal-code>a href#attr-fe-autocomplete-postal-code>postal-code/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-cc-name>a href#attr-fe-autocomplete-cc-name>cc-name/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-cc-given-name>a href#attr-fe-autocomplete-cc-given-name>cc-given-name/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-cc-additional-name>a href#attr-fe-autocomplete-cc-additional-name>cc-additional-name/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-cc-family-name>a href#attr-fe-autocomplete-cc-family-name>cc-family-name/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-cc-number>a href#attr-fe-autocomplete-cc-number>cc-number/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-cc-exp-2>a href#attr-fe-autocomplete-cc-exp>cc-exp/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-cc-exp-month>a href#attr-fe-autocomplete-cc-exp-month>cc-exp-month/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-cc-exp-year>a href#attr-fe-autocomplete-cc-exp-year>cc-exp-year/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-cc-csc>a href#attr-fe-autocomplete-cc-csc>cc-csc/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-cc-type>a href#attr-fe-autocomplete-cc-type>cc-type/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-transaction-currency>a href#attr-fe-autocomplete-transaction-currency>transaction-currency/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-transaction-amount>a href#attr-fe-autocomplete-transaction-amount>transaction-amount/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-language>a href#attr-fe-autocomplete-language>language/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-bday>a href#attr-fe-autocomplete-bday>bday/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-bday-day>a href#attr-fe-autocomplete-bday-day>bday-day/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-bday-month>a href#attr-fe-autocomplete-bday-month>bday-month/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-bday-year>a href#attr-fe-autocomplete-bday-year>bday-year/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-sex>a href#attr-fe-autocomplete-sex>sex/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-url>a href#attr-fe-autocomplete-url>url/a>/code> td>3 td>Normal tr>td>code idautofill-processing-model:attr-fe-autocomplete-photo>a href#attr-fe-autocomplete-photo>photo/a>/code> td>3 td>Normal tbody>tr>td>code idautofill-processing-model:attr-fe-autocomplete-tel>a href#attr-fe-autocomplete-tel>tel/a>/code> td>4 td>Contact tr>td>code idautofill-processing-model:attr-fe-autocomplete-tel-country-code>a href#attr-fe-autocomplete-tel-country-code>tel-country-code/a>/code> td>4 td>Contact tr>td>code idautofill-processing-model:attr-fe-autocomplete-tel-national>a href#attr-fe-autocomplete-tel-national>tel-national/a>/code> td>4 td>Contact tr>td>code idautofill-processing-model:attr-fe-autocomplete-tel-area-code>a href#attr-fe-autocomplete-tel-area-code>tel-area-code/a>/code> td>4 td>Contact tr>td>code idautofill-processing-model:attr-fe-autocomplete-tel-local>a href#attr-fe-autocomplete-tel-local>tel-local/a>/code> td>4 td>Contact tr>td>code idautofill-processing-model:attr-fe-autocomplete-tel-local-prefix>a href#attr-fe-autocomplete-tel-local-prefix>tel-local-prefix/a>/code> td>4 td>Contact tr>td>code idautofill-processing-model:attr-fe-autocomplete-tel-local-suffix>a href#attr-fe-autocomplete-tel-local-suffix>tel-local-suffix/a>/code> td>4 td>Contact tr>td>code idautofill-processing-model:attr-fe-autocomplete-tel-extension>a href#attr-fe-autocomplete-tel-extension>tel-extension/a>/code> td>4 td>Contact tr>td>code idautofill-processing-model:attr-fe-autocomplete-email>a href#attr-fe-autocomplete-email>email/a>/code> td>4 td>Contact tr>td>code idautofill-processing-model:attr-fe-autocomplete-impp>a href#attr-fe-autocomplete-impp>impp/a>/code> td>4 td>Contact /table> li>p>If var>category/var> is Off or Automatic but the elements code idautofill-processing-model:attr-fe-autocomplete-3>a href#attr-fe-autocomplete>autocomplete/a>/code> attribute is wearing the a href#autofill-anchor-mantle idautofill-processing-model:autofill-anchor-mantle>autofill anchor mantle/a>, then jump to the step labeled i>default/i>.li>p>If var>category/var> is Off, let the elements a href#autofill-field-name idautofill-processing-model:autofill-field-name-2>autofill field name/a> be the string code>off/code>, let its a href#autofill-hint-set idautofill-processing-model:autofill-hint-set-3>autofill hint set/a> be empty, and let its a href#idl-exposed-autofill-value idautofill-processing-model:idl-exposed-autofill-value>IDL-exposed autofill value/a> be the string code>off/code>. Then, abort these steps./p> li>p>If var>category/var> is Automatic, let the elements a href#autofill-field-name idautofill-processing-model:autofill-field-name-3>autofill field name/a> be the string code>on/code>, let its a href#autofill-hint-set idautofill-processing-model:autofill-hint-set-4>autofill hint set/a> be empty, and let its a href#idl-exposed-autofill-value idautofill-processing-model:idl-exposed-autofill-value-2>IDL-exposed autofill value/a> be the string code>on/code>. Then, abort these steps./p> li>p>Let var>scope tokens/var> be an empty list.li>p>Let var>hint tokens/var> be an empty set.li>p>Let var>IDL value/var> have the same value as var>field/var>.li>p>If the var>index/var>th token in var>tokens/var> is the first entry, then skip to the step labeled i>done/i>.li>p>Decrement var>index/var> by one.li> p>If var>category/var> is Contact and the var>index/var>th token in var>tokens/var> is an a idautofill-processing-model:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for one of the strings in the following list, then run the substeps that follow:/p> ul classbrief>li>code idautofill-processing-model:attr-fe-autocomplete-home>a href#attr-fe-autocomplete-home>home/a>/code> li>code idautofill-processing-model:attr-fe-autocomplete-work>a href#attr-fe-autocomplete-work>work/a>/code> li>code idautofill-processing-model:attr-fe-autocomplete-mobile>a href#attr-fe-autocomplete-mobile>mobile/a>/code> li>code idautofill-processing-model:attr-fe-autocomplete-fax-2>a href#attr-fe-autocomplete-fax>fax/a>/code> li>code idautofill-processing-model:attr-fe-autocomplete-pager>a href#attr-fe-autocomplete-pager>pager/a>/code> /ul> p>The substeps are:/p> ol>li>p>Let var>contact/var> be the matching string from the list above.li>p>Insert var>contact/var> at the start of var>scope tokens/var>.li>p>Add var>contact/var> to var>hint tokens/var>.li>p>Let var>IDL value/var> be the concatenation of var>contact/var>, a U+0020 SPACE character, and the previous value of var>IDL value/var> (which at this point will always be var>field/var>).li>p>If the var>index/var>th entry in var>tokens/var> is the first entry, then skip to the step labeled i>done/i>.li>p>Decrement var>index/var> by one./ol> li> p>If the var>index/var>th token in var>tokens/var> is an a idautofill-processing-model:ascii-case-insensitive-3 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for one of the strings in the following list, then run the substeps that follow:/p> ul classbrief>li>code idautofill-processing-model:attr-fe-autocomplete-shipping-2>a href#attr-fe-autocomplete-shipping>shipping/a>/code> li>code idautofill-processing-model:attr-fe-autocomplete-billing-2>a href#attr-fe-autocomplete-billing>billing/a>/code> /ul> p>The substeps are:/p> ol>li>p>Let var>mode/var> be the matching string from the list above.li>p>Insert var>mode/var> at the start of var>scope tokens/var>.li>p>Add var>mode/var> to var>hint tokens/var>.li>p>Let var>IDL value/var> be the concatenation of var>mode/var>, a U+0020 SPACE character, and the previous value of var>IDL value/var> (which at this point will either be var>field/var> or the concatenation of var>contact/var>, a space, and var>field/var>).li>p>If the var>index/var>th entry in var>tokens/var> is the first entry, then skip to the step labeled i>done/i>.li>p>Decrement var>index/var> by one./ol> li>p>If the var>index/var>th entry in var>tokens/var> is not the first entry, then jump to the step labeled i>default/i>.li>p>If the first eight characters of the var>index/var>th token in var>tokens/var> are not an a idautofill-processing-model:ascii-case-insensitive-4 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code idautofill-processing-model:attr-fe-autocomplete-section>a href#attr-fe-autocomplete-section>section-/a>/code>, then jump to the step labeled i>default/i>.li>p>Let var>section/var> be the var>index/var>th token in var>tokens/var>, a idautofill-processing-model:converted-to-ascii-lowercase hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>.li>p>Insert var>section/var> at the start of var>scope tokens/var>.li>p>Let var>IDL value/var> be the concatenation of var>section/var>, a U+0020 SPACE character, and the previous value of var>IDL value/var>.li>p>i>Done/i>: Let the elements a href#autofill-hint-set idautofill-processing-model:autofill-hint-set-5>autofill hint set/a> be var>hint tokens/var>./p> li>p>Let the elements a href#autofill-scope idautofill-processing-model:autofill-scope-2>autofill scope/a> be var>scope tokens/var>./p> li>p>Let the elements a href#autofill-field-name idautofill-processing-model:autofill-field-name-4>autofill field name/a> be var>field/var>./p> li>p>Let the elements a href#idl-exposed-autofill-value idautofill-processing-model:idl-exposed-autofill-value-3>IDL-exposed autofill value/a> be var>IDL value/var>./p> li>p>Abort these steps.li>p>i>Default/i>: Let the elements a href#idl-exposed-autofill-value idautofill-processing-model:idl-exposed-autofill-value-4>IDL-exposed autofill value/a> be the empty string, and its a href#autofill-hint-set idautofill-processing-model:autofill-hint-set-6>autofill hint set/a> and a href#autofill-scope idautofill-processing-model:autofill-scope-3>autofill scope/a> be empty.li>p>If the elements code idautofill-processing-model:attr-fe-autocomplete-4>a href#attr-fe-autocomplete>autocomplete/a>/code> attribute is wearing the a href#autofill-anchor-mantle idautofill-processing-model:autofill-anchor-mantle-2>autofill anchor mantle/a>, then let the elements a href#autofill-field-name idautofill-processing-model:autofill-field-name-5>autofill field name/a> be the empty string and abort these steps.li>p>Let var>form/var> be the elements a href#form-owner idautofill-processing-model:form-owner>form owner/a>, if any, or null otherwise.li> p>If var>form/var> is not null and var>form/var>s code idautofill-processing-model:attr-form-autocomplete>a href#attr-form-autocomplete>autocomplete/a>/code> attribute is in the a href#attr-form-autocomplete-off-state idautofill-processing-model:attr-form-autocomplete-off-state>off/a> state, then let the elements a href#autofill-field-name idautofill-processing-model:autofill-field-name-6>autofill field name/a> be code idautofill-processing-model:attr-fe-autocomplete-off-2>a href#attr-fe-autocomplete-off>off/a>/code>./p> p>Otherwise, let the elements a href#autofill-field-name idautofill-processing-model:autofill-field-name-7>autofill field name/a> be code idautofill-processing-model:attr-fe-autocomplete-on-2>a href#attr-fe-autocomplete-on>on/a>/code>./p> /ol> hr> p>For the purposes of autofill, a dfn idcontrols-data>controls data/dfn> depends on the kind of control:/p> dl>dt>An code idautofill-processing-model:the-input-element-2>a href#the-input-element>input/a>/code> element with its code idautofill-processing-model:attr-input-type>a href#attr-input-type>type/a>/code> attribute in the a href#e-mail-state-(typeemail) idautofill-processing-model:e-mail-state-(typeemail)>E-mail/a> state and with the code idautofill-processing-model:attr-input-multiple>a href#attr-input-multiple>multiple/a>/code> attribute specifieddd>The elements a href#concept-fe-values idautofill-processing-model:concept-fe-values>valueem>s/em>/a>.dt>Any other code idautofill-processing-model:the-input-element-3>a href#the-input-element>input/a>/code> elementdt>A code idautofill-processing-model:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code> elementdd>The elements a href#concept-fe-value idautofill-processing-model:concept-fe-value>value/a>.dt>A code idautofill-processing-model:the-select-element-2>a href#the-select-element>select/a>/code> element with its code idautofill-processing-model:attr-select-multiple>a href#attr-select-multiple>multiple/a>/code> attribute specifieddd>The code idautofill-processing-model:the-option-element>a href#the-option-element>option/a>/code> elements in the code idautofill-processing-model:the-select-element-3>a href#the-select-element>select/a>/code> elements a href#concept-select-option-list idautofill-processing-model:concept-select-option-list>list of options/a> that have their a href#concept-option-selectedness idautofill-processing-model:concept-option-selectedness>selectedness/a> set to true.dt>Any other code idautofill-processing-model:the-select-element-4>a href#the-select-element>select/a>/code> elementdd>The code idautofill-processing-model:the-option-element-2>a href#the-option-element>option/a>/code> element in the code idautofill-processing-model:the-select-element-5>a href#the-select-element>select/a>/code> elements a href#concept-select-option-list idautofill-processing-model:concept-select-option-list-2>list of options/a> that has its a href#concept-option-selectedness idautofill-processing-model:concept-option-selectedness-2>selectedness/a> set to true./dl> hr> p>How to process the a href#autofill-hint-set idautofill-processing-model:autofill-hint-set-7>autofill hint set/a>, a href#autofill-scope idautofill-processing-model:autofill-scope-4>autofill scope/a>, and a href#autofill-field-name idautofill-processing-model:autofill-field-name-8>autofill field name/a> depends on the mantle that the code idautofill-processing-model:attr-fe-autocomplete-5>a href#attr-fe-autocomplete>autocomplete/a>/code> attribute is wearing./p> dl classswitch>dt>When wearing the a href#autofill-expectation-mantle idautofill-processing-model:autofill-expectation-mantle>autofill expectation mantle/a>... dd> p>When an elements a href#autofill-field-name idautofill-processing-model:autofill-field-name-9>autofill field name/a> is code idautofill-processing-model:attr-fe-autocomplete-off-3>a href#attr-fe-autocomplete-off>off/a>/code>, the user agent should not remember the a href#controls-data idautofill-processing-model:controls-data>controls data/a>, and should not offer past values to the user./p> p classnote>In addition, when an elements a href#autofill-field-name idautofill-processing-model:autofill-field-name-10>autofill field name/a> is code idautofill-processing-model:attr-fe-autocomplete-off-4>a href#attr-fe-autocomplete-off>off/a>/code>, a href#history-autocomplete>values are reset/a> when a href#traverse-the-history idautofill-processing-model:traverse-the-history>traversing the history/a>./p> div classexample> p>Banks frequently do not want UAs to prefill login information:/p> pre><p><label>Account: <input typetext nameac autocompleteoff></label></p><p><label>PIN: <input typepassword namepin autocompleteoff></label></p>/pre> /div> p>When an elements a href#autofill-field-name idautofill-processing-model:autofill-field-name-11>autofill field name/a> is em>not/em> code idautofill-processing-model:attr-fe-autocomplete-off-5>a href#attr-fe-autocomplete-off>off/a>/code>, the user agent may store the a href#controls-data idautofill-processing-model:controls-data-2>controls data/a>, and may offer previously stored values to the user./p> div classexample> p>For example, suppose a user visits a page with this control:/p> pre><select namecountry> <option>Afghanistan <option>Albania <option>Algeria <option>Andorra <option>Angola <option>Antigua and Barbuda <option>Argentina <option>Armenia <!-- em>.../em> --> <option>Yemen <option>Zambia <option>Zimbabwe</select>/pre> p>This might render as follows:/p> p>img src/images/select-country-1.png altA drop-down control with a long alphabetical list of countries.>/p> p>Suppose that on the first visit to this page, the user selects Zambia. On the second visit, the user agent could duplicate the entry for Zambia at the top of the list, so that the interface instead looks like this:/p> p>img src/images/select-country-2.png altThe same drop-down control with the alphabetical list of countries, but with Zambia as an entry at the top.>/p> /div> p>When the a href#autofill-field-name idautofill-processing-model:autofill-field-name-12>autofill field name/a> is code idautofill-processing-model:attr-fe-autocomplete-on-3>a href#attr-fe-autocomplete-on>on/a>/code>, the user agent should attempt to use heuristics to determine the most appropriate values to offer the user, e.g. based on the elements code idautofill-processing-model:attr-fe-name>a href#attr-fe-name>name/a>/code> value, the position of the element in its a idautofill-processing-model:tree hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a>, what other fields exist in the form, and so forth./p> p>When the a href#autofill-field-name idautofill-processing-model:autofill-field-name-13>autofill field name/a> is one of the names of the a href#autofill-field idautofill-processing-model:autofill-field>autofill fields/a> described above, the user agent should provide suggestions that match the meaning of the field name as given in the table earlier in this section. The a href#autofill-hint-set idautofill-processing-model:autofill-hint-set-8>autofill hint set/a> should be used to select amongst multiple possible suggestions./p> p classexample>For example, if a user once entered one address into fields that used the code idautofill-processing-model:attr-fe-autocomplete-shipping-3>a href#attr-fe-autocomplete-shipping>shipping/a>/code> keyword, and another address into fields that used the code idautofill-processing-model:attr-fe-autocomplete-billing-3>a href#attr-fe-autocomplete-billing>billing/a>/code> keyword, then in subsequent forms only the first address would be suggested for form controls whose a href#autofill-hint-set idautofill-processing-model:autofill-hint-set-9>autofill hint set/a> contains the keyword code idautofill-processing-model:attr-fe-autocomplete-shipping-4>a href#attr-fe-autocomplete-shipping>shipping/a>/code>. Both addresses might be suggested, however, for address-related form controls whose a href#autofill-hint-set idautofill-processing-model:autofill-hint-set-10>autofill hint set/a> does not contain either keyword./p> dt>When wearing the a href#autofill-anchor-mantle idautofill-processing-model:autofill-anchor-mantle-3>autofill anchor mantle/a>... dd> p>When the a href#autofill-field-name idautofill-processing-model:autofill-field-name-14>autofill field name/a> is not the empty string, then the user agent must act as if the user had specified the a href#controls-data idautofill-processing-model:controls-data-3>controls data/a> for the given a href#autofill-hint-set idautofill-processing-model:autofill-hint-set-11>autofill hint set/a>, a href#autofill-scope idautofill-processing-model:autofill-scope-5>autofill scope/a>, and a href#autofill-field-name idautofill-processing-model:autofill-field-name-15>autofill field name/a> combination./p> /dl> p>When the user agent dfn idconcept-fe-autofill>autofills form controls/dfn>, elements with the same a href#form-owner idautofill-processing-model:form-owner-2>form owner/a> and the same a href#autofill-scope idautofill-processing-model:autofill-scope-6>autofill scope/a> must use data relating to the same person, address, payment instrument, and contact details. span idautofill-country>When a user agent autofills code idautofill-processing-model:attr-fe-autocomplete-country-2>a href#attr-fe-autocomplete-country>country/a>/code> and code idautofill-processing-model: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 idautofill-processing-model:form-owner-3>form owner/a> and a href#autofill-scope idautofill-processing-model:autofill-scope-7>autofill scope/a>, and the user agent has a value for the code idautofill-processing-model:attr-fe-autocomplete-country-3>a href#attr-fe-autocomplete-country>country/a>/code> field(s), then the code idautofill-processing-model:attr-fe-autocomplete-country-name-3>a href#attr-fe-autocomplete-country-name>country-name/a>/code> field(s) must be filled using a human-readable name for the same country./span> When a user agent fills in multiple fields at once, all fields with the same a href#autofill-field-name idautofill-processing-model:autofill-field-name-16>autofill field name/a>, a href#form-owner idautofill-processing-model:form-owner-4>form owner/a> and a href#autofill-scope idautofill-processing-model:autofill-scope-8>autofill scope/a> must be filled with the same value./p> p classexample>Suppose a user agent knows of two phone numbers, +1 555 123 1234 and +1 555 666 7777. It would not be conforming for the user agent to fill a field with code>autocompleteshipping tel-local-prefix/code> with the value 123 and another field in the same form with code>autocompleteshipping tel-local-suffix/code> with the value 7777. The only valid prefilled values given the aforementioned information would be 123 and 1234, or 666 and 7777, respectively./p> p classexample>Similarly, if a form for some reason contained both a code idautofill-processing-model:attr-fe-autocomplete-cc-exp-3>a href#attr-fe-autocomplete-cc-exp>cc-exp/a>/code> field and a code idautofill-processing-model:attr-fe-autocomplete-cc-exp-month-2>a href#attr-fe-autocomplete-cc-exp-month>cc-exp-month/a>/code> field, and the user agent prefilled the form, then the month component of the former would have to match the latter./p> div classexample> p>This requirement interacts with the a href#autofill-anchor-mantle idautofill-processing-model:autofill-anchor-mantle-4>autofill anchor mantle/a> also. Consider the following markup snippet:/p> pre><form> <input typehidden autocompletenickname valueTreePlate> <input typetext autocompletenickname></form>/pre> p>The only value that a conforming user agent could suggest in the text control is TreePlate, the value given by the hidden code idautofill-processing-model:the-input-element-4>a href#the-input-element>input/a>/code> element./p> /div> p>The code>section-*/code> tokens in the a href#autofill-scope idautofill-processing-model:autofill-scope-9>autofill scope/a> are opaque; user agents must not attempt to derive meaning from the precise values of these tokens./p> p classexample>For example, it would not be conforming if the user agent decided that it should offer the address it knows to be the users daughters address for code>section-child/code> and the addresses it knows to be the users spouses addresses for code>section-spouse/code>./p> p>The autocompletion mechanism must be implemented by the user agent acting as if the user had modified the a href#controls-data idautofill-processing-model:controls-data-4>controls data/a>, and must be done at a time where the element is i idautofill-processing-model:concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i> (e.g. just after the element has been inserted into the document, or when the user agent a href#stop-parsing idautofill-processing-model:stop-parsing>stops parsing/a>). User agents must only prefill controls using values that the user could have entered./p> p classexample>For example, if a code idautofill-processing-model:the-select-element-6>a href#the-select-element>select/a>/code> element only has code idautofill-processing-model:the-option-element-3>a href#the-option-element>option/a>/code> elements with values Steve and Rebecca, Jay, and Bob, and has an a href#autofill-field-name idautofill-processing-model:autofill-field-name-17>autofill field name/a> code idautofill-processing-model:attr-fe-autocomplete-given-name-2>a href#attr-fe-autocomplete-given-name>given-name/a>/code>, but the user agents only idea for what to prefill the field with is Evan, then the user agent cannot prefill the field. It would not be conforming to somehow set the code idautofill-processing-model:the-select-element-7>a href#the-select-element>select/a>/code> element to the value Evan, since the user could not have done so themselves./p> p>A user agent prefilling a form control must not discriminate between form controls that are a idautofill-processing-model:in-a-document-tree hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a> and those that are a idautofill-processing-model:connected hrefhttps://dom.spec.whatwg.org/#connected data-x-internalconnected>connected/a>; that is, it is not conforming to make the decision on whether or not to autofill based on whether the elements a idautofill-processing-model:root hrefhttps://dom.spec.whatwg.org/#concept-tree-root data-x-internalroot>root/a> is a a idautofill-processing-model:shadow-root hrefhttps://dom.spec.whatwg.org/#concept-shadow-root data-x-internalshadow-root>shadow root/a> versus a code idautofill-processing-model:document>a href#document>Document/a>/code>./p> p>A user agent prefilling a form controls a href#concept-fe-value idautofill-processing-model:concept-fe-value-2>value/a> must not cause that control to a href#suffering-from-a-type-mismatch idautofill-processing-model:suffering-from-a-type-mismatch>suffer from a type mismatch/a>, a href#suffering-from-being-too-long idautofill-processing-model:suffering-from-being-too-long>suffer from being too long/a>, a href#suffering-from-being-too-short idautofill-processing-model:suffering-from-being-too-short>suffer from being too short/a>, a href#suffering-from-an-underflow idautofill-processing-model:suffering-from-an-underflow>suffer from an underflow/a>, a href#suffering-from-an-overflow idautofill-processing-model:suffering-from-an-overflow>suffer from an overflow/a>, or a href#suffering-from-a-step-mismatch idautofill-processing-model:suffering-from-a-step-mismatch>suffer from a step mismatch/a>. A user agent prefilling a form controls a href#concept-fe-value idautofill-processing-model:concept-fe-value-3>value/a> must not cause that control to a href#suffering-from-a-pattern-mismatch idautofill-processing-model:suffering-from-a-pattern-mismatch>suffer from a pattern mismatch/a> either. Where possible given the controls constraints, user agents must use the format given as canonical in the aforementioned table. Where its not possible for the canonical format to be used, user agents should use heuristics to attempt to convert values so that they can be used./p> div classexample> p>For example, if the user agent knows that the users middle name is Ines, and attempts to prefill a form control that looks like this:/p> pre><input namemiddle-initial maxlength1 autocompleteadditional-name>/pre> p>...then the user agent could convert Ines to I and prefill it that way./p> /div> div classexample> p>A more elaborate example would be with month values. If the user agent knows that the users birthday is the 27th of July 2012, then it might try to prefill all of the following controls with slightly different values, all driven from this information:/p> table>tr>td> pre><input nameb typemonth autocompletebday>/pre> td> 2012-07 td> The day is dropped since the a href#month-state-(typemonth) idautofill-processing-model:month-state-(typemonth)>Month/a> state only accepts a month/year combination. (Note that this example is non-conforming, because the a href#autofill-field-name idautofill-processing-model:autofill-field-name-18>autofill field name/a> code idautofill-processing-model:attr-fe-autocomplete-bday-2>a href#attr-fe-autocomplete-bday>bday/a>/code> is not allowed with the a href#month-state-(typemonth) idautofill-processing-model:month-state-(typemonth)-2>Month/a> state.) tr>td> pre><select namec autocompletebday> <option>Jan <option>Feb em>.../em> <option>Jul <option>Aug em>.../em></select>/pre> td> July td> The user agent picks the month from the listed options, either by noticing there are twelve options and picking the 7th, or by recognizing that one of the strings (three characters Jul followed by a newline and a space) is a close match for the name of the month (July) in one of the user agents supported languages, or through some other similar mechanism. tr>td> pre><input namea typenumber min1 max12 autocompletebday-month>/pre> td> 7 td> User agent converts July to a month number in the range 1..12, like the field. tr>td> pre><input namea typenumber min0 max11 autocompletebday-month>/pre> td> 6 td> User agent converts July to a month number in the range 0..11, like the field. tr>td> pre><input namea typenumber min1 max11 autocompletebday-month>/pre> td> td> User agent doesnt fill in the field, since it cant make a good guess as to what the form expects. /table> /div> p>A user agent may allow the user to override an elements a href#autofill-field-name idautofill-processing-model:autofill-field-name-19>autofill field name/a>, e.g. to change it from code idautofill-processing-model:attr-fe-autocomplete-off-6>a href#attr-fe-autocomplete-off>off/a>/code> to code idautofill-processing-model:attr-fe-autocomplete-on-4>a href#attr-fe-autocomplete-on>on/a>/code> to allow values to be remembered and prefilled despite the page authors objections, or to always code idautofill-processing-model:attr-fe-autocomplete-off-7>a href#attr-fe-autocomplete-off>off/a>/code>, never remembering values./p> p>More specifically, user agents may in particular consider replacing the a href#autofill-field-name idautofill-processing-model:autofill-field-name-20>autofill field name/a> of form controls that match the description given in the first column of the following table, when their a href#autofill-field-name idautofill-processing-model:autofill-field-name-21>autofill field name/a> is either code idautofill-processing-model:attr-fe-autocomplete-on-5>a href#attr-fe-autocomplete-on>on/a>/code> or code idautofill-processing-model:attr-fe-autocomplete-off-8>a href#attr-fe-autocomplete-off>off/a>/code>, with the value given in the second cell of that row. If this table is used, the replacements must be done in a idautofill-processing-model:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>, since all but the first row references the a href#autofill-field-name idautofill-processing-model:autofill-field-name-22>autofill field name/a> of earlier elements. When the descriptions below refer to form controls being preceded or followed by others, they mean in the list of a href#category-listed idautofill-processing-model:category-listed>listed elements/a> that share the same a href#form-owner idautofill-processing-model:form-owner-5>form owner/a>./p> table>thead>tr>th>Form control th>New a href#autofill-field-name idautofill-processing-model:autofill-field-name-23>autofill field name/a> tbody>tr>td> an code idautofill-processing-model:the-input-element-5>a href#the-input-element>input/a>/code> element whose code idautofill-processing-model:attr-input-type-2>a href#attr-input-type>type/a>/code> attribute is in the a href#text-(typetext)-state-and-search-state-(typesearch) idautofill-processing-model:text-(typetext)-state-and-search-state-(typesearch)>Text/a> state that is followed by an code idautofill-processing-model:the-input-element-6>a href#the-input-element>input/a>/code> element whose code idautofill-processing-model:attr-input-type-3>a href#attr-input-type>type/a>/code> attribute is in the a href#password-state-(typepassword) idautofill-processing-model:password-state-(typepassword)>Password/a> state td> code idautofill-processing-model:attr-fe-autocomplete-username-2>a href#attr-fe-autocomplete-username>username/a>/code> tr>td> an code idautofill-processing-model:the-input-element-7>a href#the-input-element>input/a>/code> element whose code idautofill-processing-model:attr-input-type-4>a href#attr-input-type>type/a>/code> attribute is in the a href#password-state-(typepassword) idautofill-processing-model:password-state-(typepassword)-2>Password/a> state that is preceded by an code idautofill-processing-model:the-input-element-8>a href#the-input-element>input/a>/code> element whose a href#autofill-field-name idautofill-processing-model:autofill-field-name-24>autofill field name/a> is code idautofill-processing-model:attr-fe-autocomplete-username-3>a href#attr-fe-autocomplete-username>username/a>/code> td> code idautofill-processing-model:attr-fe-autocomplete-current-password-2>a href#attr-fe-autocomplete-current-password>current-password/a>/code> tr>td> an code idautofill-processing-model:the-input-element-9>a href#the-input-element>input/a>/code> element whose code idautofill-processing-model:attr-input-type-5>a href#attr-input-type>type/a>/code> attribute is in the a href#password-state-(typepassword) idautofill-processing-model:password-state-(typepassword)-3>Password/a> state that is preceded by an code idautofill-processing-model:the-input-element-10>a href#the-input-element>input/a>/code> element whose a href#autofill-field-name idautofill-processing-model:autofill-field-name-25>autofill field name/a> is code idautofill-processing-model:attr-fe-autocomplete-current-password-3>a href#attr-fe-autocomplete-current-password>current-password/a>/code> td> code idautofill-processing-model:attr-fe-autocomplete-new-password-2>a href#attr-fe-autocomplete-new-password>new-password/a>/code> tr>td> an code idautofill-processing-model:the-input-element-11>a href#the-input-element>input/a>/code> element whose code idautofill-processing-model:attr-input-type-6>a href#attr-input-type>type/a>/code> attribute is in the a href#password-state-(typepassword) idautofill-processing-model:password-state-(typepassword)-4>Password/a> state that is preceded by an code idautofill-processing-model:the-input-element-12>a href#the-input-element>input/a>/code> element whose a href#autofill-field-name idautofill-processing-model:autofill-field-name-26>autofill field name/a> is code idautofill-processing-model:attr-fe-autocomplete-new-password-3>a href#attr-fe-autocomplete-new-password>new-password/a>/code> td> code idautofill-processing-model:attr-fe-autocomplete-new-password-4>a href#attr-fe-autocomplete-new-password>new-password/a>/code> /table> p>The dfn iddom-fe-autocomplete>code>autocomplete/code>/dfn> IDL attribute, on getting, must return the elements a href#idl-exposed-autofill-value idautofill-processing-model:idl-exposed-autofill-value-5>IDL-exposed autofill value/a>, and on setting, must a href#reflect idautofill-processing-model:reflect>reflect/a> the content attribute of the same name./p> h4 idtextFieldSelection>span classsecno>4.10.19/span> APIs for the text control selectionsa href#textFieldSelection classself-link>/a>/h4> p>The code idtextFieldSelection:the-input-element>a href#the-input-element>input/a>/code> and code idtextFieldSelection:the-textarea-element>a href#the-textarea-element>textarea/a>/code> elements define several attributes and methods for handling their selection. Their shared algorithms are defined here./p> dl classdomintro>dt>var>element/var> . code idtextFieldSelection:dom-textarea/input-select>a href#dom-textarea/input-select>select/a>/code>()dd> p>Selects everything in the text control./p> dt>var>element/var> . code idtextFieldSelection:dom-textarea/input-selectionstart>a href#dom-textarea/input-selectionstart>selectionStart/a>/code> var>value/var> dd> p>Returns the offset to the start of the selection./p> p>Can be set, to change the start of the selection./p> dt>var>element/var> . code idtextFieldSelection:dom-textarea/input-selectionend>a href#dom-textarea/input-selectionend>selectionEnd/a>/code> var>value/var> dd> p>Returns the offset to the end of the selection./p> p>Can be set, to change the end of the selection./p> dt>var>element/var> . code idtextFieldSelection:dom-textarea/input-selectiondirection>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code> var>value/var> dd> p>Returns the current direction of the selection./p> p>Can be set, to change the direction of the selection./p> p>The possible values are code>forward/code>, code>backward/code>, and code>none/code>./p> dt>var>element/var> . code idtextFieldSelection:dom-textarea/input-setselectionrange>a href#dom-textarea/input-setselectionrange>setSelectionRange/a>/code>(var>start/var>, var>end/var> , var>direction/var> )dd> p>Changes the selection to cover the given substring in the given direction. If the direction is omitted, it will be reset to be the platform default (none or forward)./p> dt>var>element/var> . code idtextFieldSelection:dom-textarea/input-setrangetext>a href#dom-textarea/input-setrangetext>setRangeText/a>/code>(var>replacement/var> , var>start/var>, var>end/var> , var>selectionMode/var> )dd> p>Replaces a range of text with the new text. If the var>start/var> and var>end/var> arguments are not provided, the range is assumed to be the selection./p> p>The final argument determines how the selection will be set after the text has been replaced. The possible values are:/p> dl>dt>code idtextFieldSelection:dom-selectionmode-select>a href#dom-selectionmode-select>select/a>/code>dd>Selects the newly inserted text.dt>code idtextFieldSelection:dom-selectionmode-start>a href#dom-selectionmode-start>start/a>/code>dd>Moves the selection to just before the inserted text.dt>code idtextFieldSelection:dom-selectionmode-end>a href#dom-selectionmode-end>end/a>/code>dd>Moves the selection to just after the selected text.dt>code idtextFieldSelection:dom-selectionmode-preserve>a href#dom-selectionmode-preserve>preserve/a>/code>dd>Attempts to preserve the selection. This is the default./dl> /dl> p>For code idtextFieldSelection:the-input-element-2>a href#the-input-element>input/a>/code> elements, these methods and attributes must operate on the elements a href#concept-fe-value idtextFieldSelection:concept-fe-value>value/a>. For code idtextFieldSelection:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code> elements, these methods and attributes must operate on the elements a href#concept-textarea-raw-value idtextFieldSelection:concept-textarea-raw-value>raw value/a>./p> p>Where possible, user interface features for changing the text selection in code idtextFieldSelection:the-input-element-3>a href#the-input-element>input/a>/code> and code idtextFieldSelection:the-textarea-element-3>a href#the-textarea-element>textarea/a>/code> elements must be implemented in terms of the DOM API described in this section, so that, e.g., all the same events fire./p> p>The selections of code idtextFieldSelection:the-input-element-4>a href#the-input-element>input/a>/code> and code idtextFieldSelection:the-textarea-element-4>a href#the-textarea-element>textarea/a>/code> elements have a dfn idselection-direction>selection direction/dfn>, which is either code>forward/code>, code>backward/code>, or code>none/code>. This direction is set when the user manipulates the selection. The exact meaning of the selection direction depends on the platform. To dfn idset-the-selection-direction>set the selection direction/dfn> of an element to a given direction, update the elements a href#selection-direction idtextFieldSelection:selection-direction>selection direction/a> to the given direction, unless the direction is code>none/code> and the platform does not support that direction; in that case, update the elements a href#selection-direction idtextFieldSelection:selection-direction-2>selection direction/a> to code>forward/code>./p> div classnote> p>On Windows, the direction indicates the position of the caret relative to the selection: a code>forward/code> selection has the caret at the end of the selection and a code>backward/code> selection has the caret at the start of the selection. Windows has no code>none/code> direction./p> p>On Mac, the direction indicates which end of the selection is affected when the user adjusts the size of the selection using the arrow keys with the Shift modifier: the code>forward/code> direction means the end of the selection is modified, and the code>backward/code> direction means the start of the selection is modified. The code>none/code> direction is the default on Mac, it indicates that no particular direction has yet been selected. The user sets the direction implicitly when first adjusting the selection, based on which directional arrow key was used./p> /div> p>The dfn iddom-textarea/input-select>code>select()/code>/dfn> method, when invoked, must run the following steps:/p> ol>li> p>If this element is an code idtextFieldSelection:the-input-element-5>a href#the-input-element>input/a>/code> element, and either code idtextFieldSelection:dom-textarea/input-select-2>a href#dom-textarea/input-select>select()/a>/code> a href#do-not-apply idtextFieldSelection:do-not-apply>does not apply/a> to this element or the corresponding control has no selectable text, return./p> p classexample>For instance, in a user agent where code idtextFieldSelection:color-state-(typecolor)>a href#color-state-(typecolor)><input typecolor>/a>/code> is rendered as a color well with a picker, as opposed to a text control accepting a hexadecimal color code, there would be no selectable text, and thus calls to the method are ignored./p> li>p>a href#set-the-selection-range idtextFieldSelection:set-the-selection-range>Set the selection range/a> with 0 and infinity./ol> p>The dfn iddom-textarea/input-selectionstart>code>selectionStart/code>/dfn> attributes getter must run the following steps:/p> ol>li>p>If this element is an code idtextFieldSelection:the-input-element-6>a href#the-input-element>input/a>/code> element, and code idtextFieldSelection:dom-textarea/input-selectionstart-2>a href#dom-textarea/input-selectionstart>selectionStart/a>/code> a href#do-not-apply idtextFieldSelection:do-not-apply-2>does not apply/a> to this element, return null.li>p>If there is no selection, return the offset (in logical order) to the character that immediately follows the text entry cursor.li>p>Return the offset (in logical order) to the character that immediately follows the start of the selection./ol> p>The code idtextFieldSelection:dom-textarea/input-selectionstart-3>a href#dom-textarea/input-selectionstart>selectionStart/a>/code> attributes setter must run the following steps:/p> ol>li>p>If this element is an code idtextFieldSelection:the-input-element-7>a href#the-input-element>input/a>/code> element, and code idtextFieldSelection:dom-textarea/input-selectionstart-4>a href#dom-textarea/input-selectionstart>selectionStart/a>/code> a href#do-not-apply idtextFieldSelection:do-not-apply-3>does not apply/a> to this element, throw an a idtextFieldSelection:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idtextFieldSelection:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Let var>end/var> be the value of this elements code idtextFieldSelection:dom-textarea/input-selectionend-2>a href#dom-textarea/input-selectionend>selectionEnd/a>/code> attribute.li>p>If var>end/var> is less than the given value, set var>end/var> to the given value.li>p>a href#set-the-selection-range idtextFieldSelection:set-the-selection-range-2>Set the selection range/a> with the given value, var>end/var>, and the value of this elements code idtextFieldSelection:dom-textarea/input-selectiondirection-2>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code> attribute./ol> p>The dfn iddom-textarea/input-selectionend>code>selectionEnd/code>/dfn> attributes getter must run the following steps:/p> ol>li>p>If this element is an code idtextFieldSelection:the-input-element-8>a href#the-input-element>input/a>/code> element, and code idtextFieldSelection:dom-textarea/input-selectionend-3>a href#dom-textarea/input-selectionend>selectionEnd/a>/code> a href#do-not-apply idtextFieldSelection:do-not-apply-4>does not apply/a> to this element, return null.li>p>If there is no selection, return the offset (in logical order) to the character that immediately follows the text entry cursor.li>p>Return the offset (in logical order) to the character that immediately follows the end of the selection./ol> p>The code idtextFieldSelection:dom-textarea/input-selectionend-4>a href#dom-textarea/input-selectionend>selectionEnd/a>/code> attributes setter must run the following steps:/p> ol>li>p>If this element is an code idtextFieldSelection:the-input-element-9>a href#the-input-element>input/a>/code> element, and code idtextFieldSelection:dom-textarea/input-selectionend-5>a href#dom-textarea/input-selectionend>selectionEnd/a>/code> a href#do-not-apply idtextFieldSelection:do-not-apply-5>does not apply/a> to this element, throw an a idtextFieldSelection:invalidstateerror-2 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idtextFieldSelection:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>a href#set-the-selection-range idtextFieldSelection:set-the-selection-range-3>Set the selection range/a> with the value of this elements code idtextFieldSelection:dom-textarea/input-selectionstart-5>a href#dom-textarea/input-selectionstart>selectionStart/a>/code> attribute, the given value, and the value of this elements code idtextFieldSelection:dom-textarea/input-selectiondirection-3>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code> attribute./ol> p>The dfn iddom-textarea/input-selectiondirection>code>selectionDirection/code>/dfn> attributes getter must run the following steps:/p> ol>li>p>If this element is an code idtextFieldSelection:the-input-element-10>a href#the-input-element>input/a>/code> element, and code idtextFieldSelection:dom-textarea/input-selectiondirection-4>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code> a href#do-not-apply idtextFieldSelection:do-not-apply-6>does not apply/a> to this element, return null.li>p>Return this elements a href#selection-direction idtextFieldSelection:selection-direction-3>selection direction/a>./ol> p>The code idtextFieldSelection:dom-textarea/input-selectiondirection-5>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code> attributes setter must run the following steps:/p> ol>li>p>If this element is an code idtextFieldSelection:the-input-element-11>a href#the-input-element>input/a>/code> element, and code idtextFieldSelection:dom-textarea/input-selectiondirection-6>a href#dom-textarea/input-selectiondirection>selectionDirection/a>/code> a href#do-not-apply idtextFieldSelection:do-not-apply-7>does not apply/a> to this element, throw an a idtextFieldSelection:invalidstateerror-3 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idtextFieldSelection:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>a href#set-the-selection-range idtextFieldSelection:set-the-selection-range-4>Set the selection range/a> with the value of this elements code idtextFieldSelection:dom-textarea/input-selectionstart-6>a href#dom-textarea/input-selectionstart>selectionStart/a>/code> attribute, the value of this elements code idtextFieldSelection:dom-textarea/input-selectionend-6>a href#dom-textarea/input-selectionend>selectionEnd/a>/code> attribute, and the given value./ol> p>The dfn iddom-textarea/input-setselectionrange>code>setSelectionRange(var>start/var>, var>end/var>, var>direction/var>)/code>/dfn> method, when invoked, must run the following steps:div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> input-selectionspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>4.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>2+/span>/span>span classie yes>span>IE/span> span>9+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>4+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.1+/span>/span>span classopera yes>span>Opera/span> span>10.6+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featinput-selection>caniuse.com/a>/div> ol>li>p>If this element is an code idtextFieldSelection:the-input-element-12>a href#the-input-element>input/a>/code> element, and code idtextFieldSelection:dom-textarea/input-setselectionrange-2>a href#dom-textarea/input-setselectionrange>setSelectionRange()/a>/code> a href#do-not-apply idtextFieldSelection:do-not-apply-8>does not apply/a> to this element, throw an a idtextFieldSelection:invalidstateerror-4 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idtextFieldSelection:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>a href#set-the-selection-range idtextFieldSelection:set-the-selection-range-5>Set the selection range/a> with var>start/var>, var>end/var>, and var>direction/var>./ol> p>To dfn idset-the-selection-range>set the selection range/dfn> with an integer or null var>start/var>, an integer or null or the special value infinity var>end/var>, and optionally a string var>direction/var>, run the following steps:/p> ol>li>p>If var>start/var> is null, let var>start/var> be zero.li>p>If var>end/var> is null, let var>end/var> be zero.li>p>Set the selection of the text control to the sequence of characters starting with the character at the var>start/var>th position (in logical order) and ending with the character at the span>(var>end/var>-1)/span>th position. Arguments greater than the length of the value of the text control (including the special value infinity) must be treated as pointing at the end of the text control. If var>end/var> is less than or equal to var>start/var> then the start of the selection and the end of the selection must both be placed immediately before the character with offset var>end/var>. In UAs where there is no concept of an empty selection, this must set the cursor to be just before the character with offset var>end/var>.li>p>If var>direction/var> is not a a href#case-sensitive idtextFieldSelection:case-sensitive>case-sensitive/a> match for either the string code>backward/code> or code>forward/code>, or if the var>direction/var> argument was omitted, set var>direction/var> to code>none/code>.li>p>a href#set-the-selection-direction idtextFieldSelection:set-the-selection-direction>Set the selection direction/a> of the text control to var>direction/var>.li>p>If the previous steps caused the selection of the text control to be modified (in either extent or a href#selection-direction idtextFieldSelection:selection-direction-4>direction/a>), then a href#queue-a-task idtextFieldSelection:queue-a-task>queue a task/a>, using the a href#user-interaction-task-source idtextFieldSelection:user-interaction-task-source>user interaction task source/a>, to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idtextFieldSelection:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idtextFieldSelection:event-select>a href#event-select>select/a>/code> at the element, with the code idtextFieldSelection:dom-event-bubbles>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true./ol> p>The dfn iddom-textarea/input-setrangetext>code>setRangeText(var>replacement/var>, var>start/var>, var>end/var>, var>selectMode/var>)/code>/dfn> method, when invoked, must run the following steps:/p> ol>li>p>If this element is an code idtextFieldSelection:the-input-element-13>a href#the-input-element>input/a>/code> element, and code idtextFieldSelection:dom-textarea/input-setrangetext-2>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code> a href#do-not-apply idtextFieldSelection:do-not-apply-9>does not apply/a> to this element, throw an a idtextFieldSelection:invalidstateerror-5 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idtextFieldSelection:domexception-5>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Set this elements a href#concept-fe-dirty idtextFieldSelection:concept-fe-dirty>dirty value flag/a> to true.li> p>If the method has only one argument, then let var>start/var> and var>end/var> have the values of the code idtextFieldSelection:dom-textarea/input-selectionstart-7>a href#dom-textarea/input-selectionstart>selectionStart/a>/code> attribute and the code idtextFieldSelection:dom-textarea/input-selectionend-7>a href#dom-textarea/input-selectionend>selectionEnd/a>/code> attribute respectively./p> p>Otherwise, let var>start/var>, var>end/var> have the values of the second and third arguments respectively./p> li>p>If var>start/var> is greater than var>end/var>, then throw an a idtextFieldSelection:indexsizeerror hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idtextFieldSelection:domexception-6>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>If var>start/var> is greater than the length of the value of the text control, then set it to the length of the value of the text control.li>p>If var>end/var> is greater than the length of the value of the text control, then set it to the length of the value of the text control.li>p>Let var>selection start/var> be the current value of the code idtextFieldSelection:dom-textarea/input-selectionstart-8>a href#dom-textarea/input-selectionstart>selectionStart/a>/code> attribute.li>p>Let var>selection end/var> be the current value of the code idtextFieldSelection:dom-textarea/input-selectionend-8>a href#dom-textarea/input-selectionend>selectionEnd/a>/code> attribute.li>p>If var>start/var> is less than var>end/var>, delete the sequence of characters starting with the character at the var>start/var>th position (in logical order) and ending with the character at the span>(var>end/var>-1)/span>th position.li>p>Insert the value of the first argument into the text of the value of the text control, immediately before the var>start/var>th character.li>p>Let var>new length/var> be the length of the value of the first argument.li>p>Let var>new end/var> be the sum of var>start/var> and var>new length/var>.li> p>Run the appropriate set of substeps from the following list:/p> dl classswitch>dt>If the fourth arguments value is dfn iddom-selectionmode-select>code>select/code>/dfn>dd> p>Let var>selection start/var> be var>start/var>./p> p>Let var>selection end/var> be var>new end/var>./p> dt>If the fourth arguments value is dfn iddom-selectionmode-start>code>start/code>/dfn>dd> p>Let var>selection start/var> and var>selection end/var> be var>start/var>./p> dt>If the fourth arguments value is dfn iddom-selectionmode-end>code>end/code>/dfn>dd> p>Let var>selection start/var> and var>selection end/var> be var>new end/var>./p> dt>If the fourth arguments value is dfn iddom-selectionmode-preserve>code>preserve/code>/dfn> (the default)dd> ol>li>p>Let var>old length/var> be var>end/var> minus var>start/var>./p> li>p>Let var>delta/var> be var>new length/var> minus var>old length/var>./p> li> p>If var>selection start/var> is greater than var>end/var>, then increment it by var>delta/var>. (If var>delta/var> is negative, i.e. the new text is shorter than the old text, then this will em>decrease/em> the value of var>selection start/var>.)/p> p>Otherwise: if var>selection start/var> is greater than var>start/var>, then set it to var>start/var>. (This snaps the start of the selection to the start of the new text if it was in the middle of the text that it replaced.)/p> li> p>If var>selection end/var> is greater than var>end/var>, then increment it by var>delta/var> in the same way./p> p>Otherwise: if var>selection end/var> is greater than var>start/var>, then set it to var>new end/var>. (This snaps the end of the selection to the end of the new text if it was in the middle of the text that it replaced.)/p> /ol> /dl> li>p>a href#set-the-selection-range idtextFieldSelection:set-the-selection-range-6>Set the selection range/a> with var>selection start/var> and var>selection end/var>./ol> p>The code idtextFieldSelection:dom-textarea/input-setrangetext-3>a href#dom-textarea/input-setrangetext>setRangeText()/a>/code> method uses the following enumeration:/p> pre classidl>enum dfn idselectionmode>SelectionMode/dfn> { a href#dom-selectionmode-select idtextFieldSelection:dom-selectionmode-select-2>select/a>, a href#dom-selectionmode-start idtextFieldSelection:dom-selectionmode-start-2>start/a>, a href#dom-selectionmode-end idtextFieldSelection:dom-selectionmode-end-2>end/a>, a href#dom-selectionmode-preserve idtextFieldSelection:dom-selectionmode-preserve-2>preserve/a> // default};/pre> p>All elements to which this API a href#concept-input-apply idtextFieldSelection:concept-input-apply>applies/a> have either a selection or a text entry cursor position at all times (even for elements that are not a href#being-rendered idtextFieldSelection:being-rendered>being rendered/a>). The initial state must consist of a text entry cursor at the beginning of the control./p> p>Characters with no visible rendering, such as U+200D ZERO WIDTH JOINER, still count as characters. Thus, for instance, the selection can include just an invisible character, and the text insertion cursor can be placed to one side or another of such a character./p> hr> div classexample> p>To obtain the currently selected text, the following JavaScript suffices:/p> pre>var selectionText control.value.substring(control.selectionStart, control.selectionEnd);/pre> p>...where var>control/var> is the code idtextFieldSelection:the-input-element-14>a href#the-input-element>input/a>/code> or code idtextFieldSelection:the-textarea-element-5>a href#the-textarea-element>textarea/a>/code> element./p> /div> div classexample> p>To add some text at the start of a text control, while maintaining the text selection, the three attributes must be preserved:/p> pre>var oldStart control.selectionStart;var oldEnd control.selectionEnd;var oldDirection control.selectionDirection;var prefix http://;control.value prefix + control.value;control.setSelectionRange(oldStart + prefix.length, oldEnd + prefix.length, oldDirection);/pre> p>...where var>control/var> is the code idtextFieldSelection:the-input-element-15>a href#the-input-element>input/a>/code> or code idtextFieldSelection:the-textarea-element-6>a href#the-textarea-element>textarea/a>/code> element./p> /div> h4 idconstraints>span classsecno>4.10.20/span> Constraintsa href#constraints classself-link>/a>/h4> h5 iddefinitions>span classsecno>4.10.20.1/span> Definitionsa href#definitions classself-link>/a>/h5> p>A a href#category-submit iddefinitions:category-submit>submittable element/a> is a dfn idcandidate-for-constraint-validation>candidate for constraint validation/dfn> except when a condition has dfn idbarred-from-constraint-validation>barred the element from constraint validation/dfn>. (For example, an element is a href#barred-from-constraint-validation iddefinitions:barred-from-constraint-validation>barred from constraint validation/a> if it is an code iddefinitions:the-object-element>a href#the-object-element>object/a>/code> element.)/p> p>An element can have a dfn idcustom-validity-error-message>custom validity error message/dfn> defined. Initially, an element must have its a href#custom-validity-error-message iddefinitions:custom-validity-error-message>custom validity error message/a> set to the empty string. When its value is not the empty string, the element is a href#suffering-from-a-custom-error iddefinitions:suffering-from-a-custom-error>suffering from a custom error/a>. It can be set using the code iddefinitions:dom-cva-setcustomvalidity>a href#dom-cva-setcustomvalidity>setCustomValidity()/a>/code> method. The user agent should use the a href#custom-validity-error-message iddefinitions:custom-validity-error-message-2>custom validity error message/a> when alerting the user to the problem with the control./p> p>An element can be constrained in various ways. The following is the list of dfn idvalidity-states>validity states/dfn> that a form control can be in, making the control invalid for the purposes of constraint validation. (The definitions below are non-normative; other parts of this specification define more precisely when each state applies or does not.)/p> dl>dt> dfn idsuffering-from-being-missing>Suffering from being missing/dfn> dd> p>When a control has no a href#concept-fe-value iddefinitions:concept-fe-value>value/a> but has a code>required/code> attribute (code iddefinitions:the-input-element>a href#the-input-element>input/a>/code> code iddefinitions:attr-input-required>a href#attr-input-required>required/a>/code>, code iddefinitions:the-textarea-element>a href#the-textarea-element>textarea/a>/code> code iddefinitions:attr-textarea-required>a href#attr-textarea-required>required/a>/code>); or, more complicated rules for code iddefinitions:the-select-element>a href#the-select-element>select/a>/code> elements and controls in a href#radio-button-group iddefinitions:radio-button-group>radio button groups/a>, as specified in their sections.dt> dfn idsuffering-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 iddefinitions:concept-fe-value-2>value/a> that is not in the correct syntax (a href#e-mail-state-(typeemail) iddefinitions:e-mail-state-(typeemail)>E-mail/a>, a href#url-state-(typeurl) iddefinitions:url-state-(typeurl)>URL/a>). dt> dfn idsuffering-from-a-pattern-mismatch>Suffering from a pattern mismatch/dfn> dd> p>When a control has a a href#concept-fe-value iddefinitions:concept-fe-value-3>value/a> that doesnt satisfy the code iddefinitions:attr-input-pattern>a href#attr-input-pattern>pattern/a>/code> attribute.dt> dfn idsuffering-from-being-too-long>Suffering from being too long/dfn> dd> p>When a control has a a href#concept-fe-value iddefinitions:concept-fe-value-4>value/a> that is too long for the a href#attr-fe-maxlength iddefinitions:attr-fe-maxlength>form control code>maxlength/code> attribute/a> (code iddefinitions:the-input-element-2>a href#the-input-element>input/a>/code> code iddefinitions:attr-input-maxlength>a href#attr-input-maxlength>maxlength/a>/code>, code iddefinitions:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code> code iddefinitions:attr-textarea-maxlength>a href#attr-textarea-maxlength>maxlength/a>/code>). dt> dfn idsuffering-from-being-too-short>Suffering from being too short/dfn> dd> p>When a control has a a href#concept-fe-value iddefinitions:concept-fe-value-5>value/a> that is too short for the a href#attr-fe-minlength iddefinitions:attr-fe-minlength>form control code>minlength/code> attribute/a> (code iddefinitions:the-input-element-3>a href#the-input-element>input/a>/code> code iddefinitions:attr-input-minlength>a href#attr-input-minlength>minlength/a>/code>, code iddefinitions:the-textarea-element-3>a href#the-textarea-element>textarea/a>/code> code iddefinitions:attr-textarea-minlength>a href#attr-textarea-minlength>minlength/a>/code>). dt> dfn idsuffering-from-an-underflow>Suffering from an underflow/dfn> dd> p>When a control has a a href#concept-fe-value iddefinitions:concept-fe-value-6>value/a> that is not the empty string and is too low for the code iddefinitions:attr-input-min>a href#attr-input-min>min/a>/code> attribute.dt> dfn idsuffering-from-an-overflow>Suffering from an overflow/dfn> dd> p>When a control has a a href#concept-fe-value iddefinitions:concept-fe-value-7>value/a> that is not the empty string and is too high for the code iddefinitions:attr-input-max>a href#attr-input-max>max/a>/code> attribute.dt> dfn idsuffering-from-a-step-mismatch>Suffering from a step mismatch/dfn> dd> p>When a control has a a href#concept-fe-value iddefinitions:concept-fe-value-8>value/a> that doesnt fit the rules given by the code iddefinitions:attr-input-step>a href#attr-input-step>step/a>/code> attribute.dt> dfn idsuffering-from-bad-input>Suffering from bad input/dfn> dd> p>When a control has incomplete input and the user agent does not think the user ought to be able to submit the form in its current state.dt> dfn idsuffering-from-a-custom-error>Suffering from a custom error/dfn> dd> p>When a controls a href#custom-validity-error-message iddefinitions:custom-validity-error-message-3>custom validity error message/a> (as set by the elements code iddefinitions:dom-cva-setcustomvalidity-2>a href#dom-cva-setcustomvalidity>setCustomValidity()/a>/code> method) is not the empty string./p> /dl> p classnote>An element can still suffer from these states even when the element is a href#concept-fe-disabled iddefinitions:concept-fe-disabled>disabled/a>; thus these states can be represented in the DOM even if validating the form during submission wouldnt indicate a problem to the user./p> p>An element dfn idconcept-fv-valid>satisfies its constraints/dfn> if it is not suffering from any of the above a href#validity-states iddefinitions:validity-states>validity states/a>./p> h5 idconstraint-validation>span classsecno>4.10.20.2/span> Constraint validationa href#constraint-validation classself-link>/a>/h5> p>When the user agent is required to dfn idstatically-validate-the-constraints>statically validate the constraints/dfn> of code idconstraint-validation:the-form-element>a href#the-form-element>form/a>/code> element var>form/var>, it must run the following steps, which return either a i>positive/i> result (all the controls in the form are valid) or a i>negative/i> result (there are invalid controls) along with a (possibly empty) list of elements that are invalid and for which no script has claimed responsibility:/p> ol>li>p>Let var>controls/var> be a list of all the a href#category-submit idconstraint-validation:category-submit>submittable elements/a> whose a href#form-owner idconstraint-validation:form-owner>form owner/a> is var>form/var>, in a idconstraint-validation:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>.li>p>Let var>invalid controls/var> be an initially empty list of elements.li> p>For each element var>field/var> in var>controls/var>, in a idconstraint-validation:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>:/p> ol>li>p>If var>field/var> is not a a href#candidate-for-constraint-validation idconstraint-validation:candidate-for-constraint-validation>candidate for constraint validation/a>, then move on to the next element.li>p>Otherwise, if var>field/var> a href#concept-fv-valid idconstraint-validation:concept-fv-valid>satisfies its constraints/a>, then move on to the next element.li>p>Otherwise, add var>field/var> to var>invalid controls/var>./ol> li>p>If var>invalid controls/var> is empty, then return a i>positive/i> result and abort these steps.li>p>Let var>unhandled invalid controls/var> be an initially empty list of elements.li> p>For each element var>field/var> in var>invalid controls/var>, if any, in a idconstraint-validation:tree-order-3 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>:/p> ol>li>p>Let var>notCanceled/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idconstraint-validation:concept-event-fire data-x-internalconcept-event-fire>firing an event/a> named code idconstraint-validation:event-invalid>a href#event-invalid>invalid/a>/code> at var>field/var>, with the code idconstraint-validation:dom-event-cancelable>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true.li>p>If var>notCanceled/var> is true, then add var>field/var> to var>unhandled invalid controls/var>./ol> li>p>Return a i>negative/i> result with the list of elements in the var>unhandled invalid controls/var> list./ol> p>If a user agent is to dfn idinteractively-validate-the-constraints>interactively validate the constraints/dfn> of code idconstraint-validation:the-form-element-2>a href#the-form-element>form/a>/code> element var>form/var>, then the user agent must run the following steps:/p> ol>li>p>a href#statically-validate-the-constraints idconstraint-validation:statically-validate-the-constraints>Statically validate the constraints/a> of var>form/var>, and let var>unhandled invalid controls/var> be the list of elements returned if the result was i>negative/i>.li>p>If the result was i>positive/i>, then return that result and abort these steps.li>p>Report the problems with the constraints of at least one of the elements given in var>unhandled invalid controls/var> to the user. User agents may focus one of those elements in the process, by running the a href#focusing-steps idconstraint-validation:focusing-steps>focusing steps/a> for that element, and may change the scrolling position of the document, or perform some other action that brings the element to the users attention. User agents may report more than one constraint violation. User agents may coalesce related constraint violation reports if appropriate (e.g. if multiple radio buttons in a a href#radio-button-group idconstraint-validation:radio-button-group>group/a> are marked as required, only one error need be reported). If one of the controls is not a href#being-rendered idconstraint-validation:being-rendered>being rendered/a> (e.g. it has the code idconstraint-validation:the-hidden-attribute>a href#the-hidden-attribute>hidden/a>/code> attribute set) then user agents may report a script error.li>p>Return a i>negative/i> result./ol> h5 idthe-constraint-validation-api>span classsecno>4.10.20.3/span> The dfn>constraint validation API/dfn>a href#the-constraint-validation-api classself-link>/a>/h5>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> constraint-validationspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>40+/span>/span>span classios_saf yes>span>iOS Safari/span> span>10.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>51+/span>/span>span classie partial>span>IE (limited)/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>10+/span>/span>span classedge partial>span>Edge (limited)/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>56+/span>/span>span classopera yes>span>Opera/span> span>27+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featconstraint-validation>caniuse.com/a>/div> dl classdomintro>dt>var>element/var> . code idthe-constraint-validation-api:dom-cva-willvalidate>a href#dom-cva-willvalidate>willValidate/a>/code>dd> p>Returns true if the element will be validated when the form is submitted; false otherwise./p> dt>var>element/var> . code idthe-constraint-validation-api:dom-cva-setcustomvalidity>a href#dom-cva-setcustomvalidity>setCustomValidity/a>/code>(var>message/var>)dd> p>Sets a custom error, so that the element would fail to validate. The given message is the message to be shown to the user when reporting the problem to the user./p> p>If the argument is the empty string, clears the custom error./p> dt>var>element/var> . code idthe-constraint-validation-api:dom-cva-validity>a href#dom-cva-validity>validity/a>/code> . code idthe-constraint-validation-api:dom-validitystate-valuemissing>a href#dom-validitystate-valuemissing>valueMissing/a>/code>dd> p>Returns true if the element has no value but is a required field; false otherwise./p> dt>var>element/var> . code idthe-constraint-validation-api:dom-cva-validity-2>a href#dom-cva-validity>validity/a>/code> . code idthe-constraint-validation-api:dom-validitystate-typemismatch>a href#dom-validitystate-typemismatch>typeMismatch/a>/code>dd> p>Returns true if the elements value is not in the correct syntax; false otherwise./p> dt>var>element/var> . code idthe-constraint-validation-api:dom-cva-validity-3>a href#dom-cva-validity>validity/a>/code> . code idthe-constraint-validation-api:dom-validitystate-patternmismatch>a href#dom-validitystate-patternmismatch>patternMismatch/a>/code>dd> p>Returns true if the elements value doesnt match the provided pattern; false otherwise./p> dt>var>element/var> . code idthe-constraint-validation-api:dom-cva-validity-4>a href#dom-cva-validity>validity/a>/code> . code idthe-constraint-validation-api:dom-validitystate-toolong>a href#dom-validitystate-toolong>tooLong/a>/code>dd> p>Returns true if the elements value is longer than the provided maximum length; false otherwise./p> dt>var>element/var> . code idthe-constraint-validation-api:dom-cva-validity-5>a href#dom-cva-validity>validity/a>/code> . code idthe-constraint-validation-api:dom-validitystate-tooshort>a href#dom-validitystate-tooshort>tooShort/a>/code>dd> p>Returns true if the elements value, if it is not the empty string, is shorter than the provided minimum length; false otherwise./p> dt>var>element/var> . code idthe-constraint-validation-api:dom-cva-validity-6>a href#dom-cva-validity>validity/a>/code> . code idthe-constraint-validation-api:dom-validitystate-rangeunderflow>a href#dom-validitystate-rangeunderflow>rangeUnderflow/a>/code>dd> p>Returns true if the elements value is lower than the provided minimum; false otherwise./p> dt>var>element/var> . code idthe-constraint-validation-api:dom-cva-validity-7>a href#dom-cva-validity>validity/a>/code> . code idthe-constraint-validation-api:dom-validitystate-rangeoverflow>a href#dom-validitystate-rangeoverflow>rangeOverflow/a>/code>dd> p>Returns true if the elements value is higher than the provided maximum; false otherwise./p> dt>var>element/var> . code idthe-constraint-validation-api:dom-cva-validity-8>a href#dom-cva-validity>validity/a>/code> . code idthe-constraint-validation-api:dom-validitystate-stepmismatch>a href#dom-validitystate-stepmismatch>stepMismatch/a>/code>dd> p>Returns true if the elements value doesnt fit the rules given by the code idthe-constraint-validation-api:attr-input-step>a href#attr-input-step>step/a>/code> attribute; false otherwise./p> dt>var>element/var> . code idthe-constraint-validation-api:dom-cva-validity-9>a href#dom-cva-validity>validity/a>/code> . code idthe-constraint-validation-api:dom-validitystate-badinput>a href#dom-validitystate-badinput>badInput/a>/code>dd> p>Returns true if the user has provided input in the user interface that the user agent is unable to convert to a value; false otherwise./p> dt>var>element/var> . code idthe-constraint-validation-api:dom-cva-validity-10>a href#dom-cva-validity>validity/a>/code> . code idthe-constraint-validation-api:dom-validitystate-customerror>a href#dom-validitystate-customerror>customError/a>/code>dd> p>Returns true if the element has a custom error; false otherwise./p> dt>var>element/var> . code idthe-constraint-validation-api:dom-cva-validity-11>a href#dom-cva-validity>validity/a>/code> . code idthe-constraint-validation-api:dom-validitystate-valid>a href#dom-validitystate-valid>valid/a>/code>dd> p>Returns true if the elements value has no validity problems; false otherwise./p> dt>var>valid/var> var>element/var> . code idthe-constraint-validation-api:dom-cva-checkvalidity>a href#dom-cva-checkvalidity>checkValidity/a>/code>()dd> p>Returns true if the elements value has no validity problems; false otherwise. Fires an code idthe-constraint-validation-api:event-invalid>a href#event-invalid>invalid/a>/code> event at the element in the latter case./p> dt>var>valid/var> var>element/var> . code idthe-constraint-validation-api:dom-cva-reportvalidity>a href#dom-cva-reportvalidity>reportValidity/a>/code>()dd> p>Returns true if the elements value has no validity problems; otherwise, returns false, fires an code idthe-constraint-validation-api:event-invalid-2>a href#event-invalid>invalid/a>/code> event at the element, and (if the event isnt canceled) reports the problem to the user./p> dt>var>element/var> . code idthe-constraint-validation-api:dom-cva-validationmessage>a href#dom-cva-validationmessage>validationMessage/a>/code>dd> p>Returns the error message that would be shown to the user if the element was to be checked for validity./p> /dl> p>The dfn iddom-cva-willvalidate>code>willValidate/code>/dfn> attributes getter must return true, if this element is a a href#candidate-for-constraint-validation idthe-constraint-validation-api:candidate-for-constraint-validation>candidate for constraint validation/a>, and false otherwise (i.e., false if any conditions are a href#barred-from-constraint-validation idthe-constraint-validation-api:barred-from-constraint-validation>barring it from constraint validation/a>)./p> p>The dfn iddom-cva-setcustomvalidity>code>setCustomValidity(var>message/var>)/code>/dfn> method, when invoked, must set the a href#custom-validity-error-message idthe-constraint-validation-api:custom-validity-error-message>custom validity error message/a> to var>message/var>./p> div classexample> p>In the following example, a script checks the value of a form control each time it is edited, and whenever it is not a valid value, uses the code idthe-constraint-validation-api:dom-cva-setcustomvalidity-2>a href#dom-cva-setcustomvalidity>setCustomValidity()/a>/code> method to set an appropriate message./p> pre><label>Feeling: <input namef typetext oninputcheck(this)></label><script> function check(input) { if (input.value good || input.value fine || input.value tired) { input.setCustomValidity( + input.value + is not a feeling.); } else { // input is fine -- reset the error message input.setCustomValidity(); } }</script>/pre> /div> p>The dfn iddom-cva-validity>code>validity/code>/dfn> attributes getter must return a code idthe-constraint-validation-api:validitystate>a href#validitystate>ValidityState/a>/code> object that represents the a href#validity-states idthe-constraint-validation-api:validity-states>validity states/a> of this element. This object is a href#live idthe-constraint-validation-api:live>live/a>./p>pre classidl>ExposedWindowinterface dfn idvaliditystate>ValidityState/dfn> { readonly attribute boolean a href#dom-validitystate-valuemissing idthe-constraint-validation-api:dom-validitystate-valuemissing-2>valueMissing/a>; readonly attribute boolean a href#dom-validitystate-typemismatch idthe-constraint-validation-api:dom-validitystate-typemismatch-2>typeMismatch/a>; readonly attribute boolean a href#dom-validitystate-patternmismatch idthe-constraint-validation-api:dom-validitystate-patternmismatch-2>patternMismatch/a>; readonly attribute boolean a href#dom-validitystate-toolong idthe-constraint-validation-api:dom-validitystate-toolong-2>tooLong/a>; readonly attribute boolean a href#dom-validitystate-tooshort idthe-constraint-validation-api:dom-validitystate-tooshort-2>tooShort/a>; readonly attribute boolean a href#dom-validitystate-rangeunderflow idthe-constraint-validation-api:dom-validitystate-rangeunderflow-2>rangeUnderflow/a>; readonly attribute boolean a href#dom-validitystate-rangeoverflow idthe-constraint-validation-api:dom-validitystate-rangeoverflow-2>rangeOverflow/a>; readonly attribute boolean a href#dom-validitystate-stepmismatch idthe-constraint-validation-api:dom-validitystate-stepmismatch-2>stepMismatch/a>; readonly attribute boolean a href#dom-validitystate-badinput idthe-constraint-validation-api:dom-validitystate-badinput-2>badInput/a>; readonly attribute boolean a href#dom-validitystate-customerror idthe-constraint-validation-api:dom-validitystate-customerror-2>customError/a>; readonly attribute boolean a href#dom-validitystate-valid idthe-constraint-validation-api:dom-validitystate-valid-2>valid/a>;};/pre> p>A code idthe-constraint-validation-api:validitystate-2>a href#validitystate>ValidityState/a>/code> object has the following attributes. On getting, they must return true if the corresponding condition given in the following list is true, and false otherwise./p> dl>dt>dfn iddom-validitystate-valuemissing>code>valueMissing/code>/dfn>dd> p>The control is a href#suffering-from-being-missing idthe-constraint-validation-api:suffering-from-being-missing>suffering from being missing/a>./p> dt>dfn iddom-validitystate-typemismatch>code>typeMismatch/code>/dfn>dd> p>The control is a href#suffering-from-a-type-mismatch idthe-constraint-validation-api:suffering-from-a-type-mismatch>suffering from a type mismatch/a>./p> dt>dfn iddom-validitystate-patternmismatch>code>patternMismatch/code>/dfn>dd> p>The control is a href#suffering-from-a-pattern-mismatch idthe-constraint-validation-api:suffering-from-a-pattern-mismatch>suffering from a pattern mismatch/a>./p> dt>dfn iddom-validitystate-toolong>code>tooLong/code>/dfn>dd> p>The control is a href#suffering-from-being-too-long idthe-constraint-validation-api:suffering-from-being-too-long>suffering from being too long/a>./p> dt>dfn iddom-validitystate-tooshort>code>tooShort/code>/dfn>dd> p>The control is a href#suffering-from-being-too-short idthe-constraint-validation-api:suffering-from-being-too-short>suffering from being too short/a>./p> dt>dfn iddom-validitystate-rangeunderflow>code>rangeUnderflow/code>/dfn>dd> p>The control is a href#suffering-from-an-underflow idthe-constraint-validation-api:suffering-from-an-underflow>suffering from an underflow/a>./p> dt>dfn iddom-validitystate-rangeoverflow>code>rangeOverflow/code>/dfn>dd> p>The control is a href#suffering-from-an-overflow idthe-constraint-validation-api:suffering-from-an-overflow>suffering from an overflow/a>./p> dt>dfn iddom-validitystate-stepmismatch>code>stepMismatch/code>/dfn>dd> p>The control is a href#suffering-from-a-step-mismatch idthe-constraint-validation-api:suffering-from-a-step-mismatch>suffering from a step mismatch/a>./p> dt>dfn iddom-validitystate-badinput>code>badInput/code>/dfn>dd> p>The control is a href#suffering-from-bad-input idthe-constraint-validation-api:suffering-from-bad-input>suffering from bad input/a>./p> dt>dfn iddom-validitystate-customerror>code>customError/code>/dfn>dd> p>The control is a href#suffering-from-a-custom-error idthe-constraint-validation-api:suffering-from-a-custom-error>suffering from a custom error/a>./p> dt>dfn iddom-validitystate-valid>code>valid/code>/dfn>dd> p>None of the other conditions are true./p> /dl> p>The dfn iddom-cva-checkvalidity>code>checkValidity()/code>/dfn> method, when invoked, must run these steps:/p> ol>li> p>If this element is a a href#candidate-for-constraint-validation idthe-constraint-validation-api:candidate-for-constraint-validation-2>candidate for constraint validation/a> and does not a href#concept-fv-valid idthe-constraint-validation-api:concept-fv-valid>satisfy its constraints/a>, then:/p> ol>li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-constraint-validation-api:concept-event-fire data-x-internalconcept-event-fire>Fire an event/a> named code idthe-constraint-validation-api:event-invalid-3>a href#event-invalid>invalid/a>/code> at this element, with the code idthe-constraint-validation-api:dom-event-cancelable>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true (though canceling has no effect).li>p>Return false./ol> li>p>Return true./ol> p>The dfn iddom-cva-reportvalidity>code>reportValidity()/code>/dfn> method, when invoked, must run these steps: ol>li> p>If this element is a a href#candidate-for-constraint-validation idthe-constraint-validation-api:candidate-for-constraint-validation-3>candidate for constraint validation/a> and does not a href#concept-fv-valid idthe-constraint-validation-api:concept-fv-valid-2>satisfy its constraints/a>, then: ol>li>p>Let var>report/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-constraint-validation-api:concept-event-fire-2 data-x-internalconcept-event-fire>firing an event/a> named code idthe-constraint-validation-api:event-invalid-4>a href#event-invalid>invalid/a>/code> at this element, with the code idthe-constraint-validation-api:dom-event-cancelable-2>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true.li>p>If var>report/var> is true, then report the problems with the constraints of this element to the user. When reporting the problem with the constraints to the user, the user agent may run the a href#focusing-steps idthe-constraint-validation-api:focusing-steps>focusing steps/a> for this element, and may change the scrolling position of the document, or perform some other action that brings this element to the users attention. User agents may report more than one constraint violation, if this element suffers from multiple problems at once. If this element is not a href#being-rendered idthe-constraint-validation-api:being-rendered>being rendered/a>, then the user agent may, instead of notifying the user, a href#report-the-error idthe-constraint-validation-api:report-the-error>report the error/a> for the a href#running-script idthe-constraint-validation-api:running-script>running script/a>./p> li>p>Return false./ol> li>p>Return true./ol> p>The dfn iddom-cva-validationmessage>code>validationMessage/code>/dfn> attributes getter must run these steps:p> ol>li>p>If this element is not a a href#candidate-for-constraint-validation idthe-constraint-validation-api:candidate-for-constraint-validation-4>candidate for constraint validation/a> or if this element a href#concept-fv-valid idthe-constraint-validation-api:concept-fv-valid-3>satisfies its constraints/a>, then return the empty string.li>p>Return a suitably localized message that the user agent would show the user if this were the only form control with a validity constraint problem. If the user agent would not actually show a textual message in such a situation (e.g., it would show a graphical cue instead), then return a suitably localized message that expresses (one or more of) the validity constraint(s) that the control does not satisfy. If the element is a a href#candidate-for-constraint-validation idthe-constraint-validation-api:candidate-for-constraint-validation-5>candidate for constraint validation/a> and is a href#suffering-from-a-custom-error idthe-constraint-validation-api:suffering-from-a-custom-error-2>suffering from a custom error/a>, then the a href#custom-validity-error-message idthe-constraint-validation-api:custom-validity-error-message-2>custom validity error message/a> should be present in the return value./ol> h5 idsecurity-forms>span classsecno>4.10.20.4/span> Securitya href#security-forms classself-link>/a>/h5> p idsecurity-0>Servers should not rely on client-side validation. Client-side validation can be intentionally bypassed by hostile users, and unintentionally bypassed by users of older user agents or automated tools that do not implement these features. The constraint validation features are only intended to improve the user experience, not to provide any kind of security mechanism./p> h4 idform-submission-2>span classsecno>4.10.21/span> dfn>Form submission/dfn>a href#form-submission-2 classself-link>/a>/h4> h5 idintroduction-5>span classsecno>4.10.21.1/span> Introductiona href#introduction-5 classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>When a form is submitted, the data in the form is converted into the structure specified by the a href#concept-fs-enctype idintroduction-5:concept-fs-enctype>enctype/a>, and then sent to the destination specified by the a href#concept-fs-action idintroduction-5:concept-fs-action>action/a> using the given a href#concept-fs-method idintroduction-5:concept-fs-method>method/a>./p> p>For example, take the following form:/p> pre><form action/find.cgi methodget> <input typetext namet> <input typesearch nameq> <input typesubmit></form>/pre> p>If the user types in cats in the first field and fur in the second, and then hits the submit button, then the user agent will load code>/find.cgi?tcats&qfur/code>./p> p>On the other hand, consider this form:/p> pre><form action/find.cgi methodpost enctypemultipart/form-data> <input typetext namet> <input typesearch nameq> <input typesubmit></form>/pre> p>Given the same user input, the result on submission is quite different: the user agent instead does an HTTP POST to the given URL, with as the entity body something like the following text:/p> pre>------kYFrd4jNJEgCervEContent-Disposition: form-data; nametcats------kYFrd4jNJEgCervEContent-Disposition: form-data; nameqfur------kYFrd4jNJEgCervE--/pre> h5 idimplicit-submission>span classsecno>4.10.21.2/span> Implicit submissiona href#implicit-submission classself-link>/a>/h5> p>A code idimplicit-submission:the-form-element>a href#the-form-element>form/a>/code> elements dfn iddefault-button>default button/dfn> is the first a href#concept-submit-button idimplicit-submission:concept-submit-button>submit button/a> in a idimplicit-submission:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> whose a href#form-owner idimplicit-submission:form-owner>form owner/a> is that code idimplicit-submission:the-form-element-2>a href#the-form-element>form/a>/code> element./p> p>If the user agent supports letting the user submit a form implicitly (for example, on some platforms hitting the enter key while a text control is a href#focused idimplicit-submission:focused>focused/a> implicitly submits the form), then doing so for a form, whose a href#default-button idimplicit-submission:default-button>default button/a> has a idimplicit-submission:activation-behaviour hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a> and is not a href#concept-fe-disabled idimplicit-submission:concept-fe-disabled>disabled/a>, must cause the user agent to a href#fire-a-click-event idimplicit-submission:fire-a-click-event>fire a code>click/code> event/a> at that a href#default-button idimplicit-submission:default-button-2>default button/a>./p> p classnote>There are pages on the Web that are only usable if there is a way to implicitly submit forms, so user agents are strongly encouraged to support this./p> p>If the form has no a href#concept-submit-button idimplicit-submission:concept-submit-button-2>submit button/a>, then the implicit submission mechanism must do nothing if the form has more than one i>field that blocks implicit submission/i>, and must a href#concept-form-submit idimplicit-submission:concept-form-submit>submit/a> the code idimplicit-submission:the-form-element-3>a href#the-form-element>form/a>/code> element from the code idimplicit-submission:the-form-element-4>a href#the-form-element>form/a>/code> element itself otherwise./p> p>For the purpose of the previous paragraph, an element is a i>field that blocks implicit submission/i> of a code idimplicit-submission:the-form-element-5>a href#the-form-element>form/a>/code> element if it is an code idimplicit-submission:the-input-element>a href#the-input-element>input/a>/code> element whose a href#form-owner idimplicit-submission:form-owner-2>form owner/a> is that code idimplicit-submission:the-form-element-6>a href#the-form-element>form/a>/code> element and whose code idimplicit-submission:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in one of the following states: a href#text-(typetext)-state-and-search-state-(typesearch) idimplicit-submission:text-(typetext)-state-and-search-state-(typesearch)>Text/a>, a href#text-(typetext)-state-and-search-state-(typesearch) idimplicit-submission:text-(typetext)-state-and-search-state-(typesearch)-2>Search/a>, a href#url-state-(typeurl) idimplicit-submission:url-state-(typeurl)>URL/a>, a href#telephone-state-(typetel) idimplicit-submission:telephone-state-(typetel)>Telephone/a>, a href#e-mail-state-(typeemail) idimplicit-submission:e-mail-state-(typeemail)>E-mail/a>, a href#password-state-(typepassword) idimplicit-submission:password-state-(typepassword)>Password/a>, a href#date-state-(typedate) idimplicit-submission:date-state-(typedate)>Date/a>, a href#month-state-(typemonth) idimplicit-submission:month-state-(typemonth)>Month/a>, a href#week-state-(typeweek) idimplicit-submission:week-state-(typeweek)>Week/a>, a href#time-state-(typetime) idimplicit-submission:time-state-(typetime)>Time/a>, a href#local-date-and-time-state-(typedatetime-local) idimplicit-submission:local-date-and-time-state-(typedatetime-local)>Local Date and Time/a>, a href#number-state-(typenumber) idimplicit-submission:number-state-(typenumber)>Number/a> /p> h5 idform-submission-algorithm>span classsecno>4.10.21.3/span> Form submission algorithma href#form-submission-algorithm classself-link>/a>/h5> p>When a code idform-submission-algorithm:the-form-element>a href#the-form-element>form/a>/code> element var>form/var> is dfn idconcept-form-submit>submitted/dfn> from an element var>submitter/var> (typically a button), optionally with a var>submitted from code idform-submission-algorithm:dom-form-submit>a href#dom-form-submit>submit()/a>/code> method/var> flag set, the user agent must run the following steps:/p> ol>li>p>If var>form/var> a href#cannot-navigate idform-submission-algorithm:cannot-navigate>cannot navigate/a>, then return.li>p>Let var>form document/var> be var>form/var>s a idform-submission-algorithm:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>.li idsandboxSubmitBlocked>p>If var>form document/var>s a href#active-sandboxing-flag-set idform-submission-algorithm:active-sandboxing-flag-set>active sandboxing flag set/a> has its a href#sandboxed-forms-browsing-context-flag idform-submission-algorithm:sandboxed-forms-browsing-context-flag>sandboxed forms browsing context flag/a> set, then return.li>p>Let var>form browsing context/var> be the a href#concept-document-bc idform-submission-algorithm:concept-document-bc>browsing context/a> of var>form document/var>.li>p>If the var>submitted from code idform-submission-algorithm:dom-form-submit-2>a href#dom-form-submit>submit()/a>/code> method/var> flag is not set, and the var>submitter/var> elements a href#concept-fs-novalidate idform-submission-algorithm:concept-fs-novalidate>no-validate state/a> is false, then a href#interactively-validate-the-constraints idform-submission-algorithm:interactively-validate-the-constraints>interactively validate the constraints/a> of var>form/var> and examine the result: if the result is negative (the constraint validation concluded that there were invalid fields and probably informed the user of this) then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idform-submission-algorithm:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idform-submission-algorithm:event-invalid>a href#event-invalid>invalid/a>/code> at the var>form/var> element and then abort these steps.li> p>If the var>submitted from code idform-submission-algorithm:dom-form-submit-3>a href#dom-form-submit>submit()/a>/code> method/var> flag is not set, then: ol>li>p>Let var>continue/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idform-submission-algorithm:concept-event-fire-2 data-x-internalconcept-event-fire>firing an event/a> named code idform-submission-algorithm:event-submit>a href#event-submit>submit/a>/code> at var>form/var>, with the code idform-submission-algorithm:dom-event-bubbles>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true and the code idform-submission-algorithm:dom-event-cancelable>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true.li>p>If var>continue/var> is false, then return.li> p>If var>form/var> a href#cannot-navigate idform-submission-algorithm:cannot-navigate-2>cannot navigate/a>, then return./p> p classnote>a href#cannot-navigate idform-submission-algorithm:cannot-navigate-3>Cannot navigate/a> is run again as dispatching the code idform-submission-algorithm:event-submit-2>a href#event-submit>submit/a>/code> event could have changed the outcome./p> /ol> li>p>Let var>form data set/var> be the result of a href#constructing-the-form-data-set idform-submission-algorithm:constructing-the-form-data-set>constructing the form data set/a> for var>form/var> in the context of var>submitter/var>.li>p>Let var>encoding/var> be the result of a href#picking-an-encoding-for-the-form idform-submission-algorithm:picking-an-encoding-for-the-form>picking an encoding for the form/a>./p> li>p>Let var>action/var> be the var>submitter/var> elements a href#concept-fs-action idform-submission-algorithm:concept-fs-action>action/a>.li> p>If var>action/var> is the empty string, let var>action/var> be the a hrefhttps://dom.spec.whatwg.org/#concept-document-url idform-submission-algorithm:the-documents-address data-x-internalthe-documents-address>URL/a> of the var>form document/var>./p> li>p>a href#parse-a-url idform-submission-algorithm:parse-a-url>Parse/a> the a idform-submission-algorithm:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> var>action/var>, relative to the var>submitter/var> elements a idform-submission-algorithm:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>. If this fails, abort these steps.li>p>Let var>parsed action/var> be the a href#resulting-url-record idform-submission-algorithm:resulting-url-record>resulting URL record/a>.li>p>Let var>scheme/var> be the a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idform-submission-algorithm:concept-url-scheme data-x-internalconcept-url-scheme>scheme/a> of var>parsed action/var>.li>p>Let var>enctype/var> be the var>submitter/var> elements a href#concept-fs-enctype idform-submission-algorithm:concept-fs-enctype>enctype/a>.li>p>Let var>method/var> be the var>submitter/var> elements a href#concept-fs-method idform-submission-algorithm:concept-fs-method>method/a>.li>p>Let var>target/var> be the var>submitter/var> elements code idform-submission-algorithm:attr-fs-formtarget>a href#attr-fs-formtarget>formtarget/a>/code> attribute value, if the element is a a href#concept-submit-button idform-submission-algorithm:concept-submit-button>submit button/a> and has such an attribute. Otherwise, let it be the result of a href#get-an-elements-target idform-submission-algorithm:get-an-elements-target>getting an elements target/a> given var>submitter/var>s a href#form-owner idform-submission-algorithm:form-owner>form owner/a>.li>p>Let var>target browsing context/var> and var>replace/var> be the result of applying a href#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name idform-submission-algorithm:the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context/a> using var>target/var> and var>form browsing context/var>.li>p>If var>target browsing context/var> is null, then return.li>p>If var>form document/var> has not yet a href#completely-loaded idform-submission-algorithm:completely-loaded>completely loaded/a> and the var>submitted from code idform-submission-algorithm:dom-form-submit-4>a href#dom-form-submit>submit()/a>/code> method/var> flag is set, then set var>replace/var> to true.li> p>If the value of var>method/var> is a href#attr-fs-method-dialog idform-submission-algorithm:attr-fs-method-dialog>dialog/a> then jump to the a href#submit-dialog idform-submission-algorithm:submit-dialog>submit dialog/a> steps./p> p>Otherwise, select the appropriate row in the table below based on the value of var>scheme/var> as given by the first cell of each row. Then, select the appropriate cell on that row based on the value of var>method/var> as given in the first cell of each column. Then, jump to the steps named in that cell and defined below the table./p> table>thead>tr>td> th> a href#attr-fs-method-get idform-submission-algorithm:attr-fs-method-get>GET/a> th> a href#attr-fs-method-post idform-submission-algorithm:attr-fs-method-post>POST/a> tbody>tr>th> code>http/code> td> a href#submit-mutate-action idform-submission-algorithm:submit-mutate-action>Mutate action URL/a> td> a href#submit-body idform-submission-algorithm:submit-body>Submit as entity body/a> tr>th> code>https/code> td> a href#submit-mutate-action idform-submission-algorithm:submit-mutate-action-2>Mutate action URL/a> td> a href#submit-body idform-submission-algorithm:submit-body-2>Submit as entity body/a> tr>th> code>ftp/code> td> a href#submit-get-action idform-submission-algorithm:submit-get-action>Get action URL/a> td> a href#submit-get-action idform-submission-algorithm:submit-get-action-2>Get action URL/a> tr>th> code>javascript/code> td> a href#submit-get-action idform-submission-algorithm:submit-get-action-3>Get action URL/a> td> a href#submit-get-action idform-submission-algorithm:submit-get-action-4>Get action URL/a> tr>th> code>data/code> td> a href#submit-mutate-action idform-submission-algorithm:submit-mutate-action-3>Mutate action URL/a> td> a href#submit-get-action idform-submission-algorithm:submit-get-action-5>Get action URL/a> tr>th> code>mailto/code> td> a href#submit-mailto-headers idform-submission-algorithm:submit-mailto-headers>Mail with headers/a> td> a href#submit-mailto-body idform-submission-algorithm:submit-mailto-body>Mail as body/a> /table> p>If var>scheme/var> is not one of those listed in this table, then the behavior is not defined by this specification. User agents should, in the absence of another specification defining this, act in a manner analogous to that defined in this specification for similar schemes./p> p>Each code idform-submission-algorithm:the-form-element-2>a href#the-form-element>form/a>/code> element has a dfn idplanned-navigation>planned navigation/dfn>, which is either null or a a href#concept-task idform-submission-algorithm:concept-task>task/a>; when the code idform-submission-algorithm:the-form-element-3>a href#the-form-element>form/a>/code> is first created, its a href#planned-navigation idform-submission-algorithm:planned-navigation>planned navigation/a> must be set to null. In the behaviors described below, when the user agent is required to dfn idplan-to-navigate>plan to navigate/dfn> to a particular resource var>destination/var>, it must run the following steps:/p> ol>li>p>If the code idform-submission-algorithm:the-form-element-4>a href#the-form-element>form/a>/code> has a non-null a href#planned-navigation idform-submission-algorithm:planned-navigation-2>planned navigation/a>, remove it from its a href#task-queue idform-submission-algorithm:task-queue>task queue/a>.li> p>Let the code idform-submission-algorithm:the-form-element-5>a href#the-form-element>form/a>/code>s a href#planned-navigation idform-submission-algorithm:planned-navigation-3>planned navigation/a> be a new a href#concept-task idform-submission-algorithm:concept-task-2>task/a> that consists of running the following steps:/p> ol>li>p>Let the code idform-submission-algorithm:the-form-element-6>a href#the-form-element>form/a>/code>s a href#planned-navigation idform-submission-algorithm:planned-navigation-4>planned navigation/a> be null.li>p>a href#navigate idform-submission-algorithm:navigate>Navigate/a> var>target browsing context/var> to var>destination/var>. If var>replace/var> is true, then var>target browsing context/var> must be navigated with a href#replacement-enabled idform-submission-algorithm:replacement-enabled>replacement enabled/a>./p> /ol> p>For the purposes of this task, var>target browsing context/var> and var>replace/var> are the variables that were set up when the overall form submission algorithm was run, with their values as they stood when this a href#planned-navigation idform-submission-algorithm:planned-navigation-5>planned navigation/a> was a href#queue-a-task idform-submission-algorithm:queue-a-task>queued/a>./p> li> p>a href#queue-a-task idform-submission-algorithm:queue-a-task-2>Queue the task/a> that is the code idform-submission-algorithm:the-form-element-7>a href#the-form-element>form/a>/code>s new a href#planned-navigation idform-submission-algorithm:planned-navigation-6>planned navigation/a>./p> p>The a href#task-source idform-submission-algorithm:task-source>task source/a> for this task is the a href#dom-manipulation-task-source idform-submission-algorithm:dom-manipulation-task-source>DOM manipulation task source/a>./p> /ol> p>The behaviors are as follows:/p> dl>dt>dfn idsubmit-mutate-action>Mutate action URL/dfn> dd> p>Let var>query/var> be the result of running the a idform-submission-algorithm:application/x-www-form-urlencoded-serializer hrefhttps://url.spec.whatwg.org/#concept-urlencoded-serializer data-x-internalapplication/x-www-form-urlencoded-serializer>code>application/x-www-form-urlencoded/code> serializer/a> with var>form data set/var> and var>encoding/var>./p> p>Set var>parsed action/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-query idform-submission-algorithm:concept-url-query data-x-internalconcept-url-query>query/a> component to var>query/var>./p> p>a href#plan-to-navigate idform-submission-algorithm:plan-to-navigate>Plan to navigate/a> to var>parsed action/var>./p> dt>dfn idsubmit-body>Submit as entity body/dfn> dd> p>Switch on var>enctype/var>: dl classswitch>dt>code idform-submission-algorithm:attr-fs-enctype-urlencoded>a href#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded/a>/code>dd> p>Let var>body/var> be the result of running the a idform-submission-algorithm:application/x-www-form-urlencoded-serializer-2 hrefhttps://url.spec.whatwg.org/#concept-urlencoded-serializer data-x-internalapplication/x-www-form-urlencoded-serializer>code>application/x-www-form-urlencoded/code> serializer/a> with var>form data set/var> and var>encoding/var>./p> p>Set var>body/var> to the result of a hrefhttps://encoding.spec.whatwg.org/#utf-8-encode idform-submission-algorithm:utf-8-encode data-x-internalutf-8-encode>encoding/a> var>body/var>./p> p>Let var>MIME type/var> be code idform-submission-algorithm:application/x-www-form-urlencoded>a data-x-internalapplication/x-www-form-urlencoded hrefhttps://url.spec.whatwg.org/#concept-urlencoded>application/x-www-form-urlencoded/a>/code>./p> dt>code idform-submission-algorithm:attr-fs-enctype-formdata>a href#attr-fs-enctype-formdata>multipart/form-data/a>/code>dd> p>Let var>body/var> be the result of running the a href#multipart/form-data-encoding-algorithm idform-submission-algorithm:multipart/form-data-encoding-algorithm>code>multipart/form-data/code> encoding algorithm/a> with var>form data set/var> and var>encoding/var>./p> p>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 idform-submission-algorithm:multipart/form-data-boundary-string>code>multipart/form-data/code> boundary string/a> generated by the a href#multipart/form-data-encoding-algorithm idform-submission-algorithm:multipart/form-data-encoding-algorithm-2>code>multipart/form-data/code> encoding algorithm/a>./p> dt>code idform-submission-algorithm:attr-fs-enctype-text>a href#attr-fs-enctype-text>text/plain/a>/code>dd> p>Let var>body/var> be the result of running the a href#text/plain-encoding-algorithm idform-submission-algorithm:text/plain-encoding-algorithm>code>text/plain/code> encoding algorithm/a> with var>form data set/var> and var>encoding/var>./p> p>Set var>body/var> to the result of a hrefhttps://encoding.spec.whatwg.org/#encode idform-submission-algorithm:encode data-x-internalencode>encoding/a> var>body/var> using var>encoding/var>./p> p>Let var>MIME type/var> be code>text/plain/code>./p> /dl> p>a href#plan-to-navigate idform-submission-algorithm:plan-to-navigate-2>Plan to navigate/a> to a new a hrefhttps://fetch.spec.whatwg.org/#concept-request idform-submission-algorithm:concept-request data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idform-submission-algorithm:concept-request-url data-x-internalconcept-request-url>url/a> is var>parsed action/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-method idform-submission-algorithm:concept-request-method data-x-internalconcept-request-method>method/a> is var>method/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-header-list idform-submission-algorithm:concept-request-header-list data-x-internalconcept-request-header-list>header list/a> consists of `code>Content-Type/code>`/var>MIME type/var>, and a hrefhttps://fetch.spec.whatwg.org/#concept-request-body idform-submission-algorithm:concept-request-body data-x-internalconcept-request-body>body/a> is var>body/var>./p> dt>dfn idsubmit-get-action>Get action URL/dfn> dd> p>a href#plan-to-navigate idform-submission-algorithm:plan-to-navigate-3>Plan to navigate/a> to var>parsed action/var>./p> p classnote>The var>form data set/var> is discarded./p> dt>dfn idsubmit-mailto-headers>Mail with headers/dfn> dd> p>Let var>headers/var> be the result of running the a idform-submission-algorithm:application/x-www-form-urlencoded-serializer-3 hrefhttps://url.spec.whatwg.org/#concept-urlencoded-serializer data-x-internalapplication/x-www-form-urlencoded-serializer>code>application/x-www-form-urlencoded/code> serializer/a> with var>form data set/var> and var>encoding/var>./p> p>Replace occurrences of U+002B PLUS SIGN characters (+) in var>headers/var> with the string code>%20/code>./p> p>Set var>parsed action/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-query idform-submission-algorithm:concept-url-query-2 data-x-internalconcept-url-query>query/a> to var>headers/var>./p> p>a href#plan-to-navigate idform-submission-algorithm:plan-to-navigate-4>Plan to navigate/a> to var>parsed action/var>./p> dt>dfn idsubmit-mailto-body>Mail as body/dfn> dd> p>Switch on var>enctype/var>: dl classswitch>dt>code idform-submission-algorithm:attr-fs-enctype-text-2>a href#attr-fs-enctype-text>text/plain/a>/code>dd> p>Let var>body/var> be the result of running the a href#text/plain-encoding-algorithm idform-submission-algorithm:text/plain-encoding-algorithm-2>code>text/plain/code> encoding algorithm/a> with var>form data set/var> and var>encoding/var>./p> p>Set var>body/var> to the result of concatenating the result of a hrefhttps://url.spec.whatwg.org/#utf-8-percent-encode idform-submission-algorithm:utf-8-percent-encode data-x-internalutf-8-percent-encode>UTF-8 percent encoding/a> each code point in var>body/var>, using the a idform-submission-algorithm:default-encode-set hrefhttps://url.spec.whatwg.org/#default-encode-set data-x-internaldefault-encode-set>default encode set/a>. a href#refsURL>URL/a>/p> dt>Otherwisedd>p>Let var>body/var> be the result of running the a idform-submission-algorithm:application/x-www-form-urlencoded-serializer-4 hrefhttps://url.spec.whatwg.org/#concept-urlencoded-serializer data-x-internalapplication/x-www-form-urlencoded-serializer>code>application/x-www-form-urlencoded/code> serializer/a> with var>form data set/var> and var>encoding/var>./dl> p>If var>parsed action/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-query idform-submission-algorithm:concept-url-query-3 data-x-internalconcept-url-query>query/a> is null, then set it to the empty string. p>If var>parsed action/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-query idform-submission-algorithm:concept-url-query-4 data-x-internalconcept-url-query>query/a> is not the empty string, then append a single U+0026 AMPERSAND character (&) to it. p>Append code>body/code> to var>parsed action/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-query idform-submission-algorithm:concept-url-query-5 data-x-internalconcept-url-query>query/a>./p> p>Append var>body/var> to var>parsed action/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-query idform-submission-algorithm:concept-url-query-6 data-x-internalconcept-url-query>query/a>./p> p>a href#plan-to-navigate idform-submission-algorithm:plan-to-navigate-5>Plan to navigate/a> to var>parsed action/var>./p> dt>dfn idsubmit-dialog>Submit dialog/dfn> dd> p>Let var>subject/var> be the nearest ancestor code idform-submission-algorithm:the-dialog-element>a href#the-dialog-element>dialog/a>/code> element of var>form/var>, if any./p> p>If there isnt one, or if it does not have an code idform-submission-algorithm:attr-dialog-open>a href#attr-dialog-open>open/a>/code> attribute, do nothing. Otherwise, proceed as follows:/p> p>If var>submitter/var> is an code idform-submission-algorithm:the-input-element>a href#the-input-element>input/a>/code> element whose code idform-submission-algorithm:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#image-button-state-(typeimage) idform-submission-algorithm:image-button-state-(typeimage)>Image Button/a> state, then let var>result/var> be the string formed by concatenating the a href#concept-input-type-image-coordinate idform-submission-algorithm:concept-input-type-image-coordinate>selected coordinate/a>s var>x/var>-component, expressed as a base-ten number using a idform-submission-algorithm:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, a U+002C COMMA character (,), and the a href#concept-input-type-image-coordinate idform-submission-algorithm:concept-input-type-image-coordinate-2>selected coordinate/a>s var>y/var>-component, expressed in the same way as the var>x/var>-component./p> p>Otherwise, if var>submitter/var> has a a href#concept-fe-value idform-submission-algorithm:concept-fe-value>value/a>, then let var>result/var> be that a href#concept-fe-value idform-submission-algorithm:concept-fe-value-2>value/a>./p> p>Otherwise, there is no var>result/var>./p> p>Then, a href#close-the-dialog idform-submission-algorithm:close-the-dialog>close the dialog/a> var>subject/var>. If there is a var>result/var>, let that be the return value./p> /dl> /ol> h5 idconstructing-form-data-set>span classsecno>4.10.21.4/span> Constructing the form data seta href#constructing-form-data-set classself-link>/a>/h5> p>The algorithm to dfn idconstructing-the-form-data-set data-ltconstructing the form data set data-export>construct the form data set/dfn> for a form var>form/var> optionally in the context of a submitter var>submitter/var> is as follows. If not specified otherwise, var>submitter/var> is null./p> ol>li>p>Let var>controls/var> be a list of all the a href#category-submit idconstructing-form-data-set:category-submit>submittable elements/a> whose a href#form-owner idconstructing-form-data-set:form-owner>form owner/a> is var>form/var>, in a idconstructing-form-data-set:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>.li>p>Let the var>form data set/var> be a list of name-value-type tuples, initially empty.li> p>For each element var>field/var> in var>controls/var>, in a idconstructing-form-data-set:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>:/p> ol>li> p>If any of the following is true:/p> ul>li>The var>field/var> element has a code idconstructing-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 idconstructing-form-data-set:concept-fe-disabled>disabled/a>.li>The var>field/var> element is a a href#concept-button idconstructing-form-data-set:concept-button>button/a> but it is not var>submitter/var>.li>The var>field/var> element is an code idconstructing-form-data-set:the-input-element>a href#the-input-element>input/a>/code> element whose code idconstructing-form-data-set:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#checkbox-state-(typecheckbox) idconstructing-form-data-set:checkbox-state-(typecheckbox)>Checkbox/a> state and whose a href#concept-fe-checked idconstructing-form-data-set:concept-fe-checked>checkedness/a> is false.li>The var>field/var> element is an code idconstructing-form-data-set:the-input-element-2>a href#the-input-element>input/a>/code> element whose code idconstructing-form-data-set:attr-input-type-2>a href#attr-input-type>type/a>/code> attribute is in the a href#radio-button-state-(typeradio) idconstructing-form-data-set:radio-button-state-(typeradio)>Radio Button/a> state and whose a href#concept-fe-checked idconstructing-form-data-set:concept-fe-checked-2>checkedness/a> is false.li>The var>field/var> element is not an code idconstructing-form-data-set:the-input-element-3>a href#the-input-element>input/a>/code> element whose code idconstructing-form-data-set:attr-input-type-3>a href#attr-input-type>type/a>/code> attribute is in the a href#image-button-state-(typeimage) idconstructing-form-data-set:image-button-state-(typeimage)>Image Button/a> state, and either the var>field/var> element does not have a code idconstructing-form-data-set:attr-fe-name>a href#attr-fe-name>name/a>/code> attribute specified, or its code idconstructing-form-data-set:attr-fe-name-2>a href#attr-fe-name>name/a>/code> attributes value is the empty string.li>The var>field/var> element is an code idconstructing-form-data-set:the-object-element>a href#the-object-element>object/a>/code> element that is not using a a href#plugin idconstructing-form-data-set:plugin>plugin/a>./ul> p>Then continue./p> li>p>Let var>type/var> be the value of the code>type/code> IDL attribute of var>field/var>.li> p>If the var>field/var> element is an code idconstructing-form-data-set:the-input-element-4>a href#the-input-element>input/a>/code> element whose code idconstructing-form-data-set:attr-input-type-4>a href#attr-input-type>type/a>/code> attribute is in the a href#image-button-state-(typeimage) idconstructing-form-data-set:image-button-state-(typeimage)-2>Image Button/a> state, then:/p> ol>li>p>If the var>field/var> element has a code idconstructing-form-data-set:attr-fe-name-3>a href#attr-fe-name>name/a>/code> attribute specified and its value is not the empty string, let var>name/var> be that value followed by a single U+002E FULL STOP character (.). Otherwise, let var>name/var> be the empty string.li>p>Let var>namesub>x/sub>/var> be the string consisting of the concatenation of var>name/var> and a single U+0078 LATIN SMALL LETTER X character (x).li>p>Let var>namesub>y/sub>/var> be the string consisting of the concatenation of var>name/var> and a single U+0079 LATIN SMALL LETTER Y character (y).li>p>The var>field/var> element is var>submitter/var>, and before this algorithm was invoked the user a href#concept-input-type-image-coordinate idconstructing-form-data-set:concept-input-type-image-coordinate>indicated a coordinate/a>. Let var>x/var> be the var>x/var>-component of the coordinate selected by the user, and let var>y/var> be the var>y/var>-component of the coordinate selected by the user.li>p>Append an entry to the var>form data set/var> with the name var>namesub>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>namesub>y/sub>/var> and the value var>y/var>, and the type var>type/var>.li>p>Continue./ol> li>p>Let var>name/var> be the value of the var>field/var> elements code idconstructing-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 idconstructing-form-data-set:the-select-element>a href#the-select-element>select/a>/code> element, then for each code idconstructing-form-data-set:the-option-element>a href#the-option-element>option/a>/code> element in the code idconstructing-form-data-set:the-select-element-2>a href#the-select-element>select/a>/code> elements a href#concept-select-option-list idconstructing-form-data-set:concept-select-option-list>list of options/a> whose a href#concept-option-selectedness idconstructing-form-data-set:concept-option-selectedness>selectedness/a> is true and that is not a href#concept-option-disabled idconstructing-form-data-set:concept-option-disabled>disabled/a>, append an entry to the var>form data set/var> with the var>name/var> as the name, the a href#concept-option-value idconstructing-form-data-set:concept-option-value>value/a> of the code idconstructing-form-data-set:the-option-element-2>a href#the-option-element>option/a>/code> element as the value, and var>type/var> as the type.li> p>Otherwise, if the var>field/var> element is an code idconstructing-form-data-set:the-input-element-5>a href#the-input-element>input/a>/code> element whose code idconstructing-form-data-set:attr-input-type-5>a href#attr-input-type>type/a>/code> attribute is in the a href#checkbox-state-(typecheckbox) idconstructing-form-data-set:checkbox-state-(typecheckbox)-2>Checkbox/a> state or the a href#radio-button-state-(typeradio) idconstructing-form-data-set:radio-button-state-(typeradio)-2>Radio Button/a> state, then:/p> ol>li>p>If the var>field/var> element has a code idconstructing-form-data-set:attr-input-value>a href#attr-input-value>value/a>/code> attribute specified, then let var>value/var> be the value of that attribute; otherwise, let var>value/var> be the string code>on/code>.li>p>Append an entry to the var>form data set/var> with var>name/var> as the name, var>value/var> as the value, and var>type/var> as the type./ol> li>p>Otherwise, if the var>field/var> element is an code idconstructing-form-data-set:the-input-element-6>a href#the-input-element>input/a>/code> element whose code idconstructing-form-data-set:attr-input-type-6>a href#attr-input-type>type/a>/code> attribute is in the a href#file-upload-state-(typefile) idconstructing-form-data-set:file-upload-state-(typefile)>File Upload/a> state, then for each file a href#concept-input-type-file-selected idconstructing-form-data-set:concept-input-type-file-selected>selected/a> in the code idconstructing-form-data-set:the-input-element-7>a href#the-input-element>input/a>/code> element, append an entry to the var>form data set/var> with the var>name/var> as the name, the file (consisting of the name, the type, and the body) as the value, and var>type/var> as the type. If there are no a href#concept-input-type-file-selected idconstructing-form-data-set:concept-input-type-file-selected-2>selected files/a>, then append an entry to the var>form data set/var> with the var>name/var> as the name, the empty string as the value, and code idconstructing-form-data-set:application/octet-stream>a data-x-internalapplication/octet-stream hrefhttps://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 idconstructing-form-data-set:the-object-element-2>a href#the-object-element>object/a>/code> element: try to obtain a form submission value from the a href#plugin idconstructing-form-data-set:plugin-2>plugin/a>, and if that is successful, append an entry to the var>form data set/var> with var>name/var> as the name, the returned form submission value as the value, and the string code>object/code> as the type.li>p>Otherwise, append an entry to the var>form data set/var> with var>name/var> as the name, the a href#concept-fe-value idconstructing-form-data-set:concept-fe-value>value/a> of the var>field/var> element as the value, and var>type/var> as the type.li> p>If the element has a code idconstructing-form-data-set:attr-fe-dirname>a href#attr-fe-dirname>dirname/a>/code> attribute, and that attributes value is not the empty string, then:/p> ol>li>p>Let var>dirname/var> be the value of the elements code idconstructing-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 idconstructing-form-data-set:the-directionality>the directionality/a> of the element is a href#concept-ltr idconstructing-form-data-set:concept-ltr>ltr/a>, and code>rtl/code> otherwise (i.e. when a href#the-directionality idconstructing-form-data-set:the-directionality-2>the directionality/a> of the element is a href#concept-rtl idconstructing-form-data-set:concept-rtl>rtl/a>).li>p>Append an entry to the var>form data set/var> with var>dirname/var> as the name, var>dir/var> as the value, and the string code>direction/code> as the type./ol> p classnote>An element can only have a code idconstructing-form-data-set:attr-fe-dirname-3>a href#attr-fe-dirname>dirname/a>/code> attribute if it is a code idconstructing-form-data-set:the-textarea-element>a href#the-textarea-element>textarea/a>/code> element or an code idconstructing-form-data-set:the-input-element-8>a href#the-input-element>input/a>/code> element whose code idconstructing-form-data-set:attr-input-type-7>a href#attr-input-type>type/a>/code> attribute is in either the a href#text-(typetext)-state-and-search-state-(typesearch) idconstructing-form-data-set:text-(typetext)-state-and-search-state-(typesearch)>Text/a> state or the a href#text-(typetext)-state-and-search-state-(typesearch) idconstructing-form-data-set:text-(typetext)-state-and-search-state-(typesearch)-2>Search/a> state./p> /ol> li> p>For the name of each entry in the var>form data set/var>, and for the value of each entry in the var>form data set/var> whose type is not code>file/code> or code>textarea/code>, replace every occurrence of U+000D (CR) not followed by U+000A (LF), and every occurrence of U+000A (LF) not preceded by U+000D (CR), by a string consisting of a U+000D (CR) and U+000A (LF)./p> p classnote>In the case of the a href#concept-fe-value idconstructing-form-data-set:concept-fe-value-2>value/a> of code idconstructing-form-data-set:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code> elements, this newline normalization is already performed during the conversion of the controls a href#concept-textarea-raw-value idconstructing-form-data-set:concept-textarea-raw-value>raw value/a> into the controls a href#concept-fe-value idconstructing-form-data-set:concept-fe-value-3>value/a> (which also performs any necessary line wrapping). In the case of code idconstructing-form-data-set:the-input-element-9>a href#the-input-element>input/a>/code> elements code idconstructing-form-data-set:attr-input-type-8>a href#attr-input-type>type/a>/code> attributes in the a href#file-upload-state-(typefile) idconstructing-form-data-set:file-upload-state-(typefile)-2>File Upload/a> state, the value is not normalized./p> li>p>Replace the name of each entry in the var>form data set/var>, and the value of each entry in the var>form data set/var> whose type is not code>file/code>, with the results of a idconstructing-form-data-set:converting-to-a-sequence-of-unicode-scalar-values hrefhttps://heycam.github.io/webidl/#dfn-obtain-unicode data-x-internalconverting-to-a-sequence-of-unicode-scalar-values>converting to a sequence of Unicode scalar values/a>.li>p>Return the var>form data set/var>./ol> h5 idselecting-a-form-submission-encoding>span classsecno>4.10.21.5/span> Selecting a form submission encodinga href#selecting-a-form-submission-encoding classself-link>/a>/h5> p>If the user agent is to dfn idpicking-an-encoding-for-the-form>pick an encoding for a form/dfn>, it must run the following steps:/p> ol>li>p>Let var>encoding/var> be the a idselecting-a-form-submission-encoding:documents-character-encoding hrefhttps://dom.spec.whatwg.org/#concept-document-encoding data-x-internaldocuments-character-encoding>documents character encoding/a>.li> p>If the code idselecting-a-form-submission-encoding:the-form-element>a href#the-form-element>form/a>/code> element has an code idselecting-a-form-submission-encoding:attr-form-accept-charset>a href#attr-form-accept-charset>accept-charset/a>/code> attribute, set var>encoding/var> to the return value of running these substeps:/p> ol>li>p>Let var>input/var> be the value of the code idselecting-a-form-submission-encoding:the-form-element-2>a href#the-form-element>form/a>/code> elements code idselecting-a-form-submission-encoding:attr-form-accept-charset-2>a href#attr-form-accept-charset>accept-charset/a>/code> attribute.li>p>Let var>candidate encoding labels/var> be the result of a hrefhttps://infra.spec.whatwg.org/#split-on-ascii-whitespace idselecting-a-form-submission-encoding:split-a-string-on-spaces data-x-internalsplit-a-string-on-spaces>splitting var>input/var> on ASCII whitespace/a>.li>p>Let var>candidate encodings/var> be an empty list of a hrefhttps://encoding.spec.whatwg.org/#encoding idselecting-a-form-submission-encoding:encoding data-x-internalencoding>character encodings/a>.li>p>For each token in var>candidate encoding labels/var> in turn (in the order in which they were found in var>input/var>), a hrefhttps://encoding.spec.whatwg.org/#concept-encoding-get idselecting-a-form-submission-encoding:getting-an-encoding data-x-internalgetting-an-encoding>get an encoding/a> for the token and, if this does not result in failure, append the a idselecting-a-form-submission-encoding:encoding-2 hrefhttps://encoding.spec.whatwg.org/#encoding data-x-internalencoding>encoding/a> to var>candidate encodings/var>.li>p>If var>candidate encodings/var> is empty, return a idselecting-a-form-submission-encoding:utf-8 hrefhttps://encoding.spec.whatwg.org/#utf-8 data-x-internalutf-8>UTF-8/a>.li>p>Return the first encoding in var>candidate encodings/var>./ol> li>p>Return the result of a hrefhttps://encoding.spec.whatwg.org/#get-an-output-encoding idselecting-a-form-submission-encoding:get-an-output-encoding data-x-internalget-an-output-encoding>getting an output encoding/a> from var>encoding/var>./ol> h5 idurl-encoded-form-data>span classsecno>4.10.21.6/span> URL-encoded form dataa href#url-encoded-form-data classself-link>/a>/h5> p idapplication-x-www-form-urlencoded-encoding-algorithm>span idapplication/x-www-form-urlencoded-encoding-algorithm>/span>See the WHATWG URL standard for details on code idurl-encoded-form-data:application/x-www-form-urlencoded>a data-x-internalapplication/x-www-form-urlencoded hrefhttps://url.spec.whatwg.org/#concept-urlencoded>application/x-www-form-urlencoded/a>/code>. a href#refsURL>URL/a>/p> h5 idmultipart-form-data>span classsecno>4.10.21.7/span> Multipart form dataa href#multipart-form-data classself-link>/a>/h5>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id16909 titlemultipart/form-data: field name encoding is not specified; browsers do incompatible things>16909/a>/div> p>The dfn idmultipart/form-data-encoding-algorithm data-export>code>multipart/form-data/code> encoding algorithm/dfn>, given a var>form data set/var> and var>encoding/var>, is as follows:/p> ol>li>p>Let var>result/var> be the empty string.li>p>Let var>charset/var> be the a hrefhttps://encoding.spec.whatwg.org/#name idmultipart-form-data:encoding-name data-x-internalencoding-name>name/a> of var>encoding/var>.li> p>For each entry in the var>form data set/var>:/p> ol>li>p>If the entrys name is code idmultipart-form-data:attr-fe-name-charset>a href#attr-fe-name-charset>_charset_/a>/code> and its type is code>hidden/code>, replace its value with var>charset/var>.li>p>For each character in the entrys name and value that cannot be expressed using the selected character encoding, replace the character by a string consisting of a U+0026 AMPERSAND character (&), a U+0023 NUMBER SIGN character (#), one or more a idmultipart-form-data:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> representing the code point of the character in base ten, and finally a U+003B (;)./ol> li> p>Encode the (now mutated) var>form data set/var> using the rules described by RFC 7578, cite>Returning Values from Forms: code>multipart/form-data/code>/cite>, and return the resulting byte stream. a href#refsRFC7578>RFC7578/a>/p> p>Each entry in the var>form data set/var> is a i>field/i>, the name of the entry is the i>field name/i> and the value of the entry is the i>field value/i>./p> p>The order of parts must be the same as the order of fields in the var>form data set/var>. Multiple entries with the same name must be treated as distinct fields./p> p>The parts of the generated code idmultipart-form-data:multipart/form-data>a href#multipart/form-data>multipart/form-data/a>/code> resource that correspond to non-file fields must not have a `code idmultipart-form-data:content-type>a href#content-type>Content-Type/a>/code>` header specified. Their names and values must be encoded using the character encoding selected above./p> p>File names included in the generated code idmultipart-form-data:multipart/form-data-2>a href#multipart/form-data>multipart/form-data/a>/code> resource (as part of file fields) must use the character encoding selected above, though the precise name may be approximated if necessary (e.g. newlines could be removed from file names, quotes could be changed to %22, and characters not expressible in the selected character encoding could be replaced by other characters). p>The boundary used by the user agent in generating the return value of this algorithm is the dfn idmultipart/form-data-boundary-string data-export>code>multipart/form-data/code> boundary string/dfn>. (This value is used to generate the MIME type of the form submission payload generated by this algorithm.)/p> /ol> p>For details on how to interpret code idmultipart-form-data:multipart/form-data-3>a href#multipart/form-data>multipart/form-data/a>/code> payloads, see RFC 7578. a href#refsRFC7578>RFC7578/a>/p> h5 idplain-text-form-data>span classsecno>4.10.21.8/span> Plain text form dataa href#plain-text-form-data classself-link>/a>/h5> p>The dfn idtext/plain-encoding-algorithm>code>text/plain/code> encoding algorithm/dfn>, given a var>form data set/var> and var>encoding/var>, is as follows:/p> ol>li>p>Let var>result/var> be the empty string.li>p>Let var>charset/var> be the a hrefhttps://encoding.spec.whatwg.org/#name idplain-text-form-data:encoding-name data-x-internalencoding-name>name/a> of var>encoding/var>.li> p>For each entry in the var>form data set/var>:/p> ol>li>p>If the entrys name is code idplain-text-form-data:attr-fe-name-charset>a href#attr-fe-name-charset>_charset_/a>/code> and its type is code>hidden/code>, replace its value with var>charset/var>.li>p>If the entrys type is code>file/code>, replace its value with the files name only.li>p>Append the entrys name to var>result/var>.li>p>Append a single U+003D EQUALS SIGN character () to var>result/var>.li>p>Append the entrys value to var>result/var>.li>p>Append a U+000D CARRIAGE RETURN (CR) U+000A LINE FEED (LF) character pair to var>result/var>./ol> li>p>Return var>result/var>./ol> p>Payloads using the code idplain-text-form-data:text/plain>a data-x-internaltext/plain hrefhttps://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain/a>/code> format are intended to be human readable. They are not reliably interpretable by computer, as the format is ambiguous (for example, there is no way to distinguish a literal newline in a value from the newline at the end of the value)./p> h4 idresetting-a-form>span classsecno>4.10.22/span> Resetting a forma href#resetting-a-form classself-link>/a>/h4> p>When a code idresetting-a-form:the-form-element>a href#the-form-element>form/a>/code> element var>form/var> is dfn idconcept-form-reset>reset/dfn>, run these steps:/p> ol>li>p>Let var>reset/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idresetting-a-form:concept-event-fire data-x-internalconcept-event-fire>firing an event/a> named code idresetting-a-form:event-reset>a href#event-reset>reset/a>/code> at var>form/var>, with the code idresetting-a-form:dom-event-bubbles>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> and code idresetting-a-form:dom-event-cancelable>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attributes initialized to true.li>p>If var>reset/var> is true, then invoke the a href#concept-form-reset-control idresetting-a-form:concept-form-reset-control>reset algorithm/a> of each a href#category-reset idresetting-a-form:category-reset>resettable element/a> whose a href#form-owner idresetting-a-form:form-owner>form owner/a> is var>form/var>./ol> p>Each a href#category-reset idresetting-a-form:category-reset-2>resettable element/a> defines its own dfn idconcept-form-reset-control>reset algorithm/dfn>. Changes made to form controls as part of these algorithms do not count as changes caused by the user (and thus, e.g., do not cause code idresetting-a-form:event-input>a href#event-input>input/a>/code> events to fire)./p> h3 idinteractive-elements>span classsecno>4.11/span> Interactive elementsa href#interactive-elements classself-link>/a>/h3> h4 idthe-details-element>span classsecno>4.11.1/span> The dfn>code>details/code>/dfn> elementa href#the-details-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> detailsspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>12+/span>/span>span classios_saf yes>span>iOS Safari/span> span>6.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>49+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classsafari yes>span>Safari/span> span>6+/span>/span>span classedge no>span>Edge/span> span>None/span>/span>span classandroid yes>span>Android Browser/span> span>4+/span>/span>span classopera yes>span>Opera/span> span>15+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featdetails>caniuse.com/a>/div> dl classelement>dt>a href#concept-element-categories idthe-details-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-details-element:flow-content-2>Flow content/a>.dd>a href#sectioning-root idthe-details-element:sectioning-root>Sectioning root/a>.dd>a href#interactive-content-2 idthe-details-element:interactive-content-2>Interactive content/a>.dd>a href#palpable-content-2 idthe-details-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-details-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-details-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-details-element:concept-element-content-model>Content model/a>:dd>One code idthe-details-element:the-summary-element>a href#the-summary-element>summary/a>/code> element followed by a href#flow-content-2 idthe-details-element:flow-content-2-3>flow content/a>.dt>a href#concept-element-tag-omission idthe-details-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-details-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-details-element:global-attributes>Global attributes/a>dd>code idthe-details-element:attr-details-open>a href#attr-details-open>open/a>/code> — Whether the details are visibledt>a href#concept-element-dom idthe-details-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-details-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmldetailselement>HTMLDetailsElement/dfn> : a href#htmlelement idthe-details-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-details-element:cereactions>CEReactions/a> attribute boolean a href#dom-details-open idthe-details-element:dom-details-open>open/a>;};/pre> /dl> p>The code idthe-details-element:the-details-element>a href#the-details-element>details/a>/code> element a href#represents idthe-details-element:represents>represents/a> a disclosure widget from which the user can obtain additional information or controls./p> p classnote>The code idthe-details-element:the-details-element-2>a href#the-details-element>details/a>/code> element is not appropriate for footnotes. Please see a href#footnotes>the section on footnotes/a> for details on how to mark up footnotes./p> p>The first code idthe-details-element:the-summary-element-2>a href#the-summary-element>summary/a>/code> element child of the element, if any, a href#represents idthe-details-element:represents-2>represents/a> the summary or legend of the details. If there is no child code idthe-details-element:the-summary-element-3>a href#the-summary-element>summary/a>/code> element, the user agent should provide its own legend (e.g. Details)./p> p>The rest of the elements contents a href#represents idthe-details-element:represents-3>represents/a> the additional information or controls./p> p>The dfn idattr-details-open>code>open/code>/dfn> content attribute is a a href#boolean-attribute idthe-details-element:boolean-attribute>boolean attribute/a>. If present, it indicates that both the summary and the additional information is to be shown to the user. If the attribute is absent, only the summary is to be shown./p> p>When the element is created, if the attribute is absent, the additional information should be hidden; if the attribute is present, that information should be shown. Subsequently, if the attribute is removed, then the information should be hidden; if the attribute is added, the information should be shown./p> p>The user agent should allow the user to request that the additional information be shown or hidden. To honor a request for the details to be shown, the user agent must a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-set-value idthe-details-element:concept-element-attributes-set-value data-x-internalconcept-element-attributes-set-value>set/a> the code idthe-details-element:attr-details-open-2>a href#attr-details-open>open/a>/code> attribute on the element to the empty string. To honor a request for the information to be hidden, the user agent must a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-remove idthe-details-element:concept-element-attributes-remove data-x-internalconcept-element-attributes-remove>remove/a> the code idthe-details-element:attr-details-open-3>a href#attr-details-open>open/a>/code> attribute from the element./p> p classnote>This ability to request that additional information be shown or hidden may simply be the a idthe-details-element:activation-behaviour hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a> of the appropriate code idthe-details-element:the-summary-element-4>a href#the-summary-element>summary/a>/code> element, in the case such an element exists. However, if no such element exists, user agents can still provide this ability through some other user interface affordance./p> p>Whenever the code idthe-details-element:attr-details-open-4>a href#attr-details-open>open/a>/code> attribute is added to or removed from a code idthe-details-element:the-details-element-3>a href#the-details-element>details/a>/code> element, the user agent must a href#queue-a-task idthe-details-element:queue-a-task>queue a task/a> that runs the following steps, which are known as the dfn iddetails-notification-task-steps>details notification task steps/dfn>, for this code idthe-details-element:the-details-element-4>a href#the-details-element>details/a>/code> element:/p> ol>li> p>If another a href#concept-task idthe-details-element:concept-task>task/a> has been a href#queue-a-task idthe-details-element:queue-a-task-2>queued/a> to run the a href#details-notification-task-steps idthe-details-element:details-notification-task-steps>details notification task steps/a> for this code idthe-details-element:the-details-element-5>a href#the-details-element>details/a>/code> element, then abort these steps./p> p classnote>When the code idthe-details-element:attr-details-open-5>a href#attr-details-open>open/a>/code> attribute is toggled several times in succession, these steps essentially get coalesced so that only one event is fired./p> li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-details-element:concept-event-fire data-x-internalconcept-event-fire>Fire an event/a> named code idthe-details-element:event-toggle>a href#event-toggle>toggle/a>/code> at the code idthe-details-element:the-details-element-6>a href#the-details-element>details/a>/code> element./ol> p>The a href#task-source idthe-details-element:task-source>task source/a> for this task must be the a href#dom-manipulation-task-source idthe-details-element:dom-manipulation-task-source>DOM manipulation task source/a>./p> p>The dfn iddom-details-open>code>open/code>/dfn> IDL attribute must a href#reflect idthe-details-element:reflect>reflect/a> the code idthe-details-element:attr-details-open-6>a href#attr-details-open>open/a>/code> content attribute./p> div classexample> p>The following example shows the code idthe-details-element:the-details-element-7>a href#the-details-element>details/a>/code> element being used to hide technical details in a progress report./p> pre><section classprogress window> <h1>Copying Really Achieving Your Childhood Dreams</h1> <details> <summary>Copying... <progress max375505392 value97543282></progress> 25%</summary> <dl> <dt>Transfer rate:</dt> <dd>452KB/s</dd> <dt>Local filename:</dt> <dd>/home/rpausch/raycd.m4v</dd> <dt>Remote filename:</dt> <dd>/var/www/lectures/raycd.m4v</dd> <dt>Duration:</dt> <dd>01:16:27</dd> <dt>Color profile:</dt> <dd>SD (6-1-6)</dd> <dt>Dimensions:</dt> <dd>320×240</dd> </dl> </details></section>/pre> /div> div classexample> p>The following shows how a code idthe-details-element:the-details-element-8>a href#the-details-element>details/a>/code> element can be used to hide some controls by default:/p> pre><details> <summary><label forfn>Name & Extension:</label></summary> <p><input typetext idfn namefn valuePillar Magazine.pdf> <p><label><input typecheckbox nameext checked> Hide extension</label></details>/pre> p>One could use this in conjunction with other code idthe-details-element:the-details-element-9>a href#the-details-element>details/a>/code> in a list to allow the user to collapse a set of fields down to a small set of headings, with the ability to open each one./p> p classdetails-example>img src/images/sample-details-1.png width345 alt height611>img src/images/sample-details-2.png width345 alt height666>/p> p>In these examples, the summary really just summarizes what the controls can change, and not the actual values, which is less than ideal./p> /div> div classexample> p>Because the code idthe-details-element:attr-details-open-7>a href#attr-details-open>open/a>/code> attribute is added and removed automatically as the user interacts with the control, it can be used in CSS to style the element differently based on its state. Here, a stylesheet is used to animate the color of the summary when the element is opened or closed:/p> pre><style> details > summary { transition: color 1s; color: black; } detailsopen > summary { color: red; }</style><details> <summary>Automated Status: Operational</summary> <p>Velocity: 12m/s</p> <p>Direction: North</p></details>/pre> /div> h4 idthe-summary-element>span classsecno>4.11.2/span> The dfn>code>summary/code>/dfn> elementa href#the-summary-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-summary-element:concept-element-categories>Categories/a>:dd>None.dt>a href#concept-element-contexts idthe-summary-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>As the a idthe-summary-element:first-child hrefhttps://dom.spec.whatwg.org/#concept-tree-first-child data-x-internalfirst-child>first child/a> of a code idthe-summary-element:the-details-element>a href#the-details-element>details/a>/code> element.dt>a href#concept-element-content-model idthe-summary-element:concept-element-content-model>Content model/a>:dd>Either: a href#phrasing-content-2 idthe-summary-element:phrasing-content-2>phrasing content/a>.dd>Or: one element of a href#heading-content-2 idthe-summary-element:heading-content-2>heading content/a>.dt>a href#concept-element-tag-omission idthe-summary-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-summary-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-summary-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-summary-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-summary-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-summary-element:the-summary-element>a href#the-summary-element>summary/a>/code> element a href#represents idthe-summary-element:represents>represents/a> a summary, caption, or legend for the rest of the contents of the code idthe-summary-element:the-summary-element-2>a href#the-summary-element>summary/a>/code> elements parent code idthe-summary-element:the-details-element-2>a href#the-details-element>details/a>/code> element, if any./p> p>The a idthe-summary-element:activation-behaviour hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a> of code idthe-summary-element:the-summary-element-3>a href#the-summary-element>summary/a>/code> elements is to run the following steps:/p> ol>li>p>If this code idthe-summary-element:the-summary-element-4>a href#the-summary-element>summary/a>/code> element has no parent node, then abort these steps.li>p>Let var>parent/var> be this code idthe-summary-element:the-summary-element-5>a href#the-summary-element>summary/a>/code> elements parent node./p> li>p>If var>parent/var> is not a code idthe-summary-element:the-details-element-3>a href#the-details-element>details/a>/code> element, then abort these steps./p> li>p>If var>parent/var>s first code idthe-summary-element:the-summary-element-6>a href#the-summary-element>summary/a>/code> element child is not this code idthe-summary-element:the-summary-element-7>a href#the-summary-element>summary/a>/code> element, then abort these steps.li> p>If the code idthe-summary-element:attr-details-open>a href#attr-details-open>open/a>/code> attribute is present on var>parent/var>, then a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-remove idthe-summary-element:concept-element-attributes-remove data-x-internalconcept-element-attributes-remove>remove/a> it. Otherwise, a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-set-value idthe-summary-element:concept-element-attributes-set-value data-x-internalconcept-element-attributes-set-value>set/a> var>parent/var>s code idthe-summary-element:attr-details-open-2>a href#attr-details-open>open/a>/code> attribute to the empty string./p> p classnote>This will then run the a href#details-notification-task-steps idthe-summary-element:details-notification-task-steps>details notification task steps/a>./p> /ol> h4 idcommands>span classsecno>4.11.3/span> Commandsa href#commands classself-link>/a>/h4> h5 idfacets-2>span classsecno>4.11.3.1/span> Facetsa href#facets-2 classself-link>/a>/h5> p>A dfn idconcept-command>command/dfn> is the abstraction behind menu items, buttons, and links. Once a command is defined, other parts of the interface can refer to the same command, allowing many access points to a single feature to share facets such as the a href#command-facet-disabledstate idfacets-2:command-facet-disabledstate>Disabled State/a>./p> p idfacets>Commands are defined to have the following dfn idconcept-facet>facets/dfn>:/p> dl>dt>dfn idcommand-facet-label>Label/dfn>dd>The name of the command as seen by the user.dt>dfn idcommand-facet-accesskey>Access Key/dfn>dd>A key combination selected by the user agent that triggers the command. A command might not have an Access Key.dt>dfn idcommand-facet-hiddenstate>Hidden State/dfn>dd>Whether the command is hidden or not (basically, whether it should be shown in menus).dt>dfn idcommand-facet-disabledstate>Disabled State/dfn>dd>Whether the command is relevant and can be triggered or not.dt>dfn idcommand-facet-action>Action/dfn>dd>The actual effect that triggering the command will have. This could be a scripted event handler, a a idfacets-2:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> to which to a href#navigate idfacets-2:navigate>navigate/a>, or a form submission./dl> p idexpose-commands-in-ui>User agents may expose the a href#concept-command idfacets-2:concept-command>commands/a> that match the following criteria:/p> ul classbrief>li>The a href#command-facet-hiddenstate idfacets-2:command-facet-hiddenstate>Hidden State/a> facet is false (visible)li>The element is a idfacets-2:in-a-document hrefhttps://dom.spec.whatwg.org/#in-a-document data-x-internalin-a-document>in a document/a> that has an associated a href#concept-document-bc idfacets-2:concept-document-bc>browsing context/a>.li>Neither the element nor any of its ancestors has a code idfacets-2:the-hidden-attribute>a href#the-hidden-attribute>hidden/a>/code> attribute specified./ul> p>User agents are encouraged to do this especially for commands that have a href#command-facet-accesskey idfacets-2:command-facet-accesskey>Access Keys/a>, as a way to advertise those keys to the user./p> p classexample>For example, such commands could be listed in the user agents menu bar./p> h5 idusing-the-a-element-to-define-a-command>span classsecno>4.11.3.2/span> dfn>Using the code>a/code> element to define a command/dfn>a href#using-the-a-element-to-define-a-command classself-link>/a>/h5> p>An code idusing-the-a-element-to-define-a-command:the-a-element>a href#the-a-element>a/a>/code> element with an code idusing-the-a-element-to-define-a-command:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute a href#concept-command idusing-the-a-element-to-define-a-command:concept-command>defines a command/a>./p> p>The a href#command-facet-label idusing-the-a-element-to-define-a-command:command-facet-label>Label/a> of the command is the string given by the elements code idusing-the-a-element-to-define-a-command:textcontent>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> IDL attribute./p> p>The a href#command-facet-accesskey idusing-the-a-element-to-define-a-command:command-facet-accesskey>AccessKey/a> of the command is the elements a href#assigned-access-key idusing-the-a-element-to-define-a-command:assigned-access-key>assigned access key/a>, if any./p> p>The a href#command-facet-hiddenstate idusing-the-a-element-to-define-a-command:command-facet-hiddenstate>Hidden State/a> of the command is true (hidden) if the element has a code idusing-the-a-element-to-define-a-command:the-hidden-attribute>a href#the-hidden-attribute>hidden/a>/code> attribute, and false otherwise./p> p>The a href#command-facet-disabledstate idusing-the-a-element-to-define-a-command:command-facet-disabledstate>Disabled State/a> facet of the command is true if the element or one of its ancestors is a href#inert idusing-the-a-element-to-define-a-command:inert>inert/a>, and false otherwise./p> p>The a href#command-facet-action idusing-the-a-element-to-define-a-command:command-facet-action>Action/a> of the command is to a href#fire-a-click-event idusing-the-a-element-to-define-a-command:fire-a-click-event>fire a code>click/code> event/a> at the element./p> h5 idusing-the-button-element-to-define-a-command>span classsecno>4.11.3.3/span> dfn>Using the code>button/code> element to define a command/dfn>a href#using-the-button-element-to-define-a-command classself-link>/a>/h5> p>A code idusing-the-button-element-to-define-a-command:the-button-element>a href#the-button-element>button/a>/code> element always a href#concept-command idusing-the-button-element-to-define-a-command:concept-command>defines a command/a>./p> p>The a href#command-facet-label idusing-the-button-element-to-define-a-command:command-facet-label>Label/a>, a href#command-facet-accesskey idusing-the-button-element-to-define-a-command:command-facet-accesskey>Access Key/a>, a href#command-facet-hiddenstate idusing-the-button-element-to-define-a-command:command-facet-hiddenstate>Hidden State/a>, and a href#command-facet-action idusing-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 idusing-the-button-element-to-define-a-command:using-the-a-element-to-define-a-command>as for code>a/code> elements/a> (see the previous section)./p> p>The a href#command-facet-disabledstate idusing-the-button-element-to-define-a-command:command-facet-disabledstate>Disabled State/a> of the command is true if the element or one of its ancestors is a href#inert idusing-the-button-element-to-define-a-command:inert>inert/a>, or if the elements a href#concept-fe-disabled idusing-the-button-element-to-define-a-command:concept-fe-disabled>disabled/a> state is set, and false otherwise./p> h5 idusing-the-input-element-to-define-a-command>span classsecno>4.11.3.4/span> dfn>Using the code>input/code> element to define a command/dfn>a href#using-the-input-element-to-define-a-command classself-link>/a>/h5> p>An code idusing-the-input-element-to-define-a-command:the-input-element>a href#the-input-element>input/a>/code> element whose code idusing-the-input-element-to-define-a-command:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in one of the a href#submit-button-state-(typesubmit) idusing-the-input-element-to-define-a-command:submit-button-state-(typesubmit)>Submit Button/a>, a href#reset-button-state-(typereset) idusing-the-input-element-to-define-a-command:reset-button-state-(typereset)>Reset Button/a>, a href#image-button-state-(typeimage) idusing-the-input-element-to-define-a-command:image-button-state-(typeimage)>Image Button/a>, a href#button-state-(typebutton) idusing-the-input-element-to-define-a-command:button-state-(typebutton)>Button/a>, a href#radio-button-state-(typeradio) idusing-the-input-element-to-define-a-command:radio-button-state-(typeradio)>Radio Button/a>, or a href#checkbox-state-(typecheckbox) idusing-the-input-element-to-define-a-command:checkbox-state-(typecheckbox)>Checkbox/a> states a href#concept-command idusing-the-input-element-to-define-a-command:concept-command>defines a command/a>./p> p>The a href#command-facet-label idusing-the-input-element-to-define-a-command:command-facet-label>Label/a> of the command is determined as follows:/p> ul>li>p>If the code idusing-the-input-element-to-define-a-command:attr-input-type-2>a href#attr-input-type>type/a>/code> attribute is in one of the a href#submit-button-state-(typesubmit) idusing-the-input-element-to-define-a-command:submit-button-state-(typesubmit)-2>Submit Button/a>, a href#reset-button-state-(typereset) idusing-the-input-element-to-define-a-command:reset-button-state-(typereset)-2>Reset Button/a>, a href#image-button-state-(typeimage) idusing-the-input-element-to-define-a-command:image-button-state-(typeimage)-2>Image Button/a>, or a href#button-state-(typebutton) idusing-the-input-element-to-define-a-command:button-state-(typebutton)-2>Button/a> states, then the a href#command-facet-label idusing-the-input-element-to-define-a-command:command-facet-label-2>Label/a> is the string given by the code idusing-the-input-element-to-define-a-command:attr-input-value>a href#attr-input-value>value/a>/code> attribute, if any, and a UA-dependent, locale-dependent value that the UA uses to label the button itself if the attribute is absent.li>p>Otherwise, if the element is a a href#labeled-control idusing-the-input-element-to-define-a-command:labeled-control>labeled control/a>, then the a href#command-facet-label idusing-the-input-element-to-define-a-command:command-facet-label-3>Label/a> is the string given by the code idusing-the-input-element-to-define-a-command:textcontent>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> of the first code idusing-the-input-element-to-define-a-command:the-label-element>a href#the-label-element>label/a>/code> element in a idusing-the-input-element-to-define-a-command:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> whose a href#labeled-control idusing-the-input-element-to-define-a-command:labeled-control-2>labeled control/a> is the element in question. (In DOM terms, this is the string given by code>var>element/var>.labels0.textContent/code>.)li>p>Otherwise, if the code idusing-the-input-element-to-define-a-command:attr-input-value-2>a href#attr-input-value>value/a>/code> attribute is present, then the a href#command-facet-label idusing-the-input-element-to-define-a-command:command-facet-label-4>Label/a> is the value of that attribute.li>p>Otherwise, the a href#command-facet-label idusing-the-input-element-to-define-a-command:command-facet-label-5>Label/a> is the empty string./ul> p>The a href#command-facet-accesskey idusing-the-input-element-to-define-a-command:command-facet-accesskey>AccessKey/a> of the command is the elements a href#assigned-access-key idusing-the-input-element-to-define-a-command:assigned-access-key>assigned access key/a>, if any./p> p>The a href#command-facet-hiddenstate idusing-the-input-element-to-define-a-command:command-facet-hiddenstate>Hidden State/a> of the command is true (hidden) if the element has a code idusing-the-input-element-to-define-a-command:the-hidden-attribute>a href#the-hidden-attribute>hidden/a>/code> attribute, and false otherwise./p> p>The a href#command-facet-disabledstate idusing-the-input-element-to-define-a-command:command-facet-disabledstate>Disabled State/a> of the command is true if the element or one of its ancestors is a href#inert idusing-the-input-element-to-define-a-command:inert>inert/a>, or if the elements a href#concept-fe-disabled idusing-the-input-element-to-define-a-command:concept-fe-disabled>disabled/a> state is set, and false otherwise./p> p>The a href#command-facet-action idusing-the-input-element-to-define-a-command:command-facet-action>Action/a> of the command is to a href#fire-a-click-event idusing-the-input-element-to-define-a-command:fire-a-click-event>fire a code>click/code> event/a> at the element./p> h5 idusing-the-option-element-to-define-a-command>span classsecno>4.11.3.5/span> dfn>Using the code>option/code> element to define a command/dfn>a href#using-the-option-element-to-define-a-command classself-link>/a>/h5> p>An code idusing-the-option-element-to-define-a-command:the-option-element>a href#the-option-element>option/a>/code> element with an ancestor code idusing-the-option-element-to-define-a-command:the-select-element>a href#the-select-element>select/a>/code> element and either no code idusing-the-option-element-to-define-a-command:attr-option-value>a href#attr-option-value>value/a>/code> attribute or a code idusing-the-option-element-to-define-a-command:attr-option-value-2>a href#attr-option-value>value/a>/code> attribute that is not the empty string a href#concept-command idusing-the-option-element-to-define-a-command:concept-command>defines a command/a>./p> p>The a href#command-facet-label idusing-the-option-element-to-define-a-command:command-facet-label>Label/a> of the command is the value of the code idusing-the-option-element-to-define-a-command:the-option-element-2>a href#the-option-element>option/a>/code> elements code idusing-the-option-element-to-define-a-command:attr-option-label>a href#attr-option-label>label/a>/code> attribute, if there is one, or else the value of code idusing-the-option-element-to-define-a-command:the-option-element-3>a href#the-option-element>option/a>/code> elements code idusing-the-option-element-to-define-a-command:textcontent>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> IDL attribute, with a hrefhttps://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace idusing-the-option-element-to-define-a-command:strip-and-collapse-ascii-whitespace data-x-internalstrip-and-collapse-ascii-whitespace>ASCII whitespace stripped and collapsed/a>./p> p>The a href#command-facet-accesskey idusing-the-option-element-to-define-a-command:command-facet-accesskey>AccessKey/a> of the command is the elements a href#assigned-access-key idusing-the-option-element-to-define-a-command:assigned-access-key>assigned access key/a>, if any./p> p>The a href#command-facet-hiddenstate idusing-the-option-element-to-define-a-command:command-facet-hiddenstate>Hidden State/a> of the command is true (hidden) if the element has a code idusing-the-option-element-to-define-a-command:the-hidden-attribute>a href#the-hidden-attribute>hidden/a>/code> attribute, and false otherwise./p> p>The a href#command-facet-disabledstate idusing-the-option-element-to-define-a-command:command-facet-disabledstate>Disabled State/a> of the command is true if the element is a href#concept-option-disabled idusing-the-option-element-to-define-a-command:concept-option-disabled>disabled/a>, or if its nearest ancestor code idusing-the-option-element-to-define-a-command:the-select-element-2>a href#the-select-element>select/a>/code> element is a href#concept-fe-disabled idusing-the-option-element-to-define-a-command:concept-fe-disabled>disabled/a>, or if it or one of its ancestors is a href#inert idusing-the-option-element-to-define-a-command:inert>inert/a>, and false otherwise./p> p>If the code idusing-the-option-element-to-define-a-command:the-option-element-4>a href#the-option-element>option/a>/code>s nearest ancestor code idusing-the-option-element-to-define-a-command:the-select-element-3>a href#the-select-element>select/a>/code> element has a code idusing-the-option-element-to-define-a-command:attr-select-multiple>a href#attr-select-multiple>multiple/a>/code> attribute, the a href#command-facet-action idusing-the-option-element-to-define-a-command:command-facet-action>Action/a> of the command is to a href#concept-select-toggle idusing-the-option-element-to-define-a-command:concept-select-toggle>toggle/a> the code idusing-the-option-element-to-define-a-command:the-option-element-5>a href#the-option-element>option/a>/code> element. Otherwise, the a href#command-facet-action idusing-the-option-element-to-define-a-command:command-facet-action-2>Action/a> is to a href#concept-select-pick idusing-the-option-element-to-define-a-command:concept-select-pick>pick/a> the code idusing-the-option-element-to-define-a-command:the-option-element-6>a href#the-option-element>option/a>/code> element./p> h5 idusing-the-accesskey-attribute-on-a-legend-element-to-define-a-command>span classsecno>4.11.3.6/span> dfn>Using the code>accesskey/code> attribute on a code>legend/code> element to define a command/dfn>a href#using-the-accesskey-attribute-on-a-legend-element-to-define-a-command classself-link>/a>/h5> p>A code idusing-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 idusing-the-accesskey-attribute-on-a-legend-element-to-define-a-command:assigned-access-key>assigned access key/a> and is a child of a code idusing-the-accesskey-attribute-on-a-legend-element-to-define-a-command:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code> element that has a descendant that is not a descendant of the code idusing-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 idusing-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 idusing-the-accesskey-attribute-on-a-legend-element-to-define-a-command:the-legend-element-3>a href#the-legend-element>legend/a>/code> element but that a href#concept-command idusing-the-accesskey-attribute-on-a-legend-element-to-define-a-command:concept-command>defines a command/a>, itself a href#concept-command idusing-the-accesskey-attribute-on-a-legend-element-to-define-a-command:concept-command-2>defines a command/a>./p> p>The a href#command-facet-label idusing-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 elements code idusing-the-accesskey-attribute-on-a-legend-element-to-define-a-command:textcontent>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> IDL attribute./p> p>The a href#command-facet-accesskey idusing-the-accesskey-attribute-on-a-legend-element-to-define-a-command:command-facet-accesskey>AccessKey/a> of the command is the elements a href#assigned-access-key idusing-the-accesskey-attribute-on-a-legend-element-to-define-a-command:assigned-access-key-2>assigned access key/a>./p> p>The a href#command-facet-hiddenstate idusing-the-accesskey-attribute-on-a-legend-element-to-define-a-command:command-facet-hiddenstate>Hidden State/a>, a href#command-facet-disabledstate idusing-the-accesskey-attribute-on-a-legend-element-to-define-a-command:command-facet-disabledstate>Disabled State/a>, and a href#command-facet-action idusing-the-accesskey-attribute-on-a-legend-element-to-define-a-command:command-facet-action>Action/a> facets of the command are the same as the respective facets of the first element in a idusing-the-accesskey-attribute-on-a-legend-element-to-define-a-command:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> that is a descendant of the parent of the code idusing-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 idusing-the-accesskey-attribute-on-a-legend-element-to-define-a-command:concept-command-3>defines a command/a> but is not a descendant of the code idusing-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 idusing-the-accesskey-attribute-on-a-legend-element-to-define-a-command:the-label-element-2>a href#the-label-element>label/a>/code> nor a code idusing-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> h5 idusing-the-accesskey-attribute-to-define-a-command-on-other-elements>span classsecno>4.11.3.7/span> dfn>Using the code>accesskey/code> attribute to define a command on other elements/dfn>a href#using-the-accesskey-attribute-to-define-a-command-on-other-elements classself-link>/a>/h5> p>An element that has an a href#assigned-access-key idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:assigned-access-key>assigned access key/a> a href#concept-command idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:concept-command>defines a command/a>./p> p>If one of the earlier sections that define elements that a href#concept-command idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:concept-command-2>define commands/a> define that this element a href#concept-command idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:concept-command-3>defines a command/a>, then that section applies to this element, and this section does not. Otherwise, this section applies to that element./p> p>The a href#command-facet-label idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-label>Label/a> of the command depends on the element. If the element is a a href#labeled-control idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:labeled-control>labeled control/a>, the code idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:textcontent>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> of the first code idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:the-label-element>a href#the-label-element>label/a>/code> element in a idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> whose a href#labeled-control idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:labeled-control-2>labeled control/a> is the element in question is the a href#command-facet-label idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-label-2>Label/a> (in DOM terms, this is the string given by code>var>element/var>.labels0.textContent/code>). Otherwise, the a href#command-facet-label idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-label-3>Label/a> is the code idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:textcontent-2>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> of the element itself./p> p>The a href#command-facet-accesskey idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-accesskey>AccessKey/a> of the command is the elements a href#assigned-access-key idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:assigned-access-key-2>assigned access key/a>./p> p>The a href#command-facet-hiddenstate idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-hiddenstate>Hidden State/a> of the command is true (hidden) if the element has a code idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:the-hidden-attribute>a href#the-hidden-attribute>hidden/a>/code> attribute, and false otherwise./p> p>The a href#command-facet-disabledstate idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-disabledstate>Disabled State/a> of the command is true if the element or one of its ancestors is a href#inert idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:inert>inert/a>, and false otherwise./p> p>The a href#command-facet-action idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-action>Action/a> of the command is to run the following steps:/p> ol>li>Run the a href#focusing-steps idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:focusing-steps>focusing steps/a> for the element.li>a href#fire-a-click-event idusing-the-accesskey-attribute-to-define-a-command-on-other-elements:fire-a-click-event>Fire a code>click/code> event/a> at the element./ol> h4 idthe-dialog-element>span classsecno>4.11.4/span> The dfn>code>dialog/code>/dfn> elementa href#the-dialog-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> dialogspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>37+/span>/span>span classios_saf no>span>iOS Safari/span> span>None/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox no>span>Firefox/span> span>None/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari no>span>Safari/span> span>None/span>/span>span classedge no>span>Edge/span> span>None/span>/span>span classandroid yes>span>Android Browser/span> span>56+/span>/span>span classopera yes>span>Opera/span> span>24+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featdialog>caniuse.com/a>/div> dl classelement>dt>a href#concept-element-categories idthe-dialog-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-dialog-element:flow-content-2>Flow content/a>.dd>a href#sectioning-root idthe-dialog-element:sectioning-root>Sectioning root/a>.dt>a href#concept-element-contexts idthe-dialog-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#flow-content-2 idthe-dialog-element:flow-content-2-2>flow content/a> is expected.dt>a href#concept-element-content-model idthe-dialog-element:concept-element-content-model>Content model/a>:dd>a href#flow-content-2 idthe-dialog-element:flow-content-2-3>Flow content/a>.dt>a href#concept-element-tag-omission idthe-dialog-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-dialog-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-dialog-element:global-attributes>Global attributes/a>dd>code idthe-dialog-element:attr-dialog-open>a href#attr-dialog-open>open/a>/code> — Whether the dialog box is showingdt>a href#concept-element-dom idthe-dialog-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-dialog-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmldialogelement>HTMLDialogElement/dfn> : a href#htmlelement idthe-dialog-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-dialog-element:cereactions>CEReactions/a> attribute boolean a href#dom-dialog-open idthe-dialog-element:dom-dialog-open>open/a>; attribute DOMString a href#dom-dialog-returnvalue idthe-dialog-element:dom-dialog-returnvalue>returnValue/a>; a href#cereactions idthe-dialog-element:cereactions-2>CEReactions/a> void a href#dom-dialog-show idthe-dialog-element:dom-dialog-show>show/a>(); a href#cereactions idthe-dialog-element:cereactions-3>CEReactions/a> void a href#dom-dialog-showmodal idthe-dialog-element:dom-dialog-showmodal>showModal/a>(); a href#cereactions idthe-dialog-element:cereactions-4>CEReactions/a> void a href#dom-dialog-close idthe-dialog-element:dom-dialog-close>close/a>(optional DOMString returnValue);};/pre> /dl> p>The code idthe-dialog-element:the-dialog-element>a href#the-dialog-element>dialog/a>/code> element represents a part of an application that a user interacts with to perform a task, for example a dialog box, inspector, or window./p> p>The dfn idattr-dialog-open>code>open/code>/dfn> attribute is a a href#boolean-attribute idthe-dialog-element:boolean-attribute>boolean attribute/a>. When specified, it indicates that the code idthe-dialog-element:the-dialog-element-2>a href#the-dialog-element>dialog/a>/code> element is active and that the user can interact with it./p> p>A code idthe-dialog-element:the-dialog-element-3>a href#the-dialog-element>dialog/a>/code> element without an code idthe-dialog-element:attr-dialog-open-2>a href#attr-dialog-open>open/a>/code> attribute specified should not be shown to the user. This requirement may be implemented indirectly through the style layer. For example, user agents that a href#renderingUA>support the suggested default rendering/a> implement this requirement using the CSS rules described in the a href#rendering>rendering section/a>./p> div classnote> p>Removing the code idthe-dialog-element:attr-dialog-open-3>a href#attr-dialog-open>open/a>/code> attribute will usually hide the dialog. However, doing so has a number of strange additional consequences: ul>li>p>The code idthe-dialog-element:event-close>a href#event-close>close/a>/code> event will not be fired.li>p>The code idthe-dialog-element:dom-dialog-close-2>a href#dom-dialog-close>close()/a>/code> method, and any a href#canceling-dialogs>user-agent provided cancelation interface/a>, will no longer be able to close the dialog.li>p>If the dialog was shown using its code idthe-dialog-element:dom-dialog-showmodal-2>a href#dom-dialog-showmodal>showModal()/a>/code> method, the code idthe-dialog-element:document>a href#document>Document/a>/code> will still be a href#blocked-by-a-modal-dialog idthe-dialog-element:blocked-by-a-modal-dialog>blocked/a>./ul> p>For these reasons, it is generally better to never remove the code idthe-dialog-element:attr-dialog-open-4>a href#attr-dialog-open>open/a>/code> attribute manually. Instead, use the code idthe-dialog-element:dom-dialog-close-3>a href#dom-dialog-close>close()/a>/code> method to close the dialog, or the code idthe-dialog-element:the-hidden-attribute>a href#the-hidden-attribute>hidden/a>/code> attribute to hide it./p> /div> p>The code idthe-dialog-element:attr-tabindex>a href#attr-tabindex>tabindex/a>/code> attribute must not be specified on code idthe-dialog-element:the-dialog-element-4>a href#the-dialog-element>dialog/a>/code> elements./p> dl classdomintro>dt>var>dialog/var> . code idthe-dialog-element:dom-dialog-show-2>a href#dom-dialog-show>show/a>/code>()dd> p>Displays the code idthe-dialog-element:the-dialog-element-5>a href#the-dialog-element>dialog/a>/code> element./p> dt>var>dialog/var> . code idthe-dialog-element:dom-dialog-showmodal-3>a href#dom-dialog-showmodal>showModal/a>/code>()dd> p>Displays the code idthe-dialog-element:the-dialog-element-6>a href#the-dialog-element>dialog/a>/code> element and makes it the top-most modal dialog./p> p>This method honors the code idthe-dialog-element:attr-fe-autofocus>a href#attr-fe-autofocus>autofocus/a>/code> attribute./p> dt>var>dialog/var> . code idthe-dialog-element:dom-dialog-close-4>a href#dom-dialog-close>close/a>/code>( var>result/var> )dd> p>Closes the code idthe-dialog-element:the-dialog-element-7>a href#the-dialog-element>dialog/a>/code> element./p> p>The argument, if provided, provides a return value./p> dt>var>dialog/var> . code idthe-dialog-element:dom-dialog-returnvalue-2>a href#dom-dialog-returnvalue>returnValue/a>/code> var>result/var> dd> p>Returns the code idthe-dialog-element:the-dialog-element-8>a href#the-dialog-element>dialog/a>/code>s return value./p> p>Can be set, to update the return value./p> /dl> p>When the dfn iddom-dialog-show>code>show()/code>/dfn> method is invoked, the user agent must run the following steps:/p> ol>li>p>If the element already has an code idthe-dialog-element:attr-dialog-open-5>a href#attr-dialog-open>open/a>/code> attribute, then abort these steps.li>p>Add an code idthe-dialog-element:attr-dialog-open-6>a href#attr-dialog-open>open/a>/code> attribute to the code idthe-dialog-element:the-dialog-element-9>a href#the-dialog-element>dialog/a>/code> element, whose value is the empty string.li>p>Set the code idthe-dialog-element:the-dialog-element-10>a href#the-dialog-element>dialog/a>/code> to the a href#normal-alignment idthe-dialog-element:normal-alignment>normal alignment/a> mode.li>p>Run the a href#dialog-focusing-steps idthe-dialog-element:dialog-focusing-steps>dialog focusing steps/a> for the code idthe-dialog-element:the-dialog-element-11>a href#the-dialog-element>dialog/a>/code> element./ol> p>When the dfn iddom-dialog-showmodal>code>showModal()/code>/dfn> method is invoked, the user agent must run the following steps:/p> ol>li>p>Let var>subject/var> be the code idthe-dialog-element:the-dialog-element-12>a href#the-dialog-element>dialog/a>/code> element on which the method was invoked.li>p>If var>subject/var> already has an code idthe-dialog-element:attr-dialog-open-7>a href#attr-dialog-open>open/a>/code> attribute, then throw an a idthe-dialog-element:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idthe-dialog-element:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>If var>subject/var> is not a idthe-dialog-element:connected hrefhttps://dom.spec.whatwg.org/#connected data-x-internalconnected>connected/a>, then throw an a idthe-dialog-element:invalidstateerror-2 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idthe-dialog-element:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Add an code idthe-dialog-element:attr-dialog-open-8>a href#attr-dialog-open>open/a>/code> attribute to var>subject/var>, whose value is the empty string.li>p>Set the code idthe-dialog-element:the-dialog-element-13>a href#the-dialog-element>dialog/a>/code> to the a href#centered-alignment idthe-dialog-element:centered-alignment>centered alignment/a> mode.li>p>Let var>subject/var>s a idthe-dialog-element:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> be a href#blocked-by-a-modal-dialog idthe-dialog-element:blocked-by-a-modal-dialog-2>blocked by the modal dialog/a> var>subject/var>.li>p>If var>subject/var>s a idthe-dialog-element:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a idthe-dialog-element:top-layer hrefhttps://fullscreen.spec.whatwg.org/#top-layer data-x-internaltop-layer>top layer/a> does not already a hrefhttps://infra.spec.whatwg.org/#list-contain idthe-dialog-element:list-contains data-x-internallist-contains>contain/a> var>subject/var>, then a hrefhttps://fullscreen.spec.whatwg.org/#top-layer-add idthe-dialog-element:top-layer-add data-x-internaltop-layer-add>add/a> var>subject/var> to var>subject/var>s a idthe-dialog-element:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a idthe-dialog-element:top-layer-2 hrefhttps://fullscreen.spec.whatwg.org/#top-layer data-x-internaltop-layer>top layer/a>.li>p>Run the a href#dialog-focusing-steps idthe-dialog-element:dialog-focusing-steps-2>dialog focusing steps/a> for var>subject/var>./ol> p>The dfn iddialog-focusing-steps>dialog focusing steps/dfn> for a code idthe-dialog-element:the-dialog-element-14>a href#the-dialog-element>dialog/a>/code> element var>subject/var> are as follows:/p> ol>li>p>If for some reason var>subject/var> is not a a href#control-group-owner-object idthe-dialog-element:control-group-owner-object>control group owner object/a> at this point, or if it is a href#inert idthe-dialog-element:inert>inert/a>, abort these steps.li> p>Let var>control/var> be the first non-a href#inert idthe-dialog-element:inert-2>inert/a> a href#focusable-area idthe-dialog-element:focusable-area>focusable area/a> in var>subject/var>s a href#control-group idthe-dialog-element:control-group>control group/a> whose a href#dom-anchor idthe-dialog-element:dom-anchor>DOM anchor/a> has an code idthe-dialog-element:attr-fe-autofocus-2>a href#attr-fe-autofocus>autofocus/a>/code> attribute specified./p> p>If there isnt one, then let var>control/var> be the first non-a href#inert idthe-dialog-element:inert-3>inert/a> a href#focusable-area idthe-dialog-element:focusable-area-2>focusable area/a> in var>subject/var>s a href#control-group idthe-dialog-element:control-group-2>control group/a>./p> p>If there isnt one of those either, then let var>control/var> be var>subject/var>./p> li>p>Run the a href#focusing-steps idthe-dialog-element:focusing-steps>focusing steps/a> for var>control/var>./ol> p>If at any time a code idthe-dialog-element:the-dialog-element-15>a href#the-dialog-element>dialog/a>/code> element is a href#remove-an-element-from-a-document idthe-dialog-element:remove-an-element-from-a-document>removed from a code>Document/code>/a>, then if that code idthe-dialog-element:the-dialog-element-16>a href#the-dialog-element>dialog/a>/code> is in that code idthe-dialog-element:document-2>a href#document>Document/a>/code>s a idthe-dialog-element:top-layer-3 hrefhttps://fullscreen.spec.whatwg.org/#top-layer data-x-internaltop-layer>top layer/a>, it must be a hrefhttps://infra.spec.whatwg.org/#list-remove idthe-dialog-element:list-remove data-x-internallist-remove>removed/a> from it./p> p>When the dfn iddom-dialog-close>code>close()/code>/dfn> method is invoked, the user agent must a href#close-the-dialog idthe-dialog-element:close-the-dialog>close the dialog/a> that the method was invoked on. If the method was invoked with an argument, that argument must be used as the return value; otherwise, there is no return value./p> p>When a code idthe-dialog-element:the-dialog-element-17>a href#the-dialog-element>dialog/a>/code> element var>subject/var> is to be dfn idclose-the-dialog>closed/dfn>, optionally with a return value var>result/var>, the user agent must run the following steps:/p> ol>li>p>If var>subject/var> does not have an code idthe-dialog-element:attr-dialog-open-9>a href#attr-dialog-open>open/a>/code> attribute, then abort these steps.li>p>Remove var>subject/var>s code idthe-dialog-element:attr-dialog-open-10>a href#attr-dialog-open>open/a>/code> attribute.li>p>If the argument var>result/var> was provided, then set the code idthe-dialog-element:dom-dialog-returnvalue-3>a href#dom-dialog-returnvalue>returnValue/a>/code> attribute to the value of var>result/var>.li>p>If var>subject/var> is in its code idthe-dialog-element:document-3>a href#document>Document/a>/code>s a idthe-dialog-element:top-layer-4 hrefhttps://fullscreen.spec.whatwg.org/#top-layer data-x-internaltop-layer>top layer/a>, then a hrefhttps://infra.spec.whatwg.org/#list-remove idthe-dialog-element:list-remove-2 data-x-internallist-remove>remove/a> it.li>p>a href#queue-a-task idthe-dialog-element:queue-a-task>Queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-dialog-element:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idthe-dialog-element:event-close-2>a href#event-close>close/a>/code> at var>subject/var>./ol> p>The dfn iddom-dialog-returnvalue>code>returnValue/code>/dfn> IDL attribute, on getting, must return the last value to which it was set. On setting, it must be set to the new value. When the element is created, it must be set to the empty string./p> hr> p idcanceling-dialogs>strong>Canceling dialogs/strong>: When code idthe-dialog-element:document-4>a href#document>Document/a>/code> is a href#blocked-by-a-modal-dialog idthe-dialog-element:blocked-by-a-modal-dialog-3>blocked by a modal dialog/a> var>dialog/var>, user agents may provide a user interface that, upon activation, a href#queue-a-task idthe-dialog-element:queue-a-task-2>queues a task/a> to run these steps: ol>li>p>Let var>close/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-dialog-element:concept-event-fire-2 data-x-internalconcept-event-fire>firing an event/a> named code idthe-dialog-element:event-cancel>a href#event-cancel>cancel/a>/code> at var>dialog/var>, with the code idthe-dialog-element:dom-event-cancelable>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true.li>p>If var>close/var> is true and var>dialog/var> has an code idthe-dialog-element:attr-dialog-open-11>a href#attr-dialog-open>open/a>/code> attribute, then a href#close-the-dialog idthe-dialog-element:close-the-dialog-2>close the dialog/a> with no return value./ol> p classnote>An example of such a UI mechanism would be the user pressing the Escape key./p> hr> p>A code idthe-dialog-element:the-dialog-element-18>a href#the-dialog-element>dialog/a>/code> element is in one of two modes: dfn idnormal-alignment>normal alignment/dfn> or dfn idcentered-alignment>centered alignment/dfn>. When a code idthe-dialog-element:the-dialog-element-19>a href#the-dialog-element>dialog/a>/code> element is created, it must be placed in the a href#normal-alignment idthe-dialog-element:normal-alignment-2>normal alignment/a> mode. In this mode, normal CSS requirements apply to the element. The a href#centered-alignment idthe-dialog-element:centered-alignment-2>centered alignment/a> mode is only used for code idthe-dialog-element:the-dialog-element-20>a href#the-dialog-element>dialog/a>/code> elements that are in the a idthe-dialog-element:top-layer-5 hrefhttps://fullscreen.spec.whatwg.org/#top-layer data-x-internaltop-layer>top layer/a>. a href#refsFULLSCREEN>FULLSCREEN/a> a href#refsCSS>CSS/a>/p> p>When an element var>subject/var> is placed in a href#centered-alignment idthe-dialog-element:centered-alignment-3>centered alignment/a> mode, and when it is in that mode and has new rendering boxes created, the user agent must set up the element such that its static position of the edge that corresponds to var>subject/var>s parents a idthe-dialog-element:block-start hrefhttps://drafts.csswg.org/css-writing-modes/#block-start data-x-internalblock-start>block-start/a> edge, for the purposes of calculating the a idthe-dialog-element:used-value hrefhttps://drafts.csswg.org/css-cascade/#used-value data-x-internalused-value>used value/a> of the appropriate box offset property (a idthe-dialog-element:top hrefhttps://drafts.csswg.org/css2/visuren.html#propdef-top data-x-internaltop>top/a>, a idthe-dialog-element:right hrefhttps://drafts.csswg.org/css2/visuren.html#propdef-right data-x-internalright>right/a>, a idthe-dialog-element:bottom hrefhttps://drafts.csswg.org/css2/visuren.html#propdef-bottom data-x-internalbottom>bottom/a>, or a idthe-dialog-element:left hrefhttps://drafts.csswg.org/css2/visuren.html#propdef-left data-x-internalleft>left/a>), is the value that would place the elements a idthe-dialog-element:margin-edge hrefhttps://drafts.csswg.org/css2/box.html#margin-edge data-x-internalmargin-edge>margin edge/a> on the side that corresponds to var>subject/var>s parents a idthe-dialog-element:block-start-2 hrefhttps://drafts.csswg.org/css-writing-modes/#block-start data-x-internalblock-start>block-start/a> side as far from the same-side edge of the a idthe-dialog-element:viewport hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> as the elements opposing side a idthe-dialog-element:margin-edge-2 hrefhttps://drafts.csswg.org/css2/box.html#margin-edge data-x-internalmargin-edge>margin edge/a> from that same-side edge of the a idthe-dialog-element:viewport-2 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>, if the elements dimension (a idthe-dialog-element:width hrefhttps://drafts.csswg.org/css2/visudet.html#the-width-property data-x-internalwidth>width/a> or a idthe-dialog-element:height hrefhttps://drafts.csswg.org/css2/visudet.html#the-height-property data-x-internalheight>height/a>) in var>subject/var>s parents a idthe-dialog-element:block-flow-direction hrefhttps://drafts.csswg.org/css-writing-modes/#block-flow-direction data-x-internalblock-flow-direction>block flow direction/a> is less than the same-axis dimension of the a idthe-dialog-element:viewport-3 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>, and otherwise is the value that would place the elements a idthe-dialog-element:margin-edge-3 hrefhttps://drafts.csswg.org/css2/box.html#margin-edge data-x-internalmargin-edge>margin edge/a> on the side that corresponds to var>subject/var>s parents a idthe-dialog-element:block-start-3 hrefhttps://drafts.csswg.org/css-writing-modes/#block-start data-x-internalblock-start>block-start/a> side at the same-side edge of the a idthe-dialog-element:viewport-4 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>./p> p>If there is a code idthe-dialog-element:the-dialog-element-21>a href#the-dialog-element>dialog/a>/code> element with a href#centered-alignment idthe-dialog-element:centered-alignment-4>centered alignment/a> and that is a href#being-rendered idthe-dialog-element:being-rendered>being rendered/a> when its a href#browsing-context idthe-dialog-element:browsing-context>browsing context/a> changes a idthe-dialog-element:viewport-5 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> dimensions (as measured in a hrefhttps://drafts.csswg.org/css-values/#px idthe-dialog-element:px data-x-internalpx>CSS pixels/a>), or when this code idthe-dialog-element:the-dialog-element-22>a href#the-dialog-element>dialog/a>/code> elements parent changes a idthe-dialog-element:block-flow-direction-2 hrefhttps://drafts.csswg.org/css-writing-modes/#block-flow-direction data-x-internalblock-flow-direction>block flow direction/a>, then the user agent must recreate the elements boxes, recalculating its edge that corresponds to this code idthe-dialog-element:the-dialog-element-23>a href#the-dialog-element>dialog/a>/code> elements parents a idthe-dialog-element:block-start-4 hrefhttps://drafts.csswg.org/css-writing-modes/#block-start data-x-internalblock-start>block-start/a> edge as in the previous paragraph./p> p>This static position of a code idthe-dialog-element:the-dialog-element-24>a href#the-dialog-element>dialog/a>/code> elements edge with a href#centered-alignment idthe-dialog-element:centered-alignment-5>centered alignment/a> must remain the elements static position of that edge until its boxes are recreated. (The elements static position is only used in calculating the a idthe-dialog-element:used-value-2 hrefhttps://drafts.csswg.org/css-cascade/#used-value data-x-internalused-value>used value/a> of the appropriate box offset property (a idthe-dialog-element:top-2 hrefhttps://drafts.csswg.org/css2/visuren.html#propdef-top data-x-internaltop>top/a>, a idthe-dialog-element:right-2 hrefhttps://drafts.csswg.org/css2/visuren.html#propdef-right data-x-internalright>right/a>, a idthe-dialog-element:bottom-2 hrefhttps://drafts.csswg.org/css2/visuren.html#propdef-bottom data-x-internalbottom>bottom/a>, or a idthe-dialog-element:left-2 hrefhttps://drafts.csswg.org/css2/visuren.html#propdef-left data-x-internalleft>left/a>) in certain situations; its not used, for instance, to position the element if its a idthe-dialog-element:position hrefhttps://drafts.csswg.org/css-position/#position-property data-x-internalposition>position/a> property is set to a idthe-dialog-element:static hrefhttps://drafts.csswg.org/css-position/#valdef-position-static data-x-internalstatic>static/a>.)/p> p>User agents in visual interactive media should allow the user to pan the a idthe-dialog-element:viewport-6 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> to access all parts of a code idthe-dialog-element:the-dialog-element-25>a href#the-dialog-element>dialog/a>/code> elements a idthe-dialog-element:border-box hrefhttps://drafts.csswg.org/css2/box.html#x14 data-x-internalborder-box>border box/a>, even if the element is larger than the a idthe-dialog-element:viewport-7 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> and the a idthe-dialog-element:viewport-8 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> would otherwise not have a scroll mechanism (e.g. because the a idthe-dialog-element:viewport-9 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>s a idthe-dialog-element:overflow hrefhttps://drafts.csswg.org/css-overflow-3/#propdef-overflow data-x-internaloverflow>overflow/a> property is set to a idthe-dialog-element:hidden hrefhttps://drafts.csswg.org/css-overflow-3/#valdef-overflow-hidden data-x-internalhidden>hidden/a>)./p> hr> p>The dfn iddom-dialog-open>code>open/code>/dfn> IDL attribute must a href#reflect idthe-dialog-element:reflect>reflect/a> the code idthe-dialog-element:attr-dialog-open-12>a href#attr-dialog-open>open/a>/code> content attribute./p> div classexample> p>This dialog box has some small print. The code idthe-dialog-element:the-main-element>a href#the-main-element>main/a>/code> element is used to draw the users attention to the more important parts./p> pre><dialog> <h1>Add to Wallet</h1> <main> <p>How many gold coins do you want to add to your wallet?</p> <p><input nameamt typenumber min0 step0.01 value100></p> </main> <p><small>You add coins at your own risk.</small></p> <p><label><input nameround typecheckbox> Only add perfectly round coins </label> <p><input typebutton onclicksubmit() valueAdd Coins></p></dialog>/pre> /div> h3 idscripting-3>span classsecno>4.12/span> Scriptinga href#scripting-3 classself-link>/a>/h3> p>Scripts allow authors to add interactivity to their documents./p> p>Authors are encouraged to use declarative alternatives to scripting where possible, as declarative mechanisms are often more maintainable, and many users disable scripting./p> div classexample> p>For example, instead of using script to show or hide a section to show more details, the code idscripting-3:the-details-element>a href#the-details-element>details/a>/code> element could be used./p> /div> p>Authors are also encouraged to make their applications degrade gracefully in the absence of scripting support./p> div classexample> p>For example, if an author provides a link in a table header to dynamically resort the table, the link could also be made to function without scripts by requesting the sorted table from the server./p> /div> h4 idthe-script-element data-dfn-typeelement data-ltscript>span classsecno>4.12.1/span> The dfn idscript>code>script/code>/dfn> elementa href#the-script-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-script-element:concept-element-categories>Categories/a>:dd>a href#metadata-content-2 idthe-script-element:metadata-content-2>Metadata content/a>.dd>a href#flow-content-2 idthe-script-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-script-element:phrasing-content-2>Phrasing content/a>.dd>a href#script-supporting-elements-2 idthe-script-element:script-supporting-elements-2>Script-supporting element/a>.dt>a href#concept-element-contexts idthe-script-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#metadata-content-2 idthe-script-element:metadata-content-2-2>metadata content/a> is expected.dd>Where a href#phrasing-content-2 idthe-script-element:phrasing-content-2-2>phrasing content/a> is expected.dd>Where a href#script-supporting-elements-2 idthe-script-element:script-supporting-elements-2-2>script-supporting elements/a> are expected.dt>a href#concept-element-content-model idthe-script-element:concept-element-content-model>Content model/a>:dd>If there is no code idthe-script-element:attr-script-src>a href#attr-script-src>src/a>/code> attribute, depends on the value of the code idthe-script-element:attr-script-type>a href#attr-script-type>type/a>/code> attribute, but must match a href#restrictions-for-contents-of-script-elements idthe-script-element:restrictions-for-contents-of-script-elements>script content restrictions/a>.dd>If there em>is/em> a code idthe-script-element:attr-script-src-2>a href#attr-script-src>src/a>/code> attribute, the element must be either empty or contain only a href#inline-documentation-for-external-scripts idthe-script-element:inline-documentation-for-external-scripts>script documentation/a> that also matches a href#restrictions-for-contents-of-script-elements idthe-script-element:restrictions-for-contents-of-script-elements-2>script content restrictions/a>.dt>a href#concept-element-tag-omission idthe-script-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-script-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-script-element:global-attributes>Global attributes/a>dd>code idthe-script-element:attr-script-src-3>a href#attr-script-src>src/a>/code> — Address of the resourcedd>code idthe-script-element:attr-script-type-2>a href#attr-script-type>type/a>/code> — Type of scriptdd>code idthe-script-element:attr-script-nomodule>a href#attr-script-nomodule>nomodule/a>/code> — Prevents execution in user agents that support a href#module-script idthe-script-element:module-script>module scripts/a>dd>code idthe-script-element:attr-script-async>a href#attr-script-async>async/a>/code> — Execute script when available, without blockingdd>code idthe-script-element:attr-script-defer>a href#attr-script-defer>defer/a>/code> — Defer script executiondd>code idthe-script-element:attr-script-crossorigin>a href#attr-script-crossorigin>crossorigin/a>/code> — How the element handles crossorigin requestsdd>code idthe-script-element:attr-script-nonce>a href#attr-script-nonce>nonce/a>/code> — Cryptographic nonce used in cite>Content Security Policy/cite> checks a href#refsCSP>CSP/a>dd>code idthe-script-element:attr-script-integrity>a href#attr-script-integrity>integrity/a>/code> — Integrity metadata used in cite>Subresource Integrity/cite> checks a href#refsSRI>SRI/a>dt>a href#concept-element-dom idthe-script-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-script-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlscriptelement>HTMLScriptElement/dfn> : a href#htmlelement idthe-script-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-script-element:cereactions>CEReactions/a> attribute USVString a href#dom-script-src idthe-script-element:dom-script-src>src/a>; a href#cereactions idthe-script-element:cereactions-2>CEReactions/a> attribute DOMString a href#dom-script-type idthe-script-element:dom-script-type>type/a>; a href#cereactions idthe-script-element:cereactions-3>CEReactions/a> attribute boolean a href#dom-script-nomodule idthe-script-element:dom-script-nomodule>noModule/a>; a href#cereactions idthe-script-element:cereactions-4>CEReactions/a> attribute boolean a href#dom-script-async idthe-script-element:dom-script-async>async/a>; a href#cereactions idthe-script-element:cereactions-5>CEReactions/a> attribute boolean a href#dom-script-defer idthe-script-element:dom-script-defer>defer/a>; a href#cereactions idthe-script-element:cereactions-6>CEReactions/a> attribute DOMString? a href#dom-script-crossorigin idthe-script-element:dom-script-crossorigin>crossOrigin/a>; a href#cereactions idthe-script-element:cereactions-7>CEReactions/a> attribute DOMString a href#dom-script-text idthe-script-element:dom-script-text>text/a>; a href#cereactions idthe-script-element:cereactions-8>CEReactions/a> attribute DOMString a href#dom-script-nonce idthe-script-element:dom-script-nonce>nonce/a>; a href#cereactions idthe-script-element:cereactions-9>CEReactions/a> attribute DOMString a href#dom-script-integrity idthe-script-element:dom-script-integrity>integrity/a>; // a href#HTMLScriptElement-partial>also has obsolete members/a>};/pre> /dl> p>The code idthe-script-element:the-script-element>a href#the-script-element>script/a>/code> element allows authors to include dynamic script and data blocks in their documents. The element does not a href#represents idthe-script-element:represents>represent/a> content for the user./p> p>The dfn idattr-script-type>code>type/code>/dfn> attribute allows customization of the type of script represented:div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> es6-modulespan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>61+/span>/span>span classios_saf yes>span>iOS Safari/span> span>10.3+/span>/span>span classand_uc no>span>UC Browser for Android/span> span>None/span>/span>span classfirefox no>span>Firefox/span> span>None/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung no>span>Samsung Internet/span> span>None/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>10.1+/span>/span>span classedge yes>span>Edge/span> span>16+/span>/span>span classandroid no>span>Android Browser/span> span>None/span>/span>span classopera no>span>Opera/span> span>None/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#feates6-module>caniuse.com/a>/div> ul>li>p>Omitting the attribute, setting it to the empty string, or setting it to an a idthe-script-element:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for a a href#javascript-mime-type idthe-script-element:javascript-mime-type>JavaScript MIME type/a>, means that the script is a a href#classic-script idthe-script-element:classic-script>classic script/a>, to be interpreted according to the JavaScript i idthe-script-element:js-prod-script>a data-x-internaljs-prod-script hrefhttps://tc39.github.io/ecma262/#prod-Script>Script/a>/i> top-level production. Classic scripts are affected by the code idthe-script-element:attr-script-async-2>a href#attr-script-async>async/a>/code> and code idthe-script-element:attr-script-defer-2>a href#attr-script-defer>defer/a>/code> attributes. Authors should omit the attribute instead of redundantly setting it.li>p>Setting the attribute to an a idthe-script-element:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>module/code> means that the script is a a href#module-script idthe-script-element:module-script-2>module script/a>, to be interpreted according to the JavaScript i idthe-script-element:js-prod-module>a data-x-internaljs-prod-module hrefhttps://tc39.github.io/ecma262/#prod-Module>Module/a>/i> top-level production. Module scripts are not affected by the code idthe-script-element:attr-script-defer-3>a href#attr-script-defer>defer/a>/code> attribute.li>p>Setting the attribute to any other value means that the script is a dfn iddata-block>data block/dfn>, which is not processed. None of the code idthe-script-element:the-script-element-2>a href#the-script-element>script/a>/code> attributes (except code idthe-script-element:attr-script-type-3>a href#attr-script-type>type/a>/code> itself) have any effect on data blocks. Authors must use a a idthe-script-element:valid-mime-type hrefhttps://mimesniff.spec.whatwg.org/#valid-mime-type data-x-internalvalid-mime-type>valid MIME type/a> that is not a a href#javascript-mime-type idthe-script-element:javascript-mime-type-2>JavaScript MIME type/a> to denote data blocks./ul> p classnote>The requirement that a href#data-block idthe-script-element:data-block>data blocks/a> must be denoted using a a idthe-script-element:valid-mime-type-2 hrefhttps://mimesniff.spec.whatwg.org/#valid-mime-type data-x-internalvalid-mime-type>valid MIME type/a> is in place to avoid potential future collisions. If this specification ever adds additional types of a href#the-script-element idthe-script-element:the-script-element-3>script/a>, they will be triggered by setting the code idthe-script-element:attr-script-type-4>a href#attr-script-type>type/a>/code> attribute to something which is not a MIME type, like how the code>module/code> value denotes a href#module-script idthe-script-element:module-script-3>module scripts/a>. By using a valid MIME type now, you ensure that your data block will not ever be reinterpreted as a different script type, even in future user agents./p> p>a href#classic-script idthe-script-element:classic-script-2>Classic scripts/a> and a href#module-script idthe-script-element:module-script-4>module scripts/a> may either be embedded inline or may be imported from an external file using the dfn data-dfn-forscript idattr-script-src data-dfn-typeelement-attr data-export>code>src/code>/dfn> attribute, which if specified gives the a idthe-script-element:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the external script resource to use. If code idthe-script-element:attr-script-src-4>a href#attr-script-src>src/a>/code> is specified, it must be a a href#valid-non-empty-url-potentially-surrounded-by-spaces idthe-script-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces/a>. The contents of inline code idthe-script-element:the-script-element-4>a href#the-script-element>script/a>/code> elements, or the external script resource, must conform with the requirements of the JavaScript specifications i idthe-script-element:js-prod-script-2>a data-x-internaljs-prod-script hrefhttps://tc39.github.io/ecma262/#prod-Script>Script/a>/i> or i idthe-script-element:js-prod-module-2>a data-x-internaljs-prod-module hrefhttps://tc39.github.io/ecma262/#prod-Module>Module/a>/i> productions, for a href#classic-script idthe-script-element:classic-script-3>classic scripts/a> and a href#module-script idthe-script-element:module-script-5>module scripts/a> respectively. a href#refsJAVASCRIPT>JAVASCRIPT/a>/p> p>When used to include a href#data-block idthe-script-element:data-block-2>data blocks/a>, the data must be embedded inline, the format of the data must be given using the code idthe-script-element:attr-script-type-5>a href#attr-script-type>type/a>/code> attribute, and the contents of the code idthe-script-element:the-script-element-5>a href#the-script-element>script/a>/code> element must conform to the requirements defined for the format used. The code idthe-script-element:attr-script-src-5>a href#attr-script-src>src/a>/code>, code idthe-script-element:attr-script-async-3>a href#attr-script-async>async/a>/code>, code idthe-script-element:attr-script-nomodule-2>a href#attr-script-nomodule>nomodule/a>/code>, code idthe-script-element:attr-script-defer-4>a href#attr-script-defer>defer/a>/code>, code idthe-script-element:attr-script-crossorigin-2>a href#attr-script-crossorigin>crossorigin/a>/code>, code idthe-script-element:attr-script-nonce-2>a href#attr-script-nonce>nonce/a>/code> and code idthe-script-element:attr-script-integrity-2>a href#attr-script-integrity>integrity/a>/code> attributes must not be specified./p> p>The dfn idattr-script-nomodule>code>nomodule/code>/dfn> attribute is a a href#boolean-attribute idthe-script-element:boolean-attribute>boolean attribute/a> that prevents a script from being executed in user agents that support a href#module-script idthe-script-element:module-script-6>module scripts/a>. This allows selective execution of a href#module-script idthe-script-element:module-script-7>module scripts/a> in modern user agents and a href#classic-script idthe-script-element:classic-script-4>classic scripts/a> in older user agents, a href#script-nomodule-example>as shown below/a>. The code idthe-script-element:attr-script-nomodule-3>a href#attr-script-nomodule>nomodule/a>/code> attribute must not be specified on a href#module-script idthe-script-element:module-script-8>module scripts/a> (and will be ignored if it is)./p> p>The dfn idattr-script-async>code>async/code>/dfn> and dfn idattr-script-defer>code>defer/code>/dfn> attributes are a href#boolean-attribute idthe-script-element:boolean-attribute-2>boolean attributes/a> that indicate how the script should be evaluated. a href#classic-script idthe-script-element:classic-script-5>Classic scripts/a> may specify code idthe-script-element:attr-script-defer-5>a href#attr-script-defer>defer/a>/code> or code idthe-script-element:attr-script-async-4>a href#attr-script-async>async/a>/code>; a href#module-script idthe-script-element:module-script-9>module scripts/a> may specify code idthe-script-element:attr-script-async-5>a href#attr-script-async>async/a>/code>. The code idthe-script-element:attr-script-defer-6>a href#attr-script-defer>defer/a>/code> and code idthe-script-element:attr-script-async-6>a href#attr-script-async>async/a>/code> attributes must not be specified if the code idthe-script-element:attr-script-src-6>a href#attr-script-src>src/a>/code> attribute is not present.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> script-deferspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>8+/span>/span>span classios_saf yes>span>iOS Safari/span> span>5.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>3.5+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>5+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>3+/span>/span>span classopera yes>span>Opera/span> span>15+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featscript-defer>caniuse.com/a>p classsupport>strong>Support:/strong> script-asyncspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>8+/span>/span>span classios_saf yes>span>iOS Safari/span> span>5.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>3.6+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>5.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>3+/span>/span>span classopera yes>span>Opera/span> span>15+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featscript-async>caniuse.com/a>/div> p>There are several possible modes that can be selected using these attributes, and depending on the scripts type./p> p>For a href#classic-script idthe-script-element:classic-script-6>classic scripts/a>, if the code idthe-script-element:attr-script-async-7>a href#attr-script-async>async/a>/code> attribute is present, then the classic script will be fetched a href#in-parallel idthe-script-element:in-parallel>in parallel/a> to parsing and evaluated as soon as it is available (potentially before parsing completes). If the code idthe-script-element:attr-script-async-8>a href#attr-script-async>async/a>/code> attribute is not present but the code idthe-script-element:attr-script-defer-7>a href#attr-script-defer>defer/a>/code> attribute is present, then the classic script will be fetched a href#in-parallel idthe-script-element:in-parallel-2>in parallel/a> and evaluated when the page has finished parsing. If neither attribute is present, then the script is fetched and evaluated immediately, blocking parsing until these are both complete./p> p>For a href#module-script idthe-script-element:module-script-10>module scripts/a>, if the code idthe-script-element:attr-script-async-9>a href#attr-script-async>async/a>/code> attribute is present, then the module script and all its dependencies will be fetched a href#in-parallel idthe-script-element:in-parallel-3>in parallel/a> to parsing, and the module script will be evaluated as soon as it is available (potentially before parsing completes). Otherwise, the module script and its dependencies will be fetched a href#in-parallel idthe-script-element:in-parallel-4>in parallel/a> to parsing and evaluated when the page has finished parsing. (The code idthe-script-element:attr-script-defer-8>a href#attr-script-defer>defer/a>/code> attribute has no effect on module scripts.)/p> p>This is all summarized in the following schematic diagram:/p> p>img src/images/asyncdefer.svg altWith script>, parsing is interrupted by fetching and execution. With script defer>, fetching is parallel to parsing and execution takes place after all parsing has finished. And with script async>, fetching is parallel to parsing but once it finishes parsing is interrupted to execute the script. The story for script type"module"> is similar to script defer>, but the dependencies will be fetched as well, and the story for script type"module" async> is similar to script async> with the extra dependency fetching. stylewidth: 80%; min-width: 820px;>/p> p classnote>The exact processing details for these attributes are, for mostly historical reasons, somewhat non-trivial, involving a number of aspects of HTML. The implementation requirements are therefore by necessity scattered throughout the specification. The algorithms below (in this section) describe the core of this processing, but these algorithms reference and are referenced by the parsing rules for code idthe-script-element:the-script-element-6>a href#the-script-element>script/a>/code> a href#scriptTag>start/a> and a href#scriptEndTag>end/a> tags in HTML, a href#scriptForeignEndTag>in foreign content/a>, and a href#scriptTagXML>in XML/a>, the rules for the code idthe-script-element:dom-document-write>a href#dom-document-write>document.write()/a>/code> method, the handling of a href#scripting>scripting/a>, etc./p> p>The code idthe-script-element:attr-script-defer-9>a href#attr-script-defer>defer/a>/code> attribute may be specified even if the code idthe-script-element:attr-script-async-10>a href#attr-script-async>async/a>/code> attribute is specified, to cause legacy Web browsers that only support code idthe-script-element:attr-script-defer-10>a href#attr-script-defer>defer/a>/code> (and not code idthe-script-element:attr-script-async-11>a href#attr-script-async>async/a>/code>) to fall back to the code idthe-script-element:attr-script-defer-11>a href#attr-script-defer>defer/a>/code> behavior instead of the blocking behavior that is the default./p> p>The dfn idattr-script-crossorigin>code>crossorigin/code>/dfn> attribute is a a href#cors-settings-attribute idthe-script-element:cors-settings-attribute>CORS settings attribute/a>. For a href#classic-script idthe-script-element:classic-script-7>classic scripts/a>, it controls whether error information will be exposed, when the script is obtained from other a href#concept-origin idthe-script-element:concept-origin>origins/a>. For a href#module-script idthe-script-element:module-script-11>module scripts/a>, it controls the a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode idthe-script-element:concept-request-credentials-mode data-x-internalconcept-request-credentials-mode>credentials mode/a> used for cross-origin requests./p> p classnote>Unlike a href#classic-script idthe-script-element:classic-script-8>classic scripts/a>, a href#module-script idthe-script-element:module-script-12>module scripts/a> require the use of the a hrefhttps://fetch.spec.whatwg.org/#http-cors-protocol idthe-script-element:cors-protocol data-x-internalcors-protocol>CORS protocol/a> for cross-origin fetching./p> p>The dfn data-dfn-forscript idattr-script-nonce data-dfn-typeelement-attr data-export>code>nonce/code>/dfn> attribute represents a cryptographic nonce (number used once) which can be used by cite>Content Security Policy/cite> to determine whether or not the script specified by an element will be executed. The value is text. a href#refsCSP>CSP/a>/p> p>The dfn data-dfn-forscript idattr-script-integrity data-dfn-typeelement-attr data-export>code>integrity/code>/dfn> attribute represents the a hrefhttps://fetch.spec.whatwg.org/#concept-request-integrity-metadata idthe-script-element:concept-request-integrity-metadata data-x-internalconcept-request-integrity-metadata>integrity metadata/a> for requests which this element is responsible for. The value is text. The code idthe-script-element:attr-script-integrity-3>a href#attr-script-integrity>integrity/a>/code> attribute must not be specified when embedding a a href#module-script idthe-script-element:module-script-13>module script/a> or when the code idthe-script-element:attr-script-src-7>a href#attr-script-src>src/a>/code> attribute is not specified. a href#refsSRI>SRI/a>/p> p>Changing the code idthe-script-element:attr-script-src-8>a href#attr-script-src>src/a>/code>, code idthe-script-element:attr-script-type-6>a href#attr-script-type>type/a>/code>, code idthe-script-element:attr-script-nomodule-4>a href#attr-script-nomodule>nomodule/a>/code>, code idthe-script-element:attr-script-async-12>a href#attr-script-async>async/a>/code>, code idthe-script-element:attr-script-defer-12>a href#attr-script-defer>defer/a>/code>, code idthe-script-element:attr-script-crossorigin-3>a href#attr-script-crossorigin>crossorigin/a>/code>, code idthe-script-element:attr-script-nonce-3>a href#attr-script-nonce>nonce/a>/code>, and code idthe-script-element:attr-script-integrity-4>a href#attr-script-integrity>integrity/a>/code> attributes dynamically has no direct effect; these attributes are only used at specific times described below./p> p>The IDL attributes dfn iddom-script-src>code>src/code>/dfn>, dfn iddom-script-type>code>type/code>/dfn>, dfn iddom-script-defer>code>defer/code>/dfn>, dfn iddom-script-integrity>code>integrity/code>/dfn>, and dfn iddom-script-nonce>code>nonce/code>/dfn>, must each a href#reflect idthe-script-element:reflect>reflect/a> the respective content attributes of the same name./p> p>The dfn iddom-script-crossorigin>code>crossOrigin/code>/dfn> IDL attribute must a href#reflect idthe-script-element:reflect-2>reflect/a> the code idthe-script-element:attr-script-crossorigin-4>a href#attr-script-crossorigin>crossorigin/a>/code> content attribute, a href#limited-to-only-known-values idthe-script-element:limited-to-only-known-values>limited to only known values/a>./p> p>The dfn iddom-script-nomodule>code>noModule/code>/dfn> IDL attribute must a href#reflect idthe-script-element:reflect-3>reflect/a> the code idthe-script-element:attr-script-nomodule-5>a href#attr-script-nomodule>nomodule/a>/code> content attribute./p> p>The dfn iddom-script-async>code>async/code>/dfn> IDL attribute controls whether the element will execute asynchronously or not. If the elements a href#non-blocking idthe-script-element:non-blocking>non-blocking/a> flag is set, then, on getting, the code idthe-script-element:dom-script-async-2>a href#dom-script-async>async/a>/code> IDL attribute must return true, and on setting, the a href#non-blocking idthe-script-element:non-blocking-2>non-blocking/a> flag must first be unset, and then the content attribute must be removed if the IDL attributes new value is false, and must be set to the empty string if the IDL attributes new value is true. If the elements a href#non-blocking idthe-script-element:non-blocking-3>non-blocking/a> flag is em>not/em> set, the IDL attribute must a href#reflect idthe-script-element:reflect-4>reflect/a> the code idthe-script-element:attr-script-async-13>a href#attr-script-async>async/a>/code> content attribute./p> dl classdomintro>dt>var>script/var> . code idthe-script-element:dom-script-text-2>a href#dom-script-text>text/a>/code> var>value/var> dd> p>Returns the a idthe-script-element:child-text-content hrefhttps://dom.spec.whatwg.org/#concept-child-text-content data-x-internalchild-text-content>child text content/a> of the element./p> p>Can be set, to replace the elements children with the given value./p> /dl> p>The IDL attribute dfn iddom-script-text>code>text/code>/dfn> must return the a idthe-script-element:child-text-content-2 hrefhttps://dom.spec.whatwg.org/#concept-child-text-content data-x-internalchild-text-content>child text content/a> of the code idthe-script-element:the-script-element-7>a href#the-script-element>script/a>/code> element. On setting, it must act the same way as the code idthe-script-element:textcontent>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> IDL attribute./p> p classnote>When inserted using the code idthe-script-element:dom-document-write-2>a href#dom-document-write>document.write()/a>/code> method, code idthe-script-element:the-script-element-8>a href#the-script-element>script/a>/code> elements a href#document-written-scripts-intervention>usually/a> execute (typically blocking further script execution or HTML parsing). When inserted using the code idthe-script-element:dom-innerhtml>a data-x-internaldom-innerhtml hrefhttps://w3c.github.io/DOM-Parsing/#dom-element-innerhtml>innerHTML/a>/code> and code idthe-script-element:dom-outerhtml>a data-x-internaldom-outerhtml hrefhttps://w3c.github.io/DOM-Parsing/#dom-element-outerhtml>outerHTML/a>/code> attributes, they do not execute at all./p> div classexample> p>In this example, two code idthe-script-element:the-script-element-9>a href#the-script-element>script/a>/code> elements are used. One embeds an external a href#classic-script idthe-script-element:classic-script-9>classic script/a>, and the other includes some data as a a href#data-block idthe-script-element:data-block-3>data block/a>./p> pre><script srcgame-engine.js></script><script typetext/x-game-map>........U.........eo............A....e.....A.....AAA....e.A..AAA...AAAAA...e</script>/pre> p>The data in this case might be used by the script to generate the map of a video game. The data doesnt have to be used that way, though; maybe the map data is actually embedded in other parts of the pages markup, and the data block here is just used by the sites search engine to help users who are looking for particular features in their game maps./p> /div> div classexample> p>The following sample shows how a code idthe-script-element:the-script-element-10>a href#the-script-element>script/a>/code> element can be used to define a function that is then used by other parts of the document, as part of a a href#classic-script idthe-script-element:classic-script-10>classic script/a>. It also shows how a code idthe-script-element:the-script-element-11>a href#the-script-element>script/a>/code> element can be used to invoke script while the document is being parsed, in this case to initialize the forms output./p> pre><script> function calculate(form) { var price 52000; if (form.elements.brakes.checked) price + 1000; if (form.elements.radio.checked) price + 2500; if (form.elements.turbo.checked) price + 5000; if (form.elements.sticker.checked) price + 250; form.elements.result.value price; }</script><form namepricecalc onsubmitreturn false onchangecalculate(this)> <fieldset> <legend>Work out the price of your car</legend> <p>Base cost: £52000.</p> <p>Select additional options:</p> <ul> <li><label><input typecheckbox namebrakes> Ceramic brakes (£1000)</label></li> <li><label><input typecheckbox nameradio> Satellite radio (£2500)</label></li> <li><label><input typecheckbox nameturbo> Turbo charger (£5000)</label></li> <li><label><input typecheckbox namesticker> XZ sticker (£250)</label></li> </ul> <p>Total: £<output nameresult></output></p> </fieldset> <script> calculate(document.forms.pricecalc); </script></form>/pre> /div> div idscript-type-module-example-1 classexample> p>The following sample shows how a code idthe-script-element:the-script-element-12>a href#the-script-element>script/a>/code> element can be used to include an external a href#module-script idthe-script-element:module-script-14>module script/a>. pre><script typemodule srcapp.js></script>/pre> p>This module, and all its dependencies (expressed through JavaScript code>import/code> statements in the source file), will be fetched. Once the entire resulting module graph has been imported, and the document has finished parsing, the contents of code>app.js/code> will be evaluated./p> p>Additionally, if code from another code idthe-script-element:the-script-element-13>a href#the-script-element>script/a>/code> element in the same code idthe-script-element:window>a href#window>Window/a>/code> imports the module from code>app.js/code> (e.g. via code>import ./app.js;/code>), then the same a href#module-script idthe-script-element:module-script-15>module script/a> created by the former code idthe-script-element:the-script-element-14>a href#the-script-element>script/a>/code> element will be imported./p> /div> div idscript-nomodule-example classexample> p>This example shows how to include a a href#module-script idthe-script-element:module-script-16>module script/a> for modern user agents, and a a href#classic-script idthe-script-element:classic-script-11>classic script/a> for older user agents:/p> pre><script typemodule srcapp.js></script><script nomodule srcclassic-app-bundle.js></script>/pre> p>In modern user agents that support a href#module-script idthe-script-element:module-script-17>module scripts/a>, the code idthe-script-element:the-script-element-15>a href#the-script-element>script/a>/code> element with the code idthe-script-element:attr-script-nomodule-6>a href#attr-script-nomodule>nomodule/a>/code> attribute will be ignored, and the code idthe-script-element:the-script-element-16>a href#the-script-element>script/a>/code> element with a code idthe-script-element:attr-script-type-7>a href#attr-script-type>type/a>/code> of code>module/code> will be fetched and evaluated (as a a href#module-script idthe-script-element:module-script-18>module script/a>). Conversely, older user agents will ignore the code idthe-script-element:the-script-element-17>a href#the-script-element>script/a>/code> element with a code idthe-script-element:attr-script-type-8>a href#attr-script-type>type/a>/code> of code>module/code>, as that is an unknown script type for them — but they will have no problem fetching and evaluating the other code idthe-script-element:the-script-element-18>a href#the-script-element>script/a>/code> element (as a a href#classic-script idthe-script-element:classic-script-12>classic script/a>), since they do not implement the code idthe-script-element:attr-script-nomodule-7>a href#attr-script-nomodule>nomodule/a>/code> attribute./p> /div> div idscript-type-module-example-2 classexample> p>The following sample shows how a code idthe-script-element:the-script-element-19>a href#the-script-element>script/a>/code> element can be used to write an inline a href#module-script idthe-script-element:module-script-19>module script/a> that performs a number of substitutions on the documents text, in order to make for a more interesting reading experience (e.g. on a news site): a href#refsXKCD1288>XKCD1288/a>/p> pre><script typemodule> import { walkAllTextNodeDescendants } from ./dom-utils.js; const substitutions new Map( witnesses, these dudes I know allegedly, kinda probably new study, Tumblr post rebuild, avenge space, spaaace Google glass, Virtual Boy smartphone, Pokédex electric, atomic Senator, Elf-Lord car, cat election, eating contest Congressional leaders, river spirits homeland security, Homestar Runner could not be reached for comment, is guilty and everyone knows it ); function substitute(textNode) { for (const before, after of substitutions.entries()) { textNode.data textNode.data.replace(new RegExp(`\\b${before}\\b`, ig), after); } } walkAllTextNodeDescendants(document.body, substitute);</script>/pre> p>Some notable features gained by using a module script include the ability to import functions from other JavaScript modules, strict mode by default, and how top-level declarations do not introduce new properties onto the a href#global-object idthe-script-element:global-object>global object/a>. Also note that no matter where this code idthe-script-element:the-script-element-20>a href#the-script-element>script/a>/code> element appears in the document, it will not be evaluated until both document parsing has complete and its dependency (code>dom-utils.js/code>) has been fetched and evaluated./p> /div> h5 idscript-processing-model>span classsecno>4.12.1.1/span> Processing modela href#script-processing-model classself-link>/a>/h5> p>A code idscript-processing-model:the-script-element>a href#the-script-element>script/a>/code> element has several associated pieces of state./p> p>The first is a flag indicating whether or not the script block has been dfn idalready-started>already started/dfn>. Initially, code idscript-processing-model:the-script-element-2>a href#the-script-element>script/a>/code> elements must have this flag unset (script blocks, when created, are not already started). The a hrefhttps://dom.spec.whatwg.org/#concept-node-clone-ext idscript-processing-model:concept-node-clone-ext data-x-internalconcept-node-clone-ext>cloning steps/a> for code idscript-processing-model:the-script-element-3>a href#the-script-element>script/a>/code> elements must set the already started flag on the copy if it is set on the element being cloned./p> p>The second is a flag indicating whether the element was dfn data-dfn-forscript idparser-inserted data-dfn-typedfn data-export>parser-inserted/dfn>. Initially, code idscript-processing-model:the-script-element-4>a href#the-script-element>script/a>/code> elements must have this flag unset. It is set by the a href#html-parser idscript-processing-model:html-parser>HTML parser/a> and the a href#xml-parser idscript-processing-model:xml-parser>XML parser/a> on code idscript-processing-model:the-script-element-5>a href#the-script-element>script/a>/code> elements they insert and affects the processing of those elements./p> p>The third is a flag indicating whether the element will be dfn idnon-blocking>non-blocking/dfn>. Initially, code idscript-processing-model:the-script-element-6>a href#the-script-element>script/a>/code> elements must have this flag set. It is unset by the a href#html-parser idscript-processing-model:html-parser-2>HTML parser/a> and the a href#xml-parser idscript-processing-model:xml-parser-2>XML parser/a> on code idscript-processing-model:the-script-element-7>a href#the-script-element>script/a>/code> elements they insert. In addition, whenever a code idscript-processing-model:the-script-element-8>a href#the-script-element>script/a>/code> element whose a href#non-blocking idscript-processing-model:non-blocking>non-blocking/a> flag is set has an code idscript-processing-model:attr-script-async>a href#attr-script-async>async/a>/code> content attribute added, the elements a href#non-blocking idscript-processing-model:non-blocking-2>non-blocking/a> flag must be unset./p> p>The fourth is a flag indicating whether or not the script block is dfn idready-to-be-parser-executed>ready to be parser-executed/dfn>. Initially, code idscript-processing-model:the-script-element-9>a href#the-script-element>script/a>/code> elements must have this flag unset (script blocks, when created, are not ready to be parser-executed). This flag is used only for elements that are also a href#parser-inserted idscript-processing-model:parser-inserted>parser-inserted/a>, to let the parser know when to execute the script./p> p>The fifth is dfn idconcept-script-type>the scripts type/dfn>, which is either code>classic/code> or code>module/code>. It is determined when the script is a href#prepare-a-script idscript-processing-model:prepare-a-script>prepared/a>, based on the code idscript-processing-model:attr-script-type>a href#attr-script-type>type/a>/code> attribute of the element at that time./p> p>The sixth is a flag indicating whether or not the script is dfn idconcept-script-external>from an external file/dfn>. It is determined when the script is a href#prepare-a-script idscript-processing-model:prepare-a-script-2>prepared/a>, based on the code idscript-processing-model:attr-script-src>a href#attr-script-src>src/a>/code> attribute of the element at that time./p> p>Finally, a code idscript-processing-model:the-script-element-10>a href#the-script-element>script/a>/code> element has dfn idconcept-script-script data-export>the scripts script/dfn>, which is a a href#concept-script idscript-processing-model:concept-script>script/a> resulting from a href#prepare-a-script idscript-processing-model:prepare-a-script-3>preparing/a> the element. This is set asynchronously after the classic script or module graph is fetched. Once it is set, either to a a href#concept-script idscript-processing-model:concept-script-2>script/a> in the case of success or to null in the case of failure, the fetching algorithms will note that dfn idthe-script-is-ready>the script is ready/dfn>, which can trigger other actions. The user agent must a href#delay-the-load-event idscript-processing-model:delay-the-load-event>delay the load event/a> of the elements a idscript-processing-model:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> until a href#the-script-is-ready idscript-processing-model:the-script-is-ready>the script is ready/a>./p> hr> p>When a code idscript-processing-model:the-script-element-11>a href#the-script-element>script/a>/code> element that is not marked as being a href#parser-inserted idscript-processing-model:parser-inserted-2>parser-inserted/a> experiences one of the events listed in the following list, the user agent must a href#immediately idscript-processing-model:immediately>immediately/a> a href#prepare-a-script idscript-processing-model:prepare-a-script-4>prepare/a> the code idscript-processing-model:the-script-element-12>a href#the-script-element>script/a>/code> element:/p> ul>li>The code idscript-processing-model:the-script-element-13>a href#the-script-element>script/a>/code> element a href#becomes-connected idscript-processing-model:becomes-connected>becomes connected/a>.li>The code idscript-processing-model:the-script-element-14>a href#the-script-element>script/a>/code> element is a idscript-processing-model:connected hrefhttps://dom.spec.whatwg.org/#connected data-x-internalconnected>connected/a> and a node or document fragment is a href#nodes-are-inserted idscript-processing-model:nodes-are-inserted>inserted/a> into the code idscript-processing-model:the-script-element-15>a href#the-script-element>script/a>/code> element, after any code idscript-processing-model:the-script-element-16>a href#the-script-element>script/a>/code> elements a href#nodes-are-inserted idscript-processing-model:nodes-are-inserted-2>inserted/a> at that time.li>The code idscript-processing-model:the-script-element-17>a href#the-script-element>script/a>/code> element is a idscript-processing-model:connected-2 hrefhttps://dom.spec.whatwg.org/#connected data-x-internalconnected>connected/a> and has a code idscript-processing-model:attr-script-src-2>a href#attr-script-src>src/a>/code> attribute set where previously the element had no such attribute./ul> p>To dfn idprepare-a-script data-export>prepare a script/dfn>, the user agent must act as follows:/p> ol>li> p>If the code idscript-processing-model:the-script-element-18>a href#the-script-element>script/a>/code> element is marked as having a href#already-started idscript-processing-model:already-started>already started/a>, then abort these steps at this point. The script is not executed./p> li> p>If the element has its a href#parser-inserted idscript-processing-model:parser-inserted-3>parser-inserted/a> flag set, then set var>was-parser-inserted/var> to true and unset the elements a href#parser-inserted idscript-processing-model:parser-inserted-4>parser-inserted/a> flag. Otherwise, set var>was-parser-inserted/var> to false./p> p classnote>This is done so that if parser-inserted code idscript-processing-model:the-script-element-19>a href#the-script-element>script/a>/code> elements fail to run when the parser tries to run them, e.g. because they are empty or specify an unsupported scripting language, another script can later mutate them and cause them to run again./p> li> p>If var>was-parser-inserted/var> is true and the element does not have an code idscript-processing-model:attr-script-async-2>a href#attr-script-async>async/a>/code> attribute, then set the elements a href#non-blocking idscript-processing-model:non-blocking-3>non-blocking/a> flag to true./p> p classnote>This is done so that if a parser-inserted code idscript-processing-model:the-script-element-20>a href#the-script-element>script/a>/code> element fails to run when the parser tries to run it, but it is later executed after a script dynamically updates it, it will execute in a non-blocking fashion even if the code idscript-processing-model:attr-script-async-3>a href#attr-script-async>async/a>/code> attribute isnt set./p> li idscript-processing-empty> p>If the element has no code idscript-processing-model:attr-script-src-3>a href#attr-script-src>src/a>/code> attribute, and its child nodes, if any, consist only of comment nodes and empty code idscript-processing-model:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes, then abort these steps at this point. The script is not executed./p> li>p>If the element is not a idscript-processing-model:connected-3 hrefhttps://dom.spec.whatwg.org/#connected data-x-internalconnected>connected/a>, then abort these steps. The script is not executed.li idscript-processing-prepare> p>If either:/p> ul classbrief>li>the code idscript-processing-model:the-script-element-21>a href#the-script-element>script/a>/code> element has a code idscript-processing-model:attr-script-type-2>a href#attr-script-type>type/a>/code> attribute and its value is the empty string, orli>the code idscript-processing-model:the-script-element-22>a href#the-script-element>script/a>/code> element has no code idscript-processing-model:attr-script-type-3>a href#attr-script-type>type/a>/code> attribute but it has a code idscript-processing-model:attr-script-language>a href#attr-script-language>language/a>/code> attribute and em>that/em> attributes value is the empty string, orli>the code idscript-processing-model:the-script-element-23>a href#the-script-element>script/a>/code> element has neither a code idscript-processing-model:attr-script-type-4>a href#attr-script-type>type/a>/code> attribute nor a code idscript-processing-model:attr-script-language-2>a href#attr-script-language>language/a>/code> attribute, then/ul> p>...let var>the script blocks type string/var> for this code idscript-processing-model:the-script-element-24>a href#the-script-element>script/a>/code> element be code>text/javascript/code>./p> p>Otherwise, if the code idscript-processing-model:the-script-element-25>a href#the-script-element>script/a>/code> element has a code idscript-processing-model:attr-script-type-5>a href#attr-script-type>type/a>/code> attribute, let var>the script blocks type string/var> for this code idscript-processing-model:the-script-element-26>a href#the-script-element>script/a>/code> element be the value of that attribute with a hrefhttps://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace idscript-processing-model:strip-leading-and-trailing-ascii-whitespace data-x-internalstrip-leading-and-trailing-ascii-whitespace>leading and trailing ASCII whitespace stripped/a>./p> p>Otherwise, the element has a non-empty code idscript-processing-model:attr-script-language-3>a href#attr-script-language>language/a>/code> attribute; let var>the script blocks type string/var> for this code idscript-processing-model:the-script-element-27>a href#the-script-element>script/a>/code> element be the concatenation of the string code>text//code> followed by the value of the code idscript-processing-model:attr-script-language-4>a href#attr-script-language>language/a>/code> attribute./p> p classnote>The code idscript-processing-model:attr-script-language-5>a href#attr-script-language>language/a>/code> attribute is never conforming, and is always ignored if there is a code idscript-processing-model:attr-script-type-6>a href#attr-script-type>type/a>/code> attribute present./p> p>Determine a href#concept-script-type idscript-processing-model:concept-script-type>the scripts type/a> as follows:/p> ul>li>If var>the script blocks type string/var> is an a idscript-processing-model:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for any a href#javascript-mime-type idscript-processing-model:javascript-mime-type>JavaScript MIME type/a>, a href#concept-script-type idscript-processing-model:concept-script-type-2>the scripts type/a> is code>classic/code>.li>If var>the script blocks type string/var> is an a idscript-processing-model:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>module/code>, a href#concept-script-type idscript-processing-model:concept-script-type-3>the scripts type/a> is code>module/code>.li>If neither of the above conditions are true, then abort these steps at this point. No script is executed./ul> li> p>If var>was-parser-inserted/var> is true, then flag the element as a href#parser-inserted idscript-processing-model:parser-inserted-5>parser-inserted/a> again, and set the elements a href#non-blocking idscript-processing-model:non-blocking-4>non-blocking/a> flag to false./p> li idscript-processing-start> p>Set the elements a href#already-started idscript-processing-model:already-started-2>already started/a> flag./p> li> p>If the element is flagged as a href#parser-inserted idscript-processing-model:parser-inserted-6>parser-inserted/a>, but the elements a idscript-processing-model:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is not the code idscript-processing-model:document>a href#document>Document/a>/code> of the parser that created the element, then abort these steps./p> li idscript-processing-noscript> p>If a href#concept-n-noscript idscript-processing-model:concept-n-noscript>scripting is disabled/a> for the code idscript-processing-model:the-script-element-28>a href#the-script-element>script/a>/code> element, then abort these steps at this point. The script is not executed./p> p classnote>The definition of a href#concept-n-noscript idscript-processing-model:concept-n-noscript-2>scripting is disabled/a> means that, amongst others, the following scripts will not execute: scripts in code idscript-processing-model:xmlhttprequest>a data-x-internalxmlhttprequest hrefhttps://xhr.spec.whatwg.org/#xmlhttprequest>XMLHttpRequest/a>/code>s code idscript-processing-model:dom-xmlhttprequest-responsexml>a data-x-internaldom-xmlhttprequest-responsexml hrefhttps://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsexml>responseXML/a>/code> documents, scripts in code idscript-processing-model:domparser>a data-x-internaldomparser hrefhttps://w3c.github.io/DOM-Parsing/#the-domparser-interface>DOMParser/a>/code>-created documents, scripts in documents created by code idscript-processing-model:xsltprocessor>a href#xsltprocessor>XSLTProcessor/a>/code>s code idscript-processing-model:dom-xsltprocessor-transformtodocument>a href#dom-xsltprocessor-transformtodocument>transformToDocument/a>/code> feature, and scripts that are first inserted by a script into a code idscript-processing-model:document-2>a href#document>Document/a>/code> that was created using the code idscript-processing-model:dom-domimplementation-createdocument>a data-x-internaldom-domimplementation-createdocument hrefhttps://dom.spec.whatwg.org/#dom-domimplementation-createdocument>createDocument()/a>/code> API. a href#refsXHR>XHR/a> a href#refsDOMPARSING>DOMPARSING/a> a href#refsXSLTP>XSLTP/a> a href#refsDOM>DOM/a>/p> li> p>If the code idscript-processing-model:the-script-element-29>a href#the-script-element>script/a>/code> element has a code idscript-processing-model:attr-script-nomodule>a href#attr-script-nomodule>nomodule/a>/code> content attribute and a href#concept-script-type idscript-processing-model:concept-script-type-4>the scripts type/a> is code>classic/code>, then abort these steps. The script is not executed./p> p classnote>This means specifying code idscript-processing-model:attr-script-nomodule-2>a href#attr-script-nomodule>nomodule/a>/code> on a a href#module-script idscript-processing-model:module-script>module script/a> has no effect; the algorithm continues onward./p> li idscript-processing-csp>p>If the code idscript-processing-model:the-script-element-30>a href#the-script-element>script/a>/code> element does not have a code idscript-processing-model:attr-script-src-4>a href#attr-script-src>src/a>/code> content attribute, and the a idscript-processing-model:should-elements-inline-behavior-be-blocked-by-content-security-policy hrefhttps://w3c.github.io/webappsec-csp/#should-block-inline data-x-internalshould-elements-inline-behavior-be-blocked-by-content-security-policy>Should elements inline behavior be blocked by Content Security Policy?/a> algorithm returns code>Blocked/code> when executed upon the code idscript-processing-model:the-script-element-31>a href#the-script-element>script/a>/code> element, code>script/code>, and the code idscript-processing-model:the-script-element-32>a href#the-script-element>script/a>/code> elements a idscript-processing-model:child-text-content hrefhttps://dom.spec.whatwg.org/#concept-child-text-content data-x-internalchild-text-content>child text content/a>, then abort these steps. The script is not executed. a href#refsCSP>CSP/a>li idscript-processing-for> p>If the code idscript-processing-model:the-script-element-33>a href#the-script-element>script/a>/code> element has an code idscript-processing-model:attr-script-event>a href#attr-script-event>event/a>/code> attribute and a code idscript-processing-model:attr-script-for>a href#attr-script-for>for/a>/code> attribute, and a href#concept-script-type idscript-processing-model:concept-script-type-5>the scripts type/a> is code>classic/code>, then:/p> ol>li>p>Let var>for/var> be the value of the code idscript-processing-model:attr-script-for-2>a href#attr-script-for>for/a>/code> attribute.li>p>Let var>event/var> be the value of the code idscript-processing-model:attr-script-event-2>a href#attr-script-event>event/a>/code> attribute.li>p>a idscript-processing-model:strip-leading-and-trailing-ascii-whitespace-2 hrefhttps://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace data-x-internalstrip-leading-and-trailing-ascii-whitespace>Strip leading and trailing ASCII whitespace/a> from var>event/var> and var>for/var>.li>p>If var>for/var> is not an a idscript-processing-model:ascii-case-insensitive-3 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>window/code>, then abort these steps at this point. The script is not executed.li>p>If var>event/var> is not an a idscript-processing-model:ascii-case-insensitive-4 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for either the string code>onload/code> or the string code>onload()/code>, then abort these steps at this point. The script is not executed./ol> li idscript-processing-encoding> p>If the code idscript-processing-model:the-script-element-34>a href#the-script-element>script/a>/code> element has a code idscript-processing-model:attr-script-charset>a href#attr-script-charset>charset/a>/code> attribute, then let var>encoding/var> be the result of a idscript-processing-model:getting-an-encoding hrefhttps://encoding.spec.whatwg.org/#concept-encoding-get data-x-internalgetting-an-encoding>getting an encoding/a> from the value of the code idscript-processing-model:attr-script-charset-2>a href#attr-script-charset>charset/a>/code> attribute./p> p>If the code idscript-processing-model:the-script-element-35>a href#the-script-element>script/a>/code> element does not have a code idscript-processing-model:attr-script-charset-3>a href#attr-script-charset>charset/a>/code> attribute, or if a idscript-processing-model:getting-an-encoding-2 hrefhttps://encoding.spec.whatwg.org/#concept-encoding-get data-x-internalgetting-an-encoding>getting an encoding/a> failed, let var>encoding/var> be the same as a hrefhttps://dom.spec.whatwg.org/#concept-document-encoding idscript-processing-model:documents-character-encoding data-x-internaldocuments-character-encoding>the encoding/a> of the code idscript-processing-model:the-script-element-36>a href#the-script-element>script/a>/code> elements a idscript-processing-model:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>./p> p classnote>If a href#concept-script-type idscript-processing-model:concept-script-type-6>the scripts type/a> is code>module/code>, this encoding will be ignored./p> li>p>Let var>classic script CORS setting/var> be the current state of the elements code idscript-processing-model:attr-script-crossorigin>a href#attr-script-crossorigin>crossorigin/a>/code> content attribute.li>p>Let var>module script credentials mode/var> be the a href#module-script-credentials-mode idscript-processing-model:module-script-credentials-mode>module script credentials mode/a> for the elements code idscript-processing-model:attr-script-crossorigin-2>a href#attr-script-crossorigin>crossorigin/a>/code> content attribute./p> li> p>If the code idscript-processing-model:the-script-element-37>a href#the-script-element>script/a>/code> element has a code idscript-processing-model:attr-script-nonce>a href#attr-script-nonce>nonce/a>/code> attribute, then let var>cryptographic nonce/var> be that attributes value./p> p>Otherwise, let var>cryptographic nonce/var> be the empty string./p> li> p>If the code idscript-processing-model:the-script-element-38>a href#the-script-element>script/a>/code> element has an code idscript-processing-model:attr-script-integrity>a href#attr-script-integrity>integrity/a>/code> attribute, then let var>integrity metadata/var> be that attributes value./p> p>Otherwise, let var>integrity metadata/var> be the empty string./p> li>p>Let var>parser metadata/var> be code>parser-inserted/code> if the code idscript-processing-model:the-script-element-39>a href#the-script-element>script/a>/code> element has been flagged as a href#parser-inserted idscript-processing-model:parser-inserted-7>parser-inserted/a>, and code>not-parser-inserted/code> otherwise.li>p>Let var>options/var> be a a href#script-fetch-options idscript-processing-model:script-fetch-options>script fetch options/a> whose a href#concept-script-fetch-options-nonce idscript-processing-model:concept-script-fetch-options-nonce>cryptographic nonce/a> is var>cryptographic nonce/var>, a href#concept-script-fetch-options-integrity idscript-processing-model:concept-script-fetch-options-integrity>integrity metadata/a> is var>integrity metadata/var>, a href#concept-script-fetch-options-parser idscript-processing-model:concept-script-fetch-options-parser>parser metadata/a> is var>parser metadata/var>, and a href#concept-script-fetch-options-credentials idscript-processing-model:concept-script-fetch-options-credentials>credentials mode/a> is var>module script credentials mode/var>./p> li>p>Let var>settings object/var> be the elements a idscript-processing-model:node-document-4 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s code idscript-processing-model:window>a href#window>Window/a>/code> objects a href#environment-settings-object idscript-processing-model:environment-settings-object>environment settings object/a>.li idscript-processing-src-prepare> p>If the element has a code idscript-processing-model:attr-script-src-5>a href#attr-script-src>src/a>/code> content attribute, then:/p> ol>li>p>Let var>src/var> be the value of the elements code idscript-processing-model:attr-script-src-6>a href#attr-script-src>src/a>/code> attribute.li>p>If var>src/var> is the empty string, a href#queue-a-task idscript-processing-model:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idscript-processing-model:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idscript-processing-model:event-error>a href#event-error>error/a>/code> at the element, and abort these steps.li>p>Set the elements a href#concept-script-external idscript-processing-model:concept-script-external>from an external file/a> flag.li>p>a href#parse-a-url idscript-processing-model:parse-a-url>Parse/a> var>src/var> relative to the elements a idscript-processing-model:node-document-5 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>.li>p>If the previous step failed, a href#queue-a-task idscript-processing-model:queue-a-task-2>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idscript-processing-model:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idscript-processing-model:event-error-2>a href#event-error>error/a>/code> at the element, and abort these steps. Otherwise, let var>url/var> be the a href#resulting-url-record idscript-processing-model:resulting-url-record>resulting URL record/a>.li> p>Switch on a href#concept-script-type idscript-processing-model:concept-script-type-7>the scripts type/a>:/p> dl classswitch>dt>code>classic/code>dd> p>a href#fetch-a-classic-script idscript-processing-model:fetch-a-classic-script>Fetch a classic script/a> given var>url/var>, var>settings object/var>, var>options/var>, var>classic script CORS setting/var>, and var>encoding/var>./p> dt>code>module/code>dd> p>a href#fetch-a-module-script-tree idscript-processing-model:fetch-a-module-script-tree>Fetch a module script graph/a> given var>url/var>, var>settings object/var>, code>script/code>, and var>options/var>./p> /dl> p>When the chosen algorithm asynchronously completes, set a href#concept-script-script idscript-processing-model:concept-script-script>the scripts script/a> to the result. At that time, a href#the-script-is-ready idscript-processing-model:the-script-is-ready-2>the script is ready/a>./p> p>For performance reasons, user agents may start fetching the classic script or module graph (as defined above) as soon as the code idscript-processing-model:attr-script-src-7>a href#attr-script-src>src/a>/code> attribute is set, instead, in the hope that the element will be inserted into the document (and that the code idscript-processing-model:attr-script-crossorigin-3>a href#attr-script-crossorigin>crossorigin/a>/code> attribute wont change value in the meantime). Either way, once the element is a href#insert-an-element-into-a-document idscript-processing-model:insert-an-element-into-a-document>inserted into the document/a>, the load must have started as described in this step. If the UA performs such prefetching, but the element is never inserted in the document, or the code idscript-processing-model:attr-script-src-8>a href#attr-script-src>src/a>/code> attribute is dynamically changed, or the code idscript-processing-model:attr-script-crossorigin-4>a href#attr-script-crossorigin>crossorigin/a>/code> attribute is dynamically changed, then the user agent will not execute the script so obtained, and the fetching process will have been effectively wasted./p> /ol> li idestablish-script-block-source> p>If the element does not have a code idscript-processing-model:attr-script-src-9>a href#attr-script-src>src/a>/code> content attribute, run these substeps:/p> ol>li>p>Let var>source text/var> be the value of the code idscript-processing-model:dom-script-text>a href#dom-script-text>text/a>/code> IDL attribute.li>p>Let var>base URL/var> be the code idscript-processing-model:the-script-element-40>a href#the-script-element>script/a>/code> elements a idscript-processing-model:node-document-6 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#document-base-url idscript-processing-model:document-base-url>document base URL/a>.li> p>Switch on a href#concept-script-type idscript-processing-model:concept-script-type-8>the scripts type/a>:/p> dl classswitch>dt>code>classic/code>dd> ol>li>p>Let var>script/var> be the result of a href#creating-a-classic-script idscript-processing-model:creating-a-classic-script>creating a classic script/a> using var>source text/var>, var>settings object/var>, var>base URL/var>, and var>options/var>.li>p>Set a href#concept-script-script idscript-processing-model:concept-script-script-2>the scripts script/a> to var>script/var>.li>p>a href#the-script-is-ready idscript-processing-model:the-script-is-ready-3>The script is ready/a>./ol> dt>code>module/code>dd> ol>li>p>Let var>script/var> be the result of a href#creating-a-module-script idscript-processing-model:creating-a-module-script>creating a module script/a> using var>source text/var>, var>settings object/var>, var>base URL/var>, and var>options/var>.li>p>If this returns null, set a href#concept-script-script idscript-processing-model:concept-script-script-3>the scripts script/a> to null and abort these substeps; a href#the-script-is-ready idscript-processing-model:the-script-is-ready-4>the script is ready/a>.li>p>a href#fetch-the-descendants-of-and-instantiate-a-module-script idscript-processing-model:fetch-the-descendants-of-and-instantiate-a-module-script>Fetch the descendants of and instantiate/a> var>script/var>, given the destination code>script/code>. When this asynchronously completes, set a href#concept-script-script idscript-processing-model:concept-script-script-4>the scripts script/a> to the result. At that time, a href#the-script-is-ready idscript-processing-model:the-script-is-ready-5>the script is ready/a>./ol> /dl> /ol> li> p>Then, follow the first of the following options that describes the situation:/p> dl classswitch>dt idscript-processing-defer>If a href#concept-script-type idscript-processing-model:concept-script-type-9>the scripts type/a> is code>classic/code>, and the element has a code idscript-processing-model:attr-script-src-10>a href#attr-script-src>src/a>/code> attribute, and the element has a code idscript-processing-model:attr-script-defer>a href#attr-script-defer>defer/a>/code> attribute, and the element has been flagged as a href#parser-inserted idscript-processing-model:parser-inserted-8>parser-inserted/a>, and the element does not have an code idscript-processing-model:attr-script-async-4>a href#attr-script-async>async/a>/code> attributedt idscript-processing-module-noasync-parser-inserted>If a href#concept-script-type idscript-processing-model:concept-script-type-10>the scripts type/a> is code>module/code>, and the element has been flagged as a href#parser-inserted idscript-processing-model:parser-inserted-9>parser-inserted/a>, and the element does not have an code idscript-processing-model:attr-script-async-5>a href#attr-script-async>async/a>/code> attributedd> p>Add the element to the end of the dfn idlist-of-scripts-that-will-execute-when-the-document-has-finished-parsing>list of scripts that will execute when the document has finished parsing/dfn> associated with the code idscript-processing-model:document-3>a href#document>Document/a>/code> of the parser that created the element./p> p>When a href#the-script-is-ready idscript-processing-model:the-script-is-ready-6>the script is ready/a>, set the elements a href#ready-to-be-parser-executed idscript-processing-model:ready-to-be-parser-executed>ready to be parser-executed/a> flag. The parser will handle executing the script./p> dt idscript-processing-parser-inserted>If a href#concept-script-type idscript-processing-model:concept-script-type-11>the scripts type/a> is code>classic/code>, and the element has a code idscript-processing-model:attr-script-src-11>a href#attr-script-src>src/a>/code> attribute, and the element has been flagged as a href#parser-inserted idscript-processing-model:parser-inserted-10>parser-inserted/a>, and the element does not have an code idscript-processing-model:attr-script-async-6>a href#attr-script-async>async/a>/code> attributedd> p>The element is the a href#pending-parsing-blocking-script idscript-processing-model:pending-parsing-blocking-script>pending parsing-blocking script/a> of the code idscript-processing-model:document-4>a href#document>Document/a>/code> of the parser that created the element. (There can only be one such script per code idscript-processing-model:document-5>a href#document>Document/a>/code> at a time.)/p> p>When a href#the-script-is-ready idscript-processing-model:the-script-is-ready-7>the script is ready/a>, set the elements a href#ready-to-be-parser-executed idscript-processing-model:ready-to-be-parser-executed-2>ready to be parser-executed/a> flag. The parser will handle executing the script./p> dt idscript-processing-src-sync>If a href#concept-script-type idscript-processing-model:concept-script-type-12>the scripts type/a> is code>classic/code>, and the element has a code idscript-processing-model:attr-script-src-12>a href#attr-script-src>src/a>/code> attribute, and the element does not have an code idscript-processing-model:attr-script-async-7>a href#attr-script-async>async/a>/code> attribute, and the element does not have the a href#non-blocking idscript-processing-model:non-blocking-5>non-blocking/a> flag setdt idscript-processing-module-noasync>If a href#concept-script-type idscript-processing-model:concept-script-type-13>the scripts type/a> is code>module/code>, and the element does not have an code idscript-processing-model:attr-script-async-8>a href#attr-script-async>async/a>/code> attribute, and the element does not have the a href#non-blocking idscript-processing-model:non-blocking-6>non-blocking/a> flag setdd> p>Add the element to the end of the dfn idlist-of-scripts-that-will-execute-in-order-as-soon-as-possible>list of scripts that will execute in order as soon as possible/dfn> associated with the a idscript-processing-model:node-document-7 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> of the code idscript-processing-model:the-script-element-41>a href#the-script-element>script/a>/code> element at the time the a href#prepare-a-script idscript-processing-model:prepare-a-script-5>prepare a script/a> algorithm started./p> p>When a href#the-script-is-ready idscript-processing-model:the-script-is-ready-8>the script is ready/a>, run the following steps:/p> ol>li>p>If the element is not now the first element in the a href#list-of-scripts-that-will-execute-in-order-as-soon-as-possible idscript-processing-model:list-of-scripts-that-will-execute-in-order-as-soon-as-possible>list of scripts that will execute in order as soon as possible/a> to which it was added above, then mark the element as ready but abort these steps without executing the script yet.li>p>i>Execution/i>: a href#execute-the-script-block idscript-processing-model:execute-the-script-block>Execute the script block/a> corresponding to the first script element in this a href#list-of-scripts-that-will-execute-in-order-as-soon-as-possible idscript-processing-model:list-of-scripts-that-will-execute-in-order-as-soon-as-possible-2>list of scripts that will execute in order as soon as possible/a>.li>p>Remove the first element from this a href#list-of-scripts-that-will-execute-in-order-as-soon-as-possible idscript-processing-model:list-of-scripts-that-will-execute-in-order-as-soon-as-possible-3>list of scripts that will execute in order as soon as possible/a>.li>p>If this a href#list-of-scripts-that-will-execute-in-order-as-soon-as-possible idscript-processing-model:list-of-scripts-that-will-execute-in-order-as-soon-as-possible-4>list of scripts that will execute in order as soon as possible/a> is still not empty and the first entry has already been marked as ready, then jump back to the step labeled i>execution/i>./ol> dt idscript-processing-src>If a href#concept-script-type idscript-processing-model:concept-script-type-14>the scripts type/a> is code>classic/code>, and the element has a code idscript-processing-model:attr-script-src-13>a href#attr-script-src>src/a>/code> attributedt idscript-processing-module-async>If a href#concept-script-type idscript-processing-model:concept-script-type-15>the scripts type/a> is code>module/code>dd> p>The element must be added to the dfn idset-of-scripts-that-will-execute-as-soon-as-possible>set of scripts that will execute as soon as possible/dfn> of the a idscript-processing-model:node-document-8 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> of the code idscript-processing-model:the-script-element-42>a href#the-script-element>script/a>/code> element at the time the a href#prepare-a-script idscript-processing-model:prepare-a-script-6>prepare a script/a> algorithm started./p> p>When a href#the-script-is-ready idscript-processing-model:the-script-is-ready-9>the script is ready/a>, a href#execute-the-script-block idscript-processing-model:execute-the-script-block-2>execute the script block/a> and then remove the element from the a href#set-of-scripts-that-will-execute-as-soon-as-possible idscript-processing-model:set-of-scripts-that-will-execute-as-soon-as-possible>set of scripts that will execute as soon as possible/a>./p> dt idscript-processing-style-delayed>If the element does not have a code idscript-processing-model:attr-script-src-14>a href#attr-script-src>src/a>/code> attribute, and the element has been flagged as a href#parser-inserted idscript-processing-model:parser-inserted-11>parser-inserted/a>, and either the parser that created the code idscript-processing-model:the-script-element-43>a href#the-script-element>script/a>/code> is an a href#xml-parser idscript-processing-model:xml-parser-3>XML parser/a> or its an a href#html-parser idscript-processing-model:html-parser-3>HTML parser/a> whose a href#script-nesting-level idscript-processing-model:script-nesting-level>script nesting level/a> is not greater than one, and the code idscript-processing-model:document-6>a href#document>Document/a>/code> of the a href#html-parser idscript-processing-model:html-parser-4>HTML parser/a> or a href#xml-parser idscript-processing-model:xml-parser-4>XML parser/a> that created the code idscript-processing-model:the-script-element-44>a href#the-script-element>script/a>/code> element a href#has-a-style-sheet-that-is-blocking-scripts idscript-processing-model:has-a-style-sheet-that-is-blocking-scripts>has a style sheet that is blocking scripts/a>dd> p>The element is the a href#pending-parsing-blocking-script idscript-processing-model:pending-parsing-blocking-script-2>pending parsing-blocking script/a> of the code idscript-processing-model:document-7>a href#document>Document/a>/code> of the parser that created the element. (There can only be one such script per code idscript-processing-model:document-8>a href#document>Document/a>/code> at a time.)/p> p>Set the elements a href#ready-to-be-parser-executed idscript-processing-model:ready-to-be-parser-executed-3>ready to be parser-executed/a> flag. The parser will handle executing the script./p> dt idscript-processing-inline>Otherwisedd>a href#immediately idscript-processing-model:immediately-2>Immediately/a> a href#execute-the-script-block idscript-processing-model:execute-the-script-block-3>execute the script block/a>, even if other scripts are already executing./dl> /ol> p>The dfn idpending-parsing-blocking-script>pending parsing-blocking script/dfn> of a code idscript-processing-model:document-9>a href#document>Document/a>/code> is used by the code idscript-processing-model:document-10>a href#document>Document/a>/code>s parser(s)./p> p classnote>If a code idscript-processing-model:the-script-element-45>a href#the-script-element>script/a>/code> element that blocks a parser gets moved to another code idscript-processing-model:document-11>a href#document>Document/a>/code> before it would normally have stopped blocking that parser, it nonetheless continues blocking that parser until the condition that causes it to be blocking the parser no longer applies (e.g. if the script is a a href#pending-parsing-blocking-script idscript-processing-model:pending-parsing-blocking-script-3>pending parsing-blocking script/a> because there was a href#a-style-sheet-that-is-blocking-scripts idscript-processing-model:a-style-sheet-that-is-blocking-scripts>a style sheet that is blocking scripts/a> when it was parsed, but then the script is moved to another code idscript-processing-model:document-12>a href#document>Document/a>/code> before the style sheet loads, the script still blocks the parser until the style sheets are all loaded, at which time the script executes and the parser is unblocked)./p> p>When the user agent is required to dfn idexecute-the-script-block>execute a script block/dfn>, it must run the following steps./p> ol>li> p>If the element is flagged as a href#parser-inserted idscript-processing-model:parser-inserted-12>parser-inserted/a>, but the elements a idscript-processing-model:node-document-9 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is not the code idscript-processing-model:document-13>a href#document>Document/a>/code> of the parser that created the element, then abort these steps./p> li> p>If a href#concept-script-script idscript-processing-model:concept-script-script-5>the scripts script/a> is null, a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idscript-processing-model:concept-event-fire-3 data-x-internalconcept-event-fire>fire an event/a> named code idscript-processing-model:event-error-3>a href#event-error>error/a>/code> at the element, and abort these steps./p> li> p>If the script is a href#concept-script-external idscript-processing-model:concept-script-external-2>from an external file/a>, or a href#concept-script-type idscript-processing-model:concept-script-type-16>the scripts type/a> is code>module/code>, then increment the a href#ignore-destructive-writes-counter idscript-processing-model:ignore-destructive-writes-counter>ignore-destructive-writes counter/a> of the code idscript-processing-model:the-script-element-46>a href#the-script-element>script/a>/code> elements a idscript-processing-model:node-document-10 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>. Let var>neutralized doc/var> be that code idscript-processing-model:document-14>a href#document>Document/a>/code>./p> li> p>Let var>old script element/var> be the value to which the code idscript-processing-model:the-script-element-47>a href#the-script-element>script/a>/code> elements a idscript-processing-model:node-document-11 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s code idscript-processing-model:dom-document-currentscript>a href#dom-document-currentscript>currentScript/a>/code> object was most recently set./p> li> p>Switch on a href#concept-script-type idscript-processing-model:concept-script-type-17>the scripts type/a>:/p> dl classswitch>dt>code>classic/code>dd> ol>li> p>If the code idscript-processing-model:the-script-element-48>a href#the-script-element>script/a>/code> elements a idscript-processing-model:root hrefhttps://dom.spec.whatwg.org/#concept-tree-root data-x-internalroot>root/a> is em>not/em> a a idscript-processing-model:shadow-root hrefhttps://dom.spec.whatwg.org/#concept-shadow-root data-x-internalshadow-root>shadow root/a>, then set the code idscript-processing-model:the-script-element-49>a href#the-script-element>script/a>/code> elements a idscript-processing-model:node-document-12 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s code idscript-processing-model:dom-document-currentscript-2>a href#dom-document-currentscript>currentScript/a>/code> attribute to the code idscript-processing-model:the-script-element-50>a href#the-script-element>script/a>/code> element. Otherwise, set it to null./p> p classnote>This does not use the a idscript-processing-model:in-a-document-tree hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a> check, as the code idscript-processing-model:the-script-element-51>a href#the-script-element>script/a>/code> element could have been removed from the document prior to execution, and in that scenario code idscript-processing-model:dom-document-currentscript-3>a href#dom-document-currentscript>currentScript/a>/code> still needs to point to it./p> li>p>a href#run-a-classic-script idscript-processing-model:run-a-classic-script>Run the classic script/a> given by a href#concept-script-script idscript-processing-model:concept-script-script-6>the scripts script/a>./ol> dt>code>module/code>dd> ol>li>p>Set the code idscript-processing-model:the-script-element-52>a href#the-script-element>script/a>/code> elements a idscript-processing-model:node-document-13 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s code idscript-processing-model:dom-document-currentscript-4>a href#dom-document-currentscript>currentScript/a>/code> attribute to null.li>p>a href#run-a-module-script idscript-processing-model:run-a-module-script>Run the module script/a> given by a href#concept-script-script idscript-processing-model:concept-script-script-7>the scripts script/a>./ol> /dl> li> p>Set the code idscript-processing-model:the-script-element-53>a href#the-script-element>script/a>/code> elements a idscript-processing-model:node-document-14 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s code idscript-processing-model:dom-document-currentscript-5>a href#dom-document-currentscript>currentScript/a>/code> attribute to var>old script element/var>./p> li> p>Decrement the a href#ignore-destructive-writes-counter idscript-processing-model:ignore-destructive-writes-counter-2>ignore-destructive-writes counter/a> of var>neutralized doc/var>, if it was incremented in the earlier step./p> li> p>If the script is a href#concept-script-external idscript-processing-model:concept-script-external-3>from an external file/a>, then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idscript-processing-model:concept-event-fire-4 data-x-internalconcept-event-fire>fire an event/a> named code idscript-processing-model:event-load>a href#event-load>load/a>/code> at the code idscript-processing-model:the-script-element-54>a href#the-script-element>script/a>/code> element./p> /ol> h5 idscriptingLanguages>span classsecno>4.12.1.2/span> Scripting languagesa href#scriptingLanguages classself-link>/a>/h5> p>A dfn idjavascript-mime-type data-export>JavaScript MIME type/dfn> is a a idscriptingLanguages:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> string that is one of the following and refers to JavaScript: a href#refsJAVASCRIPT>JAVASCRIPT/a>/p> ul classbrief>li>code idscriptingLanguages:application/ecmascript>a href#application/ecmascript>application/ecmascript/a>/code> li>code idscriptingLanguages:application/javascript>a href#application/javascript>application/javascript/a>/code> li>code idscriptingLanguages:application/x-ecmascript>a href#application/x-ecmascript>application/x-ecmascript/a>/code> li>code idscriptingLanguages:application/x-javascript>a href#application/x-javascript>application/x-javascript/a>/code> li>code idscriptingLanguages:text/ecmascript>a href#text/ecmascript>text/ecmascript/a>/code> li>code idscriptingLanguages:text/javascript>a href#text/javascript>text/javascript/a>/code> li>code idscriptingLanguages:text/javascript1.0>a href#text/javascript1.0>text/javascript1.0/a>/code> li>code idscriptingLanguages:text/javascript1.1>a href#text/javascript1.1>text/javascript1.1/a>/code> li>code idscriptingLanguages:text/javascript1.2>a href#text/javascript1.2>text/javascript1.2/a>/code> li>code idscriptingLanguages:text/javascript1.3>a href#text/javascript1.3>text/javascript1.3/a>/code> li>code idscriptingLanguages:text/javascript1.4>a href#text/javascript1.4>text/javascript1.4/a>/code> li>code idscriptingLanguages:text/javascript1.5>a href#text/javascript1.5>text/javascript1.5/a>/code> li>code idscriptingLanguages:text/jscript>a href#text/jscript>text/jscript/a>/code> li>code idscriptingLanguages:text/livescript>a href#text/livescript>text/livescript/a>/code> li>code idscriptingLanguages:text/x-ecmascript>a href#text/x-ecmascript>text/x-ecmascript/a>/code> li>code idscriptingLanguages:text/x-javascript>a href#text/x-javascript>text/x-javascript/a>/code> /ul> p>Servers should use code idscriptingLanguages:text/javascript-2>a href#text/javascript>text/javascript/a>/code> for JavaScript resources. Servers should not use other a href#javascript-mime-type idscriptingLanguages:javascript-mime-type>JavaScript MIME types/a> for JavaScript resources, and must not use non-a href#javascript-mime-type idscriptingLanguages:javascript-mime-type-2>JavaScript MIME types/a>./p> p>User agents are not required to support JavaScript. This standard needs to be updated if a language other than JavaScript comes along and gets similar wide adoption by web browsers. Until such a time, implementing other languages is in conflict with this standard, given the processing model defined for the code idscriptingLanguages:the-script-element>a href#the-script-element>script/a>/code> element./p> p>For external JavaScript resources, MIME type parameters in `code idscriptingLanguages:content-type>a href#content-type>Content-Type/a>/code>` headers are generally ignored. (In some cases the `code>charset/code>` parameter has an effect.) However, for the code idscriptingLanguages:the-script-element-2>a href#the-script-element>script/a>/code> elements code idscriptingLanguages:attr-script-type>a href#attr-script-type>type/a>/code> attribute they are significant./p> p classnote>For example, scripts with their code idscriptingLanguages:attr-script-type-2>a href#attr-script-type>type/a>/code> attribute set to code>text/javascript; charsetutf-8/code> will not be evaluated./p> p>Furthermore, again for external JavaScript resources, special considerations apply around `code idscriptingLanguages:content-type-2>a href#content-type>Content-Type/a>/code>` header processing as detailed in the a href#prepare-a-script idscriptingLanguages:prepare-a-script>prepare a script/a> algorithm and the WHATWG Fetch standard. a href#refsFETCH>FETCH/a> /p> h5 idrestrictions-for-contents-of-script-elements>span classsecno>4.12.1.3/span> dfn>Restrictions for contents of code>script/code> elements/dfn>a href#restrictions-for-contents-of-script-elements classself-link>/a>/h5> p classnote>The easiest and safest way to avoid the rather strange restrictions described in this section is to always escape code><!--/code> as code><\!--/code>, code><script/code> as code><\script/code>, and code></script/code> as code><\/script/code> when these sequences appear in literals in scripts (e.g. in strings, regular expressions, or comments), and to avoid writing code that uses such constructs in expressions. Doing so avoids the pitfalls that the restrictions in this section are prone to triggering: namely, that, for historical reasons, parsing of code idrestrictions-for-contents-of-script-elements:the-script-element>a href#the-script-element>script/a>/code> blocks in HTML is a strange and exotic practice that acts unintuitively in the face of these sequences./p> p>The code idrestrictions-for-contents-of-script-elements:textcontent>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> of a code idrestrictions-for-contents-of-script-elements:the-script-element-2>a href#the-script-element>script/a>/code> element must match the code>script/code> production in the following ABNF, the character set for which is Unicode. a href#refsABNF>ABNF/a>/p> pre>script outer *( comment-open inner comment-close outer )outer < any string that doesnt contain a substring that matches not-in-outer >not-in-outer comment-openinner < any string that doesnt contain a substring that matches not-in-inner >not-in-inner comment-close / script-opencomment-open <!--comment-close -->script-open < s c r i p t tag-ends %x0053 ; U+0053 LATIN CAPITAL LETTER Ss / %x0073 ; U+0073 LATIN SMALL LETTER Sc %x0043 ; U+0043 LATIN CAPITAL LETTER Cc / %x0063 ; U+0063 LATIN SMALL LETTER Cr %x0052 ; U+0052 LATIN CAPITAL LETTER Rr / %x0072 ; U+0072 LATIN SMALL LETTER Ri %x0049 ; U+0049 LATIN CAPITAL LETTER Ii / %x0069 ; U+0069 LATIN SMALL LETTER Ip %x0050 ; U+0050 LATIN CAPITAL LETTER Pp / %x0070 ; U+0070 LATIN SMALL LETTER Pt %x0054 ; U+0054 LATIN CAPITAL LETTER Tt / %x0074 ; U+0074 LATIN SMALL LETTER Ttag-end %x0009 ; U+0009 CHARACTER TABULATION (tab)tag-end / %x000A ; U+000A LINE FEED (LF)tag-end / %x000C ; U+000C FORM FEED (FF)tag-end / %x0020 ; U+0020 SPACEtag-end / %x002F ; U+002F SOLIDUS (/)tag-end / %x003E ; U+003E GREATER-THAN SIGN (>)/pre> p>When a code idrestrictions-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 idrestrictions-for-contents-of-script-elements:inline-documentation-for-external-scripts>script documentation/a>, there are further restrictions on the contents of the element, as described in the section below./p> div classexample> p>The following script illustrates this issue. Suppose you have a script that contains a string, as in:/p> pre>var example Consider this string: <!-- <script>;console.log(example);/pre> p>If one were to put this string directly in a code idrestrictions-for-contents-of-script-elements:the-script-element-4>a href#the-script-element>script/a>/code> block, it would violate the restrictions above:/p> pre><script> var example Consider this string: <!-- <script>; console.log(example);</script>/pre> p>The bigger problem, though, and the reason why it would violate those restrictions, is that actually the script would get parsed weirdly: em>the script block above is not terminated/em>. That is, what looks like a code></script>/code> end tag in this snippet is actually still part of the code idrestrictions-for-contents-of-script-elements:the-script-element-5>a href#the-script-element>script/a>/code> block. The script doesnt execute (since its not terminated); if it somehow were to execute, as it might if the markup looked as follows, it would fail because the script (highlighted here) is not valid JavaScript:/p> pre><script>mark> var example Consider this string: <!-- <script>; console.log(example);</script><!-- despite appearances, this is actually part of the script still! --><script> ... // this is the same script block still.../mark></script>/pre> p>What is going on here is that for legacy reasons, code><!--/code> and code><script/code> strings in code idrestrictions-for-contents-of-script-elements:the-script-element-6>a href#the-script-element>script/a>/code> elements in HTML need to be balanced in order for the parser to consider closing the block./p> p>By escaping the problematic strings as mentioned at the top of this section, the problem is avoided entirely:/p> pre><script>mark> var example Consider this string: <\!-- <\script>; console.log(example);/mark></script><!-- this is just a comment between script blocks --><script>mark> ... // this is a new script block/mark></script>/pre> p>It is possible for these sequences to naturally occur in script expressions, as in the following examples:/p> pre>if (x<!--y) { ... }if ( player<script ) { ... }/pre> p>In such cases the characters cannot be escaped, but the expressions can be rewritten so that the sequences dont occur, as in:/p> pre>if (x < !--y) { ... }if (!--y > x) { ... }if (!(--y) > x) { ... }if (player < script) { ... }if (script > player) { ... }/pre> p>Doing this also avoids a different pitfall as well: for related historical reasons, the string <!-- in a href#classic-script idrestrictions-for-contents-of-script-elements:classic-script>classic scripts/a> is actually treated as a line comment start, just like //./p> /div> h5 idinline-documentation-for-external-scripts>span classsecno>4.12.1.4/span> dfn>Inline documentation for external scripts/dfn>a href#inline-documentation-for-external-scripts classself-link>/a>/h5> p>If a code idinline-documentation-for-external-scripts:the-script-element>a href#the-script-element>script/a>/code> elements code idinline-documentation-for-external-scripts:attr-script-src>a href#attr-script-src>src/a>/code> attribute is specified, then the contents of the code idinline-documentation-for-external-scripts:the-script-element-2>a href#the-script-element>script/a>/code> element, if any, must be such that the value of the code idinline-documentation-for-external-scripts:dom-script-text>a href#dom-script-text>text/a>/code> IDL attribute, which is derived from the elements contents, matches the code>documentation/code> production in the following ABNF, the character set for which is Unicode. a href#refsABNF>ABNF/a>/p> pre>documentation *( *( space / tab / comment ) line-comment newline )comment slash star *( not-star / star not-slash ) 1*star slashline-comment slash slash *not-newline; characterstab %x0009 ; U+0009 CHARACTER TABULATION (tab)newline %x000A ; U+000A LINE FEED (LF)space %x0020 ; U+0020 SPACEstar %x002A ; U+002A ASTERISK (*)slash %x002F ; U+002F SOLIDUS (/)not-newline %x0000-0009 / %x000B-10FFFF ; a a idinline-documentation-for-external-scripts:scalar-value hrefhttps://infra.spec.whatwg.org/#scalar-value data-x-internalscalar-value>scalar value/a> other than U+000A LINE FEED (LF)not-star %x0000-0029 / %x002B-10FFFF ; a a idinline-documentation-for-external-scripts:scalar-value-2 hrefhttps://infra.spec.whatwg.org/#scalar-value data-x-internalscalar-value>scalar value/a> other than U+002A ASTERISK (*)not-slash %x0000-002E / %x0030-10FFFF ; a a idinline-documentation-for-external-scripts:scalar-value-3 hrefhttps://infra.spec.whatwg.org/#scalar-value data-x-internalscalar-value>scalar value/a> other than U+002F SOLIDUS (/)/pre> p classnote>This corresponds to putting the contents of the element in JavaScript comments./p> p classnote>This requirement is in addition to the earlier restrictions on the syntax of contents of code idinline-documentation-for-external-scripts:the-script-element-3>a href#the-script-element>script/a>/code> elements./p> div classexample> p>This allows authors to include documentation, such as license information or API information, inside their documents while still referring to external script files. The syntax is constrained so that authors dont accidentally include what looks like valid script while also providing a code idinline-documentation-for-external-scripts:attr-script-src-2>a href#attr-script-src>src/a>/code> attribute./p> pre><script srccool-effects.js> // create new instances using: // var e new Effect(); // start the effect using .play, stop using .stop: // e.play(); // e.stop();</script>/pre> /div> h5 idscriptTagXSLT>span classsecno>4.12.1.5/span> Interaction of code idscriptTagXSLT:the-script-element>a href#the-script-element>script/a>/code> elements and XSLTa href#scriptTagXSLT classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>This specification does not define how XSLT interacts with the code idscriptTagXSLT:the-script-element-2>a href#the-script-element>script/a>/code> element. However, in the absence of another specification actually defining this, here are some guidelines for implementors, based on existing implementations:/p> ul>li>p>When an XSLT transformation program is triggered by an code><?xml-stylesheet?>/code> processing instruction and the browser implements a direct-to-DOM transformation, code idscriptTagXSLT:the-script-element-3>a href#the-script-element>script/a>/code> elements created by the XSLT processor need to be marked a href#parser-inserted idscriptTagXSLT:parser-inserted>parser-inserted/a> and run in document order (modulo scripts marked code idscriptTagXSLT:attr-script-defer>a href#attr-script-defer>defer/a>/code> or code idscriptTagXSLT:attr-script-async>a href#attr-script-async>async/a>/code>), a href#immediately idscriptTagXSLT:immediately>immediately/a>, as the transformation is occurring.li>p>The code idscriptTagXSLT:dom-xsltprocessor-transformtodocument>a href#dom-xsltprocessor-transformtodocument>XSLTProcessor.transformToDocument()/a>/code> method adds elements to a code idscriptTagXSLT:document>a href#document>Document/a>/code> that does not have a a href#concept-document-bc idscriptTagXSLT:concept-document-bc>browsing context/a>, and, accordingly, any code idscriptTagXSLT:the-script-element-4>a href#the-script-element>script/a>/code> elements they create need to have their a href#already-started idscriptTagXSLT:already-started>already started/a> flag set in the a href#prepare-a-script idscriptTagXSLT:prepare-a-script>prepare a script/a> algorithm and never get executed (a href#concept-bc-noscript idscriptTagXSLT:concept-bc-noscript>scripting is disabled/a>). Such code idscriptTagXSLT:the-script-element-5>a href#the-script-element>script/a>/code> elements still need to be marked a href#parser-inserted idscriptTagXSLT:parser-inserted-2>parser-inserted/a>, though, such that their code idscriptTagXSLT:dom-script-async>a href#dom-script-async>async/a>/code> IDL attribute will return false in the absence of an code idscriptTagXSLT:attr-script-async-2>a href#attr-script-async>async/a>/code> content attribute.li>p>The code idscriptTagXSLT:dom-xsltprocessor-transformtofragment>a href#dom-xsltprocessor-transformtofragment>XSLTProcessor.transformToFragment()/a>/code> method needs to create a fragment that is equivalent to one built manually by creating the elements using code idscriptTagXSLT:dom-document-createelementns>a data-x-internaldom-document-createelementns hrefhttps://dom.spec.whatwg.org/#dom-document-createelementns>document.createElementNS()/a>/code>. For instance, it needs to create code idscriptTagXSLT:the-script-element-6>a href#the-script-element>script/a>/code> elements that arent a href#parser-inserted idscriptTagXSLT:parser-inserted-3>parser-inserted/a> and that dont have their a href#already-started idscriptTagXSLT:already-started-2>already started/a> flag set, so that they will execute when the fragment is inserted into a document./ul> p>The main distinction between the first two cases and the last case is that the first two operate on code idscriptTagXSLT:document-2>a href#document>Document/a>/code>s and the last operates on a fragment./p> h4 idthe-noscript-element>span classsecno>4.12.2/span> The dfn>code>noscript/code>/dfn> elementa href#the-noscript-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-noscript-element:concept-element-categories>Categories/a>:dd>a href#metadata-content-2 idthe-noscript-element:metadata-content-2>Metadata content/a>.dd>a href#flow-content-2 idthe-noscript-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-noscript-element:phrasing-content-2>Phrasing content/a>.dt>a href#concept-element-contexts idthe-noscript-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>In a code idthe-noscript-element:the-head-element>a href#the-head-element>head/a>/code> element of an a hrefhttps://dom.spec.whatwg.org/#html-document idthe-noscript-element:html-documents data-x-internalhtml-documents>HTML document/a>, if there are no ancestor code idthe-noscript-element:the-noscript-element>a href#the-noscript-element>noscript/a>/code> elements.dd>Where a href#phrasing-content-2 idthe-noscript-element:phrasing-content-2-2>phrasing content/a> is expected in a idthe-noscript-element:html-documents-2 hrefhttps://dom.spec.whatwg.org/#html-document data-x-internalhtml-documents>HTML documents/a>, if there are no ancestor code idthe-noscript-element:the-noscript-element-2>a href#the-noscript-element>noscript/a>/code> elements.dt>a href#concept-element-content-model idthe-noscript-element:concept-element-content-model>Content model/a>:dd>When a href#concept-n-noscript idthe-noscript-element:concept-n-noscript>scripting is disabled/a>, in a code idthe-noscript-element:the-head-element-2>a href#the-head-element>head/a>/code> element: in any order, zero or more code idthe-noscript-element:the-link-element>a href#the-link-element>link/a>/code> elements, zero or more code idthe-noscript-element:the-style-element>a href#the-style-element>style/a>/code> elements, and zero or more code idthe-noscript-element:the-meta-element>a href#the-meta-element>meta/a>/code> elements.dd>When a href#concept-n-noscript idthe-noscript-element:concept-n-noscript-2>scripting is disabled/a>, not in a code idthe-noscript-element:the-head-element-3>a href#the-head-element>head/a>/code> element: a href#transparent idthe-noscript-element:transparent>transparent/a>, but there must be no code idthe-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 idthe-noscript-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-noscript-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-noscript-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-noscript-element:concept-element-dom>DOM interface/a>:dd>Uses code idthe-noscript-element:htmlelement>a href#htmlelement>HTMLElement/a>/code>./dl> p>The code idthe-noscript-element:the-noscript-element-4>a href#the-noscript-element>noscript/a>/code> element a href#represents idthe-noscript-element:represents>represents/a> nothing if a href#concept-n-script idthe-noscript-element:concept-n-script>scripting is enabled/a>, and a href#represents idthe-noscript-element:represents-2>represents/a> its children if a href#concept-n-noscript idthe-noscript-element:concept-n-noscript-3>scripting is disabled/a>. It is used to present different markup to user agents that support scripting and those that dont support scripting, by affecting how the document is parsed./p> p>When used in a idthe-noscript-element:html-documents-3 hrefhttps://dom.spec.whatwg.org/#html-document data-x-internalhtml-documents>HTML documents/a>, the allowed content model is as follows:/p> dl>dt>In a code idthe-noscript-element:the-head-element-4>a href#the-head-element>head/a>/code> element, if a href#concept-n-noscript idthe-noscript-element:concept-n-noscript-4>scripting is disabled/a> for the code idthe-noscript-element:the-noscript-element-5>a href#the-noscript-element>noscript/a>/code> elementdd>p>The code idthe-noscript-element:the-noscript-element-6>a href#the-noscript-element>noscript/a>/code> element must contain only code idthe-noscript-element:the-link-element-2>a href#the-link-element>link/a>/code>, code idthe-noscript-element:the-style-element-2>a href#the-style-element>style/a>/code>, and code idthe-noscript-element:the-meta-element-2>a href#the-meta-element>meta/a>/code> elements.dt>In a code idthe-noscript-element:the-head-element-5>a href#the-head-element>head/a>/code> element, if a href#concept-n-script idthe-noscript-element:concept-n-script-2>scripting is enabled/a> for the code idthe-noscript-element:the-noscript-element-7>a href#the-noscript-element>noscript/a>/code> elementdd>p>The code idthe-noscript-element:the-noscript-element-8>a href#the-noscript-element>noscript/a>/code> element must contain only text, except that invoking the a href#html-fragment-parsing-algorithm idthe-noscript-element:html-fragment-parsing-algorithm>HTML fragment parsing algorithm/a> with the code idthe-noscript-element:the-noscript-element-9>a href#the-noscript-element>noscript/a>/code> element as the var idthe-noscript-element:concept-frag-parse-context>a href#concept-frag-parse-context>context/a>/var> element and the text contents as the var>input/var> must result in a list of nodes that consists only of code idthe-noscript-element:the-link-element-3>a href#the-link-element>link/a>/code>, code idthe-noscript-element:the-style-element-3>a href#the-style-element>style/a>/code>, and code idthe-noscript-element:the-meta-element-3>a href#the-meta-element>meta/a>/code> elements that would be conforming if they were children of the code idthe-noscript-element:the-noscript-element-10>a href#the-noscript-element>noscript/a>/code> element, and no a href#parse-errors idthe-noscript-element:parse-errors>parse errors/a>.dt>Outside of code idthe-noscript-element:the-head-element-6>a href#the-head-element>head/a>/code> elements, if a href#concept-n-noscript idthe-noscript-element:concept-n-noscript-5>scripting is disabled/a> for the code idthe-noscript-element:the-noscript-element-11>a href#the-noscript-element>noscript/a>/code> elementdd>p>The code idthe-noscript-element:the-noscript-element-12>a href#the-noscript-element>noscript/a>/code> elements content model is a href#transparent idthe-noscript-element:transparent-2>transparent/a>, with the additional restriction that a code idthe-noscript-element:the-noscript-element-13>a href#the-noscript-element>noscript/a>/code> element must not have a code idthe-noscript-element:the-noscript-element-14>a href#the-noscript-element>noscript/a>/code> element as an ancestor (that is, code idthe-noscript-element:the-noscript-element-15>a href#the-noscript-element>noscript/a>/code> cant be nested).dt>Outside of code idthe-noscript-element:the-head-element-7>a href#the-head-element>head/a>/code> elements, if a href#concept-n-script idthe-noscript-element:concept-n-script-3>scripting is enabled/a> for the code idthe-noscript-element:the-noscript-element-16>a href#the-noscript-element>noscript/a>/code> elementdd> p>The code idthe-noscript-element:the-noscript-element-17>a href#the-noscript-element>noscript/a>/code> element must contain only text, except that the text must be such that running the following algorithm results in a conforming document with no code idthe-noscript-element:the-noscript-element-18>a href#the-noscript-element>noscript/a>/code> elements and no code idthe-noscript-element:the-script-element>a href#the-script-element>script/a>/code> elements, and such that no step in the algorithm throws an exception or causes an a href#html-parser idthe-noscript-element:html-parser>HTML parser/a> to flag a a href#parse-errors idthe-noscript-element:parse-errors-2>parse error/a>:/p> ol>li>Remove every code idthe-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 idthe-noscript-element:the-noscript-element-19>a href#the-noscript-element>noscript/a>/code> element in the document. For every code idthe-noscript-element:the-noscript-element-20>a href#the-noscript-element>noscript/a>/code> element in that list, perform the following steps: ol>li>Let var>s/var> be the a idthe-noscript-element:child-text-content hrefhttps://dom.spec.whatwg.org/#concept-child-text-content data-x-internalchild-text-content>child text content/a> of the code idthe-noscript-element:the-noscript-element-21>a href#the-noscript-element>noscript/a>/code> element.li>Set the code idthe-noscript-element:dom-outerhtml>a data-x-internaldom-outerhtml hrefhttps://w3c.github.io/DOM-Parsing/#dom-element-outerhtml>outerHTML/a>/code> attribute of the code idthe-noscript-element:the-noscript-element-22>a href#the-noscript-element>noscript/a>/code> element to the value of var>s/var>. (This, as a side-effect, causes the code idthe-noscript-element:the-noscript-element-23>a href#the-noscript-element>noscript/a>/code> element to be removed from the document.) a href#refsDOMPARSING>DOMPARSING/a>/ol> /ol> /dl> p classnote>All these contortions are required because, for historical reasons, the code idthe-noscript-element:the-noscript-element-24>a href#the-noscript-element>noscript/a>/code> element is handled differently by the a href#html-parser idthe-noscript-element:html-parser-2>HTML parser/a> based on whether a href#scripting-flag idthe-noscript-element:scripting-flag>scripting was enabled or not/a> when the parser was invoked./p> p>The code idthe-noscript-element:the-noscript-element-25>a href#the-noscript-element>noscript/a>/code> element must not be used in a idthe-noscript-element:xml-documents hrefhttps://dom.spec.whatwg.org/#xml-document data-x-internalxml-documents>XML documents/a>./p> p classnote>The code idthe-noscript-element:the-noscript-element-26>a href#the-noscript-element>noscript/a>/code> element is only effective in a href#syntax idthe-noscript-element:syntax>the HTML syntax/a>, it has no effect in a href#the-xhtml-syntax idthe-noscript-element:the-xhtml-syntax>the XML syntax/a>. This is because the way it works is by essentially turning off the parser when scripts are enabled, so that the contents of the element are treated as pure text and not as real elements. XML does not define a mechanism by which to do this./p> p>The code idthe-noscript-element:the-noscript-element-27>a href#the-noscript-element>noscript/a>/code> element has no other requirements. In particular, children of the code idthe-noscript-element:the-noscript-element-28>a href#the-noscript-element>noscript/a>/code> element are not exempt from a href#form-submission-2 idthe-noscript-element:form-submission-2>form submission/a>, scripting, and so forth, even when a href#concept-n-script idthe-noscript-element:concept-n-script-4>scripting is enabled/a> for the element./p> div classexample> p>In the following example, a code idthe-noscript-element:the-noscript-element-29>a href#the-noscript-element>noscript/a>/code> element is used to provide fallback for a script./p> pre><form actioncalcSquare.php> <p> <label forx>Number</label>: <input idx namex typenumber> </p> <script> var x document.getElementById(x); var output document.createElement(p); output.textContent Type a number; it will be squared right then!; x.form.appendChild(output); x.form.onsubmit function () { return false; } x.oninput function () { var v x.valueAsNumber; output.textContent v + squared is + v * v; }; </script> <noscript> <input typesubmit valueCalculate Square> </noscript></form>/pre> p>When script is disabled, a button appears to do the calculation on the server side. When script is enabled, the value is computed on-the-fly instead./p> p>The code idthe-noscript-element:the-noscript-element-30>a href#the-noscript-element>noscript/a>/code> element is a blunt instrument. Sometimes, scripts might be enabled, but for some reason the pages script might fail. For this reason, its generally better to avoid using code idthe-noscript-element:the-noscript-element-31>a href#the-noscript-element>noscript/a>/code>, and to instead design the script to change the page from being a scriptless page to a scripted page on the fly, as in the next example:/p> pre><form actioncalcSquare.php> <p> <label forx>Number</label>: <input idx namex typenumber> </p> strong><input idsubmit typesubmit valueCalculate Square>/strong> <script> var x document.getElementById(x); var output document.createElement(p); output.textContent Type a number; it will be squared right then!; x.form.appendChild(output); x.form.onsubmit function () { return false; } x.oninput function () { var v x.valueAsNumber; output.textContent v + squared is + v * v; };strong> var submit document.getElementById(submit); submit.parentNode.removeChild(submit);/strong> </script></form>/pre> p>The above technique is also useful in a idthe-noscript-element:xml-documents-2 hrefhttps://dom.spec.whatwg.org/#xml-document data-x-internalxml-documents>XML documents/a>, since code idthe-noscript-element:the-noscript-element-32>a href#the-noscript-element>noscript/a>/code> is not allowed there./p> /div> h4 idthe-template-element>span classsecno>4.12.3/span> The dfn>code>template/code>/dfn> elementa href#the-template-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> templatespan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>35+/span>/span>span classios_saf yes>span>iOS Safari/span> span>9.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>22+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>9+/span>/span>span classedge partial>span>Edge (limited)/span> span>13+/span>/span>span classandroid yes>span>Android Browser/span> span>4.4+/span>/span>span classopera yes>span>Opera/span> span>22+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#feattemplate>caniuse.com/a>/div> dl classelement>dt>a href#concept-element-categories idthe-template-element:concept-element-categories>Categories/a>:dd>a href#metadata-content-2 idthe-template-element:metadata-content-2>Metadata content/a>.dd>a href#flow-content-2 idthe-template-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-template-element:phrasing-content-2>Phrasing content/a>.dd>a href#script-supporting-elements-2 idthe-template-element:script-supporting-elements-2>Script-supporting element/a>.dt>a href#concept-element-contexts idthe-template-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#metadata-content-2 idthe-template-element:metadata-content-2-2>metadata content/a> is expected.dd>Where a href#phrasing-content-2 idthe-template-element:phrasing-content-2-2>phrasing content/a> is expected.dd>Where a href#script-supporting-elements-2 idthe-template-element:script-supporting-elements-2-2>script-supporting elements/a> are expected.dd>As a child of a code idthe-template-element:the-colgroup-element>a href#the-colgroup-element>colgroup/a>/code> element that doesnt have a code idthe-template-element:attr-colgroup-span>a href#attr-colgroup-span>span/a>/code> attribute.dt>a href#concept-element-content-model idthe-template-element:concept-element-content-model>Content model/a>:dd>a href#concept-content-nothing idthe-template-element:concept-content-nothing>Nothing/a> (for clarification, a href#template-example>see example/a>).dt>a href#concept-element-tag-omission idthe-template-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-template-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-template-element:global-attributes>Global attributes/a>dt>a href#concept-element-dom idthe-template-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-template-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmltemplateelement>HTMLTemplateElement/dfn> : a href#htmlelement idthe-template-element:htmlelement>HTMLElement/a> { readonly attribute a idthe-template-element:documentfragment hrefhttps://dom.spec.whatwg.org/#interface-documentfragment data-x-internaldocumentfragment>DocumentFragment/a> a href#dom-template-content idthe-template-element:dom-template-content>content/a>;};/pre>/dl> p>The code idthe-template-element:the-template-element>a href#the-template-element>template/a>/code> element is used to declare fragments of HTML that can be cloned and inserted in the document by script./p> p>In a rendering, the code idthe-template-element:the-template-element-2>a href#the-template-element>template/a>/code> element a href#represents idthe-template-element:represents>represents/a> nothing./p> p>The a href#template-contents idthe-template-element:template-contents>template contents/a> of a code idthe-template-element:the-template-element-3>a href#the-template-element>template/a>/code> element a href#template-syntax>are not children of the element itself/a>./p> p classnote>It is also possible, as a result of DOM manipulation, for a code idthe-template-element:the-template-element-4>a href#the-template-element>template/a>/code> element to contain code idthe-template-element:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes and element nodes; however, having any is a violation of the code idthe-template-element:the-template-element-5>a href#the-template-element>template/a>/code> elements content model, since its content model is defined as a href#concept-content-nothing idthe-template-element:concept-content-nothing-2>nothing/a>./p> div idtemplate-example classexample> p>For example, consider the following document:/p> pre><!doctype html><html langen> <head> <title>Homework</title> <body> <template idtemplate><p>Smile!</p></template> <script> let num 3; const fragment document.getElementById(template).content.cloneNode(true); while (num-- > 1) { fragment.firstChild.before(fragment.firstChild.cloneNode(true)); fragment.firstChild.textContent + fragment.lastChild.textContent; } document.body.appendChild(fragment); </script></html>/pre> p>The code idthe-template-element:the-p-element>a href#the-p-element>p/a>/code> element in the code idthe-template-element:the-template-element-6>a href#the-template-element>template/a>/code> is em>not/em> a child of the code idthe-template-element:the-template-element-7>a href#the-template-element>template/a>/code> in the DOM; it is a child of the code idthe-template-element:documentfragment-2>a data-x-internaldocumentfragment hrefhttps://dom.spec.whatwg.org/#interface-documentfragment>DocumentFragment/a>/code> returned by the code idthe-template-element:the-template-element-8>a href#the-template-element>template/a>/code> elements code idthe-template-element:dom-template-content-2>a href#dom-template-content>content/a>/code> IDL attribute./p> p>If the script were to call code idthe-template-element:dom-node-appendchild>a data-x-internaldom-node-appendchild hrefhttps://dom.spec.whatwg.org/#dom-node-appendchild>appendChild()/a>/code> on the code idthe-template-element:the-template-element-9>a href#the-template-element>template/a>/code> element, that would add a child to the code idthe-template-element:the-template-element-10>a href#the-template-element>template/a>/code> element (as for any other element); however, doing so is a violation of the code idthe-template-element:the-template-element-11>a href#the-template-element>template/a>/code> elements content model./p> /div> dl classdomintro>dt>var>template/var> . code idthe-template-element:dom-template-content-3>a href#dom-template-content>content/a>/code>dd> p>Returns the a href#template-contents idthe-template-element:template-contents-2>template contents/a> (a code idthe-template-element:documentfragment-3>a data-x-internaldocumentfragment hrefhttps://dom.spec.whatwg.org/#interface-documentfragment>DocumentFragment/a>/code>)./p> /dl> p>Each code idthe-template-element:the-template-element-12>a href#the-template-element>template/a>/code> element has an associated code idthe-template-element:documentfragment-4>a data-x-internaldocumentfragment hrefhttps://dom.spec.whatwg.org/#interface-documentfragment>DocumentFragment/a>/code> object that is its dfn idtemplate-contents>template contents/dfn>. The a href#template-contents idthe-template-element:template-contents-3>template contents/a> have a href#no-browsing-context>no conformance requirements/a>. When a code idthe-template-element:the-template-element-13>a href#the-template-element>template/a>/code> element is created, the user agent must run the following steps to establish the a href#template-contents idthe-template-element:template-contents-4>template contents/a>:/p> ol>li>p>Let var>doc/var> be the code idthe-template-element:the-template-element-14>a href#the-template-element>template/a>/code> elements a idthe-template-element:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#appropriate-template-contents-owner-document idthe-template-element:appropriate-template-contents-owner-document>appropriate template contents owner document/a>.li>p>Create a code idthe-template-element:documentfragment-5>a data-x-internaldocumentfragment hrefhttps://dom.spec.whatwg.org/#interface-documentfragment>DocumentFragment/a>/code> object whose a idthe-template-element:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is var>doc/var> and a hrefhttps://dom.spec.whatwg.org/#concept-documentfragment-host idthe-template-element:concept-documentfragment-host data-x-internalconcept-documentfragment-host>host/a> is the code idthe-template-element:the-template-element-15>a href#the-template-element>template/a>/code> element.li>p>Set the code idthe-template-element:the-template-element-16>a href#the-template-element>template/a>/code> elements a href#template-contents idthe-template-element:template-contents-5>template contents/a> to the newly created code idthe-template-element:documentfragment-6>a data-x-internaldocumentfragment hrefhttps://dom.spec.whatwg.org/#interface-documentfragment>DocumentFragment/a>/code> object./ol> p>A code idthe-template-element:document>a href#document>Document/a>/code> var>doc/var>s dfn idappropriate-template-contents-owner-document>appropriate template contents owner document/dfn> is the code idthe-template-element:document-2>a href#document>Document/a>/code> returned by the following algorithm:/p> ol>li> p>If var>doc/var> is not a code idthe-template-element:document-3>a href#document>Document/a>/code> created by this algorithm, then:/p> ol>li> p>If var>doc/var> does not yet have an dfn idassociated-inert-template-document>associated inert template document/dfn>, then:/p> ol>li>p>Let var>new doc/var> be a new code idthe-template-element:document-4>a href#document>Document/a>/code> (that does not have a a href#concept-document-bc idthe-template-element:concept-document-bc>browsing context/a>). This is a code idthe-template-element:document-5>a href#document>Document/a>/code> created by this algorithm for the purposes of the step above.li>p>If var>doc/var> is an a hrefhttps://dom.spec.whatwg.org/#html-document idthe-template-element:html-documents data-x-internalhtml-documents>HTML document/a>, mark var>new doc/var> as an a hrefhttps://dom.spec.whatwg.org/#html-document idthe-template-element:html-documents-2 data-x-internalhtml-documents>HTML document/a> also.li>p>Let var>doc/var>s a href#associated-inert-template-document idthe-template-element:associated-inert-template-document>associated inert template document/a> be var>new doc/var>./ol> li>p>Set var>doc/var> to var>doc/var>s a href#associated-inert-template-document idthe-template-element:associated-inert-template-document-2>associated inert template document/a>./ol> p classnote>Each code idthe-template-element:document-6>a href#document>Document/a>/code> not created by this algorithm thus gets a single code idthe-template-element:document-7>a href#document>Document/a>/code> to act as its proxy for owning the a href#template-contents idthe-template-element:template-contents-6>template contents/a> of all its code idthe-template-element:the-template-element-17>a href#the-template-element>template/a>/code> elements, so that they arent in a a href#browsing-context idthe-template-element:browsing-context>browsing context/a> and thus remain inert (e.g. scripts do not run). Meanwhile, code idthe-template-element:the-template-element-18>a href#the-template-element>template/a>/code> elements inside code idthe-template-element:document-8>a href#document>Document/a>/code> objects that em>are/em> created by this algorithm just reuse the same code idthe-template-element:document-9>a href#document>Document/a>/code> owner for their contents./p> li>p>Return var>doc/var>./ol> p idtemplate-adopting-steps>The a hrefhttps://dom.spec.whatwg.org/#concept-node-adopt-ext idthe-template-element:concept-node-adopt-ext data-x-internalconcept-node-adopt-ext>adopting steps/a> (with var>node/var> and var>oldDocument/var> as parameters) for code idthe-template-element:the-template-element-19>a href#the-template-element>template/a>/code> elements are the following:/p> ol>li> p>Let var>doc/var> be var>node/var>s a idthe-template-element:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#appropriate-template-contents-owner-document idthe-template-element:appropriate-template-contents-owner-document-2>appropriate template contents owner document/a>./p> p classnote>var>node/var>s a idthe-template-element:node-document-4 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is the code idthe-template-element:document-10>a href#document>Document/a>/code> object that var>node/var> was just adopted em>into/em>./p> li>p>a hrefhttps://dom.spec.whatwg.org/#concept-node-adopt idthe-template-element:concept-node-adopt data-x-internalconcept-node-adopt>Adopt/a> var>node/var>s a href#template-contents idthe-template-element:template-contents-7>template contents/a> (a code idthe-template-element:documentfragment-7>a data-x-internaldocumentfragment hrefhttps://dom.spec.whatwg.org/#interface-documentfragment>DocumentFragment/a>/code> object) into var>doc/var>./ol> p>The dfn iddom-template-content>code>content/code>/dfn> IDL attribute must return the code idthe-template-element:the-template-element-20>a href#the-template-element>template/a>/code> elements a href#template-contents idthe-template-element:template-contents-8>template contents/a>./p> hr> p>The a hrefhttps://dom.spec.whatwg.org/#concept-node-clone-ext idthe-template-element:concept-node-clone-ext data-x-internalconcept-node-clone-ext>cloning steps/a> for a code idthe-template-element:the-template-element-21>a href#the-template-element>template/a>/code> element var>node/var> being cloned to a copy var>copy/var> must run the following steps:/p> ol>li>p>If the var>clone children flag/var> is not set in the calling a hrefhttps://dom.spec.whatwg.org/#concept-node-clone idthe-template-element:concept-node-clone data-x-internalconcept-node-clone>clone/a> algorithm, abort these steps.li>p>Let var>copied contents/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-node-clone idthe-template-element:concept-node-clone-2 data-x-internalconcept-node-clone>cloning/a> all the children of var>node/var>s a href#template-contents idthe-template-element:template-contents-9>template contents/a>, with var>document/var> set to var>copy/var>s a href#template-contents idthe-template-element:template-contents-10>template contents/a>s a idthe-template-element:node-document-5 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, and with the var>clone children flag/var> set.li>p>Append var>copied contents/var> to var>copy/var>s a href#template-contents idthe-template-element:template-contents-11>template contents/a>./ol> div classexample> p>In this example, a script populates a table four-column with data from a data structure, using a code idthe-template-element:the-template-element-22>a href#the-template-element>template/a>/code> to provide the element structure instead of manually generating the structure from markup./p> pre><!DOCTYPE html><html langen><title>Cat data</title><script> // Data is hard-coded here, but could come from the server var data { name: Pillar, color: Ticked Tabby, sex: Female (neutered), legs: 3 }, { name: Hedral, color: Tuxedo, sex: Male (neutered), legs: 4 }, ;</script><table> <thead> <tr> <th>Name <th>Color <th>Sex <th>Legs <tbody> <template idrow> <tr><td><td><td><td> </template></table><script> var template document.querySelector(#row); for (var i 0; i < data.length; i + 1) { var cat datai; var clone template.content.cloneNode(true); var cells clone.querySelectorAll(td); cells0.textContent cat.name; cells1.textContent cat.color; cells2.textContent cat.sex; cells3.textContent cat.legs; template.parentNode.appendChild(clone); }</script>/pre> p>This example uses code idthe-template-element:dom-node-clonenode>a data-x-internaldom-node-clonenode hrefhttps://dom.spec.whatwg.org/#dom-node-clonenode>cloneNode()/a>/code> on the code idthe-template-element:the-template-element-23>a href#the-template-element>template/a>/code>s contents; it could equivalently have used code idthe-template-element:dom-document-importnode>a data-x-internaldom-document-importnode hrefhttps://dom.spec.whatwg.org/#dom-document-importnode>document.importNode()/a>/code>, which does the same thing. The only difference between these two APIs is when the a idthe-template-element:node-document-6 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is updated: with code idthe-template-element:dom-node-clonenode-2>a data-x-internaldom-node-clonenode hrefhttps://dom.spec.whatwg.org/#dom-node-clonenode>cloneNode()/a>/code> it is updated when the nodes are appended with code idthe-template-element:dom-node-appendchild-2>a data-x-internaldom-node-appendchild hrefhttps://dom.spec.whatwg.org/#dom-node-appendchild>appendChild()/a>/code>, with code idthe-template-element:dom-document-importnode-2>a data-x-internaldom-document-importnode hrefhttps://dom.spec.whatwg.org/#dom-document-importnode>document.importNode()/a>/code> it is updated when the nodes are cloned./p> /div> h5 idtemplate-XSLT-XPath>span classsecno>4.12.3.1/span> Interaction of code idtemplate-XSLT-XPath:the-template-element>a href#the-template-element>template/a>/code> elements with XSLT and XPatha href#template-XSLT-XPath classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>This specification does not define how XSLT and XPath interact with the code idtemplate-XSLT-XPath:the-template-element-2>a href#the-template-element>template/a>/code> element. However, in the absence of another specification actually defining this, here are some guidelines for implementors, which are intended to be consistent with other processing described in this specification:/p> ul>li>p>An XSLT processor based on an XML parser that acts a href#xml-parser idtemplate-XSLT-XPath:xml-parser>as described in this specification/a> needs to act as if code idtemplate-XSLT-XPath:the-template-element-3>a href#the-template-element>template/a>/code> elements contain as descendants their a href#template-contents idtemplate-XSLT-XPath:template-contents>template contents/a> for the purposes of the transform.li>p>An XSLT processor that outputs a DOM needs to ensure that nodes that would go into a code idtemplate-XSLT-XPath:the-template-element-4>a href#the-template-element>template/a>/code> element are instead placed into the elements a href#template-contents idtemplate-XSLT-XPath:template-contents-2>template contents/a>.li>p>XPath evaluation using the XPath DOM API when applied to a code idtemplate-XSLT-XPath:document>a href#document>Document/a>/code> parsed using the a href#html-parser idtemplate-XSLT-XPath:html-parser>HTML parser/a> or the a href#xml-parser idtemplate-XSLT-XPath:xml-parser-2>XML parser/a> described in this specification needs to ignore a href#template-contents idtemplate-XSLT-XPath:template-contents-3>template contents/a>./p> /ul> h4 idthe-slot-element>span classsecno>4.12.4/span> The dfn>code>slot/code>/dfn> elementa href#the-slot-element classself-link>/a>/h4> dl classelement>dt>a href#concept-element-categories idthe-slot-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-slot-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-slot-element:phrasing-content-2>Phrasing content/a>.dt>a href#concept-element-contexts idthe-slot-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idthe-slot-element:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idthe-slot-element:concept-element-content-model>Content model/a>:dd>a href#transparent idthe-slot-element:transparent>Transparent/a>dt>a href#concept-element-tag-omission idthe-slot-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-slot-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-slot-element:global-attributes>Global attributes/a>dd>code idthe-slot-element:attr-slot-name>a href#attr-slot-name>name/a>/code> — Name of shadow tree slotdt>a href#concept-element-dom idthe-slot-element:concept-element-dom>DOM interface/a>:dd> pre classidl>ExposedWindow, a href#htmlconstructor idthe-slot-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlslotelement>HTMLSlotElement/dfn> : a href#htmlelement idthe-slot-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-slot-element:cereactions>CEReactions/a> attribute DOMString a href#dom-slot-name idthe-slot-element:dom-slot-name>name/a>; sequence<Node> a href#dom-slot-assignednodes idthe-slot-element:dom-slot-assignednodes>assignedNodes/a>(optional a href#assignednodesoptions idthe-slot-element:assignednodesoptions>AssignedNodesOptions/a> options);};dictionary dfn idassignednodesoptions>AssignedNodesOptions/dfn> { boolean flatten false;};/pre> /dl> p>The code idthe-slot-element:the-slot-element>a href#the-slot-element>slot/a>/code> element defines a a hrefhttps://dom.spec.whatwg.org/#concept-slot idthe-slot-element:concept-slot data-x-internalconcept-slot>slot/a>. It is typically used in a a idthe-slot-element:shadow-tree hrefhttps://dom.spec.whatwg.org/#concept-shadow-tree data-x-internalshadow-tree>shadow tree/a>. A code idthe-slot-element:the-slot-element-2>a href#the-slot-element>slot/a>/code> element a href#represents idthe-slot-element:represents>represents/a> its a idthe-slot-element:assigned-nodes hrefhttps://dom.spec.whatwg.org/#slot-assigned-nodes data-x-internalassigned-nodes>assigned nodes/a>, if any, and its contents otherwise./p> p>The dfn idattr-slot-name>code>name/code>/dfn> content attribute may contain any string value. It represents a a hrefhttps://dom.spec.whatwg.org/#concept-slot idthe-slot-element:concept-slot-2 data-x-internalconcept-slot>slot/a>s a hrefhttps://dom.spec.whatwg.org/#slot-name idthe-slot-element:slot-name data-x-internalslot-name>name/a>./p> p classnote>The code idthe-slot-element:attr-slot-name-2>a href#attr-slot-name>name/a>/code> attribute is used to a hrefhttps://dom.spec.whatwg.org/#assign-a-slot idthe-slot-element:assign-a-slot data-x-internalassign-a-slot>assign slots/a> to other elements: a code idthe-slot-element:the-slot-element-3>a href#the-slot-element>slot/a>/code> element with a code idthe-slot-element:attr-slot-name-3>a href#attr-slot-name>name/a>/code> attribute creates a named a hrefhttps://dom.spec.whatwg.org/#concept-slot idthe-slot-element:concept-slot-3 data-x-internalconcept-slot>slot/a> to which any element is a hrefhttps://dom.spec.whatwg.org/#assign-a-slot idthe-slot-element:assign-a-slot-2 data-x-internalassign-a-slot>assigned/a> if that element has a code idthe-slot-element:attr-slot>a href#attr-slot>slot/a>/code> attribute whose value matches that code idthe-slot-element:attr-slot-name-4>a href#attr-slot-name>name/a>/code> attributes value, and the code idthe-slot-element:the-slot-element-4>a href#the-slot-element>slot/a>/code> element is a child of the a idthe-slot-element:shadow-tree-2 hrefhttps://dom.spec.whatwg.org/#concept-shadow-tree data-x-internalshadow-tree>shadow tree/a> whose a idthe-slot-element:root hrefhttps://dom.spec.whatwg.org/#concept-tree-root data-x-internalroot>root/a>s a hrefhttps://dom.spec.whatwg.org/#concept-documentfragment-host idthe-slot-element:concept-documentfragment-host data-x-internalconcept-documentfragment-host>host/a> has that corresponding code idthe-slot-element:attr-slot-2>a href#attr-slot>slot/a>/code> attribute value./p> dl classdomintro>dt>var>slot/var> . code idthe-slot-element:dom-slot-name-2>a href#dom-slot-name>name/a>/code>dd>Can be used to get and set var>slot/var>s a hrefhttps://dom.spec.whatwg.org/#slot-name idthe-slot-element:slot-name-2 data-x-internalslot-name>name/a>.dt>var>slot/var> . code idthe-slot-element:dom-slot-assignednodes-2>a href#dom-slot-assignednodes>assignedNodes/a>/code>()dd>Returns var>slot/var>s a idthe-slot-element:assigned-nodes-2 hrefhttps://dom.spec.whatwg.org/#slot-assigned-nodes data-x-internalassigned-nodes>assigned nodes/a>.dt>var>slot/var> . code idthe-slot-element:dom-slot-assignednodes-3>a href#dom-slot-assignednodes>assignedNodes/a>/code>({ flatten: true })dd>Returns var>slot/var>s a idthe-slot-element:assigned-nodes-3 hrefhttps://dom.spec.whatwg.org/#slot-assigned-nodes data-x-internalassigned-nodes>assigned nodes/a>, if any, and var>slot/var>s children otherwise, and does the same for any code idthe-slot-element:the-slot-element-5>a href#the-slot-element>slot/a>/code> elements encountered therein, recursively, until there are no code idthe-slot-element:the-slot-element-6>a href#the-slot-element>slot/a>/code> elements left./dl> p>The dfn iddom-slot-name>code>name/code>/dfn> IDL attribute must a href#reflect idthe-slot-element:reflect>reflect/a> the content attribute of the same name./p> p>The dfn iddom-slot-assignednodes>code>assignedNodes(var>options/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If the value of var>options/var>s code>flatten/code> member is false, then return this elements a idthe-slot-element:assigned-nodes-4 hrefhttps://dom.spec.whatwg.org/#slot-assigned-nodes data-x-internalassigned-nodes>assigned nodes/a>.li>p>Return the result of a idthe-slot-element:finding-flattened-slotables hrefhttps://dom.spec.whatwg.org/#find-flattened-slotables data-x-internalfinding-flattened-slotables>finding flattened slotables/a> with this element./ol> h4 idthe-canvas-element>span classsecno>4.12.5/span> The dfn idcanvas>code>canvas/code>/dfn> elementa href#the-canvas-element classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> canvasspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>3.2+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>3.6+/span>/span>span classie yes>span>IE/span> span>9+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini partial>span>Opera Mini (limited)/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>4+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>3+/span>/span>span classopera yes>span>Opera/span> span>9+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featcanvas>caniuse.com/a>/div> dl classelement>dt>a href#concept-element-categories idthe-canvas-element:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idthe-canvas-element:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idthe-canvas-element:phrasing-content-2>Phrasing content/a>.dd>a href#embedded-content-category idthe-canvas-element:embedded-content-category>Embedded content/a>.dd>a href#palpable-content-2 idthe-canvas-element:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idthe-canvas-element:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#embedded-content-category idthe-canvas-element:embedded-content-category-2>embedded content/a> is expected.dt>a href#concept-element-content-model idthe-canvas-element:concept-element-content-model>Content model/a>:dd>a href#transparent idthe-canvas-element:transparent>Transparent/a>, but with no a href#interactive-content-2 idthe-canvas-element:interactive-content-2>interactive content/a> descendants except for code idthe-canvas-element:the-a-element>a href#the-a-element>a/a>/code> elements, code idthe-canvas-element:the-img-element>a href#the-img-element>img/a>/code> elements with code idthe-canvas-element:attr-hyperlink-usemap>a href#attr-hyperlink-usemap>usemap/a>/code> attributes, code idthe-canvas-element:the-button-element>a href#the-button-element>button/a>/code> elements, code idthe-canvas-element:the-input-element>a href#the-input-element>input/a>/code> elements whose code idthe-canvas-element:attr-input-type>a href#attr-input-type>type/a>/code> attribute are in the a href#checkbox-state-(typecheckbox) idthe-canvas-element:checkbox-state-(typecheckbox)>Checkbox/a> or a href#radio-button-state-(typeradio) idthe-canvas-element:radio-button-state-(typeradio)>Radio Button/a> states, code idthe-canvas-element:the-input-element-2>a href#the-input-element>input/a>/code> elements that are a href#concept-button idthe-canvas-element:concept-button>buttons/a>, code idthe-canvas-element:the-select-element>a href#the-select-element>select/a>/code> elements with a code idthe-canvas-element:attr-select-multiple>a href#attr-select-multiple>multiple/a>/code> attribute or a a href#concept-select-size idthe-canvas-element:concept-select-size>display size/a> greater than 1, and elements that would not be a href#interactive-content-2 idthe-canvas-element:interactive-content-2-2>interactive content/a> except for having the code idthe-canvas-element:attr-tabindex>a href#attr-tabindex>tabindex/a>/code> attribute specified.dt>a href#concept-element-tag-omission idthe-canvas-element:concept-element-tag-omission>Tag omission in text/html/a>:dd>Neither tag is omissible.dt>a href#concept-element-attributes idthe-canvas-element:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idthe-canvas-element:global-attributes>Global attributes/a>dd>code idthe-canvas-element:attr-canvas-width>a href#attr-canvas-width>width/a>/code> — Horizontal dimensiondd>code idthe-canvas-element:attr-canvas-height>a href#attr-canvas-height>height/a>/code> — Vertical dimensiondt>a href#concept-element-dom idthe-canvas-element:concept-element-dom>DOM interface/a>:dd> pre classidl>typedef (a href#canvasrenderingcontext2d idthe-canvas-element:canvasrenderingcontext2d>CanvasRenderingContext2D/a> or a idthe-canvas-element:webglrenderingcontext hrefhttps://www.khronos.org/registry/webgl/specs/latest/1.0/#WebGLRenderingContext data-x-internalwebglrenderingcontext>WebGLRenderingContext/a>) dfn idrenderingcontext>RenderingContext/dfn>;ExposedWindow, a href#htmlconstructor idthe-canvas-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlcanvaselement>HTMLCanvasElement/dfn> : a href#htmlelement idthe-canvas-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-canvas-element:cereactions>CEReactions/a> attribute unsigned long a href#dom-canvas-width idthe-canvas-element:dom-canvas-width>width/a>; a href#cereactions idthe-canvas-element:cereactions-2>CEReactions/a> attribute unsigned long a href#dom-canvas-height idthe-canvas-element:dom-canvas-height>height/a>; a href#renderingcontext idthe-canvas-element:renderingcontext>RenderingContext/a>? a href#dom-canvas-getcontext idthe-canvas-element:dom-canvas-getcontext>getContext/a>(DOMString contextId, any... arguments); USVString a href#dom-canvas-todataurl idthe-canvas-element:dom-canvas-todataurl>toDataURL/a>(optional DOMString type, optional any quality); void a href#dom-canvas-toblob idthe-canvas-element:dom-canvas-toblob>toBlob/a>(a href#blobcallback idthe-canvas-element:blobcallback>BlobCallback/a> _callback, optional DOMString type, optional any quality); a href#offscreencanvas idthe-canvas-element:offscreencanvas>OffscreenCanvas/a> a href#dom-canvas-transfercontroltooffscreen idthe-canvas-element:dom-canvas-transfercontroltooffscreen>transferControlToOffscreen/a>();};callback dfn idblobcallback>BlobCallback/dfn> void (a idthe-canvas-element:blob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob data-x-internalblob>Blob/a>? blob);/pre> /dl> p>The code idthe-canvas-element:the-canvas-element>a href#the-canvas-element>canvas/a>/code> element provides scripts with a resolution-dependent bitmap canvas, which can be used for rendering graphs, game graphics, art, or other visual images on the fly./p> p>Authors should not use the code idthe-canvas-element:the-canvas-element-2>a href#the-canvas-element>canvas/a>/code> element in a document when a more suitable element is available. For example, it is inappropriate to use a code idthe-canvas-element:the-canvas-element-3>a href#the-canvas-element>canvas/a>/code> element to render a page heading: if the desired presentation of the heading is graphically intense, it should be marked up using appropriate elements (typically code idthe-canvas-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code>) and then styled using CSS and supporting technologies such as a hrefhttps://dom.spec.whatwg.org/#concept-shadow-tree idthe-canvas-element:shadow-tree data-x-internalshadow-tree>shadow trees/a>./p> p>When authors use the code idthe-canvas-element:the-canvas-element-4>a href#the-canvas-element>canvas/a>/code> element, they must also provide content that, when presented to the user, conveys essentially the same function or purpose as the code idthe-canvas-element:the-canvas-element-5>a href#the-canvas-element>canvas/a>/code>s bitmap. This content may be placed as content of the code idthe-canvas-element:the-canvas-element-6>a href#the-canvas-element>canvas/a>/code> element. The contents of the code idthe-canvas-element:the-canvas-element-7>a href#the-canvas-element>canvas/a>/code> element, if any, are the elements a href#fallback-content idthe-canvas-element:fallback-content>fallback content/a>./p> hr> p>In interactive visual media, if a href#concept-n-script idthe-canvas-element:concept-n-script>scripting is enabled/a> for the code idthe-canvas-element:the-canvas-element-8>a href#the-canvas-element>canvas/a>/code> element, and if support for code idthe-canvas-element:the-canvas-element-9>a href#the-canvas-element>canvas/a>/code> elements has been enabled, then the code idthe-canvas-element:the-canvas-element-10>a href#the-canvas-element>canvas/a>/code> element a href#represents idthe-canvas-element:represents>represents/a> a href#embedded-content-category idthe-canvas-element:embedded-content-category-3>embedded content/a> consisting of a dynamically created image, the elements bitmap./p> p>In non-interactive, static, visual media, if the code idthe-canvas-element:the-canvas-element-11>a href#the-canvas-element>canvas/a>/code> element has been previously associated with a rendering context (e.g. if the page was viewed in an interactive visual medium and is now being printed, or if some script that ran during the page layout process painted on the element), then the code idthe-canvas-element:the-canvas-element-12>a href#the-canvas-element>canvas/a>/code> element a href#represents idthe-canvas-element:represents-2>represents/a> a href#embedded-content-category idthe-canvas-element:embedded-content-category-4>embedded content/a> with the elements current bitmap and size. Otherwise, the element represents its a href#fallback-content idthe-canvas-element:fallback-content-2>fallback content/a> instead./p> p>In non-visual media, and in visual media if a href#concept-n-noscript idthe-canvas-element:concept-n-noscript>scripting is disabled/a> for the code idthe-canvas-element:the-canvas-element-13>a href#the-canvas-element>canvas/a>/code> element or if support for code idthe-canvas-element:the-canvas-element-14>a href#the-canvas-element>canvas/a>/code> elements has been disabled, the code idthe-canvas-element:the-canvas-element-15>a href#the-canvas-element>canvas/a>/code> element a href#represents idthe-canvas-element:represents-3>represents/a> its a href#fallback-content idthe-canvas-element:fallback-content-3>fallback content/a> instead./p> p>When a code idthe-canvas-element:the-canvas-element-16>a href#the-canvas-element>canvas/a>/code> element a href#represents idthe-canvas-element:represents-4>represents/a> a href#embedded-content-category idthe-canvas-element:embedded-content-category-5>embedded content/a>, the user can still focus descendants of the code idthe-canvas-element:the-canvas-element-17>a href#the-canvas-element>canvas/a>/code> element (in the a href#fallback-content idthe-canvas-element:fallback-content-4>fallback content/a>). When an element is a href#focused idthe-canvas-element:focused>focused/a>, it is the target of keyboard interaction events (even though the element itself is not visible). This allows authors to make an interactive canvas keyboard-accessible: authors should have a one-to-one mapping of interactive regions to i idthe-canvas-element:focusable-area>a href#focusable-area>focusable areas/a>/i> in the a href#fallback-content idthe-canvas-element:fallback-content-5>fallback content/a>. (Focus has no effect on mouse interaction events.) a href#refsUIEVENTS>UIEVENTS/a>/p> p>An element whose nearest code idthe-canvas-element:the-canvas-element-18>a href#the-canvas-element>canvas/a>/code> element ancestor is a href#being-rendered idthe-canvas-element:being-rendered>being rendered/a> and a href#represents idthe-canvas-element:represents-5>represents/a> a href#embedded-content-category idthe-canvas-element:embedded-content-category-6>embedded content/a> is an element that is dfn idbeing-used-as-relevant-canvas-fallback-content>being used as relevant canvas fallback content/dfn>./p> hr> p>The code idthe-canvas-element:the-canvas-element-19>a href#the-canvas-element>canvas/a>/code> element has two attributes to control the size of the elements bitmap: dfn idattr-canvas-width>code>width/code>/dfn> and dfn idattr-canvas-height>code>height/code>/dfn>. These attributes, when specified, must have values that are a href#valid-non-negative-integer idthe-canvas-element:valid-non-negative-integer>valid non-negative integers/a>. The a href#rules-for-parsing-non-negative-integers idthe-canvas-element:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers/a> must be used to obtain their numeric values. If an attribute is missing, or if parsing its value returns an error, then the default value must be used instead. The code idthe-canvas-element:attr-canvas-width-2>a href#attr-canvas-width>width/a>/code> attribute defaults to 300, and the code idthe-canvas-element:attr-canvas-height-2>a href#attr-canvas-height>height/a>/code> attribute defaults to 150./p> p>When setting the value of the code idthe-canvas-element:attr-canvas-width-3>a href#attr-canvas-width>width/a>/code> or code idthe-canvas-element:attr-canvas-height-3>a href#attr-canvas-height>height/a>/code> attribute, if the a href#concept-canvas-context-mode idthe-canvas-element:concept-canvas-context-mode>context mode/a> of the code idthe-canvas-element:the-canvas-element-20>a href#the-canvas-element>canvas/a>/code> element is set to a href#concept-canvas-placeholder idthe-canvas-element:concept-canvas-placeholder>placeholder/a>, the user agent must throw an a idthe-canvas-element:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idthe-canvas-element:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and leave the attributes value unchanged./p> p>The a idthe-canvas-element:intrinsic-dimensions hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic data-x-internalintrinsic-dimensions>intrinsic dimensions/a> of the code idthe-canvas-element:the-canvas-element-21>a href#the-canvas-element>canvas/a>/code> element when it a href#represents idthe-canvas-element:represents-6>represents/a> a href#embedded-content-category idthe-canvas-element:embedded-content-category-7>embedded content/a> are equal to the dimensions of the elements bitmap./p> p>The user agent must use a square pixel density consisting of one pixel of image data per coordinate space unit for the bitmaps of a code idthe-canvas-element:the-canvas-element-22>a href#the-canvas-element>canvas/a>/code> and its rendering contexts./p> p classnote>A code idthe-canvas-element:the-canvas-element-23>a href#the-canvas-element>canvas/a>/code> element can be sized arbitrarily by a style sheet, its bitmap is then subject to the a idthe-canvas-element:object-fit hrefhttps://drafts.csswg.org/css-images/#the-object-fit data-x-internalobject-fit>object-fit/a> CSS property./p> hr> p>The bitmaps of code idthe-canvas-element:the-canvas-element-24>a href#the-canvas-element>canvas/a>/code> elements, the bitmaps of code idthe-canvas-element:imagebitmap>a href#imagebitmap>ImageBitmap/a>/code> objects, as well as some of the bitmaps of rendering contexts, such as those described in the sections on the code idthe-canvas-element:canvasrenderingcontext2d-2>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> and code idthe-canvas-element:imagebitmaprenderingcontext>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code> objects below, have an dfn idconcept-canvas-origin-clean>origin-clean/dfn> flag, which can be set to true or false. Initially, when the code idthe-canvas-element:the-canvas-element-25>a href#the-canvas-element>canvas/a>/code> element or code idthe-canvas-element:imagebitmap-2>a href#imagebitmap>ImageBitmap/a>/code> object is created, its bitmaps a href#concept-canvas-origin-clean idthe-canvas-element:concept-canvas-origin-clean>origin-clean/a> flag must be set to true./p> p>A code idthe-canvas-element:the-canvas-element-26>a href#the-canvas-element>canvas/a>/code> element can have a rendering context bound to it. Initially, it does not have a bound rendering context. To keep track of whether it has a rendering context or not, and what kind of rendering context it is, a code idthe-canvas-element:the-canvas-element-27>a href#the-canvas-element>canvas/a>/code> also has a dfn idconcept-canvas-context-mode>canvas context mode/dfn>, which is initially dfn idconcept-canvas-none>none/dfn> but can be changed to either dfn idconcept-canvas-placeholder>placeholder/dfn>, dfn idconcept-canvas-2d>2d/dfn>, dfn idconcept-canvas-bitmaprenderer>bitmaprenderer/dfn>, or dfn idconcept-canvas-webgl>webgl/dfn> by algorithms defined in this specification./p> p>When its a href#concept-canvas-context-mode idthe-canvas-element:concept-canvas-context-mode-2>canvas context mode/a> is a href#concept-canvas-none idthe-canvas-element:concept-canvas-none>none/a>, a code idthe-canvas-element:the-canvas-element-28>a href#the-canvas-element>canvas/a>/code> element has no rendering context, and its bitmap must be a href#transparent-black idthe-canvas-element:transparent-black>transparent black/a> with an a href#intrinsic-width idthe-canvas-element:intrinsic-width>intrinsic width/a> equal to the numeric value of the elements code idthe-canvas-element:attr-canvas-width-4>a href#attr-canvas-width>width/a>/code> attribute and an a href#intrinsic-height idthe-canvas-element:intrinsic-height>intrinsic height/a> equal to the numeric value of the elements code idthe-canvas-element:attr-canvas-height-4>a href#attr-canvas-height>height/a>/code> attribute, those values being interpreted in a hrefhttps://drafts.csswg.org/css-values/#px idthe-canvas-element:px data-x-internalpx>CSS pixels/a>, and being updated as the attributes are set, changed, or removed./p> p>When its a href#concept-canvas-context-mode idthe-canvas-element:concept-canvas-context-mode-3>canvas context mode/a> is a href#concept-canvas-placeholder idthe-canvas-element:concept-canvas-placeholder-2>placeholder/a>, a code idthe-canvas-element:the-canvas-element-29>a href#the-canvas-element>canvas/a>/code> element has no rendering context. It serves as a placeholder for an code idthe-canvas-element:offscreencanvas-2>a href#offscreencanvas>OffscreenCanvas/a>/code> object, and the content of the code idthe-canvas-element:the-canvas-element-30>a href#the-canvas-element>canvas/a>/code> element is updated by calling the code idthe-canvas-element:offscreencontext-commit>a href#offscreencontext-commit>commit()/a>/code> method of the code idthe-canvas-element:offscreencanvas-3>a href#offscreencanvas>OffscreenCanvas/a>/code> objects rendering context./p> p>When a code idthe-canvas-element:the-canvas-element-31>a href#the-canvas-element>canvas/a>/code> element represents a href#embedded-content-category idthe-canvas-element:embedded-content-category-8>embedded content/a>, it provides a a idthe-canvas-element:paint-source hrefhttps://drafts.csswg.org/css-images-4/#paint-source data-x-internalpaint-source>paint source/a> whose width is the elements a href#intrinsic-width idthe-canvas-element:intrinsic-width-2>intrinsic width/a>, whose height is the elements a href#intrinsic-height idthe-canvas-element:intrinsic-height-2>intrinsic height/a>, and whose appearance is the elements bitmap./p> p>Whenever the code idthe-canvas-element:attr-canvas-width-5>a href#attr-canvas-width>width/a>/code> and code idthe-canvas-element:attr-canvas-height-5>a href#attr-canvas-height>height/a>/code> content attributes are set, removed, changed, or redundantly set to the value they already have, then the user agent must perform the action from the row of the following table that corresponds to the code idthe-canvas-element:the-canvas-element-32>a href#the-canvas-element>canvas/a>/code> elements a href#concept-canvas-context-mode idthe-canvas-element:concept-canvas-context-mode-4>context mode/a>./p> table>thead>tr>th> p>a href#concept-canvas-context-mode idthe-canvas-element:concept-canvas-context-mode-5>Context Mode/a>/p> th> p>Action/p> tbody>tr>th> p>a href#concept-canvas-2d idthe-canvas-element:concept-canvas-2d>2d/a>/p> td> p>Follow the steps to a href#concept-canvas-set-bitmap-dimensions idthe-canvas-element:concept-canvas-set-bitmap-dimensions>set bitmap dimensions/a> to the numeric values of the code idthe-canvas-element:attr-canvas-width-6>a href#attr-canvas-width>width/a>/code> and code idthe-canvas-element:attr-canvas-height-6>a href#attr-canvas-height>height/a>/code> content attributes./p> tr>th> p>a href#concept-canvas-webgl idthe-canvas-element:concept-canvas-webgl>webgl/a>/p> td> p>Follow the behavior defined in the WebGL specification. a href#refsWEBGL>WEBGL/a>/p> tr>th> p>a href#concept-canvas-bitmaprenderer idthe-canvas-element:concept-canvas-bitmaprenderer>bitmaprenderer/a>/p> td> p>If the contexts a href#concept-imagebitmaprenderingcontext-bitmap-mode idthe-canvas-element:concept-imagebitmaprenderingcontext-bitmap-mode>bitmap mode/a> is set to a href#concept-imagebitmaprenderingcontext-blank idthe-canvas-element:concept-imagebitmaprenderingcontext-blank>blank/a>, run the steps to a href#set-an-imagebitmaprenderingcontexts-output-bitmap idthe-canvas-element:set-an-imagebitmaprenderingcontexts-output-bitmap>set an code>ImageBitmapRenderingContext/code>s output bitmap/a>, passing the code idthe-canvas-element:the-canvas-element-33>a href#the-canvas-element>canvas/a>/code> elements rendering context./p> tr>th> p>a href#concept-canvas-placeholder idthe-canvas-element:concept-canvas-placeholder-3>placeholder/a>/p> td> p>Do nothing./p> tr>th> p>a href#concept-canvas-none idthe-canvas-element:concept-canvas-none-2>none/a>/p> td> p>Do nothing./p> /table> p>The dfn iddom-canvas-width>code>width/code>/dfn> and dfn iddom-canvas-height>code>height/code>/dfn> IDL attributes must a href#reflect idthe-canvas-element:reflect>reflect/a> the respective content attributes of the same name, with the same defaults./p> hr> dl classdomintro>dt>var>context/var> var>canvas/var> . code idthe-canvas-element:dom-canvas-getcontext-2>a href#dom-canvas-getcontext>getContext/a>/code>(var>contextId/var> , ... )dd> p>Returns an object that exposes an API for drawing on the canvas. The first argument specifies the desired API, either code idthe-canvas-element:canvas-context-2d>a href#canvas-context-2d>2d/a>/code>, code idthe-canvas-element:canvas-context-bitmaprenderer>a href#canvas-context-bitmaprenderer>bitmaprenderer/a>/code> or code idthe-canvas-element:canvas-context-webgl>a href#canvas-context-webgl>webgl/a>/code>. Subsequent arguments are handled by that API./p> p>This specification defines the code idthe-canvas-element:canvas-context-2d-2>a href#canvas-context-2d>2d/a>/code> and code idthe-canvas-element:canvas-context-bitmaprenderer-2>a href#canvas-context-bitmaprenderer>bitmaprenderer/a>/code> contexts below. There is also a specification that defines a code idthe-canvas-element:canvas-context-webgl-2>a href#canvas-context-webgl>webgl/a>/code> context. a href#refsWEBGL>WEBGL/a>/p> p>Returns null if the given context ID is not supported, or if the canvas has already been initialized with another context type (e.g. trying to get a code idthe-canvas-element:canvas-context-2d-3>a href#canvas-context-2d>2d/a>/code> context after getting a code idthe-canvas-element:canvas-context-webgl-3>a href#canvas-context-webgl>webgl/a>/code> context)./p> /dl> p>The dfn iddom-canvas-getcontext>code>getContext(var>contextId/var>, var>arguments.../var>)/code>/dfn> method of the code idthe-canvas-element:the-canvas-element-34>a href#the-canvas-element>canvas/a>/code> element, when invoked, must run the steps in the cell of the following table whose column header describes the code idthe-canvas-element:the-canvas-element-35>a href#the-canvas-element>canvas/a>/code> elements a href#concept-canvas-context-mode idthe-canvas-element:concept-canvas-context-mode-6>canvas context mode/a> and whose row header describes the methods first argument./p> table>thead>tr>td> th>a href#concept-canvas-none idthe-canvas-element:concept-canvas-none-3>none/a> th>a href#concept-canvas-2d idthe-canvas-element:concept-canvas-2d-2>2d/a> th>a href#concept-canvas-bitmaprenderer idthe-canvas-element:concept-canvas-bitmaprenderer-2>bitmaprenderer/a> th>a href#concept-canvas-webgl idthe-canvas-element:concept-canvas-webgl-2>webgl/a> th>a href#concept-canvas-placeholder idthe-canvas-element:concept-canvas-placeholder-4>placeholder/a> tbody>tr>th>dfn idcanvas-context-2d>code>2d/code>/dfn> td> Follow the a href#2d-context-creation-algorithm idthe-canvas-element:2d-context-creation-algorithm>2D context creation algorithm/a> defined in the section below, passing it the code idthe-canvas-element:the-canvas-element-36>a href#the-canvas-element>canvas/a>/code> element and the methods var>arguments.../var>, to obtain a code idthe-canvas-element:canvasrenderingcontext2d-3>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> object; if this does not throw an exception, then set the code idthe-canvas-element:the-canvas-element-37>a href#the-canvas-element>canvas/a>/code> elements a href#concept-canvas-context-mode idthe-canvas-element:concept-canvas-context-mode-7>context mode/a> to a href#concept-canvas-2d idthe-canvas-element:concept-canvas-2d-3>2d/a>, and return the code idthe-canvas-element:canvasrenderingcontext2d-4>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> object. td> Return the same object as was returned the last time the method was invoked with this same first argument. td> Return null. td> Return null. td> Throw an a idthe-canvas-element:invalidstateerror-2 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idthe-canvas-element:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>. tr>th>dfn idcanvas-context-bitmaprenderer>code>bitmaprenderer/code>/dfn> td> Follow the a href#imagebitmaprenderingcontext-creation-algorithm idthe-canvas-element:imagebitmaprenderingcontext-creation-algorithm>code>ImageBitmapRenderingContext/code> creation algorithm/a> defined in the section below, passing it the code idthe-canvas-element:the-canvas-element-38>a href#the-canvas-element>canvas/a>/code> element and the methods var>arguments.../var>, to obtain an code idthe-canvas-element:imagebitmaprenderingcontext-2>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code> object; then set the code idthe-canvas-element:the-canvas-element-39>a href#the-canvas-element>canvas/a>/code> elements a href#concept-canvas-context-mode idthe-canvas-element:concept-canvas-context-mode-8>context mode/a> to a href#concept-canvas-bitmaprenderer idthe-canvas-element:concept-canvas-bitmaprenderer-3>bitmaprenderer/a>, and return the code idthe-canvas-element:imagebitmaprenderingcontext-3>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code> object. td> Return null. td> Return the same object as was returned the last time the method was invoked with this same first argument. td> Return null. td> Throw an a idthe-canvas-element:invalidstateerror-3 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idthe-canvas-element:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>. tr>th>dfn idcanvas-context-webgl>code>webgl/code>/dfn>, if the user agent supports the WebGL feature in its current configuration td> Follow the instructions given in the WebGL specifications i>Context Creation/i> section to obtain either a code idthe-canvas-element:webglrenderingcontext-2>a data-x-internalwebglrenderingcontext hrefhttps://www.khronos.org/registry/webgl/specs/latest/1.0/#WebGLRenderingContext>WebGLRenderingContext/a>/code> or null; if the returned value is null, then return null and abort these steps, otherwise, set the code idthe-canvas-element:the-canvas-element-40>a href#the-canvas-element>canvas/a>/code> elements a href#concept-canvas-context-mode idthe-canvas-element:concept-canvas-context-mode-9>context mode/a> to a href#concept-canvas-webgl idthe-canvas-element:concept-canvas-webgl-3>webgl/a>, and return the code idthe-canvas-element:webglrenderingcontext-3>a data-x-internalwebglrenderingcontext hrefhttps://www.khronos.org/registry/webgl/specs/latest/1.0/#WebGLRenderingContext>WebGLRenderingContext/a>/code> object a href#refsWEBGL>WEBGL/a> td> Return null. td> Return null. td> Return the same object as was returned the last time the method was invoked with this same first argument. td> Throw an a idthe-canvas-element:invalidstateerror-4 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idthe-canvas-element:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>. tr>th>An unsupported value* td> Return null. td> Return null. td> Return null. td> Return null. td> Throw an a idthe-canvas-element:invalidstateerror-5 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idthe-canvas-element:domexception-5>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>. /table> p classtablenote>small>* For example, the code idthe-canvas-element:canvas-context-webgl-4>a href#canvas-context-webgl>webgl/a>/code> value in the case of a user agent having exhausted the graphics hardwares abilities and having no software fallback implementation./small>/p> hr> dl classdomintro>dt>var>url/var> var>canvas/var> . code idthe-canvas-element:dom-canvas-todataurl-2>a href#dom-canvas-todataurl>toDataURL/a>/code>( var>type/var> , var>quality/var> )dd> p>Returns a a hrefhttps://tools.ietf.org/html/rfc2397#section-2 idthe-canvas-element:data-protocol data-x-internaldata-protocol>code>data:/code> URL/a> for the image in the canvas./p> p>The first argument, if provided, controls the type of the image to be returned (e.g. PNG or JPEG). The default is code idthe-canvas-element:image/png>a href#image/png>image/png/a>/code>; that type is also used if the given type isnt supported. The second argument applies if the type is an image format that supports variable quality (such as code idthe-canvas-element:image/jpeg>a href#image/jpeg>image/jpeg/a>/code>), and is a number in the range 0.0 to 1.0 inclusive indicating the desired quality level for the resulting image./p> p>When trying to use types other than code idthe-canvas-element:image/png-2>a href#image/png>image/png/a>/code>, authors can check if the image was really returned in the requested format by checking to see if the returned string starts with one of the exact strings code>data:image/png,/code> or code>data:image/png;/code>. If it does, the image is PNG, and thus the requested type was not supported. (The one exception to this is if the canvas has either no height or no width, in which case the result might simply be code>data:,/code>.)/p> dt>var>canvas/var> . code idthe-canvas-element:dom-canvas-toblob-2>a href#dom-canvas-toblob>toBlob/a>/code>(var>callback/var> , var>type/var> , quality )dd> p>Creates a code idthe-canvas-element:blob-2>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> object representing a file containing the image in the canvas, and invokes a callback with a handle to that object./p> p>The second argument, if provided, controls the type of the image to be returned (e.g. PNG or JPEG). The default is code idthe-canvas-element:image/png-3>a href#image/png>image/png/a>/code>; that type is also used if the given type isnt supported. The third argument applies if the type is an image format that supports variable quality (such as code idthe-canvas-element:image/jpeg-2>a href#image/jpeg>image/jpeg/a>/code>), and is a number in the range 0.0 to 1.0 inclusive indicating the desired quality level for the resulting image./p> dt>var>canvas/var> . code idthe-canvas-element:dom-canvas-transfercontroltooffscreen-2>a href#dom-canvas-transfercontroltooffscreen>transferControlToOffscreen/a>/code>()dd> p>Returns a newly created code idthe-canvas-element:offscreencanvas-4>a href#offscreencanvas>OffscreenCanvas/a>/code> object that uses the code idthe-canvas-element:the-canvas-element-41>a href#the-canvas-element>canvas/a>/code> element as a placeholder. Once the code idthe-canvas-element:the-canvas-element-42>a href#the-canvas-element>canvas/a>/code> element has become a placeholder for an code idthe-canvas-element:offscreencanvas-5>a href#offscreencanvas>OffscreenCanvas/a>/code> object, its intrinsic size can no longer be changed, and it cannot have a rendering context. The content of the placeholder canvas is updated by calling the code idthe-canvas-element:offscreencontext-commit-2>a href#offscreencontext-commit>commit()/a>/code> method of the code idthe-canvas-element:offscreencanvas-6>a href#offscreencanvas>OffscreenCanvas/a>/code> objects rendering context. /p> /dl> p>The dfn iddom-canvas-todataurl>code>toDataURL(var>type/var>, var>quality/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If this code idthe-canvas-element:the-canvas-element-43>a href#the-canvas-element>canvas/a>/code> elements bitmaps a href#concept-canvas-origin-clean idthe-canvas-element:concept-canvas-origin-clean-2>origin-clean/a> flag is set to false, then throw a a idthe-canvas-element:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-canvas-element:domexception-6>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps./p> li>p>If this code idthe-canvas-element:the-canvas-element-44>a href#the-canvas-element>canvas/a>/code> elements bitmap has no pixels (i.e. either its horizontal dimension or its vertical dimension is zero) then return the string code>data:,/code> and abort these steps. (This is the shortest a hrefhttps://tools.ietf.org/html/rfc2397#section-2 idthe-canvas-element:data-protocol-2 data-x-internaldata-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 idthe-canvas-element:a-serialisation-of-the-bitmap-as-a-file>a serialization of this code>canvas/code> elements bitmap as a file/a>, passing var>type/var> and var>quality/var> if they were given.li>p>If var>file/var> is null then return code>data:,/code>.li>p>Return a a hrefhttps://tools.ietf.org/html/rfc2397#section-2 idthe-canvas-element:data-protocol-3 data-x-internaldata-protocol>code>data:/code> URL/a> representing var>file/var>. a href#refsRFC2397>RFC2397/a>/p> /ol> p>The dfn iddom-canvas-toblob>code>toBlob(var>callback/var>, var>type/var>, var>quality/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If this code idthe-canvas-element:the-canvas-element-45>a href#the-canvas-element>canvas/a>/code> elements bitmaps a href#concept-canvas-origin-clean idthe-canvas-element:concept-canvas-origin-clean-3>origin-clean/a> flag is set to false, then throw a a idthe-canvas-element:securityerror-2 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-canvas-element:domexception-7>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps./p> li> p>If this code idthe-canvas-element:the-canvas-element-46>a href#the-canvas-element>canvas/a>/code> elements bitmap has no pixels (i.e. either its horizontal dimension or its vertical dimension is zero) then let var>result/var> be null./p> p>Otherwise, let var>result/var> be a code idthe-canvas-element:blob-3>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> object representing a href#a-serialisation-of-the-bitmap-as-a-file idthe-canvas-element:a-serialisation-of-the-bitmap-as-a-file-2>a serialization of this code>canvas/code> elements bitmap as a file/a>, passing var>type/var> and var>quality/var> if they were given. a href#refsFILEAPI>FILEAPI/a>/p> li>p>Return, but continue running these steps a href#in-parallel idthe-canvas-element:in-parallel>in parallel/a>.li>p>a href#queue-a-task idthe-canvas-element:queue-a-task>Queue a task/a> to a hrefhttps://heycam.github.io/webidl/#invoke-a-callback-function idthe-canvas-element:es-invoking-callback-functions data-x-internales-invoking-callback-functions>invoke/a> the code idthe-canvas-element:blobcallback-2>a href#blobcallback>BlobCallback/a>/code> var>callback/var> with var>result/var> as its argument. The a href#task-source idthe-canvas-element:task-source>task source/a> for this task is the dfn idcanvas-blob-serialisation-task-source>canvas blob serialization task source/dfn>./ol> p>The dfn iddom-canvas-transfercontroltooffscreen>code>transferControlToOffscreen()/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If this code idthe-canvas-element:the-canvas-element-47>a href#the-canvas-element>canvas/a>/code> elements a href#concept-canvas-context-mode idthe-canvas-element:concept-canvas-context-mode-10>context mode/a> is not set to a href#concept-canvas-none idthe-canvas-element:concept-canvas-none-4>none/a>, throw an a idthe-canvas-element:invalidstateerror-6 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idthe-canvas-element:domexception-8>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Let var>offscreenCanvas/var> be a new code idthe-canvas-element:offscreencanvas-7>a href#offscreencanvas>OffscreenCanvas/a>/code> object with its width and height equal to the values of the code idthe-canvas-element:attr-canvas-width-7>a href#attr-canvas-width>width/a>/code> and code idthe-canvas-element:attr-canvas-height-7>a href#attr-canvas-height>height/a>/code> content attributes of this code idthe-canvas-element:the-canvas-element-48>a href#the-canvas-element>canvas/a>/code> element.li>p>Set the a href#offscreencanvas-placeholder idthe-canvas-element:offscreencanvas-placeholder>placeholder code>canvas/code> element/a> of var>offscreenCanvas/var> to be a weak reference to this code idthe-canvas-element:the-canvas-element-49>a href#the-canvas-element>canvas/a>/code> element.li>p>Set this code idthe-canvas-element:the-canvas-element-50>a href#the-canvas-element>canvas/a>/code> elements a href#concept-canvas-context-mode idthe-canvas-element:concept-canvas-context-mode-11>context mode/a> to a href#concept-canvas-placeholder idthe-canvas-element:concept-canvas-placeholder-5>placeholder/a>.li>p>Return var>offscreenCanvas/var>./ol> h5 id2dcontext>span classsecno>4.12.5.1/span> The 2D rendering contexta href#2dcontext classself-link>/a>/h5> pre classidl>typedef (a href#htmlimageelement id2dcontext:htmlimageelement>HTMLImageElement/a> or a id2dcontext:svgimageelement hrefhttps://www.w3.org/TR/SVG11/struct.html#InterfaceSVGImageElement data-x-internalsvgimageelement>SVGImageElement/a>) dfn idhtmlorsvgimageelement>HTMLOrSVGImageElement/dfn>;typedef (a href#htmlorsvgimageelement id2dcontext:htmlorsvgimageelement>HTMLOrSVGImageElement/a> or a href#htmlvideoelement id2dcontext:htmlvideoelement>HTMLVideoElement/a> or a href#htmlcanvaselement id2dcontext:htmlcanvaselement>HTMLCanvasElement/a> or a href#imagebitmap id2dcontext:imagebitmap>ImageBitmap/a> or a href#offscreencanvas id2dcontext:offscreencanvas>OffscreenCanvas/a>) dfn idcanvasimagesource>CanvasImageSource/dfn>;enum dfn idcanvasfillrule>CanvasFillRule/dfn> { a href#dom-context-2d-fillrule-nonzero id2dcontext:dom-context-2d-fillrule-nonzero>nonzero/a>, a href#dom-context-2d-fillrule-evenodd id2dcontext:dom-context-2d-fillrule-evenodd>evenodd/a> };dictionary dfn idcanvasrenderingcontext2dsettings>CanvasRenderingContext2DSettings/dfn> { boolean a href#dom-canvasrenderingcontext2dsettings-alpha id2dcontext:dom-canvasrenderingcontext2dsettings-alpha>alpha/a> true;};enum dfn idimagesmoothingquality>ImageSmoothingQuality/dfn> { a href#dom-context-2d-imagesmoothingquality-low id2dcontext:dom-context-2d-imagesmoothingquality-low>low/a>, a href#dom-context-2d-imagesmoothingquality-medium id2dcontext:dom-context-2d-imagesmoothingquality-medium>medium/a>, a href#dom-context-2d-imagesmoothingquality-high id2dcontext:dom-context-2d-imagesmoothingquality-high>high/a> };ExposedWindowinterface dfn idcanvasrenderingcontext2d>CanvasRenderingContext2D/dfn> { // back-reference to the canvas readonly attribute a href#htmlcanvaselement id2dcontext:htmlcanvaselement-2>HTMLCanvasElement/a> a href#dom-context-2d-canvas id2dcontext:dom-context-2d-canvas>canvas/a>;};a href#canvasrenderingcontext2d id2dcontext:canvasrenderingcontext2d>CanvasRenderingContext2D/a> implements a href#canvasstate id2dcontext:canvasstate>CanvasState/a>;a href#canvasrenderingcontext2d id2dcontext:canvasrenderingcontext2d-2>CanvasRenderingContext2D/a> implements a href#canvastransform id2dcontext:canvastransform>CanvasTransform/a>;a href#canvasrenderingcontext2d id2dcontext:canvasrenderingcontext2d-3>CanvasRenderingContext2D/a> implements a href#canvascompositing id2dcontext:canvascompositing>CanvasCompositing/a>;a href#canvasrenderingcontext2d id2dcontext:canvasrenderingcontext2d-4>CanvasRenderingContext2D/a> implements a href#canvasimagesmoothing id2dcontext:canvasimagesmoothing>CanvasImageSmoothing/a>;a href#canvasrenderingcontext2d id2dcontext:canvasrenderingcontext2d-5>CanvasRenderingContext2D/a> implements a href#canvasfillstrokestyles id2dcontext:canvasfillstrokestyles>CanvasFillStrokeStyles/a>;a href#canvasrenderingcontext2d id2dcontext:canvasrenderingcontext2d-6>CanvasRenderingContext2D/a> implements a href#canvasshadowstyles id2dcontext:canvasshadowstyles>CanvasShadowStyles/a>;a href#canvasrenderingcontext2d id2dcontext:canvasrenderingcontext2d-7>CanvasRenderingContext2D/a> implements a href#canvasfilters id2dcontext:canvasfilters>CanvasFilters/a>;a href#canvasrenderingcontext2d id2dcontext:canvasrenderingcontext2d-8>CanvasRenderingContext2D/a> implements a href#canvasrect id2dcontext:canvasrect>CanvasRect/a>;a href#canvasrenderingcontext2d id2dcontext:canvasrenderingcontext2d-9>CanvasRenderingContext2D/a> implements a href#canvasdrawpath id2dcontext:canvasdrawpath>CanvasDrawPath/a>;a href#canvasrenderingcontext2d id2dcontext:canvasrenderingcontext2d-10>CanvasRenderingContext2D/a> implements a href#canvasuserinterface id2dcontext:canvasuserinterface>CanvasUserInterface/a>;a href#canvasrenderingcontext2d id2dcontext:canvasrenderingcontext2d-11>CanvasRenderingContext2D/a> implements a href#canvastext id2dcontext:canvastext>CanvasText/a>;a href#canvasrenderingcontext2d id2dcontext:canvasrenderingcontext2d-12>CanvasRenderingContext2D/a> implements a href#canvasdrawimage id2dcontext:canvasdrawimage>CanvasDrawImage/a>;a href#canvasrenderingcontext2d id2dcontext:canvasrenderingcontext2d-13>CanvasRenderingContext2D/a> implements a href#canvasimagedata id2dcontext:canvasimagedata>CanvasImageData/a>;a href#canvasrenderingcontext2d id2dcontext:canvasrenderingcontext2d-14>CanvasRenderingContext2D/a> implements a href#canvaspathdrawingstyles id2dcontext:canvaspathdrawingstyles>CanvasPathDrawingStyles/a>;a href#canvasrenderingcontext2d id2dcontext:canvasrenderingcontext2d-15>CanvasRenderingContext2D/a> implements a href#canvastextdrawingstyles id2dcontext:canvastextdrawingstyles>CanvasTextDrawingStyles/a>;a href#canvasrenderingcontext2d id2dcontext:canvasrenderingcontext2d-16>CanvasRenderingContext2D/a> implements a href#canvaspath id2dcontext:canvaspath>CanvasPath/a>;NoInterfaceObject, Exposed(Window,Worker)interface dfn idcanvasstate>CanvasState/dfn> { // state void a href#dom-context-2d-save id2dcontext:dom-context-2d-save>save/a>(); // push state on state stack void a href#dom-context-2d-restore id2dcontext:dom-context-2d-restore>restore/a>(); // pop state stack and restore state};NoInterfaceObject, Exposed(Window,Worker)interface dfn idcanvastransform>CanvasTransform/dfn> { // transformations (default transform is the identity matrix) void a href#dom-context-2d-scale id2dcontext:dom-context-2d-scale>scale/a>(unrestricted double x, unrestricted double y); void a href#dom-context-2d-rotate id2dcontext:dom-context-2d-rotate>rotate/a>(unrestricted double angle); void a href#dom-context-2d-translate id2dcontext:dom-context-2d-translate>translate/a>(unrestricted double x, unrestricted double y); void a href#dom-context-2d-transform id2dcontext:dom-context-2d-transform>transform/a>(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f); NewObject a id2dcontext:dommatrix hrefhttps://drafts.fxtf.org/geometry/#dommatrix data-x-internaldommatrix>DOMMatrix/a> a href#dom-context-2d-gettransform id2dcontext:dom-context-2d-gettransform>getTransform/a>(); void a href#dom-context-2d-settransform id2dcontext:dom-context-2d-settransform>setTransform/a>(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f); void a href#dom-context-2d-settransform-matrix id2dcontext:dom-context-2d-settransform-matrix>setTransform/a>(optional a id2dcontext:dommatrix2dinit hrefhttps://drafts.fxtf.org/geometry/#dictdef-dommatrix2dinit data-x-internaldommatrix2dinit>DOMMatrix2DInit/a> transform); void a href#dom-context-2d-resettransform id2dcontext:dom-context-2d-resettransform>resetTransform/a>();};NoInterfaceObject, Exposed(Window,Worker)interface dfn idcanvascompositing>CanvasCompositing/dfn> { // compositing attribute unrestricted double a href#dom-context-2d-globalalpha id2dcontext:dom-context-2d-globalalpha>globalAlpha/a>; // (default 1.0) attribute DOMString a href#dom-context-2d-globalcompositeoperation id2dcontext:dom-context-2d-globalcompositeoperation>globalCompositeOperation/a>; // (default source-over)};NoInterfaceObject, Exposed(Window,Worker)interface dfn idcanvasimagesmoothing>CanvasImageSmoothing/dfn> { // image smoothing attribute boolean a href#dom-context-2d-imagesmoothingenabled id2dcontext:dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled/a>; // (default true) attribute a href#imagesmoothingquality id2dcontext:imagesmoothingquality>ImageSmoothingQuality/a> a href#dom-context-2d-imagesmoothingquality id2dcontext:dom-context-2d-imagesmoothingquality>imageSmoothingQuality/a>; // (default low)};NoInterfaceObject, Exposed(Window,Worker)interface dfn idcanvasfillstrokestyles>CanvasFillStrokeStyles/dfn> { // colors and styles (see also the a href#canvaspathdrawingstyles id2dcontext:canvaspathdrawingstyles-2>CanvasPathDrawingStyles/a> and a href#canvastextdrawingstyles id2dcontext:canvastextdrawingstyles-2>CanvasTextDrawingStyles/a> interfaces) attribute (DOMString or CanvasGradient or CanvasPattern) a href#dom-context-2d-strokestyle id2dcontext:dom-context-2d-strokestyle>strokeStyle/a>; // (default black) attribute (DOMString or CanvasGradient or CanvasPattern) a href#dom-context-2d-fillstyle id2dcontext:dom-context-2d-fillstyle>fillStyle/a>; // (default black) a href#canvasgradient id2dcontext:canvasgradient>CanvasGradient/a> a href#dom-context-2d-createlineargradient id2dcontext:dom-context-2d-createlineargradient>createLinearGradient/a>(double x0, double y0, double x1, double y1); a href#canvasgradient id2dcontext:canvasgradient-2>CanvasGradient/a> a href#dom-context-2d-createradialgradient id2dcontext:dom-context-2d-createradialgradient>createRadialGradient/a>(double x0, double y0, double r0, double x1, double y1, double r1); a href#canvaspattern id2dcontext:canvaspattern>CanvasPattern/a>? a href#dom-context-2d-createpattern id2dcontext:dom-context-2d-createpattern>createPattern/a>(a href#canvasimagesource id2dcontext:canvasimagesource>CanvasImageSource/a> image, TreatNullAsEmptyString DOMString repetition);};NoInterfaceObject, Exposed(Window,Worker)interface dfn idcanvasshadowstyles>CanvasShadowStyles/dfn> { // shadows attribute unrestricted double a href#dom-context-2d-shadowoffsetx id2dcontext:dom-context-2d-shadowoffsetx>shadowOffsetX/a>; // (default 0) attribute unrestricted double a href#dom-context-2d-shadowoffsety id2dcontext:dom-context-2d-shadowoffsety>shadowOffsetY/a>; // (default 0) attribute unrestricted double a href#dom-context-2d-shadowblur id2dcontext:dom-context-2d-shadowblur>shadowBlur/a>; // (default 0) attribute DOMString a href#dom-context-2d-shadowcolor id2dcontext:dom-context-2d-shadowcolor>shadowColor/a>; // (default a href#transparent-black id2dcontext:transparent-black>transparent black/a>)};NoInterfaceObject, Exposed(Window,Worker)interface dfn idcanvasfilters>CanvasFilters/dfn> { // filters attribute DOMString a href#dom-context-2d-filter id2dcontext:dom-context-2d-filter>filter/a>; // (default none)};NoInterfaceObject, Exposed(Window,Worker)interface dfn idcanvasrect>CanvasRect/dfn> { // rects void a href#dom-context-2d-clearrect id2dcontext:dom-context-2d-clearrect>clearRect/a>(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); void a href#dom-context-2d-fillrect id2dcontext:dom-context-2d-fillrect>fillRect/a>(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); void a href#dom-context-2d-strokerect id2dcontext:dom-context-2d-strokerect>strokeRect/a>(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);};NoInterfaceObject, Exposed(Window,Worker)interface dfn idcanvasdrawpath>CanvasDrawPath/dfn> { // path API (see also a href#canvaspath id2dcontext:canvaspath-2>CanvasPath/a>) void a href#dom-context-2d-beginpath id2dcontext:dom-context-2d-beginpath>beginPath/a>(); void a href#dom-context-2d-fill id2dcontext:dom-context-2d-fill>fill/a>(optional a href#canvasfillrule id2dcontext:canvasfillrule>CanvasFillRule/a> fillRule a href#dom-context-2d-fillrule-nonzero id2dcontext:dom-context-2d-fillrule-nonzero-2>nonzero/a>); void a href#dom-context-2d-fill id2dcontext:dom-context-2d-fill-2>fill/a>(a href#path2d id2dcontext:path2d>Path2D/a> path, optional a href#canvasfillrule id2dcontext:canvasfillrule-2>CanvasFillRule/a> fillRule a href#dom-context-2d-fillrule-nonzero id2dcontext:dom-context-2d-fillrule-nonzero-3>nonzero/a>); void a href#dom-context-2d-stroke id2dcontext:dom-context-2d-stroke>stroke/a>(); void a href#dom-context-2d-stroke id2dcontext:dom-context-2d-stroke-2>stroke/a>(a href#path2d id2dcontext:path2d-2>Path2D/a> path); void a href#dom-context-2d-clip id2dcontext:dom-context-2d-clip>clip/a>(optional a href#canvasfillrule id2dcontext:canvasfillrule-3>CanvasFillRule/a> fillRule a href#dom-context-2d-fillrule-nonzero id2dcontext:dom-context-2d-fillrule-nonzero-4>nonzero/a>); void a href#dom-context-2d-clip id2dcontext:dom-context-2d-clip-2>clip/a>(a href#path2d id2dcontext:path2d-3>Path2D/a> path, optional a href#canvasfillrule id2dcontext:canvasfillrule-4>CanvasFillRule/a> fillRule a href#dom-context-2d-fillrule-nonzero id2dcontext:dom-context-2d-fillrule-nonzero-5>nonzero/a>); void a href#dom-context-2d-resetclip id2dcontext:dom-context-2d-resetclip>resetClip/a>(); boolean a href#dom-context-2d-ispointinpath id2dcontext:dom-context-2d-ispointinpath>isPointInPath/a>(unrestricted double x, unrestricted double y, optional a href#canvasfillrule id2dcontext:canvasfillrule-5>CanvasFillRule/a> fillRule a href#dom-context-2d-fillrule-nonzero id2dcontext:dom-context-2d-fillrule-nonzero-6>nonzero/a>); boolean a href#dom-context-2d-ispointinpath id2dcontext:dom-context-2d-ispointinpath-2>isPointInPath/a>(a href#path2d id2dcontext:path2d-4>Path2D/a> path, unrestricted double x, unrestricted double y, optional a href#canvasfillrule id2dcontext:canvasfillrule-6>CanvasFillRule/a> fillRule a href#dom-context-2d-fillrule-nonzero id2dcontext:dom-context-2d-fillrule-nonzero-7>nonzero/a>); boolean a href#dom-context-2d-ispointinstroke id2dcontext:dom-context-2d-ispointinstroke>isPointInStroke/a>(unrestricted double x, unrestricted double y); boolean a href#dom-context-2d-ispointinstroke id2dcontext:dom-context-2d-ispointinstroke-2>isPointInStroke/a>(a href#path2d id2dcontext:path2d-5>Path2D/a> path, unrestricted double x, unrestricted double y);};ExposedWindow, NoInterfaceObjectinterface dfn idcanvasuserinterface>CanvasUserInterface/dfn> { void a href#dom-context-2d-drawfocusifneeded id2dcontext:dom-context-2d-drawfocusifneeded>drawFocusIfNeeded/a>(a id2dcontext:element hrefhttps://dom.spec.whatwg.org/#interface-element data-x-internalelement>Element/a> element); void a href#dom-context-2d-drawfocusifneeded id2dcontext:dom-context-2d-drawfocusifneeded-2>drawFocusIfNeeded/a>(a href#path2d id2dcontext:path2d-6>Path2D/a> path, a id2dcontext:element-2 hrefhttps://dom.spec.whatwg.org/#interface-element data-x-internalelement>Element/a> element); void a href#dom-context-2d-scrollpathintoview id2dcontext:dom-context-2d-scrollpathintoview>scrollPathIntoView/a>(); void a href#dom-context-2d-scrollpathintoview id2dcontext:dom-context-2d-scrollpathintoview-2>scrollPathIntoView/a>(a href#path2d id2dcontext:path2d-7>Path2D/a> path);};ExposedWindow, NoInterfaceObjectinterface dfn idcanvastext>CanvasText/dfn> { // text (see also the a href#canvaspathdrawingstyles id2dcontext:canvaspathdrawingstyles-3>CanvasPathDrawingStyles/a> and a href#canvastextdrawingstyles id2dcontext:canvastextdrawingstyles-3>CanvasTextDrawingStyles/a> interfaces) void a href#dom-context-2d-filltext id2dcontext:dom-context-2d-filltext>fillText/a>(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth); void a href#dom-context-2d-stroketext id2dcontext:dom-context-2d-stroketext>strokeText/a>(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth); a href#textmetrics id2dcontext:textmetrics>TextMetrics/a> a href#dom-context-2d-measuretext id2dcontext:dom-context-2d-measuretext>measureText/a>(DOMString text);};NoInterfaceObject, Exposed(Window,Worker)interface dfn idcanvasdrawimage>CanvasDrawImage/dfn> { // drawing images void a href#dom-context-2d-drawimage id2dcontext:dom-context-2d-drawimage>drawImage/a>(a href#canvasimagesource id2dcontext:canvasimagesource-2>CanvasImageSource/a> image, unrestricted double dx, unrestricted double dy); void a href#dom-context-2d-drawimage id2dcontext:dom-context-2d-drawimage-2>drawImage/a>(a href#canvasimagesource id2dcontext:canvasimagesource-3>CanvasImageSource/a> image, unrestricted double dx, unrestricted double dy, unrestricted double dw, unrestricted double dh); void a href#dom-context-2d-drawimage id2dcontext:dom-context-2d-drawimage-3>drawImage/a>(a href#canvasimagesource id2dcontext: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);};NoInterfaceObject, Exposed(Window,Worker)interface dfn idcanvasimagedata>CanvasImageData/dfn> { // a href#pixel-manipulation id2dcontext:pixel-manipulation>pixel manipulation/a> a href#imagedata id2dcontext:imagedata>ImageData/a> a href#dom-context-2d-createimagedata id2dcontext:dom-context-2d-createimagedata>createImageData/a>(long sw, long sh); a href#imagedata id2dcontext:imagedata-2>ImageData/a> a href#dom-context-2d-createimagedata id2dcontext:dom-context-2d-createimagedata-2>createImageData/a>(a href#imagedata id2dcontext:imagedata-3>ImageData/a> imagedata); a href#imagedata id2dcontext:imagedata-4>ImageData/a> a href#dom-context-2d-getimagedata id2dcontext:dom-context-2d-getimagedata>getImageData/a>(long sx, long sy, long sw, long sh); void a href#dom-context-2d-putimagedata id2dcontext:dom-context-2d-putimagedata>putImageData/a>(a href#imagedata id2dcontext:imagedata-5>ImageData/a> imagedata, long dx, long dy); void a href#dom-context-2d-putimagedata id2dcontext:dom-context-2d-putimagedata-2>putImageData/a>(a href#imagedata id2dcontext:imagedata-6>ImageData/a> imagedata, long dx, long dy, long dirtyX, long dirtyY, long dirtyWidth, long dirtyHeight);};enum dfn idcanvaslinecap>CanvasLineCap/dfn> { butt, round, square };enum dfn idcanvaslinejoin>CanvasLineJoin/dfn> { round, bevel, miter };enum dfn idcanvastextalign>CanvasTextAlign/dfn> { a href#dom-context-2d-textalign-start id2dcontext:dom-context-2d-textalign-start>start/a>, a href#dom-context-2d-textalign-end id2dcontext:dom-context-2d-textalign-end>end/a>, a href#dom-context-2d-textalign-left id2dcontext:dom-context-2d-textalign-left>left/a>, a href#dom-context-2d-textalign-right id2dcontext:dom-context-2d-textalign-right>right/a>, a href#dom-context-2d-textalign-center id2dcontext:dom-context-2d-textalign-center>center/a> };enum dfn idcanvastextbaseline>CanvasTextBaseline/dfn> { a href#dom-context-2d-textbaseline-top id2dcontext:dom-context-2d-textbaseline-top>top/a>, a href#dom-context-2d-textbaseline-hanging id2dcontext:dom-context-2d-textbaseline-hanging>hanging/a>, a href#dom-context-2d-textbaseline-middle id2dcontext:dom-context-2d-textbaseline-middle>middle/a>, a href#dom-context-2d-textbaseline-alphabetic id2dcontext:dom-context-2d-textbaseline-alphabetic>alphabetic/a>, a href#dom-context-2d-textbaseline-ideographic id2dcontext:dom-context-2d-textbaseline-ideographic>ideographic/a>, a href#dom-context-2d-textbaseline-bottom id2dcontext:dom-context-2d-textbaseline-bottom>bottom/a> };enum dfn idcanvasdirection>CanvasDirection/dfn> { a href#dom-context-2d-direction-ltr id2dcontext:dom-context-2d-direction-ltr>ltr/a>, a href#dom-context-2d-direction-rtl id2dcontext:dom-context-2d-direction-rtl>rtl/a>, a href#dom-context-2d-direction-inherit id2dcontext:dom-context-2d-direction-inherit>inherit/a> };NoInterfaceObject, Exposed(Window,Worker)interface dfn idcanvaspathdrawingstyles>CanvasPathDrawingStyles/dfn> { // line caps/joins attribute unrestricted double a href#dom-context-2d-linewidth id2dcontext:dom-context-2d-linewidth>lineWidth/a>; // (default 1) attribute a href#canvaslinecap id2dcontext:canvaslinecap>CanvasLineCap/a> a href#dom-context-2d-linecap id2dcontext:dom-context-2d-linecap>lineCap/a>; // (default butt) attribute a href#canvaslinejoin id2dcontext:canvaslinejoin>CanvasLineJoin/a> a href#dom-context-2d-linejoin id2dcontext:dom-context-2d-linejoin>lineJoin/a>; // (default miter) attribute unrestricted double a href#dom-context-2d-miterlimit id2dcontext:dom-context-2d-miterlimit>miterLimit/a>; // (default 10) // dashed lines void a href#dom-context-2d-setlinedash id2dcontext:dom-context-2d-setlinedash>setLineDash/a>(sequence<unrestricted double> segments); // default empty sequence<unrestricted double> a href#dom-context-2d-getlinedash id2dcontext:dom-context-2d-getlinedash>getLineDash/a>(); attribute unrestricted double a href#dom-context-2d-linedashoffset id2dcontext:dom-context-2d-linedashoffset>lineDashOffset/a>;};ExposedWindow, NoInterfaceObjectinterface dfn idcanvastextdrawingstyles>CanvasTextDrawingStyles/dfn> { // text attribute DOMString a href#dom-context-2d-font id2dcontext:dom-context-2d-font>font/a>; // (default 10px sans-serif) attribute a href#canvastextalign id2dcontext:canvastextalign>CanvasTextAlign/a> a href#dom-context-2d-textalign id2dcontext:dom-context-2d-textalign>textAlign/a>; // (default: start) attribute a href#canvastextbaseline id2dcontext:canvastextbaseline>CanvasTextBaseline/a> a href#dom-context-2d-textbaseline id2dcontext:dom-context-2d-textbaseline>textBaseline/a>; // (default: alphabetic) attribute a href#canvasdirection id2dcontext:canvasdirection>CanvasDirection/a> a href#dom-context-2d-direction id2dcontext:dom-context-2d-direction>direction/a>; // (default: inherit)};NoInterfaceObject, Exposed(Window,Worker)interface dfn idcanvaspath>CanvasPath/dfn> { // shared path API methods void a href#dom-context-2d-closepath id2dcontext:dom-context-2d-closepath>closePath/a>(); void a href#dom-context-2d-moveto id2dcontext:dom-context-2d-moveto>moveTo/a>(unrestricted double x, unrestricted double y); void a href#dom-context-2d-lineto id2dcontext:dom-context-2d-lineto>lineTo/a>(unrestricted double x, unrestricted double y); void a href#dom-context-2d-quadraticcurveto id2dcontext:dom-context-2d-quadraticcurveto>quadraticCurveTo/a>(unrestricted double cpx, unrestricted double cpy, unrestricted double x, unrestricted double y); void a href#dom-context-2d-beziercurveto id2dcontext:dom-context-2d-beziercurveto>bezierCurveTo/a>(unrestricted double cp1x, unrestricted double cp1y, unrestricted double cp2x, unrestricted double cp2y, unrestricted double x, unrestricted double y); void a href#dom-context-2d-arcto id2dcontext:dom-context-2d-arcto>arcTo/a>(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radius); void a href#dom-context-2d-arcto id2dcontext:dom-context-2d-arcto-2>arcTo/a>(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation); void a href#dom-context-2d-rect id2dcontext:dom-context-2d-rect>rect/a>(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); void a href#dom-context-2d-arc id2dcontext:dom-context-2d-arc>arc/a>(unrestricted double x, unrestricted double y, unrestricted double radius, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise false); void a href#dom-context-2d-ellipse id2dcontext:dom-context-2d-ellipse>ellipse/a>(unrestricted double x, unrestricted double y, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise false); };Exposed(Window,Worker)interface dfn idcanvasgradient>CanvasGradient/dfn> { // opaque object void a href#dom-canvasgradient-addcolorstop id2dcontext:dom-canvasgradient-addcolorstop>addColorStop/a>(double offset, DOMString color);};Exposed(Window,Worker)interface dfn idcanvaspattern>CanvasPattern/dfn> { // opaque object void a href#dom-canvaspattern-settransform id2dcontext:dom-canvaspattern-settransform>setTransform/a>(optional a id2dcontext:dommatrix2dinit-2 hrefhttps://drafts.fxtf.org/geometry/#dictdef-dommatrix2dinit data-x-internaldommatrix2dinit>DOMMatrix2DInit/a> transform);};ExposedWindowinterface dfn idtextmetrics>TextMetrics/dfn> { // x-direction readonly attribute double a href#dom-textmetrics-width id2dcontext:dom-textmetrics-width>width/a>; // advance width readonly attribute double a href#dom-textmetrics-actualboundingboxleft id2dcontext:dom-textmetrics-actualboundingboxleft>actualBoundingBoxLeft/a>; readonly attribute double a href#dom-textmetrics-actualboundingboxright id2dcontext:dom-textmetrics-actualboundingboxright>actualBoundingBoxRight/a>; // y-direction readonly attribute double a href#dom-textmetrics-fontboundingboxascent id2dcontext:dom-textmetrics-fontboundingboxascent>fontBoundingBoxAscent/a>; readonly attribute double a href#dom-textmetrics-fontboundingboxdescent id2dcontext:dom-textmetrics-fontboundingboxdescent>fontBoundingBoxDescent/a>; readonly attribute double a href#dom-textmetrics-actualboundingboxascent id2dcontext:dom-textmetrics-actualboundingboxascent>actualBoundingBoxAscent/a>; readonly attribute double a href#dom-textmetrics-actualboundingboxdescent id2dcontext:dom-textmetrics-actualboundingboxdescent>actualBoundingBoxDescent/a>; readonly attribute double a href#dom-textmetrics-emheightascent id2dcontext:dom-textmetrics-emheightascent>emHeightAscent/a>; readonly attribute double a href#dom-textmetrics-emheightdescent id2dcontext:dom-textmetrics-emheightdescent>emHeightDescent/a>; readonly attribute double a href#dom-textmetrics-hangingbaseline id2dcontext:dom-textmetrics-hangingbaseline>hangingBaseline/a>; readonly attribute double a href#dom-textmetrics-alphabeticbaseline id2dcontext:dom-textmetrics-alphabeticbaseline>alphabeticBaseline/a>; readonly attribute double a href#dom-textmetrics-ideographicbaseline id2dcontext:dom-textmetrics-ideographicbaseline>ideographicBaseline/a>;};a href#dom-imagedata id2dcontext:dom-imagedata>Constructor/a>(unsigned long sw, unsigned long sh), a href#dom-imagedata id2dcontext:dom-imagedata-2>Constructor/a>(a hrefhttps://heycam.github.io/webidl/#idl-Uint8ClampedArray id2dcontext:idl-uint8clampedarray data-x-internalidl-uint8clampedarray>Uint8ClampedArray/a> data, unsigned long sw, optional unsigned long sh), Exposed(Window,Worker), a href#serializable id2dcontext:serializable>Serializable/a>interface dfn idimagedata>ImageData/dfn> { readonly attribute unsigned long a href#dom-imagedata-width id2dcontext:dom-imagedata-width>width/a>; readonly attribute unsigned long a href#dom-imagedata-height id2dcontext:dom-imagedata-height>height/a>; readonly attribute a hrefhttps://heycam.github.io/webidl/#idl-Uint8ClampedArray id2dcontext:idl-uint8clampedarray-2 data-x-internalidl-uint8clampedarray>Uint8ClampedArray/a> a href#dom-imagedata-data id2dcontext:dom-imagedata-data>data/a>;};a href#dom-path2d id2dcontext:dom-path2d>Constructor/a>, a href#dom-path2d-copy id2dcontext:dom-path2d-copy>Constructor/a>(a href#path2d id2dcontext:path2d-8>Path2D/a> path), a href#dom-path2d-merge id2dcontext:dom-path2d-merge>Constructor/a>(sequence<a href#path2d id2dcontext:path2d-9>Path2D/a>> paths, optional a href#canvasfillrule id2dcontext:canvasfillrule-7>CanvasFillRule/a> fillRule a href#dom-context-2d-fillrule-nonzero id2dcontext:dom-context-2d-fillrule-nonzero-8>nonzero/a>), a href#dom-path2d-withdata id2dcontext:dom-path2d-withdata>Constructor/a>(DOMString d), Exposed(Window,Worker)interface dfn idpath2d>Path2D/dfn> { void a href#dom-path2d-addpath id2dcontext:dom-path2d-addpath>addPath/a>(a href#path2d id2dcontext:path2d-10>Path2D/a> path, optional a id2dcontext:dommatrix2dinit-3 hrefhttps://drafts.fxtf.org/geometry/#dictdef-dommatrix2dinit data-x-internaldommatrix2dinit>DOMMatrix2DInit/a> transform);};a href#path2d id2dcontext:path2d-11>Path2D/a> implements a href#canvaspath id2dcontext:canvaspath-3>CanvasPath/a>;/pre> p classnote>To maintain compatibility with existing Web content, user agents need to enumerate methods defined in code id2dcontext:canvasuserinterface-2>a href#canvasuserinterface>CanvasUserInterface/a>/code> immediately after the code id2dcontext:dom-context-2d-stroke-3>a href#dom-context-2d-stroke>stroke()/a>/code> method on code id2dcontext:canvasrenderingcontext2d-17>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> objects./p> dl classdomintro>dt>var>context/var> var>canvas/var> . code id2dcontext:dom-canvas-getcontext>a href#dom-canvas-getcontext>getContext/a>/code>(2d , { code id2dcontext:dom-canvasrenderingcontext2dsettings-alpha-2>a href#dom-canvasrenderingcontext2dsettings-alpha>alpha/a>/code>: false } )dd> p>Returns a code id2dcontext:canvasrenderingcontext2d-18>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> object that is permanently bound to a particular code id2dcontext:the-canvas-element>a href#the-canvas-element>canvas/a>/code> element./p> p>If the code id2dcontext:dom-canvasrenderingcontext2dsettings-alpha-3>a href#dom-canvasrenderingcontext2dsettings-alpha>alpha/a>/code> setting is provided and set to false, then the canvas is forced to always be opaque./p> dt>var>context/var> . code id2dcontext:dom-context-2d-canvas-2>a href#dom-context-2d-canvas>canvas/a>/code>dd> p>Returns the code id2dcontext:the-canvas-element-2>a href#the-canvas-element>canvas/a>/code> element./p> /dl> p>A code id2dcontext:canvasrenderingcontext2d-19>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> object has an dfn idoutput-bitmap>output bitmap/dfn> that is initialized when the object is created./p> p>The a href#output-bitmap id2dcontext:output-bitmap>output bitmap/a> has an a href#concept-canvas-origin-clean id2dcontext:concept-canvas-origin-clean>origin-clean/a> flag, which can be set to true or false. Initially, when one of these bitmaps is created, its a href#concept-canvas-origin-clean id2dcontext:concept-canvas-origin-clean-2>origin-clean/a> flag must be set to true./p> p>The code id2dcontext:canvasrenderingcontext2d-20>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> object also has an dfn idconcept-canvas-alpha>alpha/dfn> flag, which can be set to true or false. Initially, when the context is created, its a href#concept-canvas-alpha id2dcontext:concept-canvas-alpha>alpha/a> flag must be set to true. When a code id2dcontext:canvasrenderingcontext2d-21>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> object has its a href#concept-canvas-alpha id2dcontext:concept-canvas-alpha-2>alpha/a> flag set to false, then its alpha channel must be fixed to 1.0 (fully opaque) for all pixels, and attempts to change the alpha component of any pixel must be silently ignored./p> p classnote>Thus, the bitmap of such a context starts off as fully-opaque black instead of a href#transparent-black id2dcontext:transparent-black-2>transparent black/a>; code id2dcontext:dom-context-2d-clearrect-2>a href#dom-context-2d-clearrect>clearRect()/a>/code> always results in fully-opaque black pixels, every fourth byte from code id2dcontext:dom-context-2d-getimagedata-2>a href#dom-context-2d-getimagedata>getImageData()/a>/code> is always 255, the code id2dcontext:dom-context-2d-putimagedata-3>a href#dom-context-2d-putimagedata>putImageData()/a>/code> method effectively ignores every fourth byte in its input, and so on. However, the alpha component of styles and images drawn onto the canvas are still honoured up to the point where they would impact the a href#output-bitmap id2dcontext:output-bitmap-2>output bitmap/a>s alpha channel; for instance, drawing a 50% transparent white square on a freshly created a href#output-bitmap id2dcontext:output-bitmap-3>output bitmap/a> with its a href#concept-canvas-alpha id2dcontext:concept-canvas-alpha-3>alpha/a> flag set to false will result in a fully-opaque gray square./p> hr> p>The code id2dcontext:canvasrenderingcontext2d-22>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> 2D rendering context represents a flat linear Cartesian surface whose origin (0,0) is at the top left corner, with the coordinate space having var>x/var> values increasing when going right, and var>y/var> values increasing when going down. The var>x/var>-coordinate of the right-most edge is equal to the width of the rendering contexts a href#output-bitmap id2dcontext:output-bitmap-4>output bitmap/a> in a hrefhttps://drafts.csswg.org/css-values/#px id2dcontext:px data-x-internalpx>CSS pixels/a>; similarly, the var>y/var>-coordinate of the bottom-most edge is equal to the height of the rendering contexts a href#output-bitmap id2dcontext:output-bitmap-5>output bitmap/a> in a hrefhttps://drafts.csswg.org/css-values/#px id2dcontext:px-2 data-x-internalpx>CSS pixels/a>./p> p>The size of the coordinate space does not necessarily represent the size of the actual bitmaps that the user agent will use internally or during rendering. On high-definition displays, for instance, the user agent may internally use bitmaps with four device pixels per unit in the coordinate space, so that the rendering remains at high quality throughout. Anti-aliasing can similarly be implemented using oversampling with bitmaps of a higher resolution than the final image on the display./p> div classexample> p>Using a hrefhttps://drafts.csswg.org/css-values/#px id2dcontext:px-3 data-x-internalpx>CSS pixels/a> to describe the size of a rendering contexts a href#output-bitmap id2dcontext:output-bitmap-6>output bitmap/a> does not mean that when rendered the canvas will cover an equivalent area in a hrefhttps://drafts.csswg.org/css-values/#px id2dcontext:px-4 data-x-internalpx>CSS pixels/a>. a hrefhttps://drafts.csswg.org/css-values/#px id2dcontext:px-5 data-x-internalpx>CSS pixels/a> are reused for ease of integration with CSS features, such as text layout./p> p>In other words, the code id2dcontext:the-canvas-element-3>a href#the-canvas-element>canvas/a>/code> element belows rendering context has a 200x200 a href#output-bitmap id2dcontext:output-bitmap-7>output bitmap/a> (which internally uses a hrefhttps://drafts.csswg.org/css-values/#px id2dcontext:px-6 data-x-internalpx>CSS pixels/a> as a unit for ease of integration with CSS) and is rendered as 100x100 a hrefhttps://drafts.csswg.org/css-values/#px id2dcontext:px-7 data-x-internalpx>CSS pixels/a>: pre><canvas width200 height200 stylewidth:100px;height:100px>/pre> /div> hr> p>The dfn id2d-context-creation-algorithm>2D context creation algorithm/dfn>, which is passed a var>target/var> (a code id2dcontext:the-canvas-element-4>a href#the-canvas-element>canvas/a>/code> element) and optionally some arguments, consists of running the following steps:/p> ol>li>p>If the algorithm was passed some arguments, then let var>arg/var> be the first such argument. Otherwise, let var>arg/var> be undefined.li>p>Let var>settings/var> be the result of a href#coerce-context-arguments-for-2d id2dcontext:coerce-context-arguments-for-2d>coercing the var>arg/var> context arguments for 2D/a>.li>p>Create a new code id2dcontext:canvasrenderingcontext2d-23>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> object.li>p>Initialize its code id2dcontext:dom-context-2d-canvas-3>a href#dom-context-2d-canvas>canvas/a>/code> attribute to point to var>target/var>.li>p>Let the new code id2dcontext:canvasrenderingcontext2d-24>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> objects a href#output-bitmap id2dcontext:output-bitmap-8>output bitmap/a> be the same bitmap as var>target/var>s bitmap (so that they are shared).li>p>a href#concept-canvas-set-bitmap-dimensions id2dcontext:concept-canvas-set-bitmap-dimensions>Set bitmap dimensions/a> to the numeric values of var>target/var>s code id2dcontext:attr-canvas-width>a href#attr-canvas-width>width/a>/code> and code id2dcontext:attr-canvas-height>a href#attr-canvas-height>height/a>/code> content attributes.li> p>Process each of the members of var>settings/var> as follows:/p> dl>dt>dfn iddom-canvasrenderingcontext2dsettings-alpha>code>alpha/code>/dfn>dd>If false, then set the new code id2dcontext:canvasrenderingcontext2d-25>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> objects a href#concept-canvas-alpha id2dcontext:concept-canvas-alpha-4>alpha/a> flag to false./dl> li>p>Return the new code id2dcontext:canvasrenderingcontext2d-26>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> object./ol> hr> hr> p>When a user agent is required to dfn idcoerce-context-arguments-for-2d>coerce context arguments for 2D/dfn>, it must run these steps:/p> ol>li>p>Let var>input/var> be the argument to coerce.li>p>Let var>jsval/var> be the result of a hrefhttps://heycam.github.io/webidl/#es-type-mapping id2dcontext:concept-idl-convert data-x-internalconcept-idl-convert>converting/a> var>input/var> to a JavaScript value. (This can throw an exception.)li>p>Let var>dict/var> be the result of a hrefhttps://heycam.github.io/webidl/#es-type-mapping id2dcontext:concept-idl-convert-2 data-x-internalconcept-idl-convert>converting/a> var>jsval/var> to the dictionary type code id2dcontext:canvasrenderingcontext2dsettings>a href#canvasrenderingcontext2dsettings>CanvasRenderingContext2DSettings/a>/code>. (This can throw an exception.)li>p>Return var>dict/var>./ol> hr> p>When the user agent is to dfn idconcept-canvas-set-bitmap-dimensions>set bitmap dimensions/dfn> to var>width/var> and var>height/var>, it must run these steps:/p> ol>li>p>a href#reset-the-rendering-context-to-its-default-state id2dcontext:reset-the-rendering-context-to-its-default-state>Reset the rendering context to its default state/a>.li>p>Resize the a href#output-bitmap id2dcontext:output-bitmap-9>output bitmap/a> to the new var>width/var> and var>height/var> and clear it to a href#transparent-black id2dcontext:transparent-black-3>transparent black/a>.li>p>Let var>canvas/var> be the code id2dcontext:the-canvas-element-5>a href#the-canvas-element>canvas/a>/code> element to which the rendering contexts code id2dcontext:dom-context-2d-canvas-4>a href#dom-context-2d-canvas>canvas/a>/code> attribute was initialized.li>p>If the numeric value of var>canvas/var>s code id2dcontext:attr-canvas-width-2>a href#attr-canvas-width>width/a>/code> content attribute differs from var>width/var>, then set var>canvas/var>s code id2dcontext:attr-canvas-width-3>a href#attr-canvas-width>width/a>/code> content attribute to the shortest possible string representing var>width/var> as a a href#valid-non-negative-integer id2dcontext:valid-non-negative-integer>valid non-negative integer/a>.li>p>If the numeric value of var>canvas/var>s code id2dcontext:attr-canvas-height-2>a href#attr-canvas-height>height/a>/code> content attribute differs from var>height/var>, then set var>canvas/var>s code id2dcontext:attr-canvas-height-3>a href#attr-canvas-height>height/a>/code> content attribute to the shortest possible string representing var>height/var> as a a href#valid-non-negative-integer id2dcontext:valid-non-negative-integer-2>valid non-negative integer/a>./ol> div classexample> p>Only one square appears to be drawn in the following example:/p> pre>// canvas is a reference to a <canvas> elementvar context canvas.getContext(2d);context.fillRect(0,0,50,50);canvas.setAttribute(width, 300); // clears the canvascontext.fillRect(0,100,50,50);canvas.width canvas.width; // clears the canvascontext.fillRect(100,0,50,50); // only this square remains/pre> /div> hr> p>When the user agent is to run the dfn idconcept-canvas-unbinding-steps>unbinding steps/dfn> for a rendering context, it must run these steps:/p> ol>li>p>a href#reset-the-rendering-context-to-its-default-state id2dcontext:reset-the-rendering-context-to-its-default-state-2>Reset the rendering context to its default state/a>.li>p>Clear the code id2dcontext:canvasrenderingcontext2d-27>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> objects a href#output-bitmap id2dcontext:output-bitmap-10>output bitmap/a> to a href#transparent-black id2dcontext:transparent-black-4>transparent black/a>.li>p>Set the code id2dcontext:canvasrenderingcontext2d-28>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> objects a href#concept-canvas-origin-clean id2dcontext:concept-canvas-origin-clean-3>origin-clean/a> flag to true.li>p>Let the code id2dcontext:canvasrenderingcontext2d-29>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> object have no a href#output-bitmap id2dcontext:output-bitmap-11>output bitmap/a>./ol> p>When the user agent is to run the dfn idconcept-canvas-binding-steps>binding steps/dfn> to bind the rendering context to the code id2dcontext:the-canvas-element-6>a href#the-canvas-element>canvas/a>/code> element var>target/var>, it must run these steps:/p> ol>li>p>a href#reset-the-rendering-context-to-its-default-state id2dcontext:reset-the-rendering-context-to-its-default-state-3>Reset the rendering context to its default state/a>.li>p>Resize the code id2dcontext:canvasrenderingcontext2d-30>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> objects a href#output-bitmap id2dcontext:output-bitmap-12>output bitmap/a> to the dimensions of var>target/var>s bitmap and clear it to a href#transparent-black id2dcontext:transparent-black-5>transparent black/a>.li>p>Set the code id2dcontext:canvasrenderingcontext2d-31>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> objects a href#concept-canvas-origin-clean id2dcontext:concept-canvas-origin-clean-4>origin-clean/a> flag to true.li>p>Let the code id2dcontext:canvasrenderingcontext2d-32>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> objects a href#output-bitmap id2dcontext:output-bitmap-13>output bitmap/a> be var>target/var>s bitmap./ol> hr> p>The dfn iddom-context-2d-canvas>code>canvas/code>/dfn> attribute must return the value it was initialized to when the object was created./p> hr> p idcanvasrenderingcontext2d-currentcolor>Whenever the CSS value code>currentColor/code> is used as a color in the code id2dcontext:canvasrenderingcontext2d-33>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> API, the a id2dcontext:computed-value hrefhttps://drafts.csswg.org/css-cascade/#computed-value data-x-internalcomputed-value>computed value/a> of the code>currentColor/code> keyword is the a id2dcontext:computed-value-2 hrefhttps://drafts.csswg.org/css-cascade/#computed-value data-x-internalcomputed-value>computed value/a> of the a id2dcontext:color hrefhttps://drafts.csswg.org/css-color/#the-color-property data-x-internalcolor>color/a> property on the code id2dcontext:the-canvas-element-7>a href#the-canvas-element>canvas/a>/code> element at the time that the color is specified (e.g. when the appropriate attribute is set, or when the method is called; not when the color is rendered or otherwise used). If the computed value of the a id2dcontext:color-2 hrefhttps://drafts.csswg.org/css-color/#the-color-property data-x-internalcolor>color/a> property is undefined for a particular case (e.g. because the element is not in a document), then the a id2dcontext:computed-value-3 hrefhttps://drafts.csswg.org/css-cascade/#computed-value data-x-internalcomputed-value>computed value/a> of the a id2dcontext:color-3 hrefhttps://drafts.csswg.org/css-color/#the-color-property data-x-internalcolor>color/a> property for the purposes of determining the computed value of the code>currentColor/code> keyword is fully opaque black. a href#refsCSSCOLOR>CSSCOLOR/a>/p> p>In the case of code id2dcontext:dom-canvasgradient-addcolorstop-2>a href#dom-canvasgradient-addcolorstop>addColorStop()/a>/code> on code id2dcontext:canvasgradient-3>a href#canvasgradient>CanvasGradient/a>/code>, the a id2dcontext:computed-value-4 hrefhttps://drafts.csswg.org/css-cascade/#computed-value data-x-internalcomputed-value>computed value/a> of the a id2dcontext:color-4 hrefhttps://drafts.csswg.org/css-color/#the-color-property data-x-internalcolor>color/a> property for the purposes of determining the a id2dcontext:computed-value-5 hrefhttps://drafts.csswg.org/css-cascade/#computed-value data-x-internalcomputed-value>computed value/a> of the code>currentColor/code> keyword is always fully opaque black (there is no associated element). a href#refsCSSCOLOR>CSSCOLOR/a>/p> p classnote>This is because code id2dcontext:canvasgradient-4>a href#canvasgradient>CanvasGradient/a>/code> objects are code id2dcontext:the-canvas-element-8>a href#the-canvas-element>canvas/a>/code>-neutral — a code id2dcontext:canvasgradient-5>a href#canvasgradient>CanvasGradient/a>/code> object created by one code id2dcontext:the-canvas-element-9>a href#the-canvas-element>canvas/a>/code> can be used by another, and there is therefore no way to know which is the element in question at the time that the color is specified./p> p classnote>Similar concerns exist with font-related properties; the rules for those are described in detail in the relevant section below./p> hr> p>The code id2dcontext:canvasfillrule-8>a href#canvasfillrule>CanvasFillRule/a>/code> enumeration is used to select the dfn idfill-rule>fill rule/dfn> algorithm by which to determine if a point is inside or outside a path./p> p>The value dfn iddom-context-2d-fillrule-nonzero>code>nonzero/code>/dfn> value indicates the nonzero winding rule, wherein a point is considered to be outside a shape if the number of times a half-infinite straight line drawn from that point crosses the shapes path going in one direction is equal to the number of times it crosses the path going in the other direction. /p> p>The dfn iddom-context-2d-fillrule-evenodd>code>evenodd/code>/dfn> value indicates the even-odd rule, wherein a point is considered to be outside a shape if the number of times a half-infinite straight line drawn from that point crosses the shapes path is even. /p> p>If a point is not outside a shape, it is inside the shape./p> hr> p>The code id2dcontext:imagesmoothingquality-2>a href#imagesmoothingquality>ImageSmoothingQuality/a>/code> enumeration is used to express a preference for the interpolation quality to use when smoothing images./p> p>The dfn iddom-context-2d-imagesmoothingquality-low>code>low/code>/dfn> value indicates a preference for a low level of image interpolation quality. Low-quality image interpolation may be more computationally efficient than higher settings./p> p>The dfn iddom-context-2d-imagesmoothingquality-medium>code>medium/code>/dfn> value indicates a preference for a medium level of image interpolation quality./p> p>The dfn iddom-context-2d-imagesmoothingquality-high>code>high/code>/dfn> value indicates a preference for a high level of image interpolation quality. High-quality image interpolation may be more computationally expensive than lower settings./p> p classnote>Bilinear scaling is an example of a relatively fast, lower-quality image-smoothing algorithm. Bicubic or Lanczos scaling are examples of image-smoothing algorithms that produce higher-quality output. This specification does not mandate that specific interpolation algorithms be used./p> h6 idimplementation-notes>span classsecno>4.12.5.1.1/span> Implementation notesa href#implementation-notes classself-link>/a>/h6> p>i>This section is non-normative./i>/p> p>The a href#output-bitmap idimplementation-notes:output-bitmap>output bitmap/a>, when it is not directly displayed by the user agent, implementations can, instead of updating this bitmap, merely remember the sequence of drawing operations that have been applied to it until such time as the bitmaps actual data is needed (for example because of a call to code idimplementation-notes:dom-context-2d-drawimage>a href#dom-context-2d-drawimage>drawImage()/a>/code>, or the code idimplementation-notes:dom-createimagebitmap>a href#dom-createimagebitmap>createImageBitmap()/a>/code> factory method). In many cases, this will be more memory efficient./p> p>The bitmap of a code idimplementation-notes:the-canvas-element>a href#the-canvas-element>canvas/a>/code> element is the one bitmap thats pretty much always going to be needed in practice. The a href#output-bitmap idimplementation-notes:output-bitmap-2>output bitmap/a> of a rendering context, when it has one, is always just an alias to a code idimplementation-notes:the-canvas-element-2>a href#the-canvas-element>canvas/a>/code> elements bitmap./p> p>Additional bitmaps are sometimes needed, e.g. to enable fast drawing when the canvas is being painted at a different size than its a hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic idimplementation-notes:intrinsic-dimensions data-x-internalintrinsic-dimensions>intrinsic size/a>, or to enable double buffering so that graphics updates, like page scrolling for example, can be processed concurrently while canvas draw commands are being executed./p> h6 idthe-canvas-state>span classsecno>4.12.5.1.2/span> The canvas statea href#the-canvas-state classself-link>/a>/h6> p>Objects that implement the code idthe-canvas-state:canvasstate>a href#canvasstate>CanvasState/a>/code> interface maintain a stack of drawing states. dfn iddrawing-state>Drawing states/dfn> consist of:/p> ul classbrief>li>The current a href#transformations idthe-canvas-state:transformations>transformation matrix/a>.li>The current a href#clipping-region idthe-canvas-state:clipping-region>clipping region/a>.li>The current values of the following attributes: code idthe-canvas-state:dom-context-2d-strokestyle>a href#dom-context-2d-strokestyle>strokeStyle/a>/code>, code idthe-canvas-state:dom-context-2d-fillstyle>a href#dom-context-2d-fillstyle>fillStyle/a>/code>, code idthe-canvas-state:dom-context-2d-globalalpha>a href#dom-context-2d-globalalpha>globalAlpha/a>/code>, code idthe-canvas-state:dom-context-2d-linewidth>a href#dom-context-2d-linewidth>lineWidth/a>/code>, code idthe-canvas-state:dom-context-2d-linecap>a href#dom-context-2d-linecap>lineCap/a>/code>, code idthe-canvas-state:dom-context-2d-linejoin>a href#dom-context-2d-linejoin>lineJoin/a>/code>, code idthe-canvas-state:dom-context-2d-miterlimit>a href#dom-context-2d-miterlimit>miterLimit/a>/code>, code idthe-canvas-state:dom-context-2d-linedashoffset>a href#dom-context-2d-linedashoffset>lineDashOffset/a>/code>, code idthe-canvas-state:dom-context-2d-shadowoffsetx>a href#dom-context-2d-shadowoffsetx>shadowOffsetX/a>/code>, code idthe-canvas-state:dom-context-2d-shadowoffsety>a href#dom-context-2d-shadowoffsety>shadowOffsetY/a>/code>, code idthe-canvas-state:dom-context-2d-shadowblur>a href#dom-context-2d-shadowblur>shadowBlur/a>/code>, code idthe-canvas-state:dom-context-2d-shadowcolor>a href#dom-context-2d-shadowcolor>shadowColor/a>/code>, code idthe-canvas-state:dom-context-2d-filter>a href#dom-context-2d-filter>filter/a>/code>, code idthe-canvas-state:dom-context-2d-globalcompositeoperation>a href#dom-context-2d-globalcompositeoperation>globalCompositeOperation/a>/code>, code idthe-canvas-state:dom-context-2d-font>a href#dom-context-2d-font>font/a>/code>, code idthe-canvas-state:dom-context-2d-textalign>a href#dom-context-2d-textalign>textAlign/a>/code>, code idthe-canvas-state:dom-context-2d-textbaseline>a href#dom-context-2d-textbaseline>textBaseline/a>/code>, code idthe-canvas-state:dom-context-2d-direction>a href#dom-context-2d-direction>direction/a>/code>, code idthe-canvas-state:dom-context-2d-imagesmoothingenabled>a href#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled/a>/code>, code idthe-canvas-state:dom-context-2d-imagesmoothingquality>a href#dom-context-2d-imagesmoothingquality>imageSmoothingQuality/a>/code>.li>The current a href#dash-list idthe-canvas-state:dash-list>dash list/a>./ul> p classnote>The a href#current-default-path idthe-canvas-state:current-default-path>current default path/a> and the rendering contexts bitmaps are not part of the drawing state. The a href#current-default-path idthe-canvas-state:current-default-path-2>current default path/a> is persistent, and can only be reset using the code idthe-canvas-state:dom-context-2d-beginpath>a href#dom-context-2d-beginpath>beginPath()/a>/code> method. The bitmaps depend on whether and how the rendering context is bound to a code idthe-canvas-state:the-canvas-element>a href#the-canvas-element>canvas/a>/code> element./p> dl classdomintro>dt>var>context/var> . code idthe-canvas-state:dom-context-2d-save>a href#dom-context-2d-save>save/a>/code>()dd> p>Pushes the current state onto the stack./p> dt>var>context/var> . code idthe-canvas-state:dom-context-2d-restore>a href#dom-context-2d-restore>restore/a>/code>()dd> p>Pops the top state on the stack, restoring the context to that state./p> /dl> p>The dfn iddom-context-2d-save>code>save()/code>/dfn> method, when invoked, must push a copy of the current drawing state onto the drawing state stack./p> p>The dfn iddom-context-2d-restore>code>restore()/code>/dfn> method, when invoked, must pop the top entry in the drawing state stack, and reset the drawing state it describes. If there is no saved state, then the method must do nothing./p> p>When the user agent is to dfn idreset-the-rendering-context-to-its-default-state>reset the rendering context to its default state/dfn>, it must clear the drawing state stack and everything that a href#drawing-state idthe-canvas-state:drawing-state>drawing state/a> consists of to initial values./p> h6 idline-styles>span classsecno>4.12.5.1.3/span> Line stylesa href#line-styles classself-link>/a>/h6> dl classdomintro>dt>var>context/var> . code idline-styles:dom-context-2d-linewidth>a href#dom-context-2d-linewidth>lineWidth/a>/code> var>value/var> dt>var>styles/var> . code idline-styles:dom-context-2d-linewidth-2>a href#dom-context-2d-linewidth>lineWidth/a>/code> var>value/var> dd> p>Returns the current line width./p> p>Can be set, to change the line width. Values that are not finite values greater than zero are ignored./p> dt>var>context/var> . code idline-styles:dom-context-2d-linecap>a href#dom-context-2d-linecap>lineCap/a>/code> var>value/var> dt>var>styles/var> . code idline-styles:dom-context-2d-linecap-2>a href#dom-context-2d-linecap>lineCap/a>/code> var>value/var> dd> p>Returns the current line cap style./p> p>Can be set, to change the line cap style./p> p>The possible line cap styles are code>butt/code>, code>round/code>, and code>square/code>. Other values are ignored./p> dt>var>context/var> . code idline-styles:dom-context-2d-linejoin>a href#dom-context-2d-linejoin>lineJoin/a>/code> var>value/var> dt>var>styles/var> . code idline-styles:dom-context-2d-linejoin-2>a href#dom-context-2d-linejoin>lineJoin/a>/code> var>value/var> dd> p>Returns the current line join style./p> p>Can be set, to change the line join style./p> p>The possible line join styles are code>bevel/code>, code>round/code>, and code>miter/code>. Other values are ignored./p> dt>var>context/var> . code idline-styles:dom-context-2d-miterlimit>a href#dom-context-2d-miterlimit>miterLimit/a>/code> var>value/var> dt>var>styles/var> . code idline-styles:dom-context-2d-miterlimit-2>a href#dom-context-2d-miterlimit>miterLimit/a>/code> var>value/var> dd> p>Returns the current miter limit ratio./p> p>Can be set, to change the miter limit ratio. Values that are not finite values greater than zero are ignored./p> dt>var>context/var> . code idline-styles:dom-context-2d-setlinedash>a href#dom-context-2d-setlinedash>setLineDash/a>/code>(var>segments/var>)dt>var>styles/var> . code idline-styles:dom-context-2d-setlinedash-2>a href#dom-context-2d-setlinedash>setLineDash/a>/code>(var>segments/var>)dd> p>Sets the current line dash pattern (as used when stroking). The argument is a list of distances for which to alternately have the line on and the line off./p> dt>var>segments/var> var>context/var> . code idline-styles:dom-context-2d-getlinedash>a href#dom-context-2d-getlinedash>getLineDash/a>/code>()dt>var>segments/var> var>styles/var> . code idline-styles:dom-context-2d-getlinedash-2>a href#dom-context-2d-getlinedash>getLineDash/a>/code>()dd> p>Returns a copy of the current line dash pattern. The array returned will always have an even number of entries (i.e. the pattern is normalized)./p> dt>var>context/var> . code idline-styles:dom-context-2d-linedashoffset>a href#dom-context-2d-linedashoffset>lineDashOffset/a>/code>dt>var>styles/var> . code idline-styles:dom-context-2d-linedashoffset-2>a href#dom-context-2d-linedashoffset>lineDashOffset/a>/code>dd> p>Returns the phase offset (in the same units as the line dash pattern)./p> p>Can be set, to change the phase offset. Values that are not finite values are ignored./p> /dl> p>Objects that implement the code idline-styles:canvaspathdrawingstyles>a href#canvaspathdrawingstyles>CanvasPathDrawingStyles/a>/code> interface have attributes and methods (defined in this section) that control how lines are treated by the object./p> p>The dfn iddom-context-2d-linewidth>code>lineWidth/code>/dfn> attribute gives the width of lines, in coordinate space units. On getting, it must return the current value. On setting, zero, negative, infinite, and NaN values must be ignored, leaving the value unchanged; other values must change the current value to the new value./p> p>When the object implementing the code idline-styles:canvaspathdrawingstyles-2>a href#canvaspathdrawingstyles>CanvasPathDrawingStyles/a>/code> interface is created, the code idline-styles:dom-context-2d-linewidth-3>a href#dom-context-2d-linewidth>lineWidth/a>/code> attribute must initially have the value 1.0./p> hr> p>The dfn iddom-context-2d-linecap>code>lineCap/code>/dfn> attribute defines the type of endings that UAs will place on the end of lines. The three valid values are code>butt/code>, code>round/code>, and code>square/code>./p> p>On getting, it must return the current value. On setting, the current value must be changed to the new value./p> p>When the object implementing the code idline-styles:canvaspathdrawingstyles-3>a href#canvaspathdrawingstyles>CanvasPathDrawingStyles/a>/code> interface is created, the code idline-styles:dom-context-2d-linecap-3>a href#dom-context-2d-linecap>lineCap/a>/code> attribute must initially have the value code>butt/code>./p> hr> p>The dfn iddom-context-2d-linejoin>code>lineJoin/code>/dfn> attribute defines the type of corners that UAs will place where two lines meet. The three valid values are code>bevel/code>, code>round/code>, and code>miter/code>./p> p>On getting, it must return the current value. On setting, the current value must be changed to the new value./p> p>When the object implementing the code idline-styles:canvaspathdrawingstyles-4>a href#canvaspathdrawingstyles>CanvasPathDrawingStyles/a>/code> interface is created, the code idline-styles:dom-context-2d-linejoin-3>a href#dom-context-2d-linejoin>lineJoin/a>/code> attribute must initially have the value code>miter/code>./p> hr> p>When the code idline-styles:dom-context-2d-linejoin-4>a href#dom-context-2d-linejoin>lineJoin/a>/code> attribute has the value code>miter/code>, strokes use the miter limit ratio to decide how to render joins. The miter limit ratio can be explicitly set using the dfn iddom-context-2d-miterlimit>code>miterLimit/code>/dfn> attribute. On getting, it must return the current value. On setting, zero, negative, infinite, and NaN values must be ignored, leaving the value unchanged; other values must change the current value to the new value./p> p>When the object implementing the code idline-styles:canvaspathdrawingstyles-5>a href#canvaspathdrawingstyles>CanvasPathDrawingStyles/a>/code> interface is created, the code idline-styles:dom-context-2d-miterlimit-3>a href#dom-context-2d-miterlimit>miterLimit/a>/code> attribute must initially have the value 10.0./p> hr> p>Each code idline-styles:canvaspathdrawingstyles-6>a href#canvaspathdrawingstyles>CanvasPathDrawingStyles/a>/code> object has a dfn iddash-list>dash list/dfn>, which is either empty or consists of an even number of non-negative numbers. Initially, the a href#dash-list idline-styles:dash-list>dash list/a> must be empty./p> p>The dfn iddom-context-2d-setlinedash>code>setLineDash()/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>Let var>a/var> be the argument.li>p>If any value in var>a/var> is not finite (e.g. an Infinity or a NaN value), or if any value is negative (less than zero), then return (without throwing an exception; user agents could show a message on a developer console, though, as that would be helpful for debugging).li>p>If the number of elements in var>a/var> is odd, then let var>a/var> be the concatenation of two copies of var>a/var>.li>p>Let the objects a href#dash-list idline-styles:dash-list-2>dash list/a> be var>a/var>./ol> p>When the dfn iddom-context-2d-getlinedash>code>getLineDash()/code>/dfn> method is invoked, it must return a sequence whose values are the values of the objects a href#dash-list idline-styles:dash-list-3>dash list/a>, in the same order./p> p>It is sometimes useful to change the phase of the dash pattern, e.g. to achieve a marching ants effect. The phase can be set using the dfn iddom-context-2d-linedashoffset>code>lineDashOffset/code>/dfn> attribute. On getting, it must return the current value. On setting, infinite and NaN values must be ignored, leaving the value unchanged; other values must change the current value to the new value./p> p>When the object implementing the code idline-styles:canvaspathdrawingstyles-7>a href#canvaspathdrawingstyles>CanvasPathDrawingStyles/a>/code> interface is created, the code idline-styles:dom-context-2d-linedashoffset-3>a href#dom-context-2d-linedashoffset>lineDashOffset/a>/code> attribute must initially have the value 0.0./p> hr> p>When a user agent is to dfn idtrace-a-path>trace a path/dfn>, given an object var>style/var> that implements the code idline-styles:canvaspathdrawingstyles-8>a href#canvaspathdrawingstyles>CanvasPathDrawingStyles/a>/code> interface, it must run the following algorithm. This algorithm returns a new a href#concept-path idline-styles:concept-path>path/a>./p> ol>li>p>Let var>path/var> be a copy of the path being traced.li>p>Prune all zero-length a href#line-segments idline-styles:line-segments>line segments/a> from var>path/var>.li>p>Remove from var>path/var> any subpaths containing no lines (i.e. subpaths with just one point).li>p>Replace each point in each subpath of var>path/var> other than the first point and the last point of each subpath by a i>join/i> that joins the line leading to that point to the line leading out of that point, such that the subpaths all consist of two points (a starting point with a line leading out of it, and an ending point with a line leading into it), one or more lines (connecting the points and the joins), and zero or more joins (each connecting one line to another), connected together such that each subpath is a series of one or more lines with a join between each one and a point on each end.li>p>Add a straight closing line to each closed subpath in var>path/var> connecting the last point and the first point of that subpath; change the last point to a join (from the previously last line to the newly added closing line), and change the first point to a join (from the newly added closing line to the first line)./p> li>p>If the var>styles/var> a href#dash-list idline-styles:dash-list-4>dash list/a> is empty, then jump to the step labeled i>convert/i>.li>p>Let var>pattern width/var> be the concatenation of all the entries of the var>styles/var> a href#dash-list idline-styles:dash-list-5>dash list/a>, in coordinate space units./p> li>p>For each subpath var>subpath/var> in var>path/var>, run the following substeps. These substeps mutate the subpaths in var>path/var> i>in vivo/i>./p> ol>li>p>Let var>subpath width/var> be the length of all the lines of var>subpath/var>, in coordinate space units./p> li>p>Let var>offset/var> be the value of the var>styles/var> code idline-styles:dom-context-2d-linedashoffset-4>a href#dom-context-2d-linedashoffset>lineDashOffset/a>/code>, in coordinate space units.li> p>While var>offset/var> is greater than var>pattern width/var>, decrement it by var>pattern width/var>./p> p>While var>offset/var> is less than zero, increment it by var>pattern width/var>./p> li>p>Define var>L/var> to be a linear coordinate line defined along all lines in var>subpath/var>, such that the start of the first line in the subpath is defined as coordinate 0, and the end of the last line in the subpath is defined as coordinate var>subpath width/var>.li>p>Let var>position/var> be zero minus var>offset/var>.li>p>Let var>index/var> be 0.li>p>Let var>current state/var> be i>off/i> (the other states being i>on/i> and i>zero-on/i>).li>p>i>Dash on/i>: Let var>segment length/var> be the value of the var>styles/var> a href#dash-list idline-styles:dash-list-6>dash list/a>s var>index/var>th entry.li>p>Increment var>position/var> by var>segment length/var>.li>p>If var>position/var> is greater than var>subpath width/var>, then end these substeps for this subpath and start them again for the next subpath; if there are no more subpaths, then jump to the step labeled i>convert/i> instead.li>p>If var>segment length/var> is nonzero, then let var>current state/var> be i>on/i>.li>p>Increment var>index/var> by one.li>p>i>Dash off/i>: Let var>segment length/var> be the value of the var>styles/var> a href#dash-list idline-styles:dash-list-7>dash list/a>s var>index/var>th entry.li>p>Let var>start/var> be the offset var>position/var> on var>L/var>.li>p>Increment var>position/var> by var>segment length/var>.li>p>If var>position/var> is less than zero, then jump to the step labeled i>post-cut/i>.li>p>If var>start/var> is less than zero, then let var>start/var> be zero.li>p>If var>position/var> is greater than var>subpath width/var>, then let var>end/var> be the offset var>subpath width/var> on var>L/var>. Otherwise, let var>end/var> be the offset var>position/var> on var>L/var>.li> p>Jump to the first appropriate step:/p> dl classswitch>dt>If var>segment length/var> is zero and var>current state/var> is i>off/i>dd> p>Do nothing, just continue to the next step./p> dt>If var>current state/var> is i>off/i>dd> p>Cut the line on which var>end/var> finds itself short at var>end/var> and place a point there, cutting in two the subpath that it was in; remove all line segments, joins, points, and subpaths that are between var>start/var> and var>end/var>; and finally place a single point at var>start/var> with no lines connecting to it./p> p>The point has a i>directionality/i> for the purposes of drawing line caps (see below). The directionality is the direction that the original line had at that point (i.e. when var>L/var> was defined above)./p> dt>Otherwisedd> p>Cut the line on which var>start/var> finds itself into two at var>start/var> and place a point there, cutting in two the subpath that it was in, and similarly cut the line on which var>end/var> finds itself short at var>end/var> and place a point there, cutting in two the subpath that em>it/em> was in, and then remove all line segments, joins, points, and subpaths that are between var>start/var> and var>end/var>./p> p>If var>start/var> and var>end/var> are the same point, then this results in just the line being cut in two and two points being inserted there, with nothing being removed, unless a join also happens to be at that point, in which case the join must be removed./p> /dl> li>p>i>Post-cut/i>: If var>position/var> is greater than var>subpath width/var>, then jump to the step labeled i>convert/i>.li>p>If var>segment length/var> is greater than zero, then let var>positioned-at-on-dash/var> be false.li>p>Increment var>index/var> by one. If it is equal to the number of entries in the var>styles/var> a href#dash-list idline-styles:dash-list-8>dash list/a>, then let var>index/var> be 0.li>p>Return to the step labeled i>dash on/i>./ol> li> p>i>Convert/i>: This is the step that converts the path to a new path that represents its stroke./p> p>Create a new a href#concept-path idline-styles:concept-path-2>path/a> that describes the edge of the areas that would be covered if a straight line of length equal to the var>styles/var> code idline-styles:dom-context-2d-linewidth-4>a href#dom-context-2d-linewidth>lineWidth/a>/code> was swept along each subpath in var>path/var> while being kept at an angle such that the line is orthogonal to the path being swept, replacing each point with the end cap necessary to satisfy the var>styles/var> code idline-styles:dom-context-2d-linecap-4>a href#dom-context-2d-linecap>lineCap/a>/code> attribute as described previously and elaborated below, and replacing each join with the join necessary to satisfy the var>styles/var> code idline-styles:dom-context-2d-linejoin-5>a href#dom-context-2d-linejoin>lineJoin/a>/code> type, as defined below./p> p>strong>Caps/strong>: Each point has a flat edge perpendicular to the direction of the line coming out of it. This is then augmented according to the value of the var>styles/var> code idline-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 idline-styles:dom-context-2d-linewidth-5>a href#dom-context-2d-linewidth>lineWidth/a>/code> width must additionally be placed on to the line coming out of each point. The code>square/code> value means that a rectangle with the length of the var>styles/var> code idline-styles:dom-context-2d-linewidth-6>a href#dom-context-2d-linewidth>lineWidth/a>/code> width and the width of half the var>styles/var> code idline-styles:dom-context-2d-linewidth-7>a href#dom-context-2d-linewidth>lineWidth/a>/code> width, placed flat against the edge perpendicular to the direction of the line coming out of the point, must be added at each point./p> p>Points with no lines coming out of them must have two caps placed back-to-back as if it was really two points connected to each other by an infinitesimally short straight line in the direction of the points i>directionality/i> (as defined above)./p> p>strong>Joins/strong>: In addition to the point where a join occurs, two additional points are relevant to each join, one for each line: the two corners found half the line width away from the join point, one perpendicular to each line, each on the side furthest from the other line./p> p>A triangle connecting these two opposite corners with a straight line, with the third point of the triangle being the join point, must be added at all joins. The code idline-styles:dom-context-2d-linejoin-6>a href#dom-context-2d-linejoin>lineJoin/a>/code> attribute controls whether anything else is rendered. The three aforementioned values have the following meanings:/p> p>The code>bevel/code> value means that this is all that is rendered at joins./p> p>The code>round/code> value means that an arc connecting the two aforementioned corners of the join, abutting (and not overlapping) the aforementioned triangle, with the diameter equal to the line width and the origin at the point of the join, must be added at joins./p> p>The code>miter/code> value means that a second triangle must (if it can given the miter length) be added at the join, with one line being the line between the two aforementioned corners, abutting the first triangle, and the other two being continuations of the outside edges of the two joining lines, as long as required to intersect without going over the miter length./p> p>The miter length is the distance from the point where the join occurs to the intersection of the line edges on the outside of the join. The miter limit ratio is the maximum allowed ratio of the miter length to half the line width. If the miter length would cause the miter limit ratio (as set by the var>style/var> code idline-styles:dom-context-2d-miterlimit-4>a href#dom-context-2d-miterlimit>miterLimit/a>/code> attribute) to be exceeded, then this second triangle must not be added./p> p>The subpaths in the newly created path must be oriented such that for any point, the number of times a half-infinite straight line drawn from that point crosses a subpath is even if and only if the number of times a half-infinite straight line drawn from that same point crosses a subpath going in one direction is equal to the number of times it crosses a subpath going in the other direction./p> li>p>Return the newly created path./ol> h6 idtext-styles>span classsecno>4.12.5.1.4/span> Text stylesa href#text-styles classself-link>/a>/h6> dl classdomintro>dt>var>context/var> . code idtext-styles:dom-context-2d-font>a href#dom-context-2d-font>font/a>/code> var>value/var> dt>var>styles/var> . code idtext-styles:dom-context-2d-font-2>a href#dom-context-2d-font>font/a>/code> var>value/var> dd> p>Returns the current font settings./p> p>Can be set, to change the font. The syntax is the same as for the CSS a idtext-styles:font hrefhttps://drafts.csswg.org/css-fonts/#font-prop data-x-internalfont>font/a> property; values that cannot be parsed as CSS font values are ignored./p> p>Relative keywords and lengths are computed relative to the font of the code idtext-styles:the-canvas-element>a href#the-canvas-element>canvas/a>/code> element./p> dt>var>context/var> . code idtext-styles:dom-context-2d-textalign>a href#dom-context-2d-textalign>textAlign/a>/code> var>value/var> dt>var>styles/var> . code idtext-styles:dom-context-2d-textalign-2>a href#dom-context-2d-textalign>textAlign/a>/code> var>value/var> dd> p>Returns the current text alignment settings./p> p>Can be set, to change the alignment. The possible values are and their meanings are given below. Other values are ignored. The default is code>start/code>./p> dt>var>context/var> . code idtext-styles:dom-context-2d-textbaseline>a href#dom-context-2d-textbaseline>textBaseline/a>/code> var>value/var> dt>var>styles/var> . code idtext-styles:dom-context-2d-textbaseline-2>a href#dom-context-2d-textbaseline>textBaseline/a>/code> var>value/var> dd> p>Returns the current baseline alignment settings./p> p>Can be set, to change the baseline alignment. The possible values and their meanings are given below. Other values are ignored. The default is code idtext-styles:dom-context-2d-textbaseline-alphabetic>a href#dom-context-2d-textbaseline-alphabetic>alphabetic/a>/code>./p> dt>var>context/var> . code idtext-styles:dom-context-2d-direction>a href#dom-context-2d-direction>direction/a>/code> var>value/var> dt>var>styles/var> . code idtext-styles:dom-context-2d-direction-2>a href#dom-context-2d-direction>direction/a>/code> var>value/var> dd> p>Returns the current directionality./p> p>Can be set, to change the directionality. The possible values and their meanings are given below. Other values are ignored. The default is code idtext-styles:dom-context-2d-direction-inherit>a href#dom-context-2d-direction-inherit>inherit/a>/code>./p> /dl> p>Objects that implement the code idtext-styles:canvastextdrawingstyles>a href#canvastextdrawingstyles>CanvasTextDrawingStyles/a>/code> interface have attributes (defined in this section) that control how text is laid out (rasterized or outlined) by the object. Such objects can also have a dfn idfont-style-source-object>font style source object/dfn>. For code idtext-styles:canvasrenderingcontext2d>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> objects, this is the code idtext-styles:the-canvas-element-2>a href#the-canvas-element>canvas/a>/code> element referenced by the contexts canvas property./p> p>The dfn iddom-context-2d-font>code>font/code>/dfn> IDL attribute, on setting, must be a hrefhttps://drafts.csswg.org/css-syntax/#parse-grammar idtext-styles:parse-something-according-to-a-css-grammar data-x-internalparse-something-according-to-a-css-grammar>parsed as a CSS <font> value/a> (but without supporting property-independent style sheet syntax like inherit), and the resulting font must be assigned to the context, with the a idtext-styles:line-height hrefhttps://drafts.csswg.org/css2/visudet.html#propdef-line-height data-x-internalline-height>line-height/a> component forced to normal, with the a idtext-styles:font-size hrefhttps://drafts.csswg.org/css-fonts/#font-size-prop data-x-internalfont-size>font-size/a> component converted to a hrefhttps://drafts.csswg.org/css-values/#px idtext-styles:px data-x-internalpx>CSS pixels/a>, and with system fonts being computed to explicit values. If the new value is syntactically incorrect (including using property-independent style sheet syntax like inherit or initial), then it must be ignored, without assigning a new font value. a href#refsCSS>CSS/a>/p> p>Font family names must be interpreted in the context of the a href#font-style-source-object idtext-styles:font-style-source-object>font style source object/a> when the font is to be used; any fonts embedded using code>@font-face/code> or loaded using code idtext-styles:fontface>a href#fontface>FontFace/a>/code> objects that are visible to the a href#font-style-source-object idtext-styles:font-style-source-object-2>font style source object/a> must therefore be available once they are loaded. (Each a href#font-style-source-object idtext-styles:font-style-source-object-3>font style source object/a> has a a idtext-styles:font-source hrefhttps://drafts.csswg.org/css-font-loading/#font-source data-x-internalfont-source>font source/a>, which determines what fonts are available.) If a font is used before it is fully loaded, or if the a href#font-style-source-object idtext-styles:font-style-source-object-4>font style source object/a> does not have that font in scope at the time the font is to be used, then it must be treated as if it was an unknown font, falling back to another as described by the relevant CSS specifications. a href#refsCSSFONTS>CSSFONTS/a> a href#refsCSSFONTLOAD>CSSFONTLOAD/a>/p> p>On getting, the code idtext-styles:dom-context-2d-font-3>a href#dom-context-2d-font>font/a>/code> attribute must return the a hrefhttps://drafts.csswg.org/cssom/#serialize-a-css-value idtext-styles:serializing-a-css-value data-x-internalserializing-a-css-value>serialized form/a> of the current font of the context (with no a idtext-styles:line-height-2 hrefhttps://drafts.csswg.org/css2/visudet.html#propdef-line-height data-x-internalline-height>line-height/a> component). a href#refsCSSOM>CSSOM/a>/p> div classexample> p>For example, after the following statement:/p> pre>context.font italic 400 12px/2 Unknown Font, sans-serif;/pre> p>...the expression code>context.font/code> would evaluate to the string code>italic 12px Unknown Font, sans-serif/code>. The 400 font-weight doesnt appear because that is the default value. The line-height doesnt appear because it is forced to normal, the default value./p> /div> p>When the object implementing the code idtext-styles:canvastextdrawingstyles-2>a href#canvastextdrawingstyles>CanvasTextDrawingStyles/a>/code> interface is created, the font of the context must be set to 10px sans-serif. When the a idtext-styles:font-size-2 hrefhttps://drafts.csswg.org/css-fonts/#font-size-prop data-x-internalfont-size>font-size/a> component is set to lengths using percentages, a idtext-styles:em hrefhttps://drafts.csswg.org/css-values/#em data-x-internalem>em/a> or a idtext-styles:ex hrefhttps://drafts.csswg.org/css-values/#ex data-x-internalex>ex/a> units, or the larger or smaller keywords, these must be interpreted relative to the a idtext-styles:computed-value hrefhttps://drafts.csswg.org/css-cascade/#computed-value data-x-internalcomputed-value>computed value/a> of the a idtext-styles:font-size-3 hrefhttps://drafts.csswg.org/css-fonts/#font-size-prop data-x-internalfont-size>font-size/a> property of the a href#font-style-source-object idtext-styles:font-style-source-object-5>font style source object/a> at the time that the attribute is set, if it is an element. When the a idtext-styles:font-weight hrefhttps://drafts.csswg.org/css-fonts/#font-weight-prop data-x-internalfont-weight>font-weight/a> component is set to the relative values bolder and lighter, these must be interpreted relative to the a idtext-styles:computed-value-2 hrefhttps://drafts.csswg.org/css-cascade/#computed-value data-x-internalcomputed-value>computed value/a> of the a idtext-styles:font-weight-2 hrefhttps://drafts.csswg.org/css-fonts/#font-weight-prop data-x-internalfont-weight>font-weight/a> property of the a href#font-style-source-object idtext-styles:font-style-source-object-6>font style source object/a> at the time that the attribute is set, if it is an element. If the a hrefhttps://drafts.csswg.org/css-cascade/#computed-value idtext-styles:computed-value-3 data-x-internalcomputed-value>computed values/a> are undefined for a particular case (e.g. because the a href#font-style-source-object idtext-styles:font-style-source-object-7>font style source object/a> is not an element or is not a href#being-rendered idtext-styles:being-rendered>being rendered/a>), then the relative keywords must be interpreted relative to the normal-weight 10px sans-serif default./p> p>The dfn iddom-context-2d-textalign>code>textAlign/code>/dfn> IDL attribute, on getting, must return the current value. On setting, the current value must be changed to the new value. When the object implementing the code idtext-styles:canvastextdrawingstyles-3>a href#canvastextdrawingstyles>CanvasTextDrawingStyles/a>/code> interface is created, the code idtext-styles:dom-context-2d-textalign-3>a href#dom-context-2d-textalign>textAlign/a>/code> attribute must initially have the value code idtext-styles:dom-context-2d-textalign-start>a href#dom-context-2d-textalign-start>start/a>/code>./p> p>The dfn iddom-context-2d-textbaseline>code>textBaseline/code>/dfn> IDL attribute, on getting, must return the current value. On setting, the current value must be changed to the new value. When the object implementing the code idtext-styles:canvastextdrawingstyles-4>a href#canvastextdrawingstyles>CanvasTextDrawingStyles/a>/code> interface is created, the code idtext-styles:dom-context-2d-textbaseline-3>a href#dom-context-2d-textbaseline>textBaseline/a>/code> attribute must initially have the value code idtext-styles:dom-context-2d-textbaseline-alphabetic-2>a href#dom-context-2d-textbaseline-alphabetic>alphabetic/a>/code>./p> p>The dfn iddom-context-2d-direction>code>direction/code>/dfn> IDL attribute, on getting, must return the current value. On setting, the current value must be changed to the new value. When the object implementing the code idtext-styles:canvastextdrawingstyles-5>a href#canvastextdrawingstyles>CanvasTextDrawingStyles/a>/code> interface is created, the code idtext-styles:dom-context-2d-direction-3>a href#dom-context-2d-direction>direction/a>/code> attribute must initially have the value code idtext-styles:dom-context-2d-direction-inherit-2>a href#dom-context-2d-direction-inherit>inherit/a>/code>./p> p>The code idtext-styles:dom-context-2d-textalign-4>a href#dom-context-2d-textalign>textAlign/a>/code> attributes allowed keywords are as follows:/p> dl>dt>dfn iddom-context-2d-textalign-start>code>start/code>/dfn> dd>p>Align to the start edge of the text (left side in left-to-right text, right side in right-to-left text).dt>dfn iddom-context-2d-textalign-end>code>end/code>/dfn> dd>p>Align to the end edge of the text (right side in left-to-right text, left side in right-to-left text).dt>dfn iddom-context-2d-textalign-left>code>left/code>/dfn> dd>p>Align to the left.dt>dfn iddom-context-2d-textalign-right>code>right/code>/dfn> dd>p>Align to the right.dt>dfn iddom-context-2d-textalign-center>code>center/code>/dfn> dd>p>Align to the center./dl> p>The code idtext-styles:dom-context-2d-textbaseline-4>a href#dom-context-2d-textbaseline>textBaseline/a>/code> attributes allowed keywords correspond to alignment points in the font:/p> p>img src/images/baselines.png width738 altThe 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. height300>/p> p>The keywords map to these alignment points as follows:/p> dl>dt>dfn iddom-context-2d-textbaseline-top>code>top/code>/dfn> dd>The top of the em squaredt>dfn iddom-context-2d-textbaseline-hanging>code>hanging/code>/dfn> dd>The hanging baselinedt>dfn iddom-context-2d-textbaseline-middle>code>middle/code>/dfn> dd>The middle of the em squaredt>dfn iddom-context-2d-textbaseline-alphabetic>code>alphabetic/code>/dfn> dd>The alphabetic baselinedt>dfn iddom-context-2d-textbaseline-ideographic>code>ideographic/code>/dfn> dd>The ideographic baselinedt>dfn iddom-context-2d-textbaseline-bottom>code>bottom/code>/dfn> dd>The bottom of the em square/dl> p>The code idtext-styles:dom-context-2d-direction-4>a href#dom-context-2d-direction>direction/a>/code> attributes allowed keywords are as follows:/p> dl>dt>dfn iddom-context-2d-direction-ltr>code>ltr/code>/dfn> dd>p>Treat input to the a href#text-preparation-algorithm idtext-styles:text-preparation-algorithm>text preparation algorithm/a> as left-to-right text.dt>dfn iddom-context-2d-direction-rtl>code>rtl/code>/dfn> dd>p>Treat input to the a href#text-preparation-algorithm idtext-styles:text-preparation-algorithm-2>text preparation algorithm/a> as right-to-left text.dt>dfn iddom-context-2d-direction-inherit>code>inherit/code>/dfn> dd>p>Default to the directionality of the code idtext-styles:the-canvas-element-3>a href#the-canvas-element>canvas/a>/code> element or code idtext-styles:document>a href#document>Document/a>/code> as appropriate./dl> p>The dfn idtext-preparation-algorithm>text preparation algorithm/dfn> is as follows. It takes as input a string var>text /var>, a code idtext-styles:canvastextdrawingstyles-6>a href#canvastextdrawingstyles>CanvasTextDrawingStyles/a>/code> object var>target/var>, and an optional length var>maxWidth/var>. It returns an array of glyph shapes, each positioned on a common coordinate space, a var>physical alignment/var> whose value is one of i>left/i>, i>right/i>, and i>center/i>, and an a idtext-styles:inline-box hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a>. (Most callers of this algorithm ignore the var>physical alignment/var> and the a idtext-styles:inline-box-2 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a>.)/p> ol>li>p>If var>maxWidth/var> was provided but is less than or equal to zero or equal to NaN, then return an empty array.li>p>Replace all a idtext-styles:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> in var>text/var> with U+0020 SPACE characters.li>p>Let var>font/var> be the current font of var>target/var>, as given by that objects code idtext-styles:dom-context-2d-font-4>a href#dom-context-2d-font>font/a>/code> attribute.li> p>Apply the appropriate step from the following list to determine the value of var>direction/var>:/p> dl classswitch>dt>If the var>target/var> objects code idtext-styles:dom-context-2d-direction-5>a href#dom-context-2d-direction>direction/a>/code> attribute has the value code idtext-styles:dom-context-2d-direction-ltr>a href#dom-context-2d-direction-ltr>ltr/a>/code>dd>Let var>direction/var> be a href#concept-ltr idtext-styles:concept-ltr>ltr/a>.dt>If the var>target/var> objects code idtext-styles:dom-context-2d-direction-6>a href#dom-context-2d-direction>direction/a>/code> attribute has the value code idtext-styles:dom-context-2d-direction-rtl>a href#dom-context-2d-direction-rtl>rtl/a>/code>dd>Let var>direction/var> be a href#concept-rtl idtext-styles:concept-rtl>rtl/a>.dt>If the var>target/var> objects a href#font-style-source-object idtext-styles:font-style-source-object-8>font style source object/a> is an elementdd>Let var>direction/var> be a href#the-directionality idtext-styles:the-directionality>the directionality/a> of the var>target/var> objects a href#font-style-source-object idtext-styles:font-style-source-object-9>font style source object/a>.dt>If the var>target/var> objects a href#font-style-source-object idtext-styles:font-style-source-object-10>font style source object/a> is a code idtext-styles:document-2>a href#document>Document/a>/code> with a non-null a idtext-styles:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>dd>Let var>direction/var> be a href#the-directionality idtext-styles:the-directionality-2>the directionality/a> of the var>target/var> objects a href#font-style-source-object idtext-styles:font-style-source-object-11>font style source object/a>s a idtext-styles:document-element-2 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>.dt>Otherwisedd>Let var>direction/var> be a href#concept-ltr idtext-styles:concept-ltr-2>ltr/a>./dl> li>p>Form a hypothetical infinitely-wide CSS a idtext-styles:line-box hrefhttps://drafts.csswg.org/css2/visuren.html#line-box data-x-internalline-box>line box/a> containing a single a idtext-styles:inline-box-3 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a> containing the text var>text/var>, with all the properties at their initial values except the a idtext-styles:font-2 hrefhttps://drafts.csswg.org/css-fonts/#font-prop data-x-internalfont>font/a> property of the a idtext-styles:inline-box-4 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a> set to var>font/var>, the a idtext-styles:direction hrefhttps://drafts.csswg.org/css-writing-modes/#direction data-x-internaldirection>direction/a> property of the a idtext-styles:inline-box-5 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a> set to var>direction/var>, and the a idtext-styles:white-space hrefhttps://drafts.csswg.org/css-text/#white-space-property data-x-internalwhite-space>white-space/a> property set to pre. a href#refsCSS>CSS/a>li>p>If var>maxWidth/var> was provided and the hypothetical width of the a idtext-styles:inline-box-6 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a> in the hypothetical a idtext-styles:line-box-2 hrefhttps://drafts.csswg.org/css2/visuren.html#line-box data-x-internalline-box>line box/a> is greater than var>maxWidth/var> a hrefhttps://drafts.csswg.org/css-values/#px idtext-styles:px-2 data-x-internalpx>CSS pixels/a>, then change var>font/var> to have a more condensed font (if one is available or if a reasonably readable one can be synthesized by applying a horizontal scale factor to the font) or a smaller font, and return to the previous step.li> p>The var>anchor point/var> is a point on the a idtext-styles:inline-box-7 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a>, 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 idtext-styles:dom-context-2d-textalign-5>a href#dom-context-2d-textalign>textAlign/a>/code> and code idtext-styles:dom-context-2d-textbaseline-5>a href#dom-context-2d-textbaseline>textBaseline/a>/code> values as follows:/p> p>Horizontal position:/p> dl>dt>If code idtext-styles:dom-context-2d-textalign-6>a href#dom-context-2d-textalign>textAlign/a>/code> is code idtext-styles:dom-context-2d-textalign-left>a href#dom-context-2d-textalign-left>left/a>/code>dt>If code idtext-styles:dom-context-2d-textalign-7>a href#dom-context-2d-textalign>textAlign/a>/code> is code idtext-styles:dom-context-2d-textalign-start-2>a href#dom-context-2d-textalign-start>start/a>/code> and var>direction/var> is ltrdt>If code idtext-styles:dom-context-2d-textalign-8>a href#dom-context-2d-textalign>textAlign/a>/code> is code idtext-styles:dom-context-2d-textalign-end>a href#dom-context-2d-textalign-end>end/a>/code> and var>direction/var> is rtldd>Let the var>anchor point/var>s horizontal position be the left edge of the a idtext-styles:inline-box-8 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a>, and let var>physical alignment/var> be i>left/i>.dt>If code idtext-styles:dom-context-2d-textalign-9>a href#dom-context-2d-textalign>textAlign/a>/code> is code idtext-styles:dom-context-2d-textalign-right>a href#dom-context-2d-textalign-right>right/a>/code>dt>If code idtext-styles:dom-context-2d-textalign-10>a href#dom-context-2d-textalign>textAlign/a>/code> is code idtext-styles:dom-context-2d-textalign-end-2>a href#dom-context-2d-textalign-end>end/a>/code> and var>direction/var> is ltrdt>If code idtext-styles:dom-context-2d-textalign-11>a href#dom-context-2d-textalign>textAlign/a>/code> is code idtext-styles:dom-context-2d-textalign-start-3>a href#dom-context-2d-textalign-start>start/a>/code> and var>direction/var> is rtldd>Let the var>anchor point/var>s horizontal position be the right edge of the a idtext-styles:inline-box-9 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a>, and let var>physical alignment/var> be i>right/i>.dt>If code idtext-styles:dom-context-2d-textalign-12>a href#dom-context-2d-textalign>textAlign/a>/code> is code idtext-styles:dom-context-2d-textalign-center>a href#dom-context-2d-textalign-center>center/a>/code>dd>Let the var>anchor point/var>s horizontal position be half way between the left and right edges of the a idtext-styles:inline-box-10 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a>, and let var>physical alignment/var> be i>center/i>./dl> p>Vertical position:/p> dl>dt>If code idtext-styles:dom-context-2d-textbaseline-6>a href#dom-context-2d-textbaseline>textBaseline/a>/code> is code idtext-styles:dom-context-2d-textbaseline-top>a href#dom-context-2d-textbaseline-top>top/a>/code>dd>Let the var>anchor point/var>s vertical position be the top of the em box of the first available font of the a idtext-styles:inline-box-11 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a>.dt>If code idtext-styles:dom-context-2d-textbaseline-7>a href#dom-context-2d-textbaseline>textBaseline/a>/code> is code idtext-styles:dom-context-2d-textbaseline-hanging>a href#dom-context-2d-textbaseline-hanging>hanging/a>/code>dd>Let the var>anchor point/var>s vertical position be the hanging baseline of the first available font of the a idtext-styles:inline-box-12 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a>.dt>If code idtext-styles:dom-context-2d-textbaseline-8>a href#dom-context-2d-textbaseline>textBaseline/a>/code> is code idtext-styles:dom-context-2d-textbaseline-middle>a href#dom-context-2d-textbaseline-middle>middle/a>/code>dd>Let the var>anchor point/var>s vertical position be half way between the bottom and the top of the em box of the first available font of the a idtext-styles:inline-box-13 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a>.dt>If code idtext-styles:dom-context-2d-textbaseline-9>a href#dom-context-2d-textbaseline>textBaseline/a>/code> is code idtext-styles:dom-context-2d-textbaseline-alphabetic-3>a href#dom-context-2d-textbaseline-alphabetic>alphabetic/a>/code>dd>Let the var>anchor point/var>s vertical position be the alphabetic baseline of the first available font of the a idtext-styles:inline-box-14 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a>.dt>If code idtext-styles:dom-context-2d-textbaseline-10>a href#dom-context-2d-textbaseline>textBaseline/a>/code> is code idtext-styles:dom-context-2d-textbaseline-ideographic>a href#dom-context-2d-textbaseline-ideographic>ideographic/a>/code>dd>Let the var>anchor point/var>s vertical position be the ideographic baseline of the first available font of the a idtext-styles:inline-box-15 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a>.dt>If code idtext-styles:dom-context-2d-textbaseline-11>a href#dom-context-2d-textbaseline>textBaseline/a>/code> is code idtext-styles:dom-context-2d-textbaseline-bottom>a href#dom-context-2d-textbaseline-bottom>bottom/a>/code>dd>Let the var>anchor point/var>s vertical position be the bottom of the em box of the first available font of the a idtext-styles:inline-box-16 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a>./dl> li> p>Let var>result/var> be an array constructed by iterating over each glyph in the a idtext-styles:inline-box-17 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a> from left to right (if any), adding to the array, for each glyph, the shape of the glyph as it is in the a idtext-styles:inline-box-18 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a>, positioned on a coordinate space using a hrefhttps://drafts.csswg.org/css-values/#px idtext-styles:px-3 data-x-internalpx>CSS pixels/a> with its origin is at the var>anchor point/var>./p> li>p>Return var>result/var>, var>physical alignment/var>, and the inline box./ol> h6 idbuilding-paths>span classsecno>4.12.5.1.5/span> Building pathsa href#building-paths classself-link>/a>/h6> p>Objects that implement the code idbuilding-paths:canvaspath>a href#canvaspath>CanvasPath/a>/code> interface have a a href#concept-path idbuilding-paths:concept-path>path/a>. A dfn idconcept-path>path/dfn> has a list of zero or more subpaths. Each subpath consists of a list of one or more points, connected by straight or curved dfn idline-segments>line segments/dfn>, and a flag indicating whether the subpath is closed or not. A closed subpath is one where the last point of the subpath is connected to the first point of the subpath by a straight line. Subpaths with only one point are ignored when painting the path./p> p>a href#concept-path idbuilding-paths:concept-path-2>Paths/a> have a dfn idneed-new-subpath>need new subpath/dfn> flag. When this flag is set, certain APIs create a new subpath rather than extending the previous one. When a a href#concept-path idbuilding-paths:concept-path-3>path/a> is created, its a href#need-new-subpath idbuilding-paths:need-new-subpath>need new subpath/a> flag must be set./p> p>When an object implementing the code idbuilding-paths:canvaspath-2>a href#canvaspath>CanvasPath/a>/code> interface is created, its a href#concept-path idbuilding-paths:concept-path-4>path/a> must be initialized to zero subpaths./p> dl classdomintro>dt>var>context/var> . code idbuilding-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 idbuilding-paths:dom-context-2d-moveto-2>a href#dom-context-2d-moveto>moveTo/a>/code>(var>x/var>, var>y/var>)dd> p>Creates a new subpath with the given point./p> dt>var>context/var> . code idbuilding-paths:dom-context-2d-closepath>a href#dom-context-2d-closepath>closePath/a>/code>()dt>var>path/var> . code idbuilding-paths:dom-context-2d-closepath-2>a href#dom-context-2d-closepath>closePath/a>/code>()dd> p>Marks the current subpath as closed, and starts a new subpath with a point the same as the start and end of the newly closed subpath./p> dt>var>context/var> . code idbuilding-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 idbuilding-paths:dom-context-2d-lineto-2>a href#dom-context-2d-lineto>lineTo/a>/code>(var>x/var>, var>y/var>)dd> p>Adds the given point to the current subpath, connected to the previous one by a straight line./p> dt>var>context/var> . code idbuilding-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 idbuilding-paths:dom-context-2d-quadraticcurveto-2>a href#dom-context-2d-quadraticcurveto>quadraticCurveTo/a>/code>(var>cpx/var>, var>cpy/var>, var>x/var>, var>y/var>)dd> p>Adds the given point to the current subpath, connected to the previous one by a quadratic Bézier curve with the given control point./p> dt>var>context/var> . code idbuilding-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 idbuilding-paths:dom-context-2d-beziercurveto-2>a href#dom-context-2d-beziercurveto>bezierCurveTo/a>/code>(var>cp1x/var>, var>cp1y/var>, var>cp2x/var>, var>cp2y/var>, var>x/var>, var>y/var>)dd> p>Adds the given point to the current subpath, connected to the previous one by a cubic Bézier curve with the given control points./p> dt>var>context/var> . code idbuilding-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 idbuilding-paths:dom-context-2d-arcto-2>a href#dom-context-2d-arcto>arcTo/a>/code>(var>x1/var>, var>y1/var>, var>x2/var>, var>y2/var>, var>radiusX/var> , var>radiusY/var>, var>rotation/var> )dd> p>Adds an arc with the given control points and radius to the current subpath, connected to the previous point by a straight line./p> p>If two radii are provided, then the first controls the width of the arcs ellipse, and the second controls the height. If only one is provided, or if they are the same, then the arc is from a circle. In the case of an ellipse, the rotation argument controls the clockwise inclination of the ellipse relative to the x-axis./p> p>Throws an a idbuilding-paths:indexsizeerror hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idbuilding-paths:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the given radius is negative./p> figure classdiagrams> img width357 src/images/arcTo1.png height254 alt> img width468 src/images/arcTo2.png height310 alt> img width513 src/images/arcTo3.png height233 alt> /figure> dt>var>context/var> . code idbuilding-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 idbuilding-paths:dom-context-2d-arc-2>a href#dom-context-2d-arc>arc/a>/code>(var>x/var>, var>y/var>, var>radius/var>, var>startAngle/var>, var>endAngle/var> , var>anticlockwise/var> )dd> p>Adds points to the subpath such that the arc described by the circumference of the circle described by the arguments, starting at the given start angle and ending at the given end angle, going in the given direction (defaulting to clockwise), is added to the path, connected to the previous point by a straight line./p> p>Throws an a idbuilding-paths:indexsizeerror-2 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idbuilding-paths:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the given radius is negative./p> figure classdiagrams> img width590 src/images/arc1.png height255 alt> /figure> dt>var>context/var> . code idbuilding-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 idbuilding-paths:dom-context-2d-ellipse-2>a href#dom-context-2d-ellipse>ellipse/a>/code>(var>x/var>, var>y/var>, var>radiusX/var>, var>radiusY/var>, var>rotation/var>, var>startAngle/var>, var>endAngle/var> , var>anticlockwise/var> )dd> p>Adds points to the subpath such that the arc described by the circumference of the ellipse described by the arguments, starting at the given start angle and ending at the given end angle, going in the given direction (defaulting to clockwise), is added to the path, connected to the previous point by a straight line./p> p>Throws an a idbuilding-paths:indexsizeerror-3 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idbuilding-paths:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the given radius is negative./p> dt>var>context/var> . code idbuilding-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 idbuilding-paths:dom-context-2d-rect-2>a href#dom-context-2d-rect>rect/a>/code>(var>x/var>, var>y/var>, var>w/var>, var>h/var>)dd> p>Adds a new closed subpath to the path, representing the given rectangle./p> /dl> p>The following methods allow authors to manipulate the a href#concept-path idbuilding-paths:concept-path-5>paths/a> of objects implementing the code idbuilding-paths:canvaspath-3>a href#canvaspath>CanvasPath/a>/code> interface./p> p>For objects implementing the code idbuilding-paths:canvasdrawpath>a href#canvasdrawpath>CanvasDrawPath/a>/code> and code idbuilding-paths:canvastransform>a href#canvastransform>CanvasTransform/a>/code> interfaces, the points passed to the methods, and the resulting lines added to a href#current-default-path idbuilding-paths:current-default-path>current default path/a> by these methods, must be transformed according to the a href#transformations idbuilding-paths:transformations>current transformation matrix/a> before being added to the path./p> p>The dfn iddom-context-2d-moveto>code>moveTo(var>x/var>, var>y/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If either of the arguments are infinite or NaN, then return.li>p>Create a new subpath with the specified point as its first (and only) point./ol> p>When the user agent is to dfn idensure-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 idbuilding-paths:concept-path-6>path/a>, the user agent must check to see if the a href#concept-path idbuilding-paths:concept-path-7>path/a> has its a href#need-new-subpath idbuilding-paths:need-new-subpath-2>need new subpath/a> flag set. If it does, then 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 idbuilding-paths:dom-context-2d-moveto-3>a href#dom-context-2d-moveto>moveTo()/a>/code> method had been called, and must then unset the a href#concept-path idbuilding-paths:concept-path-8>path/a>s a href#need-new-subpath idbuilding-paths:need-new-subpath-3>need new subpath/a> flag./p> p>The dfn iddom-context-2d-closepath>code>closePath()/code>/dfn> method, when invoked, must do nothing if the objects path has no subpaths. Otherwise, it must mark the last subpath as closed, create a new subpath whose first point is the same as the previous subpaths first point, and finally add this new subpath to the path./p> p classnote>If the last subpath had more than one point in its list of points, then this is equivalent to adding a straight line connecting the last point back to the first point, thus closing the shape, and then repeating the last (possibly implied) code idbuilding-paths:dom-context-2d-moveto-4>a href#dom-context-2d-moveto>moveTo()/a>/code> call./p> p>New points and the lines connecting them are added to subpaths using the methods described below. In all cases, the methods only modify the last subpath in the objects path./p> p>The dfn iddom-context-2d-lineto>code>lineTo(var>x/var>, var>y/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If either of the arguments are infinite or NaN, then return.li>p>If the objects path has no subpaths, then a href#ensure-there-is-a-subpath idbuilding-paths:ensure-there-is-a-subpath>ensure there is a subpath/a> for span>(var>x/var>, var>y/var>)/span>.li>p>Otherwise, connect the last point in the subpath to the given point (var>x/var>, var>y/var>) using a straight line, and then add the given point (var>x/var>, var>y/var>) to the subpath./ol> p>The dfn iddom-context-2d-quadraticcurveto>code>quadraticCurveTo(var>cpx/var>, var>cpy/var>, var>x/var>, var>y/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If any of the arguments are infinite or NaN, then return.li>p>a href#ensure-there-is-a-subpath idbuilding-paths:ensure-there-is-a-subpath-2>Ensure there is a subpath/a> for span>(var>cpx/var>, var>cpy/var>)/span>li>p>Connect the last point in the subpath to the given point (var>x/var>, var>y/var>) using a quadratic Bézier curve with control point (var>cpx/var>, var>cpy/var>). a href#refsBEZIER>BEZIER/a>li>p>Add the given point (var>x/var>, var>y/var>) to the subpath./ol> p>The dfn iddom-context-2d-beziercurveto>code>bezierCurveTo(var>cp1x/var>, var>cp1y/var>, var>cp2x/var>, var>cp2y/var>, var>x/var>, var>y/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If any of the arguments are infinite or NaN, then return.li>p>a href#ensure-there-is-a-subpath idbuilding-paths:ensure-there-is-a-subpath-3>Ensure there is a subpath/a> for span>(var>cp1x/var>, var>cp1y/var>)/span>.li>p>Connect the last point in the subpath to the given point (var>x/var>, var>y/var>) using a cubic Bézier curve with control points (var>cp1x/var>, var>cp1y/var>) and (var>cp2x/var>, var>cp2y/var>). a href#refsBEZIER>BEZIER/a>li>p>Add the point (var>x/var>, var>y/var>) to the subpath./ol> hr> p>The dfn iddom-context-2d-arcto>code>arcTo(var>x1/var>, var>y1/var>, var>x2/var>, var>y2/var>, var>radiusX/var>, var>radiusY/var>, var>rotation/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If any of the arguments are infinite or NaN, then return.li>p>a href#ensure-there-is-a-subpath idbuilding-paths:ensure-there-is-a-subpath-4>Ensure there is a subpath/a> for span>(var>x1/var>, var>y1/var>)/span>.li>p>If either var>radiusX/var> or var>radiusY/var> are negative, then throw an a idbuilding-paths:indexsizeerror-4 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idbuilding-paths:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If var>radiusY/var> is omitted, then set var>radiusY/var> to var>radiusX/var>.li>p>Let the point (var>x0/var>, var>y0/var>) be the last point in the subpath, transformed by the inverse of the a href#transformations idbuilding-paths:transformations-2>current transformation matrix/a> (so that it is in the same coordinate system as the points passed to the method).li>p>If the point (var>x0/var>, var>y0/var>) is equal to the point (var>x1/var>, var>y1/var>), or if the point (var>x1/var>, var>y1/var>) is equal to the point (var>x2/var>, var>y2/var>), or if both var>radiusX/var> and var>radiusY/var> are zero, then add the point (var>x1/var>, var>y1/var>) to the subpath, and connect that point to the previous point (var>x0/var>, var>y0/var>) by a straight line.li>p>Otherwise, if the points (var>x0/var>, var>y0/var>), (var>x1/var>, var>y1/var>), and (var>x2/var>, var>y2/var>) all lie on a single straight line, then add the point (var>x1/var>, var>y1/var>) to the subpath, and connect that point to the previous point (var>x0/var>, var>y0/var>) by a straight line.li>p>Otherwise, let var>The Arc/var> be the shortest arc given by circumference of the ellipse that has radius var>radiusX/var> on the major axis and radius var>radiusY/var> on the minor axis, and whose semi-major axis is rotated var>rotation/var> radians clockwise from the positive x-axis, and that has one point tangent to the half-infinite line that crosses the point (var>x0/var>, var>y0/var>) and ends at the point (var>x1/var>, var>y1/var>), and that has a different point tangent to the half-infinite line that ends at the point (var>x1/var>, var>y1/var>) and crosses the point (var>x2/var>, var>y2/var>). The points at which this ellipse touches these two lines are called the start and end tangent points respectively. Connect the point (var>x0/var>, var>y0/var>) to the start tangent point by a straight line, adding the start tangent point to the subpath, and then connect the start tangent point to the end tangent point by var>The Arc/var>, adding the end tangent point to the subpath./ol> hr> p>The dfn iddom-context-2d-arc>code>arc(var>x/var>, var>y/var>, var>radius/var>, var>startAngle/var>, var>endAngle/var>, var>anticlockwise/var>)/code>/dfn> and dfn iddom-context-2d-ellipse>code>ellipse(var>x/var>, var>y/var>, var>radiusX/var>, var>radiusY/var>, var>rotation/var>, var>startAngle/var>, var>endAngle/var>, var>anticlockwise/var>)/code>/dfn> methods draw arcs./p> p>The code idbuilding-paths:dom-context-2d-arc-3>a href#dom-context-2d-arc>arc()/a>/code> method is equivalent to the code idbuilding-paths:dom-context-2d-ellipse-3>a href#dom-context-2d-ellipse>ellipse()/a>/code> method in the case where the two radii are equal. When the code idbuilding-paths:dom-context-2d-arc-4>a href#dom-context-2d-arc>arc()/a>/code> method is invoked, it must act as if the code idbuilding-paths:dom-context-2d-ellipse-4>a href#dom-context-2d-ellipse>ellipse()/a>/code> method had been invoked with the var>radiusX/var> and var>radiusY/var> arguments set to the value of the var>radius/var> argument, the var>rotation/var> argument set to zero, and the other arguments set to the same values as their identically named arguments on the code idbuilding-paths:dom-context-2d-arc-5>a href#dom-context-2d-arc>arc()/a>/code> method./p> p>The code idbuilding-paths:dom-context-2d-ellipse-5>a href#dom-context-2d-ellipse>ellipse()/a>/code> method, when invoked, must run these steps:/p> ol>li>p>If any of the arguments are infinite or NaN, then return.li>p>If either var>radiusX/var> or var>radiusY/var> are negative, then throw an a idbuilding-paths:indexsizeerror-5 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idbuilding-paths:domexception-5>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If the objects path has any subpaths, then add a straight line from the last point in the subpath to the start point of the arc.li> p>Add the start and end points of the arc to the subpath, and connect them with an arc. The arc and its start and end points are defined as follows:/p> p>Consider an ellipse that has its origin at (var>x/var>, var>y/var>), that has a major-axis radius var>radiusX/var> and a minor-axis radius var>radiusY/var>, and that is rotated about its origin such that its semi-major axis is inclined var>rotation/var> radians clockwise from the x-axis./p> p>If var>anticlockwise/var> is false and span>var>endAngle/var>-var>startAngle/var>/span> is equal to or greater than span>2π/span>, or, if var>anticlockwise/var> is em>true/em> and span>var>startAngle/var>-var>endAngle/var>/span> is equal to or greater than span>2π/span>, then the arc is the whole circumference of this ellipse, and the point at var>startAngle/var> along this circles circumference, measured in radians clockwise from the ellipses semi-major axis, acts as both the start point and the end point./p> p>Otherwise, the points at var>startAngle/var> and var>endAngle/var> along this circles circumference, measured in radians clockwise from the ellipses semi-major axis, are the start and end points respectively, and the arc is the path along the circumference of this ellipse from the start point to the end point, going anti-clockwise if var>anticlockwise/var> is true, and clockwise otherwise. Since the points are on the ellipse, as opposed to being simply angles from zero, the arc can never cover an angle greater than span>2π/span> radians./p> p classnote>Even if the arc covers the entire circumference of the ellipse and there are no other points in the subpath, the path is not closed unless the code idbuilding-paths:dom-context-2d-closepath-3>a href#dom-context-2d-closepath>closePath()/a>/code> method is appropriately invoked./p> /ol> hr> p>The dfn iddom-context-2d-rect>code>rect(var>x/var>, var>y/var>, var>w/var>, var>h/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If any of the arguments are infinite or NaN, then return.li>p>Create a new subpath containing just the four points (var>x/var>, var>y/var>), (var>x/var>+var>w/var>, var>y/var>), (var>x/var>+var>w/var>, var>y/var>+var>h/var>), (var>x/var>, var>y/var>+var>h/var>), in that order, with those four points connected by straight lines.li>p>Mark the subpath as closed.li>p>Create a new subpath with the point (var>x/var>, var>y/var>) as the only point in the subpath./ol> h6 idpath2d-objects>span classsecno>4.12.5.1.6/span> code idpath2d-objects:path2d>a href#path2d>Path2D/a>/code> objectsa href#path2d-objects classself-link>/a>/h6>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> path2dspan classand_chr partial>span>Chrome for Android (limited)/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>63+/span>/span>span classios_saf yes>span>iOS Safari/span> span>9.0+/span>/span>span classand_uc partial>span>UC Browser for Android (limited)/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>48+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung partial>span>Samsung Internet (limited)/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>9.1+/span>/span>span classedge partial>span>Edge (limited)/span> span>14+/span>/span>span classandroid partial>span>Android Browser (limited)/span> span>56+/span>/span>span classopera partial>span>Opera (limited)/span> span>23+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featpath2d>caniuse.com/a>/div> p>code idpath2d-objects:path2d-2>a href#path2d>Path2D/a>/code> objects can be used to declare paths that are then later used on objects implementing the code idpath2d-objects:canvasdrawpath>a href#canvasdrawpath>CanvasDrawPath/a>/code> interface. In addition to many of the APIs described in earlier sections, code idpath2d-objects:path2d-3>a href#path2d>Path2D/a>/code> objects have methods to combine paths, and to add text to paths./p> dl classdomintro>dt>var>path/var> new code idpath2d-objects:dom-path2d>a href#dom-path2d>Path2D/a>/code>()dd> p>Creates a new empty code idpath2d-objects:path2d-4>a href#path2d>Path2D/a>/code> object./p> dt>var>path/var> new code idpath2d-objects:dom-path2d-copy>a href#dom-path2d-copy>Path2D/a>/code>(var>path/var>)dd> p>Creates a new code idpath2d-objects:path2d-5>a href#path2d>Path2D/a>/code> object that is a copy of the argument./p> dt>var>path/var> new code idpath2d-objects:dom-path2d-merge>a href#dom-path2d-merge>Path2D/a>/code>(var>paths/var> , var>fillRule/var> )dd> p>Creates a new code idpath2d-objects:path2d-6>a href#path2d>Path2D/a>/code> object that describes a path that outlines the given var>paths/var>, using the given fill rule./p> dt>var>path/var> new code idpath2d-objects:dom-path2d-withdata>a href#dom-path2d-withdata>Path2D/a>/code>(var>d/var>)dd> p>Creates a new path with the path described by the argument, interpreted as SVG path data. a href#refsSVG>SVG/a>/p> dt>var>path/var> . code idpath2d-objects:dom-path2d-addpath>a href#dom-path2d-addpath>addPath/a>/code>(var>path/var> , var>transform/var> )dd> p>Adds to the path the path given by the argument./p> /dl> p>The dfn iddom-path2d>code>Path2D()/code>/dfn> constructor, when invoked, must return a newly created code idpath2d-objects:path2d-7>a href#path2d>Path2D/a>/code> object./p> hr> p>The dfn iddom-path2d-copy>code>Path2D(var>path/var>)/code>/dfn> constructor, when invoked, must return a newly created code idpath2d-objects:path2d-8>a href#path2d>Path2D/a>/code> object, to which the subpaths of the argument are added. (In other words, it returns a copy of the argument.)/p> hr> p>The dfn iddom-path2d-merge>code>Path2D(var>paths/var>, var>fillRule/var>)/code>/dfn> constructor, when invoked, must run these steps:/p> ol>li> p>Run the appropriate step from the following list, based on the constructors second argument:/p> dl classswitch>dt>If it is nonzerodd> p>Let var>merged path/var> be a a href#concept-path idpath2d-objects:concept-path>path/a> that consists of a set of non-overlapping subpaths that exactly outline the points from which, in any of the a href#concept-path idpath2d-objects:concept-path-2>paths/a> provided in the constructors first argument, the number of times a half-infinite straight line drawn from that point crosses a subpath going in one direction is not equal to the number of times it crosses a subpath going in the other direction./p> dt>If it is evenodddd> p>Let var>merged path/var> be a a href#concept-path idpath2d-objects:concept-path-3>path/a> that consists of a set of non-overlapping subpaths that exactly outline the points from which, in any of the a href#concept-path idpath2d-objects:concept-path-4>paths/a> provided in the constructors first argument, the number of times a half-infinite straight line drawn from that point crosses that path is odd./p> /dl> p>The subpaths in var>merged path/var> must be oriented such that for any point, the number of times a half-infinite straight line drawn from that point crosses a subpath is even if and only if the number of times a half-infinite straight line drawn from that same point crosses a subpath going in one direction is equal to the number of times it crosses a subpath going in the other direction./p> li>p>Add all the subpaths in var>merged path/var> to the code idpath2d-objects:path2d-9>a href#path2d>Path2D/a>/code> object.li>p>Set the code idpath2d-objects:path2d-10>a href#path2d>Path2D/a>/code> objects a href#need-new-subpath idpath2d-objects:need-new-subpath>need new subpath/a> flag./ol> hr> p>The dfn iddom-path2d-withdata>code>Path2D(var>d/var>)/code>/dfn> constructor, when invoked, must run these steps:/p> ol>li> p>Parse and interpret the var>d/var> argument according to the SVG specifications rules for path data, thus obtaining an SVG path. a href#refsSVG>SVG/a>/p> p classnote>The resulting path could be empty. SVG defines error handling rules for parsing and applying path data./p> li>p>Let (var>x/var>, var>y/var>) be the last point in the SVG path.li>p>Create a new code idpath2d-objects:path2d-11>a href#path2d>Path2D/a>/code> object and add all the subpaths in the SVG path, if any, to that code idpath2d-objects:path2d-12>a href#path2d>Path2D/a>/code> object. /p> li>p>Create a new subpath in the code idpath2d-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 idpath2d-objects:path2d-14>a href#path2d>Path2D/a>/code> object as the constructed object./ol> hr> p>The dfn iddom-path2d-addpath>code>addPath(var>b/var>, var>transform/var>)/code>/dfn> method, when invoked on a code idpath2d-objects:path2d-15>a href#path2d>Path2D/a>/code> object var>a/var>, must run these steps:/p> ol>li>p>If the code idpath2d-objects:path2d-16>a href#path2d>Path2D/a>/code> object var>b/var> has no subpaths, then return.li>p>Let var>matrix/var> be the result of a hrefhttps://drafts.fxtf.org/geometry/#create-a-dommatrix-from-the-dictionary idpath2d-objects:create-a-dommatrix-from-a-dictionary data-x-internalcreate-a-dommatrix-from-a-dictionary>creating a code>DOMMatrix/code> from the dictionary/a> var>transform/var>, with var>ignore3D/var> set to true.li>p>If one or more of var>matrix/var>s a idpath2d-objects:m11-element hrefhttps://drafts.fxtf.org/geometry/#matrix-m11-element data-x-internalm11-element>m11 element/a>, a idpath2d-objects:m12-element hrefhttps://drafts.fxtf.org/geometry/#matrix-m12-element data-x-internalm12-element>m12 element/a>, a idpath2d-objects:m21-element hrefhttps://drafts.fxtf.org/geometry/#matrix-m21-element data-x-internalm21-element>m21 element/a>, a idpath2d-objects:m22-element hrefhttps://drafts.fxtf.org/geometry/#matrix-m22-element data-x-internalm22-element>m22 element/a>, a idpath2d-objects:m41-element hrefhttps://drafts.fxtf.org/geometry/#matrix-m41-element data-x-internalm41-element>m41 element/a>, or a idpath2d-objects:m42-element hrefhttps://drafts.fxtf.org/geometry/#matrix-m42-element data-x-internalm42-element>m42 element/a> are infinite or NaN, then return.li>p>Create a copy of all the subpaths in var>b/var>. Let this copy be known as var>c/var>.li>p>Transform all the coordinates and lines in var>c/var> by the transform matrix var>matrix/var>.li>p>Let (var>x/var>, var>y/var>) be the last point in the last subpath of var>c/var>.li>p>Add all the subpaths in var>c/var> to var>a/var>.li>p>Create a new subpath in var>a/var> with (var>x/var>, var>y/var>) as the only point in the subpath./ol> h6 idtransformations>span classsecno>4.12.5.1.7/span> dfn>Transformations/dfn>a href#transformations classself-link>/a>/h6>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id28333 titleShow on example how a,b,c,d,e,f affect the point position>28333/a>/div> p>Objects that implement the code idtransformations:canvastransform>a href#canvastransform>CanvasTransform/a>/code> interface have a dfn idcurrent-transformation-matrix>current transformation matrix/dfn>, as well as methods (described in this section) to manipulate it. When an object implementing the code idtransformations:canvastransform-2>a href#canvastransform>CanvasTransform/a>/code> interface is created, its transformation matrix must be initialized to the identity transform./p> p>The a href#current-transformation-matrix idtransformations:current-transformation-matrix>current transformation matrix/a> is applied to coordinates when creating the a href#current-default-path idtransformations:current-default-path>current default path/a>, and when painting text, shapes, and code idtransformations:path2d>a href#path2d>Path2D/a>/code> objects, on objects implementing the code idtransformations:canvastransform-3>a href#canvastransform>CanvasTransform/a>/code> interface./p> p classnote>Most of the API uses code idtransformations:dommatrix>a data-x-internaldommatrix hrefhttps://drafts.fxtf.org/geometry/#dommatrix>DOMMatrix/a>/code> objects rather than this API. This API remains mostly for historical reasons./p> p>The transformations must be performed in reverse order./p> p classnote>For instance, if a scale transformation that doubles the width is applied to the canvas, followed by a rotation transformation that rotates drawing operations by a quarter turn, and a rectangle twice as wide as it is tall is then drawn on the canvas, the actual result will be a square./p> dl classdomintro>dt>var>context/var> . code idtransformations:dom-context-2d-scale>a href#dom-context-2d-scale>scale/a>/code>(var>x/var>, var>y/var>)dd> p>Changes the a href#current-transformation-matrix idtransformations:current-transformation-matrix-2>current transformation matrix/a> to apply a scaling transformation with the given characteristics./p> dt>var>context/var> . code idtransformations:dom-context-2d-rotate>a href#dom-context-2d-rotate>rotate/a>/code>(var>angle/var>)dd> p>Changes the a href#current-transformation-matrix idtransformations:current-transformation-matrix-3>current transformation matrix/a> to apply a rotation transformation with the given characteristics. The angle is in radians./p> dt>var>context/var> . code idtransformations:dom-context-2d-translate>a href#dom-context-2d-translate>translate/a>/code>(var>x/var>, var>y/var>)dd> p>Changes the a href#current-transformation-matrix idtransformations:current-transformation-matrix-4>current transformation matrix/a> to apply a translation transformation with the given characteristics./p> dt>var>context/var> . code idtransformations:dom-context-2d-transform>a href#dom-context-2d-transform>transform/a>/code>(var>a/var>, var>b/var>, var>c/var>, var>d/var>, var>e/var>, var>f/var>)dd> p>Changes the a href#current-transformation-matrix idtransformations:current-transformation-matrix-5>current transformation matrix/a> to apply the matrix given by the arguments as described below./p> dt>var>matrix/var> var>context/var> . code idtransformations:dom-context-2d-gettransform>a href#dom-context-2d-gettransform>getTransform/a>/code>()dd> p>Returns a copy of the a href#current-transformation-matrix idtransformations:current-transformation-matrix-6>current transformation matrix/a>, as a newly created code idtransformations:dommatrix-2>a data-x-internaldommatrix hrefhttps://drafts.fxtf.org/geometry/#dommatrix>DOMMatrix/a>/code> object./p> dt>var>context/var> . code idtransformations:dom-context-2d-settransform>a href#dom-context-2d-settransform>setTransform/a>/code>(var>a/var>, var>b/var>, var>c/var>, var>d/var>, var>e/var>, var>f/var>)dd> p>Changes the a href#current-transformation-matrix idtransformations:current-transformation-matrix-7>current transformation matrix/a> em>to/em> the matrix given by the arguments as described below./p> dt>var>context/var> . code idtransformations:dom-context-2d-settransform-matrix>a href#dom-context-2d-settransform-matrix>setTransform/a>/code>(var>transform/var>)dd> p>Changes the a href#current-transformation-matrix idtransformations:current-transformation-matrix-8>current transformation matrix/a> em>to/em> the matrix represented by the passed code idtransformations:dommatrix2dinit>a data-x-internaldommatrix2dinit hrefhttps://drafts.fxtf.org/geometry/#dictdef-dommatrix2dinit>DOMMatrix2DInit/a>/code> dictionary./p> dt>var>context/var> . code idtransformations:dom-context-2d-resettransform>a href#dom-context-2d-resettransform>resetTransform/a>/code>()dd> p>Changes the a href#current-transformation-matrix idtransformations:current-transformation-matrix-9>current transformation matrix/a> to the identity transform./p> /dl> p>The dfn iddom-context-2d-scale>code>scale(var>x/var>, var>y/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If either of the arguments are infinite or NaN, then return.li>p>Add the scaling transformation described by the arguments to the a href#current-transformation-matrix idtransformations:current-transformation-matrix-10>current transformation matrix/a>. The var>x/var> argument represents the scale factor in the horizontal direction and the var>y/var> argument represents the scale factor in the vertical direction. The factors are multiples./ol> p>The dfn iddom-context-2d-rotate>code>rotate(var>angle/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If var>angle/var> is infinite or NaN, then return.li>p>Add the rotation transformation described by the argument to the a href#current-transformation-matrix idtransformations:current-transformation-matrix-11>current transformation matrix/a>. The var>angle/var> argument represents a clockwise rotation angle expressed in radians./ol> p>The dfn iddom-context-2d-translate>code>translate(var>x/var>, var>y/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If either of the arguments are infinite or NaN, then return.li>p>Add the translation transformation described by the arguments to the a href#current-transformation-matrix idtransformations:current-transformation-matrix-12>current transformation matrix/a>. The var>x/var> argument represents the translation distance in the horizontal direction and the var>y/var> argument represents the translation distance in the vertical direction. The arguments are in coordinate space units./ol> p>The dfn iddom-context-2d-transform>code>transform(var>a/var>, var>b/var>, var>c/var>, var>d/var>, var>e/var>, var>f/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If any of the arguments are infinite or NaN, then return.li>p>Replace the a href#current-transformation-matrix idtransformations:current-transformation-matrix-13>current transformation matrix/a> with the result of multiplying the current transformation matrix with the matrix described by:/ol> table classmatrix>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>0td>0td>1/table> p classnote>The arguments var>a/var>, var>b/var>, var>c/var>, var>d/var>, var>e/var>, and var>f/var> are sometimes called var>m11/var>, var>m12/var>, var>m21/var>, var>m22/var>, var>dx/var>, and var>dy/var> or var>m11/var>, var>m21/var>, var>m12/var>, var>m22/var>, var>dx/var>, and var>dy/var>. Care ought to be taken in particular with the order of the second and third arguments (var>b/var> and var>c/var>) as their order varies from API to API and APIs sometimes use the notation var>m12/var>/var>m21/var> and sometimes var>m21/var>/var>m12/var> for those positions./p> p>The dfn iddom-context-2d-gettransform>code>getTransform()/code>/dfn> method, when invoked, must return a newly created code idtransformations:dommatrix-3>a data-x-internaldommatrix hrefhttps://drafts.fxtf.org/geometry/#dommatrix>DOMMatrix/a>/code> representing a copy of the a href#current-transformation-matrix idtransformations:current-transformation-matrix-14>current transformation matrix/a> matrix of the context./p> p classnote>This returned object is not live, so updating it will not affect the a href#current-transformation-matrix idtransformations:current-transformation-matrix-15>current transformation matrix/a>, and updating the a href#current-transformation-matrix idtransformations:current-transformation-matrix-16>current transformation matrix/a> will not affect an already returned code idtransformations:dommatrix-4>a data-x-internaldommatrix hrefhttps://drafts.fxtf.org/geometry/#dommatrix>DOMMatrix/a>/code>./p> p>The dfn iddom-context-2d-settransform>code>setTransform(var>a/var>, var>b/var>, var>c/var>, var>d/var>, var>e/var>, var>f/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If any of the arguments are infinite or NaN, then return.li>p>Reset the a href#current-transformation-matrix idtransformations:current-transformation-matrix-17>current transformation matrix/a> to the identity matrix.li>p>Invoke the code>a href#dom-context-2d-transform idtransformations:dom-context-2d-transform-2>transform/a>(var>a/var>, var>b/var>, var>c/var>, var>d/var>, var>e/var>, var>f/var>)/code> method with the same arguments./ol> p>The dfn iddom-context-2d-settransform-matrix>code>setTransform(var>transform/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>Let var>matrix/var> be the result of a hrefhttps://drafts.fxtf.org/geometry/#create-a-dommatrix-from-the-dictionary idtransformations:create-a-dommatrix-from-a-dictionary data-x-internalcreate-a-dommatrix-from-a-dictionary>creating a code>DOMMatrix/code> from the dictionary/a> var>transform/var>, with var>ignore3D/var> set to true./p> li>p>If one or more of var>matrix/var>s a idtransformations:m11-element hrefhttps://drafts.fxtf.org/geometry/#matrix-m11-element data-x-internalm11-element>m11 element/a>, a idtransformations:m12-element hrefhttps://drafts.fxtf.org/geometry/#matrix-m12-element data-x-internalm12-element>m12 element/a>, a idtransformations:m21-element hrefhttps://drafts.fxtf.org/geometry/#matrix-m21-element data-x-internalm21-element>m21 element/a>, a idtransformations:m22-element hrefhttps://drafts.fxtf.org/geometry/#matrix-m22-element data-x-internalm22-element>m22 element/a>, a idtransformations:m41-element hrefhttps://drafts.fxtf.org/geometry/#matrix-m41-element data-x-internalm41-element>m41 element/a>, or a idtransformations:m42-element hrefhttps://drafts.fxtf.org/geometry/#matrix-m42-element data-x-internalm42-element>m42 element/a> are infinite or NaN, then return.li>p>Reset the a href#current-transformation-matrix idtransformations:current-transformation-matrix-18>current transformation matrix/a> to var>matrix/var>./ol> p>The dfn iddom-context-2d-resettransform>code>resetTransform()/code>/dfn> method, when invoked, must reset the a href#current-transformation-matrix idtransformations:current-transformation-matrix-19>current transformation matrix/a> to the identity matrix./p> h6 idimage-sources-for-2d-rendering-contexts>span classsecno>4.12.5.1.8/span> Image sources for 2D rendering contextsa href#image-sources-for-2d-rendering-contexts classself-link>/a>/h6> p>Some methods on the code idimage-sources-for-2d-rendering-contexts:canvasdrawimage>a href#canvasdrawimage>CanvasDrawImage/a>/code> and code idimage-sources-for-2d-rendering-contexts:canvasfillstrokestyles>a href#canvasfillstrokestyles>CanvasFillStrokeStyles/a>/code> interfaces take the union type code idimage-sources-for-2d-rendering-contexts:canvasimagesource>a href#canvasimagesource>CanvasImageSource/a>/code> as an argument./p> p>This union type allows objects implementing any of the following interfaces to be used as image sources:/p> ul>li>code idimage-sources-for-2d-rendering-contexts:htmlorsvgimageelement>a href#htmlorsvgimageelement>HTMLOrSVGImageElement/a>/code> (code idimage-sources-for-2d-rendering-contexts:the-img-element>a href#the-img-element>img/a>/code> or a idimage-sources-for-2d-rendering-contexts:svg-image hrefhttps://www.w3.org/TR/SVG11/struct.html#ImageElement data-x-internalsvg-image>SVG code>image/code>/a> elements)li>code idimage-sources-for-2d-rendering-contexts:htmlvideoelement>a href#htmlvideoelement>HTMLVideoElement/a>/code> (code idimage-sources-for-2d-rendering-contexts:the-video-element>a href#the-video-element>video/a>/code> elements)li>code idimage-sources-for-2d-rendering-contexts:htmlcanvaselement>a href#htmlcanvaselement>HTMLCanvasElement/a>/code> (code idimage-sources-for-2d-rendering-contexts:the-canvas-element>a href#the-canvas-element>canvas/a>/code> elements)li>code idimage-sources-for-2d-rendering-contexts:imagebitmap>a href#imagebitmap>ImageBitmap/a>/code>/ul> p classnote>Although not formally specified as such, a idimage-sources-for-2d-rendering-contexts:svg-image-2 hrefhttps://www.w3.org/TR/SVG11/struct.html#ImageElement data-x-internalsvg-image>SVG code>image/code>/a> elements are expected to be implemented nearly identical to code idimage-sources-for-2d-rendering-contexts:the-img-element-2>a href#the-img-element>img/a>/code> elements. That is, a idimage-sources-for-2d-rendering-contexts:svg-image-3 hrefhttps://www.w3.org/TR/SVG11/struct.html#ImageElement data-x-internalsvg-image>SVG code>image/code>/a> elements share the fundamental concepts and features of code idimage-sources-for-2d-rendering-contexts:the-img-element-3>a href#the-img-element>img/a>/code> elements./p> p classnote>The code idimage-sources-for-2d-rendering-contexts:imagebitmap-2>a href#imagebitmap>ImageBitmap/a>/code> interface can be created from a number of other image-representing types, including code idimage-sources-for-2d-rendering-contexts:imagedata>a href#imagedata>ImageData/a>/code>./p> p>When a user agent is required to dfn idcheck-the-usability-of-the-image-argument>check the usability of the var>image/var> argument/dfn>, where var>image/var> is a code idimage-sources-for-2d-rendering-contexts:canvasimagesource-2>a href#canvasimagesource>CanvasImageSource/a>/code> object, the user agent must run these steps, which return either i>good/i>, i>bad/i>, or i>aborted/i>:/p> ol>li>p>If var>image/var> is an code idimage-sources-for-2d-rendering-contexts:htmlorsvgimageelement-2>a href#htmlorsvgimageelement>HTMLOrSVGImageElement/a>/code> object that is in the a href#img-error idimage-sources-for-2d-rendering-contexts:img-error>broken/a> state, then throw an a idimage-sources-for-2d-rendering-contexts:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idimage-sources-for-2d-rendering-contexts:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>, return i>aborted/i>, and abort these steps.li>p>If var>image/var> is an code idimage-sources-for-2d-rendering-contexts:htmlorsvgimageelement-3>a href#htmlorsvgimageelement>HTMLOrSVGImageElement/a>/code> object that is not a href#img-good idimage-sources-for-2d-rendering-contexts:img-good>fully decodable/a>, or if var>image/var> is an code idimage-sources-for-2d-rendering-contexts:htmlvideoelement-2>a href#htmlvideoelement>HTMLVideoElement/a>/code> object whose code idimage-sources-for-2d-rendering-contexts:dom-media-readystate>a href#dom-media-readystate>readyState/a>/code> attribute is either code idimage-sources-for-2d-rendering-contexts:dom-media-have_nothing>a href#dom-media-have_nothing>HAVE_NOTHING/a>/code> or code idimage-sources-for-2d-rendering-contexts:dom-media-have_metadata>a href#dom-media-have_metadata>HAVE_METADATA/a>/code>, then return i>bad/i> and abort these steps.li>p>If var>image/var> is an code idimage-sources-for-2d-rendering-contexts:htmlorsvgimageelement-4>a href#htmlorsvgimageelement>HTMLOrSVGImageElement/a>/code> object with an a href#intrinsic-width idimage-sources-for-2d-rendering-contexts:intrinsic-width>intrinsic width/a> or a href#intrinsic-height idimage-sources-for-2d-rendering-contexts:intrinsic-height>intrinsic height/a> (or both) equal to zero, then return i>bad/i> and abort these steps.li>p>If var>image/var> is an code idimage-sources-for-2d-rendering-contexts:htmlcanvaselement-2>a href#htmlcanvaselement>HTMLCanvasElement/a>/code> object with either a horizontal dimension or a vertical dimension equal to zero, then return i>bad/i> and abort these steps.li>p>If var>image/var> is an code idimage-sources-for-2d-rendering-contexts:imagebitmap-3>a href#imagebitmap>ImageBitmap/a>/code> object with its a href#detached idimage-sources-for-2d-rendering-contexts:detached>Detached/a> internal slot value set to true, then throw an a idimage-sources-for-2d-rendering-contexts:invalidstateerror-2 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idimage-sources-for-2d-rendering-contexts:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>, return i>aborted/i>, and abort these steps.li>p>Return i>good/i>./ol> p>When a code idimage-sources-for-2d-rendering-contexts:canvasimagesource-3>a href#canvasimagesource>CanvasImageSource/a>/code> object represents an code idimage-sources-for-2d-rendering-contexts:htmlorsvgimageelement-5>a href#htmlorsvgimageelement>HTMLOrSVGImageElement/a>/code>, the elements image must be used as the source image./p> p>Specifically, when a code idimage-sources-for-2d-rendering-contexts:canvasimagesource-4>a href#canvasimagesource>CanvasImageSource/a>/code> object represents an animated image in an code idimage-sources-for-2d-rendering-contexts:htmlorsvgimageelement-6>a href#htmlorsvgimageelement>HTMLOrSVGImageElement/a>/code>, the user agent must use the default image of the animation (the one that the format defines is to be used when animation is not supported or is disabled), or, if there is no such image, the first frame of the animation, when rendering the image for code idimage-sources-for-2d-rendering-contexts:canvasrenderingcontext2d>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> APIs./p> p>When a code idimage-sources-for-2d-rendering-contexts:canvasimagesource-5>a href#canvasimagesource>CanvasImageSource/a>/code> object represents an code idimage-sources-for-2d-rendering-contexts:htmlvideoelement-3>a href#htmlvideoelement>HTMLVideoElement/a>/code>, then the frame at the a href#current-playback-position idimage-sources-for-2d-rendering-contexts:current-playback-position>current playback position/a> when the method with the argument is invoked must be used as the source image when rendering the image for code idimage-sources-for-2d-rendering-contexts:canvasrenderingcontext2d-2>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> APIs, and the source images dimensions must be the a href#concept-video-intrinsic-width idimage-sources-for-2d-rendering-contexts:concept-video-intrinsic-width>intrinsic width/a> and a href#concept-video-intrinsic-height idimage-sources-for-2d-rendering-contexts:concept-video-intrinsic-height>intrinsic height/a> of the a href#media-resource idimage-sources-for-2d-rendering-contexts:media-resource>media resource/a> (i.e. after any aspect-ratio correction has been applied)./p> p>When a code idimage-sources-for-2d-rendering-contexts:canvasimagesource-6>a href#canvasimagesource>CanvasImageSource/a>/code> object represents an code idimage-sources-for-2d-rendering-contexts:htmlcanvaselement-3>a href#htmlcanvaselement>HTMLCanvasElement/a>/code>, the elements bitmap must be used as the source image./p> p>When a code idimage-sources-for-2d-rendering-contexts:canvasimagesource-7>a href#canvasimagesource>CanvasImageSource/a>/code> object represents an element that is a href#being-rendered idimage-sources-for-2d-rendering-contexts:being-rendered>being rendered/a> and that element has been resized, the original image data of the source image must be used, not the image as it is rendered (e.g. code idimage-sources-for-2d-rendering-contexts:attr-dim-width>a href#attr-dim-width>width/a>/code> and code idimage-sources-for-2d-rendering-contexts:attr-dim-height>a href#attr-dim-height>height/a>/code> attributes on the source element have no effect on how the object is interpreted when rendering the image for code idimage-sources-for-2d-rendering-contexts:canvasrenderingcontext2d-3>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> APIs)./p> p>When a code idimage-sources-for-2d-rendering-contexts:canvasimagesource-8>a href#canvasimagesource>CanvasImageSource/a>/code> object represents an code idimage-sources-for-2d-rendering-contexts:imagebitmap-4>a href#imagebitmap>ImageBitmap/a>/code>, the objects bitmap image data must be used as the source image./p> p>dfn idthe-image-argument-is-not-origin-clean>The var>image argument/var> is not origin-clean/dfn> if it is an code idimage-sources-for-2d-rendering-contexts:htmlorsvgimageelement-7>a href#htmlorsvgimageelement>HTMLOrSVGImageElement/a>/code> or code idimage-sources-for-2d-rendering-contexts:htmlvideoelement-4>a href#htmlvideoelement>HTMLVideoElement/a>/code> whose a href#concept-origin idimage-sources-for-2d-rendering-contexts:concept-origin>origin/a> is not the a href#same-origin idimage-sources-for-2d-rendering-contexts:same-origin>same/a> as the a href#concept-settings-object-origin idimage-sources-for-2d-rendering-contexts:concept-settings-object-origin>origin/a> specified by the a href#entry-settings-object idimage-sources-for-2d-rendering-contexts:entry-settings-object>entry settings object/a>, or if it is an code idimage-sources-for-2d-rendering-contexts:htmlcanvaselement-4>a href#htmlcanvaselement>HTMLCanvasElement/a>/code> whose bitmaps a href#concept-canvas-origin-clean idimage-sources-for-2d-rendering-contexts:concept-canvas-origin-clean>origin-clean/a> flag is false./p> h6 idfill-and-stroke-styles>span classsecno>4.12.5.1.9/span> Fill and stroke stylesa href#fill-and-stroke-styles classself-link>/a>/h6> dl classdomintro>dt>var>context/var> . code idfill-and-stroke-styles:dom-context-2d-fillstyle>a href#dom-context-2d-fillstyle>fillStyle/a>/code> var>value/var> dd> p>Returns the current style used for filling shapes./p> p>Can be set, to change the fill style./p> p>The style can be either a string containing a CSS color, or a code idfill-and-stroke-styles:canvasgradient>a href#canvasgradient>CanvasGradient/a>/code> or code idfill-and-stroke-styles:canvaspattern>a href#canvaspattern>CanvasPattern/a>/code> object. Invalid values are ignored./p> dt>var>context/var> . code idfill-and-stroke-styles:dom-context-2d-strokestyle>a href#dom-context-2d-strokestyle>strokeStyle/a>/code> var>value/var> dd> p>Returns the current style used for stroking shapes./p> p>Can be set, to change the stroke style./p> p>The style can be either a string containing a CSS color, or a code idfill-and-stroke-styles:canvasgradient-2>a href#canvasgradient>CanvasGradient/a>/code> or code idfill-and-stroke-styles:canvaspattern-2>a href#canvaspattern>CanvasPattern/a>/code> object. Invalid values are ignored./p> /dl> p>Objects that implement the code idfill-and-stroke-styles:canvasfillstrokestyles>a href#canvasfillstrokestyles>CanvasFillStrokeStyles/a>/code> interface have attributes and methods (defined in this section) that control how shapes are treated by the object./p> p>The dfn iddom-context-2d-fillstyle>code>fillStyle/code>/dfn> attribute represents the color or style to use inside shapes, and the dfn iddom-context-2d-strokestyle>code>strokeStyle/code>/dfn> attribute represents the color or style to use for the lines around the shapes./p> p>Both attributes can be either strings, code idfill-and-stroke-styles:canvasgradient-3>a href#canvasgradient>CanvasGradient/a>/code>s, or code idfill-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 idfill-and-stroke-styles:parsed-as-a-css-color-value>parsed as CSS <color> values/a> and the color assigned, and code idfill-and-stroke-styles:canvasgradient-4>a href#canvasgradient>CanvasGradient/a>/code> and code idfill-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 idfill-and-stroke-styles:parsed-as-a-css-color-value-2>parsed as a CSS <color> value/a>, then it must be ignored, and the attribute must retain its previous value. If the new value is a code idfill-and-stroke-styles:canvaspattern-5>a href#canvaspattern>CanvasPattern/a>/code> object that is marked as a href#concept-canvas-pattern-not-origin-clean idfill-and-stroke-styles:concept-canvas-pattern-not-origin-clean>not origin-clean/a>, then the code idfill-and-stroke-styles:canvasrenderingcontext2d>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code>s a href#concept-canvas-origin-clean idfill-and-stroke-styles:concept-canvas-origin-clean>origin-clean/a> flag must be set to false. /p> p>When set to a code idfill-and-stroke-styles:canvaspattern-6>a href#canvaspattern>CanvasPattern/a>/code> or code idfill-and-stroke-styles:canvasgradient-5>a href#canvasgradient>CanvasGradient/a>/code> object, the assignment is a href#live idfill-and-stroke-styles:live>live/a>, meaning that changes made to the object after the assignment do affect subsequent stroking or filling of shapes./p> p>On getting, if the value is a color, then the a href#serialisation-of-a-color idfill-and-stroke-styles:serialisation-of-a-color>serialization of the color/a> must be returned. Otherwise, if it is not a color but a code idfill-and-stroke-styles:canvasgradient-6>a href#canvasgradient>CanvasGradient/a>/code> or code idfill-and-stroke-styles:canvaspattern-7>a href#canvaspattern>CanvasPattern/a>/code>, then the respective object must be returned. (Such objects are opaque and therefore only useful for assigning to other attributes or for comparison to other gradients or patterns.)/p> p>The dfn idserialisation-of-a-color>serialization of a color/dfn> for a color value is a string, computed as follows: if it has alpha equal to 1.0, then the string is a lowercase six-digit hex value, prefixed with a # character (U+0023 NUMBER SIGN), with the first two digits representing the red component, the next two digits representing the green component, and the last two digits representing the blue component, the digits being a hrefhttps://infra.spec.whatwg.org/#ascii-lower-hex-digit idfill-and-stroke-styles:lowercase-ascii-hex-digits data-x-internallowercase-ascii-hex-digits>ASCII lower hex digits/a>. Otherwise, the color value has alpha less than 1.0, and the string is the color value in the CSS code>rgba()/code> functional-notation format: the literal string code>rgba/code> (U+0072 U+0067 U+0062 U+0061) followed by a U+0028 LEFT PARENTHESIS, a base-ten integer in the range 0-255 representing the red component (using a idfill-and-stroke-styles:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> in the shortest form possible), a literal U+002C COMMA and U+0020 SPACE, an integer for the green component, a comma and a space, an integer for the blue component, another comma and space, a U+0030 DIGIT ZERO, if the alpha value is greater than zero then a U+002E FULL STOP (representing the decimal point), if the alpha value is greater than zero then one or more a idfill-and-stroke-styles:ascii-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> representing the fractional part of the alpha, and finally a U+0029 RIGHT PARENTHESIS. User agents must express the fractional part of the alpha value, if any, with the level of precision necessary for the alpha value, when reparsed, to be interpreted as the same alpha value./p> p>When the context is created, the code idfill-and-stroke-styles:dom-context-2d-fillstyle-2>a href#dom-context-2d-fillstyle>fillStyle/a>/code> and code idfill-and-stroke-styles:dom-context-2d-strokestyle-2>a href#dom-context-2d-strokestyle>strokeStyle/a>/code> attributes must initially have the string value code>#000000/code>./p> p>When the value is a color, it must not be affected by the transformation matrix when used to draw on bitmaps./p> hr> p>There are two types of gradients, linear gradients and radial gradients, both represented by objects implementing the opaque code idfill-and-stroke-styles:canvasgradient-7>a href#canvasgradient>CanvasGradient/a>/code> interface./p> p idinterpolation>Once a gradient has been created (see below), stops are placed along it to define how the colors are distributed along the gradient. The color of the gradient at each stop is the color specified for that stop. Between each such stop, the colors and the alpha component must be linearly interpolated over the RGBA space without premultiplying the alpha value to find the color to use at that offset. Before the first stop, the color must be the color of the first stop. After the last stop, the color must be the color of the last stop. When there are no stops, the gradient is a href#transparent-black idfill-and-stroke-styles:transparent-black>transparent black/a>./p> dl classdomintro>dt>var>gradient/var> . code idfill-and-stroke-styles:dom-canvasgradient-addcolorstop>a href#dom-canvasgradient-addcolorstop>addColorStop/a>/code>(var>offset/var>, var>color/var>)dd> p>Adds a color stop with the given color to the gradient at the given offset. 0.0 is the offset at one end of the gradient, 1.0 is the offset at the other end./p> p>Throws an a idfill-and-stroke-styles:indexsizeerror hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idfill-and-stroke-styles:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the offset is out of range. Throws a a idfill-and-stroke-styles:syntaxerror hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idfill-and-stroke-styles:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the color cannot be parsed./p> dt>var>gradient/var> var>context/var> . code idfill-and-stroke-styles:dom-context-2d-createlineargradient>a href#dom-context-2d-createlineargradient>createLinearGradient/a>/code>(var>x0/var>, var>y0/var>, var>x1/var>, var>y1/var>)dd> p>Returns a code idfill-and-stroke-styles:canvasgradient-8>a href#canvasgradient>CanvasGradient/a>/code> object that represents a linear gradient that paints along the line given by the coordinates represented by the arguments./p> dt>var>gradient/var> var>context/var> . code idfill-and-stroke-styles:dom-context-2d-createradialgradient>a href#dom-context-2d-createradialgradient>createRadialGradient/a>/code>(var>x0/var>, var>y0/var>, var>r0/var>, var>x1/var>, var>y1/var>, var>r1/var>)dd> p>Returns a code idfill-and-stroke-styles:canvasgradient-9>a href#canvasgradient>CanvasGradient/a>/code> object that represents a radial gradient that paints along the cone given by the circles represented by the arguments./p> p>If either of the radii are negative, throws an a idfill-and-stroke-styles:indexsizeerror-2 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idfill-and-stroke-styles:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> exception./p> /dl> p>The dfn iddom-canvasgradient-addcolorstop>code>addColorStop(var>offset/var>, var>color/var>)/code>/dfn> method on the code idfill-and-stroke-styles:canvasgradient-10>a href#canvasgradient>CanvasGradient/a>/code> interface adds a new stop to a gradient. If the var>offset/var> is less than 0 or greater than 1 then an a idfill-and-stroke-styles:indexsizeerror-3 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idfill-and-stroke-styles:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> must be thrown. If the var>color/var> cannot be a href#parsed-as-a-css-color-value idfill-and-stroke-styles:parsed-as-a-css-color-value-3>parsed as a CSS <color> value/a>, then a a idfill-and-stroke-styles:syntaxerror-2 hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idfill-and-stroke-styles:domexception-5>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> must be thrown. Otherwise, the gradient must have a new stop placed, at offset var>offset/var> relative to the whole gradient, and with the color obtained by a href#parsed-as-a-css-color-value idfill-and-stroke-styles:parsed-as-a-css-color-value-4>parsing var>color/var> as a CSS <color> value/a>. If multiple stops are added at the same offset on a gradient, then they must be placed in the order added, with the first one closest to the start of the gradient, and each subsequent one infinitesimally further along towards the end point (in effect causing all but the first and last stop added at each point to be ignored)./p> p>The dfn iddom-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, when invoked, must return a linear code idfill-and-stroke-styles:canvasgradient-11>a href#canvasgradient>CanvasGradient/a>/code> initialized with the specified line./p> p>Linear gradients must be rendered such that all points on a line perpendicular to the line that crosses the start and end points have the color at the point where those two lines cross (with the colors coming from the a href#interpolation>interpolation and extrapolation/a> described above). The points in the linear gradient must be transformed as described by the a href#transformations idfill-and-stroke-styles:transformations>current transformation matrix/a> when rendering./p> p>If var>x0/var> var>x1/var> and span>var>y0/var> var>y1/var>/span>, then the linear gradient must paint nothing./p> p>The dfn iddom-context-2d-createradialgradient>code>createRadialGradient(var>x0/var>, var>y0/var>, var>r0/var>, var>x1/var>, var>y1/var>, var>r1/var>)/code>/dfn> method takes six arguments, the first three representing the start circle with origin (var>x0/var>, var>y0/var>) and radius var>r0/var>, and the last three representing the end circle with origin (var>x1/var>, var>y1/var>) and radius var>r1/var>. The values are in coordinate space units. If either of var>r0/var> or var>r1/var> are negative, then an a idfill-and-stroke-styles:indexsizeerror-4 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idfill-and-stroke-styles:domexception-6>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> must be thrown. Otherwise, the method, when invoked, must return a radial code idfill-and-stroke-styles:canvasgradient-12>a href#canvasgradient>CanvasGradient/a>/code> initialized with the two specified circles./p> p>Radial gradients must be rendered by following these steps:/p> ol>li>p>If var>xsub>0/sub>/var> var>xsub>1/sub>/var> and var>ysub>0/sub>/var> var>ysub>1/sub>/var> and var>rsub>0/sub>/var> var>rsub>1/sub>/var>, then the radial gradient must paint nothing. Abort these steps.li> p>Let span>x(var>ω/var>) (var>xsub>1/sub>/var>-var>xsub>0/sub>/var>)var>ω/var> + var>xsub>0/sub>/var>/span>/p> p>Let span>y(var>ω/var>) (var>ysub>1/sub>/var>-var>ysub>0/sub>/var>)var>ω/var> + var>ysub>0/sub>/var>/span>/p> p>Let span>r(var>ω/var>) (var>rsub>1/sub>/var>-var>rsub>0/sub>/var>)var>ω/var> + var>rsub>0/sub>/var>/span>/p> p>Let the color at var>ω/var> be the color at that position on the gradient (with the colors coming from the a href#interpolation>interpolation and extrapolation/a> described above)./p> li>p>For all values of var>ω/var> where span>r(var>ω/var>) > 0/span>, starting with the value of var>ω/var> nearest to positive infinity and ending with the value of var>ω/var> nearest to negative infinity, draw the circumference of the circle with radius span>r(var>ω/var>)/span> at position (span>x(var>ω/var>)/span>, span>y(var>ω/var>)/span>), with the color at var>ω/var>, but only painting on the parts of the bitmap that have not yet been painted on by earlier circles in this step for this rendering of the gradient./ol> p classnote>This effectively creates a cone, touched by the two circles defined in the creation of the gradient, with the part of the cone before the start circle (0.0) using the color of the first offset, the part of the cone after the end circle (1.0) using the color of the last offset, and areas outside the cone untouched by the gradient (a href#transparent-black idfill-and-stroke-styles:transparent-black-2>transparent black/a>)./p> p>The resulting radial gradient must then be transformed as described by the a href#transformations idfill-and-stroke-styles:transformations-2>current transformation matrix/a> when rendering./p> p>Gradients must be painted only where the relevant stroking or filling effects requires that they be drawn./p> hr> p>Patterns are represented by objects implementing the opaque code idfill-and-stroke-styles:canvaspattern-8>a href#canvaspattern>CanvasPattern/a>/code> interface./p> dl classdomintro>dt>var>pattern/var> var>context/var> . code idfill-and-stroke-styles:dom-context-2d-createpattern>a href#dom-context-2d-createpattern>createPattern/a>/code>(var>image/var>, var>repetition/var>)dd> p>Returns a code idfill-and-stroke-styles:canvaspattern-9>a href#canvaspattern>CanvasPattern/a>/code> object that uses the given image and repeats in the direction(s) given by the var>repetition/var> argument./p> p>The allowed values for var>repetition/var> are code>repeat/code> (both directions), code>repeat-x/code> (horizontal only), code>repeat-y/code> (vertical only), and code>no-repeat/code> (neither). If the var>repetition/var> argument is empty, the value code>repeat/code> is used./p> p>If the image isnt yet fully decoded, then nothing is drawn. If the image is a canvas with no data, throws an a idfill-and-stroke-styles:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idfill-and-stroke-styles:domexception-7>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> dt>var>pattern/var> . code idfill-and-stroke-styles:dom-canvaspattern-settransform>a href#dom-canvaspattern-settransform>setTransform/a>/code>(var>transform/var>)dd> p>Sets the transformation matrix that will be used when rendering the pattern during a fill or stroke painting operation./p> /dl> p>The dfn iddom-context-2d-createpattern>code>createPattern(var>image/var>, var>repetition/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>Let var>image/var> be the first argument and var>repetition/var> be the second argument.li>p>a href#check-the-usability-of-the-image-argument idfill-and-stroke-styles:check-the-usability-of-the-image-argument>Check the usability of the var>image/var> argument/a>. If this returns i>aborted/i>, then an exception has been thrown and the method doesnt return anything; abort these steps. If it returns i>bad/i>, then return null and abort these steps. Otherwise it returns i>good/i>; continue with these steps.li>p>If var>repetition/var> is the empty string, then set it to code>repeat/code>./p> li>p>If var>repetition/var> is not a a href#case-sensitive idfill-and-stroke-styles:case-sensitive>case-sensitive/a> match for one of code>repeat/code>, code>repeat-x/code>, code>repeat-y/code>, or code>no-repeat/code>, then throw a a idfill-and-stroke-styles:syntaxerror-3 hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idfill-and-stroke-styles:domexception-8>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Create a new code idfill-and-stroke-styles:canvaspattern-10>a href#canvaspattern>CanvasPattern/a>/code> object with the image var>image/var> and the repetition behavior given by var>repetition/var>.li>p>If a href#the-image-argument-is-not-origin-clean idfill-and-stroke-styles:the-image-argument-is-not-origin-clean>the var>image argument/var> is not origin-clean/a>, then mark the code idfill-and-stroke-styles:canvaspattern-11>a href#canvaspattern>CanvasPattern/a>/code> object as dfn idconcept-canvas-pattern-not-origin-clean>not origin-clean/dfn>.li>p>Return the code idfill-and-stroke-styles:canvaspattern-12>a href#canvaspattern>CanvasPattern/a>/code> object./ol> p>Modifying the var>image/var> used when creating a code idfill-and-stroke-styles:canvaspattern-13>a href#canvaspattern>CanvasPattern/a>/code> object after calling the code idfill-and-stroke-styles:dom-context-2d-createpattern-2>a href#dom-context-2d-createpattern>createPattern()/a>/code> method must not affect the pattern(s) rendered by the code idfill-and-stroke-styles:canvaspattern-14>a href#canvaspattern>CanvasPattern/a>/code> object./p> p>Patterns have a transformation matrix, which controls how the pattern is used when it is painted. Initially, a patterns transformation matrix must be the identity transform./p> p>The dfn iddom-canvaspattern-settransform>code>setTransform(var>transform/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>Let var>matrix/var> be the result of a hrefhttps://drafts.fxtf.org/geometry/#create-a-dommatrix-from-the-dictionary idfill-and-stroke-styles:create-a-dommatrix-from-a-dictionary data-x-internalcreate-a-dommatrix-from-a-dictionary>creating a code>DOMMatrix/code> from the dictionary/a> var>transform/var>, with var>ignore3D/var> set to true./p> li>p>If one or more of var>matrix/var>s a idfill-and-stroke-styles:m11-element hrefhttps://drafts.fxtf.org/geometry/#matrix-m11-element data-x-internalm11-element>m11 element/a>, a idfill-and-stroke-styles:m12-element hrefhttps://drafts.fxtf.org/geometry/#matrix-m12-element data-x-internalm12-element>m12 element/a>, a idfill-and-stroke-styles:m21-element hrefhttps://drafts.fxtf.org/geometry/#matrix-m21-element data-x-internalm21-element>m21 element/a>, a idfill-and-stroke-styles:m22-element hrefhttps://drafts.fxtf.org/geometry/#matrix-m22-element data-x-internalm22-element>m22 element/a>, a idfill-and-stroke-styles:m41-element hrefhttps://drafts.fxtf.org/geometry/#matrix-m41-element data-x-internalm41-element>m41 element/a>, or a idfill-and-stroke-styles:m42-element hrefhttps://drafts.fxtf.org/geometry/#matrix-m42-element data-x-internalm42-element>m42 element/a> are infinite or NaN, then return.li>p>Reset the patterns transformation matrix to var>matrix/var>./ol> p>When a pattern is to be rendered within an area, the user agent must run the following steps to determine what is rendered:/p> ol>li>p>Create an infinite a href#transparent-black idfill-and-stroke-styles:transparent-black-3>transparent black/a> bitmap.li> p>Place a copy of the image on the bitmap, anchored such that its top left corner is at the origin of the coordinate space, with one coordinate space unit per a hrefhttps://drafts.csswg.org/css-values/#px idfill-and-stroke-styles:px data-x-internalpx>CSS pixel/a> of the image, then place repeated copies of this image horizontally to the left and right, if the repetition behavior is code>repeat-x/code>, or vertically up and down, if the repetition behavior is code>repeat-y/code>, or in all four directions all over the bitmap, if the repetition behavior is code>repeat/code>./p> p>If the original image data is a bitmap image, then the value painted at a point in the area of the repetitions is computed by filtering the original image data. When scaling up, if the code idfill-and-stroke-styles:dom-context-2d-imagesmoothingenabled>a href#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled/a>/code> attribute is set to false, then the image must be rendered using nearest-neighbor interpolation. Otherwise, the user agent may use any filtering algorithm (for example bilinear interpolation or nearest-neighbor). User agents which support multiple filtering algorithms may use the value of the code idfill-and-stroke-styles:dom-context-2d-imagesmoothingquality>a href#dom-context-2d-imagesmoothingquality>imageSmoothingQuality/a>/code> attribute to guide the choice of filtering algorithm. When such a filtering algorithm requires a pixel value from outside the original image data, it must instead use the value from wrapping the pixels coordinates to the original images dimensions. (That is, the filter uses repeat behavior, regardless of the value of the patterns repetition behavior.)/p> li>p>Transform the resulting bitmap according to the patterns transformation matrix.li>p>Transform the resulting bitmap again, this time according to the a href#transformations idfill-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 a href#transparent-black idfill-and-stroke-styles:transparent-black-4>transparent black/a>.li>p>The resulting bitmap is what is to be rendered, with the same origin and same scale./ol> hr> p>If a radial gradient or repeated pattern is used when the transformation matrix is singular, then the resulting style must be a href#transparent-black idfill-and-stroke-styles:transparent-black-5>transparent black/a> (otherwise the gradient or pattern would be collapsed to a point or line, leaving the other pixels undefined). Linear gradients and solid colors always define all points even with singular transformation matrices./p> h6 iddrawing-rectangles-to-the-bitmap>span classsecno>4.12.5.1.10/span> Drawing rectangles to the bitmapa href#drawing-rectangles-to-the-bitmap classself-link>/a>/h6> p>Objects that implement the code iddrawing-rectangles-to-the-bitmap:canvasrect>a href#canvasrect>CanvasRect/a>/code> interface provide the following methods for immediately drawing rectangles to the bitmap. The methods each take four arguments; the first two give the var>x/var> and var>y/var> coordinates of the top left of the rectangle, and the second two give the width var>w/var> and height var>h/var> of the rectangle, respectively./p> p>The a href#transformations iddrawing-rectangles-to-the-bitmap:transformations>current transformation matrix/a> must be applied to the following four coordinates, which form the path that must then be closed to get the specified rectangle: span>(var>x/var>, var>y/var>)/span>, span>(var>x/var>+var>w/var>, var>y/var>)/span>, span>(var>x/var>+var>w/var>, var>y/var>+var>h/var>)/span>, span>(var>x/var>, var>y/var>+var>h/var>)/span>./p> p>Shapes are painted without affecting the a href#current-default-path iddrawing-rectangles-to-the-bitmap:current-default-path>current default path/a>, and are subject to the a href#clipping-region iddrawing-rectangles-to-the-bitmap:clipping-region>clipping region/a>, and, with the exception of code iddrawing-rectangles-to-the-bitmap:dom-context-2d-clearrect>a href#dom-context-2d-clearrect>clearRect()/a>/code>, also a href#shadows iddrawing-rectangles-to-the-bitmap:shadows>shadow effects/a>, a href#dom-context-2d-globalalpha iddrawing-rectangles-to-the-bitmap:dom-context-2d-globalalpha>global alpha/a>, and a href#dom-context-2d-globalcompositeoperation iddrawing-rectangles-to-the-bitmap:dom-context-2d-globalcompositeoperation>global composition operators/a>./p> dl classdomintro>dt>var>context/var> . code iddrawing-rectangles-to-the-bitmap:dom-context-2d-clearrect-2>a href#dom-context-2d-clearrect>clearRect/a>/code>(var>x/var>, var>y/var>, var>w/var>, var>h/var>)dd> p>Clears all pixels on the bitmap in the given rectangle to a href#transparent-black iddrawing-rectangles-to-the-bitmap:transparent-black>transparent black/a>./p> dt>var>context/var> . code iddrawing-rectangles-to-the-bitmap:dom-context-2d-fillrect>a href#dom-context-2d-fillrect>fillRect/a>/code>(var>x/var>, var>y/var>, var>w/var>, var>h/var>)dd> p>Paints the given rectangle onto the bitmap, using the current fill style./p> dt>var>context/var> . code iddrawing-rectangles-to-the-bitmap:dom-context-2d-strokerect>a href#dom-context-2d-strokerect>strokeRect/a>/code>(var>x/var>, var>y/var>, var>w/var>, var>h/var>)dd> p>Paints the box that outlines the given rectangle onto the bitmap, using the current stroke style./p> /dl> p>The dfn iddom-context-2d-clearrect>code>clearRect(var>x/var>, var>y/var>, var>w/var>, var>h/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If any of the arguments are infinite or NaN, then return.li>p>Let var>pixels/var> be the set of pixels in the specified rectangle that also intersect the current a href#clipping-region iddrawing-rectangles-to-the-bitmap:clipping-region-2>clipping region/a>.li>p>Clear the pixels in var>pixels/var> to a a href#transparent-black iddrawing-rectangles-to-the-bitmap:transparent-black-2>transparent black/a>, erasing any previous image./ol> p classnote>If either height or width are zero, this method has no effect, since the set of pixels would be empty./p> p>The dfn iddom-context-2d-fillrect>code>fillRect(var>x/var>, var>y/var>, var>w/var>, var>h/var>)/code>/dfn> method, when invoked, must must run these steps:/p> ol>li>p>If any of the arguments are infinite or NaN, then return.li>p>If either var>w/var> or var>h/var> are zero, then abort these steps.li>p>Paint the specified rectangular area using the code iddrawing-rectangles-to-the-bitmap:dom-context-2d-fillstyle>a href#dom-context-2d-fillstyle>fillStyle/a>/code>./p> /ol> p>The dfn iddom-context-2d-strokerect>code>strokeRect(var>x/var>, var>y/var>, var>w/var>, var>h/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If any of the arguments are infinite or NaN, then return.li>p>Take the result of a href#trace-a-path iddrawing-rectangles-to-the-bitmap:trace-a-path>tracing the path/a> described below, using the code iddrawing-rectangles-to-the-bitmap:canvaspathdrawingstyles>a href#canvaspathdrawingstyles>CanvasPathDrawingStyles/a>/code> interfaces line styles, and fill it with the code iddrawing-rectangles-to-the-bitmap:dom-context-2d-strokestyle>a href#dom-context-2d-strokestyle>strokeStyle/a>/code>./ol> p>If both var>w/var> and var>h/var> are zero, the path has a single subpath with just one point (var>x/var>, var>y/var>), and no lines, and this method thus has no effect (the a href#trace-a-path iddrawing-rectangles-to-the-bitmap:trace-a-path-2>trace a path/a> algorithm returns an empty path in that case)./p> p>If just one of either var>w/var> or var>h/var> is zero, then the path has a single subpath consisting of two points, with coordinates (var>x/var>, var>y/var>) and (var>x/var>+var>w/var>, var>y/var>+var>h/var>), in that order, connected by a single straight line./p> p>Otherwise, the path has a single subpath consisting of four points, with coordinates (span>var>x/var>/span>, var>y/var>), (span>var>x/var>+var>w/var>/span>, var>y/var>), (var>x/var>+var>w/var>, var>y/var>+var>h/var>), and (var>x/var>, var>y/var>+var>h/var>), connected to each other in that order by straight lines./p> h6 iddrawing-text-to-the-bitmap>span classsecno>4.12.5.1.11/span> Drawing text to the bitmapa href#drawing-text-to-the-bitmap classself-link>/a>/h6>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> canvas-textspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>3.2+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>3.5+/span>/span>span classie yes>span>IE/span> span>9+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>4+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.1+/span>/span>span classopera yes>span>Opera/span> span>10.5+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featcanvas-text>caniuse.com/a>/div> dl idtext-0 classdomintro>dt>var>context/var> . code iddrawing-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 iddrawing-text-to-the-bitmap:dom-context-2d-stroketext>a href#dom-context-2d-stroketext>strokeText/a>/code>(var>text/var>, var>x/var>, var>y/var> , var>maxWidth/var> )dd> p>Fills or strokes (respectively) the given text at the given position. If a maximum width is provided, the text will be scaled to fit that width if necessary./p> dt>var>metrics/var> var>context/var> . code iddrawing-text-to-the-bitmap:dom-context-2d-measuretext>a href#dom-context-2d-measuretext>measureText/a>/code>(var>text/var>)dd> p>Returns a code iddrawing-text-to-the-bitmap:textmetrics>a href#textmetrics>TextMetrics/a>/code> object with the metrics of the given text in the current font./p> dt>var>metrics/var> . code iddrawing-text-to-the-bitmap:dom-textmetrics-width>a href#dom-textmetrics-width>width/a>/code>dt>var>metrics/var> . code iddrawing-text-to-the-bitmap:dom-textmetrics-actualboundingboxleft>a href#dom-textmetrics-actualboundingboxleft>actualBoundingBoxLeft/a>/code>dt>var>metrics/var> . code iddrawing-text-to-the-bitmap:dom-textmetrics-actualboundingboxright>a href#dom-textmetrics-actualboundingboxright>actualBoundingBoxRight/a>/code>dt>var>metrics/var> . code iddrawing-text-to-the-bitmap:dom-textmetrics-fontboundingboxascent>a href#dom-textmetrics-fontboundingboxascent>fontBoundingBoxAscent/a>/code>dt>var>metrics/var> . code iddrawing-text-to-the-bitmap:dom-textmetrics-fontboundingboxdescent>a href#dom-textmetrics-fontboundingboxdescent>fontBoundingBoxDescent/a>/code>dt>var>metrics/var> . code iddrawing-text-to-the-bitmap:dom-textmetrics-actualboundingboxascent>a href#dom-textmetrics-actualboundingboxascent>actualBoundingBoxAscent/a>/code>dt>var>metrics/var> . code iddrawing-text-to-the-bitmap:dom-textmetrics-actualboundingboxdescent>a href#dom-textmetrics-actualboundingboxdescent>actualBoundingBoxDescent/a>/code>dt>var>metrics/var> . code iddrawing-text-to-the-bitmap:dom-textmetrics-emheightascent>a href#dom-textmetrics-emheightascent>emHeightAscent/a>/code>dt>var>metrics/var> . code iddrawing-text-to-the-bitmap:dom-textmetrics-emheightdescent>a href#dom-textmetrics-emheightdescent>emHeightDescent/a>/code>dt>var>metrics/var> . code iddrawing-text-to-the-bitmap:dom-textmetrics-hangingbaseline>a href#dom-textmetrics-hangingbaseline>hangingBaseline/a>/code>dt>var>metrics/var> . code iddrawing-text-to-the-bitmap:dom-textmetrics-alphabeticbaseline>a href#dom-textmetrics-alphabeticbaseline>alphabeticBaseline/a>/code>dt>var>metrics/var> . code iddrawing-text-to-the-bitmap:dom-textmetrics-ideographicbaseline>a href#dom-textmetrics-ideographicbaseline>ideographicBaseline/a>/code>dd> p>Returns the measurement described below./p> /dl> p>Objects that implement the code iddrawing-text-to-the-bitmap:canvastext>a href#canvastext>CanvasText/a>/code> interface provide the following methods for rendering text./p> p>The dfn iddom-context-2d-filltext>code>fillText()/code>/dfn> and dfn iddom-context-2d-stroketext>code>strokeText()/code>/dfn> methods take three or four arguments, var>text/var>, var>x/var>, var>y/var>, and optionally var>maxWidth/var>, and render the given var>text/var> at the given (var>x/var>, var>y/var>) coordinates ensuring that the text isnt wider than var>maxWidth/var> if specified, using the current code iddrawing-text-to-the-bitmap:dom-context-2d-font>a href#dom-context-2d-font>font/a>/code>, code iddrawing-text-to-the-bitmap:dom-context-2d-textalign>a href#dom-context-2d-textalign>textAlign/a>/code>, and code iddrawing-text-to-the-bitmap:dom-context-2d-textbaseline>a href#dom-context-2d-textbaseline>textBaseline/a>/code> values. Specifically, when the methods are invoked, the user agent must run these steps:/p> ol>li>p>If any of the arguments are infinite or NaN, then return.li>p>Run the a href#text-preparation-algorithm iddrawing-text-to-the-bitmap:text-preparation-algorithm>text preparation algorithm/a>, passing it var>text/var>, the object implementing the code iddrawing-text-to-the-bitmap:canvastext-2>a href#canvastext>CanvasText/a>/code> interface, and, if the var>maxWidth/var> argument was provided, that argument. Let var>glyphs/var> be the result./p> li>p>Move all the shapes in var>glyphs/var> to the right by var>x/var> a hrefhttps://drafts.csswg.org/css-values/#px iddrawing-text-to-the-bitmap:px data-x-internalpx>CSS pixels/a> and down by var>y/var> a hrefhttps://drafts.csswg.org/css-values/#px iddrawing-text-to-the-bitmap:px-2 data-x-internalpx>CSS pixels/a>.li> p>Paint the shapes given in var>glyphs/var>, as transformed by the a href#transformations iddrawing-text-to-the-bitmap:transformations>current transformation matrix/a>, with each a hrefhttps://drafts.csswg.org/css-values/#px iddrawing-text-to-the-bitmap:px-3 data-x-internalpx>CSS pixel/a> in the coordinate space of var>glyphs/var> mapped to one coordinate space unit./p> p>For code iddrawing-text-to-the-bitmap:dom-context-2d-filltext-2>a href#dom-context-2d-filltext>fillText()/a>/code>, code iddrawing-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 iddrawing-text-to-the-bitmap:dom-context-2d-strokestyle>a href#dom-context-2d-strokestyle>strokeStyle/a>/code> must be ignored. For code iddrawing-text-to-the-bitmap:dom-context-2d-stroketext-2>a href#dom-context-2d-stroketext>strokeText()/a>/code>, the reverse holds: code iddrawing-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 iddrawing-text-to-the-bitmap:trace-a-path>tracing/a> the shapes using the object implementing the code iddrawing-text-to-the-bitmap:canvastext-3>a href#canvastext>CanvasText/a>/code> interface for the line styles, and code iddrawing-text-to-the-bitmap:dom-context-2d-fillstyle-2>a href#dom-context-2d-fillstyle>fillStyle/a>/code> must be ignored./p> p>These shapes are painted without affecting the current path, and are subject to a href#shadows iddrawing-text-to-the-bitmap:shadows>shadow effects/a>, a href#dom-context-2d-globalalpha iddrawing-text-to-the-bitmap:dom-context-2d-globalalpha>global alpha/a>, the a href#clipping-region iddrawing-text-to-the-bitmap:clipping-region>clipping region/a>, and a href#dom-context-2d-globalcompositeoperation iddrawing-text-to-the-bitmap:dom-context-2d-globalcompositeoperation>global composition operators/a>./p> /ol> p>The dfn iddom-context-2d-measuretext>code>measureText()/code>/dfn> method takes one argument, var>text/var>. When the method is invoked, the user agent must run the a href#text-preparation-algorithm iddrawing-text-to-the-bitmap:text-preparation-algorithm-2>text preparation algorithm/a>, passing it var>text/var> and the object implementing the code iddrawing-text-to-the-bitmap:canvastext-4>a href#canvastext>CanvasText/a>/code> interface, and then using the returned a iddrawing-text-to-the-bitmap:inline-box hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a> must create a new code iddrawing-text-to-the-bitmap:textmetrics-2>a href#textmetrics>TextMetrics/a>/code> object with its attributes set as described in the following list. If doing these measurements requires using a font that has an a href#concept-origin iddrawing-text-to-the-bitmap:concept-origin>origin/a> that is not the a href#same-origin iddrawing-text-to-the-bitmap:same-origin>same/a> as that of the code iddrawing-text-to-the-bitmap:document>a href#document>Document/a>/code> object that owns the code iddrawing-text-to-the-bitmap:the-canvas-element>a href#the-canvas-element>canvas/a>/code> element (even if using a font means just checking if that font has a particular glyph in it before falling back to another font), then the method, when invoked, must throw a a iddrawing-text-to-the-bitmap:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code iddrawing-text-to-the-bitmap:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>. Otherwise, it must return the new code iddrawing-text-to-the-bitmap:textmetrics-3>a href#textmetrics>TextMetrics/a>/code> object. a href#refsCSS>CSS/a> a href#fingerprinting-vector iddrawing-text-to-the-bitmap:fingerprinting-vector classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> dl>dt>dfn iddom-textmetrics-width>code>width/code>/dfn> attributedd>p>The width of that a iddrawing-text-to-the-bitmap:inline-box-2 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a>, in a hrefhttps://drafts.csswg.org/css-values/#px iddrawing-text-to-the-bitmap:px-4 data-x-internalpx>CSS pixels/a>. (The texts advance width.)dt>dfn iddom-textmetrics-actualboundingboxleft>code>actualBoundingBoxLeft/code>/dfn> attributedd> p>The distance parallel to the baseline from the alignment point given by the code iddrawing-text-to-the-bitmap:dom-context-2d-textalign-2>a href#dom-context-2d-textalign>textAlign/a>/code> attribute to the left side of the bounding rectangle of the given text, in a hrefhttps://drafts.csswg.org/css-values/#px iddrawing-text-to-the-bitmap:px-5 data-x-internalpx>CSS pixels/a>; positive numbers indicating a distance going left from the given alignment point. p classnote>The sum of this value and the next (code iddrawing-text-to-the-bitmap:dom-textmetrics-actualboundingboxright-2>a href#dom-textmetrics-actualboundingboxright>actualBoundingBoxRight/a>/code>) can be wider than the width of the a iddrawing-text-to-the-bitmap:inline-box-3 hrefhttps://drafts.csswg.org/css2/visuren.html#inline-box data-x-internalinline-box>inline box/a> (code iddrawing-text-to-the-bitmap:dom-textmetrics-width-2>a href#dom-textmetrics-width>width/a>/code>), in particular with slanted fonts where characters overhang their advance width./p> dt>dfn iddom-textmetrics-actualboundingboxright>code>actualBoundingBoxRight/code>/dfn> attributedd> p>The distance parallel to the baseline from the alignment point given by the code iddrawing-text-to-the-bitmap:dom-context-2d-textalign-3>a href#dom-context-2d-textalign>textAlign/a>/code> attribute to the right side of the bounding rectangle of the given text, in a hrefhttps://drafts.csswg.org/css-values/#px iddrawing-text-to-the-bitmap:px-6 data-x-internalpx>CSS pixels/a>; positive numbers indicating a distance going right from the given alignment point./p> dt>dfn iddom-textmetrics-fontboundingboxascent>code>fontBoundingBoxAscent/code>/dfn> attributedd> p>The distance from the horizontal line indicated by the code iddrawing-text-to-the-bitmap:dom-context-2d-textbaseline-2>a href#dom-context-2d-textbaseline>textBaseline/a>/code> attribute to the top of the highest bounding rectangle of all the fonts used to render the text, in a hrefhttps://drafts.csswg.org/css-values/#px iddrawing-text-to-the-bitmap:px-7 data-x-internalpx>CSS pixels/a>; positive numbers indicating a distance going up from the given baseline./p> p classnote>This value and the next are useful when rendering a background that have to have a consistent height even if the exact text being rendered changes. The code iddrawing-text-to-the-bitmap:dom-textmetrics-actualboundingboxascent-2>a href#dom-textmetrics-actualboundingboxascent>actualBoundingBoxAscent/a>/code> attribute (and its corresponding attribute for the descent) are useful when drawing a bounding box around specific text./p> dt>dfn iddom-textmetrics-fontboundingboxdescent>code>fontBoundingBoxDescent/code>/dfn> attributedd>p>The distance from the horizontal line indicated by the code iddrawing-text-to-the-bitmap:dom-context-2d-textbaseline-3>a href#dom-context-2d-textbaseline>textBaseline/a>/code> attribute to the bottom of the lowest bounding rectangle of all the fonts used to render the text, in a hrefhttps://drafts.csswg.org/css-values/#px iddrawing-text-to-the-bitmap:px-8 data-x-internalpx>CSS pixels/a>; positive numbers indicating a distance going down from the given baseline.dt>dfn iddom-textmetrics-actualboundingboxascent>code>actualBoundingBoxAscent/code>/dfn> attributedd> p>The distance from the horizontal line indicated by the code iddrawing-text-to-the-bitmap:dom-context-2d-textbaseline-4>a href#dom-context-2d-textbaseline>textBaseline/a>/code> attribute to the top of the bounding rectangle of the given text, in a hrefhttps://drafts.csswg.org/css-values/#px iddrawing-text-to-the-bitmap:px-9 data-x-internalpx>CSS pixels/a>; positive numbers indicating a distance going up from the given baseline. p classnote>This number can vary greatly based on the input text, even if the first font specified covers all the characters in the input. For example, the code iddrawing-text-to-the-bitmap:dom-textmetrics-actualboundingboxascent-3>a href#dom-textmetrics-actualboundingboxascent>actualBoundingBoxAscent/a>/code> of a lowercase o from an alphabetic baseline would be less than that of an uppercase F. The value can easily be negative; for example, the distance from the top of the em box (code iddrawing-text-to-the-bitmap:dom-context-2d-textbaseline-5>a href#dom-context-2d-textbaseline>textBaseline/a>/code> value code iddrawing-text-to-the-bitmap:dom-context-2d-textbaseline-top>a href#dom-context-2d-textbaseline-top>top/a>/code>) to the top of the bounding rectangle when the given text is just a single comma code>,/code> would likely (unless the font is quite unusual) be negative./p> dt>dfn iddom-textmetrics-actualboundingboxdescent>code>actualBoundingBoxDescent/code>/dfn> attributedd>p>The distance from the horizontal line indicated by the code iddrawing-text-to-the-bitmap:dom-context-2d-textbaseline-6>a href#dom-context-2d-textbaseline>textBaseline/a>/code> attribute to the bottom of the bounding rectangle of the given text, in a hrefhttps://drafts.csswg.org/css-values/#px iddrawing-text-to-the-bitmap:px-10 data-x-internalpx>CSS pixels/a>; positive numbers indicating a distance going down from the given baseline.dt>dfn iddom-textmetrics-emheightascent>code>emHeightAscent/code>/dfn> attributedd>p>The distance from the horizontal line indicated by the code iddrawing-text-to-the-bitmap:dom-context-2d-textbaseline-7>a href#dom-context-2d-textbaseline>textBaseline/a>/code> attribute to the highest top of the em squares in the a iddrawing-text-to-the-bitmap:line-box hrefhttps://drafts.csswg.org/css2/visuren.html#line-box data-x-internalline-box>line box/a>, in a hrefhttps://drafts.csswg.org/css-values/#px iddrawing-text-to-the-bitmap:px-11 data-x-internalpx>CSS pixels/a>; positive numbers indicating that the given baseline is below the top of that em square (so this value will usually be positive). Zero if the given baseline is the top of that em square; half the font size if the given baseline is the middle of that em square.dt>dfn iddom-textmetrics-emheightdescent>code>emHeightDescent/code>/dfn> attributedd>p>The distance from the horizontal line indicated by the code iddrawing-text-to-the-bitmap:dom-context-2d-textbaseline-8>a href#dom-context-2d-textbaseline>textBaseline/a>/code> attribute to the lowest bottom of the em squares in the a iddrawing-text-to-the-bitmap:line-box-2 hrefhttps://drafts.csswg.org/css2/visuren.html#line-box data-x-internalline-box>line box/a>, in a hrefhttps://drafts.csswg.org/css-values/#px iddrawing-text-to-the-bitmap:px-12 data-x-internalpx>CSS pixels/a>; positive numbers indicating that the given baseline is below the bottom of that em square (so this value will usually be negative). (Zero if the given baseline is the bottom of that em square.)dt>dfn iddom-textmetrics-hangingbaseline>code>hangingBaseline/code>/dfn> attributedd>p>The distance from the horizontal line indicated by the code iddrawing-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 a iddrawing-text-to-the-bitmap:line-box-3 hrefhttps://drafts.csswg.org/css2/visuren.html#line-box data-x-internalline-box>line box/a>, in a hrefhttps://drafts.csswg.org/css-values/#px iddrawing-text-to-the-bitmap:px-13 data-x-internalpx>CSS pixels/a>; positive numbers indicating that the given baseline is below the hanging baseline. (Zero if the given baseline is the hanging baseline.)dt>dfn iddom-textmetrics-alphabeticbaseline>code>alphabeticBaseline/code>/dfn> attributedd>p>The distance from the horizontal line indicated by the code iddrawing-text-to-the-bitmap:dom-context-2d-textbaseline-10>a href#dom-context-2d-textbaseline>textBaseline/a>/code> attribute to the alphabetic baseline of the a iddrawing-text-to-the-bitmap:line-box-4 hrefhttps://drafts.csswg.org/css2/visuren.html#line-box data-x-internalline-box>line box/a>, in a hrefhttps://drafts.csswg.org/css-values/#px iddrawing-text-to-the-bitmap:px-14 data-x-internalpx>CSS pixels/a>; positive numbers indicating that the given baseline is below the alphabetic baseline. (Zero if the given baseline is the alphabetic baseline.)dt>dfn iddom-textmetrics-ideographicbaseline>code>ideographicBaseline/code>/dfn> attributedd>p>The distance from the horizontal line indicated by the code iddrawing-text-to-the-bitmap:dom-context-2d-textbaseline-11>a href#dom-context-2d-textbaseline>textBaseline/a>/code> attribute to the ideographic baseline of the a iddrawing-text-to-the-bitmap:line-box-5 hrefhttps://drafts.csswg.org/css2/visuren.html#line-box data-x-internalline-box>line box/a>, in a hrefhttps://drafts.csswg.org/css-values/#px iddrawing-text-to-the-bitmap:px-15 data-x-internalpx>CSS pixels/a>; positive numbers indicating that the given baseline is below the ideographic baseline. (Zero if the given baseline is the ideographic baseline.)/dl> p classnote>Glyphs rendered using code iddrawing-text-to-the-bitmap:dom-context-2d-filltext-3>a href#dom-context-2d-filltext>fillText()/a>/code> and code iddrawing-text-to-the-bitmap:dom-context-2d-stroketext-3>a href#dom-context-2d-stroketext>strokeText()/a>/code> can spill out of the box given by the font size (the em square size) and the width returned by code iddrawing-text-to-the-bitmap:dom-context-2d-measuretext-2>a href#dom-context-2d-measuretext>measureText()/a>/code> (the text width). Authors are encouraged to use the bounding box values described above if this is an issue./p> p classnote>A future version of the 2D context API might provide a way to render fragments of documents, rendered using CSS, straight to the canvas. This would be provided in preference to a dedicated way of doing multiline layout./p> h6 iddrawing-paths-to-the-canvas>span classsecno>4.12.5.1.12/span> Drawing paths to the canvasa href#drawing-paths-to-the-canvas classself-link>/a>/h6> p>Objects that implement the code iddrawing-paths-to-the-canvas:canvasdrawpath>a href#canvasdrawpath>CanvasDrawPath/a>/code> interface have a dfn idcurrent-default-path>current default path/dfn>. There is only one a href#current-default-path iddrawing-paths-to-the-canvas:current-default-path>current default path/a>, it is not part of the a href#drawing-state iddrawing-paths-to-the-canvas:drawing-state>drawing state/a>. The a href#current-default-path iddrawing-paths-to-the-canvas:current-default-path-2>current default path/a> is a a href#concept-path iddrawing-paths-to-the-canvas:concept-path>path/a>, as described above./p> dl classdomintro>dt>var>context/var> . code iddrawing-paths-to-the-canvas:dom-context-2d-beginpath>a href#dom-context-2d-beginpath>beginPath/a>/code>()dd> p>Resets the a href#current-default-path iddrawing-paths-to-the-canvas:current-default-path-3>current default path/a>./p> dt>var>context/var> . code iddrawing-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 iddrawing-paths-to-the-canvas:dom-context-2d-fill-2>a href#dom-context-2d-fill>fill/a>/code>(var>path/var> , var>fillRule/var> )dd> p>Fills the subpaths of the a href#current-default-path iddrawing-paths-to-the-canvas:current-default-path-4>current default path/a> or the given path with the current fill style, obeying the given fill rule./p> dt>var>context/var> . code iddrawing-paths-to-the-canvas:dom-context-2d-stroke>a href#dom-context-2d-stroke>stroke/a>/code>()dt>var>context/var> . code iddrawing-paths-to-the-canvas:dom-context-2d-stroke-2>a href#dom-context-2d-stroke>stroke/a>/code>(var>path/var>)dd> p>Strokes the subpaths of the a href#current-default-path iddrawing-paths-to-the-canvas:current-default-path-5>current default path/a> or the given path with the current stroke style./p> dt>var>context/var> . code iddrawing-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 iddrawing-paths-to-the-canvas:dom-context-2d-clip-2>a href#dom-context-2d-clip>clip/a>/code>(var>path/var> , var>fillRule/var> )dd> p>Further constrains the clipping region to the a href#current-default-path iddrawing-paths-to-the-canvas:current-default-path-6>current default path/a> or the given path, using the given fill rule to determine what points are in the path./p> dt>var>context/var> . code iddrawing-paths-to-the-canvas:dom-context-2d-resetclip>a href#dom-context-2d-resetclip>resetClip/a>/code>()dd> p>Unconstrains the clipping region./p> dt>var>context/var> . code iddrawing-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 iddrawing-paths-to-the-canvas:dom-context-2d-ispointinpath-2>a href#dom-context-2d-ispointinpath>isPointInPath/a>/code>(var>path/var>, var>x/var>, var>y/var> , var>fillRule/var> )dd> p>Returns true if the given point is in the a href#current-default-path iddrawing-paths-to-the-canvas:current-default-path-7>current default path/a> or the given path, using the given fill rule to determine what points are in the path./p> dt>var>context/var> . code iddrawing-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 iddrawing-paths-to-the-canvas:dom-context-2d-ispointinstroke-2>a href#dom-context-2d-ispointinstroke>isPointInStroke/a>/code>(var>path/var>, var>x/var>, var>y/var>)dd> p>Returns true if the given point would be in the region covered by the stroke of the a href#current-default-path iddrawing-paths-to-the-canvas:current-default-path-8>current default path/a> or the given path, given the current stroke style./p> /dl> p>The dfn iddom-context-2d-beginpath>code>beginPath()/code>/dfn> method, when invoked, must empty the list of subpaths in the contexts a href#current-default-path iddrawing-paths-to-the-canvas:current-default-path-9>current default path/a> so that the it once again has zero subpaths./p> p>Where the following method definitions use the term i>intended path/i>, it means the code iddrawing-paths-to-the-canvas:path2d>a href#path2d>Path2D/a>/code> argument, if one was provided, or the a href#current-default-path iddrawing-paths-to-the-canvas:current-default-path-10>current default path/a> otherwise./p> p>When the intended path is a code iddrawing-paths-to-the-canvas:path2d-2>a href#path2d>Path2D/a>/code> object, the coordinates and lines of its subpaths must be transformed according to the a href#transformations iddrawing-paths-to-the-canvas:transformations> current transformation matrix/a> on the object implementing the code iddrawing-paths-to-the-canvas:canvastransform>a href#canvastransform>CanvasTransform/a>/code> interface when used by these methods (without affecting the code iddrawing-paths-to-the-canvas:path2d-3>a href#path2d>Path2D/a>/code> object itself). When the intended path is the a href#current-default-path iddrawing-paths-to-the-canvas:current-default-path-11>current default path/a>, it is not affected by the transform. (This is because transformations already affect the a href#current-default-path iddrawing-paths-to-the-canvas:current-default-path-12>current default path/a> when it is constructed, so applying it when it is painted as well would result in a double transformation.)/p> p>The dfn iddom-context-2d-fill>code>fill()/code>/dfn> method, when invoked, must fill all the subpaths of the intended path, using code iddrawing-paths-to-the-canvas:dom-context-2d-fillstyle>a href#dom-context-2d-fillstyle>fillStyle/a>/code>, and using the a href#fill-rule iddrawing-paths-to-the-canvas:fill-rule>fill rule/a> indicated by the var>fillRule/var> argument. Open subpaths must be implicitly closed when being filled (without affecting the actual subpaths).div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id28217 titlecanvas>: not clear if two polygon paths with a common edge should have no line visible>28217/a>/div> p>The dfn iddom-context-2d-stroke>code>stroke()/code>/dfn> method, when invoked, must a href#trace-a-path iddrawing-paths-to-the-canvas:trace-a-path>trace/a> the intended path, using this code iddrawing-paths-to-the-canvas:canvaspathdrawingstyles>a href#canvaspathdrawingstyles>CanvasPathDrawingStyles/a>/code> object for the line styles, and then fill the resulting path using the code iddrawing-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 iddrawing-paths-to-the-canvas:dom-context-2d-fillrule-nonzero>nonzero winding rule/a>./p> p classnote>As a result of how the algorithm to a href#trace-a-path iddrawing-paths-to-the-canvas:trace-a-path-2>trace a path/a> is defined, overlapping parts of the paths in one stroke operation are treated as if their union was what was painted./p> p classnote>The stroke em>style/em> is affected by the transformation during painting, even if the intended path is the a href#current-default-path iddrawing-paths-to-the-canvas:current-default-path-13>current default path/a>./p> p>Paths, when filled or stroked, must be painted without affecting the a href#current-default-path iddrawing-paths-to-the-canvas:current-default-path-14>current default path/a> or any code iddrawing-paths-to-the-canvas:path2d-4>a href#path2d>Path2D/a>/code> objects, and must be subject to a href#shadows iddrawing-paths-to-the-canvas:shadows>shadow effects/a>, a href#dom-context-2d-globalalpha iddrawing-paths-to-the-canvas:dom-context-2d-globalalpha>global alpha/a>, the a href#clipping-region iddrawing-paths-to-the-canvas:clipping-region>clipping region/a>, and a href#dom-context-2d-globalcompositeoperation iddrawing-paths-to-the-canvas:dom-context-2d-globalcompositeoperation>global composition operators/a>. (The effect of transformations is described above and varies based on which path is being used.)/p> hr> p>The dfn iddom-context-2d-clip>code>clip()/code>/dfn> method, when invoked, must create a new dfn idclipping-region>clipping region/dfn> by calculating the intersection of the current clipping region and the area described by the intended path, using the a href#fill-rule iddrawing-paths-to-the-canvas:fill-rule-2>fill rule/a> indicated by the var>fillRule/var> argument. Open subpaths must be implicitly closed when computing the clipping region, without affecting the actual subpaths. The new clipping region replaces the current clipping region./p> p>When the context is initialized, the clipping region must be set to the largest infinite surface (i.e. by default, no clipping occurs)./p> p>The dfn iddom-context-2d-resetclip>code>resetClip()/code>/dfn> method, when invoked, must create a new a href#clipping-region iddrawing-paths-to-the-canvas:clipping-region-2>clipping region/a> that is the largest infinite surface. The new clipping region replaces the current clipping region./p> hr> p>The dfn iddom-context-2d-ispointinpath>code>isPointInPath()/code>/dfn> method, when invoked, must return true if the point given by the var>x/var> and var>y/var> coordinates passed to the method, when treated as coordinates in the canvas coordinate space unaffected by the current transformation, is inside the intended path as determined by the a href#fill-rule iddrawing-paths-to-the-canvas:fill-rule-3>fill rule/a> indicated by the var>fillRule/var> argument; and must return false otherwise. Open subpaths must be implicitly closed when computing the area inside the path, without affecting the actual subpaths. Points on the path itself must be considered to be inside the path. If either of the arguments are infinite or NaN, then the method must return false./p> hr> p>The dfn iddom-context-2d-ispointinstroke>code>isPointInStroke()/code>/dfn> method, when invoked, must return true if the point given by the var>x/var> and var>y/var> coordinates passed to the method, when treated as coordinates in the canvas coordinate space unaffected by the current transformation, is inside the path that results from a href#trace-a-path iddrawing-paths-to-the-canvas:trace-a-path-3>tracing/a> the intended path, using the a href#dom-context-2d-fillrule-nonzero iddrawing-paths-to-the-canvas:dom-context-2d-fillrule-nonzero-2>nonzero winding rule/a>, and using the code iddrawing-paths-to-the-canvas:canvaspathdrawingstyles-2>a href#canvaspathdrawingstyles>CanvasPathDrawingStyles/a>/code> interface for the line styles; and must return false otherwise. Points on the resulting path must be considered to be inside the path. If either of the arguments are infinite or NaN, then the method must return false./p> hr> div iddrawCustomFocusRingExample classexample> p>This code iddrawing-paths-to-the-canvas:the-canvas-element>a href#the-canvas-element>canvas/a>/code> element has a couple of checkboxes. The path-related commands are highlighted:/p> pre><canvas height400 width750> <label><input typecheckbox idshowA> Show As</label> <label><input typecheckbox idshowB> Show Bs</label> <!-- ... --></canvas><script> function drawCheckbox(context, element, x, y, paint) { context.save(); context.font 10px sans-serif; context.textAlign left; context.textBaseline middle; var metrics context.measureText(element.labels0.textContent); if (paint) {strong> context.beginPath(); context.strokeStyle black; context.rect(x-5, y-5, 10, 10); context.stroke();/strong> if (element.checked) {strong> context.fillStyle black; context.fill();/strong> } context.fillText(element.labels0.textContent, x+5, y); }strong> context.beginPath(); context.rect(x-7, y-7, 12 + metrics.width+2, 14);/strong> context.drawFocusIfNeeded(element); context.restore(); } function drawBase() { /* ... */ } function drawAs() { /* ... */ } function drawBs() { /* ... */ } function redraw() { var canvas document.getElementsByTagName(canvas)0; var context canvas.getContext(2d); context.clearRect(0, 0, canvas.width, canvas.height); drawCheckbox(context, document.getElementById(showA), 20, 40, true); drawCheckbox(context, document.getElementById(showB), 20, 60, true); drawBase(); if (document.getElementById(showA).checked) drawAs(); if (document.getElementById(showB).checked) drawBs(); } function processClick(event) { var canvas document.getElementsByTagName(canvas)0; var context canvas.getContext(2d); var x event.clientX; var y event.clientY; var node event.target; while (node) { x - node.offsetLeft - node.scrollLeft; y - node.offsetTop - node.scrollTop; node node.offsetParent; } drawCheckbox(context, document.getElementById(showA), 20, 40, false); if (strong>context.isPointInPath(x, y)/strong>) document.getElementById(showA).checked !(document.getElementById(showA).checked); drawCheckbox(context, document.getElementById(showB), 20, 60, false); if (strong>context.isPointInPath(x, y)/strong>) document.getElementById(showB).checked !(document.getElementById(showB).checked); redraw(); } document.getElementsByTagName(canvas)0.addEventListener(focus, redraw, true); document.getElementsByTagName(canvas)0.addEventListener(blur, redraw, true); document.getElementsByTagName(canvas)0.addEventListener(change, redraw, true); document.getElementsByTagName(canvas)0.addEventListener(click, processClick, false); redraw();</script>/pre> /div> h6 iddrawing-focus-rings-and-scrolling-paths-into-view>span classsecno>4.12.5.1.13/span> Drawing focus rings and scrolling paths into viewa href#drawing-focus-rings-and-scrolling-paths-into-view classself-link>/a>/h6> dl classdomintro>dt>var>context/var> . code iddrawing-focus-rings-and-scrolling-paths-into-view:dom-context-2d-drawfocusifneeded>a href#dom-context-2d-drawfocusifneeded>drawFocusIfNeeded/a>/code>(var>element/var>)dt>var>context/var> . code iddrawing-focus-rings-and-scrolling-paths-into-view:dom-context-2d-drawfocusifneeded-2>a href#dom-context-2d-drawfocusifneeded>drawFocusIfNeeded/a>/code>(var>path/var>, var>element/var>)dd> p>If the given element is a href#focused iddrawing-focus-rings-and-scrolling-paths-into-view:focused>focused/a>, draws a focus ring around the a href#current-default-path iddrawing-focus-rings-and-scrolling-paths-into-view:current-default-path>current default path/a> or the given path, following the platform conventions for focus rings./p> dt>var>context/var> . code iddrawing-focus-rings-and-scrolling-paths-into-view:dom-context-2d-scrollpathintoview>a href#dom-context-2d-scrollpathintoview>scrollPathIntoView/a>/code>()dt>var>context/var> . code iddrawing-focus-rings-and-scrolling-paths-into-view:dom-context-2d-scrollpathintoview-2>a href#dom-context-2d-scrollpathintoview>scrollPathIntoView/a>/code>(var>path/var>)dd> p>Scrolls the a href#current-default-path iddrawing-focus-rings-and-scrolling-paths-into-view:current-default-path-2>current default path/a> or the given path into view. This is especially useful on devices with small screens, where the whole canvas might not be visible at once./p> /dl> Objects that implement the code iddrawing-focus-rings-and-scrolling-paths-into-view:canvasuserinterface>a href#canvasuserinterface>CanvasUserInterface/a>/code> interface provide the following methods to control drawing focus rings and scrolling paths into view. hr> p iddom-context-2d-drawosfocusring>The dfn iddom-context-2d-drawfocusifneeded>code>drawFocusIfNeeded(var>element/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If var>element/var> is not a href#focused iddrawing-focus-rings-and-scrolling-paths-into-view:focused-2>focused/a> or is not a descendant of the element with whose context the method is associated, then abort these steps.li> p>Draw a focus ring of the appropriate style along the intended path, following platform conventions./p> p classnote>Some platforms only draw focus rings around elements that have been focused from the keyboard, and not those focused from the mouse. Other platforms simply dont draw focus rings around some elements at all unless relevant accessibility features are enabled. This API is intended to follow these conventions. User agents that implement distinctions based on the manner in which the element was focused are encouraged to classify focus driven by the code iddrawing-focus-rings-and-scrolling-paths-into-view:dom-focus>a href#dom-focus>focus()/a>/code> method based on the kind of user interaction event from which the call was triggered (if any)./p> p>The focus ring should not be subject to the a href#shadows iddrawing-focus-rings-and-scrolling-paths-into-view:shadows>shadow effects/a>, the a href#dom-context-2d-globalalpha iddrawing-focus-rings-and-scrolling-paths-into-view:dom-context-2d-globalalpha>global alpha/a>, the a href#dom-context-2d-globalcompositeoperation iddrawing-focus-rings-and-scrolling-paths-into-view:dom-context-2d-globalcompositeoperation>global composition operators/a>, or any of the members in the code iddrawing-focus-rings-and-scrolling-paths-into-view:canvasfillstrokestyles>a href#canvasfillstrokestyles>CanvasFillStrokeStyles/a>/code>, code iddrawing-focus-rings-and-scrolling-paths-into-view:canvaspathdrawingstyles>a href#canvaspathdrawingstyles>CanvasPathDrawingStyles/a>/code>, code iddrawing-focus-rings-and-scrolling-paths-into-view:canvastextdrawingstyles>a href#canvastextdrawingstyles>CanvasTextDrawingStyles/a>/code> interfaces, but em>should/em> be subject to the a href#clipping-region iddrawing-focus-rings-and-scrolling-paths-into-view:clipping-region>clipping region/a>. (The effect of transformations is described above and varies based on which path is being used.)/p> li>p>a href#inform>Inform the user/a> that the focus is at the location given by the intended path. User agents may wait until the next time the a href#event-loop iddrawing-focus-rings-and-scrolling-paths-into-view:event-loop>event loop/a> reaches its a href#update-the-rendering iddrawing-focus-rings-and-scrolling-paths-into-view:update-the-rendering>update the rendering/a> step to optionally inform the user./ol> p>User agents should not implicitly close open subpaths in the intended path when drawing the focus ring./p> p classnote>This might be a moot point, however. For example, if the focus ring is drawn as an axis-aligned bounding rectangle around the points in the intended path, then whether the subpaths are closed or not has no effect. This specification intentionally does not specify precisely how focus rings are to be drawn: user agents are expected to honor their platforms native conventions./p> hr> p>The dfn iddom-context-2d-scrollpathintoview>code>scrollPathIntoView()/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>Let var>the specified rectangle/var> be the rectangle of the bounding box of the intended path.li>p>Let var>notional child/var> be a hypothetical element that is a rendered child of the code iddrawing-focus-rings-and-scrolling-paths-into-view:the-canvas-element>a href#the-canvas-element>canvas/a>/code> element whose dimensions are those of var>the specified rectangle/var>.li>p>a hrefhttps://drafts.csswg.org/cssom-view/#scroll-an-element-into-view iddrawing-focus-rings-and-scrolling-paths-into-view:scroll-an-element-into-view data-x-internalscroll-an-element-into-view>Scroll var>notional child/var> into view/a> with the var>align to top flag/var> set./p> li>p>Optionally, a href#inform>inform the user/a> that the caret or selection (or both) cover var>the specified rectangle/var> of the canvas. The user agent may wait until the next time the a href#event-loop iddrawing-focus-rings-and-scrolling-paths-into-view:event-loop-2>event loop/a> reaches its a href#update-the-rendering iddrawing-focus-rings-and-scrolling-paths-into-view:update-the-rendering-2>update the rendering/a> step to optionally inform the user./ol> p idinform>Inform the user, as used in this section, does not imply any persistent state change. It could mean, for instance, calling a system accessibility API to notify assistive technologies such as magnification tools so that the users magnifier moves to the given area of the canvas. However, it does not associate the path with the element, or provide a region for tactile feedback, etc./p> h6 iddrawing-images>span classsecno>4.12.5.1.14/span> Drawing imagesa href#drawing-images classself-link>/a>/h6> p>Objects that implement the code iddrawing-images:canvasdrawimage>a href#canvasdrawimage>CanvasDrawImage/a>/code> interface have the dfn iddom-context-2d-drawimage>code>drawImage/code>/dfn> method to draw images./p> p>This method can be invoked with three different sets of arguments:/p> ul classbrief>li>code>drawImage(var>image/var>, var>dx/var>, var>dy/var>)/code> li>code>drawImage(var>image/var>, var>dx/var>, var>dy/var>, var>dw/var>, var>dh/var>)/code> li>code>drawImage(var>image/var>, var>sx/var>, var>sy/var>, var>sw/var>, var>sh/var>, var>dx/var>, var>dy/var>, var>dw/var>, var>dh/var>)/code> /ul> dl classdomintro>dt>var>context/var> . code iddrawing-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 iddrawing-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 iddrawing-images:dom-context-2d-drawimage-3>a href#dom-context-2d-drawimage>drawImage/a>/code>(var>image/var>, var>sx/var>, var>sy/var>, var>sw/var>, var>sh/var>, var>dx/var>, var>dy/var>, var>dw/var>, var>dh/var>)dd> p>Draws the given image onto the canvas. The arguments are interpreted as follows:/p> p>img src/images/drawImage.png width356 altThe 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. height356>/p> p>If the image isnt yet fully decoded, then nothing is drawn. If the image is a canvas with no data, throws an a iddrawing-images:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code iddrawing-images:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> /dl> p>When the code iddrawing-images:dom-context-2d-drawimage-4>a href#dom-context-2d-drawimage>drawImage()/a>/code> method is invoked, the user agent must run these steps:/p> ol>li>p>If any of the arguments are infinite or NaN, then return.li>p>a href#check-the-usability-of-the-image-argument iddrawing-images:check-the-usability-of-the-image-argument>Check the usability of the var>image/var> argument/a>. If this returns i>aborted/i>, then an exception has been thrown and the method doesnt return anything; abort these steps. If it returns i>bad/i>, then abort these steps without drawing anything. Otherwise it returns i>good/i>; continue with these steps.li> p>Establish the source and destination rectangles as follows:/p> p>If not specified, the var>dw/var> and var>dh/var> arguments must default to the values of var>sw/var> and var>sh/var>, interpreted such that one a hrefhttps://drafts.csswg.org/css-values/#px iddrawing-images:px data-x-internalpx>CSS pixel/a> in the image is treated as one unit in the a href#output-bitmap iddrawing-images:output-bitmap>output bitmap/a>s coordinate space. If the var>sx/var>, var>sy/var>, var>sw/var>, and var>sh/var> arguments are omitted, then they must default to 0, 0, the images a href#intrinsic-width iddrawing-images:intrinsic-width>intrinsic width/a> in image pixels, and the images a href#intrinsic-height iddrawing-images:intrinsic-height>intrinsic height/a> in image pixels, respectively. If the image has no a iddrawing-images:intrinsic-dimensions hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic data-x-internalintrinsic-dimensions>intrinsic dimensions/a>, then the i>concrete object size/i> must be used instead, as determined using the CSS a hrefhttps://drafts.csswg.org/css-images/#default-sizing>Concrete Object Size Resolution/a> algorithm, with the i>specified size/i> having neither a definite width nor height, nor any additional constraints, the objects intrinsic properties being those of the var>image/var> argument, and the a iddrawing-images:default-object-size hrefhttps://drafts.csswg.org/css-images/#default-object-size data-x-internaldefault-object-size>default object size/a> being the size of the a href#output-bitmap iddrawing-images:output-bitmap-2>output bitmap/a>. a href#refsCSSIMAGES>CSSIMAGES/a>/p> p>The source rectangle is the rectangle whose corners are the four points (var>sx/var>, var>sy/var>), (var>sx/var>+var>sw/var>, var>sy/var>), (var>sx/var>+var>sw/var>, var>sy/var>+var>sh/var>), (var>sx/var>, var>sy/var>+var>sh/var>)./p> p>The destination rectangle is the rectangle whose corners are the four points (var>dx/var>, var>dy/var>), (var>dx/var>+var>dw/var>, var>dy/var>), (var>dx/var>+var>dw/var>, var>dy/var>+var>dh/var>), (var>dx/var>, var>dy/var>+var>dh/var>)./p> p>When the source rectangle is outside the source image, the source rectangle must be clipped to the source image and the destination rectangle must be clipped in the same proportion./p> p classnote>When the destination rectangle is outside the destination image (the a href#output-bitmap iddrawing-images:output-bitmap-3>output bitmap/a>), the pixels that land outside the a href#output-bitmap iddrawing-images:output-bitmap-4>output bitmap/a> are discarded, as if the destination was an infinite canvas whose rendering was clipped to the dimensions of the a href#output-bitmap iddrawing-images:output-bitmap-5>output bitmap/a>./p> li>p>If one of the var>sw/var> or var>sh/var> arguments is zero, then abort these steps. Nothing is painted.li> p>Paint the region of the var>image/var> argument specified by the source rectangle on the region of the rendering contexts a href#output-bitmap iddrawing-images:output-bitmap-6>output bitmap/a> specified by the destination rectangle, after applying the a href#transformations iddrawing-images:transformations>current transformation matrix/a> to the destination rectangle./p> p>The image data must be processed in the original direction, even if the dimensions given are negative. /p> p>When scaling up, if the code iddrawing-images:dom-context-2d-imagesmoothingenabled>a href#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled/a>/code> attribute is set to true, the user agent should attempt to apply a smoothing algorithm to the image data when it is scaled. User agents which support multiple filtering algorithms may use the value of the code iddrawing-images:dom-context-2d-imagesmoothingquality>a href#dom-context-2d-imagesmoothingquality>imageSmoothingQuality/a>/code> attribute to guide the choice of filtering algorithm when the code iddrawing-images:dom-context-2d-imagesmoothingenabled-2>a href#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled/a>/code> attribute is set to true. Otherwise, the image must be rendered using nearest-neighbor interpolation./p> p classnote>This specification does not define the precise algorithm to use when scaling an image down, or when scaling an image up when the code iddrawing-images:dom-context-2d-imagesmoothingenabled-3>a href#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled/a>/code> attribute is set to true./p> p classnote>When a code iddrawing-images:the-canvas-element>a href#the-canvas-element>canvas/a>/code> element is drawn onto itself, the a href#drawing-model iddrawing-images:drawing-model>drawing model/a> requires the source to be copied before the image is drawn, so it is possible to copy parts of a code iddrawing-images:the-canvas-element-2>a href#the-canvas-element>canvas/a>/code> element onto overlapping parts of itself./p> p>If the original image data is a bitmap image, then the value painted at a point in the destination rectangle is computed by filtering the original image data. The user agent may use any filtering algorithm (for example bilinear interpolation or nearest-neighbor). When the filtering algorithm requires a pixel value from outside the original image data, it must instead use the value from the nearest edge pixel. (That is, the filter uses clamp-to-edge behavior.) When the filtering algorithm requires a pixel value from outside the source rectangle but inside the original image data, then the value from the original image data must be used./p> p classnote>Thus, scaling an image in parts or in whole will have the same effect. This does mean that when sprites coming from a single sprite sheet are to be scaled, adjacent images in the sprite sheet can interfere. This can be avoided by ensuring each sprite in the sheet is surrounded by a border of a href#transparent-black iddrawing-images:transparent-black>transparent black/a>, or by copying sprites to be scaled into temporary code iddrawing-images:the-canvas-element-3>a href#the-canvas-element>canvas/a>/code> elements and drawing the scaled sprites from there./p> p>Images are painted without affecting the current path, and are subject to a href#shadows iddrawing-images:shadows>shadow effects/a>, a href#dom-context-2d-globalalpha iddrawing-images:dom-context-2d-globalalpha>global alpha/a>, the a href#clipping-region iddrawing-images:clipping-region>clipping region/a>, and a href#dom-context-2d-globalcompositeoperation iddrawing-images:dom-context-2d-globalcompositeoperation>global composition operators/a>./p> li>p>If a href#the-image-argument-is-not-origin-clean iddrawing-images:the-image-argument-is-not-origin-clean>the var>image argument/var> is not origin-clean/a>, then set the code iddrawing-images:canvasrenderingcontext2d>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code>s a href#concept-canvas-origin-clean iddrawing-images:concept-canvas-origin-clean>origin-clean/a> flag to false./ol> h6 idpixel-manipulation>span classsecno>4.12.5.1.15/span> dfn>Pixel manipulation/dfn>a href#pixel-manipulation classself-link>/a>/h6> dl classdomintro>dt>var>imagedata/var> new code idpixel-manipulation:dom-imagedata>a href#dom-imagedata>ImageData/a>/code>(var>sw/var>, var>sh/var>)dt>var>imagedata/var> var>context/var> . code idpixel-manipulation:dom-context-2d-createimagedata>a href#dom-context-2d-createimagedata>createImageData/a>/code>(var>sw/var>, var>sh/var>)dd> p>Returns an code idpixel-manipulation:imagedata>a href#imagedata>ImageData/a>/code> object with the given dimensions. All the pixels in the returned object are a href#transparent-black idpixel-manipulation:transparent-black>transparent black/a>./p> p>Throws an a idpixel-manipulation:indexsizeerror hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idpixel-manipulation:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if either of the width or height arguments are zero./p> dt>var>imagedata/var> var>context/var> . code idpixel-manipulation:dom-context-2d-createimagedata-2>a href#dom-context-2d-createimagedata>createImageData/a>/code>(var>imagedata/var>)dd> p>Returns an code idpixel-manipulation:imagedata-2>a href#imagedata>ImageData/a>/code> object with the same dimensions as the argument. All the pixels in the returned object are a href#transparent-black idpixel-manipulation:transparent-black-2>transparent black/a>./p> dt>var>imagedata/var> new code idpixel-manipulation:dom-imagedata-2>a href#dom-imagedata>ImageData/a>/code>(var>data/var>, var>sw/var> , var>sh/var> )dd> p>Returns an code idpixel-manipulation:imagedata-3>a href#imagedata>ImageData/a>/code> object using the data provided in the code idpixel-manipulation:idl-uint8clampedarray>a data-x-internalidl-uint8clampedarray hrefhttps://heycam.github.io/webidl/#idl-Uint8ClampedArray>Uint8ClampedArray/a>/code> argument, interpreted using the given dimensions./p> p>As each pixel in the data is represented by four numbers, the length of the data needs to be a multiple of four times the given width. If the height is provided as well, then the length needs to be exactly the width times the height times 4./p> p>Throws an a idpixel-manipulation:indexsizeerror-2 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idpixel-manipulation:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the given data and dimensions cant be interpreted consistently, or if either dimension is zero./p> dt>var>imagedata/var> var>context/var> . code idpixel-manipulation:dom-context-2d-getimagedata>a href#dom-context-2d-getimagedata>getImageData/a>/code>(var>sx/var>, var>sy/var>, var>sw/var>, var>sh/var>)dd> p>Returns an code idpixel-manipulation:imagedata-4>a href#imagedata>ImageData/a>/code> object containing the image data for the given rectangle of the bitmap./p> p>Throws an a idpixel-manipulation:indexsizeerror-3 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idpixel-manipulation:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the either of the width or height arguments are zero./p> dt>var>imagedata/var> . code idpixel-manipulation:dom-imagedata-width>a href#dom-imagedata-width>width/a>/code>dt>var>imagedata/var> . code idpixel-manipulation:dom-imagedata-height>a href#dom-imagedata-height>height/a>/code>dd> p>Returns the actual dimensions of the data in the code idpixel-manipulation:imagedata-5>a href#imagedata>ImageData/a>/code> object, in pixels./p> dt>var>imagedata/var> . code idpixel-manipulation:dom-imagedata-data>a href#dom-imagedata-data>data/a>/code>dd> p>Returns the one-dimensional array containing the data in RGBA order, as integers in the range 0 to 255./p> dt>var>context/var> . code idpixel-manipulation:dom-context-2d-putimagedata>a href#dom-context-2d-putimagedata>putImageData/a>/code>(var>imagedata/var>, var>dx/var>, var>dy/var> , var>dirtyX/var>, var>dirtyY/var>, var>dirtyWidth/var>, var>dirtyHeight/var> )dd> p>Paints the data from the given code idpixel-manipulation:imagedata-6>a href#imagedata>ImageData/a>/code> object onto the bitmap. If a dirty rectangle is provided, only the pixels from that rectangle are painted./p> p>The code idpixel-manipulation:dom-context-2d-globalalpha>a href#dom-context-2d-globalalpha>globalAlpha/a>/code> and code idpixel-manipulation:dom-context-2d-globalcompositeoperation>a href#dom-context-2d-globalcompositeoperation>globalCompositeOperation/a>/code> attributes, as well as the shadow attributes, are ignored for the purposes of this method call; pixels in the canvas are replaced wholesale, with no composition, alpha blending, no shadows, etc./p> p>Throws an a idpixel-manipulation:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idpixel-manipulation:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the var>imagedata/var> objects datas a href#detached idpixel-manipulation:detached>Detached/a> internal slot value is true./p> /dl> p>Objects that implement the code idpixel-manipulation:canvasimagedata>a href#canvasimagedata>CanvasImageData/a>/code> interface provide the following methods for reading and writing pixel data to the bitmap./p> p>The dfn iddom-imagedata>code>ImageData()/code>/dfn> constructors and the dfn iddom-context-2d-createimagedata>code>createImageData()/code>/dfn> methods are used to instantiate new code idpixel-manipulation:imagedata-7>a href#imagedata>ImageData/a>/code> objects./p> p>When the code idpixel-manipulation:dom-imagedata-3>a href#dom-imagedata>ImageData()/a>/code> constructor is invoked with two numeric arguments var>sw/var> and var>sh/var>, it must a href#create-an-imagedata-object idpixel-manipulation:create-an-imagedata-object>create an code>ImageData/code> object/a> with parameter var>pixelsPerRow/var> set to var>sw/var>, and var>rows/var> set to var>sh/var>. The image data of the newly created code idpixel-manipulation:imagedata-8>a href#imagedata>ImageData/a>/code> object must be initialized to a href#transparent-black idpixel-manipulation:transparent-black-3>transparent black/a>. If both var>sw/var> and var>sh/var> are nonzero, then return the new code idpixel-manipulation:imagedata-9>a href#imagedata>ImageData/a>/code> object. If one or both of var>sw/var> and var>sh/var> are zero, then the constructor must throw an a idpixel-manipulation:indexsizeerror-4 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idpixel-manipulation:domexception-5>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> instead./p> p>When the code idpixel-manipulation:dom-imagedata-4>a href#dom-imagedata>ImageData()/a>/code> constructor is invoked with its first argument being an code idpixel-manipulation:idl-uint8clampedarray-2>a data-x-internalidl-uint8clampedarray hrefhttps://heycam.github.io/webidl/#idl-Uint8ClampedArray>Uint8ClampedArray/a>/code> var>source/var> and its second and optional third arguments being numeric arguments var>sw/var> and var>sh/var>, it must run these steps:/p> 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 nonzero integral multiple of four, then throw an a idpixel-manipulation:invalidstateerror-2 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idpixel-manipulation:domexception-6>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Let var>length/var> be var>length/var> divided by four./p> li> p>If var>length/var> is not an integral multiple of var>sw/var>, then throw an a idpixel-manipulation:indexsizeerror-5 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idpixel-manipulation:domexception-7>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps./p> p classnote>At this step, the length is guaranteed to be greater than zero (otherwise the second step above would have aborted the steps), so if var>sw/var> is zero, this step will throw the exception and abort these steps./p> li>p>Let var>height/var> be var>length/var> divided by var>sw/var>.li>p>If the var>sh/var> argument was not omitted, and its value is not equal to var>height/var>, then throw an a idpixel-manipulation:indexsizeerror-6 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idpixel-manipulation:domexception-8>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li> p>a href#create-an-imagedata-object idpixel-manipulation:create-an-imagedata-object-2>Create an code>ImageData/code> object/a>, with parameter var>pixelsPerRow/var> set to var>sw/var>, var>rows/var> set to var>sh/var>, and using var>source/var>. Return the newly created code idpixel-manipulation:imagedata-10>a href#imagedata>ImageData/a>/code> object./p> p classnote>The resulting objects data is not a em>copy/em> of var>source/var>, its the actual code idpixel-manipulation:idl-uint8clampedarray-3>a data-x-internalidl-uint8clampedarray hrefhttps://heycam.github.io/webidl/#idl-Uint8ClampedArray>Uint8ClampedArray/a>/code> object passed as the first argument to the constructor./p> /ol> p>When the code idpixel-manipulation:dom-context-2d-createimagedata-3>a href#dom-context-2d-createimagedata>createImageData()/a>/code> method is invoked with two numeric arguments var>sw/var> and var>sh/var>, it must a href#create-an-imagedata-object idpixel-manipulation:create-an-imagedata-object-3>create an code>ImageData/code> object/a>, with parameter var>pixelsPerRow/var> set to the absolute magnitude of var>sw/var>, and parameter var>rows/var> set to the absolute magnitude of var>sh/var>. Initialize the image data of the new code idpixel-manipulation:imagedata-11>a href#imagedata>ImageData/a>/code> object to a href#transparent-black idpixel-manipulation:transparent-black-4>transparent black/a>. If both var>sw/var> and var>sh/var> are nonzero, then return the new code idpixel-manipulation:imagedata-12>a href#imagedata>ImageData/a>/code> object. If one or both of var>sw/var> and var>sh/var> are zero, then throw an a idpixel-manipulation:indexsizeerror-7 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idpixel-manipulation:domexception-9>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> instead./p> p>When the code idpixel-manipulation:dom-context-2d-createimagedata-4>a href#dom-context-2d-createimagedata>createImageData()/a>/code> method is invoked with a single var>imagedata/var> argument, it must a href#create-an-imagedata-object idpixel-manipulation:create-an-imagedata-object-4>create an code>ImageData/code> object/a>, with parameter var>pixelsPerRow/var> set to the value of the code idpixel-manipulation:dom-imagedata-width-2>a href#dom-imagedata-width>width/a>/code> attribute of the code idpixel-manipulation:imagedata-13>a href#imagedata>ImageData/a>/code> object passed as the argument, and the var>rows/var> parameter set to the value of the code idpixel-manipulation:dom-imagedata-height-2>a href#dom-imagedata-height>height/a>/code> attribute. Initialize the image data of the new code idpixel-manipulation:imagedata-14>a href#imagedata>ImageData/a>/code> object to a href#transparent-black idpixel-manipulation:transparent-black-5>transparent black/a>. Return the newly created code idpixel-manipulation:imagedata-15>a href#imagedata>ImageData/a>/code> object./p> p>The dfn iddom-context-2d-getimagedata>code>getImageData(var>sx/var>, var>sy/var>, var>sw/var>, var>sh/var>)/code>/dfn> method, when invoked, must, if either the var>sw/var> or var>sh/var> arguments are zero, throw an a idpixel-manipulation:indexsizeerror-8 hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idpixel-manipulation:domexception-10>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>; otherwise, if the code idpixel-manipulation:canvasrenderingcontext2d>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code>s a href#concept-canvas-origin-clean idpixel-manipulation:concept-canvas-origin-clean>origin-clean/a> flag is set to false, it must throw a a idpixel-manipulation:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idpixel-manipulation:domexception-11>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>; otherwise, it must a href#create-an-imagedata-object idpixel-manipulation:create-an-imagedata-object-5>create an code>ImageData/code> object/a>, with parameter var>pixelsPerRow/var> set to var>sw/var>, and parameter var>rows/var> set to var>sh/var>. Set the pixel values of the image data of the newly created code idpixel-manipulation:imagedata-16>a href#imagedata>ImageData/a>/code> object to represent the a href#output-bitmap idpixel-manipulation:output-bitmap>output bitmap/a> for the area of that bitmap denoted by the rectangle whose corners are the four points (var>sx/var>, var>sy/var>), (span>var>sx/var>+var>sw/var>/span>, var>sy/var>), (span>var>sx/var>+var>sw/var>/span>, span>var>sy/var>+var>sh/var>/span>), (var>sx/var>, var>sy/var>+var>sh/var>), in the bitmaps coordinate space units. Pixels outside the a href#output-bitmap idpixel-manipulation:output-bitmap-2>output bitmap/a> must be set to a href#transparent-black idpixel-manipulation:transparent-black-6>transparent black/a>. Pixel values must not be premultiplied by alpha./p> p>When the user agent is required to dfn idcreate-an-imagedata-object>create an code>ImageData/code> object/dfn>, given a positive integer number of rows var>rows/var>, a positive integer number of pixels per row var>pixelsPerRow/var>, and an optional code idpixel-manipulation:idl-uint8clampedarray-4>a data-x-internalidl-uint8clampedarray hrefhttps://heycam.github.io/webidl/#idl-Uint8ClampedArray>Uint8ClampedArray/a>/code> var>source/var>, it must run these steps:/p> ol>li>p>Let var>imageData/var> be a new uninitialized code idpixel-manipulation:imagedata-17>a href#imagedata>ImageData/a>/code> object.li>p>If var>source/var> is specified, then assign the dfn iddom-imagedata-data>code>data/code>/dfn> attribute of var>imageData/var> to var>source/var>.li> p>If var>source/var> is not specified, then initialize the code idpixel-manipulation:dom-imagedata-data-2>a href#dom-imagedata-data>data/a>/code> attribute of var>imageData/var> to a new code idpixel-manipulation:idl-uint8clampedarray-5>a data-x-internalidl-uint8clampedarray hrefhttps://heycam.github.io/webidl/#idl-Uint8ClampedArray>Uint8ClampedArray/a>/code> object. The code idpixel-manipulation:idl-uint8clampedarray-6>a data-x-internalidl-uint8clampedarray hrefhttps://heycam.github.io/webidl/#idl-Uint8ClampedArray>Uint8ClampedArray/a>/code> object must use a new a href#canvas-pixel-arraybuffer idpixel-manipulation:canvas-pixel-arraybuffer>Canvas Pixel code>ArrayBuffer/code>/a> for its storage, and must have a zero start offset and a length equal to the length of its storage, in bytes. The a href#canvas-pixel-arraybuffer idpixel-manipulation:canvas-pixel-arraybuffer-2>Canvas Pixel code>ArrayBuffer/code>/a> must have the correct size to store var>rows/var> × var>pixelsPerRow/var> pixels./p> p>If the a href#canvas-pixel-arraybuffer idpixel-manipulation:canvas-pixel-arraybuffer-3>Canvas Pixel code>ArrayBuffer/code>/a> cannot be allocated, then rethrow the code idpixel-manipulation:js-rangeerror>a data-x-internaljs-rangeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-rangeerror>RangeError/a>/code> thrown by JavaScript, and abort these steps./p> li>p>Initialize the dfn iddom-imagedata-width>code>width/code>/dfn> attribute of var>imageData/var> to var>pixelsPerRow/var>.li>p>Initialize the dfn iddom-imagedata-height>code>height/code>/dfn> attribute of var>imageData/var> to var>rows/var>.li>p>Return var>imageData/var>./ol> p>code idpixel-manipulation:imagedata-18>a href#imagedata>ImageData/a>/code> objects are a href#serializable-objects idpixel-manipulation:serializable-objects>serializable objects/a>. Their a href#serialization-steps idpixel-manipulation:serialization-steps>serialization steps/a>, given var>value/var> and var>serialized/var>, are:/p> ol>li>p>Set var>serialized/var>.Data to the a href#sub-serialization idpixel-manipulation:sub-serialization>sub-serialization/a> of the value of var>value/var>s code idpixel-manipulation:dom-imagedata-data-3>a href#dom-imagedata-data>data/a>/code> attribute.li>p>Set var>serialized/var>.Width to the value of var>value/var>s code idpixel-manipulation:dom-imagedata-width-3>a href#dom-imagedata-width>width/a>/code> attribute.li>p>Set var>serialized/var>.Height to the value of var>value/var>s code idpixel-manipulation:dom-imagedata-height-3>a href#dom-imagedata-height>height/a>/code> attribute./ol> p>Their a href#deserialization-steps idpixel-manipulation:deserialization-steps>deserialization steps/a>, given var>serialized/var> and var>value/var>, are:/p> ol>li>p>Initialize var>value/var>s code idpixel-manipulation:dom-imagedata-data-4>a href#dom-imagedata-data>data/a>/code> attribute to the a href#sub-deserialization idpixel-manipulation:sub-deserialization>sub-deserialization/a> of var>serialized/var>.Data.li>p>Initialize var>value/var>s code idpixel-manipulation:dom-imagedata-width-4>a href#dom-imagedata-width>width/a>/code> attribute to var>serialized/var>.Width.li>p>Initialize var>value/var>s code idpixel-manipulation:dom-imagedata-height-4>a href#dom-imagedata-height>height/a>/code> attribute to var>serialized/var>.Height./ol> p>A dfn idcanvas-pixel-arraybuffer>Canvas Pixel code>ArrayBuffer/code>/dfn> is an code idpixel-manipulation:idl-arraybuffer>a data-x-internalidl-arraybuffer hrefhttps://heycam.github.io/webidl/#idl-ArrayBuffer>ArrayBuffer/a>/code> whose data is represented in left-to-right order, row by row top to bottom, starting with the top left, with each pixels red, green, blue, and alpha components being given in that order for each pixel. Each component of each pixel represented in this array must be in the range 0..255, representing the 8 bit value for that component. The components must be assigned consecutive indices starting with 0 for the top left pixels red component./p> p>The dfn iddom-context-2d-putimagedata>code>putImageData()/code>/dfn> method writes data from code idpixel-manipulation:imagedata-19>a href#imagedata>ImageData/a>/code> structures back to the rendering contexts a href#output-bitmap idpixel-manipulation:output-bitmap-3>output bitmap/a>. Its arguments are: var>imagedata/var>, var>dx/var>, var>dy/var>, var>dirtyX/var>, var>dirtyY/var>, var>dirtyWidth/var>, and var>dirtyHeight/var>./p> p>When the last four arguments to this method are omitted, they must be assumed to have the values 0, 0, the code idpixel-manipulation:dom-imagedata-width-5>a href#dom-imagedata-width>width/a>/code> member of the var>imagedata/var> structure, and the code idpixel-manipulation:dom-imagedata-height-5>a href#dom-imagedata-height>height/a>/code> member of the var>imagedata/var> structure, respectively./p> p>The method, when invoked, must act as follows:/p> ol>li> p>If var>imagedata/var>s code idpixel-manipulation:dom-imagedata-data-5>a href#dom-imagedata-data>data/a>/code> attribute values a href#detached idpixel-manipulation:detached-2>Detached/a> internal slot value is true, then throw an a idpixel-manipulation:invalidstateerror-3 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idpixel-manipulation:domexception-12>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps./p> li> p>If var>dirtyWidth/var> is negative, then let var>dirtyX/var> be span>var>dirtyX/var>+var>dirtyWidth/var>/span>, and let var>dirtyWidth/var> be equal to the absolute magnitude of var>dirtyWidth/var>./p> p>If var>dirtyHeight/var> is negative, then let var>dirtyY/var> be span>var>dirtyY/var>+var>dirtyHeight/var>/span>, and let var>dirtyHeight/var> be equal to the absolute magnitude of var>dirtyHeight/var>./p> li> p>If var>dirtyX/var> is negative, then let var>dirtyWidth/var> be span>var>dirtyWidth/var>+var>dirtyX/var>/span>, and let var>dirtyX/var> be zero./p> p>If var>dirtyY/var> is negative, then let var>dirtyHeight/var> be span>var>dirtyHeight/var>+var>dirtyY/var>/span>, and let var>dirtyY/var> be zero./p> li> p>If var>dirtyX/var>+var>dirtyWidth/var> is greater than the code idpixel-manipulation:dom-imagedata-width-6>a href#dom-imagedata-width>width/a>/code> attribute of the var>imagedata/var> argument, then let var>dirtyWidth/var> be the value of that code idpixel-manipulation:dom-imagedata-width-7>a href#dom-imagedata-width>width/a>/code> attribute, minus the value of var>dirtyX/var>./p> p>If var>dirtyY/var>+var>dirtyHeight/var> is greater than the code idpixel-manipulation:dom-imagedata-height-6>a href#dom-imagedata-height>height/a>/code> attribute of the var>imagedata/var> argument, then let var>dirtyHeight/var> be the value of that code idpixel-manipulation:dom-imagedata-height-7>a href#dom-imagedata-height>height/a>/code> attribute, minus the value of var>dirtyY/var>./p> li> p>If, after those changes, either var>dirtyWidth/var> or var>dirtyHeight/var> are negative or zero, then abort these steps without affecting any bitmaps./p> li>p>For all integer values of var>x/var> and var>y/var> where span>var>dirtyX/var> ≤ var>x/var> < span>var>dirtyX/var>+var>dirtyWidth/var>/span>/span> and span>var>dirtyY/var> ≤ var>y/var> < span>var>dirtyY/var>+var>dirtyHeight/var>/span>/span>, copy the four channels of the pixel with coordinate (var>x/var>, var>y/var>) in the var>imagedata/var> data structures a href#canvas-pixel-arraybuffer idpixel-manipulation:canvas-pixel-arraybuffer-4>Canvas Pixel code>ArrayBuffer/code>/a> to the pixel with coordinate (span>var>dx/var>+var>x/var>/span>, var>dy/var>+var>y/var>) in the rendering contexts a href#output-bitmap idpixel-manipulation:output-bitmap-4>output bitmap/a>./ol> p classnote>Due to the lossy nature of converting to and from premultiplied alpha color values, pixels that have just been set using code idpixel-manipulation:dom-context-2d-putimagedata-2>a href#dom-context-2d-putimagedata>putImageData()/a>/code> might be returned to an equivalent code idpixel-manipulation:dom-context-2d-getimagedata-2>a href#dom-context-2d-getimagedata>getImageData()/a>/code> as different values./p> p>The current path, a href#transformations idpixel-manipulation:transformations>transformation matrix/a>, a href#shadows idpixel-manipulation:shadows>shadow attributes/a>, a href#dom-context-2d-globalalpha idpixel-manipulation:dom-context-2d-globalalpha-2>global alpha/a>, the a href#clipping-region idpixel-manipulation:clipping-region>clipping region/a>, and a href#dom-context-2d-globalcompositeoperation idpixel-manipulation:dom-context-2d-globalcompositeoperation-2>global composition operator/a> must not affect the methods described in this section./p> div classexample> p>In the following example, the script generates an code idpixel-manipulation:imagedata-20>a href#imagedata>ImageData/a>/code> object so that it can draw onto it./p> pre>// canvas is a reference to a <canvas> elementvar context canvas.getContext(2d);// create a blank slatevar data context.createImageData(canvas.width, canvas.height);// create some plasmaFillPlasma(data, green); // green plasma// add a cloud to the plasmaAddCloud(data, data.width/2, data.height/2); // put a cloud in the middle// paint the plasma+cloud on the canvascontext.putImageData(data, 0, 0);// support methodsfunction FillPlasma(data, color) { ... }function AddCloud(data, x, y) { ... }/pre> /div> div classexample> p>Here is an example of using code idpixel-manipulation:dom-context-2d-getimagedata-3>a href#dom-context-2d-getimagedata>getImageData()/a>/code> and code idpixel-manipulation:dom-context-2d-putimagedata-3>a href#dom-context-2d-putimagedata>putImageData()/a>/code> to implement an edge detection filter./p> pre><!DOCTYPE HTML><html langen> <head> <title>Edge detection demo</title> <script> var image new Image(); function init() { image.onload demo; image.src image.jpeg; } function demo() { var canvas document.getElementsByTagName(canvas)0; var context canvas.getContext(2d); // draw the image onto the canvas context.drawImage(image, 0, 0); // get the image data to manipulate var input context.getImageData(0, 0, canvas.width, canvas.height); // get an empty slate to put the data into var output context.createImageData(canvas.width, canvas.height); // alias some variables for convenience // In this case input.width and input.height // match canvas.width and canvas.height // but well use the former to keep the code generic. var w input.width, h input.height; var inputData input.data; var outputData output.data; // edge detection for (var y 1; y < h-1; y + 1) { for (var x 1; x < w-1; x + 1) { for (var c 0; c < 3; c + 1) { var i (y*w + x)*4 + c; outputDatai 127 + -inputDatai - w*4 - 4 - inputDatai - w*4 - inputDatai - w*4 + 4 + -inputDatai - 4 + 8*inputDatai - inputDatai + 4 + -inputDatai + w*4 - 4 - inputDatai + w*4 - inputDatai + w*4 + 4; } outputData(y*w + x)*4 + 3 255; // alpha } } // put the image data back after manipulation context.putImageData(output, 0, 0); } </script> </head> <body onloadinit()> <canvas></canvas> </body></html>/pre> /div> h6 idcompositing>span classsecno>4.12.5.1.16/span> Compositinga href#compositing classself-link>/a>/h6> dl classdomintro>dt>var>context/var> . code idcompositing:dom-context-2d-globalalpha>a href#dom-context-2d-globalalpha>globalAlpha/a>/code> var>value/var> dd> p>Returns the current alpha value applied to rendering operations./p> p>Can be set, to change the alpha value. Values outside of the range 0.0 .. 1.0 are ignored./p> dt>var>context/var> . code idcompositing:dom-context-2d-globalcompositeoperation>a href#dom-context-2d-globalcompositeoperation>globalCompositeOperation/a>/code> var>value/var> dd> p>Returns the current composition operation, from the values defined in the Compositing and Blending specification. a href#refsCOMPOSITE>COMPOSITE/a>./p> p>Can be set, to change the composition operation. Unknown values are ignored./p> /dl> p>All drawing operations on an object which implements the code idcompositing:canvascompositing>a href#canvascompositing>CanvasCompositing/a>/code> interface are affected by the global compositing attributes, code idcompositing:dom-context-2d-globalalpha-2>a href#dom-context-2d-globalalpha>globalAlpha/a>/code> and code idcompositing:dom-context-2d-globalcompositeoperation-2>a href#dom-context-2d-globalcompositeoperation>globalCompositeOperation/a>/code>./p> p>The dfn iddom-context-2d-globalalpha>code>globalAlpha/code>/dfn> attribute gives an alpha value that is applied to shapes and images before they are composited onto the a href#output-bitmap idcompositing:output-bitmap>output bitmap/a>. The value must be in the range from 0.0 (fully transparent) to 1.0 (no additional transparency). If an attempt is made to set the attribute to a value outside this range, including Infinity and Not-a-Number (NaN) values, then the attribute must retain its previous value. When the context is created, the code idcompositing:dom-context-2d-globalalpha-3>a href#dom-context-2d-globalalpha>globalAlpha/a>/code> attribute must initially have the value 1.0./p> p>The dfn iddom-context-2d-globalcompositeoperation>code>globalCompositeOperation/code>/dfn> attribute sets the dfn idcurrent-composition-operator>current composition operator/dfn>, which controls how shapes and images are drawn onto the a href#output-bitmap idcompositing:output-bitmap-2>output bitmap/a>, once they have had code idcompositing:dom-context-2d-globalalpha-4>a href#dom-context-2d-globalalpha>globalAlpha/a>/code> and the current transformation matrix applied. The possible values are those defined in the Compositing and Blending specification, and include the values dfn idgcop-source-over>code>source-over/code>/dfn> and dfn idgcop-copy>code>copy/code>/dfn>. a href#refsCOMPOSITE>COMPOSITE/a>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id27313 titleIt seems like this should be defined in terms of an IDL enum. If not, please clarify the relationshi ...>27313/a>/div> p>These values are all case-sensitive — they must be used exactly as defined. User agents must not recognize values that are not a a href#case-sensitive idcompositing:case-sensitive>case-sensitive/a> match for one of the values given in the Compositing and Blending specification. a href#refsCOMPOSITE>COMPOSITE/a>/p> p>On setting, if the user agent does not recognize the specified value, it must be ignored, leaving the value of code idcompositing:dom-context-2d-globalcompositeoperation-3>a href#dom-context-2d-globalcompositeoperation>globalCompositeOperation/a>/code> unaffected. Otherwise, the attribute must be set to the given new value./p> p>When the context is created, the code idcompositing:dom-context-2d-globalcompositeoperation-4>a href#dom-context-2d-globalcompositeoperation>globalCompositeOperation/a>/code> attribute must initially have the value code idcompositing:gcop-source-over>a href#gcop-source-over>source-over/a>/code>./p> h6 idimage-smoothing>span classsecno>4.12.5.1.17/span> Image smoothinga href#image-smoothing classself-link>/a>/h6> dl classdomintro>dt>var>context/var> . code idimage-smoothing:dom-context-2d-imagesmoothingenabled>a href#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled/a>/code> var>value/var> dd> p>Returns whether pattern fills and the code idimage-smoothing:dom-context-2d-drawimage>a href#dom-context-2d-drawimage>drawImage()/a>/code> method will attempt to smooth images if their pixels dont line up exactly with the display, when scaling images up./p> p>Can be set, to change whether images are smoothed (true) or not (false)./p> dt>var>context/var> . code idimage-smoothing:dom-context-2d-imagesmoothingquality>a href#dom-context-2d-imagesmoothingquality>imageSmoothingQuality/a>/code> var>value/var> dd> p>Returns the current image-smoothing-quality preference./p> p>Can be set, to change the preferred quality of image smoothing. The possible values are code idimage-smoothing:dom-context-2d-imagesmoothingquality-low>a href#dom-context-2d-imagesmoothingquality-low>low/a>/code>, code idimage-smoothing:dom-context-2d-imagesmoothingquality-medium>a href#dom-context-2d-imagesmoothingquality-medium>medium/a>/code> and code idimage-smoothing:dom-context-2d-imagesmoothingquality-high>a href#dom-context-2d-imagesmoothingquality-high>high/a>/code>. Unknown values are ignored./p> /dl> p>Objects that implement the code idimage-smoothing:canvasimagesmoothing>a href#canvasimagesmoothing>CanvasImageSmoothing/a>/code> interface have attributes that control how image smoothing is performed./p> p>The dfn iddom-context-2d-imagesmoothingenabled>code>imageSmoothingEnabled/code>/dfn> attribute, on getting, must return the last value it was set to. On setting, it must be set to the new value. When the object implementing the code idimage-smoothing:canvasimagesmoothing-2>a href#canvasimagesmoothing>CanvasImageSmoothing/a>/code> interface is created, the attribute must be set to true./p> p>The dfn iddom-context-2d-imagesmoothingquality>code>imageSmoothingQuality/code>/dfn> attribute, on getting, must return the last value it was set to. On setting, it must be set to the new value. When the object implementing the code idimage-smoothing:canvasimagesmoothing-3>a href#canvasimagesmoothing>CanvasImageSmoothing/a>/code> interface is created, the attribute must be set to code idimage-smoothing:dom-context-2d-imagesmoothingquality-low-2>a href#dom-context-2d-imagesmoothingquality-low>low/a>/code>./p> h6 idshadows>span classsecno>4.12.5.1.18/span> dfn>Shadows/dfn>a href#shadows classself-link>/a>/h6> p>All drawing operations on an object which implements the code idshadows:canvasshadowstyles>a href#canvasshadowstyles>CanvasShadowStyles/a>/code> interface are affected by the four global shadow attributes./p> dl classdomintro>dt>var>context/var> . code idshadows:dom-context-2d-shadowcolor>a href#dom-context-2d-shadowcolor>shadowColor/a>/code> var>value/var> dd> p>Returns the current shadow color./p> p>Can be set, to change the shadow color. Values that cannot be parsed as CSS colors are ignored./p> dt>var>context/var> . code idshadows:dom-context-2d-shadowoffsetx>a href#dom-context-2d-shadowoffsetx>shadowOffsetX/a>/code> var>value/var> dt>var>context/var> . code idshadows:dom-context-2d-shadowoffsety>a href#dom-context-2d-shadowoffsety>shadowOffsetY/a>/code> var>value/var> dd> p>Returns the current shadow offset./p> p>Can be set, to change the shadow offset. Values that are not finite numbers are ignored./p> dt>var>context/var> . code idshadows:dom-context-2d-shadowblur>a href#dom-context-2d-shadowblur>shadowBlur/a>/code> var>value/var> dd> p>Returns the current level of blur applied to shadows./p> p>Can be set, to change the blur level. Values that are not finite numbers greater than or equal to zero are ignored./p> /dl> p>The dfn iddom-context-2d-shadowcolor>code>shadowColor/code>/dfn> attribute sets the color of the shadow./p> p>When the context is created, the code idshadows:dom-context-2d-shadowcolor-2>a href#dom-context-2d-shadowcolor>shadowColor/a>/code> attribute initially must be a href#transparent-black idshadows:transparent-black>transparent black/a>./p> p>On getting, the a href#serialisation-of-a-color idshadows:serialisation-of-a-color>serialization of the color/a> must be returned./p> p>On setting, the new value must be a href#parsed-as-a-css-color-value idshadows:parsed-as-a-css-color-value>parsed as a CSS <color> value/a> and the color assigned. If the value cannot be a href#parsed-as-a-css-color-value idshadows:parsed-as-a-css-color-value-2>parsed as a CSS <color> value/a> then it must be ignored, and the attribute must retain its previous value. a href#refsCSSCOLOR>CSSCOLOR/a>/p> p>The dfn iddom-context-2d-shadowoffsetx>code>shadowOffsetX/code>/dfn> and dfn iddom-context-2d-shadowoffsety>code>shadowOffsetY/code>/dfn> attributes specify the distance that the shadow will be offset in the positive horizontal and positive vertical distance respectively. Their values are in coordinate space units. They are not affected by the current transformation matrix./p> p>When the context is created, the shadow offset attributes must initially have the value 0./p> p>On getting, they must return their current value. On setting, the attribute being set must be set to the new value, except if the value is infinite or NaN, in which case the new value must be ignored./p> p>The dfn iddom-context-2d-shadowblur>code>shadowBlur/code>/dfn> attribute specifies the level of the blurring effect. (The units do not map to coordinate space units, and are not affected by the current transformation matrix.)/p> p>When the context is created, the code idshadows:dom-context-2d-shadowblur-2>a href#dom-context-2d-shadowblur>shadowBlur/a>/code> attribute must initially have the value 0./p> p>On getting, the attribute must return its current value. On setting the attribute must be set to the new value, except if the value is negative, infinite or NaN, in which case the new value must be ignored./p> p>dfn idwhen-shadows-are-drawn>Shadows are only drawn if/dfn> the opacity component of the alpha component of the color of code idshadows:dom-context-2d-shadowcolor-3>a href#dom-context-2d-shadowcolor>shadowColor/a>/code> is nonzero and either the code idshadows:dom-context-2d-shadowblur-3>a href#dom-context-2d-shadowblur>shadowBlur/a>/code> is nonzero, or the code idshadows:dom-context-2d-shadowoffsetx-2>a href#dom-context-2d-shadowoffsetx>shadowOffsetX/a>/code> is nonzero, or the code idshadows:dom-context-2d-shadowoffsety-2>a href#dom-context-2d-shadowoffsety>shadowOffsetY/a>/code> is nonzero./p> p>a href#when-shadows-are-drawn idshadows:when-shadows-are-drawn>When shadows are drawn/a>, they must be rendered as follows:/p> ol>li>p>Let var>A/var> be an infinite a href#transparent-black idshadows:transparent-black-2>transparent black/a> bitmap on which the source image for which a shadow is being created has been rendered.li>p>Let var>B/var> be an infinite a href#transparent-black idshadows:transparent-black-3>transparent black/a> bitmap, with a coordinate space and an origin identical to var>A/var>.li>p>Copy the alpha channel of var>A/var> to var>B/var>, offset by code idshadows:dom-context-2d-shadowoffsetx-3>a href#dom-context-2d-shadowoffsetx>shadowOffsetX/a>/code> in the positive var>x/var> direction, and code idshadows:dom-context-2d-shadowoffsety-3>a href#dom-context-2d-shadowoffsety>shadowOffsetY/a>/code> in the positive var>y/var> direction.li> p>If code idshadows:dom-context-2d-shadowblur-4>a href#dom-context-2d-shadowblur>shadowBlur/a>/code> is greater than 0:/p> ol>li> p>Let var>σ/var> be half the value of code idshadows:dom-context-2d-shadowblur-5>a href#dom-context-2d-shadowblur>shadowBlur/a>/code>.li> p>Perform a 2D Gaussian Blur on var>B/var>, using var>σ/var> as the standard deviation./p> /ol> p>User agents may limit values of var>σ/var> to an implementation-specific maximum value to avoid exceeding hardware limitations during the Gaussian blur operation./p> li>p>Set the red, green, and blue components of every pixel in var>B/var> to the red, green, and blue components (respectively) of the color of code idshadows:dom-context-2d-shadowcolor-4>a href#dom-context-2d-shadowcolor>shadowColor/a>/code>.li>p>Multiply the alpha component of every pixel in var>B/var> by the alpha component of the color of code idshadows:dom-context-2d-shadowcolor-5>a href#dom-context-2d-shadowcolor>shadowColor/a>/code>.li>p>The shadow is in the bitmap var>B/var>, and is rendered as part of the a href#drawing-model idshadows:drawing-model>drawing model/a> described below./ol> p>If the current composition operation is code idshadows:gcop-copy>a href#gcop-copy>copy/a>/code>, then shadows effectively wont render (since the shape will overwrite the shadow)./p> h6 idfilters>span classsecno>4.12.5.1.19/span> Filtersa href#filters classself-link>/a>/h6> p>All drawing operations on an object which implements the code idfilters:canvasfilters>a href#canvasfilters>CanvasFilters/a>/code> interface are affected by the global dfn iddom-context-2d-filter>code>filter/code>/dfn> attribute./p> dl classdomintro>dt>var>context/var> . code idfilters:dom-context-2d-filter>a href#dom-context-2d-filter>filter/a>/code> var>value/var> dd> p>Returns the current filter./p> p>Can be set, to change the filter. Values that cannot be parsed as a a idfilters:filter-function-list hrefhttps://drafts.fxtf.org/filter-effects/#typedef-filter-function-list data-x-internalfilter-function-list><filter-function-list>/a> value are ignored./p> /dl> p>The code idfilters:dom-context-2d-filter-2>a href#dom-context-2d-filter>filter/a>/code> attribute, on getting, must return the last value it was successfully set to. The value must not be re-serialized. On setting, if the new value is none (not the empty string, null, or undefined), filters must be disabled for the context. Otherwise, the value must be parsed as a a idfilters:filter-function-list-2 hrefhttps://drafts.fxtf.org/filter-effects/#typedef-filter-function-list data-x-internalfilter-function-list><filter-function-list>/a> value. If the value cannot be parsed as a a idfilters:filter-function-list-3 hrefhttps://drafts.fxtf.org/filter-effects/#typedef-filter-function-list data-x-internalfilter-function-list><filter-function-list>/a> value, where using property-independent style sheet syntax like inherit or initial is considered an invalid value, then it must be ignored, and the attribute must retain its previous value. When creating the object implementing the code idfilters:canvasfilters-2>a href#canvasfilters>CanvasFilters/a>/code> interface, the attribute must be set to none./p> p>A a idfilters:filter-function-list-4 hrefhttps://drafts.fxtf.org/filter-effects/#typedef-filter-function-list data-x-internalfilter-function-list><filter-function-list>/a> value consists of a sequence of one or more filter functions or references to SVG filters. The input to the filter is used as the input to the first item in the list. Subsequent items take the output of the previous item as their input. a href#refsFILTERS>FILTERS/a>/p> p>Coordinates used in the value of the code idfilters:dom-context-2d-filter-3>a href#dom-context-2d-filter>filter/a>/code> attribute are interpreted such that one pixel is equivalent to one SVG user space unit and to one canvas coordinate space unit. Filter coordinates are not affected by the a href#transformations idfilters:transformations>current transformation matrix/a>. The current transformation matrix affects only the input to the filter. Filters are applied in the a href#output-bitmap idfilters:output-bitmap>output bitmap/a>s coordinate space./p> p>When the value of the code idfilters:dom-context-2d-filter-4>a href#dom-context-2d-filter>filter/a>/code> attribute defines lengths using percentages or using a idfilters:em hrefhttps://drafts.csswg.org/css-values/#em data-x-internalem>em/a> or a idfilters:ex hrefhttps://drafts.csswg.org/css-values/#ex data-x-internalex>ex/a> units, these must be interpreted relative to the a idfilters:computed-value hrefhttps://drafts.csswg.org/css-cascade/#computed-value data-x-internalcomputed-value>computed value/a> of the a idfilters:font-size hrefhttps://drafts.csswg.org/css-fonts/#font-size-prop data-x-internalfont-size>font-size/a> property of the a href#font-style-source-object idfilters:font-style-source-object>font style source object/a> at the time that the attribute is set, if it is an element. If the a hrefhttps://drafts.csswg.org/css-cascade/#computed-value idfilters:computed-value-2 data-x-internalcomputed-value>computed values/a> are undefined for a particular case (e.g. because the a href#font-style-source-object idfilters:font-style-source-object-2>font style source object/a> is not an element or is not a href#being-rendered idfilters:being-rendered>being rendered/a>), then the relative keywords must be interpreted relative to the default value of the code idfilters:dom-context-2d-font>a href#dom-context-2d-font>font/a>/code> attribute. The larger and smaller keywords are not supported./p> p>If the value of the code idfilters:dom-context-2d-filter-5>a href#dom-context-2d-filter>filter/a>/code> attribute refers to an SVG filter in the same document, and this SVG filter changes, then the changed filter is used for the next draw operation./p> p>If the value of the code idfilters:dom-context-2d-filter-6>a href#dom-context-2d-filter>filter/a>/code> attribute refers to an SVG filter in an external resource document and that document is not loaded when a drawing operation is invoked, then the drawing operation must proceed with no filtering./p> h6 idworking-with-externally-defined-svg-filters>span classsecno>4.12.5.1.20/span> Working with externally-defined SVG filtersa href#working-with-externally-defined-svg-filters classself-link>/a>/h6> p>i>This section is non-normative./i>/p> p>Since drawing is performed using filter value none until an externally-defined filter has finished loading, authors might wish to determine whether such a filter has finished loading before proceeding with a drawing operation. One way to accomplish this is to load the externally-defined filter elsewhere within the same page in some element that sends a code>load/code> event (for example, an a idworking-with-externally-defined-svg-filters:svg-use hrefhttps://www.w3.org/TR/SVG11/struct.html#UseElement data-x-internalsvg-use>SVG code>use/code>/a> element), and wait for the code>load/code> event to be dispatched./p> h6 iddrawing-model>span classsecno>4.12.5.1.21/span> dfn>Drawing model/dfn>a href#drawing-model classself-link>/a>/h6> p>When a shape or image is painted, user agents must follow these steps, in the order given (or act as if they do):/p> ol>li>p>Render the shape or image onto an infinite a href#transparent-black iddrawing-model:transparent-black>transparent black/a> bitmap, creating image var>A/var>, as described in the previous sections. For shapes, the current fill, stroke, and line styles must be honored, and the stroke must itself also be subjected to the current transformation matrix.li>p>When the filter attribute is set to a value other than none and all the externally-defined filters it references, if any, are in documents that are currently loaded, then use image var>A/var> as the input to the code iddrawing-model:dom-context-2d-filter>a href#dom-context-2d-filter>filter/a>/code>, creating image var>B/var>. Otherwise, let var>B/var> be an alias for var>A/var>.li>p>a href#when-shadows-are-drawn iddrawing-model:when-shadows-are-drawn>When shadows are drawn/a>, render the shadow from image var>B/var>, using the current shadow styles, creating image var>C/var>.li>p>a href#when-shadows-are-drawn iddrawing-model:when-shadows-are-drawn-2>When shadows are drawn/a>, multiply the alpha component of every pixel in var>C/var> by code iddrawing-model:dom-context-2d-globalalpha>a href#dom-context-2d-globalalpha>globalAlpha/a>/code>.li>p>a href#when-shadows-are-drawn iddrawing-model:when-shadows-are-drawn-3>When shadows are drawn/a>, composite var>C/var> within the a href#clipping-region iddrawing-model:clipping-region>clipping region/a> over the current a href#output-bitmap iddrawing-model:output-bitmap>output bitmap/a> using the a href#current-composition-operator iddrawing-model:current-composition-operator>current composition operator/a>.li>p>Multiply the alpha component of every pixel in var>B/var> by code iddrawing-model:dom-context-2d-globalalpha-2>a href#dom-context-2d-globalalpha>globalAlpha/a>/code>.li>p>Composite var>B/var> within the a href#clipping-region iddrawing-model:clipping-region-2>clipping region/a> over the current a href#output-bitmap iddrawing-model:output-bitmap-2>output bitmap/a> using the a href#current-composition-operator iddrawing-model:current-composition-operator-2>current composition operator/a>./ol> p>When compositing onto the a href#output-bitmap iddrawing-model:output-bitmap-3>output bitmap/a>, pixels that would fall outside of the a href#output-bitmap iddrawing-model:output-bitmap-4>output bitmap/a> must be discarded./p> h6 idbest-practices>span classsecno>4.12.5.1.22/span> Best practicesa href#best-practices classself-link>/a>/h6> p>When a canvas is interactive, authors should include focusable elements in the elements fallback content corresponding to each focusable part of the canvas, as in the a href#drawCustomFocusRingExample>example above/a>./p> p>When rendering focus rings, to ensure that focus rings have the appearance of native focus rings, authors should use the code idbest-practices:dom-context-2d-drawfocusifneeded>a href#dom-context-2d-drawfocusifneeded>drawFocusIfNeeded()/a>/code> method, passing it the element for which a ring is being drawn. This method only draws the focus ring if the element is a href#focused idbest-practices:focused>focused/a>, so that it can simply be called whenever drawing the element, without checking whether the element is focused or not first./p> p>In addition to drawing focus rings, authors should use the code idbest-practices:dom-context-2d-scrollpathintoview>a href#dom-context-2d-scrollpathintoview>scrollPathIntoView()/a>/code> method when an element in the canvas is focused, to make sure it is visible on the screen (if applicable)./p> p idno-text-editing-in-canvas-please>Authors should avoid implementing text editing controls using the code idbest-practices:the-canvas-element>a href#the-canvas-element>canvas/a>/code> element. Doing so has a large number of disadvantages:/p> ul>li>Mouse placement of the caret has to be reimplemented.li>Keyboard movement of the caret has to be reimplemented (possibly across lines, for multiline text input).li>Scrolling of the text control has to be implemented (horizontally for long lines, vertically for multiline input).li>Native features such as copy-and-paste have to be reimplemented.li>Native features such as spell-checking have to be reimplemented.li>Native features such as drag-and-drop have to be reimplemented.li>Native features such as page-wide text search have to be reimplemented.li>Native features specific to the user, for example custom text services, have to be reimplemented. This is close to impossible since each user might have different services installed, and there is an unbounded set of possible such services.li>Bidirectional text editing has to be reimplemented.li>For multiline text editing, line wrapping has to be implemented for all relevant languages.li>Text selection has to be reimplemented.li>Dragging of bidirectional text selections has to be reimplemented.li>Platform-native keyboard shortcuts have to be reimplemented.li>Platform-native input method editors (IMEs) have to be reimplemented.li>Undo and redo functionality has to be reimplemented.li>Accessibility features such as magnification following the caret or selection have to be reimplemented./ul> p>This is a huge amount of work, and authors are most strongly encouraged to avoid doing any of it by instead using the code idbest-practices:the-input-element>a href#the-input-element>input/a>/code> element, the code idbest-practices:the-textarea-element>a href#the-textarea-element>textarea/a>/code> element, or the code idbest-practices:attr-contenteditable>a href#attr-contenteditable>contenteditable/a>/code> attribute./p> h6 idexamples>span classsecno>4.12.5.1.23/span> Examplesa href#examples classself-link>/a>/h6> p>i>This section is non-normative./i>/p> div classexample> p>Here is an example of a script that uses canvas to draw a hrefdata:text/html;charsetutf-8;base64,PCFET0NUWVBFIEhUTUw%2BDQo8aHRtbCBsYW5nPSJlbiI%2BDQogPGhlYWQ%2BDQogIDx0aXRsZT5QcmV0dHkgR2xvd2luZyBMaW5lczwvdGl0bGU%2BDQogPC9oZWFkPg0KIDxib2R5Pg0KPGNhbnZhcyB3aWR0aD0iODAwIiBoZWlnaHQ9IjQ1MCI%2BPC9jYW52YXM%2BDQo8c2NyaXB0Pg0KDQogdmFyIGNvbnRleHQgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnY2FudmFzJylbMF0uZ2V0Q29udGV4dCgnMmQnKTsNCg0KIHZhciBsYXN0WCA9IGNvbnRleHQuY2FudmFzLndpZHRoICogTWF0aC5yYW5kb20oKTsNCiB2YXIgbGFzdFkgPSBjb250ZXh0LmNhbnZhcy5oZWlnaHQgKiBNYXRoLnJhbmRvbSgpOw0KIHZhciBodWUgPSAwOw0KIGZ1bmN0aW9uIGxpbmUoKSB7DQogICBjb250ZXh0LnNhdmUoKTsNCiAgIGNvbnRleHQudHJhbnNsYXRlKGNvbnRleHQuY2FudmFzLndpZHRoLzIsIGNvbnRleHQuY2FudmFzLmhlaWdodC8yKTsNCiAgIGNvbnRleHQuc2NhbGUoMC45LCAwLjkpOw0KICAgY29udGV4dC50cmFuc2xhdGUoLWNvbnRleHQuY2FudmFzLndpZHRoLzIsIC1jb250ZXh0LmNhbnZhcy5oZWlnaHQvMik7DQogICBjb250ZXh0LmJlZ2luUGF0aCgpOw0KICAgY29udGV4dC5saW5lV2lkdGggPSA1ICsgTWF0aC5yYW5kb20oKSAqIDEwOw0KICAgY29udGV4dC5tb3ZlVG8obGFzdFgsIGxhc3RZKTsNCiAgIGxhc3RYID0gY29udGV4dC5jYW52YXMud2lkdGggKiBNYXRoLnJhbmRvbSgpOw0KICAgbGFzdFkgPSBjb250ZXh0LmNhbnZhcy5oZWlnaHQgKiBNYXRoLnJhbmRvbSgpOw0KICAgY29udGV4dC5iZXppZXJDdXJ2ZVRvKGNvbnRleHQuY2FudmFzLndpZHRoICogTWF0aC5yYW5kb20oKSwNCiAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0LmNhbnZhcy5oZWlnaHQgKiBNYXRoLnJhbmRvbSgpLA0KICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHQuY2FudmFzLndpZHRoICogTWF0aC5yYW5kb20oKSwNCiAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0LmNhbnZhcy5oZWlnaHQgKiBNYXRoLnJhbmRvbSgpLA0KICAgICAgICAgICAgICAgICAgICAgICAgIGxhc3RYLCBsYXN0WSk7DQoNCiAgIGh1ZSA9IGh1ZSArIDEwICogTWF0aC5yYW5kb20oKTsNCiAgIGNvbnRleHQuc3Ryb2tlU3R5bGUgPSAnaHNsKCcgKyBodWUgKyAnLCA1MCUsIDUwJSknOw0KICAgY29udGV4dC5zaGFkb3dDb2xvciA9ICd3aGl0ZSc7DQogICBjb250ZXh0LnNoYWRvd0JsdXIgPSAxMDsNCiAgIGNvbnRleHQuc3Ryb2tlKCk7DQogICBjb250ZXh0LnJlc3RvcmUoKTsNCiB9DQogc2V0SW50ZXJ2YWwobGluZSwgNTApOw0KDQogZnVuY3Rpb24gYmxhbmsoKSB7DQogICBjb250ZXh0LmZpbGxTdHlsZSA9ICdyZ2JhKDAsMCwwLDAuMSknOw0KICAgY29udGV4dC5maWxsUmVjdCgwLCAwLCBjb250ZXh0LmNhbnZhcy53aWR0aCwgY29udGV4dC5jYW52YXMuaGVpZ2h0KTsNCiB9DQogc2V0SW50ZXJ2YWwoYmxhbmssIDQwKTsNCg0KPC9zY3JpcHQ%2BDQogPC9ib2R5Pg0KPC9odG1sPg0K>pretty glowing lines/a>./p> pre><canvas width800 height450></canvas><script> var context document.getElementsByTagName(canvas)0.getContext(2d); var lastX context.canvas.width * Math.random(); var lastY context.canvas.height * Math.random(); var hue 0; function line() { context.save(); context.translate(context.canvas.width/2, context.canvas.height/2); context.scale(0.9, 0.9); context.translate(-context.canvas.width/2, -context.canvas.height/2); context.beginPath(); context.lineWidth 5 + Math.random() * 10; context.moveTo(lastX, lastY); lastX context.canvas.width * Math.random(); lastY context.canvas.height * Math.random(); context.bezierCurveTo(context.canvas.width * Math.random(), context.canvas.height * Math.random(), context.canvas.width * Math.random(), context.canvas.height * Math.random(), lastX, lastY); hue hue + 10 * Math.random(); context.strokeStyle hsl( + hue + , 50%, 50%); context.shadowColor white; context.shadowBlur 10; context.stroke(); context.restore(); } setInterval(line, 50); function blank() { context.fillStyle rgba(0,0,0,0.1); context.fillRect(0, 0, context.canvas.width, context.canvas.height); } setInterval(blank, 40);</script>/pre> /div> div classexample> p>The 2D rendering context for code idexamples:the-canvas-element>a href#the-canvas-element>canvas/a>/code> is often used for sprite-based games. The following example demonstrates this:/p> iframe src/demos/canvas/blue-robot/index-idle.html width396 height216>/iframe> p>Here is the source for this example:/p> pre><!DOCTYPE HTML><meta charsetutf-8><title>Blue Robot Demo</title><style> html { overflow: hidden; min-height: 200px; min-width: 380px; } body { height: 200px; position: relative; margin: 8px; } .buttons { position: absolute; bottom: 0px; left: 0px; margin: 4px; }</style><canvas width380 height200></canvas><script> var Landscape function (context, width, height) { this.offset 0; this.width width; this.advance function (dx) { this.offset + dx; }; this.horizon height * 0.7; // This creates the sky gradient (from a darker blue to white at the bottom) this.sky context.createLinearGradient(0, 0, 0, this.horizon); this.sky.addColorStop(0.0, rgb(55,121,179)); this.sky.addColorStop(0.7, rgb(121,194,245)); this.sky.addColorStop(1.0, rgb(164,200,214)); // this creates the grass gradient (from a darker green to a lighter green) this.earth context.createLinearGradient(0, this.horizon, 0, height); this.earth.addColorStop(0.0, rgb(81,140,20)); this.earth.addColorStop(1.0, rgb(123,177,57)); this.paintBackground function (context, width, height) { // first, paint the sky and grass rectangles context.fillStyle this.sky; context.fillRect(0, 0, width, this.horizon); context.fillStyle this.earth; context.fillRect(0, this.horizon, width, height-this.horizon); // then, draw the cloudy banner // we make it cloudy by having the draw text off the top of the // canvas, and just having the blurred shadow shown on the canvas context.save(); context.translate(width-((this.offset+(this.width*3.2)) % (this.width*4.0))+0, 0); context.shadowColor white; context.shadowOffsetY 30+this.horizon/3; // offset down on canvas context.shadowBlur 5; context.fillStyle white; context.textAlign left; context.textBaseline top; context.font 20px sans-serif; context.fillText(WHATWG ROCKS, 10, -30); // text up above canvas context.restore(); // then, draw the background tree context.save(); context.translate(width-((this.offset+(this.width*0.2)) % (this.width*1.5))+30, 0); context.beginPath(); context.fillStyle rgb(143,89,2); context.lineStyle rgb(10,10,10); context.lineWidth 2; context.rect(0, this.horizon+5, 10, -50); // trunk context.fill(); context.stroke(); context.beginPath(); context.fillStyle rgb(78,154,6); context.arc(5, this.horizon-60, 30, 0, Math.PI*2); // leaves context.fill(); context.stroke(); context.restore(); }; this.paintForeground function (context, width, height) { // draw the box that goes in front context.save(); context.translate(width-((this.offset+(this.width*0.7)) % (this.width*1.1))+0, 0); context.beginPath(); context.rect(0, this.horizon - 5, 25, 25); context.fillStyle rgb(220,154,94); context.lineStyle rgb(10,10,10); context.lineWidth 2; context.fill(); context.stroke(); context.restore(); }; };</script><script> var BlueRobot function () { this.sprites new Image(); this.sprites.src blue-robot.png; // this sprite sheet has 8 cells this.targetMode idle; this.walk function () { this.targetMode walk; }; this.stop function () { this.targetMode idle; }; this.frameIndex { idle: 0, // first cell is the idle frame walk: 1,2,3,4,5,6, // the walking animation is cells 1-6 stop: 7, // last cell is the stopping animation }; this.mode idle; this.frame 0; // index into frameIndex this.tick function () { // this advances the frame and the robot // the return value is how many pixels the robot has moved this.frame + 1; if (this.frame > this.frameIndexthis.mode.length) { // weve reached the end of this animation cycle this.frame 0; if (this.mode ! this.targetMode) { // switch to next cycle if (this.mode walk) { // we need to stop walking before we decide what to do next this.mode stop; } else if (this.mode stop) { if (this.targetMode walk) this.mode walk; else this.mode idle; } else if (this.mode idle) { if (this.targetMode walk) this.mode walk; } } } if (this.mode walk) return 8; return 0; }, this.paint function (context, x, y) { if (!this.sprites.complete) return; // draw the right frame out of the sprite sheet onto the canvas // we assume each frame is as high as the sprite sheet // the x,y coordinates give the position of the bottom center of the sprite context.drawImage(this.sprites, this.frameIndexthis.modethis.frame * this.sprites.height, 0, this.sprites.height, this.sprites.height, x-this.sprites.height/2, y-this.sprites.height, this.sprites.height, this.sprites.height); }; };</script><script> var canvas document.getElementsByTagName(canvas)0; var context canvas.getContext(2d); var landscape new Landscape(context, canvas.width, canvas.height); var blueRobot new BlueRobot(); // paint when the browser wants us to, using requestAnimationFrame() function paint() { context.clearRect(0, 0, canvas.width, canvas.height); landscape.paintBackground(context, canvas.width, canvas.height); blueRobot.paint(context, canvas.width/2, landscape.horizon*1.1); landscape.paintForeground(context, canvas.width, canvas.height); requestAnimationFrame(paint); } paint(); // but tick every 150ms, so that we dont slow down when we dont paint setInterval(function () { var dx blueRobot.tick(); landscape.advance(dx); }, 100);</script><p classbuttons> <input typebutton valueWalk onclickblueRobot.walk()> <input typebutton valueStop onclickblueRobot.stop()><footer> <small> Blue Robot Player Sprite by <a hrefhttps://johncolburn.deviantart.com/>JohnColburn</a>. Licensed under the terms of the Creative Commons Attribution Share-Alike 3.0 Unported license.</small> <small> This work is itself licensed under a <a rellicense hrefhttps://creativecommons.org/licenses/by-sa/3.0/>Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</small></footer>/pre> /div> h5 idthe-imagebitmap-rendering-context>span classsecno>4.12.5.2/span> The code idthe-imagebitmap-rendering-context:imagebitmap>a href#imagebitmap>ImageBitmap/a>/code> rendering contexta href#the-imagebitmap-rendering-context classself-link>/a>/h5> h6 idintroduction-6>span classsecno>4.12.5.2.1/span> Introductiona href#introduction-6 classself-link>/a>/h6> p>code idintroduction-6:imagebitmaprenderingcontext>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code> is a performance-oriented interface that provides a low overhead method for displaying the contents of code idintroduction-6:imagebitmap>a href#imagebitmap>ImageBitmap/a>/code> objects. It uses transfer semantics to reduce overall memory consumption. It also streamlines performance by avoiding intermediate compositing, unlike the code idintroduction-6:dom-context-2d-drawimage>a href#dom-context-2d-drawimage>drawImage()/a>/code> method of code idintroduction-6:canvasrenderingcontext2d>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code>./p> p>Using an code idintroduction-6:the-img-element>a href#the-img-element>img/a>/code> element as an intermediate for getting an image resource into a canvas, for example, would result in two copies of the decoded image existing in memory at the same time: the code idintroduction-6:the-img-element-2>a href#the-img-element>img/a>/code> elements copy, and the one in the canvass backing store. This memory cost can be prohibitive when dealing with extremely large images. This can be avoided by using code idintroduction-6:imagebitmaprenderingcontext-2>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code>./p> div classexample> p>Using code idintroduction-6:imagebitmaprenderingcontext-3>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code>, here is how to transcode an image to the JPEG format in a memory- and CPU-efficient way:/p> pre>createImageBitmap(inputImageBlob).then(image > { const canvas document.createElement(canvas); const context canvas.getContext(bitmaprenderer); context.transferFromImageBitmap(image); canvas.toBlob(outputJPEGBlob > { // Do something with outputJPEGBlob. }, image/jpeg);});/pre> /div> h6 idthe-imagebitmaprenderingcontext-interface>span classsecno>4.12.5.2.2/span> The code idthe-imagebitmaprenderingcontext-interface:imagebitmaprenderingcontext>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code> interfacea href#the-imagebitmaprenderingcontext-interface classself-link>/a>/h6> pre classidl>ExposedWindowinterface dfn idimagebitmaprenderingcontext>ImageBitmapRenderingContext/dfn> { readonly attribute a href#htmlcanvaselement idthe-imagebitmaprenderingcontext-interface:htmlcanvaselement>HTMLCanvasElement/a> a href#dom-imagebitmaprenderingcontext-canvas idthe-imagebitmaprenderingcontext-interface:dom-imagebitmaprenderingcontext-canvas>canvas/a>; void a href#dom-imagebitmaprenderingcontext-transferfromimagebitmap idthe-imagebitmaprenderingcontext-interface:dom-imagebitmaprenderingcontext-transferfromimagebitmap>transferFromImageBitmap/a>(ImageBitmap? bitmap);};dictionary dfn idimagebitmaprenderingcontextsettings>ImageBitmapRenderingContextSettings/dfn> { boolean a href#dom-imagebitmaprenderingcontextsettings-alpha idthe-imagebitmaprenderingcontext-interface:dom-imagebitmaprenderingcontextsettings-alpha>alpha/a> true;};/pre> dl classdomintro>dt>var>context/var> var>canvas/var> . code idthe-imagebitmaprenderingcontext-interface:dom-canvas-getcontext>a href#dom-canvas-getcontext>getContext/a>/code>(bitmaprenderer , { code idthe-imagebitmaprenderingcontext-interface:dom-imagebitmaprenderingcontextsettings-alpha-2>a href#dom-imagebitmaprenderingcontextsettings-alpha>alpha/a>/code>: false } )dd> p>Returns an code idthe-imagebitmaprenderingcontext-interface:imagebitmaprenderingcontext-2>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code> object that is permanently bound to a particular code idthe-imagebitmaprenderingcontext-interface:the-canvas-element>a href#the-canvas-element>canvas/a>/code> element./p> p>If the code idthe-imagebitmaprenderingcontext-interface:dom-imagebitmaprenderingcontextsettings-alpha-3>a href#dom-imagebitmaprenderingcontextsettings-alpha>alpha/a>/code> setting is provided and set to false, then the canvas is forced to always be opaque./p> dt>var>context/var> . code idthe-imagebitmaprenderingcontext-interface:dom-imagebitmaprenderingcontext-canvas-2>a href#dom-imagebitmaprenderingcontext-canvas>canvas/a>/code>dd> p>Returns the code idthe-imagebitmaprenderingcontext-interface:the-canvas-element-2>a href#the-canvas-element>canvas/a>/code> element that the context is bound to./p> dt>var>context/var> . code idthe-imagebitmaprenderingcontext-interface:dom-imagebitmaprenderingcontext-transferfromimagebitmap-2>a href#dom-imagebitmaprenderingcontext-transferfromimagebitmap>transferFromImageBitmap/a>/code>(imageBitmap)dd> p>Transfers the underlying a href#concept-imagebitmap-bitmap-data idthe-imagebitmaprenderingcontext-interface:concept-imagebitmap-bitmap-data>bitmap data/a> from var>imageBitmap/var> to var>context/var>, and the bitmap becomes the contents of the code idthe-imagebitmaprenderingcontext-interface:the-canvas-element-3>a href#the-canvas-element>canvas/a>/code> element to which var>context/var> is bound./p> dt>var>context/var> . code idthe-imagebitmaprenderingcontext-interface:dom-imagebitmaprenderingcontext-transferfromimagebitmap-3>a href#dom-imagebitmaprenderingcontext-transferfromimagebitmap>transferFromImageBitmap/a>/code>( null)dd> p>Replaces contents of the code idthe-imagebitmaprenderingcontext-interface:the-canvas-element-4>a href#the-canvas-element>canvas/a>/code> element to which var>context/var> is bound with a a href#transparent-black idthe-imagebitmaprenderingcontext-interface:transparent-black>transparent black/a> bitmap whose size corresponds to the code idthe-imagebitmaprenderingcontext-interface:attr-canvas-width>a href#attr-canvas-width>width/a>/code> and code idthe-imagebitmaprenderingcontext-interface:attr-canvas-height>a href#attr-canvas-height>height/a>/code> content attributes of the code idthe-imagebitmaprenderingcontext-interface:the-canvas-element-5>a href#the-canvas-element>canvas/a>/code> element./p> /dl> p>The dfn iddom-imagebitmaprenderingcontext-canvas>code>canvas/code>/dfn> attribute must return the value it was initialized to when the object was created./p> p>An code idthe-imagebitmaprenderingcontext-interface:imagebitmaprenderingcontext-3>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code> object has an dfn idconcept-imagebitmaprenderingcontext-output-bitmap>output bitmap/dfn>, which is a reference to a href#concept-imagebitmap-bitmap-data idthe-imagebitmaprenderingcontext-interface:concept-imagebitmap-bitmap-data-2>bitmap data/a>./p> p>An code idthe-imagebitmaprenderingcontext-interface:imagebitmaprenderingcontext-4>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code> object has a dfn idconcept-imagebitmaprenderingcontext-bitmap-mode>bitmap mode/dfn>, which can be set to dfn idconcept-imagebitmaprenderingcontext-valid>valid/dfn> or dfn idconcept-imagebitmaprenderingcontext-blank>blank/dfn>. A value of a href#concept-imagebitmaprenderingcontext-valid idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-valid>valid/a> indicates that the contexts a href#concept-imagebitmaprenderingcontext-output-bitmap idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-output-bitmap>output bitmap/a> refers to a href#concept-imagebitmap-bitmap-data idthe-imagebitmaprenderingcontext-interface:concept-imagebitmap-bitmap-data-3>bitmap data/a> that was acquired via code idthe-imagebitmaprenderingcontext-interface:dom-imagebitmaprenderingcontext-transferfromimagebitmap-4>a href#dom-imagebitmaprenderingcontext-transferfromimagebitmap>transferFromImageBitmap()/a>/code>. A value a href#concept-imagebitmaprenderingcontext-blank idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-blank>blank/a> indicates that the contexts a href#concept-imagebitmaprenderingcontext-output-bitmap idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-output-bitmap-2>output bitmap/a> is a default transparent bitmap./p> p>An code idthe-imagebitmaprenderingcontext-interface:imagebitmaprenderingcontext-5>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code> object also has an dfn idconcept-imagebitmaprenderingcontext-alpha>alpha/dfn> flag, which can be set to true or false. When an code idthe-imagebitmaprenderingcontext-interface:imagebitmaprenderingcontext-6>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code> object has its a href#concept-imagebitmaprenderingcontext-alpha idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-alpha>alpha/a> flag set to false, the contents of the code idthe-imagebitmaprenderingcontext-interface:the-canvas-element-6>a href#the-canvas-element>canvas/a>/code> element to which the context is bound are obtained by compositing the contexts a href#concept-imagebitmaprenderingcontext-output-bitmap idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-output-bitmap-3>output bitmap/a> onto an opaque black bitmap of the same size using the source-over composite operation. If the a href#concept-imagebitmaprenderingcontext-alpha idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-alpha-2>alpha/a> flag is set to true, then the a href#concept-imagebitmaprenderingcontext-output-bitmap idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-output-bitmap-4>output bitmap/a> is used as the contents of the code idthe-imagebitmaprenderingcontext-interface:the-canvas-element-7>a href#the-canvas-element>canvas/a>/code> element to which the context is bound. a href#refsCOMPOSITE>COMPOSITE/a>/p> p classnote>The step of compositing over an opaque black bitmap ought to be elided whenever equivalent results can be obtained more efficiently by other means./p> hr> p>When a user agent is required to dfn idset-an-imagebitmaprenderingcontexts-output-bitmap>set an code>ImageBitmapRenderingContext/code>s output bitmap/dfn>, with a var>context/var> argument that is an code idthe-imagebitmaprenderingcontext-interface:imagebitmaprenderingcontext-7>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code> object and an optional argument var>bitmap/var> that refers to a href#concept-imagebitmap-bitmap-data idthe-imagebitmaprenderingcontext-interface:concept-imagebitmap-bitmap-data-4>bitmap data/a>, it must run these steps:/p> ol>li>p>If a var>bitmap/var> argument was not provided, then:/p> ol>li>p>Set var>context/var>s a href#concept-imagebitmaprenderingcontext-bitmap-mode idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-bitmap-mode>bitmap mode/a> to a href#concept-imagebitmaprenderingcontext-blank idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-blank-2>blank/a>.li>p>Let var>canvas/var> be the code idthe-imagebitmaprenderingcontext-interface:the-canvas-element-8>a href#the-canvas-element>canvas/a>/code> element to which var>context/var> is bound.li>p>Set var>context/var>s a href#concept-imagebitmaprenderingcontext-output-bitmap idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-output-bitmap-5>output bitmap/a> to be a href#transparent-black idthe-imagebitmaprenderingcontext-interface:transparent-black-2>transparent black/a> with an a href#intrinsic-width idthe-imagebitmaprenderingcontext-interface:intrinsic-width>intrinsic width/a> equal to the numeric value of var>canvas/var>s code idthe-imagebitmaprenderingcontext-interface:attr-canvas-width-2>a href#attr-canvas-width>width/a>/code> attribute and an a href#intrinsic-height idthe-imagebitmaprenderingcontext-interface:intrinsic-height>intrinsic height/a> equal to the numeric value of var>canvas/var>s code idthe-imagebitmaprenderingcontext-interface:attr-canvas-height-2>a href#attr-canvas-height>height/a>/code> attribute, those values being interpreted in a hrefhttps://drafts.csswg.org/css-values/#px idthe-imagebitmaprenderingcontext-interface:px data-x-internalpx>CSS pixels/a>.li>p>Set the a href#concept-imagebitmaprenderingcontext-output-bitmap idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-output-bitmap-6>output bitmap/a>s a href#concept-canvas-origin-clean idthe-imagebitmaprenderingcontext-interface:concept-canvas-origin-clean>origin-clean/a> flag to true./ol> li>p>If a var>bitmap/var> argument was provided, then:/p> ol>li>p>Set var>context/var>s a href#concept-imagebitmaprenderingcontext-bitmap-mode idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-bitmap-mode-2>bitmap mode/a> to a href#concept-imagebitmaprenderingcontext-valid idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-valid-2>valid/a>.li> p>Set var>context/var>s a href#concept-imagebitmaprenderingcontext-output-bitmap idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-output-bitmap-7>output bitmap/a> to refer to the same underlying bitmap data as var>bitmap/var>, without making a copy./p> p classnote>The a href#concept-canvas-origin-clean idthe-imagebitmaprenderingcontext-interface:concept-canvas-origin-clean-2>origin-clean/a> flag of var>bitmap/var> is included in the bitmap data to be referenced by var>context/var>s a href#concept-imagebitmaprenderingcontext-output-bitmap idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-output-bitmap-8>output bitmap/a>./p> /ol> /ol> hr> p>The dfn idimagebitmaprenderingcontext-creation-algorithm>code>ImageBitmapRenderingContext/code> creation algorithm/dfn>, which is passed a var>target/var> (a code idthe-imagebitmaprenderingcontext-interface:the-canvas-element-9>a href#the-canvas-element>canvas/a>/code> element) and optionally some arguments, consists of running the following steps:/p> ol>li>p>If the algorithm was passed some arguments, then let var>arg/var> be the first such argument. Otherwise, let var>arg/var> be undefined.li>p>Let var>settings/var> be the result of a href#coerce-context-arguments-for-imagebitmaprenderingcontext idthe-imagebitmaprenderingcontext-interface:coerce-context-arguments-for-imagebitmaprenderingcontext>coercing the var>arg/var> context arguments for code>ImageBitmapRenderingContext/code>/a>.li>p>Create a new code idthe-imagebitmaprenderingcontext-interface:imagebitmaprenderingcontext-8>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code> object.li>p>Initialize its code idthe-imagebitmaprenderingcontext-interface:dom-context-2d-canvas>a href#dom-context-2d-canvas>canvas/a>/code> attribute to point to var>target/var>.li>p>Let the new code idthe-imagebitmaprenderingcontext-interface:imagebitmaprenderingcontext-9>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code> objects a href#concept-imagebitmaprenderingcontext-output-bitmap idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-output-bitmap-9>output bitmap/a> and var>target/var>s bitmap be a shared reference to the same bitmap.li>p>Run the steps to a href#set-an-imagebitmaprenderingcontexts-output-bitmap idthe-imagebitmaprenderingcontext-interface:set-an-imagebitmaprenderingcontexts-output-bitmap>set an code>ImageBitmapRenderingContext/code>s output bitmap/a>, using the new code idthe-imagebitmaprenderingcontext-interface:imagebitmaprenderingcontext-10>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code> object as the var>context/var> argument, and with no var>bitmap/var> argument.li>p>Initialize var>context/var>s a href#concept-imagebitmaprenderingcontext-alpha idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-alpha-3>alpha/a> flag to true. li> p>Process each of the members of var>settings/var> as follows:/p> dl>dt>dfn iddom-imagebitmaprenderingcontextsettings-alpha>code>alpha/code>/dfn>dd>If false, then set var>context/var>s a href#concept-imagebitmaprenderingcontext-alpha idthe-imagebitmaprenderingcontext-interface:concept-imagebitmaprenderingcontext-alpha-4>alpha/a> flag to false./dl> li>p>Return the new code idthe-imagebitmaprenderingcontext-interface:imagebitmaprenderingcontext-11>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code> object./ol> hr> p>When a user agent is required to dfn idcoerce-context-arguments-for-imagebitmaprenderingcontext>coerce context arguments for code>ImageBitmapRenderingContext/code>/dfn>, it must run these steps:/p> ol>li>p>Let var>input/var> be the argument to coerce.li>p>Let var>jsval/var> be the result of a hrefhttps://heycam.github.io/webidl/#es-type-mapping idthe-imagebitmaprenderingcontext-interface:concept-idl-convert data-x-internalconcept-idl-convert>converting/a> var>input/var> to a JavaScript value. (This can throw an exception.)li>p>Let var>dict/var> be the result of a hrefhttps://heycam.github.io/webidl/#es-type-mapping idthe-imagebitmaprenderingcontext-interface:concept-idl-convert-2 data-x-internalconcept-idl-convert>converting/a> var>jsval/var> to the dictionary type code idthe-imagebitmaprenderingcontext-interface:imagebitmaprenderingcontextsettings>a href#imagebitmaprenderingcontextsettings>ImageBitmapRenderingContextSettings/a>/code>. (This can throw an exception.)li>p>Return var>dict/var>./ol> hr> p>The dfn iddom-imagebitmaprenderingcontext-transferfromimagebitmap>code>transferFromImageBitmap(var>imageBitmap/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>Let var>bitmapContext/var> be the code idthe-imagebitmaprenderingcontext-interface:imagebitmaprenderingcontext-12>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code> object on which the code idthe-imagebitmaprenderingcontext-interface:dom-imagebitmaprenderingcontext-transferfromimagebitmap-5>a href#dom-imagebitmaprenderingcontext-transferfromimagebitmap>transferFromImageBitmap()/a>/code> method was called.li>p>If var>imageBitmap/var> is null, then run the steps to a href#set-an-imagebitmaprenderingcontexts-output-bitmap idthe-imagebitmaprenderingcontext-interface:set-an-imagebitmaprenderingcontexts-output-bitmap-2>set an ImageBitmapRenderingContexts output bitmap/a>, with var>bitmapContext/var> as the var>context/var> argument and no var>bitmap/var> argument, then abort these steps.li>p>If the value of var>imageBitmap/var>s a href#detached idthe-imagebitmaprenderingcontext-interface:detached>Detached/a> internal slot is set to true, then throw an a idthe-imagebitmaprenderingcontext-interface:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idthe-imagebitmaprenderingcontext-interface:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Run the steps to a href#set-an-imagebitmaprenderingcontexts-output-bitmap idthe-imagebitmaprenderingcontext-interface:set-an-imagebitmaprenderingcontexts-output-bitmap-3>set an code>ImageBitmapRenderingContext/code>s output bitmap/a>, with the var>context/var> argument equal to var>bitmapContext/var>, and the var>bitmap/var> argument referring to var>imageBitmap/var>s underlying a href#concept-imagebitmap-bitmap-data idthe-imagebitmaprenderingcontext-interface:concept-imagebitmap-bitmap-data-5>bitmap data/a>. li>p>Set the value of var>imageBitmap/var>s a href#detached idthe-imagebitmaprenderingcontext-interface:detached-2>Detached/a> internal slot to true.li>p>Unset var>imageBitmaps/var> a href#concept-imagebitmap-bitmap-data idthe-imagebitmaprenderingcontext-interface:concept-imagebitmap-bitmap-data-6>bitmap data/a>./ol> h5 idthe-offscreencanvas-interface>span classsecno>4.12.5.3/span> The code idthe-offscreencanvas-interface:offscreencanvas>a href#offscreencanvas>OffscreenCanvas/a>/code> interfacea href#the-offscreencanvas-interface classself-link>/a>/h5>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> offscreencanvasspan classand_chr no>span>Chrome for Android/span> span>None/span>/span>span classchrome no>span>Chrome/span> span>None/span>/span>span classios_saf no>span>iOS Safari/span> span>None/span>/span>span classand_uc no>span>UC Browser for Android/span> span>None/span>/span>span classfirefox no>span>Firefox/span> span>None/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung no>span>Samsung Internet/span> span>None/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari no>span>Safari/span> span>None/span>/span>span classedge no>span>Edge/span> span>None/span>/span>span classandroid no>span>Android Browser/span> span>None/span>/span>span classopera no>span>Opera/span> span>None/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featoffscreencanvas>caniuse.com/a>/div> pre classidl>typedef (a href#offscreencanvasrenderingcontext2d idthe-offscreencanvas-interface:offscreencanvasrenderingcontext2d>OffscreenCanvasRenderingContext2D/a> or a idthe-offscreencanvas-interface:webglrenderingcontext hrefhttps://www.khronos.org/registry/webgl/specs/latest/1.0/#WebGLRenderingContext data-x-internalwebglrenderingcontext>WebGLRenderingContext/a>) dfn idoffscreenrenderingcontext>OffscreenRenderingContext/dfn>;dictionary dfn idimageencodeoptions>ImageEncodeOptions/dfn> { DOMString a href#image-encode-options-type idthe-offscreencanvas-interface:image-encode-options-type>type/a> image/png; unrestricted double a href#image-encode-options-quality idthe-offscreencanvas-interface:image-encode-options-quality>quality/a> 1.0;};enum dfn idoffscreenrenderingcontexttype>OffscreenRenderingContextType/dfn> { a href#offscreen-context-type-2d idthe-offscreencanvas-interface:offscreen-context-type-2d>2d/a>, a href#offscreen-context-type-webgl idthe-offscreencanvas-interface:offscreen-context-type-webgl>webgl/a> };a href#dom-offscreencanvas idthe-offscreencanvas-interface:dom-offscreencanvas>Constructor/a>(EnforceRange unsigned long long width, EnforceRange unsigned long long height), Exposed(Window,Worker), a href#transferable idthe-offscreencanvas-interface:transferable>Transferable/a>interface dfn idoffscreencanvas>OffscreenCanvas/dfn> : a idthe-offscreencanvas-interface:eventtarget hrefhttps://dom.spec.whatwg.org/#interface-eventtarget data-x-internaleventtarget>EventTarget/a> { attribute unsigned long long a href#dom-offscreencanvas-width idthe-offscreencanvas-interface:dom-offscreencanvas-width>width/a>; attribute unsigned long long a href#dom-offscreencanvas-height idthe-offscreencanvas-interface:dom-offscreencanvas-height>height/a>; a href#offscreenrenderingcontext idthe-offscreencanvas-interface:offscreenrenderingcontext>OffscreenRenderingContext/a>? a href#dom-offscreencanvas-getcontext idthe-offscreencanvas-interface:dom-offscreencanvas-getcontext>getContext/a>(a href#offscreenrenderingcontexttype idthe-offscreencanvas-interface:offscreenrenderingcontexttype>OffscreenRenderingContextType/a> contextType, any... arguments); a href#imagebitmap idthe-offscreencanvas-interface:imagebitmap>ImageBitmap/a> a href#dom-offscreencanvas-transfertoimagebitmap idthe-offscreencanvas-interface:dom-offscreencanvas-transfertoimagebitmap>transferToImageBitmap/a>(); Promise<a idthe-offscreencanvas-interface:blob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob data-x-internalblob>Blob/a>> a href#dom-offscreencanvas-converttoblob idthe-offscreencanvas-interface:dom-offscreencanvas-converttoblob>convertToBlob/a>(optional a href#imageencodeoptions idthe-offscreencanvas-interface:imageencodeoptions>ImageEncodeOptions/a> options);};/pre> p>code idthe-offscreencanvas-interface:offscreencanvas-2>a href#offscreencanvas>OffscreenCanvas/a>/code> objects are used to create rendering contexts, much like an code idthe-offscreencanvas-interface:htmlcanvaselement>a href#htmlcanvaselement>HTMLCanvasElement/a>/code>, but with no connection to the DOM. This makes it possible to use canvas rendering contexts in a href#workers>workers/a>./p> p>An code idthe-offscreencanvas-interface:offscreencanvas-3>a href#offscreencanvas>OffscreenCanvas/a>/code> object may hold a weak reference to a dfn idoffscreencanvas-placeholder>placeholder code>canvas/code> element/dfn>, which is typically in the DOM, whose embedded content is provided by the code idthe-offscreencanvas-interface:offscreencanvas-4>a href#offscreencanvas>OffscreenCanvas/a>/code> object. The bitmap of the code idthe-offscreencanvas-interface:offscreencanvas-5>a href#offscreencanvas>OffscreenCanvas/a>/code> object is pushed to the a href#offscreencanvas-placeholder idthe-offscreencanvas-interface:offscreencanvas-placeholder>placeholder code>canvas/code> element/a> by calling the dfn idoffscreencontext-commit>code>commit()/code>/dfn> method of the code idthe-offscreencanvas-interface:offscreencanvas-6>a href#offscreencanvas>OffscreenCanvas/a>/code> objects rendering context. All rendering context types that can be created by an code idthe-offscreencanvas-interface:offscreencanvas-7>a href#offscreencanvas>OffscreenCanvas/a>/code> object must implement a code idthe-offscreencanvas-interface:offscreencontext-commit>a href#offscreencontext-commit>commit()/a>/code> method. The exact behavior of the commit method (e.g. whether it copies or transfers bitmaps) may vary, as defined by the rendering contexts respective specifications. Only the a href#offscreencanvasrenderingcontext2d idthe-offscreencanvas-interface:offscreencanvasrenderingcontext2d-2>2D context for offscreen canvases/a> is defined in this specification./p> dl classdomintro>dt>var>offscreenCanvas/var> new code idthe-offscreencanvas-interface:dom-offscreencanvas-2>a href#dom-offscreencanvas>OffscreenCanvas/a>/code>(var>width/var>, var>height/var>)dt> dd> p>Returns a new code idthe-offscreencanvas-interface:offscreencanvas-8>a href#offscreencanvas>OffscreenCanvas/a>/code> object that is not linked to a a href#offscreencanvas-placeholder idthe-offscreencanvas-interface:offscreencanvas-placeholder-2>placeholder code>canvas/code> element/a>, and whose bitmaps size is determined by the var>width/var> and var>height/var> arguments./p> dt>var>context/var> var>offscreenCanvas/var> . code idthe-offscreencanvas-interface:dom-offscreencanvas-getcontext-2>a href#dom-offscreencanvas-getcontext>getContext/a>/code>(var>contextType/var> , ... )dd> p>Returns an object that exposes an API for drawing on the code idthe-offscreencanvas-interface:offscreencanvas-9>a href#offscreencanvas>OffscreenCanvas/a>/code> object. The first argument specifies the desired API, either code idthe-offscreencanvas-interface:offscreen-context-type-2d-2>a href#offscreen-context-type-2d>2d/a>/code>, or code idthe-offscreencanvas-interface:offscreen-context-type-webgl-2>a href#offscreen-context-type-webgl>webgl/a>/code>. Subsequent arguments are handled by that API./p> p>This specification defines the code idthe-offscreencanvas-interface:canvas-context-2d>a href#canvas-context-2d>2d/a>/code> context below, which is similar but distinct from the code idthe-offscreencanvas-interface:offscreen-context-type-2d-3>a href#offscreen-context-type-2d>2d/a>/code> context that is created from a code idthe-offscreencanvas-interface:the-canvas-element>a href#the-canvas-element>canvas/a>/code> element. There is also a specification that defines a code idthe-offscreencanvas-interface:offscreen-context-type-webgl-3>a href#offscreen-context-type-webgl>webgl/a>/code> context. a href#refsWEBGL>WEBGL/a>/p> p>Returns null if the canvas has already been initialized with another context type (e.g. trying to get a code idthe-offscreencanvas-interface:offscreen-context-type-2d-4>a href#offscreen-context-type-2d>2d/a>/code> context after getting a code idthe-offscreencanvas-interface:offscreen-context-type-webgl-4>a href#offscreen-context-type-webgl>webgl/a>/code> context)./p> /dl> p>An code idthe-offscreencanvas-interface:offscreencanvas-10>a href#offscreencanvas>OffscreenCanvas/a>/code> object has an internal dfn idoffscreencanvas-bitmap>bitmap/dfn> that is initialized when the object is created. The width and height of the a href#offscreencanvas-bitmap idthe-offscreencanvas-interface:offscreencanvas-bitmap>bitmap/a> are equal to the values of the code idthe-offscreencanvas-interface:dom-offscreencanvas-width-2>a href#dom-offscreencanvas-width>width/a>/code> and code idthe-offscreencanvas-interface:dom-offscreencanvas-height-2>a href#dom-offscreencanvas-height>height/a>/code> attributes of the code idthe-offscreencanvas-interface:offscreencanvas-11>a href#offscreencanvas>OffscreenCanvas/a>/code> object. Initially, all the bitmaps pixels are a href#transparent-black idthe-offscreencanvas-interface:transparent-black>transparent black/a>./p> p>An code idthe-offscreencanvas-interface:offscreencanvas-12>a href#offscreencanvas>OffscreenCanvas/a>/code> object can have a rendering context bound to it. Initially, it does not have a bound rendering context. To keep track of whether it has a rendering context or not, and what kind of rendering context it is, an code idthe-offscreencanvas-interface:offscreencanvas-13>a href#offscreencanvas>OffscreenCanvas/a>/code> object also has a dfn idoffscreencanvas-context-mode>context mode/dfn>, which is initially dfn idoffscreencanvas-context-none>none/dfn> but can be changed to either dfn idoffscreencanvas-context-2d>2d/dfn>, dfn idoffscreencanvas-context-webgl>webgl/dfn> or dfn idoffscreencanvas-context-detached>detached/dfn> by algorithms defined in this specification./p> p>The constructor dfn iddom-offscreencanvas>code>OffscreenCanvas(var>width/var>, var>height/var>)/code>/dfn>, when invoked, must create a new code idthe-offscreencanvas-interface:offscreencanvas-14>a href#offscreencanvas>OffscreenCanvas/a>/code> object with its a href#offscreencanvas-bitmap idthe-offscreencanvas-interface:offscreencanvas-bitmap-2>bitmap/a> initialized to a rectangular array of a href#transparent-black idthe-offscreencanvas-interface:transparent-black-2>transparent black/a> pixels of the dimensions specified by var>width/var> and var>height/var>; and its code idthe-offscreencanvas-interface:dom-offscreencanvas-width-3>a href#dom-offscreencanvas-width>width/a>/code> and code idthe-offscreencanvas-interface:dom-offscreencanvas-height-3>a href#dom-offscreencanvas-height>height/a>/code> attributes initialized to var>width/var> and var>height/var> respectively./p> hr> p>code idthe-offscreencanvas-interface:offscreencanvas-15>a href#offscreencanvas>OffscreenCanvas/a>/code> objects are a href#transferable-objects idthe-offscreencanvas-interface:transferable-objects>transferable/a>. Their a href#transfer-steps idthe-offscreencanvas-interface:transfer-steps>transfer steps/a>, given var>value/var> and var>dataHolder/var>, are as follows:/p> ol>li>p>If var>value/var>s a href#offscreencanvas-context-mode idthe-offscreencanvas-interface:offscreencanvas-context-mode>context mode/a> is not equal to a href#offscreencanvas-context-none idthe-offscreencanvas-interface:offscreencanvas-context-none>none/a>, then throw an a idthe-offscreencanvas-interface:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idthe-offscreencanvas-interface:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Set var>value/var>s a href#offscreencanvas-context-mode idthe-offscreencanvas-interface:offscreencanvas-context-mode-2>context mode/a> to a href#offscreencanvas-context-detached idthe-offscreencanvas-interface:offscreencanvas-context-detached>detached/a>.li>p>Let var>width/var> and var>height/var> be the dimensions of var>value/var>s a href#offscreencanvas-bitmap idthe-offscreencanvas-interface:offscreencanvas-bitmap-3>bitmap/a>.li>p>Unset var>value/var>s a href#offscreencanvas-bitmap idthe-offscreencanvas-interface:offscreencanvas-bitmap-4>bitmap/a>.li>p>Set var>dataHolder/var>.With to var>width/var>, and var>dataHolder/var>.Height to var>height/var>.li>p>Set var>dataHolder/var>.PlaceholderCanvas to be a weak reference to var>value/var>s a href#offscreencanvas-placeholder idthe-offscreencanvas-interface:offscreencanvas-placeholder-3>placeholder code>canvas/code> element/a>, if var>value/var> has one, or null if it does not./ol> p>Their a href#transfer-receiving-steps idthe-offscreencanvas-interface:transfer-receiving-steps>transfer-receiving steps/a>, given var>dataHolder/var> and var>value/var>, are:/p> ol>li>p>Initialize var>value/var>s a href#offscreencanvas-bitmap idthe-offscreencanvas-interface:offscreencanvas-bitmap-5>bitmap/a> to a rectangular array of a href#transparent-black idthe-offscreencanvas-interface:transparent-black-3>transparent black/a> pixels with width given by var>dataHolder/var>.Width and height given by var>dataHolder/var>.Height.li>p>If var>dataHolder/var>.PlaceholderCanvas is not null, set var>value/var>s a href#offscreencanvas-placeholder idthe-offscreencanvas-interface:offscreencanvas-placeholder-4>placeholder code>canvas/code> element/a> to var>dataHolder/var>.PlaceholderCanvas (while maintaining the weak reference semantics)./ol> hr> p>The dfn iddom-offscreencanvas-getcontext>code>getContext(var>contextId/var>, var>arguments.../var>)/code>/dfn> method of an code idthe-offscreencanvas-interface:offscreencanvas-16>a href#offscreencanvas>OffscreenCanvas/a>/code> object, when invoked, must run the steps in the cell of the following table whose column header describes the code idthe-offscreencanvas-interface:offscreencanvas-17>a href#offscreencanvas>OffscreenCanvas/a>/code> objects a href#offscreencanvas-context-mode idthe-offscreencanvas-interface:offscreencanvas-context-mode-3>context mode/a> and whose row header describes the methods first argument./p> table>thead>tr>td> th>a href#offscreencanvas-context-none idthe-offscreencanvas-interface:offscreencanvas-context-none-2>none/a> th>a href#offscreencanvas-context-2d idthe-offscreencanvas-interface:offscreencanvas-context-2d>2d/a> th>a href#offscreencanvas-context-webgl idthe-offscreencanvas-interface:offscreencanvas-context-webgl>webgl/a> th>a href#offscreencanvas-context-detached idthe-offscreencanvas-interface:offscreencanvas-context-detached-2>detached/a> tbody>tr>th>dfn idoffscreen-context-type-2d>code>2d/code>/dfn> td> Follow the steps to a href#offscreen-2d-context-creation-algorithm idthe-offscreencanvas-interface:offscreen-2d-context-creation-algorithm>create an offscreen 2D context/a> defined in the section below, passing it the code idthe-offscreencanvas-interface:offscreencanvas-18>a href#offscreencanvas>OffscreenCanvas/a>/code> object and the methods var>arguments.../var>, to obtain an code idthe-offscreencanvas-interface:offscreencanvasrenderingcontext2d-3>a href#offscreencanvasrenderingcontext2d>OffscreenCanvasRenderingContext2D/a>/code> object; if this does not throw an exception, then set the code idthe-offscreencanvas-interface:offscreencanvas-19>a href#offscreencanvas>OffscreenCanvas/a>/code> objects a href#offscreencanvas-context-mode idthe-offscreencanvas-interface:offscreencanvas-context-mode-4>context mode/a> to a href#offscreencanvas-context-2d idthe-offscreencanvas-interface:offscreencanvas-context-2d-2>2d/a>, and return the new code idthe-offscreencanvas-interface:offscreencanvasrenderingcontext2d-4>a href#offscreencanvasrenderingcontext2d>OffscreenCanvasRenderingContext2D/a>/code> object. td> Return the same object as was returned the last time the method was invoked with this same first argument. td> Return null. td> Throw an a idthe-offscreencanvas-interface:invalidstateerror-2 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idthe-offscreencanvas-interface:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>. tr>th>dfn idoffscreen-context-type-webgl>code>webgl/code>/dfn> td> Follow the instructions given in the WebGL specifications i>Context Creation/i> section to obtain either a code idthe-offscreencanvas-interface:webglrenderingcontext-2>a data-x-internalwebglrenderingcontext hrefhttps://www.khronos.org/registry/webgl/specs/latest/1.0/#WebGLRenderingContext>WebGLRenderingContext/a>/code> or null; if the returned value is null, then return null and abort these steps, otherwise, set the code idthe-offscreencanvas-interface:offscreencanvas-20>a href#offscreencanvas>OffscreenCanvas/a>/code> objects a href#offscreencanvas-context-mode idthe-offscreencanvas-interface:offscreencanvas-context-mode-5>context mode/a> to a href#offscreencanvas-context-webgl idthe-offscreencanvas-interface:offscreencanvas-context-webgl-2>webgl/a>, and return the code idthe-offscreencanvas-interface:webglrenderingcontext-3>a data-x-internalwebglrenderingcontext hrefhttps://www.khronos.org/registry/webgl/specs/latest/1.0/#WebGLRenderingContext>WebGLRenderingContext/a>/code> object. a href#refsWEBGL>WEBGL/a> td> Return null. td> Return the same value as was returned the last time the method was invoked with this same first argument. td> Throw an a idthe-offscreencanvas-interface:invalidstateerror-3 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idthe-offscreencanvas-interface:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>. /table> hr> dl classdomintro>dt>var>offscreenCanvas/var> . code idthe-offscreencanvas-interface:dom-offscreencanvas-width-4>a href#dom-offscreencanvas-width>width/a>/code> var>value/var> dt>var>offscreenCanvas/var> . code idthe-offscreencanvas-interface:dom-offscreencanvas-height-4>a href#dom-offscreencanvas-height>height/a>/code> var>value/var> dd> p>These attributes return the dimensions of the code idthe-offscreencanvas-interface:offscreencanvas-21>a href#offscreencanvas>OffscreenCanvas/a>/code> objects a href#offscreencanvas-bitmap idthe-offscreencanvas-interface:offscreencanvas-bitmap-6>bitmap/a>./p> p>They can be set, to replace the a href#offscreencanvas-bitmap idthe-offscreencanvas-interface:offscreencanvas-bitmap-7>bitmap/a> with a new, a href#transparent-black idthe-offscreencanvas-interface:transparent-black-4>transparent black/a> bitmap of the specified dimensions (effectively resizing it)./p> /dl> p>If either the dfn iddom-offscreencanvas-width>code>width/code>/dfn> or dfn iddom-offscreencanvas-height>code>height/code>/dfn> attributes of an code idthe-offscreencanvas-interface:offscreencanvas-22>a href#offscreencanvas>OffscreenCanvas/a>/code> object are set (to a new value or to the same value as before) and the code idthe-offscreencanvas-interface:offscreencanvas-23>a href#offscreencanvas>OffscreenCanvas/a>/code> objects a href#offscreencanvas-context-mode idthe-offscreencanvas-interface:offscreencanvas-context-mode-6>context mode/a> is a href#offscreencanvas-context-2d idthe-offscreencanvas-interface:offscreencanvas-context-2d-3>2d/a>, then replace the code idthe-offscreencanvas-interface:offscreencanvas-24>a href#offscreencanvas>OffscreenCanvas/a>/code> objects a href#offscreencanvas-bitmap idthe-offscreencanvas-interface:offscreencanvas-bitmap-8>bitmap/a> with a new a href#transparent-black idthe-offscreencanvas-interface:transparent-black-5>transparent black/a> bitmap and a href#reset-the-rendering-context-to-its-default-state idthe-offscreencanvas-interface:reset-the-rendering-context-to-its-default-state>reset the rendering context to its default state/a>. The new bitmaps dimensions are equal to the new values of the code idthe-offscreencanvas-interface:dom-offscreencanvas-width-5>a href#dom-offscreencanvas-width>width/a>/code> and code idthe-offscreencanvas-interface:dom-offscreencanvas-height-5>a href#dom-offscreencanvas-height>height/a>/code> attributes./p> p>The resizing behavior for code idthe-offscreencanvas-interface:offscreen-context-type-webgl-5>a href#offscreen-context-type-webgl>webgl/a>/code> contexts is defined in the WebGL specification. a href#refsWEBGL>WEBGL/a>/p> p classnote>If an code idthe-offscreencanvas-interface:offscreencanvas-25>a href#offscreencanvas>OffscreenCanvas/a>/code> object whose dimensions were changed has a a href#offscreencanvas-placeholder idthe-offscreencanvas-interface:offscreencanvas-placeholder-5>placeholder code>canvas/code> element/a>, then the a href#offscreencanvas-placeholder idthe-offscreencanvas-interface:offscreencanvas-placeholder-6>placeholder code>canvas/code> element/a>s a hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic idthe-offscreencanvas-interface:intrinsic-dimensions data-x-internalintrinsic-dimensions>intrinsic size/a> will only be updated via the code idthe-offscreencanvas-interface:offscreencontext-commit-2>a href#offscreencontext-commit>commit()/a>/code> method of the code idthe-offscreencanvas-interface:offscreencanvas-26>a href#offscreencanvas>OffscreenCanvas/a>/code> objects rendering context./p> dl classdomintro>dt>var>promise/var> var>offscreenCanvas/var> . code idthe-offscreencanvas-interface:dom-offscreencanvas-converttoblob-2>a href#dom-offscreencanvas-converttoblob>convertToBlob/a>/code>( var>options/var> )dd> p>Returns a promise that will fulfill with a new code idthe-offscreencanvas-interface:blob-2>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> object representing a file containing the image in the code idthe-offscreencanvas-interface:offscreencanvas-27>a href#offscreencanvas>OffscreenCanvas/a>/code> object./p> p>The argument, if provided, is a dictionary that controls the encoding options of the image file to be created. The code idthe-offscreencanvas-interface:image-encode-options-type-2>a href#image-encode-options-type>type/a>/code> field specifies the file format and has a default value of code idthe-offscreencanvas-interface:image/png>a href#image/png>image/png/a>/code>; that type is also used if the requested type isnt supported. If the image format supports variable quality (such as code idthe-offscreencanvas-interface:image/jpeg>a href#image/jpeg>image/jpeg/a>/code>), then the code idthe-offscreencanvas-interface:image-encode-options-quality-2>a href#image-encode-options-quality>quality/a>/code> field is a number in the range 0.0 to 1.0 inclusive indicating the desired quality level for the resulting image./p> dt>var>canvas/var> . code idthe-offscreencanvas-interface:dom-offscreencanvas-transfertoimagebitmap-2>a href#dom-offscreencanvas-transfertoimagebitmap>transferToImageBitmap/a>/code>()dd> p>Returns a newly created code idthe-offscreencanvas-interface:imagebitmap-2>a href#imagebitmap>ImageBitmap/a>/code> object with the image in the code idthe-offscreencanvas-interface:offscreencanvas-28>a href#offscreencanvas>OffscreenCanvas/a>/code> object. The image in the code idthe-offscreencanvas-interface:offscreencanvas-29>a href#offscreencanvas>OffscreenCanvas/a>/code> object is replaced with a new blank image./p> /dl> p>The dfn iddom-offscreencanvas-converttoblob>code>convertToBlob(var>options/var>)/code>/dfn> method, when invoked, must run the following steps:/p> ol>li>p>If the value of this code idthe-offscreencanvas-interface:offscreencanvas-30>a href#offscreencanvas>OffscreenCanvas/a>/code> objects a href#detached idthe-offscreencanvas-interface:detached>Detached/a> internal slot is set to true, then return a promise rejected with an a idthe-offscreencanvas-interface:invalidstateerror-4 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idthe-offscreencanvas-interface:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>If this code idthe-offscreencanvas-interface:offscreencanvas-31>a href#offscreencanvas>OffscreenCanvas/a>/code> objects a href#offscreencanvas-context-mode idthe-offscreencanvas-interface:offscreencanvas-context-mode-7>context mode/a> is a href#offscreencanvas-context-2d idthe-offscreencanvas-interface:offscreencanvas-context-2d-4>2d/a> and the rendering contexts a href#offscreencontext2d-bitmap idthe-offscreencanvas-interface:offscreencontext2d-bitmap>bitmap/a>s a href#offscreencontext2d-origin-clean idthe-offscreencanvas-interface:offscreencontext2d-origin-clean>origin-clean/a> flag is set to false, then return a promise rejected with a a idthe-offscreencanvas-interface:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-offscreencanvas-interface:domexception-5>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps./p> li>p>If this code idthe-offscreencanvas-interface:offscreencanvas-32>a href#offscreencanvas>OffscreenCanvas/a>/code> objects a href#offscreencanvas-bitmap idthe-offscreencanvas-interface:offscreencanvas-bitmap-9>bitmap/a> has no pixels (i.e. either its horizontal dimension or its vertical dimension is zero) then return a promise rejected with an a idthe-offscreencanvas-interface:indexsizeerror hrefhttps://heycam.github.io/webidl/#indexsizeerror data-x-internalindexsizeerror>code>IndexSizeError/code>/a> code idthe-offscreencanvas-interface:domexception-6>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Let var>result/var> be a new promise object.li>p>Return var>result/var>, and a href#queue-a-task idthe-offscreencanvas-interface:queue-a-task>queue a task/a> to run the remaining steps a href#in-parallel idthe-offscreencanvas-interface:in-parallel>in parallel/a>.li>p>Let var>blob/var> be a code idthe-offscreencanvas-interface:blob-3>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> object, created in the a href#concept-relevant-realm idthe-offscreencanvas-interface:concept-relevant-realm>relevant Realm/a> of this code idthe-offscreencanvas-interface:offscreencanvas-33>a href#offscreencanvas>OffscreenCanvas/a>/code> object, representing a href#a-serialisation-of-the-bitmap-as-a-file idthe-offscreencanvas-interface:a-serialisation-of-the-bitmap-as-a-file>a serialization of this code>OffscreenCanvas/code> objects span>bitmap/span> as a file/a>, passing the values of the dfn idimage-encode-options-type>code>type/code>/dfn> and dfn idimage-encode-options-quality>code>quality/code>/dfn> fields of var>options/var>, if var>options/var> was specified. a href#refsFILEAPI>FILEAPI/a>li>p>If var>blob/var> is null, then reject var>result/var> with an a idthe-offscreencanvas-interface:encodingerror hrefhttps://heycam.github.io/webidl/#encodingerror data-x-internalencodingerror>code>EncodingError/code>/a> code idthe-offscreencanvas-interface:domexception-7>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Otherwise, resolve var>result/var> with var>blob/var>./ol> p>The dfn iddom-offscreencanvas-transfertoimagebitmap>code>transferToImageBitmap()/code>/dfn> method, when invoked, must run the following steps:/p> ol>li>p>If the value of this code idthe-offscreencanvas-interface:offscreencanvas-34>a href#offscreencanvas>OffscreenCanvas/a>/code> objects a href#detached idthe-offscreencanvas-interface:detached-2>Detached/a> internal slot is set to true, then throw an a idthe-offscreencanvas-interface:invalidstateerror-5 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idthe-offscreencanvas-interface:domexception-8>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>If this code idthe-offscreencanvas-interface:offscreencanvas-35>a href#offscreencanvas>OffscreenCanvas/a>/code> objects a href#offscreencanvas-context-mode idthe-offscreencanvas-interface:offscreencanvas-context-mode-8>context mode/a> is set to a href#offscreencanvas-context-none idthe-offscreencanvas-interface:offscreencanvas-context-none-3>none/a>, then throw an a idthe-offscreencanvas-interface:invalidstateerror-6 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idthe-offscreencanvas-interface:domexception-9>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Let var>image/var> be a newly created code idthe-offscreencanvas-interface:imagebitmap-3>a href#imagebitmap>ImageBitmap/a>/code> object that references the same underlying bitmap data as this code idthe-offscreencanvas-interface:offscreencanvas-36>a href#offscreencanvas>OffscreenCanvas/a>/code> objects a href#offscreencanvas-bitmap idthe-offscreencanvas-interface:offscreencanvas-bitmap-10>bitmap/a>.li>p>Set this code idthe-offscreencanvas-interface:offscreencanvas-37>a href#offscreencanvas>OffscreenCanvas/a>/code> objects a href#offscreencanvas-bitmap idthe-offscreencanvas-interface:offscreencanvas-bitmap-11>bitmap/a> to reference a newly created bitmap of the same dimensions as the previous bitmap, and with its pixels initialized to a href#transparent-black idthe-offscreencanvas-interface:transparent-black-6>transparent black/a>, or opaque black if the rendering contexts a href#offscreencontext2d-alpha idthe-offscreencanvas-interface:offscreencontext2d-alpha>alpha/a> flag is set to false.li>p>Return var>image/var>./ol> h6 idthe-offscreen-2d-rendering-context>span classsecno>4.12.5.3.1/span> The offscreen 2D rendering contexta href#the-offscreen-2d-rendering-context classself-link>/a>/h6> pre classidl>Exposed(Window,Worker)interface a href#offscreencanvasrenderingcontext2d idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d>OffscreenCanvasRenderingContext2D/a> { void a href#offscreencontext2d-commit idthe-offscreen-2d-rendering-context:offscreencontext2d-commit>commit/a>(); readonly attribute a href#offscreencanvas idthe-offscreen-2d-rendering-context:offscreencanvas>OffscreenCanvas/a> a href#offscreencontext2d-canvas idthe-offscreen-2d-rendering-context:offscreencontext2d-canvas>canvas/a>;};a href#offscreencanvasrenderingcontext2d idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-2>OffscreenCanvasRenderingContext2D/a> implements a href#canvasstate idthe-offscreen-2d-rendering-context:canvasstate>CanvasState/a>;a href#offscreencanvasrenderingcontext2d idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-3>OffscreenCanvasRenderingContext2D/a> implements a href#canvastransform idthe-offscreen-2d-rendering-context:canvastransform>CanvasTransform/a>;a href#offscreencanvasrenderingcontext2d idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-4>OffscreenCanvasRenderingContext2D/a> implements a href#canvascompositing idthe-offscreen-2d-rendering-context:canvascompositing>CanvasCompositing/a>;a href#offscreencanvasrenderingcontext2d idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-5>OffscreenCanvasRenderingContext2D/a> implements a href#canvasimagesmoothing idthe-offscreen-2d-rendering-context:canvasimagesmoothing>CanvasImageSmoothing/a>;a href#offscreencanvasrenderingcontext2d idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-6>OffscreenCanvasRenderingContext2D/a> implements a href#canvasfillstrokestyles idthe-offscreen-2d-rendering-context:canvasfillstrokestyles>CanvasFillStrokeStyles/a>;a href#offscreencanvasrenderingcontext2d idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-7>OffscreenCanvasRenderingContext2D/a> implements a href#canvasshadowstyles idthe-offscreen-2d-rendering-context:canvasshadowstyles>CanvasShadowStyles/a>;a href#offscreencanvasrenderingcontext2d idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-8>OffscreenCanvasRenderingContext2D/a> implements a href#canvasfilters idthe-offscreen-2d-rendering-context:canvasfilters>CanvasFilters/a>;a href#offscreencanvasrenderingcontext2d idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-9>OffscreenCanvasRenderingContext2D/a> implements a href#canvasrect idthe-offscreen-2d-rendering-context:canvasrect>CanvasRect/a>;a href#offscreencanvasrenderingcontext2d idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-10>OffscreenCanvasRenderingContext2D/a> implements a href#canvasdrawpath idthe-offscreen-2d-rendering-context:canvasdrawpath>CanvasDrawPath/a>;a href#offscreencanvasrenderingcontext2d idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-11>OffscreenCanvasRenderingContext2D/a> implements a href#canvasdrawimage idthe-offscreen-2d-rendering-context:canvasdrawimage>CanvasDrawImage/a>;a href#offscreencanvasrenderingcontext2d idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-12>OffscreenCanvasRenderingContext2D/a> implements a href#canvasimagedata idthe-offscreen-2d-rendering-context:canvasimagedata>CanvasImageData/a>;a href#offscreencanvasrenderingcontext2d idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-13>OffscreenCanvasRenderingContext2D/a> implements a href#canvaspathdrawingstyles idthe-offscreen-2d-rendering-context:canvaspathdrawingstyles>CanvasPathDrawingStyles/a>;a href#offscreencanvasrenderingcontext2d idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-14>OffscreenCanvasRenderingContext2D/a> implements a href#canvaspath idthe-offscreen-2d-rendering-context:canvaspath>CanvasPath/a>;/pre> p>The dfn idoffscreencanvasrenderingcontext2d>code>OffscreenCanvasRenderingContext2D/code>/dfn> is a rendering context interface for drawing to the a href#offscreencanvas-bitmap idthe-offscreen-2d-rendering-context:offscreencanvas-bitmap>bitmap/a> of an code idthe-offscreen-2d-rendering-context:offscreencanvas-2>a href#offscreencanvas>OffscreenCanvas/a>/code> object. It is similar to code idthe-offscreen-2d-rendering-context:canvasrenderingcontext2d>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code>, with the following differences:/p> ul>li>p>a href#canvastext idthe-offscreen-2d-rendering-context:canvastext>text rendering/a> is not supported;li>p>there is no support for a href#canvasuserinterface idthe-offscreen-2d-rendering-context:canvasuserinterface>user interface/a> features;li>p>its code idthe-offscreen-2d-rendering-context:offscreencontext2d-canvas-2>a href#offscreencontext2d-canvas>canvas/a>/code> attribute refers to an code idthe-offscreen-2d-rendering-context:offscreencanvas-3>a href#offscreencanvas>OffscreenCanvas/a>/code> object rather than a code idthe-offscreen-2d-rendering-context:the-canvas-element>a href#the-canvas-element>canvas/a>/code> element;li>p>it has a code idthe-offscreen-2d-rendering-context:offscreencontext2d-commit-2>a href#offscreencontext2d-commit>commit()/a>/code> method for pushing the rendered image to the contexts code idthe-offscreen-2d-rendering-context:offscreencanvas-4>a href#offscreencanvas>OffscreenCanvas/a>/code> objects a href#offscreencanvas-placeholder idthe-offscreen-2d-rendering-context:offscreencanvas-placeholder>placeholder code>canvas/code> element/a>./ul> p>An code idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-15>a href#offscreencanvasrenderingcontext2d>OffscreenCanvasRenderingContext2D/a>/code> object has a dfn idoffscreencontext2d-bitmap>bitmap/dfn> that is initialized when the object is created./p> p>The a href#offscreencontext2d-bitmap idthe-offscreen-2d-rendering-context:offscreencontext2d-bitmap>bitmap/a> has an dfn idoffscreencontext2d-origin-clean>origin-clean/dfn> flag, which can be set to true or false. Initially, when one of these bitmaps is created, its a href#offscreencontext2d-origin-clean idthe-offscreen-2d-rendering-context:offscreencontext2d-origin-clean>origin-clean/a> flag must be set to true./p> p>An code idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-16>a href#offscreencanvasrenderingcontext2d>OffscreenCanvasRenderingContext2D/a>/code> object also has an dfn idoffscreencontext2d-alpha>alpha/dfn> flag, which can be set to true or false. Initially, when the context is created, its alpha flag must be set to true. When an code idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-17>a href#offscreencanvasrenderingcontext2d>OffscreenCanvasRenderingContext2D/a>/code> object has its a href#offscreencontext2d-alpha idthe-offscreen-2d-rendering-context:offscreencontext2d-alpha>alpha/a> flag set to false, then its alpha channel must be fixed to 1.0 (fully opaque) for all pixels, and attempts to change the alpha component of any pixel must be silently ignored./p> p>An code idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-18>a href#offscreencanvasrenderingcontext2d>OffscreenCanvasRenderingContext2D/a>/code> object has an dfn idassociated-offscreencanvas-object>associated code>OffscreenCanvas/code> object/dfn>, which is the code idthe-offscreen-2d-rendering-context:offscreencanvas-5>a href#offscreencanvas>OffscreenCanvas/a>/code> object from which the code idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-19>a href#offscreencanvasrenderingcontext2d>OffscreenCanvasRenderingContext2D/a>/code> object was created. dl classdomintro>dt>var>offscreenCanvasRenderingContext2D/var> . code idthe-offscreen-2d-rendering-context:offscreencontext2d-commit-3>a href#offscreencontext2d-commit>commit/a>/code>()dd> p>Copies the rendering contexts a href#offscreencontext2d-bitmap idthe-offscreen-2d-rendering-context:offscreencontext2d-bitmap-2>bitmap/a> to the bitmap of the a href#offscreencanvas-placeholder idthe-offscreen-2d-rendering-context:offscreencanvas-placeholder-2>placeholder code>canvas/code> element/a> of the a href#associated-offscreencanvas-object idthe-offscreen-2d-rendering-context:associated-offscreencanvas-object>associated code>OffscreenCanvas/code> object/a>. The copy operation is asynchronous./p> dt>var>offscreenCanvas/var> var>offscreenCanvasRenderingContext2D/var> . code idthe-offscreen-2d-rendering-context:offscreencontext2d-canvas-3>a href#offscreencontext2d-canvas>canvas/a>/code>dd> p>Returns the a href#associated-offscreencanvas-object idthe-offscreen-2d-rendering-context:associated-offscreencanvas-object-2>associated code>OffscreenCanvas/code> object/a>./p> /dl> p>The dfn idoffscreen-2d-context-creation-algorithm>offscreen 2D context creation algorithm/dfn>, which is passed a var>target/var> (an code idthe-offscreen-2d-rendering-context:offscreencanvas-6>a href#offscreencanvas>OffscreenCanvas/a>/code> object) and optionally some arguments, consists of running the following steps:/p> ol>li>p>If the algorithm was passed some arguments, let var>arg/var> be the first such argument. Otherwise, let var>arg/var> be undefined.li>p>Let var>settings/var> be the result of a href#coerce-context-arguments-for-2d idthe-offscreen-2d-rendering-context:coerce-context-arguments-for-2d>coercing the var>arg/var> context arguments for 2D/a>.li>p>Let var>context/var> be a new code idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-20>a href#offscreencanvasrenderingcontext2d>OffscreenCanvasRenderingContext2D/a>/code> object.li>p>Set var>context/var>s a href#associated-offscreencanvas-object idthe-offscreen-2d-rendering-context:associated-offscreencanvas-object-3>associated code>OffscreenCanvas/code> object/a> to var>target/var>.li>p>Process each of the members of var>settings/var> as follows:/p> dl>dt>code idthe-offscreen-2d-rendering-context:dom-canvasrenderingcontext2dsettings-alpha>a href#dom-canvasrenderingcontext2dsettings-alpha>alpha/a>/code>dd>If false, set var>context/var>s a href#offscreencontext2d-alpha idthe-offscreen-2d-rendering-context:offscreencontext2d-alpha-2>alpha/a> flag to false./dl> li>p>Set var>context/var>s a href#offscreencontext2d-bitmap idthe-offscreen-2d-rendering-context:offscreencontext2d-bitmap-3>bitmap/a> to a newly created bitmap with the dimensions specified by the code idthe-offscreen-2d-rendering-context:dom-offscreencanvas-width>a href#dom-offscreencanvas-width>width/a>/code> and code idthe-offscreen-2d-rendering-context:dom-offscreencanvas-height>a href#dom-offscreencanvas-height>height/a>/code> attributes of var>target/var>, and set var>target/var>s bitmap to the same bitmap (so that they are shared).li>p>If var>context/var>s a href#offscreencontext2d-alpha idthe-offscreen-2d-rendering-context:offscreencontext2d-alpha-3>alpha/a> flag is set to true, initialize all the pixels of var>context/var>s a href#offscreencontext2d-bitmap idthe-offscreen-2d-rendering-context:offscreencontext2d-bitmap-4>bitmap/a> to a href#transparent-black idthe-offscreen-2d-rendering-context:transparent-black>transparent black/a>. Otherwise, initialize the pixels to opaque black.li>p>Return var>context/var>./ol> p>The dfn idoffscreencontext2d-commit>code>commit()/code>/dfn> method, when invoked, must run the following steps:/p> ol>li>p>If this code idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-21>a href#offscreencanvasrenderingcontext2d>OffscreenCanvasRenderingContext2D/a>/code>s a href#associated-offscreencanvas-object idthe-offscreen-2d-rendering-context:associated-offscreencanvas-object-4>associated code>OffscreenCanvas/code> object/a> does not have a a href#offscreencanvas-placeholder idthe-offscreen-2d-rendering-context:offscreencanvas-placeholder-3>placeholder code>canvas/code> element/a>, abort these steps.li>p>Let var>image/var> be a copy of this code idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-22>a href#offscreencanvasrenderingcontext2d>OffscreenCanvasRenderingContext2D/a>/code>s a href#offscreencontext2d-bitmap idthe-offscreen-2d-rendering-context:offscreencontext2d-bitmap-5>bitmap/a>, including the value of its a href#offscreencontext2d-origin-clean idthe-offscreen-2d-rendering-context:offscreencontext2d-origin-clean-2>origin-clean/a> flag.li> p>a href#queue-a-task idthe-offscreen-2d-rendering-context:queue-a-task>Queue a task/a> in the a href#offscreencanvas-placeholder idthe-offscreen-2d-rendering-context:offscreencanvas-placeholder-4>placeholder code>canvas/code> element/a>s a href#relevant-settings-object idthe-offscreen-2d-rendering-context:relevant-settings-object>relevant settings object/a>s a href#responsible-event-loop idthe-offscreen-2d-rendering-context:responsible-event-loop>responsible event loop/a> (which will be a a href#browsing-context idthe-offscreen-2d-rendering-context:browsing-context>browsing context/a> a href#event-loop idthe-offscreen-2d-rendering-context:event-loop>event loop/a>) to set the a href#offscreencanvas-placeholder idthe-offscreen-2d-rendering-context:offscreencanvas-placeholder-5>placeholder code>canvas/code> element/a>s a href#output-bitmap idthe-offscreen-2d-rendering-context:output-bitmap>output bitmap/a> to be a reference to var>image/var>./p> p classnote>If var>image/var> has different dimensions than the bitmap previously referenced as the a href#offscreencanvas-placeholder idthe-offscreen-2d-rendering-context:offscreencanvas-placeholder-6>placeholder code>canvas/code> element/a>s a href#output-bitmap idthe-offscreen-2d-rendering-context:output-bitmap-2>output bitmap/a>, then this task will result in a change in the a href#offscreencanvas-placeholder idthe-offscreen-2d-rendering-context:offscreencanvas-placeholder-7>placeholder code>canvas/code> element/a>s a hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic idthe-offscreen-2d-rendering-context:intrinsic-dimensions data-x-internalintrinsic-dimensions>intrinsic size/a>, which can affect document layout./p> /ol> p classnote>Implementations are encouraged to short-circuit the graphics update steps of the a href#browsing-context idthe-offscreen-2d-rendering-context:browsing-context-2>browsing context/a> a href#event-loop idthe-offscreen-2d-rendering-context:event-loop-2>event loop/a> for the purposes of updating the contents of a a href#offscreencanvas-placeholder idthe-offscreen-2d-rendering-context:offscreencanvas-placeholder-8>placeholder code>canvas/code> element/a> to the display. This could mean, for example, that the code idthe-offscreen-2d-rendering-context:offscreencontext2d-commit-4>a href#offscreencontext2d-commit>commit()/a>/code> method can copy the bitmap contents directly to a graphics buffer that is mapped to the physical display location of the a href#offscreencanvas-placeholder idthe-offscreen-2d-rendering-context:offscreencanvas-placeholder-9>placeholder code>canvas/code> element/a>. This or similar short-circuiting approaches can significantly reduce display latency, especially in cases where the code idthe-offscreen-2d-rendering-context:offscreencontext2d-commit-5>a href#offscreencontext2d-commit>commit()/a>/code> method is invoked from a worker and the a href#event-loop idthe-offscreen-2d-rendering-context:event-loop-3>event loop/a> of the a href#offscreencanvas-placeholder idthe-offscreen-2d-rendering-context:offscreencanvas-placeholder-10>placeholder code>canvas/code> element/a>s a href#browsing-context idthe-offscreen-2d-rendering-context:browsing-context-3>browsing context/a> is busy. However, such shortcuts can not have any script-observable side-effects. This means that the committed bitmap still needs to be sent to the a href#offscreencanvas-placeholder idthe-offscreen-2d-rendering-context:offscreencanvas-placeholder-11>placeholder code>canvas/code> element/a>, in case the element is used as a code idthe-offscreen-2d-rendering-context:canvasimagesource>a href#canvasimagesource>CanvasImageSource/a>/code>, as an code idthe-offscreen-2d-rendering-context:imagebitmapsource>a href#imagebitmapsource>ImageBitmapSource/a>/code>, or in case code idthe-offscreen-2d-rendering-context:dom-canvas-todataurl>a href#dom-canvas-todataurl>toDataURL()/a>/code> or code idthe-offscreen-2d-rendering-context:dom-canvas-toblob>a href#dom-canvas-toblob>toBlob()/a>/code> are called on it./p> p>The dfn idoffscreencontext2d-canvas>code>canvas/code>/dfn> attribute, on getting, must return this code idthe-offscreen-2d-rendering-context:offscreencanvasrenderingcontext2d-23>a href#offscreencanvasrenderingcontext2d>OffscreenCanvasRenderingContext2D/a>/code>s a href#associated-offscreencanvas-object idthe-offscreen-2d-rendering-context:associated-offscreencanvas-object-5>associated code>OffscreenCanvas/code> object/a>. /p> h5 idcolour-spaces-and-colour-correction>span classsecno>4.12.5.4/span> Color spaces and color correctiona href#colour-spaces-and-colour-correction classself-link>/a>/h5> p>The code idcolour-spaces-and-colour-correction:the-canvas-element>a href#the-canvas-element>canvas/a>/code> APIs must perform color correction at only two points: when rendering images with their own gamma correction and color space information onto a bitmap, to convert the image to the color space used by the bitmaps (e.g. using the 2D Contexts code idcolour-spaces-and-colour-correction:dom-context-2d-drawimage>a href#dom-context-2d-drawimage>drawImage()/a>/code> method with an code idcolour-spaces-and-colour-correction:htmlorsvgimageelement>a href#htmlorsvgimageelement>HTMLOrSVGImageElement/a>/code> object), and when rendering the actual canvas bitmap to the output device./p> p classnote>Thus, in the 2D context, colors used to draw shapes onto the canvas will exactly match colors obtained through the code idcolour-spaces-and-colour-correction:dom-context-2d-getimagedata>a href#dom-context-2d-getimagedata>getImageData()/a>/code> method./p> p>The code idcolour-spaces-and-colour-correction:dom-canvas-todataurl>a href#dom-canvas-todataurl>toDataURL()/a>/code> method, when invoked, must not include color space information in the resources they return. Where the output format allows it, the color of pixels in resources created by code idcolour-spaces-and-colour-correction:dom-canvas-todataurl-2>a href#dom-canvas-todataurl>toDataURL()/a>/code> must match those returned by the code idcolour-spaces-and-colour-correction:dom-context-2d-getimagedata-2>a href#dom-context-2d-getimagedata>getImageData()/a>/code> method./p> p>In user agents that support CSS, the color space used by a code idcolour-spaces-and-colour-correction:the-canvas-element-2>a href#the-canvas-element>canvas/a>/code> element must match the color space used for processing any colors for that element in CSS./p> p>The gamma correction and color space information of images must be handled in such a way that an image rendered directly using an code idcolour-spaces-and-colour-correction:the-img-element>a href#the-img-element>img/a>/code> element would use the same colors as one painted on a code idcolour-spaces-and-colour-correction:the-canvas-element-3>a href#the-canvas-element>canvas/a>/code> element that is then itself rendered. Furthermore, the rendering of images that have no color correction information (such as those returned by the code idcolour-spaces-and-colour-correction:dom-canvas-todataurl-3>a href#dom-canvas-todataurl>toDataURL()/a>/code> method) must be rendered with no color correction./p> p classnote>Thus, in the 2D context, calling the code idcolour-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 idcolour-spaces-and-colour-correction:dom-canvas-todataurl-4>a href#dom-canvas-todataurl>toDataURL()/a>/code> method to the canvas, given the appropriate dimensions, has no visible effect./p> h5 idserialising-bitmaps-to-a-file>span classsecno>4.12.5.5/span> Serializing bitmaps to a filea href#serialising-bitmaps-to-a-file classself-link>/a>/h5> p>When a user agent is to create dfn ida-serialisation-of-the-bitmap-as-a-file>a serialization of the bitmap as a file/dfn>, given an optional var>type/var> and var>quality/var>, it must create an image file in the format given by var>type/var>, or if var>type/var> was not supplied, in the PNG format. If an error occurs during the creation of the image file (e.g. an internal encoder error), then the result of the serialization is null. a href#refsPNG>PNG/a>/p> p>The image files pixel data must be the bitmaps pixel data scaled to one image pixel per coordinate space unit, and if the file format used supports encoding resolution metadata, the resolution must be given as 96dpi (one image pixel per a hrefhttps://drafts.csswg.org/css-values/#px idserialising-bitmaps-to-a-file:px data-x-internalpx>CSS pixel/a>)./p> p>If var>type/var> is supplied, then it must be interpreted as a a hrefhttps://mimesniff.spec.whatwg.org/#mime-type idserialising-bitmaps-to-a-file:mime-type data-x-internalmime-type>MIME type/a> giving the format to use. If the type has any parameters, then it must be treated as not supported./p> p classexample>For example, the value code idserialising-bitmaps-to-a-file:image/png>a href#image/png>image/png/a>/code> would mean to generate a PNG image, the value code idserialising-bitmaps-to-a-file:image/jpeg>a href#image/jpeg>image/jpeg/a>/code> would mean to generate a JPEG image, and the value code idserialising-bitmaps-to-a-file:image/svg+xml>a href#image/svg+xml>image/svg+xml/a>/code> would mean to generate an SVG image (which would require that the user agent track how the bitmap was generated, an unlikely, though potentially awesome, feature)./p> p>User agents must support PNG (code idserialising-bitmaps-to-a-file:image/png-2>a href#image/png>image/png/a>/code>). User agents may support other types. If the user agent does not support the requested type, then it must create the file using the PNG format. a href#refsPNG>PNG/a>/p> p>User agents must a hrefhttps://infra.spec.whatwg.org/#ascii-lowercase idserialising-bitmaps-to-a-file:converted-to-ascii-lowercase data-x-internalconverted-to-ascii-lowercase>convert the provided type to ASCII lowercase/a> before establishing if they support that type./p> p>For image types that do not support an alpha channel, the serialized image must be the bitmap image composited onto a solid black background using the source-over operator./p> p>If var>type/var> is an image format that supports variable quality (such as code idserialising-bitmaps-to-a-file:image/jpeg-2>a href#image/jpeg>image/jpeg/a>/code>) and var>quality/var> is given, then, if a hrefhttps://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values idserialising-bitmaps-to-a-file:js-type data-x-internaljs-type>Type/a>(var>quality/var>) is Number, and var>quality/var> is in the range 0.0 to 1.0 inclusive, the user agent must treat var>quality/var> as the desired quality level. If a hrefhttps://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values idserialising-bitmaps-to-a-file:js-type-2 data-x-internaljs-type>Type/a>(var>quality/var>) is not Number, or if var>quality/var> is outside that range, the user agent must use its default quality value, as if the var>quality/var> argument had not been given./p> p classnote>The use of type-testing here, instead of simply declaring var>quality/var> as a Web IDL code>double/code>, is a historical artifact./p> h5 idsecurity-with-canvas-elements>span classsecno>4.12.5.6/span> Security with code idsecurity-with-canvas-elements:the-canvas-element>a href#the-canvas-element>canvas/a>/code> elementsa href#security-with-canvas-elements classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>strong>Information leakage/strong> can occur if scripts from one a href#concept-origin idsecurity-with-canvas-elements:concept-origin>origin/a> can access information (e.g. read pixels) from images from another origin (one that isnt the a href#same-origin idsecurity-with-canvas-elements:same-origin>same/a>)./p> p>To mitigate this, bitmaps used with code idsecurity-with-canvas-elements:the-canvas-element-2>a href#the-canvas-element>canvas/a>/code> elements and code idsecurity-with-canvas-elements:imagebitmap>a href#imagebitmap>ImageBitmap/a>/code> objects are defined to have a flag indicating whether they are a href#concept-canvas-origin-clean idsecurity-with-canvas-elements:concept-canvas-origin-clean>origin-clean/a>. All bitmaps start with their a href#concept-canvas-origin-clean idsecurity-with-canvas-elements:concept-canvas-origin-clean-2>origin-clean/a> set to true. The flag is set to false when cross-origin images are used./p> p>The code idsecurity-with-canvas-elements:dom-canvas-todataurl>a href#dom-canvas-todataurl>toDataURL()/a>/code>, code idsecurity-with-canvas-elements:dom-canvas-toblob>a href#dom-canvas-toblob>toBlob()/a>/code>, and code idsecurity-with-canvas-elements:dom-context-2d-getimagedata>a href#dom-context-2d-getimagedata>getImageData()/a>/code> methods check the flag and will throw a a idsecurity-with-canvas-elements:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idsecurity-with-canvas-elements:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> rather than leak cross-origin data./p> p>The value of the a href#concept-canvas-origin-clean idsecurity-with-canvas-elements:concept-canvas-origin-clean-3>origin-clean/a> flag is propagated from a source code idsecurity-with-canvas-elements:the-canvas-element-3>a href#the-canvas-element>canvas/a>/code> elements bitmap to a new code idsecurity-with-canvas-elements:imagebitmap-2>a href#imagebitmap>ImageBitmap/a>/code> object by code idsecurity-with-canvas-elements:dom-createimagebitmap>a href#dom-createimagebitmap>createImageBitmap()/a>/code>. Conversely, a destination code idsecurity-with-canvas-elements:the-canvas-element-4>a href#the-canvas-element>canvas/a>/code> elements bitmap will have its a href#concept-canvas-origin-clean idsecurity-with-canvas-elements:concept-canvas-origin-clean-4>origin-clean/a> flags set to false by code idsecurity-with-canvas-elements:dom-context-2d-drawimage>a href#dom-context-2d-drawimage>drawImage/a>/code> if the source image is an code idsecurity-with-canvas-elements:imagebitmap-3>a href#imagebitmap>ImageBitmap/a>/code> object whose bitmap has its a href#concept-canvas-origin-clean idsecurity-with-canvas-elements:concept-canvas-origin-clean-5>origin-clean/a> flag set to false./p> p>The flag can be reset in certain situations; for example, when changing the value of the code idsecurity-with-canvas-elements:attr-canvas-width>a href#attr-canvas-width>width/a>/code> or the code idsecurity-with-canvas-elements:attr-canvas-height>a href#attr-canvas-height>height/a>/code> content attribute of the code idsecurity-with-canvas-elements:the-canvas-element-5>a href#the-canvas-element>canvas/a>/code> element to which a code idsecurity-with-canvas-elements:canvasrenderingcontext2d>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> is bound, the bitmap is cleared and its a href#concept-canvas-origin-clean idsecurity-with-canvas-elements:concept-canvas-origin-clean-6>origin-clean/a> flag is reset./p> p>When using an code idsecurity-with-canvas-elements:imagebitmaprenderingcontext>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code>, the value of the a href#concept-canvas-origin-clean idsecurity-with-canvas-elements:concept-canvas-origin-clean-7>origin-clean/a> flag is propagated from code idsecurity-with-canvas-elements:imagebitmap-4>a href#imagebitmap>ImageBitmap/a>/code> objects when they are transferred to the code idsecurity-with-canvas-elements:the-canvas-element-6>a href#the-canvas-element>canvas/a>/code> via a href#dom-imagebitmaprenderingcontext-transferfromimagebitmap idsecurity-with-canvas-elements:dom-imagebitmaprenderingcontext-transferfromimagebitmap>transferFromImageBitmap()/a>./p> h3 idcustom-elements>span classsecno>4.13/span> Custom elementsa href#custom-elements classself-link>/a>/h3>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> custom-elementsv1span classand_chr partial>span>Chrome for Android (limited)/span> span>61+/span>/span>span classchrome partial>span>Chrome (limited)/span> span>54+/span>/span>span classios_saf partial>span>iOS Safari (limited)/span> span>10.3+/span>/span>span classand_uc no>span>UC Browser for Android/span> span>None/span>/span>span classfirefox no>span>Firefox/span> span>None/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung partial>span>Samsung Internet (limited)/span> span>5+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari partial>span>Safari (limited)/span> span>10.1+/span>/span>span classandroid partial>span>Android Browser (limited)/span> span>56+/span>/span>span classopera partial>span>Opera (limited)/span> span>41+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featcustom-elementsv1>caniuse.com/a>/div> h4 idcustom-elements-intro>span classsecno>4.13.1/span> Introductiona href#custom-elements-intro classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>a href#custom-element idcustom-elements-intro:custom-element>Custom elements/a> provide a way for authors to build their own fully-featured DOM elements. Although authors could always use non-standard elements in their documents, with application-specific behavior added after the fact by scripting or similar, such elements have historically been non-conforming and not very functional. By a href#element-definition idcustom-elements-intro:element-definition>defining/a> a custom element, authors can inform the parser how to properly construct an element and how elements of that class should react to changes./p> p>Custom elements are part of a larger effort to rationalise the platform, by explaining existing platform features (like the elements of HTML) in terms of lower-level author-exposed extensibility points (like custom element definition). Although today there are many limitations on the capabilities of custom elements—both functionally and semantically—that prevent them from fully explaining the behaviors of HTMLs existing elements, we hope to shrink this gap over time./p> h5 idcustom-elements-autonomous-example>span classsecno>4.13.1.1/span> Creating an autonomous custom elementa href#custom-elements-autonomous-example classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>For the purposes of illustrating how to create an a href#autonomous-custom-element idcustom-elements-autonomous-example:autonomous-custom-element>autonomous custom element/a>, lets define a custom element that encapsulates rendering a small icon for a country flag. Our goal is to be able to use it like so:/p> pre><flag-icon countrynl></flag-icon>/pre> p>To do this, we first declare a class for the custom element, extending code idcustom-elements-autonomous-example:htmlelement>a href#htmlelement>HTMLElement/a>/code>:/p> pre>class FlagIcon extends HTMLElement { constructor() { super(); this._countryCode null; } static get observedAttributes() { return country; } attributeChangedCallback(name, oldValue, newValue) { // name will always be country due to observedAttributes this._countryCode newValue; this._updateRendering(); } connectedCallback() { this._updateRendering(); } get country() { return this._countryCode; } set country(v) { this.setAttribute(country, v); } _updateRendering() { // Left as an exercise for the reader. But, youll probably want to // check this.ownerDocument.defaultView to see if weve been // inserted into a document with a browsing context, and avoid // doing any work if not. }}/pre> p>We then need to use this class to define the element:/p> pre>customElements.define(flag-icon, FlagIcon);/pre> p>At this point, our above code will work! The parser, whenever it sees the code>flag-icon/code> tag, will construct a new instance of our code>FlagIcon/code> class, and tell our code about its new code>country/code> attribute, which we then use to set the elements internal state and update its rendering (when appropriate)./p> p>You can also create code>flag-icon/code> elements using the DOM API:/p> pre>const flagIcon document.createElement(flag-icon)flagIcon.country jpdocument.body.appendChild(flagIcon)/pre> p>Finally, we can also use the a href#custom-element-constructor idcustom-elements-autonomous-example:custom-element-constructor>custom element constructor/a> itself. That is, the above code is equivalent to:/p> pre>const flagIcon new FlagIcon()flagIcon.country jpdocument.body.appendChild(flagIcon)/pre> h5 idcustom-elements-customized-builtin-example>span classsecno>4.13.1.2/span> Creating a customized built-in elementa href#custom-elements-customized-builtin-example classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>a href#customized-built-in-element idcustom-elements-customized-builtin-example:customized-built-in-element>Customized built-in elements/a> are a distinct kind of a href#custom-element idcustom-elements-customized-builtin-example:custom-element>custom element/a>, which are defined slightly differently and used very differently compared to a href#autonomous-custom-element idcustom-elements-customized-builtin-example:autonomous-custom-element>autonomous custom elements/a>. They exist to allow reuse of behaviors from the existing elements of HTML, by extending those elements with new custom functionality. This is important since many of the existing behaviors of HTML elements can unfortunately not be duplicated by using purely a href#autonomous-custom-element idcustom-elements-customized-builtin-example:autonomous-custom-element-2>autonomous custom elements/a>. Instead, a href#customized-built-in-element idcustom-elements-customized-builtin-example:customized-built-in-element-2>customized built-in elements/a> allow the installation of custom construction behavior, lifecycle hooks, and prototype chain onto existing elements, essentially mixing in these capabilities on top of the already-existing element./p> p>a href#customized-built-in-element idcustom-elements-customized-builtin-example:customized-built-in-element-3>Customized built-in elements/a> require a distinct syntax from a href#autonomous-custom-element idcustom-elements-customized-builtin-example:autonomous-custom-element-3>autonomous custom elements/a> because user agents and other software key off an elements local name in order to identify the elements semantics and behavior. That is, the concept of a href#customized-built-in-element idcustom-elements-customized-builtin-example:customized-built-in-element-4>customized built-in elements/a> building on top of existing behavior depends crucially on the extended elements retaining their original local name./p> p>In this example, well be creating a a href#customized-built-in-element idcustom-elements-customized-builtin-example:customized-built-in-element-5>customized built-in element/a> named code>plastic-button/code>, which behaves like a normal button but gets fancy animation effects added whenever you click on it. We start by defining a class, just like before, although this time we extend code idcustom-elements-customized-builtin-example:htmlbuttonelement>a href#htmlbuttonelement>HTMLButtonElement/a>/code> instead of code idcustom-elements-customized-builtin-example:htmlelement>a href#htmlelement>HTMLElement/a>/code>:/p> pre>class PlasticButton extends HTMLButtonElement { constructor() { super(); this.addEventListener(click, () > { // Draw some fancy animation effects! }); }}/pre> p>When defining our custom element, we have to also specify the code>extends/code> option:/p> pre>customElements.define(plastic-button, PlasticButton, { extends: button });/pre> p>In general, the name of the element being extended cannot be determined simply by looking at what element interface it extends, as many elements share the same interface (such as code idcustom-elements-customized-builtin-example:the-q-element>a href#the-q-element>q/a>/code> and code idcustom-elements-customized-builtin-example:the-blockquote-element>a href#the-blockquote-element>blockquote/a>/code> both sharing code idcustom-elements-customized-builtin-example:htmlquoteelement>a href#htmlquoteelement>HTMLQuoteElement/a>/code>)./p> p>To use our a href#customized-built-in-element idcustom-elements-customized-builtin-example:customized-built-in-element-6>customized built-in element/a>, we use the code idcustom-elements-customized-builtin-example:attr-is>a href#attr-is>is/a>/code> attribute on a code idcustom-elements-customized-builtin-example:the-button-element>a href#the-button-element>button/a>/code> element:/p> pre><button isplastic-button>Click Me!</button>/pre> p>Trying to use a a href#customized-built-in-element idcustom-elements-customized-builtin-example:customized-built-in-element-7>customized built-in element/a> as an a href#autonomous-custom-element idcustom-elements-customized-builtin-example:autonomous-custom-element-4>autonomous custom element/a> will em>not/em> work; that is, code><plastic-button>Click me?</plastic-button>/code> will simply create an code idcustom-elements-customized-builtin-example:htmlelement-2>a href#htmlelement>HTMLElement/a>/code> with no special behavior./p> p>If you need to create a type-extended element programmatically, you can use the following form of code idcustom-elements-customized-builtin-example:dom-document-createelement>a data-x-internaldom-document-createelement hrefhttps://dom.spec.whatwg.org/#dom-document-createelement>createElement()/a>/code>:/p> pre>const plasticButton document.createElement(button, { is: plastic-button });plasticButton.textContent Click me!;/pre> p>And as before, the constructor will also work:/p> pre>const plasticButton2 new PlasticButton();console.log(plasticButton2.localName); // will output buttonconsole.log(plasticButton2.getAttribute(is)); // will output plastic-button/pre> p>Notably, all the of the ways in which code idcustom-elements-customized-builtin-example:the-button-element-2>a href#the-button-element>button/a>/code> is special apply to such plastic buttons as well: their focus behavior, ability to participate in a href#concept-form-submit idcustom-elements-customized-builtin-example:concept-form-submit>form submission/a>, the code idcustom-elements-customized-builtin-example:attr-fe-disabled>a href#attr-fe-disabled>disabled/a>/code> attribute, and so on./p> p idcustomized-built-in-element-restrictions>a href#customized-built-in-element idcustom-elements-customized-builtin-example:customized-built-in-element-8>Customized built-in elements/a> are designed to allow extension of existing HTML elements that have useful user-agent supplied behavior or APIs. As such, they can only extend existing HTML elements defined in this specification, and cannot extend legacy elements such as code idcustom-elements-customized-builtin-example:bgsound>a href#bgsound>bgsound/a>/code>, code idcustom-elements-customized-builtin-example:blink>a href#blink>blink/a>/code>, code idcustom-elements-customized-builtin-example:isindex>a href#isindex>isindex/a>/code>, code idcustom-elements-customized-builtin-example:keygen>a href#keygen>keygen/a>/code>, code idcustom-elements-customized-builtin-example:multicol>a href#multicol>multicol/a>/code>, code idcustom-elements-customized-builtin-example:nextid>a href#nextid>nextid/a>/code>, or code idcustom-elements-customized-builtin-example:spacer>a href#spacer>spacer/a>/code> that have been defined to use code idcustom-elements-customized-builtin-example:htmlunknownelement>a href#htmlunknownelement>HTMLUnknownElement/a>/code> as their a idcustom-elements-customized-builtin-example:element-interface hrefhttps://dom.spec.whatwg.org/#concept-element-interface data-x-internalelement-interface>element interface/a>./p> p>One reason for this requirement is future-compatibility: if a a href#customized-built-in-element idcustom-elements-customized-builtin-example:customized-built-in-element-9>customized built-in element/a> was defined that extended a currently-unknown element, for example code>combobox/code>, this would prevent this specification from defining a code>combobox/code> element in the future, as consumers of the derived a href#customized-built-in-element idcustom-elements-customized-builtin-example:customized-built-in-element-10>customized built-in element/a> would have come to depend on their base element having no interesting user-agent-supplied behavior./p> h5 idcustom-elements-autonomous-drawbacks>span classsecno>4.13.1.3/span> Drawbacks of autonomous custom elementsa href#custom-elements-autonomous-drawbacks classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>As specified below, and alluded to above, simply defining and using an element called code>taco-button/code> does not mean that such elements a href#represents idcustom-elements-autonomous-drawbacks:represents>represent/a> buttons. That is, tools such as Web browsers, search engines, or accessibility technology will not automatically treat the resulting element as a button just based on its defined name./p> p>To convey the desired button semantics to a variety of users, while still using an a href#autonomous-custom-element idcustom-elements-autonomous-drawbacks:autonomous-custom-element>autonomous custom element/a>, a number of techniques would need to be employed:/p> ul>li>p>The addition of the code idcustom-elements-autonomous-drawbacks:attr-tabindex>a href#attr-tabindex>tabindex/a>/code> attribute would make the code>taco-button/code> a href#interactive-content-2 idcustom-elements-autonomous-drawbacks:interactive-content-2>interactive content/a>, thus making it a href#focusable-area idcustom-elements-autonomous-drawbacks:focusable-area>focusable/a>. Note that if the code>taco-button/code> were to become logically disabled, the code idcustom-elements-autonomous-drawbacks:attr-tabindex-2>a href#attr-tabindex>tabindex/a>/code> attribute would need to be removed.li>p>The addition of various ARIA attributes helps convey semantics to accessibility technology. For example, setting the code idcustom-elements-autonomous-drawbacks:attr-aria-role>a href#attr-aria-role>role/a>/code> attribute to code idcustom-elements-autonomous-drawbacks:attr-aria-role-button>a data-x-internalattr-aria-role-button hrefhttps://w3c.github.io/aria/aria/aria.html#button>button/a>/code> will convey the semantics that this is a button, enabling users to successfully interact with the control using usual button-like interactions in their accessibility technology. Setting the code idcustom-elements-autonomous-drawbacks:attr-aria-label>a data-x-internalattr-aria-label hrefhttps://w3c.github.io/aria/aria/aria.html#aria-label>aria-label/a>/code> attribute is necessary to give the button an a hrefhttps://w3c.github.io/aria/aria/aria.html#dfn-accessible-name idcustom-elements-autonomous-drawbacks:concept-accessible-name data-x-internalconcept-accessible-name>accessible name/a>, instead of having accessibility technology traverse its child text nodes and announce them. And setting code idcustom-elements-autonomous-drawbacks:attr-aria-disabled>a data-x-internalattr-aria-disabled hrefhttps://w3c.github.io/aria/aria/aria.html#aria-disabled>aria-disabled/a>/code> to code>true/code> when the button is logically disabled conveys to accessibility technology the buttons disabled state.li>p>The addition of event handlers to handle commonly-expected button behaviors helps convey the semantics of the button to Web browser users. In this case, the most relevant event handler would be one that proxies appropriate code idcustom-elements-autonomous-drawbacks:event-keydown>a data-x-internalevent-keydown hrefhttps://w3c.github.io/uievents/#event-type-keydown>keydown/a>/code> events to become code idcustom-elements-autonomous-drawbacks:event-click>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> events, so that you can activate the button both with keyboard and by clicking.li>p>In addition to any default visual styling provided for code>taco-button/code> elements, the visual styling will also need to be updated to reflect changes in logical state, such as becoming disabled; that is, whatever stylesheet has rules for code>taco-button/code> will also need to have rules for code>taco-buttondisabled/code>./ul> p>With these points in mind, a full-featured code>taco-button/code> that took on the responsibility of conveying button semantics (including the ability to be disabled) might look something like this:/p> pre>class TacoButton extends HTMLElement { static get observedAttributes() { return disabled; } constructor() { super(); this.addEventListener(keydown, e > { if (e.keyCode 32 || e.keyCode 13) { this.dispatchEvent(new MouseEvent(click, { bubbles: true, cancelable: true })); } }); this.addEventListener(click, e > { if (this.disabled) { e.preventDefault(); e.stopPropagation(); } }); this._observer new MutationObserver(() > { this.setAttribute(aria-label, this.textContent); }); } connectedCallback() { this.setAttribute(role, button); this.setAttribute(tabindex, 0); this._observer.observe(this, { childList: true, characterData: true, subtree: true }); } disconnectedCallback() { this._observer.disconnect(); } get disabled() { return this.hasAttribute(disabled); } set disabled(v) { if (v) { this.setAttribute(disabled, ); } else { this.removeAttribute(disabled); } } attributeChangedCallback() { // only is called for the disabled attribute due to observedAttributes if (this.disabled) { this.removeAttribute(tabindex); this.setAttribute(aria-disabled, true); } else { this.setAttribute(tabindex, 0); this.setAttribute(aria-disabled, false); } }}/pre> p>Even with this rather-complicated element definition, the element is not a pleasure to use for consumers: it will be continually sprouting code idcustom-elements-autonomous-drawbacks:attr-tabindex-3>a href#attr-tabindex>tabindex/a>/code> and code idcustom-elements-autonomous-drawbacks:attr-aria-*>a href#attr-aria-*>aria-*/a>/code> attributes of its own volition. This is because as of now there is no way to specify default accessibility semantics or focus behavior for custom elements, forcing the use of these attributes to do so (even though they are usually reserved for allowing the consumer to override default behavior)./p> p>In contrast, a simple a href#customized-built-in-element idcustom-elements-autonomous-drawbacks:customized-built-in-element>customized built-in element/a>, as shown in the previous section, would automatically inherit the semantics and behavior of the code idcustom-elements-autonomous-drawbacks:the-button-element>a href#the-button-element>button/a>/code> element, with no need to implement these behaviors manually. In general, for any elements with nontrivial behavior and semantics that build on top of existing elements of HTML, a href#customized-built-in-element idcustom-elements-autonomous-drawbacks:customized-built-in-element-2>customized built-in elements/a> will be easier to develop, maintain, and consume./p> h5 idcustom-elements-upgrades-examples>span classsecno>4.13.1.4/span> Upgrading elements after their creationa href#custom-elements-upgrades-examples classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>Because a href#element-definition idcustom-elements-upgrades-examples:element-definition>element definition/a> can occur at any time, a non-custom element could be a hrefhttps://dom.spec.whatwg.org/#concept-create-element idcustom-elements-upgrades-examples:create-an-element data-x-internalcreate-an-element>created/a>, and then later become a a href#custom-element idcustom-elements-upgrades-examples:custom-element>custom element/a> after an appropriate a href#custom-element-definition idcustom-elements-upgrades-examples:custom-element-definition>definition/a> is registered. We call this process upgrading the element, from a normal element into a custom element./p> p>a href#upgrades idcustom-elements-upgrades-examples:upgrades>Upgrades/a> enable scenarios where it may be preferable for a href#custom-element-definition idcustom-elements-upgrades-examples:custom-element-definition-2>custom element definitions/a> to be registered after relevant elements has been initially created, such as by the parser. They allow progressive enhancement of the content in the custom element. For example, in the following HTML document the element definition for code>img-viewer/code> is loaded asynchronously:/p> pre><!DOCTYPE html><html langen><title>Image viewer example</title><img-viewer filterKelvin> <img srcimages/tree.jpg altA beautiful tree towering over an empty savannah></img-viewer><script srcjs/elements/img-viewer.js async></script>/pre> p>The definition for the code>img-viewer/code> element here is loaded using a code idcustom-elements-upgrades-examples:the-script-element>a href#the-script-element>script/a>/code> element marked with the code idcustom-elements-upgrades-examples:attr-script-async>a href#attr-script-async>async/a>/code> attribute, placed after the code><img-viewer>/code> tag in the markup. While the script is loading, the code>img-viewer/code> element will be treated as an undefined element, similar to a code idcustom-elements-upgrades-examples:the-span-element>a href#the-span-element>span/a>/code>. Once the script loads, it will define the code>img-viewer/code> element, and the existing code>img-viewer/code> element on the page will be upgraded, applying the custom elements definition (which presumably includes applying an image filter identified by the string Kelvin, enhancing the images visual appearance)./p> hr> p>Note that a href#upgrades idcustom-elements-upgrades-examples:upgrades-2>upgrades/a> only apply to elements in the document tree. (Formally, elements that are a idcustom-elements-upgrades-examples:connected hrefhttps://dom.spec.whatwg.org/#connected data-x-internalconnected>connected/a>.) An element that is not inserted into a document will stay un-upgraded. An example illustrates this point:/p> pre><!DOCTYPE html><html langen><title>Upgrade edge-cases example</title><example-element></example-element><script> use strict; const inDocument document.querySelector(example-element); const outOfDocument document.createElement(example-element); // Before the element definition, both are HTMLElement: console.assert(inDocument instanceof HTMLElement); console.assert(outOfDocument instanceof HTMLElement); class ExampleElement extends HTMLElement {} customElements.define(example-element, ExampleElement); // After element definition, the in-document element was upgraded: console.assert(inDocument instanceof ExampleElement); console.assert(!(outOfDocument instanceof ExampleElement)); document.body.appendChild(outOfDocument); // Now that weve moved the element into the document, it too was upgraded: console.assert(outOfDocument instanceof ExampleElement);</script>/pre> h4 idcustom-element-conformance>span classsecno>4.13.2/span> Requirements for custom element constructorsa href#custom-element-conformance classself-link>/a>/h4> p>When authoring a href#custom-element-constructor idcustom-element-conformance:custom-element-constructor>custom element constructors/a>, authors are bound by the following conformance requirements:/p> ul>li>p>A parameter-less call to code>super()/code> must be the first statement in the constructor body, to establish the correct prototype chain and b>this/b> value before any further code is run.li>p>A code>return/code> statement must not appear anywhere inside the constructor body, unless it is a simple early-return (code>return/code> or code>return this/code>).li>p>The constructor must not use the code idcustom-element-conformance:dom-document-write>a href#dom-document-write>document.write()/a>/code> or code idcustom-element-conformance:dom-document-open>a href#dom-document-open>document.open()/a>/code> methods.li>p>The elements attributes and children must not be inspected, as in the non-a href#upgrades idcustom-element-conformance:upgrades>upgrade/a> case none will be present, and relying on upgrades makes the element less usable.li>p>The element must not gain any attributes or children, as this violates the expectations of consumers who use the code idcustom-element-conformance:dom-document-createelement>a data-x-internaldom-document-createelement hrefhttps://dom.spec.whatwg.org/#dom-document-createelement>createElement/a>/code> or code idcustom-element-conformance:dom-document-createelementns>a data-x-internaldom-document-createelementns hrefhttps://dom.spec.whatwg.org/#dom-document-createelementns>createElementNS/a>/code> methods.li>p>In general, work should be deferred to code>connectedCallback/code> as much as possible—especially work involving fetching resources or rendering. However, note that code>connectedCallback/code> can be called more than once, so any initialization work that is truly one-time will need a guard to prevent it from running twice.li>p>In general, the constructor should be used to set up initial state and default values, and to set up event listeners and possibly a a idcustom-element-conformance:shadow-root hrefhttps://dom.spec.whatwg.org/#concept-shadow-root data-x-internalshadow-root>shadow root/a>./ul> p>Several of these requirements are checked during a hrefhttps://dom.spec.whatwg.org/#concept-create-element idcustom-element-conformance:create-an-element data-x-internalcreate-an-element>element creation/a>, either directly or indirectly, and failing to follow them will result in a custom element that cannot be instantiated by the parser or DOM APIs. This is true even if the work is done inside a constructor-initiated a href#microtask idcustom-element-conformance:microtask>microtask/a>, as a a href#perform-a-microtask-checkpoint idcustom-element-conformance:perform-a-microtask-checkpoint>microtask checkpoint/a> can occur immediately after construction./p> h4 idcustom-elements-core-concepts>span classsecno>4.13.3/span> Core conceptsa href#custom-elements-core-concepts classself-link>/a>/h4> p>A dfn idcustom-element data-export>custom element/dfn> is an element that is a hrefhttps://dom.spec.whatwg.org/#concept-element-custom idcustom-elements-core-concepts:concept-element-custom data-x-internalconcept-element-custom>custom/a>. Informally, this means that its constructor and prototype are defined by the author, instead of by the user agent. This author-supplied constructor function is called the dfn idcustom-element-constructor data-export>custom element constructor/dfn>./p> p>Two distinct types of a href#custom-element idcustom-elements-core-concepts:custom-element>custom elements/a> can be defined:/p> ol>li>p>An dfn idautonomous-custom-element data-export>autonomous custom element/dfn>, which is defined with no code>extends/code> option. These types of custom elements have a local name equal to their a href#concept-custom-element-definition-name idcustom-elements-core-concepts:concept-custom-element-definition-name>defined name/a>.li>p>A dfn idcustomized-built-in-element data-export>customized built-in element/dfn>, which is defined with an code>extends/code> option. These types of custom elements have a local name equal to the value passed in their code>extends/code> option, and their a href#concept-custom-element-definition-name idcustom-elements-core-concepts:concept-custom-element-definition-name-2>defined name/a> is used as the value of the dfn idattr-is>code>is/code>/dfn> attribute, which therefore must be a a href#valid-custom-element-name idcustom-elements-core-concepts:valid-custom-element-name>valid custom element name/a>./ol> p>After a a href#custom-element idcustom-elements-core-concepts:custom-element-2>custom element/a> is a hrefhttps://dom.spec.whatwg.org/#concept-create-element idcustom-elements-core-concepts:create-an-element data-x-internalcreate-an-element>created/a>, changing the value of the code idcustom-elements-core-concepts:attr-is>a href#attr-is>is/a>/code> attribute does not change the elements behavior, as it is saved on the element as its a hrefhttps://dom.spec.whatwg.org/#concept-element-is-value idcustom-elements-core-concepts:concept-element-is-value data-x-internalconcept-element-is-value>code>is/code> value/a>./p> p>a href#autonomous-custom-element idcustom-elements-core-concepts:autonomous-custom-element>Autonomous custom elements/a> have the following element definition:/p> dl classelement>dt>a href#concept-element-categories idcustom-elements-core-concepts:concept-element-categories>Categories/a>:dd>a href#flow-content-2 idcustom-elements-core-concepts:flow-content-2>Flow content/a>.dd>a href#phrasing-content-2 idcustom-elements-core-concepts:phrasing-content-2>Phrasing content/a>.dd>a href#palpable-content-2 idcustom-elements-core-concepts:palpable-content-2>Palpable content/a>.dt>a href#concept-element-contexts idcustom-elements-core-concepts:concept-element-contexts>Contexts in which this element can be used/a>:dd>Where a href#phrasing-content-2 idcustom-elements-core-concepts:phrasing-content-2-2>phrasing content/a> is expected.dt>a href#concept-element-content-model idcustom-elements-core-concepts:concept-element-content-model>Content model/a>:dd>a href#transparent idcustom-elements-core-concepts:transparent>Transparent/a>.dt>a href#concept-element-attributes idcustom-elements-core-concepts:concept-element-attributes>Content attributes/a>:dd>a href#global-attributes idcustom-elements-core-concepts:global-attributes>Global attributes/a>, except the code idcustom-elements-core-concepts:attr-is-2>a href#attr-is>is/a>/code> attributedd>Any other attribute that has no namespace (see prose).dt>a href#concept-element-dom idcustom-elements-core-concepts:concept-element-dom>DOM interface/a>:dd>Supplied by the elements author (inherits from code idcustom-elements-core-concepts:htmlelement>a href#htmlelement>HTMLElement/a>/code>)/dl> p>An a href#autonomous-custom-element idcustom-elements-core-concepts:autonomous-custom-element-2>autonomous custom element/a> does not have any special meaning: it a href#represents idcustom-elements-core-concepts:represents>represents/a> its children. A a href#customized-built-in-element idcustom-elements-core-concepts:customized-built-in-element>customized built-in element/a> inherits the semantics of the element that it extends./p> p>Any namespace-less attribute that is relevant to the elements functioning, as determined by the elements author, may be specified on an a href#autonomous-custom-element idcustom-elements-core-concepts:autonomous-custom-element-3>autonomous custom element/a>, so long as the attribute name is a href#xml-compatible idcustom-elements-core-concepts:xml-compatible>XML-compatible/a> and contains no a hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha idcustom-elements-core-concepts:uppercase-ascii-letters data-x-internaluppercase-ascii-letters>ASCII upper alphas/a>. The exception is the code idcustom-elements-core-concepts:attr-is-3>a href#attr-is>is/a>/code> attribute, which must not be specified on an a href#autonomous-custom-element idcustom-elements-core-concepts:autonomous-custom-element-4>autonomous custom element/a> (and which will have no effect if it is)./p> p>a href#customized-built-in-element idcustom-elements-core-concepts:customized-built-in-element-2>Customized built-in elements/a> follow the normal requirements for attributes, based on the elements they extend. To add custom attribute-based behavior, use code idcustom-elements-core-concepts:attr-data-*>a href#attr-data-*>data-*/a>/code> attributes./p> hr> p>A dfn idvalid-custom-element-name data-export>valid custom element name/dfn> is a sequence of characters var>name/var> that meets all of the following requirements:/p> ul>li> p>var>name/var> must match the code idcustom-elements-core-concepts:prod-potentialcustomelementname>a href#prod-potentialcustomelementname>PotentialCustomElementName/a>/code> production:/p> dl>dt>code>dfn idprod-potentialcustomelementname>PotentialCustomElementName/dfn> ::/code>dd>code>a-z (a href#prod-pcenchar idcustom-elements-core-concepts:prod-pcenchar>PCENChar/a>)* - (a href#prod-pcenchar idcustom-elements-core-concepts:prod-pcenchar-2>PCENChar/a>)*/code>dt>code>dfn idprod-pcenchar>PCENChar/dfn> ::/code>dd>code>- | . | 0-9 | _ | a-z | #xB7 | #xC0-#xD6 | #xD8-#xF6 | #xF8-#x37D | #x37F-#x1FFF | #x200C-#x200D | #x203F-#x2040 | #x2070-#x218F | #x2C00-#x2FEF | #x3001-#xD7FF | #xF900-#xFDCF | #xFDF0-#xFFFD | #x10000-#xEFFFF/code>/dl> p>This uses the a hrefhttps://www.w3.org/TR/xml/#sec-notation>EBNF notation/a> from the cite>XML/cite> specification. a href#refsXML>XML/a>/p> li> p>var>name/var> must not be any of the following:/p> ul classbrief>li>code>annotation-xml/code>li>code>color-profile/code>li>code>font-face/code>li>code>font-face-src/code>li>code>font-face-uri/code>li>code>font-face-format/code>li>code>font-face-name/code>li>code>missing-glyph/code>/ul> p classnote>The list of names above is the summary of all hyphen-containing element names from the a href#other-applicable-specifications idcustom-elements-core-concepts:other-applicable-specifications>applicable specifications/a>, namely cite>SVG/cite> and cite>MathML/cite>. a href#refsSVG>SVG/a> a href#refsMATHML>MATHML/a>/p> /ul> div classnote> p>These requirements ensure a number of goals for a href#valid-custom-element-name idcustom-elements-core-concepts:valid-custom-element-name-2>valid custom element names/a>:/p> ul>li>p>They start with an a idcustom-elements-core-concepts:lowercase-ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-lower-alpha data-x-internallowercase-ascii-letters>ASCII lower alpha/a>, ensuring that the HTML parser will treat them as tags instead of as text.li>p>They do not contain any a hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha idcustom-elements-core-concepts:uppercase-ascii-letters-2 data-x-internaluppercase-ascii-letters>ASCII upper alphas/a>, ensuring that the user agent can always treat HTML elements ASCII-case-insensitively.li>p>They contain a hyphen, used for namespacing and to ensure forward compatibility (since no elements will be added to HTML, SVG, or MathML with hyphen-containing local names in the future).li>p>They can always be created with code idcustom-elements-core-concepts:dom-document-createelement>a data-x-internaldom-document-createelement hrefhttps://dom.spec.whatwg.org/#dom-document-createelement>createElement()/a>/code> and code idcustom-elements-core-concepts:dom-document-createelementns>a data-x-internaldom-document-createelementns hrefhttps://dom.spec.whatwg.org/#dom-document-createelementns>createElementNS()/a>/code>, which have restrictions that go beyond the parsers./ul> p>Apart from these restrictions, a large variety of names is allowed, to give maximum flexibility for use cases like code><math-α>/code> or code><emotion-😍>/code>./p> /div> p>A dfn idcustom-element-definition>custom element definition/dfn> describes a a href#custom-element idcustom-elements-core-concepts:custom-element-3>custom element/a> and consists of:/p> dl>dt>A dfn data-dfn-forcustom element definition idconcept-custom-element-definition-name data-export>name/dfn>dd>A a href#valid-custom-element-name idcustom-elements-core-concepts:valid-custom-element-name-3>valid custom element name/a>dt>A dfn data-dfn-forcustom element definition idconcept-custom-element-definition-local-name data-export>local name/dfn>dd>A local namedt>A dfn data-dfn-forcustom element definition idconcept-custom-element-definition-constructor data-export>constructor/dfn>dd>A Web IDL code idcustom-elements-core-concepts:idl-function>a data-x-internalidl-function hrefhttps://heycam.github.io/webidl/#common-Function>Function/a>/code> callback function type value wrapping the a href#custom-element-constructor idcustom-elements-core-concepts:custom-element-constructor>custom element constructor/a>dt>A list of dfn idconcept-custom-element-definition-observed-attributes>observed attributes/dfn>dd>A code>sequence<DOMString>/code>dt>A collection of dfn idconcept-custom-element-definition-lifecycle-callbacks>lifecycle callbacks/dfn>dd>A map, whose four keys are the strings code>connectedCallback/code>, code>disconnectedCallback/code>, code>adoptedCallback/code>, and code>attributeChangedCallback/code>. The corresponding values are either a Web IDL code idcustom-elements-core-concepts:idl-function-2>a data-x-internalidl-function hrefhttps://heycam.github.io/webidl/#common-Function>Function/a>/code> callback function type value, or null. By default the value of each entry is null.dt>A dfn idconcept-custom-element-definition-construction-stack>construction stack/dfn>dd>A list, initially empty, that is manipulated by the a href#concept-upgrade-an-element idcustom-elements-core-concepts:concept-upgrade-an-element>upgrade an element/a> algorithm and the a href#html-element-constructors>HTML element constructors/a>. Each entry in the list will be either an element or an dfn idconcept-already-constructed-marker>i>already constructed/i> marker/dfn>./dl> p>To dfn idlook-up-a-custom-element-definition data-export>look up a custom element definition/dfn>, given a var>document/var>, var>namespace/var>, var>localName/var>, and var>is/var>, perform the following steps. They will return either a a href#custom-element-definition idcustom-elements-core-concepts:custom-element-definition>custom element definition/a> or null:/p> ol>li>p>If var>namespace/var> is not the a idcustom-elements-core-concepts:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>, return null.li>p>If var>document/var> does not have a a href#concept-document-bc idcustom-elements-core-concepts:concept-document-bc>browsing context/a>, return null.li>p>Let var>registry/var> be var>document/var>s a href#concept-document-bc idcustom-elements-core-concepts:concept-document-bc-2>browsing context/a>s code idcustom-elements-core-concepts:window>a href#window>Window/a>/code>s code idcustom-elements-core-concepts:customelementregistry>a href#customelementregistry>CustomElementRegistry/a>/code> object.li>p>If there is a href#custom-element-definition idcustom-elements-core-concepts:custom-element-definition-2>custom element definition/a> in var>registry/var> with a href#concept-custom-element-definition-name idcustom-elements-core-concepts:concept-custom-element-definition-name-3>name/a> and a href#concept-custom-element-definition-local-name idcustom-elements-core-concepts:concept-custom-element-definition-local-name>local name/a> both equal to var>localName/var>, return that a href#custom-element-definition idcustom-elements-core-concepts:custom-element-definition-3>custom element definition/a>.li>p>If there is a a href#custom-element-definition idcustom-elements-core-concepts:custom-element-definition-4>custom element definition/a> in var>registry/var> with a href#concept-custom-element-definition-name idcustom-elements-core-concepts:concept-custom-element-definition-name-4>name/a> equal to var>is/var> and a href#concept-custom-element-definition-local-name idcustom-elements-core-concepts:concept-custom-element-definition-local-name-2>local name/a> equal to var>localName/var>, return that a href#custom-element-definition idcustom-elements-core-concepts:custom-element-definition-5>custom element definition/a>.li>p>Return null./ol> h4 idcustom-elements-api>span classsecno>4.13.4/span> The code idcustom-elements-api:customelementregistry>a href#customelementregistry>CustomElementRegistry/a>/code> interfacea href#custom-elements-api classself-link>/a>/h4> p>Each code idcustom-elements-api:window>a href#window>Window/a>/code> object is associated with a unique instance of a code idcustom-elements-api:customelementregistry-2>a href#customelementregistry>CustomElementRegistry/a>/code> object, allocated when the code idcustom-elements-api:window-2>a href#window>Window/a>/code> object is created./p> p classnote>Custom element registries are associated with code idcustom-elements-api:window-3>a href#window>Window/a>/code> objects, instead of code idcustom-elements-api:document>a href#document>Document/a>/code> objects, since each a href#custom-element-constructor idcustom-elements-api:custom-element-constructor>custom element constructor/a> inherits from the code idcustom-elements-api:htmlelement>a href#htmlelement>HTMLElement/a>/code> interface, and there is exactly one code idcustom-elements-api:htmlelement-2>a href#htmlelement>HTMLElement/a>/code> interface per code idcustom-elements-api:window-4>a href#window>Window/a>/code> object./p> p>The dfn iddom-window-customelements>code>customElements/code>/dfn> attribute of the code idcustom-elements-api:window-5>a href#window>Window/a>/code> interface must return the code idcustom-elements-api:customelementregistry-3>a href#customelementregistry>CustomElementRegistry/a>/code> object for that code idcustom-elements-api:window-6>a href#window>Window/a>/code> object./p> pre classidl>ExposedWindowinterface dfn idcustomelementregistry>CustomElementRegistry/dfn> { a href#cereactions idcustom-elements-api:cereactions>CEReactions/a> void a href#dom-customelementregistry-define idcustom-elements-api:dom-customelementregistry-define>define/a>(DOMString name, Function constructor, optional ElementDefinitionOptions options); any a href#dom-customelementregistry-get idcustom-elements-api:dom-customelementregistry-get>get/a>(DOMString name); Promise<void> a href#dom-customelementregistry-whendefined idcustom-elements-api:dom-customelementregistry-whendefined>whenDefined/a>(DOMString name);};dictionary dfn idelementdefinitionoptions>ElementDefinitionOptions/dfn> { DOMString extends;};/pre> p>Every code idcustom-elements-api:customelementregistry-4>a href#customelementregistry>CustomElementRegistry/a>/code> has a set of a href#custom-element-definition idcustom-elements-api:custom-element-definition>custom element definitions/a>, initially empty. In general, algorithms in this specification look up elements in the registry by any of a href#concept-custom-element-definition-name idcustom-elements-api:concept-custom-element-definition-name>name/a>, a href#concept-custom-element-definition-local-name idcustom-elements-api:concept-custom-element-definition-local-name>local name/a>, or a href#concept-custom-element-definition-constructor idcustom-elements-api:concept-custom-element-definition-constructor>constructor/a>./p> p>Every code idcustom-elements-api:customelementregistry-5>a href#customelementregistry>CustomElementRegistry/a>/code> also has an dfn idelement-definition-is-running>element definition is running/dfn> flag which is used to prevent reentrant invocations of a href#element-definition idcustom-elements-api:element-definition>element definition/a>. It is initially unset./p> p>Every code idcustom-elements-api:customelementregistry-6>a href#customelementregistry>CustomElementRegistry/a>/code> also has a dfn idwhen-defined-promise-map>when-defined promise map/dfn>, mapping a href#valid-custom-element-name idcustom-elements-api:valid-custom-element-name>valid custom element names/a> to promises. It is used to implement the code idcustom-elements-api:dom-customelementregistry-whendefined-2>a href#dom-customelementregistry-whendefined>whenDefined()/a>/code> method./p> dl classdomintro>dt>var>window/var> . code idcustom-elements-api:dom-window-customelements>a href#dom-window-customelements>customElements/a>/code> . code idcustom-elements-api:dom-customelementregistry-define-2>a href#dom-customelementregistry-define>define/a>/code>(var>name/var>, var>constructor/var>)dd>Defines a new a href#custom-element idcustom-elements-api:custom-element>custom element/a>, mapping the given name to the given constructor as an a href#autonomous-custom-element idcustom-elements-api:autonomous-custom-element>autonomous custom element/a>.dt>var>window/var> . code idcustom-elements-api:dom-window-customelements-2>a href#dom-window-customelements>customElements/a>/code> . code idcustom-elements-api:dom-customelementregistry-define-3>a href#dom-customelementregistry-define>define/a>/code>(var>name/var>, var>constructor/var>, { extends: var>baseLocalName/var> })dd>Defines a new a href#custom-element idcustom-elements-api:custom-element-2>custom element/a>, mapping the given name to the given constructor as a a href#customized-built-in-element idcustom-elements-api:customized-built-in-element>customized built-in element/a> for the a href#element-type idcustom-elements-api:element-type>element type/a> identified by the supplied var>baseLocalName/var>. A a idcustom-elements-api:notsupportederror hrefhttps://heycam.github.io/webidl/#notsupportederror data-x-internalnotsupportederror>code>NotSupportedError/code>/a> code idcustom-elements-api:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> will be thrown upon trying to extend a a href#custom-element idcustom-elements-api:custom-element-3>custom element/a> or an unknown element.dt>var>window/var> . code idcustom-elements-api:dom-window-customelements-3>a href#dom-window-customelements>customElements/a>/code> . code idcustom-elements-api:dom-customelementregistry-get-2>a href#dom-customelementregistry-get>get/a>/code>(var>name/var>)dd>Retrieves the a href#custom-element-constructor idcustom-elements-api:custom-element-constructor-2>custom element constructor/a> defined for the given a href#concept-custom-element-definition-name idcustom-elements-api:concept-custom-element-definition-name-2>name/a>. Returns undefined if there is no a href#custom-element-definition idcustom-elements-api:custom-element-definition-2>custom element definition/a> with the given a href#concept-custom-element-definition-name idcustom-elements-api:concept-custom-element-definition-name-3>name/a>.dt>var>window/var> . code idcustom-elements-api:dom-window-customelements-4>a href#dom-window-customelements>customElements/a>/code> . code idcustom-elements-api:dom-customelementregistry-whendefined-3>a href#dom-customelementregistry-whendefined>whenDefined/a>/code>(var>name/var>)dd>Returns a promise that will be fulfilled when a a href#custom-element idcustom-elements-api:custom-element-4>custom element/a> becomes defined with the given name. (If such a a href#custom-element idcustom-elements-api:custom-element-5>custom element/a> is already defined, the returned promise will be immediately fulfilled.) Returns a promise rejected with a a idcustom-elements-api:syntaxerror hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idcustom-elements-api:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if not given a a href#valid-custom-element-name idcustom-elements-api:valid-custom-element-name-2>valid custom element name/a>./dl> p>dfn idelement-definition>Element definition/dfn> is a process of adding a a href#custom-element-definition idcustom-elements-api:custom-element-definition-3>custom element definition/a> to the code idcustom-elements-api:customelementregistry-7>a href#customelementregistry>CustomElementRegistry/a>/code>. This is accomplished by the code idcustom-elements-api:dom-customelementregistry-define-4>a href#dom-customelementregistry-define>define()/a>/code> method. When invoked, the dfn iddom-customelementregistry-define>code>define(var>name/var>, var>constructor/var>, var>options/var>)/code>/dfn> method must run these steps:/p> ol>li>p>If a idcustom-elements-api:isconstructor hrefhttps://tc39.github.io/ecma262/#sec-isconstructor data-x-internalisconstructor>IsConstructor/a>(var>constructor/var>) is false, then throw a code idcustom-elements-api:typeerror>a data-x-internaltypeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror>TypeError/a>/code> and abort these steps.li>p>If var>name/var> is not a a href#valid-custom-element-name idcustom-elements-api:valid-custom-element-name-3>valid custom element name/a>, then throw a a idcustom-elements-api:syntaxerror-2 hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idcustom-elements-api:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>If this code idcustom-elements-api:customelementregistry-8>a href#customelementregistry>CustomElementRegistry/a>/code> contains an entry with a href#concept-custom-element-definition-name idcustom-elements-api:concept-custom-element-definition-name-4>name/a> var>name/var>, then throw a a idcustom-elements-api:notsupportederror-2 hrefhttps://heycam.github.io/webidl/#notsupportederror data-x-internalnotsupportederror>code>NotSupportedError/code>/a> code idcustom-elements-api:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>If this code idcustom-elements-api:customelementregistry-9>a href#customelementregistry>CustomElementRegistry/a>/code> contains an entry with a href#concept-custom-element-definition-constructor idcustom-elements-api:concept-custom-element-definition-constructor-2>constructor/a> var>constructor/var>, then throw a a idcustom-elements-api:notsupportederror-3 hrefhttps://heycam.github.io/webidl/#notsupportederror data-x-internalnotsupportederror>code>NotSupportedError/code>/a> code idcustom-elements-api:domexception-5>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Let var>localName/var> be var>name/var>.li>p>Let var>extends/var> be the value of the code>extends/code> member of var>options/var>, or null if no such member exists.li> p>If var>extends/var> is not null, then:/p> ol>li>p>If var>extends/var> is a a href#valid-custom-element-name idcustom-elements-api:valid-custom-element-name-4>valid custom element name/a>, then throw a a idcustom-elements-api:notsupportederror-4 hrefhttps://heycam.github.io/webidl/#notsupportederror data-x-internalnotsupportederror>code>NotSupportedError/code>/a> code idcustom-elements-api:domexception-6>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If the a idcustom-elements-api:element-interface hrefhttps://dom.spec.whatwg.org/#concept-element-interface data-x-internalelement-interface>element interface/a> for var>extends/var> and the a idcustom-elements-api:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a> is code idcustom-elements-api:htmlunknownelement>a href#htmlunknownelement>HTMLUnknownElement/a>/code> (e.g., if var>extends/var> does not indicate an element definition in this specification), then throw a a idcustom-elements-api:notsupportederror-5 hrefhttps://heycam.github.io/webidl/#notsupportederror data-x-internalnotsupportederror>code>NotSupportedError/code>/a> code idcustom-elements-api:domexception-7>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Set var>localName/var> to var>extends/var>./ol> li>p>If this code idcustom-elements-api:customelementregistry-10>a href#customelementregistry>CustomElementRegistry/a>/code>s a href#element-definition-is-running idcustom-elements-api:element-definition-is-running>element definition is running/a> flag is set, then throw a a idcustom-elements-api:notsupportederror-6 hrefhttps://heycam.github.io/webidl/#notsupportederror data-x-internalnotsupportederror>code>NotSupportedError/code>/a> code idcustom-elements-api:domexception-8>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Set this code idcustom-elements-api:customelementregistry-11>a href#customelementregistry>CustomElementRegistry/a>/code>s a href#element-definition-is-running idcustom-elements-api:element-definition-is-running-2>element definition is running/a> flag.li> p>Run the following substeps while catching any exceptions:/p> ol>li>p>Let var>prototype/var> be a hrefhttps://tc39.github.io/ecma262/#sec-get-o-p idcustom-elements-api:js-get data-x-internaljs-get>Get/a>(var>constructor/var>, prototype). Rethrow any exceptions.li>p>If a hrefhttps://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values idcustom-elements-api:js-type data-x-internaljs-type>Type/a>(var>prototype/var>) is not Object, then throw a code idcustom-elements-api:typeerror-2>a data-x-internaltypeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror>TypeError/a>/code> exception.li>p>Let var>lifecycleCallbacks/var> be a map with the four keys code>connectedCallback/code>, code>disconnectedCallback/code>, code>adoptedCallback/code>, and code>attributeChangedCallback/code>, each of which belongs to an entry whose value is null./p> li> p>For each of the four keys var>callbackName/var> in var>lifecycleCallbacks/var>, in the order listed in the previous step:/p> ol>li>p>Let var>callbackValue/var> be a hrefhttps://tc39.github.io/ecma262/#sec-get-o-p idcustom-elements-api:js-get-2 data-x-internaljs-get>Get/a>(var>prototype/var>, var>callbackName/var>). Rethrow any exceptions./p> li>p>If var>callbackValue/var> is not undefined, then set the value of the entry in var>lifecycleCallbacks/var> with key var>callbackName/var> to the result of a hrefhttps://heycam.github.io/webidl/#es-type-mapping idcustom-elements-api:concept-idl-convert data-x-internalconcept-idl-convert>converting/a> var>callbackValue/var> to the Web IDL code idcustom-elements-api:idl-function>a data-x-internalidl-function hrefhttps://heycam.github.io/webidl/#common-Function>Function/a>/code> callback type. Rethrow any exceptions from the conversion./ol> li>p>Let var>observedAttributes/var> be an empty code>sequence<DOMString>/code>.li> p>If the value of the entry in var>lifecycleCallbacks/var> with key code>attributeChangedCallback/code> is not null, then:/p> ol>li>p>Let var>observedAttributesIterable/var> be a hrefhttps://tc39.github.io/ecma262/#sec-get-o-p idcustom-elements-api:js-get-3 data-x-internaljs-get>Get/a>(var>constructor/var>, observedAttributes). Rethrow any exceptions.li>p>If var>observedAttributesIterable/var> is not undefined, then set var>observedAttributes/var> to the result of a hrefhttps://heycam.github.io/webidl/#es-type-mapping idcustom-elements-api:concept-idl-convert-2 data-x-internalconcept-idl-convert>converting/a> var>observedAttributesIterable/var> to a code>sequence<DOMString>/code>. Rethrow any exceptions from the conversion./ol> /ol> p>Then, perform the following substep, regardless of whether the above steps threw an exception or not:/p> ol>li>p>Unset this code idcustom-elements-api:customelementregistry-12>a href#customelementregistry>CustomElementRegistry/a>/code>s a href#element-definition-is-running idcustom-elements-api:element-definition-is-running-3>element definition is running/a> flag./ol> p>Finally, if the first set of substeps threw an exception, then rethrow that exception, and terminate this algorithm. Otherwise, continue onward./p> li>p>Let var>definition/var> be a new a href#custom-element-definition idcustom-elements-api:custom-element-definition-4>custom element definition/a> with a href#concept-custom-element-definition-name idcustom-elements-api:concept-custom-element-definition-name-5>name/a> var>name/var>, a href#concept-custom-element-definition-local-name idcustom-elements-api:concept-custom-element-definition-local-name-2>local name/a> var>localName/var>, a href#concept-custom-element-definition-constructor idcustom-elements-api:concept-custom-element-definition-constructor-3>constructor/a> var>constructor/var>, a href#concept-custom-element-definition-observed-attributes idcustom-elements-api:concept-custom-element-definition-observed-attributes>observed attributes/a> var>observedAttributes/var>, and a href#concept-custom-element-definition-lifecycle-callbacks idcustom-elements-api:concept-custom-element-definition-lifecycle-callbacks>lifecycle callbacks/a> var>lifecycleCallbacks/var>.li>p>Add var>definition/var> to this code idcustom-elements-api:customelementregistry-13>a href#customelementregistry>CustomElementRegistry/a>/code>.li>p>Let var>document/var> be this code idcustom-elements-api:customelementregistry-14>a href#customelementregistry>CustomElementRegistry/a>/code>s a href#concept-relevant-global idcustom-elements-api:concept-relevant-global>relevant global object/a>s a href#concept-document-window idcustom-elements-api:concept-document-window>associated code>Document/code>/a>.li>p>Let var>upgrade candidates/var> be all elements that are a hrefhttps://dom.spec.whatwg.org/#concept-shadow-including-descendant idcustom-elements-api:shadow-including-descendant data-x-internalshadow-including-descendant>shadow-including descendants/a> of var>document/var>, whose namespace is the a idcustom-elements-api:html-namespace-2-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a> and whose local name is var>localName/var>, in a idcustom-elements-api:shadow-including-tree-order hrefhttps://dom.spec.whatwg.org/#concept-shadow-including-tree-order data-x-internalshadow-including-tree-order>shadow-including tree order/a>. Additionally, if var>extends/var> is non-null, only include elements whose a hrefhttps://dom.spec.whatwg.org/#concept-element-is-value idcustom-elements-api:concept-element-is-value data-x-internalconcept-element-is-value>code>is/code> value/a> is equal to var>name/var>.li>p>For each element var>element/var> in var>upgrade candidates/var>, a href#enqueue-a-custom-element-upgrade-reaction idcustom-elements-api:enqueue-a-custom-element-upgrade-reaction>enqueue a custom element upgrade reaction/a> given var>element/var> and var>definition/var>.li> p>If this code idcustom-elements-api:customelementregistry-15>a href#customelementregistry>CustomElementRegistry/a>/code>s a href#when-defined-promise-map idcustom-elements-api:when-defined-promise-map>when-defined promise map/a> contains an entry with key var>name/var>:/p> ol>li>p>Let var>promise/var> be the value of that entry.li>p>Resolve var>promise/var> with undefined.li>p>Delete the entry with key var>name/var> from this code idcustom-elements-api:customelementregistry-16>a href#customelementregistry>CustomElementRegistry/a>/code>s a href#when-defined-promise-map idcustom-elements-api:when-defined-promise-map-2>when-defined promise map/a>./ol> /ol> p>When invoked, the dfn iddom-customelementregistry-get>code>get(var>name/var>)/code>/dfn> method must run these steps:/p> ol>li>p>If this code idcustom-elements-api:customelementregistry-17>a href#customelementregistry>CustomElementRegistry/a>/code> contains an entry with a href#concept-custom-element-definition-name idcustom-elements-api:concept-custom-element-definition-name-6>name/a> var>name/var>, then return that entrys a href#concept-custom-element-definition-constructor idcustom-elements-api:concept-custom-element-definition-constructor-4>constructor/a>.li>p>Otherwise, return undefined./ol> p>When invoked, the dfn iddom-customelementregistry-whendefined>code>whenDefined(var>name/var>)/code>/dfn> method must run these steps:/p> ol>li>p>If var>name/var> is not a a href#valid-custom-element-name idcustom-elements-api:valid-custom-element-name-5>valid custom element name/a>, then return a new promise rejected with a a idcustom-elements-api:syntaxerror-3 hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idcustom-elements-api:domexception-9>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>If this code idcustom-elements-api:customelementregistry-18>a href#customelementregistry>CustomElementRegistry/a>/code> contains an entry with a href#concept-custom-element-definition-name idcustom-elements-api:concept-custom-element-definition-name-7>name/a> var>name/var>, then return a new promise resolved with undefined and abort these steps.li>p>Let var>map/var> be this code idcustom-elements-api:customelementregistry-19>a href#customelementregistry>CustomElementRegistry/a>/code>s a href#when-defined-promise-map idcustom-elements-api:when-defined-promise-map-3>when-defined promise map/a>.li>p>If var>map/var> does not contain an entry with key var>name/var>, create an entry in var>map/var> with key var>name/var> and whose value is a new promise.li>p>Let var>promise/var> be the value of the entry in var>map/var> with key var>name/var>.li>p>Return var>promise/var>./ol> div classexample> p>The code idcustom-elements-api:dom-customelementregistry-whendefined-4>a href#dom-customelementregistry-whendefined>whenDefined()/a>/code> method can be used to avoid performing an action until all appropriate a href#custom-element idcustom-elements-api:custom-element-6>custom elements/a> are a hrefhttps://dom.spec.whatwg.org/#concept-element-defined idcustom-elements-api:concept-element-defined data-x-internalconcept-element-defined>defined/a>. In this example, we combine it with the code idcustom-elements-api:selector-defined>a href#selector-defined>:defined/a>/code> pseudo-class to hide a dynamically-loaded articles contents until were sure that all of the a href#autonomous-custom-element idcustom-elements-api:autonomous-custom-element-2>autonomous custom elements/a> it uses are defined./p> pre>articleContainer.hidden true;fetch(articleURL) .then(response > response.text()) .then(text > { articleContainer.innerHTML text; return Promise.all( ...articleContainer.querySelectorAll(:not(:defined)) .map(el > customElements.whenDefined(el.localName)) ); }) .then(() > { articleContainer.hidden false; });/pre> /div> h4 idupgrades>span classsecno>4.13.5/span> dfn>Upgrades/dfn>a href#upgrades classself-link>/a>/h4> p>To dfn idconcept-upgrade-an-element data-export>upgrade an element/dfn>, given as input a a href#custom-element-definition idupgrades:custom-element-definition>custom element definition/a> var>definition/var> and an element var>element/var>, run the following steps:/p> ol>li> p>If var>element/var> is a hrefhttps://dom.spec.whatwg.org/#concept-element-custom idupgrades:concept-element-custom data-x-internalconcept-element-custom>custom/a>, abort these steps./p> div classexample> p>This can occur due to reentrant invocation of this algorithm, as in the following example:/p> pre><!DOCTYPE html><x-foo ida></x-foo><x-foo idb></x-foo><script>// Defining enqueues upgrade reactions for both a and bcustomElements.define(x-foo, class extends HTMLElement { constructor() { super(); const b document.querySelector(#b); b.remove(); // While this constructor is running for a, b is still // undefined, and so inserting it into the document will enqueue a // second upgrade reaction for b in addition to the one enqueued // by defining x-foo. document.body.appendChild(b); }})</script>/pre> p>This step will thus bail out the algorithm early when a href#concept-upgrade-an-element idupgrades:concept-upgrade-an-element>upgrade an element/a> is invoked with code>b/code> a second time./p> /div> li>p>If var>element/var>s a idupgrades:custom-element-state hrefhttps://dom.spec.whatwg.org/#concept-element-custom-element-state data-x-internalcustom-element-state>custom element state/a> is code>failed/code>, then abort these steps.li>p>Set var>element/var>s a hrefhttps://dom.spec.whatwg.org/#concept-element-custom-element-definition idupgrades:concept-element-custom-element-definition data-x-internalconcept-element-custom-element-definition>custom element definition/a> to var>definition/var>.li>p>For each var>attribute/var> in var>element/var>s a idupgrades:attribute-list hrefhttps://dom.spec.whatwg.org/#concept-element-attribute data-x-internalattribute-list>attribute list/a>, in order, a href#enqueue-a-custom-element-callback-reaction idupgrades:enqueue-a-custom-element-callback-reaction>enqueue a custom element callback reaction/a> with var>element/var>, callback name code>attributeChangedCallback/code>, and an argument list containing var>attribute/var>s local name, null, var>attribute/var>s value, and var>attribute/var>s namespace.li>p>If var>element/var> is a idupgrades:connected hrefhttps://dom.spec.whatwg.org/#connected data-x-internalconnected>connected/a>, then a href#enqueue-a-custom-element-callback-reaction idupgrades:enqueue-a-custom-element-callback-reaction-2>enqueue a custom element callback reaction/a> with var>element/var>, callback name code>connectedCallback/code>, and an empty argument list.li>p>Add var>element/var> to the end of var>definition/var>s a href#concept-custom-element-definition-construction-stack idupgrades:concept-custom-element-definition-construction-stack>construction stack/a>.li>p>Let var>C/var> be var>definition/var>s a href#concept-custom-element-definition-constructor idupgrades:concept-custom-element-definition-constructor>constructor/a>.li> p>Run the following substeps while catching any exceptions:/p> ol>li> p>Let var>constructResult/var> be the result of a hrefhttps://heycam.github.io/webidl/#construct-a-callback-function idupgrades:es-constructing-callback-functions data-x-internales-constructing-callback-functions>constructing/a> var>C/var>, with no arguments./p> p classnote>If var>C/var> a href#custom-element-conformance>non-conformantly/a> uses an API decorated with the code idupgrades:cereactions>a href#cereactions>CEReactions/a>/code> extended attribute, then the reactions enqueued at the beginning of this algorithm will execute during this step, before var>C/var> finishes and control returns to this algorithm. Otherwise, they will execute after var>C/var> and the rest of the upgrade process finishes./p> li> p>If a idupgrades:samevalue hrefhttps://tc39.github.io/ecma262/#sec-samevalue data-x-internalsamevalue>SameValue/a>(var>constructResult/var>, var>element/var>) is false, then throw an a idupgrades:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idupgrades:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> p classnote>This can occur if var>C/var> constructs another instance of the same custom element before calling code>super()/code>, or if var>C/var> uses JavaScripts code>return/code>-override feature to return an arbitrary object from the constructor./p> /ol> p>Then, perform the following substep, regardless of whether the above steps threw an exception or not:/p> ol>li> p>Remove the last entry from the end of var>definition/var>s a href#concept-custom-element-definition-construction-stack idupgrades:concept-custom-element-definition-construction-stack-2>construction stack/a>./p> div classnote> p>Assuming var>C/var> calls code>super()/code> (as it will if it is a href#custom-element-conformance>conformant/a>), and that the call succeeds, this will be the a href#concept-already-constructed-marker idupgrades:concept-already-constructed-marker>i>already constructed/i> marker/a> that replaced the var>element/var> we pushed at the beginning of this algorithm. (The a href#html-element-constructors>HTML element constructor/a> carries out this replacement.)/p> p>If var>C/var> does not call code>super()/code> (i.e. it is not a href#custom-element-conformance>conformant/a>), or if any step in the a href#html-element-constructors>HTML element constructor/a> throws, then this entry will still be var>element/var>./p> /div> /ol> p>Finally, if the above steps threw an exception, then:/p> ol>li>p>Set var>element/var>s a idupgrades:custom-element-state-2 hrefhttps://dom.spec.whatwg.org/#concept-element-custom-element-state data-x-internalcustom-element-state>custom element state/a> to code>failed/code>.li>p>Set var>element/var>s a hrefhttps://dom.spec.whatwg.org/#concept-element-custom-element-definition idupgrades:concept-element-custom-element-definition-2 data-x-internalconcept-element-custom-element-definition>custom element definition/a> to null.li>p>Empty var>element/var>s a href#custom-element-reaction-queue idupgrades:custom-element-reaction-queue>custom element reaction queue/a>./p> li>p>Rethrow the exception, and terminate this algorithm./ol> li>p>Set var>element/var>s a idupgrades:custom-element-state-3 hrefhttps://dom.spec.whatwg.org/#concept-element-custom-element-state data-x-internalcustom-element-state>custom element state/a> to code>custom/code>./ol> p>To dfn idconcept-try-upgrade data-export>try to upgrade an element/dfn>, given as input an element var>element/var>, run the following steps:/p> ol>li>p>Let var>definition/var> be the result of a href#look-up-a-custom-element-definition idupgrades:look-up-a-custom-element-definition>looking up a custom element definition/a> given var>element/var>s a idupgrades:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, var>element/var>s namespace, var>element/var>s local name, and var>element/var>s a hrefhttps://dom.spec.whatwg.org/#concept-element-is-value idupgrades:concept-element-is-value data-x-internalconcept-element-is-value>code>is/code> value/a>.li>p>If var>definition/var> is not null, then a href#enqueue-a-custom-element-upgrade-reaction idupgrades:enqueue-a-custom-element-upgrade-reaction>enqueue a custom element upgrade reaction/a> given var>element/var> and var>definition/var>./ol> h4 idcustom-element-reactions>span classsecno>4.13.6/span> Custom element reactionsa href#custom-element-reactions classself-link>/a>/h4> p>A a href#custom-element idcustom-element-reactions:custom-element>custom element/a> possesses the ability to respond to certain occurrences by running author code:/p> ul>li>p>When a href#upgrades idcustom-element-reactions:upgrades>upgraded/a>, its a href#custom-element-constructor idcustom-element-reactions:custom-element-constructor>constructor/a> is run, with no arguments.li>p>When it a href#becomes-connected idcustom-element-reactions:becomes-connected>becomes connected/a>, its code>connectedCallback/code> is called, with no arguments.li>p>When it a href#becomes-disconnected idcustom-element-reactions:becomes-disconnected>becomes disconnected/a>, its code>disconnectedCallback/code> is called, with no arguments.li>p>When it is a hrefhttps://dom.spec.whatwg.org/#concept-node-adopt idcustom-element-reactions:concept-node-adopt data-x-internalconcept-node-adopt>adopted/a> into a new document, its code>adoptedCallback/code> is called, given the old document and new document as arguments.li>p>When any of its attributes are a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-change idcustom-element-reactions:concept-element-attributes-change data-x-internalconcept-element-attributes-change>changed/a>, a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-append idcustom-element-reactions:concept-element-attributes-append data-x-internalconcept-element-attributes-append>appended/a>, a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-remove idcustom-element-reactions:concept-element-attributes-remove data-x-internalconcept-element-attributes-remove>removed/a>, or a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-replace idcustom-element-reactions:concept-element-attributes-replace data-x-internalconcept-element-attributes-replace>replaced/a>, its code>attributeChangedCallback/code> is called, given the attributes local name, old value, new value, and namespace as arguments. (An attributes old or new value is considered to be null when the attribute is added or removed, respectively.)/ul> p>We call these reactions collectively dfn idconcept-custom-element-reaction>custom element reactions/dfn>./p> p>The way in which a href#concept-custom-element-reaction idcustom-element-reactions:concept-custom-element-reaction>custom element reactions/a> are invoked is done with special care, to avoid running author code during the middle of delicate operations. Effectively, they are delayed until just before returning to user script. This means that for most purposes they appear to execute synchronously, but in the case of complicated composite operations (like a hrefhttps://dom.spec.whatwg.org/#concept-node-clone idcustom-element-reactions:concept-node-clone data-x-internalconcept-node-clone>cloning/a>, or a hrefhttps://dom.spec.whatwg.org/#concept-range idcustom-element-reactions:concept-range data-x-internalconcept-range>range/a> manipulation), they will instead be delayed until after all the relevant user agent processing steps have completed, and then run together as a batch./p> p>Additionally, the precise ordering of these reactions is managed via a somewhat-complicated stack-of-queues system, described below. The intention behind this system is to guarantee that a href#concept-custom-element-reaction idcustom-element-reactions:concept-custom-element-reaction-2>custom element reactions/a> always are invoked in the same order as their triggering actions, at least within the local context of a single a href#custom-element idcustom-element-reactions:custom-element-2>custom element/a>. (Because a href#concept-custom-element-reaction idcustom-element-reactions:concept-custom-element-reaction-3>custom element reaction/a> code can perform its own mutations, it is not possible to give a global ordering guarantee across multiple elements.)/p> hr> p>Each a href#unit-of-related-similar-origin-browsing-contexts idcustom-element-reactions:unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts/a> has a dfn idcustom-element-reactions-stack>custom element reactions stack/dfn>, which is initially empty. The dfn idcurrent-element-queue>current element queue/dfn> is the a href#element-queue idcustom-element-reactions:element-queue>element queue/a> at the top of the a href#custom-element-reactions-stack idcustom-element-reactions:custom-element-reactions-stack>custom element reactions stack/a>. Each item in the stack is an dfn idelement-queue>element queue/dfn>, which is initially empty as well. Each item in an a href#element-queue idcustom-element-reactions:element-queue-2>element queue/a> is an element. (The elements are not necessarily a hrefhttps://dom.spec.whatwg.org/#concept-element-custom idcustom-element-reactions:concept-element-custom data-x-internalconcept-element-custom>custom/a> yet, since this queue is used for a href#upgrades idcustom-element-reactions:upgrades-2>upgrades/a> as well.)/p> p>Each a href#custom-element-reactions-stack idcustom-element-reactions:custom-element-reactions-stack-2>custom element reactions stack/a> has an associated dfn idbackup-element-queue>backup element queue/dfn>, which an initially-empty a href#element-queue idcustom-element-reactions:element-queue-3>element queue/a>. Elements are pushed onto the a href#backup-element-queue idcustom-element-reactions:backup-element-queue>backup element queue/a> during operations that affect the DOM without going through an API decorated with code idcustom-element-reactions:cereactions>a href#cereactions>CEReactions/a>/code>, or through the parsers a href#create-an-element-for-the-token idcustom-element-reactions:create-an-element-for-the-token>create an element for the token/a> algorithm. An example of this is a user-initiated editing operation which modifies the descendants or attributes of an a idcustom-element-reactions:editable hrefhttps://w3c.github.io/editing/execCommand.html#editable data-x-internaleditable>editable/a> element. To prevent reentrancy when processing the a href#backup-element-queue idcustom-element-reactions:backup-element-queue-2>backup element queue/a>, each a href#custom-element-reactions-stack idcustom-element-reactions:custom-element-reactions-stack-3>custom element reactions stack/a> also has a dfn idprocessing-the-backup-element-queue>processing the backup element queue/dfn> flag, initially unset./p> p>All elements have an associated dfn idcustom-element-reaction-queue>custom element reaction queue/dfn>, initially empty. Each item in the a href#custom-element-reaction-queue idcustom-element-reactions:custom-element-reaction-queue>custom element reaction queue/a> is of one of two types:/p> ul>li>p>An dfn idupgrade-reaction>upgrade reaction/dfn>, which will a href#upgrades idcustom-element-reactions:upgrades-3>upgrade/a> the custom element and contains a a href#custom-element-definition idcustom-element-reactions:custom-element-definition>custom element definition/a>; orli>p>A dfn idcallback-reaction>callback reaction/dfn>, which will call a lifecycle callback, and contains a callback function as well as a list of arguments./ul> p>This is all summarized in the following schematic diagram:/p> p>img src/images/custom-element-reactions.svg altA custom element reactions stack consists of a stack of element queues. Zooming in on a particular queue, we see that it contains a number of elements (in our example, x-a>, then x-b>, then x-c>). Any particular element in the queue then has a custom element reaction queue. Zooming in on the custom element reaction queue, we see that it contains a variety of queued-up reactions (in our example, upgrade, then attribute changed, then another attribute changed, then connected). stylewidth: 80%; max-width: 580px;>/p> p>To dfn idenqueue-an-element-on-the-appropriate-element-queue>enqueue an element on the appropriate element queue/dfn>, given an element var>element/var>, run the following steps:/p> ol>li> p>If the a href#custom-element-reactions-stack idcustom-element-reactions:custom-element-reactions-stack-4>custom element reactions stack/a> is empty, then:/p> ol>li>p>Add var>element/var> to the a href#backup-element-queue idcustom-element-reactions:backup-element-queue-3>backup element queue/a>.li>p>If the a href#processing-the-backup-element-queue idcustom-element-reactions:processing-the-backup-element-queue>processing the backup element queue/a> flag is set, abort this algorithm.li>p>Set the a href#processing-the-backup-element-queue idcustom-element-reactions:processing-the-backup-element-queue-2>processing the backup element queue/a> flag.li> p>a href#queue-a-microtask idcustom-element-reactions:queue-a-microtask>Queue a microtask/a> to perform the following steps:/p> ol>li>p>a href#invoke-custom-element-reactions idcustom-element-reactions:invoke-custom-element-reactions>Invoke custom element reactions/a> in the a href#backup-element-queue idcustom-element-reactions:backup-element-queue-4>backup element queue/a>.li>p>Unset the a href#processing-the-backup-element-queue idcustom-element-reactions:processing-the-backup-element-queue-3>processing the backup element queue/a> flag./ol> /ol> li>p>Otherwise, add var>element/var> to the a href#current-element-queue idcustom-element-reactions:current-element-queue>current element queue/a>./ol> p>To dfn idenqueue-a-custom-element-callback-reaction data-export>enqueue a custom element callback reaction/dfn>, given a a href#custom-element idcustom-element-reactions:custom-element-3>custom element/a> var>element/var>, a callback name var>callbackName/var>, and a list of arguments var>args/var>, run the following steps:/p> ol>li>p>Let var>definition/var> be var>element/var>s a hrefhttps://dom.spec.whatwg.org/#concept-element-custom-element-definition idcustom-element-reactions:concept-element-custom-element-definition data-x-internalconcept-element-custom-element-definition>custom element definition/a>./p> li>p>Let var>callback/var> be the value of the entry in var>definition/var>s a href#concept-custom-element-definition-lifecycle-callbacks idcustom-element-reactions:concept-custom-element-definition-lifecycle-callbacks>lifecycle callbacks/a> with key var>callbackName/var>.li>p>If var>callback/var> is null, then abort these steps.li> p>If var>callbackName/var> is code>attributeChangedCallback/code>, then:/p> ol>li>p>Let var>attributeName/var> be the first element of var>args/var>.li>p>If var>definition/var>s a href#concept-custom-element-definition-observed-attributes idcustom-element-reactions:concept-custom-element-definition-observed-attributes>observed attributes/a> does not contain var>attributeName/var>, then abort these steps./ol> li>p>Add a new a href#callback-reaction idcustom-element-reactions:callback-reaction>callback reaction/a> to var>element/var>s a href#custom-element-reaction-queue idcustom-element-reactions:custom-element-reaction-queue-2>custom element reaction queue/a>, with callback function var>callback/var> and arguments var>args/var>.li>p>a href#enqueue-an-element-on-the-appropriate-element-queue idcustom-element-reactions:enqueue-an-element-on-the-appropriate-element-queue>Enqueue an element on the appropriate element queue/a> given var>element/var>./ol> p>To dfn idenqueue-a-custom-element-upgrade-reaction data-export>enqueue a custom element upgrade reaction/dfn>, given an element var>element/var> and a href#custom-element-definition idcustom-element-reactions:custom-element-definition-2>custom element definition/a> var>definition/var>, run the following steps:/p> ol>li>p>Add a new a href#upgrade-reaction idcustom-element-reactions:upgrade-reaction>upgrade reaction/a> to var>element/var>s a href#custom-element-reaction-queue idcustom-element-reactions:custom-element-reaction-queue-3>custom element reaction queue/a>, with a href#custom-element-definition idcustom-element-reactions:custom-element-definition-3>custom element definition/a> var>definition/var>.li>p>a href#enqueue-an-element-on-the-appropriate-element-queue idcustom-element-reactions:enqueue-an-element-on-the-appropriate-element-queue-2>Enqueue an element on the appropriate element queue/a> given var>element/var>./ol> p>To dfn idinvoke-custom-element-reactions>invoke custom element reactions/dfn> in an a href#element-queue idcustom-element-reactions:element-queue-4>element queue/a> var>queue/var>, run the following steps:/p> ol>li> p>For each a href#custom-element idcustom-element-reactions:custom-element-4>custom element/a> var>element/var> in var>queue/var>:/p> ol>li>p>Let var>reactions/var> be var>element/var>s a href#custom-element-reaction-queue idcustom-element-reactions:custom-element-reaction-queue-4>custom element reaction queue/a>.li> p>Repeat until var>reactions/var> is empty:/p> ol>li> p>Remove the first element of var>reactions/var>, and let var>reaction/var> be that element. Switch on var>reaction/var>s type:/p> dl classswitch>dt>a href#upgrade-reaction idcustom-element-reactions:upgrade-reaction-2>upgrade reaction/a>dd>a href#concept-upgrade-an-element idcustom-element-reactions:concept-upgrade-an-element>Upgrade/a> var>element/var> using var>reaction/var>s a href#custom-element-definition idcustom-element-reactions:custom-element-definition-4>custom element definition/a>.dt>a href#callback-reaction idcustom-element-reactions:callback-reaction-2>callback reaction/a>dd>a hrefhttps://heycam.github.io/webidl/#invoke-a-callback-function idcustom-element-reactions:es-invoking-callback-functions data-x-internales-invoking-callback-functions>Invoke/a> var>reaction/var>s callback function with var>reaction/var>s arguments, and with var>element/var> as the a hrefhttps://heycam.github.io/webidl/#dfn-callback-this-value idcustom-element-reactions:dfn-callback-this-value data-x-internaldfn-callback-this-value>callback this value/a>./dl> p>If this throws an exception, catch it, and a href#report-the-exception idcustom-element-reactions:report-the-exception>report the exception/a>./p> /ol> /ol> /ol> hr> p>To ensure a href#concept-custom-element-reaction idcustom-element-reactions:concept-custom-element-reaction-4>custom element reactions/a> are triggered appropriately, we introduce the dfn idcereactions data-dfn-typeextended-attribute data-ltCEReactions data-export>code>CEReactions/code>/dfn> IDL a idcustom-element-reactions:extended-attribute hrefhttps://heycam.github.io/webidl/#dfn-extended-attribute data-x-internalextended-attribute>extended attribute/a>. It indicates that the relevant algorithm is to be supplemented with additional steps in order to appropriately track and invoke a href#concept-custom-element-reaction idcustom-element-reactions:concept-custom-element-reaction-5>custom element reactions/a>./p> p>The code idcustom-element-reactions:cereactions-2>a href#cereactions>CEReactions/a>/code> extended attribute must take no arguments, and must not appear on anything other than an operation, attribute, setter, or deleter. Additionally, it must not appear on readonly attributes./p> p>Operations, attributes, setters, or deleters annotated with the code idcustom-element-reactions:cereactions-3>a href#cereactions>CEReactions/a>/code> extended attribute must run the following steps surrounding the actions listed in the description of the operation, setter, deleter, or the attributes setter:/p> dl>dt>Before executing the listed actionsdd>Push a new a href#element-queue idcustom-element-reactions:element-queue-5>element queue/a> onto the a href#custom-element-reactions-stack idcustom-element-reactions:custom-element-reactions-stack-5>custom element reactions stack/a>.dt>After executing the listed actionsdd>Pop the a href#element-queue idcustom-element-reactions:element-queue-6>element queue/a> from the a href#custom-element-reactions-stack idcustom-element-reactions:custom-element-reactions-stack-6>custom element reactions stack/a>, and a href#invoke-custom-element-reactions idcustom-element-reactions:invoke-custom-element-reactions-2>invoke custom element reactions/a> in that queue./dl> div classnote> p>The intent behind this extended attribute is somewhat subtle. One way of accomplishing its goals would be to say that every operation, attribute, setter, and deleter on the platform must have these steps inserted, and to allow implementers to optimize away unnecessary cases (where no DOM mutation is possible that could cause a href#concept-custom-element-reaction idcustom-element-reactions:concept-custom-element-reaction-6>custom element reactions/a> to occur)./p> p>However, in practice this imprecision could lead to non-interoperable implementations of a href#concept-custom-element-reaction idcustom-element-reactions:concept-custom-element-reaction-7>custom element reactions/a>, as some implementations might forget to invoke these steps in some cases. Instead, we settled on the approach of explicitly annotating all relevant IDL constructs, as a way of ensuring interoperable behavior and helping implementations easily pinpoint all cases where these steps are necessary./p> /div> p>Any nonstandard APIs introduced by the user agent that could modify the DOM in such a way as to cause a href#enqueue-a-custom-element-callback-reaction idcustom-element-reactions:enqueue-a-custom-element-callback-reaction>enqueuing a custom element callback reaction/a> or a href#enqueue-a-custom-element-upgrade-reaction idcustom-element-reactions:enqueue-a-custom-element-upgrade-reaction>enqueuing a custom element upgrade reaction/a>, for example by modifying any attributes or child elements, must also be decorated with the code idcustom-element-reactions:cereactions-4>a href#cereactions>CEReactions/a>/code> attribute./p> div classnote> p>As of the time of this writing, the following nonstandard or not-yet-standardized APIs are known to fall into this category:/p> ul>li>p>code idcustom-element-reactions:htmlelement>a href#htmlelement>HTMLElement/a>/code>s code>outerText/code> IDL attributeli>p>code idcustom-element-reactions:htmlinputelement>a href#htmlinputelement>HTMLInputElement/a>/code>s code>webkitdirectory/code> and code>incremental/code> IDL attributesli>p>code idcustom-element-reactions:htmllinkelement>a href#htmllinkelement>HTMLLinkElement/a>/code>s code>disabled/code> and code>scope/code> IDL attributesli>p>code idcustom-element-reactions:shadowroot>a data-x-internalshadowroot hrefhttps://dom.spec.whatwg.org/#interface-shadowroot>ShadowRoot/a>/code>s code>innerHTML/code> IDL attribute/ul> /div> h3 idcommon-idioms>span classsecno>4.14/span> Common idioms without dedicated elementsa href#common-idioms classself-link>/a>/h3> h4 idthe-main-part-of-the-content>span classsecno>4.14.1/span> The main part of the contenta href#the-main-part-of-the-content classself-link>/a>/h4> p>The main content of a page — not including headers and footers, navigation links, sidebars, advertisements, and so forth — can be marked up in a variety of ways, depending on the needs of the author./p> p>The simplest solution is to not mark up the main content at all, and just leave it as implicit. Another way to think of this is that the code idthe-main-part-of-the-content:the-body-element>a href#the-body-element>body/a>/code> elements marks up the main content of the page, and the bits that arent main content are excluded through the use of more appropriate elements like code idthe-main-part-of-the-content:the-aside-element>a href#the-aside-element>aside/a>/code> and code idthe-main-part-of-the-content:the-nav-element>a href#the-nav-element>nav/a>/code>./p> div classexample> p>Here is a short Web page marked up along this minimalistic school of thought. The main content is highlighted. Notice how all the em>other/em> content in the code idthe-main-part-of-the-content:the-body-element-2>a href#the-body-element>body/a>/code> is marked up with elements to indicate that its not part of the main content, in this case code idthe-main-part-of-the-content:the-header-element>a href#the-header-element>header/a>/code>, code idthe-main-part-of-the-content:the-nav-element-2>a href#the-nav-element>nav/a>/code>, and code idthe-main-part-of-the-content:the-footer-element>a href#the-footer-element>footer/a>/code>./p> pre><!DOCTYPE HTML><html langen> <head> <title> My Toys </title> </head> <body> <header> <h1>My toys</h1> </header> <nav> <p><a href/>Home</a></p> <p><a href/contact>Contact</a></p> </nav>strong> <p>I really like my chained book and my telephone. Im not such a fan of my big ball.</p> <p>Another toy I like is my mirror.</p>/strong> <footer> <p>© copyright 2010 by the boy</p> </footer> </body></html>/pre> /div> p>If the main content is an independent unit of content that one could imagine syndicating independently, then the code idthe-main-part-of-the-content:the-article-element>a href#the-article-element>article/a>/code> element would be appropriate to mark up the main content of the document./p> div classexample> p>The document in the previous example is here recast as a blog post:/p> pre><!DOCTYPE HTML><html langen> <head> <title> The Boy Blog: My Toys </title> </head> <body> <header> <h1>The Boy Blog</h1> </header> <nav> <p><a href/>Home</a></p> <p><a href/contact>Contact</a></p> </nav>strong> <article> <header> <h1>My toys</h1> <p>Published August 4th</p> </header> <p>I really like my chained book and my telephone. Im not such a fan of my big ball.</p> <p>Another toy I like is my mirror.</p> </article>/strong> <footer> <p>© copyright 2010 by the boy</p> </footer> </body></html>/pre> /div> p>If the main content is not an independent unit of content so much as a section of a larger work, for instance a chapter, then the code idthe-main-part-of-the-content:the-section-element>a href#the-section-element>section/a>/code> element would be appropriate to mark up the main content of the document./p> div classexample> p>Here is the same document, but as a chapter in an online book:/p> pre><!DOCTYPE HTML><html langen> <head> <title> Chapter 2: My Toys — The Book of the Boy </title> </head> <body> <header> <hgroup> <h1>The Book of the Boy</h1> <h2>A book about boy stuff</h2> </hgroup> </header> <nav> <p><a href/>Front Page</a></p> <p><a href/toc>Table of Contents</a></p> <p><a href/c1>Chapter 1</a> — <a href/c3>Chapter 3</a></p> </nav>strong> <section> <h1>Chapter 2: My Toys</h1> <p>I really like my chained book and my telephone. Im not such a fan of my big ball.</p> <p>Another toy I like is my mirror.</p> </section>/strong> </body></html>/pre> /div> p>If neither code idthe-main-part-of-the-content:the-article-element-2>a href#the-article-element>article/a>/code> nor code idthe-main-part-of-the-content:the-section-element-2>a href#the-section-element>section/a>/code> would be appropriate, but the main content still needs an explicit element, for example for styling purposes, then the code idthe-main-part-of-the-content:the-main-element>a href#the-main-element>main/a>/code> element can be used./p> div classexample> p>This is the same as the original example, but using code idthe-main-part-of-the-content:the-main-element-2>a href#the-main-element>main/a>/code> for the main content instead of leaving it implied:/p> pre><!DOCTYPE HTML><html langen> <head> <title> My Toys </title> <style> body > main { background: navy; color: yellow; } </style> </head> <body> <header> <h1>My toys</h1> </header> <nav> <p><a href/>Home</a></p> <p><a href/contact>Contact</a></p> </nav>strong> <main> <p>I really like my chained book and my telephone. Im not such a fan of my big ball.</p> <p>Another toy I like is my mirror.</p> </main>/strong> <footer> <p>© copyright 2010 by the boy</p> </footer> </body></html>/pre> /div> h4 idrel-up>span classsecno>4.14.2/span> Bread crumb navigationa href#rel-up classself-link>/a>/h4> p>This specification does not provide a machine-readable way of describing bread-crumb navigation menus. Authors are encouraged to just use a series of links in a paragraph. The code idrel-up:the-nav-element>a href#the-nav-element>nav/a>/code> element can be used to mark the section containing these paragraphs as being navigation blocks./p> div classexample> p>In the following example, the current page can be reached via two paths./p> pre><nav> <p> <a href/>Main</a> ▸ <a href/products/>Products</a> ▸ <a href/products/dishwashers/>Dishwashers</a> ▸ <a>Second hand</a> </p> <p> <a href/>Main</a> ▸ <a href/second-hand/>Second hand</a> ▸ <a>Dishwashers</a> </p></nav>/pre> /div> h4 idtag-clouds>span classsecno>4.14.3/span> Tag cloudsa href#tag-clouds classself-link>/a>/h4> p idtag-cloud>This specification does not define any markup specifically for marking up lists of keywords that apply to a group of pages (also known as i>tag clouds/i>). In general, authors are encouraged to either mark up such lists using code idtag-clouds:the-ul-element>a href#the-ul-element>ul/a>/code> elements with explicit inline counts that are then hidden and turned into a presentational effect using a style sheet, or to use SVG./p> div classexample> p>Here, three tags are included in a short tag cloud:/p> pre><style>.tag-cloud > li > span { display: none; }.tag-cloud > li { display: inline; }.tag-cloud-1 { font-size: 0.7em; }.tag-cloud-2 { font-size: 0.9em; }.tag-cloud-3 { font-size: 1.1em; }.tag-cloud-4 { font-size: 1.3em; }.tag-cloud-5 { font-size: 1.5em; }@media speech { .tag-cloud > li > span { display:inline }}</style>...<ul classtag-cloud> <li classtag-cloud-4><a title28 instances href/t/apple>apple</a> <span>(popular)</span> <li classtag-cloud-2><a title6 instances href/t/kiwi>kiwi</a> <span>(rare)</span> <li classtag-cloud-5><a title41 instances href/t/pear>pear</a> <span>(very popular)</span></ul>/pre> p>The actual frequency of each tag is given using the code idtag-clouds:attr-title>a href#attr-title>title/a>/code> attribute. A CSS style sheet is provided to convert the markup into a cloud of differently-sized words, but for user agents that do not support CSS or are not visual, the markup contains annotations like (popular) or (rare) to categorize the various tags by frequency, thus enabling all users to benefit from the information./p> p>The code idtag-clouds:the-ul-element-2>a href#the-ul-element>ul/a>/code> element is used (rather than code idtag-clouds:the-ol-element>a href#the-ol-element>ol/a>/code>) because the order is not particularly important: while the list is in fact ordered alphabetically, it would convey the same information if ordered by, say, the length of the tag./p> p>The code idtag-clouds:link-type-tag>a href#link-type-tag>tag/a>/code> code idtag-clouds:attr-hyperlink-rel>a href#attr-hyperlink-rel>rel/a>/code>-keyword is em>not/em> used on these code idtag-clouds:the-a-element>a href#the-a-element>a/a>/code> elements because they do not represent tags that apply to the page itself; they are just part of an index listing the tags themselves./p> /div> h4 idconversations>span classsecno>4.14.4/span> Conversationsa href#conversations classself-link>/a>/h4> p>This specification does not define a specific element for marking up conversations, meeting minutes, chat transcripts, dialogues in screenplays, instant message logs, and other situations where different players take turns in discourse./p> p>Instead, authors are encouraged to mark up conversations using code idconversations:the-p-element>a href#the-p-element>p/a>/code> elements and punctuation. Authors who need to mark the speaker for styling purposes are encouraged to use code idconversations:the-span-element>a href#the-span-element>span/a>/code> or code idconversations:the-b-element>a href#the-b-element>b/a>/code>. Paragraphs with their text wrapped in the code idconversations:the-i-element>a href#the-i-element>i/a>/code> element can be used for marking up stage directions./p> div classexample> p>This example demonstrates this using an extract from Abbot and Costellos famous sketch, cite>Whos on first/cite>:/p>pre><p> Costello: Look, you gotta first baseman?<p> Abbott: Certainly.<p> Costello: Whos playing first?<p> Abbott: Thats right.<p> Costello becomes exasperated.<p> Costello: When you pay off the first baseman every month, who gets the money?<p> Abbott: Every dollar of it./pre> /div> div classexample> p>The following extract shows how an IM conversation log could be marked up, using the code idconversations:the-data-element>a href#the-data-element>data/a>/code> element to provide Unix timestamps for each line. Note that the timestamps are provided in a format that the code idconversations:the-time-element>a href#the-time-element>time/a>/code> element does not support, so the code idconversations:the-data-element-2>a href#the-data-element>data/a>/code> element is used instead (namely, Unix code>time_t/code> timestamps). Had the author wished to mark up the data using one of the date and time formats supported by the code idconversations:the-time-element-2>a href#the-time-element>time/a>/code> element, that element could have been used instead of code idconversations:the-data-element-3>a href#the-data-element>data/a>/code>. This could be advantageous as it would allow data analysis tools to detect the timestamps unambiguously, without coordination with the page author./p> pre><p> <data value1319898155>14:22</data> <b>egof</b> Im not that nerdy, Ive only seen 30% of the star trek episodes<p> <data value1319898192>14:23</data> <b>kaj</b> if you know what percentage of the star trek episodes you have seen, you are inarguably nerdy<p> <data value1319898200>14:23</data> <b>egof</b> its unarguably<p> <data value1319898228>14:23</data> <i>* kaj blinks</i><p> <data value1319898260>14:24</data> <b>kaj</b> you are not helping your case/pre> /div> div classexample> p>HTML does not have a good way to mark up graphs, so descriptions of interactive conversations from games are more difficult to mark up. This example shows one possible convention using code idconversations:the-dl-element>a href#the-dl-element>dl/a>/code> elements to list the possible responses at each point in the conversation. Another option to consider is describing the conversation in the form of a DOT file, and outputting the result as an SVG image to place in the document. a href#refsDOT>DOT/a>/p> pre><p> Next, you meet a fisher. You can say one of several greetings:<dl> <dt> Hello there! <dd> <p> She responds with Hello, how may I help you?; you can respond with: <dl> <dt> I would like to buy a fish. <dd> <p> She sells you a fish and the conversation finishes. <dt> Can I borrow your boat? <dd> <p> She is surprised and asks What are you offering in return?. <dl> <dt> Five gold. (if you have enough) <dt> Ten gold. (if you have enough) <dt> Fifteen gold. (if you have enough) <dd> <p> She lends you her boat. The conversation ends. <dt> A fish. (if you have one) <dt> A newspaper. (if you have one) <dt> A pebble. (if you have one) <dd> <p> No thanks, she replies. Your conversation options at this point are the same as they were after asking to borrow her boat, minus any options youve suggested before. </dl> </dd> </dl> </dd> <dt> Vote for me in the next election! <dd> <p> She turns away. The conversation finishes. <dt> Madam, are you aware that your fish are running away? <dd> <p> She looks at you skeptically and says Fish cannot run, miss. <dl> <dt> You got me! <dd> <p> The fisher sighs and the conversation ends. <dt> Only kidding. <dd> <p> Good one! she retorts. Your conversation options at this point are the same as those following Hello there! above. <dt> Oh, then what are they doing? <dd> <p> She looks at her fish, giving you an opportunity to steal her boat, which you do. The conversation ends. </dl> </dd></dl>/pre> /div> div classexample> p>In some games, conversations are simpler: each character merely has a fixed set of lines that they say. In this example, a game FAQ/walkthrough lists some of the known possible responses for each character:/p> pre><section> <h1>Dialogue</h1> <p><small>Some characters repeat their lines in order each time you interact with them, others randomly pick from amongst their lines. Those who respond in order have numbered entries in the lists below.</small> <h2>The Shopkeeper</h2> <ul> <li>How may I help you? <li>Fresh apples! <li>A loaf of bread for madam? </ul> <h2>The pilot</h2> <p>Before the accident: <ul> <li>Im about to fly out, sorry! <li>Sorry, Im just waiting for flight clearance and then Ill be off! </ul> <p>After the accident: <ol> <li>Im about to fly out, sorry! <li>Ok, Im not leaving right now, my plane is being cleaned. <li>Ok, its not being cleaned, it needs a minor repair first. <li>Ok, ok, stop bothering me! Truth is, I had a crash. </ol> <h2>Clan Leader</h2> <p>During the first clan meeting: <ul> <li>Hey, have you seen my daughter? I bet shes up to something nefarious again... <li>Nice weather were having today, eh? <li>The name is Bailey, Jeff Bailey. How can I help you today? <li>A glass of water? Fresh from the well! </ul> <p>After the earthquake: <ol> <li>Everyone is safe in the shelter, we just have to put out the fire! <li>Ill go and tell the fire brigade, you keep hosing it down! </ol></section>/pre> /div> h4 idfootnotes>span classsecno>4.14.5/span> Footnotesa href#footnotes classself-link>/a>/h4> p>HTML does not have a dedicated mechanism for marking up footnotes. Here are the suggested alternatives./p> hr> p>For short inline annotations, the code idfootnotes:attr-title>a href#attr-title>title/a>/code> attribute could be used./p> div classexample> p>In this example, two parts of a dialogue are annotated with footnote-like content using the code idfootnotes:attr-title-2>a href#attr-title>title/a>/code> attribute./p> pre><p> <b>Customer</b>: Hello! I wish to register a complaint. Hello. Miss?<p> <b>Shopkeeper</b>: strong><span titleColloquial pronunciation of What do you/strong>>Watcha</span> mean, miss?<p> <b>Customer</b>: Uh, Im sorry, I have a cold. I wish to make a complaint.<p> <b>Shopkeeper</b>: Sorry, <span strong>titleThis is, of course, a lie./strong>>wereclosing for lunch</span>./pre> /div> p classnote>Unfortunately, relying on the code idfootnotes:attr-title-3>a href#attr-title>title/a>/code> attribute is currently discouraged as many user agents do not expose the attribute in an accessible manner as required by this specification (e.g. requiring a pointing device such as a mouse to cause a tooltip to appear, which excludes keyboard-only users and touch-only users, such as anyone with a modern phone or tablet)./p> p classnote>If the code idfootnotes:attr-title-4>a href#attr-title>title/a>/code> attribute is used, CSS can be used to draw the readers attention to the elements with the attribute./p> div classexample> p>For example, the following CSS places a dashed line below elements that have a code idfootnotes:attr-title-5>a href#attr-title>title/a>/code> attribute./p> pre>title { border-bottom: thin dashed; }/pre> /div> hr> p>For longer annotations, the code idfootnotes:the-a-element>a href#the-a-element>a/a>/code> element should be used, pointing to an element later in the document. The convention is that the contents of the link be a number in square brackets./p> div classexample> p>In this example, a footnote in the dialogue links to a paragraph below the dialogue. The paragraph then reciprocally links back to the dialogue, allowing the user to return to the location of the footnote./p> pre><p> Announcer: Number 16: The <i>hand</i>.<p> Interviewer: Good evening. I have with me in the studio tonightMr Norman St John Polevaulter, who for the past few years has beencontradicting people. Mr Polevaulter, why <em>do</em> youcontradict people?<p> Norman: I dont. <sup><a href#fn1 idr1>1</a></sup><p> Interviewer: You told me you did!em>.../em><section> <p idfn1><a href#r1>1</a> This is, naturally, a lie, but paradoxically if it were true he could not say so without contradicting the interviewer and thus making it false.</p></section>/pre> /div> hr> p>For side notes, longer annotations that apply to entire sections of the text rather than just specific words or sentences, the code idfootnotes:the-aside-element>a href#the-aside-element>aside/a>/code> element should be used./p> div classexample> p>In this example, a sidebar is given after a dialogue, giving it some context./p> pre><p> <span classspeaker>Customer</span>: I will not buy this record, it is scratched.<p> <span classspeaker>Shopkeeper</span>: Im sorry?<p> <span classspeaker>Customer</span>: I will not buy this record, it is scratched.<p> <span classspeaker>Shopkeeper</span>: No no no, thissa tobacconists.<aside> <p>In 1970, the British Empire lay in ruins, and foreign nationalists frequented the streets — many of them Hungarians (not the streets — the foreign nationals). Sadly, Alexander Yalt has been publishing incompetently-written phrase books.</aside>/pre> /div> hr> p>For figures or tables, footnotes can be included in the relevant code idfootnotes:the-figcaption-element>a href#the-figcaption-element>figcaption/a>/code> or code idfootnotes:the-caption-element>a href#the-caption-element>caption/a>/code> element, or in surrounding prose./p> div classexample> p>In this example, a table has cells with footnotes that are given in prose. A code idfootnotes:the-figure-element>a href#the-figure-element>figure/a>/code> element is used to give a single legend to the combination of the table and its footnotes./p> pre><figure> <figcaption>Table 1. Alternative activities for knights.</figcaption> <table> <tr> <th> Activity <th> Location <th> Cost <tr> <td> Dance <td> Wherever possible <td> £0<sup><a href#fn1>1</a></sup> <tr> <td> Routines, chorus scenes<sup><a href#fn2>2</a></sup> <td> Undisclosed <td> Undisclosed <tr> <td> Dining<sup><a href#fn3>3</a></sup> <td> Camelot <td> Cost of ham, jam, and spam<sup><a href#fn4>4</a></sup> </table> <p idfn1>1. Assumed.</p> <p idfn2>2. Footwork impeccable.</p> <p idfn3>3. Quality described as well.</p> <p idfn4>4. A lot.</p></figure>/pre> /div> h3 iddisabled-elements>span classsecno>4.15/span> Disabled elementsa href#disabled-elements classself-link>/a>/h3> p>An element is said to be dfn idconcept-element-disabled>actually disabled/dfn> if it is one of the following:/p> ul>li>a code iddisabled-elements:the-button-element>a href#the-button-element>button/a>/code> element that is a href#concept-fe-disabled iddisabled-elements:concept-fe-disabled>disabled/a>li>an code iddisabled-elements:the-input-element>a href#the-input-element>input/a>/code> element that is a href#concept-fe-disabled iddisabled-elements:concept-fe-disabled-2>disabled/a>li>a code iddisabled-elements:the-select-element>a href#the-select-element>select/a>/code> element that is a href#concept-fe-disabled iddisabled-elements:concept-fe-disabled-3>disabled/a>li>a code iddisabled-elements:the-textarea-element>a href#the-textarea-element>textarea/a>/code> element that is a href#concept-fe-disabled iddisabled-elements:concept-fe-disabled-4>disabled/a>li>an code iddisabled-elements:the-optgroup-element>a href#the-optgroup-element>optgroup/a>/code> element that has a code iddisabled-elements:attr-optgroup-disabled>a href#attr-optgroup-disabled>disabled/a>/code> attributeli>an code iddisabled-elements:the-option-element>a href#the-option-element>option/a>/code> element that is a href#concept-option-disabled iddisabled-elements:concept-option-disabled>disabled/a>li>a code iddisabled-elements:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code> element that is a a href#concept-fieldset-disabled iddisabled-elements:concept-fieldset-disabled>disabled fieldset/a>/ul> p classnote>This definition is used to determine what elements a href#specially-focusable iddisabled-elements:specially-focusable>can be focused/a> and which elements match the code iddisabled-elements:selector-enabled>a href#selector-enabled>:enabled/a>/code> and code iddisabled-elements:selector-disabled>a href#selector-disabled>:disabled/a>/code> a hrefhttps://drafts.csswg.org/selectors/#pseudo-class iddisabled-elements:pseudo-class data-x-internalpseudo-class>pseudo-classes/a>./p> h3 idselectors>span classsecno>4.16/span> Matching HTML elements using selectors and CSSa href#selectors classself-link>/a>/h3> h4 idcase-sensitivity-of-the-css-attr()-function>span classsecno>4.16.1/span> Case-sensitivity of the CSS a idcase-sensitivity-of-the-css-attr()-function:attr() hrefhttps://drafts.csswg.org/css-values/#funcdef-attr data-x-internalattr()>attr()/a> functiona href#case-sensitivity-of-the-css-attr()-function classself-link>/a>/h4> p>The CSS Values and Units specification leaves the case-sensitivity of attribute names for the purpose of the a idcase-sensitivity-of-the-css-attr()-function:attr()-2 hrefhttps://drafts.csswg.org/css-values/#funcdef-attr data-x-internalattr()>attr()/a> function to be defined by the host language. a href#refsCSSVALUES>CSSVALUES/a>/p> p>When comparing the attribute name part of a CSS a idcase-sensitivity-of-the-css-attr()-function:attr()-3 hrefhttps://drafts.csswg.org/css-values/#funcdef-attr data-x-internalattr()>attr()/a> function to the names of namespace-less attributes on a href#html-elements idcase-sensitivity-of-the-css-attr()-function:html-elements>HTML elements/a> in a idcase-sensitivity-of-the-css-attr()-function:html-documents hrefhttps://dom.spec.whatwg.org/#html-document data-x-internalhtml-documents>HTML documents/a>, the name part of the CSS a idcase-sensitivity-of-the-css-attr()-function:attr()-4 hrefhttps://drafts.csswg.org/css-values/#funcdef-attr data-x-internalattr()>attr()/a> function must first be a idcase-sensitivity-of-the-css-attr()-function:converted-to-ascii-lowercase hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>. The same function when compared to other attributes must be compared according to its original case. In both cases, the comparison is a href#case-sensitive idcase-sensitivity-of-the-css-attr()-function:case-sensitive>case-sensitive/a>./p> p classnote>This is the same as comparing the name part of a CSS a idcase-sensitivity-of-the-css-attr()-function:attribute-selector hrefhttps://drafts.csswg.org/selectors/#attribute-selector data-x-internalattribute-selector>attribute selector/a>, specified in the next section./p> h4 idcase-sensitivity-of-selectors>span classsecno>4.16.2/span> Case-sensitivity of selectorsa href#case-sensitivity-of-selectors classself-link>/a>/h4> p>The Selectors specification leaves the case-sensitivity of element names, attribute names, and attribute values to be defined by the host language. a href#refsSELECTORS>SELECTORS/a>/p> p>When comparing a CSS element a idcase-sensitivity-of-selectors:type-selector hrefhttps://drafts.csswg.org/selectors/#type-selector data-x-internaltype-selector>type selector/a> to the names of a href#html-elements idcase-sensitivity-of-selectors:html-elements>HTML elements/a> in a idcase-sensitivity-of-selectors:html-documents hrefhttps://dom.spec.whatwg.org/#html-document data-x-internalhtml-documents>HTML documents/a>, the CSS element a idcase-sensitivity-of-selectors:type-selector-2 hrefhttps://drafts.csswg.org/selectors/#type-selector data-x-internaltype-selector>type selector/a> must first be a idcase-sensitivity-of-selectors:converted-to-ascii-lowercase hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>. The same selector when compared to other elements must be compared according to its original case. In both cases, the comparison is a href#case-sensitive idcase-sensitivity-of-selectors:case-sensitive>case-sensitive/a>./p> p>When comparing the name part of a CSS a idcase-sensitivity-of-selectors:attribute-selector hrefhttps://drafts.csswg.org/selectors/#attribute-selector data-x-internalattribute-selector>attribute selector/a> to the names of attributes on a href#html-elements idcase-sensitivity-of-selectors:html-elements-2>HTML elements/a> in a idcase-sensitivity-of-selectors:html-documents-2 hrefhttps://dom.spec.whatwg.org/#html-document data-x-internalhtml-documents>HTML documents/a>, the name part of the CSS a idcase-sensitivity-of-selectors:attribute-selector-2 hrefhttps://drafts.csswg.org/selectors/#attribute-selector data-x-internalattribute-selector>attribute selector/a> must first be a idcase-sensitivity-of-selectors:converted-to-ascii-lowercase-2 hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>. The same selector when compared to other attributes must be compared according to its original case. In both cases, the comparison is a href#case-sensitive idcase-sensitivity-of-selectors:case-sensitive-2>case-sensitive/a>./p> p>a hrefhttps://drafts.csswg.org/selectors/#attribute-selector idcase-sensitivity-of-selectors:attribute-selector-3 data-x-internalattribute-selector>Attribute selectors/a> on an a href#html-elements idcase-sensitivity-of-selectors:html-elements-3>HTML element/a> in an a hrefhttps://dom.spec.whatwg.org/#html-document idcase-sensitivity-of-selectors:html-documents-3 data-x-internalhtml-documents>HTML document/a> must treat the em>values/em> of attributes with the following names as a idcase-sensitivity-of-selectors:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a>, with one exception as noted a href#attribute-selector-case-sensitive>in the rendering section/a>:/p> ul classbrief>li>code>accept/code> li>code>accept-charset/code> li>code>align/code> li>code>alink/code> li>code>axis/code> li>code>bgcolor/code> li>code>charset/code> li>code>checked/code> li>code>clear/code> li>code>codetype/code> li>code>color/code> li>code>compact/code> li>code>declare/code> li>code>defer/code> li>code>dir/code> li>code>direction/code> li>code>disabled/code> li>code>enctype/code> li>code>face/code> li>code>frame/code> li>code>hreflang/code> li>code>http-equiv/code> li>code>lang/code> li>code>language/code> li>code>link/code> li>code>media/code> li>code>method/code> li>code>multiple/code> li>code>nohref/code> li>code>noresize/code> li>code>noshade/code> li>code>nowrap/code> li>code>readonly/code> li>code>rel/code> li>code>rev/code> li>code>rules/code> li>code>scope/code> li>code>scrolling/code> li>code>selected/code> li>code>shape/code> li>code>target/code> li>code>text/code> li>code>type/code> (except as specified in the rendering section) li>code>valign/code> li>code>valuetype/code> li>code>vlink/code> /ul> div classexample> p>For example, the selector code>bgcolor#ffffff/code> will match any HTML element with a code>bgcolor/code> attribute with values including code>#ffffff/code>, code>#FFFFFF/code> and code>#fffFFF/code>. This happens even if code>bgcolor/code> has no effect for a given element (e.g., code idcase-sensitivity-of-selectors:the-div-element>a href#the-div-element>div/a>/code>)./p> /div> p>All other attribute values and everything else must be treated as entirely a href#case-sensitive idcase-sensitivity-of-selectors:case-sensitive-3>case-sensitive/a> for the purposes of selector matching. This includes:/p> ul classbrief>li> a hrefhttps://dom.spec.whatwg.org/#concept-id idcase-sensitivity-of-selectors:concept-id data-x-internalconcept-id>IDs/a> and a hrefhttps://dom.spec.whatwg.org/#concept-class idcase-sensitivity-of-selectors:concept-class data-x-internalconcept-class>classes/a> in a idcase-sensitivity-of-selectors:no-quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-no-quirks data-x-internalno-quirks-mode>no-quirks mode/a> and a idcase-sensitivity-of-selectors:limited-quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-limited-quirks data-x-internallimited-quirks-mode>limited-quirks mode/a> li> the names of elements not in the a idcase-sensitivity-of-selectors:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a> li> the names of a href#html-elements idcase-sensitivity-of-selectors:html-elements-4>HTML elements/a> in a idcase-sensitivity-of-selectors:xml-documents hrefhttps://dom.spec.whatwg.org/#xml-document data-x-internalxml-documents>XML documents/a> li> the names of attributes of elements not in the a idcase-sensitivity-of-selectors:html-namespace-2-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a> li> the names of attributes of a href#html-elements idcase-sensitivity-of-selectors:html-elements-5>HTML elements/a> in a idcase-sensitivity-of-selectors:xml-documents-2 hrefhttps://dom.spec.whatwg.org/#xml-document data-x-internalxml-documents>XML documents/a> li> the names of attributes that themselves have namespaces /ul> p classnote>cite>Selectors/cite> defines that ID and class selectors (such as code>#foo/code> and code>.bar/code>), when matched against elements in documents that are in a idcase-sensitivity-of-selectors:quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>, will be matched in an a idcase-sensitivity-of-selectors:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> manner. However, this does not apply for attribute selectors with code>id/code> or code>class/code> as the name part. The selector code>classfoobar/code> will treat its value as a href#case-sensitive idcase-sensitivity-of-selectors:case-sensitive-4>case-sensitive/a> even in a idcase-sensitivity-of-selectors:quirks-mode-2 hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>./p> h4 idpseudo-classes>span classsecno>4.16.3/span> Pseudo-classesa href#pseudo-classes classself-link>/a>/h4> p>There are a number of dynamic selectors that can be used with HTML. This section defines when these selectors match HTML elements. a href#refsSELECTORS>SELECTORS/a> a href#refsCSSUI>CSSUI/a>/p> dl>dt>dfn idselector-defined data-dfn-typeselector data-export>code>:defined/code>/dfn>dd> p>The code idpseudo-classes:selector-defined>a href#selector-defined>:defined/a>/code> a idpseudo-classes:pseudo-class hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> must match any element that is a hrefhttps://dom.spec.whatwg.org/#concept-element-defined idpseudo-classes:concept-element-defined data-x-internalconcept-element-defined>defined/a>./p> dt>dfn idselector-link>code>:link/code>/dfn>dt>dfn idselector-visited>code>:visited/code>/dfn>dd> p>All code idpseudo-classes:the-a-element>a href#the-a-element>a/a>/code> elements that have an code idpseudo-classes:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute, all code idpseudo-classes:the-area-element>a href#the-area-element>area/a>/code> elements that have an code idpseudo-classes:attr-hyperlink-href-2>a href#attr-hyperlink-href>href/a>/code> attribute, and all code idpseudo-classes:the-link-element>a href#the-link-element>link/a>/code> elements that have an code idpseudo-classes:attr-link-href>a href#attr-link-href>href/a>/code> attribute, must match one of code idpseudo-classes:selector-link>a href#selector-link>:link/a>/code> and code idpseudo-classes:selector-visited>a href#selector-visited>:visited/a>/code>./p> p>Other specifications might apply more specific rules regarding how these elements are to match these a hrefhttps://drafts.csswg.org/selectors/#pseudo-class idpseudo-classes:pseudo-class-2 data-x-internalpseudo-class>pseudo-classes/a>, to mitigate some privacy concerns that apply with straightforward implementations of this requirement./p> dt>dfn idselector-active>code>:active/code>/dfn>dd> p>The code idpseudo-classes:selector-active>a href#selector-active>:active/a>/code> a idpseudo-classes:pseudo-class-3 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> is defined to match an element q citehttps://drafts.csswg.org/selectors3/#the-user-action-pseudo-classes-hover-act>while an element is dfn idconcept-selector-active>i>being activated/i>/dfn> by the user/q>./p> p>To determine whether a particular element is i idpseudo-classes:concept-selector-active>a href#concept-selector-active>being activated/a>/i> for the purposes of defining the code idpseudo-classes:selector-active-2>a href#selector-active>:active/a>/code> a idpseudo-classes:pseudo-class-4 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> only, an HTML user agent must use the first relevant entry in the following list./p> dl>dt>If the element has a descendant that is currently matching the code idpseudo-classes:selector-active-3>a href#selector-active>:active/a>/code> a idpseudo-classes:pseudo-class-5 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a>dd>p>The element is i idpseudo-classes:concept-selector-active-2>a href#concept-selector-active>being activated/a>/i>.dt>If the element is the a href#labeled-control idpseudo-classes:labeled-control>labeled control/a> of a code idpseudo-classes:the-label-element>a href#the-label-element>label/a>/code> element that is currently matching code idpseudo-classes:selector-active-4>a href#selector-active>:active/a>/code>dd>p>The element is i idpseudo-classes:concept-selector-active-3>a href#concept-selector-active>being activated/a>/i>.dt>If the element is a code idpseudo-classes:the-button-element>a href#the-button-element>button/a>/code> elementdt>If the element is an code idpseudo-classes:the-input-element>a href#the-input-element>input/a>/code> element whose code idpseudo-classes:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#submit-button-state-(typesubmit) idpseudo-classes:submit-button-state-(typesubmit)>Submit Button/a>, a href#image-button-state-(typeimage) idpseudo-classes:image-button-state-(typeimage)>Image Button/a>, a href#reset-button-state-(typereset) idpseudo-classes:reset-button-state-(typereset)>Reset Button/a>, or a href#button-state-(typebutton) idpseudo-classes:button-state-(typebutton)>Button/a> statedd> p>The element is i idpseudo-classes:concept-selector-active-4>a href#concept-selector-active>being activated/a>/i> if it is a href#in-a-formal-activation-state idpseudo-classes:in-a-formal-activation-state>in a formal activation state/a> and it is not a href#concept-fe-disabled idpseudo-classes:concept-fe-disabled>disabled/a>./p> p classexample>For example, if the user is using a keyboard to push a code idpseudo-classes:the-button-element-2>a href#the-button-element>button/a>/code> element by pressing the space bar, the element would match this a idpseudo-classes:pseudo-class-6 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> in between the time that the element received the code idpseudo-classes:event-keydown>a data-x-internalevent-keydown hrefhttps://w3c.github.io/uievents/#event-type-keydown>keydown/a>/code> event and the time the element received the code idpseudo-classes:event-keyup>a data-x-internalevent-keyup hrefhttps://w3c.github.io/uievents/#event-type-keyup>keyup/a>/code> event./p> dt>If the element is an code idpseudo-classes:the-a-element-2>a href#the-a-element>a/a>/code> element that has an code idpseudo-classes:attr-hyperlink-href-3>a href#attr-hyperlink-href>href/a>/code> attributedt>If the element is an code idpseudo-classes:the-area-element-2>a href#the-area-element>area/a>/code> element that has an code idpseudo-classes:attr-hyperlink-href-4>a href#attr-hyperlink-href>href/a>/code> attributedt>If the element is a code idpseudo-classes:the-link-element-2>a href#the-link-element>link/a>/code> element that has an code idpseudo-classes:attr-link-href-2>a href#attr-link-href>href/a>/code> attributedt>If the element has its a href#specially-focusable idpseudo-classes:specially-focusable>tabindex focus flag/a> setdd>p>The element is i idpseudo-classes:concept-selector-active-5>a href#concept-selector-active>being activated/a>/i> if it is a href#in-a-formal-activation-state idpseudo-classes:in-a-formal-activation-state-2>in a formal activation state/a>.dt>If the element is a href#being-actively-pointed-at idpseudo-classes:being-actively-pointed-at>being actively pointed at/a>dd>p>The element is i idpseudo-classes:concept-selector-active-6>a href#concept-selector-active>being activated/a>/i>./dl> p>An element is said to be dfn idin-a-formal-activation-state>in a formal activation state/dfn> between the time the user begins to indicate an intent to trigger the elements a idpseudo-classes:activation-behaviour hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a> and either the time the user stops indicating an intent to trigger the elements a idpseudo-classes:activation-behaviour-2 hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a>, or the time the elements a idpseudo-classes:activation-behaviour-3 hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a> has finished running, which ever comes first./p> p>An element is said to be dfn idbeing-actively-pointed-at>being actively pointed at/dfn> while the user indicates the element using a pointing device while that pointing device is in the down state (e.g. for a mouse, between the time the mouse button is pressed and the time it is depressed; for a finger in a multitouch environment, while the finger is touching the display surface)./p> dt>dfn idselector-hover>code>:hover/code>/dfn>dd> p>The code idpseudo-classes:selector-hover>a href#selector-hover>:hover/a>/code> a idpseudo-classes:pseudo-class-7 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> is defined to match an element q citehttps://drafts.csswg.org/selectors3/#the-user-action-pseudo-classes-hover-act>while the user i>designates/i> an element with a pointing device/q>. For the purposes of defining the code idpseudo-classes:selector-hover-2>a href#selector-hover>:hover/a>/code> a idpseudo-classes:pseudo-class-8 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> only, an HTML user agent must consider an element as being one that the user i>designates/i> if it is:/p> ul>li> p>An element that the user indicates using a pointing device./p> li> p>An element that has a descendant that the user indicates using a pointing device./p> li> p>An element that is the a href#labeled-control idpseudo-classes:labeled-control-2>labeled control/a> of a code idpseudo-classes:the-label-element-2>a href#the-label-element>label/a>/code> element that is currently matching code idpseudo-classes:selector-hover-3>a href#selector-hover>:hover/a>/code>./p> /ul> div classexample> p>Consider in particular a fragment such as:/p> pre><p> <label forc> <input ida> </label> <span idb> <input idc> </span> </p>/pre> p>If the user designates the element with ID code>a/code> with their pointing device, then the code idpseudo-classes:the-p-element>a href#the-p-element>p/a>/code> element (and all its ancestors not shown in the snippet above), the code idpseudo-classes:the-label-element-3>a href#the-label-element>label/a>/code> element, the element with ID code>a/code>, and the element with ID code>c/code> will match the code idpseudo-classes:selector-hover-4>a href#selector-hover>:hover/a>/code> a idpseudo-classes:pseudo-class-9 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a>. The element with ID code>a/code> matches it from condition 1, the code idpseudo-classes:the-label-element-4>a href#the-label-element>label/a>/code> and code idpseudo-classes:the-p-element-2>a href#the-p-element>p/a>/code> elements match it because of condition 2 (one of their descendants is designated), and the element with ID code>c/code> matches it through condition 3 (its code idpseudo-classes:the-label-element-5>a href#the-label-element>label/a>/code> element matches code idpseudo-classes:selector-hover-5>a href#selector-hover>:hover/a>/code>). However, the element with ID code>b/code> does em>not/em> match code idpseudo-classes:selector-hover-6>a href#selector-hover>:hover/a>/code>: its descendant is not designated, even though it matches code idpseudo-classes:selector-hover-7>a href#selector-hover>:hover/a>/code>./p> /div> dt>dfn idselector-focus>code>:focus/code>/dfn>dd> p>For the purposes of the CSS code idpseudo-classes:selector-focus>a href#selector-focus>:focus/a>/code> a idpseudo-classes:pseudo-class-10 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a>, an dfn idelement-has-the-focus>element has the focus/dfn> when its a href#top-level-browsing-context idpseudo-classes:top-level-browsing-context>top-level browsing context/a> has the system focus, it is not itself a a href#browsing-context-container idpseudo-classes:browsing-context-container>browsing context container/a>, and it is one of the elements listed in the a href#focus-chain idpseudo-classes:focus-chain>focus chain/a> of the a href#currently-focused-area-of-a-top-level-browsing-context idpseudo-classes:currently-focused-area-of-a-top-level-browsing-context>currently focused area of the top-level browsing context/a>./p> dt>dfn idselector-target>code>:target/code>/dfn>dd> p>For the purposes of the CSS code idpseudo-classes:selector-focus-2>a href#selector-focus>:target/a>/code> a idpseudo-classes:pseudo-class-11 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a>, the code idpseudo-classes:document>a href#document>Document/a>/code>s i>target elements/i> are a list containing the code idpseudo-classes:document-2>a href#document>Document/a>/code>s a href#target-element idpseudo-classes:target-element>target element/a>, if it is not null, or containing no elements, if it is. a href#refsSELECTORS>SELECTORS/a>/p> dt>dfn idselector-enabled>code>:enabled/code>/dfn>dd> p>The code idpseudo-classes:selector-enabled>a href#selector-enabled>:enabled/a>/code> a idpseudo-classes:pseudo-class-12 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> must match any code idpseudo-classes:the-button-element-3>a href#the-button-element>button/a>/code>, code idpseudo-classes:the-input-element-2>a href#the-input-element>input/a>/code>, code idpseudo-classes:the-select-element>a href#the-select-element>select/a>/code>, code idpseudo-classes:the-textarea-element>a href#the-textarea-element>textarea/a>/code>, code idpseudo-classes:the-optgroup-element>a href#the-optgroup-element>optgroup/a>/code>, code idpseudo-classes:the-option-element>a href#the-option-element>option/a>/code>, or code idpseudo-classes:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code> element that is not a href#concept-element-disabled idpseudo-classes:concept-element-disabled>actually disabled/a>./p> dt>dfn idselector-disabled>code>:disabled/code>/dfn>dd> p>The code idpseudo-classes:selector-disabled>a href#selector-disabled>:disabled/a>/code> a idpseudo-classes:pseudo-class-13 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> must match any element that is a href#concept-element-disabled idpseudo-classes:concept-element-disabled-2>actually disabled/a>./p> dt>dfn idselector-checked>code>:checked/code>/dfn>dd> p>The code idpseudo-classes:selector-checked>a href#selector-checked>:checked/a>/code> a idpseudo-classes:pseudo-class-14 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> must match any element falling into one of the following categories:/p> ul>li>code idpseudo-classes:the-input-element-3>a href#the-input-element>input/a>/code> elements whose code idpseudo-classes:attr-input-type-2>a href#attr-input-type>type/a>/code> attribute is in the a href#checkbox-state-(typecheckbox) idpseudo-classes:checkbox-state-(typecheckbox)>Checkbox/a> state and whose a href#concept-fe-checked idpseudo-classes:concept-fe-checked>checkedness/a> state is trueli>code idpseudo-classes:the-input-element-4>a href#the-input-element>input/a>/code> elements whose code idpseudo-classes:attr-input-type-3>a href#attr-input-type>type/a>/code> attribute is in the a href#radio-button-state-(typeradio) idpseudo-classes:radio-button-state-(typeradio)>Radio Button/a> state and whose a href#concept-fe-checked idpseudo-classes:concept-fe-checked-2>checkedness/a> state is trueli>code idpseudo-classes:the-option-element-2>a href#the-option-element>option/a>/code> elements whose a href#concept-option-selectedness idpseudo-classes:concept-option-selectedness>selectedness/a> is true/ul> dt>dfn idselector-indeterminate>code>:indeterminate/code>/dfn>dd> p>The code idpseudo-classes:selector-indeterminate>a href#selector-indeterminate>:indeterminate/a>/code> a idpseudo-classes:pseudo-class-15 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> must match any element falling into one of the following categories:/p> ul>li>code idpseudo-classes:the-input-element-5>a href#the-input-element>input/a>/code> elements whose code idpseudo-classes:attr-input-type-4>a href#attr-input-type>type/a>/code> attribute is in the a href#checkbox-state-(typecheckbox) idpseudo-classes:checkbox-state-(typecheckbox)-2>Checkbox/a> state and whose code idpseudo-classes:dom-input-indeterminate>a href#dom-input-indeterminate>indeterminate/a>/code> IDL attribute is set to trueli>code idpseudo-classes:the-input-element-6>a href#the-input-element>input/a>/code> elements whose code idpseudo-classes:attr-input-type-5>a href#attr-input-type>type/a>/code> attribute is in the a href#radio-button-state-(typeradio) idpseudo-classes:radio-button-state-(typeradio)-2>Radio Button/a> state and whose a href#radio-button-group idpseudo-classes:radio-button-group>radio button group/a> contains no code idpseudo-classes:the-input-element-7>a href#the-input-element>input/a>/code> elements whose a href#concept-fe-checked idpseudo-classes:concept-fe-checked-3>checkedness/a> state is true.li>code idpseudo-classes:the-progress-element>a href#the-progress-element>progress/a>/code> elements with no code idpseudo-classes:attr-progress-value>a href#attr-progress-value>value/a>/code> content attribute/ul> dt>dfn idselector-default>code>:default/code>/dfn>dd> p>The code idpseudo-classes:selector-default>a href#selector-default>:default/a>/code> a idpseudo-classes:pseudo-class-16 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> must match any element falling into one of the following categories:/p> ul>li>code idpseudo-classes:the-button-element-4>a href#the-button-element>button/a>/code> elements that are their forms a href#default-button idpseudo-classes:default-button>default button/a>li>code idpseudo-classes:the-input-element-8>a href#the-input-element>input/a>/code> elements whose code idpseudo-classes:attr-input-type-6>a href#attr-input-type>type/a>/code> attribute is in the a href#submit-button-state-(typesubmit) idpseudo-classes:submit-button-state-(typesubmit)-2>Submit Button/a> or a href#image-button-state-(typeimage) idpseudo-classes:image-button-state-(typeimage)-2>Image Button/a> state, and that are their forms a href#default-button idpseudo-classes:default-button-2>default button/a>li>code idpseudo-classes:the-input-element-9>a href#the-input-element>input/a>/code> elements to which the code idpseudo-classes:attr-input-checked>a href#attr-input-checked>checked/a>/code> attribute applies and that have a code idpseudo-classes:attr-input-checked-2>a href#attr-input-checked>checked/a>/code> attributeli>code idpseudo-classes:the-option-element-3>a href#the-option-element>option/a>/code> elements that have a code idpseudo-classes:attr-option-selected>a href#attr-option-selected>selected/a>/code> attribute/ul> dt>dfn idselector-placeholder-shown>code>:placeholder-shown/code>/dfn>dd> p>The code idpseudo-classes:selector-placeholder-shown>a href#selector-placeholder-shown>:placeholder-shown/a>/code> a idpseudo-classes:pseudo-class-17 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> must match any element falling into one of the following categories:/p> ul>li>code idpseudo-classes:the-input-element-10>a href#the-input-element>input/a>/code> elements that have a code idpseudo-classes:attr-input-placeholder>a href#attr-input-placeholder>placeholder/a>/code> attribute whose value is currently being presented to the user.li>code idpseudo-classes:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code> elements that have a code idpseudo-classes:attr-textarea-placeholder>a href#attr-textarea-placeholder>placeholder/a>/code> attribute whose value is currently being presented to the user./ul> dt>dfn idselector-valid>code>:valid/code>/dfn>dd> p>The code idpseudo-classes:selector-valid>a href#selector-valid>:valid/a>/code> a idpseudo-classes:pseudo-class-18 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> must match any element falling into one of the following categories:/p> ul>li>elements that are a href#candidate-for-constraint-validation idpseudo-classes:candidate-for-constraint-validation>candidates for constraint validation/a> and that a href#concept-fv-valid idpseudo-classes:concept-fv-valid>satisfy their constraints/a>li>code idpseudo-classes:the-form-element>a href#the-form-element>form/a>/code> elements that are not the a href#form-owner idpseudo-classes:form-owner>form owner/a> of any elements that themselves are a href#candidate-for-constraint-validation idpseudo-classes:candidate-for-constraint-validation-2>candidates for constraint validation/a> but do not a href#concept-fv-valid idpseudo-classes:concept-fv-valid-2>satisfy their constraints/a>li>code idpseudo-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 idpseudo-classes:candidate-for-constraint-validation-3>candidates for constraint validation/a> but do not a href#concept-fv-valid idpseudo-classes:concept-fv-valid-3>satisfy their constraints/a>/ul> dt>dfn idselector-invalid>code>:invalid/code>/dfn>dd> p>The code idpseudo-classes:selector-invalid>a href#selector-invalid>:invalid/a>/code> a idpseudo-classes:pseudo-class-19 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> must match any element falling into one of the following categories:/p> ul>li>elements that are a href#candidate-for-constraint-validation idpseudo-classes:candidate-for-constraint-validation-4>candidates for constraint validation/a> but that do not a href#concept-fv-valid idpseudo-classes:concept-fv-valid-4>satisfy their constraints/a>li>code idpseudo-classes:the-form-element-2>a href#the-form-element>form/a>/code> elements that are the a href#form-owner idpseudo-classes:form-owner-2>form owner/a> of one or more elements that themselves are a href#candidate-for-constraint-validation idpseudo-classes:candidate-for-constraint-validation-5>candidates for constraint validation/a> but do not a href#concept-fv-valid idpseudo-classes:concept-fv-valid-5>satisfy their constraints/a>li>code idpseudo-classes:the-fieldset-element-3>a href#the-fieldset-element>fieldset/a>/code> elements that have of one or more descendant elements that themselves are a href#candidate-for-constraint-validation idpseudo-classes:candidate-for-constraint-validation-6>candidates for constraint validation/a> but do not a href#concept-fv-valid idpseudo-classes:concept-fv-valid-6>satisfy their constraints/a>/ul> dt>dfn idselector-in-range>code>:in-range/code>/dfn>dd> p>The code idpseudo-classes:selector-in-range>a href#selector-in-range>:in-range/a>/code> a idpseudo-classes:pseudo-class-20 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> must match all elements that are a href#candidate-for-constraint-validation idpseudo-classes:candidate-for-constraint-validation-7>candidates for constraint validation/a>, a href#have-range-limitations idpseudo-classes:have-range-limitations>have range limitations/a>, and that are neither a href#suffering-from-an-underflow idpseudo-classes:suffering-from-an-underflow>suffering from an underflow/a> nor a href#suffering-from-an-overflow idpseudo-classes:suffering-from-an-overflow>suffering from an overflow/a>./p> dt>dfn idselector-out-of-range>code>:out-of-range/code>/dfn>dd> p>The code idpseudo-classes:selector-out-of-range>a href#selector-out-of-range>:out-of-range/a>/code> a idpseudo-classes:pseudo-class-21 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> must match all elements that are a href#candidate-for-constraint-validation idpseudo-classes:candidate-for-constraint-validation-8>candidates for constraint validation/a>, a href#have-range-limitations idpseudo-classes:have-range-limitations-2>have range limitations/a>, and that are either a href#suffering-from-an-underflow idpseudo-classes:suffering-from-an-underflow-2>suffering from an underflow/a> or a href#suffering-from-an-overflow idpseudo-classes:suffering-from-an-overflow-2>suffering from an overflow/a>./p> dt>dfn idselector-required>code>:required/code>/dfn>dd> p>The code idpseudo-classes:selector-required>a href#selector-required>:required/a>/code> a idpseudo-classes:pseudo-class-22 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> must match any element falling into one of the following categories:/p> ul>li>code idpseudo-classes:the-input-element-11>a href#the-input-element>input/a>/code> elements that are i idpseudo-classes:concept-input-required>a href#concept-input-required>required/a>/i>li>code idpseudo-classes:the-select-element-2>a href#the-select-element>select/a>/code> elements that have a code idpseudo-classes:attr-select-required>a href#attr-select-required>required/a>/code> attributeli>code idpseudo-classes:the-textarea-element-3>a href#the-textarea-element>textarea/a>/code> elements that have a code idpseudo-classes:attr-textarea-required>a href#attr-textarea-required>required/a>/code> attribute/ul> dt>dfn idselector-optional>code>:optional/code>/dfn>dd> p>The code idpseudo-classes:selector-optional>a href#selector-optional>:optional/a>/code> a idpseudo-classes:pseudo-class-23 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> must match any element falling into one of the following categories:/p> ul>li>code idpseudo-classes:the-input-element-12>a href#the-input-element>input/a>/code> elements to which the code idpseudo-classes:attr-input-required>a href#attr-input-required>required/a>/code> attribute applies that are not i idpseudo-classes:concept-input-required-2>a href#concept-input-required>required/a>/i>li>code idpseudo-classes:the-select-element-3>a href#the-select-element>select/a>/code> elements that do not have a code idpseudo-classes:attr-select-required-2>a href#attr-select-required>required/a>/code> attributeli>code idpseudo-classes:the-textarea-element-4>a href#the-textarea-element>textarea/a>/code> elements that do not have a code idpseudo-classes:attr-textarea-required-2>a href#attr-textarea-required>required/a>/code> attribute/ul> dt>dfn idselector-read-only>code>:read-only/code>/dfn>dt>dfn idselector-read-write>code>:read-write/code>/dfn>dd> p>The code idpseudo-classes:selector-read-write>a href#selector-read-write>:read-write/a>/code> a idpseudo-classes:pseudo-class-24 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> must match any element falling into one of the following categories, which for the purposes of Selectors are thus considered i>user-alterable/i>: a href#refsSELECTORS>SELECTORS/a>/p> ul>li>code idpseudo-classes:the-input-element-13>a href#the-input-element>input/a>/code> elements to which the code idpseudo-classes:attr-input-readonly>a href#attr-input-readonly>readonly/a>/code> attribute applies, and that are i idpseudo-classes:concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i> (i.e. that do not have the code idpseudo-classes:attr-input-readonly-2>a href#attr-input-readonly>readonly/a>/code> attribute specified and that are not a href#concept-fe-disabled idpseudo-classes:concept-fe-disabled-2>disabled/a>)li>code idpseudo-classes:the-textarea-element-5>a href#the-textarea-element>textarea/a>/code> elements that do not have a code idpseudo-classes:attr-textarea-readonly>a href#attr-textarea-readonly>readonly/a>/code> attribute, and that are not a href#concept-fe-disabled idpseudo-classes:concept-fe-disabled-3>disabled/a>li>elements that are a hrefhttps://w3c.github.io/editing/execCommand.html#editing-host idpseudo-classes:editing-host data-x-internalediting-host>editing hosts/a> or a idpseudo-classes:editable hrefhttps://w3c.github.io/editing/execCommand.html#editable data-x-internaleditable>editable/a> and are neither code idpseudo-classes:the-input-element-14>a href#the-input-element>input/a>/code> elements nor code idpseudo-classes:the-textarea-element-6>a href#the-textarea-element>textarea/a>/code> elements/ul> p>The code idpseudo-classes:selector-read-only>a href#selector-read-only>:read-only/a>/code> a idpseudo-classes:pseudo-class-25 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> must match all other a href#html-elements idpseudo-classes:html-elements>HTML elements/a>./p> dt>dfn idselector-ltr>code>:dir(ltr)/code>/dfn>dd> p>The code idpseudo-classes:selector-ltr>a href#selector-ltr>:dir(ltr)/a>/code> a idpseudo-classes:pseudo-class-26 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> must match all elements whose a href#the-directionality idpseudo-classes:the-directionality>directionality/a> is a href#concept-ltr idpseudo-classes:concept-ltr>ltr/a>./p> dt>dfn idselector-rtl>code>:dir(rtl)/code>/dfn>dd> p>The code idpseudo-classes:selector-rtl>a href#selector-rtl>:dir(rtl)/a>/code> a idpseudo-classes:pseudo-class-27 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> must match all elements whose a href#the-directionality idpseudo-classes:the-directionality-2>directionality/a> is a href#concept-rtl idpseudo-classes:concept-rtl>rtl/a>./p> /dl> p classnote>This specification does not define when an element matches the code>:lang()/code> dynamic a idpseudo-classes:pseudo-class-28 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a>, as it is defined in sufficient detail in a language-agnostic fashion in the Selectors specification. a href#refsSELECTORS>SELECTORS/a>/p> h2 idmicrodata>span classsecno>5/span> dfn>Microdata/dfn>a href#microdata classself-link>/a>/h2> h3 idintroduction-7>span classsecno>5.1/span> Introductiona href#introduction-7 classself-link>/a>/h3> h4 idoverview>span classsecno>5.1.1/span> Overviewa href#overview classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>Sometimes, it is desirable to annotate content with specific machine-readable labels, e.g. to allow generic scripts to provide services that are customized to the page, or to enable content from a variety of cooperating authors to be processed by a single script in a consistent manner./p> p>For this purpose, authors can use the microdata features described in this section. Microdata allows nested groups of name-value pairs to be added to documents, in parallel with the existing content./p> h4 idthe-basic-syntax>span classsecno>5.1.2/span> The basic syntaxa href#the-basic-syntax classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>At a high level, microdata consists of a group of name-value pairs. The groups are called a href#concept-item idthe-basic-syntax:concept-item>items/a>, and each name-value pair is a property. Items and properties are represented by regular elements./p> p>To create an item, the code idthe-basic-syntax:attr-itemscope>a href#attr-itemscope>itemscope/a>/code> attribute is used./p> p>To add a property to an item, the code idthe-basic-syntax:names:-the-itemprop-attribute>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute is used on one of the a href#concept-item idthe-basic-syntax:concept-item-2>items/a> descendants./p> div classexample> p>Here there are two items, each of which has the property name:/p> pre><div itemscope> <p>My name is <span itempropname>Elizabeth</span>.</p></div><div itemscope> <p>My name is <span itempropname>Daniel</span>.</p></div>/pre> /div> p>Markup without the microdata-related attributes does not have any effect on the microdata model./p> div classexample> p>These two examples are exactly equivalent, at a microdata level, as the previous two examples respectively:/p> pre><div itemscope> <p>My <em>name</em> is <span itempropname>E<strong>liz</strong>abeth</span>.</p></div><section> <div itemscope> <aside> <p>My name is <span itempropname><a href/?userdaniel>Daniel</a></span>.</p> </aside> </div></section>/pre> /div> p>Properties generally have values that are strings./p> div classexample> p>Here the item has three properties:/p> pre><div itemscope> <p>My name is <span itempropname>Neil</span>.</p> <p>My band is called <span itempropband>Four Parts Water</span>.</p> <p>I am <span itempropnationality>British</span>.</p></div>/pre> /div> p>When a string value is a a idthe-basic-syntax:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>, it is expressed using the code idthe-basic-syntax:the-a-element>a href#the-a-element>a/a>/code> element and its code idthe-basic-syntax:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute, the code idthe-basic-syntax:the-img-element>a href#the-img-element>img/a>/code> element and its code idthe-basic-syntax:attr-img-src>a href#attr-img-src>src/a>/code> attribute, or other elements that link to or embed external resources./p> div classexample> p>In this example, the item has one property, image, whose value is a URL:/p> pre><div itemscope> <img itempropimage srcgoogle-logo.png altGoogle></div>/pre> /div> p>When a string value is in some machine-readable format unsuitable for human consumption, it is expressed using the code idthe-basic-syntax:attr-data-value>a href#attr-data-value>value/a>/code> attribute of the code idthe-basic-syntax:the-data-element>a href#the-data-element>data/a>/code> element, with the human-readable version given in the elements contents./p> div classexample> p>Here, there is an item with a property whose value is a product ID. The ID is not human-friendly, so the products name is used the human-visible text instead of the ID./p> pre><h1 itemscope> <data itempropproduct-id value9678AOU879>The Instigator 2000</data></h1>/pre> /div> p>For numeric data, the code idthe-basic-syntax:the-meter-element>a href#the-meter-element>meter/a>/code> element and its code idthe-basic-syntax:attr-meter-value>a href#attr-meter-value>value/a>/code> attribute can be used instead./p> div classexample> p>Here a rating is given using a code idthe-basic-syntax:the-meter-element-2>a href#the-meter-element>meter/a>/code> element./p> pre><div itemscope itemtypehttp://schema.org/Product> <span itempropname>Panasonic White 60L Refrigerator</span> <img srcpanasonic-fridge-60l-white.jpg alt> <div itempropaggregateRating itemscope itemtypehttp://schema.org/AggregateRating> <meter itempropratingValue min0 value3.5 max5>Rated 3.5/5</meter> (based on <span itempropreviewCount>11</span> customer reviews) </div></div>/pre> /div> p>Similarly, for date- and time-related data, the code idthe-basic-syntax:the-time-element>a href#the-time-element>time/a>/code> element and its code idthe-basic-syntax:attr-time-datetime>a href#attr-time-datetime>datetime/a>/code> attribute can be used instead./p> div classexample> p>In this example, the item has one property, birthday, whose value is a date:/p> pre><div itemscope> I was born on <time itempropbirthday datetime2009-05-10>May 10th 2009</time>.</div>/pre> /div> p>Properties can also themselves be groups of name-value pairs, by putting the code idthe-basic-syntax:attr-itemscope-2>a href#attr-itemscope>itemscope/a>/code> attribute on the element that declares the property./p> p>Items that are not part of others are called a href#top-level-microdata-items idthe-basic-syntax:top-level-microdata-items>top-level microdata items/a>./p> div classexample> p>In this example, the outer item represents a person, and the inner one represents a band:/p> pre><div itemscope> <p>Name: <span itempropname>Amanda</span></p> <p>Band: <span itempropband itemscope> <span itempropname>Jazz Band</span> (<span itempropsize>12</span> players)</span></p></div>/pre> p>The outer item here has two properties, name and band. The name is Amanda, and the band is an item in its own right, with two properties, name and size. The name of the band is Jazz Band, and the size is 12./p> p>The outer item in this example is a top-level microdata item./p> /div> p>Properties that are not descendants of the element with the code idthe-basic-syntax:attr-itemscope-3>a href#attr-itemscope>itemscope/a>/code> attribute can be associated with the a href#concept-item idthe-basic-syntax:concept-item-3>item/a> using the code idthe-basic-syntax:attr-itemref>a href#attr-itemref>itemref/a>/code> attribute. This attribute takes a list of IDs of elements to crawl in addition to crawling the children of the element with the code idthe-basic-syntax:attr-itemscope-4>a href#attr-itemscope>itemscope/a>/code> attribute./p> div classexample> p>This example is the same as the previous one, but all the properties are separated from their a href#concept-item idthe-basic-syntax:concept-item-4>items/a>:/p> pre><div itemscope idamanda itemrefa b></div><p ida>Name: <span itempropname>Amanda</span></p><div idb itempropband itemscope itemrefc></div><div idc> <p>Band: <span itempropname>Jazz Band</span></p> <p>Size: <span itempropsize>12</span> players</p></div>/pre> p>This gives the same result as the previous example. The first item has two properties, name, set to Amanda, and band, set to another item. That second item has two further properties, name, set to Jazz Band, and size, set to 12./p> /div> p>An a href#concept-item idthe-basic-syntax:concept-item-5>item/a> can have multiple properties with the same name and different values./p> div classexample> p>This example describes an ice cream, with two flavors:/p> pre><div itemscope> <p>Flavors in my favorite ice cream:</p> <ul> <li itempropflavor>Lemon sorbet</li> <li itempropflavor>Apricot sorbet</li> </ul></div>/pre> p>This thus results in an item with two properties, both flavor, having the values Lemon sorbet and Apricot sorbet./p> /div> p>An element introducing a property can also introduce multiple properties at once, to avoid duplication when some of the properties have the same value./p> div classexample> p>Here we see an item with two properties, favorite-color and favorite-fruit, both set to the value orange:/p> pre><div itemscope> <span itempropfavorite-color favorite-fruit>orange</span></div>/pre> /div> p>Its important to note that there is no relationship between the microdata and the content of the document where the microdata is marked up./p> div classexample> p>There is no semantic difference, for instance, between the following two examples:/p> pre><figure> <img srccastle.jpeg> <figcaption><span itemscope><span itempropname>The Castle</span></span> (1986)</figcaption></figure>/pre> pre><span itemscope><meta itempropname contentThe Castle></span><figure> <img srccastle.jpeg> <figcaption>The Castle (1986)</figcaption></figure>/pre> p>Both have a figure with a caption, and both, completely unrelated to the figure, have an item with a name-value pair with the name name and the value The Castle. The only difference is that if the user drags the caption out of the document, in the former case, the item will be included in the drag-and-drop data. In neither case is the image in any way associated with the item./p> /div> h4 idtyped-items>span classsecno>5.1.3/span> Typed itemsa href#typed-items classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>The examples in the previous section show how information could be marked up on a page that doesnt expect its microdata to be re-used. Microdata is most useful, though, when it is used in contexts where other authors and readers are able to cooperate to make new uses of the markup./p> p>For this purpose, it is necessary to give each a href#concept-item idtyped-items:concept-item>item/a> a type, such as https://example.com/person, or https://example.org/cat, or https://band.example.net/. Types are identified as a hrefhttps://url.spec.whatwg.org/#concept-url idtyped-items:url data-x-internalurl>URLs/a>./p> p>The type for an a href#concept-item idtyped-items:concept-item-2>item/a> is given as the value of an code idtyped-items:attr-itemtype>a href#attr-itemtype>itemtype/a>/code> attribute on the same element as the code idtyped-items:attr-itemscope>a href#attr-itemscope>itemscope/a>/code> attribute./p> div classexample> p>Here, the items type is https://example.org/animals#cat:/p>pre><section itemscope itemtypehttps://example.org/animals#cat> <h1 itempropname>Hedral</h1> <p itempropdesc>Hedral is a male american domestic shorthair, with a fluffy black fur with white paws and belly.</p> <img itempropimg srchedral.jpeg alt titleHedral, age 18 months></section>/pre> p>In this example the https://example.org/animals#cat item has three properties, a name (Hedral), a desc (Hedral is...), and an img (hedral.jpeg)./p> /div> p>The type gives the context for the properties, thus selecting a vocabulary: a property named class given for an item with the type https://census.example/person might refer to the economic class of an individual, while a property named class given for an item with the type https://example.com/school/teacher might refer to the classroom a teacher has been assigned. Several types can share a vocabulary. For example, the types code>https://example.org/people/teacher/code> and code>https://example.org/people/engineer/code> could be defined to use the same vocabulary (though maybe some properties would not be especially useful in both cases, e.g. maybe the code>https://example.org/people/engineer/code> type might not typically be used with the code>classroom/code> property). Multiple types defined to use the same vocabulary can be given for a single item by listing the URLs as a space-separated list in the attribute value. An item cannot be given two types if they do not use the same vocabulary, however./p> h4 idglobal-identifiers-for-items>span classsecno>5.1.4/span> Global identifiers for itemsa href#global-identifiers-for-items classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>Sometimes, an a href#concept-item idglobal-identifiers-for-items:concept-item>item/a> gives information about a topic that has a global identifier. For example, books can be identified by their ISBN number./p> p>Vocabularies (as identified by the code idglobal-identifiers-for-items:attr-itemtype>a href#attr-itemtype>itemtype/a>/code> attribute) can be designed such that a href#concept-item idglobal-identifiers-for-items:concept-item-2>items/a> get associated with their global identifier in an unambiguous way by expressing the global identifiers as a hrefhttps://url.spec.whatwg.org/#concept-url idglobal-identifiers-for-items:url data-x-internalurl>URLs/a> given in an code idglobal-identifiers-for-items:attr-itemid>a href#attr-itemid>itemid/a>/code> attribute./p> p>The exact meaning of the a hrefhttps://url.spec.whatwg.org/#concept-url idglobal-identifiers-for-items:url-2 data-x-internalurl>URLs/a> given in code idglobal-identifiers-for-items:attr-itemid-2>a href#attr-itemid>itemid/a>/code> attributes depends on the vocabulary used./p> div classexample> p>Here, an item is talking about a particular book:/p>pre><dl itemscope itemtypehttps://vocab.example.net/book strong>itemidurn:isbn:0-330-34032-8/strong>> <dt>Title <dd itemproptitle>The Reality Dysfunction <dt>Author <dd itempropauthor>Peter F. Hamilton <dt>Publication date <dd><time itemproppubdate datetime1996-01-26>26 January 1996</time></dl>/pre> p>The code>https://vocab.example.net/book/code> vocabulary in this example would define that the code idglobal-identifiers-for-items:attr-itemid-3>a href#attr-itemid>itemid/a>/code> attribute takes a code idglobal-identifiers-for-items:urn-protocol>a data-x-internalurn-protocol hrefhttps://tools.ietf.org/html/rfc2141#section-2>urn:/a>/code> a idglobal-identifiers-for-items:url-3 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> pointing to the ISBN of the book./p> /div> h4 idselecting-names-when-defining-vocabularies>span classsecno>5.1.5/span> Selecting names when defining vocabulariesa href#selecting-names-when-defining-vocabularies classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>Using microdata means using a vocabulary. For some purposes, an ad-hoc vocabulary is adequate. For others, a vocabulary will need to be designed. Where possible, authors are encouraged to re-use existing vocabularies, as this makes content re-use easier./p> p>When designing new vocabularies, identifiers can be created either using a hrefhttps://url.spec.whatwg.org/#concept-url idselecting-names-when-defining-vocabularies:url data-x-internalurl>URLs/a>, or, for properties, as plain words (with no dots or colons). For URLs, conflicts with other vocabularies can be avoided by only using identifiers that correspond to pages that the author has control over./p> div classexample> p>For instance, if Jon and Adam both write content at code>example.com/code>, at code>https://example.com/~jon/.../code> and code>https://example.com/~adam/.../code> respectively, then they could select identifiers of the form https://example.com/~jon/name and https://example.com/~adam/name respectively./p> /div> p>Properties whose names are just plain words can only be used within the context of the types for which they are intended; properties named using URLs can be reused in items of any type. If an item has no type, and is not part of another item, then if its properties have names that are just plain words, they are not intended to be globally unique, and are instead only intended for limited use. Generally speaking, authors are encouraged to use either properties with globally unique names (URLs) or ensure that their items are typed./p> div classexample> p>Here, an item is an https://example.org/animals#cat, and most of the properties have names that are words defined in the context of that type. There are also a few additional properties whose names come from other vocabularies./p>pre><section itemscope itemtypehttps://example.org/animals#cat> <h1 itempropname https://example.com/fn>Hedral</h1> <p itempropdesc>Hedral is a male american domestic shorthair, with a fluffy <span itemprophttps://example.com/color>black</span> fur with <span itemprophttps://example.com/color>white</span> paws and belly.</p> <img itempropimg srchedral.jpeg alt titleHedral, age 18 months></section>/pre> p>This example has one item with the type https://example.org/animals#cat and the following properties:/p> table>thead>tr>td>Property td>Value tbody>tr>td>name td>Hedral tr>td>https://example.com/fn td>Hedral tr>td>desc td>Hedral is a male american domestic shorthair, with a fluffy black fur with white paws and belly. tr>td>https://example.com/color td>black tr>td>https://example.com/color td>white tr>td>img td>.../hedral.jpeg /table> /div> h3 idencoding-microdata>span classsecno>5.2/span> Encoding microdataa href#encoding-microdata classself-link>/a>/h3> h4 idthe-microdata-model>span classsecno>5.2.1/span> The microdata modela href#the-microdata-model classself-link>/a>/h4> p>The microdata model consists of groups of name-value pairs known as a href#concept-item idthe-microdata-model:concept-item>items/a>./p> p>Each group is known as an a href#concept-item idthe-microdata-model:concept-item-2>item/a>. Each a href#concept-item idthe-microdata-model:concept-item-3>item/a> can have a href#item-types idthe-microdata-model:item-types>item types/a>, a a href#global-identifier idthe-microdata-model:global-identifier>global identifier/a> (if the vocabulary specified by the a href#item-types idthe-microdata-model:item-types-2>item types/a> a href#support-global-identifiers-for-items idthe-microdata-model:support-global-identifiers-for-items>support global identifiers for items/a>), and a list of name-value pairs. Each name in the name-value pair is known as a a href#the-properties-of-an-item idthe-microdata-model:the-properties-of-an-item>property/a>, and each a href#the-properties-of-an-item idthe-microdata-model:the-properties-of-an-item-2>property/a> has one or more a href#concept-property-value idthe-microdata-model:concept-property-value>values/a>. Each a href#concept-property-value idthe-microdata-model:concept-property-value-2>value/a> is either a string or itself a group of name-value pairs (an a href#concept-item idthe-microdata-model:concept-item-4>item/a>). The names are unordered relative to each other, but if a particular name has multiple values, they do have a relative order./p> h4 iditems>span classsecno>5.2.2/span> Itemsa href#items classself-link>/a>/h4> p>Every a href#html-elements iditems:html-elements>HTML element/a> may have an dfn idattr-itemscope>code>itemscope/code>/dfn> attribute specified. The code iditems:attr-itemscope>a href#attr-itemscope>itemscope/a>/code> attribute is a a href#boolean-attribute iditems:boolean-attribute>boolean attribute/a>./p> p>An element with the code iditems:attr-itemscope-2>a href#attr-itemscope>itemscope/a>/code> attribute specified creates a new dfn idconcept-item>item/dfn>, a group of name-value pairs./p> hr> p>Elements with an code iditems:attr-itemscope-3>a href#attr-itemscope>itemscope/a>/code> attribute may have an dfn idattr-itemtype>code>itemtype/code>/dfn> attribute specified, to give the a href#item-types iditems:item-types>item types/a> of the a href#concept-item iditems:concept-item>item/a>./p> p>The code iditems:attr-itemtype>a href#attr-itemtype>itemtype/a>/code> attribute, if specified, must have a value that is an a href#unordered-set-of-unique-space-separated-tokens iditems:unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens/a> that are a href#case-sensitive iditems:case-sensitive>case-sensitive/a>, each of which is a a iditems:valid-url-string hrefhttps://url.spec.whatwg.org/#valid-url-string data-x-internalvalid-url-string>valid URL string/a> that is an a iditems:absolute-url hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>, and all of which are defined to use the same vocabulary. The attributes value must have at least one token./p> p>The dfn iditem-types>item types/dfn> of an a href#concept-item iditems:concept-item-2>item/a> are the tokens obtained by a hrefhttps://infra.spec.whatwg.org/#split-on-ascii-whitespace iditems:split-a-string-on-spaces data-x-internalsplit-a-string-on-spaces>splitting the elements code>itemtype/code> attributes value on ASCII whitespace/a>. If the code iditems:attr-itemtype-2>a href#attr-itemtype>itemtype/a>/code> attribute is missing or parsing it in this way finds no tokens, the a href#concept-item iditems:concept-item-3>item/a> is said to have no a href#item-types iditems:item-types-2>item types/a>./p> p>The a href#item-types iditems:item-types-3>item types/a> must all be types defined in a href#other-applicable-specifications iditems:other-applicable-specifications>applicable specifications/a> and must all be defined to use the same vocabulary./p> p>Except if otherwise specified by that specification, the a hrefhttps://url.spec.whatwg.org/#concept-url iditems:url data-x-internalurl>URLs/a> given as the a href#item-types iditems:item-types-4>item types/a> should not be automatically dereferenced./p> p classnote>A specification could define that its a href#item-types iditems:item-types-5>item type/a> can be dereferenced to provide the user with help information, for example. In fact, vocabulary authors are encouraged to provide useful information at the given a iditems:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>./p> p>a href#item-types iditems:item-types-6>Item types/a> are opaque identifiers, and user agents must not dereference unknown a href#item-types iditems:item-types-7>item types/a>, or otherwise deconstruct them, in order to determine how to process a href#concept-item iditems:concept-item-4>items/a> that use them./p> p>The code iditems:attr-itemtype-3>a href#attr-itemtype>itemtype/a>/code> attribute must not be specified on elements that do not have an code iditems:attr-itemscope-4>a href#attr-itemscope>itemscope/a>/code> attribute specified./p> hr> p>An a href#concept-item iditems:concept-item-5>item/a> is said to be a dfn idtyped-item>typed item/dfn> when either it has an a href#item-types iditems:item-types-8>item type/a>, or it is the a href#concept-property-value iditems:concept-property-value>value/a> of a a href#the-properties-of-an-item iditems:the-properties-of-an-item>property/a> of a a href#typed-item iditems:typed-item>typed item/a>. The dfn idrelevant-types>relevant types/dfn> for a a href#typed-item iditems:typed-item-2>typed item/a> is the a href#concept-item iditems:concept-item-6>item/a>s a href#item-types iditems:item-types-9>item types/a>, if it has any, or else is the a href#relevant-types iditems:relevant-types>relevant types/a> of the a href#concept-item iditems:concept-item-7>item/a> for which it is a a href#the-properties-of-an-item iditems:the-properties-of-an-item-2>property/a>s a href#concept-property-value iditems:concept-property-value-2>value/a>./p> hr> p>Elements with an code iditems:attr-itemscope-5>a href#attr-itemscope>itemscope/a>/code> attribute and an code iditems:attr-itemtype-4>a href#attr-itemtype>itemtype/a>/code> attribute that references a vocabulary that is defined to dfn idsupport-global-identifiers-for-items>support global identifiers for items/dfn> may also have an dfn idattr-itemid>code>itemid/code>/dfn> attribute specified, to give a global identifier for the a href#concept-item iditems:concept-item-8>item/a>, so that it can be related to other a href#concept-item iditems:concept-item-9>items/a> on pages elsewhere on the Web./p> p>The code iditems:attr-itemid>a href#attr-itemid>itemid/a>/code> attribute, if specified, must have a value that is a a href#valid-url-potentially-surrounded-by-spaces iditems:valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by spaces/a>./p> p>The dfn idglobal-identifier>global identifier/dfn> of an a href#concept-item iditems:concept-item-10>item/a> is the value of its elements code iditems:attr-itemid-2>a href#attr-itemid>itemid/a>/code> attribute, if it has one, a href#parse-a-url iditems:parse-a-url>parsed/a> relative to the a iditems:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> of the element on which the attribute is specified. If the code iditems:attr-itemid-3>a href#attr-itemid>itemid/a>/code> attribute is missing or if resolving it fails, it is said to have no a href#global-identifier iditems:global-identifier>global identifier/a>./p> p>The code iditems:attr-itemid-4>a href#attr-itemid>itemid/a>/code> attribute must not be specified on elements that do not have both an code iditems:attr-itemscope-6>a href#attr-itemscope>itemscope/a>/code> attribute and an code iditems:attr-itemtype-5>a href#attr-itemtype>itemtype/a>/code> attribute specified, and must not be specified on elements with an code iditems:attr-itemscope-7>a href#attr-itemscope>itemscope/a>/code> attribute whose code iditems:attr-itemtype-6>a href#attr-itemtype>itemtype/a>/code> attribute specifies a vocabulary that does not a href#support-global-identifiers-for-items iditems:support-global-identifiers-for-items>support global identifiers for items/a>, as defined by that vocabularys specification./p> p>The exact meaning of a a href#global-identifier iditems:global-identifier-2>global identifier/a> is determined by the vocabularys specification. It is up to such specifications to define whether multiple items with the same global identifier (whether on the same page or on different pages) are allowed to exist, and what the processing rules for that vocabulary are with respect to handling the case of multiple items with the same ID./p> hr> p>Elements with an code iditems:attr-itemscope-8>a href#attr-itemscope>itemscope/a>/code> attribute may have an dfn idattr-itemref>code>itemref/code>/dfn> attribute specified, to give a list of additional elements to crawl to find the name-value pairs of the a href#concept-item iditems:concept-item-11>item/a>./p> p>The code iditems:attr-itemref>a href#attr-itemref>itemref/a>/code> attribute, if specified, must have a value that is an a href#unordered-set-of-unique-space-separated-tokens iditems:unordered-set-of-unique-space-separated-tokens-2>unordered set of unique space-separated tokens/a> that are a href#case-sensitive iditems:case-sensitive-2>case-sensitive/a>, consisting of a hrefhttps://dom.spec.whatwg.org/#concept-id iditems:concept-id data-x-internalconcept-id>IDs/a> of elements in the same a iditems:tree hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a>./p> p>The code iditems:attr-itemref-2>a href#attr-itemref>itemref/a>/code> attribute must not be specified on elements that do not have an code iditems:attr-itemscope-9>a href#attr-itemscope>itemscope/a>/code> attribute specified./p> p classnote>The code iditems:attr-itemref-3>a href#attr-itemref>itemref/a>/code> attribute is not part of the microdata data model. It is merely a syntactic construct to aid authors in adding annotations to pages where the data to be annotated does not follow a convenient tree structure. For example, it allows authors to mark up data in a table so that each column defines a separate a href#concept-item iditems:concept-item-12>item/a>, while keeping the properties in the cells./p> div classexample> p>This example shows a simple vocabulary used to describe the products of a model railway manufacturer. The vocabulary has just five property names:/p> dl>dt>product-codedd>An integer that names the product in the manufacturers catalog.dt>namedd>A brief description of the product.dt>scaledd>One of HO, 1, or Z (potentially with leading or trailing whitespace), indicating the scale of the product.dt>digitaldd>If present, one of Digital, Delta, or Systems (potentially with leading or trailing whitespace) indicating that the product has a digital decoder of the given type.dt>track-typedd>For track-specific products, one of K, M, C (potentially with leading or trailing whitespace) indicating the type of track for which the product is intended./dl> p>This vocabulary has four defined a href#item-types iditems:item-types-10>item types/a>:/p> dl>dt>https://md.example.com/locodd>Rolling stock with an enginedt>https://md.example.com/passengersdd>Passenger rolling stockdt>https://md.example.com/trackdd>Track piecesdt>https://md.example.com/lightingdd>Equipment with lighting/dl> p>Each a href#concept-item iditems:concept-item-13>item/a> that uses this vocabulary can be given one or more of these types, depending on what the product is./p> p>Thus, a locomotive might be marked up as:/p>pre><dl itemscope itemtypehttps://md.example.com/loco https://md.example.com/lighting> <dt>Name: <dd itempropname>Tank Locomotive (DB 80) <dt>Product code: <dd itempropproduct-code>33041 <dt>Scale: <dd itempropscale>HO <dt>Digital: <dd itempropdigital>Delta</dl>/pre> p>A turnout lantern retrofit kit might be marked up as:/p> pre><dl itemscope itemtypehttps://md.example.com/track https://md.example.com/lighting> <dt>Name: <dd itempropname>Turnout Lantern Kit <dt>Product code: <dd itempropproduct-code>74470 <dt>Purpose: <dd>For retrofitting 2 <span itemproptrack-type>C</span> Track turnouts. <meta itempropscale contentHO></dl>/pre> p>A passenger car with no lighting might be marked up as:/p> pre><dl itemscope itemtypehttps://md.example.com/passengers> <dt>Name: <dd itempropname>Express Train Passenger Car (DB Am 203) <dt>Product code: <dd itempropproduct-code>8710 <dt>Scale: <dd itempropscale>Z</dl>/pre> p>Great care is necessary when creating new vocabularies. Often, a hierarchical approach to types can be taken that results in a vocabulary where each item only ever has a single type, which is generally much simpler to manage./p> /div> h4 idnames:-the-itemprop-attribute>span classsecno>5.2.3/span> Names: the dfn>code>itemprop/code>/dfn> attributea href#names:-the-itemprop-attribute classself-link>/a>/h4> p>Every a href#html-elements idnames:-the-itemprop-attribute:html-elements>HTML element/a> may have an code idnames:-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 idnames:-the-itemprop-attribute:the-properties-of-an-item>adds one or more properties/a> to one or more a href#concept-item idnames:-the-itemprop-attribute:concept-item>items/a> (as defined below)./p> p>The code idnames:-the-itemprop-attribute:names:-the-itemprop-attribute-2>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute, if specified, must have a value that is an a href#unordered-set-of-unique-space-separated-tokens idnames:-the-itemprop-attribute:unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens/a> that are a href#case-sensitive idnames:-the-itemprop-attribute:case-sensitive>case-sensitive/a>, representing the names of the name-value pairs that it adds. The attributes value must have at least one token./p> p>Each token must be either:/p> ul>li>If the item is a a href#typed-item idnames:-the-itemprop-attribute:typed-item>typed item/a>: a dfn iddefined-property-name>defined property name/dfn> allowed in this situation according to the specification that defines the a href#relevant-types idnames:-the-itemprop-attribute:relevant-types>relevant types/a> for the item, orli>A a idnames:-the-itemprop-attribute:valid-url-string hrefhttps://url.spec.whatwg.org/#valid-url-string data-x-internalvalid-url-string>valid URL string/a> that is an a idnames:-the-itemprop-attribute:absolute-url hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a> defined as an item property name allowed in this situation by a vocabulary specification, orli>A a idnames:-the-itemprop-attribute:valid-url-string-2 hrefhttps://url.spec.whatwg.org/#valid-url-string data-x-internalvalid-url-string>valid URL string/a> that is an a idnames:-the-itemprop-attribute:absolute-url-2 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>, used as a proprietary item property name (i.e. one used by the author for private purposes, not defined in a public specification), orli>If the item is not a a href#typed-item idnames:-the-itemprop-attribute:typed-item-2>typed item/a>: a string that contains no U+002E FULL STOP characters (.) and no U+003A COLON characters (:), used as a proprietary item property name (i.e. one used by the author for private purposes, not defined in a public specification)./ul> p>Specifications that introduce a href#defined-property-name idnames:-the-itemprop-attribute:defined-property-name>defined property names/a> must ensure all such property names contain no U+002E FULL STOP characters (.), no U+003A COLON characters (:), and no a idnames:-the-itemprop-attribute:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>./p> p classnote>The rules above disallow U+003A COLON characters (:) in non-URL values because otherwise they could not be distinguished from URLs. Values with U+002E FULL STOP characters (.) are reserved for future extensions. a idnames:-the-itemprop-attribute:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> are disallowed because otherwise the values would be parsed as multiple tokens./p> p>When an element with an code idnames:-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 idnames:-the-itemprop-attribute:the-properties-of-an-item-2>adds a property/a> to multiple a href#concept-item idnames:-the-itemprop-attribute:concept-item-2>items/a>, the requirement above regarding the tokens applies for each a href#concept-item idnames:-the-itemprop-attribute:concept-item-3>item/a> individually./p> p>The dfn idproperty-names>property names/dfn> of an element are the tokens that the elements code idnames:-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 hrefhttps://infra.spec.whatwg.org/#split-on-ascii-whitespace idnames:-the-itemprop-attribute:split-a-string-on-spaces data-x-internalsplit-a-string-on-spaces>split on ASCII whitespace/a>, with the order preserved but with duplicates removed (leaving only the first occurrence of each name)./p> p>Within an a href#concept-item idnames:-the-itemprop-attribute:concept-item-4>item/a>, the properties are unordered with respect to each other, except for properties with the same name, which are ordered in the order they are given by the algorithm that defines a href#the-properties-of-an-item idnames:-the-itemprop-attribute:the-properties-of-an-item-3>the properties of an item/a>./p> div classexample> p>In the following example, the a property has the values 1 and 2, em>in that order/em>, but whether the a property comes before the b property or not is not important:/p> pre><div itemscope> <p itempropa>1</p> <p itempropa>2</p> <p itempropb>test</p></div>/pre> p>Thus, the following is equivalent:/p> pre><div itemscope> <p itempropb>test</p> <p itempropa>1</p> <p itempropa>2</p></div>/pre> p>As is the following:/p> pre><div itemscope> <p itempropa>1</p> <p itempropb>test</p> <p itempropa>2</p></div>/pre> p>And the following:/p> pre><div idx> <p itempropa>1</p></div><div itemscope itemrefx> <p itempropb>test</p> <p itempropa>2</p></div>/pre> /div> h4 idvalues>span classsecno>5.2.4/span> Valuesa href#values classself-link>/a>/h4> p>The dfn idconcept-property-value>property value/dfn> of a name-value pair added by an element with an code idvalues:names:-the-itemprop-attribute>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute is as given for the first matching case in the following list:/p> dl classswitch>dt>If the element also has an code idvalues:attr-itemscope>a href#attr-itemscope>itemscope/a>/code> attributedd> p>The value is the a href#concept-item idvalues:concept-item>item/a> created by the element./p> dt>If the element is a code idvalues:the-meta-element>a href#the-meta-element>meta/a>/code> elementdd> p>The value is the value of the elements code idvalues:attr-meta-content>a href#attr-meta-content>content/a>/code> attribute, if any, or the empty string if there is no such attribute./p> dt>If the element is an code idvalues:the-audio-element>a href#the-audio-element>audio/a>/code>, code idvalues:the-embed-element>a href#the-embed-element>embed/a>/code>, code idvalues:the-iframe-element>a href#the-iframe-element>iframe/a>/code>, code idvalues:the-img-element>a href#the-img-element>img/a>/code>, code idvalues:the-source-element>a href#the-source-element>source/a>/code>, code idvalues:the-track-element>a href#the-track-element>track/a>/code>, or code idvalues:the-video-element>a href#the-video-element>video/a>/code> elementdd> p>The value is the a href#resulting-url-string idvalues:resulting-url-string>resulting URL string/a> that results from a href#parse-a-url idvalues:parse-a-url>parsing/a> the value of the elements code>src/code> attribute relative to the a idvalues:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> of the element at the time the attribute is set, or the empty string if there is no such attribute or if a href#parse-a-url idvalues:parse-a-url-2>parsing/a> it results in an error./p> dt>If the element is an code idvalues:the-a-element>a href#the-a-element>a/a>/code>, code idvalues:the-area-element>a href#the-area-element>area/a>/code>, or code idvalues:the-link-element>a href#the-link-element>link/a>/code> elementdd> p>The value is the a href#resulting-url-string idvalues:resulting-url-string-2>resulting URL string/a> that results from a href#parse-a-url idvalues:parse-a-url-3>parsing/a> the value of the elements code>href/code> attribute relative to the a idvalues:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> of the element at the time the attribute is set, or the empty string if there is no such attribute or if a href#parse-a-url idvalues:parse-a-url-4>parsing/a> it results in an error./p> dt>If the element is an code idvalues:the-object-element>a href#the-object-element>object/a>/code> elementdd> p>The value is the a href#resulting-url-string idvalues:resulting-url-string-3>resulting URL string/a> that results from a href#parse-a-url idvalues:parse-a-url-5>parsing/a> the value of the elements code>data/code> attribute relative to the a idvalues:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> of the element at the time the attribute is set, or the empty string if there is no such attribute or if a href#parse-a-url idvalues:parse-a-url-6>parsing/a> it results in an error./p> dt>If the element is a code idvalues:the-data-element>a href#the-data-element>data/a>/code> elementdd> p>The value is the value of the elements code idvalues:attr-data-value>a href#attr-data-value>value/a>/code> attribute, if it has one, or the empty string otherwise./p> dt>If the element is a code idvalues:the-meter-element>a href#the-meter-element>meter/a>/code> elementdd> p>The value is the value of the elements code idvalues:attr-meter-value>a href#attr-meter-value>value/a>/code> attribute, if it has one, or the empty string otherwise./p> dt>If the element is a code idvalues:the-time-element>a href#the-time-element>time/a>/code> elementdd> p>The value is the elements a href#datetime-value idvalues:datetime-value>datetime value/a>./p> dt>Otherwisedd> p>The value is the elements code idvalues:textcontent>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code>./p> /dl> p>The dfn idurl-property-elements>URL property elements/dfn> are the code idvalues:the-a-element-2>a href#the-a-element>a/a>/code>, code idvalues:the-area-element-2>a href#the-area-element>area/a>/code>, code idvalues:the-audio-element-2>a href#the-audio-element>audio/a>/code>, code idvalues:the-embed-element-2>a href#the-embed-element>embed/a>/code>, code idvalues:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code>, code idvalues:the-img-element-2>a href#the-img-element>img/a>/code>, code idvalues:the-link-element-2>a href#the-link-element>link/a>/code>, code idvalues:the-object-element-2>a href#the-object-element>object/a>/code>, code idvalues:the-source-element-2>a href#the-source-element>source/a>/code>, code idvalues:the-track-element-2>a href#the-track-element>track/a>/code>, and code idvalues:the-video-element-2>a href#the-video-element>video/a>/code> elements./p> p>If a propertys a href#concept-property-value idvalues:concept-property-value>value/a>, as defined by the propertys definition, is an a idvalues:absolute-url hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>, the property must be specified using a a href#url-property-elements idvalues:url-property-elements>URL property element/a>./p> p classnote>These requirements do not apply just because a property value happens to match the syntax for a URL. They only apply if the property is explicitly defined as taking such a value./p> p classexample>For example, a book about the first moon landing could be called mission:moon. A title property from a vocabulary that defines a title as being a string would not expect the title to be given in an code idvalues:the-a-element-3>a href#the-a-element>a/a>/code> element, even though it looks like a a idvalues:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>. On the other hand, if there was a (rather narrowly scoped!) vocabulary for books whose titles look like URLs which had a title property defined to take a URL, then the property em>would/em> expect the title to be given in an code idvalues:the-a-element-4>a href#the-a-element>a/a>/code> element (or one of the other a href#url-property-elements idvalues:url-property-elements-2>URL property elements/a>), because of the requirement above./p> h4 idassociating-names-with-items>span classsecno>5.2.5/span> Associating names with itemsa href#associating-names-with-items classself-link>/a>/h4> p>To find dfn idthe-properties-of-an-item>the properties of an item/dfn> defined by the element var>root/var>, the user agent must run the following steps. These steps are also used to flag a href#microdata-error idassociating-names-with-items:microdata-error>microdata errors/a>./p> ol>li>p>Let var>results/var>, var>memory/var>, and var>pending/var> be empty lists of elements.li>p>Add the element var>root/var> to var>memory/var>.li>p>Add the child elements of var>root/var>, if any, to var>pending/var>.li>p>If var>root/var> has an code idassociating-names-with-items:attr-itemref>a href#attr-itemref>itemref/a>/code> attribute, a hrefhttps://infra.spec.whatwg.org/#split-on-ascii-whitespace idassociating-names-with-items:split-a-string-on-spaces data-x-internalsplit-a-string-on-spaces>split the value of that code>itemref/code> attribute on ASCII whitespace/a>. For each resulting token var>ID/var>, if there is an element in the a idassociating-names-with-items:tree hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a> of var>root/var> with the a hrefhttps://dom.spec.whatwg.org/#concept-id idassociating-names-with-items:concept-id data-x-internalconcept-id>ID/a> var>ID/var>, then add the first such element to var>pending/var>.li> p>While var>pending/var> is not empty:/p> ol>li>p>Remove an element from var>pending/var> and let var>current/var> be that element.li>p>If var>current/var> is already in var>memory/var>, there is a a href#microdata-error idassociating-names-with-items:microdata-error-2>microdata error/a>; continue.li>p>Add var>current/var> to var>memory/var>.li>p>If var>current/var> does not have an code idassociating-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 idassociating-names-with-items:names:-the-itemprop-attribute>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute specified and has one or more a href#property-names idassociating-names-with-items:property-names>property names/a>, then add var>current/var> to var>results/var>./ol> li>p>Sort var>results/var> in a idassociating-names-with-items:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>.li>p>Return var>results/var>./ol> p>A document must not contain any a href#concept-item idassociating-names-with-items:concept-item>items/a> for which the algorithm to find a href#the-properties-of-an-item idassociating-names-with-items:the-properties-of-an-item>the properties of an item/a> finds any dfn idmicrodata-error>microdata errors/dfn>./p> p>An a href#concept-item idassociating-names-with-items:concept-item-2>item/a> is a dfn idtop-level-microdata-items>top-level microdata item/dfn> if its element does not have an code idassociating-names-with-items:names:-the-itemprop-attribute-2>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute./p> p>All code idassociating-names-with-items:attr-itemref-2>a href#attr-itemref>itemref/a>/code> attributes in a code idassociating-names-with-items:document>a href#document>Document/a>/code> must be such that there are no cycles in the graph formed from representing each a href#concept-item idassociating-names-with-items:concept-item-3>item/a> in the code idassociating-names-with-items:document-2>a href#document>Document/a>/code> as a node in the graph and each a href#the-properties-of-an-item idassociating-names-with-items:the-properties-of-an-item-2>property/a> of an item whose a href#concept-property-value idassociating-names-with-items:concept-property-value>value/a> is another item as an edge in the graph connecting those two items./p> p>A document must not contain any elements that have an code idassociating-names-with-items:names:-the-itemprop-attribute-3>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute that would not be found to be a property of any of the a href#concept-item idassociating-names-with-items:concept-item-4>items/a> in that document were their a href#the-properties-of-an-item idassociating-names-with-items:the-properties-of-an-item-3>properties/a> all to be determined./p> div classexample> p>In this example, a single license statement is applied to two works, using code idassociating-names-with-items:attr-itemref-3>a href#attr-itemref>itemref/a>/code> from the items representing the works:/p> pre><!DOCTYPE HTML><html langen> <head> <title>Photo gallery</title> </head> <body> <h1>My photos</h1> <figure itemscope itemtypehttp://n.whatwg.org/work itemreflicenses> <img itempropwork srcimages/house.jpeg altA white house, boarded up, sits in a forest.> <figcaption itemproptitle>The house I found.</figcaption> </figure> <figure itemscope itemtypehttp://n.whatwg.org/work itemreflicenses> <img itempropwork srcimages/mailbox.jpeg altOutside the house is a mailbox. It has a leaflet inside.> <figcaption itemproptitle>The mailbox.</figcaption> </figure> <footer> <p idlicenses>All images licensed under the <a itemproplicense hrefhttp://www.opensource.org/licenses/mit-license.php>MIT license</a>.</p> </footer> </body></html>/pre> p>The above results in two items with the type code>http://n.whatwg.org/work/code>, one with:/p> dl classbrief>dt>work dd>code>images/house.jpeg/code> dt>title dd>The house I found. dt>license dd>code>http://www.opensource.org/licenses/mit-license.php/code> /dl> p>...and one with:/p> dl classbrief>dt>work dd>code>images/mailbox.jpeg/code> dt>title dd>The mailbox. dt>license dd>code>http://www.opensource.org/licenses/mit-license.php/code> /dl> /div> h4 idmicrodata-and-other-namespaces>span classsecno>5.2.6/span> Microdata and other namespacesa href#microdata-and-other-namespaces classself-link>/a>/h4> p>Currently, the code idmicrodata-and-other-namespaces:attr-itemscope>a href#attr-itemscope>itemscope/a>/code>, code idmicrodata-and-other-namespaces:names:-the-itemprop-attribute>a href#names:-the-itemprop-attribute>itemprop/a>/code>, and other microdata attributes are only defined for a href#html-elements idmicrodata-and-other-namespaces:html-elements>HTML elements/a>. This means that attributes with the literal names code>itemscope/code>, code>itemprop/code>, etc, do not cause microdata processing to occur on elements in other namespaces, such as SVG./p> div classexample> p>Thus, in the following example there is only one item, not two./p> pre classbad><p itemscope></p> <!-- this is an item (with no properties and no type) --><svg itemscope></svg> <!-- this is not, its just an a idmicrodata-and-other-namespaces:svg-svg hrefhttps://www.w3.org/TR/SVG11/struct.html#SVGElement data-x-internalsvg-svg>SVG code>svg/code>/a> element with an invalid unknown attribute -->/pre> /div> h3 idmdvocabs>span classsecno>5.3/span> Sample microdata vocabulariesa href#mdvocabs classself-link>/a>/h3> p>The vocabularies in this section are primarily intended to demonstrate how a vocabulary is specified, though they are also usable in their own right./p> h4 idvcard>span classsecno>5.3.1/span> vCarda href#vcard classself-link>/a>/h4> p>An item with the a href#item-types idvcard:item-types>item type/a> dfn idmd-vcard>code>http://microformats.org/profile/hcard/code>/dfn> represents a persons or organizations contact information./p> p>This vocabulary does not a href#support-global-identifiers-for-items idvcard:support-global-identifiers-for-items>support global identifiers for items/a>./p> p>The following are the types a href#defined-property-name idvcard:defined-property-name>defined property names/a>. They are based on the vocabulary defined in the vCard 4.0 specification and its extensions, where more information on how to interpret the values can be found. a href#refsRFC6350>RFC6350/a>/p> dl>dt>dfn idmd-vcard-kind>code>kind/code>/dfn>dd> p>Describes what kind of contact the item represents./p> p>The a href#concept-property-value idvcard:concept-property-value>value/a> must be text that, when compared in a a href#case-sensitive idvcard:case-sensitive>case-sensitive/a> manner, is equal to one of the a href#kind-strings idvcard:kind-strings>kind strings/a>./p> p>A single property with the name code idvcard:md-vcard-kind>a href#md-vcard-kind>kind/a>/code> may be present within each a href#concept-item idvcard:concept-item>item/a> with the type code idvcard:md-vcard>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-fn>code>fn/code>/dfn>dd> p>Gives the formatted text corresponding to the name of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-2>value/a> must be text./p> p>Exactly one property with the name code idvcard:md-vcard-fn>a href#md-vcard-fn>fn/a>/code> must be present within each a href#concept-item idvcard:concept-item-2>item/a> with the type code idvcard:md-vcard-2>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-n>code>n/code>/dfn>dd> p>Gives the structured name of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-3>value/a> must be an a href#concept-item idvcard:concept-item-3>item/a> with zero or more of each of the code idvcard:md-vcard-n-family-name>a href#md-vcard-n-family-name>family-name/a>/code>, code idvcard:md-vcard-n-given-name>a href#md-vcard-n-given-name>given-name/a>/code>, code idvcard:md-vcard-n-additional-name>a href#md-vcard-n-additional-name>additional-name/a>/code>, code idvcard:md-vcard-n-honorific-prefix>a href#md-vcard-n-honorific-prefix>honorific-prefix/a>/code>, and code idvcard:md-vcard-n-honorific-suffix>a href#md-vcard-n-honorific-suffix>honorific-suffix/a>/code> properties./p> p>Exactly one property with the name code idvcard:md-vcard-n>a href#md-vcard-n>n/a>/code> must be present within each a href#concept-item idvcard:concept-item-4>item/a> with the type code idvcard:md-vcard-3>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-n-family-name>code>family-name/code>/dfn> (inside code idvcard:md-vcard-n-2>a href#md-vcard-n>n/a>/code>)dd> p>Gives the family name of the person, or the full name of the organization./p> p>The a href#concept-property-value idvcard:concept-property-value-4>value/a> must be text./p> p>Any number of properties with the name code idvcard: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 idvcard:concept-item-5>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-5>value/a> of the code idvcard:md-vcard-n-3>a href#md-vcard-n>n/a>/code> property of an a href#concept-item idvcard:concept-item-6>item/a> with the type code idvcard:md-vcard-4>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-n-given-name>code>given-name/code>/dfn> (inside code idvcard:md-vcard-n-4>a href#md-vcard-n>n/a>/code>)dd> p>Gives the given-name of the person./p> p>The a href#concept-property-value idvcard:concept-property-value-6>value/a> must be text./p> p>Any number of properties with the name code idvcard:md-vcard-n-given-name-2>a href#md-vcard-n-given-name>given-name/a>/code> may be present within the a href#concept-item idvcard:concept-item-7>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-7>value/a> of the code idvcard:md-vcard-n-5>a href#md-vcard-n>n/a>/code> property of an a href#concept-item idvcard:concept-item-8>item/a> with the type code idvcard:md-vcard-5>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-n-additional-name>code>additional-name/code>/dfn> (inside code idvcard:md-vcard-n-6>a href#md-vcard-n>n/a>/code>)dd> p>Gives the any additional names of the person./p> p>The a href#concept-property-value idvcard:concept-property-value-8>value/a> must be text./p> p>Any number of properties with the name code idvcard: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 idvcard:concept-item-9>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-9>value/a> of the code idvcard:md-vcard-n-7>a href#md-vcard-n>n/a>/code> property of an a href#concept-item idvcard:concept-item-10>item/a> with the type code idvcard:md-vcard-6>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-n-honorific-prefix>code>honorific-prefix/code>/dfn> (inside code idvcard:md-vcard-n-8>a href#md-vcard-n>n/a>/code>)dd> p>Gives the honorific prefix of the person./p> p>The a href#concept-property-value idvcard:concept-property-value-10>value/a> must be text./p> p>Any number of properties with the name code idvcard: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 idvcard:concept-item-11>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-11>value/a> of the code idvcard:md-vcard-n-9>a href#md-vcard-n>n/a>/code> property of an a href#concept-item idvcard:concept-item-12>item/a> with the type code idvcard:md-vcard-7>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-n-honorific-suffix>code>honorific-suffix/code>/dfn> (inside code idvcard:md-vcard-n-10>a href#md-vcard-n>n/a>/code>)dd> p>Gives the honorific suffix of the person./p> p>The a href#concept-property-value idvcard:concept-property-value-12>value/a> must be text./p> p>Any number of properties with the name code idvcard: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 idvcard:concept-item-13>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-13>value/a> of the code idvcard:md-vcard-n-11>a href#md-vcard-n>n/a>/code> property of an a href#concept-item idvcard:concept-item-14>item/a> with the type code idvcard:md-vcard-8>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-nickname>code>nickname/code>/dfn>dd> p>Gives the nickname of the person or organization./p> p classnote>The nickname is the descriptive name given instead of or in addition to the one belonging to a person, place, or thing. It can also be used to specify a familiar form of a proper name specified by the code idvcard:md-vcard-fn-2>a href#md-vcard-fn>fn/a>/code> or code idvcard:md-vcard-n-12>a href#md-vcard-n>n/a>/code> properties./p> p>The a href#concept-property-value idvcard:concept-property-value-14>value/a> must be text./p> p>Any number of properties with the name code idvcard:md-vcard-nickname>a href#md-vcard-nickname>nickname/a>/code> may be present within each a href#concept-item idvcard:concept-item-15>item/a> with the type code idvcard:md-vcard-9>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-photo>code>photo/code>/dfn>dd> p>Gives a photograph of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-15>value/a> must be an a idvcard:absolute-url hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>./p> p>Any number of properties with the name code idvcard:md-vcard-photo>a href#md-vcard-photo>photo/a>/code> may be present within each a href#concept-item idvcard:concept-item-16>item/a> with the type code idvcard:md-vcard-10>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-bday>code>bday/code>/dfn>dd> p>Gives the birth date of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-16>value/a> must be a a href#valid-date-string idvcard:valid-date-string>valid date string/a>./p> p>A single property with the name code idvcard:md-vcard-bday>a href#md-vcard-bday>bday/a>/code> may be present within each a href#concept-item idvcard:concept-item-17>item/a> with the type code idvcard:md-vcard-11>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-anniversary>code>anniversary/code>/dfn>dd> p>Gives the birth date of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-17>value/a> must be a a href#valid-date-string idvcard:valid-date-string-2>valid date string/a>./p> p>A single property with the name code idvcard:md-vcard-anniversary>a href#md-vcard-anniversary>anniversary/a>/code> may be present within each a href#concept-item idvcard:concept-item-18>item/a> with the type code idvcard:md-vcard-12>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-sex>code>sex/code>/dfn>dd> p>Gives the biological sex of the person./p> p>The a href#concept-property-value idvcard:concept-property-value-18>value/a> must be one of code>F/code>, meaning female, code>M/code>, meaning male, code>N/code>, meaning none or not applicable, code>O/code>, meaning other, or code>U/code>, meaning unknown./p> p>A single property with the name code idvcard:md-vcard-sex>a href#md-vcard-sex>sex/a>/code> may be present within each a href#concept-item idvcard:concept-item-19>item/a> with the type code idvcard:md-vcard-13>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-gender-identity>code>gender-identity/code>/dfn>dd> p>Gives the gender identity of the person./p> p>The a href#concept-property-value idvcard:concept-property-value-19>value/a> must be text./p> p>A single property with the name code idvcard:md-vcard-gender-identity>a href#md-vcard-gender-identity>gender-identity/a>/code> may be present within each a href#concept-item idvcard:concept-item-20>item/a> with the type code idvcard:md-vcard-14>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-adr>code>adr/code>/dfn>dd> p>Gives the delivery address of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-20>value/a> must be an a href#concept-item idvcard:concept-item-21>item/a> with zero or more code idvcard:md-vcard-adr-type>a href#md-vcard-adr-type>type/a>/code>, code idvcard:md-vcard-adr-post-office-box>a href#md-vcard-adr-post-office-box>post-office-box/a>/code>, code idvcard:md-vcard-adr-extended-address>a href#md-vcard-adr-extended-address>extended-address/a>/code>, and code idvcard:md-vcard-adr-street-address>a href#md-vcard-adr-street-address>street-address/a>/code> properties, and optionally a code idvcard:md-vcard-adr-locality>a href#md-vcard-adr-locality>locality/a>/code> property, optionally a code idvcard:md-vcard-adr-region>a href#md-vcard-adr-region>region/a>/code> property, optionally a code idvcard:md-vcard-adr-postal-code>a href#md-vcard-adr-postal-code>postal-code/a>/code> property, and optionally a code idvcard:md-vcard-adr-country-name>a href#md-vcard-adr-country-name>country-name/a>/code> property./p> p>If no code idvcard:md-vcard-adr-type-2>a href#md-vcard-adr-type>type/a>/code> properties are present within an a href#concept-item idvcard:concept-item-22>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-21>value/a> of an code idvcard:md-vcard-adr>a href#md-vcard-adr>adr/a>/code> property of an a href#concept-item idvcard:concept-item-23>item/a> with the type code idvcard:md-vcard-15>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>, then the a href#address-type-strings idvcard:address-type-strings>address type string/a> code idvcard:md-vcard-type-adr-work>a href#md-vcard-type-adr-work>work/a>/code> is implied./p> p>Any number of properties with the name code idvcard:md-vcard-adr-2>a href#md-vcard-adr>adr/a>/code> may be present within each a href#concept-item idvcard:concept-item-24>item/a> with the type code idvcard:md-vcard-16>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-adr-type>code>type/code>/dfn> (inside code idvcard:md-vcard-adr-3>a href#md-vcard-adr>adr/a>/code>)dd> p>Gives the type of delivery address./p> p>The a href#concept-property-value idvcard:concept-property-value-22>value/a> must be text that, when compared in a a href#case-sensitive idvcard:case-sensitive-2>case-sensitive/a> manner, is equal to one of the a href#address-type-strings idvcard:address-type-strings-2>address type strings/a>./p> p>Any number of properties with the name code idvcard:md-vcard-adr-type-3>a href#md-vcard-adr-type>type/a>/code> may be present within the a href#concept-item idvcard:concept-item-25>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-23>value/a> of an code idvcard:md-vcard-adr-4>a href#md-vcard-adr>adr/a>/code> property of an a href#concept-item idvcard:concept-item-26>item/a> with the type code idvcard:md-vcard-17>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>, but within each such code idvcard:md-vcard-adr-5>a href#md-vcard-adr>adr/a>/code> property a href#concept-item idvcard:concept-item-27>item/a> there must only be one code idvcard:md-vcard-adr-type-4>a href#md-vcard-adr-type>type/a>/code> property per distinct value./p> dt>dfn idmd-vcard-adr-post-office-box>code>post-office-box/code>/dfn> (inside code idvcard:md-vcard-adr-6>a href#md-vcard-adr>adr/a>/code>)dd> p>Gives the post office box component of the delivery address of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-24>value/a> must be text./p> p>Any number of properties with the name code idvcard: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 idvcard:concept-item-28>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-25>value/a> of an code idvcard:md-vcard-adr-7>a href#md-vcard-adr>adr/a>/code> property of an a href#concept-item idvcard:concept-item-29>item/a> with the type code idvcard:md-vcard-18>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> p classnote>The vCard specification urges authors not to use this field./p> dt>dfn idmd-vcard-adr-extended-address>code>extended-address/code>/dfn> (inside code idvcard:md-vcard-adr-8>a href#md-vcard-adr>adr/a>/code>)dd> p>Gives an additional component of the delivery address of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-26>value/a> must be text./p> p>Any number of properties with the name code idvcard: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 idvcard:concept-item-30>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-27>value/a> of an code idvcard:md-vcard-adr-9>a href#md-vcard-adr>adr/a>/code> property of an a href#concept-item idvcard:concept-item-31>item/a> with the type code idvcard:md-vcard-19>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> p classnote>The vCard specification urges authors not to use this field./p> dt>dfn idmd-vcard-adr-street-address>code>street-address/code>/dfn> (inside code idvcard:md-vcard-adr-10>a href#md-vcard-adr>adr/a>/code>)dd> p>Gives the street address component of the delivery address of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-28>value/a> must be text./p> p>Any number of properties with the name code idvcard: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 idvcard:concept-item-32>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-29>value/a> of an code idvcard:md-vcard-adr-11>a href#md-vcard-adr>adr/a>/code> property of an a href#concept-item idvcard:concept-item-33>item/a> with the type code idvcard:md-vcard-20>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-adr-locality>code>locality/code>/dfn> (inside code idvcard:md-vcard-adr-12>a href#md-vcard-adr>adr/a>/code>)dd> p>Gives the locality component (e.g. city) of the delivery address of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-30>value/a> must be text./p> p>A single property with the name code idvcard:md-vcard-adr-locality-2>a href#md-vcard-adr-locality>locality/a>/code> may be present within the a href#concept-item idvcard:concept-item-34>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-31>value/a> of an code idvcard:md-vcard-adr-13>a href#md-vcard-adr>adr/a>/code> property of an a href#concept-item idvcard:concept-item-35>item/a> with the type code idvcard:md-vcard-21>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-adr-region>code>region/code>/dfn> (inside code idvcard:md-vcard-adr-14>a href#md-vcard-adr>adr/a>/code>)dd> p>Gives the region component (e.g. state or province) of the delivery address of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-32>value/a> must be text./p> p>A single property with the name code idvcard:md-vcard-adr-region-2>a href#md-vcard-adr-region>region/a>/code> may be present within the a href#concept-item idvcard:concept-item-36>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-33>value/a> of an code idvcard:md-vcard-adr-15>a href#md-vcard-adr>adr/a>/code> property of an a href#concept-item idvcard:concept-item-37>item/a> with the type code idvcard:md-vcard-22>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-adr-postal-code>code>postal-code/code>/dfn> (inside code idvcard:md-vcard-adr-16>a href#md-vcard-adr>adr/a>/code>)dd> p>Gives the postal code component of the delivery address of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-34>value/a> must be text./p> p>A single property with the name code idvcard:md-vcard-adr-postal-code-2>a href#md-vcard-adr-postal-code>postal-code/a>/code> may be present within the a href#concept-item idvcard:concept-item-38>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-35>value/a> of an code idvcard:md-vcard-adr-17>a href#md-vcard-adr>adr/a>/code> property of an a href#concept-item idvcard:concept-item-39>item/a> with the type code idvcard:md-vcard-23>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-adr-country-name>code>country-name/code>/dfn> (inside code idvcard:md-vcard-adr-18>a href#md-vcard-adr>adr/a>/code>)dd> p>Gives the country name component of the delivery address of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-36>value/a> must be text./p> p>A single property with the name code idvcard:md-vcard-adr-country-name-2>a href#md-vcard-adr-country-name>country-name/a>/code> may be present within the a href#concept-item idvcard:concept-item-40>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-37>value/a> of an code idvcard:md-vcard-adr-19>a href#md-vcard-adr>adr/a>/code> property of an a href#concept-item idvcard:concept-item-41>item/a> with the type code idvcard:md-vcard-24>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-tel>code>tel/code>/dfn>dd> p>Gives the telephone number of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-38>value/a> must be either text that can be interpreted as a telephone number as defined in the CCITT specifications E.163 and X.121, or an a href#concept-item idvcard:concept-item-42>item/a> with zero or more code idvcard:md-vcard-tel-type>a href#md-vcard-tel-type>type/a>/code> properties and exactly one code idvcard:md-vcard-tel-value>a href#md-vcard-tel-value>value/a>/code> property. a href#refsE163>E163/a> a href#refsX121>X121/a>/p> p>If no code idvcard:md-vcard-tel-type-2>a href#md-vcard-tel-type>type/a>/code> properties are present within an a href#concept-item idvcard:concept-item-43>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-39>value/a> of a code idvcard:md-vcard-tel>a href#md-vcard-tel>tel/a>/code> property of an a href#concept-item idvcard:concept-item-44>item/a> with the type code idvcard:md-vcard-25>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>, or if the a href#concept-property-value idvcard:concept-property-value-40>value/a> of such a code idvcard:md-vcard-tel-2>a href#md-vcard-tel>tel/a>/code> property is text, then the a href#telephone-type-strings idvcard:telephone-type-strings>telephone type string/a> code idvcard:md-vcard-type-tel-voice>a href#md-vcard-type-tel-voice>voice/a>/code> is implied./p> p>Any number of properties with the name code idvcard:md-vcard-tel-3>a href#md-vcard-tel>tel/a>/code> may be present within each a href#concept-item idvcard:concept-item-45>item/a> with the type code idvcard:md-vcard-26>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-tel-type>code>type/code>/dfn> (inside code idvcard:md-vcard-tel-4>a href#md-vcard-tel>tel/a>/code>)dd> p>Gives the type of telephone number./p> p>The a href#concept-property-value idvcard:concept-property-value-41>value/a> must be text that, when compared in a a href#case-sensitive idvcard:case-sensitive-3>case-sensitive/a> manner, is equal to one of the a href#telephone-type-strings idvcard:telephone-type-strings-2>telephone type strings/a>./p> p>Any number of properties with the name code idvcard:md-vcard-tel-type-3>a href#md-vcard-tel-type>type/a>/code> may be present within the a href#concept-item idvcard:concept-item-46>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-42>value/a> of a code idvcard:md-vcard-tel-5>a href#md-vcard-tel>tel/a>/code> property of an a href#concept-item idvcard:concept-item-47>item/a> with the type code idvcard:md-vcard-27>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>, but within each such code idvcard:md-vcard-tel-6>a href#md-vcard-tel>tel/a>/code> property a href#concept-item idvcard:concept-item-48>item/a> there must only be one code idvcard:md-vcard-tel-type-4>a href#md-vcard-tel-type>type/a>/code> property per distinct value./p> dt>dfn idmd-vcard-tel-value>code>value/code>/dfn> (inside code idvcard:md-vcard-tel-7>a href#md-vcard-tel>tel/a>/code>)dd> p>Gives the actual telephone number of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-43>value/a> must be text that can be interpreted as a telephone number as defined in the CCITT specifications E.163 and X.121. a href#refsE163>E163/a> a href#refsX121>X121/a>/p> p>Exactly one property with the name code idvcard:md-vcard-tel-value-2>a href#md-vcard-tel-value>value/a>/code> must be present within the a href#concept-item idvcard:concept-item-49>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-44>value/a> of a code idvcard:md-vcard-tel-8>a href#md-vcard-tel>tel/a>/code> property of an a href#concept-item idvcard:concept-item-50>item/a> with the type code idvcard:md-vcard-28>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-email>code>email/code>/dfn>dd> p>Gives the e-mail address of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-45>value/a> must be text./p> p>Any number of properties with the name code idvcard:md-vcard-email>a href#md-vcard-email>email/a>/code> may be present within each a href#concept-item idvcard:concept-item-51>item/a> with the type code idvcard:md-vcard-29>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-impp>code>impp/code>/dfn>dd> p>Gives a a idvcard:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> for instant messaging and presence protocol communications with the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-46>value/a> must be an a idvcard:absolute-url-2 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>./p> p>Any number of properties with the name code idvcard:md-vcard-impp>a href#md-vcard-impp>impp/a>/code> may be present within each a href#concept-item idvcard:concept-item-52>item/a> with the type code idvcard:md-vcard-30>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-lang>code>lang/code>/dfn>dd> p>Gives a language understood by the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-47>value/a> must be a valid BCP 47 language tag. a href#refsBCP47>BCP47/a>./p> p>Any number of properties with the name code idvcard:md-vcard-lang>a href#md-vcard-lang>lang/a>/code> may be present within each a href#concept-item idvcard:concept-item-53>item/a> with the type code idvcard:md-vcard-31>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-tz>code>tz/code>/dfn>dd> p>Gives the time zone of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-48>value/a> must be text and must match the following syntax:/p> ol>li>Either a U+002B PLUS SIGN character (+) or a U+002D HYPHEN-MINUS character (-).li>A a href#valid-non-negative-integer idvcard:valid-non-negative-integer>valid non-negative integer/a> that is exactly two digits long and that represents a number in the range 00..23.li>A U+003A COLON character (:).li>A a href#valid-non-negative-integer idvcard:valid-non-negative-integer-2>valid non-negative integer/a> that is exactly two digits long and that represents a number in the range 00..59./ol> p>Any number of properties with the name code idvcard:md-vcard-tz>a href#md-vcard-tz>tz/a>/code> may be present within each a href#concept-item idvcard:concept-item-54>item/a> with the type code idvcard:md-vcard-32>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-geo>code>geo/code>/dfn>dd> p>Gives the geographical position of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-49>value/a> must be text and must match the following syntax:/p> ol>li>Optionally, either a U+002B PLUS SIGN character (+) or a U+002D HYPHEN-MINUS character (-).li>One or more a idvcard:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>.li>Optionally*, a U+002E FULL STOP character (.) followed by one or more a idvcard:ascii-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>.li>A U+003B SEMICOLON character (;).li>Optionally, either a U+002B PLUS SIGN character (+) or a U+002D HYPHEN-MINUS character (-).li>One or more a idvcard:ascii-digits-3 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>.li>Optionally*, a U+002E FULL STOP character (.) followed by one or more a idvcard:ascii-digits-4 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>./ol> p>The optional components marked with an asterisk (*) should be included, and should have six digits each./p> p classnote>The value specifies latitude and longitude, in that order (i.e., LAT LON ordering), in decimal degrees. The longitude represents the location east and west of the prime meridian as a positive or negative real number, respectively. The latitude represents the location north and south of the equator as a positive or negative real number, respectively./p> p>Any number of properties with the name code idvcard:md-vcard-geo>a href#md-vcard-geo>geo/a>/code> may be present within each a href#concept-item idvcard:concept-item-55>item/a> with the type code idvcard:md-vcard-33>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-title>code>title/code>/dfn>dd> p>Gives the job title, functional position or function of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-50>value/a> must be text./p> p>Any number of properties with the name code idvcard:md-vcard-title>a href#md-vcard-title>title/a>/code> may be present within each a href#concept-item idvcard:concept-item-56>item/a> with the type code idvcard:md-vcard-34>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-role>code>role/code>/dfn>dd> p>Gives the role, occupation, or business category of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-51>value/a> must be text./p> p>Any number of properties with the name code idvcard:md-vcard-role>a href#md-vcard-role>role/a>/code> may be present within each a href#concept-item idvcard:concept-item-57>item/a> with the type code idvcard:md-vcard-35>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-logo>code>logo/code>/dfn>dd> p>Gives the logo of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-52>value/a> must be an a idvcard:absolute-url-3 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>./p> p>Any number of properties with the name code idvcard:md-vcard-logo>a href#md-vcard-logo>logo/a>/code> may be present within each a href#concept-item idvcard:concept-item-58>item/a> with the type code idvcard:md-vcard-36>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-agent>code>agent/code>/dfn>dd> p>Gives the contact information of another person who will act on behalf of the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-53>value/a> must be either an a href#concept-item idvcard:concept-item-59>item/a> with the type code idvcard:md-vcard-37>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>, or an a idvcard:absolute-url-4 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>, or text./p> p>Any number of properties with the name code idvcard:md-vcard-agent>a href#md-vcard-agent>agent/a>/code> may be present within each a href#concept-item idvcard:concept-item-60>item/a> with the type code idvcard:md-vcard-38>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-org>code>org/code>/dfn>dd> p>Gives the name and units of the organization./p> p>The a href#concept-property-value idvcard:concept-property-value-54>value/a> must be either text or an a href#concept-item idvcard:concept-item-61>item/a> with one code idvcard:md-vcard-org-organization-name>a href#md-vcard-org-organization-name>organization-name/a>/code> property and zero or more code idvcard:md-vcard-org-organization-unit>a href#md-vcard-org-organization-unit>organization-unit/a>/code> properties./p> p>Any number of properties with the name code idvcard:md-vcard-org>a href#md-vcard-org>org/a>/code> may be present within each a href#concept-item idvcard:concept-item-62>item/a> with the type code idvcard:md-vcard-39>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-org-organization-name>code>organization-name/code>/dfn> (inside code idvcard:md-vcard-org-2>a href#md-vcard-org>org/a>/code>)dd> p>Gives the name of the organization./p> p>The a href#concept-property-value idvcard:concept-property-value-55>value/a> must be text./p> p>Exactly one property with the name code idvcard: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 idvcard:concept-item-63>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-56>value/a> of an code idvcard:md-vcard-org-3>a href#md-vcard-org>org/a>/code> property of an a href#concept-item idvcard:concept-item-64>item/a> with the type code idvcard:md-vcard-40>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-org-organization-unit>code>organization-unit/code>/dfn> (inside code idvcard:md-vcard-org-4>a href#md-vcard-org>org/a>/code>)dd> p>Gives the name of the organization unit./p> p>The a href#concept-property-value idvcard:concept-property-value-57>value/a> must be text./p> p>Any number of properties with the name code idvcard: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 idvcard:concept-item-65>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-58>value/a> of the code idvcard:md-vcard-org-5>a href#md-vcard-org>org/a>/code> property of an a href#concept-item idvcard:concept-item-66>item/a> with the type code idvcard:md-vcard-41>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-member>code>member/code>/dfn>dd> p>Gives a a idvcard:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> that represents a member of the group./p> p>The a href#concept-property-value idvcard:concept-property-value-59>value/a> must be an a idvcard:absolute-url-5 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>./p> p>Any number of properties with the name code idvcard:md-vcard-member>a href#md-vcard-member>member/a>/code> may be present within each a href#concept-item idvcard:concept-item-67>item/a> with the type code idvcard:md-vcard-42>a href#md-vcard>http://microformats.org/profile/hcard/a>/code> if the a href#concept-item idvcard:concept-item-68>item/a> also has a property with the name code idvcard:md-vcard-kind-2>a href#md-vcard-kind>kind/a>/code> whose value is code idvcard:md-vcard-kind-group>a href#md-vcard-kind-group>group/a>/code>./p> dt>dfn idmd-vcard-related>code>related/code>/dfn>dd> p>Gives a relationship to another entity./p> p>The a href#concept-property-value idvcard:concept-property-value-60>value/a> must be an a href#concept-item idvcard:concept-item-69>item/a> with one code idvcard:md-vcard-related-url>a href#md-vcard-related-url>url/a>/code> property and one code idvcard:md-vcard-related-rel>a href#md-vcard-related-rel>rel/a>/code> properties./p> p>Any number of properties with the name code idvcard:md-vcard-related>a href#md-vcard-related>related/a>/code> may be present within each a href#concept-item idvcard:concept-item-70>item/a> with the type code idvcard:md-vcard-43>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-related-url>code>url/code>/dfn> (inside code idvcard:md-vcard-related-2>a href#md-vcard-related>related/a>/code>)dd> p>Gives the a idvcard:url-3 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> for the related entity./p> p>The a href#concept-property-value idvcard:concept-property-value-61>value/a> must be an a idvcard:absolute-url-6 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>./p> p>Exactly one property with the name code idvcard:md-vcard-related-url-2>a href#md-vcard-related-url>url/a>/code> must be present within the a href#concept-item idvcard:concept-item-71>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-62>value/a> of a code idvcard:md-vcard-related-3>a href#md-vcard-related>related/a>/code> property of an a href#concept-item idvcard:concept-item-72>item/a> with the type code idvcard:md-vcard-44>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-related-rel>code>rel/code>/dfn> (inside code idvcard:md-vcard-related-4>a href#md-vcard-related>related/a>/code>)dd> p>Gives the relationship between the entity and the related entity./p> p>The a href#concept-property-value idvcard:concept-property-value-63>value/a> must be text that, when compared in a a href#case-sensitive idvcard:case-sensitive-4>case-sensitive/a> manner, is equal to one of the a href#relationship-strings idvcard:relationship-strings>relationship strings/a>./p> p>Exactly one property with the name code idvcard:md-vcard-related-rel-2>a href#md-vcard-related-rel>rel/a>/code> must be present within the a href#concept-item idvcard:concept-item-73>item/a> that forms the a href#concept-property-value idvcard:concept-property-value-64>value/a> of a code idvcard:md-vcard-related-5>a href#md-vcard-related>related/a>/code> property of an a href#concept-item idvcard:concept-item-74>item/a> with the type code idvcard:md-vcard-45>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-categories>code>categories/code>/dfn>dd> p>Gives the name of a category or tag that the person or organization could be classified as./p> p>The a href#concept-property-value idvcard:concept-property-value-65>value/a> must be text./p> p>Any number of properties with the name code idvcard:md-vcard-categories>a href#md-vcard-categories>categories/a>/code> may be present within each a href#concept-item idvcard:concept-item-75>item/a> with the type code idvcard:md-vcard-46>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-note>code>note/code>/dfn>dd> p>Gives supplemental information or a comment about the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-66>value/a> must be text./p> p>Any number of properties with the name code idvcard:md-vcard-note>a href#md-vcard-note>note/a>/code> may be present within each a href#concept-item idvcard:concept-item-76>item/a> with the type code idvcard:md-vcard-47>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-rev>code>rev/code>/dfn>dd> p>Gives the revision date and time of the contact information./p> p>The a href#concept-property-value idvcard:concept-property-value-67>value/a> must be text that is a a href#valid-global-date-and-time-string idvcard:valid-global-date-and-time-string>valid global date and time string/a>./p> p classnote>The value distinguishes the current revision of the information for other renditions of the information./p> p>Any number of properties with the name code idvcard:md-vcard-rev>a href#md-vcard-rev>rev/a>/code> may be present within each a href#concept-item idvcard:concept-item-77>item/a> with the type code idvcard:md-vcard-48>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-sound>code>sound/code>/dfn>dd> p>Gives a sound file relating to the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-68>value/a> must be an a idvcard:absolute-url-7 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>./p> p>Any number of properties with the name code idvcard:md-vcard-sound>a href#md-vcard-sound>sound/a>/code> may be present within each a href#concept-item idvcard:concept-item-78>item/a> with the type code idvcard:md-vcard-49>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-uid>code>uid/code>/dfn>dd> p>Gives a globally unique identifier corresponding to the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-69>value/a> must be text./p> p>A single property with the name code idvcard:md-vcard-uid>a href#md-vcard-uid>uid/a>/code> may be present within each a href#concept-item idvcard:concept-item-79>item/a> with the type code idvcard:md-vcard-50>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> dt>dfn idmd-vcard-url>code>url/code>/dfn>dd> p>Gives a a idvcard:url-4 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> relating to the person or organization./p> p>The a href#concept-property-value idvcard:concept-property-value-70>value/a> must be an a idvcard:absolute-url-8 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>./p> p>Any number of properties with the name code idvcard:md-vcard-url>a href#md-vcard-url>url/a>/code> may be present within each a href#concept-item idvcard:concept-item-80>item/a> with the type code idvcard:md-vcard-51>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>./p> /dl> p>The dfn idkind-strings>kind strings/dfn> are:/p> dl>dt>dfn idmd-vcard-kind-individual>code>individual/code>/dfn>dd> p>Indicates a single entity (e.g. a person)./p> dt>dfn idmd-vcard-kind-group>code>group/code>/dfn>dd> p>Indicates multiple entities (e.g. a mailing list)./p> dt>dfn idmd-vcard-kind-org>code>org/code>/dfn>dd> p>Indicates a single entity that is not a person (e.g. a company)./p> dt>dfn idmd-vcard-kind-location>code>location/code>/dfn>dd> p>Indicates a geographical place (e.g. an office building)./p> /dl> p>The dfn idaddress-type-strings>address type strings/dfn> are:/p> dl>dt>dfn idmd-vcard-type-adr-home>code>home/code>/dfn>dd> p>Indicates a delivery address for a residence./p> dt>dfn idmd-vcard-type-adr-work>code>work/code>/dfn>dd> p>Indicates a delivery address for a place of work./p> /dl> p>The dfn idtelephone-type-strings>telephone type strings/dfn> are:/p> dl>dt>dfn idmd-vcard-type-tel-home>code>home/code>/dfn>dd> p>Indicates a residential number./p> dt>dfn idmd-vcard-type-tel-work>code>work/code>/dfn>dd> p>Indicates a telephone number for a place of work./p> dt>dfn idmd-vcard-type-tel-text>code>text/code>/dfn>dd> p>Indicates that the telephone number supports text messages (SMS)./p> dt>dfn idmd-vcard-type-tel-voice>code>voice/code>/dfn>dd> p>Indicates a voice telephone number./p> dt>dfn idmd-vcard-type-tel-fax>code>fax/code>/dfn>dd> p>Indicates a facsimile telephone number./p> dt>dfn idmd-vcard-type-tel-cell>code>cell/code>/dfn>dd> p>Indicates a cellular telephone number./p> dt>dfn idmd-vcard-type-tel-video>code>video/code>/dfn>dd> p>Indicates a video conferencing telephone number./p> dt>dfn idmd-vcard-type-tel-pager>code>pager/code>/dfn>dd> p>Indicates a paging device telephone number./p> dt>dfn idmd-vcard-type-tel-textphone>code>textphone/code>/dfn>dd> p>Indicates a telecommunication device for people with hearing or speech difficulties./p> /dl> p>The dfn idrelationship-strings>relationship strings/dfn> are:/p> dl>dt>dfn idmd-vcard-rel-emergency>code>emergency/code>/dfn>dd> p>An emergency contact./p> dt>dfn idmd-vcard-rel-agent>code>agent/code>/dfn>dd> p>Another entity that acts on behalf of this entity./p> dt>dfn idmd-vcard-rel-contact>contact/dfn>dt>dfn idmd-vcard-rel-acquaintance>acquaintance/dfn>dt>dfn idmd-vcard-rel-friend>friend/dfn>dt>dfn idmd-vcard-rel-met>met/dfn>dt>dfn idmd-vcard-rel-co-worker>worker/dfn>dt>dfn idmd-vcard-rel-colleague>colleague/dfn>dt>dfn idmd-vcard-rel-co-resident>resident/dfn>dt>dfn idmd-vcard-rel-neighbor>neighbor/dfn>dt>dfn idmd-vcard-rel-child>child/dfn>dt>dfn idmd-vcard-rel-parent>parent/dfn>dt>dfn idmd-vcard-rel-sibling>sibling/dfn>dt>dfn idmd-vcard-rel-spouse>spouse/dfn>dt>dfn idmd-vcard-rel-kin>kin/dfn>dt>dfn idmd-vcard-rel-muse>muse/dfn>dt>dfn idmd-vcard-rel-crush>crush/dfn>dt>dfn idmd-vcard-rel-date>date/dfn>dt>dfn idmd-vcard-rel-sweetheart>sweetheart/dfn>dt>dfn idmd-vcard-rel-me>me/dfn>dd> p>Has the meaning defined in XFN. a href#refsXFN>XFN/a>/p> /dl> h5 idconversion-to-vcard>span classsecno>5.3.1.1/span> Conversion to vCarda href#conversion-to-vcard classself-link>/a>/h5> p>Given a list of nodes var>nodes/var> in a code idconversion-to-vcard:document>a href#document>Document/a>/code>, a user agent must run the following algorithm to dfn idextracting-a-vcard>extract any vCard data represented by those nodes/dfn> (only the first vCard is returned):/p> ol>li>p>If none of the nodes in var>nodes/var> are a href#concept-item idconversion-to-vcard:concept-item>items/a> with the a href#item-types idconversion-to-vcard:item-types>item type/a> code idconversion-to-vcard:md-vcard>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>, then there is no vCard. Abort the algorithm, returning nothing.li>p>Let var>node/var> be the first node in var>nodes/var> that is an a href#concept-item idconversion-to-vcard:concept-item-2>item/a> with the a href#item-types idconversion-to-vcard:item-types-2>item type/a> code idconversion-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 idconversion-to-vcard:add-a-vcard-line>Add a vCard line/a> with the type code>BEGIN/code> and the value code>VCARD/code> to var>output/var>.li>p>a href#add-a-vcard-line idconversion-to-vcard:add-a-vcard-line-2>Add a vCard line/a> with the type code>PROFILE/code> and the value code>VCARD/code> to var>output/var>.li>p>a href#add-a-vcard-line idconversion-to-vcard:add-a-vcard-line-3>Add a vCard line/a> with the type code>VERSION/code> and the value code>4.0/code> to var>output/var>.li>p>a href#add-a-vcard-line idconversion-to-vcard:add-a-vcard-line-4>Add a vCard line/a> with the type code>SOURCE/code> and the result of a href#escaping-the-vcard-text-string idconversion-to-vcard:escaping-the-vcard-text-string>escaping the vCard text string/a> that is the documents a hrefhttps://dom.spec.whatwg.org/#concept-document-url idconversion-to-vcard:the-documents-address data-x-internalthe-documents-address>URL/a> as the value to var>output/var>.li>p>If a href#the-title-element-2 idconversion-to-vcard:the-title-element-2>the code>title/code> element/a> is not null, a href#add-a-vcard-line idconversion-to-vcard:add-a-vcard-line-5>add a vCard line/a> with the type code>NAME/code> and with the result of a href#escaping-the-vcard-text-string idconversion-to-vcard:escaping-the-vcard-text-string-2>escaping the vCard text string/a> obtained from the code idconversion-to-vcard:textcontent>a data-x-internaltextcontent hrefhttps://dom.spec.whatwg.org/#dom-node-textcontent>textContent/a>/code> of a href#the-title-element-2 idconversion-to-vcard:the-title-element-2-2>the code>title/code> element/a> as the value to var>output/var>.li>p>Let var>sex/var> be the empty string.li>p>Let var>gender-identity/var> be the empty string.li> p>For each element var>element/var> that is a href#the-properties-of-an-item idconversion-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 idconversion-to-vcard:property-names>property names/a>, run the following substeps:/p> ol>li>p>Let var>parameters/var> be an empty set of name-value pairs.li> p>Run the appropriate set of substeps from the following list. The steps will set a variable var>value/var>, which is used in the next step./p> dl>dt>If the propertys a href#concept-property-value idconversion-to-vcard:concept-property-value>value/a> is an a href#concept-item idconversion-to-vcard:concept-item-3>item/a> var>subitem/var> and var>name/var> is code idconversion-to-vcard:md-vcard-n>a href#md-vcard-n>n/a>/code>dd> ol>li>p>Let var>value/var> be the empty string.li>p>Append to var>value/var> the result of a href#collecting-the-first-vcard-subproperty idconversion-to-vcard:collecting-the-first-vcard-subproperty>collecting the first vCard subproperty/a> named code idconversion-to-vcard:md-vcard-n-family-name>a href#md-vcard-n-family-name>family-name/a>/code> in var>subitem/var>./p> li>Append a U+003B SEMICOLON character (;) to var>value/var>.li>p>Append to var>value/var> the result of a href#collecting-the-first-vcard-subproperty idconversion-to-vcard:collecting-the-first-vcard-subproperty-2>collecting the first vCard subproperty/a> named code idconversion-to-vcard:md-vcard-n-given-name>a href#md-vcard-n-given-name>given-name/a>/code> in var>subitem/var>./p> li>Append a U+003B SEMICOLON character (;) to var>value/var>.li>p>Append to var>value/var> the result of a href#collecting-the-first-vcard-subproperty idconversion-to-vcard:collecting-the-first-vcard-subproperty-3>collecting the first vCard subproperty/a> named code idconversion-to-vcard:md-vcard-n-additional-name>a href#md-vcard-n-additional-name>additional-name/a>/code> in var>subitem/var>./p> li>Append a U+003B SEMICOLON character (;) to var>value/var>.li>p>Append to var>value/var> the result of a href#collecting-the-first-vcard-subproperty idconversion-to-vcard:collecting-the-first-vcard-subproperty-4>collecting the first vCard subproperty/a> named code idconversion-to-vcard:md-vcard-n-honorific-prefix>a href#md-vcard-n-honorific-prefix>honorific-prefix/a>/code> in var>subitem/var>./p> li>Append a U+003B SEMICOLON character (;) to var>value/var>.li>p>Append to var>value/var> the result of a href#collecting-the-first-vcard-subproperty idconversion-to-vcard:collecting-the-first-vcard-subproperty-5>collecting the first vCard subproperty/a> named code idconversion-to-vcard:md-vcard-n-honorific-suffix>a href#md-vcard-n-honorific-suffix>honorific-suffix/a>/code> in var>subitem/var>./p> /ol> dt>If the propertys a href#concept-property-value idconversion-to-vcard:concept-property-value-2>value/a> is an a href#concept-item idconversion-to-vcard:concept-item-4>item/a> var>subitem/var> and var>name/var> is code idconversion-to-vcard:md-vcard-adr>a href#md-vcard-adr>adr/a>/code>dd> ol>li>p>Let var>value/var> be the empty string.li>p>Append to var>value/var> the result of a href#collecting-vcard-subproperties idconversion-to-vcard:collecting-vcard-subproperties>collecting vCard subproperties/a> named code idconversion-to-vcard:md-vcard-adr-post-office-box>a href#md-vcard-adr-post-office-box>post-office-box/a>/code> in var>subitem/var>./p> li>Append a U+003B SEMICOLON character (;) to var>value/var>.li>p>Append to var>value/var> the result of a href#collecting-vcard-subproperties idconversion-to-vcard:collecting-vcard-subproperties-2>collecting vCard subproperties/a> named code idconversion-to-vcard:md-vcard-adr-extended-address>a href#md-vcard-adr-extended-address>extended-address/a>/code> in var>subitem/var>./p> li>Append a U+003B SEMICOLON character (;) to var>value/var>.li>p>Append to var>value/var> the result of a href#collecting-vcard-subproperties idconversion-to-vcard:collecting-vcard-subproperties-3>collecting vCard subproperties/a> named code idconversion-to-vcard:md-vcard-adr-street-address>a href#md-vcard-adr-street-address>street-address/a>/code> in var>subitem/var>./p> li>Append a U+003B SEMICOLON character (;) to var>value/var>.li>p>Append to var>value/var> the result of a href#collecting-the-first-vcard-subproperty idconversion-to-vcard:collecting-the-first-vcard-subproperty-6>collecting the first vCard subproperty/a> named code idconversion-to-vcard:md-vcard-adr-locality>a href#md-vcard-adr-locality>locality/a>/code> in var>subitem/var>./p> li>Append a U+003B SEMICOLON character (;) to var>value/var>.li>p>Append to var>value/var> the result of a href#collecting-the-first-vcard-subproperty idconversion-to-vcard:collecting-the-first-vcard-subproperty-7>collecting the first vCard subproperty/a> named code idconversion-to-vcard:md-vcard-adr-region>a href#md-vcard-adr-region>region/a>/code> in var>subitem/var>./p> li>Append a U+003B SEMICOLON character (;) to var>value/var>.li>p>Append to var>value/var> the result of a href#collecting-the-first-vcard-subproperty idconversion-to-vcard:collecting-the-first-vcard-subproperty-8>collecting the first vCard subproperty/a> named code idconversion-to-vcard:md-vcard-adr-postal-code>a href#md-vcard-adr-postal-code>postal-code/a>/code> in var>subitem/var>./p> li>Append a U+003B SEMICOLON character (;) to var>value/var>.li>p>Append to var>value/var> the result of a href#collecting-the-first-vcard-subproperty idconversion-to-vcard:collecting-the-first-vcard-subproperty-9>collecting the first vCard subproperty/a> named code idconversion-to-vcard:md-vcard-adr-country-name>a href#md-vcard-adr-country-name>country-name/a>/code> in var>subitem/var>./p> li>p>If there is a property named code idconversion-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 idconversion-to-vcard:concept-property-value-3>value/a> that is not an a href#concept-item idconversion-to-vcard:concept-item-5>item/a> and whose value consists only of a hrefhttps://infra.spec.whatwg.org/#ascii-alphanumeric idconversion-to-vcard:alphanumeric-ascii-characters data-x-internalalphanumeric-ascii-characters>ASCII alphanumerics/a>, then add a parameter named code>TYPE/code> whose value is the a href#concept-property-value idconversion-to-vcard:concept-property-value-4>value/a> of that property to var>parameters/var>./ol> dt>If the propertys a href#concept-property-value idconversion-to-vcard:concept-property-value-5>value/a> is an a href#concept-item idconversion-to-vcard:concept-item-6>item/a> var>subitem/var> and var>name/var> is code idconversion-to-vcard:md-vcard-org>a href#md-vcard-org>org/a>/code>dd> ol>li>p>Let var>value/var> be the empty string.li>p>Append to var>value/var> the result of a href#collecting-the-first-vcard-subproperty idconversion-to-vcard:collecting-the-first-vcard-subproperty-10>collecting the first vCard subproperty/a> named code idconversion-to-vcard:md-vcard-org-organization-name>a href#md-vcard-org-organization-name>organization-name/a>/code> in var>subitem/var>./p> li> p>For each property named code idconversion-to-vcard:md-vcard-org-organization-unit>a href#md-vcard-org-organization-unit>organization-unit/a>/code> in var>subitem/var>, run the following steps:/p> ol>li>p>If the a href#concept-property-value idconversion-to-vcard:concept-property-value-6>value/a> of the property is an a href#concept-item idconversion-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 idconversion-to-vcard:escaping-the-vcard-text-string-3>escaping the vCard text string/a> given by the a href#concept-property-value idconversion-to-vcard:concept-property-value-7>value/a> of the property to var>value/var>./ol> /ol> dt>If the propertys a href#concept-property-value idconversion-to-vcard:concept-property-value-8>value/a> is an a href#concept-item idconversion-to-vcard:concept-item-8>item/a> var>subitem/var> with the a href#item-types idconversion-to-vcard:item-types-3>item type/a> code idconversion-to-vcard:md-vcard-3>a href#md-vcard>http://microformats.org/profile/hcard/a>/code> and var>name/var> is code idconversion-to-vcard:md-vcard-related>a href#md-vcard-related>related/a>/code>dd> ol>li>p>Let var>value/var> be the empty string.li>p>If there is a property named code idconversion-to-vcard:md-vcard-related-url>a href#md-vcard-related-url>url/a>/code> in var>subitem/var>, and its element is a a href#url-property-elements idconversion-to-vcard:url-property-elements>URL property element/a>, then append the result of a href#escaping-the-vcard-text-string idconversion-to-vcard:escaping-the-vcard-text-string-4>escaping the vCard text string/a> given by the a href#concept-property-value idconversion-to-vcard:concept-property-value-9>value/a> of the first such property to var>value/var>, and add a parameter with the name code>VALUE/code> and the value code>URI/code> to var>parameters/var>.li>p>If there is a property named code idconversion-to-vcard:md-vcard-related-rel>a href#md-vcard-related-rel>rel/a>/code> in var>subitem/var>, and the first such property has a a href#concept-property-value idconversion-to-vcard:concept-property-value-10>value/a> that is not an a href#concept-item idconversion-to-vcard:concept-item-9>item/a> and whose value consists only of a hrefhttps://infra.spec.whatwg.org/#ascii-alphanumeric idconversion-to-vcard:alphanumeric-ascii-characters-2 data-x-internalalphanumeric-ascii-characters>ASCII alphanumerics/a>, then add a parameter named code>RELATION/code> whose value is the a href#concept-property-value idconversion-to-vcard:concept-property-value-11>value/a> of that property to var>parameters/var>./ol> dt>If the propertys a href#concept-property-value idconversion-to-vcard:concept-property-value-12>value/a> is an a href#concept-item idconversion-to-vcard:concept-item-10>item/a> and var>name/var> is none of the abovedd> ol>li>p>Let var>value/var> be the result of a href#collecting-the-first-vcard-subproperty idconversion-to-vcard:collecting-the-first-vcard-subproperty-11>collecting the first vCard subproperty/a> named code>value/code> in var>subitem/var>./p> li>p>If there is a property named code>type/code> in var>subitem/var>, and the first such property has a a href#concept-property-value idconversion-to-vcard:concept-property-value-13>value/a> that is not an a href#concept-item idconversion-to-vcard:concept-item-11>item/a> and whose value consists only of a hrefhttps://infra.spec.whatwg.org/#ascii-alphanumeric idconversion-to-vcard:alphanumeric-ascii-characters-3 data-x-internalalphanumeric-ascii-characters>ASCII alphanumeric/a>, then add a parameter named code>TYPE/code> whose value is the a href#concept-property-value idconversion-to-vcard:concept-property-value-14>value/a> of that property to var>parameters/var>./ol> dt>If the propertys a href#concept-property-value idconversion-to-vcard:concept-property-value-15>value/a> is not an a href#concept-item idconversion-to-vcard:concept-item-12>item/a> and its var>name/var> is code idconversion-to-vcard:md-vcard-sex>a href#md-vcard-sex>sex/a>/code>dd> p>If this is the first such property to be found, set var>sex/var> to the propertys a href#concept-property-value idconversion-to-vcard:concept-property-value-16>value/a>./p> dt>If the propertys a href#concept-property-value idconversion-to-vcard:concept-property-value-17>value/a> is not an a href#concept-item idconversion-to-vcard:concept-item-13>item/a> and its var>name/var> is code idconversion-to-vcard:md-vcard-gender-identity>a href#md-vcard-gender-identity>gender-identity/a>/code>dd> p>If this is the first such property to be found, set var>gender-identity/var> to the propertys a href#concept-property-value idconversion-to-vcard:concept-property-value-18>value/a>./p> dt>Otherwise (the propertys a href#concept-property-value idconversion-to-vcard:concept-property-value-19>value/a> is not an a href#concept-item idconversion-to-vcard:concept-item-14>item/a>)dd> ol>li>p>Let var>value/var> be the propertys a href#concept-property-value idconversion-to-vcard:concept-property-value-20>value/a>.li>p>If var>element/var> is one of the a href#url-property-elements idconversion-to-vcard:url-property-elements-2>URL property elements/a>, add a parameter with the name code>VALUE/code> and the value code>URI/code> to var>parameters/var>.li>p>Otherwise, if var>name/var> is code idconversion-to-vcard:md-vcard-bday>a href#md-vcard-bday>bday/a>/code> or code idconversion-to-vcard:md-vcard-anniversary>a href#md-vcard-anniversary>anniversary/a>/code> and the var>value/var> is a a href#valid-date-string idconversion-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 idconversion-to-vcard:md-vcard-rev>a href#md-vcard-rev>rev/a>/code> and the var>value/var> is a a href#valid-global-date-and-time-string idconversion-to-vcard:valid-global-date-and-time-string>valid global date and time string/a>, add a parameter with the name code>VALUE/code> and the value code>DATE-TIME/code> to var>parameters/var>.li>p>Prefix every U+005C REVERSE SOLIDUS character (\) in var>value/var> with another U+005C REVERSE SOLIDUS character (\).li>p>Prefix every U+002C COMMA character (,) in var>value/var> with a U+005C REVERSE SOLIDUS character (\).li>p>Unless var>name/var> is code idconversion-to-vcard:md-vcard-geo>a href#md-vcard-geo>geo/a>/code>, prefix every U+003B SEMICOLON character (;) in var>value/var> with a U+005C REVERSE SOLIDUS character (\).li>p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED character pair (CRLF) in var>value/var> with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN SMALL LETTER N character (n).li>p>Replace every remaining U+000D CARRIAGE RETURN (CR) or U+000A LINE FEED (LF) character in var>value/var> with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN SMALL LETTER N character (n)./ol> /dl> li> p>a href#add-a-vcard-line idconversion-to-vcard:add-a-vcard-line-6>Add a vCard line/a> with the type var>name/var>, the parameters var>parameters/var>, and the value var>value/var> to var>output/var>./p> /ol> li>p>If either var>sex/var> or var>gender-identity/var> has a value that is not the empty string, a href#add-a-vcard-line idconversion-to-vcard:add-a-vcard-line-7>add a vCard line/a> with the type code>GENDER/code> and the value consisting of the concatenation of var>sex/var>, a U+003B SEMICOLON character (;), and var>gender-identity/var> to var>output/var>.li>p>a href#add-a-vcard-line idconversion-to-vcard:add-a-vcard-line-8>Add a vCard line/a> with the type code>END/code> and the value code>VCARD/code> to var>output/var>./ol> p>When the above algorithm says that the user agent is to dfn idadd-a-vcard-line>add a vCard line/dfn> consisting of a type var>type/var>, optionally some parameters, and a value var>value/var> to a string var>output/var>, it must run the following steps:/p> ol>li>p>Let var>line/var> be an empty string. li>p>Append var>type/var>, a idconversion-to-vcard:converted-to-ascii-uppercase hrefhttps://infra.spec.whatwg.org/#ascii-uppercase data-x-internalconverted-to-ascii-uppercase>converted to ASCII uppercase/a>, to var>line/var>.li> p>If there are any parameters, then for each parameter, in the order that they were added, run these substeps:/p> ol>li>p>Append a U+003B SEMICOLON character (;) to var>line/var>.li>p>Append the parameters name to var>line/var>.li>p>Append a U+003D EQUALS SIGN character () to var>line/var>.li>p>Append the parameters value to var>line/var>./ol> li>p>Append a U+003A COLON character (:) to var>line/var>.li>p>Append var>value/var> to var>line/var>.li>p>Let var>maximum length/var> be 75.li> p>While var>line/var>s a hrefhttps://infra.spec.whatwg.org/#string-length idconversion-to-vcard:string-length data-x-internalstring-length>length/a> is greater than var>maximum length/var>:/p> ol>li>p>Append the first var>maximum length/var> code points of var>line/var> to var>output/var>.li>p>Remove the first var>maximum length/var> code points from var>line/var>.li>p>Append a U+000D CARRIAGE RETURN character (CR) to var>output/var>.li>p>Append a U+000A LINE FEED character (LF) to var>output/var>.li>p>Append a U+0020 SPACE character to var>output/var>.li>p>Let var>maximum length/var> be 74./ol> li>p>Append (what remains of) var>line/var> to var>output/var>.li>p>Append a U+000D CARRIAGE RETURN character (CR) to var>output/var>.li>p>Append a U+000A LINE FEED character (LF) to var>output/var>./ol> p>When the steps above require the user agent to obtain the result of dfn idcollecting-vcard-subproperties>collecting vCard subproperties/dfn> named var>subname/var> in var>subitem/var>, the user agent must run the following steps:/p> ol>li>p>Let var>value/var> be the empty string.li> p>For each property named var>subname/var> in the item var>subitem/var>, run the following substeps:/p> ol>li>p>If the a href#concept-property-value idconversion-to-vcard:concept-property-value-21>value/a> of the property is itself an a href#concept-item idconversion-to-vcard:concept-item-15>item/a>, then skip this property.li>p>If this is not the first property named var>subname/var> in var>subitem/var> (ignoring any that were skipped by the previous step), then append a U+002C COMMA character (,) to var>value/var>.li>p>Append the result of a href#escaping-the-vcard-text-string idconversion-to-vcard:escaping-the-vcard-text-string-5>escaping the vCard text string/a> given by the a href#concept-property-value idconversion-to-vcard:concept-property-value-22>value/a> of the property to var>value/var>./ol> li>p>Return var>value/var>./ol> p>When the steps above require the user agent to obtain the result of dfn idcollecting-the-first-vcard-subproperty>collecting the first vCard subproperty/dfn> named var>subname/var> in var>subitem/var>, the user agent must run the following steps:/p> ol>li>p>If there are no properties named var>subname/var> in var>subitem/var>, then abort these substeps, returning the empty string.li>p>If the a href#concept-property-value idconversion-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 idconversion-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 idconversion-to-vcard:escaping-the-vcard-text-string-6>escaping the vCard text string/a> given by the a href#concept-property-value idconversion-to-vcard:concept-property-value-24>value/a> of the first property named var>subname/var> in var>subitem/var>./ol> p>When the above algorithms say the user agent is to dfn idescaping-the-vcard-text-string>escape the vCard text string/dfn> var>value/var>, the user agent must use the following steps:/p> ol>li>p>Prefix every U+005C REVERSE SOLIDUS character (\) in var>value/var> with another U+005C REVERSE SOLIDUS character (\).li>p>Prefix every U+002C COMMA character (,) in var>value/var> with a U+005C REVERSE SOLIDUS character (\).li>p>Prefix every U+003B SEMICOLON character (;) in var>value/var> with a U+005C REVERSE SOLIDUS character (\).li>p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED character pair (CRLF) in var>value/var> with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN SMALL LETTER N character (n).li>p>Replace every remaining U+000D CARRIAGE RETURN (CR) or U+000A LINE FEED (LF) character in var>value/var> with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN SMALL LETTER N character (n).li>p>Return the mutated var>value/var>./ol> p classnote>This algorithm can generate invalid vCard output, if the input does not conform to the rules described for the code idconversion-to-vcard:md-vcard-4>a href#md-vcard>http://microformats.org/profile/hcard/a>/code> a href#item-types idconversion-to-vcard:item-types-4>item type/a> and a href#defined-property-name idconversion-to-vcard:defined-property-name>defined property names/a>./p> h5 idexamples-2>span classsecno>5.3.1.2/span> Examplesa href#examples-2 classself-link>/a>/h5> p>i>This section is non-normative./i>/p> div classexample> p>Here is a long example vCard for a fictional character called Jack Bauer:/p> pre><section idjack itemscope itemtypehttp://microformats.org/profile/hcard> <h1 itempropfn> <span itempropn itemscope> <span itempropgiven-name>Jack</span> <span itempropfamily-name>Bauer</span> </span> </h1> <img itempropphoto alt srcjack-bauer.jpg> <p itemproporg itemscope> <span itemproporganization-name>Counter-Terrorist Unit</span> (<span itemproporganization-unit>Los Angeles Division</span>) </p> <p> <span itempropadr itemscope> <span itempropstreet-address>10201 W. Pico Blvd.</span><br> <span itemproplocality>Los Angeles</span>, <span itempropregion>CA</span> <span itemproppostal-code>90064</span><br> <span itempropcountry-name>United States</span><br> </span> <span itempropgeo>34.052339;-118.410623</span> </p> <h2>Assorted Contact Methods</h2> <ul> <li itemproptel itemscope> <span itempropvalue>+1 (310) 597 3781</span> <span itemproptype>work</span> <meta itemproptype contentvoice> </li> <li><a itempropurl hrefhttps://en.wikipedia.org/wiki/Jack_Bauer>Im on Wikipedia</a> so you can leave a message on my user talk page.</li> <li><a itempropurl hrefhttp://www.jackbauerfacts.com/>Jack Bauer Facts</a></li> <li itempropemail><a hrefmailto:j.bauer@la.ctu.gov.invalid>j.bauer@la.ctu.gov.invalid</a></li> <li itemproptel itemscope> <span itempropvalue>+1 (310) 555 3781</span> <span> <meta itemproptype contentcell>mobile phone</span> </li> </ul> <ins datetime2008-07-20 21:00:00+01:00> <meta itemproprev content2008-07-20 21:00:00+01:00> <p itemproptel itemscope><strong>Update!</strong> My new <span itemproptype>home</span> phone number is <span itempropvalue>01632 960 123</span>.</p> </ins></section>/pre> p>The odd line wrapping is needed because newlines are meaningful in microdata: newlines would be preserved in a conversion to, for example, the vCard format./p> /div> div classexample> p>This example shows a sites contact details (using the code idexamples-2:the-address-element>a href#the-address-element>address/a>/code> element) containing an address with two street components:/p> pre><address itemscope itemtypehttp://microformats.org/profile/hcard> <strong itempropfn><span itempropn itemscope><span itempropgiven-name>Alfred</span> <span itempropfamily-name>Person</span></span></strong> <br> <span itempropadr itemscope> <span itempropstreet-address>1600 Amphitheatre Parkway</span> <br> <span itempropstreet-address>Building 43, Second Floor</span> <br> <span itemproplocality>Mountain View</span>, <span itempropregion>CA</span> <span itemproppostal-code>94043</span> </span></address>/pre> /div> div classexample> p>The vCard vocabulary can be used to just mark up peoples names:/p> pre><span itemscope itemtypehttp://microformats.org/profile/hcard><span itempropfn><span itempropn itemscope><span itempropgiven-name>George</span> <span itempropfamily-name>Washington</span></span></span></span>/pre> p>This creates a single item with a two name-value pairs, one with the name fn and the value George Washington, and the other with the name n and a second item as its value, the second item having the two name-value pairs given-name and family-name with the values George and Washington respectively. This is defined to map to the following vCard:/p> pre>BEGIN:VCARDPROFILE:VCARDVERSION:4.0SOURCE:var>documents address/var>FN:George WashingtonN:Washington;George;;;END:VCARD/pre> /div> h4 idvevent>span classsecno>5.3.2/span> vEventa href#vevent classself-link>/a>/h4> p>An item with the a href#item-types idvevent:item-types>item type/a> dfn idmd-vevent>code>http://microformats.org/profile/hcalendar#vevent/code>/dfn> represents an event./p> p>This vocabulary does not a href#support-global-identifiers-for-items idvevent:support-global-identifiers-for-items>support global identifiers for items/a>./p> p>The following are the types a href#defined-property-name idvevent:defined-property-name>defined property names/a>. They are based on the vocabulary defined in the iCalendar specification, where more information on how to interpret the values can be found. a href#refsRFC5545>RFC5545/a>/p> p classnote>Only the parts of the iCalendar vocabulary relating to events are used here; this vocabulary cannot express a complete iCalendar instance./p> dl>dt>dfn idmd-vevent-attach>code>attach/code>/dfn>dd> p>Gives the address of an associated document for the event./p> p>The a href#concept-property-value idvevent:concept-property-value>value/a> must be an a idvevent:absolute-url hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>./p> p>Any number of properties with the name code idvevent:md-vevent-attach>a href#md-vevent-attach>attach/a>/code> may be present within each a href#concept-item idvevent:concept-item>item/a> with the type code idvevent:md-vevent>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-categories>code>categories/code>/dfn>dd> p>Gives the name of a category or tag that the event could be classified as./p> p>The a href#concept-property-value idvevent:concept-property-value-2>value/a> must be text./p> p>Any number of properties with the name code idvevent:md-vevent-categories>a href#md-vevent-categories>categories/a>/code> may be present within each a href#concept-item idvevent:concept-item-2>item/a> with the type code idvevent:md-vevent-2>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-class>code>class/code>/dfn>dd> p>Gives the access classification of the information regarding the event./p> p>The a href#concept-property-value idvevent:concept-property-value-3>value/a> must be text with one of the following values:/p> ul classbrief>li>code>public/code>li>code>private/code>li>code>confidential/code>/ul> p classwarning>This is merely advisory and cannot be considered a confidentiality measure./p> p>A single property with the name code idvevent:md-vevent-class>a href#md-vevent-class>class/a>/code> may be present within each a href#concept-item idvevent:concept-item-3>item/a> with the type code idvevent:md-vevent-3>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-comment>code>comment/code>/dfn>dd> p>Gives a comment regarding the event./p> p>The a href#concept-property-value idvevent:concept-property-value-4>value/a> must be text./p> p>Any number of properties with the name code idvevent:md-vevent-comment>a href#md-vevent-comment>comment/a>/code> may be present within each a href#concept-item idvevent:concept-item-4>item/a> with the type code idvevent:md-vevent-4>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-description>code>description/code>/dfn>dd> p>Gives a detailed description of the event./p> p>The a href#concept-property-value idvevent:concept-property-value-5>value/a> must be text./p> p>A single property with the name code idvevent:md-vevent-description>a href#md-vevent-description>description/a>/code> may be present within each a href#concept-item idvevent:concept-item-5>item/a> with the type code idvevent:md-vevent-5>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-geo>code>geo/code>/dfn>dd> p>Gives the geographical position of the event./p> p>The a href#concept-property-value idvevent:concept-property-value-6>value/a> must be text and must match the following syntax:/p> ol>li>Optionally, either a U+002B PLUS SIGN character (+) or a U+002D HYPHEN-MINUS character (-).li>One or more a idvevent:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>.li>Optionally*, a U+002E FULL STOP character (.) followed by one or more a idvevent:ascii-digits-2 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>.li>A U+003B SEMICOLON character (;).li>Optionally, either a U+002B PLUS SIGN character (+) or a U+002D HYPHEN-MINUS character (-).li>One or more a idvevent:ascii-digits-3 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>.li>Optionally*, a U+002E FULL STOP character (.) followed by one or more a idvevent:ascii-digits-4 hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>./ol> p>The optional components marked with an asterisk (*) should be included, and should have six digits each./p> p classnote>The value specifies latitude and longitude, in that order (i.e., LAT LON ordering), in decimal degrees. The longitude represents the location east and west of the prime meridian as a positive or negative real number, respectively. The latitude represents the location north and south of the equator as a positive or negative real number, respectively./p> p>A single property with the name code idvevent:md-vevent-geo>a href#md-vevent-geo>geo/a>/code> may be present within each a href#concept-item idvevent:concept-item-6>item/a> with the type code idvevent:md-vevent-6>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-location>code>location/code>/dfn>dd> p>Gives the location of the event./p> p>The a href#concept-property-value idvevent:concept-property-value-7>value/a> must be text./p> p>A single property with the name code idvevent:md-vevent-location>a href#md-vevent-location>location/a>/code> may be present within each a href#concept-item idvevent:concept-item-7>item/a> with the type code idvevent:md-vevent-7>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-resources>code>resources/code>/dfn>dd> p>Gives a resource that will be needed for the event./p> p>The a href#concept-property-value idvevent:concept-property-value-8>value/a> must be text./p> p>Any number of properties with the name code idvevent:md-vevent-resources>a href#md-vevent-resources>resources/a>/code> may be present within each a href#concept-item idvevent:concept-item-8>item/a> with the type code idvevent:md-vevent-8>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-status>code>status/code>/dfn>dd> p>Gives the confirmation status of the event./p> p>The a href#concept-property-value idvevent:concept-property-value-9>value/a> must be text with one of the following values:/p> ul classbrief>li>code>tentative/code>li>code>confirmed/code>li>code>cancelled/code>/ul> p>A single property with the name code idvevent:md-vevent-status>a href#md-vevent-status>status/a>/code> may be present within each a href#concept-item idvevent:concept-item-9>item/a> with the type code idvevent:md-vevent-9>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-summary>code>summary/code>/dfn>dd> p>Gives a short summary of the event./p> p>The a href#concept-property-value idvevent:concept-property-value-10>value/a> must be text./p> p>User agents should replace U+000A LINE FEED (LF) characters in the a href#concept-property-value idvevent:concept-property-value-11>value/a> by U+0020 SPACE characters when using the value./p> p>A single property with the name code idvevent:md-vevent-summary>a href#md-vevent-summary>summary/a>/code> may be present within each a href#concept-item idvevent:concept-item-10>item/a> with the type code idvevent:md-vevent-10>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-dtend>code>dtend/code>/dfn>dd> p>Gives the date and time by which the event ends./p> p>If the property with the name code idvevent:md-vevent-dtend>a href#md-vevent-dtend>dtend/a>/code> is present within an a href#concept-item idvevent:concept-item-11>item/a> with the type code idvevent:md-vevent-11>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code> that has a property with the name code idvevent:md-vevent-dtstart>a href#md-vevent-dtstart>dtstart/a>/code> whose value is a a href#valid-date-string idvevent:valid-date-string>valid date string/a>, then the a href#concept-property-value idvevent:concept-property-value-12>value/a> of the property with the name code idvevent:md-vevent-dtend-2>a href#md-vevent-dtend>dtend/a>/code> must be text that is a a href#valid-date-string idvevent:valid-date-string-2>valid date string/a> also. Otherwise, the a href#concept-property-value idvevent:concept-property-value-13>value/a> of the property must be text that is a a href#valid-global-date-and-time-string idvevent:valid-global-date-and-time-string>valid global date and time string/a>./p> p>In either case, the a href#concept-property-value idvevent:concept-property-value-14>value/a> be later in time than the value of the code idvevent:md-vevent-dtstart-2>a href#md-vevent-dtstart>dtstart/a>/code> property of the same a href#concept-item idvevent:concept-item-12>item/a>./p> p classnote>The time given by the code idvevent:md-vevent-dtend-3>a href#md-vevent-dtend>dtend/a>/code> property is not inclusive. For day-long events, therefore, the code idvevent:md-vevent-dtend-4>a href#md-vevent-dtend>dtend/a>/code> propertys a href#concept-property-value idvevent:concept-property-value-15>value/a> will be the day em>after/em> the end of the event./p> p>A single property with the name code idvevent:md-vevent-dtend-5>a href#md-vevent-dtend>dtend/a>/code> may be present within each a href#concept-item idvevent:concept-item-13>item/a> with the type code idvevent:md-vevent-12>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>, so long as that code idvevent:md-vevent-13>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code> does not have a property with the name code idvevent:md-vevent-duration>a href#md-vevent-duration>duration/a>/code>./p> dt>dfn idmd-vevent-dtstart>code>dtstart/code>/dfn>dd> p>Gives the date and time at which the event starts./p> p>The a href#concept-property-value idvevent:concept-property-value-16>value/a> must be text that is either a a href#valid-date-string idvevent:valid-date-string-3>valid date string/a> or a a href#valid-global-date-and-time-string idvevent:valid-global-date-and-time-string-2>valid global date and time string/a>./p> p>Exactly one property with the name code idvevent:md-vevent-dtstart-3>a href#md-vevent-dtstart>dtstart/a>/code> must be present within each a href#concept-item idvevent:concept-item-14>item/a> with the type code idvevent:md-vevent-14>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-duration>code>duration/code>/dfn>dd> p>Gives the duration of the event./p> p>The a href#concept-property-value idvevent:concept-property-value-17>value/a> must be text that is a a href#valid-vevent-duration-string idvevent:valid-vevent-duration-string>valid vevent duration string/a>./p> p>The duration represented is the sum of all the durations represented by integers in the value./p> p>A single property with the name code idvevent:md-vevent-duration-2>a href#md-vevent-duration>duration/a>/code> may be present within each a href#concept-item idvevent:concept-item-15>item/a> with the type code idvevent:md-vevent-15>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>, so long as that code idvevent:md-vevent-16>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code> does not have a property with the name code idvevent:md-vevent-dtend-6>a href#md-vevent-dtend>dtend/a>/code>./p> dt>dfn idmd-vevent-transp>code>transp/code>/dfn>dd> p>Gives whether the event is to be considered as consuming time on a calendar, for the purpose of free-busy time searches./p> p>The a href#concept-property-value idvevent:concept-property-value-18>value/a> must be text with one of the following values:/p> ul classbrief>li>code>opaque/code>li>code>transparent/code>/ul> p>A single property with the name code idvevent:md-vevent-transp>a href#md-vevent-transp>transp/a>/code> may be present within each a href#concept-item idvevent:concept-item-16>item/a> with the type code idvevent:md-vevent-17>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-contact>code>contact/code>/dfn>dd> p>Gives the contact information for the event./p> p>The a href#concept-property-value idvevent:concept-property-value-19>value/a> must be text./p> p>Any number of properties with the name code idvevent:md-vevent-contact>a href#md-vevent-contact>contact/a>/code> may be present within each a href#concept-item idvevent:concept-item-17>item/a> with the type code idvevent:md-vevent-18>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-url>code>url/code>/dfn>dd> p>Gives a a idvevent:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> for the event./p> p>The a href#concept-property-value idvevent:concept-property-value-20>value/a> must be an a idvevent:absolute-url-2 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>./p> p>A single property with the name code idvevent:md-vevent-url>a href#md-vevent-url>url/a>/code> may be present within each a href#concept-item idvevent:concept-item-18>item/a> with the type code idvevent:md-vevent-19>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-uid>code>uid/code>/dfn>dd> p>Gives a globally unique identifier corresponding to the event./p> p>The a href#concept-property-value idvevent:concept-property-value-21>value/a> must be text./p> p>A single property with the name code idvevent:md-vevent-uid>a href#md-vevent-uid>uid/a>/code> may be present within each a href#concept-item idvevent:concept-item-19>item/a> with the type code idvevent:md-vevent-20>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-exdate>code>exdate/code>/dfn>dd> p>Gives a date and time at which the event does not occur despite the recurrence rules./p> p>The a href#concept-property-value idvevent:concept-property-value-22>value/a> must be text that is either a a href#valid-date-string idvevent:valid-date-string-4>valid date string/a> or a a href#valid-global-date-and-time-string idvevent:valid-global-date-and-time-string-3>valid global date and time string/a>./p> p>Any number of properties with the name code idvevent:md-vevent-exdate>a href#md-vevent-exdate>exdate/a>/code> may be present within each a href#concept-item idvevent:concept-item-20>item/a> with the type code idvevent:md-vevent-21>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-rdate>code>rdate/code>/dfn>dd> p>Gives a date and time at which the event recurs./p> p>The a href#concept-property-value idvevent:concept-property-value-23>value/a> must be text that is one of the following: ul>li>A a href#valid-date-string idvevent:valid-date-string-5>valid date string/a>.li>A a href#valid-global-date-and-time-string idvevent:valid-global-date-and-time-string-4>valid global date and time string/a>.li>A a href#valid-global-date-and-time-string idvevent:valid-global-date-and-time-string-5>valid global date and time string/a> followed by a U+002F SOLIDUS character (/) followed by a second a href#valid-global-date-and-time-string idvevent:valid-global-date-and-time-string-6>valid global date and time string/a> representing a later time.li>A a href#valid-global-date-and-time-string idvevent:valid-global-date-and-time-string-7>valid global date and time string/a> followed by a U+002F SOLIDUS character (/) followed by a a href#valid-vevent-duration-string idvevent:valid-vevent-duration-string-2>valid vevent duration string/a>./ul> p>Any number of properties with the name code idvevent:md-vevent-rdate>a href#md-vevent-rdate>rdate/a>/code> may be present within each a href#concept-item idvevent:concept-item-21>item/a> with the type code idvevent:md-vevent-22>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-rrule>code>rrule/code>/dfn>dd> p>Gives a rule for finding dates and times at which the event occurs./p> p>The a href#concept-property-value idvevent:concept-property-value-24>value/a> must be text that matches the RECUR value type defined in the iCalendar specification. a href#refsRFC5545>RFC5545/a>/p> p>A single property with the name code idvevent:md-vevent-rrule>a href#md-vevent-rrule>rrule/a>/code> may be present within each a href#concept-item idvevent:concept-item-22>item/a> with the type code idvevent:md-vevent-23>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-created>code>created/code>/dfn>dd> p>Gives the date and time at which the event information was first created in a calendaring system./p> p>The a href#concept-property-value idvevent:concept-property-value-25>value/a> must be text that is a a href#valid-global-date-and-time-string idvevent:valid-global-date-and-time-string-8>valid global date and time string/a>./p> p>A single property with the name code idvevent:md-vevent-created>a href#md-vevent-created>created/a>/code> may be present within each a href#concept-item idvevent:concept-item-23>item/a> with the type code idvevent:md-vevent-24>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-last-modified>code>last-modified/code>/dfn>dd> p>Gives the date and time at which the event information was last modified in a calendaring system./p> p>The a href#concept-property-value idvevent:concept-property-value-26>value/a> must be text that is a a href#valid-global-date-and-time-string idvevent:valid-global-date-and-time-string-9>valid global date and time string/a>./p> p>A single property with the name code idvevent:md-vevent-last-modified>a href#md-vevent-last-modified>last-modified/a>/code> may be present within each a href#concept-item idvevent:concept-item-24>item/a> with the type code idvevent:md-vevent-25>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> dt>dfn idmd-vevent-sequence>code>sequence/code>/dfn>dd> p>Gives a revision number for the event information./p> p>The a href#concept-property-value idvevent:concept-property-value-27>value/a> must be text that is a a href#valid-non-negative-integer idvevent:valid-non-negative-integer>valid non-negative integer/a>./p> p>A single property with the name code idvevent:md-vevent-sequence>a href#md-vevent-sequence>sequence/a>/code> may be present within each a href#concept-item idvevent:concept-item-25>item/a> with the type code idvevent:md-vevent-26>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>./p> /dl> p>A string is a dfn idvalid-vevent-duration-string>valid vevent duration string/dfn> if it matches the following pattern:/p> ol>li>A U+0050 LATIN CAPITAL LETTER P character (P).li>One of the following: ul>li> A a href#valid-non-negative-integer idvevent:valid-non-negative-integer-2>valid non-negative integer/a> followed by a U+0057 LATIN CAPITAL LETTER W character (W). The integer represents a duration of that number of weeks. li> At least one, and possible both in this order, of the following: ol>li> A a href#valid-non-negative-integer idvevent:valid-non-negative-integer-3>valid non-negative integer/a> followed by a U+0044 LATIN CAPITAL LETTER D character (D). The integer represents a duration of that number of days. li> A U+0054 LATIN CAPITAL LETTER T character (T) followed by any one of the following, or the first and second of the following in that order, or the second and third of the following in that order, or all three of the following in this order: ol>li> A a href#valid-non-negative-integer idvevent:valid-non-negative-integer-4>valid non-negative integer/a> followed by a U+0048 LATIN CAPITAL LETTER H character (H). The integer represents a duration of that number of hours. li> A a href#valid-non-negative-integer idvevent:valid-non-negative-integer-5>valid non-negative integer/a> followed by a U+004D LATIN CAPITAL LETTER M character (M). The integer represents a duration of that number of minutes. li> A a href#valid-non-negative-integer idvevent:valid-non-negative-integer-6>valid non-negative integer/a> followed by a U+0053 LATIN CAPITAL LETTER S character (S). The integer represents a duration of that number of seconds. /ol> /ol> /ul> /ol> h5 idconversion-to-icalendar>span classsecno>5.3.2.1/span> Conversion to iCalendara href#conversion-to-icalendar classself-link>/a>/h5> p>Given a list of nodes var>nodes/var> in a code idconversion-to-icalendar:document>a href#document>Document/a>/code>, a user agent must run the following algorithm to dfn idextracting-vevent-data>extract any vEvent data represented by those nodes/dfn>:/p> ol>li>p>If none of the nodes in var>nodes/var> are a href#concept-item idconversion-to-icalendar:concept-item>items/a> with the type code idconversion-to-icalendar:md-vevent>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>, then there is no vEvent data. Abort the algorithm, returning nothing.li>p>Let var>output/var> be an empty string.li>p>a href#add-an-icalendar-line idconversion-to-icalendar:add-an-icalendar-line>Add an iCalendar line/a> with the type code>BEGIN/code> and the value code>VCALENDAR/code> to var>output/var>.li>p>a href#add-an-icalendar-line idconversion-to-icalendar:add-an-icalendar-line-2>Add an iCalendar line/a> with the type code>PRODID/code> and the value equal to a user-agent-specific string representing the user agent to var>output/var>.li>p>a href#add-an-icalendar-line idconversion-to-icalendar:add-an-icalendar-line-3>Add an iCalendar line/a> with the type code>VERSION/code> and the value code>2.0/code> to var>output/var>.li> p>For each node var>node/var> in var>nodes/var> that is an a href#concept-item idconversion-to-icalendar:concept-item-2>item/a> with the type code idconversion-to-icalendar:md-vevent-2>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code>, run the following steps:/p> ol>li>p>a href#add-an-icalendar-line idconversion-to-icalendar:add-an-icalendar-line-4>Add an iCalendar line/a> with the type code>BEGIN/code> and the value code>VEVENT/code> to var>output/var>.li>p>a href#add-an-icalendar-line idconversion-to-icalendar:add-an-icalendar-line-5>Add an iCalendar line/a> with the type code>DTSTAMP/code> and a value consisting of an iCalendar DATE-TIME string representing the current date and time, with the annotation code>VALUEDATE-TIME/code>, to var>output/var>. a href#refsRFC5545>RFC5545/a>li> p>For each element var>element/var> that is a href#the-properties-of-an-item idconversion-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 idconversion-to-icalendar:property-names>property names/a>, run the appropriate set of substeps from the following list:/p> dl>dt>If the propertys a href#concept-property-value idconversion-to-icalendar:concept-property-value>value/a> is an a href#concept-item idconversion-to-icalendar:concept-item-3>item/a>dd> p>Skip the property./p> dt>If the property is code idconversion-to-icalendar:md-vevent-dtend>a href#md-vevent-dtend>dtend/a>/code>dt>If the property is code idconversion-to-icalendar:md-vevent-dtstart>a href#md-vevent-dtstart>dtstart/a>/code>dt>If the property is code idconversion-to-icalendar:md-vevent-exdate>a href#md-vevent-exdate>exdate/a>/code>dt>If the property is code idconversion-to-icalendar:md-vevent-rdate>a href#md-vevent-rdate>rdate/a>/code>dt>If the property is code idconversion-to-icalendar:md-vevent-created>a href#md-vevent-created>created/a>/code>dt>If the property is code idconversion-to-icalendar:md-vevent-last-modified>a href#md-vevent-last-modified>last-modified/a>/code>dd> p>Let var>value/var> be the result of stripping all U+002D HYPHEN-MINUS (-) and U+003A COLON (:) characters from the propertys a href#concept-property-value idconversion-to-icalendar:concept-property-value-2>value/a>./p> p>If the propertys a href#concept-property-value idconversion-to-icalendar:concept-property-value-3>value/a> is a a href#valid-date-string idconversion-to-icalendar:valid-date-string>valid date string/a> then a href#add-an-icalendar-line idconversion-to-icalendar:add-an-icalendar-line-6>add an iCalendar line/a> with the type var>name/var> and the value var>value/var> to var>output/var>, with the annotation code>VALUEDATE/code>./p> p>Otherwise, if the propertys a href#concept-property-value idconversion-to-icalendar:concept-property-value-4>value/a> is a a href#valid-global-date-and-time-string idconversion-to-icalendar:valid-global-date-and-time-string>valid global date and time string/a> then a href#add-an-icalendar-line idconversion-to-icalendar:add-an-icalendar-line-7>add an iCalendar line/a> with the type var>name/var> and the value var>value/var> to var>output/var>, with the annotation code>VALUEDATE-TIME/code>./p> p>Otherwise skip the property./p> dt>Otherwisedd> p>a href#add-an-icalendar-line idconversion-to-icalendar:add-an-icalendar-line-8>Add an iCalendar line/a> with the type var>name/var> and the propertys a href#concept-property-value idconversion-to-icalendar:concept-property-value-5>value/a> to var>output/var>./p> /dl> li>p>a href#add-an-icalendar-line idconversion-to-icalendar:add-an-icalendar-line-9>Add an iCalendar line/a> with the type code>END/code> and the value code>VEVENT/code> to var>output/var>./ol> li>p>a href#add-an-icalendar-line idconversion-to-icalendar:add-an-icalendar-line-10>Add an iCalendar line/a> with the type code>END/code> and the value code>VCALENDAR/code> to var>output/var>./ol> p>When the above algorithm says that the user agent is to dfn idadd-an-icalendar-line>add an iCalendar line/dfn> consisting of a type var>type/var>, a value var>value/var>, and optionally an annotation, to a string var>output/var>, it must run the following steps:/p> ol>li>p>Let var>line/var> be an empty string.li>p>Append var>type/var>, a idconversion-to-icalendar:converted-to-ascii-uppercase hrefhttps://infra.spec.whatwg.org/#ascii-uppercase data-x-internalconverted-to-ascii-uppercase>converted to ASCII uppercase/a>, to var>line/var>.li> p>If there is an annotation:/p> ol>li>p>Append a U+003B SEMICOLON character (;) to var>line/var>.li>p>Append the annotation to var>line/var>./ol> li>p>Append a U+003A COLON character (:) to var>line/var>.li>p>Prefix every U+005C REVERSE SOLIDUS character (\) in var>value/var> with another U+005C REVERSE SOLIDUS character (\).li>p>Prefix every U+002C COMMA character (,) in var>value/var> with a U+005C REVERSE SOLIDUS character (\).li>p>Prefix every U+003B SEMICOLON character (;) in var>value/var> with a U+005C REVERSE SOLIDUS character (\).li>p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED character pair (CRLF) in var>value/var> with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN SMALL LETTER N character (n).li>p>Replace every remaining U+000D CARRIAGE RETURN (CR) or U+000A LINE FEED (LF) character in var>value/var> with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN SMALL LETTER N character (n).li>p>Append var>value/var> to var>line/var>.li>p>Let var>maximum length/var> be 75.li> p>While var>line/var>s a hrefhttps://infra.spec.whatwg.org/#string-length idconversion-to-icalendar:string-length data-x-internalstring-length>length/a> is greater than var>maximum length/var>:/p> ol>li>p>Append the first var>maximum length/var> code points of var>line/var> to var>output/var>.li>p>Remove the first var>maximum length/var> code points from var>line/var>.li>p>Append a U+000D CARRIAGE RETURN character (CR) to var>output/var>.li>p>Append a U+000A LINE FEED character (LF) to var>output/var>.li>p>Append a U+0020 SPACE character to var>output/var>.li>p>Let var>maximum length/var> be 74./ol> li>p>Append (what remains of) var>line/var> to var>output/var>.li>p>Append a U+000D CARRIAGE RETURN character (CR) to var>output/var>.li>p>Append a U+000A LINE FEED character (LF) to var>output/var>./ol> p classnote>This algorithm can generate invalid iCalendar output, if the input does not conform to the rules described for the code idconversion-to-icalendar:md-vevent-3>a href#md-vevent>http://microformats.org/profile/hcalendar#vevent/a>/code> a href#item-types idconversion-to-icalendar:item-types>item type/a> and a href#defined-property-name idconversion-to-icalendar:defined-property-name>defined property names/a>./p> h5 idexamples-3>span classsecno>5.3.2.2/span> Examplesa href#examples-3 classself-link>/a>/h5> p>i>This section is non-normative./i>/p> div classexample> p>Here is an example of a page that uses the vEvent vocabulary to mark up an event:/p> pre><body itemscope itemtypehttp://microformats.org/profile/hcalendar#vevent> ... <h1 itempropsummary>Bluesday Tuesday: Money Road</h1> ... <time itempropdtstart datetime2009-05-05T19:00:00Z>May 5th @ 7pm</time> (until <time itempropdtend datetime2009-05-05T21:00:00Z>9pm</time>) ... <a hrefhttp://livebrum.co.uk/2009/05/05/bluesday-tuesday-money-road relbookmark itempropurl>Link to this page</a> ... <p>Location: <span itemproplocation>The RoadHouse</span></p> ... <p><input typebutton valueAdd to Calendar onclicklocation getCalendar(this)></p> ... <meta itempropdescription contentvia livebrum.co.uk></body>/pre> p>The code>getCalendar()/code> function is left as an exercise for the reader./p> p>The same page could offer some markup, such as the following, for copy-and-pasting into blogs:/p> pre><div itemscope itemtypehttp://microformats.org/profile/hcalendar#vevent> <p>Im going to <strong itempropsummary>Bluesday Tuesday: Money Road</strong>, <time itempropdtstart datetime2009-05-05T19:00:00Z>May 5th at 7pm</time> to <time itempropdtend datetime2009-05-05T21:00:00Z>9pm</time>, at <span itemproplocation>The RoadHouse</span>!</p> <p><a hrefhttp://livebrum.co.uk/2009/05/05/bluesday-tuesday-money-road itempropurl>See this event on livebrum.co.uk</a>.</p> <meta itempropdescription contentvia livebrum.co.uk></div>/pre> /div> h4 idlicensing-works>span classsecno>5.3.3/span> Licensing worksa href#licensing-works classself-link>/a>/h4> p>An item with the a href#item-types idlicensing-works:item-types>item type/a> dfn idmd-work>code>http://n.whatwg.org/work/code>/dfn> represents a work (e.g. an article, an image, a video, a song, etc). This type is primarily intended to allow authors to include licensing information for works./p> p>The following are the types a href#defined-property-name idlicensing-works:defined-property-name>defined property names/a>./p> dl>dt>dfn idmd-work-work>code>work/code>/dfn>dd> p>Identifies the work being described./p> p>The a href#concept-property-value idlicensing-works:concept-property-value>value/a> must be an a idlicensing-works:absolute-url hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>./p> p>Exactly one property with the name code idlicensing-works:md-work-work>a href#md-work-work>work/a>/code> must be present within each a href#concept-item idlicensing-works:concept-item>item/a> with the type code idlicensing-works:md-work>a href#md-work>http://n.whatwg.org/work/a>/code>./p> dt>dfn idmd-work-title>code>title/code>/dfn>dd> p>Gives the name of the work./p> p>A single property with the name code idlicensing-works:md-work-title>a href#md-work-title>title/a>/code> may be present within each a href#concept-item idlicensing-works:concept-item-2>item/a> with the type code idlicensing-works:md-work-2>a href#md-work>http://n.whatwg.org/work/a>/code>./p> dt>dfn idmd-work-author>code>author/code>/dfn>dd> p>Gives the name or contact information of one of the authors or creators of the work./p> p>The a href#concept-property-value idlicensing-works:concept-property-value-2>value/a> must be either an a href#concept-item idlicensing-works:concept-item-3>item/a> with the type code idlicensing-works:md-vcard>a href#md-vcard>http://microformats.org/profile/hcard/a>/code>, or text./p> p>Any number of properties with the name code idlicensing-works:md-work-author>a href#md-work-author>author/a>/code> may be present within each a href#concept-item idlicensing-works:concept-item-4>item/a> with the type code idlicensing-works:md-work-3>a href#md-work>http://n.whatwg.org/work/a>/code>./p> dt>dfn idmd-work-license>code>license/code>/dfn>dd> p>Identifies one of the licenses under which the work is available./p> p>The a href#concept-property-value idlicensing-works:concept-property-value-3>value/a> must be an a idlicensing-works:absolute-url-2 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>./p> p>Any number of properties with the name code idlicensing-works:md-work-license>a href#md-work-license>license/a>/code> may be present within each a href#concept-item idlicensing-works:concept-item-5>item/a> with the type code idlicensing-works:md-work-4>a href#md-work>http://n.whatwg.org/work/a>/code>./p> /dl> h5 idexamples-4>span classsecno>5.3.3.1/span> Examplesa href#examples-4 classself-link>/a>/h5> p>i>This section is non-normative./i>/p> div classexample> p>This example shows an embedded image entitled cite>My Pond/cite>, licensed under the Creative Commons Attribution-Share Alike 4.0 International License and the MIT license simultaneously./p> pre><figure strong>itemscope itemtypehttp://n.whatwg.org/work/strong>> <img strong>itempropwork/strong> srcmypond.jpeg> <figcaption> <p><cite strong>itemproptitle/strong>>My Pond</cite></p> <p><small>Licensed under the <a strong>itemproplicense/strong> hrefhttps://creativecommons.org/licenses/by-sa/4.0/>Creative Commons Attribution-Share Alike 4.0 International License</a> and the <a strong>itemproplicense/strong> hrefhttp://www.opensource.org/licenses/mit-license.php>MIT license</a>.</small> </figcaption></figure>/pre> /div> h3 idconverting-html-to-other-formats>span classsecno>5.4/span> Converting HTML to other formatsa href#converting-html-to-other-formats classself-link>/a>/h3> h4 idjson>span classsecno>5.4.1/span> JSONa href#json classself-link>/a>/h4> p>Given a list of nodes var>nodes/var> in a code idjson:document>a href#document>Document/a>/code>, a user agent must run the following algorithm to dfn idextracting-json>extract the microdata from those nodes into a JSON form/dfn>:/p> ol>li>p>Let var>result/var> be an empty object.li>p>Let var>items/var> be an empty array.li>p>For each var>node/var> in var>nodes/var>, check if the element is a a href#top-level-microdata-items idjson:top-level-microdata-items>top-level microdata item/a>, and if it is then a href#get-the-object idjson:get-the-object>get the object/a> for that element and add it to var>items/var>.li>p>Add an entry to var>result/var> called code>items/code> whose value is the array var>items/var>.li>p>Return the result of serializing var>result/var> to JSON in the shortest possible way (meaning no whitespace between tokens, no unnecessary zero digits in numbers, and only using Unicode escapes in strings for characters that do not have a dedicated escape sequence), and with a lowercase code>e/code> used, when appropriate, in the representation of any numbers. a href#refsJSON>JSON/a>/ol> p classnote>This algorithm returns an object with a single property that is an array, instead of just returning an array, so that it is possible to extend the algorithm in the future if necessary./p> p>When the user agent is to dfn idget-the-object>get the object/dfn> for an item var>item/var>, optionally with a list of elements var>memory/var>, it must run the following substeps:/p> ol>li>p>Let var>result/var> be an empty object.li>p>If no var>memory/var> was passed to the algorithm, let var>memory/var> be an empty list.li>p>Add var>item/var> to var>memory/var>.li>p>If the var>item/var> has any a href#item-types idjson:item-types>item types/a>, add an entry to var>result/var> called code>type/code> whose value is an array listing the a href#item-types idjson:item-types-2>item types/a> of var>item/var>, in the order they were specified on the code idjson:attr-itemtype>a href#attr-itemtype>itemtype/a>/code> attribute./p> li>p>If the var>item/var> has a a href#global-identifier idjson:global-identifier>global identifier/a>, add an entry to var>result/var> called code>id/code> whose value is the a href#global-identifier idjson:global-identifier-2>global identifier/a> of var>item/var>.li>p>Let var>properties/var> be an empty object.li> p>For each element var>element/var> that has one or more a href#property-names idjson:property-names>property names/a> and is one of a href#the-properties-of-an-item idjson:the-properties-of-an-item>the properties of the item/a> var>item/var>, in the order those elements are given by the algorithm that returns a href#the-properties-of-an-item idjson:the-properties-of-an-item-2>the properties of an item/a>, run the following substeps:/p> ol>li>p>Let var>value/var> be the a href#concept-property-value idjson:concept-property-value>property value/a> of var>element/var>.li>p>If var>value/var> is an a href#concept-item idjson:concept-item>item/a>, then: If var>value/var> is in var>memory/var>, then let var>value/var> be the string code>ERROR/code>. Otherwise, a href#get-the-object idjson:get-the-object-2>get the object/a> for var>value/var>, passing a copy of var>memory/var>, and then replace var>value/var> with the object returned from those steps.li> p>For each name var>name/var> in var>element/var>s a href#property-names idjson:property-names-2>property names/a>, run the following substeps:/p> ol>li>p>If there is no entry named var>name/var> in var>properties/var>, then add an entry named var>name/var> to var>properties/var> whose value is an empty array.li>p>Append var>value/var> to the entry named var>name/var> in var>properties/var>./ol> /ol> li>p>Add an entry to var>result/var> called code>properties/code> whose value is the object var>properties/var>.li>p>Return var>result/var>./ol> div classexample> p>For example, take this markup:/p> pre><!DOCTYPE HTML><html langen><title>My Blog</title><article itemscope itemtypehttp://schema.org/BlogPosting> <header> <h1 itempropheadline>Progress report</h1> <p><time itempropdatePublished datetime2013-08-29>today</time></p> <link itempropurl href?comments0> </header> <p>All in all, hes doing well with his swim lessons. The biggest thing was he had trouble putting his head in, but we got it down.</p> <section> <h1>Comments</h1> <article itempropcomment itemscope itemtypehttp://schema.org/UserComments idc1> <link itempropurl href#c1> <footer> <p>Posted by: <span itempropcreator itemscope itemtypehttp://schema.org/Person> <span itempropname>Greg</span> </span></p> <p><time itempropcommentTime datetime2013-08-29>15 minutes ago</time></p> </footer> <p>Ha!</p> </article> <article itempropcomment itemscope itemtypehttp://schema.org/UserComments idc2> <link itempropurl href#c2> <footer> <p>Posted by: <span itempropcreator itemscope itemtypehttp://schema.org/Person> <span itempropname>Charlotte</span> </span></p> <p><time itempropcommentTime datetime2013-08-29>5 minutes ago</time></p> </footer> <p>When you say we got it down...</p> </article> </section></article>/pre> p>It would be turned into the following JSON by the algorithm above (supposing that the pages URL was code>https://blog.example.com/progress-report/code>):/p> pre>{ items: { type: http://schema.org/BlogPosting , properties: { headline: Progress report , datePublished: 2013-08-29 , url: https://blog.example.com/progress-report?comments0 , comment: { type: http://schema.org/UserComments , properties: { url: https://blog.example.com/progress-report#c1 , creator: { type: http://schema.org/Person , properties: { name: Greg } } , commentTime: 2013-08-29 } }, { type: http://schema.org/UserComments , properties: { url: https://blog.example.com/progress-report#c2 , creator: { type: http://schema.org/Person , properties: { name: Charlotte } } , commentTime: 2013-08-29 } } } } }/pre> /div> h2 idediting>span classsecno>6/span> dfn>User interaction/dfn>a href#editing classself-link>/a>/h2> h3 idthe-hidden-attribute>span classsecno>6.1/span> The dfn>code>hidden/code>/dfn> attributea href#the-hidden-attribute classself-link>/a>/h3>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> hiddenspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>6+/span>/span>span classios_saf yes>span>iOS Safari/span> span>5.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>4+/span>/span>span classie yes>span>IE/span> span>11+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>5.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>4+/span>/span>span classopera yes>span>Opera/span> span>11.1+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#feathidden>caniuse.com/a>/div> p>All a href#html-elements idthe-hidden-attribute:html-elements>HTML elements/a> may have the code idthe-hidden-attribute:the-hidden-attribute>a href#the-hidden-attribute>hidden/a>/code> content attribute set. The code idthe-hidden-attribute:the-hidden-attribute-2>a href#the-hidden-attribute>hidden/a>/code> attribute is a a href#boolean-attribute idthe-hidden-attribute:boolean-attribute>boolean attribute/a>. When specified on an element, it indicates that the element is not yet, or is no longer, directly relevant to the pages current state, or that it is being used to declare content to be reused by other parts of the page as opposed to being directly accessed by the user. User agents should not render elements that have the code idthe-hidden-attribute:the-hidden-attribute-3>a href#the-hidden-attribute>hidden/a>/code> attribute specified. This requirement may be implemented indirectly through the style layer. For example, an HTML+CSS user agent could implement these requirements a href#hiddenCSS>using the rules suggested in the Rendering section/a>./p> p classnote>Because this attribute is typically implemented using CSS, its also possible to override it using CSS. For instance, a rule that applies display: block to all elements will cancel the effects of the code idthe-hidden-attribute:the-hidden-attribute-4>a href#the-hidden-attribute>hidden/a>/code> attribute. Authors therefore have to take care when writing their style sheets to make sure that the attribute is still styled as expected./p> div classexample> p>In the following skeletal example, the attribute is used to hide the Web games main screen until the user logs in:/p> pre> <h1>The Example Game</h1> <section idlogin> <h2>Login</h2> <form> ... <!-- calls login() once the users credentials have been checked --> </form> <script> function login() { // switch screens document.getElementById(login).hidden true; document.getElementById(game).hidden false; } </script> </section> <section idgame hidden> ... </section>/pre> /div> p>The code idthe-hidden-attribute:the-hidden-attribute-5>a href#the-hidden-attribute>hidden/a>/code> attribute must not be used to hide content that could legitimately be shown in another presentation. For example, it is incorrect to use code idthe-hidden-attribute:the-hidden-attribute-6>a href#the-hidden-attribute>hidden/a>/code> to hide panels in a tabbed dialog, because the tabbed interface is merely a kind of overflow presentation — one could equally well just show all the form controls in one big page with a scrollbar. It is similarly incorrect to use this attribute to hide content just from one presentation — if something is marked code idthe-hidden-attribute:the-hidden-attribute-7>a href#the-hidden-attribute>hidden/a>/code>, it is hidden from all presentations, including, for instance, screen readers./p> p>Elements that are not themselves code idthe-hidden-attribute:the-hidden-attribute-8>a href#the-hidden-attribute>hidden/a>/code> must not a href#hyperlink idthe-hidden-attribute:hyperlink>hyperlink/a> to elements that are code idthe-hidden-attribute:the-hidden-attribute-9>a href#the-hidden-attribute>hidden/a>/code>. The code>for/code> attributes of code idthe-hidden-attribute:the-label-element>a href#the-label-element>label/a>/code> and code idthe-hidden-attribute:the-output-element>a href#the-output-element>output/a>/code> elements that are not themselves code idthe-hidden-attribute:the-hidden-attribute-10>a href#the-hidden-attribute>hidden/a>/code> must similarly not refer to elements that are code idthe-hidden-attribute:the-hidden-attribute-11>a href#the-hidden-attribute>hidden/a>/code>. In both cases, such references would cause user confusion./p> p>Elements and scripts may, however, refer to elements that are code idthe-hidden-attribute:the-hidden-attribute-12>a href#the-hidden-attribute>hidden/a>/code> in other contexts./p> div classexample> p>For example, it would be incorrect to use the code idthe-hidden-attribute:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute to link to a section marked with the code idthe-hidden-attribute:the-hidden-attribute-13>a href#the-hidden-attribute>hidden/a>/code> attribute. If the content is not applicable or relevant, then there is no reason to link to it./p> p>It would be fine, however, to use the ARIA code idthe-hidden-attribute:attr-aria-describedby>a data-x-internalattr-aria-describedby hrefhttps://w3c.github.io/aria/aria/aria.html#aria-describedby>aria-describedby/a>/code> attribute to refer to descriptions that are themselves code idthe-hidden-attribute:the-hidden-attribute-14>a href#the-hidden-attribute>hidden/a>/code>. While hiding the descriptions implies that they are not useful alone, they could be written in such a way that they are useful in the specific context of being referenced from the images that they describe./p> p>Similarly, a code idthe-hidden-attribute:the-canvas-element>a href#the-canvas-element>canvas/a>/code> element with the code idthe-hidden-attribute:the-hidden-attribute-15>a href#the-hidden-attribute>hidden/a>/code> attribute could be used by a scripted graphics engine as an off-screen buffer, and a form control could refer to a hidden code idthe-hidden-attribute:the-form-element>a href#the-form-element>form/a>/code> element using its code idthe-hidden-attribute:attr-fae-form>a href#attr-fae-form>form/a>/code> attribute./p> /div> p>Elements in a section hidden by the code idthe-hidden-attribute:the-hidden-attribute-16>a href#the-hidden-attribute>hidden/a>/code> attribute are still active, e.g. scripts and form controls in such sections still execute and submit respectively. Only their presentation to the user changes./p> p>The dfn iddom-hidden>code>hidden/code>/dfn> IDL attribute must a href#reflect idthe-hidden-attribute:reflect>reflect/a> the content attribute of the same name./p> h3 idinert-subtrees>span classsecno>6.2/span> Inert subtreesa href#inert-subtrees classself-link>/a>/h3> p classnote>This section strong>does not/strong> define or create any content attribute named inert. This section merely defines an abstract em>concept/em> of a href#inert idinert-subtrees:inert>inertness/a>./p> p>A node (in particular elements and text nodes) can be marked as dfn idinert>inert/dfn>. When a node is a href#inert idinert-subtrees:inert-2>inert/a>, then the user agent must act as if the node was absent for the purposes of targeting user interaction events, may ignore the node for the purposes of text search user interfaces (commonly known as find in page), and may prevent the user from selecting text in that node. User agents should allow the user to override the restrictions on search and text selection, however./p> p classexample>For example, consider a page that consists of just a single a href#inert idinert-subtrees:inert-3>inert/a> paragraph positioned in the middle of a code idinert-subtrees:the-body-element>a href#the-body-element>body/a>/code>. If a user moves their pointing device from the code idinert-subtrees:the-body-element-2>a href#the-body-element>body/a>/code> over to the a href#inert idinert-subtrees:inert-4>inert/a> paragraph and clicks on the paragraph, no code idinert-subtrees:event-mouseover>a data-x-internalevent-mouseover hrefhttps://w3c.github.io/uievents/#event-type-mouseover>mouseover/a>/code> event would be fired, and the code idinert-subtrees:event-mousemove>a data-x-internalevent-mousemove hrefhttps://w3c.github.io/uievents/#event-type-mousemove>mousemove/a>/code> and code idinert-subtrees:event-click>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> events would be fired on the code idinert-subtrees:the-body-element-3>a href#the-body-element>body/a>/code> element rather than the paragraph./p> p classnote>When a node is inert, it generally cannot be focused. Inert nodes that are a href#concept-command idinert-subtrees:concept-command>commands/a> will also get disabled./p> p>While a a href#browsing-context-container idinert-subtrees:browsing-context-container>browsing context container/a> is marked as a href#inert idinert-subtrees:inert-5>inert/a>, its a href#nested-browsing-context idinert-subtrees:nested-browsing-context>nested browsing context/a>s a href#active-document idinert-subtrees:active-document>active document/a>, and all nodes in that code idinert-subtrees:document>a href#document>Document/a>/code>, must be marked as a href#inert idinert-subtrees:inert-6>inert/a>./p> p>A code idinert-subtrees:document-2>a href#document>Document/a>/code> var>document/var> is dfn idblocked-by-a-modal-dialog>blocked by a modal dialog/dfn> var>subject/var> if var>subject/var> is the topmost code idinert-subtrees:the-dialog-element>a href#the-dialog-element>dialog/a>/code> element in var>document/var>s a idinert-subtrees:top-layer hrefhttps://fullscreen.spec.whatwg.org/#top-layer data-x-internaltop-layer>top layer/a>. While var>document/var> is so blocked, every node that is a idinert-subtrees:connected hrefhttps://dom.spec.whatwg.org/#connected data-x-internalconnected>connected/a> to var>document/var>, with the exception of the var>subject/var> element and its a hrefhttps://dom.spec.whatwg.org/#concept-shadow-including-descendant idinert-subtrees:shadow-including-descendant data-x-internalshadow-including-descendant>shadow-including descendants/a>, must be marked a href#inert idinert-subtrees:inert-7>inert/a>. (The elements excepted by this paragraph can additionally be marked a href#inert idinert-subtrees:inert-8>inert/a> through other means; being part of a modal dialog does not protect a node from being marked a href#inert idinert-subtrees:inert-9>inert/a>.)/p> p classnote>The code idinert-subtrees:the-dialog-element-2>a href#the-dialog-element>dialog/a>/code> elements code idinert-subtrees:dom-dialog-showmodal>a href#dom-dialog-showmodal>showModal()/a>/code> method causes this mechanism to trigger, by a hrefhttps://fullscreen.spec.whatwg.org/#top-layer-add idinert-subtrees:top-layer-add data-x-internaltop-layer-add>adding/a> the code idinert-subtrees:the-dialog-element-3>a href#the-dialog-element>dialog/a>/code> element to its a idinert-subtrees:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a idinert-subtrees:top-layer-2 hrefhttps://fullscreen.spec.whatwg.org/#top-layer data-x-internaltop-layer>top layer/a>./p> h3 idactivation>span classsecno>6.3/span> Activationa href#activation classself-link>/a>/h3> p>Certain elements in HTML have an a idactivation:activation-behaviour hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a>, which means that the user can activate them. This is always caused by a code idactivation:event-click>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> event./p> p>The user agent should allow the user to manually trigger elements that have an a idactivation:activation-behaviour-2 hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a>, for instance using keyboard or voice input, or through mouse clicks. When the user triggers an element with a defined a idactivation:activation-behaviour-3 hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a> in a manner other than clicking it, the default action of the interaction event must be to a href#fire-a-click-event idactivation:fire-a-click-event>fire a code>click/code> event/a> at the element./p> p idallowed-to-show-a-popup>An algorithm is dfn idtriggered-by-user-activation data-export>triggered by user activation/dfn> if any of the following conditions is true:/p> ul>li>p>The a href#concept-task idactivation:concept-task>task/a> in which the algorithm is running is currently processing an a idactivation:activation-behaviour-4 hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a> whose code idactivation:event-click-2>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> events code idactivation:dom-event-istrusted>a data-x-internaldom-event-istrusted hrefhttps://dom.spec.whatwg.org/#dom-event-istrusted>isTrusted/a>/code> attribute is true.li> p>The a href#concept-task idactivation:concept-task-2>task/a> in which the algorithm is running is currently running the event listener for an event whose code idactivation:dom-event-istrusted-2>a data-x-internaldom-event-istrusted hrefhttps://dom.spec.whatwg.org/#dom-event-istrusted>isTrusted/a>/code> attribute is true and whose code idactivation:dom-event-type>a data-x-internaldom-event-type hrefhttps://dom.spec.whatwg.org/#dom-event-type>type/a>/code> is one of:/p> ul classbrief>li>code idactivation:event-change>a href#event-change>change/a>/code>li>code idactivation:event-click-3>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code>li>code idactivation:event-dblclick>a data-x-internalevent-dblclick hrefhttps://w3c.github.io/uievents/#event-type-dblclick>dblclick/a>/code>li>code idactivation:event-mouseup>a data-x-internalevent-mouseup hrefhttps://w3c.github.io/uievents/#event-type-mouseup>mouseup/a>/code>li>code idactivation:event-pointerup>a data-x-internalevent-pointerup hrefhttps://w3c.github.io/pointerevents/#the-pointerup-event>pointerup/a>/code>li>code idactivation:event-reset>a href#event-reset>reset/a>/code>li>code idactivation:event-submit>a href#event-submit>submit/a>/code>li>code idactivation:event-touchend>a data-x-internalevent-touchend hrefhttps://w3c.github.io/touch-events/#event-touchend>touchend/a>/code>/ul> li> p>The a href#concept-task idactivation:concept-task-3>task/a> in which the algorithm is running was a href#queue-a-task idactivation:queue-a-task>queued/a> by an algorithm that was a href#triggered-by-user-activation idactivation:triggered-by-user-activation>triggered by user activation/a>, and the chain of such algorithms started within a user-agent defined timeframe./p> p classexample>For example, if a user clicked a button, it might be acceptable for a popup to result from that after 4 seconds, but it would likely not be acceptable for a popup to result from that after 4 hours./p> /ul> dl classdomintro>dt>var>element/var> . code idactivation:dom-click>a href#dom-click>click/a>/code>()dd> p>Acts as if the element was clicked./p> /dl> p>Each element has an associated dfn idclick-in-progress-flag>click in progress flag/dfn>, which is initially unset./p> p>The dfn iddom-click>code>click()/code>/dfn> method must run the following steps:/p> ol>li>p>If this element is a form control that is a href#concept-fe-disabled idactivation:concept-fe-disabled>disabled/a>, then abort these steps.li>p>If this elements a href#click-in-progress-flag idactivation:click-in-progress-flag>click in progress flag/a> is set, then abort these steps.li>p>Set this elements a href#click-in-progress-flag idactivation:click-in-progress-flag-2>click in progress flag/a>.li>p>a href#fire-a-synthetic-mouse-event idactivation:fire-a-synthetic-mouse-event>Fire a synthetic mouse event/a> at this element, with the var>not trusted flag/var> set.li>p>Unset this elements a href#click-in-progress-flag idactivation:click-in-progress-flag-3>click in progress flag/a>./ol> h3 idfocus>span classsecno>6.4/span> Focusa href#focus classself-link>/a>/h3> h4 idintroduction-8>span classsecno>6.4.1/span> Introductiona href#introduction-8 classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>An HTML user interface typically consists of multiple interactive widgets, such as form controls, scrollable regions, links, dialog boxes, browser tabs, and so forth. These widgets form a hierarchy, with some (e.g. browser tabs, dialog boxes) containing others (e.g. links, form controls)./p> p>When interacting with an interface using a keyboard, key input is channeled from the system, through the hierarchy of interactive widgets, to an active widget, which is said to be a href#focused idintroduction-8:focused>focused/a>./p> div classexample> p>Consider an HTML application running in a browser tab running in a graphical environment. Suppose this application had a page with some text controls and links, and was currently showing a modal dialog, which itself had a text control and a button./p> p>The hierarchy of focusable widgets, in this scenario, would include the browser window, which would have, amongst its children, the browser tab containing the HTML application. The tab itself would have as its children the various links and text controls, as well as the dialog. The dialog itself would have as its children the text control and the button./p> p>img width800 src/images/focus-tree.png height450 alt> p>If the widget with a href#focused idintroduction-8:focused-2>focus/a> in this example was the text control in the dialog box, then key input would be channeled from the graphical system to ① the Web browser, then to ② the tab, then to ③ the dialog, and finally to ④ the text control./p> /div> p>Keyboard em>events/em> are always targeted at this a href#focused idintroduction-8:focused-3>focused/a> element./p> h4 iddata-model>span classsecno>6.4.2/span> Data modela href#data-model classself-link>/a>/h4> p>The term dfn idfocusable-area>focusable area/dfn> is used to refer to regions of the interface that can become the target of keyboard input. Focusable areas can be elements, parts of elements, or other regions managed by the user agent./p> p>Each a href#focusable-area iddata-model:focusable-area>focusable area/a> has a dfn iddom-anchor>DOM anchor/dfn>, which is a code iddata-model:node>a data-x-internalnode hrefhttps://dom.spec.whatwg.org/#interface-node>Node/a>/code> object that represents the position of the a href#focusable-area iddata-model:focusable-area-2>focusable area/a> in the DOM. (When the a href#focusable-area iddata-model:focusable-area-3>focusable area/a> is itself a code iddata-model:node-2>a data-x-internalnode hrefhttps://dom.spec.whatwg.org/#interface-node>Node/a>/code>, it is its own a href#dom-anchor iddata-model:dom-anchor>DOM anchor/a>.) The a href#dom-anchor iddata-model:dom-anchor-2>DOM anchor/a> is used in some APIs as a substitute for the a href#focusable-area iddata-model:focusable-area-4>focusable area/a> when there is no other DOM object to represent the a href#focusable-area iddata-model:focusable-area-5>focusable area/a>./p> p>The following table describes what objects can be a href#focusable-area iddata-model:focusable-area-6>focusable areas/a>. The cells in the left column describe objects that can be a href#focusable-area iddata-model:focusable-area-7>focusable areas/a>; the cells in the right column describe the a href#dom-anchor iddata-model:dom-anchor-3>DOM anchors/a> for those elements. (The cells that span both columns are non-normative examples.)/p> table idtable-fa>thead>tr>th idth-fa-area>a href#focusable-area iddata-model:focusable-area-8>Focusable area/a> th idth-fa-dom-rep>a href#dom-anchor iddata-model:dom-anchor-4>DOM anchor/a> tr>th colspan2 idth-fa-examples>Examples tbody>tr>th headersth-fa-area idtd-fa-1 classdata-header> Elements that have their a href#specially-focusable iddata-model:specially-focusable>tabindex focus flag/a> set, that are not a href#concept-element-disabled iddata-model:concept-element-disabled>actually disabled/a>, that are not a href#expressly-inert iddata-model:expressly-inert>expressly inert/a>, and that are either a href#being-rendered iddata-model:being-rendered>being rendered/a> or a href#being-used-as-relevant-canvas-fallback-content iddata-model:being-used-as-relevant-canvas-fallback-content>being used as relevant canvas fallback content/a>. td headerstd-fa-1 th-fa-dom-rep> The element itself. tr>td colspan2 headerstd-fa-1 th-fa-examples> p classexample>code iddata-model:the-iframe-element>a href#the-iframe-element>iframe/a>/code>, code iddata-model:text-(typetext)-state-and-search-state-(typesearch)>a href#text-(typetext)-state-and-search-state-(typesearch)><input typetext>/a>/code>, sometimes code iddata-model:the-a-element>a href#the-a-element><a href>/a>/code> (depending on platform conventions). tbody>tr>th headersth-fa-area idtd-fa-2 classdata-header> The shapes of code iddata-model:the-area-element>a href#the-area-element>area/a>/code> elements in an a href#image-map iddata-model:image-map>image map/a> associated with an code iddata-model:the-img-element>a href#the-img-element>img/a>/code> element that is a href#being-rendered iddata-model:being-rendered-2>being rendered/a> and is not a href#expressly-inert iddata-model:expressly-inert-2>expressly inert/a>. td headerstd-fa-2 th-fa-dom-rep> The code iddata-model:the-img-element-2>a href#the-img-element>img/a>/code> element. tr>td colspan2 headerstd-fa-2 th-fa-examples> div classexample> p>In the following example, the code iddata-model:the-area-element-2>a href#the-area-element>area/a>/code> element creates two shapes, one on each image. The a href#dom-anchor iddata-model:dom-anchor-5>DOM anchor/a> of the first shape is the first code iddata-model:the-img-element-3>a href#the-img-element>img/a>/code> element, and the a href#dom-anchor iddata-model:dom-anchor-6>DOM anchor/a> of the second shape is the second code iddata-model:the-img-element-4>a href#the-img-element>img/a>/code> element./p> pre><map idwallmap><area altEnter Door coords10,10,100,200 hrefdoor.html></map>...<img srcimages/innerwall.jpeg altThere is a white wall here, with a door. usemap#wallmap>...<img srcimages/outerwall.jpeg altThere is a red wall here, with a door. usemap#wallmap>/pre> /div> tbody>tr>th headersth-fa-area idtd-fa-3 classdata-header> The user-agent provided subwidgets of elements that are a href#being-rendered iddata-model:being-rendered-3>being rendered/a> and are not a href#concept-element-disabled iddata-model:concept-element-disabled-2>actually disabled/a> or a href#expressly-inert iddata-model:expressly-inert-3>expressly inert/a>. td headerstd-fa-3 th-fa-dom-rep> The element for which the a href#focusable-area iddata-model:focusable-area-9>focusable area/a> is a subwidget. tr>td colspan2 headerstd-fa-3 th-fa-examples> p classexample>The a href#expose-a-user-interface-to-the-user iddata-model:expose-a-user-interface-to-the-user>controls in the user interface that is exposed to the user/a> for a code iddata-model:the-video-element>a href#the-video-element>video/a>/code> element, the up and down buttons in a spin-control version of code iddata-model:number-state-(typenumber)>a href#number-state-(typenumber)><input typenumber>/a>/code>, the two range control widgets in a code iddata-model:range-state-(typerange)>a href#range-state-(typerange)><input typerange multiple>/a>/code>, the part of a code iddata-model:the-details-element>a href#the-details-element>details/a>/code> elements rendering that enabled the element to be opened or closed using keyboard input./p> tbody>tr>th headersth-fa-area idtd-fa-4 classdata-header> The scrollable regions of elements that are a href#being-rendered iddata-model:being-rendered-4>being rendered/a> and are not a href#expressly-inert iddata-model:expressly-inert-4>expressly inert/a>. td headerstd-fa-4 th-fa-dom-rep> The element for which the box that the scrollable region scrolls was created. tr>td colspan2 headerstd-fa-4 th-fa-examples> p classexample>The CSS a iddata-model:overflow hrefhttps://drafts.csswg.org/css-overflow-3/#propdef-overflow data-x-internaloverflow>overflow/a> propertys scroll value typically creates a scrollable region./p> tbody>tr>th headersth-fa-area idtd-fa-5 classdata-header> The a iddata-model:viewport hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> of a code iddata-model:document>a href#document>Document/a>/code> that has a a href#concept-document-bc iddata-model:concept-document-bc>browsing context/a> and is not a href#inert iddata-model:inert>inert/a>. td headerstd-fa-5 th-fa-dom-rep> The code iddata-model:document-2>a href#document>Document/a>/code> for which the a iddata-model:viewport-2 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> was created. tr>td colspan2 headerstd-fa-5 th-fa-examples> p classexample>The contents of an code iddata-model:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code>./p> tbody>tr>th headersth-fa-area idtd-fa-6 classdata-header> Any other element or part of an element, especially to aid with accessibility or to better match platform conventions. td headerstd-fa-6 th-fa-dom-rep> The element. tr>td colspan2 headerstd-fa-6 th-fa-examples> p classexample>A user agent could make all list item bullets focusable, so that a user can more easily navigate lists./p> p classexample>Similarly, a user agent could make all elements with code iddata-model:attr-title>a href#attr-title>title/a>/code> attributes focusable, so that their advisory information can be accessed./p> /table> p idbc-focus-ergo-bcc-focus classnote>A a href#browsing-context-container iddata-model:browsing-context-container>browsing context container/a> (e.g. an code iddata-model:the-iframe-element-3>a href#the-iframe-element>iframe/a>/code>) is a a href#focusable-area iddata-model:focusable-area-10>focusable area/a>, but key events routed to a a href#browsing-context-container iddata-model:browsing-context-container-2>browsing context container/a> get immediately routed to the a href#nested-browsing-context iddata-model:nested-browsing-context>nested browsing context/a>s a href#active-document iddata-model:active-document>active document/a>. Similarly, in sequential focus navigation a a href#browsing-context-container iddata-model:browsing-context-container-3>browsing context container/a> essentially acts merely as a placeholder for its a href#nested-browsing-context iddata-model:nested-browsing-context-2>nested browsing context/a>s a href#active-document iddata-model:active-document-2>active document/a>./p> hr> p>The following create dfn idcontrol-group>control groups/dfn>: ul classbrief>li>code iddata-model:document-3>a href#document>Document/a>/code> object that have a href#concept-document-bc iddata-model:concept-document-bc-2>browsing contexts/a>.li>code iddata-model:the-dialog-element>a href#the-dialog-element>dialog/a>/code> elements that have an code iddata-model:attr-dialog-open>a href#attr-dialog-open>open/a>/code> attribute specified and that are a href#being-rendered iddata-model:being-rendered-5>being rendered/a>./ul> p>The corresponding code iddata-model:document-4>a href#document>Document/a>/code> object or code iddata-model:the-dialog-element-2>a href#the-dialog-element>dialog/a>/code> element is the created a href#control-group iddata-model:control-group>control group/a>s dfn idcontrol-group-owner-object>owner object/dfn>. (There is always a 1-to-1 mapping of a href#control-group iddata-model:control-group-2>control groups/a> to a href#control-group-owner-object iddata-model:control-group-owner-object>control group owner objects/a>.)/p> p>Each a href#focusable-area iddata-model:focusable-area-11>focusable area/a> belongs to a single a href#control-group iddata-model:control-group-3>control group/a> as follows. If the a href#dom-anchor iddata-model:dom-anchor-7>DOM anchor/a> of a a href#focusable-area iddata-model:focusable-area-12>focusable area/a> is a a href#control-group-owner-object iddata-model:control-group-owner-object-2>control group owner object/a>, then that a href#focusable-area iddata-model:focusable-area-13>focusable area/a> belongs to that a href#control-group-owner-object iddata-model:control-group-owner-object-3>control group owner object/a>s a href#control-group iddata-model:control-group-4>control group/a>. Otherwise, the a href#focusable-area iddata-model:focusable-area-14>focusable area/a> belongs to its a href#dom-anchor iddata-model:dom-anchor-8>DOM anchor/a>s nearest ancestor a href#control-group-owner-object iddata-model:control-group-owner-object-4>control group owner object/a>s a href#control-group iddata-model:control-group-5>control group/a>./p> div classexample> p>Thus:/p> ul>li>p>A a iddata-model:viewport-3 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> always belongs to the a href#control-group iddata-model:control-group-6>control group/a> of the code iddata-model:document-5>a href#document>Document/a>/code> for which the a iddata-model:viewport-4 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> was created.li>p>An code iddata-model:the-input-element>a href#the-input-element>input/a>/code> control belongs to the a href#control-group iddata-model:control-group-7>control group/a> of its nearest ancestor code iddata-model:the-dialog-element-3>a href#the-dialog-element>dialog/a>/code> or code iddata-model:document-6>a href#document>Document/a>/code>.li>p>An image maps shapes belong to the nearest ancestor code iddata-model:the-dialog-element-4>a href#the-dialog-element>dialog/a>/code> or code iddata-model:document-7>a href#document>Document/a>/code> of the code iddata-model:the-img-element-5>a href#the-img-element>img/a>/code> elements (not the code iddata-model:the-area-element-3>a href#the-area-element>area/a>/code> elements — this means one code iddata-model:the-area-element-4>a href#the-area-element>area/a>/code> element might create multiple shapes in different a href#control-group iddata-model:control-group-8>control groups/a>)./ul> /div> p classnote>It is possible for a a href#control-group iddata-model:control-group-9>control group/a> to be empty, i.e. for it to have no a href#focusable-area iddata-model:focusable-area-15>focusable areas/a>./p> hr> p>span idexpressly-inert-control>/span>span idexpressly-inert-dialog>/span>An element is dfn idexpressly-inert>expressly inert/dfn> if it is a href#inert iddata-model:inert-2>inert/a> and its nearest ancestor a href#control-group-owner-object iddata-model:control-group-owner-object-5>control group owner object/a> is not a href#inert iddata-model:inert-3>inert/a>./p> div classexample> p>In a page with no code iddata-model:the-dialog-element-5>a href#the-dialog-element>dialog/a>/code> elements, all elements that are a href#inert iddata-model:inert-4>inert/a> are a href#expressly-inert iddata-model:expressly-inert-5>expressly inert/a>, and vice-versa./p> p>Inside an a href#inert iddata-model:inert-5>inert/a> code iddata-model:the-dialog-element-6>a href#the-dialog-element>dialog/a>/code> element, all descendant elements are not a href#expressly-inert iddata-model:expressly-inert-6>expressly inert/a>, even if they are a href#inert iddata-model:inert-6>inert/a>./p> p>A code iddata-model:the-dialog-element-7>a href#the-dialog-element>dialog/a>/code> element is a href#expressly-inert iddata-model:expressly-inert-7>expressly inert/a> if it is a href#inert iddata-model:inert-7>inert/a> and not nested inside another a href#inert iddata-model:inert-8>inert/a> dialog./p> /div> hr> p>Each a href#control-group-owner-object iddata-model:control-group-owner-object-6>control group owner object/a> can also act as the dfn iddialog-group-manager>manager/dfn> of a dfn iddialog-group>dialog group/dfn>./p> p>Each code iddata-model:the-dialog-element-8>a href#the-dialog-element>dialog/a>/code> element that has an code iddata-model:attr-dialog-open-2>a href#attr-dialog-open>open/a>/code> attribute specified and that is a href#being-rendered iddata-model:being-rendered-6>being rendered/a> (i.e. that is a a href#control-group-owner-object iddata-model:control-group-owner-object-7>control group owner object/a>) and is not a href#expressly-inert iddata-model:expressly-inert-8>expressly inert/a> belongs to the a href#dialog-group iddata-model:dialog-group>dialog group/a> whose a href#dialog-group-manager iddata-model:dialog-group-manager>manager/a> is the code iddata-model:the-dialog-element-9>a href#the-dialog-element>dialog/a>/code> elements nearest ancestor a href#control-group-owner-object iddata-model:control-group-owner-object-8>control group owner object/a>./p> p>If no code iddata-model:the-dialog-element-10>a href#the-dialog-element>dialog/a>/code> element has a particular a href#control-group-owner-object iddata-model:control-group-owner-object-9>control group owner object/a> as its nearest ancestor a href#control-group-owner-object iddata-model:control-group-owner-object-10>control group owner object/a>, then that a href#control-group-owner-object iddata-model:control-group-owner-object-11>control group owner object/a> has no a href#dialog-group iddata-model:dialog-group-2>dialog group/a>./p> p>Each a href#dialog-group iddata-model:dialog-group-3>dialog group/a> can have a code iddata-model:the-dialog-element-11>a href#the-dialog-element>dialog/a>/code> designated as the dfn idfocused-dialog-of-the-dialog-group>focused dialog of the dialog group/dfn>. Which code iddata-model:the-dialog-element-12>a href#the-dialog-element>dialog/a>/code> is so designated changes over time, based on algorithms in this specification./p> p>Elements in a href#dialog-group iddata-model:dialog-group-4>dialog groups/a> are ordered in a iddata-model:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>./p> hr> p>One a href#focusable-area iddata-model:focusable-area-16>focusable area/a> in each non-empty a href#control-group iddata-model:control-group-10>control group/a> is designated the dfn idfocused-area-of-the-control-group>focused area of the control group/dfn>. Which control is so designated changes over time, based on algorithms in this specification. If a a href#control-group iddata-model:control-group-11>control group/a> is empty, it has no a href#focused-area-of-the-control-group iddata-model:focused-area-of-the-control-group>focused area/a>./p> p>a href#focusable-area iddata-model:focusable-area-17>Focusable areas/a> in a href#control-group iddata-model:control-group-12>control groups/a> are ordered relative to the a iddata-model:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> of their a href#dom-anchor iddata-model:dom-anchor-9>DOM anchors/a>. a href#focusable-area iddata-model:focusable-area-18>Focusable areas/a> with the same a href#dom-anchor iddata-model:dom-anchor-10>DOM anchor/a> in a a href#control-group iddata-model:control-group-13>control group/a> are ordered relative to their CSS boxs relative positions in a pre-order, depth-first traversal of the box tree. a href#refsCSS>CSS/a>/p> hr> p>The dfn idcurrently-focused-area-of-a-top-level-browsing-context>currently focused area of a top-level browsing context/dfn> at any particular time is the a href#focusable-area iddata-model:focusable-area-19>focusable area/a> or code iddata-model:the-dialog-element-13>a href#the-dialog-element>dialog/a>/code> returned by this algorithm:/p> ol>li>p>Let var>candidate/var> be the code iddata-model:document-8>a href#document>Document/a>/code> of the a href#top-level-browsing-context iddata-model:top-level-browsing-context>top-level browsing context/a>.li> p>If var>candidate/var> has a a href#dialog-group iddata-model:dialog-group-5>dialog group/a> with a designated a href#focused-dialog-of-the-dialog-group iddata-model:focused-dialog-of-the-dialog-group>focused dialog of the dialog group/a>, then let var>candidate/var> be the designated a href#focused-dialog-of-the-dialog-group iddata-model:focused-dialog-of-the-dialog-group-2>focused dialog of the dialog group/a>, and redo this step./p> p>Otherwise, if var>candidate/var> has a non-empty a href#control-group iddata-model:control-group-14>control group/a>, and the designated a href#focused-area-of-the-control-group iddata-model:focused-area-of-the-control-group-2>focused area of the control group/a> is a a href#browsing-context-container iddata-model:browsing-context-container-4>browsing context container/a> with a non-null a href#nested-browsing-context iddata-model:nested-browsing-context-3>nested browsing context/a>, then let var>candidate/var> be the a href#active-document iddata-model:active-document-3>active document/a> of that a href#browsing-context-container iddata-model:browsing-context-container-5>browsing context container/a>s a href#nested-browsing-context iddata-model:nested-browsing-context-4>nested browsing context/a>, and redo this step./p> p>Otherwise, if var>candidate/var> has a non-empty a href#control-group iddata-model:control-group-15>control group/a>, let var>candidate/var> be the designated a href#focused-area-of-the-control-group iddata-model:focused-area-of-the-control-group-3>focused area of the control group/a>./p> li>p>Return var>candidate/var>./ol> p>An element that is the a href#dom-anchor iddata-model:dom-anchor-11>DOM anchor/a> of a a href#focusable-area iddata-model:focusable-area-20>focusable area/a> is said to dfn idgains-focus>gain focus/dfn> when that a href#focusable-area iddata-model:focusable-area-21>focusable area/a> becomes the a href#currently-focused-area-of-a-top-level-browsing-context iddata-model:currently-focused-area-of-a-top-level-browsing-context>currently focused area of a top-level browsing context/a>. When an element is the a href#dom-anchor iddata-model:dom-anchor-12>DOM anchor/a> of a a href#focusable-area iddata-model:focusable-area-22>focusable area/a> of the a href#currently-focused-area-of-a-top-level-browsing-context iddata-model:currently-focused-area-of-a-top-level-browsing-context-2>currently focused area of a top-level browsing context/a>, it is dfn idfocused>focused/dfn>./p> p>The dfn idfocus-chain>focus chain/dfn> of a a href#focusable-area iddata-model:focusable-area-23>focusable area/a> or a href#control-group-owner-object iddata-model:control-group-owner-object-12>control group owner object/a> var>subject/var> is the ordered list constructed as follows:/p> ol>li>p>Let var>current object/var> be var>subject/var>.li>p>Let var>output/var> be an empty list.li>p>i>Loop/i>: Append var>current object/var> to var>output/var>.li> p>If var>current object/var> is an code iddata-model:the-area-element-5>a href#the-area-element>area/a>/code> elements shape, append that code iddata-model:the-area-element-6>a href#the-area-element>area/a>/code> element to var>output/var>./p> p>Otherwise, if var>current object/var> is a a href#focusable-area iddata-model:focusable-area-24>focusable area/a> whose a href#dom-anchor iddata-model:dom-anchor-13>DOM anchor/a> is an element that is not var>current object/var> itself, append that a href#dom-anchor iddata-model:dom-anchor-14>DOM anchor/a> element to var>output/var>./p> li> p>If var>current object/var> is a code iddata-model:the-dialog-element-14>a href#the-dialog-element>dialog/a>/code> object in a a href#dialog-group iddata-model:dialog-group-6>dialog group/a>, let var>current object/var> be that a href#dialog-group iddata-model:dialog-group-7>dialog group/a>s a href#dialog-group-manager iddata-model:dialog-group-manager-2>manager/a>, and return to the step labeled i>loop/i>./p> p>Otherwise, if var>current object/var> is a a href#focusable-area iddata-model:focusable-area-25>focusable area/a>, let var>current object/var> be that a href#focusable-area iddata-model:focusable-area-26>focusable area/a>s a href#control-group iddata-model:control-group-16>control group/a>s a href#control-group-owner-object iddata-model:control-group-owner-object-13>owner object/a>, and return to the step labeled i>loop/i>./p> p>Otherwise, if var>current object/var> is a code iddata-model:document-9>a href#document>Document/a>/code> in a a href#nested-browsing-context iddata-model:nested-browsing-context-5>nested browsing context/a>, let var>current object/var> be its a href#browsing-context-container iddata-model:browsing-context-container-6>browsing context container/a>, and return to the step labeled i>loop/i>./p> li> p>Return var>output/var>./p> p classnote>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 iddata-model:currently-focused-area-of-a-top-level-browsing-context-3>currently focused area of a top-level browsing context/a>) continues up the focus hierarchy up to the code iddata-model:document-10>a href#document>Document/a>/code> of the a href#top-level-browsing-context iddata-model:top-level-browsing-context-2>top-level browsing context/a>./p> /ol> h4 idthe-tabindex-attribute>span classsecno>6.4.3/span> The code idthe-tabindex-attribute:attr-tabindex>a href#attr-tabindex>tabindex/a>/code> attributea href#the-tabindex-attribute classself-link>/a>/h4> p>The dfn idattr-tabindex>code>tabindex/code>/dfn> content attribute allows authors to indicate that an element is supposed to be a href#focusable-area idthe-tabindex-attribute:focusable-area>focusable/a>, and whether it is supposed to be reachable using a href#sequential-focus-navigation idthe-tabindex-attribute:sequential-focus-navigation>sequential focus navigation/a> and, if so, what is to be the relative order of the element for the purposes of sequential focus navigation. The name tab index comes from the common use of the tab key to navigate through the focusable elements. The term tabbing refers to moving forward through the focusable elements that can be reached using sequential focus navigation.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> tabindex-attrspan classchrome yes>span>Chrome/span> span>15+/span>/span>span classios_saf yes>span>iOS Safari/span> span>3.2+/span>/span>span classfirefox yes>span>Firefox/span> span>4+/span>/span>span classie yes>span>IE/span> span>7+/span>/span>span classsafari yes>span>Safari/span> span>5.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classopera yes>span>Opera/span> span>9.5+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#feattabindex-attr>caniuse.com/a>/div> p>When the attribute is omitted, the user agent applies defaults. (There is no way to make an element that is a href#being-rendered idthe-tabindex-attribute:being-rendered>being rendered/a> be not focusable at all without a href#concept-element-disabled idthe-tabindex-attribute:concept-element-disabled>disabling/a> it or making it a href#inert idthe-tabindex-attribute:inert>inert/a>.)/p> p>The code idthe-tabindex-attribute:attr-tabindex-2>a href#attr-tabindex>tabindex/a>/code> attribute, if specified, must have a value that is a a href#valid-integer idthe-tabindex-attribute:valid-integer>valid integer/a>. Positive numbers specify the relative position of the elements a href#focusable-area idthe-tabindex-attribute:focusable-area-2>focusable areas/a> in the a href#sequential-focus-navigation-order idthe-tabindex-attribute:sequential-focus-navigation-order>sequential focus navigation order/a>, and negative numbers indicate that the control is to be unreachable by a href#sequential-focus-navigation idthe-tabindex-attribute:sequential-focus-navigation-2>sequential focus navigation/a>./p> p>Developers should use caution when using values other than 0 or −1 for their code idthe-tabindex-attribute:attr-tabindex-3>a href#attr-tabindex>tabindex/a>/code> attributes as this is complicated to do correctly./p> p>Each element can have a dfn idspecially-focusable>tabindex focus flag/dfn> set, as defined below. This flag is a factor that contributes towards determining whether an element is a a href#focusable-area idthe-tabindex-attribute:focusable-area-3>focusable area/a>, as described in the previous section./p> p>If the code idthe-tabindex-attribute:attr-tabindex-4>a href#attr-tabindex>tabindex/a>/code> attribute is specified on an element, it must be parsed using the a href#rules-for-parsing-integers idthe-tabindex-attribute:rules-for-parsing-integers>rules for parsing integers/a>. The attributes values, or lack thereof, must be interpreted as follows:/p> dl>dt>If the attribute is omitted or parsing the value returns an errordd> p>The user agent should follow platform conventions to determine if the elements a href#specially-focusable idthe-tabindex-attribute:specially-focusable>tabindex focus flag/a> is set and, if so, whether the element and any a href#focusable-area idthe-tabindex-attribute:focusable-area-4>focusable areas/a> that have the element as their a href#dom-anchor idthe-tabindex-attribute:dom-anchor>DOM anchor/a> can be reached using a href#sequential-focus-navigation idthe-tabindex-attribute:sequential-focus-navigation-3>sequential focus navigation/a>, and if so, what their relative position in the a href#sequential-focus-navigation-order idthe-tabindex-attribute:sequential-focus-navigation-order-2>sequential focus navigation order/a> is to be./p> p>Modulo platform conventions, it is suggested that for the following elements, the a href#specially-focusable idthe-tabindex-attribute:specially-focusable-2>tabindex focus flag/a> be set:/p> ul>li>code idthe-tabindex-attribute:the-a-element>a href#the-a-element>a/a>/code> elements that have an code idthe-tabindex-attribute:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attributeli>code idthe-tabindex-attribute:the-link-element>a href#the-link-element>link/a>/code> elements that have an code idthe-tabindex-attribute:attr-link-href>a href#attr-link-href>href/a>/code> attributeli>code idthe-tabindex-attribute:the-button-element>a href#the-button-element>button/a>/code> elementsli>code idthe-tabindex-attribute:the-input-element>a href#the-input-element>input/a>/code> elements whose code idthe-tabindex-attribute:attr-input-type>a href#attr-input-type>type/a>/code> attribute are not in the a href#hidden-state-(typehidden) idthe-tabindex-attribute:hidden-state-(typehidden)>Hidden/a> stateli>code idthe-tabindex-attribute:the-select-element>a href#the-select-element>select/a>/code> elementsli>code idthe-tabindex-attribute:the-textarea-element>a href#the-textarea-element>textarea/a>/code> elementsli>code idthe-tabindex-attribute:the-summary-element>a href#the-summary-element>summary/a>/code> elements that are the first code idthe-tabindex-attribute:the-summary-element-2>a href#the-summary-element>summary/a>/code> element child of a code idthe-tabindex-attribute:the-details-element>a href#the-details-element>details/a>/code> elementli>Elements with a code idthe-tabindex-attribute:the-draggable-attribute>a href#the-draggable-attribute>draggable/a>/code> attribute set, if that would enable the user agent to allow the user to begin a drag operations for those elements without the use of a pointing deviceli>a hrefhttps://w3c.github.io/editing/execCommand.html#editing-host idthe-tabindex-attribute:editing-host data-x-internalediting-host>Editing hosts/a>li>a href#browsing-context-container idthe-tabindex-attribute:browsing-context-container>Browsing context containers/a>/ul> dt idnegative-tabindex>If the value is a negative integerdd> p>The user agent must set the elements a href#specially-focusable idthe-tabindex-attribute:specially-focusable-3>tabindex focus flag/a>, but should omit the element from the a href#sequential-focus-navigation-order idthe-tabindex-attribute:sequential-focus-navigation-order-3>sequential focus navigation order/a>./p> p classnote>One valid reason to ignore the requirement that sequential focus navigation not allow the author to lead to the element would be if the users only mechanism for moving the focus is sequential focus navigation. For instance, a keyboard-only user would be unable to click on a text control with a negative code idthe-tabindex-attribute:attr-tabindex-5>a href#attr-tabindex>tabindex/a>/code>, so that users user agent would be well justified in allowing the user to tab to the control regardless./p> dt>If the value is a zerodd> p>The user agent must set the elements a href#specially-focusable idthe-tabindex-attribute:specially-focusable-4>tabindex focus flag/a>, should allow the element and any a href#focusable-area idthe-tabindex-attribute:focusable-area-5>focusable areas/a> that have the element as their a href#dom-anchor idthe-tabindex-attribute:dom-anchor-2>DOM anchor/a> to be reached using a href#sequential-focus-navigation idthe-tabindex-attribute:sequential-focus-navigation-4>sequential focus navigation/a>, following platform conventions to determine the elements relative position in the a href#sequential-focus-navigation-order idthe-tabindex-attribute:sequential-focus-navigation-order-4>sequential focus navigation order/a>./p> dt>If the value is greater than zerodd> p>The user agent must set the elements a href#specially-focusable idthe-tabindex-attribute:specially-focusable-5>tabindex focus flag/a>, should allow the element and any a href#focusable-area idthe-tabindex-attribute:focusable-area-6>focusable areas/a> that have the element as their a href#dom-anchor idthe-tabindex-attribute:dom-anchor-3>DOM anchor/a> to be reached using sequential focus navigation, and should place the element — referenced as var>candidate/var> below — and the aforementioned a href#focusable-area idthe-tabindex-attribute:focusable-area-7>focusable areas/a> in the a href#sequential-focus-navigation idthe-tabindex-attribute:sequential-focus-navigation-5>sequential focus navigation/a> order so that, relative to other a href#focusable-area idthe-tabindex-attribute:focusable-area-8>focusable areas/a> in the a href#sequential-focus-navigation-order idthe-tabindex-attribute:sequential-focus-navigation-order-5>sequential focus navigation order/a>, they are:/p> ul>li>before any a href#focusable-area idthe-tabindex-attribute:focusable-area-9>focusable area/a> whose a href#dom-anchor idthe-tabindex-attribute:dom-anchor-4>DOM anchor/a> is an element whose code idthe-tabindex-attribute:attr-tabindex-6>a href#attr-tabindex>tabindex/a>/code> attribute has been omitted or whose value, when parsed, returns an error,li>before any a href#focusable-area idthe-tabindex-attribute:focusable-area-10>focusable area/a> whose a href#dom-anchor idthe-tabindex-attribute:dom-anchor-5>DOM anchor/a> is an element whose code idthe-tabindex-attribute:attr-tabindex-7>a href#attr-tabindex>tabindex/a>/code> attribute has a value equal to or less than zero,li>after any a href#focusable-area idthe-tabindex-attribute:focusable-area-11>focusable area/a> whose a href#dom-anchor idthe-tabindex-attribute:dom-anchor-6>DOM anchor/a> is an element whose code idthe-tabindex-attribute:attr-tabindex-8>a href#attr-tabindex>tabindex/a>/code> attribute has a value greater than zero but less than the value of the code idthe-tabindex-attribute:attr-tabindex-9>a href#attr-tabindex>tabindex/a>/code> attribute on var>candidate/var>,li>after any a href#focusable-area idthe-tabindex-attribute:focusable-area-12>focusable area/a> whose a href#dom-anchor idthe-tabindex-attribute:dom-anchor-7>DOM anchor/a> is an element whose code idthe-tabindex-attribute:attr-tabindex-10>a href#attr-tabindex>tabindex/a>/code> attribute has a value equal to the value of the code idthe-tabindex-attribute:attr-tabindex-11>a href#attr-tabindex>tabindex/a>/code> attribute on var>candidate/var> but that is earlier in the document in a idthe-tabindex-attribute:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> than var>candidate/var>,li>before any a href#focusable-area idthe-tabindex-attribute:focusable-area-13>focusable area/a> whose a href#dom-anchor idthe-tabindex-attribute:dom-anchor-8>DOM anchor/a> is an element whose code idthe-tabindex-attribute:attr-tabindex-12>a href#attr-tabindex>tabindex/a>/code> attribute has a value equal to the value of the code idthe-tabindex-attribute:attr-tabindex-13>a href#attr-tabindex>tabindex/a>/code> attribute on var>candidate/var> but that is later in the document in a idthe-tabindex-attribute:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> than var>candidate/var>, andli>before any a href#focusable-area idthe-tabindex-attribute:focusable-area-14>focusable area/a> whose a href#dom-anchor idthe-tabindex-attribute:dom-anchor-9>DOM anchor/a> is an element whose code idthe-tabindex-attribute:attr-tabindex-14>a href#attr-tabindex>tabindex/a>/code> attribute has a value greater than the value of the code idthe-tabindex-attribute:attr-tabindex-15>a href#attr-tabindex>tabindex/a>/code> attribute on var>candidate/var>./ul> /dl> p>An element with the code idthe-tabindex-attribute:attr-tabindex-16>a href#attr-tabindex>tabindex/a>/code> attribute specified is a href#interactive-content-2 idthe-tabindex-attribute:interactive-content-2>interactive content/a>./p> p>The dfn iddom-tabindex>code>tabIndex/code>/dfn> IDL attribute must a href#reflect idthe-tabindex-attribute:reflect>reflect/a> the value of the code idthe-tabindex-attribute:attr-tabindex-17>a href#attr-tabindex>tabindex/a>/code> content attribute. Its default value is 0 for elements that are focusable and −1 for elements that are not focusable./p> h4 idfocus-processing-model>span classsecno>6.4.4/span> span idprocessing-model-5>/span>Processing modela href#focus-processing-model classself-link>/a>/h4> p>The dfn idfocusing-steps data-export>focusing steps/dfn> for an object var>new focus target/var> that is either a a href#focusable-area idfocus-processing-model:focusable-area>focusable area/a>, or an element that is not a a href#focusable-area idfocus-processing-model:focusable-area-2>focusable area/a>, or a a href#browsing-context idfocus-processing-model:browsing-context>browsing context/a>, are as follows. They can optionally be run with a i>fallback target/i>./p> ol>li> p>If var>new focus target/var> is neither a code idfocus-processing-model:the-dialog-element>a href#the-dialog-element>dialog/a>/code> element that has an code idfocus-processing-model:attr-dialog-open>a href#attr-dialog-open>open/a>/code> attribute specified and that is a href#being-rendered idfocus-processing-model:being-rendered>being rendered/a> (i.e. that is a a href#control-group-owner-object idfocus-processing-model:control-group-owner-object>control group owner object/a>), nor a a href#focusable-area idfocus-processing-model:focusable-area-3>focusable area/a>, then run the first matching set of steps from the following list:/p> dl classswitch>dt>If var>new focus target/var> is an code idfocus-processing-model:the-area-element>a href#the-area-element>area/a>/code> element with one or more shapes that are a href#focusable-area idfocus-processing-model:focusable-area-4>focusable areas/a>dd> p>Let var>new focus target/var> be the shape corresponding to the first code idfocus-processing-model:the-img-element>a href#the-img-element>img/a>/code> element in a idfocus-processing-model:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> that uses the image map to which the code idfocus-processing-model:the-area-element-2>a href#the-area-element>area/a>/code> element belongs./p> dt>If var>new focus target/var> is an element with one or more scrollable regions that are a href#focusable-area idfocus-processing-model:focusable-area-5>focusable areas/a>dd> p>Let var>new focus target/var> be the elements first scrollable region, according to a pre-order, depth-first traversal of the box tree. a href#refsCSS>CSS/a>/p> dt>If var>new focus target/var> is the a idfocus-processing-model:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> of its code idfocus-processing-model:document>a href#document>Document/a>/code>dd> p>Let var>new focus target/var> be the code idfocus-processing-model:document-2>a href#document>Document/a>/code>s a idfocus-processing-model:viewport hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>./p> dt>If var>new focus target/var> is a a href#browsing-context idfocus-processing-model:browsing-context-2>browsing context/a>dd> p>Let var>new focus target/var> be the a href#browsing-context idfocus-processing-model:browsing-context-3>browsing context/a>s a href#active-document idfocus-processing-model:active-document>active document/a>./p> dt>If var>new focus target/var> is a a href#browsing-context-container idfocus-processing-model:browsing-context-container>browsing context container/a> with a non-null a href#nested-browsing-context idfocus-processing-model:nested-browsing-context>nested browsing context/a>dd> p>Let var>new focus target/var> be the a href#browsing-context-container idfocus-processing-model:browsing-context-container-2>browsing context container/a>s a href#nested-browsing-context idfocus-processing-model:nested-browsing-context-2>nested browsing context/a>s a href#active-document idfocus-processing-model:active-document-2>active document/a>./p> dt>Otherwisedd> p>If no i>fallback target/i> was specified, abort the a href#focusing-steps idfocus-processing-model:focusing-steps>focusing steps/a>./p> p>Otherwise, let var>new focus target/var> be the i>fallback target/i>./p> /dl> li> p>If var>new focus target/var> is a a href#control-group-owner-object idfocus-processing-model:control-group-owner-object-2>control group owner object/a> that is not a a href#focusable-area idfocus-processing-model:focusable-area-6>focusable area/a>, but does have a a href#dialog-group idfocus-processing-model:dialog-group>dialog group/a>, and that a href#dialog-group idfocus-processing-model:dialog-group-2>dialog group/a> has a designated a href#focused-dialog-of-the-dialog-group idfocus-processing-model:focused-dialog-of-the-dialog-group>focused dialog/a>, then let var>new focus target/var> be the a href#focused-dialog-of-the-dialog-group idfocus-processing-model:focused-dialog-of-the-dialog-group-2>focused dialog of the dialog group/a>, and redo this step./p> p>Otherwise, if var>new focus target/var> is a a href#control-group-owner-object idfocus-processing-model:control-group-owner-object-3>control group owner object/a> that is not a a href#focusable-area idfocus-processing-model:focusable-area-7>focusable area/a>, and its a href#control-group idfocus-processing-model:control-group>control group/a> is not empty, then designate var>new focus target/var> as the a href#focused-area-of-the-control-group idfocus-processing-model:focused-area-of-the-control-group>focused area of the control group/a>, and redo this step./p> p>Otherwise, if var>new focus target/var> is a a href#browsing-context-container idfocus-processing-model:browsing-context-container-3>browsing context container/a> with non-null a href#nested-browsing-context idfocus-processing-model:nested-browsing-context-3>nested browsing context/a>, then let var>new focus target/var> be the a href#nested-browsing-context idfocus-processing-model:nested-browsing-context-4>nested browsing context/a>s a href#active-document idfocus-processing-model:active-document-3>active document/a>, and redo this step./p> p classnote>A code idfocus-processing-model:the-dialog-element-2>a href#the-dialog-element>dialog/a>/code> element can be both a a href#control-group-owner-object idfocus-processing-model:control-group-owner-object-4>control group owner object/a> and a a href#focusable-area idfocus-processing-model:focusable-area-8>focusable area/a>, if it has both an code idfocus-processing-model:attr-dialog-open-2>a href#attr-dialog-open>open/a>/code> attribute specified and a code idfocus-processing-model:attr-tabindex>a href#attr-tabindex>tabindex/a>/code> attribute specified and is a href#being-rendered idfocus-processing-model:being-rendered-2>being rendered/a>./p> li>p>If var>new focus target/var> is a a href#focusable-area idfocus-processing-model:focusable-area-9>focusable area/a> and its a href#dom-anchor idfocus-processing-model:dom-anchor>DOM anchor/a> is a href#inert idfocus-processing-model: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 idfocus-processing-model:currently-focused-area-of-a-top-level-browsing-context>currently focused area of a top-level browsing context/a>, then abort these steps.li>p>Let var>old chain/var> be the a href#focus-chain idfocus-processing-model:focus-chain>focus chain/a> of the a href#currently-focused-area-of-a-top-level-browsing-context idfocus-processing-model:currently-focused-area-of-a-top-level-browsing-context-2>currently focused area of the top-level browsing context/a> in which var>new focus target/var> finds itself.li>p>Let var>new chain/var> be the a href#focus-chain idfocus-processing-model:focus-chain-2>focus chain/a> of var>new focus target/var>.li>p>Run the a href#focus-update-steps idfocus-processing-model:focus-update-steps>focus update steps/a> with var>old chain/var>, var>new chain/var>, and var>new focus target/var> respectively./ol> p>User agents must a href#immediately idfocus-processing-model:immediately>immediately/a> run the a href#focusing-steps idfocus-processing-model:focusing-steps-2>focusing steps/a> for a a href#focusable-area idfocus-processing-model:focusable-area-10>focusable area/a>, code idfocus-processing-model:the-dialog-element-3>a href#the-dialog-element>dialog/a>/code>, or a href#browsing-context idfocus-processing-model:browsing-context-4>browsing context/a> var>candidate/var> whenever the user attempts to move the focus to var>candidate/var>./p> p>The dfn idunfocusing-steps>unfocusing steps/dfn> for an object var>old focus target/var> that is either a a href#focusable-area idfocus-processing-model:focusable-area-11>focusable area/a> or an element that is not a a href#focusable-area idfocus-processing-model:focusable-area-12>focusable area/a> are as follows:/p> ol>li>p>If var>old focus target/var> is a href#inert idfocus-processing-model:inert-2>inert/a>, then abort these steps.li> p>If var>old focus target/var> is an code idfocus-processing-model:the-area-element-3>a href#the-area-element>area/a>/code> element and one of its shapes is the a href#currently-focused-area-of-a-top-level-browsing-context idfocus-processing-model:currently-focused-area-of-a-top-level-browsing-context-3>currently focused area of a top-level browsing context/a>, or, if var>old focus target/var> is an element with one or more scrollable regions, and one of them is the a href#currently-focused-area-of-a-top-level-browsing-context idfocus-processing-model:currently-focused-area-of-a-top-level-browsing-context-4>currently focused area of a top-level browsing context/a>, then let var>old focus target/var> be that a href#currently-focused-area-of-a-top-level-browsing-context idfocus-processing-model:currently-focused-area-of-a-top-level-browsing-context-5>currently focused area of a top-level browsing context/a>./p> li>p>Let var>old chain/var> be the a href#focus-chain idfocus-processing-model:focus-chain-3>focus chain/a> of the a href#currently-focused-area-of-a-top-level-browsing-context idfocus-processing-model:currently-focused-area-of-a-top-level-browsing-context-6>currently focused area of a top-level browsing context/a>.li>p>If var>old focus target/var> is not one of the entries in var>old chain/var>, then abort these steps.li> p>If var>old focus target/var> is a code idfocus-processing-model:the-dialog-element-4>a href#the-dialog-element>dialog/a>/code> in a a href#dialog-group idfocus-processing-model:dialog-group-3>dialog group/a>, and the a href#dialog-group-manager idfocus-processing-model:dialog-group-manager>dialog group manager/a> has a non-empty a href#control-group idfocus-processing-model:control-group-2>control group/a>, then let var>new focus target/var> be the designated a href#focused-area-of-the-control-group idfocus-processing-model:focused-area-of-the-control-group-2>focused area of that focus group/a>./p> p>Otherwise, if var>old focus target/var> is a a href#focusable-area idfocus-processing-model:focusable-area-13>focusable area/a>, then let var>new focus target/var> be the first a href#focusable-area idfocus-processing-model:focusable-area-14>focusable area/a> of its a href#control-group idfocus-processing-model:control-group-3>control group/a> (if the a href#control-group-owner-object idfocus-processing-model:control-group-owner-object-5>control group owner object/a> is a code idfocus-processing-model:document-3>a href#document>Document/a>/code>, this will always be a a idfocus-processing-model:viewport-2 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>)./p> p>Otherwise, let var>new focus target/var> be null./p> li>p>If var>new focus target/var> is not null, then run the a href#focusing-steps idfocus-processing-model:focusing-steps-3>focusing steps/a> for var>new focus target/var>./ol> p>When the a href#currently-focused-area-of-a-top-level-browsing-context idfocus-processing-model:currently-focused-area-of-a-top-level-browsing-context-7>currently focused area of a top-level browsing context/a> is somehow unfocused without another element being explicitly focused in its stead, the user agent must a href#immediately idfocus-processing-model:immediately-2>immediately/a> run the a href#unfocusing-steps idfocus-processing-model:unfocusing-steps>unfocusing steps/a> for that object./p> p classnote>The a href#unfocusing-steps idfocus-processing-model:unfocusing-steps-2>unfocusing steps/a> do not always result in the focus changing, even when applied to the a href#currently-focused-area-of-a-top-level-browsing-context idfocus-processing-model:currently-focused-area-of-a-top-level-browsing-context-8>currently focused area of a top-level browsing context/a>. For example, if the a href#currently-focused-area-of-a-top-level-browsing-context idfocus-processing-model:currently-focused-area-of-a-top-level-browsing-context-9>currently focused area of a top-level browsing context/a> is a a idfocus-processing-model:viewport-3 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>, then it will usually keep its focus regardless until another a href#focusable-area idfocus-processing-model:focusable-area-15>focusable area/a> is explicitly focused with the a href#focusing-steps idfocus-processing-model:focusing-steps-4>focusing steps/a>./p> hr> p>When a a href#focusable-area idfocus-processing-model:focusable-area-16>focusable area/a> is added to an empty a href#control-group idfocus-processing-model:control-group-4>control group/a>, it must be designated the a href#focused-area-of-the-control-group idfocus-processing-model:focused-area-of-the-control-group-3>focused area of the control group/a>./p> p>When a a href#dialog-group idfocus-processing-model:dialog-group-4>dialog group/a> is formed, if the a href#dialog-group-manager idfocus-processing-model:dialog-group-manager-2>dialog group manager/a> has an empty a href#control-group idfocus-processing-model:control-group-5>control group/a>, the first non-a href#inert idfocus-processing-model:inert-3>inert/a> code idfocus-processing-model:the-dialog-element-5>a href#the-dialog-element>dialog/a>/code> in the a href#dialog-group idfocus-processing-model:dialog-group-5>dialog group/a>, if any, or else the first code idfocus-processing-model:the-dialog-element-6>a href#the-dialog-element>dialog/a>/code> in the a href#dialog-group idfocus-processing-model:dialog-group-6>dialog group/a> regardless of a href#inert idfocus-processing-model:inert-4>inertness/a>, must be designated the a href#focused-dialog-of-the-dialog-group idfocus-processing-model:focused-dialog-of-the-dialog-group-3>focused dialog of the dialog group/a>./p> p>dfn idfocus-fixup-rule-one>Focus fixup rule one/dfn>: When the designated a href#focused-area-of-the-control-group idfocus-processing-model:focused-area-of-the-control-group-4>focused area of a control group/a> is removed from that a href#control-group idfocus-processing-model:control-group-6>control group/a> in some way (e.g. it stops being a a href#focusable-area idfocus-processing-model:focusable-area-17>focusable area/a>, it is removed from the DOM, it becomes a href#expressly-inert idfocus-processing-model:expressly-inert>expressly inert/a>, etc), and the a href#control-group idfocus-processing-model:control-group-7>control group/a> is still not empty: designate the first non-a href#inert idfocus-processing-model:inert-5>inert/a> a href#focusable-area idfocus-processing-model:focusable-area-18>focusable area/a> in that a href#control-group idfocus-processing-model:control-group-8>control group/a> to be the new a href#focused-area-of-the-control-group idfocus-processing-model:focused-area-of-the-control-group-5>focused area of the control group/a>, if any; if they are all a href#inert idfocus-processing-model:inert-6>inert/a>, then designate the first a href#focusable-area idfocus-processing-model:focusable-area-19>focusable area/a> in that a href#control-group idfocus-processing-model:control-group-9>control group/a> to be the new a href#focused-area-of-the-control-group idfocus-processing-model:focused-area-of-the-control-group-6>focused area of the control group/a> regardless of a href#inert idfocus-processing-model:inert-7>inertness/a>. If such a removal instead results in the a href#control-group idfocus-processing-model:control-group-10>control group/a> being empty, then there is simply no longer a a href#focused-area-of-the-control-group idfocus-processing-model:focused-area-of-the-control-group-7>focused area of the control group/a>./p> p classexample>For example, this might happen because an element is removed from its code idfocus-processing-model:document-4>a href#document>Document/a>/code>, or has a code idfocus-processing-model:the-hidden-attribute>a href#the-hidden-attribute>hidden/a>/code> attribute added. It might also happen to an code idfocus-processing-model:the-input-element>a href#the-input-element>input/a>/code> element when the element gets a href#concept-fe-disabled idfocus-processing-model:concept-fe-disabled>disabled/a>./p> p classexample>In a code idfocus-processing-model:document-5>a href#document>Document/a>/code> without code idfocus-processing-model:the-dialog-element-7>a href#the-dialog-element>dialog/a>/code> elements, whose a href#focused-area-of-the-control-group idfocus-processing-model:focused-area-of-the-control-group-8>focused area/a> is a code idfocus-processing-model:the-button-element>a href#the-button-element>button/a>/code> element, removing, disabling, or hiding that button would cause the pages new a href#focused-area-of-the-control-group idfocus-processing-model:focused-area-of-the-control-group-9>focused area/a> to be the a idfocus-processing-model:viewport-4 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> of the code idfocus-processing-model:document-6>a href#document>Document/a>/code>. This would, in turn, be reflected through the code idfocus-processing-model:dom-document-activeelement>a href#dom-document-activeelement>activeElement/a>/code> API as a href#the-body-element-2 idfocus-processing-model:the-body-element-2>the body element/a>./p> p>dfn idfocus-fixup-rule-two>Focus fixup rule two/dfn>: When a a href#dialog-group idfocus-processing-model:dialog-group-7>dialog group/a> has no designated a href#focused-dialog-of-the-dialog-group idfocus-processing-model:focused-dialog-of-the-dialog-group-4>focused dialog of the dialog group/a>, and its a href#dialog-group-manager idfocus-processing-model:dialog-group-manager-3>dialog group manager/a>s a href#control-group idfocus-processing-model:control-group-11>control group/a> changes from being non-empty to being empty, the first non-a href#inert idfocus-processing-model:inert-8>inert/a> code idfocus-processing-model:the-dialog-element-8>a href#the-dialog-element>dialog/a>/code> in the a href#dialog-group idfocus-processing-model:dialog-group-8>dialog group/a>, if any, or else the first code idfocus-processing-model:the-dialog-element-9>a href#the-dialog-element>dialog/a>/code> in the a href#dialog-group idfocus-processing-model:dialog-group-9>dialog group/a> regardless of a href#inert idfocus-processing-model:inert-9>inertness/a>, must be designated the a href#focused-dialog-of-the-dialog-group idfocus-processing-model:focused-dialog-of-the-dialog-group-5>focused dialog of the dialog group/a>./p> p>dfn idfocus-fixup-rule-three>Focus fixup rule three/dfn>: When the designated a href#focused-dialog-of-the-dialog-group idfocus-processing-model:focused-dialog-of-the-dialog-group-6>focused dialog of a dialog group/a> is removed from that a href#dialog-group idfocus-processing-model:dialog-group-10>dialog group/a> in some way (e.g. it stops a href#being-rendered idfocus-processing-model:being-rendered-3>being rendered/a>, it loses its code idfocus-processing-model:attr-dialog-open-3>a href#attr-dialog-open>open/a>/code> attribute, it becomes a href#expressly-inert idfocus-processing-model:expressly-inert-2>expressly inert/a>, etc), and there is still a a href#dialog-group idfocus-processing-model:dialog-group-11>dialog group/a> (because the code idfocus-processing-model:the-dialog-element-10>a href#the-dialog-element>dialog/a>/code> in question was not the last code idfocus-processing-model:the-dialog-element-11>a href#the-dialog-element>dialog/a>/code> in that a href#dialog-group idfocus-processing-model:dialog-group-12>dialog group/a>): if the a href#dialog-group idfocus-processing-model:dialog-group-13>dialog group/a>s a href#dialog-group-manager idfocus-processing-model:dialog-group-manager-4>manager/a>s a href#control-group idfocus-processing-model:control-group-12>control group/a> is non-empty, let there be no designated a href#focused-dialog-of-the-dialog-group idfocus-processing-model:focused-dialog-of-the-dialog-group-7>focused dialog of the dialog group/a> any more; otherwise (in the case that the a href#control-group idfocus-processing-model:control-group-13>control group/a> is empty), designate the first non-a href#inert idfocus-processing-model:inert-10>inert/a> code idfocus-processing-model:the-dialog-element-12>a href#the-dialog-element>dialog/a>/code> in the a href#dialog-group idfocus-processing-model:dialog-group-14>dialog group/a> to be the a href#focused-dialog-of-the-dialog-group idfocus-processing-model:focused-dialog-of-the-dialog-group-8>focused dialog of the dialog group/a>, or, if they are all a href#inert idfocus-processing-model:inert-11>inert/a>, designate the first code idfocus-processing-model:the-dialog-element-13>a href#the-dialog-element>dialog/a>/code> in the a href#dialog-group idfocus-processing-model:dialog-group-15>dialog group/a> to be the a href#focused-dialog-of-the-dialog-group idfocus-processing-model:focused-dialog-of-the-dialog-group-9>focused dialog of the dialog group/a> regardless of a href#inert idfocus-processing-model:inert-12>inertness/a>./p> p>When the a href#currently-focused-area-of-a-top-level-browsing-context idfocus-processing-model: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 idfocus-processing-model:focusable-area-20>focusable area/a> but stops being a a href#focusable-area idfocus-processing-model:focusable-area-21>focusable area/a>, or when it was a code idfocus-processing-model:the-dialog-element-14>a href#the-dialog-element>dialog/a>/code> in a a href#dialog-group idfocus-processing-model:dialog-group-16>dialog group/a> and stops being part of that a href#dialog-group idfocus-processing-model:dialog-group-17>dialog group/a>, or when it starts being a href#inert idfocus-processing-model:inert-13>inert/a>, the user agent must run the following steps:/p> ol>li>p>Let var>old focus target/var> be whatever the a href#currently-focused-area-of-a-top-level-browsing-context idfocus-processing-model:currently-focused-area-of-a-top-level-browsing-context-11>currently focused area of the top-level browsing context/a> was immediately before this algorithm became applicable (e.g. before the element was disabled, or the dialog was closed, or whatever caused this algorithm to run).li>p>Let var>old chain/var> be the a href#focus-chain idfocus-processing-model:focus-chain-4>focus chain/a> of the a href#currently-focused-area-of-a-top-level-browsing-context idfocus-processing-model:currently-focused-area-of-a-top-level-browsing-context-12>currently focused area of the top-level browsing context/a> at the same time.li>p>Make sure that the changes implied by the focus fixup rules a href#focus-fixup-rule-one idfocus-processing-model:focus-fixup-rule-one>one/a>, a href#focus-fixup-rule-two idfocus-processing-model:focus-fixup-rule-two>two/a>, and a href#focus-fixup-rule-three idfocus-processing-model: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 idfocus-processing-model:currently-focused-area-of-a-top-level-browsing-context-13>currently focused area of a top-level browsing context/a>.li>p>If var>old focus target/var> and var>new focus target/var> are the same, abort these steps.li>p>Let var>new chain/var> be the a href#focus-chain idfocus-processing-model:focus-chain-5>focus chain/a> of var>new focus target/var>.li>p>Run the a href#focus-update-steps idfocus-processing-model:focus-update-steps-2>focus update steps/a> with var>old chain/var>, var>new chain/var>, and var>new focus target/var> respectively./ol> hr> p>The dfn idfocus-update-steps>focus update steps/dfn>, given an var>old chain/var>, a var>new chain/var>, and a var>new focus target/var> respectively, are as follows:/p> ol>li>p>If the last entry in var>old chain/var> and the last entry in var>new chain/var> are the same, pop the last entry from var>old chain/var> and the last entry from var>new chain/var> and redo this step.li> p>For each entry var>entry/var> in var>old chain/var>, in order, run these substeps:/p> ol>li idunfocus-causes-change-event>p>If var>entry/var> is an code idfocus-processing-model:the-input-element-2>a href#the-input-element>input/a>/code> element, and the code idfocus-processing-model:event-change>a href#event-change>change/a>/code> event a href#concept-input-apply idfocus-processing-model:concept-input-apply>applies/a> to the element, and the element does not have a defined a idfocus-processing-model:activation-behaviour hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a>, and the user has changed the elements a href#concept-fe-value idfocus-processing-model:concept-fe-value>value/a> or its list of a href#concept-input-type-file-selected idfocus-processing-model:concept-input-type-file-selected>selected files/a> while the control was focused without committing that change (such that it is different to what it was when the control was first focused), then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idfocus-processing-model:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idfocus-processing-model:event-change-2>a href#event-change>change/a>/code> at the element, with the code idfocus-processing-model:dom-event-bubbles>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true./p> li> p>If var>entry/var> is an element, let var>blur event target/var> be var>entry/var>./p> p>If var>entry/var> is a code idfocus-processing-model:document-7>a href#document>Document/a>/code> object, let var>blur event target/var> be that code idfocus-processing-model:document-8>a href#document>Document/a>/code> objects code idfocus-processing-model:window>a href#window>Window/a>/code> object./p> p>Otherwise, let var>blur event target/var> be null./p> li>p>If var>entry/var> is the last entry in var>old chain/var>, and var>entry/var> is an code idfocus-processing-model:element>a data-x-internalelement hrefhttps://dom.spec.whatwg.org/#interface-element>Element/a>/code>, and the last entry in var>new chain/var> is also an code idfocus-processing-model:element-2>a data-x-internalelement hrefhttps://dom.spec.whatwg.org/#interface-element>Element/a>/code>, then let var>related blur target/var> be the last entry in var>new chain/var>. Otherwise, let var>related blur target/var> be null.li> p>If var>blur event target/var> is not null, a href#fire-a-focus-event idfocus-processing-model:fire-a-focus-event>fire a focus event/a> named code idfocus-processing-model:event-blur>a href#event-blur>blur/a>/code> at var>blur event target/var>, with var>related blur target/var> as the related target./p> p classnote>In some cases, e.g. if var>entry/var> is an code idfocus-processing-model:the-area-element-4>a href#the-area-element>area/a>/code> elements shape, a scrollable region, or a a idfocus-processing-model:viewport-5 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>, no event is fired./p> /ol> li>p>Apply any relevant platform-specific conventions for focusing var>new focus target/var>. (For example, some platforms select the contents of a text control when that control is focused.)li> p>For each entry var>entry/var> in var>new chain/var>, in reverse order, run these substeps:/p> ol>li>p>If var>entry/var> is a code idfocus-processing-model:the-dialog-element-15>a href#the-dialog-element>dialog/a>/code> element: let var>entry/var> be the designated a href#focused-dialog-of-the-dialog-group idfocus-processing-model:focused-dialog-of-the-dialog-group-10>focused dialog of its dialog group/a>.li> p>If var>entry/var> is a a href#focusable-area idfocus-processing-model:focusable-area-22>focusable area/a>: designate var>entry/var> as the a href#focused-area-of-the-control-group idfocus-processing-model:focused-area-of-the-control-group-10>focused area of the control group/a>. If its a href#control-group idfocus-processing-model:control-group-14>control group/a>s a href#control-group-owner-object idfocus-processing-model:control-group-owner-object-6>owner object/a> is also a a href#dialog-group-manager idfocus-processing-model:dialog-group-manager-5>dialog group manager/a>, then let there be no designated a href#focused-dialog-of-the-dialog-group idfocus-processing-model:focused-dialog-of-the-dialog-group-11>focused dialog/a> in that a href#dialog-group idfocus-processing-model:dialog-group-18>dialog group/a>./p> p classnote>It is possible for var>entry/var> to be both a code idfocus-processing-model:the-dialog-element-16>a href#the-dialog-element>dialog/a>/code> element and a a href#focusable-area idfocus-processing-model:focusable-area-23>focusable area/a>, in which case it is its own a href#control-group-owner-object idfocus-processing-model:control-group-owner-object-7>control group owner object/a>./p> li> p>If var>entry/var> is an element, let var>focus event target/var> be var>entry/var>./p> p>If var>entry/var> is a code idfocus-processing-model:document-9>a href#document>Document/a>/code> object, let var>focus event target/var> be that code idfocus-processing-model:document-10>a href#document>Document/a>/code> objects code idfocus-processing-model:window-2>a href#window>Window/a>/code> object./p> p>Otherwise, let var>focus event target/var> be null./p> li>p>If var>entry/var> is the last entry in var>new chain/var>, and var>entry/var> is an code idfocus-processing-model:element-3>a data-x-internalelement hrefhttps://dom.spec.whatwg.org/#interface-element>Element/a>/code>, and the last entry in var>old chain/var> is also an code idfocus-processing-model:element-4>a data-x-internalelement hrefhttps://dom.spec.whatwg.org/#interface-element>Element/a>/code>, then let var>related focus target/var> be the last entry in var>old chain/var>. Otherwise, let var>related focus target/var> be null.li> p>If var>focus event target/var> is not null, a href#fire-a-focus-event idfocus-processing-model:fire-a-focus-event-2>fire a focus event/a> named code idfocus-processing-model:event-focus>a href#event-focus>focus/a>/code> at var>focus event target/var>, with var>related focus target/var> as the related target./p> p classnote>In some cases, e.g. if var>entry/var> is an code idfocus-processing-model:the-area-element-5>a href#the-area-element>area/a>/code> elements shape, a scrollable region, or a a idfocus-processing-model:viewport-6 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>, no event is fired./p> /ol> /ol> p>To dfn idfire-a-focus-event>fire a focus event/dfn> named var>e/var> at an element var>t/var> and with a given related target var>r/var>, a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idfocus-processing-model:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named var>e/var> at var>t/var>, using code idfocus-processing-model:focusevent>a data-x-internalfocusevent hrefhttps://w3c.github.io/uievents/#focusevent>FocusEvent/a>/code>, with the code idfocus-processing-model:dom-focusevent-relatedtarget>a data-x-internaldom-focusevent-relatedtarget hrefhttps://w3c.github.io/uievents/#dom-focusevent-relatedtarget>relatedTarget/a>/code> attribute initialized to var>r/var> and the code idfocus-processing-model:dom-uievent-view>a data-x-internaldom-uievent-view hrefhttps://w3c.github.io/uievents/#dom-uievent-view>view/a>/code> attribute initialized to var>t/var>s a idfocus-processing-model:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s code idfocus-processing-model:window-3>a href#window>Window/a>/code> object./p> hr> p>When a key event is to be routed in a a href#top-level-browsing-context idfocus-processing-model:top-level-browsing-context>top-level browsing context/a>, the user agent must run the following steps:/p> ol>li>p>Let var>target area/var> be the a href#currently-focused-area-of-a-top-level-browsing-context idfocus-processing-model:currently-focused-area-of-a-top-level-browsing-context-14>currently focused area of the top-level browsing context/a>.li>p>If var>target area/var> is a a href#focusable-area idfocus-processing-model:focusable-area-24>focusable area/a>, let var>target node/var> be var>target area/var>s a href#dom-anchor idfocus-processing-model:dom-anchor-2>DOM anchor/a>. Otherwise, var>target area/var> is a code idfocus-processing-model:the-dialog-element-17>a href#the-dialog-element>dialog/a>/code>; let var>target node/var> be var>target area/var>.li> p>If var>target node/var> is a code idfocus-processing-model:document-11>a href#document>Document/a>/code> that has a a href#the-body-element-2 idfocus-processing-model:the-body-element-2-2>body element/a>, then let var>target node/var> be a href#the-body-element-2 idfocus-processing-model:the-body-element-2-3>the body element/a> of that code idfocus-processing-model:document-12>a href#document>Document/a>/code>./p> p>Otherwise, if var>target node/var> is a code idfocus-processing-model:document-13>a href#document>Document/a>/code> object that has a non-null a idfocus-processing-model:document-element-2 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>, then let var>target node/var> be that a idfocus-processing-model:document-element-3 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>./p> li> p>If var>target node/var> is not a href#inert idfocus-processing-model:inert-14>inert/a>, then:/p> p classnote>It is possible for the a href#currently-focused-area-of-a-top-level-browsing-context idfocus-processing-model:currently-focused-area-of-a-top-level-browsing-context-15>currently focused area of a top-level browsing context/a> to be a href#inert idfocus-processing-model:inert-15>inert/a>, for example if a a href#dom-dialog-showmodal idfocus-processing-model:dom-dialog-showmodal>modal dialog is shown/a>, and then that code idfocus-processing-model:the-dialog-element-18>a href#the-dialog-element>dialog/a>/code> element is made a href#inert idfocus-processing-model:inert-16>inert/a>. It is likely to be the result of a logic error in the application, though./p> ol>li>p>Let var>canHandle/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-dispatch idfocus-processing-model:concept-event-dispatch data-x-internalconcept-event-dispatch>dispatching/a> the key event at var>target node/var>.li>p>If var>canHandle/var> is true, then let var>target area/var> handle the key event. This might include a href#fire-a-click-event idfocus-processing-model:fire-a-click-event>firing a code>click/code> event/a> at var>target node/var>./ol> /ol> hr> p>The dfn idhas-focus-steps data-export>has focus steps/dfn>, given a code idfocus-processing-model:document-14>a href#document>Document/a>/code> object var>target/var>, are as follows:/p> ol>li>p>Let var>candidate/var> be the code idfocus-processing-model:document-15>a href#document>Document/a>/code> of the a href#top-level-browsing-context idfocus-processing-model:top-level-browsing-context-2>top-level browsing context/a>.li>p>If var>candidate/var> is var>target/var>, return true and abort these steps.li> p>If var>candidate/var> has a a href#dialog-group idfocus-processing-model:dialog-group-19>dialog group/a> with a designated a href#focused-dialog-of-the-dialog-group idfocus-processing-model:focused-dialog-of-the-dialog-group-12>focused dialog of the dialog group/a>, then let var>candidate/var> be the designated a href#focused-dialog-of-the-dialog-group idfocus-processing-model:focused-dialog-of-the-dialog-group-13>focused dialog of the dialog group/a>, and redo this step./p> p>Otherwise, if var>candidate/var> has a non-empty a href#control-group idfocus-processing-model:control-group-15>control group/a>, and the designated a href#focused-area-of-the-control-group idfocus-processing-model:focused-area-of-the-control-group-11>focused area of the control group/a> is a a href#browsing-context-container idfocus-processing-model:browsing-context-container-4>browsing context container/a> with a non-null a href#nested-browsing-context idfocus-processing-model:nested-browsing-context-5>nested browsing context/a>, and the a href#active-document idfocus-processing-model:active-document-4>active document/a> of that a href#browsing-context-container idfocus-processing-model:browsing-context-container-5>browsing context container/a>s a href#nested-browsing-context idfocus-processing-model:nested-browsing-context-6>nested browsing context/a> is var>target/var>, then return true and abort these steps./p> p>Otherwise, if var>candidate/var> has a non-empty a href#control-group idfocus-processing-model:control-group-16>control group/a>, and the designated a href#focused-area-of-the-control-group idfocus-processing-model:focused-area-of-the-control-group-12>focused area of the control group/a> is a a href#browsing-context-container idfocus-processing-model:browsing-context-container-6>browsing context container/a> with a non-null a href#nested-browsing-context idfocus-processing-model:nested-browsing-context-7>nested browsing context/a>, then let var>candidate/var> be the a href#active-document idfocus-processing-model:active-document-5>active document/a> of that a href#browsing-context-container idfocus-processing-model:browsing-context-container-7>browsing context container/a>s a href#nested-browsing-context idfocus-processing-model:nested-browsing-context-8>nested browsing context/a>, and redo this step./p> p>Otherwise, return false and abort these steps./p> /ol> h4 idsequential-focus-navigation>span classsecno>6.4.5/span> dfn>Sequential focus navigation/dfn>a href#sequential-focus-navigation classself-link>/a>/h4> p>Each a href#control-group idsequential-focus-navigation:control-group>control group/a> has a dfn idsequential-focus-navigation-order>sequential focus navigation order/dfn>, which orders some or all of the a href#focusable-area idsequential-focus-navigation:focusable-area>focusable areas/a> in the a href#control-group idsequential-focus-navigation:control-group-2>control group/a> relative to each other. The order in the a href#sequential-focus-navigation-order idsequential-focus-navigation:sequential-focus-navigation-order>sequential focus navigation order/a> does not have to be related to the order in the a href#control-group idsequential-focus-navigation:control-group-3>control group/a> itself. If a a href#focusable-area idsequential-focus-navigation:focusable-area-2>focusable area/a> is omitted from the a href#sequential-focus-navigation-order idsequential-focus-navigation:sequential-focus-navigation-order-2>sequential focus navigation order/a> of its a href#control-group idsequential-focus-navigation:control-group-4>control group/a>, then it is unreachable via a href#sequential-focus-navigation idsequential-focus-navigation:sequential-focus-navigation>sequential focus navigation/a>./p> p>There can also be a dfn idsequential-focus-navigation-starting-point>sequential focus navigation starting point/dfn>. It is initially unset. The user agent may set it when the user indicates that it should be moved./p> p classexample>For example, the user agent could set it to the position of the users click if the user clicks on the document contents./p> p>When the user requests that focus move from the a href#currently-focused-area-of-a-top-level-browsing-context idsequential-focus-navigation:currently-focused-area-of-a-top-level-browsing-context>currently focused area of a top-level browsing context/a> to the next or previous a href#focusable-area idsequential-focus-navigation:focusable-area-3>focusable area/a> (e.g. as the default action of pressing the kbd>kbd>tab/kbd>/kbd> key), or when the user requests that focus sequentially move to a a href#top-level-browsing-context idsequential-focus-navigation:top-level-browsing-context>top-level browsing context/a> in the first place (e.g. from the browsers location bar), the user agent must use the following algorithm:/p> ol>li>p>Let var>starting point/var> be the a href#currently-focused-area-of-a-top-level-browsing-context idsequential-focus-navigation:currently-focused-area-of-a-top-level-browsing-context-2>currently focused area of a top-level browsing context/a>, if the user requested to move focus sequentially from there, or else the a href#top-level-browsing-context idsequential-focus-navigation:top-level-browsing-context-2>top-level browsing context/a> itself, if the user instead requested to move focus from outside the a href#top-level-browsing-context idsequential-focus-navigation:top-level-browsing-context-3>top-level browsing context/a>.li>p>If there is a a href#sequential-focus-navigation-starting-point idsequential-focus-navigation:sequential-focus-navigation-starting-point>sequential focus navigation starting point/a> defined and it is inside var>starting point/var>, then let var>starting point/var> be the a href#sequential-focus-navigation-starting-point idsequential-focus-navigation:sequential-focus-navigation-starting-point-2>sequential focus navigation starting point/a> instead.li> p>Let var>direction/var> be i>forward/i> if the user requested the em>next/em> control, and i>backward/i> if the user requested the previous control./p> p classnote>Typically, pressing kbd>kbd>tab/kbd>/kbd> requests the next control, and pressing kbd>kbd>shift/kbd>+kbd>tab/kbd>/kbd> requests the previous control./p> li> p>i>Loop/i>: Let var>selection mechanism/var> be i>sequential/i> if the var>starting point/var> is a a href#browsing-context idsequential-focus-navigation:browsing-context>browsing context/a> or if var>starting point/var> is in its a href#control-group idsequential-focus-navigation:control-group-5>control group/a>s a href#sequential-focus-navigation-order idsequential-focus-navigation:sequential-focus-navigation-order-3>sequential focus navigation order/a>./p> p>Otherwise, var>starting point/var> is not in its a href#control-group idsequential-focus-navigation:control-group-6>control group/a>s a href#sequential-focus-navigation-order idsequential-focus-navigation:sequential-focus-navigation-order-4>sequential focus navigation order/a>; let var>selection mechanism/var> be i>DOM/i>./p> li>p>Let var>candidate/var> be the result of running the a href#sequential-navigation-search-algorithm idsequential-focus-navigation:sequential-navigation-search-algorithm>sequential navigation search algorithm/a> with var>starting point/var>, var>direction/var>, and var>selection mechanism/var> as the arguments.li>p>If var>candidate/var> is not null, then run the a href#focusing-steps idsequential-focus-navigation:focusing-steps>focusing steps/a> for var>candidate/var> and abort these steps.li>p>Otherwise, unset the a href#sequential-focus-navigation-starting-point idsequential-focus-navigation:sequential-focus-navigation-starting-point-3>sequential focus navigation starting point/a>.li> p>If var>starting point/var> is the a href#top-level-browsing-context idsequential-focus-navigation:top-level-browsing-context-4>top-level browsing context/a>, or a a href#focusable-area idsequential-focus-navigation:focusable-area-4>focusable area/a> in the a href#top-level-browsing-context idsequential-focus-navigation:top-level-browsing-context-5>top-level browsing context/a>, the user agent should transfer focus to its own controls appropriately (if any), honouring var>direction/var>, and then abort these steps./p> p classexample>For example, if var>direction/var> is i>backward/i>, then the last focusable control before the browsers rendering area would be the control to focus./p> p>If the user agent has no focusable controls — a kiosk-mode browser, for instance — then the user agent may instead restart these steps with the var>starting point/var> being the a href#top-level-browsing-context idsequential-focus-navigation:top-level-browsing-context-6>top-level browsing context/a> itself./p> li>p>Otherwise, var>starting point/var> is a a href#focusable-area idsequential-focus-navigation:focusable-area-5>focusable area/a> in a a href#nested-browsing-context idsequential-focus-navigation:nested-browsing-context>nested browsing context/a>. Let var>starting point/var> be that a href#nested-browsing-context idsequential-focus-navigation:nested-browsing-context-2>nested browsing context/a>s a href#browsing-context-container idsequential-focus-navigation:browsing-context-container>browsing context container/a>, and return to the step labeled i>loop/i>./p> /ol> p>The dfn idsequential-navigation-search-algorithm>sequential navigation search algorithm/dfn> consists of the following steps. This algorithm takes three arguments: var>starting point/var>, var>direction/var>, and var>selection mechanism/var>./p> ol>li> p>Pick the appropriate cell from the following table, and follow the instructions in that cell./p> p>The appropriate cell is the one that is from the column whose header describes var>direction/var> and from the first row whose header describes var>starting point/var> and var>selection mechanism/var>./p> table>thead>tr>th> th> var>direction/var> is i>forward/i> th> var>direction/var> is i>backward/i> tbody>tr>th>var>starting point/var> is a a href#browsing-context idsequential-focus-navigation:browsing-context-2>browsing context/a> td>Let var>candidate/var> be the first a href#suitable-sequentially-focusable-area idsequential-focus-navigation:suitable-sequentially-focusable-area>suitable sequentially focusable area/a> in var>starting point/var>s a href#active-document idsequential-focus-navigation:active-document>active document/a>s a href#primary-control-group idsequential-focus-navigation:primary-control-group>primary control group/a>, if any; or else null td>Let var>candidate/var> be the last a href#suitable-sequentially-focusable-area idsequential-focus-navigation:suitable-sequentially-focusable-area-2>suitable sequentially focusable area/a> in var>starting point/var>s a href#active-document idsequential-focus-navigation:active-document-2>active document/a>s a href#primary-control-group idsequential-focus-navigation:primary-control-group-2>primary control group/a>, if any; or else null tr>th>var>selection mechanism/var> is i>DOM/i> td>Let var>candidate/var> be the first a href#suitable-sequentially-focusable-area idsequential-focus-navigation:suitable-sequentially-focusable-area-3>suitable sequentially focusable area/a> in the a href#home-control-group idsequential-focus-navigation:home-control-group>home control group/a> following var>starting point/var>, if any; or else null td>Let var>candidate/var> be the last a href#suitable-sequentially-focusable-area idsequential-focus-navigation:suitable-sequentially-focusable-area-4>suitable sequentially focusable area/a> in the a href#home-control-group idsequential-focus-navigation:home-control-group-2>home control group/a> preceding var>starting point/var>, if any; or else null tr>th>var>selection mechanism/var> is i>sequential/i> td>Let var>candidate/var> be the first a href#suitable-sequentially-focusable-area idsequential-focus-navigation:suitable-sequentially-focusable-area-5>suitable sequentially focusable area/a> in the a href#home-sequential-focus-navigation-order idsequential-focus-navigation:home-sequential-focus-navigation-order>home sequential focus navigation order/a> following var>starting point/var>, if any; or else null td>Let var>candidate/var> be the last a href#suitable-sequentially-focusable-area idsequential-focus-navigation:suitable-sequentially-focusable-area-6>suitable sequentially focusable area/a> in the a href#home-sequential-focus-navigation-order idsequential-focus-navigation:home-sequential-focus-navigation-order-2>home sequential focus navigation order/a> preceding var>starting point/var>, if any; or else null /table> p>A dfn idsuitable-sequentially-focusable-area>suitable sequentially focusable area/dfn> is a a href#focusable-area idsequential-focus-navigation:focusable-area-6>focusable area/a> whose a href#dom-anchor idsequential-focus-navigation:dom-anchor>DOM anchor/a> is not a href#inert idsequential-focus-navigation:inert>inert/a> and that is in its a href#control-group idsequential-focus-navigation:control-group-7>control group/a>s a href#sequential-focus-navigation-order idsequential-focus-navigation:sequential-focus-navigation-order-5>sequential focus navigation order/a>./p> p>The dfn idprimary-control-group>primary control group/dfn> of a a href#control-group-owner-object idsequential-focus-navigation:control-group-owner-object>control group owner object/a> var>X/var> is the a href#control-group idsequential-focus-navigation:control-group-8>control group/a> of var>X/var> if var>X/var> has no a href#dialog-group idsequential-focus-navigation:dialog-group>dialog group/a> or if its a href#dialog-group idsequential-focus-navigation:dialog-group-2>dialog group/a> has no designated a href#focused-dialog-of-the-dialog-group idsequential-focus-navigation:focused-dialog-of-the-dialog-group>focused dialog of the dialog group/a>, otherwise, it is the a href#primary-control-group idsequential-focus-navigation:primary-control-group-3>primary control group/a> of var>X/var>s a href#dialog-group idsequential-focus-navigation:dialog-group-3>dialog group/a>s designated a href#focused-dialog-of-the-dialog-group idsequential-focus-navigation:focused-dialog-of-the-dialog-group-2>focused dialog of the dialog group/a>./p> p>The dfn idhome-control-group>home control group/dfn> is the a href#control-group idsequential-focus-navigation:control-group-9>control group/a> to which var>starting point/var> belongs./p> p>The dfn idhome-sequential-focus-navigation-order>home sequential focus navigation order/dfn> is the a href#sequential-focus-navigation-order idsequential-focus-navigation:sequential-focus-navigation-order-6>sequential focus navigation order/a> to which var>starting point/var> belongs./p> p classnote>The a href#home-sequential-focus-navigation-order idsequential-focus-navigation:home-sequential-focus-navigation-order-3>home sequential focus navigation order/a> is the a href#home-control-group idsequential-focus-navigation:home-control-group-3>home control group/a>s a href#sequential-focus-navigation-order idsequential-focus-navigation:sequential-focus-navigation-order-7>sequential focus navigation order/a>, but is only used when the var>starting point/var> is in that a href#sequential-focus-navigation-order idsequential-focus-navigation:sequential-focus-navigation-order-8>sequential focus navigation order/a> (when its not, var>selection mechanism/var> will be i>DOM/i>)./p> li> p>If var>candidate/var> is a a href#browsing-context-container idsequential-focus-navigation:browsing-context-container-2>browsing context container/a> with a non-null a href#nested-browsing-context idsequential-focus-navigation:nested-browsing-context-3>nested browsing context/a>, then let var>new candidate/var> be the result of running the a href#sequential-navigation-search-algorithm idsequential-focus-navigation:sequential-navigation-search-algorithm-2>sequential navigation search algorithm/a> with var>candidate/var>s a href#nested-browsing-context idsequential-focus-navigation:nested-browsing-context-4>nested browsing context/a> as the first argument, var>direction/var> as the second, and i>sequential/i> as the third./p> p>If var>new candidate/var> is null, then let var>starting point/var> be var>candidate/var>, and return to the top of this algorithm. Otherwise, let var>candidate/var> be var>new candidate/var>./p> li>p>Return var>candidate/var>./ol> h4 idfocus-management-apis>span classsecno>6.4.6/span> Focus management APIsa href#focus-management-apis classself-link>/a>/h4> pre classidl>dictionary dfn idfocusoptions>FocusOptions/dfn> { boolean a href#dom-focusoptions-preventscroll idfocus-management-apis:dom-focusoptions-preventscroll>preventScroll/a> false;};/pre> dl classdomintro>dt>var>document/var> . code idfocus-management-apis:dom-document-activeelement>a href#dom-document-activeelement>activeElement/a>/code>dd> p>Returns the deepest element in the document through which or to which key events are being routed. This is, roughly speaking, the focused element in the document./p> p>For the purposes of this API, when a a href#child-browsing-context idfocus-management-apis:child-browsing-context>child browsing context/a> is focused, its a href#browsing-context-container idfocus-management-apis:browsing-context-container>browsing context container/a> is a href#bc-focus-ergo-bcc-focus>focused/a> in the a href#parent-browsing-context idfocus-management-apis:parent-browsing-context>parent browsing context/a>. For example, if the user moves the focus to a text control in an code idfocus-management-apis:the-iframe-element>a href#the-iframe-element>iframe/a>/code>, the code idfocus-management-apis:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code> is the element returned by the code idfocus-management-apis:dom-document-activeelement-2>a href#dom-document-activeelement>activeElement/a>/code> API in the code idfocus-management-apis:the-iframe-element-3>a href#the-iframe-element>iframe/a>/code>s a idfocus-management-apis:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>./p> dt>var>document/var> . code idfocus-management-apis:dom-document-hasfocus>a href#dom-document-hasfocus>hasFocus/a>/code>()dd> p>Returns true if key events are being routed through or to the document; otherwise, returns false. Roughly speaking, this corresponds to the document, or a document nested inside this one, being focused./p> dt>var>window/var> . code idfocus-management-apis:dom-window-focus>a href#dom-window-focus>focus/a>/code>()dd> p>Moves the focus to the windows a href#browsing-context idfocus-management-apis:browsing-context>browsing context/a>, if any./p> dt>var>element/var> . code idfocus-management-apis:dom-focus>a href#dom-focus>focus/a>/code>( { code idfocus-management-apis:dom-focusoptions-preventscroll-2>a href#dom-focusoptions-preventscroll>preventScroll/a>/code>: true } )dd> p>Moves the focus to the element./p> p>If the element is a a href#browsing-context-container idfocus-management-apis:browsing-context-container-2>browsing context container/a>, moves the focus to the a href#nested-browsing-context idfocus-management-apis:nested-browsing-context>nested browsing context/a> instead./p> p>By default, this method also scrolls the element into view. Providing the code idfocus-management-apis:dom-focusoptions-preventscroll-3>a href#dom-focusoptions-preventscroll>preventScroll/a>/code> option and setting it to true prevents this behavior./p> dt>var>element/var> . code idfocus-management-apis:dom-blur>a href#dom-blur>blur/a>/code>()dd> p>Moves the focus to the a idfocus-management-apis:viewport hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>. Use of this method is discouraged; if you want to focus the a idfocus-management-apis:viewport-2 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>, call the code idfocus-management-apis:dom-focus-2>a href#dom-focus>focus()/a>/code> method on the code idfocus-management-apis:document>a href#document>Document/a>/code>s a idfocus-management-apis:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>./p> p>Do not use this method to hide the focus ring if you find the focus ring unsightly. Instead, use a CSS rule to override the a idfocus-management-apis:outline hrefhttps://drafts.csswg.org/css-ui/#outline data-x-internaloutline>outline/a> property, and provide a different way to show what element is focused. Be aware that if an alternative focusing style isnt made available, the page will be significantly less usable for people who primarily navigate pages using a keyboard, or those with reduced vision who use focus outlines to help them navigate the page./p> div classexample> p>For example, to hide the outline from links and instead use a yellow background to indicate focus, you could use:/p> pre>:link:focus, :visited:focus { outline: none; background: yellow; color: black; }/pre> /div> /dl> p>The dfn iddom-document-activeelement>code>activeElement/code>/dfn> attribute on code idfocus-management-apis:document-2>a href#document>Document/a>/code> objects must return the value returned by the following steps:/p> ol>li>p>Let var>candidate/var> be the code idfocus-management-apis:document-3>a href#document>Document/a>/code> on which the method was invoked.li>p>If var>candidate/var> has a a href#dialog-group idfocus-management-apis:dialog-group>dialog group/a> with a designated a href#focused-dialog-of-the-dialog-group idfocus-management-apis:focused-dialog-of-the-dialog-group>focused dialog of the dialog group/a>, then let var>candidate/var> be the designated a href#focused-dialog-of-the-dialog-group idfocus-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 idfocus-management-apis:control-group>control group/a>, let var>candidate/var> be the designated a href#focused-area-of-the-control-group idfocus-management-apis:focused-area-of-the-control-group>focused area of the control group/a>./p> li>p>If var>candidate/var> is a a href#focusable-area idfocus-management-apis:focusable-area>focusable area/a>, let var>candidate/var> be var>candidate/var>s a href#dom-anchor idfocus-management-apis:dom-anchor>DOM anchor/a>.li> p>If var>candidate/var> is a code idfocus-management-apis:document-4>a href#document>Document/a>/code> that has a a href#the-body-element-2 idfocus-management-apis:the-body-element-2>body element/a>, then let var>candidate/var> be a href#the-body-element-2 idfocus-management-apis:the-body-element-2-2>the body element/a> of that code idfocus-management-apis:document-5>a href#document>Document/a>/code>./p> p>Otherwise, if var>candidate/var> is a code idfocus-management-apis:document-6>a href#document>Document/a>/code> with a non-null a idfocus-management-apis:document-element-2 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>, then let var>candidate/var> be that a idfocus-management-apis:document-element-3 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>./p> p>Otherwise, if var>candidate/var> is a code idfocus-management-apis:document-7>a href#document>Document/a>/code>, then let var>candidate/var> be null./p> li>p>Return var>candidate/var>./ol> p>The dfn iddom-document-hasfocus>code>hasFocus()/code>/dfn> method on the code idfocus-management-apis:document-8>a href#document>Document/a>/code> object, when invoked, must return the result of running the a href#has-focus-steps idfocus-management-apis:has-focus-steps>has focus steps/a> with the code idfocus-management-apis:document-9>a href#document>Document/a>/code> object as the argument./p> p>The dfn data-dfn-forWindow iddom-window-focus>code>focus()/code>/dfn> method on the code idfocus-management-apis:window>a href#window>Window/a>/code> object, when invoked, must run the a href#focusing-steps idfocus-management-apis:focusing-steps>focusing steps/a> with the code idfocus-management-apis:window-2>a href#window>Window/a>/code> objects a href#browsing-context idfocus-management-apis:browsing-context-2>browsing context/a>. Additionally, if this a href#browsing-context idfocus-management-apis:browsing-context-3>browsing context/a> is a a href#top-level-browsing-context idfocus-management-apis:top-level-browsing-context>top-level browsing context/a>, user agents are encouraged to trigger some sort of notification to indicate to the user that the page is attempting to gain focus./p> p>The dfn data-dfn-forWindow iddom-window-blur>code>blur()/code>/dfn> method on the code idfocus-management-apis:window-3>a href#window>Window/a>/code> object, when invoked, provides a hint to the user agent that the script believes the user probably is not currently interested in the contents of the a href#browsing-context idfocus-management-apis:browsing-context-4>browsing context/a> of the code idfocus-management-apis:window-4>a href#window>Window/a>/code> object on which the method was invoked, but that the contents might become interesting again in the future./p> p>User agents are encouraged to ignore calls to this code idfocus-management-apis:dom-window-blur>a href#dom-window-blur>blur()/a>/code> method entirely./p> p classnote>Historically, the code idfocus-management-apis:dom-window-blur-2>a href#dom-window-blur>focus()/a>/code> and code idfocus-management-apis:dom-window-blur-3>a href#dom-window-blur>blur()/a>/code> methods actually affected the system-level focus of the system widget (e.g. tab or window) that contained the a href#browsing-context idfocus-management-apis:browsing-context-5>browsing context/a>, but hostile sites widely abuse this behavior to the users detriment./p> p>The dfn iddom-focus>code>focus(var>options/var>)/code>/dfn> method on elements, when invoked, must run the following steps:/p> ol>li>p>If the element is marked as i idfocus-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 idlocked-for-focus>locked for focus/dfn>.li>p>Run the a href#focusing-steps idfocus-management-apis:focusing-steps-2>focusing steps/a> for the element.li>p>If the value of the dfn iddom-focusoptions-preventscroll>code>preventScroll/code>/dfn> dictionary member of var>options/var> is false, then a hrefhttps://drafts.csswg.org/cssom-view/#scroll-an-element-into-view idfocus-management-apis:scroll-an-element-into-view data-x-internalscroll-an-element-into-view>scroll the element into view/a> with scroll behavior code>auto/code>, block flow direction position set to a UA-defined value, and inline base direction position set to a UA-defined value.li>p>Unmark the element as i idfocus-management-apis:locked-for-focus-2>a href#locked-for-focus>locked for focus/a>/i>./ol> p>The dfn data-dfn-forHTMLElement iddom-blur>code>blur()/code>/dfn> method, when invoked, should run the a href#unfocusing-steps idfocus-management-apis:unfocusing-steps>unfocusing steps/a> for the element on which the method was called. User agents may selectively or uniformly ignore calls to this method for usability reasons./p> p classexample>For example, if the code idfocus-management-apis:dom-blur-2>a href#dom-blur>blur()/a>/code> method is unwisely being used to remove the focus ring for aesthetics reasons, the page would become unusable by keyboard users. Ignoring calls to this method would thus allow keyboard users to interact with the page./p> h3 idassigning-keyboard-shortcuts>span classsecno>6.5/span> Assigning keyboard shortcutsa href#assigning-keyboard-shortcuts classself-link>/a>/h3> h4 idintroduction-9>span classsecno>6.5.1/span> Introductiona href#introduction-9 classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>Each element that can be activated or focused can be assigned a single key combination to activate it, using the code idintroduction-9:the-accesskey-attribute>a href#the-accesskey-attribute>accesskey/a>/code> attribute./p> p>The exact shortcut is determined by the user agent, based on information about the users keyboard, what keyboard shortcuts already exist on the platform, and what other shortcuts have been specified on the page, using the information provided in the code idintroduction-9:the-accesskey-attribute-2>a href#the-accesskey-attribute>accesskey/a>/code> attribute as a guide./p> p>In order to ensure that a relevant keyboard shortcut is available on a wide variety of input devices, the author can provide a number of alternatives in the code idintroduction-9:the-accesskey-attribute-3>a href#the-accesskey-attribute>accesskey/a>/code> attribute./p> p>Each alternative consists of a single character, such as a letter or digit./p> p>User agents can provide users with a list of the keyboard shortcuts, but authors are encouraged to do so also. The code idintroduction-9:dom-accesskeylabel>a href#dom-accesskeylabel>accessKeyLabel/a>/code> IDL attribute returns a string representing the actual key combination assigned by the user agent./p> div classexample> p>In this example, an author has provided a button that can be invoked using a shortcut key. To support full keyboards, the author has provided C as a possible key. To support devices equipped only with numeric keypads, the author has provided 1 as another possibly key./p> pre><input typebutton valueCollect onclickcollect() strong>accesskeyC 1/strong> idc>/pre> /div> div classexample> p>To tell the user what the shortcut key is, the author has this script here opted to explicitly add the key combination to the buttons label:/p> pre>function addShortcutKeyLabel(button) {strong> if (button.accessKeyLabel ! ) button.value + ( + button.accessKeyLabel + );/strong>}addShortcutKeyLabel(document.getElementById(c));/pre> p>Browsers on different platforms will show different labels, even for the same key combination, based on the convention prevalent on that platform. For example, if the key combination is the Control key, the Shift key, and the letter C, a Windows browser might display samp>Ctrl+Shift+C/samp>, whereas a Mac browser might display samp>^⇧C/samp>, while an Emacs browser might just display samp>C-C/samp>. Similarly, if the key combination is the Alt key and the Escape key, Windows might use samp>Alt+Esc/samp>, Mac might use samp>⌥⎋/samp>, and an Emacs browser might use samp>M-ESC/samp> or samp>ESC ESC/samp>./p> p>In general, therefore, it is unwise to attempt to parse the value returned from the code idintroduction-9:dom-accesskeylabel-2>a href#dom-accesskeylabel>accessKeyLabel/a>/code> IDL attribute./p> /div> h4 idthe-accesskey-attribute>span classsecno>6.5.2/span> The dfn>code>accesskey/code>/dfn> attributea href#the-accesskey-attribute classself-link>/a>/h4> p>All a href#html-elements idthe-accesskey-attribute:html-elements>HTML elements/a> may have the code idthe-accesskey-attribute:the-accesskey-attribute>a href#the-accesskey-attribute>accesskey/a>/code> content attribute set. The code idthe-accesskey-attribute:the-accesskey-attribute-2>a href#the-accesskey-attribute>accesskey/a>/code> attributes value is used by the user agent as a guide for creating a keyboard shortcut that activates or focuses the element./p> p>If specified, the value must be an a href#ordered-set-of-unique-space-separated-tokens idthe-accesskey-attribute:ordered-set-of-unique-space-separated-tokens>ordered set of unique space-separated tokens/a> that are a href#case-sensitive idthe-accesskey-attribute:case-sensitive>case-sensitive/a>, each of which must be exactly one code point in length./p> div classexample> p>In the following example, a variety of links are given with access keys so that keyboard users familiar with the site can more quickly navigate to the relevant pages:/p> pre><nav> <p> <a titleConsortium Activities accesskeyA href/Consortium/activities>Activities</a> | <a titleTechnical Reports and Recommendations accesskeyT href/TR/>Technical Reports</a> | <a titleAlphabetical Site Index accesskeyS href/Consortium/siteindex>Site Index</a> | <a titleAbout This Site accesskeyB href/Consortium/>About Consortium</a> | <a titleContact Consortium accesskeyC href/Consortium/contact>Contact</a> </p></nav>/pre> /div> div classexample> p>In the following example, the search field is given two possible access keys, s and 0 (in that order). A user agent on a device with a full keyboard might pick kbd>kbd>Ctrl/kbd>+kbd>Alt/kbd>+kbd>S/kbd>/kbd> as the shortcut key, while a user agent on a small device with just a numeric keypad might pick just the plain unadorned key kbd>kbd>0/kbd>/kbd>:/p> pre><form action/search> <label>Search: <input typesearch nameq accesskeys 0></label> <input typesubmit></form>/pre> /div> div classexample> p>In the following example, a button has possible access keys described. A script then tries to update the buttons label to advertise the key combination the user agent selected./p> pre><input typesubmit accesskeyN @ 1 valueCompose>...<script> function labelButton(button) { if (button.accessKeyLabel) button.value + ( + button.accessKeyLabel + ); } var inputs document.getElementsByTagName(input); for (var i 0; i < inputs.length; i + 1) { if (inputsi.type submit) labelButton(inputsi); }</script>/pre> p>On one user agent, the buttons label might become samp>Compose (⌘N)/samp>. On another, it might become samp>Compose (Alt+⇧+1)/samp>. If the user agent doesnt assign a key, it will be just samp>Compose/samp>. The exact string depends on what the a href#assigned-access-key idthe-accesskey-attribute:assigned-access-key>assigned access key/a> is, and on how the user agent represents that key combination./p> /div> h4 idkeyboard-shortcuts-processing-model>span classsecno>6.5.3/span> span idprocessing-model-6>/span>Processing modela href#keyboard-shortcuts-processing-model classself-link>/a>/h4> p>An elements dfn idassigned-access-key>assigned access key/dfn> is a key combination derived from the elements code idkeyboard-shortcuts-processing-model:the-accesskey-attribute>a href#the-accesskey-attribute>accesskey/a>/code> content attribute. Initially, an element must not have an a href#assigned-access-key idkeyboard-shortcuts-processing-model:assigned-access-key>assigned access key/a>./p> p>Whenever an elements code idkeyboard-shortcuts-processing-model:the-accesskey-attribute-2>a href#the-accesskey-attribute>accesskey/a>/code> attribute is set, changed, or removed, the user agent must update the elements a href#assigned-access-key idkeyboard-shortcuts-processing-model:assigned-access-key-2>assigned access key/a> by running the following steps:/p> ol>li>p>If the element has no code idkeyboard-shortcuts-processing-model:the-accesskey-attribute-3>a href#the-accesskey-attribute>accesskey/a>/code> attribute, then skip to the i>fallback/i> step below.li>p>Otherwise, a hrefhttps://infra.spec.whatwg.org/#split-on-ascii-whitespace idkeyboard-shortcuts-processing-model:split-a-string-on-spaces data-x-internalsplit-a-string-on-spaces>split the attributes value on ASCII whitespace/a>, and let var>keys/var> be the resulting tokens.li> p>For each value in var>keys/var> in turn, in the order the tokens appeared in the attributes value, run the following substeps:/p> ol>li>p>If the value is not a string exactly one code point in length, then skip the remainder of these steps for this value.li>p>If the value does not correspond to a key on the systems keyboard, then skip the remainder of these steps for this value.li>p>If the user agent can find a mix of zero or more modifier keys that, combined with the key that corresponds to the value given in the attribute, can be used as the access key, then the user agent may assign that combination of keys as the elements a href#assigned-access-key idkeyboard-shortcuts-processing-model:assigned-access-key-3>assigned access key/a> and abort these steps. a href#fingerprinting-vector idkeyboard-shortcuts-processing-model:fingerprinting-vector classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /ol> li>p>i>Fallback/i>: Optionally, the user agent may assign a key combination of its choosing as the elements a href#assigned-access-key idkeyboard-shortcuts-processing-model: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 idkeyboard-shortcuts-processing-model:assigned-access-key-5>assigned access key/a>./ol> p>Once a user agent has selected and assigned an access key for an element, the user agent should not change the elements a href#assigned-access-key idkeyboard-shortcuts-processing-model:assigned-access-key-6>assigned access key/a> unless the code idkeyboard-shortcuts-processing-model:the-accesskey-attribute-4>a href#the-accesskey-attribute>accesskey/a>/code> content attribute is changed or the element is moved to another code idkeyboard-shortcuts-processing-model:document>a href#document>Document/a>/code>./p> p>When the user presses the key combination corresponding to the a href#assigned-access-key idkeyboard-shortcuts-processing-model:assigned-access-key-7>assigned access key/a> for an element, if the element a href#concept-command idkeyboard-shortcuts-processing-model:concept-command>defines a command/a>, the commands a href#command-facet-hiddenstate idkeyboard-shortcuts-processing-model:command-facet-hiddenstate>Hidden State/a> facet is false (visible), the commands a href#command-facet-disabledstate idkeyboard-shortcuts-processing-model:command-facet-disabledstate>Disabled State/a> facet is also false (enabled), the element is a idkeyboard-shortcuts-processing-model:in-a-document hrefhttps://dom.spec.whatwg.org/#in-a-document data-x-internalin-a-document>in a document/a> that has a a href#concept-document-bc idkeyboard-shortcuts-processing-model:concept-document-bc>browsing context/a>, and neither the element nor any of its ancestors has a code idkeyboard-shortcuts-processing-model: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 idkeyboard-shortcuts-processing-model:command-facet-action>Action/a> of the command./p> p classnote>User agents a href#expose-commands-in-ui>might expose/a> elements that have an code idkeyboard-shortcuts-processing-model:the-accesskey-attribute-5>a href#the-accesskey-attribute>accesskey/a>/code> attribute in other ways as well, e.g. in a menu displayed in response to a specific key combination./p> hr> p>The dfn iddom-accesskey>code>accessKey/code>/dfn> IDL attribute must a href#reflect idkeyboard-shortcuts-processing-model:reflect>reflect/a> the code idkeyboard-shortcuts-processing-model:the-accesskey-attribute-6>a href#the-accesskey-attribute>accesskey/a>/code> content attribute./p> p>The dfn iddom-accesskeylabel>code>accessKeyLabel/code>/dfn> IDL attribute must return a string that represents the elements a href#assigned-access-key idkeyboard-shortcuts-processing-model:assigned-access-key-8>assigned access key/a>, if any. If the element does not have one, then the IDL attribute must return the empty string./p> h3 idediting-2>span classsecno>6.6/span> Editinga href#editing-2 classself-link>/a>/h3> h4 idcontenteditable>span classsecno>6.6.1/span> Making document regions editable: The code idcontenteditable:attr-contenteditable>a href#attr-contenteditable>contenteditable/a>/code> content attributea href#contenteditable classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> contenteditablespan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>5.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>3.5+/span>/span>span classie yes>span>IE/span> span>5.5+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>3.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>3+/span>/span>span classopera yes>span>Opera/span> span>9+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featcontenteditable>caniuse.com/a>/div> pre classidl>ExposedWindow, NoInterfaceObjectinterface dfn idelementcontenteditable>ElementContentEditable/dfn> { a href#cereactions idcontenteditable:cereactions>CEReactions/a> attribute DOMString a href#dom-contenteditable idcontenteditable:dom-contenteditable>contentEditable/a>; readonly attribute boolean a href#dom-iscontenteditable idcontenteditable:dom-iscontenteditable>isContentEditable/a>;};/pre> p>The dfn idattr-contenteditable>code>contenteditable/code>/dfn> content attribute is an a href#enumerated-attribute idcontenteditable:enumerated-attribute>enumerated attribute/a> whose keywords are the empty string, code>true/code>, and code>false/code>. The empty string and the code>true/code> keyword map to the i>true/i> state. The code>false/code> keyword maps to the i>false/i> state. In addition, there is a third state, the i>inherit/i> state, which is the i idcontenteditable:missing-value-default>a href#missing-value-default>missing value default/a>/i> (and the i idcontenteditable:invalid-value-default>a href#invalid-value-default>invalid value default/a>/i>)./p> p>The i>true/i> state indicates that the element is editable. The i>inherit/i> state indicates that the element is editable if its parent is. The i>false/i> state indicates that the element is not editable./p> div classexample> p>For example, consider a page that has a code idcontenteditable:the-form-element>a href#the-form-element>form/a>/code> and a code idcontenteditable:the-textarea-element>a href#the-textarea-element>textarea/a>/code> to publish a new article, where the user is expected to write the article using HTML:/p> pre><form methodPOST> <fieldset> <legend>New article</legend> <textarea namearticle><p>Hello world.</p></textarea> </fieldset> <p><button>Publish</button></p></form>/pre> p>When scripting is enabled, the code idcontenteditable:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code> element could be replaced with a rich text control instead, using the code idcontenteditable:attr-contenteditable-2>a href#attr-contenteditable>contenteditable/a>/code> attribute:/p> pre><form methodPOST> <fieldset> <legend>New article</legend> <textarea idtextarea namearticle><p>Hello world.</p></textarea> <div iddiv stylewhite-space: pre-wrap hidden><p>Hello world.</p></div> <script> let textarea document.getElementById(textarea); let div document.getElementById(div); textarea.hidden true; div.hidden false; div.contentEditable true; div.oninput (e) > { textarea.value div.innerHTML; }; </script> </fieldset> <p><button>Publish</button></p></form>/pre> p>Features to enable, e.g., inserting links, can be implemented using the code idcontenteditable:execCommand>a data-x-internalexecCommand hrefhttps://w3c.github.io/editing/execCommand.html#execcommand%28%29>document.execCommand()/a>/code> API, or using code idcontenteditable:selection>a data-x-internalselection hrefhttps://w3c.github.io/selection-api/#selection-interface>Selection/a>/code> APIs and other DOM APIs. a href#refsEXECCOMMAND>EXECCOMMAND/a> a href#refsSELECTION>SELECTION/a> a href#refsDOM>DOM/a>/p> /div> div classexample> p>The code idcontenteditable:attr-contenteditable-3>a href#attr-contenteditable>contenteditable/a>/code> attribute can also be used to great effect:/p> pre><!doctype html><html langen><title>Live CSS editing!</title><style stylewhite-space:pre contenteditable>html { margin:.2em; font-size:2em; color:lime; background:purple }head, title, style { display:block }body { display:none }</style>/pre> /div> dl classdomintro>dt>var>element/var> . code idcontenteditable:dom-contenteditable-2>a href#dom-contenteditable>contentEditable/a>/code> var>value/var> dd> p>Returns code>true/code>, code>false/code>, or code>inherit/code>, based on the state of the code idcontenteditable:attr-contenteditable-4>a href#attr-contenteditable>contenteditable/a>/code> attribute./p> p>Can be set, to change that state./p> p>Throws a a idcontenteditable:syntaxerror hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idcontenteditable:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the new value isnt one of those strings./p> dt>var>element/var> . code idcontenteditable:dom-iscontenteditable-2>a href#dom-iscontenteditable>isContentEditable/a>/code>dd> p>Returns true if the element is editable; otherwise, returns false./p> /dl> p>The dfn iddom-contenteditable>code>contentEditable/code>/dfn> IDL attribute, on getting, must return the string code>true/code> if the content attribute is set to the true state, code>false/code> if the content attribute is set to the false state, and code>inherit/code> otherwise. On setting, if the new value is an a idcontenteditable:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>inherit/code> then the content attribute must be removed, if the new value is an a idcontenteditable:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>true/code> then the content attribute must be set to the string code>true/code>, if the new value is an a idcontenteditable:ascii-case-insensitive-3 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>false/code> then the content attribute must be set to the string code>false/code>, and otherwise the attribute setter must throw a a idcontenteditable:syntaxerror-2 hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idcontenteditable:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> p>The dfn iddom-iscontenteditable>code>isContentEditable/code>/dfn> IDL attribute, on getting, must return true if the element is either an a idcontenteditable:editing-host hrefhttps://w3c.github.io/editing/execCommand.html#editing-host data-x-internalediting-host>editing host/a> or a idcontenteditable:editable hrefhttps://w3c.github.io/editing/execCommand.html#editable data-x-internaleditable>editable/a>, and false otherwise./p> h4 idmaking-entire-documents-editable:-the-designmode-idl-attribute>span classsecno>6.6.2/span> Making entire documents editable: the code idmaking-entire-documents-editable:-the-designmode-idl-attribute:designMode>a href#designMode>designMode/a>/code> IDL attributea href#making-entire-documents-editable:-the-designmode-idl-attribute classself-link>/a>/h4> p>Documents have a dfn iddesignMode>code>designMode/code>/dfn>, which can be either enabled or disabled./p> dl classdomintro>dt>var>document/var> . code idmaking-entire-documents-editable:-the-designmode-idl-attribute:designMode-2>a href#designMode>designMode/a>/code> var>value/var> dd> p>Returns code>on/code> if the document is editable, and code>off/code> if it isnt./p> p>Can be set, to change the documents current state. This focuses the document and resets the selection in that document./p> /dl> p>The code idmaking-entire-documents-editable:-the-designmode-idl-attribute:designMode-3>a href#designMode>designMode/a>/code> IDL attribute on the code idmaking-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 idmaking-entire-documents-editable:-the-designmode-idl-attribute:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> manner to these two values; if it matches the code>on/code> value, then code idmaking-entire-documents-editable:-the-designmode-idl-attribute:designMode-4>a href#designMode>designMode/a>/code> must be enabled, and if it matches the code>off/code> value, then code idmaking-entire-documents-editable:-the-designmode-idl-attribute:designMode-5>a href#designMode>designMode/a>/code> must be disabled. Other values must be ignored./p> p>On getting, if code idmaking-entire-documents-editable:-the-designmode-idl-attribute:designMode-6>a href#designMode>designMode/a>/code> is enabled, the IDL attribute must return the value code>on/code>; otherwise it is disabled, and the attribute must return the value code>off/code>./p> p>The last state set must persist until the document is destroyed or the state is changed. Initially, documents must have their code idmaking-entire-documents-editable:-the-designmode-idl-attribute:designMode-7>a href#designMode>designMode/a>/code> disabled./p> p>When the code idmaking-entire-documents-editable:-the-designmode-idl-attribute:designMode-8>a href#designMode>designMode/a>/code> changes from being disabled to being enabled, the user agent must a href#immediately idmaking-entire-documents-editable:-the-designmode-idl-attribute:immediately>immediately/a> reset the documents a idmaking-entire-documents-editable:-the-designmode-idl-attribute:active-range hrefhttps://w3c.github.io/editing/execCommand.html#active-range data-x-internalactive-range>active range/a>s start and end boundary points to be at the start of the code idmaking-entire-documents-editable:-the-designmode-idl-attribute:document-2>a href#document>Document/a>/code> and then run the a href#focusing-steps idmaking-entire-documents-editable:-the-designmode-idl-attribute:focusing-steps>focusing steps/a> for the a idmaking-entire-documents-editable:-the-designmode-idl-attribute:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> of the code idmaking-entire-documents-editable:-the-designmode-idl-attribute:document-3>a href#document>Document/a>/code>, if non-null./p> h4 idbest-practices-for-in-page-editors>span classsecno>6.6.3/span> Best practices for in-page editorsa href#best-practices-for-in-page-editors classself-link>/a>/h4> p>Authors are encouraged to set the a idbest-practices-for-in-page-editors:white-space hrefhttps://drafts.csswg.org/css-text/#white-space-property data-x-internalwhite-space>white-space/a> property on a hrefhttps://w3c.github.io/editing/execCommand.html#editing-host idbest-practices-for-in-page-editors:editing-host data-x-internalediting-host>editing hosts/a> and on markup that was originally created through these editing mechanisms to the value pre-wrap. Default HTML whitespace handling is not well suited to WYSIWYG editing, and line wrapping will not work correctly in some corner cases if a idbest-practices-for-in-page-editors:white-space-2 hrefhttps://drafts.csswg.org/css-text/#white-space-property data-x-internalwhite-space>white-space/a> is left at its default value./p> div classexample> p>As an example of problems that occur if the default normal value is used instead, consider the case of the user typing kbd>yellow␣␣ball/kbd>, with two spaces (here represented by ␣) between the words. With the editing rules in place for the default value of a idbest-practices-for-in-page-editors:white-space-3 hrefhttps://drafts.csswg.org/css-text/#white-space-property data-x-internalwhite-space>white-space/a> (normal), the resulting markup will either consist of samp>yellow ball/samp> or samp>yellow ball/samp>; i.e., there will be a non-breaking space between the two words in addition to the regular space. This is necessary because the normal value for a idbest-practices-for-in-page-editors:white-space-4 hrefhttps://drafts.csswg.org/css-text/#white-space-property data-x-internalwhite-space>white-space/a> requires adjacent regular spaces to be collapsed together./p> p>In the former case, samp>yellow⍽/samp> might wrap to the next line (⍽ being used here to represent a non-breaking space) even though samp>yellow/samp> alone might fit at the end of the line; in the latter case, samp>⍽ball/samp>, if wrapped to the start of the line, would have visible indentation from the non-breaking space./p> p>When a idbest-practices-for-in-page-editors:white-space-5 hrefhttps://drafts.csswg.org/css-text/#white-space-property data-x-internalwhite-space>white-space/a> is set to pre-wrap, however, the editing rules will instead simply put two regular spaces between the words, and should the two words be split at the end of a line, the spaces would be neatly removed from the rendering./p> /div> h4 idediting-apis>span classsecno>6.6.4/span> Editing APIsa href#editing-apis classself-link>/a>/h4> p>The definition of the terms dfn idactive-range>a hrefhttps://w3c.github.io/editing/execCommand.html#active-range>active range/a>/dfn>, dfn idediting-host>a hrefhttps://w3c.github.io/editing/execCommand.html#editing-host>editing host/a>/dfn>, and dfn ideditable>a hrefhttps://w3c.github.io/editing/execCommand.html#editable>editable/a>/dfn>, the user interface requirements of elements that are a hrefhttps://w3c.github.io/editing/execCommand.html#editing-host idediting-apis:editing-host data-x-internalediting-host>editing hosts/a> or a idediting-apis:editable hrefhttps://w3c.github.io/editing/execCommand.html#editable data-x-internaleditable>editable/a>, the dfn idexecCommand>a hrefhttps://w3c.github.io/editing/execCommand.html#execcommand%28%29>code>execCommand()/code>/a>/dfn>, dfn iddom-document-querycommandenabled>a hrefhttps://w3c.github.io/editing/execCommand.html#querycommandenabled%28%29>code>queryCommandEnabled()/code>/a>/dfn>, dfn iddom-document-querycommandindeterm>a hrefhttps://w3c.github.io/editing/execCommand.html#querycommandindeterm%28%29>code>queryCommandIndeterm()/code>/a>/dfn>, dfn iddom-document-querycommandstate>a hrefhttps://w3c.github.io/editing/execCommand.html#querycommandstate%28%29>code>queryCommandState()/code>/a>/dfn>, dfn iddom-document-querycommandsupported>a hrefhttps://w3c.github.io/editing/execCommand.html#querycommandsupported%28%29>code>queryCommandSupported()/code>/a>/dfn>, and dfn iddom-document-querycommandvalue>a hrefhttps://w3c.github.io/editing/execCommand.html#querycommandvalue%28%29>code>queryCommandValue()/code>/a>/dfn> methods, text selections, and the dfn iddelete-the-selection>a hrefhttps://w3c.github.io/editing/execCommand.html#delete-the-selection>delete the selection/a>/dfn> algorithm are defined in cite>execCommand/cite>. a href#refsEXECCOMMAND>EXECCOMMAND/a>/p> h4 idspelling-and-grammar-checking>span classsecno>6.6.5/span> Spelling and grammar checkinga href#spelling-and-grammar-checking classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> spellcheck-attributespan classand_chr partial>span>Chrome for Android (limited)/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>9+/span>/span>span classios_saf partial>span>iOS Safari (limited)/span> span>3.2+/span>/span>span classand_uc partial>span>UC Browser for Android (limited)/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>2+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung partial>span>Samsung Internet (limited)/span> span>4+/span>/span>span classop_mini partial>span>Opera Mini (limited)/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>5.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid partial>span>Android Browser (limited)/span> span>2.1+/span>/span>span classopera yes>span>Opera/span> span>10.5+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featspellcheck-attribute>caniuse.com/a>/div> p>User agents can support the checking of spelling and grammar of editable text, either in form controls (such as the value of code idspelling-and-grammar-checking:the-textarea-element>a href#the-textarea-element>textarea/a>/code> elements), or in elements in an a idspelling-and-grammar-checking:editing-host hrefhttps://w3c.github.io/editing/execCommand.html#editing-host data-x-internalediting-host>editing host/a> (e.g. using code idspelling-and-grammar-checking:attr-contenteditable>a href#attr-contenteditable>contenteditable/a>/code>)./p> p>For each element, user agents must establish a dfn idconcept-spellcheck-default>default behavior/dfn>, either through defaults or through preferences expressed by the user. There are three possible default behaviors for each element:/p> dl>dt>dfn idconcept-spellcheck-default-true>true-by-default/dfn> dd>The element will be checked for spelling and grammar if its contents are editable and spellchecking is not explicitly disabled through the code idspelling-and-grammar-checking:attr-spellcheck>a href#attr-spellcheck>spellcheck/a>/code> attribute. dt>dfn idconcept-spellcheck-default-false>false-by-default/dfn> dd>The element will never be checked for spelling and grammar unless spellchecking is explicitly enabled through the code idspelling-and-grammar-checking:attr-spellcheck-2>a href#attr-spellcheck>spellcheck/a>/code> attribute. dt>dfn idconcept-spellcheck-default-inherit>inherit-by-default/dfn> dd>The elements default behavior is the same as its parent elements. Elements that have no parent element cannot have this as their default behavior. /dl> hr> p>The dfn idattr-spellcheck>code>spellcheck/code>/dfn> attribute is an a href#enumerated-attribute idspelling-and-grammar-checking:enumerated-attribute>enumerated attribute/a> whose keywords are the empty string, code>true/code> and code>false/code>. The empty string and the code>true/code> keyword map to the i>true/i> state. The code>false/code> keyword maps to the i>false/i> state. In addition, there is a third state, the i>default/i> state, which is the i idspelling-and-grammar-checking:missing-value-default>a href#missing-value-default>missing value default/a>/i> (and the i idspelling-and-grammar-checking:invalid-value-default>a href#invalid-value-default>invalid value default/a>/i>)./p> p classnote>The i>true/i> state indicates that the element is to have its spelling and grammar checked. The i>default/i> state indicates that the element is to act according to a default behavior, possibly based on the parent elements own code idspelling-and-grammar-checking:attr-spellcheck-3>a href#attr-spellcheck>spellcheck/a>/code> state, as defined below. The i>false/i> state indicates that the element is not to be checked./p> hr> dl classdomintro>dt>var>element/var> . code idspelling-and-grammar-checking:dom-spellcheck>a href#dom-spellcheck>spellcheck/a>/code> var>value/var> dd> p>Returns true if the element is to have its spelling and grammar checked; otherwise, returns false./p> p>Can be set, to override the default and set the code idspelling-and-grammar-checking:attr-spellcheck-4>a href#attr-spellcheck>spellcheck/a>/code> content attribute./p> /dl> p>The dfn iddom-spellcheck>code>spellcheck/code>/dfn> IDL attribute, on getting, must return true if the elements code idspelling-and-grammar-checking:attr-spellcheck-5>a href#attr-spellcheck>spellcheck/a>/code> content attribute is in the i>true/i> state, or if the elements code idspelling-and-grammar-checking:attr-spellcheck-6>a href#attr-spellcheck>spellcheck/a>/code> content attribute is in the i>default/i> state and the elements a href#concept-spellcheck-default idspelling-and-grammar-checking:concept-spellcheck-default>default behavior/a> is a href#concept-spellcheck-default-true idspelling-and-grammar-checking:concept-spellcheck-default-true>true-by-default/a>, or if the elements code idspelling-and-grammar-checking:attr-spellcheck-7>a href#attr-spellcheck>spellcheck/a>/code> content attribute is in the i>default/i> state and the elements a href#concept-spellcheck-default idspelling-and-grammar-checking:concept-spellcheck-default-2>default behavior/a> is a href#concept-spellcheck-default-inherit idspelling-and-grammar-checking:concept-spellcheck-default-inherit>inherit-by-default/a> and the elements parent elements code idspelling-and-grammar-checking:dom-spellcheck-2>a href#dom-spellcheck>spellcheck/a>/code> IDL attribute would return true; otherwise, if none of those conditions applies, then the attribute must instead return false./p> p classnote>The code idspelling-and-grammar-checking:dom-spellcheck-3>a href#dom-spellcheck>spellcheck/a>/code> IDL attribute is not affected by user preferences that override the code idspelling-and-grammar-checking:attr-spellcheck-8>a href#attr-spellcheck>spellcheck/a>/code> content attribute, and therefore might not reflect the actual spellchecking state./p> p>On setting, if the new value is true, then the elements code idspelling-and-grammar-checking:attr-spellcheck-9>a href#attr-spellcheck>spellcheck/a>/code> content attribute must be set to the literal string code>true/code>, otherwise it must be set to the literal string code>false/code>. hr> p>User agents must only consider the following pieces of text as checkable for the purposes of this feature:/p> ul>li>The a href#concept-fe-value idspelling-and-grammar-checking:concept-fe-value>value/a> of code idspelling-and-grammar-checking:the-input-element>a href#the-input-element>input/a>/code> elements whose code idspelling-and-grammar-checking:attr-input-type>a href#attr-input-type>type/a>/code> attributes are in the a href#text-(typetext)-state-and-search-state-(typesearch) idspelling-and-grammar-checking:text-(typetext)-state-and-search-state-(typesearch)>Text/a>, a href#text-(typetext)-state-and-search-state-(typesearch) idspelling-and-grammar-checking:text-(typetext)-state-and-search-state-(typesearch)-2>Search/a>, a href#url-state-(typeurl) idspelling-and-grammar-checking:url-state-(typeurl)>URL/a>, or a href#e-mail-state-(typeemail) idspelling-and-grammar-checking:e-mail-state-(typeemail)>E-mail/a> states and that are i idspelling-and-grammar-checking:concept-fe-mutable>a href#concept-fe-mutable>mutable/a>/i> (i.e. that do not have the code idspelling-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 idspelling-and-grammar-checking:concept-fe-disabled>disabled/a>).li>The a href#concept-fe-value idspelling-and-grammar-checking:concept-fe-value-2>value/a> of code idspelling-and-grammar-checking:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code> elements that do not have a code idspelling-and-grammar-checking:attr-textarea-readonly>a href#attr-textarea-readonly>readonly/a>/code> attribute and that are not a href#concept-fe-disabled idspelling-and-grammar-checking:concept-fe-disabled-2>disabled/a>.li>Text in code idspelling-and-grammar-checking:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes that are children of a hrefhttps://w3c.github.io/editing/execCommand.html#editing-host idspelling-and-grammar-checking:editing-host-2 data-x-internalediting-host>editing hosts/a> or a idspelling-and-grammar-checking:editable hrefhttps://w3c.github.io/editing/execCommand.html#editable data-x-internaleditable>editable/a> elements.li>Text in attributes of a idspelling-and-grammar-checking:editable-2 hrefhttps://w3c.github.io/editing/execCommand.html#editable data-x-internaleditable>editable/a> elements./ul> p>For text that is part of a code idspelling-and-grammar-checking:text-2>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node, the element with which the text is associated is the element that is the immediate parent of the first character of the word, sentence, or other piece of text. For text in attributes, it is the attributes element. For the values of code idspelling-and-grammar-checking:the-input-element-2>a href#the-input-element>input/a>/code> and code idspelling-and-grammar-checking:the-textarea-element-3>a href#the-textarea-element>textarea/a>/code> elements, it is the element itself./p> p>To determine if a word, sentence, or other piece of text in an applicable element (as defined above) is to have spelling- and grammar-checking enabled, the UA must use the following algorithm:/p> ol>li>If the user has disabled the checking for this text, then the checking is disabled.li>Otherwise, if the user has forced the checking for this text to always be enabled, then the checking is enabled.li>Otherwise, if the element with which the text is associated has a code idspelling-and-grammar-checking:attr-spellcheck-10>a href#attr-spellcheck>spellcheck/a>/code> content attribute, then: if that attribute is in the i>true/i> state, then checking is enabled; otherwise, if that attribute is in the i>false/i> state, then checking is disabled.li>Otherwise, if there is an ancestor element with a code idspelling-and-grammar-checking:attr-spellcheck-11>a href#attr-spellcheck>spellcheck/a>/code> content attribute that is not in the i>default/i> state, then: if the nearest such ancestors code idspelling-and-grammar-checking:attr-spellcheck-12>a href#attr-spellcheck>spellcheck/a>/code> content attribute is in the i>true/i> state, then checking is enabled; otherwise, checking is disabled.li>Otherwise, if the elements a href#concept-spellcheck-default idspelling-and-grammar-checking:concept-spellcheck-default-3>default behavior/a> is a href#concept-spellcheck-default-true idspelling-and-grammar-checking:concept-spellcheck-default-true-2>true-by-default/a>, then checking is enabled.li>Otherwise, if the elements a href#concept-spellcheck-default idspelling-and-grammar-checking:concept-spellcheck-default-4>default behavior/a> is a href#concept-spellcheck-default-false idspelling-and-grammar-checking:concept-spellcheck-default-false>false-by-default/a>, then checking is disabled.li>Otherwise, if the elements parent element has em>its/em> checking enabled, then checking is enabled.li>Otherwise, checking is disabled./ol> p>If the checking is enabled for a word/sentence/text, the user agent should indicate spelling and grammar errors in that text. User agents should take into account the other semantics given in the document when suggesting spelling and grammar corrections. User agents may use the language of the element to determine what spelling and grammar rules to use, or may use the users preferred language settings. UAs should use code idspelling-and-grammar-checking:the-input-element-3>a href#the-input-element>input/a>/code> element attributes such as code idspelling-and-grammar-checking:attr-input-pattern>a href#attr-input-pattern>pattern/a>/code> to ensure that the resulting value is valid, where possible./p> p>If checking is disabled, the user agent should not indicate spelling or grammar errors for that text./p> div classexample> p>The element with ID a in the following example would be the one used to determine if the word Hello is checked for spelling errors. In this example, it would not be./p> pre><div contenteditabletrue> <span spellcheckfalse ida>Hell</span><em>o!</em></div>/pre> p>The element with ID b in the following example would have checking enabled (the leading space character in the attributes value on the code idspelling-and-grammar-checking:the-input-element-4>a href#the-input-element>input/a>/code> element causes the attribute to be ignored, so the ancestors value is used instead, regardless of the default)./p> pre classbad><p spellchecktrue> <label>Name: <input spellcheck false idb></label></p>/pre> /div> p classnote>This specification does not define the user interface for spelling and grammar checkers. A user agent could offer on-demand checking, could perform continuous checking while the checking is enabled, or could use other interfaces./p> h3 iddnd>span classsecno>6.7/span> dfn>Drag and drop/dfn>a href#dnd classself-link>/a>/h3>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> dragndropspan classand_chr no>span>Chrome for Android/span> span>None/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>11+/span>/span>span classand_uc no>span>UC Browser for Android/span> span>None/span>/span>span classfirefox yes>span>Firefox/span> span>3.5+/span>/span>span classie partial>span>IE (limited)/span> span>5.5+/span>/span>span classsamsung no>span>Samsung Internet/span> span>None/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>3.1+/span>/span>span classedge partial>span>Edge (limited)/span> span>12+/span>/span>span classandroid no>span>Android Browser/span> span>None/span>/span>span classopera yes>span>Opera/span> span>12+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featdragndrop>caniuse.com/a>/div> p>This section defines an event-based drag-and-drop mechanism./p> p>This specification does not define exactly what a em>drag-and-drop operation/em> actually is./p> p>On a visual medium with a pointing device, a drag operation could be the default action of a code iddnd:event-mousedown>a data-x-internalevent-mousedown hrefhttps://w3c.github.io/uievents/#event-type-mousedown>mousedown/a>/code> event that is followed by a series of code iddnd:event-mousemove>a data-x-internalevent-mousemove hrefhttps://w3c.github.io/uievents/#event-type-mousemove>mousemove/a>/code> events, and the drop could be triggered by the mouse being released./p> p>When using an input modality other than a pointing device, users would probably have to explicitly indicate their intention to perform a drag-and-drop operation, stating what they wish to drag and where they wish to drop it, respectively./p> p>However it is implemented, drag-and-drop operations must have a starting point (e.g. where the mouse was clicked, or the start of the selection or element that was selected for the drag), may have any number of intermediate steps (elements that the mouse moves over during a drag, or elements that the user picks as possible drop points as they cycle through possibilities), and must either have an end point (the element above which the mouse button was released, or the element that was finally selected), or be canceled. The end point must be the last element selected as a possible drop point before the drop occurs (so if the operation is not canceled, there must be at least one element in the middle step)./p> h4 idevent-drag>span classsecno>6.7.1/span> Introductiona href#event-drag classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>To make an element draggable, give the element a code idevent-drag:the-draggable-attribute>a href#the-draggable-attribute>draggable/a>/code> attribute, and set an event listener for code idevent-drag:event-dnd-dragstart>a href#event-dnd-dragstart>dragstart/a>/code> that stores the data being dragged./p> p>The event handler typically needs to check that its not a text selection that is being dragged, and then needs to store data into the code idevent-drag:datatransfer>a href#datatransfer>DataTransfer/a>/code> object and set the allowed effects (copy, move, link, or some combination)./p> p>For example:/p> pre><p>What fruits do you like?</p><ol ondragstartdragStartHandler(event)> <li draggabletrue data-valuefruit-apple>Apples</li> <li draggabletrue data-valuefruit-orange>Oranges</li> <li draggabletrue data-valuefruit-pear>Pears</li></ol><script> var internalDNDType text/x-example; // set this to something specific to your site function dragStartHandler(event) { if (event.target instanceof HTMLLIElement) { // use the elements data-value attribute as the value to be moving: event.dataTransfer.setData(internalDNDType, event.target.dataset.value); event.dataTransfer.effectAllowed move; // only allow moves } else { event.preventDefault(); // dont allow selection to be dragged } }</script>/pre> hr> p>To accept a drop, the drop target has to listen to the following events:/p> ol>li>The code idevent-drag:event-dnd-dragenter>a href#event-dnd-dragenter>dragenter/a>/code> event handler reports whether or not the drop target is potentially willing to accept the drop, by canceling the event.li>The code idevent-drag:event-dnd-dragover>a href#event-dnd-dragover>dragover/a>/code> event handler specifies what feedback will be shown to the user, by setting the code idevent-drag:dom-datatransfer-dropeffect>a href#dom-datatransfer-dropeffect>dropEffect/a>/code> attribute of the code idevent-drag:datatransfer-2>a href#datatransfer>DataTransfer/a>/code> associated with the event. This event also needs to be canceled.li>The code idevent-drag:event-dnd-drop>a href#event-dnd-drop>drop/a>/code> event handler has a final chance to accept or reject the drop. If the drop is accepted, the event handler must perform the drop operation on the target. This event needs to be canceled, so that the code idevent-drag:dom-datatransfer-dropeffect-2>a href#dom-datatransfer-dropeffect>dropEffect/a>/code> attributes value can be used by the source. Otherwise, the drop operation is rejected./ol> p>For example:/p> pre><p>Drop your favorite fruits below:</p><ol ondragenterdragEnterHandler(event) ondragoverdragOverHandler(event) ondropdropHandler(event)></ol><script> var internalDNDType text/x-example; // set this to something specific to your site function dragEnterHandler(event) { var items event.dataTransfer.items; for (var i 0; i < items.length; ++i) { var item itemsi; if (item.kind string && item.type internalDNDType) { event.preventDefault(); return; } } } function dragOverHandler(event) { event.dataTransfer.dropEffect move; event.preventDefault(); } function dropHandler(event) { var li document.createElement(li); var data event.dataTransfer.getData(internalDNDType); if (data fruit-apple) { li.textContent Apples; } else if (data fruit-orange) { li.textContent Oranges; } else if (data fruit-pear) { li.textContent Pears; } else { li.textContent Unknown Fruit; } event.target.appendChild(li); }</script>/pre> hr> p>To remove the original element (the one that was dragged) from the display, the code idevent-drag:event-dnd-dragend>a href#event-dnd-dragend>dragend/a>/code> event can be used./p> p>For our example here, that means updating the original markup to handle that event:/p> pre><p>What fruits do you like?</p><ol ondragstartdragStartHandler(event) ondragenddragEndHandler(event)> em>...as before.../em></ol><script> function dragStartHandler(event) { // em>...as before.../em> } function dragEndHandler(event) { if (event.dataTransfer.dropEffect move) { // remove the dragged element event.target.parentNode.removeChild(event.target); } }</script>/pre> h4 idthe-drag-data-store>span classsecno>6.7.2/span> The drag data storea href#the-drag-data-store classself-link>/a>/h4> p>The data that underlies a drag-and-drop operation, known as the dfn iddrag-data-store>drag data store/dfn>, consists of the following information:/p> ul>li>p>A dfn iddrag-data-store-item-list>drag data store item list/dfn>, which is a list of items representing the dragged data, each consisting of the following information:/p> dl>dt>dfn idthe-drag-data-item-kind>The drag data item kind/dfn>dd> p>The kind of data:/p> dl>dt>i>Plain Unicode string/i>dd> p>Text./p> dt>i>File/i>dd> p>Binary data with a file name./p> /dl> dt>dfn idthe-drag-data-item-type-string>The drag data item type string/dfn>dd> p>A Unicode string giving the type or format of the data, generally given by a a idthe-drag-data-store:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a>. Some values that are not a hrefhttps://mimesniff.spec.whatwg.org/#mime-type idthe-drag-data-store:mime-type-2 data-x-internalmime-type>MIME types/a> are special-cased for legacy reasons. The API does not enforce the use of a hrefhttps://mimesniff.spec.whatwg.org/#mime-type idthe-drag-data-store:mime-type-3 data-x-internalmime-type>MIME types/a>; other values can be used as well. In all cases, however, the values are all a idthe-drag-data-store:converted-to-ascii-lowercase hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a> by the API./p> p>There is a limit of one i>Plain Unicode string/i> item per a href#the-drag-data-item-type-string idthe-drag-data-store:the-drag-data-item-type-string>item type string/a>./p> dt>The actual datadd>p>A Unicode or binary string, in some cases with a file name (itself a Unicode string), as per a href#the-drag-data-item-kind idthe-drag-data-store:the-drag-data-item-kind>the drag data item kind/a>./dl> p>The a href#drag-data-store-item-list idthe-drag-data-store:drag-data-store-item-list>drag data store item list/a> is ordered in the order that the items were added to the list; most recently added last./p> li> p>The following information, used to generate the UI feedback during the drag:/p> ul>li>User-agent-defined default feedback information, known as the dfn iddrag-data-store-default-feedback>drag data store default feedback/dfn>.li>Optionally, a bitmap image and the coordinate of a point within that image, known as the dfn iddrag-data-store-bitmap>drag data store bitmap/dfn> and dfn iddrag-data-store-hot-spot-coordinate>drag data store hot spot coordinate/dfn>./ul> li> p>A dfn iddrag-data-store-mode>drag data store mode/dfn>, which is one of the following:/p> dl>dt>dfn idconcept-dnd-rw>Read/write mode/dfn>dd> p>For the code idthe-drag-data-store:event-dnd-dragstart>a href#event-dnd-dragstart>dragstart/a>/code> event. New data can be added to the a href#drag-data-store idthe-drag-data-store:drag-data-store>drag data store/a>./p> dt>dfn idconcept-dnd-ro>Read-only mode/dfn>dd> p>For the code idthe-drag-data-store:event-dnd-drop>a href#event-dnd-drop>drop/a>/code> event. The list of items representing dragged data can be read, including the data. No new data can be added./p> dt>dfn idconcept-dnd-p>Protected mode/dfn>dd> p>For all other events. The formats and kinds in the a href#drag-data-store idthe-drag-data-store:drag-data-store-2>drag data store/a> list of items representing dragged data can be enumerated, but the data itself is unavailable and no new data can be added./p> /dl> li> p>A dfn iddrag-data-store-allowed-effects-state>drag data store allowed effects state/dfn>, which is a string./p> /ul> p>When a a href#drag-data-store idthe-drag-data-store:drag-data-store-3>drag data store/a> is dfn idcreate-a-drag-data-store>created/dfn>, it must be initialized such that its a href#drag-data-store-item-list idthe-drag-data-store:drag-data-store-item-list-2>drag data store item list/a> is empty, it has no a href#drag-data-store-default-feedback idthe-drag-data-store:drag-data-store-default-feedback>drag data store default feedback/a>, it has no a href#drag-data-store-bitmap idthe-drag-data-store:drag-data-store-bitmap>drag data store bitmap/a> and a href#drag-data-store-hot-spot-coordinate idthe-drag-data-store:drag-data-store-hot-spot-coordinate>drag data store hot spot coordinate/a>, its a href#drag-data-store-mode idthe-drag-data-store:drag-data-store-mode>drag data store mode/a> is a href#concept-dnd-p idthe-drag-data-store:concept-dnd-p>protected mode/a>, and its a href#drag-data-store-allowed-effects-state idthe-drag-data-store:drag-data-store-allowed-effects-state>drag data store allowed effects state/a> is the string code idthe-drag-data-store:dom-datatransfer-effectallowed-uninitialized>a href#dom-datatransfer-effectallowed-uninitialized>uninitialized/a>/code>./p> h4 idthe-datatransfer-interface>span classsecno>6.7.3/span> The code idthe-datatransfer-interface:datatransfer>a href#datatransfer>DataTransfer/a>/code> interfacea href#the-datatransfer-interface classself-link>/a>/h4> p>code idthe-datatransfer-interface:datatransfer-2>a href#datatransfer>DataTransfer/a>/code> objects are used to expose the a href#drag-data-store idthe-datatransfer-interface:drag-data-store>drag data store/a> that underlies a drag-and-drop operation./p> pre classidl>ExposedWindow, a href#dom-datatransfer idthe-datatransfer-interface:dom-datatransfer>Constructor/a> interface dfn iddatatransfer>DataTransfer/dfn> { attribute DOMString a href#dom-datatransfer-dropeffect idthe-datatransfer-interface:dom-datatransfer-dropeffect>dropEffect/a>; attribute DOMString a href#dom-datatransfer-effectallowed idthe-datatransfer-interface:dom-datatransfer-effectallowed>effectAllowed/a>; SameObject readonly attribute a href#datatransferitemlist idthe-datatransfer-interface:datatransferitemlist>DataTransferItemList/a> a href#dom-datatransfer-items idthe-datatransfer-interface:dom-datatransfer-items>items/a>; void a href#dom-datatransfer-setdragimage idthe-datatransfer-interface:dom-datatransfer-setdragimage>setDragImage/a>(Element image, long x, long y); /* old interface */ readonly attribute FrozenArray<DOMString> a href#dom-datatransfer-types idthe-datatransfer-interface:dom-datatransfer-types>types/a>; DOMString a href#dom-datatransfer-getdata idthe-datatransfer-interface:dom-datatransfer-getdata>getData/a>(DOMString format); void a href#dom-datatransfer-setdata idthe-datatransfer-interface:dom-datatransfer-setdata>setData/a>(DOMString format, DOMString data); void a href#dom-datatransfer-cleardata idthe-datatransfer-interface:dom-datatransfer-cleardata>clearData/a>(optional DOMString format); SameObject readonly attribute a idthe-datatransfer-interface:filelist hrefhttps://w3c.github.io/FileAPI/#filelist-section data-x-internalfilelist>FileList/a> a href#dom-datatransfer-files idthe-datatransfer-interface:dom-datatransfer-files>files/a>;};/pre> dl classdomintro>dt>var>dataTransfer/var> new code idthe-datatransfer-interface:dom-datatransfer-2>a href#dom-datatransfer>DataTransfer/a>/code>()dd> p>Creates a new code idthe-datatransfer-interface:datatransfer-3>a href#datatransfer>DataTransfer/a>/code> object with an empty a href#drag-data-store idthe-datatransfer-interface:drag-data-store-2>drag data store/a>./p> dt>var>dataTransfer/var> . code idthe-datatransfer-interface:dom-datatransfer-dropeffect-2>a href#dom-datatransfer-dropeffect>dropEffect/a>/code> var>value/var> dd> p>Returns the kind of operation that is currently selected. If the kind of operation isnt one of those that is allowed by the code idthe-datatransfer-interface:dom-datatransfer-effectallowed-2>a href#dom-datatransfer-effectallowed>effectAllowed/a>/code> attribute, then the operation will fail./p> p>Can be set, to change the selected operation./p> p>The possible values are code idthe-datatransfer-interface:dom-datatransfer-dropeffect-none>a href#dom-datatransfer-dropeffect-none>none/a>/code>, code idthe-datatransfer-interface:dom-datatransfer-dropeffect-copy>a href#dom-datatransfer-dropeffect-copy>copy/a>/code>, code idthe-datatransfer-interface:dom-datatransfer-dropeffect-link>a href#dom-datatransfer-dropeffect-link>link/a>/code>, and code idthe-datatransfer-interface:dom-datatransfer-dropeffect-move>a href#dom-datatransfer-dropeffect-move>move/a>/code>./p> dt>var>dataTransfer/var> . code idthe-datatransfer-interface:dom-datatransfer-effectallowed-3>a href#dom-datatransfer-effectallowed>effectAllowed/a>/code> var>value/var> dd> p>Returns the kinds of operations that are to be allowed./p> p>Can be set (during the code idthe-datatransfer-interface:event-dnd-dragstart>a href#event-dnd-dragstart>dragstart/a>/code> event), to change the allowed operations./p> p>The possible values are code idthe-datatransfer-interface:dom-datatransfer-effectallowed-none>a href#dom-datatransfer-effectallowed-none>none/a>/code>, code idthe-datatransfer-interface:dom-datatransfer-effectallowed-copy>a href#dom-datatransfer-effectallowed-copy>copy/a>/code>, code idthe-datatransfer-interface:dom-datatransfer-effectallowed-copylink>a href#dom-datatransfer-effectallowed-copylink>copyLink/a>/code>, code idthe-datatransfer-interface:dom-datatransfer-effectallowed-copymove>a href#dom-datatransfer-effectallowed-copymove>copyMove/a>/code>, code idthe-datatransfer-interface:dom-datatransfer-effectallowed-link>a href#dom-datatransfer-effectallowed-link>link/a>/code>, code idthe-datatransfer-interface:dom-datatransfer-effectallowed-linkmove>a href#dom-datatransfer-effectallowed-linkmove>linkMove/a>/code>, code idthe-datatransfer-interface:dom-datatransfer-effectallowed-move>a href#dom-datatransfer-effectallowed-move>move/a>/code>, code idthe-datatransfer-interface:dom-datatransfer-effectallowed-all>a href#dom-datatransfer-effectallowed-all>all/a>/code>, and code idthe-datatransfer-interface:dom-datatransfer-effectallowed-uninitialized>a href#dom-datatransfer-effectallowed-uninitialized>uninitialized/a>/code>,/p> dt>var>dataTransfer/var> . code idthe-datatransfer-interface:dom-datatransfer-items-2>a href#dom-datatransfer-items>items/a>/code>dd> p>Returns a code idthe-datatransfer-interface:datatransferitemlist-2>a href#datatransferitemlist>DataTransferItemList/a>/code> object, with the drag data./p> dt>var>dataTransfer/var> . code idthe-datatransfer-interface:dom-datatransfer-setdragimage-2>a href#dom-datatransfer-setdragimage>setDragImage/a>/code>(var>element/var>, var>x/var>, var>y/var>)dd> p>Uses the given element to update the drag feedback, replacing any previously specified feedback./p> dt>var>dataTransfer/var> . code idthe-datatransfer-interface:dom-datatransfer-types-2>a href#dom-datatransfer-types>types/a>/code>dd> p>Returns a a idthe-datatransfer-interface:frozen-array hrefhttps://heycam.github.io/webidl/#dfn-frozen-array-type data-x-internalfrozen-array>frozen array/a> listing the formats that were set in the code idthe-datatransfer-interface:event-dnd-dragstart-2>a href#event-dnd-dragstart>dragstart/a>/code> event. In addition, if any files are being dragged, then one of the types will be the string code>Files/code>./p> dt>var>data/var> var>dataTransfer/var> . code idthe-datatransfer-interface:dom-datatransfer-getdata-2>a href#dom-datatransfer-getdata>getData/a>/code>(var>format/var>)dd> p>Returns the specified data. If there is no such data, returns the empty string./p> dt>var>dataTransfer/var> . code idthe-datatransfer-interface:dom-datatransfer-setdata-2>a href#dom-datatransfer-setdata>setData/a>/code>(var>format/var>, var>data/var>)dd> p>Adds the specified data./p> dt>var>dataTransfer/var> . code idthe-datatransfer-interface:dom-datatransfer-cleardata-2>a href#dom-datatransfer-cleardata>clearData/a>/code>( var>format/var> )dd> p>Removes the data of the specified formats. Removes all data if the argument is omitted./p> dt>var>dataTransfer/var> . code idthe-datatransfer-interface:dom-datatransfer-files-2>a href#dom-datatransfer-files>files/a>/code>dd> p>Returns a code idthe-datatransfer-interface:filelist-2>a data-x-internalfilelist hrefhttps://w3c.github.io/FileAPI/#filelist-section>FileList/a>/code> of the files being dragged, if any./p> /dl> p>code idthe-datatransfer-interface:datatransfer-4>a href#datatransfer>DataTransfer/a>/code> objects that are created as part of a href#dndevents>drag-and-drop events/a> are only valid while those events are being fired./p> p>A code idthe-datatransfer-interface:datatransfer-5>a href#datatransfer>DataTransfer/a>/code> object is associated with a a href#drag-data-store idthe-datatransfer-interface:drag-data-store-3>drag data store/a> while it is valid./p> p>A code idthe-datatransfer-interface:datatransfer-6>a href#datatransfer>DataTransfer/a>/code> object has an associated dfn idconcept-datatransfer-types>types array/dfn>, which is a code idthe-datatransfer-interface:frozen-array-2>a data-x-internalfrozen-array hrefhttps://heycam.github.io/webidl/#dfn-frozen-array-type>FrozenArray<DOMString>/a>/code>, initially empty. When the contents of the code idthe-datatransfer-interface:datatransfer-7>a href#datatransfer>DataTransfer/a>/code> objects a href#drag-data-store-item-list idthe-datatransfer-interface:drag-data-store-item-list>drag data store item list/a> change, or when the code idthe-datatransfer-interface:datatransfer-8>a href#datatransfer>DataTransfer/a>/code> object becomes no longer associated with a a href#drag-data-store idthe-datatransfer-interface:drag-data-store-4>drag data store/a>, run the following steps:/p> ol>li>p>Let var>L/var> be an empty sequence.li> p>If the code idthe-datatransfer-interface:datatransfer-9>a href#datatransfer>DataTransfer/a>/code> object is still associated with a a href#drag-data-store idthe-datatransfer-interface:drag-data-store-5>drag data store/a>, then:/p> ol>li>p>For each item in the code idthe-datatransfer-interface:datatransfer-10>a href#datatransfer>DataTransfer/a>/code> objects a href#drag-data-store-item-list idthe-datatransfer-interface:drag-data-store-item-list-2>drag data store item list/a> whose a href#the-drag-data-item-kind idthe-datatransfer-interface:the-drag-data-item-kind>kind/a> is i>Plain Unicode string/i>, add an entry to var>L/var> consisting of the items a href#the-drag-data-item-type-string idthe-datatransfer-interface:the-drag-data-item-type-string>type string/a>.li>p>If there are any items in the code idthe-datatransfer-interface:datatransfer-11>a href#datatransfer>DataTransfer/a>/code> objects a href#drag-data-store-item-list idthe-datatransfer-interface:drag-data-store-item-list-3>drag data store item list/a> whose a href#the-drag-data-item-kind idthe-datatransfer-interface:the-drag-data-item-kind-2>kind/a> is i>File/i>, then add an entry to var>L/var> consisting of the string code>Files/code>. (This value can be distinguished from the other values because it is not lowercase.)/ol> li>p>Set the code idthe-datatransfer-interface:datatransfer-12>a href#datatransfer>DataTransfer/a>/code> objects a href#concept-datatransfer-types idthe-datatransfer-interface:concept-datatransfer-types>types array/a> to the result of a idthe-datatransfer-interface:creating-a-frozen-array hrefhttps://heycam.github.io/webidl/#dfn-create-frozen-array data-x-internalcreating-a-frozen-array>creating a frozen array/a> from var>L/var>./ol> p>The dfn iddom-datatransfer>code>DataTransfer()/code>/dfn> constructor, when invoked, must return a newly created code idthe-datatransfer-interface:datatransfer-13>a href#datatransfer>DataTransfer/a>/code> object initialized as follows:/p> ol>li>p>Set the a href#drag-data-store idthe-datatransfer-interface:drag-data-store-6>drag data store/a>s a href#drag-data-store-item-list idthe-datatransfer-interface:drag-data-store-item-list-4>item list/a> to be an empty list.li>p>Set the a href#drag-data-store idthe-datatransfer-interface:drag-data-store-7>drag data store/a>s a href#drag-data-store-mode idthe-datatransfer-interface:drag-data-store-mode>mode/a> to a href#concept-dnd-rw idthe-datatransfer-interface:concept-dnd-rw>read/write mode/a>.li>p>Set the code idthe-datatransfer-interface:dom-datatransfer-dropeffect-3>a href#dom-datatransfer-dropeffect>dropEffect/a>/code> and code idthe-datatransfer-interface:dom-datatransfer-effectallowed-4>a href#dom-datatransfer-effectallowed>effectAllowed/a>/code> to none./ol> p>The dfn iddom-datatransfer-dropeffect>code>dropEffect/code>/dfn> attribute controls the drag-and-drop feedback that the user is given during a drag-and-drop operation. When the code idthe-datatransfer-interface:datatransfer-14>a href#datatransfer>DataTransfer/a>/code> object is created, the code idthe-datatransfer-interface:dom-datatransfer-dropeffect-4>a href#dom-datatransfer-dropeffect>dropEffect/a>/code> attribute is set to a string value. On getting, it must return its current value. On setting, if the new value is one of dfn iddom-datatransfer-dropeffect-none>code>none/code>/dfn>, dfn iddom-datatransfer-dropeffect-copy>code>copy/code>/dfn>, dfn iddom-datatransfer-dropeffect-link>code>link/code>/dfn>, or dfn iddom-datatransfer-dropeffect-move>code>move/code>/dfn>, then the attributes current value must be set to the new value. Other values must be ignored./p> p>The dfn iddom-datatransfer-effectallowed>code>effectAllowed/code>/dfn> attribute is used in the drag-and-drop processing model to initialize the code idthe-datatransfer-interface:dom-datatransfer-dropeffect-5>a href#dom-datatransfer-dropeffect>dropEffect/a>/code> attribute during the code idthe-datatransfer-interface:event-dnd-dragenter>a href#event-dnd-dragenter>dragenter/a>/code> and code idthe-datatransfer-interface:event-dnd-dragover>a href#event-dnd-dragover>dragover/a>/code> events. When the code idthe-datatransfer-interface:datatransfer-15>a href#datatransfer>DataTransfer/a>/code> object is created, the code idthe-datatransfer-interface:dom-datatransfer-effectallowed-5>a href#dom-datatransfer-effectallowed>effectAllowed/a>/code> attribute is set to a string value. On getting, it must return its current value. On setting, if a href#drag-data-store idthe-datatransfer-interface:drag-data-store-8>drag data store/a>s a href#drag-data-store-mode idthe-datatransfer-interface:drag-data-store-mode-2>mode/a> is the a href#concept-dnd-rw idthe-datatransfer-interface:concept-dnd-rw-2>read/write mode/a> and the new value is one of dfn iddom-datatransfer-effectallowed-none>code>none/code>/dfn>, dfn iddom-datatransfer-effectallowed-copy>code>copy/code>/dfn>, dfn iddom-datatransfer-effectallowed-copylink>code>copyLink/code>/dfn>, dfn iddom-datatransfer-effectallowed-copymove>code>copyMove/code>/dfn>, dfn iddom-datatransfer-effectallowed-link>code>link/code>/dfn>, dfn iddom-datatransfer-effectallowed-linkmove>code>linkMove/code>/dfn>, dfn iddom-datatransfer-effectallowed-move>code>move/code>/dfn>, dfn iddom-datatransfer-effectallowed-all>code>all/code>/dfn>, or dfn iddom-datatransfer-effectallowed-uninitialized>code>uninitialized/code>/dfn>, then the attributes current value must be set to the new value. Otherwise it must be left unchanged./p> p>The dfn iddom-datatransfer-items>code>items/code>/dfn> attribute must return a code idthe-datatransfer-interface:datatransferitemlist-3>a href#datatransferitemlist>DataTransferItemList/a>/code> object associated with the code idthe-datatransfer-interface:datatransfer-16>a href#datatransfer>DataTransfer/a>/code> object./p> p>The dfn iddom-datatransfer-setdragimage>code>setDragImage(var>element/var>, var>x/var>, var>y/var>)/code>/dfn> method must run the following steps:/p> ol>li>p>If the code idthe-datatransfer-interface:datatransfer-17>a href#datatransfer>DataTransfer/a>/code> object is no longer associated with a a href#drag-data-store idthe-datatransfer-interface:drag-data-store-9>drag data store/a>, abort these steps. Nothing happens.li>p>If the a href#drag-data-store idthe-datatransfer-interface:drag-data-store-10>drag data store/a>s a href#drag-data-store-mode idthe-datatransfer-interface:drag-data-store-mode-3>mode/a> is not the a href#concept-dnd-rw idthe-datatransfer-interface:concept-dnd-rw-3>read/write mode/a>, abort these steps. Nothing happens.li>p>If var>element/var> is an code idthe-datatransfer-interface:the-img-element>a href#the-img-element>img/a>/code> element, then set the a href#drag-data-store-bitmap idthe-datatransfer-interface:drag-data-store-bitmap>drag data store bitmap/a> to the elements image (at its a hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic idthe-datatransfer-interface:intrinsic-dimensions data-x-internalintrinsic-dimensions>intrinsic size/a>); otherwise, set the a href#drag-data-store-bitmap idthe-datatransfer-interface:drag-data-store-bitmap-2>drag data store bitmap/a> to an image generated from the given element (the exact mechanism for doing so is not currently specified).li>p>Set the a href#drag-data-store-hot-spot-coordinate idthe-datatransfer-interface:drag-data-store-hot-spot-coordinate>drag data store hot spot coordinate/a> to the given var>x/var>, var>y/var> coordinate./ol> p>The dfn iddom-datatransfer-types>code>types/code>/dfn> attribute must return this code idthe-datatransfer-interface:datatransfer-18>a href#datatransfer>DataTransfer/a>/code> objects a href#concept-datatransfer-types idthe-datatransfer-interface:concept-datatransfer-types-2>types array/a>./p> p>The dfn iddom-datatransfer-getdata>code>getData(var>format/var>)/code>/dfn> method must run the following steps:/p> ol>li>p>If the code idthe-datatransfer-interface:datatransfer-19>a href#datatransfer>DataTransfer/a>/code> object is no longer associated with a a href#drag-data-store idthe-datatransfer-interface:drag-data-store-11>drag data store/a>, return the empty string and abort these steps.li>p>If the a href#drag-data-store idthe-datatransfer-interface:drag-data-store-12>drag data store/a>s a href#drag-data-store-mode idthe-datatransfer-interface:drag-data-store-mode-4>mode/a> is the a href#concept-dnd-p idthe-datatransfer-interface:concept-dnd-p>protected mode/a>, return the empty string and abort these steps.li>p>Let var>format/var> be the first argument, a idthe-datatransfer-interface:converted-to-ascii-lowercase hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>.li>p>Let var>convert-to-URL/var> be false.li>p>If var>format/var> equals code>text/code>, change it to code>text/plain/code>.li>p>If var>format/var> equals code>url/code>, change it to code>text/uri-list/code> and set var>convert-to-URL/var> to true.li>p>If there is no item in the a href#drag-data-store-item-list idthe-datatransfer-interface:drag-data-store-item-list-5>drag data store item list/a> whose a href#the-drag-data-item-kind idthe-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 idthe-datatransfer-interface:the-drag-data-item-type-string-2>type string/a> is equal to var>format/var>, return the empty string and abort these steps.li>p>Let var>result/var> be the data of the item in the a href#drag-data-store-item-list idthe-datatransfer-interface:drag-data-store-item-list-6>drag data store item list/a> whose a href#the-drag-data-item-kind idthe-datatransfer-interface:the-drag-data-item-kind-4>kind/a> is i>Plain Unicode string/i> and whose a href#the-drag-data-item-type-string idthe-datatransfer-interface:the-drag-data-item-type-string-3>type string/a> is equal to var>format/var>.li>p>If var>convert-to-URL/var> is true, then parse var>result/var> as appropriate for code>text/uri-list/code> data, and then set var>result/var> to the first URL from the list, if any, or the empty string otherwise. a href#refsRFC2483>RFC2483/a>li>p>Return var>result/var>./ol> p>The dfn iddom-datatransfer-setdata>code>setData(var>format/var>, var>data/var>)/code>/dfn> method must run the following steps:/p> ol>li>p>If the code idthe-datatransfer-interface:datatransfer-20>a href#datatransfer>DataTransfer/a>/code> object is no longer associated with a a href#drag-data-store idthe-datatransfer-interface:drag-data-store-13>drag data store/a>, abort these steps. Nothing happens.li>p>If the a href#drag-data-store idthe-datatransfer-interface:drag-data-store-14>drag data store/a>s a href#drag-data-store-mode idthe-datatransfer-interface:drag-data-store-mode-5>mode/a> is not the a href#concept-dnd-rw idthe-datatransfer-interface:concept-dnd-rw-4>read/write mode/a>, abort these steps. Nothing happens.li>p>Let var>format/var> be the first argument, a idthe-datatransfer-interface:converted-to-ascii-lowercase-2 hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>.li> p>If var>format/var> equals code>text/code>, change it to code>text/plain/code>./p> p>If var>format/var> equals code>url/code>, change it to code>text/uri-list/code>./p> li>p>Remove the item in the a href#drag-data-store-item-list idthe-datatransfer-interface:drag-data-store-item-list-7>drag data store item list/a> whose a href#the-drag-data-item-kind idthe-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 idthe-datatransfer-interface:the-drag-data-item-type-string-4>type string/a> is equal to var>format/var>, if there is one.li>p>Add an item to the a href#drag-data-store-item-list idthe-datatransfer-interface:drag-data-store-item-list-8>drag data store item list/a> whose a href#the-drag-data-item-kind idthe-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 idthe-datatransfer-interface:the-drag-data-item-type-string-5>type string/a> is equal to var>format/var>, and whose data is the string given by the methods second argument./ol> p>The dfn iddom-datatransfer-cleardata>code>clearData()/code>/dfn> method must run the following steps:/p> ol>li>p>If the code idthe-datatransfer-interface:datatransfer-21>a href#datatransfer>DataTransfer/a>/code> object is no longer associated with a a href#drag-data-store idthe-datatransfer-interface:drag-data-store-15>drag data store/a>, abort these steps. Nothing happens.li>p>If the a href#drag-data-store idthe-datatransfer-interface:drag-data-store-16>drag data store/a>s a href#drag-data-store-mode idthe-datatransfer-interface:drag-data-store-mode-6>mode/a> is not the a href#concept-dnd-rw idthe-datatransfer-interface:concept-dnd-rw-5>read/write mode/a>, abort these steps. Nothing happens.li>p>If the method was called with no arguments, remove each item in the a href#drag-data-store-item-list idthe-datatransfer-interface:drag-data-store-item-list-9>drag data store item list/a> whose a href#the-drag-data-item-kind idthe-datatransfer-interface:the-drag-data-item-kind-7>kind/a> is i>Plain Unicode string/i>, and abort these steps.li>p>Let var>format/var> be the first argument, a idthe-datatransfer-interface:converted-to-ascii-lowercase-3 hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>.li> p>If var>format/var> equals code>text/code>, change it to code>text/plain/code>./p> p>If var>format/var> equals code>url/code>, change it to code>text/uri-list/code>./p> li>p>Remove the item in the a href#drag-data-store-item-list idthe-datatransfer-interface:drag-data-store-item-list-10>drag data store item list/a> whose a href#the-drag-data-item-kind idthe-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 idthe-datatransfer-interface:the-drag-data-item-type-string-6>type string/a> is equal to var>format/var>, if there is one./ol> p classnote>The code idthe-datatransfer-interface:dom-datatransfer-cleardata-3>a href#dom-datatransfer-cleardata>clearData()/a>/code> method does not affect whether any files were included in the drag, so the code idthe-datatransfer-interface:dom-datatransfer-types-3>a href#dom-datatransfer-types>types/a>/code> attributes list might still not be empty after calling code idthe-datatransfer-interface:dom-datatransfer-cleardata-4>a href#dom-datatransfer-cleardata>clearData()/a>/code> (it would still contain the code>Files/code> string if any files were included in the drag)./p> p>The dfn iddom-datatransfer-files>code>files/code>/dfn> attribute must return a a href#live idthe-datatransfer-interface:live>live/a> code idthe-datatransfer-interface:filelist-3>a data-x-internalfilelist hrefhttps://w3c.github.io/FileAPI/#filelist-section>FileList/a>/code> sequence consisting of code idthe-datatransfer-interface:file>a data-x-internalfile hrefhttps://w3c.github.io/FileAPI/#dfn-file>File/a>/code> objects representing the files found by the following steps. Furthermore, for a given code idthe-datatransfer-interface:filelist-4>a data-x-internalfilelist hrefhttps://w3c.github.io/FileAPI/#filelist-section>FileList/a>/code> object and a given underlying file, the same code idthe-datatransfer-interface:file-2>a data-x-internalfile hrefhttps://w3c.github.io/FileAPI/#dfn-file>File/a>/code> object must be used each time./p> ol>li>p>Start with an empty list var>L/var>.li>p>If the code idthe-datatransfer-interface:datatransfer-22>a href#datatransfer>DataTransfer/a>/code> object is no longer associated with a a href#drag-data-store idthe-datatransfer-interface:drag-data-store-17>drag data store/a>, the code idthe-datatransfer-interface:filelist-5>a data-x-internalfilelist hrefhttps://w3c.github.io/FileAPI/#filelist-section>FileList/a>/code> is empty. Abort these steps; return the empty list var>L/var>.li>p>If the a href#drag-data-store idthe-datatransfer-interface:drag-data-store-18>drag data store/a>s a href#drag-data-store-mode idthe-datatransfer-interface:drag-data-store-mode-7>mode/a> is the a href#concept-dnd-p idthe-datatransfer-interface:concept-dnd-p-2>protected mode/a>, abort these steps; return the empty list var>L/var>.li>p>For each item in the a href#drag-data-store-item-list idthe-datatransfer-interface:drag-data-store-item-list-11>drag data store item list/a> whose a href#the-drag-data-item-kind idthe-datatransfer-interface:the-drag-data-item-kind-9>kind/a> is i>File/i> , add the items data (the file, in particular its name and contents, as well as its a href#the-drag-data-item-type-string idthe-datatransfer-interface:the-drag-data-item-type-string-7>type/a>) to the list var>L/var>.li>p>The files found by these steps are those in the list var>L/var>./ol> p classnote>This version of the API does not expose the types of the files during the drag./p> h5 idthe-datatransferitemlist-interface>span classsecno>6.7.3.1/span> The code idthe-datatransferitemlist-interface:datatransferitemlist>a href#datatransferitemlist>DataTransferItemList/a>/code> interfacea href#the-datatransferitemlist-interface classself-link>/a>/h5> p>Each code idthe-datatransferitemlist-interface:datatransfer>a href#datatransfer>DataTransfer/a>/code> object is associated with a code idthe-datatransferitemlist-interface:datatransferitemlist-2>a href#datatransferitemlist>DataTransferItemList/a>/code> object./p> pre classidl>ExposedWindowinterface dfn iddatatransferitemlist>DataTransferItemList/dfn> { readonly attribute unsigned long a href#dom-datatransferitemlist-length idthe-datatransferitemlist-interface:dom-datatransferitemlist-length>length/a>; a href#dom-datatransferitemlist-item>getter/a> a href#datatransferitem idthe-datatransferitemlist-interface:datatransferitem>DataTransferItem/a> (unsigned long index); a href#datatransferitem idthe-datatransferitemlist-interface:datatransferitem-2>DataTransferItem/a>? a href#dom-datatransferitemlist-add idthe-datatransferitemlist-interface:dom-datatransferitemlist-add>add/a>(DOMString data, DOMString type); a href#datatransferitem idthe-datatransferitemlist-interface:datatransferitem-3>DataTransferItem/a>? a href#dom-datatransferitemlist-add idthe-datatransferitemlist-interface:dom-datatransferitemlist-add-2>add/a>(a idthe-datatransferitemlist-interface:file hrefhttps://w3c.github.io/FileAPI/#dfn-file data-x-internalfile>File/a> data); void a href#dom-datatransferitemlist-remove idthe-datatransferitemlist-interface:dom-datatransferitemlist-remove>remove/a>(unsigned long index); void a href#dom-datatransferitemlist-clear idthe-datatransferitemlist-interface:dom-datatransferitemlist-clear>clear/a>();};/pre> dl classdomintro>dt>var>items/var> . code idthe-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 idthe-datatransferitemlist-interface:drag-data-store>drag data store/a>.dt>var>items/var>var>index/var>dd> p>Returns the code idthe-datatransferitemlist-interface:datatransferitem-4>a href#datatransferitem>DataTransferItem/a>/code> object representing the var>index/var>th entry in the a href#drag-data-store idthe-datatransferitemlist-interface:drag-data-store-2>drag data store/a>./p> dt>var>items/var> . code idthe-datatransferitemlist-interface:dom-datatransferitemlist-remove-2>a href#dom-datatransferitemlist-remove>remove/a>/code>(var>index/var>)dd> p>Removes the var>index/var>th entry in the a href#drag-data-store idthe-datatransferitemlist-interface:drag-data-store-3>drag data store/a>./p> dt>var>items/var> . code idthe-datatransferitemlist-interface:dom-datatransferitemlist-clear-2>a href#dom-datatransferitemlist-clear>clear/a>/code>()dd> p>Removes all the entries in the a href#drag-data-store idthe-datatransferitemlist-interface:drag-data-store-4>drag data store/a>./p> dt>var>items/var> . code idthe-datatransferitemlist-interface:dom-datatransferitemlist-add-3>a href#dom-datatransferitemlist-add>add/a>/code>(var>data/var>)dt>var>items/var> . code idthe-datatransferitemlist-interface:dom-datatransferitemlist-add-4>a href#dom-datatransferitemlist-add>add/a>/code>(var>data/var>, var>type/var>)dd> p>Adds a new entry for the given data to the a href#drag-data-store idthe-datatransferitemlist-interface:drag-data-store-5>drag data store/a>. If the data is plain text then a var>type/var> string has to be provided also./p> /dl> p>While the code idthe-datatransferitemlist-interface:datatransferitemlist-3>a href#datatransferitemlist>DataTransferItemList/a>/code> objects code idthe-datatransferitemlist-interface:datatransfer-2>a href#datatransfer>DataTransfer/a>/code> object is associated with a a href#drag-data-store idthe-datatransferitemlist-interface:drag-data-store-6>drag data store/a>, the code idthe-datatransferitemlist-interface:datatransferitemlist-4>a href#datatransferitemlist>DataTransferItemList/a>/code> objects i>mode/i> is the same as the a href#drag-data-store-mode idthe-datatransferitemlist-interface:drag-data-store-mode>drag data store mode/a>. When the code idthe-datatransferitemlist-interface:datatransferitemlist-5>a href#datatransferitemlist>DataTransferItemList/a>/code> objects code idthe-datatransferitemlist-interface:datatransfer-3>a href#datatransfer>DataTransfer/a>/code> object is em>not/em> associated with a a href#drag-data-store idthe-datatransferitemlist-interface:drag-data-store-7>drag data store/a>, the code idthe-datatransferitemlist-interface:datatransferitemlist-6>a href#datatransferitemlist>DataTransferItemList/a>/code> objects i>mode/i> is the i>disabled mode/i>. The a href#drag-data-store idthe-datatransferitemlist-interface:drag-data-store-8>drag data store/a> referenced in this section (which is used only when the code idthe-datatransferitemlist-interface:datatransferitemlist-7>a href#datatransferitemlist>DataTransferItemList/a>/code> object is not in the i>disabled mode/i>) is the a href#drag-data-store idthe-datatransferitemlist-interface:drag-data-store-9>drag data store/a> with which the code idthe-datatransferitemlist-interface:datatransferitemlist-8>a href#datatransferitemlist>DataTransferItemList/a>/code> objects code idthe-datatransferitemlist-interface:datatransfer-4>a href#datatransfer>DataTransfer/a>/code> object is associated./p> p>The dfn iddom-datatransferitemlist-length>code>length/code>/dfn> attribute must return zero if the object is in the i>disabled mode/i>; otherwise it must return the number of items in the a href#drag-data-store-item-list idthe-datatransferitemlist-interface:drag-data-store-item-list>drag data store item list/a>./p> p>When a code idthe-datatransferitemlist-interface:datatransferitemlist-9>a href#datatransferitemlist>DataTransferItemList/a>/code> object is not in the i>disabled mode/i>, its a idthe-datatransferitemlist-interface:supported-property-indices hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a> are the numbers in the range span>0 .. var>n/var>-1/span>, where var>n/var> is the number of items in the a href#drag-data-store-item-list idthe-datatransferitemlist-interface:drag-data-store-item-list-2>drag data store item list/a>./p> p iddom-datatransferitemlist-item>To a idthe-datatransferitemlist-interface:determine-the-value-of-an-indexed-property hrefhttps://heycam.github.io/webidl/#dfn-determine-the-value-of-an-indexed-property data-x-internaldetermine-the-value-of-an-indexed-property>determine the value of an indexed property/a> var>i/var> of a code idthe-datatransferitemlist-interface:datatransferitemlist-10>a href#datatransferitemlist>DataTransferItemList/a>/code> object, the user agent must return a code idthe-datatransferitemlist-interface:datatransferitem-5>a href#datatransferitem>DataTransferItem/a>/code> object representing the var>i/var>th item in the a href#drag-data-store idthe-datatransferitemlist-interface:drag-data-store-10>drag data store/a>. The same object must be returned each time a particular item is obtained from this code idthe-datatransferitemlist-interface:datatransferitemlist-11>a href#datatransferitemlist>DataTransferItemList/a>/code> object. The code idthe-datatransferitemlist-interface:datatransferitem-6>a href#datatransferitem>DataTransferItem/a>/code> object must be associated with the same code idthe-datatransferitemlist-interface:datatransfer-5>a href#datatransfer>DataTransfer/a>/code> object as the code idthe-datatransferitemlist-interface:datatransferitemlist-12>a href#datatransferitemlist>DataTransferItemList/a>/code> object when it is first created./p> p>The dfn iddom-datatransferitemlist-add>code>add()/code>/dfn> method must run the following steps:/p> ol>li>p>If the code idthe-datatransferitemlist-interface:datatransferitemlist-13>a href#datatransferitemlist>DataTransferItemList/a>/code> object is not in the i idthe-datatransferitemlist-interface:concept-dnd-rw>a href#concept-dnd-rw>read/write mode/a>/i>, return null and abort these steps.li> p>Jump to the appropriate set of steps from the following list:/p> dl classswitch>dt>If the first argument to the method is a stringdd> p>If there is already an item in the a href#drag-data-store-item-list idthe-datatransferitemlist-interface:drag-data-store-item-list-3>drag data store item list/a> whose a href#the-drag-data-item-kind idthe-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 idthe-datatransferitemlist-interface:the-drag-data-item-type-string>type string/a> is equal to the value of the methods second argument, a idthe-datatransferitemlist-interface:converted-to-ascii-lowercase hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>, then throw a a idthe-datatransferitemlist-interface:notsupportederror hrefhttps://heycam.github.io/webidl/#notsupportederror data-x-internalnotsupportederror>code>NotSupportedError/code>/a> code idthe-datatransferitemlist-interface:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps./p> p>Otherwise, add an item to the a href#drag-data-store-item-list idthe-datatransferitemlist-interface:drag-data-store-item-list-4>drag data store item list/a> whose a href#the-drag-data-item-kind idthe-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 idthe-datatransferitemlist-interface:the-drag-data-item-type-string-2>type string/a> is equal to the value of the methods second argument, a idthe-datatransferitemlist-interface:converted-to-ascii-lowercase-2 hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>, and whose data is the string given by the methods first argument./p> dt>If the first argument to the method is a code idthe-datatransferitemlist-interface:file-2>a data-x-internalfile hrefhttps://w3c.github.io/FileAPI/#dfn-file>File/a>/code>dd> p>Add an item to the a href#drag-data-store-item-list idthe-datatransferitemlist-interface:drag-data-store-item-list-5>drag data store item list/a> whose a href#the-drag-data-item-kind idthe-datatransferitemlist-interface:the-drag-data-item-kind-3>kind/a> is i>File/i>, whose a href#the-drag-data-item-type-string idthe-datatransferitemlist-interface:the-drag-data-item-type-string-3>type string/a> is the code idthe-datatransferitemlist-interface:dom-blob-type>a data-x-internaldom-blob-type hrefhttps://w3c.github.io/FileAPI/#dfn-type>type/a>/code> of the code idthe-datatransferitemlist-interface:file-3>a data-x-internalfile hrefhttps://w3c.github.io/FileAPI/#dfn-file>File/a>/code>, a idthe-datatransferitemlist-interface:converted-to-ascii-lowercase-3 hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>, and whose data is the same as the code idthe-datatransferitemlist-interface:file-4>a data-x-internalfile hrefhttps://w3c.github.io/FileAPI/#dfn-file>File/a>/code>s data./p> /dl> li>p>a href#dom-datatransferitemlist-item>Determine the value of the indexed property/a> corresponding to the newly added item, and return that value (a newly created code idthe-datatransferitemlist-interface:datatransferitem-7>a href#datatransferitem>DataTransferItem/a>/code> object)./ol> p>The dfn iddom-datatransferitemlist-remove>code>remove()/code>/dfn> method, when invoked with the argument var>i/var>, must run these steps:/p> ol>li>p>If the code idthe-datatransferitemlist-interface:datatransferitemlist-14>a href#datatransferitemlist>DataTransferItemList/a>/code> object is not in the i idthe-datatransferitemlist-interface:concept-dnd-rw-2>a href#concept-dnd-rw>read/write mode/a>/i>, throw an a idthe-datatransferitemlist-interface:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idthe-datatransferitemlist-interface:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Remove the var>i/var>th item from the a href#drag-data-store idthe-datatransferitemlist-interface:drag-data-store-11>drag data store/a>./ol> p>The dfn iddom-datatransferitemlist-clear>code>clear()/code>/dfn> method, if the code idthe-datatransferitemlist-interface:datatransferitemlist-15>a href#datatransferitemlist>DataTransferItemList/a>/code> object is in the i idthe-datatransferitemlist-interface:concept-dnd-rw-3>a href#concept-dnd-rw>read/write mode/a>/i>, must remove all the items from the a href#drag-data-store idthe-datatransferitemlist-interface:drag-data-store-12>drag data store/a>. Otherwise, it must do nothing./p> h5 idthe-datatransferitem-interface>span classsecno>6.7.3.2/span> The code idthe-datatransferitem-interface:datatransferitem>a href#datatransferitem>DataTransferItem/a>/code> interfacea href#the-datatransferitem-interface classself-link>/a>/h5> p>Each code idthe-datatransferitem-interface:datatransferitem-2>a href#datatransferitem>DataTransferItem/a>/code> object is associated with a code idthe-datatransferitem-interface:datatransfer>a href#datatransfer>DataTransfer/a>/code> object./p> pre classidl>ExposedWindowinterface dfn iddatatransferitem>DataTransferItem/dfn> { readonly attribute DOMString a href#dom-datatransferitem-kind idthe-datatransferitem-interface:dom-datatransferitem-kind>kind/a>; readonly attribute DOMString a href#dom-datatransferitem-type idthe-datatransferitem-interface:dom-datatransferitem-type>type/a>; void a href#dom-datatransferitem-getasstring idthe-datatransferitem-interface:dom-datatransferitem-getasstring>getAsString/a>(a href#functionstringcallback idthe-datatransferitem-interface:functionstringcallback>FunctionStringCallback/a>? _callback); a idthe-datatransferitem-interface:file hrefhttps://w3c.github.io/FileAPI/#dfn-file data-x-internalfile>File/a>? a href#dom-datatransferitem-getasfile idthe-datatransferitem-interface:dom-datatransferitem-getasfile>getAsFile/a>();};callback dfn idfunctionstringcallback>FunctionStringCallback/dfn> void (DOMString data);/pre> dl classdomintro>dt>var>item/var> . code idthe-datatransferitem-interface:dom-datatransferitem-kind-2>a href#dom-datatransferitem-kind>kind/a>/code>dd> p>Returns a href#the-drag-data-item-kind idthe-datatransferitem-interface:the-drag-data-item-kind>the drag data item kind/a>, one of: string, file./p> dt>var>item/var> . code idthe-datatransferitem-interface:dom-datatransferitem-type-2>a href#dom-datatransferitem-type>type/a>/code>dd> p>Returns a href#the-drag-data-item-type-string idthe-datatransferitem-interface:the-drag-data-item-type-string>the drag data item type string/a>./p> dt>var>item/var> . code idthe-datatransferitem-interface:dom-datatransferitem-getasstring-2>a href#dom-datatransferitem-getasstring>getAsString/a>/code>(var>callback/var>)dd> p>Invokes the callback with the string data as the argument, if a href#the-drag-data-item-kind idthe-datatransferitem-interface:the-drag-data-item-kind-2>the drag data item kind/a> is i>Plain Unicode string/i>./p> dt>var>file/var> var>item/var> . code idthe-datatransferitem-interface:dom-datatransferitem-getasfile-2>a href#dom-datatransferitem-getasfile>getAsFile/a>/code>()dd> p>Returns a code idthe-datatransferitem-interface:file-2>a data-x-internalfile hrefhttps://w3c.github.io/FileAPI/#dfn-file>File/a>/code> object, if a href#the-drag-data-item-kind idthe-datatransferitem-interface:the-drag-data-item-kind-3>the drag data item kind/a> is i>File/i>./p> /dl> p>While the code idthe-datatransferitem-interface:datatransferitem-3>a href#datatransferitem>DataTransferItem/a>/code> objects code idthe-datatransferitem-interface:datatransfer-2>a href#datatransfer>DataTransfer/a>/code> object is associated with a a href#drag-data-store idthe-datatransferitem-interface:drag-data-store>drag data store/a> and that a href#drag-data-store idthe-datatransferitem-interface:drag-data-store-2>drag data store/a>s a href#drag-data-store-item-list idthe-datatransferitem-interface:drag-data-store-item-list>drag data store item list/a> still contains the item that the code idthe-datatransferitem-interface:datatransferitem-4>a href#datatransferitem>DataTransferItem/a>/code> object represents, the code idthe-datatransferitem-interface:datatransferitem-5>a href#datatransferitem>DataTransferItem/a>/code> objects i>mode/i> is the same as the a href#drag-data-store-mode idthe-datatransferitem-interface:drag-data-store-mode>drag data store mode/a>. When the code idthe-datatransferitem-interface:datatransferitem-6>a href#datatransferitem>DataTransferItem/a>/code> objects code idthe-datatransferitem-interface:datatransfer-3>a href#datatransfer>DataTransfer/a>/code> object is em>not/em> associated with a a href#drag-data-store idthe-datatransferitem-interface:drag-data-store-3>drag data store/a>, or if the item that the code idthe-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 idthe-datatransferitem-interface:drag-data-store-item-list-2>drag data store item list/a>, the code idthe-datatransferitem-interface:datatransferitem-8>a href#datatransferitem>DataTransferItem/a>/code> objects i>mode/i> is the i>disabled mode/i>. The a href#drag-data-store idthe-datatransferitem-interface:drag-data-store-4>drag data store/a> referenced in this section (which is used only when the code idthe-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 idthe-datatransferitem-interface:drag-data-store-5>drag data store/a> with which the code idthe-datatransferitem-interface:datatransferitem-10>a href#datatransferitem>DataTransferItem/a>/code> objects code idthe-datatransferitem-interface:datatransfer-4>a href#datatransfer>DataTransfer/a>/code> object is associated./p> p>The dfn iddom-datatransferitem-kind>code>kind/code>/dfn> attribute must return the empty string if the code idthe-datatransferitem-interface:datatransferitem-11>a href#datatransferitem>DataTransferItem/a>/code> object is in the i>disabled mode/i>; otherwise it must return the string given in the cell from the second column of the following table from the row whose cell in the first column contains a href#the-drag-data-item-kind idthe-datatransferitem-interface:the-drag-data-item-kind-4>the drag data item kind/a> of the item represented by the code idthe-datatransferitem-interface:datatransferitem-12>a href#datatransferitem>DataTransferItem/a>/code> object:/p> table>thead>tr>th> Kind th> String tbody>tr>td> i>Plain Unicode string/i> td> code>string/code> tr>td> i>File/i> td> code>file/code> /table> p>The dfn iddom-datatransferitem-type>code>type/code>/dfn> attribute must return the empty string if the code idthe-datatransferitem-interface:datatransferitem-13>a href#datatransferitem>DataTransferItem/a>/code> object is in the i>disabled mode/i>; otherwise it must return a href#the-drag-data-item-type-string idthe-datatransferitem-interface:the-drag-data-item-type-string-2>the drag data item type string/a> of the item represented by the code idthe-datatransferitem-interface:datatransferitem-14>a href#datatransferitem>DataTransferItem/a>/code> object./p> p>The dfn iddom-datatransferitem-getasstring>code>getAsString(var>callback/var>)/code>/dfn> method must run the following steps:/p> ol>li>p>If the var>callback/var> is null, abort these steps.li>p>If the code idthe-datatransferitem-interface:datatransferitem-15>a href#datatransferitem>DataTransferItem/a>/code> object is not in the i idthe-datatransferitem-interface:concept-dnd-rw>a href#concept-dnd-rw>read/write mode/a>/i> or the i idthe-datatransferitem-interface:concept-dnd-ro>a href#concept-dnd-ro>read-only mode/a>/i>, abort these steps. The callback is never invoked.li>p>If a href#the-drag-data-item-kind idthe-datatransferitem-interface:the-drag-data-item-kind-5>the drag data item kind/a> is not i>Plain Unicode string/i>, abort these steps. The callback is never invoked.li>p>Otherwise, a href#queue-a-task idthe-datatransferitem-interface:queue-a-task>queue a task/a> to invoke var>callback/var>, passing the actual data of the item represented by the code idthe-datatransferitem-interface:datatransferitem-16>a href#datatransferitem>DataTransferItem/a>/code> object as the argument./ol> p>The dfn iddom-datatransferitem-getasfile>code>getAsFile()/code>/dfn> method must run the following steps:/p> ol>li>p>If the code idthe-datatransferitem-interface:datatransferitem-17>a href#datatransferitem>DataTransferItem/a>/code> object is not in the i idthe-datatransferitem-interface:concept-dnd-rw-2>a href#concept-dnd-rw>read/write mode/a>/i> or the i idthe-datatransferitem-interface:concept-dnd-ro-2>a href#concept-dnd-ro>read-only mode/a>/i>, return null and abort these steps.li>p>If a href#the-drag-data-item-kind idthe-datatransferitem-interface:the-drag-data-item-kind-6>the drag data item kind/a> is not i>File/i>, then return null and abort these steps.li>p>Return a new code idthe-datatransferitem-interface:file-3>a data-x-internalfile hrefhttps://w3c.github.io/FileAPI/#dfn-file>File/a>/code> object representing the actual data of the item represented by the code idthe-datatransferitem-interface:datatransferitem-18>a href#datatransferitem>DataTransferItem/a>/code> object./p> /ol> h4 idthe-dragevent-interface>span classsecno>6.7.4/span> The code idthe-dragevent-interface:dragevent>a href#dragevent>DragEvent/a>/code> interfacea href#the-dragevent-interface classself-link>/a>/h4> p>The drag-and-drop processing model involves several events. They all use the code idthe-dragevent-interface:dragevent-2>a href#dragevent>DragEvent/a>/code> interface./p> pre classidl>ExposedWindow, Constructor(DOMString type, optional a href#drageventinit idthe-dragevent-interface:drageventinit>DragEventInit/a> eventInitDict)interface dfn iddragevent>DragEvent/dfn> : a idthe-dragevent-interface:mouseevent hrefhttps://w3c.github.io/uievents/#mouseevent data-x-internalmouseevent>MouseEvent/a> { readonly attribute a href#datatransfer idthe-dragevent-interface:datatransfer>DataTransfer/a>? a href#dom-dragevent-datatransfer idthe-dragevent-interface:dom-dragevent-datatransfer>dataTransfer/a>;};dictionary dfn iddrageventinit>DragEventInit/dfn> : a idthe-dragevent-interface:mouseeventinit hrefhttps://w3c.github.io/uievents/#dictdef-mouseeventinit data-x-internalmouseeventinit>MouseEventInit/a> { a href#datatransfer idthe-dragevent-interface:datatransfer-2>DataTransfer/a>? dataTransfer null;};/pre> dl classdomintro>dt>var>event/var> . code idthe-dragevent-interface:dom-dragevent-datatransfer-2>a href#dom-dragevent-datatransfer>dataTransfer/a>/code>dd> p>Returns the code idthe-dragevent-interface:datatransfer-3>a href#datatransfer>DataTransfer/a>/code> object for the event./p> /dl> p classnote>Although, for consistency with other event interfaces, the code idthe-dragevent-interface:dragevent-3>a href#dragevent>DragEvent/a>/code> interface has a constructor, it is not particularly useful. In particular, theres no way to create a useful code idthe-dragevent-interface:datatransfer-4>a href#datatransfer>DataTransfer/a>/code> object from script, as code idthe-dragevent-interface:datatransfer-5>a href#datatransfer>DataTransfer/a>/code> objects have a processing and security model that is coordinated by the browser during drag-and-drops./p> p>The dfn iddom-dragevent-datatransfer>code>dataTransfer/code>/dfn> attribute of the code idthe-dragevent-interface:dragevent-4>a href#dragevent>DragEvent/a>/code> interface must return the value it was initialized to. It represents the context information for the event./p> p>When a user agent is required to dfn idfire-a-dnd-event>fire a DND event/dfn> named var>e/var> at an element, using a particular a href#drag-data-store idthe-dragevent-interface:drag-data-store>drag data store/a>, and optionally with a specific var>related target/var>, the user agent must run the following steps:/p> ol>li>Let var>dataDragStoreWasChanged/var> be false.li>p>If no specific var>related target/var> was provided, set var>related target/var> to null.li>p>Let var>window/var> be the code idthe-dragevent-interface:window>a href#window>Window/a>/code> object of the code idthe-dragevent-interface:document>a href#document>Document/a>/code> object of the specified target element.li> p>If var>e/var> is code idthe-dragevent-interface:event-dnd-dragstart>a href#event-dnd-dragstart>dragstart/a>/code>, then set the a href#drag-data-store-mode idthe-dragevent-interface:drag-data-store-mode>drag data store mode/a> to the a href#concept-dnd-rw idthe-dragevent-interface:concept-dnd-rw>read/write mode/a> and set var>dataDragStoreWasChanged/var> to true./p> p>If var>e/var> is code idthe-dragevent-interface:event-dnd-drop>a href#event-dnd-drop>drop/a>/code>, set the a href#drag-data-store-mode idthe-dragevent-interface:drag-data-store-mode-2>drag data store mode/a> to the a href#concept-dnd-ro idthe-dragevent-interface:concept-dnd-ro>read-only mode/a>./p> li>p>Let var>dataTransfer/var> be a newly created code idthe-dragevent-interface:datatransfer-6>a href#datatransfer>DataTransfer/a>/code> object associated with the given a href#drag-data-store idthe-dragevent-interface:drag-data-store-2>drag data store/a>.li>p ideffectAllowed-initialisation>Set the code idthe-dragevent-interface:dom-datatransfer-effectallowed>a href#dom-datatransfer-effectallowed>effectAllowed/a>/code> attribute to the a href#drag-data-store idthe-dragevent-interface:drag-data-store-3>drag data store/a>s a href#drag-data-store-allowed-effects-state idthe-dragevent-interface:drag-data-store-allowed-effects-state>drag data store allowed effects state/a>.li> p iddropEffect-initialisation>Set the code idthe-dragevent-interface:dom-datatransfer-dropeffect>a href#dom-datatransfer-dropeffect>dropEffect/a>/code> attribute to code idthe-dragevent-interface:dom-datatransfer-dropeffect-none>a href#dom-datatransfer-dropeffect-none>none/a>/code> if var>e/var> is code idthe-dragevent-interface:event-dnd-dragstart-2>a href#event-dnd-dragstart>dragstart/a>/code>, code idthe-dragevent-interface:event-dnd-drag>a href#event-dnd-drag>drag/a>/code>, code idthe-dragevent-interface:event-dnd-dragexit>a href#event-dnd-dragexit>dragexit/a>/code>, or code idthe-dragevent-interface:event-dnd-dragleave>a href#event-dnd-dragleave>dragleave/a>/code>; to the value corresponding to the a href#current-drag-operation idthe-dragevent-interface:current-drag-operation>current drag operation/a> if var>e/var> is code idthe-dragevent-interface:event-dnd-drop-2>a href#event-dnd-drop>drop/a>/code> or code idthe-dragevent-interface:event-dnd-dragend>a href#event-dnd-dragend>dragend/a>/code>; and to a value based on the code idthe-dragevent-interface:dom-datatransfer-effectallowed-2>a href#dom-datatransfer-effectallowed>effectAllowed/a>/code> attributes value and the drag-and-drop source, as given by the following table, otherwise (i.e. if var>e/var> is code idthe-dragevent-interface:event-dnd-dragenter>a href#event-dnd-dragenter>dragenter/a>/code> or code idthe-dragevent-interface:event-dnd-dragover>a href#event-dnd-dragover>dragover/a>/code>):/p> table>thead>tr>th>code idthe-dragevent-interface:dom-datatransfer-effectallowed-3>a href#dom-datatransfer-effectallowed>effectAllowed/a>/code>th>code idthe-dragevent-interface:dom-datatransfer-dropeffect-2>a href#dom-datatransfer-dropeffect>dropEffect/a>/code>tbody>tr>td>code idthe-dragevent-interface:dom-datatransfer-effectallowed-none>a href#dom-datatransfer-effectallowed-none>none/a>/code>td>code idthe-dragevent-interface:dom-datatransfer-dropeffect-none-2>a href#dom-datatransfer-dropeffect-none>none/a>/code>tr>td>code idthe-dragevent-interface:dom-datatransfer-effectallowed-copy>a href#dom-datatransfer-effectallowed-copy>copy/a>/code>td>code idthe-dragevent-interface:dom-datatransfer-dropeffect-copy>a href#dom-datatransfer-dropeffect-copy>copy/a>/code>tr>td>code idthe-dragevent-interface:dom-datatransfer-effectallowed-copylink>a href#dom-datatransfer-effectallowed-copylink>copyLink/a>/code>td>code idthe-dragevent-interface:dom-datatransfer-dropeffect-copy-2>a href#dom-datatransfer-dropeffect-copy>copy/a>/code>, or, a href#concept-platform-dropeffect-override idthe-dragevent-interface:concept-platform-dropeffect-override>if appropriate/a>, code idthe-dragevent-interface:dom-datatransfer-dropeffect-link>a href#dom-datatransfer-dropeffect-link>link/a>/code>tr>td>code idthe-dragevent-interface:dom-datatransfer-effectallowed-copymove>a href#dom-datatransfer-effectallowed-copymove>copyMove/a>/code>td>code idthe-dragevent-interface:dom-datatransfer-dropeffect-copy-3>a href#dom-datatransfer-dropeffect-copy>copy/a>/code>, or, a href#concept-platform-dropeffect-override idthe-dragevent-interface:concept-platform-dropeffect-override-2>if appropriate/a>, code idthe-dragevent-interface:dom-datatransfer-dropeffect-move>a href#dom-datatransfer-dropeffect-move>move/a>/code>tr>td>code idthe-dragevent-interface:dom-datatransfer-effectallowed-all>a href#dom-datatransfer-effectallowed-all>all/a>/code>td>code idthe-dragevent-interface:dom-datatransfer-dropeffect-copy-4>a href#dom-datatransfer-dropeffect-copy>copy/a>/code>, or, a href#concept-platform-dropeffect-override idthe-dragevent-interface:concept-platform-dropeffect-override-3>if appropriate/a>, either code idthe-dragevent-interface:dom-datatransfer-dropeffect-link-2>a href#dom-datatransfer-dropeffect-link>link/a>/code> or code idthe-dragevent-interface:dom-datatransfer-dropeffect-move-2>a href#dom-datatransfer-dropeffect-move>move/a>/code>tr>td>code idthe-dragevent-interface:dom-datatransfer-effectallowed-link>a href#dom-datatransfer-effectallowed-link>link/a>/code>td>code idthe-dragevent-interface:dom-datatransfer-dropeffect-link-3>a href#dom-datatransfer-dropeffect-link>link/a>/code>tr>td>code idthe-dragevent-interface:dom-datatransfer-effectallowed-linkmove>a href#dom-datatransfer-effectallowed-linkmove>linkMove/a>/code>td>code idthe-dragevent-interface:dom-datatransfer-dropeffect-link-4>a href#dom-datatransfer-dropeffect-link>link/a>/code>, or, a href#concept-platform-dropeffect-override idthe-dragevent-interface:concept-platform-dropeffect-override-4>if appropriate/a>, code idthe-dragevent-interface:dom-datatransfer-dropeffect-move-3>a href#dom-datatransfer-dropeffect-move>move/a>/code>tr>td>code idthe-dragevent-interface:dom-datatransfer-effectallowed-move>a href#dom-datatransfer-effectallowed-move>move/a>/code>td>code idthe-dragevent-interface:dom-datatransfer-dropeffect-move-4>a href#dom-datatransfer-dropeffect-move>move/a>/code>tr>td>code idthe-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 controltd>code idthe-dragevent-interface:dom-datatransfer-dropeffect-move-5>a href#dom-datatransfer-dropeffect-move>move/a>/code>, or, a href#concept-platform-dropeffect-override idthe-dragevent-interface:concept-platform-dropeffect-override-5>if appropriate/a>, either code idthe-dragevent-interface:dom-datatransfer-dropeffect-copy-5>a href#dom-datatransfer-dropeffect-copy>copy/a>/code> or code idthe-dragevent-interface:dom-datatransfer-dropeffect-link-5>a href#dom-datatransfer-dropeffect-link>link/a>/code>tr>td>code idthe-dragevent-interface:dom-datatransfer-effectallowed-uninitialized-2>a href#dom-datatransfer-effectallowed-uninitialized>uninitialized/a>/code> when what is being dragged is a selectiontd>code idthe-dragevent-interface:dom-datatransfer-dropeffect-copy-6>a href#dom-datatransfer-dropeffect-copy>copy/a>/code>, or, a href#concept-platform-dropeffect-override idthe-dragevent-interface:concept-platform-dropeffect-override-6>if appropriate/a>, either code idthe-dragevent-interface:dom-datatransfer-dropeffect-link-6>a href#dom-datatransfer-dropeffect-link>link/a>/code> or code idthe-dragevent-interface:dom-datatransfer-dropeffect-move-6>a href#dom-datatransfer-dropeffect-move>move/a>/code>tr>td>code idthe-dragevent-interface:dom-datatransfer-effectallowed-uninitialized-3>a href#dom-datatransfer-effectallowed-uninitialized>uninitialized/a>/code> when what is being dragged is an code idthe-dragevent-interface:the-a-element>a href#the-a-element>a/a>/code> element with an code idthe-dragevent-interface:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attributetd>code idthe-dragevent-interface:dom-datatransfer-dropeffect-link-7>a href#dom-datatransfer-dropeffect-link>link/a>/code>, or, a href#concept-platform-dropeffect-override idthe-dragevent-interface:concept-platform-dropeffect-override-7>if appropriate/a>, either code idthe-dragevent-interface:dom-datatransfer-dropeffect-copy-7>a href#dom-datatransfer-dropeffect-copy>copy/a>/code> or code idthe-dragevent-interface:dom-datatransfer-dropeffect-move-7>a href#dom-datatransfer-dropeffect-move>move/a>/code>tr>td>Any other casetd>code idthe-dragevent-interface:dom-datatransfer-dropeffect-copy-8>a href#dom-datatransfer-dropeffect-copy>copy/a>/code>, or, a href#concept-platform-dropeffect-override idthe-dragevent-interface:concept-platform-dropeffect-override-8>if appropriate/a>, either code idthe-dragevent-interface:dom-datatransfer-dropeffect-link-8>a href#dom-datatransfer-dropeffect-link>link/a>/code> or code idthe-dragevent-interface:dom-datatransfer-dropeffect-move-8>a href#dom-datatransfer-dropeffect-move>move/a>/code>/table> p>Where the table above provides dfn idconcept-platform-dropeffect-override>possibly appropriate alternatives/dfn>, user agents may instead use the listed alternative values if platform conventions dictate that the user has requested those alternate effects./p> p classexample>For example, Windows platform conventions are such that dragging while holding the alt key indicates a preference for linking the data, rather than moving or copying it. Therefore, on a Windows system, if code idthe-dragevent-interface:dom-datatransfer-dropeffect-link-9>a href#dom-datatransfer-dropeffect-link>link/a>/code> is an option according to the table above while the alt key is depressed, the user agent could select that instead of code idthe-dragevent-interface:dom-datatransfer-dropeffect-copy-9>a href#dom-datatransfer-dropeffect-copy>copy/a>/code> or code idthe-dragevent-interface:dom-datatransfer-dropeffect-move-9>a href#dom-datatransfer-dropeffect-move>move/a>/code>./p> li>p>Let var>event/var> be the result of a idthe-dragevent-interface:creating-an-event hrefhttps://dom.spec.whatwg.org/#concept-event-create data-x-internalcreating-an-event>creating an event/a> using code idthe-dragevent-interface:dragevent-5>a href#dragevent>DragEvent/a>/code>.li>p>Initialize var>event/var>s code idthe-dragevent-interface:dom-event-type>a data-x-internaldom-event-type hrefhttps://dom.spec.whatwg.org/#dom-event-type>type/a>/code> attribute to var>e/var>, its code idthe-dragevent-interface:dom-event-bubbles>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute to true, its code idthe-dragevent-interface:dom-uievent-view>a data-x-internaldom-uievent-view hrefhttps://w3c.github.io/uievents/#dom-uievent-view>view/a>/code> attribute to var>window/var>, its code idthe-dragevent-interface:dom-mouseevent-relatedtarget>a data-x-internaldom-mouseevent-relatedtarget hrefhttps://w3c.github.io/uievents/#dom-mouseevent-relatedtarget>relatedTarget/a>/code> attribute to var>related target/var>, and its code idthe-dragevent-interface:dom-dragevent-datatransfer-3>a href#dom-dragevent-datatransfer>dataTransfer/a>/code> attribute to var>dataTransfer/var>.li>p>If var>e/var> is not code idthe-dragevent-interface:event-dnd-dragexit-2>a href#event-dnd-dragexit>dragexit/a>/code>, code idthe-dragevent-interface:event-dnd-dragleave-2>a href#event-dnd-dragleave>dragleave/a>/code>, or code idthe-dragevent-interface:event-dnd-dragend-2>a href#event-dnd-dragend>dragend/a>/code>, then initialize var>event/var>s code idthe-dragevent-interface:dom-event-cancelable>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute to true.li> p>Initialize var>event/var>s mouse and key attributes initialized according to the state of the input devices as they would be for user interaction events./p> p>If there is no relevant pointing device, then initialize var>event/var>s code>screenX/code>, code>screenY/code>, code>clientX/code>, code>clientY/code>, and code>button/code> attributes to 0./p> li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-dispatch idthe-dragevent-interface:concept-event-dispatch data-x-internalconcept-event-dispatch>Dispatch/a> var>event/var> at the specified target element.li>p>Set the a href#drag-data-store-allowed-effects-state idthe-dragevent-interface:drag-data-store-allowed-effects-state-2>drag data store allowed effects state/a> to the current value of var>dataTransfer/var>s code idthe-dragevent-interface:dom-datatransfer-effectallowed-4>a href#dom-datatransfer-effectallowed>effectAllowed/a>/code> attribute. (It can only have changed value if var>e/var> is code idthe-dragevent-interface:event-dnd-dragstart-3>a href#event-dnd-dragstart>dragstart/a>/code>.)li>p>If var>dataDragStoreWasChanged/var> is true, then set the a href#drag-data-store-mode idthe-dragevent-interface:drag-data-store-mode-3>drag data store mode/a> back to the a href#concept-dnd-p idthe-dragevent-interface:concept-dnd-p>protected mode/a>.li>p>Break the association between var>dataTransfer/var> and the a href#drag-data-store idthe-dragevent-interface:drag-data-store-4>drag data store/a>./ol> h4 iddrag-and-drop-processing-model>span classsecno>6.7.5/span> Processing modela href#drag-and-drop-processing-model classself-link>/a>/h4> p>When the user attempts to begin a drag operation, the user agent must run the following steps. User agents must act as if these steps were run even if the drag actually started in another document or application and the user agent was not aware that the drag was occurring until it intersected with a document under the user agents purview./p> ol>li> p>Determine what is being dragged, as follows:/p> p>If the drag operation was invoked on a selection, then it is the selection that is being dragged./p> p>Otherwise, if the drag operation was invoked on a code iddrag-and-drop-processing-model:document>a href#document>Document/a>/code>, it is the first element, going up the ancestor chain, starting at the node that the user tried to drag, that has the IDL attribute code iddrag-and-drop-processing-model:dom-draggable>a href#dom-draggable>draggable/a>/code> set to true. If there is no such element, then nothing is being dragged; abort these steps, the drag-and-drop operation is never started./p> p>Otherwise, the drag operation was invoked outside the user agents purview. What is being dragged is defined by the document or application where the drag was started./p> p classnote>code iddrag-and-drop-processing-model:the-img-element>a href#the-img-element>img/a>/code> elements and code iddrag-and-drop-processing-model:the-a-element>a href#the-a-element>a/a>/code> elements with an code iddrag-and-drop-processing-model:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute have their code iddrag-and-drop-processing-model:dom-draggable-2>a href#dom-draggable>draggable/a>/code> attribute set to true by default./p> li>p>a href#create-a-drag-data-store iddrag-and-drop-processing-model:create-a-drag-data-store>Create a drag data store/a>. All the DND events fired subsequently by the steps in this section must use this a href#drag-data-store iddrag-and-drop-processing-model:drag-data-store>drag data store/a>.li> p>Establish which DOM node is the dfn idsource-node>source node/dfn>, as follows:/p> p>If it is a selection that is being dragged, then the a href#source-node iddrag-and-drop-processing-model:source-node>source node/a> is the code iddrag-and-drop-processing-model:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node that the user started the drag on (typically the code iddrag-and-drop-processing-model:text-2>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node that the user originally clicked). If the user did not specify a particular node, for example if the user just told the user agent to begin a drag of the selection, then the a href#source-node iddrag-and-drop-processing-model:source-node-2>source node/a> is the first code iddrag-and-drop-processing-model:text-3>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node containing a part of the selection./p> p>Otherwise, if it is an element that is being dragged, then the a href#source-node iddrag-and-drop-processing-model:source-node-3>source node/a> is the element that is being dragged./p> p>Otherwise, the a href#source-node iddrag-and-drop-processing-model:source-node-4>source node/a> is part of another document or application. When this specification requires that an event be dispatched at the a href#source-node iddrag-and-drop-processing-model:source-node-5>source node/a> in this case, the user agent must instead follow the platform-specific conventions relevant to that situation./p> p classnote>Multiple events are fired on the a href#source-node iddrag-and-drop-processing-model:source-node-6>source node/a> during the course of the drag-and-drop operation./p> li> p>Determine the dfn idlist-of-dragged-nodes>list of dragged nodes/dfn>, as follows:/p> p>If it is a selection that is being dragged, then the a href#list-of-dragged-nodes iddrag-and-drop-processing-model:list-of-dragged-nodes>list of dragged nodes/a> contains, in a iddrag-and-drop-processing-model:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>, every node that is partially or completely included in the selection (including all their ancestors)./p> p>Otherwise, the a href#list-of-dragged-nodes iddrag-and-drop-processing-model:list-of-dragged-nodes-2>list of dragged nodes/a> contains only the a href#source-node iddrag-and-drop-processing-model:source-node-7>source node/a>, if any./p> li> p>If it is a selection that is being dragged, then add an item to the a href#drag-data-store-item-list iddrag-and-drop-processing-model:drag-data-store-item-list>drag data store item list/a>, with its properties set as follows:/p> dl>dt>a href#the-drag-data-item-type-string iddrag-and-drop-processing-model:the-drag-data-item-type-string>The drag data item type string/a> dd>code iddrag-and-drop-processing-model:text/plain>a data-x-internaltext/plain hrefhttps://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain/a>/code>dt>a href#the-drag-data-item-kind iddrag-and-drop-processing-model:the-drag-data-item-kind>The drag data item kind/a> dd>i>Plain Unicode string/i>dt>The actual datadd>The text of the selection/dl> p>Otherwise, if any files are being dragged, then add one item per file to the a href#drag-data-store-item-list iddrag-and-drop-processing-model:drag-data-store-item-list-2>drag data store item list/a>, with their properties set as follows:/p> dl>dt>a href#the-drag-data-item-type-string iddrag-and-drop-processing-model:the-drag-data-item-type-string-2>The drag data item type string/a> dd>The MIME type of the file, if known, or code iddrag-and-drop-processing-model:application/octet-stream>a data-x-internalapplication/octet-stream hrefhttps://tools.ietf.org/html/rfc2046#section-4.5.1>application/octet-stream/a>/code> otherwise.dt>a href#the-drag-data-item-kind iddrag-and-drop-processing-model:the-drag-data-item-kind-2>The drag data item kind/a> dd>i>File/i>dt>The actual datadd>The files contents and name./dl> p classnote>Dragging files can currently only happen from outside a a href#browsing-context iddrag-and-drop-processing-model:browsing-context>browsing context/a>, for example from a file system manager application./p> p>If the drag initiated outside of the application, the user agent must add items to the a href#drag-data-store-item-list iddrag-and-drop-processing-model:drag-data-store-item-list-3>drag data store item list/a> as appropriate for the data being dragged, honoring platform conventions where appropriate; however, if the platform conventions do not use a hrefhttps://mimesniff.spec.whatwg.org/#mime-type iddrag-and-drop-processing-model:mime-type data-x-internalmime-type>MIME types/a> to label dragged data, the user agent must make a best-effort attempt to map the types to MIME types, and, in any case, all the a href#the-drag-data-item-type-string iddrag-and-drop-processing-model:the-drag-data-item-type-string-3>drag data item type strings/a> must be a iddrag-and-drop-processing-model:converted-to-ascii-lowercase hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>./p> p>User agents may also add one or more items representing the selection or dragged element(s) in other forms, e.g. as HTML./p> li> p>If the a href#list-of-dragged-nodes iddrag-and-drop-processing-model:list-of-dragged-nodes-3>list of dragged nodes/a> is not empty, then a href#extracting-json iddrag-and-drop-processing-model:extracting-json>extract the microdata from those nodes into a JSON form/a>, and add one item to the a href#drag-data-store-item-list iddrag-and-drop-processing-model:drag-data-store-item-list-4>drag data store item list/a>, with its properties set as follows:/p> dl>dt>a href#the-drag-data-item-type-string iddrag-and-drop-processing-model:the-drag-data-item-type-string-4>The drag data item type string/a> dd>code iddrag-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 iddrag-and-drop-processing-model:the-drag-data-item-kind-3>The drag data item kind/a> dd>i>Plain Unicode string/i>dt>The actual datadd>The resulting JSON string./dl> li> p>Run the following substeps:/p> ol>li>p>Let var>urls/var> be an empty list of a hrefhttps://url.spec.whatwg.org/#syntax-url-absolute iddrag-and-drop-processing-model:absolute-url data-x-internalabsolute-url>absolute URLs/a>.li> p>For each var>node/var> in the a href#list-of-dragged-nodes iddrag-and-drop-processing-model:list-of-dragged-nodes-4>list of dragged nodes/a>:/p> dl>dt>If the node is an code iddrag-and-drop-processing-model:the-a-element-2>a href#the-a-element>a/a>/code> element with an code iddrag-and-drop-processing-model:attr-hyperlink-href-2>a href#attr-hyperlink-href>href/a>/code> attributedd>Add to var>urls/var> the result of a href#parse-a-url iddrag-and-drop-processing-model:parse-a-url>parsing/a> the elements code iddrag-and-drop-processing-model:attr-hyperlink-href-3>a href#attr-hyperlink-href>href/a>/code> content attribute relative to the elements a iddrag-and-drop-processing-model:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>.dt>If the node is an code iddrag-and-drop-processing-model:the-img-element-2>a href#the-img-element>img/a>/code> element with a code iddrag-and-drop-processing-model:attr-img-src>a href#attr-img-src>src/a>/code> attributedd>Add to var>urls/var> the result of a href#parse-a-url iddrag-and-drop-processing-model:parse-a-url-2>parsing/a> the elements code iddrag-and-drop-processing-model:attr-img-src-2>a href#attr-img-src>src/a>/code> content attribute relative to the elements a iddrag-and-drop-processing-model:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>./dl> li>p>If var>urls/var> is still empty, abort these substeps.li>p>Let var>url string/var> be the result of concatenating the strings in var>urls/var>, in the order they were added, separated by a U+000D CARRIAGE RETURN U+000A LINE FEED character pair (CRLF).li>p>Add one item to the a href#drag-data-store-item-list iddrag-and-drop-processing-model:drag-data-store-item-list-5>drag data store item list/a>, with its properties set as follows:/p> dl>dt>a href#the-drag-data-item-type-string iddrag-and-drop-processing-model:the-drag-data-item-type-string-5>The drag data item type string/a> dd>code iddrag-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 iddrag-and-drop-processing-model:the-drag-data-item-kind-4>The drag data item kind/a> dd>i>Plain Unicode string/i>dt>The actual datadd>var>url string/var>/dl> /ol> li> p>Update the a href#drag-data-store-default-feedback iddrag-and-drop-processing-model:drag-data-store-default-feedback>drag data store default feedback/a> as appropriate for the user agent (if the user is dragging the selection, then the selection would likely be the basis for this feedback; if the user is dragging an element, then that elements rendering would be used; if the drag began outside the user agent, then the platform conventions for determining the drag feedback should be used)./p> li> p>a href#fire-a-dnd-event iddrag-and-drop-processing-model:fire-a-dnd-event>Fire a DND event/a> named code iddrag-and-drop-processing-model:event-dnd-dragstart>a href#event-dnd-dragstart>dragstart/a>/code> at the a href#source-node iddrag-and-drop-processing-model:source-node-8>source node/a>./p> p>If the event is canceled, then the drag-and-drop operation should not occur; abort these steps./p> p classnote>Since events with no event listeners registered are, almost by definition, never canceled, drag-and-drop is always available to the user if the author does not specifically prevent it./p> li> p>a href#initiate-the-drag-and-drop-operation iddrag-and-drop-processing-model:initiate-the-drag-and-drop-operation>Initiate the drag-and-drop operation/a> in a manner consistent with platform conventions, and as described below./p> p idbase-dnd-feedback>The drag-and-drop feedback must be generated from the first of the following sources that is available:/p> ol>li>The a href#drag-data-store-bitmap iddrag-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 iddrag-and-drop-processing-model:drag-data-store-hot-spot-coordinate>drag data store hot spot coordinate/a> should be used as hints for where to put the cursor relative to the resulting image. The values are expressed as distances in a hrefhttps://drafts.csswg.org/css-values/#px iddrag-and-drop-processing-model:px data-x-internalpx>CSS pixels/a> from the left side and from the top side of the image respectively. a href#refsCSS>CSS/a>li>The a href#drag-data-store-default-feedback iddrag-and-drop-processing-model:drag-data-store-default-feedback-2>drag data store default feedback/a>./ol> /ol> p>From the moment that the user agent is to dfn idinitiate-the-drag-and-drop-operation>initiate the drag-and-drop operation/dfn>, until the end of the drag-and-drop operation, device input events (e.g. mouse and keyboard events) must be suppressed./p> p>During the drag operation, the element directly indicated by the user as the drop target is called the dfn idimmediate-user-selection>immediate user selection/dfn>. (Only elements can be selected by the user; other nodes must not be made available as drop targets.) However, the a href#immediate-user-selection iddrag-and-drop-processing-model:immediate-user-selection>immediate user selection/a> is not necessarily the dfn idcurrent-target-element>current target element/dfn>, which is the element currently selected for the drop part of the drag-and-drop operation./p> p>The a href#immediate-user-selection iddrag-and-drop-processing-model:immediate-user-selection-2>immediate user selection/a> changes as the user selects different elements (either by pointing at them with a pointing device, or by selecting them in some other way). The a href#current-target-element iddrag-and-drop-processing-model:current-target-element>current target element/a> changes when the a href#immediate-user-selection iddrag-and-drop-processing-model:immediate-user-selection-3>immediate user selection/a> changes, based on the results of event listeners in the document, as described below./p> p>Both the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-2>current target element/a> and the a href#immediate-user-selection iddrag-and-drop-processing-model:immediate-user-selection-4>immediate user selection/a> can be null, which means no target element is selected. They can also both be elements in other (DOM-based) documents, or other (non-Web) programs altogether. (For example, a user could drag text to a word-processor.) The a href#current-target-element iddrag-and-drop-processing-model:current-target-element-3>current target element/a> is initially null./p> p>In addition, there is also a dfn idcurrent-drag-operation>current drag operation/dfn>, which can take on the values dfn idconcept-current-drag-operation-none>code>none/code>/dfn>, dfn idconcept-current-drag-operation-copy>code>copy/code>/dfn>, dfn idconcept-current-drag-operation-link>code>link/code>/dfn>, and dfn idconcept-current-drag-operation-move>code>move/code>/dfn>. Initially, it has the value code iddrag-and-drop-processing-model:concept-current-drag-operation-none>a href#concept-current-drag-operation-none>none/a>/code>. It is updated by the user agent as described in the steps below./p> p>User agents must, as soon as the drag operation is a href#initiate-the-drag-and-drop-operation iddrag-and-drop-processing-model:initiate-the-drag-and-drop-operation-2>initiated/a> and every 350ms (±200ms) thereafter for as long as the drag operation is ongoing, a href#queue-a-task iddrag-and-drop-processing-model:queue-a-task>queue a task/a> to perform the following steps in sequence:/p> ol>li> p>If the user agent is still performing the previous iteration of the sequence (if any) when the next iteration becomes due, abort these steps for this iteration (effectively skipping missed frames of the drag-and-drop operation)./p> li> p>a href#fire-a-dnd-event iddrag-and-drop-processing-model:fire-a-dnd-event-2>Fire a DND event/a> named code iddrag-and-drop-processing-model:event-dnd-drag>a href#event-dnd-drag>drag/a>/code> at the a href#source-node iddrag-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 iddrag-and-drop-processing-model:current-drag-operation>current drag operation/a> to code iddrag-and-drop-processing-model:concept-current-drag-operation-none-2>a href#concept-current-drag-operation-none>none/a>/code> (no drag operation)./p> li> p>If the code iddrag-and-drop-processing-model:event-dnd-drag-2>a href#event-dnd-drag>drag/a>/code> event was not canceled and the user has not ended the drag-and-drop operation, check the state of the drag-and-drop operation, as follows:/p> ol>li> p>If the user is indicating a different a href#immediate-user-selection iddrag-and-drop-processing-model:immediate-user-selection-5>immediate user selection/a> than during the last iteration (or if this is the first iteration), and if this a href#immediate-user-selection iddrag-and-drop-processing-model:immediate-user-selection-6>immediate user selection/a> is not the same as the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-4>current target element/a>, then a href#fire-a-dnd-event iddrag-and-drop-processing-model:fire-a-dnd-event-3>fire a DND event/a> named code iddrag-and-drop-processing-model:event-dnd-dragexit>a href#event-dnd-dragexit>dragexit/a>/code> at the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-5>current target element/a>, and then update the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-6>current target element/a> as follows:/p> dl classswitch>dt>If the new a href#immediate-user-selection iddrag-and-drop-processing-model:immediate-user-selection-7>immediate user selection/a> is nulldd>p>Set the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-7>current target element/a> to null also.dt>If the new a href#immediate-user-selection iddrag-and-drop-processing-model:immediate-user-selection-8>immediate user selection/a> is in a non-DOM document or applicationdd>p>Set the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-8>current target element/a> to the a href#immediate-user-selection iddrag-and-drop-processing-model:immediate-user-selection-9>immediate user selection/a>.dt>Otherwisedd> p>a href#fire-a-dnd-event iddrag-and-drop-processing-model:fire-a-dnd-event-4>Fire a DND event/a> named code iddrag-and-drop-processing-model:event-dnd-dragenter>a href#event-dnd-dragenter>dragenter/a>/code> at the a href#immediate-user-selection iddrag-and-drop-processing-model:immediate-user-selection-10>immediate user selection/a>./p> p>If the event is canceled, then set the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-9>current target element/a> to the a href#immediate-user-selection iddrag-and-drop-processing-model:immediate-user-selection-11>immediate user selection/a>./p> p>Otherwise, run the appropriate step from the following list:/p> dl classswitch>dt>If the a href#immediate-user-selection iddrag-and-drop-processing-model:immediate-user-selection-12>immediate user selection/a> is a text control (e.g., code iddrag-and-drop-processing-model:the-textarea-element>a href#the-textarea-element>textarea/a>/code>, or an code iddrag-and-drop-processing-model:the-input-element>a href#the-input-element>input/a>/code> element whose code iddrag-and-drop-processing-model:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#text-(typetext)-state-and-search-state-(typesearch) iddrag-and-drop-processing-model:text-(typetext)-state-and-search-state-(typesearch)>Text/a> state) or an a iddrag-and-drop-processing-model:editing-host hrefhttps://w3c.github.io/editing/execCommand.html#editing-host data-x-internalediting-host>editing host/a> or a iddrag-and-drop-processing-model:editable hrefhttps://w3c.github.io/editing/execCommand.html#editable data-x-internaleditable>editable/a> element, and the a href#drag-data-store-item-list iddrag-and-drop-processing-model:drag-data-store-item-list-6>drag data store item list/a> has an item with a href#the-drag-data-item-type-string iddrag-and-drop-processing-model:the-drag-data-item-type-string-6>the drag data item type string/a> code iddrag-and-drop-processing-model:text/plain-2>a data-x-internaltext/plain hrefhttps://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain/a>/code> and a href#the-drag-data-item-kind iddrag-and-drop-processing-model:the-drag-data-item-kind-5>the drag data item kind/a> i>Plain Unicode string/i>dd>p>Set the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-10>current target element/a> to the a href#immediate-user-selection iddrag-and-drop-processing-model:immediate-user-selection-13>immediate user selection/a> anyway.dt>If the a href#immediate-user-selection iddrag-and-drop-processing-model:immediate-user-selection-14>immediate user selection/a> is a href#the-body-element-2 iddrag-and-drop-processing-model:the-body-element-2>the body element/a>dd>p>Leave the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-11>current target element/a> unchanged.dt>Otherwisedd> p>a href#fire-a-dnd-event iddrag-and-drop-processing-model:fire-a-dnd-event-5>Fire a DND event/a> named code iddrag-and-drop-processing-model:event-dnd-dragenter-2>a href#event-dnd-dragenter>dragenter/a>/code> at a href#the-body-element-2 iddrag-and-drop-processing-model:the-body-element-2-2>the body element/a>, if there is one, or at the code iddrag-and-drop-processing-model:document-2>a href#document>Document/a>/code> object, if not. Then, set the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-12>current target element/a> to a href#the-body-element-2 iddrag-and-drop-processing-model:the-body-element-2-3>the body element/a>, regardless of whether that event was canceled or not./p> /dl> /dl> li> p>If the previous step caused the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-13>current target element/a> to change, and if the previous target element was not null or a part of a non-DOM document, then a href#fire-a-dnd-event iddrag-and-drop-processing-model:fire-a-dnd-event-6>fire a DND event/a> named code iddrag-and-drop-processing-model:event-dnd-dragleave>a href#event-dnd-dragleave>dragleave/a>/code> at the previous target element, with the new a href#current-target-element iddrag-and-drop-processing-model:current-target-element-14>current target element/a> as the specific var>related target/var>./p> li> p>If the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-15>current target element/a> is a DOM element, then a href#fire-a-dnd-event iddrag-and-drop-processing-model:fire-a-dnd-event-7>fire a DND event/a> named code iddrag-and-drop-processing-model:event-dnd-dragover>a href#event-dnd-dragover>dragover/a>/code> at this a href#current-target-element iddrag-and-drop-processing-model:current-target-element-16>current target element/a>./p> p>If the code iddrag-and-drop-processing-model:event-dnd-dragover-2>a href#event-dnd-dragover>dragover/a>/code> event is not canceled, run the appropriate step from the following list:/p> dl classswitch>dt>If the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-17>current target element/a> is a text control (e.g., code iddrag-and-drop-processing-model:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code>, or an code iddrag-and-drop-processing-model:the-input-element-2>a href#the-input-element>input/a>/code> element whose code iddrag-and-drop-processing-model:attr-input-type-2>a href#attr-input-type>type/a>/code> attribute is in the a href#text-(typetext)-state-and-search-state-(typesearch) iddrag-and-drop-processing-model:text-(typetext)-state-and-search-state-(typesearch)-2>Text/a> state) or an a iddrag-and-drop-processing-model:editing-host-2 hrefhttps://w3c.github.io/editing/execCommand.html#editing-host data-x-internalediting-host>editing host/a> or a iddrag-and-drop-processing-model:editable-2 hrefhttps://w3c.github.io/editing/execCommand.html#editable data-x-internaleditable>editable/a> element, and the a href#drag-data-store-item-list iddrag-and-drop-processing-model:drag-data-store-item-list-7>drag data store item list/a> has an item with a href#the-drag-data-item-type-string iddrag-and-drop-processing-model:the-drag-data-item-type-string-7>the drag data item type string/a> code iddrag-and-drop-processing-model:text/plain-3>a data-x-internaltext/plain hrefhttps://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain/a>/code> and a href#the-drag-data-item-kind iddrag-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 iddrag-and-drop-processing-model:current-drag-operation-2>current drag operation/a> to either code iddrag-and-drop-processing-model:concept-current-drag-operation-copy>a href#concept-current-drag-operation-copy>copy/a>/code> or code iddrag-and-drop-processing-model:concept-current-drag-operation-move>a href#concept-current-drag-operation-move>move/a>/code>, as appropriate given the platform conventions.dt>Otherwisedd>p>Reset the a href#current-drag-operation iddrag-and-drop-processing-model:current-drag-operation-3>current drag operation/a> to code iddrag-and-drop-processing-model:concept-current-drag-operation-none-3>a href#concept-current-drag-operation-none>none/a>/code>./dl> p>Otherwise (if the code iddrag-and-drop-processing-model:event-dnd-dragover-3>a href#event-dnd-dragover>dragover/a>/code> event em>is/em> canceled), set the a href#current-drag-operation iddrag-and-drop-processing-model:current-drag-operation-4>current drag operation/a> based on the values of the code iddrag-and-drop-processing-model:dom-datatransfer-effectallowed>a href#dom-datatransfer-effectallowed>effectAllowed/a>/code> and code iddrag-and-drop-processing-model:dom-datatransfer-dropeffect>a href#dom-datatransfer-dropeffect>dropEffect/a>/code> attributes of the code iddrag-and-drop-processing-model:dragevent>a href#dragevent>DragEvent/a>/code> objects code iddrag-and-drop-processing-model:dom-dragevent-datatransfer>a href#dom-dragevent-datatransfer>dataTransfer/a>/code> object as they stood after the event a hrefhttps://dom.spec.whatwg.org/#concept-event-dispatch iddrag-and-drop-processing-model:concept-event-dispatch data-x-internalconcept-event-dispatch>dispatch/a> finished, as per the following table:/p> table>thead>tr>th>code iddrag-and-drop-processing-model:dom-datatransfer-effectallowed-2>a href#dom-datatransfer-effectallowed>effectAllowed/a>/code>th>code iddrag-and-drop-processing-model:dom-datatransfer-dropeffect-2>a href#dom-datatransfer-dropeffect>dropEffect/a>/code>th>Drag operationtbody>tr>td>code iddrag-and-drop-processing-model:dom-datatransfer-effectallowed-uninitialized>a href#dom-datatransfer-effectallowed-uninitialized>uninitialized/a>/code>, code iddrag-and-drop-processing-model:dom-datatransfer-effectallowed-copy>a href#dom-datatransfer-effectallowed-copy>copy/a>/code>, code iddrag-and-drop-processing-model:dom-datatransfer-effectallowed-copylink>a href#dom-datatransfer-effectallowed-copylink>copyLink/a>/code>, code iddrag-and-drop-processing-model:dom-datatransfer-effectallowed-copymove>a href#dom-datatransfer-effectallowed-copymove>copyMove/a>/code>, or code iddrag-and-drop-processing-model:dom-datatransfer-effectallowed-all>a href#dom-datatransfer-effectallowed-all>all/a>/code>td>code iddrag-and-drop-processing-model:dom-datatransfer-dropeffect-copy>a href#dom-datatransfer-dropeffect-copy>copy/a>/code>td>code iddrag-and-drop-processing-model:concept-current-drag-operation-copy-2>a href#concept-current-drag-operation-copy>copy/a>/code>tr>td>code iddrag-and-drop-processing-model:dom-datatransfer-effectallowed-uninitialized-2>a href#dom-datatransfer-effectallowed-uninitialized>uninitialized/a>/code>, code iddrag-and-drop-processing-model:dom-datatransfer-effectallowed-link>a href#dom-datatransfer-effectallowed-link>link/a>/code>, code iddrag-and-drop-processing-model:dom-datatransfer-effectallowed-copylink-2>a href#dom-datatransfer-effectallowed-copylink>copyLink/a>/code>, code iddrag-and-drop-processing-model:dom-datatransfer-effectallowed-linkmove>a href#dom-datatransfer-effectallowed-linkmove>linkMove/a>/code>, or code iddrag-and-drop-processing-model:dom-datatransfer-effectallowed-all-2>a href#dom-datatransfer-effectallowed-all>all/a>/code>td>code iddrag-and-drop-processing-model:dom-datatransfer-dropeffect-link>a href#dom-datatransfer-dropeffect-link>link/a>/code>td>code iddrag-and-drop-processing-model:concept-current-drag-operation-link>a href#concept-current-drag-operation-link>link/a>/code>tr>td>code iddrag-and-drop-processing-model:dom-datatransfer-effectallowed-uninitialized-3>a href#dom-datatransfer-effectallowed-uninitialized>uninitialized/a>/code>, code iddrag-and-drop-processing-model:dom-datatransfer-effectallowed-move>a href#dom-datatransfer-effectallowed-move>move/a>/code>, code iddrag-and-drop-processing-model:dom-datatransfer-effectallowed-copymove-2>a href#dom-datatransfer-effectallowed-copymove>copyMove/a>/code>, code iddrag-and-drop-processing-model:dom-datatransfer-effectallowed-linkmove-2>a href#dom-datatransfer-effectallowed-linkmove>linkMove/a>/code>, or code iddrag-and-drop-processing-model:dom-datatransfer-effectallowed-all-3>a href#dom-datatransfer-effectallowed-all>all/a>/code>td>code iddrag-and-drop-processing-model:dom-datatransfer-dropeffect-move>a href#dom-datatransfer-dropeffect-move>move/a>/code>td>code iddrag-and-drop-processing-model:concept-current-drag-operation-move-2>a href#concept-current-drag-operation-move>move/a>/code>tr>td colspan2>Any other casetd>code iddrag-and-drop-processing-model:concept-current-drag-operation-none-4>a href#concept-current-drag-operation-none>none/a>/code>/table> li> p>Otherwise, if the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-18>current target element/a> is not a DOM element, use platform-specific mechanisms to determine what drag operation is being performed (none, copy, link, or move), and set the a href#current-drag-operation iddrag-and-drop-processing-model:current-drag-operation-5>current drag operation/a> accordingly./p> li> p>Update the drag feedback (e.g. the mouse cursor) to match the a href#current-drag-operation iddrag-and-drop-processing-model:current-drag-operation-6>current drag operation/a>, as follows:/p> table>thead>tr>th>Drag operationth>Feedbacktbody>tr>td>code iddrag-and-drop-processing-model:concept-current-drag-operation-copy-3>a href#concept-current-drag-operation-copy>copy/a>/code>td>Data will be copied if dropped here.tr>td>code iddrag-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 iddrag-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 iddrag-and-drop-processing-model:concept-current-drag-operation-none-5>a href#concept-current-drag-operation-none>none/a>/code>td>No operation allowed, dropping here will cancel the drag-and-drop operation./table> /ol> li> p>Otherwise, if the user ended the drag-and-drop operation (e.g. by releasing the mouse button in a mouse-driven drag-and-drop interface), or if the code iddrag-and-drop-processing-model:event-dnd-drag-3>a href#event-dnd-drag>drag/a>/code> event was canceled, then this will be the last iteration. Run the following steps, then stop the drag-and-drop operation:/p> ol>li> p>If the a href#current-drag-operation iddrag-and-drop-processing-model:current-drag-operation-7>current drag operation/a> is code iddrag-and-drop-processing-model:concept-current-drag-operation-none-6>a href#concept-current-drag-operation-none>none/a>/code> (no drag operation), or, if the user ended the drag-and-drop operation by canceling it (e.g. by hitting the kbd>kbd>Escape/kbd>/kbd> key), or if the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-19>current target element/a> is null, then the drag operation failed. Run these substeps:/p> ol>li>p>Let var>dropped/var> be false.li>p>If the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-20>current target element/a> is a DOM element, a href#fire-a-dnd-event iddrag-and-drop-processing-model:fire-a-dnd-event-8>fire a DND event/a> named code iddrag-and-drop-processing-model:event-dnd-dragleave-2>a href#event-dnd-dragleave>dragleave/a>/code> at it; otherwise, if it is not null, use platform-specific conventions for drag cancelation.li>p>Set the a href#current-drag-operation iddrag-and-drop-processing-model:current-drag-operation-8>current drag operation/a> to code iddrag-and-drop-processing-model:concept-current-drag-operation-none-7>a href#concept-current-drag-operation-none>none/a>/code>./ol> p>Otherwise, the drag operation might be a success; run these substeps:/p> ol>li>p>Let var>dropped/var> be true.li>p>If the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-21>current target element/a> is a DOM element, a href#fire-a-dnd-event iddrag-and-drop-processing-model:fire-a-dnd-event-9>fire a DND event/a> named code iddrag-and-drop-processing-model:event-dnd-drop>a href#event-dnd-drop>drop/a>/code> at it; otherwise, use platform-specific conventions for indicating a drop.li> p>If the event is canceled, set the a href#current-drag-operation iddrag-and-drop-processing-model:current-drag-operation-9>current drag operation/a> to the value of the code iddrag-and-drop-processing-model:dom-datatransfer-dropeffect-3>a href#dom-datatransfer-dropeffect>dropEffect/a>/code> attribute of the code iddrag-and-drop-processing-model:dragevent-2>a href#dragevent>DragEvent/a>/code> objects code iddrag-and-drop-processing-model:dom-dragevent-datatransfer-2>a href#dom-dragevent-datatransfer>dataTransfer/a>/code> object as it stood after the event a hrefhttps://dom.spec.whatwg.org/#concept-event-dispatch iddrag-and-drop-processing-model:concept-event-dispatch-2 data-x-internalconcept-event-dispatch>dispatch/a> finished./p> p>Otherwise, the event is not canceled; perform the events default action, which depends on the exact target as follows:/p> dl classswitch>dt>If the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-22>current target element/a> is a text control (e.g., code iddrag-and-drop-processing-model:the-textarea-element-3>a href#the-textarea-element>textarea/a>/code>, or an code iddrag-and-drop-processing-model:the-input-element-3>a href#the-input-element>input/a>/code> element whose code iddrag-and-drop-processing-model:attr-input-type-3>a href#attr-input-type>type/a>/code> attribute is in the a href#text-(typetext)-state-and-search-state-(typesearch) iddrag-and-drop-processing-model:text-(typetext)-state-and-search-state-(typesearch)-3>Text/a> state) or an a iddrag-and-drop-processing-model:editing-host-3 hrefhttps://w3c.github.io/editing/execCommand.html#editing-host data-x-internalediting-host>editing host/a> or a iddrag-and-drop-processing-model:editable-3 hrefhttps://w3c.github.io/editing/execCommand.html#editable data-x-internaleditable>editable/a> element, and the a href#drag-data-store-item-list iddrag-and-drop-processing-model:drag-data-store-item-list-8>drag data store item list/a> has an item with a href#the-drag-data-item-type-string iddrag-and-drop-processing-model:the-drag-data-item-type-string-8>the drag data item type string/a> code iddrag-and-drop-processing-model:text/plain-4>a data-x-internaltext/plain hrefhttps://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain/a>/code> and a href#the-drag-data-item-kind iddrag-and-drop-processing-model:the-drag-data-item-kind-7>the drag data item kind/a> i>Plain Unicode string/i>dd>p>Insert the actual data of the first item in the a href#drag-data-store-item-list iddrag-and-drop-processing-model:drag-data-store-item-list-9>drag data store item list/a> to have a href#the-drag-data-item-type-string iddrag-and-drop-processing-model:the-drag-data-item-type-string-9>a drag data item type string/a> of code iddrag-and-drop-processing-model:text/plain-5>a data-x-internaltext/plain hrefhttps://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain/a>/code> and a href#the-drag-data-item-kind iddrag-and-drop-processing-model:the-drag-data-item-kind-8>a drag data item kind/a> that is i>Plain Unicode string/i> into the text control or a iddrag-and-drop-processing-model:editing-host-4 hrefhttps://w3c.github.io/editing/execCommand.html#editing-host data-x-internalediting-host>editing host/a> or a iddrag-and-drop-processing-model:editable-4 hrefhttps://w3c.github.io/editing/execCommand.html#editable data-x-internaleditable>editable/a> element in a manner consistent with platform-specific conventions (e.g. inserting it at the current mouse cursor position, or inserting it at the end of the field).dt>Otherwisedd>p>Reset the a href#current-drag-operation iddrag-and-drop-processing-model:current-drag-operation-10>current drag operation/a> to code iddrag-and-drop-processing-model:concept-current-drag-operation-none-8>a href#concept-current-drag-operation-none>none/a>/code>./dl> /ol> li> p>a href#fire-a-dnd-event iddrag-and-drop-processing-model:fire-a-dnd-event-10>Fire a DND event/a> named code iddrag-and-drop-processing-model:event-dnd-dragend>a href#event-dnd-dragend>dragend/a>/code> at the a href#source-node iddrag-and-drop-processing-model:source-node-10>source node/a>./p> li> p>Run the appropriate steps from the following list as the default action of the code iddrag-and-drop-processing-model:event-dnd-dragend-2>a href#event-dnd-dragend>dragend/a>/code> event:/p> dl classswitch>dt>If var>dropped/var> is true, the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-23>current target element/a> is a i>text control/i> (see below), the a href#current-drag-operation iddrag-and-drop-processing-model:current-drag-operation-11>current drag operation/a> is code iddrag-and-drop-processing-model:concept-current-drag-operation-move-4>a href#concept-current-drag-operation-move>move/a>/code>, and the source of the drag-and-drop operation is a selection in the DOM that is entirely contained within an a iddrag-and-drop-processing-model:editing-host-5 hrefhttps://w3c.github.io/editing/execCommand.html#editing-host data-x-internalediting-host>editing host/a>dd>p>a iddrag-and-drop-processing-model:delete-the-selection hrefhttps://w3c.github.io/editing/execCommand.html#delete-the-selection data-x-internaldelete-the-selection>Delete the selection/a>.dt>If var>dropped/var> is true, the a href#current-target-element iddrag-and-drop-processing-model:current-target-element-24>current target element/a> is a i>text control/i> (see below), the a href#current-drag-operation iddrag-and-drop-processing-model:current-drag-operation-12>current drag operation/a> is code iddrag-and-drop-processing-model:concept-current-drag-operation-move-5>a href#concept-current-drag-operation-move>move/a>/code>, and the source of the drag-and-drop operation is a selection in a text controldd>p>The user agent should delete the dragged selection from the relevant text control.dt>If var>dropped/var> is false or if the a href#current-drag-operation iddrag-and-drop-processing-model:current-drag-operation-13>current drag operation/a> is code iddrag-and-drop-processing-model:concept-current-drag-operation-none-9>a href#concept-current-drag-operation-none>none/a>/code>dd>p>The drag was canceled. If the platform conventions dictate that this be represented to the user (e.g. by animating the dragged selection going back to the source of the drag-and-drop operation), then do so.dt>Otherwisedd>p>The event has no default action./dl> p>For the purposes of this step, a i>text control/i> is a code iddrag-and-drop-processing-model:the-textarea-element-4>a href#the-textarea-element>textarea/a>/code> element or an code iddrag-and-drop-processing-model:the-input-element-4>a href#the-input-element>input/a>/code> element whose code iddrag-and-drop-processing-model:attr-input-type-4>a href#attr-input-type>type/a>/code> attribute is in one of the a href#text-(typetext)-state-and-search-state-(typesearch) iddrag-and-drop-processing-model:text-(typetext)-state-and-search-state-(typesearch)-4>Text/a>, a href#text-(typetext)-state-and-search-state-(typesearch) iddrag-and-drop-processing-model:text-(typetext)-state-and-search-state-(typesearch)-5>Search/a>, a href#telephone-state-(typetel) iddrag-and-drop-processing-model:telephone-state-(typetel)>Tel/a>, a href#url-state-(typeurl) iddrag-and-drop-processing-model:url-state-(typeurl)>URL/a>, a href#e-mail-state-(typeemail) iddrag-and-drop-processing-model:e-mail-state-(typeemail)>E-mail/a>, a href#password-state-(typepassword) iddrag-and-drop-processing-model:password-state-(typepassword)>Password/a>, or a href#number-state-(typenumber) iddrag-and-drop-processing-model:number-state-(typenumber)>Number/a> states./p> /ol> /ol> p classnote>User agents are encouraged to consider how to react to drags near the edge of scrollable regions. For example, if a user drags a link to the bottom of the a iddrag-and-drop-processing-model:viewport hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> on a long page, it might make sense to scroll the page so that the user can drop the link lower on the page./p> p classnote>This model is independent of which code iddrag-and-drop-processing-model:document-3>a href#document>Document/a>/code> object the nodes involved are from; the events are fired as described above and the rest of the processing model runs as described above, irrespective of how many documents are involved in the operation./p> h4 iddndevents>span classsecno>6.7.6/span> Events summarya href#dndevents classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>The following events are involved in the drag-and-drop model./p> table>thead>tr>th> Event Name th> Target th> Cancelable? th> a href#drag-data-store-mode iddndevents:drag-data-store-mode>Drag data store mode/a> th> code iddndevents:dom-datatransfer-dropeffect>a href#dom-datatransfer-dropeffect>dropEffect/a>/code> th> Default Action tbody>tr>td>dfn idevent-dnd-dragstart>code>dragstart/code>/dfn>td>a href#source-node iddndevents:source-node>Source node/a>td>✓ Cancelabletd>a href#concept-dnd-rw iddndevents:concept-dnd-rw>Read/write mode/a> td>code iddndevents:dom-datatransfer-dropeffect-none>a href#dom-datatransfer-dropeffect-none>none/a>/code>td>Initiate the drag-and-drop operationtr>td>dfn idevent-dnd-drag>code>drag/code>/dfn>td>a href#source-node iddndevents:source-node-2>Source node/a>td>✓ Cancelabletd>a href#concept-dnd-p iddndevents:concept-dnd-p>Protected mode/a> td>code iddndevents:dom-datatransfer-dropeffect-none-2>a href#dom-datatransfer-dropeffect-none>none/a>/code>td>Continue the drag-and-drop operationtr>td>dfn idevent-dnd-dragenter>code>dragenter/code>/dfn>td>a href#immediate-user-selection iddndevents:immediate-user-selection>Immediate user selection/a> or a href#the-body-element-2 iddndevents:the-body-element-2>the body element/a>td>✓ Cancelabletd>a href#concept-dnd-p iddndevents:concept-dnd-p-2>Protected mode/a> td>a href#dropEffect-initialisation>Based on code>effectAllowed/code> value/a>td>Reject a href#immediate-user-selection iddndevents:immediate-user-selection-2>immediate user selection/a> as potential a href#current-target-element iddndevents:current-target-element>target element/a>tr>td>dfn idevent-dnd-dragexit>code>dragexit/code>/dfn>td>a href#current-target-element iddndevents:current-target-element-2>Previous target element/a>td>—td>a href#concept-dnd-p iddndevents:concept-dnd-p-3>Protected mode/a> td>code iddndevents:dom-datatransfer-dropeffect-none-3>a href#dom-datatransfer-dropeffect-none>none/a>/code>td>Nonetr>td>dfn idevent-dnd-dragleave>code>dragleave/code>/dfn>td>a href#current-target-element iddndevents:current-target-element-3>Previous target element/a>td>—td>a href#concept-dnd-p iddndevents:concept-dnd-p-4>Protected mode/a> td>code iddndevents:dom-datatransfer-dropeffect-none-4>a href#dom-datatransfer-dropeffect-none>none/a>/code>td>Nonetr>td>dfn idevent-dnd-dragover>code>dragover/code>/dfn>td>a href#current-target-element iddndevents:current-target-element-4>Current target element/a>td>✓ Cancelabletd>a href#concept-dnd-p iddndevents:concept-dnd-p-5>Protected mode/a> td>a href#dropEffect-initialisation>Based on code>effectAllowed/code> value/a>td>Reset the a href#current-drag-operation iddndevents:current-drag-operation>current drag operation/a> to nonetr>td>dfn idevent-dnd-drop>code>drop/code>/dfn>td>a href#current-target-element iddndevents:current-target-element-5>Current target element/a>td>✓ Cancelabletd>a href#concept-dnd-ro iddndevents:concept-dnd-ro>Read-only mode/a> td>a href#current-drag-operation iddndevents:current-drag-operation-2>Current drag operation/a>td>Variestr>td>dfn idevent-dnd-dragend>code>dragend/code>/dfn>td>a href#source-node iddndevents:source-node-3>Source node/a>td>—td>a href#concept-dnd-p iddndevents:concept-dnd-p-6>Protected mode/a> td>a href#current-drag-operation iddndevents:current-drag-operation-3>Current drag operation/a>td>Varies/table> p>Not shown in the above table: all these events bubble, are composed, and the code iddndevents:dom-datatransfer-effectallowed>a href#dom-datatransfer-effectallowed>effectAllowed/a>/code> attribute always has the value it had after the code iddndevents:event-dnd-dragstart>a href#event-dnd-dragstart>dragstart/a>/code> event, defaulting to code iddndevents:dom-datatransfer-effectallowed-uninitialized>a href#dom-datatransfer-effectallowed-uninitialized>uninitialized/a>/code> in the code iddndevents:event-dnd-dragstart-2>a href#event-dnd-dragstart>dragstart/a>/code> event./p> h4 idthe-draggable-attribute>span classsecno>6.7.7/span> The dfn>code>draggable/code>/dfn> attributea href#the-draggable-attribute classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id26024 titleDrag and drop img> should give the rendered images URL>26024/a>/div> p>All a href#html-elements idthe-draggable-attribute:html-elements>HTML elements/a> may have the code idthe-draggable-attribute:the-draggable-attribute>a href#the-draggable-attribute>draggable/a>/code> content attribute set. The code idthe-draggable-attribute:the-draggable-attribute-2>a href#the-draggable-attribute>draggable/a>/code> attribute is an a href#enumerated-attribute idthe-draggable-attribute:enumerated-attribute>enumerated attribute/a>. It has three states. The first state is i>true/i> and it has the keyword code>true/code>. The second state is i>false/i> and it has the keyword code>false/code>. The third state is i>auto/i>; it has no keywords but it is the i idthe-draggable-attribute:missing-value-default>a href#missing-value-default>missing value default/a>/i>./p> p>The i>true/i> state means the element is draggable; the i>false/i> state means that it is not. The i>auto/i> state uses the default behavior of the user agent./p> p>An element with a code idthe-draggable-attribute:the-draggable-attribute-3>a href#the-draggable-attribute>draggable/a>/code> attribute should also have a code idthe-draggable-attribute:attr-title>a href#attr-title>title/a>/code> attribute that names the element for the purpose of non-visual interactions. /p> dl classdomintro>dt>var>element/var> . code idthe-draggable-attribute:dom-draggable>a href#dom-draggable>draggable/a>/code> var>value/var> dd> p>Returns true if the element is draggable; otherwise, returns false./p> p>Can be set, to override the default and set the code idthe-draggable-attribute:the-draggable-attribute-4>a href#the-draggable-attribute>draggable/a>/code> content attribute./p> /dl> p>The dfn iddom-draggable>code>draggable/code>/dfn> IDL attribute, whose value depends on the content attributes in the way described below, controls whether or not the element is draggable. Generally, only text selections are draggable, but elements whose code idthe-draggable-attribute:dom-draggable-2>a href#dom-draggable>draggable/a>/code> IDL attribute is true become draggable as well./p> p>If an elements code idthe-draggable-attribute:the-draggable-attribute-5>a href#the-draggable-attribute>draggable/a>/code> content attribute has the state i>true/i>, the code idthe-draggable-attribute:dom-draggable-3>a href#dom-draggable>draggable/a>/code> IDL attribute must return true./p> p>Otherwise, if the elements code idthe-draggable-attribute:the-draggable-attribute-6>a href#the-draggable-attribute>draggable/a>/code> content attribute has the state i>false/i>, the code idthe-draggable-attribute:dom-draggable-4>a href#dom-draggable>draggable/a>/code> IDL attribute must return false./p> p>Otherwise, the elements code idthe-draggable-attribute:the-draggable-attribute-7>a href#the-draggable-attribute>draggable/a>/code> content attribute has the state i>auto/i>. If the element is an code idthe-draggable-attribute:the-img-element>a href#the-img-element>img/a>/code> element, an code idthe-draggable-attribute:the-object-element>a href#the-object-element>object/a>/code> element that a href#represents idthe-draggable-attribute:represents>represents/a> an image, or an code idthe-draggable-attribute:the-a-element>a href#the-a-element>a/a>/code> element with an code idthe-draggable-attribute:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> content attribute, the code idthe-draggable-attribute:dom-draggable-5>a href#dom-draggable>draggable/a>/code> IDL attribute must return true; otherwise, the code idthe-draggable-attribute:dom-draggable-6>a href#dom-draggable>draggable/a>/code> IDL attribute must return false./p> p>If the code idthe-draggable-attribute:dom-draggable-7>a href#dom-draggable>draggable/a>/code> IDL attribute is set to the value false, the code idthe-draggable-attribute:the-draggable-attribute-8>a href#the-draggable-attribute>draggable/a>/code> content attribute must be set to the literal value code>false/code>. If the code idthe-draggable-attribute:dom-draggable-8>a href#dom-draggable>draggable/a>/code> IDL attribute is set to the value true, the code idthe-draggable-attribute:the-draggable-attribute-9>a href#the-draggable-attribute>draggable/a>/code> content attribute must be set to the literal value code>true/code>./p> h4 idsecurity-risks-in-the-drag-and-drop-model>span classsecno>6.7.8/span> Security risks in the drag-and-drop modela href#security-risks-in-the-drag-and-drop-model classself-link>/a>/h4> p>User agents must not make the data added to the code idsecurity-risks-in-the-drag-and-drop-model:datatransfer>a href#datatransfer>DataTransfer/a>/code> object during the code idsecurity-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 idsecurity-risks-in-the-drag-and-drop-model:event-dnd-drop>a href#event-dnd-drop>drop/a>/code> event, because otherwise, if a user were to drag sensitive information from one document to a second document, crossing a hostile third document in the process, the hostile document could intercept the data./p> p>For the same reason, user agents must consider a drop to be successful only if the user specifically ended the drag operation — if any scripts end the drag operation, it must be considered unsuccessful (canceled) and the code idsecurity-risks-in-the-drag-and-drop-model:event-dnd-drop-2>a href#event-dnd-drop>drop/a>/code> event must not be fired./p> p>User agents should take care to not start drag-and-drop operations in response to script actions. For example, in a mouse-and-window environment, if a script moves a window while the user has their mouse button depressed, the UA would not consider that to start a drag. This is important because otherwise UAs could cause data to be dragged from sensitive sources and dropped into hostile documents without the users consent./p> p>User agents should filter potentially active (scripted) content (e.g. HTML) when it is dragged and when it is dropped, using a safelist of known-safe features. Similarly, a hrefhttps://url.spec.whatwg.org/#syntax-url-relative idsecurity-risks-in-the-drag-and-drop-model:relative-url data-x-internalrelative-url>relative URLs/a> should be turned into absolute URLs to avoid references changing in unexpected ways. This specification does not specify how this is performed./p> div classexample> p>Consider a hostile page providing some content and getting the user to select and drag and drop (or indeed, copy and paste) that content to a victim pages code idsecurity-risks-in-the-drag-and-drop-model:attr-contenteditable>a href#attr-contenteditable>contenteditable/a>/code> region. If the browser does not ensure that only safe content is dragged, potentially unsafe content such as scripts and event handlers in the selection, once dropped (or pasted) into the victim site, get the privileges of the victim site. This would thus enable a cross-site scripting attack./p> /div> h2 idbrowsers>span classsecno>7/span> Loading Web pagesa href#browsers classself-link>/a>/h2> p>This section describes features that apply most directly to Web browsers. Having said that, except where specified otherwise, the requirements defined in this section em>do/em> apply to all user agents, whether they are Web browsers or not./p> h3 idwindows>span classsecno>7.1/span> Browsing contextsa href#windows classself-link>/a>/h3> p>A dfn idbrowsing-context data-export>browsing context/dfn> is an environment in which code idwindows:document>a href#document>Document/a>/code> objects are presented to the user./p> p classnote>A tab or window in a Web browser typically contains a a href#browsing-context idwindows:browsing-context>browsing context/a>, as does an code idwindows:the-iframe-element>a href#the-iframe-element>iframe/a>/code> or code idwindows:frame>a href#frame>frame/a>/code>s in a code idwindows:frameset>a href#frameset>frameset/a>/code>./p> p>A a href#browsing-context idwindows:browsing-context-2>browsing context/a> has a corresponding code idwindows:windowproxy>a href#windowproxy>WindowProxy/a>/code> object./p> p>A a href#browsing-context idwindows:browsing-context-3>browsing context/a> has a a href#session-history idwindows:session-history>session history/a>, which lists the code idwindows:document-2>a href#document>Document/a>/code> objects that the a href#browsing-context idwindows:browsing-context-4>browsing context/a> has presented, is presenting, or will present. A a href#browsing-context idwindows:browsing-context-5>browsing context/a>s dfn idactive-document data-export>active document/dfn> is its code idwindows:windowproxy-2>a href#windowproxy>WindowProxy/a>/code> objects a href#concept-windowproxy-window idwindows:concept-windowproxy-window>Window/a> internal slot values a href#concept-document-window idwindows:concept-document-window>associated code>Document/code>/a>. A dfn data-dfn-forDocument idconcept-document-bc data-ltbrowsing context data-export>code>Document/code>s browsing context/dfn> is the a href#browsing-context idwindows:browsing-context-6>browsing context/a> whose a href#session-history idwindows:session-history-2>session history/a> contains the code idwindows:document-3>a href#document>Document/a>/code>, if any such browsing context exists and has not been a href#a-browsing-context-is-discarded idwindows:a-browsing-context-is-discarded>discarded/a>./p> p classnote>In general, there is a 1-to-1 mapping from the code idwindows:window>a href#window>Window/a>/code> object to the code idwindows:document-4>a href#document>Document/a>/code> object, as long as the code idwindows:document-5>a href#document>Document/a>/code> object has a a href#concept-document-bc idwindows:concept-document-bc>browsing context/a>. There are two exceptions. First, a code idwindows:window-2>a href#window>Window/a>/code> can be reused for the presentation of a second code idwindows:document-6>a href#document>Document/a>/code> in the same a href#browsing-context idwindows:browsing-context-7>browsing context/a>, such that the mapping is then 1-to-2. This occurs when a a href#browsing-context idwindows:browsing-context-8>browsing context/a> is a href#navigate idwindows:navigate>navigated/a> from the initial code idwindows:about:blank>a href#about:blank>about:blank/a>/code> code idwindows:document-7>a href#document>Document/a>/code> to another, with a href#replacement-enabled idwindows:replacement-enabled>replacement enabled/a>. Second, a code idwindows:document-8>a href#document>Document/a>/code> can end up being reused for several code idwindows:window-3>a href#window>Window/a>/code> objects when the code idwindows:dom-document-open>a href#dom-document-open>document.open()/a>/code> method is used, such that the mapping is then many-to-1./p> p classnote>A code idwindows:document-9>a href#document>Document/a>/code> does not necessarily have a a href#concept-document-bc idwindows:concept-document-bc-2>browsing context/a> associated with it. In particular, data mining tools are likely to never instantiate browsing contexts. A code idwindows:document-10>a href#document>Document/a>/code> created using an API such as code idwindows:dom-domimplementation-createdocument>a data-x-internaldom-domimplementation-createdocument hrefhttps://dom.spec.whatwg.org/#dom-domimplementation-createdocument>createDocument()/a>/code> never has a a href#concept-document-bc idwindows:concept-document-bc-3>browsing context/a>. And the code idwindows:document-11>a href#document>Document/a>/code> originally created for an code idwindows:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code> element, which has since been a href#remove-an-element-from-a-document idwindows:remove-an-element-from-a-document>removed from the document/a>, has no associated browsing context, since that browsing context was a href#a-browsing-context-is-discarded idwindows:a-browsing-context-is-discarded-2>discarded/a>./p> p>To dfn idset-the-active-document>set the active document/dfn> of a a href#browsing-context idwindows:browsing-context-9>browsing context/a> var>browsingContext/var> to a code idwindows:document-12>a href#document>Document/a>/code> object var>document/var>, optionally with a code idwindows:window-4>a href#window>Window/a>/code> object var>window/var>, run these steps:/p> ol>li> p>If var>window/var> is not given, let var>window/var> be var>document/var>s a href#concept-relevant-global idwindows:concept-relevant-global>relevant global object/a>./p> p classXXX>Per this standard var>document/var> can be created before var>window/var>, which does not make much sense. See a hrefhttps://github.com/whatwg/html/issues/2688>issue #2688/a>./p> li>p>Set var>browsingContext/var>s code idwindows:windowproxy-3>a href#windowproxy>WindowProxy/a>/code> objects a href#concept-windowproxy-window idwindows:concept-windowproxy-window-2>Window/a> internal slot value to var>window/var>.li>p>Set var>window/var>s a href#concept-document-window idwindows:concept-document-window-2>associated code>Document/code>/a> to var>document/var>.li>p>Set var>window/var>s a href#relevant-settings-object idwindows:relevant-settings-object>relevant settings object/a>s a href#concept-environment-execution-ready-flag idwindows:concept-environment-execution-ready-flag>execution ready flag/a>./ol> hr> p>A a href#browsing-context idwindows:browsing-context-10>browsing context/a> can have a dfn idcreator-browsing-context data-export>creator browsing context/dfn>, the a href#browsing-context idwindows:browsing-context-11>browsing context/a> that was responsible for its creation. If a a href#browsing-context idwindows:browsing-context-12>browsing context/a> has a a href#parent-browsing-context idwindows:parent-browsing-context>parent browsing context/a>, then that is its a href#creator-browsing-context idwindows:creator-browsing-context>creator browsing context/a>. Otherwise, if the a href#browsing-context idwindows:browsing-context-13>browsing context/a> has an a href#opener-browsing-context idwindows:opener-browsing-context>opener browsing context/a>, then em>that/em> is its a href#creator-browsing-context idwindows:creator-browsing-context-2>creator browsing context/a>. Otherwise, the a href#browsing-context idwindows:browsing-context-14>browsing context/a> has no a href#creator-browsing-context idwindows:creator-browsing-context-3>creator browsing context/a>./p> p>If a a href#browsing-context idwindows:browsing-context-15>browsing context/a> var>context/var> has a a href#creator-browsing-context idwindows:creator-browsing-context-4>creator browsing context/a> var>creator/var>, it also has the following properties. In what follows, let var>creator document/var> be var>creator/var>s a href#active-document idwindows:active-document>active document/a> at the time var>context/var> is created:/p> dl>dt>dfn idcreator-origin>creator origin/dfn>dd>var>creator document/var>s a href#concept-origin idwindows:concept-origin>origin/a>dt>dfn idcreator-url>creator URL/dfn>dd>var>creator document/var>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url idwindows:the-documents-address data-x-internalthe-documents-address>URL/a>dt>dfn idcreator-base-url>creator base URL/dfn>dd>var>creator document/var>s a href#document-base-url idwindows:document-base-url>base URL/a>dt>dfn idcreator-referrer-policy>creator referrer policy/dfn>dd>var>creator document/var>s a href#concept-document-referrer-policy idwindows:concept-document-referrer-policy>referrer policy/a>/dl> p>To dfn idcreating-a-new-browsing-context>create a new browsing context/dfn>, optionally given var>noopener/var>:/p> ol>li>p>If var>noopener/var> was not given, let it be false.li>p>Let var>browsingContext/var> be a new a href#browsing-context idwindows:browsing-context-16>browsing context/a>.li> p>Call the JavaScript a hrefhttps://tc39.github.io/ecma262/#sec-initializehostdefinedrealm idwindows:js-initializehostdefinedrealm data-x-internaljs-initializehostdefinedrealm>InitializeHostDefinedRealm()/a> abstract operation with the following customizations:/p> ul>li>p>For the global object, create a new code idwindows:window-5>a href#window>Window/a>/code> object var>window/var>.li>p>For the global b>this/b> value, use var>browsingContext/var>s code idwindows:windowproxy-4>a href#windowproxy>WindowProxy/a>/code> object.li>p>Let var>realm execution context/var> be the created a idwindows:javascript-execution-context hrefhttps://tc39.github.io/ecma262/#sec-execution-contexts data-x-internaljavascript-execution-context>JavaScript execution context/a>./ul> li>p>a href#set-up-a-window-environment-settings-object idwindows:set-up-a-window-environment-settings-object>Set up a window environment settings object/a> with var>realm execution context/var>, and let var>settingsObject/var> be the result.li>p>Let var>document/var> be a new code idwindows:document-13>a href#document>Document/a>/code>, marked as an a hrefhttps://dom.spec.whatwg.org/#html-document idwindows:html-documents data-x-internalhtml-documents>HTML document/a> in a idwindows:quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>, whose a hrefhttps://dom.spec.whatwg.org/#concept-document-content-type idwindows:concept-document-content-type data-x-internalconcept-document-content-type>content type/a> is code>text/html/code>, and which is both a href#ready-for-post-load-tasks idwindows:ready-for-post-load-tasks>ready for post-load tasks/a> and a href#completely-loaded idwindows:completely-loaded>completely loaded/a> immediately.li>p>Ensure that var>document/var> has a single child code idwindows:the-html-element>a href#the-html-element>html/a>/code> node, which itself has two empty child nodes: a code idwindows:the-head-element>a href#the-head-element>head/a>/code> element, and a code idwindows:the-body-element>a href#the-body-element>body/a>/code> element.li>p>a href#set-the-active-document idwindows:set-the-active-document>Set the active document/a> of var>browsingContext/var> to var>document/var>.li> p idabout-blank-origin>Set the a href#concept-origin idwindows:concept-origin-2>origin/a> of var>document/var>:/p> ul>li>p>If var>browsingContext/var> has a a href#creator-browsing-context idwindows:creator-browsing-context-5>creator browsing context/a>, then the a href#concept-origin idwindows:concept-origin-3>origin/a> of var>document/var> is the a href#creator-origin idwindows:creator-origin>creator origin/a>.li>p>Otherwise, the a href#concept-origin idwindows:concept-origin-4>origin/a> of var>document/var> is a unique a href#concept-origin-opaque idwindows:concept-origin-opaque>opaque origin/a>./ul> li>p>If var>browsingContext/var> has a a href#creator-browsing-context idwindows:creator-browsing-context-6>creator browsing context/a>, then set var>document/var>s a href#the-documents-referrer idwindows:the-documents-referrer>referrer/a> to the a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idwindows:concept-url-serializer data-x-internalconcept-url-serializer>serialization/a> of a href#creator-url idwindows:creator-url>creator URL/a>.li>p>If var>browsingContext/var> has a a href#creator-browsing-context idwindows:creator-browsing-context-7>creator browsing context/a>, then set var>document/var>s a href#concept-document-referrer-policy idwindows:concept-document-referrer-policy-2>referrer policy/a> to the a href#creator-referrer-policy idwindows:creator-referrer-policy>creator referrer policy/a>.li>p>a href#implement-the-sandboxing idwindows:implement-the-sandboxing>Implement the sandboxing/a> for var>document/var>.li>p>a href#set-the-allow*-flags idwindows:set-the-allow*-flags>Set the allow* flags/a> for var>document/var>.li>p>Add var>document/var> to var>browsingContext/var>s a href#session-history idwindows:session-history-3>session history/a>.li idcopy-session-storage>p>If var>noopener/var> is false, var>browsingContext/var> is a a href#top-level-browsing-context idwindows:top-level-browsing-context>top-level browsing context/a>, and a href#creator-origin idwindows:creator-origin-2>creator origin/a> is a href#same-origin idwindows:same-origin>same origin/a> with var>document/var>s a href#concept-origin idwindows:concept-origin-5>origin/a>, then copy the code idwindows:dom-sessionstorage>a href#dom-sessionstorage>sessionStorage/a>/code> storage area of the a href#creator-origin idwindows:creator-origin-3>creator origin/a> from the a href#creator-browsing-context idwindows:creator-browsing-context-8>creator browsing context/a> into var>browsingContext/var>s set of session storage areas. These areas must be considered separate, not affecting each other in any way.li>p>Return var>browsingContext/var>./ol> h4 idnested-browsing-contexts>span classsecno>7.1.1/span> Nested browsing contextsa href#nested-browsing-contexts classself-link>/a>/h4> p>Certain elements (for example, code idnested-browsing-contexts:the-iframe-element>a href#the-iframe-element>iframe/a>/code> elements) can instantiate further a href#browsing-context idnested-browsing-contexts:browsing-context>browsing contexts/a>. These elements are called dfn idbrowsing-context-container data-ltbrowsing context container data-export>browsing context containers/dfn>./p> p>Each a href#browsing-context-container idnested-browsing-contexts:browsing-context-container>browsing context container/a> has a dfn idnested-browsing-context data-export>nested browsing context/dfn>, which is either a a href#browsing-context idnested-browsing-contexts:browsing-context-2>browsing context/a> or null./p> p>If a a href#browsing-context idnested-browsing-contexts:browsing-context-3>browsing context/a> is the a href#nested-browsing-context idnested-browsing-contexts:nested-browsing-context>nested browsing context/a> of a a href#browsing-context-container idnested-browsing-contexts:browsing-context-container-2>browsing context container/a>, then the browsing context is said to be dfn idbrowsing-context-nested-through data-export>nested through/dfn> the a href#browsing-context-container idnested-browsing-contexts:browsing-context-container-3>browsing context container/a>s a idnested-browsing-contexts:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>./p> p>A a href#browsing-context idnested-browsing-contexts:browsing-context-4>browsing context/a> var>child/var> is said to be a dfn idchild-browsing-context data-export>child browsing context/dfn> of another a href#browsing-context idnested-browsing-contexts:browsing-context-5>browsing context/a> var>parent/var>, if all of the following conditions hold:/p> ul>li>p>var>child/var> is a a href#nested-browsing-context idnested-browsing-contexts:nested-browsing-context-2>nested browsing context/a> of a a href#browsing-context-container idnested-browsing-contexts:browsing-context-container-4>browsing context container/a> var>element/var>li>p>var>element/var> is a idnested-browsing-contexts:connected hrefhttps://dom.spec.whatwg.org/#connected data-x-internalconnected>connected/a>li>p>var>element/var>s a idnested-browsing-contexts:shadow-including-root hrefhttps://dom.spec.whatwg.org/#concept-shadow-including-root data-x-internalshadow-including-root>shadow-including root/a>s a href#concept-document-bc idnested-browsing-contexts:concept-document-bc>browsing context/a> is var>parent/var>/ul> p>A a href#browsing-context idnested-browsing-contexts:browsing-context-6>browsing context/a> var>child/var> is then a dfn iddocument-tree-child-browsing-context>document-tree child browsing context/dfn> of var>parent/var> if it is a a href#child-browsing-context idnested-browsing-contexts:child-browsing-context>child browsing context/a> and its a href#browsing-context-container idnested-browsing-contexts:browsing-context-container-5>browsing context container/a> is not just a idnested-browsing-contexts:connected-2 hrefhttps://dom.spec.whatwg.org/#connected data-x-internalconnected>connected/a>, but also a idnested-browsing-contexts:in-a-document-tree hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a>./p> p>A a href#browsing-context idnested-browsing-contexts:browsing-context-7>browsing context/a> var>child/var> may have a dfn idparent-browsing-context data-export>parent browsing context/dfn>. This is the unique a href#browsing-context idnested-browsing-contexts:browsing-context-8>browsing context/a> that has var>child/var> as a a href#child-browsing-context idnested-browsing-contexts:child-browsing-context-2>child browsing context/a>, if any such browsing context exists. Otherwise, the a href#browsing-context idnested-browsing-contexts:browsing-context-9>browsing context/a> has no a href#parent-browsing-context idnested-browsing-contexts:parent-browsing-context>parent browsing context/a>./p> p>A a href#browsing-context idnested-browsing-contexts:browsing-context-10>browsing context/a> var>A/var> is said to be an dfn idancestor-browsing-context data-ltancestor browsing context data-export>ancestor/dfn> of a browsing context var>B/var> if there exists a browsing context var>A/var> that is a a href#child-browsing-context idnested-browsing-contexts:child-browsing-context-3>child browsing context/a> of var>A/var> and that is itself an a href#ancestor-browsing-context idnested-browsing-contexts:ancestor-browsing-context>ancestor/a> of var>B/var>, or if the browsing context var>A/var> is the a href#parent-browsing-context idnested-browsing-contexts:parent-browsing-context-2>parent browsing context/a> of var>B/var>./p> p>A a href#browsing-context idnested-browsing-contexts:browsing-context-11>browsing context/a> that is not a a href#nested-browsing-context idnested-browsing-contexts:nested-browsing-context-3>nested browsing context/a> has no a href#parent-browsing-context idnested-browsing-contexts:parent-browsing-context-3>parent browsing context/a>, and is the dfn idtop-level-browsing-context data-export>top-level browsing context/dfn> of all the browsing contexts for which it is an a href#ancestor-browsing-context idnested-browsing-contexts:ancestor-browsing-context-2>ancestor browsing context/a>./p> p>The transitive closure of a href#parent-browsing-context idnested-browsing-contexts:parent-browsing-context-4>parent browsing contexts/a> for a a href#browsing-context idnested-browsing-contexts:browsing-context-12>browsing context/a> that is a a href#nested-browsing-context idnested-browsing-contexts:nested-browsing-context-4>nested browsing context/a> gives the list of a href#ancestor-browsing-context idnested-browsing-contexts:ancestor-browsing-context-3>ancestor browsing contexts/a>./p> p>The dfn idlist-of-the-descendant-browsing-contexts>list of the descendant browsing contexts/dfn> of a code idnested-browsing-contexts:document>a href#document>Document/a>/code> var>d/var> is the (ordered) list returned by the following algorithm:/p> ol>li>p>Let var>list/var> be an empty list.li> p>For each a href#child-browsing-context idnested-browsing-contexts:child-browsing-context-4>child browsing context/a> of var>d/var> that is a href#browsing-context-nested-through idnested-browsing-contexts:browsing-context-nested-through>nested through/a> an element that is a hrefhttps://dom.spec.whatwg.org/#in-a-document idnested-browsing-contexts:in-a-document data-x-internalin-a-document>in the code>Document/code>/a> var>d/var>, in the a idnested-browsing-contexts:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> of the elements nesting those a href#browsing-context idnested-browsing-contexts:browsing-context-13>browsing contexts/a>, run these substeps:/p> ol>li>p>Append that a href#child-browsing-context idnested-browsing-contexts:child-browsing-context-5>child browsing context/a> to the list var>list/var>./p> li>p>Append the a href#list-of-the-descendant-browsing-contexts idnested-browsing-contexts:list-of-the-descendant-browsing-contexts>list of the descendant browsing contexts/a> of the a href#active-document idnested-browsing-contexts:active-document>active document/a> of that a href#child-browsing-context idnested-browsing-contexts:child-browsing-context-6>child browsing context/a> to the list var>list/var>./ol> li>p>Return the constructed var>list/var>./ol> p>A code idnested-browsing-contexts:document-2>a href#document>Document/a>/code> is said to be dfn data-dfn-forDocument idfully-active data-export>fully active/dfn> when it has a a href#concept-document-bc idnested-browsing-contexts:concept-document-bc-2>browsing context/a> and it is the a href#active-document idnested-browsing-contexts:active-document-2>active document/a> of that a href#browsing-context idnested-browsing-contexts:browsing-context-14>browsing context/a>, and either its browsing context is a a href#top-level-browsing-context idnested-browsing-contexts:top-level-browsing-context>top-level browsing context/a>, or it has a a href#parent-browsing-context idnested-browsing-contexts:parent-browsing-context-5>parent browsing context/a> and the code idnested-browsing-contexts:document-3>a href#document>Document/a>/code> a href#browsing-context-nested-through idnested-browsing-contexts:browsing-context-nested-through-2>through which/a> it is a href#nested-browsing-context idnested-browsing-contexts:nested-browsing-context-5>nested/a> is itself a href#fully-active idnested-browsing-contexts:fully-active>fully active/a>./p> p>Because they are associated with an element, a href#child-browsing-context idnested-browsing-contexts:child-browsing-context-7>child browsing contexts/a> are always tied to a specific code idnested-browsing-contexts:document-4>a href#document>Document/a>/code> in their a href#parent-browsing-context idnested-browsing-contexts:parent-browsing-context-6>parent browsing context/a>. User agents must not allow the user to interact with a href#child-browsing-context idnested-browsing-contexts:child-browsing-context-8>child browsing contexts/a> of elements that are in code idnested-browsing-contexts:document-5>a href#document>Document/a>/code>s that are not themselves a href#fully-active idnested-browsing-contexts:fully-active-2>fully active/a>./p> p>A a href#browsing-context idnested-browsing-contexts:browsing-context-15>browsing context/a> that is a a href#nested-browsing-context idnested-browsing-contexts:nested-browsing-context-6>nested browsing context/a> can be put into a dfn iddelaying-load-events-mode>delaying code>load/code> events mode/dfn>. This is used when it is a href#navigate idnested-browsing-contexts:navigate>navigated/a>, to a href#delay-the-load-event idnested-browsing-contexts:delay-the-load-event>delay the load event/a> of its a href#browsing-context-container idnested-browsing-contexts:browsing-context-container-6>browsing context container/a> before the new code idnested-browsing-contexts:document-6>a href#document>Document/a>/code> is created./p> p>The dfn iddocument-family>document family/dfn> of a a href#browsing-context idnested-browsing-contexts:browsing-context-16>browsing context/a> consists of the union of all the code idnested-browsing-contexts:document-7>a href#document>Document/a>/code> objects in that a href#browsing-context idnested-browsing-contexts:browsing-context-17>browsing context/a>s a href#session-history idnested-browsing-contexts:session-history>session history/a> and the a href#document-family idnested-browsing-contexts:document-family>document families/a> of all those code idnested-browsing-contexts:document-8>a href#document>Document/a>/code> objects. The a href#document-family idnested-browsing-contexts:document-family-2>document family/a> of a code idnested-browsing-contexts:document-9>a href#document>Document/a>/code> object consists of the union of all the a href#document-family idnested-browsing-contexts:document-family-3>document families/a> of the a href#browsing-context idnested-browsing-contexts:browsing-context-18>browsing contexts/a> that are a href#browsing-context-nested-through idnested-browsing-contexts:browsing-context-nested-through-3>nested through/a> the code idnested-browsing-contexts:document-10>a href#document>Document/a>/code> object./p> p>The dfn idconcept-bcc-content-document>content document/dfn> of a a href#browsing-context-container idnested-browsing-contexts:browsing-context-container-7>browsing context container/a> var>container/var> is the result of the following algorithm:/p> ol>li>p>If var>container/var>s a href#nested-browsing-context idnested-browsing-contexts:nested-browsing-context-7>nested browsing context/a> is null, then return null.li>p>Let var>context/var> be var>container/var>s a href#nested-browsing-context idnested-browsing-contexts:nested-browsing-context-8>nested browsing context/a>.li>p>Let var>document/var> be var>context/var>s a href#active-document idnested-browsing-contexts:active-document-3>active document/a>.li>p>If var>document/var>s a href#concept-origin idnested-browsing-contexts:concept-origin>origin/a> and the a href#concept-settings-object-origin idnested-browsing-contexts:concept-settings-object-origin>origin/a> specified by the a href#current-settings-object idnested-browsing-contexts:current-settings-object>current settings object/a> are not a href#same-origin-domain idnested-browsing-contexts:same-origin-domain>same origin-domain/a>, then return null.li>p>Return var>document/var>./ol> h5 idnavigating-nested-browsing-contexts-in-the-dom>span classsecno>7.1.1.1/span> Navigating nested browsing contexts in the DOMa href#navigating-nested-browsing-contexts-in-the-dom classself-link>/a>/h5> dl classdomintro>dt>var>window/var> . code idnavigating-nested-browsing-contexts-in-the-dom:dom-top>a href#dom-top>top/a>/code>dd> p>Returns the code idnavigating-nested-browsing-contexts-in-the-dom:windowproxy>a href#windowproxy>WindowProxy/a>/code> for the a href#top-level-browsing-context idnavigating-nested-browsing-contexts-in-the-dom:top-level-browsing-context>top-level browsing context/a>./p> dt>var>window/var> . code idnavigating-nested-browsing-contexts-in-the-dom:dom-parent>a href#dom-parent>parent/a>/code>dd> p>Returns the code idnavigating-nested-browsing-contexts-in-the-dom:windowproxy-2>a href#windowproxy>WindowProxy/a>/code> for the a href#parent-browsing-context idnavigating-nested-browsing-contexts-in-the-dom:parent-browsing-context>parent browsing context/a>./p> dt>var>window/var> . code idnavigating-nested-browsing-contexts-in-the-dom:dom-frameelement>a href#dom-frameelement>frameElement/a>/code>dd> p>Returns the code idnavigating-nested-browsing-contexts-in-the-dom:element>a data-x-internalelement hrefhttps://dom.spec.whatwg.org/#interface-element>Element/a>/code> for the a href#browsing-context-container idnavigating-nested-browsing-contexts-in-the-dom:browsing-context-container>browsing context container/a>./p> p>Returns null if there isnt one, and in cross-origin situations./p> /dl> p>The dfn iddom-top>code>top/code>/dfn> IDL attribute, on getting, must run the following algorithm:/p> ol>li>p>Let var>windowProxy/var> be this code idnavigating-nested-browsing-contexts-in-the-dom:window>a href#window>Window/a>/code> objects code idnavigating-nested-browsing-contexts-in-the-dom:windowproxy-3>a href#windowproxy>WindowProxy/a>/code> object.li>p>If there is no a href#browsing-context idnavigating-nested-browsing-contexts-in-the-dom:browsing-context>browsing context/a> with var>windowProxy/var> as its code idnavigating-nested-browsing-contexts-in-the-dom:windowproxy-4>a href#windowproxy>WindowProxy/a>/code> object, then return null./p> li>p>Let var>context/var> be that a href#browsing-context idnavigating-nested-browsing-contexts-in-the-dom:browsing-context-2>browsing context/a>.li>p>If var>context/var> is a a href#top-level-browsing-context idnavigating-nested-browsing-contexts-in-the-dom:top-level-browsing-context-2>top-level browsing context/a>, then return var>context/var>s code idnavigating-nested-browsing-contexts-in-the-dom:windowproxy-5>a href#windowproxy>WindowProxy/a>/code> object.li>p>Otherwise, var>context/var> must have a a href#top-level-browsing-context idnavigating-nested-browsing-contexts-in-the-dom:top-level-browsing-context-3>top-level browsing context/a> (i.e. an a href#ancestor-browsing-context idnavigating-nested-browsing-contexts-in-the-dom:ancestor-browsing-context>ancestor browsing context/a> with no a href#parent-browsing-context idnavigating-nested-browsing-contexts-in-the-dom:parent-browsing-context-2>parent browsing context/a>). Return that a href#top-level-browsing-context idnavigating-nested-browsing-contexts-in-the-dom:top-level-browsing-context-4>top-level browsing context/a>s code idnavigating-nested-browsing-contexts-in-the-dom:windowproxy-6>a href#windowproxy>WindowProxy/a>/code> object./ol> p>The dfn iddom-parent>code>parent/code>/dfn> IDL attribute, on getting, must run the following algorithm:/p> ol>li>p>Let var>windowProxy/var> be this code idnavigating-nested-browsing-contexts-in-the-dom:window-2>a href#window>Window/a>/code> objects code idnavigating-nested-browsing-contexts-in-the-dom:windowproxy-7>a href#windowproxy>WindowProxy/a>/code> object.li>p>If there is no a href#browsing-context idnavigating-nested-browsing-contexts-in-the-dom:browsing-context-3>browsing context/a> with var>windowProxy/var> as its code idnavigating-nested-browsing-contexts-in-the-dom:windowproxy-8>a href#windowproxy>WindowProxy/a>/code> object, then return null./p> li>p>Let var>context/var> be that a href#browsing-context idnavigating-nested-browsing-contexts-in-the-dom:browsing-context-4>browsing context/a>.li>p>If var>context/var> is a a href#child-browsing-context idnavigating-nested-browsing-contexts-in-the-dom:child-browsing-context>child browsing context/a> of another a href#browsing-context idnavigating-nested-browsing-contexts-in-the-dom:browsing-context-5>browsing context/a> var>parent/var>, then return var>parent/var>s code idnavigating-nested-browsing-contexts-in-the-dom:windowproxy-9>a href#windowproxy>WindowProxy/a>/code> object.li>p>Otherwise, var>context/var> must be a a href#top-level-browsing-context idnavigating-nested-browsing-contexts-in-the-dom:top-level-browsing-context-5>top-level browsing context/a>. Return var>context/var>s code idnavigating-nested-browsing-contexts-in-the-dom:windowproxy-10>a href#windowproxy>WindowProxy/a>/code> object./ol> p>The dfn iddom-frameelement>code>frameElement/code>/dfn> IDL attribute, on getting, must run the following algorithm:/p> ol>li>p>Let var>windowProxy/var> be this code idnavigating-nested-browsing-contexts-in-the-dom:window-3>a href#window>Window/a>/code> objects code idnavigating-nested-browsing-contexts-in-the-dom:windowproxy-11>a href#windowproxy>WindowProxy/a>/code> object.li>p>If there is no a href#browsing-context idnavigating-nested-browsing-contexts-in-the-dom:browsing-context-6>browsing context/a> with var>windowProxy/var> as its code idnavigating-nested-browsing-contexts-in-the-dom:windowproxy-12>a href#windowproxy>WindowProxy/a>/code> object, then return null./p> li>p>Let var>context/var> be that a href#browsing-context idnavigating-nested-browsing-contexts-in-the-dom:browsing-context-7>browsing context/a>.li>p>If var>context/var> is not a a href#nested-browsing-context idnavigating-nested-browsing-contexts-in-the-dom:nested-browsing-context>nested browsing context/a>, then return null.li>p>Let var>container/var> be var>context/var>s a href#browsing-context-container idnavigating-nested-browsing-contexts-in-the-dom:browsing-context-container-2>browsing context container/a>.li>p>If var>container/var>s a idnavigating-nested-browsing-contexts-in-the-dom:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#concept-origin idnavigating-nested-browsing-contexts-in-the-dom:concept-origin>origin/a> is not a href#same-origin-domain idnavigating-nested-browsing-contexts-in-the-dom:same-origin-domain>same origin-domain/a> with the a href#current-settings-object idnavigating-nested-browsing-contexts-in-the-dom:current-settings-object>current settings object/a>s a href#concept-settings-object-origin idnavigating-nested-browsing-contexts-in-the-dom:concept-settings-object-origin>origin/a>, then return null.li>p>Return var>container/var>./ol> div classexample> p>An example of when these IDL attributes can return null is as follows:/p> pre><!DOCTYPE html><iframe></iframe><script>use strict;const element document.querySelector(iframe);const iframeWindow element.contentWindow;element.remove();console.assert(iframeWindow.top null);console.assert(iframeWindow.parent null);console.assert(iframeWindow.frameElement null);</script>/pre> p>Here the a href#browsing-context idnavigating-nested-browsing-contexts-in-the-dom:browsing-context-8>browsing context/a> corresponding to code>iframeWindow/code> was a href#a-browsing-context-is-discarded idnavigating-nested-browsing-contexts-in-the-dom:a-browsing-context-is-discarded>discarded/a> when code>element/code> was removed from the document./p> /div> h4 idauxiliary-browsing-contexts>span classsecno>7.1.2/span> Auxiliary browsing contextsa href#auxiliary-browsing-contexts classself-link>/a>/h4> p>It is possible to create new browsing contexts that are related to a a href#top-level-browsing-context idauxiliary-browsing-contexts:top-level-browsing-context>top-level browsing context/a> without being nested through an element. Such browsing contexts are called dfn idauxiliary-browsing-context data-ltauxiliary browsing context data-export>auxiliary browsing contexts/dfn>. Auxiliary browsing contexts are always a href#top-level-browsing-context idauxiliary-browsing-contexts:top-level-browsing-context-2 data-lttop-level browsing context data-export>top-level browsing contexts/a>./p> p>An a href#auxiliary-browsing-context idauxiliary-browsing-contexts:auxiliary-browsing-context>auxiliary browsing context/a> has an dfn idopener-browsing-context data-export>opener browsing context/dfn>, which is the a href#browsing-context idauxiliary-browsing-contexts:browsing-context>browsing context/a> from which the a href#auxiliary-browsing-context idauxiliary-browsing-contexts:auxiliary-browsing-context-2>auxiliary browsing context/a> was created./p> h5 idnavigating-auxiliary-browsing-contexts-in-the-dom>span classsecno>7.1.2.1/span> Navigating auxiliary browsing contexts in the DOMa href#navigating-auxiliary-browsing-contexts-in-the-dom classself-link>/a>/h5> p>The dfn iddom-opener>code>opener/code>/dfn> IDL attribute on the code idnavigating-auxiliary-browsing-contexts-in-the-dom:window>a href#window>Window/a>/code> object, on getting, must return the code idnavigating-auxiliary-browsing-contexts-in-the-dom:windowproxy>a href#windowproxy>WindowProxy/a>/code> object of the a href#browsing-context idnavigating-auxiliary-browsing-contexts-in-the-dom:browsing-context>browsing context/a> from which the current a href#browsing-context idnavigating-auxiliary-browsing-contexts-in-the-dom:browsing-context-2>browsing context/a> was created (its a href#opener-browsing-context idnavigating-auxiliary-browsing-contexts-in-the-dom:opener-browsing-context>opener browsing context/a>), if there is one, if it is still available, and if the current a href#browsing-context idnavigating-auxiliary-browsing-contexts-in-the-dom:browsing-context-3>browsing context/a> has not i idnavigating-auxiliary-browsing-contexts-in-the-dom:disowned-its-opener>a href#disowned-its-opener>disowned its opener/a>/i>; otherwise, it must return null. On setting, if the new value is null then the current a href#browsing-context idnavigating-auxiliary-browsing-contexts-in-the-dom:browsing-context-4>browsing context/a> must dfn iddisowned-its-opener data-export>disown its opener/dfn>; if the new value is anything else then the user agent must call the DefineOwnProperty internal method of the code idnavigating-auxiliary-browsing-contexts-in-the-dom:window-2>a href#window>Window/a>/code> object, passing the property name code>opener/code> as the property key, and the Property Descriptor { Value: var>value/var>, Writable: true, Enumerable: true, Configurable: true } as the property descriptor, where var>value/var> is the new value./p> div classnote> p>If a a href#browsing-context idnavigating-auxiliary-browsing-contexts-in-the-dom:browsing-context-5>browsing context/a> has a href#disowned-its-opener idnavigating-auxiliary-browsing-contexts-in-the-dom:disowned-its-opener-2>disowned its opener/a>, the value of its code idnavigating-auxiliary-browsing-contexts-in-the-dom:dom-opener>a href#dom-opener>window.opener/a>/code> is code>null/code>. That prevents scripts in the a href#browsing-context idnavigating-auxiliary-browsing-contexts-in-the-dom:browsing-context-6>browsing context/a> from changing any properties of its a href#opener-browsing-context idnavigating-auxiliary-browsing-contexts-in-the-dom:opener-browsing-context-2>opener browsing context/a>s code idnavigating-auxiliary-browsing-contexts-in-the-dom:window-3>a href#window>Window/a>/code> (i.e., the window from which the a href#browsing-context idnavigating-auxiliary-browsing-contexts-in-the-dom:browsing-context-7>browsing context/a> was created)./p> p>Otherwise, if a a href#browsing-context idnavigating-auxiliary-browsing-contexts-in-the-dom:browsing-context-8>browsing context/a> has em>not/em> a href#disowned-its-opener idnavigating-auxiliary-browsing-contexts-in-the-dom:disowned-its-opener-3>disowned its opener/a>, then scripts in that a href#browsing-context idnavigating-auxiliary-browsing-contexts-in-the-dom:browsing-context-9>browsing context/a> can use code idnavigating-auxiliary-browsing-contexts-in-the-dom:dom-opener-2>a href#dom-opener>window.opener/a>/code> to change properties of its a href#opener-browsing-context idnavigating-auxiliary-browsing-contexts-in-the-dom:opener-browsing-context-3>opener browsing context/a>s code idnavigating-auxiliary-browsing-contexts-in-the-dom:window-4>a href#window>Window/a>/code>. For example, a script running in the a href#browsing-context idnavigating-auxiliary-browsing-contexts-in-the-dom:browsing-context-10>browsing context/a> can change the value of code>window.opener.location/code>, causing the a href#opener-browsing-context idnavigating-auxiliary-browsing-contexts-in-the-dom:opener-browsing-context-4>opener browsing context/a> to navigate to a completely different document./p> /div> h4 idsecurity-nav>span classsecno>7.1.3/span> Securitya href#security-nav classself-link>/a>/h4> p idsecurity-1>A a href#browsing-context idsecurity-nav:browsing-context>browsing context/a> var>A/var> is dfn idfamiliar-with>familiar with/dfn> a second a href#browsing-context idsecurity-nav:browsing-context-2>browsing context/a> var>B/var> if one of the following conditions is true:/p> ul>li>Either the a href#concept-origin idsecurity-nav:concept-origin>origin/a> of the a href#active-document idsecurity-nav:active-document>active document/a> of var>A/var> is the a href#same-origin idsecurity-nav:same-origin>same/a> as the a href#concept-origin idsecurity-nav:concept-origin-2>origin/a> of the a href#active-document idsecurity-nav:active-document-2>active document/a> of var>B/var>, orli>The browsing context var>A/var> is a a href#nested-browsing-context idsecurity-nav:nested-browsing-context>nested browsing context/a> with a a href#top-level-browsing-context idsecurity-nav:top-level-browsing-context>top-level browsing context/a>, and its a href#top-level-browsing-context idsecurity-nav:top-level-browsing-context-2>top-level browsing context/a> is var>B/var>, orli>The browsing context var>B/var> is an a href#auxiliary-browsing-context idsecurity-nav:auxiliary-browsing-context>auxiliary browsing context/a> and var>A/var> is a href#familiar-with idsecurity-nav:familiar-with>familiar with/a> var>B/var>s a href#opener-browsing-context idsecurity-nav:opener-browsing-context>opener browsing context/a>, orli>The browsing context var>B/var> is not a a href#top-level-browsing-context idsecurity-nav:top-level-browsing-context-3>top-level browsing context/a>, but there exists an a href#ancestor-browsing-context idsecurity-nav:ancestor-browsing-context>ancestor browsing context/a> of var>B/var> whose a href#active-document idsecurity-nav:active-document-3>active document/a> has the a href#same-origin idsecurity-nav:same-origin-2>same/a> a href#concept-origin idsecurity-nav:concept-origin-3>origin/a> as the a href#active-document idsecurity-nav:active-document-4>active document/a> of var>A/var> (possibly in fact being var>A/var> itself)./ul> hr> p>A a href#browsing-context idsecurity-nav:browsing-context-3>browsing context/a> var>A/var> is dfn idallowed-to-navigate>allowed to navigate/dfn> a second a href#browsing-context idsecurity-nav:browsing-context-4>browsing context/a> var>B/var> if the following algorithm terminates positively:/p> ol>li>p>If var>A/var> is not the same a href#browsing-context idsecurity-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 idsecurity-nav:ancestor-browsing-context-2>ancestor browsing contexts/a> of var>B/var>, and var>B/var> is not a a href#top-level-browsing-context idsecurity-nav:top-level-browsing-context-4>top-level browsing context/a>, and var>A/var>s a href#active-document idsecurity-nav:active-document-5>active document/a>s a href#active-sandboxing-flag-set idsecurity-nav:active-sandboxing-flag-set>active sandboxing flag set/a> has its a href#sandboxed-navigation-browsing-context-flag idsecurity-nav:sandboxed-navigation-browsing-context-flag>sandboxed navigation browsing context flag/a> set, then abort these steps negatively.li> p>Otherwise, if var>B/var> is a a href#top-level-browsing-context idsecurity-nav:top-level-browsing-context-5>top-level browsing context/a>, and is one of the a href#ancestor-browsing-context idsecurity-nav:ancestor-browsing-context-3>ancestor browsing contexts/a> of var>A/var>, then:/p> ol>li>p>If this algorithm is a href#triggered-by-user-activation idsecurity-nav:triggered-by-user-activation>triggered by user activation/a> and var>A/var>s a href#active-document idsecurity-nav:active-document-6>active document/a>s a href#active-sandboxing-flag-set idsecurity-nav:active-sandboxing-flag-set-2>active sandboxing flag set/a> has its a href#sandboxed-top-level-navigation-with-user-activation-browsing-context-flag idsecurity-nav:sandboxed-top-level-navigation-with-user-activation-browsing-context-flag>sandboxed top-level navigation with user activation browsing context flag/a> set, then abort these steps negatively.li>p>Otherwise, If this algorithm is not a href#triggered-by-user-activation idsecurity-nav:triggered-by-user-activation-2>triggered by user activation/a> and var>A/var>s a href#active-document idsecurity-nav:active-document-7>active document/a>s a href#active-sandboxing-flag-set idsecurity-nav:active-sandboxing-flag-set-3>active sandboxing flag set/a> has its a href#sandboxed-top-level-navigation-without-user-activation-browsing-context-flag idsecurity-nav:sandboxed-top-level-navigation-without-user-activation-browsing-context-flag>sandboxed top-level navigation without user activation browsing context flag/a> set, then abort these steps negatively./ol> li>p>Otherwise, if var>B/var> is a a href#top-level-browsing-context idsecurity-nav:top-level-browsing-context-6>top-level browsing context/a>, and is neither var>A/var> nor one of the a href#ancestor-browsing-context idsecurity-nav:ancestor-browsing-context-4>ancestor browsing contexts/a> of var>A/var>, and var>A/var>s code idsecurity-nav:document>a href#document>Document/a>/code>s a href#active-sandboxing-flag-set idsecurity-nav:active-sandboxing-flag-set-4>active sandboxing flag set/a> has its a href#sandboxed-navigation-browsing-context-flag idsecurity-nav:sandboxed-navigation-browsing-context-flag-2>sandboxed navigation browsing context flag/a> set, and var>A/var> is not the a href#one-permitted-sandboxed-navigator idsecurity-nav:one-permitted-sandboxed-navigator>one permitted sandboxed navigator/a> of var>B/var>, then abort these steps negatively.li>p>Otherwise, terminate positively!/ol> hr> p>An element has a dfn idbrowsing-context-scope-origin>browsing context scope origin/dfn> if its code idsecurity-nav:document-2>a href#document>Document/a>/code>s a href#concept-document-bc idsecurity-nav:concept-document-bc>browsing context/a> is a a href#top-level-browsing-context idsecurity-nav:top-level-browsing-context-7>top-level browsing context/a> or if all of its code idsecurity-nav:document-3>a href#document>Document/a>/code>s a href#ancestor-browsing-context idsecurity-nav:ancestor-browsing-context-5>ancestor browsing contexts/a> all have a href#active-document idsecurity-nav:active-document-8>active documents/a> whose a href#concept-origin idsecurity-nav:concept-origin-4>origin/a> are the a href#same-origin idsecurity-nav:same-origin-3>same origin/a> as the elements a idsecurity-nav:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#concept-origin idsecurity-nav:concept-origin-5>origin/a>. If an element has a a href#browsing-context-scope-origin idsecurity-nav:browsing-context-scope-origin>browsing context scope origin/a>, then its value is the a href#concept-origin idsecurity-nav:concept-origin-6>origin/a> of the elements a idsecurity-nav:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>./p> h4 idgroupings-of-browsing-contexts>span classsecno>7.1.4/span> Groupings of browsing contextsa href#groupings-of-browsing-contexts classself-link>/a>/h4> p>Each a href#browsing-context idgroupings-of-browsing-contexts:browsing-context>browsing context/a> is defined as having a list of one or more dfn iddirectly-reachable-browsing-contexts>directly reachable browsing contexts/dfn>. These are:/p> ul>li>The a href#browsing-context idgroupings-of-browsing-contexts:browsing-context-2>browsing context/a> itself.li>All the a href#browsing-context idgroupings-of-browsing-contexts:browsing-context-3>browsing context/a>s a href#child-browsing-context idgroupings-of-browsing-contexts:child-browsing-context>child browsing contexts/a>.li>The a href#browsing-context idgroupings-of-browsing-contexts:browsing-context-4>browsing context/a>s a href#parent-browsing-context idgroupings-of-browsing-contexts:parent-browsing-context>parent browsing context/a>.li>All the a href#browsing-context idgroupings-of-browsing-contexts:browsing-context-5>browsing contexts/a> that have the a href#browsing-context idgroupings-of-browsing-contexts:browsing-context-6>browsing context/a> as their a href#opener-browsing-context idgroupings-of-browsing-contexts:opener-browsing-context>opener browsing context/a>.li>The a href#browsing-context idgroupings-of-browsing-contexts:browsing-context-7>browsing context/a>s a href#opener-browsing-context idgroupings-of-browsing-contexts:opener-browsing-context-2>opener browsing context/a>./ul> p>The transitive closure of all the a href#browsing-context idgroupings-of-browsing-contexts:browsing-context-8>browsing contexts/a> that are a href#directly-reachable-browsing-contexts idgroupings-of-browsing-contexts:directly-reachable-browsing-contexts>directly reachable browsing contexts/a> forms a dfn idunit-of-related-browsing-contexts>unit of related browsing contexts/dfn>./p> p>Each a href#unit-of-related-browsing-contexts idgroupings-of-browsing-contexts:unit-of-related-browsing-contexts>unit of related browsing contexts/a> is then further divided into the smallest number of groups such that every member of each group has an a href#active-document idgroupings-of-browsing-contexts:active-document>active document/a> with an a href#concept-origin idgroupings-of-browsing-contexts:concept-origin>origin/a> that, through appropriate manipulation of the code idgroupings-of-browsing-contexts:dom-document-domain>a href#dom-document-domain>document.domain/a>/code> attribute, could be made to be a href#same-origin-domain idgroupings-of-browsing-contexts:same-origin-domain>same origin-domain/a> with other members of the group, but could not be made the same as members of any other group. Each such group is a dfn idunit-of-related-similar-origin-browsing-contexts data-export>unit of related similar-origin browsing contexts/dfn>./p> p classnote>There is also at most one a href#event-loop idgroupings-of-browsing-contexts:event-loop>event loop/a> per a href#unit-of-related-similar-origin-browsing-contexts idgroupings-of-browsing-contexts:unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts/a> (though several a href#unit-of-related-similar-origin-browsing-contexts idgroupings-of-browsing-contexts:unit-of-related-similar-origin-browsing-contexts-2>units of related similar-origin browsing contexts/a> can have a shared a href#event-loop idgroupings-of-browsing-contexts:event-loop-2>event loop/a>)./p> h4 idbrowsing-context-names>span classsecno>7.1.5/span> Browsing context namesa href#browsing-context-names classself-link>/a>/h4> p>Browsing contexts can have a dfn idbrowsing-context-name>browsing context name/dfn>. Unless stated otherwise, it is the empty string./p> p>A dfn idvalid-browsing-context-name>valid browsing context name/dfn> is any string with at least one character that does not start with a U+005F LOW LINE character. (Names starting with an underscore are reserved for special keywords.)/p> p>A dfn idvalid-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 idbrowsing-context-names:valid-browsing-context-name>valid browsing context name/a> or that is an a idbrowsing-context-names:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for one of: code>_blank/code>, code>_self/code>, code>_parent/code>, or code>_top/code>./p> p>These values have different meanings based on whether the page is sandboxed or not, as summarized in the following (non-normative) table. In this table, current means the a href#browsing-context idbrowsing-context-names:browsing-context>browsing context/a> that the link or script is in, parent means the a href#parent-browsing-context idbrowsing-context-names:parent-browsing-context>parent browsing context/a> of the one the link or script is in, top means the a href#top-level-browsing-context idbrowsing-context-names:top-level-browsing-context>top-level browsing context/a> of the one the link or script is in, new means a new a href#top-level-browsing-context idbrowsing-context-names:top-level-browsing-context-2>top-level browsing context/a> or a href#auxiliary-browsing-context idbrowsing-context-names:auxiliary-browsing-context>auxiliary browsing context/a> is to be created, subject to various user preferences and user agent policies, none means that nothing will happen, and maybe new means the same as new if the code idbrowsing-context-names:attr-iframe-sandbox-allow-popups>a href#attr-iframe-sandbox-allow-popups>allow-popups/a>/code> keyword is also specified on the code idbrowsing-context-names:attr-iframe-sandbox>a href#attr-iframe-sandbox>sandbox/a>/code> attribute (or if the user overrode the sandboxing), and the same as none otherwise./p> table>thead>tr>th rowspan2>Keyword th rowspan2>Ordinary effect th colspan2>Effect in an code idbrowsing-context-names:the-iframe-element>a href#the-iframe-element>iframe/a>/code> with... tr>th>code>sandbox/code> th>code>sandboxallow-top-navigation/code> tbody>tr>td>none specified, for links and form submissions td>current td>current td>current tr>td>empty string td>current td>current td>current tr>td>code>_blank/code> td>new td>maybe new td>maybe new tr>td>code>_self/code> td>current td>current td>current tr>td>code>_parent/code> if there isnt a parent td>current td>current td>current tr>td>code>_parent/code> if parent is also top td>parent/top td>none td>parent/top tr>td>code>_parent/code> if there is one and its not top td>parent td>none td>none tr>td>code>_top/code> if top is current td>current td>current td>current tr>td>code>_top/code> if top is not current td>top td>none td>top tr>td>name that doesnt exist td>new td>maybe new td>maybe new tr>td>name that exists and is a descendant td>specified descendant td>specified descendant td>specified descendant tr>td>name that exists and is current td>current td>current td>current tr>td>name that exists and is an ancestor that is top td>specified ancestor td>none td>specified ancestor/top tr>td>name that exists and is an ancestor that is not top td>specified ancestor td>none td>none tr>td>other name that exists with common top td>specified td>none td>none tr>td>name that exists with different top, if a href#familiar-with idbrowsing-context-names:familiar-with>familiar/a> and a href#one-permitted-sandboxed-navigator idbrowsing-context-names:one-permitted-sandboxed-navigator>one permitted sandboxed navigator/a> td>specified td>specified td>specified tr>td>name that exists with different top, if a href#familiar-with idbrowsing-context-names:familiar-with-2>familiar/a> but not a href#one-permitted-sandboxed-navigator idbrowsing-context-names:one-permitted-sandboxed-navigator-2>one permitted sandboxed navigator/a> td>specified td>none td>none tr>td>name that exists with different top, not a href#familiar-with idbrowsing-context-names:familiar-with-3>familiar/a> td>new td>maybe new td>maybe new /table> p classtablenote>small>Most of the restrictions on sandboxed browsing contexts are applied by other algorithms, e.g. the a href#navigate idbrowsing-context-names:navigate>navigation/a> algorithm, not a href#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name idbrowsing-context-names:the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context/a> given below./small>/p> hr> p>dfn idthe-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>The rules for choosing a browsing context/dfn>, given null or a a href#browsing-context-name idbrowsing-context-names:browsing-context-name>browsing context name/a> var>name/var>, a a href#browsing-context idbrowsing-context-names:browsing-context-2>browsing context/a> var>current/var>, and a boolean var>noopener/var> are as follows:/p> ol>li>p>Let var>chosen/var> be null.li>p>Let var>new/var> be false.li>p>If var>name/var> is the empty string or an a idbrowsing-context-names:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for code>_self/code>, then set var>chosen/var> to var>current/var>.li>p>If var>name/var> is an a idbrowsing-context-names:ascii-case-insensitive-3 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for code>_parent/code>, then set var>chosen/var> to var>current/var>s a href#parent-browsing-context idbrowsing-context-names:parent-browsing-context-2>parent browsing context/a>, if any, and var>current/var> otherwise.li>p>If var>name/var> is an a idbrowsing-context-names:ascii-case-insensitive-4 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for code>_top/code>, then set var>chosen/var> to var>current/var>s a href#top-level-browsing-context idbrowsing-context-names:top-level-browsing-context-3>top-level browsing context/a>, if any, and var>current/var> otherwise.li> p>If var>name/var> is not an a idbrowsing-context-names:ascii-case-insensitive-5 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for code>_blank/code> and there exists a browsing context whose a href#browsing-context-name idbrowsing-context-names:browsing-context-name-2>name/a> is the same as var>name/var>, and var>current/var> is a href#familiar-with idbrowsing-context-names:familiar-with-4>familiar with/a> that browsing context, and the user agent determines that the two browsing contexts are related enough that it is ok if they reach each other, then set var>chosen/var> to that browsing context. If there are multiple matching browsing contexts, the user agent should set var>chosen/var> to one in some arbitrary consistent manner, such as the most recently opened, most recently focused, or more closely related./p> p classXXX>This will be made more precise in a hrefhttps://github.com/whatwg/html/issues/1440>issue #1440/a>. li> p>Otherwise, a new browsing context is being requested, and what happens depends on the user agents configuration and abilities — it is determined by the rules given for the first applicable option from the following list:/p> dl classswitch>dt idpopup-blocker>If the algorithm is not a href#triggered-by-user-activation idbrowsing-context-names:triggered-by-user-activation>triggered by user activation/a> and the user agent has been configured to not show popups (i.e. the user agent has a popup blocker enabled)dd>p>The user agent may inform the user that a popup has been blocked.dt idsandboxWindowOpen>If var>current/var>s a href#active-document idbrowsing-context-names:active-document>active document/a>s a href#active-sandboxing-flag-set idbrowsing-context-names:active-sandboxing-flag-set>active sandboxing flag set/a> has the a href#sandboxed-auxiliary-navigation-browsing-context-flag idbrowsing-context-names:sandboxed-auxiliary-navigation-browsing-context-flag>sandboxed auxiliary navigation browsing context flag/a> set.dd> p>The user agent may offer the user one of: ol>li>p>Set var>chosen/var> to a a href#creating-a-new-browsing-context idbrowsing-context-names:creating-a-new-browsing-context>new/a> a href#top-level-browsing-context idbrowsing-context-names:top-level-browsing-context-4>top-level browsing context/a> given var>noopener/var>, and set var>new/var> to true.li>p>Set var>chosen/var> to an existing a href#top-level-browsing-context idbrowsing-context-names:top-level-browsing-context-5>top-level browsing context/a>./p> /ol> p classwarning>If this case occurs, it means that an author has explicitly sandboxed the document that is trying to open a link./p> p classnote>If the user declines or the user agent doesnt offer the above, the variables remain unchanged./p> dt idnoopener>If the user agent has been configured such that in this instance it will create a new browsing context:dd> p>Set var>chosen/var> to a a href#creating-a-new-browsing-context idbrowsing-context-names:creating-a-new-browsing-context-2>new/a> a href#auxiliary-browsing-context idbrowsing-context-names:auxiliary-browsing-context-2>auxiliary browsing context/a> given var>noopener/var> with the a href#opener-browsing-context idbrowsing-context-names:opener-browsing-context>opener browsing context/a> being var>current/var>, and set var>new/var> to true. If var>name/var> is not an a idbrowsing-context-names:ascii-case-insensitive-6 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for code>_blank/code>, then var>chosen/var>s a href#browsing-context-name idbrowsing-context-names:browsing-context-name-3>name/a> must be set to var>name/var> (otherwise, it has no name)./p> p classnote>If the newly created a href#browsing-context idbrowsing-context-names:browsing-context-3>browsing context/a> is immediately a href#navigate idbrowsing-context-names:navigate-2>navigated/a>, then the navigation will be done with a href#replacement-enabled idbrowsing-context-names:replacement-enabled>replacement enabled/a>./p> dt>If the user agent has been configured such that in this instance it will reuse var>current/var>dd>p>Set var>chosen/var> to var>current/var>.dt>If the user agent has been configured such that in this instance it will not find a browsing contextdd>p>Do nothing./dl> p classnote>User agents are encouraged to provide a way for users to configure the user agent to always reuse var>current/var>./p> p>If var>new/var> is true, then:/p> ol>li>p>Let var>flagSet/var> be var>current/var>s a href#active-document idbrowsing-context-names:active-document-2>active document/a>s a href#active-sandboxing-flag-set idbrowsing-context-names:active-sandboxing-flag-set-2>active sandboxing flag set/a>.li>p>If var>flagSet/var>s a href#sandboxed-navigation-browsing-context-flag idbrowsing-context-names:sandboxed-navigation-browsing-context-flag>sandboxed navigation browsing context flag/a> is set, then var>current/var> must be set as var>chosen/var>s a href#one-permitted-sandboxed-navigator idbrowsing-context-names:one-permitted-sandboxed-navigator-3>one permitted sandboxed navigator/a>.li>p>If var>flagSet/var>s a href#sandbox-propagates-to-auxiliary-browsing-contexts-flag idbrowsing-context-names:sandbox-propagates-to-auxiliary-browsing-contexts-flag>sandbox propagates to auxiliary browsing contexts flag/a> is set, then all the flags that are set in var>flagSet/var> must be set in var>chosen/var>s a href#popup-sandboxing-flag-set idbrowsing-context-names:popup-sandboxing-flag-set>popup sandboxing flag set/a>./ol> li>p>Return var>chosen/var> and var>new/var>./ol> h3 idcross-origin-objects>span classsecno>7.2/span> Security infrastructure for code idcross-origin-objects:window>a href#window>Window/a>/code>, code idcross-origin-objects:windowproxy>a href#windowproxy>WindowProxy/a>/code>, and code idcross-origin-objects:location>a href#location>Location/a>/code> objectsa href#cross-origin-objects classself-link>/a>/h3> p>Although typically objects cannot be accessed across a href#concept-origin idcross-origin-objects:concept-origin>origins/a>, the web platform would not be true to itself if it did not have some legacy exceptions to that rule that the web depends upon. h4 idintegration-with-idl>span classsecno>7.2.1/span> Integration with IDLa href#integration-with-idl classself-link>/a>/h4> p>When a idintegration-with-idl:perform-a-security-check hrefhttps://heycam.github.io/webidl/#dfn-perform-a-security-check data-x-internalperform-a-security-check>perform a security check/a> is invoked, with a var>platformObject/var>, var>identifier/var>, and var>type/var>, run these steps:/p> ol>li> p>If var>platformObject/var> is a code idintegration-with-idl:window>a href#window>Window/a>/code> or code idintegration-with-idl:location>a href#location>Location/a>/code> object, then:/p> ol>li> p>Repeat for each var>e/var> that is an element of ! a href#crossoriginproperties-(-o-) idintegration-with-idl:crossoriginproperties-(-o-)>CrossOriginProperties/a>(var>platformObject/var>):/p> ol>li> p>If a idintegration-with-idl:samevalue hrefhttps://tc39.github.io/ecma262/#sec-samevalue data-x-internalsamevalue>SameValue/a>(var>e/var>.Property, var>identifier/var>) is true, then:/p> ol>li>p>If var>type/var> is code>method/code> and var>e/var> has neither NeedsGet nor NeedsSet, then return.li>p>Otherwise, if var>type/var> is code>getter/code> and var>e/var>.NeedsGet is true, then return.li>p>Otherwise, if var>type/var> is code>setter/code> and var>e/var>.NeedsSet is true, then return./ol> /ol> /ol> li>p>If ! a href#isplatformobjectsameorigin-(-o-) idintegration-with-idl:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin/a>(var>platformObject/var>) is false, then throw a a idintegration-with-idl:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idintegration-with-idl:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./ol> h4 idshared-internal-slot:-crossoriginpropertydescriptormap>span classsecno>7.2.2/span> Shared internal slot: CrossOriginPropertyDescriptorMapa href#shared-internal-slot:-crossoriginpropertydescriptormap classself-link>/a>/h4> p>code idshared-internal-slot:-crossoriginpropertydescriptormap:window>a href#window>Window/a>/code> and code idshared-internal-slot:-crossoriginpropertydescriptormap:location>a href#location>Location/a>/code> objects both have a dfn idcrossoriginpropertydescriptormap>CrossOriginPropertyDescriptorMap/dfn> internal slot, whose value is initially an empty map. p classnote>The a href#crossoriginpropertydescriptormap idshared-internal-slot:-crossoriginpropertydescriptormap:crossoriginpropertydescriptormap>CrossOriginPropertyDescriptorMap/a> internal slot contains a map with entries whose keys are (var>currentGlobal/var>, var>objectGlobal/var>, var>propertyKey/var>)-tuples and values are property descriptors, as a memoization of what is visible to scripts when var>currentGlobal/var> inspects a code idshared-internal-slot:-crossoriginpropertydescriptormap:window-2>a href#window>Window/a>/code> or code idshared-internal-slot:-crossoriginpropertydescriptormap:location-2>a href#location>Location/a>/code> object from var>objectGlobal/var>. It is filled lazily by a href#crossorigingetownpropertyhelper-(-o,-p-) idshared-internal-slot:-crossoriginpropertydescriptormap:crossorigingetownpropertyhelper-(-o,-p-)>CrossOriginGetOwnPropertyHelper/a>, which consults it on future lookups./p> p>User agents should allow a value held in the map to be garbage collected along with its corresponding key when nothing holds a reference to any part of the value. That is, as long as garbage collection is not observable./p> p classexample>For example, with code>const href Object.getOwnPropertyDescriptor(crossOriginLocation, href).set/code> the value and its corresponding key in the map cannot be garbage collected as that would be observable./p> p>User agents may have an optimization whereby they remove key-value pairs from the map when code idshared-internal-slot:-crossoriginpropertydescriptormap:dom-document-domain>a href#dom-document-domain>document.domain/a>/code> is set. This is not observable as code idshared-internal-slot:-crossoriginpropertydescriptormap:dom-document-domain-2>a href#dom-document-domain>document.domain/a>/code> cannot revisit an earlier value./p> p classexample>For example, setting code idshared-internal-slot:-crossoriginpropertydescriptormap:dom-document-domain-3>a href#dom-document-domain>document.domain/a>/code> to code>example.com/code> on www.example.com means user agents can remove all key-value pairs from the map where part of the key is www.example.com, as that can never be part of the a href#concept-origin idshared-internal-slot:-crossoriginpropertydescriptormap:concept-origin>origin/a> again and therefore the corresponding value could never be retrieved from the map./p> h4 idshared-abstract-operations>span classsecno>7.2.3/span> Shared abstract operationsa href#shared-abstract-operations classself-link>/a>/h4> h5 idcrossoriginproperties-(-o-)>span classsecno>7.2.3.1/span> dfn>CrossOriginProperties/dfn> ( var>O/var> )a href#crossoriginproperties-(-o-) classself-link>/a>/h5> ol>li>p>Assert: var>O/var> is a code idcrossoriginproperties-(-o-):location>a href#location>Location/a>/code> or code idcrossoriginproperties-(-o-):window>a href#window>Window/a>/code> object.li>p>If var>O/var> is a code idcrossoriginproperties-(-o-):location-2>a href#location>Location/a>/code> object, then return « { Property: code>href/code>, NeedsGet: false, NeedsSet: true }, { Property: code>replace/code> } ».li>p>Let var>crossOriginWindowProperties/var> be « { Property: code>window/code>, NeedsGet: true, NeedsSet: false }, { Property: code>self/code>, NeedsGet: true, NeedsSet: false }, { Property: code>location/code>, NeedsGet: true, NeedsSet: true }, { Property: code>close/code> }, { Property: code>closed/code>, NeedsGet: true, NeedsSet: false }, { Property: code>focus/code> }, { Property: code>blur/code> }, { Property: code>frames/code>, NeedsGet: true, NeedsSet: false }, { Property: code>length/code>, NeedsGet: true, NeedsSet: false }, { Property: code>top/code>, NeedsGet: true, NeedsSet: false }, { Property: code>opener/code>, NeedsGet: true, NeedsSet: false }, { Property: code>parent/code>, NeedsGet: true, NeedsSet: false }, { Property: code>postMessage/code> } ».li> p>Repeat for each var>e/var> that is an element of var>O/var>s a href#document-tree-child-browsing-context-name-property-set idcrossoriginproperties-(-o-):document-tree-child-browsing-context-name-property-set>document-tree child browsing context name property set/a>:/p> ol>li>p>Add { Property: var>e/var>, HideFromKeys: true } as the last element of var>crossOriginWindowProperties/var>./ol> li>p>Return var>crossOriginWindowProperties/var>./ol> p classnote>Indexed properties do not need to be safelisted as they are handled directly by the code idcrossoriginproperties-(-o-):windowproxy>a href#windowproxy>WindowProxy/a>/code> object./p> h5 idisplatformobjectsameorigin-(-o-)>span classsecno>7.2.3.2/span> dfn>IsPlatformObjectSameOrigin/dfn> ( var>O/var> )a href#isplatformobjectsameorigin-(-o-) classself-link>/a>/h5> ol>li>p>Return true if the a href#current-settings-object idisplatformobjectsameorigin-(-o-):current-settings-object>current settings object/a>s a href#concept-settings-object-origin idisplatformobjectsameorigin-(-o-):concept-settings-object-origin>origin/a> is a href#same-origin-domain idisplatformobjectsameorigin-(-o-):same-origin-domain>same origin-domain/a> with var>O/var>s a href#relevant-settings-object idisplatformobjectsameorigin-(-o-):relevant-settings-object>relevant settings object/a>s a href#concept-settings-object-origin idisplatformobjectsameorigin-(-o-):concept-settings-object-origin-2>origin/a>, and false otherwise./ol> h5 idcrossorigingetownpropertyhelper-(-o,-p-)>span classsecno>7.2.3.3/span> dfn>CrossOriginGetOwnPropertyHelper/dfn> ( var>O/var>, var>P/var> )a href#crossorigingetownpropertyhelper-(-o,-p-) classself-link>/a>/h5> p classnote>If this abstract operation returns undefined and there is no custom behavior, the caller needs to throw a a idcrossorigingetownpropertyhelper-(-o,-p-):securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idcrossorigingetownpropertyhelper-(-o,-p-):domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> ol>li>p>If var>P/var> is a href#@@tostringtag idcrossorigingetownpropertyhelper-(-o,-p-):@@tostringtag>@@toStringTag/a>, a href#@@hasinstance idcrossorigingetownpropertyhelper-(-o,-p-):@@hasinstance>@@hasInstance/a>, or a href#@@isconcatspreadable idcrossorigingetownpropertyhelper-(-o,-p-):@@isconcatspreadable>@@isConcatSpreadable/a>, then return a idcrossorigingetownpropertyhelper-(-o,-p-):propertydescriptor hrefhttps://tc39.github.io/ecma262/#sec-property-descriptor-specification-type data-x-internalpropertydescriptor>PropertyDescriptor/a>{ Value: undefined, Writable: false, Enumerable: false, Configurable: true }.li>p>Let var>crossOriginKey/var> be a tuple consisting of the a href#current-settings-object idcrossorigingetownpropertyhelper-(-o,-p-):current-settings-object>current settings object/a>, var>O/var>s a href#relevant-settings-object idcrossorigingetownpropertyhelper-(-o,-p-):relevant-settings-object>relevant settings object/a>, and var>P/var>.li> p>Repeat for each var>e/var> that is an element of ! a href#crossoriginproperties-(-o-) idcrossorigingetownpropertyhelper-(-o,-p-):crossoriginproperties-(-o-)>CrossOriginProperties/a>(var>O/var>):/p> ol>li> p>If a idcrossorigingetownpropertyhelper-(-o,-p-):samevalue hrefhttps://tc39.github.io/ecma262/#sec-samevalue data-x-internalsamevalue>SameValue/a>(var>e/var>.Property, var>P/var>) is true, then:/p> ol>li>p>If the value of the a href#crossoriginpropertydescriptormap idcrossorigingetownpropertyhelper-(-o,-p-):crossoriginpropertydescriptormap>CrossOriginPropertyDescriptorMap/a> internal slot of var>O/var> contains an entry whose key is var>crossOriginKey/var>, then return that entrys value.li>p>Let var>originalDesc/var> be a idcrossorigingetownpropertyhelper-(-o,-p-):ordinarygetownproperty hrefhttps://tc39.github.io/ecma262/#sec-ordinarygetownproperty data-x-internalordinarygetownproperty>OrdinaryGetOwnProperty/a>(var>O/var>, var>P/var>).li>p>Let var>crossOriginDesc/var> be undefined.li> p>If var>e/var>.NeedsGet and var>e/var>.NeedsSet are absent, then:/p> ol>li>p>Let var>value/var> be var>originalDesc/var>.Value.li>p>If ! a idcrossorigingetownpropertyhelper-(-o,-p-):iscallable hrefhttps://tc39.github.io/ecma262/#sec-iscallable data-x-internaliscallable>IsCallable/a>(var>value/var>) is true, then set var>value/var> to an anonymous built-in function, created in the a idcrossorigingetownpropertyhelper-(-o,-p-):current-realm-record hrefhttps://tc39.github.io/ecma262/#current-realm data-x-internalcurrent-realm-record>current Realm Record/a>, that performs the same steps as the IDL operation var>P/var> on object var>O/var>.li>p>Set var>crossOriginDesc/var> to a idcrossorigingetownpropertyhelper-(-o,-p-):propertydescriptor-2 hrefhttps://tc39.github.io/ecma262/#sec-property-descriptor-specification-type data-x-internalpropertydescriptor>PropertyDescriptor/a>{ Value: var>value/var>, Enumerable: false, Writable: false, Configurable: true }./ol> li> p>Otherwise:/p> ol>li>p>Let var>crossOriginGet/var> be undefined.li>p>If var>e/var>.NeedsGet is true, then set var>crossOriginGet/var> to an anonymous built-in function, created in the a idcrossorigingetownpropertyhelper-(-o,-p-):current-realm-record-2 hrefhttps://tc39.github.io/ecma262/#current-realm data-x-internalcurrent-realm-record>current Realm Record/a>, that performs the same steps as the getter of the IDL attribute var>P/var> on object var>O/var>.li>p>Let var>crossOriginSet/var> be undefined.li>p>If var>e/var>.NeedsSet is true, then set var>crossOriginSet/var> to an anonymous built-in function, created in the a idcrossorigingetownpropertyhelper-(-o,-p-):current-realm-record-3 hrefhttps://tc39.github.io/ecma262/#current-realm data-x-internalcurrent-realm-record>current Realm Record/a>, that performs the same steps as the setter of the IDL attribute var>P/var> on object var>O/var>.li>p>Set var>crossOriginDesc/var> to a idcrossorigingetownpropertyhelper-(-o,-p-):propertydescriptor-3 hrefhttps://tc39.github.io/ecma262/#sec-property-descriptor-specification-type data-x-internalpropertydescriptor>PropertyDescriptor/a>{ Get: var>crossOriginGet/var>, Set: var>crossOriginSet/var>, Enumerable: false, Configurable: true }./ol> li>p>Create an entry in the value of the a href#crossoriginpropertydescriptormap idcrossorigingetownpropertyhelper-(-o,-p-):crossoriginpropertydescriptormap-2>CrossOriginPropertyDescriptorMap/a> internal slot of var>O/var> with key var>crossOriginKey/var> and value var>crossOriginDesc/var>.li>p>Return var>crossOriginDesc/var>./ol> /ol> li>p>Return undefined./ol> p classnote>The reason that the property descriptors produced here are configurable is to preserve the a idcrossorigingetownpropertyhelper-(-o,-p-):invariants-of-the-essential-internal-methods hrefhttps://tc39.github.io/ecma262/#sec-invariants-of-the-essential-internal-methods data-x-internalinvariants-of-the-essential-internal-methods>invariants of the essential internal methods/a> required by the JavaScript specification. In particular, since the value of the property can change as a consequence of navigation, it is required that the property be configurable. (However, see a hrefhttps://github.com/tc39/ecma262/issues/672>tc39/ecma262 issue #672/a> and references to it elsewhere in this specification for cases where we are not able to preserve these invariants, for compatibility with existing Web content.) a href#refsJAVASCRIPT>JAVASCRIPT/a>/p> p classnote>The reason the property descriptors are non-enumerable, despite this mismatching the same-origin behavior, is for compatibility with existing Web content. See a hrefhttps://github.com/whatwg/html/issues/3183>issue #3183/a> for details./p> h5 idcrossoriginget-(-o,-p,-receiver-)>span classsecno>7.2.3.4/span> dfn>CrossOriginGet/dfn> ( var>O/var>, var>P/var>, var>Receiver/var> )a href#crossoriginget-(-o,-p,-receiver-) classself-link>/a>/h5> ol>li>p>Let var>desc/var> be ? var>O/var>.GetOwnProperty(var>P/var>).li>p>Assert: var>desc/var> is not undefined.li>p>If ! a idcrossoriginget-(-o,-p,-receiver-):isdatadescriptor hrefhttps://tc39.github.io/ecma262/#sec-isdatadescriptor data-x-internalisdatadescriptor>IsDataDescriptor/a>(var>desc/var>) is true, then return var>desc/var>.Value.li>p>Assert: a idcrossoriginget-(-o,-p,-receiver-):isaccessordescriptor hrefhttps://tc39.github.io/ecma262/#sec-isaccessordescriptor data-x-internalisaccessordescriptor>IsAccessorDescriptor/a>(var>desc/var>) is true.li>p>Let var>getter/var> be var>desc/var>.Get.li>p>If var>getter/var> is undefined, then throw a a idcrossoriginget-(-o,-p,-receiver-):securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idcrossoriginget-(-o,-p,-receiver-):domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Return ? a idcrossoriginget-(-o,-p,-receiver-):call hrefhttps://tc39.github.io/ecma262/#sec-call data-x-internalcall>Call/a>(var>getter/var>, var>Receiver/var>)./ol> h5 idcrossoriginset-(-o,-p,-v,-receiver-)>span classsecno>7.2.3.5/span> dfn>CrossOriginSet/dfn> ( var>O/var>, var>P/var>, var>V/var>, var>Receiver/var> )a href#crossoriginset-(-o,-p,-v,-receiver-) classself-link>/a>/h5> ol>li>p>Let var>desc/var> be ? var>O/var>.GetOwnProperty(var>P/var>).li>p>Assert: var>desc/var> is not undefined.li> p>If var>desc/var>.Set is present and its value is not undefined, then: ol>li>p>Perform ? a idcrossoriginset-(-o,-p,-v,-receiver-):call hrefhttps://tc39.github.io/ecma262/#sec-call data-x-internalcall>Call/a>(var>setter/var>, var>Receiver/var>, «var>V/var>»).li>p>Return true./ol> li>p>Throw a a idcrossoriginset-(-o,-p,-v,-receiver-):securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idcrossoriginset-(-o,-p,-v,-receiver-):domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./ol> h5 idcrossoriginownpropertykeys-(-o-)>span classsecno>7.2.3.6/span> dfn>CrossOriginOwnPropertyKeys/dfn> ( var>O/var> )a href#crossoriginownpropertykeys-(-o-) classself-link>/a>/h5> ol>li>p>Let var>keys/var> be a new empty a hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type idcrossoriginownpropertykeys-(-o-):js-list data-x-internaljs-list>List/a>.li> p>Repeat for each var>e/var> that is an element of ! a href#crossoriginproperties-(-o-) idcrossoriginownpropertykeys-(-o-):crossoriginproperties-(-o-)>CrossOriginProperties/a>(var>O/var>):/p> ol>li>p>If var>e/var>.HideFromKeys is not true, a hrefhttps://infra.spec.whatwg.org/#list-append idcrossoriginownpropertykeys-(-o-):list-append data-x-internallist-append>append/a> var>e/var>.Property to var>keys/var>./ol> li>p>Return the concatenation of var>keys/var> and « a href#@@tostringtag idcrossoriginownpropertykeys-(-o-):@@tostringtag>@@toStringTag/a>, a href#@@hasinstance idcrossoriginownpropertykeys-(-o-):@@hasinstance>@@hasInstance/a>, a href#@@isconcatspreadable idcrossoriginownpropertykeys-(-o-):@@isconcatspreadable>@@isConcatSpreadable/a> »./ol> h3 idthe-window-object>span classsecno>7.3/span> The code idthe-window-object:window>a href#window>Window/a>/code> objecta href#the-window-object classself-link>/a>/h3> pre classidl>PrimaryGlobal, LegacyUnenumerableNamedProperties interface dfn idwindow data-dfn-typeinterface data-export>Window/dfn> : a idthe-window-object:eventtarget hrefhttps://dom.spec.whatwg.org/#interface-eventtarget data-x-internaleventtarget>EventTarget/a> { // the current browsing context Unforgeable readonly attribute a href#windowproxy idthe-window-object:windowproxy>WindowProxy/a> a href#dom-window idthe-window-object:dom-window>window/a>; Replaceable readonly attribute a href#windowproxy idthe-window-object:windowproxy-2>WindowProxy/a> a href#dom-self idthe-window-object:dom-self>self/a>; Unforgeable readonly attribute a href#document idthe-window-object:document>Document/a> a href#dom-document-2 idthe-window-object:dom-document-2>document/a>; attribute DOMString a href#dom-name idthe-window-object:dom-name>name/a>; PutForwardsa href#dom-location-href idthe-window-object:dom-location-href>href/a>, Unforgeable readonly attribute a href#location idthe-window-object:location>Location/a> a href#dom-location idthe-window-object:dom-location>location/a>; readonly attribute a href#history-3 idthe-window-object:history-3>History/a> a href#dom-history idthe-window-object:dom-history>history/a>; readonly attribute a href#customelementregistry idthe-window-object:customelementregistry>CustomElementRegistry/a> a href#dom-window-customelements idthe-window-object:dom-window-customelements>customElements/a>; Replaceable readonly attribute a href#barprop idthe-window-object:barprop>BarProp/a> a href#dom-window-locationbar idthe-window-object:dom-window-locationbar>locationbar/a>; Replaceable readonly attribute a href#barprop idthe-window-object:barprop-2>BarProp/a> a href#dom-window-menubar idthe-window-object:dom-window-menubar>menubar/a>; Replaceable readonly attribute a href#barprop idthe-window-object:barprop-3>BarProp/a> a href#dom-window-personalbar idthe-window-object:dom-window-personalbar>personalbar/a>; Replaceable readonly attribute a href#barprop idthe-window-object:barprop-4>BarProp/a> a href#dom-window-scrollbars idthe-window-object:dom-window-scrollbars>scrollbars/a>; Replaceable readonly attribute a href#barprop idthe-window-object:barprop-5>BarProp/a> a href#dom-window-statusbar idthe-window-object:dom-window-statusbar>statusbar/a>; Replaceable readonly attribute a href#barprop idthe-window-object:barprop-6>BarProp/a> a href#dom-window-toolbar idthe-window-object:dom-window-toolbar>toolbar/a>; attribute DOMString a href#dom-window-status idthe-window-object:dom-window-status>status/a>; void a href#dom-window-close idthe-window-object:dom-window-close>close/a>(); readonly attribute boolean a href#dom-window-closed idthe-window-object:dom-window-closed>closed/a>; void a href#dom-window-stop idthe-window-object:dom-window-stop>stop/a>(); void a href#dom-window-focus idthe-window-object:dom-window-focus>focus/a>(); void a href#dom-window-blur idthe-window-object:dom-window-blur>blur/a>(); // other browsing contexts Replaceable readonly attribute a href#windowproxy idthe-window-object:windowproxy-3>WindowProxy/a> a href#dom-frames idthe-window-object:dom-frames>frames/a>; Replaceable readonly attribute unsigned long a href#dom-length idthe-window-object:dom-length>length/a>; Unforgeable readonly attribute a href#windowproxy idthe-window-object:windowproxy-4>WindowProxy/a>? a href#dom-top idthe-window-object:dom-top>top/a>; attribute any a href#dom-opener idthe-window-object:dom-opener>opener/a>; Replaceable readonly attribute a href#windowproxy idthe-window-object:windowproxy-5>WindowProxy/a>? a href#dom-parent idthe-window-object:dom-parent>parent/a>; readonly attribute a idthe-window-object:element hrefhttps://dom.spec.whatwg.org/#interface-element data-x-internalelement>Element/a>? a href#dom-frameelement idthe-window-object:dom-frameelement>frameElement/a>; a href#windowproxy idthe-window-object:windowproxy-6>WindowProxy/a>? a href#dom-open idthe-window-object:dom-open>open/a>(optional USVString url about:blank, optional DOMString target _blank, optional TreatNullAsEmptyString DOMString features ); a href#dom-window-nameditem>getter/a> a hrefhttps://heycam.github.io/webidl/#idl-object idthe-window-object:idl-object data-x-internalidl-object>object/a> (DOMString name); // Since this is the global object, the IDL named getter adds a NamedPropertiesObject exotic // object on the prototype chain. Indeed, this does not make the global object an exotic object. // Indexed access is taken care of by the a href#windowproxy idthe-window-object:windowproxy-7>WindowProxy/a> exotic object. // the user agent readonly attribute a href#navigator idthe-window-object:navigator>Navigator/a> a href#dom-navigator idthe-window-object:dom-navigator>navigator/a>; readonly attribute a href#applicationcache idthe-window-object:applicationcache>ApplicationCache/a> a href#dom-applicationcache idthe-window-object:dom-applicationcache>applicationCache/a>; // user prompts void a href#dom-alert idthe-window-object:dom-alert>alert/a>(); void a href#dom-alert idthe-window-object:dom-alert-2>alert/a>(DOMString message); boolean a href#dom-confirm idthe-window-object:dom-confirm>confirm/a>(optional DOMString message ); DOMString? a href#dom-prompt idthe-window-object:dom-prompt>prompt/a>(optional DOMString message , optional DOMString default ); void a href#dom-print idthe-window-object:dom-print>print/a>(); unsigned long a href#dom-window-requestanimationframe idthe-window-object:dom-window-requestanimationframe>requestAnimationFrame/a>(a href#framerequestcallback idthe-window-object:framerequestcallback>FrameRequestCallback/a> callback); void a href#dom-window-cancelanimationframe idthe-window-object:dom-window-cancelanimationframe>cancelAnimationFrame/a>(unsigned long handle); void a href#dom-window-postmessage idthe-window-object:dom-window-postmessage>postMessage/a>(any message, USVString targetOrigin, optional sequence<a hrefhttps://heycam.github.io/webidl/#idl-object idthe-window-object:idl-object-2 data-x-internalidl-object>object/a>> transfer ); // a href#Window-partial>also has obsolete members/a>};a href#window idthe-window-object:window-2>Window/a> implements a href#globaleventhandlers idthe-window-object:globaleventhandlers>GlobalEventHandlers/a>;a href#window idthe-window-object:window-3>Window/a> implements a href#windoweventhandlers idthe-window-object:windoweventhandlers>WindowEventHandlers/a>;callback dfn idframerequestcallback>FrameRequestCallback/dfn> void (a idthe-window-object:domhighrestimestamp hrefhttps://w3c.github.io/hr-time/#dom-domhighrestimestamp data-x-internaldomhighrestimestamp>DOMHighResTimeStamp/a> time);/pre> dl classdomintro>dt>var>window/var> . code idthe-window-object:dom-window-2>a href#dom-window>window/a>/code>dt>var>window/var> . code idthe-window-object:dom-frames-2>a href#dom-frames>frames/a>/code>dt>var>window/var> . code idthe-window-object:dom-self-2>a href#dom-self>self/a>/code>dd> p>These attributes all return var>window/var>./p> dt>var>window/var> . code idthe-window-object:dom-document-2-2>a href#dom-document-2>document/a>/code>dd> p>Returns the code idthe-window-object:document-2>a href#document>Document/a>/code> associated with var>window/var>./p> dt>var>document/var> . code idthe-window-object:dom-document-defaultview>a href#dom-document-defaultview>defaultView/a>/code>dd> p>Returns the code idthe-window-object:window-4>a href#window>Window/a>/code> object of the a href#active-document idthe-window-object:active-document>active document/a>./p> /dl> p>The code idthe-window-object:window-5>a href#window>Window/a>/code> has an dfn idconcept-document-window data-export>associated code>Document/code>/dfn>, which is a code idthe-window-object:document-3>a href#document>Document/a>/code> object. It is set when the code idthe-window-object:window-6>a href#window>Window/a>/code> object is created, and only ever changed during a href#navigate idthe-window-object:navigate>navigation/a> from the initial code idthe-window-object:about:blank>a href#about:blank>about:blank/a>/code> code idthe-window-object:document-4>a href#document>Document/a>/code>./p> p>The dfn iddom-window>code>window/code>/dfn>, dfn iddom-frames>code>frames/code>/dfn>, and dfn iddom-self>code>self/code>/dfn> IDL attributes, on getting, must all return this code idthe-window-object:window-7>a href#window>Window/a>/code> objects a href#browsing-context idthe-window-object:browsing-context>browsing context/a>s code idthe-window-object:windowproxy-8>a href#windowproxy>WindowProxy/a>/code> object./p> p>The dfn iddom-document-2>code>document/code>/dfn> IDL attribute, on getting, must return this code idthe-window-object:window-8>a href#window>Window/a>/code> objects a href#concept-document-window idthe-window-object:concept-document-window>associated code>Document/code>/a>./p> p classnote>The code idthe-window-object:document-5>a href#document>Document/a>/code> object associated with a code idthe-window-object:window-9>a href#window>Window/a>/code> object can change in exactly one case: when the a href#navigate idthe-window-object:navigate-2>navigate/a> algorithm a href#initialise-the-document-object idthe-window-object:initialise-the-document-object>initializes a new code>Document/code> object/a> for the first page loaded in a a href#browsing-context idthe-window-object:browsing-context-2>browsing context/a>. In that specific case, the code idthe-window-object:window-10>a href#window>Window/a>/code> object of the original code idthe-window-object:about:blank-2>a href#about:blank>about:blank/a>/code> page is reused and gets a new code idthe-window-object:document-6>a href#document>Document/a>/code> object./p> p>The dfn iddom-document-defaultview>code>defaultView/code>/dfn> IDL attribute of the code idthe-window-object:document-7>a href#document>Document/a>/code> interface, on getting, must return this code idthe-window-object:document-8>a href#document>Document/a>/code>s a href#concept-document-bc idthe-window-object:concept-document-bc>browsing context/a>s code idthe-window-object:windowproxy-9>a href#windowproxy>WindowProxy/a>/code> object, if this code idthe-window-object:document-9>a href#document>Document/a>/code> has an associated browsing context, or null otherwise./p> hr> p>For historical reasons, code idthe-window-object:window-11>a href#window>Window/a>/code> objects must also have a writable, configurable, non-enumerable property named dfn idhtmldocument>code>HTMLDocument/code>/dfn> whose value is the code idthe-window-object:document-10>a href#document>Document/a>/code> a idthe-window-object:interface-object hrefhttps://heycam.github.io/webidl/#dfn-interface-object data-x-internalinterface-object>interface object/a>./p> h4 idapis-for-creating-and-navigating-browsing-contexts-by-name>span classsecno>7.3.1/span> APIs for creating and navigating browsing contexts by namea href#apis-for-creating-and-navigating-browsing-contexts-by-name classself-link>/a>/h4> dl classdomintro>dt>var>window/var> var>window/var> . code idapis-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> )dd> p>Opens a window to show var>url/var> (defaults to code idapis-for-creating-and-navigating-browsing-contexts-by-name:about:blank>a href#about:blank>about:blank/a>/code>), and returns it. The var>target/var> argument gives the name of the new window. If a window exists with that name already, it is reused. The var>features/var> argument can be used to influence the rendering of the new window./p> dt>var>window/var> . code idapis-for-creating-and-navigating-browsing-contexts-by-name:dom-name>a href#dom-name>name/a>/code> var>value/var> dd> p>Returns the name of the window./p> p>Can be set, to change the name./p> dt>var>window/var> . code idapis-for-creating-and-navigating-browsing-contexts-by-name:dom-window-close>a href#dom-window-close>close/a>/code>()dd> p>Closes the window./p> dt>var>window/var> . code idapis-for-creating-and-navigating-browsing-contexts-by-name:dom-window-closed>a href#dom-window-closed>closed/a>/code>dd> p>Returns true if the window has been closed, false otherwise./p> dt>var>window/var> . code idapis-for-creating-and-navigating-browsing-contexts-by-name:dom-window-stop>a href#dom-window-stop>stop/a>/code>()dd> p>Cancels the document load./p> /dl> p>The dfn idwindow-open-steps>window open steps/dfn>, given a string var>url/var>, a string var>target/var>, and a string var>features/var>, are as follows:/p> ol>li>p>Let var>entry settings/var> be the a href#entry-settings-object idapis-for-creating-and-navigating-browsing-contexts-by-name:entry-settings-object>entry settings object/a>.li>p>Let var>source browsing context/var> be the a href#responsible-browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:responsible-browsing-context>responsible browsing context/a> specified by var>entry settings/var>.li>p>If var>target/var> is the empty string, then set var>target/var> to code>_blank/code>.li>p>Let var>tokenizedFeatures/var> be the result of a href#concept-window-open-features-tokenize idapis-for-creating-and-navigating-browsing-contexts-by-name:concept-window-open-features-tokenize>tokenizing/a> var>features/var>.li>p>Let var>noopener/var> be true if var>tokenizedFeatures/var> a hrefhttps://infra.spec.whatwg.org/#map-exists idapis-for-creating-and-navigating-browsing-contexts-by-name:map-exists data-x-internalmap-exists>contains/a> an entry with the key code>noopener/code>li> p>Let var>target browsing context/var> and var>new/var> be the result of applying a href#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name idapis-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/a> given var>target/var>, var>source browsing context/var>, and var>noopener/var>. p classexample>If there is a user agent that supports control-clicking a link to open it in a new tab, and the user control-clicks on an element whose code idapis-for-creating-and-navigating-browsing-contexts-by-name:handler-onclick>a href#handler-onclick>onclick/a>/code> handler uses the code idapis-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 code idapis-for-creating-and-navigating-browsing-contexts-by-name:the-iframe-element>a href#the-iframe-element>iframe/a>/code> element, the user agent could override the selection of the target browsing context to instead target a new tab./p> li>p>If var>target browsing context/var> is null, then return null.li>p>If var>new/var> is true, then a idapis-for-creating-and-navigating-browsing-contexts-by-name:set-up-browsing-context-features hrefhttps://drafts.csswg.org/cssom-view/#set-up-browsing-context-features data-x-internalset-up-browsing-context-features>set up browsing context features/a> for var>target browsing context/var> given var>tokenizedFeatures/var>. a href#refsCSSOMVIEW>CSSOMVIEW/a>li>p>Let var>resource/var> be the a idapis-for-creating-and-navigating-browsing-contexts-by-name:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> code idapis-for-creating-and-navigating-browsing-contexts-by-name:about:blank-2>a href#about:blank>about:blank/a>/code>.li> p>If var>url/var> is not the empty string or var>new/var> is true, then: ol>li>p>If var>url/var> is not the empty string, then a href#parse-a-url idapis-for-creating-and-navigating-browsing-contexts-by-name:parse-a-url>parse/a> var>url/var> relative to var>entry settings/var>, and set var>resource/var> to the a href#resulting-url-record idapis-for-creating-and-navigating-browsing-contexts-by-name:resulting-url-record>resulting URL record/a>, if any. If the a href#parse-a-url idapis-for-creating-and-navigating-browsing-contexts-by-name:parse-a-url-2>parse a URL/a> algorithm failed, then throw a a idapis-for-creating-and-navigating-browsing-contexts-by-name:syntaxerror hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idapis-for-creating-and-navigating-browsing-contexts-by-name:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If var>resource/var> is code idapis-for-creating-and-navigating-browsing-contexts-by-name:about:blank-3>a href#about:blank>about:blank/a>/code> and var>new/var> is true, then a href#queue-a-task idapis-for-creating-and-navigating-browsing-contexts-by-name:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idapis-for-creating-and-navigating-browsing-contexts-by-name:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idapis-for-creating-and-navigating-browsing-contexts-by-name:event-load>a href#event-load>load/a>/code> at var>target browsing context/var>s code idapis-for-creating-and-navigating-browsing-contexts-by-name:window>a href#window>Window/a>/code> object, with the var>legacy target override flag/var> set./p> li>p>Otherwise, a href#navigate idapis-for-creating-and-navigating-browsing-contexts-by-name:navigate>navigate/a> var>target browsing context/var> to var>resource/var>, with the var>a href#exceptions-enabled idapis-for-creating-and-navigating-browsing-contexts-by-name:exceptions-enabled>exceptions enabled flag/a>/var> set. If var>new/var> is true, then a href#replacement-enabled idapis-for-creating-and-navigating-browsing-contexts-by-name:replacement-enabled>replacement must be enabled/a>. The a href#source-browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:source-browsing-context>source browsing context/a> is var>source browsing context/var>. Rethrow any exceptions./ol> li>p>If var>noopener/var> is true, then a href#disowned-its-opener idapis-for-creating-and-navigating-browsing-contexts-by-name:disowned-its-opener>disown var>target browsing context/var>s opener/a> and return null.li>p>Return var>target browsing context/var>s code idapis-for-creating-and-navigating-browsing-contexts-by-name:windowproxy>a href#windowproxy>WindowProxy/a>/code> object./ol> p>The dfn data-dfn-forWindow iddom-open data-dfn-typeoperation data-ltopen()|open(url, target, features) data-export>code>open(var>url/var>, var>target/var>, var>features/var>)/code>/dfn> method on code idapis-for-creating-and-navigating-browsing-contexts-by-name:window-2>a href#window>Window/a>/code> objects provides a mechanism for a href#navigate idapis-for-creating-and-navigating-browsing-contexts-by-name:navigate-2>navigating/a> an existing a href#browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context>browsing context/a> or opening and navigating an a href#auxiliary-browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:auxiliary-browsing-context>auxiliary browsing context/a>./p> p>When the method is invoked, the user agent must run the a href#window-open-steps idapis-for-creating-and-navigating-browsing-contexts-by-name:window-open-steps>window open steps/a> with var>url/var>, var>target/var>, and var>features/var>./p> hr> p>To dfn idconcept-window-open-features-tokenize>tokenize the var>features/var> argument/dfn>:/p> ol>li>p>Let var>tokenizedFeatures/var> be a new a idapis-for-creating-and-navigating-browsing-contexts-by-name:ordered-map hrefhttps://infra.spec.whatwg.org/#ordered-map data-x-internalordered-map>ordered map/a>.li>p>Let var>position/var> point at the first code point of var>features/var>.li> p>a idapis-for-creating-and-navigating-browsing-contexts-by-name:while hrefhttps://infra.spec.whatwg.org/#iteration-while data-x-internalwhile>While/a> var>position/var> is not past the end of var>features/var>:/p> ol>li>p>Let var>name/var> be the empty string.li>p>Let var>value/var> be the empty string.li>p>a idapis-for-creating-and-navigating-browsing-contexts-by-name:collect-a-sequence-of-code-points hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a href#feature-separator idapis-for-creating-and-navigating-browsing-contexts-by-name:feature-separator>feature separators/a> from var>features/var> given var>position/var>. This skips past leading separators before the name.li>p>a idapis-for-creating-and-navigating-browsing-contexts-by-name:collect-a-sequence-of-code-points-2 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are not a href#feature-separator idapis-for-creating-and-navigating-browsing-contexts-by-name:feature-separator-2>feature separators/a> from var>features/var> given var>position/var>. Set var>name/var> to the collected characters, a idapis-for-creating-and-navigating-browsing-contexts-by-name:converted-to-ascii-lowercase hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>.li>p>Set var>name/var> to the result of a href#normalizing-the-feature-name idapis-for-creating-and-navigating-browsing-contexts-by-name:normalizing-the-feature-name>normalizing the feature name/a> var>name/var>.li> p>a idapis-for-creating-and-navigating-browsing-contexts-by-name:while-2 hrefhttps://infra.spec.whatwg.org/#iteration-while data-x-internalwhile>While/a> var>position/var> is not past the end of var>features/var> and the code point at var>position/var> in var>features/var> is not U+003D ():/p> ol>li>p>If the code point at var>position/var> in var>features/var> is U+002C (,), or if it is not a a href#feature-separator idapis-for-creating-and-navigating-browsing-contexts-by-name:feature-separator-3>feature separator/a>, then a idapis-for-creating-and-navigating-browsing-contexts-by-name:break hrefhttps://infra.spec.whatwg.org/#iteration-break data-x-internalbreak>break/a>.li>p>Advance var>position/var> by 1./ol> p classnote>This skips to the first U+003D () but does not skip past a U+002C (,) or a non-separator./p> li> p>If the code point at var>position/var> in var>features/var> is a a href#feature-separator idapis-for-creating-and-navigating-browsing-contexts-by-name:feature-separator-4>feature separator/a>:/p> ol>li> p>While var>position/var> is not past the end of var>features/var> and the code point at var>position/var> in var>features/var> is a a href#feature-separator idapis-for-creating-and-navigating-browsing-contexts-by-name:feature-separator-5>feature separator/a>:/p> ol>li>p>If the code point at var>position/var> in var>features/var> is U+002C (,), then a idapis-for-creating-and-navigating-browsing-contexts-by-name:break-2 hrefhttps://infra.spec.whatwg.org/#iteration-break data-x-internalbreak>break/a>.li>p>Advance var>position/var> by 1./ol> p classnote>This skips to the first non-separator but does not skip past a U+002C (,)./p> li>p>a idapis-for-creating-and-navigating-browsing-contexts-by-name:collect-a-sequence-of-code-points-3 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are not a href#feature-separator idapis-for-creating-and-navigating-browsing-contexts-by-name:feature-separator-6>feature separators/a> code points from var>features/var> given var>position/var>. Set var>value/var> to the collected code points, a idapis-for-creating-and-navigating-browsing-contexts-by-name:converted-to-ascii-lowercase-2 hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>./ol> li>p>If var>name/var> is not the empty string, then set var>tokenizedFeatures/var>var>name/var> to var>value/var>./ol> li>p>Return var>tokenizedFeatures/var>./ol> p>A code point is a dfn idfeature-separator>feature separator/dfn> if it is a idapis-for-creating-and-navigating-browsing-contexts-by-name:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, U+003D (), or U+002C (,)./p> p>For legacy reasons, there are some aliases of some feature names. To dfn idnormalizing-the-feature-name>normalize a feature name/dfn> var>name/var>, switch on var>name/var>:/p> dl classswitch>dt>code>screenx/code> dd>Return code>left/code>. dt>code>screeny/code> dd>Return code>top/code>. dt>code>innerwidth/code> dd>Return code>width/code>. dt>code>innerheight/code> dd>Return code>height/code>. dt>Anything else dd>Return var>name/var>. /dl> hr> p>The dfn iddom-name>code>name/code>/dfn> attribute of the code idapis-for-creating-and-navigating-browsing-contexts-by-name:window-3>a href#window>Window/a>/code> object must, on getting, return the current a href#browsing-context-name idapis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-name>name/a> of the a href#browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-2>browsing context/a>; and, on setting, set the a href#browsing-context-name idapis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-name-2>name/a> of the a href#browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-3>browsing context/a> to the new value./p> p classnote>The name a href#resetBCName>gets reset/a> when the browsing context is a href#navigate idapis-for-creating-and-navigating-browsing-contexts-by-name:navigate-3>navigated/a> to another a href#concept-origin idapis-for-creating-and-navigating-browsing-contexts-by-name:concept-origin>origin/a>./p> hr> p>The dfn iddom-window-close>code>close()/code>/dfn> method on code idapis-for-creating-and-navigating-browsing-contexts-by-name:window-4>a href#window>Window/a>/code> objects should, if all the following conditions are met, a href#close-a-browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:close-a-browsing-context>close/a> the a href#browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-4>browsing context/a> var>A/var>: ul classbrief>li>The corresponding a href#browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-5>browsing context/a> var>A/var> is a href#script-closable idapis-for-creating-and-navigating-browsing-contexts-by-name:script-closable>script-closable/a>.li>The a href#responsible-browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:responsible-browsing-context-2>responsible browsing context/a> specified by the a href#incumbent-settings-object idapis-for-creating-and-navigating-browsing-contexts-by-name:incumbent-settings-object>incumbent settings object/a> is a href#familiar-with idapis-for-creating-and-navigating-browsing-contexts-by-name:familiar-with>familiar with/a> the a href#browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-6>browsing context/a> var>A/var>.li idsandboxClose>The a href#responsible-browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:responsible-browsing-context-3>responsible browsing context/a> specified by the a href#incumbent-settings-object idapis-for-creating-and-navigating-browsing-contexts-by-name:incumbent-settings-object-2>incumbent settings object/a> is a href#allowed-to-navigate idapis-for-creating-and-navigating-browsing-contexts-by-name:allowed-to-navigate>allowed to navigate/a> the a href#browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-7>browsing context/a> var>A/var>./ul> p>A a href#browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-8>browsing context/a> is dfn idscript-closable>script-closable/dfn> if it is an a href#auxiliary-browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:auxiliary-browsing-context-2>auxiliary browsing context/a> that was created by a script (as opposed to by an action of the user), or if it is a a href#top-level-browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:top-level-browsing-context>top-level browsing context/a> whose a href#session-history idapis-for-creating-and-navigating-browsing-contexts-by-name:session-history>session history/a> contains only one code idapis-for-creating-and-navigating-browsing-contexts-by-name:document>a href#document>Document/a>/code>./p> p>The dfn iddom-window-closed>code>closed/code>/dfn> attribute on code idapis-for-creating-and-navigating-browsing-contexts-by-name:window-5>a href#window>Window/a>/code> objects must return true if the code idapis-for-creating-and-navigating-browsing-contexts-by-name:window-6>a href#window>Window/a>/code> objects a href#browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-9>browsing context/a> has been a href#a-browsing-context-is-discarded idapis-for-creating-and-navigating-browsing-contexts-by-name:a-browsing-context-is-discarded>discarded/a>, and false otherwise./p> p>The dfn iddom-window-stop>code>stop()/code>/dfn> method on code idapis-for-creating-and-navigating-browsing-contexts-by-name:window-7>a href#window>Window/a>/code> objects should, if there is an existing attempt to a href#navigate idapis-for-creating-and-navigating-browsing-contexts-by-name:navigate-4>navigate/a> the a href#browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-10>browsing context/a> and that attempt is not currently running the a href#unload-a-document idapis-for-creating-and-navigating-browsing-contexts-by-name:unload-a-document>unload a document/a> algorithm, cancel that a href#navigate idapis-for-creating-and-navigating-browsing-contexts-by-name:navigate-5>navigation/a>; then, it must a href#abort-a-document idapis-for-creating-and-navigating-browsing-contexts-by-name:abort-a-document>abort/a> the a href#active-document idapis-for-creating-and-navigating-browsing-contexts-by-name:active-document>active document/a> of the a href#browsing-context idapis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-11>browsing context/a> of the code idapis-for-creating-and-navigating-browsing-contexts-by-name:window-8>a href#window>Window/a>/code> object on which it was invoked./p> h4 idaccessing-other-browsing-contexts>span classsecno>7.3.2/span> Accessing other browsing contextsa href#accessing-other-browsing-contexts classself-link>/a>/h4> dl classdomintro>dt>var>window/var> . code idaccessing-other-browsing-contexts:dom-length>a href#dom-length>length/a>/code>dd> p>Returns the number of a href#document-tree-child-browsing-context idaccessing-other-browsing-contexts:document-tree-child-browsing-context>document-tree child browsing contexts/a>./p> dt>var>window/var>var>index/var>dd> p>Returns the indicated a href#document-tree-child-browsing-context idaccessing-other-browsing-contexts:document-tree-child-browsing-context-2>document-tree child browsing context/a>./p> /dl> p idnumber-of-child-browsing-contexts>The dfn idnumber-of-document-tree-child-browsing-contexts>number of document-tree child browsing contexts/dfn> of a code idaccessing-other-browsing-contexts:window>a href#window>Window/a>/code> object var>W/var> is the number of a href#document-tree-child-browsing-context idaccessing-other-browsing-contexts:document-tree-child-browsing-context-3>document-tree child browsing contexts/a> of var>W/var>s a href#concept-document-window idaccessing-other-browsing-contexts:concept-document-window>associated code>Document/code>/a>s a href#concept-document-bc idaccessing-other-browsing-contexts:concept-document-bc>browsing context/a>./p> p>The dfn iddom-length>code>length/code>/dfn> IDL attributes getter must return the a href#number-of-document-tree-child-browsing-contexts idaccessing-other-browsing-contexts:number-of-document-tree-child-browsing-contexts>number of document-tree child browsing contexts/a> of this code idaccessing-other-browsing-contexts:window-2>a href#window>Window/a>/code> object./p> p classnote>Indexed access to a href#document-tree-child-browsing-context idaccessing-other-browsing-contexts:document-tree-child-browsing-context-4>document-tree child browsing contexts/a> is defined through the a href#windowproxy-getownproperty>GetOwnProperty/a> internal method of the code idaccessing-other-browsing-contexts:windowproxy>a href#windowproxy>WindowProxy/a>/code> object./p> h4 idnamed-access-on-the-window-object>span classsecno>7.3.3/span> Named access on the code idnamed-access-on-the-window-object:window>a href#window>Window/a>/code> objecta href#named-access-on-the-window-object classself-link>/a>/h4> dl classdomintro>dt>var>window/var>var>name/var>dd> p>Returns the indicated element or collection of elements./p> p>As a general rule, relying on this will lead to brittle code. Which IDs end up mapping to this API can vary over time, as new features are added to the Web platform, for example. Instead of this, use code>document.getElementById()/code> or code>document.querySelector()/code>./p> /dl> p idchild-browsing-context-name-property-set>The dfn iddocument-tree-child-browsing-context-name-property-set>document-tree child browsing context name property set/dfn> of a code idnamed-access-on-the-window-object:window-2>a href#window>Window/a>/code> object var>window/var> is the return value of running these steps:/p> ol>li>p>Let var>activeDocument/var> be var>window/var>s a href#browsing-context idnamed-access-on-the-window-object:browsing-context>browsing context/a>s a href#active-document idnamed-access-on-the-window-object:active-document>active document/a>.li>p>Let var>childBrowsingContexts/var> be all a href#document-tree-child-browsing-context idnamed-access-on-the-window-object:document-tree-child-browsing-context>document-tree child browsing contexts/a> of var>activeDocument/var>s a href#concept-document-bc idnamed-access-on-the-window-object:concept-document-bc>browsing context/a> whose a href#browsing-context-name idnamed-access-on-the-window-object:browsing-context-name>browsing context name/a> is not the empty string, in order, and including only the first a href#document-tree-child-browsing-context idnamed-access-on-the-window-object:document-tree-child-browsing-context-2>document-tree child browsing context/a> with a given a href#browsing-context-name idnamed-access-on-the-window-object:browsing-context-name-2>name/a> if multiple a href#document-tree-child-browsing-context idnamed-access-on-the-window-object:document-tree-child-browsing-context-3>document-tree child browsing contexts/a> have the same one.li>p>Remove each a href#browsing-context idnamed-access-on-the-window-object:browsing-context-2>browsing context/a> from var>childBrowsingContexts/var> whose a href#active-document idnamed-access-on-the-window-object:active-document-2>active document/a>s a href#concept-origin idnamed-access-on-the-window-object:concept-origin>origin/a> is not a href#same-origin idnamed-access-on-the-window-object:same-origin>same origin/a> with var>activeDocument/var>s a href#concept-origin idnamed-access-on-the-window-object:concept-origin-2>origin/a> and whose a href#browsing-context-name idnamed-access-on-the-window-object:browsing-context-name-3>browsing context name/a> does not match the name of its a href#browsing-context-container idnamed-access-on-the-window-object:browsing-context-container>browsing context container/a>s code>name/code> content attribute value.li>p>Return the a href#browsing-context-name idnamed-access-on-the-window-object:browsing-context-name-4>browsing context names/a> of var>childBrowsingContexts/var>, in the same order./ol> div classexample> p>This means that in the following example, hosted on code>https://example.org//code>, assuming code>https://elsewhere.example//code> sets code idnamed-access-on-the-window-object:dom-name>a href#dom-name>window.name/a>/code> to code>spices/code>, evaluating code>window.spices/code> after everything has loaded will yield undefined:/p> pre><iframe srchttps://elsewhere.example.com/></iframe><iframe namespices></iframe>/pre> /div> p>The code idnamed-access-on-the-window-object:window-3>a href#window>Window/a>/code> object a hrefhttps://heycam.github.io/webidl/#dfn-support-named-properties idnamed-access-on-the-window-object:support-named-properties data-x-internalsupport-named-properties>supports named properties/a>. The a idnamed-access-on-the-window-object:supported-property-names hrefhttps://heycam.github.io/webidl/#dfn-supported-property-names data-x-internalsupported-property-names>supported property names/a> of a code idnamed-access-on-the-window-object:window-4>a href#window>Window/a>/code> object var>window/var> at any moment consist of the following, in a idnamed-access-on-the-window-object:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> according to the element that contributed them, ignoring later duplicates:/p> ul>li>p>var>window/var>s a href#document-tree-child-browsing-context-name-property-set idnamed-access-on-the-window-object:document-tree-child-browsing-context-name-property-set>document-tree child browsing context name property set/a>;li>p>the value of the code>name/code> content attribute for all code idnamed-access-on-the-window-object:the-embed-element>a href#the-embed-element>embed/a>/code>, code idnamed-access-on-the-window-object:the-form-element>a href#the-form-element>form/a>/code>, code idnamed-access-on-the-window-object:frameset>a href#frameset>frameset/a>/code>, code idnamed-access-on-the-window-object:the-img-element>a href#the-img-element>img/a>/code>, and code idnamed-access-on-the-window-object:the-object-element>a href#the-object-element>object/a>/code> elements that have a non-empty code>name/code> content attribute and are a idnamed-access-on-the-window-object:in-a-document-tree hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a> with var>window/var>s a href#browsing-context idnamed-access-on-the-window-object:browsing-context-3>browsing context/a>s a href#active-document idnamed-access-on-the-window-object:active-document-3>active document/a> as their a idnamed-access-on-the-window-object:root hrefhttps://dom.spec.whatwg.org/#concept-tree-root data-x-internalroot>root/a>; andli>p>the value of the code idnamed-access-on-the-window-object:the-id-attribute>a href#the-id-attribute>id/a>/code> content attribute for all a href#html-elements idnamed-access-on-the-window-object:html-elements>HTML elements/a> that have a non-empty code idnamed-access-on-the-window-object:the-id-attribute-2>a href#the-id-attribute>id/a>/code> content attribute and are a idnamed-access-on-the-window-object:in-a-document-tree-2 hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a> with var>window/var>s a href#browsing-context idnamed-access-on-the-window-object:browsing-context-4>browsing context/a>s a href#active-document idnamed-access-on-the-window-object:active-document-4>active document/a> as their a idnamed-access-on-the-window-object:root-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-root data-x-internalroot>root/a>./ul> p iddom-window-nameditem>To a idnamed-access-on-the-window-object:determine-the-value-of-a-named-property hrefhttps://heycam.github.io/webidl/#dfn-determine-the-value-of-a-named-property data-x-internaldetermine-the-value-of-a-named-property>determine the value of a named property/a> var>name/var> in a code idnamed-access-on-the-window-object:window-5>a href#window>Window/a>/code>, the user agent must return the value obtained using the following steps:/p> ol>li> p>Let var>objects/var> be the list of a href#dom-window-nameditem-filter idnamed-access-on-the-window-object:dom-window-nameditem-filter>named objects/a> with the name var>name/var>./p> p classnote>There will be at least one such object, by definition./p> li> p>If var>objects/var> contains a a href#nested-browsing-context idnamed-access-on-the-window-object:nested-browsing-context>nested browsing context/a>, then return the code idnamed-access-on-the-window-object:windowproxy>a href#windowproxy>WindowProxy/a>/code> object of the a href#nested-browsing-context idnamed-access-on-the-window-object:nested-browsing-context-2>nested browsing context/a> corresponding to the first a href#browsing-context-container idnamed-access-on-the-window-object:browsing-context-container-2>browsing context container/a> in a idnamed-access-on-the-window-object:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> whose a href#nested-browsing-context idnamed-access-on-the-window-object:nested-browsing-context-3>nested browsing context/a> is in var>objects/var>, and abort these steps./p> li> p>Otherwise, if var>objects/var> has only one element, return that element and abort these steps./p> li> p>Otherwise return an code idnamed-access-on-the-window-object:htmlcollection>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> rooted at the code idnamed-access-on-the-window-object:document>a href#document>Document/a>/code> node, whose filter matches only a href#dom-window-nameditem-filter idnamed-access-on-the-window-object:dom-window-nameditem-filter-2>named objects/a> with the name var>name/var>. (By definition, these will all be elements.)/p> /ol> p>dfn iddom-window-nameditem-filter>Named objects/dfn> with the name var>name/var>, for the purposes of the above algorithm, consist of the following:/p> ul>li>p>a href#document-tree-child-browsing-context idnamed-access-on-the-window-object:document-tree-child-browsing-context-4>document-tree child browsing contexts/a> of the a href#active-document idnamed-access-on-the-window-object:active-document-5>active document/a> whose name is var>name/var>;li>p>code idnamed-access-on-the-window-object:the-embed-element-2>a href#the-embed-element>embed/a>/code>, code idnamed-access-on-the-window-object:the-form-element-2>a href#the-form-element>form/a>/code>, code idnamed-access-on-the-window-object:frameset-2>a href#frameset>frameset/a>/code>, code idnamed-access-on-the-window-object:the-img-element-2>a href#the-img-element>img/a>/code>, or code idnamed-access-on-the-window-object:the-object-element-2>a href#the-object-element>object/a>/code> elements that have a code>name/code> content attribute whose value is var>name/var> and are a idnamed-access-on-the-window-object:in-a-document-tree-3 hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a> with the a href#active-document idnamed-access-on-the-window-object:active-document-6>active document/a> as their a idnamed-access-on-the-window-object:root-3 hrefhttps://dom.spec.whatwg.org/#concept-tree-root data-x-internalroot>root/a>; andli>p>a href#html-elements idnamed-access-on-the-window-object:html-elements-2>HTML elements/a> that have an code idnamed-access-on-the-window-object:the-id-attribute-3>a href#the-id-attribute>id/a>/code> content attribute whose value is var>name/var> and are a idnamed-access-on-the-window-object:in-a-document-tree-4 hrefhttps://dom.spec.whatwg.org/#in-a-document-tree data-x-internalin-a-document-tree>in a document tree/a> with the a href#active-document idnamed-access-on-the-window-object:active-document-7>active document/a> as their a idnamed-access-on-the-window-object:root-4 hrefhttps://dom.spec.whatwg.org/#concept-tree-root data-x-internalroot>root/a>./ul> h4 idgarbage-collection-and-browsing-contexts>span classsecno>7.3.4/span> Garbage collection and browsing contextsa href#garbage-collection-and-browsing-contexts classself-link>/a>/h4> p>A a href#browsing-context idgarbage-collection-and-browsing-contexts:browsing-context>browsing context/a> has a strong reference to each of its code idgarbage-collection-and-browsing-contexts:document>a href#document>Document/a>/code>s and its code idgarbage-collection-and-browsing-contexts:windowproxy>a href#windowproxy>WindowProxy/a>/code> object, and the user agent itself has a strong reference to its a href#top-level-browsing-context idgarbage-collection-and-browsing-contexts:top-level-browsing-context>top-level browsing contexts/a>./p> p>A code idgarbage-collection-and-browsing-contexts:document-2>a href#document>Document/a>/code> has a strong reference to its code idgarbage-collection-and-browsing-contexts:window>a href#window>Window/a>/code> object./p> p classnote>A code idgarbage-collection-and-browsing-contexts:window-2>a href#window>Window/a>/code> object a href#implied-strong-reference idgarbage-collection-and-browsing-contexts:implied-strong-reference>has a strong reference/a> to its code idgarbage-collection-and-browsing-contexts:document-3>a href#document>Document/a>/code> object through its code idgarbage-collection-and-browsing-contexts:dom-document-2>a href#dom-document-2>document/a>/code> attribute. Thus, references from other scripts to either of those objects will keep both alive. Similarly, both code idgarbage-collection-and-browsing-contexts:document-4>a href#document>Document/a>/code> and code idgarbage-collection-and-browsing-contexts:window-3>a href#window>Window/a>/code> objects have a href#implied-strong-reference idgarbage-collection-and-browsing-contexts:implied-strong-reference-2>implied strong references/a> to the code idgarbage-collection-and-browsing-contexts:windowproxy-2>a href#windowproxy>WindowProxy/a>/code> object./p> p>Each a href#concept-script idgarbage-collection-and-browsing-contexts:concept-script>script/a> has a strong reference to its a href#settings-object idgarbage-collection-and-browsing-contexts:settings-object>settings object/a>, and each a href#environment-settings-object idgarbage-collection-and-browsing-contexts:environment-settings-object>environment settings object/a> has strong references to its a href#concept-settings-object-global idgarbage-collection-and-browsing-contexts:concept-settings-object-global>global object/a>, a href#responsible-browsing-context idgarbage-collection-and-browsing-contexts:responsible-browsing-context>responsible browsing context/a>, and a href#responsible-document idgarbage-collection-and-browsing-contexts:responsible-document>responsible document/a> (if any)./p> p>When a a href#browsing-context idgarbage-collection-and-browsing-contexts:browsing-context-2>browsing context/a> is to dfn iddiscard-a-document data-export>discard a code>Document/code>/dfn>, the user agent must run the following steps:/p> ol>li>p>Set the code idgarbage-collection-and-browsing-contexts:document-5>a href#document>Document/a>/code>s i idgarbage-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 idgarbage-collection-and-browsing-contexts:unloading-document-cleanup-steps>unloading document cleanup steps/a> for the code idgarbage-collection-and-browsing-contexts:document-6>a href#document>Document/a>/code> that are defined by this specification and a href#other-applicable-specifications idgarbage-collection-and-browsing-contexts:other-applicable-specifications>other applicable specifications/a>.li>p>a href#abort-a-document idgarbage-collection-and-browsing-contexts:abort-a-document>Abort the code>Document/code>/a>.li>p>Remove any a href#concept-task idgarbage-collection-and-browsing-contexts:concept-task>tasks/a> associated with the code idgarbage-collection-and-browsing-contexts:document-7>a href#document>Document/a>/code> in any a href#task-source idgarbage-collection-and-browsing-contexts:task-source>task source/a>, without running those tasks.li>p>a href#a-browsing-context-is-discarded idgarbage-collection-and-browsing-contexts:a-browsing-context-is-discarded>Discard/a> all the a href#child-browsing-context idgarbage-collection-and-browsing-contexts:child-browsing-context>child browsing contexts/a> of the code idgarbage-collection-and-browsing-contexts:document-8>a href#document>Document/a>/code>.li>p>Lose the strong reference from the code idgarbage-collection-and-browsing-contexts:document-9>a href#document>Document/a>/code>s a href#concept-document-bc idgarbage-collection-and-browsing-contexts:concept-document-bc>browsing context/a> to the code idgarbage-collection-and-browsing-contexts:document-10>a href#document>Document/a>/code>./ol> p classnote>Whenever a code idgarbage-collection-and-browsing-contexts:document-11>a href#document>Document/a>/code> object is a href#discard-a-document idgarbage-collection-and-browsing-contexts:discard-a-document>discarded/a>, it is also removed from the a href#concept-WorkerGlobalScope-owner-set idgarbage-collection-and-browsing-contexts:concept-WorkerGlobalScope-owner-set>owner set/a> of each worker whose set contains that code idgarbage-collection-and-browsing-contexts:document-12>a href#document>Document/a>/code>./p> p>When dfn ida-browsing-context-is-discarded data-export>a em>browsing context/em> is discarded/dfn>, the strong reference from the user agent itself to the a href#browsing-context idgarbage-collection-and-browsing-contexts:browsing-context-3>browsing context/a> must be severed, and all the code idgarbage-collection-and-browsing-contexts:document-13>a href#document>Document/a>/code> objects for all the entries in the a href#browsing-context idgarbage-collection-and-browsing-contexts:browsing-context-4>browsing context/a>s session history must be a href#discard-a-document idgarbage-collection-and-browsing-contexts:discard-a-document-2>discarded/a> as well./p> p>User agents may a href#a-browsing-context-is-discarded idgarbage-collection-and-browsing-contexts:a-browsing-context-is-discarded-2>discard/a> a href#top-level-browsing-context idgarbage-collection-and-browsing-contexts:top-level-browsing-context-2>top-level browsing contexts/a> at any time (typically, in response to user requests, e.g. when a user force-closes a window containing one or more a href#top-level-browsing-context idgarbage-collection-and-browsing-contexts:top-level-browsing-context-3>top-level browsing contexts/a>). Other a href#browsing-context idgarbage-collection-and-browsing-contexts:browsing-context-5>browsing contexts/a> must be discarded once their code idgarbage-collection-and-browsing-contexts:windowproxy-3>a href#windowproxy>WindowProxy/a>/code> object is eligible for garbage collection, in addition to the other places where this specification requires them to be discarded./p> p>A code idgarbage-collection-and-browsing-contexts:windowproxy-4>a href#windowproxy>WindowProxy/a>/code> does em>not/em> have a strong reference to the a href#browsing-context idgarbage-collection-and-browsing-contexts:browsing-context-6>browsing context/a> it was created alongside. In particular, it is possible for a a href#nested-browsing-context idgarbage-collection-and-browsing-contexts:nested-browsing-context>nested browsing context/a> to be a href#a-browsing-context-is-discarded idgarbage-collection-and-browsing-contexts:a-browsing-context-is-discarded-3>discarded/a> even if JavaScript code holds a reference to its code idgarbage-collection-and-browsing-contexts:windowproxy-5>a href#windowproxy>WindowProxy/a>/code> object./p> h4 idclosing-browsing-contexts>span classsecno>7.3.5/span> Closing browsing contextsa href#closing-browsing-contexts classself-link>/a>/h4> p>To dfn idclose-a-browsing-context>close a browsing context/dfn> var>browsingContext/var>, run these steps:/p> ol>li>p>a href#prompt-to-unload-a-document idclosing-browsing-contexts:prompt-to-unload-a-document>Prompt to unload/a> var>browsingContext/var>s a href#active-document idclosing-browsing-contexts:active-document>active document/a>. If the user a href#refused-to-allow-the-document-to-be-unloaded idclosing-browsing-contexts:refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be unloaded/a>, then return.li>p>a href#unload-a-document idclosing-browsing-contexts:unload-a-document>Unload/a> var>browsingContext/var>s a href#active-document idclosing-browsing-contexts:active-document-2>active document/a> with the var>recycle/var> parameter set to false.li>p>Remove var>browsingContext/var> from the user interface (e.g., close or hide its tab in a tabbed browser).li>p>a href#a-browsing-context-is-discarded idclosing-browsing-contexts:a-browsing-context-is-discarded>Discard/a> var>browsingContext/var>./ol> p>User agents should offer users the ability to arbitrarily a href#close-a-browsing-context idclosing-browsing-contexts:close-a-browsing-context>close/a> any a href#top-level-browsing-context idclosing-browsing-contexts:top-level-browsing-context>top-level browsing context/a>./p> h4 idbrowser-interface-elements>span classsecno>7.3.6/span> Browser interface elementsa href#browser-interface-elements classself-link>/a>/h4> p>To allow Web pages to integrate with Web browsers, certain Web browser interface elements are exposed in a limited way to scripts in Web pages./p> p>Each interface element is represented by a code idbrowser-interface-elements:barprop>a href#barprop>BarProp/a>/code> object:/p> pre classidl>ExposedWindowinterface dfn idbarprop>BarProp/dfn> { readonly attribute boolean a href#dom-barprop-visible idbrowser-interface-elements:dom-barprop-visible>visible/a>;};/pre> dl classdomintro>dt>var>window/var> . code idbrowser-interface-elements:dom-window-locationbar>a href#dom-window-locationbar>locationbar/a>/code> . code idbrowser-interface-elements:dom-barprop-visible-2>a href#dom-barprop-visible>visible/a>/code>dd> p>Returns true if the location bar is visible; otherwise, returns false./p> dt>var>window/var> . code idbrowser-interface-elements:dom-window-menubar>a href#dom-window-menubar>menubar/a>/code> . code idbrowser-interface-elements:dom-barprop-visible-3>a href#dom-barprop-visible>visible/a>/code>dd> p>Returns true if the menu bar is visible; otherwise, returns false./p> dt>var>window/var> . code idbrowser-interface-elements:dom-window-personalbar>a href#dom-window-personalbar>personalbar/a>/code> . code idbrowser-interface-elements:dom-barprop-visible-4>a href#dom-barprop-visible>visible/a>/code>dd> p>Returns true if the personal bar is visible; otherwise, returns false./p> dt>var>window/var> . code idbrowser-interface-elements:dom-window-scrollbars>a href#dom-window-scrollbars>scrollbars/a>/code> . code idbrowser-interface-elements:dom-barprop-visible-5>a href#dom-barprop-visible>visible/a>/code>dd> p>Returns true if the scroll bars are visible; otherwise, returns false./p> dt>var>window/var> . code idbrowser-interface-elements:dom-window-statusbar>a href#dom-window-statusbar>statusbar/a>/code> . code idbrowser-interface-elements:dom-barprop-visible-6>a href#dom-barprop-visible>visible/a>/code>dd> p>Returns true if the status bar is visible; otherwise, returns false./p> dt>var>window/var> . code idbrowser-interface-elements:dom-window-toolbar>a href#dom-window-toolbar>toolbar/a>/code> . code idbrowser-interface-elements:dom-barprop-visible-7>a href#dom-barprop-visible>visible/a>/code>dd> p>Returns true if the toolbar is visible; otherwise, returns false./p> /dl> p>The dfn iddom-barprop-visible>visible/dfn> attribute, on getting, must return either true or a value determined by the user agent to most accurately represent the visibility state of the user interface element that the object represents, as described below./p> p>The following code idbrowser-interface-elements:barprop-2>a href#barprop>BarProp/a>/code> objects exist for each code idbrowser-interface-elements:document>a href#document>Document/a>/code> object in a a href#browsing-context idbrowser-interface-elements:browsing-context>browsing context/a>. Some of the user interface elements represented by these objects might have no equivalent in some user agents; for those user agents, except when otherwise specified, the object must act as if it was present and visible (i.e. its code idbrowser-interface-elements:dom-barprop-visible-8>a href#dom-barprop-visible>visible/a>/code> attribute must return true)./p> dl>dt>dfn idthe-location-bar-barprop-object>The location bar code>BarProp/code> object/dfn>dd>Represents the user interface element that contains a control that displays the a idbrowser-interface-elements:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the a href#active-document idbrowser-interface-elements:active-document>active document/a>, or some similar interface concept.dt>dfn idthe-menu-bar-barprop-object>The menu bar code>BarProp/code> object/dfn>dd>Represents the user interface element that contains a list of commands in menu form, or some similar interface concept.dt>dfn idthe-personal-bar-barprop-object>The personal bar code>BarProp/code> object/dfn>dd>Represents the user interface element that contains links to the users favorite pages, or some similar interface concept.dt>dfn idthe-scrollbar-barprop-object>The scrollbar code>BarProp/code> object/dfn>dd>Represents the user interface element that contains a scrolling mechanism, or some similar interface concept.dt>dfn idthe-status-bar-barprop-object>The status bar code>BarProp/code> object/dfn>dd>Represents a user interface element found immediately below or after the document, as appropriate for the users media, which typically provides information about ongoing network activity or information about elements that the users pointing device is current indicating. If the user agent has no such user interface element, then the object may act as if the corresponding user interface element was absent (i.e. its code idbrowser-interface-elements:dom-barprop-visible-9>a href#dom-barprop-visible>visible/a>/code> attribute may return false).dt>dfn idthe-toolbar-barprop-object>The toolbar code>BarProp/code> object/dfn>dd>Represents the user interface element found immediately above or before the document, as appropriate for the users media, which typically provides a href#session-history idbrowser-interface-elements:session-history>session history/a> traversal controls (back and forward buttons, reload buttons, etc). If the user agent has no such user interface element, then the object may act as if the corresponding user interface element was absent (i.e. its code idbrowser-interface-elements:dom-barprop-visible-10>a href#dom-barprop-visible>visible/a>/code> attribute may return false)./dl> p>The dfn iddom-window-locationbar>code>locationbar/code>/dfn> attribute must return a href#the-location-bar-barprop-object idbrowser-interface-elements:the-location-bar-barprop-object>the location bar code>BarProp/code> object/a>./p> p>The dfn iddom-window-menubar>code>menubar/code>/dfn> attribute must return a href#the-menu-bar-barprop-object idbrowser-interface-elements:the-menu-bar-barprop-object>the menu bar code>BarProp/code> object/a>./p> p>The dfn iddom-window-personalbar>code>personalbar/code>/dfn> attribute must return a href#the-personal-bar-barprop-object idbrowser-interface-elements:the-personal-bar-barprop-object>the personal bar code>BarProp/code> object/a>./p> p>The dfn iddom-window-scrollbars>code>scrollbars/code>/dfn> attribute must return a href#the-scrollbar-barprop-object idbrowser-interface-elements:the-scrollbar-barprop-object>the scrollbar code>BarProp/code> object/a>./p> p>The dfn iddom-window-statusbar>code>statusbar/code>/dfn> attribute must return a href#the-status-bar-barprop-object idbrowser-interface-elements:the-status-bar-barprop-object>the status bar code>BarProp/code> object/a>./p> p>The dfn iddom-window-toolbar>code>toolbar/code>/dfn> attribute must return a href#the-toolbar-barprop-object idbrowser-interface-elements:the-toolbar-barprop-object>the toolbar code>BarProp/code> object/a>./p> hr> p>For historical reasons, the dfn iddom-window-status>code>status/code>/dfn> attribute on the code idbrowser-interface-elements:window>a href#window>Window/a>/code> object must, on getting, return the last string it was set to, and on setting, must set itself to the new value. When the code idbrowser-interface-elements:window-2>a href#window>Window/a>/code> object is created, the attribute must be set to the empty string. It does not do anything else./p> h4 idscript-settings-for-window-objects>span classsecno>7.3.7/span> Script settings for code idscript-settings-for-window-objects:window>a href#window>Window/a>/code> objectsa href#script-settings-for-window-objects classself-link>/a>/h4> p>When the user agent is required to dfn idset-up-a-window-environment-settings-object>set up a window environment settings object/dfn>, given a a idscript-settings-for-window-objects:javascript-execution-context hrefhttps://tc39.github.io/ecma262/#sec-execution-contexts data-x-internaljavascript-execution-context>JavaScript execution context/a> var>execution context/var> and an optional a href#environment idscript-settings-for-window-objects:environment>environment/a> var>reserved environment/var>, it must run the following steps:/p> ol>li>p>Let var>realm/var> be the value of var>execution context/var>s Realm component.li>p>Let var>window/var> be var>realm/var>s a href#concept-realm-global idscript-settings-for-window-objects:concept-realm-global>global object/a>.li>p>Let var>url/var> be a copy of the a hrefhttps://dom.spec.whatwg.org/#concept-document-url idscript-settings-for-window-objects:the-documents-address data-x-internalthe-documents-address>URL/a> of var>window/var>s a href#concept-document-window idscript-settings-for-window-objects:concept-document-window>associated code>Document/code>/a>.li> p>Let var>settings object/var> be a new a href#environment-settings-object idscript-settings-for-window-objects:environment-settings-object>environment settings object/a> whose algorithms are defined as follows:/p> dl>dt>The a href#realm-execution-context idscript-settings-for-window-objects:realm-execution-context>realm execution context/a>dd> p>Return var>execution context/var>./p> dt>The a href#concept-settings-object-module-map idscript-settings-for-window-objects:concept-settings-object-module-map>module map/a>dd> p>Return the a href#concept-document-module-map idscript-settings-for-window-objects:concept-document-module-map>module map/a> of var>window/var>s a href#concept-document-window idscript-settings-for-window-objects:concept-document-window-2>associated code>Document/code>/a>./p> dt>The a href#responsible-browsing-context idscript-settings-for-window-objects:responsible-browsing-context>responsible browsing context/a>dd> p>Return the a href#browsing-context idscript-settings-for-window-objects:browsing-context>browsing context/a> with which var>window/var> is associated./p> dt>The a href#responsible-event-loop idscript-settings-for-window-objects:responsible-event-loop>responsible event loop/a>dd> p>Return the a href#event-loop idscript-settings-for-window-objects:event-loop>event loop/a> that is associated with the a href#unit-of-related-similar-origin-browsing-contexts idscript-settings-for-window-objects:unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts/a> to which var>window/var>s a href#browsing-context idscript-settings-for-window-objects:browsing-context-2>browsing context/a> belongs./p> dt>The a href#responsible-document idscript-settings-for-window-objects:responsible-document>responsible document/a>dd> p>Return var>window/var>s a href#concept-document-window idscript-settings-for-window-objects:concept-document-window-3>associated code>Document/code>/a>./p> dt>The a href#api-url-character-encoding idscript-settings-for-window-objects:api-url-character-encoding>API URL character encoding/a>dd> p>Return the current a hrefhttps://dom.spec.whatwg.org/#concept-document-encoding idscript-settings-for-window-objects:documents-character-encoding data-x-internaldocuments-character-encoding>character encoding/a> of var>window/var>s a href#concept-document-window idscript-settings-for-window-objects:concept-document-window-4>associated code>Document/code>/a>./p> dt>The a href#api-base-url idscript-settings-for-window-objects:api-base-url>API base URL/a>dd> p>Return the current a href#document-base-url idscript-settings-for-window-objects:document-base-url>base URL/a> of var>window/var>s a href#concept-document-window idscript-settings-for-window-objects:concept-document-window-5>associated code>Document/code>/a>./p> dt>The a href#concept-settings-object-origin idscript-settings-for-window-objects:concept-settings-object-origin>origin/a>dd> p>Return the a href#concept-origin idscript-settings-for-window-objects:concept-origin>origin/a> of var>window/var>s a href#concept-document-window idscript-settings-for-window-objects:concept-document-window-6>associated code>Document/code>/a>./p> dt>The a href#https-state idscript-settings-for-window-objects:https-state>HTTPS state/a>dd> p>Return the a href#concept-document-https-state idscript-settings-for-window-objects:concept-document-https-state>HTTPS state/a> of var>window/var>s a href#concept-document-window idscript-settings-for-window-objects:concept-document-window-7>associated code>Document/code>/a>./p> dt>The a href#concept-settings-object-referrer-policy idscript-settings-for-window-objects:concept-settings-object-referrer-policy>referrer policy/a>dd> ol>li>p>Let var>document/var> be the code idscript-settings-for-window-objects:document>a href#document>Document/a>/code> with which var>window/var> is currently associated.li>p>While var>document/var> is a href#an-iframe-srcdoc-document idscript-settings-for-window-objects:an-iframe-srcdoc-document>an code>iframe/code> code>srcdoc/code> document/a> and var>document/var>s a href#concept-document-referrer-policy idscript-settings-for-window-objects:concept-document-referrer-policy>referrer policy/a> is the empty string, set var>document/var> to var>document/var>s a href#concept-document-bc idscript-settings-for-window-objects:concept-document-bc>browsing context/a>s a href#browsing-context-container idscript-settings-for-window-objects:browsing-context-container>browsing context container/a>s a idscript-settings-for-window-objects:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>.li>p>Return var>document/var>s a href#concept-document-referrer-policy idscript-settings-for-window-objects:concept-document-referrer-policy-2>referrer policy/a>./ol> /dl> li> p>If var>reserved environment/var> is given, then:/p> ol>li>p>Set var>settings object/var>s a href#concept-environment-id idscript-settings-for-window-objects:concept-environment-id>id/a> to var>reserved environment/var>s a href#concept-environment-id idscript-settings-for-window-objects:concept-environment-id-2>id/a>, var>settings object/var>s a href#concept-environment-creation-url idscript-settings-for-window-objects:concept-environment-creation-url>creation URL/a> to var>reserved environment/var>s a href#concept-environment-creation-url idscript-settings-for-window-objects:concept-environment-creation-url-2>creation URL/a>, var>settings object/var>s a href#concept-environment-target-browsing-context idscript-settings-for-window-objects:concept-environment-target-browsing-context>target browsing context/a> to var>reserved environment/var>s a href#concept-environment-target-browsing-context idscript-settings-for-window-objects:concept-environment-target-browsing-context-2>target browsing context/a>, and var>settings object/var>s a href#concept-environment-active-service-worker idscript-settings-for-window-objects:concept-environment-active-service-worker>active service worker/a> to var>reserved environment/var>s a href#concept-environment-active-service-worker idscript-settings-for-window-objects:concept-environment-active-service-worker-2>active service worker/a>.li> p>Set var>reserved environment/var>s a href#concept-environment-id idscript-settings-for-window-objects:concept-environment-id-3>id/a> to the empty string./p> p classnote>The identity of the reserved environment is considered to be fully transferred to the created a href#environment-settings-object idscript-settings-for-window-objects:environment-settings-object-2>environment settings object/a>. The reserved environment is not searchable by the a href#environment idscript-settings-for-window-objects:environment-2>environment/a>’s a href#concept-environment-id idscript-settings-for-window-objects:concept-environment-id-4>id/a> from this point on./p> /ol> li>p>Otherwise, set var>settings object/var>s a href#concept-environment-id idscript-settings-for-window-objects:concept-environment-id-5>id/a> to a new unique opaque string, var>settings object/var>s a href#concept-environment-creation-url idscript-settings-for-window-objects:concept-environment-creation-url-3>creation URL/a> to var>url/var>, var>settings object/var>s a href#concept-environment-target-browsing-context idscript-settings-for-window-objects:concept-environment-target-browsing-context-3>target browsing context/a> to null, and var>settings object/var>s a href#concept-environment-active-service-worker idscript-settings-for-window-objects:concept-environment-active-service-worker-3>active service worker/a> to null.li>p>Set var>realm/var>s HostDefined field to var>settings object/var>.li>p>Return var>settings object/var>./ol> h3 idthe-windowproxy-exotic-object>span classsecno>7.4/span> The code idthe-windowproxy-exotic-object:windowproxy>a href#windowproxy>WindowProxy/a>/code> exotic objecta href#the-windowproxy-exotic-object classself-link>/a>/h3> p>A dfn idwindowproxy data-dfn-typeinterface data-export>code>WindowProxy/code>/dfn> is an exotic object that wraps a code idthe-windowproxy-exotic-object:window>a href#window>Window/a>/code> ordinary object, indirecting most operations through to the wrapped object. Each a href#browsing-context idthe-windowproxy-exotic-object:browsing-context>browsing context/a> has an associated code idthe-windowproxy-exotic-object:windowproxy-2>a href#windowproxy>WindowProxy/a>/code> object. When the a href#browsing-context idthe-windowproxy-exotic-object:browsing-context-2>browsing context/a> is a href#navigate idthe-windowproxy-exotic-object:navigate>navigated/a>, the code idthe-windowproxy-exotic-object:window-2>a href#window>Window/a>/code> object wrapped by the a href#browsing-context idthe-windowproxy-exotic-object:browsing-context-3>browsing context/a>s associated code idthe-windowproxy-exotic-object:windowproxy-3>a href#windowproxy>WindowProxy/a>/code> object is changed./p> p>There is no code idthe-windowproxy-exotic-object:windowproxy-4>a href#windowproxy>WindowProxy/a>/code> a idthe-windowproxy-exotic-object:interface-object hrefhttps://heycam.github.io/webidl/#dfn-interface-object data-x-internalinterface-object>interface object/a>./p> p>Every code idthe-windowproxy-exotic-object:windowproxy-5>a href#windowproxy>WindowProxy/a>/code> object has a dfn idconcept-windowproxy-window>Window/dfn> internal slot representing the wrapped code idthe-windowproxy-exotic-object:window-3>a href#window>Window/a>/code> object./p> p>The code idthe-windowproxy-exotic-object:windowproxy-6>a href#windowproxy>WindowProxy/a>/code> object internal methods are described in the subsections below./p> p classnote>Although code idthe-windowproxy-exotic-object:windowproxy-7>a href#windowproxy>WindowProxy/a>/code> is named as a proxy, it does not do polymorphic dispatch on its targets internal methods as a real proxy would, due to a desire to reuse machinery between code idthe-windowproxy-exotic-object:windowproxy-8>a href#windowproxy>WindowProxy/a>/code> and code idthe-windowproxy-exotic-object:location>a href#location>Location/a>/code> objects. As long as the code idthe-windowproxy-exotic-object:window-4>a href#window>Window/a>/code> object remains an ordinary object this is unobservable and can be implemented either way./p> h4 idwindowproxy-getprototypeof>span classsecno>7.4.1/span> GetPrototypeOf ( )a href#windowproxy-getprototypeof classself-link>/a>/h4> ol>li>p>Let var>W/var> be the value of the a href#concept-windowproxy-window idwindowproxy-getprototypeof:concept-windowproxy-window>Window/a> internal slot of b>this/b>.li>p>If ! a href#isplatformobjectsameorigin-(-o-) idwindowproxy-getprototypeof:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin/a>(var>W/var>) is true, then return ! a idwindowproxy-getprototypeof:ordinarygetprototypeof hrefhttps://tc39.github.io/ecma262/#sec-ordinarygetprototypeof data-x-internalordinarygetprototypeof>OrdinaryGetPrototypeOf/a>(var>W/var>).li>p>Return null./ol> h4 idwindowproxy-setprototypeof>span classsecno>7.4.2/span> SetPrototypeOf ( var>V/var> )a href#windowproxy-setprototypeof classself-link>/a>/h4> ol>li>p>Return ! a idwindowproxy-setprototypeof:setimmutableprototype hrefhttps://tc39.github.io/ecma262/#sec-set-immutable-prototype data-x-internalsetimmutableprototype>SetImmutablePrototype/a>(b>this/b>, var>V/var>)./ol> h4 idwindowproxy-isextensible>span classsecno>7.4.3/span> IsExtensible ( )a href#windowproxy-isextensible classself-link>/a>/h4> ol>li>p>Return true./ol> h4 idwindowproxy-preventextensions>span classsecno>7.4.4/span> PreventExtensions ( )a href#windowproxy-preventextensions classself-link>/a>/h4> ol>li>p>Return false./ol> h4 idwindowproxy-getownproperty>span classsecno>7.4.5/span> GetOwnProperty ( var>P/var> )a href#windowproxy-getownproperty classself-link>/a>/h4> ol>li>p>Let var>W/var> be the value of the a href#concept-windowproxy-window idwindowproxy-getownproperty:concept-windowproxy-window>Window/a> internal slot of b>this/b>.li> p>If var>P/var> is an a idwindowproxy-getownproperty:array-index-property-name hrefhttps://heycam.github.io/webidl/#dfn-array-index-property-name data-x-internalarray-index-property-name>array index property name/a>, then:/p> ol>li>p>Let var>index/var> be ! a idwindowproxy-getownproperty:touint32 hrefhttps://tc39.github.io/ecma262/#sec-touint32 data-x-internaltouint32>ToUint32/a>(var>P/var>).li>p>Let var>maxProperties/var> be the a href#number-of-document-tree-child-browsing-contexts idwindowproxy-getownproperty:number-of-document-tree-child-browsing-contexts>number of document-tree child browsing contexts/a> of var>W/var>.li>p>Let var>value/var> be undefined.li> p>If var>maxProperties/var> is greater than 0 and var>index/var> is less than var>maxProperties/var>, then:/p> ol>li>p>Let var>document/var> be var>W/var>s a href#concept-document-window idwindowproxy-getownproperty:concept-document-window>associated code>Document/code>/a>.li>p>Set var>value/var> to the code idwindowproxy-getownproperty:windowproxy>a href#windowproxy>WindowProxy/a>/code> object of the var>index/var>th a href#document-tree-child-browsing-context idwindowproxy-getownproperty:document-tree-child-browsing-context>document-tree child browsing context/a> of var>document/var>s a href#concept-document-bc idwindowproxy-getownproperty:concept-document-bc>browsing context/a>, sorted in the order that their a href#browsing-context-container idwindowproxy-getownproperty:browsing-context-container>browsing context container/a> elements were most recently inserted into var>document/var>, the code idwindowproxy-getownproperty:windowproxy-2>a href#windowproxy>WindowProxy/a>/code> object of the most recently inserted a href#browsing-context-container idwindowproxy-getownproperty:browsing-context-container-2>browsing context container/a>s a href#nested-browsing-context idwindowproxy-getownproperty:nested-browsing-context>nested browsing context/a> being last./ol> li>p>If var>value/var> is undefined, then return undefined.li>p>Return a idwindowproxy-getownproperty:propertydescriptor hrefhttps://tc39.github.io/ecma262/#sec-property-descriptor-specification-type data-x-internalpropertydescriptor>PropertyDescriptor/a>{ Value: var>value/var>, Writable: false, Enumerable: true, Configurable: true }./ol> li> p>If ! a href#isplatformobjectsameorigin-(-o-) idwindowproxy-getownproperty:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin/a>(var>W/var>) is true, then return ! a idwindowproxy-getownproperty:ordinarygetownproperty hrefhttps://tc39.github.io/ecma262/#sec-ordinarygetownproperty data-x-internalordinarygetownproperty>OrdinaryGetOwnProperty/a>(var>W/var>, var>P/var>)./p> p classnote>This is a a href#willful-violation idwindowproxy-getownproperty:willful-violation>willful violation/a> of the JavaScript specifications a idwindowproxy-getownproperty:invariants-of-the-essential-internal-methods hrefhttps://tc39.github.io/ecma262/#sec-invariants-of-the-essential-internal-methods data-x-internalinvariants-of-the-essential-internal-methods>invariants of the essential internal methods/a> to maintain compatibility with existing Web content. See a hrefhttps://github.com/tc39/ecma262/issues/672>tc39/ecma262 issue #672/a> for more information. a href#refsJAVASCRIPT>JAVASCRIPT/a>/p> li>p>Let var>property/var> be ! a href#crossorigingetownpropertyhelper-(-o,-p-) idwindowproxy-getownproperty:crossorigingetownpropertyhelper-(-o,-p-)>CrossOriginGetOwnPropertyHelper/a>(var>W/var>, var>P/var>).li>p>If var>property/var> is not undefined, then return var>property/var>.li> p>If var>property/var> is undefined and var>P/var> is in var>W/var>s a href#document-tree-child-browsing-context-name-property-set idwindowproxy-getownproperty:document-tree-child-browsing-context-name-property-set>document-tree child browsing context name property set/a>, then:/p> ol>li>p>Let var>value/var> be the code idwindowproxy-getownproperty:windowproxy-3>a href#windowproxy>WindowProxy/a>/code> object of the a href#dom-window-nameditem-filter idwindowproxy-getownproperty:dom-window-nameditem-filter>named object/a> with the name var>P/var>. li> p>Return a idwindowproxy-getownproperty:propertydescriptor-2 hrefhttps://tc39.github.io/ecma262/#sec-property-descriptor-specification-type data-x-internalpropertydescriptor>PropertyDescriptor/a>{ Value: var>value/var>, Enumerable: false, Writable: false, Configurable: true }./p> p classnote>The reason the property descriptors are non-enumerable, despite this mismatching the same-origin behavior, is for compatibility with existing Web content. See a hrefhttps://github.com/whatwg/html/issues/3183>issue #3183/a> for details./p> /ol> li>p>Throw a a idwindowproxy-getownproperty:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idwindowproxy-getownproperty:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./ol> h4 idwindowproxy-defineownproperty>span classsecno>7.4.6/span> DefineOwnProperty ( var>P/var>, var>Desc/var> )a href#windowproxy-defineownproperty classself-link>/a>/h4> ol>li>p>Let var>W/var> be the value of the a href#concept-windowproxy-window idwindowproxy-defineownproperty:concept-windowproxy-window>Window/a> internal slot of b>this/b>.li> p>If ! a href#isplatformobjectsameorigin-(-o-) idwindowproxy-defineownproperty:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin/a>(var>W/var>) is true, then: ol>li>p>If var>P/var> is an a idwindowproxy-defineownproperty:array-index-property-name hrefhttps://heycam.github.io/webidl/#dfn-array-index-property-name data-x-internalarray-index-property-name>array index property name/a>, return false.li> p>Return ? a idwindowproxy-defineownproperty:ordinarydefineownproperty hrefhttps://tc39.github.io/ecma262/#sec-ordinarydefineownproperty data-x-internalordinarydefineownproperty>OrdinaryDefineOwnProperty/a>(var>W/var>, var>P/var>, var>Desc/var>)./p> p classnote>This is a a href#willful-violation idwindowproxy-defineownproperty:willful-violation>willful violation/a> of the JavaScript specifications a idwindowproxy-defineownproperty:invariants-of-the-essential-internal-methods hrefhttps://tc39.github.io/ecma262/#sec-invariants-of-the-essential-internal-methods data-x-internalinvariants-of-the-essential-internal-methods>invariants of the essential internal methods/a> to maintain compatibility with existing Web content. See a hrefhttps://github.com/tc39/ecma262/issues/672>tc39/ecma262 issue #672/a> for more information. a href#refsJAVASCRIPT>JAVASCRIPT/a>/p> /ol> li>p>Throw a a idwindowproxy-defineownproperty:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idwindowproxy-defineownproperty:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./ol> h4 idwindowproxy-get>span classsecno>7.4.7/span> Get ( var>P/var>, var>Receiver/var> )a href#windowproxy-get classself-link>/a>/h4> ol>li>p>Let var>W/var> be the value of the a href#concept-windowproxy-window idwindowproxy-get:concept-windowproxy-window>Window/a> internal slot of b>this/b>.li>p>If ! a href#isplatformobjectsameorigin-(-o-) idwindowproxy-get:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin/a>(var>W/var>) is true, then return ? a idwindowproxy-get:ordinaryget hrefhttps://tc39.github.io/ecma262/#sec-ordinaryget data-x-internalordinaryget>OrdinaryGet/a>(b>this/b>, var>P/var>, var>Receiver/var>).li>p>Return ? a href#crossoriginget-(-o,-p,-receiver-) idwindowproxy-get:crossoriginget-(-o,-p,-receiver-)>CrossOriginGet/a>(b>this/b>, var>P/var>, var>Receiver/var>)./ol> h4 idwindowproxy-set>span classsecno>7.4.8/span> Set ( var>P/var>, var>V/var>, var>Receiver/var> )a href#windowproxy-set classself-link>/a>/h4> ol>li>p>Let var>W/var> be the value of the a href#concept-windowproxy-window idwindowproxy-set:concept-windowproxy-window>Window/a> internal slot of b>this/b>.li>p>If ! a href#isplatformobjectsameorigin-(-o-) idwindowproxy-set:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin/a>(var>W/var>) is true, then return ? a idwindowproxy-set:ordinaryset hrefhttps://tc39.github.io/ecma262/#sec-ordinaryset data-x-internalordinaryset>OrdinarySet/a>(var>W/var>, b>this/b>, var>Receiver/var>).li>p>Return ? a href#crossoriginset-(-o,-p,-v,-receiver-) idwindowproxy-set:crossoriginset-(-o,-p,-v,-receiver-)>CrossOriginSet/a>(b>this/b>, var>P/var>, var>V/var>, var>Receiver/var>)./ol> h4 idwindowproxy-delete>span classsecno>7.4.9/span> Delete ( var>P/var> )a href#windowproxy-delete classself-link>/a>/h4> ol>li>p>Let var>W/var> be the value of the a href#concept-windowproxy-window idwindowproxy-delete:concept-windowproxy-window>Window/a> internal slot of b>this/b>.li> p>If ! a href#isplatformobjectsameorigin-(-o-) idwindowproxy-delete:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin/a>(var>W/var>) is true, then: ol>li> p>If var>P/var> is an a idwindowproxy-delete:array-index-property-name hrefhttps://heycam.github.io/webidl/#dfn-array-index-property-name data-x-internalarray-index-property-name>array index property name/a>, then:/p> ol>li>p>Let var>desc/var> be ! b>this/b>.GetOwnProperty(var>P/var>).li>p>If var>desc/var> is undefined, then return true.li>p>Return false./ol> li>p>Return ? a idwindowproxy-delete:ordinarydelete hrefhttps://tc39.github.io/ecma262/#sec-ordinarydelete data-x-internalordinarydelete>OrdinaryDelete/a>(var>W/var>, var>P/var>)./ol> li>p>Throw a a idwindowproxy-delete:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idwindowproxy-delete:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./ol> h4 idwindowproxy-ownpropertykeys>span classsecno>7.4.10/span> OwnPropertyKeys ( )a href#windowproxy-ownpropertykeys classself-link>/a>/h4> ol>li>p>Let var>W/var> be the value of the a href#concept-windowproxy-window idwindowproxy-ownpropertykeys:concept-windowproxy-window>Window/a> internal slot of b>this/b>.li>p>Let var>keys/var> be a new empty a hrefhttps://tc39.github.io/ecma262/#sec-list-and-record-specification-type idwindowproxy-ownpropertykeys:js-list data-x-internaljs-list>List/a>.li>p>Let var>maxProperties/var> be the a href#number-of-document-tree-child-browsing-contexts idwindowproxy-ownpropertykeys:number-of-document-tree-child-browsing-contexts>number of document-tree child browsing contexts/a> of var>W/var>.li>p>Let var>index/var> be 0.li> p>Repeat while var>index/var> < var>maxProperties/var>, ol>li>p>Add ! a idwindowproxy-ownpropertykeys:tostring hrefhttps://tc39.github.io/ecma262/#sec-tostring data-x-internaltostring>ToString/a>(var>index/var>) as the last element of var>keys/var>.li>p>Increment var>index/var> by 1./ol> li>p>If ! a href#isplatformobjectsameorigin-(-o-) idwindowproxy-ownpropertykeys:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin/a>(var>W/var>) is true, then return the concatenation of var>keys/var> and ! a idwindowproxy-ownpropertykeys:ordinaryownpropertykeys hrefhttps://tc39.github.io/ecma262/#sec-ordinaryownpropertykeys data-x-internalordinaryownpropertykeys>OrdinaryOwnPropertyKeys/a>(var>W/var>).li>p>Return the concatenation of var>keys/var> and ! a href#crossoriginownpropertykeys-(-o-) idwindowproxy-ownpropertykeys:crossoriginownpropertykeys-(-o-)>CrossOriginOwnPropertyKeys/a>(var>W/var>)./ol> h3 idorigin>span classsecno>7.5/span> Origina href#origin classself-link>/a>/h3>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id28374 titleShould canvas really get tainted by a cross-origin (via document.domain) drawImage call?>28374/a>/div> p>Origins are the fundamental currency of the Webs security model. Two actors in the Web platform that share an origin are assumed to trust each other and to have the same authority. Actors with differing origins are considered potentially hostile versus each other, and are isolated from each other to varying degrees./p> p classexample>For example, if Example Banks Web site, hosted at code>bank.example.com/code>, tries to examine the DOM of Example Charitys Web site, hosted at code>charity.example.org/code>, a a idorigin:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idorigin:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> will be raised./p> hr> p idorigin-2>An dfn data-export idconcept-origin>origin/dfn> is one of the following:/p> dl>dt>An dfn idconcept-origin-opaque data-export>opaque origin/dfn>dd>p>An internal value, with no serialization it can be recreated from (it is serialized as code>null/code> per a href#ascii-serialisation-of-an-origin idorigin:ascii-serialisation-of-an-origin>serialization of an origin/a>), for which the only meaningful operation is testing for equality.dt>A dfn idconcept-origin-tuple data-export>tuple origin/dfn>dd> p>A a href#concept-origin-tuple idorigin:concept-origin-tuple>tuple/a> consists of: ul classbrief>li>A dfn data-dfn-fororigin idconcept-origin-scheme data-export>scheme/dfn> (a a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idorigin:concept-url-scheme data-x-internalconcept-url-scheme>scheme/a>).li>A dfn data-dfn-fororigin idconcept-origin-host data-export>host/dfn> (a a hrefhttps://url.spec.whatwg.org/#concept-host idorigin:concept-host data-x-internalconcept-host>host/a>).li>A dfn data-dfn-fororigin idconcept-origin-port data-export>port/dfn> (a a hrefhttps://url.spec.whatwg.org/#concept-url-port idorigin:concept-url-port data-x-internalconcept-url-port>port/a>).li>A dfn data-dfn-fororigin idconcept-origin-domain data-export>domain/dfn> (null or a a hrefhttps://url.spec.whatwg.org/#concept-domain idorigin:concept-domain data-x-internalconcept-domain>domain/a>). Null unless stated otherwise./ul> /dl> p classnote>a href#concept-origin idorigin:concept-origin>Origins/a> can be shared, e.g., among multiple code idorigin:document>a href#document>Document/a>/code> objects. Furthermore, a href#concept-origin idorigin:concept-origin-2>origins/a> are generally immutable. Only the a href#concept-origin-domain idorigin:concept-origin-domain>domain/a> of a a href#concept-origin-tuple idorigin:concept-origin-tuple-2>tuple origin/a> can be changed, and only through the code idorigin:dom-document-domain>a href#dom-document-domain>document.domain/a>/code> API./p> p>The dfn idconcept-origin-effective-domain data-export>effective domain/dfn> of an a href#concept-origin idorigin:concept-origin-3>origin/a> var>origin/var> is computed as follows:/p> ol>li>p>If var>origin/var> is an a href#concept-origin-opaque idorigin:concept-origin-opaque>opaque origin/a>, then return null.li>p>If var>origin/var>s a href#concept-origin-domain idorigin:concept-origin-domain-2>domain/a> is non-null, then return var>origin/var>s a href#concept-origin-domain idorigin:concept-origin-domain-3>domain/a>.li>p>Return var>origin/var>s a href#concept-origin-host idorigin:concept-origin-host>host/a>./ol> p>Various specification objects are defined to have an a href#concept-origin idorigin:concept-origin-4>origin/a>. These a href#concept-origin idorigin:concept-origin-5>origins/a> are determined as follows:/p> dl>dt>For code idorigin:document-2>a href#document>Document/a>/code> objectsdd> dl classswitch>dt idsandboxOrigin>If the code idorigin:document-3>a href#document>Document/a>/code>s a href#active-sandboxing-flag-set idorigin:active-sandboxing-flag-set>active sandboxing flag set/a> has its a href#sandboxed-origin-browsing-context-flag idorigin:sandboxed-origin-browsing-context-flag>sandboxed origin browsing context flag/a> setdt>If the code idorigin:document-4>a href#document>Document/a>/code> was generated from a a hrefhttps://tools.ietf.org/html/rfc2397#section-2 idorigin:data-protocol data-x-internaldata-protocol>code>data:/code> URL/a>dd>p>A unique a href#concept-origin-opaque idorigin:concept-origin-opaque-2>opaque origin/a> assigned when the code idorigin:document-5>a href#document>Document/a>/code> is created.dt>If the code idorigin:document-6>a href#document>Document/a>/code>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url idorigin:the-documents-address data-x-internalthe-documents-address>URL/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idorigin:concept-url-scheme-2 data-x-internalconcept-url-scheme>scheme/a> is a a idorigin:network-scheme hrefhttps://fetch.spec.whatwg.org/#network-scheme data-x-internalnetwork-scheme>network scheme/a>dd> p>A copy of the code idorigin:document-7>a href#document>Document/a>/code>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url idorigin:the-documents-address-2 data-x-internalthe-documents-address>URL/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-origin idorigin:concept-url-origin data-x-internalconcept-url-origin>origin/a> assigned when the code idorigin:document-8>a href#document>Document/a>/code> is created./p> p classnote>The code idorigin:dom-document-open>a href#dom-document-open>document.open()/a>/code> method can change the code idorigin:document-9>a href#document>Document/a>/code>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url idorigin:the-documents-address-3 data-x-internalthe-documents-address>URL/a> to code idorigin:about:blank>a href#about:blank>about:blank/a>/code>. Therefore the a href#concept-origin idorigin:concept-origin-6>origin/a> is assigned when the code idorigin:document-10>a href#document>Document/a>/code> is created./p> dt>If the code idorigin:document-11>a href#document>Document/a>/code> is the initial code idorigin:about:blank-2>a href#about:blank>about:blank/a>/code> documentdd>p>a href#about-blank-origin>The one it was assigned when its browsing context was created/a>.dt>If the code idorigin:document-12>a href#document>Document/a>/code> is a non-initial code idorigin:about:blank-3>a href#about:blank>about:blank/a>/code> documentdd>p>The a href#concept-settings-object-origin idorigin:concept-settings-object-origin>origin/a> of the a href#incumbent-settings-object idorigin:incumbent-settings-object>incumbent settings object/a> when the a href#navigate idorigin:navigate>navigate/a> algorithm was invoked, or, if no a href#concept-script idorigin:concept-script>script/a> was involved, the a href#concept-origin idorigin:concept-origin-7>origin/a> of the a idorigin:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> of the element that initiated the a href#navigate idorigin:navigate-2>navigation/a> to that a idorigin:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>.dt>If the code idorigin:document-13>a href#document>Document/a>/code> was created as part of the processing for a href#javascript-protocol idorigin:javascript-protocol>code>javascript:/code> URLs/a>dd>p>The a href#concept-origin idorigin:concept-origin-8>origin/a> of the a href#active-document idorigin:active-document>active document/a> of the a href#browsing-context idorigin:browsing-context>browsing context/a> being navigated when the a href#navigate idorigin:navigate-3>navigate/a> algorithm was invoked.dt>If the code idorigin:document-14>a href#document>Document/a>/code> is a href#an-iframe-srcdoc-document idorigin:an-iframe-srcdoc-document>an code>iframe/code> code>srcdoc/code> document/a>dd>p>The a href#concept-origin idorigin:concept-origin-9>origin/a> of the code idorigin:document-15>a href#document>Document/a>/code>s a href#concept-document-bc idorigin:concept-document-bc>browsing context/a>s a href#browsing-context-container idorigin:browsing-context-container>browsing context container/a>s a idorigin:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>.dt>If the code idorigin:document-16>a href#document>Document/a>/code> was obtained in some other manner (e.g. a code idorigin:document-17>a href#document>Document/a>/code> created using the code idorigin:dom-domimplementation-createdocument>a data-x-internaldom-domimplementation-createdocument hrefhttps://dom.spec.whatwg.org/#dom-domimplementation-createdocument>createDocument()/a>/code> API, etc)dd> p>The default behavior as defined in the WHATWG DOM standard applies. a href#refsDOM>DOM/a>./p> p classnote>The a href#concept-origin idorigin:concept-origin-10>origin/a> is a unique a href#concept-origin-opaque idorigin:concept-origin-opaque-3>opaque origin/a> assigned when the code idorigin:document-18>a href#document>Document/a>/code> is created./p> /dl> dt>For images of code idorigin:the-img-element>a href#the-img-element>img/a>/code> elementsdd> dl classswitch>dt>If the a href#img-req-data idorigin:img-req-data>image data/a> is a href#cors-cross-origin idorigin:cors-cross-origin>CORS-cross-origin/a>dd>p>A unique a href#concept-origin-opaque idorigin:concept-origin-opaque-4>opaque origin/a> assigned when the image is created.dt>If the a href#img-req-data idorigin:img-req-data-2>image data/a> is a href#cors-same-origin idorigin:cors-same-origin>CORS-same-origin/a>dd>p>The code idorigin:the-img-element-2>a href#the-img-element>img/a>/code> elements a idorigin:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#concept-origin idorigin:concept-origin-11>origin/a>./dl> dt>For code idorigin:the-audio-element>a href#the-audio-element>audio/a>/code> and code idorigin:the-video-element>a href#the-video-element>video/a>/code> elementsdd> dl classswitch>dt>If the a href#media-data idorigin:media-data>media data/a> is a href#cors-cross-origin idorigin:cors-cross-origin-2>CORS-cross-origin/a>dd>p>A unique a href#concept-origin-opaque idorigin:concept-origin-opaque-5>opaque origin/a> assigned when the a href#media-data idorigin:media-data-2>media data/a> is fetched.dt>If the a href#media-data idorigin:media-data-3>media data/a> is a href#cors-same-origin idorigin:cors-same-origin-2>CORS-same-origin/a>dd>p>The a href#media-element idorigin:media-element>media element/a>s a idorigin:node-document-4 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#concept-origin idorigin:concept-origin-12>origin/a>./dl> /dl> p>Other specifications can override the above definitions by themselves specifying the origin of a particular code idorigin:document-19>a href#document>Document/a>/code> object, image, or a href#media-element idorigin:media-element-2>media element/a>./p> hr> p>The dfn idascii-serialisation-of-an-origin data-ltserialization of an origin|ASCII serialization of an origin data-export>serialization of an origin/dfn> is the string obtained by applying the following algorithm to the given a href#concept-origin idorigin:concept-origin-13>origin/a> var>origin/var>:/p> ol>li>p>If var>origin/var> is an a href#concept-origin-opaque idorigin:concept-origin-opaque-6>opaque origin/a>, then return code>null/code>.li>p>Otherwise, let var>result/var> be var>origin/var>s a href#concept-origin-scheme idorigin:concept-origin-scheme>scheme/a>.li>p>Append code>:///code> to var>result/var>.li>p>Append var>origin/var>s a href#concept-origin-host idorigin:concept-origin-host-2>host/a>, a hrefhttps://url.spec.whatwg.org/#concept-host-serializer idorigin:host-serializer data-x-internalhost-serializer>serialized/a>, to var>result/var>.li>p>If var>origin/var>s a href#concept-origin-port idorigin:concept-origin-port>port/a> is non-null, append a U+003A COLON character (:), and var>origin/var>s a href#concept-origin-port idorigin:concept-origin-port-2>port/a>, a hrefhttps://url.spec.whatwg.org/#serialize-an-integer idorigin:serialize-an-integer data-x-internalserialize-an-integer>serialized/a>, to var>result/var>.li>p>Return var>result/var>./ol> p classexample>The a href#ascii-serialisation-of-an-origin idorigin:ascii-serialisation-of-an-origin-2>serialization/a> of (code>https/code>, code>xn--maraa-rta.example/code>, null, null) is code>https://xn--maraa-rta.example/code>./p> p idunicode-serialisation-of-an-origin classnote>There used to also be a i>Unicode serialization of an origin/i>. However, it was never widely adopted./p> hr> p>Two a href#concept-origin idorigin:concept-origin-14>origins/a>, var>A/var> and var>B/var>, are said to be dfn idsame-origin data-export>same origin/dfn> if the following algorithm returns true:/p> ol>li>p>If var>A/var> and var>B/var> are the same a href#concept-origin-opaque idorigin:concept-origin-opaque-7>opaque origin/a>, then return true.li>p>If var>A/var> and var>B/var> are both a href#concept-origin-tuple idorigin:concept-origin-tuple-3>tuple origins/a> and their a href#concept-origin-scheme idorigin:concept-origin-scheme-2>schemes/a>, a href#concept-origin-host idorigin:concept-origin-host-3>hosts/a>, and a href#concept-origin-port idorigin:concept-origin-port-3>port/a> are identical, then return true.li>p>Return false./ol> p>Two a href#concept-origin idorigin:concept-origin-15>origins/a>, var>A/var> and var>B/var>, are said to be dfn idsame-origin-domain data-export>same origin-domain/dfn> if the following algorithm returns true:/p> ol>li>p>If var>A/var> and var>B/var> are the same a href#concept-origin-opaque idorigin:concept-origin-opaque-8>opaque origin/a>, then return true.li> p>If var>A/var> and var>B/var> are both a href#concept-origin-tuple idorigin:concept-origin-tuple-4>tuple origins/a>, run these substeps:/p> ol>li>p>If var>A/var> and var>B/var>s a href#concept-origin-scheme idorigin:concept-origin-scheme-3>schemes/a> are identical, and their a href#concept-origin-domain idorigin:concept-origin-domain-4>domains/a> are identical and non-null, then return true.li>p>Otherwise, if var>A/var> and var>B/var> are a href#same-origin idorigin:same-origin>same origin/a> and their a href#concept-origin-domain idorigin:concept-origin-domain-5>domains/a> are identical and null, then return true./ol> li>p>Return false./ol> div classexample> table>tr>th>var>A/var> th>var>B/var> th>a href#same-origin idorigin:same-origin-2>same origin/a> th>a href#same-origin-domain idorigin:same-origin-domain>same origin-domain/a> tr>td>(code>https/code>, code>example.org/code>, null, null) td>(code>https/code>, code>example.org/code>, null, null) td>✅ td>✅ tr>td>(code>https/code>, code>example.org/code>, 314, null) td>(code>https/code>, code>example.org/code>, 420, null) td>❌ td>❌ tr>td>(code>https/code>, code>example.org/code>, 314, code>example.org/code>) td>(code>https/code>, code>example.org/code>, 420, code>example.org/code>) td>❌ td>✅ tr>td>(code>https/code>, code>example.org/code>, null, null) td>(code>https/code>, code>example.org/code>, null, code>example.org/code>) td>✅ td>❌ tr>td>(code>https/code>, code>example.org/code>, null, code>example.org/code>) td>(code>http/code>, code>example.org/code>, null, code>example.org/code>) td>❌ td>❌ /table> /div> h4 idrelaxing-the-same-origin-restriction>span classsecno>7.5.1/span> Relaxing the same-origin restrictiona href#relaxing-the-same-origin-restriction classself-link>/a>/h4> dl classdomintro>dt>var>document/var> . code idrelaxing-the-same-origin-restriction:dom-document-domain>a href#dom-document-domain>domain/a>/code> var>domain/var> dd> p>Returns the current domain used for security checks./p> p>Can be set to a value that removes subdomains, to change the a href#concept-origin idrelaxing-the-same-origin-restriction:concept-origin>origin/a>s a href#concept-origin-domain idrelaxing-the-same-origin-restriction:concept-origin-domain>domain/a> to allow pages on other subdomains of the same domain (if they do the same thing) to access each other. (Cant be set in sandboxed code idrelaxing-the-same-origin-restriction:the-iframe-element>a href#the-iframe-element>iframe/a>/code>s.)/p> /dl> p>To determine if a string var>hostSuffixString/var> dfn idis-a-registrable-domain-suffix-of-or-is-equal-to data-ltis a registrable domain suffix of or is equal to|is not a registrable domain suffix of and is not equal to data-export>is a registrable domain suffix of or is equal to/dfn> a a hrefhttps://url.spec.whatwg.org/#concept-host idrelaxing-the-same-origin-restriction:concept-host data-x-internalconcept-host>host/a> var>originalHost/var>, run these steps:/p> ol>li>p>If var>hostSuffixString/var> is the empty string, then return false.li>p>Let var>host/var> be the result of a hrefhttps://url.spec.whatwg.org/#concept-host-parser idrelaxing-the-same-origin-restriction:host-parser data-x-internalhost-parser>parsing/a> var>hostSuffixString/var>.li>p>If var>host/var> is failure, then return false.li> p>If var>host/var> is em>not/em> a hrefhttps://url.spec.whatwg.org/#concept-host-equals idrelaxing-the-same-origin-restriction:host-equals data-x-internalhost-equals>equal/a> to var>originalHost/var>, then run these substeps:/p> ol>li> p>If var>host/var> or var>originalHost/var> is not a a hrefhttps://url.spec.whatwg.org/#concept-domain idrelaxing-the-same-origin-restriction:concept-domain data-x-internalconcept-domain>domain/a>, then return false./p> p classnote>This is meant to exclude a hrefhttps://url.spec.whatwg.org/#concept-host idrelaxing-the-same-origin-restriction:concept-host-2 data-x-internalconcept-host>hosts/a> that are an a idrelaxing-the-same-origin-restriction:ipv4-address hrefhttps://url.spec.whatwg.org/#concept-ipv4 data-x-internalipv4-address>IPv4 address/a> or an a idrelaxing-the-same-origin-restriction:ipv6-address hrefhttps://url.spec.whatwg.org/#concept-ipv6 data-x-internalipv6-address>IPv6 address/a>./p> li>p>If var>host/var>, prefixed by a U+002E FULL STOP (.), does not exactly match the end of var>originalHost/var>, then return false.li> p>If var>host/var> matches a suffix in the Public Suffix List, or, if var>host/var>, prefixed by a U+002E FULL STOP (.), matches the end of a suffix in the Public Suffix List, then return false. a href#refsPSL>PSL/a>/p> p>Suffixes must be compared after applying the a idrelaxing-the-same-origin-restriction:host-parser-2 hrefhttps://url.spec.whatwg.org/#concept-host-parser data-x-internalhost-parser>host parser/a> algorithm./p> /ol> li>p>Return true./ol> p>The dfn iddom-document-domain>code>domain/code>/dfn> attributes getter must run these steps:/p> ol>li>p>If this code idrelaxing-the-same-origin-restriction:document>a href#document>Document/a>/code> object does not have a a href#concept-document-bc idrelaxing-the-same-origin-restriction:concept-document-bc>browsing context/a>, then return the empty string. li>p>Let var>effectiveDomain/var> be this code idrelaxing-the-same-origin-restriction:document-2>a href#document>Document/a>/code>s a href#concept-origin idrelaxing-the-same-origin-restriction:concept-origin-2>origin/a>s a href#concept-origin-effective-domain idrelaxing-the-same-origin-restriction:concept-origin-effective-domain>effective domain/a>. li>p>If var>effectiveDomain/var> is null, then return the empty string.li>p>Return var>effectiveDomain/var>, a hrefhttps://url.spec.whatwg.org/#concept-host-serializer idrelaxing-the-same-origin-restriction:host-serializer data-x-internalhost-serializer>serialized/a>./ol> p>The code idrelaxing-the-same-origin-restriction:dom-document-domain-2>a href#dom-document-domain>domain/a>/code> attributes setter must run these steps:/p> ol>li>p>If this code idrelaxing-the-same-origin-restriction:document-3>a href#document>Document/a>/code> object has no a href#concept-document-bc idrelaxing-the-same-origin-restriction:concept-document-bc-2>browsing context/a>, then throw a a idrelaxing-the-same-origin-restriction:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idrelaxing-the-same-origin-restriction:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If this code idrelaxing-the-same-origin-restriction:document-4>a href#document>Document/a>/code> objects a href#active-sandboxing-flag-set idrelaxing-the-same-origin-restriction:active-sandboxing-flag-set>active sandboxing flag set/a> has its a href#sandboxed-document.domain-browsing-context-flag idrelaxing-the-same-origin-restriction:sandboxed-document.domain-browsing-context-flag>sandboxed code>document.domain/code> browsing context flag/a> set, then throw a a idrelaxing-the-same-origin-restriction:securityerror-2 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idrelaxing-the-same-origin-restriction:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Let var>effectiveDomain/var> be this code idrelaxing-the-same-origin-restriction:document-5>a href#document>Document/a>/code>s a href#concept-origin idrelaxing-the-same-origin-restriction:concept-origin-3>origin/a>s a href#concept-origin-effective-domain idrelaxing-the-same-origin-restriction:concept-origin-effective-domain-2>effective domain/a>. li>p>If var>effectiveDomain/var> is null, then throw a a idrelaxing-the-same-origin-restriction:securityerror-3 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idrelaxing-the-same-origin-restriction:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If the given value a href#is-a-registrable-domain-suffix-of-or-is-equal-to idrelaxing-the-same-origin-restriction:is-a-registrable-domain-suffix-of-or-is-equal-to>is not a registrable domain suffix of and is not equal to/a> var>effectiveDomain/var>, then throw a a idrelaxing-the-same-origin-restriction:securityerror-4 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idrelaxing-the-same-origin-restriction:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Set this code idrelaxing-the-same-origin-restriction:document-6>a href#document>Document/a>/code> objects a href#concept-origin idrelaxing-the-same-origin-restriction:concept-origin-4>origin/a>s a href#concept-origin-domain idrelaxing-the-same-origin-restriction:concept-origin-domain-2>domain/a> to the result of a hrefhttps://url.spec.whatwg.org/#concept-host-parser idrelaxing-the-same-origin-restriction:host-parser-3 data-x-internalhost-parser>parsing/a> the given value./ol> p classnote>The code idrelaxing-the-same-origin-restriction:dom-document-domain-3>a href#dom-document-domain>document.domain/a>/code> attribute is used to enable pages on different hosts of a domain to access each others DOMs./p> p classwarning>Do not use the code idrelaxing-the-same-origin-restriction:dom-document-domain-4>a href#dom-document-domain>document.domain/a>/code> attribute when using shared hosting. If an untrusted third party is able to host an HTTP server at the same IP address but on a different port, then the same-origin protection that normally protects two different sites on the same host will fail, as the ports are ignored when comparing origins after the code idrelaxing-the-same-origin-restriction:dom-document-domain-5>a href#dom-document-domain>document.domain/a>/code> attribute has been used./p> h3 idsandboxing>span classsecno>7.6/span> Sandboxinga href#sandboxing classself-link>/a>/h3> p>A dfn idsandboxing-flag-set data-export>sandboxing flag set/dfn> is a set of zero or more of the following flags, which are used to restrict the abilities that potentially untrusted resources have:/p> dl>dt>The dfn idsandboxed-navigation-browsing-context-flag data-export>sandboxed navigation browsing context flag/dfn>dd> p>This flag a href#sandboxLinks>prevents content from navigating browsing contexts other than the sandboxed browsing context itself/a> (or browsing contexts further nested inside it), a href#auxiliary-browsing-context idsandboxing:auxiliary-browsing-context>auxiliary browsing contexts/a> (which are protected by the a href#sandboxed-auxiliary-navigation-browsing-context-flag idsandboxing:sandboxed-auxiliary-navigation-browsing-context-flag>sandboxed auxiliary navigation browsing context flag/a> defined next), and the a href#top-level-browsing-context idsandboxing:top-level-browsing-context>top-level browsing context/a> (which is protected by the a href#sandboxed-top-level-navigation-without-user-activation-browsing-context-flag idsandboxing:sandboxed-top-level-navigation-without-user-activation-browsing-context-flag>sandboxed top-level navigation without user activation browsing context flag/a> and a href#sandboxed-top-level-navigation-with-user-activation-browsing-context-flag idsandboxing:sandboxed-top-level-navigation-with-user-activation-browsing-context-flag>sandboxed top-level navigation with user activation browsing context flag/a> defined below)./p> p>If the a href#sandboxed-auxiliary-navigation-browsing-context-flag idsandboxing:sandboxed-auxiliary-navigation-browsing-context-flag-2>sandboxed auxiliary navigation browsing context flag/a> is not set, then in certain cases the restrictions nonetheless allow popups (new a href#top-level-browsing-context idsandboxing:top-level-browsing-context-2>top-level browsing contexts/a>) to be opened. These a href#browsing-context idsandboxing:browsing-context>browsing contexts/a> always have dfn idone-permitted-sandboxed-navigator>one permitted sandboxed navigator/dfn>, set when the browsing context is created, which allows the a href#browsing-context idsandboxing:browsing-context-2>browsing context/a> that created them to actually navigate them. (Otherwise, the a href#sandboxed-navigation-browsing-context-flag idsandboxing:sandboxed-navigation-browsing-context-flag>sandboxed navigation browsing context flag/a> would prevent them from being navigated even if they were opened.)/p> dt>The dfn idsandboxed-auxiliary-navigation-browsing-context-flag data-export>sandboxed auxiliary navigation browsing context flag/dfn>dd> p>This flag a href#sandboxWindowOpen>prevents content from creating new auxiliary browsing contexts/a>, e.g. using the code idsandboxing:attr-hyperlink-target>a href#attr-hyperlink-target>target/a>/code> attribute or the code idsandboxing:dom-open>a href#dom-open>window.open()/a>/code> method./p> dt>The dfn idsandboxed-top-level-navigation-without-user-activation-browsing-context-flag data-export>sandboxed top-level navigation without user activation browsing context flag/dfn>dd> p>This flag a href#sandboxLinks>prevents content from navigating their span>top-level browsing context/span>/a> and a href#sandboxClose>prevents content from closing their span>top-level browsing context/span>/a>. It is consulted only from algorithms that are em>not/em> a href#triggered-by-user-activation idsandboxing:triggered-by-user-activation>triggered by user activation/a>./p> p>When the a href#sandboxed-top-level-navigation-without-user-activation-browsing-context-flag idsandboxing:sandboxed-top-level-navigation-without-user-activation-browsing-context-flag-2>sandboxed top-level navigation without user activation browsing context flag/a> is em>not/em> set, content can navigate its a href#top-level-browsing-context idsandboxing:top-level-browsing-context-3>top-level browsing context/a>, but other a href#browsing-context idsandboxing:browsing-context-3>browsing contexts/a> are still protected by the a href#sandboxed-navigation-browsing-context-flag idsandboxing:sandboxed-navigation-browsing-context-flag-2>sandboxed navigation browsing context flag/a> and possibly the a href#sandboxed-auxiliary-navigation-browsing-context-flag idsandboxing:sandboxed-auxiliary-navigation-browsing-context-flag-3>sandboxed auxiliary navigation browsing context flag/a>./p> dt>The dfn idsandboxed-top-level-navigation-with-user-activation-browsing-context-flag data-export>sandboxed top-level navigation with user activation browsing context flag/dfn>dd> p>This flag a href#sandboxLinks>prevents content from navigating their span>top-level browsing context/span>/a> and a href#sandboxClose>prevents content from closing their span>top-level browsing context/span>/a>. It is consulted only from algorithms that em>are/em> a href#triggered-by-user-activation idsandboxing:triggered-by-user-activation-2>triggered by user activation/a>./p> p>As with the a href#sandboxed-top-level-navigation-without-user-activation-browsing-context-flag idsandboxing:sandboxed-top-level-navigation-without-user-activation-browsing-context-flag-3>sandboxed top-level navigation without user activation browsing context flag/a>, this flag only affects the a href#top-level-browsing-context idsandboxing:top-level-browsing-context-4>top-level browsing context/a>; if it is not set, other a href#browsing-context idsandboxing:browsing-context-4>browsing contexts/a> might still be protected by other flags./p> dt>The dfn idsandboxed-plugins-browsing-context-flag data-export>sandboxed plugins browsing context flag/dfn>dd> p>This flag prevents content from instantiating a href#plugin idsandboxing:plugin>plugins/a>, whether using a href#sandboxPluginEmbed>the code>embed/code> element/a>, a href#sandboxPluginObject>the code>object/code> element/a>, or through a href#sandboxPluginNavigate>navigation/a> of a a href#nested-browsing-context idsandboxing:nested-browsing-context>nested browsing context/a>, unless those a href#plugin idsandboxing:plugin-2>plugins/a> can be a href#concept-plugin-secure idsandboxing:concept-plugin-secure>secured/a>./p> dt>The dfn idsandboxed-origin-browsing-context-flag data-export>sandboxed origin browsing context flag/dfn>dd> p>This flag a href#sandboxOrigin>forces content into a unique origin/a>, thus preventing it from accessing other content from the same a href#concept-origin idsandboxing:concept-origin>origin/a>./p> p>This flag also a href#sandboxCookies>prevents script from reading from or writing to the code>document.cookie/code> IDL attribute/a>, and blocks access to code idsandboxing:dom-localstorage>a href#dom-localstorage>localStorage/a>/code>./p> dt>The dfn idsandboxed-forms-browsing-context-flag data-export>sandboxed forms browsing context flag/dfn>dd> p>This flag a href#sandboxSubmitBlocked>blocks form submission/a>./p> dt>The dfn idsandboxed-pointer-lock-browsing-context-flag data-export>sandboxed pointer lock browsing context flag/dfn>dd> p>This flag disables the Pointer Lock API. a href#refsPOINTERLOCK>POINTERLOCK/a>/p> dt>The dfn idsandboxed-scripts-browsing-context-flag data-export>sandboxed scripts browsing context flag/dfn>dd> p>This flag a href#sandboxScriptBlocked>blocks script execution/a>./p> dt>The dfn idsandboxed-automatic-features-browsing-context-flag data-export>sandboxed automatic features browsing context flag/dfn>dd> p>This flag blocks features that trigger automatically, such as a href#attr-media-autoplay idsandboxing:attr-media-autoplay>automatically playing a video/a> or a href#attr-fe-autofocus idsandboxing:attr-fe-autofocus>automatically focusing a form control/a>./p> dt>The dfn idsandboxed-storage-area-urls-flag data-export>sandboxed storage area URLs flag/dfn>dd> p>This flag prevents URL schemes that use storage areas from being able to access the origins data./p> dt>The dfn idsandboxed-document.domain-browsing-context-flag data-export>sandboxed code>document.domain/code> browsing context flag/dfn>dd> p>This flag prevents content from using the code idsandboxing:dom-document-domain>a href#dom-document-domain>document.domain/a>/code> setter./p> dt>The dfn idsandbox-propagates-to-auxiliary-browsing-contexts-flag data-export>sandbox propagates to auxiliary browsing contexts flag/dfn>dd> p>This flag prevents content from escaping the sandbox by ensuring that any a href#auxiliary-browsing-context idsandboxing:auxiliary-browsing-context-2>auxiliary browsing context/a> it creates inherits the contents a href#active-sandboxing-flag-set idsandboxing:active-sandboxing-flag-set>active sandboxing flag set/a>./p> dt>The dfn idsandboxed-modals-flag data-export>sandboxed modals flag/dfn>dd> p>This flag prevents content from using any of the following features to produce modal dialogs:/p> ul>li>code idsandboxing:dom-alert>a href#dom-alert>window.alert()/a>/code>li>code idsandboxing:dom-confirm>a href#dom-confirm>window.confirm()/a>/code>li>code idsandboxing:dom-print>a href#dom-print>window.print()/a>/code>li>code idsandboxing:dom-prompt>a href#dom-prompt>window.prompt()/a>/code>li>the code idsandboxing:event-beforeunload>a href#event-beforeunload>beforeunload/a>/code> event/ul> dt>The dfn idsandboxed-orientation-lock-browsing-context-flag data-export>sandboxed orientation lock browsing context flag/dfn>dd> p>This flag disables the ability to lock the screen orientation. a href#refsSCREENORIENTATION>SCREENORIENTATION/a>/p> dt>The dfn idsandboxed-presentation-browsing-context-flag data-export>sandboxed presentation browsing context flag/dfn>dd> p>This flag disables the Presentation API. a href#refsPRESENTATION>PRESENTATION/a>/p> /dl> p>When the user agent is to dfn idparse-a-sandboxing-directive data-export>parse a sandboxing directive/dfn>, given a string var>input/var>, a a href#sandboxing-flag-set idsandboxing:sandboxing-flag-set>sandboxing flag set/a> var>output/var>, it must run the following steps:/p> ol>li>p>a hrefhttps://infra.spec.whatwg.org/#split-on-ascii-whitespace idsandboxing:split-a-string-on-spaces data-x-internalsplit-a-string-on-spaces>Split var>input/var> on ASCII whitespace/a>, to obtain var>tokens/var>.li>p>Let var>output/var> be empty.li> p>Add the following flags to var>output/var>:/p> ul>li>p>The a href#sandboxed-navigation-browsing-context-flag idsandboxing:sandboxed-navigation-browsing-context-flag-3>sandboxed navigation browsing context flag/a>.li>p>The a href#sandboxed-auxiliary-navigation-browsing-context-flag idsandboxing:sandboxed-auxiliary-navigation-browsing-context-flag-4>sandboxed auxiliary navigation browsing context flag/a>, unless var>tokens/var> contains the dfn idattr-iframe-sandbox-allow-popups>code>allow-popups/code>/dfn> keyword.li>p>The a href#sandboxed-top-level-navigation-without-user-activation-browsing-context-flag idsandboxing:sandboxed-top-level-navigation-without-user-activation-browsing-context-flag-4>sandboxed top-level navigation without user activation browsing context flag/a>, unless var>tokens/var> contains the dfn idattr-iframe-sandbox-allow-top-navigation>code>allow-top-navigation/code>/dfn> keyword.li> p>The a href#sandboxed-top-level-navigation-with-user-activation-browsing-context-flag idsandboxing:sandboxed-top-level-navigation-with-user-activation-browsing-context-flag-2>sandboxed top-level navigation with user activation browsing context flag/a>, unless var>tokens/var> contains either the dfn idattr-iframe-sandbox-allow-top-navigation-by-user-activation>code>allow-top-navigation-by-user-activation/code>/dfn> keyword or the code idsandboxing:attr-iframe-sandbox-allow-top-navigation>a href#attr-iframe-sandbox-allow-top-navigation>allow-top-navigation/a>/code> keyword./p> p classnote>This means that if the code idsandboxing:attr-iframe-sandbox-allow-top-navigation-2>a href#attr-iframe-sandbox-allow-top-navigation>allow-top-navigation/a>/code> is present, the code idsandboxing:attr-iframe-sandbox-allow-top-navigation-by-user-activation>a href#attr-iframe-sandbox-allow-top-navigation-by-user-activation>allow-top-navigation-by-user-activation/a>/code> keyword will have no effect. For this reason, specifying both is a document conformance error./p> li>p>The a href#sandboxed-plugins-browsing-context-flag idsandboxing:sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag/a>.li> p>The a href#sandboxed-origin-browsing-context-flag idsandboxing:sandboxed-origin-browsing-context-flag>sandboxed origin browsing context flag/a>, unless the var>tokens/var> contains the dfn idattr-iframe-sandbox-allow-same-origin>code>allow-same-origin/code>/dfn> keyword./p> div classnote> p>The code idsandboxing:attr-iframe-sandbox-allow-same-origin>a href#attr-iframe-sandbox-allow-same-origin>allow-same-origin/a>/code> keyword is intended for two cases./p> p>First, it can be used to allow content from the same site to be sandboxed to disable scripting, while still allowing access to the DOM of the sandboxed content./p> p>Second, it can be used to embed content from a third-party site, sandboxed to prevent that site from opening pop-up windows, etc, without preventing the embedded page from communicating back to its originating site, using the database APIs to store data, etc./p> /div> li>p>The a href#sandboxed-forms-browsing-context-flag idsandboxing:sandboxed-forms-browsing-context-flag>sandboxed forms browsing context flag/a>, unless var>tokens/var> contains the dfn idattr-iframe-sandbox-allow-forms>code>allow-forms/code>/dfn> keyword.li>p>The a href#sandboxed-pointer-lock-browsing-context-flag idsandboxing:sandboxed-pointer-lock-browsing-context-flag>sandboxed pointer lock browsing context flag/a>, unless var>tokens/var> contains the dfn idattr-iframe-sandbox-allow-pointer-lock>code>allow-pointer-lock/code>/dfn> keyword.li>p>The a href#sandboxed-scripts-browsing-context-flag idsandboxing:sandboxed-scripts-browsing-context-flag>sandboxed scripts browsing context flag/a>, unless var>tokens/var> contains the dfn idattr-iframe-sandbox-allow-scripts>code>allow-scripts/code>/dfn> keyword.li> p>The a href#sandboxed-automatic-features-browsing-context-flag idsandboxing:sandboxed-automatic-features-browsing-context-flag>sandboxed automatic features browsing context flag/a>, unless var>tokens/var> contains the code idsandboxing:attr-iframe-sandbox-allow-scripts>a href#attr-iframe-sandbox-allow-scripts>allow-scripts/a>/code> keyword (defined above)./p> p classnote>This flag is relaxed by the same keyword as scripts, because when scripts are enabled these features are trivially possible anyway, and it would be unfortunate to force authors to use script to do them when sandboxed rather than allowing them to use the declarative features./p> li>p>The a href#sandboxed-storage-area-urls-flag idsandboxing:sandboxed-storage-area-urls-flag>sandboxed storage area URLs flag/a>.li>p>The a href#sandboxed-document.domain-browsing-context-flag idsandboxing:sandboxed-document.domain-browsing-context-flag>sandboxed code>document.domain/code> browsing context flag/a>.li>p>The a href#sandbox-propagates-to-auxiliary-browsing-contexts-flag idsandboxing:sandbox-propagates-to-auxiliary-browsing-contexts-flag>sandbox propagates to auxiliary browsing contexts flag/a>, unless var>tokens/var> contains the dfn idattr-iframe-sandbox-allow-popups-to-escape-sandbox>code>allow-popups-to-escape-sandbox/code>/dfn> keyword.li>p>The a href#sandboxed-modals-flag idsandboxing:sandboxed-modals-flag>sandboxed modals flag/a>, unless var>tokens/var> contains the dfn idattr-iframe-sandbox-allow-modals>code>allow-modals/code>/dfn> keyword.li>p>The a href#sandboxed-orientation-lock-browsing-context-flag idsandboxing:sandboxed-orientation-lock-browsing-context-flag>sandboxed orientation lock browsing context flag/a>, unless var>tokens/var> contains the dfn idattr-iframe-sandbox-allow-orientation-lock>code>allow-orientation-lock/code>/dfn> keyword.li>p>The a href#sandboxed-presentation-browsing-context-flag idsandboxing:sandboxed-presentation-browsing-context-flag>sandboxed presentation browsing context flag/a>, unless var>tokens/var> contains the dfn idattr-iframe-sandbox-allow-presentation>code>allow-presentation/code>/dfn> keyword./ul> /ol> hr> p>Every a href#top-level-browsing-context idsandboxing:top-level-browsing-context-5>top-level browsing context/a> has a dfn idpopup-sandboxing-flag-set>popup sandboxing flag set/dfn>, which is a a href#sandboxing-flag-set idsandboxing:sandboxing-flag-set-2>sandboxing flag set/a>. When a a href#browsing-context idsandboxing:browsing-context-5>browsing context/a> is created, its a href#popup-sandboxing-flag-set idsandboxing: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 idsandboxing:the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context/a>./p> p>Every a href#browsing-context idsandboxing:browsing-context-6>browsing context/a> that is a a href#nested-browsing-context idsandboxing:nested-browsing-context-2>nested browsing context/a> has an dfn idiframe-sandboxing-flag-set>code>iframe/code> sandboxing flag set/dfn>, which is a a href#sandboxing-flag-set idsandboxing:sandboxing-flag-set-3>sandboxing flag set/a>. Which flags in a a href#nested-browsing-context idsandboxing:nested-browsing-context-3>nested browsing context/a>s a href#iframe-sandboxing-flag-set idsandboxing:iframe-sandboxing-flag-set>code>iframe/code> sandboxing flag set/a> are set at any particular time is determined by the code idsandboxing:the-iframe-element>a href#the-iframe-element>iframe/a>/code> elements code idsandboxing:attr-iframe-sandbox>a href#attr-iframe-sandbox>sandbox/a>/code> attribute./p> p>Every code idsandboxing:document>a href#document>Document/a>/code> has an dfn idactive-sandboxing-flag-set>active sandboxing flag set/dfn>, which is a a href#sandboxing-flag-set idsandboxing:sandboxing-flag-set-4>sandboxing flag set/a>. When the code idsandboxing:document-2>a href#document>Document/a>/code> is created, its a href#active-sandboxing-flag-set idsandboxing:active-sandboxing-flag-set-2>active sandboxing flag set/a> must be empty. It is populated by the a href#navigate idsandboxing:navigate>navigation algorithm/a>./p> p>Every resource that is obtained by the a href#navigate idsandboxing:navigate-2>navigation algorithm/a> has a dfn idforced-sandboxing-flag-set data-export>forced sandboxing flag set/dfn>, which is a a href#sandboxing-flag-set idsandboxing:sandboxing-flag-set-5>sandboxing flag set/a>. A resource by default has no flags set in its a href#forced-sandboxing-flag-set idsandboxing:forced-sandboxing-flag-set>forced sandboxing flag set/a>, but other specifications can define that certain flags are set./p> p classnote>In particular, the a href#forced-sandboxing-flag-set idsandboxing:forced-sandboxing-flag-set-2>forced sandboxing flag set/a> is used by cite>Content Security Policy/cite>. a href#refsCSP>CSP/a>/p> hr> p>To dfn idimplement-the-sandboxing>implement the sandboxing/dfn> for a code idsandboxing:document-3>a href#document>Document/a>/code> object var>document/var>, populate var>document/var>s a href#active-sandboxing-flag-set idsandboxing:active-sandboxing-flag-set-3>active sandboxing flag set/a> with the union of the flags that are present in the following a href#sandboxing-flag-set idsandboxing:sandboxing-flag-set-6>sandboxing flag sets/a>:/p> ul>li>p>If var>document/var>s a href#concept-document-bc idsandboxing:concept-document-bc>browsing context/a> is a a href#top-level-browsing-context idsandboxing:top-level-browsing-context-6>top-level browsing context/a>, then: the flags set on the a href#browsing-context idsandboxing:browsing-context-7>browsing context/a>s a href#popup-sandboxing-flag-set idsandboxing:popup-sandboxing-flag-set-2>popup sandboxing flag set/a>.li>p>If var>document/var>s a href#concept-document-bc idsandboxing:concept-document-bc-2>browsing context/a> is a a href#nested-browsing-context idsandboxing:nested-browsing-context-4>nested browsing context/a>, then: the flags set on the a href#browsing-context idsandboxing:browsing-context-8>browsing context/a>s a href#iframe-sandboxing-flag-set idsandboxing:iframe-sandboxing-flag-set-2>code>iframe/code> sandboxing flag set/a>.li>p>If var>document/var>s a href#concept-document-bc idsandboxing:concept-document-bc-3>browsing context/a> is a a href#nested-browsing-context idsandboxing:nested-browsing-context-5>nested browsing context/a>, then: the flags set on the a href#browsing-context idsandboxing:browsing-context-9>browsing context/a>s a href#parent-browsing-context idsandboxing:parent-browsing-context>parent browsing context/a>s a href#active-document idsandboxing:active-document>active document/a>s a href#active-sandboxing-flag-set idsandboxing:active-sandboxing-flag-set-4>active sandboxing flag set/a>.li>p>The flags set on var>document/var>s resources a href#forced-sandboxing-flag-set idsandboxing:forced-sandboxing-flag-set-3>forced sandboxing flag set/a>, if it has one./ul> h3 idhistory>span classsecno>7.7/span> Session history and navigationa href#history classself-link>/a>/h3> h4 idthe-session-history-of-browsing-contexts>span classsecno>7.7.1/span> The session history of browsing contextsa href#the-session-history-of-browsing-contexts classself-link>/a>/h4> p>The sequence of code idthe-session-history-of-browsing-contexts:document>a href#document>Document/a>/code>s in a a href#browsing-context idthe-session-history-of-browsing-contexts:browsing-context>browsing context/a> is its dfn idsession-history>session history/dfn>. Each a href#browsing-context idthe-session-history-of-browsing-contexts:browsing-context-2>browsing context/a>, including a href#nested-browsing-context idthe-session-history-of-browsing-contexts:nested-browsing-context>nested browsing contexts/a>, has a distinct session history. A a href#browsing-context idthe-session-history-of-browsing-contexts:browsing-context-3>browsing context/a>s session history consists of a flat list of a href#session-history-entry idthe-session-history-of-browsing-contexts:session-history-entry>session history entries/a>. Each dfn idsession-history-entry>session history entry/dfn> consists, at a minimum, of a a idthe-session-history-of-browsing-contexts:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>, and each entry may in addition have a href#serialized-state idthe-session-history-of-browsing-contexts:serialized-state>serialized state/a>, a title, a code idthe-session-history-of-browsing-contexts:document-2>a href#document>Document/a>/code> object, form data, a a href#scroll-restoration-mode idthe-session-history-of-browsing-contexts:scroll-restoration-mode>scroll restoration mode/a>, a scroll position, a a href#browsing-context-name idthe-session-history-of-browsing-contexts:browsing-context-name>browsing context name/a>, and other information associated with it./p> p classnote>Each entry, when first created, has a code idthe-session-history-of-browsing-contexts:document-3>a href#document>Document/a>/code>. However, when a code idthe-session-history-of-browsing-contexts:document-4>a href#document>Document/a>/code> is not a href#fully-active idthe-session-history-of-browsing-contexts:fully-active>active/a>, its possible for it to be a href#discard-a-document idthe-session-history-of-browsing-contexts:discard-a-document>discarded/a> to free resources. The a idthe-session-history-of-browsing-contexts:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> and other data in a a href#session-history-entry idthe-session-history-of-browsing-contexts:session-history-entry-2>session history entry/a> is then used to bring a new code idthe-session-history-of-browsing-contexts:document-5>a href#document>Document/a>/code> into being to take the place of the original, in case the user agent finds itself having to reactivate that code idthe-session-history-of-browsing-contexts:document-6>a href#document>Document/a>/code>./p> p classnote>Titles associated with a href#session-history-entry idthe-session-history-of-browsing-contexts:session-history-entry-3>session history entries/a> need not have any relation with the current code idthe-session-history-of-browsing-contexts:the-title-element>a href#the-title-element>title/a>/code> of the code idthe-session-history-of-browsing-contexts:document-7>a href#document>Document/a>/code>. The title of a a href#session-history-entry idthe-session-history-of-browsing-contexts:session-history-entry-4>session history entry/a> is intended to explain the state of the document at that point, so that the user can navigate the documents history./p> p>URLs without associated a href#serialized-state idthe-session-history-of-browsing-contexts:serialized-state-2>serialized state/a> are added to the session history as the user (or script) navigates from page to page./p> hr> p>Each code idthe-session-history-of-browsing-contexts:document-8>a href#document>Document/a>/code> object in a a href#browsing-context idthe-session-history-of-browsing-contexts:browsing-context-4>browsing context/a>s a href#session-history idthe-session-history-of-browsing-contexts:session-history>session history/a> is associated with a unique code idthe-session-history-of-browsing-contexts:history-3>a href#history-3>History/a>/code> object which must all model the same underlying a href#session-history idthe-session-history-of-browsing-contexts:session-history-2>session history/a>./p> p>The dfn iddom-history>code>history/code>/dfn> attribute of the code idthe-session-history-of-browsing-contexts:window>a href#window>Window/a>/code> interface must return the object implementing the code idthe-session-history-of-browsing-contexts:history-3-2>a href#history-3>History/a>/code> interface for this code idthe-session-history-of-browsing-contexts:window-2>a href#window>Window/a>/code> objects a href#concept-document-window idthe-session-history-of-browsing-contexts:concept-document-window>associated code>Document/code>/a>./p> hr> p idstate-object>dfn idserialized-state>Serialized state/dfn> is a serialization (via a href#structuredserializeforstorage idthe-session-history-of-browsing-contexts:structuredserializeforstorage>StructuredSerializeForStorage/a>) of an object representing a user interface state. We sometimes informally refer to state objects, which are the objects representing user interface state supplied by the author, or alternately the objects created by deserializing (via a href#structureddeserialize idthe-session-history-of-browsing-contexts:structureddeserialize>StructuredDeserialize/a>) serialized state./p> p>Pages can a href#dom-history-pushstate idthe-session-history-of-browsing-contexts:dom-history-pushstate>add/a> a href#serialized-state idthe-session-history-of-browsing-contexts:serialized-state-3>serialized state/a> to the session history. These are then a href#structureddeserialize idthe-session-history-of-browsing-contexts:structureddeserialize-2>deserialized/a> and a href#event-popstate idthe-session-history-of-browsing-contexts:event-popstate>returned to the script/a> when the user (or script) goes back in the history, thus enabling authors to use the navigation metaphor even in one-page applications./p> div classnote> p>a href#serialized-state idthe-session-history-of-browsing-contexts:serialized-state-4>Serialized state/a> is intended to be used for two main purposes: first, storing a preparsed description of the state in the a idthe-session-history-of-browsing-contexts:url-3 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> so that in the simple case an author doesnt have to do the parsing (though one would still need the parsing for handling a hrefhttps://url.spec.whatwg.org/#concept-url idthe-session-history-of-browsing-contexts:url-4 data-x-internalurl>URLs/a> passed around by users, so its only a minor optimization). Second, so that the author can store state that one wouldnt store in the URL because it only applies to the current code idthe-session-history-of-browsing-contexts:document-9>a href#document>Document/a>/code> instance and it would have to be reconstructed if a new code idthe-session-history-of-browsing-contexts:document-10>a href#document>Document/a>/code> were opened./p> p>An example of the latter would be something like keeping track of the precise coordinate from which a pop-up code idthe-session-history-of-browsing-contexts:the-div-element>a href#the-div-element>div/a>/code> was made to animate, so that if the user goes back, it can be made to animate to the same location. Or alternatively, it could be used to keep a pointer into a cache of data that would be fetched from the server based on the information in the a idthe-session-history-of-browsing-contexts:url-5 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>, so that when going back and forward, the information doesnt have to be fetched again./p> /div> hr> p>At any point, one of the entries in the session history is the dfn idcurrent-entry>current entry/dfn>. This is the entry representing the a href#active-document idthe-session-history-of-browsing-contexts:active-document>active document/a> of the a href#browsing-context idthe-session-history-of-browsing-contexts:browsing-context-5>browsing context/a>. Which entry is the a href#current-entry idthe-session-history-of-browsing-contexts:current-entry>current entry/a> is changed by the algorithms defined in this specification, e.g. during a href#traverse-the-history idthe-session-history-of-browsing-contexts:traverse-the-history>session history traversal/a>./p> p classnote>The a href#current-entry idthe-session-history-of-browsing-contexts:current-entry-2>current entry/a> is usually an entry for the a hrefhttps://dom.spec.whatwg.org/#concept-document-url idthe-session-history-of-browsing-contexts:the-documents-address data-x-internalthe-documents-address>URL/a> of the code idthe-session-history-of-browsing-contexts:document-11>a href#document>Document/a>/code>. However, it can also be one of the entries for a href#serialized-state idthe-session-history-of-browsing-contexts:serialized-state-5>serialized state/a> added to the history by that document./p> p>dfn idan-entry-with-persisted-user-state>An entry with persisted user state/dfn> is one that also has user-agent defined state. This specification does not specify what kind of state can be stored./p> p classexample>For example, some user agents might want to persist the scroll position, or the values of form controls./p> p classnote>User agents that persist the value of form controls are encouraged to also persist their directionality (the value of the elements code idthe-session-history-of-browsing-contexts:the-dir-attribute>a href#the-dir-attribute>dir/a>/code> attribute). This prevents values from being displayed incorrectly after a history traversal when the user had originally entered the values with an explicit, non-default directionality./p> p>An entrys dfn idscroll-restoration-mode>scroll restoration mode/dfn> indicates whether the user agent should restore the persisted scroll position (if any) when traversing to it. The scroll restoration mode may be one of the following:/p> dl>dt>dfn iddom-scrollrestoration-auto>code>auto/code>/dfn>dd>The user agent is responsible for restoring the scroll position upon navigation.dt>dfn iddom-scrollrestoration-manual>code>manual/code>/dfn>dd>The page is responsible for restoring the scroll position and the user agent does not attempt to do so automatically/dl> p>If unspecified, the a href#scroll-restoration-mode idthe-session-history-of-browsing-contexts:scroll-restoration-mode-2>scroll restoration mode/a> of a new entry must be set to code idthe-session-history-of-browsing-contexts:dom-scrollrestoration-auto>a href#dom-scrollrestoration-auto>auto/a>/code>./p> p>Entries that contain a href#serialized-state idthe-session-history-of-browsing-contexts:serialized-state-6>serialized state/a> share the same code idthe-session-history-of-browsing-contexts:document-12>a href#document>Document/a>/code> as the entry for the page that was active when they were added./p> p>Contiguous entries that differ just by their a hrefhttps://url.spec.whatwg.org/#concept-url idthe-session-history-of-browsing-contexts:url-6 data-x-internalurl>URLs/a> a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idthe-session-history-of-browsing-contexts:concept-url-fragment data-x-internalconcept-url-fragment>fragments/a> also share the same code idthe-session-history-of-browsing-contexts:document-13>a href#document>Document/a>/code>./p> p classnote>All entries that share the same code idthe-session-history-of-browsing-contexts:document-14>a href#document>Document/a>/code> (and that are therefore merely different states of one particular document) are contiguous by definition./p> p>Each code idthe-session-history-of-browsing-contexts:document-15>a href#document>Document/a>/code> in a a href#browsing-context idthe-session-history-of-browsing-contexts:browsing-context-6>browsing context/a> can also have a dfn idlatest-entry>latest entry/dfn>. This is the entry for that code idthe-session-history-of-browsing-contexts:document-16>a href#document>Document/a>/code> to which the a href#browsing-context idthe-session-history-of-browsing-contexts:browsing-context-7>browsing context/a>s a href#session-history idthe-session-history-of-browsing-contexts:session-history-3>session history/a> was most recently traversed. When a code idthe-session-history-of-browsing-contexts:document-17>a href#document>Document/a>/code> is created, it initially has no a href#latest-entry idthe-session-history-of-browsing-contexts:latest-entry>latest entry/a>./p> p>User agents may a href#discard-a-document idthe-session-history-of-browsing-contexts:discard-a-document-2>discard/a> the code idthe-session-history-of-browsing-contexts:document-18>a href#document>Document/a>/code> objects of entries other than the a href#current-entry idthe-session-history-of-browsing-contexts:current-entry-3>current entry/a> that are not referenced from any script, reloading the pages afresh when the user or script navigates back to such pages. This specification does not specify when user agents should discard code idthe-session-history-of-browsing-contexts:document-19>a href#document>Document/a>/code> objects and when they should cache them./p> p>Entries that have had their code idthe-session-history-of-browsing-contexts:document-20>a href#document>Document/a>/code> objects discarded must, for the purposes of the algorithms given below, act as if they had not. When the user or script navigates back or forwards to a page which has no in-memory DOM objects, any other entries that shared the same code idthe-session-history-of-browsing-contexts:document-21>a href#document>Document/a>/code> object with it must share the new object as well./p> h4 idthe-history-interface>span classsecno>7.7.2/span> The code idthe-history-interface:history-3>a href#history-3>History/a>/code> interfacea href#the-history-interface classself-link>/a>/h4> pre classidl>enum dfn idscrollrestoration>ScrollRestoration/dfn> { a href#dom-scrollrestoration-auto idthe-history-interface:dom-scrollrestoration-auto>auto/a>, a href#dom-scrollrestoration-manual idthe-history-interface:dom-scrollrestoration-manual>manual/a> };ExposedWindowinterface dfn idhistory-3>History/dfn> { readonly attribute unsigned long a href#dom-history-index idthe-history-interface:dom-history-index>index/a>; readonly attribute unsigned long a href#dom-history-length idthe-history-interface:dom-history-length>length/a>; attribute a href#scrollrestoration idthe-history-interface:scrollrestoration>ScrollRestoration/a> a href#dom-history-scroll-restoration idthe-history-interface:dom-history-scroll-restoration>scrollRestoration/a>; readonly attribute any a href#dom-history-state idthe-history-interface:dom-history-state>state/a>; void a href#dom-history-go idthe-history-interface:dom-history-go>go/a>(optional long delta 0); void a href#dom-history-back idthe-history-interface:dom-history-back>back/a>(); void a href#dom-history-forward idthe-history-interface:dom-history-forward>forward/a>(); void a href#dom-history-pushstate idthe-history-interface:dom-history-pushstate>pushState/a>(any data, DOMString title, optional USVString? url null); void a href#dom-history-replacestate idthe-history-interface:dom-history-replacestate>replaceState/a>(any data, DOMString title, optional USVString? url null);};/pre> dl classdomintro>dt>var>window/var> . code idthe-history-interface:dom-history>a href#dom-history>history/a>/code> . code idthe-history-interface:dom-history-index-2>a href#dom-history-index>index/a>/code>dd> p>Returns the index of the a href#current-entry-of-the-joint-session-history idthe-history-interface:current-entry-of-the-joint-session-history>current entry of the joint session history/a> within the a href#joint-session-history idthe-history-interface:joint-session-history>joint session history/a>./p> dt>var>window/var> . code idthe-history-interface:dom-history-2>a href#dom-history>history/a>/code> . code idthe-history-interface:dom-history-length-2>a href#dom-history-length>length/a>/code>dd> p>Returns the number of entries in the a href#joint-session-history idthe-history-interface:joint-session-history-2>joint session history/a>./p> dt>var>window/var> . code idthe-history-interface:dom-history-3>a href#dom-history>history/a>/code> . code idthe-history-interface:dom-history-scroll-restoration-2>a href#dom-history-scroll-restoration>scrollRestoration/a>/code> var>value/var> dd> p>Returns the a href#scroll-restoration-mode idthe-history-interface:scroll-restoration-mode>scroll restoration mode/a> of the current entry in the a href#session-history idthe-history-interface:session-history>session history/a>./p> p>Can be set, to change the a href#scroll-restoration-mode idthe-history-interface:scroll-restoration-mode-2>scroll restoration mode/a> of the current entry in the a href#session-history idthe-history-interface:session-history-2>session history/a>./p> dt>var>window/var> . code idthe-history-interface:dom-history-4>a href#dom-history>history/a>/code> . code idthe-history-interface:dom-history-state-2>a href#dom-history-state>state/a>/code>dd> p>Returns the current a href#serialized-state idthe-history-interface:serialized-state>serialized state/a>, deserialized into an object./p> dt>var>window/var> . code idthe-history-interface:dom-history-5>a href#dom-history>history/a>/code> . code idthe-history-interface:dom-history-go-2>a href#dom-history-go>go/a>/code>( var>delta/var> )dd> p>Goes back or forward the specified number of steps in the a href#joint-session-history idthe-history-interface:joint-session-history-3>joint session history/a>./p> p>A zero delta will reload the current page./p> p>If the delta is out of range, does nothing./p> dt>var>window/var> . code idthe-history-interface:dom-history-6>a href#dom-history>history/a>/code> . code idthe-history-interface:dom-history-back-2>a href#dom-history-back>back/a>/code>()dd> p>Goes back one step in the a href#joint-session-history idthe-history-interface:joint-session-history-4>joint session history/a>./p> p>If there is no previous page, does nothing./p> dt>var>window/var> . code idthe-history-interface:dom-history-7>a href#dom-history>history/a>/code> . code idthe-history-interface:dom-history-forward-2>a href#dom-history-forward>forward/a>/code>()dd> p>Goes forward one step in the a href#joint-session-history idthe-history-interface:joint-session-history-5>joint session history/a>./p> p>If there is no next page, does nothing./p> dt>var>window/var> . code idthe-history-interface:dom-history-8>a href#dom-history>history/a>/code> . code idthe-history-interface:dom-history-pushstate-2>a href#dom-history-pushstate>pushState/a>/code>(var>data/var>, var>title/var> , var>url/var> )dd> p>Pushes the given data onto the session history, with the given title, and, if provided and not null, the given URL./p> dt>var>window/var> . code idthe-history-interface:dom-history-9>a href#dom-history>history/a>/code> . code idthe-history-interface:dom-history-replacestate-2>a href#dom-history-replacestate>replaceState/a>/code>(var>data/var>, var>title/var> , var>url/var> )dd> p>Updates the current entry in the session history to have the given data, title, and, if provided and not null, URL./p> /dl> p>The dfn idjoint-session-history>joint session history/dfn> of a a href#top-level-browsing-context idthe-history-interface:top-level-browsing-context>top-level browsing context/a> is the union of all the a href#session-history idthe-history-interface:session-history-3>session histories/a> of all a href#concept-document-bc idthe-history-interface:concept-document-bc>browsing contexts/a> of all the a href#fully-active idthe-history-interface:fully-active>fully active/a> code idthe-history-interface:document>a href#document>Document/a>/code> objects that share that a href#top-level-browsing-context idthe-history-interface:top-level-browsing-context-2>top-level browsing context/a>, with all the entries that are a href#current-entry idthe-history-interface:current-entry>current entries/a> in their respective a href#session-history idthe-history-interface:session-history-4>session histories/a> removed except for the a href#current-entry-of-the-joint-session-history idthe-history-interface:current-entry-of-the-joint-session-history-2>current entry of the joint session history/a>./p> p>The dfn idcurrent-entry-of-the-joint-session-history>current entry of the joint session history/dfn> is the entry that most recently became a a href#current-entry idthe-history-interface:current-entry-2>current entry/a> in its a href#session-history idthe-history-interface:session-history-5>session history/a>./p> p>Entries in the a href#joint-session-history idthe-history-interface:joint-session-history-6>joint session history/a> are ordered chronologically by the time they were added to their respective a href#session-history idthe-history-interface:session-history-6>session histories/a>. Each entry has an index; the earliest entry has index 0, and the subsequent entries are numbered with consecutively increasing integers (1, 2, 3, etc)./p> p classnote>Since each code idthe-history-interface:document-2>a href#document>Document/a>/code> in a a href#browsing-context idthe-history-interface:browsing-context>browsing context/a> might have a different a href#event-loop idthe-history-interface:event-loop>event loop/a>, the actual state of the a href#joint-session-history idthe-history-interface:joint-session-history-7>joint session history/a> can be somewhat nebulous. For example, two sibling code idthe-history-interface:the-iframe-element>a href#the-iframe-element>iframe/a>/code> elements could both a href#traverse-the-history idthe-history-interface:traverse-the-history>traverse/a> from one unique origin to another at the same time, so their precise order might not be well-defined; similarly, since they might only find out about each other later, they might disagree about the length of the a href#joint-session-history idthe-history-interface:joint-session-history-8>joint session history/a>./p> p>The dfn iddom-history-index>code>index/code>/dfn> attribute of the code idthe-history-interface:history-3-2>a href#history-3>History/a>/code> interface, on getting, must return the index of the a href#current-entry-of-the-joint-session-history idthe-history-interface:current-entry-of-the-joint-session-history-3>current entry of the joint session history/a> within the a href#top-level-browsing-context idthe-history-interface:top-level-browsing-context-3>top-level browsing context/a>s a href#joint-session-history idthe-history-interface:joint-session-history-9>joint session history/a>. If this code idthe-history-interface:history-3-3>a href#history-3>History/a>/code> object is associated with a code idthe-history-interface:document-3>a href#document>Document/a>/code> that is not a href#fully-active idthe-history-interface:fully-active-2>fully active/a>, getting must instead throw a a idthe-history-interface:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-history-interface:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> p>The dfn iddom-history-length>code>length/code>/dfn> attribute of the code idthe-history-interface:history-3-4>a href#history-3>History/a>/code> interface, on getting, must return the number of entries in the a href#top-level-browsing-context idthe-history-interface:top-level-browsing-context-4>top-level browsing context/a>s a href#joint-session-history idthe-history-interface:joint-session-history-10>joint session history/a>. If this code idthe-history-interface:history-3-5>a href#history-3>History/a>/code> object is associated with a code idthe-history-interface:document-4>a href#document>Document/a>/code> that is not a href#fully-active idthe-history-interface:fully-active-3>fully active/a>, getting must instead throw a a idthe-history-interface:securityerror-2 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-history-interface:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> p>The actual entries are not accessible from script./p> p>The dfn iddom-history-scroll-restoration>code>scrollRestoration/code>/dfn> attribute of the History interface, on getting, must return the a href#scroll-restoration-mode idthe-history-interface:scroll-restoration-mode-3>scroll restoration mode/a> of the current entry in the a href#session-history idthe-history-interface:session-history-7>session history/a>. On setting, the a href#scroll-restoration-mode idthe-history-interface:scroll-restoration-mode-4>scroll restoration mode /a> of the current entry in the a href#session-history idthe-history-interface:session-history-8>session history/a> must be set to the new value. If this code idthe-history-interface:history-3-6>a href#history-3>History/a>/code> object is associated with a code idthe-history-interface:document-5>a href#document>Document/a>/code> that is not a href#fully-active idthe-history-interface:fully-active-4>fully active/a>, both getting and setting must instead throw a a idthe-history-interface:securityerror-3 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-history-interface:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> p>The dfn iddom-history-state>code>state/code>/dfn> attribute of the code idthe-history-interface:history-3-7>a href#history-3>History/a>/code> interface, on getting, must return the last value it was set to by the user agent. If this code idthe-history-interface:history-3-8>a href#history-3>History/a>/code> object is associated with a code idthe-history-interface:document-6>a href#document>Document/a>/code> that is not a href#fully-active idthe-history-interface:fully-active-5>fully active/a>, getting must instead throw a a idthe-history-interface:securityerror-4 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-history-interface:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>. Initially, its value must be null./p> p>When the dfn iddom-history-go>code>go(var>delta/var>)/code>/dfn> method is invoked, if var>delta/var> is zero, the user agent must act as if the code idthe-history-interface:dom-location-reload>a href#dom-location-reload>location.reload()/a>/code> method was called instead. Otherwise, the user agent must a href#traverse-the-history-by-a-delta idthe-history-interface:traverse-the-history-by-a-delta>traverse the history by a delta/a> whose value is var>delta/var>. If this code idthe-history-interface:history-3-9>a href#history-3>History/a>/code> object is associated with a code idthe-history-interface:document-7>a href#document>Document/a>/code> that is not a href#fully-active idthe-history-interface:fully-active-6>fully active/a>, invoking must instead throw a a idthe-history-interface:securityerror-5 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-history-interface:domexception-5>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> p>When the dfn iddom-history-back>code>back()/code>/dfn> method is invoked, the user agent must a href#traverse-the-history-by-a-delta idthe-history-interface:traverse-the-history-by-a-delta-2>traverse the history by a delta/a> −1. If this code idthe-history-interface:history-3-10>a href#history-3>History/a>/code> object is associated with a code idthe-history-interface:document-8>a href#document>Document/a>/code> that is not a href#fully-active idthe-history-interface:fully-active-7>fully active/a>, invoking must instead throw a a idthe-history-interface:securityerror-6 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-history-interface:domexception-6>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> p>When the dfn iddom-history-forward>code>forward()/code>/dfn> method is invoked, the user agent must a href#traverse-the-history-by-a-delta idthe-history-interface:traverse-the-history-by-a-delta-3>traverse the history by a delta/a> +1. If this code idthe-history-interface:history-3-11>a href#history-3>History/a>/code> object is associated with a code idthe-history-interface:document-9>a href#document>Document/a>/code> that is not a href#fully-active idthe-history-interface:fully-active-8>fully active/a>, invoking must instead throw a a idthe-history-interface:securityerror-7 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-history-interface:domexception-7>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> hr> p>Each a href#top-level-browsing-context idthe-history-interface:top-level-browsing-context-5>top-level browsing context/a> has a dfn idsession-history-traversal-queue>session history traversal queue/dfn>, initially empty, to which a href#concept-task idthe-history-interface:concept-task>tasks/a> can be added./p> p>Each a href#top-level-browsing-context idthe-history-interface:top-level-browsing-context-6>top-level browsing context/a>, when created, must begin running the following algorithm, known as the dfn idsession-history-event-loop>session history event loop/dfn> for that a href#top-level-browsing-context idthe-history-interface:top-level-browsing-context-7>top-level browsing context/a>, a href#in-parallel idthe-history-interface:in-parallel>in parallel/a>:/p> ol>li>p>Wait until this a href#top-level-browsing-context idthe-history-interface:top-level-browsing-context-8>top-level browsing context/a>s a href#session-history-traversal-queue idthe-history-interface:session-history-traversal-queue>session history traversal queue/a> is not empty.li>p>Pull the first a href#concept-task idthe-history-interface:concept-task-2>task/a> from this a href#top-level-browsing-context idthe-history-interface:top-level-browsing-context-9>top-level browsing context/a>s a href#session-history-traversal-queue idthe-history-interface:session-history-traversal-queue-2>session history traversal queue/a>, and execute it.li>p>Return to the first step of this algorithm./p> /ol> p>The a href#session-history-event-loop idthe-history-interface:session-history-event-loop>session history event loop/a> helps coordinate cross-browsing-context transitions of the a href#joint-session-history idthe-history-interface:joint-session-history-11>joint session history/a>: since each a href#browsing-context idthe-history-interface:browsing-context-2>browsing context/a> might, at any particular time, have a different a href#event-loop idthe-history-interface:event-loop-2>event loop/a> (this can happen if the user agent has more than one a href#event-loop idthe-history-interface:event-loop-3>event loop/a> per a href#unit-of-related-browsing-contexts idthe-history-interface:unit-of-related-browsing-contexts>unit of related browsing contexts/a>), transitions would otherwise have to involve cross-event-loop synchronization./p> hr> p>To dfn idtraverse-the-history-by-a-delta>traverse the history by a delta/dfn> var>delta/var>, the user agent must append a a href#concept-task idthe-history-interface:concept-task-3>task/a> to this a href#top-level-browsing-context idthe-history-interface:top-level-browsing-context-10>top-level browsing context/a>s a href#session-history-traversal-queue idthe-history-interface:session-history-traversal-queue-3>session history traversal queue/a>, the a href#concept-task idthe-history-interface:concept-task-4>task/a> consisting of running the following steps:/p> ol>li>p>If the index of the a href#current-entry-of-the-joint-session-history idthe-history-interface:current-entry-of-the-joint-session-history-4>current entry of the joint session history/a> plus var>delta/var> is less than zero or greater than or equal to the number of items in the a href#joint-session-history idthe-history-interface:joint-session-history-12>joint session history/a>, then abort these steps./p> li>p>Let var>specified entry/var> be the entry in the a href#joint-session-history idthe-history-interface:joint-session-history-13>joint session history/a> whose index is the sum of var>delta/var> and the index of the a href#current-entry-of-the-joint-session-history idthe-history-interface:current-entry-of-the-joint-session-history-5>current entry of the joint session history/a>.li>p>Let var>specified browsing context/var> be the a href#browsing-context idthe-history-interface:browsing-context-3>browsing context/a> of the var>specified entry/var>.li>p>If the var>specified browsing context/var>s a href#active-document idthe-history-interface:active-document>active document/a>s a href#unload-a-document idthe-history-interface:unload-a-document>unload a document/a> algorithm is currently running, abort these steps.li> p>a href#queue-a-task idthe-history-interface:queue-a-task>Queue a task/a> that consists of running the following substeps. The relevant a href#event-loop idthe-history-interface:event-loop-4>event loop/a> is that of the var>specified browsing context/var>s a href#active-document idthe-history-interface:active-document-2>active document/a>. The a href#task-source idthe-history-interface:task-source>task source/a> for the queued task is the a href#history-traversal-task-source idthe-history-interface:history-traversal-task-source>history traversal task source/a>./p> ol>li>p>If there is an ongoing attempt to navigate var>specified browsing context/var> that has not yet a href#concept-navigate-mature idthe-history-interface:concept-navigate-mature>matured/a> (i.e. it has not passed the point of making its code idthe-history-interface:document-10>a href#document>Document/a>/code> the a href#active-document idthe-history-interface:active-document-3>active document/a>), then cancel that attempt to navigate the a href#browsing-context idthe-history-interface:browsing-context-4>browsing context/a>.li> p>If the var>specified browsing context/var>s a href#active-document idthe-history-interface:active-document-4>active document/a> is not the same code idthe-history-interface:document-11>a href#document>Document/a>/code> as the code idthe-history-interface:document-12>a href#document>Document/a>/code> of the var>specified entry/var>, then run these substeps:/p> ol>li>p>a href#prompt-to-unload-a-document idthe-history-interface:prompt-to-unload-a-document>Prompt to unload/a> the a href#active-document idthe-history-interface:active-document-5>active document/a> of the var>specified browsing context/var>. If the user a href#refused-to-allow-the-document-to-be-unloaded idthe-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 idthe-history-interface:unload-a-document-2>Unload/a> the a href#active-document idthe-history-interface:active-document-6>active document/a> of the var>specified browsing context/var> with the var>recycle/var> parameter set to false./ol> li>p>a href#traverse-the-history idthe-history-interface:traverse-the-history-2>Traverse the history/a> of the var>specified browsing context/var> to the var>specified entry/var>./p> /ol> /ol> p>When the user navigates through a a href#browsing-context idthe-history-interface:browsing-context-5>browsing context/a>, e.g. using a browsers back and forward buttons, the user agent must a href#traverse-the-history-by-a-delta idthe-history-interface:traverse-the-history-by-a-delta-4>traverse the history by a delta/a> equivalent to the action specified by the user./p> hr idhistory-1> p>The dfn iddom-history-pushstate>code>pushState(var>data/var>, var>title/var>, var>url/var>)/code>/dfn> method adds a state object entry to the history.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> historyspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>5+/span>/span>span classios_saf yes>span>iOS Safari/span> span>5.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>4+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>6+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>4.2+/span>/span>span classopera yes>span>Opera/span> span>11.5+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#feathistory>caniuse.com/a>/div> p>The dfn iddom-history-replacestate>code>replaceState(var>data/var>, var>title/var>, var>url/var>)/code>/dfn> method updates the state object, title, and optionally the a idthe-history-interface:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the a href#current-entry idthe-history-interface:current-entry-3>current entry/a> in the history./p> p>When either of these methods is invoked, the user agent must run the following steps:/p> ol>li>p>Let var>document/var> be the unique code idthe-history-interface:document-13>a href#document>Document/a>/code> object this code idthe-history-interface:history-3-12>a href#history-3>History/a>/code> object is associated with.li>p>If var>document/var> is not a href#fully-active idthe-history-interface:fully-active-9>fully active/a>, throw a a idthe-history-interface:securityerror-8 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-history-interface:domexception-8>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Optionally, abort these steps. (For example, the user agent might disallow calls to these methods that are invoked on a timer, or from event listeners that are not triggered in response to a clear user action, or that are invoked in rapid succession.)li>p>Let var>targetRealm/var> be this code idthe-history-interface:history-3-13>a href#history-3>History/a>/code> objects a href#concept-relevant-realm idthe-history-interface:concept-relevant-realm>relevant Realm/a>.li>p>Let var>serializedData/var> be a href#structuredserializeforstorage idthe-history-interface:structuredserializeforstorage>StructuredSerializeForStorage/a>(var>data/var>). Rethrow any exceptions.li> p>If the third argument is not null, run these substeps:/p> ol>li>a href#parse-a-url idthe-history-interface:parse-a-url>Parse/a> the value of the third argument, relative to the a href#relevant-settings-object idthe-history-interface:relevant-settings-object>relevant settings object/a> of this code idthe-history-interface:history-3-14>a href#history-3>History/a>/code> object.li>If that fails, throw a a idthe-history-interface:securityerror-9 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-history-interface:domexception-9>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Let var>new URL/var> be the a href#resulting-url-record idthe-history-interface:resulting-url-record>resulting URL record/a>.li>Compare var>new URL/var> to var>document/var>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url idthe-history-interface:the-documents-address data-x-internalthe-documents-address>URL/a>. If any component of these two a hrefhttps://url.spec.whatwg.org/#concept-url idthe-history-interface:url-record data-x-internalurl-record>URL records/a> differ other than the a hrefhttps://url.spec.whatwg.org/#concept-url-path idthe-history-interface:concept-url-path data-x-internalconcept-url-path>path/a>, a hrefhttps://url.spec.whatwg.org/#concept-url-query idthe-history-interface:concept-url-query data-x-internalconcept-url-query>query/a>, and a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idthe-history-interface:concept-url-fragment data-x-internalconcept-url-fragment>fragment/a> components, then throw a a idthe-history-interface:securityerror-10 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-history-interface:domexception-10>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>If the a hrefhttps://url.spec.whatwg.org/#concept-url-origin idthe-history-interface:concept-url-origin data-x-internalconcept-url-origin>origin/a> of var>new URL/var> is not a href#same-origin idthe-history-interface:same-origin>same origin/a> with the a href#concept-origin idthe-history-interface:concept-origin>origin/a> of var>document/var>, and either the a hrefhttps://url.spec.whatwg.org/#concept-url-path idthe-history-interface:concept-url-path-2 data-x-internalconcept-url-path>path/a> or a hrefhttps://url.spec.whatwg.org/#concept-url-query idthe-history-interface:concept-url-query-2 data-x-internalconcept-url-query>query/a> components of the two a hrefhttps://url.spec.whatwg.org/#concept-url idthe-history-interface:url-record-2 data-x-internalurl-record>URL records/a> compared in the previous step differ, throw a a idthe-history-interface:securityerror-11 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-history-interface:domexception-11>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps. (This prevents sandboxed content from spoofing other pages on the same origin.)/ol> li>p>If the third argument is null, then let var>new URL/var> be the a idthe-history-interface:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the a href#current-entry idthe-history-interface:current-entry-4>current entry/a>.li> p>If the method invoked was the code idthe-history-interface:dom-history-pushstate-3>a href#dom-history-pushstate>pushState()/a>/code> method:/p> ol>li> p>Remove all the entries in the a href#browsing-context idthe-history-interface:browsing-context-6>browsing context/a>s a href#session-history idthe-history-interface:session-history-9>session history/a> after the a href#current-entry idthe-history-interface:current-entry-5>current entry/a>. If the a href#current-entry idthe-history-interface:current-entry-6>current entry/a> is the last entry in the session history, then no entries are removed./p> p classnote>This a href#history-notes>doesnt necessarily have to affect/a> the user agents user interface./p> li>p>Remove any a href#concept-task idthe-history-interface:concept-task-5>tasks/a> queued by the a href#history-traversal-task-source idthe-history-interface:history-traversal-task-source-2>history traversal task source/a> that are associated with any code idthe-history-interface:document-14>a href#document>Document/a>/code> objects in the a href#top-level-browsing-context idthe-history-interface:top-level-browsing-context-11>top-level browsing context/a>s a href#document-family idthe-history-interface:document-family>document family/a>.li>p>If appropriate, update the a href#current-entry idthe-history-interface:current-entry-7>current entry/a> to reflect any state that the user agent wishes to persist. The entry is then said to be a href#an-entry-with-persisted-user-state idthe-history-interface:an-entry-with-persisted-user-state>an entry with persisted user state/a>.li>p>Add a a href#session-history-entry idthe-history-interface:session-history-entry>session history entry/a> entry to the session history, after the a href#current-entry idthe-history-interface:current-entry-8>current entry/a>, with var>serializedData/var> as the a href#serialized-state idthe-history-interface:serialized-state-2>serialized state/a>, the given var>title/var> as the title, var>new URL/var> as the a idthe-history-interface:url-3 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the entry, and the a href#scroll-restoration-mode idthe-history-interface:scroll-restoration-mode-5>scroll restoration mode/a> of the current entry in the a href#session-history idthe-history-interface:session-history-10>session history/a> as the scroll restoration mode.li>p>Update the a href#current-entry idthe-history-interface:current-entry-9>current entry/a> to be this newly added entry./ol> p>Otherwise, if the method invoked was the code idthe-history-interface:dom-history-replacestate-3>a href#dom-history-replacestate>replaceState()/a>/code> method:/p> ol>li>p>Update the a href#current-entry idthe-history-interface:current-entry-10>current entry/a> in the session history so that var>serializedData/var> is the entrys new a href#serialized-state idthe-history-interface:serialized-state-3>serialized state/a>, the given var>title/var> is the new title, and var>new URL/var> is the entrys new a idthe-history-interface:url-4 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>./ol> li>p>If the a href#current-entry idthe-history-interface:current-entry-11>current entry/a> in the session history represents a non-GET request (e.g. it was the result of a POST submission) then update it to instead represent a GET request.li> p>Set var>document/var>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url idthe-history-interface:the-documents-address-2 data-x-internalthe-documents-address>URL/a> to var>new URL/var>./p> p classnote>Since this is neither a a href#navigate idthe-history-interface:navigate>navigation/a> of the a href#browsing-context idthe-history-interface:browsing-context-7>browsing context/a> nor a a href#traverse-the-history idthe-history-interface:traverse-the-history-3>history traversal/a>, it does not cause a code idthe-history-interface:event-hashchange>a href#event-hashchange>hashchange/a>/code> event to be fired./p> li>p>Let var>state/var> be a href#structureddeserialize idthe-history-interface:structureddeserialize>StructuredDeserialize/a>(var>serializedData/var>, var>targetRealm/var>). If this throws an exception, catch it, ignore the exception, and set var>state/var> to null.li>p>Set code idthe-history-interface:dom-history-state-3>a href#dom-history-state>history.state/a>/code> to var>state/var>.li>p>Set the a href#current-entry idthe-history-interface:current-entry-12>current entry/a>s code idthe-history-interface:document-15>a href#document>Document/a>/code> objects a href#latest-entry idthe-history-interface:latest-entry>latest entry/a> to the a href#current-entry idthe-history-interface:current-entry-13>current entry/a>./ol> p classnote>The var>title/var> is purely advisory. User agents might use the title in the user interface./p> p>User agents may limit the number of state objects added to the session history per page. If a page hits the UA-defined limit, user agents must remove the entry immediately after the first entry for that code idthe-history-interface:document-16>a href#document>Document/a>/code> object in the session history after having added the new entry. (Thus the state history acts as a FIFO buffer for eviction, but as a LIFO buffer for navigation.)/p> div classexample> p>Consider a game where the user can navigate along a line, such that the user is always at some coordinate, and such that the user can bookmark the page corresponding to a particular coordinate, to return to it later./p> p>A static page implementing the x5 position in such a game could look like the following:/p> pre><!DOCTYPE HTML><!-- this is https://example.com/line?x5 --><html langen><title>Line Game - 5</title><p>You are at coordinate 5 on the line.</p><p> <a href?x6>Advance to 6</a> or <a href?x4>retreat to 4</a>?</p>/pre> p>The problem with such a system is that each time the user clicks, the whole page has to be reloaded. Here instead is another way of doing it, using script:/p> pre><!DOCTYPE HTML><!-- this starts off as https://example.com/line?x5 --><html langen><title>Line Game - 5</title><p>You are at coordinate <span idcoord>5</span> on the line.</p><p> <a href?x6 onclickgo(1); return false;>Advance to 6</a> or <a href?x4 onclickgo(-1); return false;>retreat to 4</a>?</p><script> var currentPage 5; // prefilled by server function go(d) { setupPage(currentPage + d); history.pushState(currentPage, document.title, ?x + currentPage); } onpopstate function(event) { setupPage(event.state); } function setupPage(page) { currentPage page; document.title Line Game - + currentPage; document.getElementById(coord).textContent currentPage; document.links0.href ?x + (currentPage+1); document.links0.textContent Advance to + (currentPage+1); document.links1.href ?x + (currentPage-1); document.links1.textContent retreat to + (currentPage-1); }</script>/pre> p>In systems without script, this still works like the previous example. However, users that em>do/em> have script support can now navigate much faster, since there is no network access for the same experience. Furthermore, contrary to the experience the user would have with just a naïve script-based approach, bookmarking and navigating the session history still work./p> p>In the example above, the var>data/var> argument to the code idthe-history-interface:dom-history-pushstate-4>a href#dom-history-pushstate>pushState()/a>/code> method is the same information as would be sent to the server, but in a more convenient form, so that the script doesnt have to parse the URL each time the user navigates./p> /div> div classexample> p>Applications might not use the same title for a a href#session-history-entry idthe-history-interface:session-history-entry-2>session history entry/a> as the value of the documents code idthe-history-interface:the-title-element>a href#the-title-element>title/a>/code> element at that time. For example, here is a simple page that shows a block in the code idthe-history-interface:the-title-element-2>a href#the-title-element>title/a>/code> element. Clearly, when navigating backwards to a previous state the user does not go back in time, and therefore it would be inappropriate to put the time in the session history title./p> pre><!DOCTYPE HTML><HTML LANGEN><TITLE>Line</TITLE><SCRIPT> setInterval(function () { document.title Line - + new Date(); }, 1000); var i 1; function inc() { set(i+1); history.pushState(i, Line - + i); } function set(newI) { i newI; document.forms.F.I.value newI; }</SCRIPT><BODY ONPOPSTATEset(event.state)><FORM NAMEF>State: <OUTPUT NAMEI>1</OUTPUT> <INPUT VALUEIncrement TYPEBUTTON ONCLICKinc()></FORM>/pre> /div> div classexample> p>Most applications want to use the same a href#scroll-restoration-mode idthe-history-interface:scroll-restoration-mode-6>scroll restoration mode/a> value for all of their history entries. To achieve this they can set the code idthe-history-interface:dom-history-scroll-restoration-3>a href#dom-history-scroll-restoration>scrollRestoration/a>/code> attribute as soon as possible (e.g., in the first code idthe-history-interface:the-script-element>a href#the-script-element>script/a>/code> element in the documents code idthe-history-interface:the-head-element>a href#the-head-element>head/a>/code> element) to ensure that any entry added to the history session gets the desired scroll restoration mode./p> pre><head> <script> if (scrollRestoration in history) history.scrollRestoration manual; </script></head> /pre> /div> h4 idhistory-notes>span classsecno>7.7.3/span> Implementation notes for session historya href#history-notes classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>The code idhistory-notes:history-3>a href#history-3>History/a>/code> interface is not meant to place restrictions on how implementations represent the session history to the user./p> p>For example, session history could be implemented in a tree-like manner, with each page having multiple forward pages. This specification doesnt define how the linear list of pages in the code idhistory-notes:dom-history>a href#dom-history>history/a>/code> object are derived from the actual session history as seen from the users perspective./p> p>Similarly, a page containing two code idhistory-notes:the-iframe-element>a href#the-iframe-element>iframe/a>/code>s has a code idhistory-notes:dom-history-2>a href#dom-history>history/a>/code> object distinct from the code idhistory-notes:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code>s code idhistory-notes:dom-history-3>a href#dom-history>history/a>/code> objects, despite the fact that typical Web browsers present the user with just one Back button, with a session history that interleaves the navigation of the two inner frames and the outer page./p> p>strong>Security/strong>: It is suggested that to avoid letting a page hijack the history navigation facilities of a UA by abusing code idhistory-notes:dom-history-pushstate>a href#dom-history-pushstate>pushState()/a>/code>, the UA provide the user with a way to jump back to the previous page (rather than just going back to the previous state). For example, the back button could have a drop down showing just the pages in the session history, and not showing any of the states. Similarly, an aural browser could have two back commands, one that goes back to the previous state, and one that jumps straight back to the previous page./p> p>For both code idhistory-notes:dom-history-pushstate-2>a href#dom-history-pushstate>pushState()/a>/code> and code idhistory-notes:dom-history-replacestate>a href#dom-history-replacestate>replaceState()/a>/code>, user agents are encouraged to prevent abuse of these APIs via too-frequent calls or over-large state objects. As detailed above, the algorithm explicitly allows user agents to ignore any such calls when appropriate./p> h4 idthe-location-interface>span classsecno>7.7.4/span> The code idthe-location-interface:location>a href#location>Location/a>/code> interfacea href#the-location-interface classself-link>/a>/h4> p>Each code idthe-location-interface:window>a href#window>Window/a>/code> object is associated with a unique instance of a code idthe-location-interface:location-2>a href#location>Location/a>/code> object, allocated when the code idthe-location-interface:window-2>a href#window>Window/a>/code> object is created./p> p classwarning>The code idthe-location-interface:location-3>a href#location>Location/a>/code> exotic object is defined through a mishmash of IDL, invocation of JavaScript internal methods post-creation, and overridden JavaScript internal methods. Coupled with its scary security policy, please take extra care while implementing this excrescence./p> p>To create a code idthe-location-interface:location-4>a href#location>Location/a>/code> object, run these steps:/p> ol>li>p>Let var>location/var> be a new code idthe-location-interface:location-5>a href#location>Location/a>/code> a idthe-location-interface:platform-object hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a>.li>p>Perform ! var>location/var>.DefineOwnProperty(code>valueOf/code>, { Value: a idthe-location-interface:objproto_valueof hrefhttps://tc39.github.io/ecma262/#sec-object.prototype.valueof data-x-internalobjproto_valueof>%ObjProto_valueOf%/a>, Writable: false, Enumerable: false, Configurable: false }).li>p>Perform ! var>location/var>.DefineOwnProperty(a href#@@toprimitive idthe-location-interface:@@toprimitive>@@toPrimitive/a>, { Value: undefined, Writable: false, Enumerable: false, Configurable: false }).li>p>Set the value of the a href#defaultproperties idthe-location-interface:defaultproperties>DefaultProperties/a> internal slot of var>location/var> to var>location/var>.OwnPropertyKeys().li>p>Return var>location/var>./ol> p classnote>The addition of code>valueOf/code> and a href#@@toprimitive idthe-location-interface:@@toprimitive-2>@@toPrimitive/a> own data properties, as well as the fact that all of code idthe-location-interface:location-6>a href#location>Location/a>/code>s IDL attributes are marked code>Unforgeable/code>, is required by legacy code that consulted the code idthe-location-interface:location-7>a href#location>Location/a>/code> interface, or stringified it, to determine the a hrefhttps://dom.spec.whatwg.org/#concept-document-url idthe-location-interface:the-documents-address data-x-internalthe-documents-address>document URL/a>, and then used it in a security-sensitive way. In particular, the code>valueOf/code>, a href#@@toprimitive idthe-location-interface:@@toprimitive-3>@@toPrimitive/a>, and code>Unforgeable/code> stringifier mitigations ensure that code such as code>foolocation bar/code> or code>location + /code> cannot be misdirected./p> dl classdomintro>dt>var>document/var> . code idthe-location-interface:dom-document-location>a href#dom-document-location>location/a>/code> var>value/var> dt>var>window/var> . code idthe-location-interface:dom-location>a href#dom-location>location/a>/code> var>value/var> dd> p>Returns a code idthe-location-interface:location-8>a href#location>Location/a>/code> object with the current pages location./p> p>Can be set, to navigate to another page./p> /dl> p>The code idthe-location-interface:document>a href#document>Document/a>/code> objects dfn iddom-document-location>code>location/code>/dfn> attributes getter must return this code idthe-location-interface:document-2>a href#document>Document/a>/code> objects a href#concept-relevant-global idthe-location-interface:concept-relevant-global>relevant global object/a>s code idthe-location-interface:location-9>a href#location>Location/a>/code> object, if this code idthe-location-interface:document-3>a href#document>Document/a>/code> object is a href#fully-active idthe-location-interface:fully-active>fully active/a>, and null otherwise./p> p>The code idthe-location-interface:window-3>a href#window>Window/a>/code> objects dfn iddom-location>code>location/code>/dfn> attributes getter must return this code idthe-location-interface:window-4>a href#window>Window/a>/code> objects code idthe-location-interface:location-10>a href#location>Location/a>/code> object./p> p>code idthe-location-interface:location-11>a href#location>Location/a>/code> objects provide a representation of the a hrefhttps://dom.spec.whatwg.org/#concept-document-url idthe-location-interface:the-documents-address-2 data-x-internalthe-documents-address>URL/a> of the a href#active-document idthe-location-interface:active-document>active document/a> of their code idthe-location-interface:document-4>a href#document>Document/a>/code>s a href#concept-document-bc idthe-location-interface:concept-document-bc>browsing context/a>, and allow the a href#current-entry idthe-location-interface:current-entry>current entry/a> of the a href#browsing-context idthe-location-interface:browsing-context>browsing context/a>s session history to be changed, by adding or replacing entries in the code idthe-location-interface:dom-history>a href#dom-history>history/a>/code> object./p> pre classidl>ExposedWindowinterface dfn idlocation>Location/dfn> { // but see also a href#the-location-interface>additional creation steps/a> and a href#location-internal-methods>overridden internal methods/a> Unforgeable stringifier attribute USVString a href#dom-location-href idthe-location-interface:dom-location-href>href/a>; Unforgeable readonly attribute USVString a href#dom-location-origin idthe-location-interface:dom-location-origin>origin/a>; Unforgeable attribute USVString a href#dom-location-protocol idthe-location-interface:dom-location-protocol>protocol/a>; Unforgeable attribute USVString a href#dom-location-host idthe-location-interface:dom-location-host>host/a>; Unforgeable attribute USVString a href#dom-location-hostname idthe-location-interface:dom-location-hostname>hostname/a>; Unforgeable attribute USVString a href#dom-location-port idthe-location-interface:dom-location-port>port/a>; Unforgeable attribute USVString a href#dom-location-pathname idthe-location-interface:dom-location-pathname>pathname/a>; Unforgeable attribute USVString a href#dom-location-search idthe-location-interface:dom-location-search>search/a>; Unforgeable attribute USVString a href#dom-location-hash idthe-location-interface:dom-location-hash>hash/a>; Unforgeable void a href#dom-location-assign idthe-location-interface:dom-location-assign>assign/a>(USVString url); Unforgeable void a href#dom-location-replace idthe-location-interface:dom-location-replace>replace/a>(USVString url); Unforgeable void a href#dom-location-reload idthe-location-interface:dom-location-reload>reload/a>(); Unforgeable, SameObject readonly attribute a href#domstringlist idthe-location-interface:domstringlist>DOMStringList/a> a href#dom-location-ancestororigins idthe-location-interface:dom-location-ancestororigins>ancestorOrigins/a>;};/pre> dl classdomintro>dt>var>location/var> . code>toString()/code>dt>var>location/var> . code idthe-location-interface:dom-location-href-2>a href#dom-location-href>href/a>/code>dd> p>Returns the code idthe-location-interface:location-12>a href#location>Location/a>/code> objects URL./p> p>Can be set, to navigate to the given URL./p> dt>var>location/var> . code idthe-location-interface:dom-location-origin-2>a href#dom-location-origin>origin/a>/code>dd> p>Returns the code idthe-location-interface:location-13>a href#location>Location/a>/code> objects URLs origin./p> dt>var>location/var> . code idthe-location-interface:dom-location-protocol-2>a href#dom-location-protocol>protocol/a>/code>dd> p>Returns the code idthe-location-interface:location-14>a href#location>Location/a>/code> objects URLs scheme./p> p>Can be set, to navigate to the same URL with a changed scheme./p> dt>var>location/var> . code idthe-location-interface:dom-location-host-2>a href#dom-location-host>host/a>/code>dd> p>Returns the code idthe-location-interface:location-15>a href#location>Location/a>/code> objects URLs host and port (if different from the default port for the scheme)./p> p>Can be set, to navigate to the same URL with a changed host and port./p> dt>var>location/var> . code idthe-location-interface:dom-location-hostname-2>a href#dom-location-hostname>hostname/a>/code>dd> p>Returns the code idthe-location-interface:location-16>a href#location>Location/a>/code> objects URLs host./p> p>Can be set, to navigate to the same URL with a changed host./p> dt>var>location/var> . code idthe-location-interface:dom-location-port-2>a href#dom-location-port>port/a>/code>dd> p>Returns the code idthe-location-interface:location-17>a href#location>Location/a>/code> objects URLs port./p> p>Can be set, to navigate to the same URL with a changed port./p> dt>var>location/var> . code idthe-location-interface:dom-location-pathname-2>a href#dom-location-pathname>pathname/a>/code>dd> p>Returns the code idthe-location-interface:location-18>a href#location>Location/a>/code> objects URLs path./p> p>Can be set, to navigate to the same URL with a changed path./p> dt>var>location/var> . code idthe-location-interface:dom-location-search-2>a href#dom-location-search>search/a>/code>dd> p>Returns the code idthe-location-interface:location-19>a href#location>Location/a>/code> objects URLs query (includes leading code>?/code> if non-empty)./p> p>Can be set, to navigate to the same URL with a changed query (ignores leading code>?/code>)./p> dt>var>location/var> . code idthe-location-interface:dom-location-hash-2>a href#dom-location-hash>hash/a>/code>dd> p>Returns the code idthe-location-interface:location-20>a href#location>Location/a>/code> objects URLs fragment (includes leading code>#/code> if non-empty)./p> p>Can be set, to navigate to the same URL with a changed fragment (ignores leading code>#/code>)./p> dt>var>location/var> . code idthe-location-interface:dom-location-assign-2>a href#dom-location-assign>assign/a>/code>(var>url/var>)dd> p>Navigates to the given URL./p> dt>var>location/var> . code idthe-location-interface:dom-location-replace-2>a href#dom-location-replace>replace/a>/code>(var>url/var>)dd> p>Removes the current page from the session history and navigates to the given URL./p> dt>var>location/var> . code idthe-location-interface:dom-location-reload-2>a href#dom-location-reload>reload/a>/code>()dd> p>Reloads the current page./p> dt>var>location/var> . code idthe-location-interface:dom-location-ancestororigins-2>a href#dom-location-ancestororigins>ancestorOrigins/a>/code>dd> p>Returns a code idthe-location-interface:domstringlist-2>a href#domstringlist>DOMStringList/a>/code> object listing the origins of the ancestor a href#browsing-context idthe-location-interface:browsing-context-2>browsing contexts/a>, from the a href#parent-browsing-context idthe-location-interface:parent-browsing-context>parent browsing context/a> to the a href#top-level-browsing-context idthe-location-interface:top-level-browsing-context>top-level browsing context/a>./p> /dl> p>A code idthe-location-interface:location-21>a href#location>Location/a>/code> object has an associated dfn idrelevant-document>relevant code>Document/code>/dfn>, which is this code idthe-location-interface:location-22>a href#location>Location/a>/code> objects associated code idthe-location-interface:document-5>a href#document>Document/a>/code> objects a href#concept-document-bc idthe-location-interface:concept-document-bc-2>browsing context/a>s a href#active-document idthe-location-interface:active-document-2>active document/a>./p> p>A code idthe-location-interface:location-23>a href#location>Location/a>/code> object has an associated dfn idconcept-location-url>url/dfn>, which is this code idthe-location-interface:location-24>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document>relevant code>Document/code>/a>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url idthe-location-interface:the-documents-address-3 data-x-internalthe-documents-address>URL/a>./p> p>A code idthe-location-interface:location-25>a href#location>Location/a>/code> object has an associated dfn idconcept-location-ancestor-origins-list>ancestor origins list/dfn>. When a code idthe-location-interface:location-26>a href#location>Location/a>/code> object is created, its a href#concept-location-ancestor-origins-list idthe-location-interface:concept-location-ancestor-origins-list>ancestor origins list/a> must be set to a code idthe-location-interface:domstringlist-3>a href#domstringlist>DOMStringList/a>/code> object whose associated list is the a idthe-location-interface:list hrefhttps://infra.spec.whatwg.org/#list data-x-internallist>list/a> of strings that the following steps would produce:/p> ol>li>p>Let var>output/var> be a new a idthe-location-interface:list-2 hrefhttps://infra.spec.whatwg.org/#list data-x-internallist>list/a> of strings.li>p>Let var>current/var> be the a href#concept-document-bc idthe-location-interface:concept-document-bc-3>browsing context/a> of the code idthe-location-interface:document-6>a href#document>Document/a>/code> with which this code idthe-location-interface:location-27>a href#location>Location/a>/code> object is associated.li>p>i>Loop/i>: If var>current/var> has no a href#parent-browsing-context idthe-location-interface:parent-browsing-context-2>parent browsing context/a>, jump to the step labeled i>end/i>.li>p>Let var>current/var> be var>current/var>s a href#parent-browsing-context idthe-location-interface:parent-browsing-context-3>parent browsing context/a>.li>p>a hrefhttps://infra.spec.whatwg.org/#list-append idthe-location-interface:list-append data-x-internallist-append>Append/a> the a href#ascii-serialisation-of-an-origin idthe-location-interface:ascii-serialisation-of-an-origin>serialization/a> of var>current/var>s a href#active-document idthe-location-interface:active-document-3>active document/a>s a href#concept-origin idthe-location-interface:concept-origin>origin/a> to var>output/var>.li>p>Return to the step labeled i>loop/i>.li>p>i>End/i>: Return var>output/var>./ol> p>A code idthe-location-interface:location-28>a href#location>Location/a>/code> object has an associated dfn idlocation-object-setter-navigate>code>Location/code>-object-setter navigate/dfn> algorithm, which given a var>url/var>, runs these steps:/p> ol>li> p>If any of the following conditions are met, let var>replacement flag/var> be unset; otherwise, let it be set:/p> ul classbrief>li>This code idthe-location-interface:location-29>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-2>relevant code>Document/code>/a> has a href#completely-loaded idthe-location-interface:completely-loaded>completely loaded/a>, orli>In the a href#concept-task idthe-location-interface:concept-task>task/a> in which the algorithm is running, an a idthe-location-interface:activation-behaviour hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a> is currently being processed whose code idthe-location-interface:event-click>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> events code idthe-location-interface:dom-event-istrusted>a data-x-internaldom-event-istrusted hrefhttps://dom.spec.whatwg.org/#dom-event-istrusted>isTrusted/a>/code> attribute is true, orli>In the a href#concept-task idthe-location-interface:concept-task-2>task/a> in which the algorithm is running, the event listener for a code idthe-location-interface:event-click-2>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> event, whose code idthe-location-interface:dom-event-istrusted-2>a data-x-internaldom-event-istrusted hrefhttps://dom.spec.whatwg.org/#dom-event-istrusted>isTrusted/a>/code> attribute is true, is being handled./ul> li>p>a href#location-object-navigate idthe-location-interface:location-object-navigate>code>Location/code>-object navigate/a>, given var>url/var> and var>replacement flag/var>./ol> p>To dfn idlocation-object-navigate>code>Location/code>-object navigate/dfn>, given a var>url/var> and var>replacement flag/var>, run these steps:/p> ol>li>p>The a href#source-browsing-context idthe-location-interface:source-browsing-context>source browsing context/a> is the a href#responsible-browsing-context idthe-location-interface:responsible-browsing-context>responsible browsing context/a> specified by the a href#incumbent-settings-object idthe-location-interface:incumbent-settings-object>incumbent settings object/a>.li> p>a href#navigate idthe-location-interface:navigate>Navigate/a> the a href#browsing-context idthe-location-interface:browsing-context-3>browsing context/a> to var>url/var>, with the var>a href#exceptions-enabled idthe-location-interface:exceptions-enabled>exceptions enabled flag/a>/var> set. Rethrow any exceptions./p> p>If the var>replacement flag/var> is set or the a href#browsing-context idthe-location-interface:browsing-context-4>browsing context/a>s a href#session-history idthe-location-interface:session-history>session history/a> contains only one code idthe-location-interface:document-7>a href#document>Document/a>/code>, and that was the code idthe-location-interface:about:blank>a href#about:blank>about:blank/a>/code> code idthe-location-interface:document-8>a href#document>Document/a>/code> created when the a href#browsing-context idthe-location-interface:browsing-context-5>browsing context/a> was created, then the navigation must be done with a href#replacement-enabled idthe-location-interface:replacement-enabled>replacement enabled/a>./p> /ol> p>The dfn iddom-location-href>code>href/code>/dfn> attributes getter must run these steps:/p> ol>li>p>If this code idthe-location-interface:location-30>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-3>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-2>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin>origin/a>, then throw a a idthe-location-interface:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Return this code idthe-location-interface:location-31>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url>url/a>, a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idthe-location-interface:concept-url-serializer data-x-internalconcept-url-serializer>serialized/a>./ol> p>The code idthe-location-interface:dom-location-href-3>a href#dom-location-href>href/a>/code> attributes setter must run these steps:/p> ol>li>p>a href#parse-a-url idthe-location-interface:parse-a-url>Parse/a> the given value relative to the a href#entry-settings-object idthe-location-interface:entry-settings-object-2>entry settings object/a>. If that failed, throw a code idthe-location-interface:typeerror>a data-x-internaltypeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror>TypeError/a>/code> exception.li>p>a href#location-object-setter-navigate idthe-location-interface:location-object-setter-navigate>code>Location/code>-object-setter navigate/a> to the a href#resulting-url-record idthe-location-interface:resulting-url-record>resulting URL record/a>./ol> p classnote>The code idthe-location-interface:dom-location-href-4>a href#dom-location-href>href/a>/code> attribute setter intentionally has no security check./p> p>The dfn iddom-location-origin>code>origin/code>/dfn> attributes getter must run these steps:/p> ol>li>p>If this code idthe-location-interface:location-32>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-4>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-3>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain-2>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object-3>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin-2>origin/a>, then throw a a idthe-location-interface:securityerror-2 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Return the a href#ascii-serialisation-of-an-origin idthe-location-interface:ascii-serialisation-of-an-origin-2>serialization/a> of this code idthe-location-interface:location-33>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-2>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-origin idthe-location-interface:concept-url-origin data-x-internalconcept-url-origin>origin/a>./ol> p>The dfn iddom-location-protocol>code>protocol/code>/dfn> attributes getter must run these steps:/p> ol>li>p>If this code idthe-location-interface:location-34>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-5>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-4>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain-3>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object-4>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin-3>origin/a>, then throw a a idthe-location-interface:securityerror-3 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Return this code idthe-location-interface:location-35>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-3>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idthe-location-interface:concept-url-scheme data-x-internalconcept-url-scheme>scheme/a>, followed by code>:/code>./ol> p>The code idthe-location-interface:dom-location-protocol-3>a href#dom-location-protocol>protocol/a>/code> attributes setter must run these steps:/p> ol>li>p>If this code idthe-location-interface:location-36>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-6>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-5>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain-4>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object-5>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin-4>origin/a>, then throw a a idthe-location-interface:securityerror-4 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Let var>copyURL/var> be a copy of this code idthe-location-interface:location-37>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-4>url/a>.li> p>Let var>possibleFailure/var> be the result of a hrefhttps://url.spec.whatwg.org/#concept-basic-url-parser idthe-location-interface:basic-url-parser data-x-internalbasic-url-parser>basic URL parsing/a> the given value, followed by code>:/code>, with var>copyURL/var> as var>url/var> and a idthe-location-interface:scheme-start-state hrefhttps://url.spec.whatwg.org/#scheme-start-state data-x-internalscheme-start-state>scheme start state/a> as var>state override/var>./p> p classnote>Because the URL parser ignores multiple consecutive colons, providing a value of code>https:/code> (or even code>https::::/code>) is the same as providing a value of code>https/code>./p> li>p>If var>possibleFailure/var> is failure, then throw a a idthe-location-interface:syntaxerror hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idthe-location-interface:domexception-5>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If var>copyURL/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idthe-location-interface:concept-url-scheme-2 data-x-internalconcept-url-scheme>scheme/a> is not an a idthe-location-interface:http(s)-scheme hrefhttps://fetch.spec.whatwg.org/#http-scheme data-x-internalhttp(s)-scheme>HTTP(S) scheme/a>, then terminate these steps.li>p>a href#location-object-setter-navigate idthe-location-interface:location-object-setter-navigate-2>code>Location/code>-object-setter navigate/a> to var>copyURL/var>./ol> p>The dfn iddom-location-host>code>host/code>/dfn> attributes getter must run these steps:/p> ol>li>p>If this code idthe-location-interface:location-38>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-7>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-6>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain-5>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object-6>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin-5>origin/a>, then throw a a idthe-location-interface:securityerror-5 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception-6>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Let var>url/var> be this code idthe-location-interface:location-39>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-5>url/a>.li>p>If var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-host idthe-location-interface:concept-url-host data-x-internalconcept-url-host>host/a> is null, return the empty string.li>p>If var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-port idthe-location-interface:concept-url-port data-x-internalconcept-url-port>port/a> is null, return var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-host idthe-location-interface:concept-url-host-2 data-x-internalconcept-url-host>host/a>, a hrefhttps://url.spec.whatwg.org/#concept-host-serializer idthe-location-interface:host-serializer data-x-internalhost-serializer>serialized/a>.li>p>Return var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-host idthe-location-interface:concept-url-host-3 data-x-internalconcept-url-host>host/a>, a hrefhttps://url.spec.whatwg.org/#concept-host-serializer idthe-location-interface:host-serializer-2 data-x-internalhost-serializer>serialized/a>, followed by code>:/code> and var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-port idthe-location-interface:concept-url-port-2 data-x-internalconcept-url-port>port/a>, a hrefhttps://url.spec.whatwg.org/#serialize-an-integer idthe-location-interface:serialize-an-integer data-x-internalserialize-an-integer>serialized/a>./ol> p>The code idthe-location-interface:dom-location-host-3>a href#dom-location-host>host/a>/code> attributes setter must run these steps:/p> ol>li>p>If this code idthe-location-interface:location-40>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-8>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-7>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain-6>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object-7>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin-6>origin/a>, then throw a a idthe-location-interface:securityerror-6 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception-7>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Let var>copyURL/var> be a copy of this code idthe-location-interface:location-41>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-6>url/a>.li>p>If var>copyURL/var>s a idthe-location-interface:cannot-be-a-base-url-flag hrefhttps://url.spec.whatwg.org/#url-cannot-be-a-base-url-flag data-x-internalcannot-be-a-base-url-flag>cannot-be-a-base-URL flag/a> is set, terminate these steps.li>p>a hrefhttps://url.spec.whatwg.org/#concept-basic-url-parser idthe-location-interface:basic-url-parser-2 data-x-internalbasic-url-parser>Basic URL parse/a> the given value, with var>copyURL/var> as var>url/var> and a idthe-location-interface:host-state hrefhttps://url.spec.whatwg.org/#host-state data-x-internalhost-state>host state/a> as var>state override/var>.li>p>a href#location-object-setter-navigate idthe-location-interface:location-object-setter-navigate-3>code>Location/code>-object-setter navigate/a> to var>copyURL/var>./ol> p>The dfn iddom-location-hostname>code>hostname/code>/dfn> attributes getter must run these steps:/p> ol>li>p>If this code idthe-location-interface:location-42>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-9>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-8>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain-7>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object-8>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin-7>origin/a>, then throw a a idthe-location-interface:securityerror-7 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception-8>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If this code idthe-location-interface:location-43>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-7>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-host idthe-location-interface:concept-url-host-4 data-x-internalconcept-url-host>host/a> is null, return the empty string.li>p>Return this code idthe-location-interface:location-44>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-8>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-host idthe-location-interface:concept-url-host-5 data-x-internalconcept-url-host>host/a>, a hrefhttps://url.spec.whatwg.org/#concept-host-serializer idthe-location-interface:host-serializer-3 data-x-internalhost-serializer>serialized/a>./ol> p>The code idthe-location-interface:dom-location-hostname-3>a href#dom-location-hostname>hostname/a>/code> attributes setter must run these steps:/p> ol>li>p>If this code idthe-location-interface:location-45>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-10>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-9>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain-8>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object-9>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin-8>origin/a>, then throw a a idthe-location-interface:securityerror-8 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception-9>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Let var>copyURL/var> be a copy of this code idthe-location-interface:location-46>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-9>url/a>.li>p>If var>copyURL/var>s a idthe-location-interface:cannot-be-a-base-url-flag-2 hrefhttps://url.spec.whatwg.org/#url-cannot-be-a-base-url-flag data-x-internalcannot-be-a-base-url-flag>cannot-be-a-base-URL flag/a> is set, terminate these steps.li>p>a hrefhttps://url.spec.whatwg.org/#concept-basic-url-parser idthe-location-interface:basic-url-parser-3 data-x-internalbasic-url-parser>Basic URL parse/a> the given value, with var>copyURL/var> as var>url/var> and a idthe-location-interface:hostname-state hrefhttps://url.spec.whatwg.org/#hostname-state data-x-internalhostname-state>hostname state/a> as var>state override/var>.li>p>a href#location-object-setter-navigate idthe-location-interface:location-object-setter-navigate-4>code>Location/code>-object-setter navigate/a> to var>copyURL/var>./ol> p>The dfn iddom-location-port>code>port/code>/dfn> attributes getter must run these steps:/p> ol>li>p>If this code idthe-location-interface:location-47>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-11>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-10>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain-9>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object-10>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin-9>origin/a>, then throw a a idthe-location-interface:securityerror-9 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception-10>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If this code idthe-location-interface:location-48>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-10>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-port idthe-location-interface:concept-url-port-3 data-x-internalconcept-url-port>port/a> is null, return the empty string.li>p>Return this code idthe-location-interface:location-49>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-11>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-port idthe-location-interface:concept-url-port-4 data-x-internalconcept-url-port>port/a>, a hrefhttps://url.spec.whatwg.org/#serialize-an-integer idthe-location-interface:serialize-an-integer-2 data-x-internalserialize-an-integer>serialized/a>./ol> p>The code idthe-location-interface:dom-location-port-3>a href#dom-location-port>port/a>/code> attributes setter must run these steps:/p> ol>li>p>If this code idthe-location-interface:location-50>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-12>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-11>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain-10>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object-11>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin-10>origin/a>, then throw a a idthe-location-interface:securityerror-10 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception-11>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Let var>copyURL/var> be a copy of this code idthe-location-interface:location-51>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-12>url/a>.li>p>If var>copyURL/var> a idthe-location-interface:cannot-have-a-username/password/port hrefhttps://url.spec.whatwg.org/#cannot-have-a-username-password-port data-x-internalcannot-have-a-username/password/port>cannot have a username/password/port/a>, then return.li>p>If the given value is the empty string, then set var>copyURL/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-port idthe-location-interface:concept-url-port-5 data-x-internalconcept-url-port>port/a> to null.li>p>Otherwise, a hrefhttps://url.spec.whatwg.org/#concept-basic-url-parser idthe-location-interface:basic-url-parser-4 data-x-internalbasic-url-parser>basic URL parse/a> the given value, with var>copyURL/var> as var>url/var> and a idthe-location-interface:port-state hrefhttps://url.spec.whatwg.org/#port-state data-x-internalport-state>port state/a> as var>state override/var>.li>p>a href#location-object-setter-navigate idthe-location-interface:location-object-setter-navigate-5>code>Location/code>-object-setter navigate/a> to var>copyURL/var>./ol> p>The dfn iddom-location-pathname>code>pathname/code>/dfn> attributes getter must run these steps:/p> ol>li>p>If this code idthe-location-interface:location-52>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-13>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-12>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain-11>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object-12>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin-11>origin/a>, then throw a a idthe-location-interface:securityerror-11 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception-12>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Let var>url/var> be this code idthe-location-interface:location-53>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-13>url/a>.li>p>If var>url/var>s a idthe-location-interface:cannot-be-a-base-url-flag-3 hrefhttps://url.spec.whatwg.org/#url-cannot-be-a-base-url-flag data-x-internalcannot-be-a-base-url-flag>cannot-be-a-base-URL flag/a> is set, return the first string in var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-path idthe-location-interface:concept-url-path data-x-internalconcept-url-path>path/a>.li>p>If var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-path idthe-location-interface:concept-url-path-2 data-x-internalconcept-url-path>path/a> is empty, then return the empty string.li>p>Return code>//code>, followed by the strings in var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-path idthe-location-interface:concept-url-path-3 data-x-internalconcept-url-path>path/a> (including empty strings), separated from each other by code>//code>./ol> p>The code idthe-location-interface:dom-location-pathname-3>a href#dom-location-pathname>pathname/a>/code> attributes setter must run these steps:/p> ol>li>p>If this code idthe-location-interface:location-54>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-14>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-13>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain-12>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object-13>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin-12>origin/a>, then throw a a idthe-location-interface:securityerror-12 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception-13>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Let var>copyURL/var> be a copy of this code idthe-location-interface:location-55>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-14>url/a>.li>p>If var>copyURL/var>s a idthe-location-interface:cannot-be-a-base-url-flag-4 hrefhttps://url.spec.whatwg.org/#url-cannot-be-a-base-url-flag data-x-internalcannot-be-a-base-url-flag>cannot-be-a-base-URL flag/a> is set, terminate these steps.li>p>Set var>copyURL/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-path idthe-location-interface:concept-url-path-4 data-x-internalconcept-url-path>path/a> to the empty list.li>p>a hrefhttps://url.spec.whatwg.org/#concept-basic-url-parser idthe-location-interface:basic-url-parser-5 data-x-internalbasic-url-parser>Basic URL parse/a> the given value, with var>copyURL/var> as var>url/var> and a idthe-location-interface:path-start-state hrefhttps://url.spec.whatwg.org/#path-start-state data-x-internalpath-start-state>path start state/a> as var>state override/var>.li>p>a href#location-object-setter-navigate idthe-location-interface:location-object-setter-navigate-6>code>Location/code>-object-setter navigate/a> to var>copyURL/var>./ol> p>The dfn iddom-location-search>code>search/code>/dfn> attributes getter must run these steps:/p> ol>li>p>If this code idthe-location-interface:location-56>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-15>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-14>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain-13>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object-14>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin-13>origin/a>, then throw a a idthe-location-interface:securityerror-13 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception-14>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If this code idthe-location-interface:location-57>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-15>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-query idthe-location-interface:concept-url-query data-x-internalconcept-url-query>query/a> is either null or the empty string, return the empty string.li>p>Return code>?/code>, followed by this code idthe-location-interface:location-58>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-16>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-query idthe-location-interface:concept-url-query-2 data-x-internalconcept-url-query>query/a>./ol> p>The code idthe-location-interface:dom-location-search-3>a href#dom-location-search>search/a>/code> attributes setter must run these steps:/p> ol>li>p>If this code idthe-location-interface:location-59>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-16>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-15>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain-14>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object-15>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin-14>origin/a>, then throw a a idthe-location-interface:securityerror-14 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception-15>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Let var>copyURL/var> be a copy of this code idthe-location-interface:location-60>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-17>url/a>.li>p>If the given value is the empty string, set var>copyURL/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-query idthe-location-interface:concept-url-query-3 data-x-internalconcept-url-query>query/a> to null. li> p>Otherwise, run these substeps:/p> ol>li>p>Let var>input/var> be the given value with a single leading code>?/code> removed, if any.li>p>Set var>copyURL/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-query idthe-location-interface:concept-url-query-4 data-x-internalconcept-url-query>query/a> to the empty string.li>p>a hrefhttps://url.spec.whatwg.org/#concept-basic-url-parser idthe-location-interface:basic-url-parser-6 data-x-internalbasic-url-parser>Basic URL parse/a> var>input/var>, with var>copyURL/var> as var>url/var> and a idthe-location-interface:query-state hrefhttps://url.spec.whatwg.org/#query-state data-x-internalquery-state>query state/a> as var>state override/var>, and the a href#relevant-document idthe-location-interface:relevant-document-17>relevant code>Document/code>/a>s a idthe-location-interface:documents-character-encoding hrefhttps://dom.spec.whatwg.org/#concept-document-encoding data-x-internaldocuments-character-encoding>documents character encoding/a> as var>encoding override/var>./ol> li>p>a href#location-object-setter-navigate idthe-location-interface:location-object-setter-navigate-7>code>Location/code>-object-setter navigate/a> to var>copyURL/var>./ol> p>The dfn iddom-location-hash>code>hash/code>/dfn> attributes getter must run these steps:/p> ol>li>p>If this code idthe-location-interface:location-61>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-18>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-16>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain-15>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object-16>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin-15>origin/a>, then throw a a idthe-location-interface:securityerror-15 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception-16>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If this code idthe-location-interface:location-62>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-18>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idthe-location-interface:concept-url-fragment data-x-internalconcept-url-fragment>fragment/a> is either null or the empty string, return the empty string.li>p>Return code>#/code>, followed by this code idthe-location-interface:location-63>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-19>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idthe-location-interface:concept-url-fragment-2 data-x-internalconcept-url-fragment>fragment/a>./ol> p>The code idthe-location-interface:dom-location-hash-3>a href#dom-location-hash>hash/a>/code> attributes setter must run these steps:/p> ol>li>p>If this code idthe-location-interface:location-64>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-19>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-17>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain-16>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object-17>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin-16>origin/a>, then throw a a idthe-location-interface:securityerror-16 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception-17>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Let var>copyURL/var> be a copy of this code idthe-location-interface:location-65>a href#location>Location/a>/code> objects a href#concept-location-url idthe-location-interface:concept-location-url-20>url/a>.li>p>Let var>input/var> be the given value with a single leading code>#/code> removed, if any.li>p>Set var>copyURL/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idthe-location-interface:concept-url-fragment-3 data-x-internalconcept-url-fragment>fragment/a> to the empty string.li>p>a hrefhttps://url.spec.whatwg.org/#concept-basic-url-parser idthe-location-interface:basic-url-parser-7 data-x-internalbasic-url-parser>Basic URL parse/a> var>input/var>, with var>copyURL/var> as var>url/var> and a idthe-location-interface:fragment-state hrefhttps://url.spec.whatwg.org/#fragment-state data-x-internalfragment-state>fragment state/a> as var>state override/var>.li>p>a href#location-object-setter-navigate idthe-location-interface:location-object-setter-navigate-8>code>Location/code>-object-setter navigate/a> to var>copyURL/var>./ol> p classnote>Unlike the equivalent API for the code idthe-location-interface:the-a-element>a href#the-a-element>a/a>/code> and code idthe-location-interface:the-area-element>a href#the-area-element>area/a>/code> elements, the code idthe-location-interface:dom-location-hash-4>a href#dom-location-hash>hash/a>/code> attributes setter does not special case the empty string to remain compatible with deployed scripts./p> hr> p>When the dfn iddom-location-assign>code>assign(var>url/var>)/code>/dfn> method is invoked, the user agent must run the following steps: ol>li>p>If this code idthe-location-interface:location-66>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-20>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-18>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain-17>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object-18>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin-17>origin/a>, then throw a a idthe-location-interface:securityerror-17 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception-18>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>a href#parse-a-url idthe-location-interface:parse-a-url-2>Parse/a> var>url/var> relative to the a href#entry-settings-object idthe-location-interface:entry-settings-object-19>entry settings object/a>. If that failed, throw a a idthe-location-interface:syntaxerror-2 hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idthe-location-interface:domexception-19>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>a href#location-object-navigate idthe-location-interface:location-object-navigate-2>code>Location/code>-object navigate/a> to the a href#resulting-url-record idthe-location-interface:resulting-url-record-2>resulting URL record/a>./ol> p>When the dfn iddom-location-replace>code>replace(var>url/var>)/code>/dfn> method is invoked, the user agent must run the following steps: ol>li>p>a href#parse-a-url idthe-location-interface:parse-a-url-3>Parse/a> var>url/var> relative to the a href#entry-settings-object idthe-location-interface:entry-settings-object-20>entry settings object/a>. If that failed, throw a a idthe-location-interface:syntaxerror-3 hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idthe-location-interface:domexception-20>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>a href#location-object-navigate idthe-location-interface:location-object-navigate-3>code>Location/code>-object navigate/a> to the a href#resulting-url-record idthe-location-interface:resulting-url-record-3>resulting URL record/a> with the var>replacement flag/var> set./ol> p classnote>The code idthe-location-interface:dom-location-replace-3>a href#dom-location-replace>replace()/a>/code> method intentionally has no security check./p> p>When the dfn iddom-location-reload>code>reload()/code>/dfn> method is invoked, the user agent must run the appropriate steps from the following list:/p> dl classswitch>dt>If this code idthe-location-interface:location-67>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-21>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-19>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain-18>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object-21>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin-18>origin/a>dd>p>Throw a a idthe-location-interface:securityerror-18 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception-21>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.dt>If the currently executing a href#concept-task idthe-location-interface:concept-task-3>task/a> is the dispatch of a code idthe-location-interface:event-resize>a data-x-internalevent-resize hrefhttps://drafts.csswg.org/cssom-view/#eventdef-window-resize>resize/a>/code> event in response to the user resizing the a href#browsing-context idthe-location-interface:browsing-context-6>browsing context/a>dd>p>Repaint the a href#browsing-context idthe-location-interface:browsing-context-7>browsing context/a> and abort these steps.dt>If the a href#browsing-context idthe-location-interface:browsing-context-8>browsing context/a>s a href#active-document idthe-location-interface:active-document-4>active document/a> is a href#an-iframe-srcdoc-document idthe-location-interface:an-iframe-srcdoc-document>an code>iframe/code> code>srcdoc/code> document/a>dd>p>a href#process-the-iframe-attributes idthe-location-interface:process-the-iframe-attributes>Reprocess the code>iframe/code> attributes/a> of the a href#browsing-context idthe-location-interface:browsing-context-9>browsing context/a>s a href#browsing-context-container idthe-location-interface:browsing-context-container>browsing context container/a>.dt>If the a href#browsing-context idthe-location-interface:browsing-context-10>browsing context/a>s a href#active-document idthe-location-interface:active-document-5>active document/a> has its a href#reload-override-flag idthe-location-interface:reload-override-flag>reload override flag/a> setdd>p>Perform a href#an-overridden-reload idthe-location-interface:an-overridden-reload>an overridden reload/a>, with the a href#browsing-context idthe-location-interface:browsing-context-11>browsing context/a> being navigated as the a href#responsible-browsing-context idthe-location-interface:responsible-browsing-context-2>responsible browsing context/a>. Rethrow any exceptions.dt>Otherwisedd>p>a href#navigate idthe-location-interface:navigate-2>Navigate/a> the a href#browsing-context idthe-location-interface:browsing-context-12>browsing context/a> to this code idthe-location-interface:location-68>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-22>relevant code>Document/code>/a>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url idthe-location-interface:the-documents-address-4 data-x-internalthe-documents-address>URL/a> to perform an a href#entry-update idthe-location-interface:entry-update>entry update/a> of the a href#browsing-context idthe-location-interface:browsing-context-13>browsing context/a>s a href#current-entry idthe-location-interface:current-entry-2>current entry/a>, with the var>a href#exceptions-enabled idthe-location-interface:exceptions-enabled-2>exceptions enabled flag/a>/var> set. The a href#source-browsing-context idthe-location-interface:source-browsing-context-2>source browsing context/a> must be the a href#browsing-context idthe-location-interface:browsing-context-14>browsing context/a> being navigated. This is a a href#reload-triggered-navigation idthe-location-interface:reload-triggered-navigation>reload-triggered navigation/a>. Rethrow any exceptions./dl> p>When a user requests that the a href#active-document idthe-location-interface:active-document-6>active document/a> of a a href#browsing-context idthe-location-interface:browsing-context-15>browsing context/a> be reloaded through a user interface element, the user agent should a href#navigate idthe-location-interface:navigate-3>navigate/a> the a href#browsing-context idthe-location-interface:browsing-context-16>browsing context/a> to the same resource as that code idthe-location-interface:document-9>a href#document>Document/a>/code>, to perform an a href#entry-update idthe-location-interface:entry-update-2>entry update/a> of the a href#browsing-context idthe-location-interface:browsing-context-17>browsing context/a>s a href#current-entry idthe-location-interface:current-entry-3>current entry/a>. This is a a href#reload-triggered-navigation idthe-location-interface:reload-triggered-navigation-2>reload-triggered navigation/a>. In the case of non-idempotent methods (e.g. HTTP POST), the user agent should prompt the user to confirm the operation first, since otherwise transactions (e.g. purchases or database modifications) could be repeated. User agents may allow the user to explicitly override any caches when reloading. If a href#browsing-context idthe-location-interface:browsing-context-18>browsing context/a>s a href#active-document idthe-location-interface:active-document-7>active document/a>s a href#reload-override-flag idthe-location-interface:reload-override-flag-2>reload override flag/a> is set, then the user agent may instead perform a href#an-overridden-reload idthe-location-interface:an-overridden-reload-2>an overridden reload/a> rather than the navigation described in this paragraph (with the a href#browsing-context idthe-location-interface:browsing-context-19>browsing context/a> being reloaded as the a href#source-browsing-context idthe-location-interface:source-browsing-context-3>source browsing context/a>)./p> hr> p>The dfn iddom-location-ancestororigins>code>ancestorOrigins/code>/dfn> attributes getter must run these steps: ol>li>p>If this code idthe-location-interface:location-69>a href#location>Location/a>/code> objects a href#relevant-document idthe-location-interface:relevant-document-23>relevant code>Document/code>/a>s a href#concept-origin idthe-location-interface:concept-origin-20>origin/a> is not a href#same-origin-domain idthe-location-interface:same-origin-domain-19>same origin-domain/a> with the a href#entry-settings-object idthe-location-interface:entry-settings-object-22>entry settings object/a>s a href#concept-settings-object-origin idthe-location-interface:concept-settings-object-origin-19>origin/a>, then throw a a idthe-location-interface:securityerror-19 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-location-interface:domexception-22>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Otherwise, return this code idthe-location-interface:location-70>a href#location>Location/a>/code> objects a href#concept-location-ancestor-origins-list idthe-location-interface:concept-location-ancestor-origins-list-2>ancestor origins list/a>./ol> p classwarning>The details of how the code idthe-location-interface:dom-location-ancestororigins-3>a href#dom-location-ancestororigins>ancestorOrigins/a>/code> attribute works are still controversial and might change. See a hrefhttps://github.com/whatwg/html/issues/1918>issue #1918/a> for more information./p> hr> p idlocation-internal-methods>As explained earlier, the code idthe-location-interface:location-71>a href#location>Location/a>/code> exotic object requires additional logic beyond IDL for security purposes. The internal slot and internal methods code idthe-location-interface:location-72>a href#location>Location/a>/code> objects must implement are defined below./p> p>Every code idthe-location-interface:location-73>a href#location>Location/a>/code> object has a dfn iddefaultproperties>DefaultProperties/dfn> internal slot representing its own properties at time of its creation./p> h5 idlocation-getprototypeof>span classsecno>7.7.4.1/span> GetPrototypeOf ( )a href#location-getprototypeof classself-link>/a>/h5> ol>li>p>If ! a href#isplatformobjectsameorigin-(-o-) idlocation-getprototypeof:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin/a>(b>this/b>) is true, then return ! a idlocation-getprototypeof:ordinarygetprototypeof hrefhttps://tc39.github.io/ecma262/#sec-ordinarygetprototypeof data-x-internalordinarygetprototypeof>OrdinaryGetPrototypeOf/a>(b>this/b>).li>p>Return null./ol> h5 idlocation-setprototypeof>span classsecno>7.7.4.2/span> SetPrototypeOf ( var>V/var> )a href#location-setprototypeof classself-link>/a>/h5> ol>li>p>Return ! a idlocation-setprototypeof:setimmutableprototype hrefhttps://tc39.github.io/ecma262/#sec-set-immutable-prototype data-x-internalsetimmutableprototype>SetImmutablePrototype/a>(b>this/b>, var>V/var>)./ol> h5 idlocation-isextensible>span classsecno>7.7.4.3/span> IsExtensible ( )a href#location-isextensible classself-link>/a>/h5> ol>li>p>Return true./ol> h5 idlocation-preventextensions>span classsecno>7.7.4.4/span> PreventExtensions ( )a href#location-preventextensions classself-link>/a>/h5> ol>li>p>Return false./ol> h5 idlocation-getownproperty>span classsecno>7.7.4.5/span> GetOwnProperty ( var>P/var> )a href#location-getownproperty classself-link>/a>/h5> ol>li> p>If ! a href#isplatformobjectsameorigin-(-o-) idlocation-getownproperty:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin/a>(b>this/b>) is true, then:/p> ol>li>p>Let var>desc/var> be ! a idlocation-getownproperty:ordinarygetownproperty hrefhttps://tc39.github.io/ecma262/#sec-ordinarygetownproperty data-x-internalordinarygetownproperty>OrdinaryGetOwnProperty/a>(b>this/b>, var>P/var>).li>p>If the value of the a href#defaultproperties idlocation-getownproperty:defaultproperties>DefaultProperties/a> internal slot of b>this/b> contains var>P/var>, then set var>desc/var>.Configurable to true.li>p>Return var>desc/var>./ol> li>p>Let var>property/var> be ! a href#crossorigingetownpropertyhelper-(-o,-p-) idlocation-getownproperty:crossorigingetownpropertyhelper-(-o,-p-)>CrossOriginGetOwnPropertyHelper/a>(b>this/b>, var>P/var>).li>p>If var>property/var> is not undefined, return var>property/var>.li>p>Throw a a idlocation-getownproperty:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idlocation-getownproperty:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./ol> h5 idlocation-defineownproperty>span classsecno>7.7.4.6/span> DefineOwnProperty ( var>P/var>, var>Desc/var> )a href#location-defineownproperty classself-link>/a>/h5> ol>li> p>If ! a href#isplatformobjectsameorigin-(-o-) idlocation-defineownproperty:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin/a>(b>this/b>) is true, then:/p> ol>li>p>If the value of the a href#defaultproperties idlocation-defineownproperty:defaultproperties>DefaultProperties/a> internal slot of b>this/b> contains var>P/var>, then return false.li>p>Return ? a idlocation-defineownproperty:ordinarydefineownproperty hrefhttps://tc39.github.io/ecma262/#sec-ordinarydefineownproperty data-x-internalordinarydefineownproperty>OrdinaryDefineOwnProperty/a>(b>this/b>, var>P/var>, var>Desc/var>)./ol> li>p>Throw a a idlocation-defineownproperty:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idlocation-defineownproperty:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./ol> h5 idlocation-get>span classsecno>7.7.4.7/span> Get ( var>P/var>, var>Receiver/var> )a href#location-get classself-link>/a>/h5> ol>li>p>If ! a href#isplatformobjectsameorigin-(-o-) idlocation-get:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin/a>(b>this/b>) is true, then return ? a idlocation-get:ordinaryget hrefhttps://tc39.github.io/ecma262/#sec-ordinaryget data-x-internalordinaryget>OrdinaryGet/a>(b>this/b>, var>P/var>, var>Receiver/var>).li>p>Return ? a href#crossoriginget-(-o,-p,-receiver-) idlocation-get:crossoriginget-(-o,-p,-receiver-)>CrossOriginGet/a>(b>this/b>, var>P/var>, var>Receiver/var>)./ol> h5 idlocation-set>span classsecno>7.7.4.8/span> Set ( var>P/var>, var>V/var>, var>Receiver/var> )a href#location-set classself-link>/a>/h5> ol>li>p>If ! a href#isplatformobjectsameorigin-(-o-) idlocation-set:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin/a>(b>this/b>) is true, then return ? a idlocation-set:ordinaryset hrefhttps://tc39.github.io/ecma262/#sec-ordinaryset data-x-internalordinaryset>OrdinarySet/a>(b>this/b>, var>P/var>, var>Receiver/var>).li>p>Return ? a href#crossoriginset-(-o,-p,-v,-receiver-) idlocation-set:crossoriginset-(-o,-p,-v,-receiver-)>CrossOriginSet/a>(b>this/b>, var>P/var>, var>V/var>, var>Receiver/var>)./ol> h5 idlocation-delete>span classsecno>7.7.4.9/span> Delete ( var>P/var> )a href#location-delete classself-link>/a>/h5> ol>li>p>If ! a href#isplatformobjectsameorigin-(-o-) idlocation-delete:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin/a>(b>this/b>) is true, then return ? a idlocation-delete:ordinarydelete hrefhttps://tc39.github.io/ecma262/#sec-ordinarydelete data-x-internalordinarydelete>OrdinaryDelete/a>(b>this/b>, var>P/var>).li>p>Throw a a idlocation-delete:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idlocation-delete:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./ol> h5 idlocation-ownpropertykeys>span classsecno>7.7.4.10/span> OwnPropertyKeys ( )a href#location-ownpropertykeys classself-link>/a>/h5> ol>li>p>If ! a href#isplatformobjectsameorigin-(-o-) idlocation-ownpropertykeys:isplatformobjectsameorigin-(-o-)>IsPlatformObjectSameOrigin/a>(b>this/b>) is true, then return ! a idlocation-ownpropertykeys:ordinaryownpropertykeys hrefhttps://tc39.github.io/ecma262/#sec-ordinaryownpropertykeys data-x-internalordinaryownpropertykeys>OrdinaryOwnPropertyKeys/a>(b>this/b>).li>p>Return ! a href#crossoriginownpropertykeys-(-o-) idlocation-ownpropertykeys:crossoriginownpropertykeys-(-o-)>CrossOriginOwnPropertyKeys/a>(b>this/b>)./ol> h3 idbrowsing-the-web>span classsecno>7.8/span> Browsing the Weba href#browsing-the-web classself-link>/a>/h3> h4 idnavigating-across-documents>span classsecno>7.8.1/span> Navigating across documentsa href#navigating-across-documents classself-link>/a>/h4> p>Certain actions cause the a href#browsing-context idnavigating-across-documents:browsing-context>browsing context/a> to i idnavigating-across-documents:navigate>a href#navigate>navigate/a>/i> to a new resource. A user agent may provide various ways for the user to explicitly cause a browsing context to navigate, in addition to those defined in this specification./p> p classexample>For example, a href#following-hyperlinks-2 idnavigating-across-documents:following-hyperlinks-2>following a hyperlink/a>, a href#concept-form-submit idnavigating-across-documents:concept-form-submit>form submission/a>, and the code idnavigating-across-documents:dom-open>a href#dom-open>window.open()/a>/code> and code idnavigating-across-documents:dom-location-assign>a href#dom-location-assign>location.assign()/a>/code> methods can all cause a browsing context to navigate./p> p classnote>A i>resource/i> has a URL, but that might not be the only information necessary to identify it. For example, a form submission that uses HTTP POST would also have the HTTP method and payload. Similarly, a href#an-iframe-srcdoc-document idnavigating-across-documents:an-iframe-srcdoc-document>an code>iframe/code> code>srcdoc/code> document/a> needs to know the data it is to use./p> p>Navigation always involves dfn idsource-browsing-context data-export>source browsing context/dfn>, which is the browsing context which was responsible for starting the navigation./p> p classXXX>As explained in a hrefhttps://github.com/whatwg/html/issues/1130>issue #1130/a> the use of a browsing context as source might not be the correct architecture./p> p>To dfn idnavigate data-export>navigate/dfn> a browsing context var>browsingContext/var> to a resource var>resource/var>, optionally with an dfn data-export idexceptions-enabled>var>exceptions enabled flag/var>/dfn>, the user agent must run these steps:/p> ol>li>p>If var>resource/var> is a a idnavigating-across-documents:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>, then set var>resource/var> to a new a hrefhttps://fetch.spec.whatwg.org/#concept-request idnavigating-across-documents:concept-request data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idnavigating-across-documents:concept-request-url data-x-internalconcept-request-url>url/a> is var>resource/var>.li idsandboxLinks> p>If the a href#source-browsing-context idnavigating-across-documents:source-browsing-context>source browsing context/a> is not a href#allowed-to-navigate idnavigating-across-documents:allowed-to-navigate>allowed to navigate/a> var>browsingContext/var>, then:/p> ol>li>p>If the var>a href#exceptions-enabled idnavigating-across-documents:exceptions-enabled>exceptions enabled flag/a>/var> is set, then throw a a idnavigating-across-documents:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idnavigating-across-documents:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li> p>Otherwise, the user agent may instead offer to open var>resource/var> in a new a href#top-level-browsing-context idnavigating-across-documents:top-level-browsing-context>top-level browsing context/a> or in the a href#top-level-browsing-context idnavigating-across-documents:top-level-browsing-context-2>top-level browsing context/a> of the a href#source-browsing-context idnavigating-across-documents:source-browsing-context-2>source browsing context/a>, at the users option, in which case the user agent must a href#navigate idnavigating-across-documents:navigate-2>navigate/a> that designated a href#top-level-browsing-context idnavigating-across-documents:top-level-browsing-context-3>top-level browsing context/a> to var>resource/var> as if the user had requested it independently./p> p classnote>Doing so, however, can be dangerous, as it means that the user is overriding the authors explicit request to sandbox the content./p> /ol> li>p>If there is a preexisting attempt to navigate var>browsingContext/var>, and the a href#source-browsing-context idnavigating-across-documents:source-browsing-context-3>source browsing context/a> is the same as var>browsingContext/var>, and that attempt is currently running the a href#unload-a-document idnavigating-across-documents:unload-a-document>unload a document/a> algorithm, then abort these steps without affecting the preexisting attempt to navigate var>browsingContext/var>.li>p>If the a href#prompt-to-unload-a-document idnavigating-across-documents:prompt-to-unload-a-document>prompt to unload/a> algorithm is being run for the a href#active-document idnavigating-across-documents:active-document>active document/a> of var>browsingContext/var>, then abort these steps without affecting the a href#prompt-to-unload-a-document idnavigating-across-documents:prompt-to-unload-a-document-2>prompt to unload/a> algorithm.li idnavigate-fragid-step>p>If this is not a dfn idreload-triggered-navigation>reload-triggered navigation/dfn>, var>resource/var> is a a hrefhttps://fetch.spec.whatwg.org/#concept-request idnavigating-across-documents:concept-request-2 data-x-internalconcept-request>request/a>, var>resource/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idnavigating-across-documents:concept-request-url-2 data-x-internalconcept-request-url>url/a> a hrefhttps://url.spec.whatwg.org/#concept-url-equals idnavigating-across-documents:concept-url-equals data-x-internalconcept-url-equals>equals/a> var>browsingContext/var>s a href#active-document idnavigating-across-documents:active-document-2>active document/a>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url idnavigating-across-documents:the-documents-address data-x-internalthe-documents-address>URL/a> with var>exclude fragments flag/var> set, and var>resource/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idnavigating-across-documents:concept-request-url-3 data-x-internalconcept-request-url>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idnavigating-across-documents:concept-url-fragment data-x-internalconcept-url-fragment>fragment/a> is non-null, then a href#scroll-to-fragid idnavigating-across-documents:scroll-to-fragid>navigate to that fragment/a>, with a href#replacement-enabled idnavigating-across-documents:replacement-enabled>replacement enabled/a> if this was invoked with a href#replacement-enabled idnavigating-across-documents:replacement-enabled-2>replacement enabled/a>, and abort these steps.li>p>Cancel any preexisting but not yet a href#concept-navigate-mature idnavigating-across-documents:concept-navigate-mature>mature/a> attempt to navigate var>browsingContext/var>, including canceling any instances of the a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idnavigating-across-documents:concept-fetch data-x-internalconcept-fetch>fetch/a> algorithm started by those attempts. If one of those attempts has already created and a href#initialise-the-document-object idnavigating-across-documents:initialise-the-document-object>initialized a new code>Document/code> object/a>, a href#abort-a-document idnavigating-across-documents:abort-a-document>abort/a> that code idnavigating-across-documents:document>a href#document>Document/a>/code> also. (Navigation attempts that have a href#concept-navigate-mature idnavigating-across-documents:concept-navigate-mature-2>matured/a> already have session history entries, and are therefore handled during the a href#update-the-session-history-with-the-new-page idnavigating-across-documents:update-the-session-history-with-the-new-page>update the session history with the new page/a> algorithm, later.)li> p>a href#prompt-to-unload-a-document idnavigating-across-documents:prompt-to-unload-a-document-3>Prompt to unload/a> the a href#active-document idnavigating-across-documents:active-document-3>active document/a> of var>browsingContext/var>. If the user a href#refused-to-allow-the-document-to-be-unloaded idnavigating-across-documents:refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be unloaded/a>, then abort these steps./p> p>If this instance of the a href#navigate idnavigating-across-documents:navigate-3>navigation/a> algorithm gets canceled while this step is running, the a href#prompt-to-unload-a-document idnavigating-across-documents:prompt-to-unload-a-document-4>prompt to unload/a> algorithm must nonetheless be run to completion./p> li>p>a href#abort-a-document idnavigating-across-documents:abort-a-document-2>Abort/a> the a href#active-document idnavigating-across-documents:active-document-4>active document/a> of var>browsingContext/var>.li> p>If var>browsingContext/var> is a a href#nested-browsing-context idnavigating-across-documents:nested-browsing-context>nested browsing context/a>, then put it in the a href#delaying-load-events-mode idnavigating-across-documents:delaying-load-events-mode>delaying code>load/code> events mode/a>./p> p>The user agent must take this a href#nested-browsing-context idnavigating-across-documents:nested-browsing-context-2>nested browsing context/a> out of the a href#delaying-load-events-mode idnavigating-across-documents:delaying-load-events-mode-2>delaying code>load/code> events mode/a> when this a href#navigate idnavigating-across-documents:navigate-4>navigation/a> algorithm later a href#concept-navigate-mature idnavigating-across-documents:concept-navigate-mature-3>matures/a>, or when it terminates (whether due to having run all the steps, or being canceled, or being aborted), whichever happens first./p> li>p>Let var>navigationType/var> be code>form-submission/code> if the a href#navigate idnavigating-across-documents:navigate-5>navigation algorithm/a> was invoked as a result of the a href#concept-form-submit idnavigating-across-documents:concept-form-submit-2>form submission algorithm/a>, and code>other/code> otherwise.li>p>Return to whatever algorithm invoked the navigation steps and continue running these steps a href#in-parallel idnavigating-across-documents:in-parallel>in parallel/a>.li> p>This is the step that attempts to obtain var>resource/var>, if necessary. Jump to the first appropriate substep:/p> dl>dt>If var>resource/var> is a a hrefhttps://fetch.spec.whatwg.org/#concept-response idnavigating-across-documents:concept-response data-x-internalconcept-response>response/a>dd>p>Run a href#process-a-navigate-response idnavigating-across-documents:process-a-navigate-response>process a navigate response/a> with null, var>resource/var>, var>navigationType/var>, the a href#source-browsing-context idnavigating-across-documents:source-browsing-context-4>source browsing context/a>, and var>browsingContext/var>, and then abort these steps.dt>If var>resource/var> is a a hrefhttps://fetch.spec.whatwg.org/#concept-request idnavigating-across-documents:concept-request-3 data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idnavigating-across-documents:concept-request-url-4 data-x-internalconcept-request-url>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idnavigating-across-documents:concept-url-scheme data-x-internalconcept-url-scheme>scheme/a> is code idnavigating-across-documents:javascript-protocol>a href#javascript-protocol>javascript/a>/code>dd> p>a href#queue-a-task idnavigating-across-documents:queue-a-task>Queue a task/a> to run dfn idjavascript-protocol>these code>javascript:/code> URL steps/dfn>, associated with the a href#active-document idnavigating-across-documents:active-document-5>active document/a> of var>browsingContext/var>:/p> ol idconcept-js-deref>li> p>Let var>result/var> be undefined, and jump to the step labeled i>process result/i> below if either of the following are true:/p> ul>li> p>The a href#source-browsing-context idnavigating-across-documents:source-browsing-context-5>source browsing context/a>s a href#active-document idnavigating-across-documents:active-document-6>active document/a>s a href#concept-origin idnavigating-across-documents:concept-origin>origin/a> is not the a href#same-origin idnavigating-across-documents:same-origin>same origin/a> as var>browsingContext/var>s a href#active-document idnavigating-across-documents:active-document-7>active document/a>s a href#concept-origin idnavigating-across-documents:concept-origin-2>origin/a>./p> p classXXX>As explained in a hrefhttps://github.com/whatwg/html/issues/2591>issue #2591/a> this step does not work and presents a security issue./p> li>p>The a idnavigating-across-documents:should-navigation-request-of-type-from-source-in-target-be-blocked-by-content-security-policy hrefhttps://w3c.github.io/webappsec-csp/#should-block-navigation-request data-x-internalshould-navigation-request-of-type-from-source-in-target-be-blocked-by-content-security-policy>Should navigation request of type from source in target be blocked by Content Security Policy?/a> algorithm returns code>Blocked/code> when executed upon var>resource/var>, code>other/code>, the a href#source-browsing-context idnavigating-across-documents:source-browsing-context-6>source browsing context/a>, and var>browsingContext/var>. a href#refsCSP>CSP/a>/ul> li>p>Let var>urlString/var> be the result of running the a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idnavigating-across-documents:concept-url-serializer data-x-internalconcept-url-serializer>URL serializer/a> on var>resource/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idnavigating-across-documents:concept-request-url-5 data-x-internalconcept-request-url>url/a>.li>p>Remove the leading code>javascript:/code> string from var>urlString/var>.li>p>Let var>script source/var> be the result of applying the a idnavigating-across-documents:percent-decode hrefhttps://url.spec.whatwg.org/#percent-decode data-x-internalpercent-decode>percent decode/a> algorithm to var>urlString/var>.li>p>Replace var>script source/var> with the result of applying the a idnavigating-across-documents:utf-8-decode hrefhttps://encoding.spec.whatwg.org/#utf-8-decode data-x-internalutf-8-decode>UTF-8 decode/a> algorithm to var>script source/var>.li>p>Let var>address/var> be the a hrefhttps://dom.spec.whatwg.org/#concept-document-url idnavigating-across-documents:the-documents-address-2 data-x-internalthe-documents-address>URL/a> of the a href#active-document idnavigating-across-documents:active-document-8>active document/a> of var>browsingContext/var>.li>p>Let var>settings/var> be the a href#relevant-settings-object idnavigating-across-documents:relevant-settings-object>relevant settings object/a> for the a href#active-document idnavigating-across-documents:active-document-9>active document/a> of var>browsingContext/var>.li>p>Let var>base URL/var> be var>settings object/var>s a href#api-base-url idnavigating-across-documents:api-base-url>API base URL/a>.li>p>Let var>script/var> be the result of a href#creating-a-classic-script idnavigating-across-documents:creating-a-classic-script>creating a classic script/a> given var>script source/var>, var>settings/var>, var>base URL/var>, and the a href#default-classic-script-fetch-options idnavigating-across-documents:default-classic-script-fetch-options>default classic script fetch options/a>.li>p>Let var>result/var> be the result of a href#run-a-classic-script idnavigating-across-documents:run-a-classic-script>running the classic script/a> var>script/var>. If evaluation was unsuccessful, let var>result/var> be undefined instead. (The result will also be undefined if a href#concept-bc-noscript idnavigating-across-documents:concept-bc-noscript>scripting is disabled/a>.)li>p>Let var>response/var> be null.li> p>i>Process result/i>: If a hrefhttps://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values idnavigating-across-documents:js-type data-x-internaljs-type>Type/a>(var>result/var>) is not String, then set var>response/var> to a a hrefhttps://fetch.spec.whatwg.org/#concept-response idnavigating-across-documents:concept-response-2 data-x-internalconcept-response>response/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-response-status idnavigating-across-documents:concept-response-status data-x-internalconcept-response-status>status/a> is code>204/code>./p> p>Otherwise, set var>response/var> a a hrefhttps://fetch.spec.whatwg.org/#concept-response idnavigating-across-documents:concept-response-3 data-x-internalconcept-response>response/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-response-header-list idnavigating-across-documents:concept-response-header-list data-x-internalconcept-response-header-list>header list/a> consists of `code>Content-Type/code>`/`code idnavigating-across-documents:text/html>a href#text/html>text/html/a>/code>` and `code idnavigating-across-documents:http-referrer-policy>a data-x-internalhttp-referrer-policy hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy-header-dfn>Referrer-Policy/a>/code>`/var>settings/var>s a idnavigating-across-documents:referrer-policy hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>referrer policy/a>, whose a hrefhttps://fetch.spec.whatwg.org/#concept-response-body idnavigating-across-documents:concept-response-body data-x-internalconcept-response-body>body/a> is var>result/var>, and whose a hrefhttps://fetch.spec.whatwg.org/#concept-response-https-state idnavigating-across-documents:concept-response-https-state data-x-internalconcept-response-https-state>HTTPS state/a> is var>settings/var>s a href#https-state idnavigating-across-documents:https-state>HTTPS state/a>./p> p classwarning>The exact conversion between the JavaScript string var>result/var> and the bytes that comprise a a hrefhttps://fetch.spec.whatwg.org/#concept-response-body idnavigating-across-documents:concept-response-body-2 data-x-internalconcept-response-body>response body/a> is not yet specified, pending further investigation into user agent behavior. See a hrefhttps://github.com/whatwg/html/issues/1129>issue #1129/a>./p> p>When it comes time to a href#set-the-documents-address idnavigating-across-documents:set-the-documents-address>set the documents address/a>, use var>address/var> as the a href#override-url idnavigating-across-documents:override-url>override URL/a>./p> li>p>Run a href#process-a-navigate-response idnavigating-across-documents:process-a-navigate-response-2>process a navigate response/a> with var>resource/var>, var>response/var>, var>navigationType/var>, the a href#source-browsing-context idnavigating-across-documents:source-browsing-context-7>source browsing context/a>, and var>browsingContext/var>, and then abort these steps./ol> p>The a href#task-source idnavigating-across-documents:task-source>task source/a> for this a href#concept-task idnavigating-across-documents:concept-task>task/a> is the a href#dom-manipulation-task-source idnavigating-across-documents:dom-manipulation-task-source>DOM manipulation task source/a>./p> div classexample> p>So for example a a href#javascript-protocol idnavigating-across-documents:javascript-protocol-2>code>javascript:/code> URL/a> in an code idnavigating-across-documents:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute of an code idnavigating-across-documents:the-a-element>a href#the-a-element>a/a>/code> element would only be evaluated when the link was a href#following-hyperlinks-2 idnavigating-across-documents:following-hyperlinks-2-2>followed/a>, while such a URL in the code idnavigating-across-documents:attr-iframe-src>a href#attr-iframe-src>src/a>/code> attribute of an code idnavigating-across-documents:the-iframe-element>a href#the-iframe-element>iframe/a>/code> element would be evaluated in the context of the code idnavigating-across-documents:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code>s own a href#nested-browsing-context idnavigating-across-documents:nested-browsing-context-3>nested browsing context/a> when the code idnavigating-across-documents:the-iframe-element-3>a href#the-iframe-element>iframe/a>/code> is being set up; once evaluated, its return value (if it was a string) would replace that a href#browsing-context idnavigating-across-documents:browsing-context-2>browsing context/a>s code idnavigating-across-documents:document-2>a href#document>Document/a>/code>, thus also changing the code idnavigating-across-documents:window>a href#window>Window/a>/code> object of that a href#browsing-context idnavigating-across-documents:browsing-context-3>browsing context/a>./p> /div> dt>If var>resource/var> is to be fetched using `code>GET/code>`, and there are a href#relevant-application-cache idnavigating-across-documents:relevant-application-cache>relevant application caches/a> that are identified by a URL with the a href#same-origin idnavigating-across-documents:same-origin-2>same origin/a> as the URL in question, and that have this URL as one of their entries, excluding entries marked as a href#concept-appcache-foreign idnavigating-across-documents:concept-appcache-foreign>foreign/a>, and whose a href#concept-appcache-mode idnavigating-across-documents:concept-appcache-mode>mode/a> is a href#concept-appcache-mode-fast idnavigating-across-documents:concept-appcache-mode-fast>fast/a>, and the user agent is not in a mode where it will avoid using a href#application-cache idnavigating-across-documents:application-cache>application caches/a>dd> p>Fetch var>resource/var> from the a href#concept-appcache-selection idnavigating-across-documents:concept-appcache-selection>most appropriate application cache/a> of those that match./p> p classexample>For example, imagine an HTML page with an associated application cache displaying an image and a form, where the image is also used by several other application caches. If the user right-clicks on the image and chooses View Image, then the user agent could decide to show the image from any of those caches, but it is likely that the most useful cache for the user would be the one that was used for the aforementioned HTML page. On the other hand, if the user submits the form, and the form does a POST submission, then the user agent will not use an application cache at all; the submission will be made to the network./p> p classXXX>This still needs to be integrated with the Fetch standard. a href#refsFETCH>FETCH/a>/p> dt>If var>resource/var> is a a hrefhttps://fetch.spec.whatwg.org/#concept-request idnavigating-across-documents:concept-request-4 data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idnavigating-across-documents:concept-request-url-6 data-x-internalconcept-request-url>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idnavigating-across-documents:concept-url-scheme-2 data-x-internalconcept-url-scheme>scheme/a> is a a idnavigating-across-documents:fetch-scheme hrefhttps://fetch.spec.whatwg.org/#fetch-scheme data-x-internalfetch-scheme>fetch scheme/a>dd>p>Run a href#process-a-navigate-fetch idnavigating-across-documents:process-a-navigate-fetch>process a navigate fetch/a> given var>resource/var>, the a href#source-browsing-context idnavigating-across-documents:source-browsing-context-8>source browsing context/a>, and var>browsing context/var>, and var>navigationType/var>.dt>Otherwise, var>resource/var> is a a hrefhttps://fetch.spec.whatwg.org/#concept-request idnavigating-across-documents:concept-request-5 data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idnavigating-across-documents:concept-request-url-7 data-x-internalconcept-request-url>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idnavigating-across-documents:concept-url-scheme-3 data-x-internalconcept-url-scheme>scheme/a> is neither code idnavigating-across-documents:javascript-protocol-3>a href#javascript-protocol>javascript/a>/code> nor a a idnavigating-across-documents:fetch-scheme-2 hrefhttps://fetch.spec.whatwg.org/#fetch-scheme data-x-internalfetch-scheme>fetch scheme/a>dd>p>Run a href#process-a-navigate-url-scheme idnavigating-across-documents:process-a-navigate-url-scheme>process a navigate URL scheme/a> given var>resource/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idnavigating-across-documents:concept-request-url-8 data-x-internalconcept-request-url>url/a> and var>browsingContext/var>./dl> /ol> p>To dfn idprocess-a-navigate-fetch data-export>process a navigate fetch/dfn>, given a a hrefhttps://fetch.spec.whatwg.org/#concept-request idnavigating-across-documents:concept-request-6 data-x-internalconcept-request>request/a> var>request/var>, a href#browsing-context idnavigating-across-documents:browsing-context-4>browsing context/a> var>sourceBrowsingContext/var>, a href#browsing-context idnavigating-across-documents:browsing-context-5>browsing context/a> var>browsingContext/var>, and string var>navigationType/var>, run these steps:/p> ol>li>p>Let var>response/var> be null.li>p>Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-client idnavigating-across-documents:concept-request-client data-x-internalconcept-request-client>client/a> to var>sourceBrowsingContext/var>s a href#active-document idnavigating-across-documents:active-document-10>active document/a>s a href#relevant-settings-object idnavigating-across-documents:relevant-settings-object-2>relevant settings object/a>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination idnavigating-across-documents:concept-request-destination data-x-internalconcept-request-destination>destination/a> to code>document/code>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-mode idnavigating-across-documents:concept-request-mode data-x-internalconcept-request-mode>mode/a> to code>navigate/code>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode idnavigating-across-documents:concept-request-credentials-mode data-x-internalconcept-request-credentials-mode>credentials mode/a> to code>include/code>, a idnavigating-across-documents:use-url-credentials-flag hrefhttps://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag data-x-internaluse-url-credentials-flag>use-URL-credentials flag/a>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-redirect-mode idnavigating-across-documents:concept-request-redirect-mode data-x-internalconcept-request-redirect-mode>redirect mode/a> to code>manual/code>, and a hrefhttps://fetch.spec.whatwg.org/#concept-request-target-client-id idnavigating-across-documents:concept-request-target-client-id data-x-internalconcept-request-target-client-id>target client id/a> to var>browsingContext/var>s a href#active-document idnavigating-across-documents:active-document-11>active document/a>s a href#relevant-settings-object idnavigating-across-documents:relevant-settings-object-3>relevant settings object/a>s a href#concept-environment-id idnavigating-across-documents:concept-environment-id>id/a>.li>p>If var>browsingContext/var> is a a href#child-browsing-context idnavigating-across-documents:child-browsing-context>child browsing context/a> and the a href#browsing-context-container idnavigating-across-documents:browsing-context-container>browsing context container/a> of var>browsingContext/var> has a a href#browsing-context-scope-origin idnavigating-across-documents:browsing-context-scope-origin>browsing context scope origin/a>, then set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-origin idnavigating-across-documents:concept-request-origin data-x-internalconcept-request-origin>origin/a> to that a href#browsing-context-scope-origin idnavigating-across-documents:browsing-context-scope-origin-2>browsing context scope origin/a>.li> p>Create a new a href#environment idnavigating-across-documents:environment>environment/a> var>reservedEnvironment/var>, and set its a href#concept-environment-id idnavigating-across-documents:concept-environment-id-2>id/a> to a new unique opaque string, its a href#concept-environment-creation-url idnavigating-across-documents:concept-environment-creation-url>creation URL/a> to var>request/var>s a idnavigating-across-documents:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>url/a>, and its a href#concept-environment-target-browsing-context idnavigating-across-documents:concept-environment-target-browsing-context>target browsing context/a> to var>browsingContext/var>./p> p classnote>The created environments a href#concept-environment-active-service-worker idnavigating-across-documents:concept-environment-active-service-worker>active service worker/a> is set in the a hrefhttps://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm idnavigating-across-documents:on-fetch-request-algorithm data-x-internalon-fetch-request-algorithm>handle fetch/a> algorithm during the fetch if its a href#concept-environment-creation-url idnavigating-across-documents:concept-environment-creation-url-2>creation URL/a> matches a service worker registration. a href#refsSW>SW/a>/p> li>p>Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-reserved-client idnavigating-across-documents:concept-request-reserved-client data-x-internalconcept-request-reserved-client>reserved client/a> to var>reservedEnvironment/var>.li> p>If the a idnavigating-across-documents:should-navigation-request-of-type-from-source-in-target-be-blocked-by-content-security-policy-2 hrefhttps://w3c.github.io/webappsec-csp/#should-block-navigation-request data-x-internalshould-navigation-request-of-type-from-source-in-target-be-blocked-by-content-security-policy>Should navigation request of type from source in target be blocked by Content Security Policy?/a> algorithm returns code>Blocked/code> when executed upon var>request/var>, var>navigationType/var>, var>sourceBrowsingContext/var>, and var>browsingContext/var>, then set var>response/var> to a network error. a href#refsCSP>CSP/a>/p> p>Otherwise:/p> ol>li>p>a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idnavigating-across-documents:concept-fetch-2 data-x-internalconcept-fetch>Fetch/a> var>request/var>.li>p>Wait for the a href#concept-task idnavigating-across-documents:concept-task-2>task/a> on the a href#networking-task-source idnavigating-across-documents:networking-task-source>networking task source/a> to a idnavigating-across-documents:process-response hrefhttps://fetch.spec.whatwg.org/#process-response data-x-internalprocess-response>process response/a> and set var>response/var> to the result./ol> li idnavigate-redirect-step> p>If var>response/var> has a a hrefhttps://fetch.spec.whatwg.org/#concept-response-location-url idnavigating-across-documents:concept-response-location-url data-x-internalconcept-response-location-url>location URL/a> and it is either failure or a a idnavigating-across-documents:url-3 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> whose a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idnavigating-across-documents:concept-url-scheme-4 data-x-internalconcept-url-scheme>scheme/a> is an a idnavigating-across-documents:http(s)-scheme hrefhttps://fetch.spec.whatwg.org/#http-scheme data-x-internalhttp(s)-scheme>HTTP(S) scheme/a>, then set var>response/var> to the result of performing a idnavigating-across-documents:http-redirect-fetch hrefhttps://fetch.spec.whatwg.org/#concept-http-redirect-fetch data-x-internalhttp-redirect-fetch>HTTP-redirect fetch/a> using var>request/var> and var>response/var> and then run this step again./p> p classnote>Navigation handles redirects manually as navigation is the only place in the web platform that cares for redirects to code idnavigating-across-documents:mailto-protocol>a data-x-internalmailto-protocol hrefhttps://tools.ietf.org/html/rfc6068#section-2>mailto:/a>/code> URLs and such./p> li>p>Otherwise, if var>response/var> has a a hrefhttps://fetch.spec.whatwg.org/#concept-response-location-url idnavigating-across-documents:concept-response-location-url-2 data-x-internalconcept-response-location-url>location URL/a> that is a a idnavigating-across-documents:url-4 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> whose a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idnavigating-across-documents:concept-url-scheme-5 data-x-internalconcept-url-scheme>scheme/a> is code>blob/code>, code>file/code>, code>filesystem/code>, or code>javascript/code>, then set var>response/var> to a network error.li>p>Otherwise, if var>response/var> has a a hrefhttps://fetch.spec.whatwg.org/#concept-response-location-url idnavigating-across-documents:concept-response-location-url-3 data-x-internalconcept-response-location-url>location URL/a> that is a a idnavigating-across-documents:url-5 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> whose a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idnavigating-across-documents:concept-url-scheme-6 data-x-internalconcept-url-scheme>scheme/a> is a a idnavigating-across-documents:fetch-scheme-3 hrefhttps://fetch.spec.whatwg.org/#fetch-scheme data-x-internalfetch-scheme>fetch scheme/a>, then run a href#process-a-navigate-fetch idnavigating-across-documents:process-a-navigate-fetch-2>process a navigate fetch/a> with a new a hrefhttps://fetch.spec.whatwg.org/#concept-request idnavigating-across-documents:concept-request-7 data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idnavigating-across-documents:concept-request-url-9 data-x-internalconcept-request-url>url/a> is var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-location-url idnavigating-across-documents:concept-response-location-url-4 data-x-internalconcept-response-location-url>location URL/a>, var>sourceBrowsingContext/var>, var>browsingContext/var>, and var>navigationType/var>. li>p>Otherwise, if var>response/var> has a a hrefhttps://fetch.spec.whatwg.org/#concept-response-location-url idnavigating-across-documents:concept-response-location-url-5 data-x-internalconcept-response-location-url>location URL/a> that is a a idnavigating-across-documents:url-6 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>, run the a href#process-a-navigate-url-scheme idnavigating-across-documents:process-a-navigate-url-scheme-2>process a navigate URL scheme/a> given var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-location-url idnavigating-across-documents:concept-response-location-url-6 data-x-internalconcept-response-location-url>location URL/a> and var>browsingContext/var>.li> p>strong>Fallback in prefer-online mode/strong>: If var>response/var> was not fetched from an a href#application-cache idnavigating-across-documents:application-cache-2>application cache/a>, and was to be fetched using `code>GET/code>`, and there are a href#relevant-application-cache idnavigating-across-documents:relevant-application-cache-2>relevant application caches/a> that are identified by a URL with the a href#same-origin idnavigating-across-documents:same-origin-3>same origin/a> as the URL in question, and that have this URL as one of their entries, excluding entries marked as a href#concept-appcache-foreign idnavigating-across-documents:concept-appcache-foreign-2>foreign/a>, and whose a href#concept-appcache-mode idnavigating-across-documents:concept-appcache-mode-2>mode/a> is a href#concept-appcache-mode-prefer-online idnavigating-across-documents:concept-appcache-mode-prefer-online>prefer-online/a>, and the user didnt cancel the navigation attempt during the earlier step, and var>response/var> is either a network error or its a hrefhttps://fetch.spec.whatwg.org/#concept-response-status idnavigating-across-documents:concept-response-status-2 data-x-internalconcept-response-status>status/a> is not an a idnavigating-across-documents:ok-status hrefhttps://fetch.spec.whatwg.org/#ok-status data-x-internalok-status>ok status/a>, then:/p> p>Let var>candidate/var> be the response identified by the URL in question from the a href#concept-appcache-selection idnavigating-across-documents:concept-appcache-selection-2>most appropriate application cache/a> of those that match./p> p>If var>candidate/var> is not marked as a href#concept-appcache-foreign idnavigating-across-documents:concept-appcache-foreign-3>foreign/a>, then the user agent must discard the failed load and instead continue along these steps using var>candidate/var> as var>response/var>. The user agent may indicate to the user that the original page load failed, and that the page used was a previously cached response./p> li> p>strong>Fallback for fallback entries/strong>: If var>response/var> was not fetched from an a href#application-cache idnavigating-across-documents:application-cache-3>application cache/a>, and was to be fetched using `code>GET/code>`, and its URL a href#concept-appcache-matches-fallback idnavigating-across-documents:concept-appcache-matches-fallback>matches the fallback namespace/a> of one or more a href#relevant-application-cache idnavigating-across-documents:relevant-application-cache-3>relevant application caches/a>, and the a href#concept-appcache-selection idnavigating-across-documents:concept-appcache-selection-3>most appropriate application cache/a> of those that match does not have an entry in its a href#concept-appcache-onlinesafelist idnavigating-across-documents:concept-appcache-onlinesafelist>online safelist/a> that has the a href#same-origin idnavigating-across-documents:same-origin-4>same origin/a> as var>response/var>s URL and that is a a href#prefix-match idnavigating-across-documents:prefix-match>prefix match/a> for var>response/var>s URL, and the user didnt cancel the navigation attempt during the earlier step, and var>response/var> is either a network error or its a hrefhttps://fetch.spec.whatwg.org/#concept-response-status idnavigating-across-documents:concept-response-status-3 data-x-internalconcept-response-status>status/a> is not an a idnavigating-across-documents:ok-status-2 hrefhttps://fetch.spec.whatwg.org/#ok-status data-x-internalok-status>ok status/a>, then:/p> p>Let var>candidate/var> be the a href#concept-appcache-fallback idnavigating-across-documents:concept-appcache-fallback>fallback response/a> specified for the a href#concept-appcache-fallback-ns idnavigating-across-documents:concept-appcache-fallback-ns>fallback namespace/a> in question. If multiple application caches match, the user agent must use the fallback of the a href#concept-appcache-selection idnavigating-across-documents:concept-appcache-selection-4>most appropriate application cache/a> of those that match./p> p>If var>candidate/var> is not marked as a href#concept-appcache-foreign idnavigating-across-documents:concept-appcache-foreign-4>foreign/a>, then the user agent must discard the failed load and instead continue along these steps using var>candidate/var> as var>response/var>. The documents a hrefhttps://dom.spec.whatwg.org/#concept-document-url idnavigating-across-documents:the-documents-address-3 data-x-internalthe-documents-address>URL/a>, if appropriate, will still be the originally requested URL, not the fallback URL, but the user agent may indicate to the user that the original page load failed, that the page used was a fallback response, and what the URL of the fallback response actually is./p> li>p>Run a href#process-a-navigate-response idnavigating-across-documents:process-a-navigate-response-3>process a navigate response/a> given var>request/var>, var>response/var>, var>navigationType/var>, the a href#source-browsing-context idnavigating-across-documents:source-browsing-context-9>source browsing context/a>, var>browsingContext/var>, and var>reservedEnvironment/var>./ol> p>To dfn idprocess-a-navigate-response data-export>process a navigate response/dfn>, given null or a a hrefhttps://fetch.spec.whatwg.org/#concept-request idnavigating-across-documents:concept-request-8 data-x-internalconcept-request>request/a> var>request/var>, a a hrefhttps://fetch.spec.whatwg.org/#concept-response idnavigating-across-documents:concept-response-4 data-x-internalconcept-response>response/a> var>response/var>, a string var>navigationType/var>, two a href#browsing-context idnavigating-across-documents:browsing-context-6>browsing contexts/a> var>source/var> and var>browsingContext/var>, and an optional a href#environment idnavigating-across-documents:environment-2>environment/a> var>reservedEnvironment/var>, run these steps:/p> ol>li> p>If any of the following are true, then a href#read-ua-inline idnavigating-across-documents:read-ua-inline>display the inline content with an appropriate error shown to the user/a>, with the newly created code idnavigating-across-documents:document-3>a href#document>Document/a>/code> objects a href#concept-origin idnavigating-across-documents:concept-origin-3>origin/a> set to a new a href#concept-origin-opaque idnavigating-across-documents:concept-origin-opaque>opaque origin/a>, and abort these steps./p> ul>li>p>var>response/var> is a network error.li>p classXXX>TODO: Define code>X-Frame-Options/code> processing here a hrefhttps://github.com/whatwg/html/issue/1230>whatwg/html#1230/a>.li>p>The a idnavigating-across-documents:should-navigation-response-to-navigation-request-of-type-from-source-in-target-be-blocked-by-content-security-policy hrefhttps://w3c.github.io/webappsec-csp/#should-block-navigation-response data-x-internalshould-navigation-response-to-navigation-request-of-type-from-source-in-target-be-blocked-by-content-security-policy>Should navigation response to navigation request of type from source in target be blocked by Content Security Policy?/a> algorithm returns code>Blocked/code> when executed upon var>request/var>, var>response/var>, var>navigationType/var>, var>source/var>, and var>browsingContext/var>. a href#refsCSP>CSP/a>/ul> p classnote>This is where the network errors defined and propagated by the WHATWG Fetch standard, such as DNS or TLS errors, end up being displayed to users. a href#refsFETCH>FETCH/a>/p> li>p>If var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-status idnavigating-across-documents:concept-response-status-4 data-x-internalconcept-response-status>status/a> is code>204/code> or code>205/code>, then abort these steps.li>p>If var>response/var> has an `code idnavigating-across-documents:http-content-disposition>a data-x-internalhttp-content-disposition hrefhttps://tools.ietf.org/html/rfc6266>Content-Disposition/a>/code>` header specifying the code>attachment/code> disposition type, then handle it a href#as-a-download idnavigating-across-documents:as-a-download>as a download/a> and abort these steps.li>p>Let var>type/var> be the a hrefhttps://mimesniff.spec.whatwg.org/#computed-mime-type idnavigating-across-documents:content-type-sniffing-2 data-x-internalcontent-type-sniffing-2>computed type of var>response/var>/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 idnavigating-across-documents:browsing-context-7>browsing context/a>, then skip this step. Otherwise, if the var>type/var> is one of the following types, jump to the appropriate entry in the following list, and process var>response/var> as described there:/p> dl classswitch>dt>an a idnavigating-across-documents:html-mime-type hrefhttps://mimesniff.spec.whatwg.org/#html-mime-type data-x-internalhtml-mime-type>HTML MIME type/a>dd>Follow the steps given in the a href#read-html idnavigating-across-documents:read-html>HTML document/a> section, and then, once they have completed, abort this a href#navigate idnavigating-across-documents:navigate-6>navigate/a> algorithm.dt>an a idnavigating-across-documents:xml-mime-type hrefhttps://mimesniff.spec.whatwg.org/#xml-mime-type data-x-internalxml-mime-type>XML MIME type/a> that is not an a href#explicitly-supported-xml-type idnavigating-across-documents:explicitly-supported-xml-type>explicitly supported XML type/a>dd>Follow the steps given in the a href#read-xml idnavigating-across-documents:read-xml>XML document/a> section. If that section determines that the content is em>not/em> to be displayed as a generic XML document, then proceed to the next step in this overall set of steps. Otherwise, once the steps given in the a href#read-xml idnavigating-across-documents:read-xml-2>XML document/a> section have completed, abort this a href#navigate idnavigating-across-documents:navigate-7>navigate/a> algorithm.dt>a a href#javascript-mime-type idnavigating-across-documents:javascript-mime-type>JavaScript MIME type/a>dt>a a href#json-mime-type idnavigating-across-documents:json-mime-type>JSON MIME type/a> that is not an a href#explicitly-supported-json-type idnavigating-across-documents:explicitly-supported-json-type>explicitly supported JSON type/a>dt>code idnavigating-across-documents:text/cache-manifest>a href#text/cache-manifest>text/cache-manifest/a>/code>dt>code idnavigating-across-documents:text/css>a href#text/css>text/css/a>/code>dt>code idnavigating-across-documents:text/plain>a data-x-internaltext/plain hrefhttps://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain/a>/code>dt>code idnavigating-across-documents:text/vtt>a href#text/vtt>text/vtt/a>/code>dd>Follow the steps given in the a href#read-text idnavigating-across-documents:read-text>plain text file/a> section, and then, once they have completed, abort this a href#navigate idnavigating-across-documents:navigate-8>navigate/a> algorithm.dt>code idnavigating-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 idnavigating-across-documents:read-multipart-x-mixed-replace>multipart/x-mixed-replace/a> section, and then, once they have completed, abort this a href#navigate idnavigating-across-documents:navigate-9>navigate/a> algorithm.dt>A supported image, video, or audio typedd>Follow the steps given in the a href#read-media idnavigating-across-documents:read-media>media/a> section, and then, once they have completed, abort this a href#navigate idnavigating-across-documents:navigate-10>navigate/a> algorithm.dt>A type that will use an external application to render the content in var>browsingContext/var>dd>Follow the steps given in the a href#read-plugin idnavigating-across-documents:read-plugin>plugin/a> section, and then, once they have completed, abort this a href#navigate idnavigating-across-documents:navigate-11>navigate/a> algorithm./dl> p>An dfn idexplicitly-supported-xml-type>explicitly supported XML type/dfn> is one for which the user agent is configured to use an external application to render the content (either a a href#plugin idnavigating-across-documents:plugin>plugin/a> rendering directly in var>browsingContext/var>, or a separate application), or one for which the user agent has dedicated processing rules (e.g. a Web browser with a built-in Atom feed viewer would be said to explicitly support the code idnavigating-across-documents:application/atom+xml>a href#application/atom+xml>application/atom+xml/a>/code> MIME type), or one for which the user agent has a dedicated handler./p> p>The term dfn idjson-mime-type>JSON MIME type/dfn> is used to refer to the a hrefhttps://mimesniff.spec.whatwg.org/#mime-type idnavigating-across-documents:mime-type data-x-internalmime-type>MIME types/a> code idnavigating-across-documents:application/json>a href#application/json>application/json/a>/code>, code idnavigating-across-documents:text/json>a href#text/json>text/json/a>/code>, and any a idnavigating-across-documents:mime-type-2 hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> whose subtype ends with the five characters code>+json/code>. p>An dfn idexplicitly-supported-json-type>explicitly supported JSON type/dfn> is one for which the user agent is configured to use an external application to render the content (either a a href#plugin idnavigating-across-documents:plugin-2>plugin/a> rendering directly in var>browsingContext/var>, or a separate application), or one for which the user agent has dedicated processing rules, or one for which the user agent has a dedicated handler./p> p>dfn idset-the-documents-address>Setting the documents address/dfn>: If there is no dfn idoverride-url>override URL/dfn>, then any code idnavigating-across-documents:document-4>a href#document>Document/a>/code> created by these steps must have its a hrefhttps://dom.spec.whatwg.org/#concept-document-url idnavigating-across-documents:the-documents-address-4 data-x-internalthe-documents-address>URL/a> set to the a idnavigating-across-documents:url-7 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> that was originally to be fetched, ignoring any other data that was used to obtain the resource. However, if there em>is/em> an a href#override-url idnavigating-across-documents:override-url-2>override URL/a>, then any code idnavigating-across-documents:document-5>a href#document>Document/a>/code> created by these steps must have its a hrefhttps://dom.spec.whatwg.org/#concept-document-url idnavigating-across-documents:the-documents-address-5 data-x-internalthe-documents-address>URL/a> set to that a idnavigating-across-documents:url-8 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> instead./p> p classnote>An a href#override-url idnavigating-across-documents:override-url-3>override URL/a> is set when a href#javascript-protocol idnavigating-across-documents:javascript-protocol-4>dereferencing a code>javascript:/code> URL/a> and when performing a href#an-overridden-reload idnavigating-across-documents:an-overridden-reload>an overridden reload/a>./p> p>dfn idinitialise-the-document-object data-export>Initializing a new code>Document/code> object/dfn>: when a code idnavigating-across-documents:document-6>a href#document>Document/a>/code> is created as part of the above steps, the user agent will be required to additionally run the following algorithm after creating the new object:/p> ol>li>p>If var>browsingContext/var>s only entry in its a href#session-history idnavigating-across-documents:session-history>session history/a> is the code idnavigating-across-documents:about:blank>a href#about:blank>about:blank/a>/code> code idnavigating-across-documents:document-7>a href#document>Document/a>/code> that was added when var>browsingContext/var> was a href#creating-a-new-browsing-context idnavigating-across-documents:creating-a-new-browsing-context>created/a>, and navigation is occurring with a href#replacement-enabled idnavigating-across-documents:replacement-enabled-3>replacement enabled/a>, and that code idnavigating-across-documents:document-8>a href#document>Document/a>/code> has the a href#same-origin idnavigating-across-documents:same-origin-5>same origin/a> as the new code idnavigating-across-documents:document-9>a href#document>Document/a>/code>, then do nothing.li> p>Otherwise:/p> ol>li> p>Call the JavaScript a hrefhttps://tc39.github.io/ecma262/#sec-initializehostdefinedrealm idnavigating-across-documents:js-initializehostdefinedrealm data-x-internaljs-initializehostdefinedrealm>InitializeHostDefinedRealm()/a> abstract operation with the following customizations:/p> ul>li>p>For the global object, create a new code idnavigating-across-documents:window-2>a href#window>Window/a>/code> object.li>p>For the global b>this/b> value, use var>browsingContext/var>s code idnavigating-across-documents:windowproxy>a href#windowproxy>WindowProxy/a>/code> object.li>p>Let var>realm execution context/var> be the created a idnavigating-across-documents:javascript-execution-context hrefhttps://tc39.github.io/ecma262/#sec-execution-contexts data-x-internaljavascript-execution-context>JavaScript execution context/a>./ul> li>p>a href#set-up-a-window-environment-settings-object idnavigating-across-documents:set-up-a-window-environment-settings-object>Set up a window environment settings object/a> with var>realm execution context/var> and var>reservedEnvironment/var>, if present./ol> li>p>Set the code idnavigating-across-documents:document-10>a href#document>Document/a>/code>s a href#concept-document-https-state idnavigating-across-documents:concept-document-https-state>HTTPS state/a> to the a hrefhttps://fetch.spec.whatwg.org/#concept-response-https-state idnavigating-across-documents:concept-response-https-state-2 data-x-internalconcept-response-https-state>HTTPS state/a> of var>response/var>.li>p>Set the code idnavigating-across-documents:document-11>a href#document>Document/a>/code>s a href#concept-document-referrer-policy idnavigating-across-documents:concept-document-referrer-policy>referrer policy/a> to the result of a hrefhttps://w3c.github.io/webappsec-referrer-policy/#parse-referrer-policy-from-header idnavigating-across-documents:parse-referrer-policy-header data-x-internalparse-referrer-policy-header>parsing the `code>Referrer-Policy/code>` header/a> of var>response/var>. a href#refsREFERRERPOLICY>REFERRERPOLICY/a>li>p>Execute the a idnavigating-across-documents:initialize-a-documents-csp-list hrefhttps://w3c.github.io/webappsec-csp/#initialize-document-csp data-x-internalinitialize-a-documents-csp-list>Initialize a code>Document/code>s CSP list/a> algorithm on the code idnavigating-across-documents:document-12>a href#document>Document/a>/code> object and the a hrefhttps://fetch.spec.whatwg.org/#concept-response idnavigating-across-documents:concept-response-5 data-x-internalconcept-response>response/a> used to generate the document. a href#refsCSP>CSP/a>/p> li> p>If var>request/var> is non-null, then set a href#the-documents-referrer idnavigating-across-documents:the-documents-referrer>the documents referrer/a> to the a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idnavigating-across-documents:concept-url-serializer-2 data-x-internalconcept-url-serializer>serialization/a> of var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-referrer idnavigating-across-documents:concept-request-referrer data-x-internalconcept-request-referrer>referrer/a>, if var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-referrer idnavigating-across-documents:concept-request-referrer-2 data-x-internalconcept-request-referrer>referrer/a> is a a idnavigating-across-documents:url-record hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a>, and the empty string otherwise./p> p classnote>Per the WHATWG Fetch standard a a hrefhttps://fetch.spec.whatwg.org/#concept-request idnavigating-across-documents:concept-request-9 data-x-internalconcept-request>request/a>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-referrer idnavigating-across-documents:concept-request-referrer-3 data-x-internalconcept-request-referrer>referrer/a> will be either a a idnavigating-across-documents:url-record-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a> or code>no-referrer/code> at this point./p> li>p>a href#implement-the-sandboxing idnavigating-across-documents:implement-the-sandboxing>Implement the sandboxing/a> for the code idnavigating-across-documents:document-13>a href#document>Document/a>/code>.li>p>a href#set-the-allow*-flags idnavigating-across-documents:set-the-allow*-flags>Set the allow* flags/a> for the code idnavigating-across-documents:document-14>a href#document>Document/a>/code>.li> p>If var>response/var> has a `code idnavigating-across-documents:refresh>a href#refresh>Refresh/a>/code>` header, then:/p> ol>li>p classXXX>a hrefhttps://github.com/whatwg/html/issues/2900>Multiple `code>Refresh/code>` headers/a>.li>p>Let var>value/var> be the value of the header with each byte mapped to a code point of equal value.li>p>Run the a href#shared-declarative-refresh-steps idnavigating-across-documents:shared-declarative-refresh-steps>shared declarative refresh steps/a> with the code idnavigating-across-documents:document-15>a href#document>Document/a>/code> and var>value/var>./ol> /ol> li idnavigate-non-Document>p>i>Non-document content/i>: If, given var>type/var>, the new resource is to be handled by displaying some sort of inline content, e.g., a native rendering of the content or an error message because the specified type is not supported, then a href#read-ua-inline idnavigating-across-documents:read-ua-inline-2>display the inline content/a>, and then abort these steps.li>p>Otherwise, the documents var>type/var> is such that the resource will not affect var>browsingContext/var>, e.g., because the resource is to be handed to an external application or because it is an unknown type that will be processed a href#as-a-download idnavigating-across-documents:as-a-download-2>as a download/a>. a href#hand-off-to-external-software idnavigating-across-documents:hand-off-to-external-software>Process the resource appropriately/a>./p> /ol> p>To dfn idprocess-a-navigate-url-scheme>process a navigate URL scheme/dfn>, given a a idnavigating-across-documents:url-9 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> var>url/var> and a href#browsing-context idnavigating-across-documents:browsing-context-8>browsing context/a> var>browsingContext/var>, run these steps:/p> ol>li>p>If var>url/var> is to be handled using a mechanism that does not affect var>browsingContext/var>, e.g., because var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idnavigating-across-documents:concept-url-scheme-7 data-x-internalconcept-url-scheme>scheme/a> is handled externally, then a href#hand-off-to-external-software idnavigating-across-documents:hand-off-to-external-software-2>proceed with that mechanism instead/a>.li> p>Otherwise, var>url/var> is to be handled by displaying some sort of inline content, e.g., an error message because the specified scheme is not one of the supported protocols, or an inline prompt to allow the user to select a href#dom-navigator-registerprotocolhandler idnavigating-across-documents:dom-navigator-registerprotocolhandler>a registered handler/a> for the given scheme. a href#read-ua-inline idnavigating-across-documents:read-ua-inline-3>Display the inline content/a>./p> p classnote>In the case of a registered handler being used, a href#navigate idnavigating-across-documents:navigate-12>navigate/a> will be invoked with a new URL./p> /ol> p>When a resource is handled by dfn idhand-off-to-external-software>passing its URL or data to an external software package/dfn> separate from the user agent (e.g. handing a code idnavigating-across-documents:mailto-protocol-2>a data-x-internalmailto-protocol hrefhttps://tools.ietf.org/html/rfc6068#section-2>mailto:/a>/code> URL to a mail client, or a Word document to a word processor), user agents should attempt to mitigate the risk that this is an attempt to exploit the target software, e.g. by prompting the user to confirm that the a href#source-browsing-context idnavigating-across-documents:source-browsing-context-10>source browsing context/a>s a href#active-document idnavigating-across-documents:active-document-12>active document/a>s a href#concept-origin idnavigating-across-documents:concept-origin-4>origin/a> is to be allowed to invoke the specified software. In particular, if the a href#navigate idnavigating-across-documents:navigate-13>navigate/a> algorithm, when it was invoked, was not a href#triggered-by-user-activation idnavigating-across-documents:triggered-by-user-activation>triggered by user activation/a>, the user agent should not invoke the external software package without prior user confirmation./p> p classexample>For example, there could be a vulnerability in the target softwares URL handler which a hostile page would attempt to exploit by tricking a user into clicking a link./p> hr> p>Some of the sections below, to which the above algorithm defers in certain cases, require the user agent to dfn idupdate-the-session-history-with-the-new-page>update the session history with the new page/dfn>. When a user agent is required to do this, it must a href#queue-a-task idnavigating-across-documents:queue-a-task-2>queue a task/a> (associated with the code idnavigating-across-documents:document-16>a href#document>Document/a>/code> object of the a href#current-entry idnavigating-across-documents:current-entry>current entry/a>, not the new one) to run the following steps:/p> ol>li> p>a href#unload-a-document idnavigating-across-documents:unload-a-document-2>Unload/a> the code idnavigating-across-documents:document-17>a href#document>Document/a>/code> object of the a href#current-entry idnavigating-across-documents:current-entry-2>current entry/a>, with the var>recycle/var> parameter set to false./p> p>If this instance of the a href#navigate idnavigating-across-documents:navigate-14>navigation/a> algorithm is canceled while this step is running the a href#unload-a-document idnavigating-across-documents:unload-a-document-3>unload a document/a> algorithm, then the a href#unload-a-document idnavigating-across-documents:unload-a-document-4>unload a document/a> algorithm must be allowed to run to completion, but this instance of the a href#navigate idnavigating-across-documents:navigate-15>navigation/a> algorithm must not run beyond this step. (In particular, for instance, the cancelation of this algorithm does not abort any event dispatch or script execution occurring as part of unloading the document or its descendants.)/p> li> dl>dt>If the navigation was initiated for dfn identry-update>entry update/dfn> of an entrydd> ol>li>p>Replace the code idnavigating-across-documents:document-18>a href#document>Document/a>/code> of the entry being updated, and any other entries that referenced the same document as that entry, with the new code idnavigating-across-documents:document-19>a href#document>Document/a>/code>.li>p>a href#traverse-the-history idnavigating-across-documents:traverse-the-history>Traverse the history/a> to the new entry./ol> dt>If the navigation was initiated with a a idnavigating-across-documents:url-10 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> that a hrefhttps://url.spec.whatwg.org/#concept-url-equals idnavigating-across-documents:concept-url-equals-2 data-x-internalconcept-url-equals>equals/a> the a href#browsing-context idnavigating-across-documents:browsing-context-9>browsing context/a>s a href#active-document idnavigating-across-documents:active-document-13>active document/a>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url idnavigating-across-documents:the-documents-address-6 data-x-internalthe-documents-address>URL/a>dd> ol>li>p>Replace the a href#current-entry idnavigating-across-documents:current-entry-3>current entry/a> with a new entry representing the new resource and its code idnavigating-across-documents:document-20>a href#document>Document/a>/code> object, related state, and the default a href#scroll-restoration-mode idnavigating-across-documents:scroll-restoration-mode>scroll restoration mode/a> of code idnavigating-across-documents:dom-scrollrestoration-auto>a href#dom-scrollrestoration-auto>auto/a>/code>.li>p>a href#traverse-the-history idnavigating-across-documents:traverse-the-history-2>Traverse the history/a> to the new entry./ol> dt>Otherwisedd> ol>li> p>Remove all the entries in the a href#browsing-context idnavigating-across-documents:browsing-context-10>browsing context/a>s a href#session-history idnavigating-across-documents:session-history-2>session history/a> after the a href#current-entry idnavigating-across-documents:current-entry-4>current entry/a>. If the a href#current-entry idnavigating-across-documents:current-entry-5>current entry/a> is the last entry in the session history, then no entries are removed./p> p classnote>This a href#history-notes>doesnt necessarily have to affect/a> the user agents user interface./p> li>p>Append a new entry at the end of the code idnavigating-across-documents:history-3>a href#history-3>History/a>/code> object representing the new resource and its code idnavigating-across-documents:document-21>a href#document>Document/a>/code> object, related state, and the default a href#scroll-restoration-mode idnavigating-across-documents:scroll-restoration-mode-2>scroll restoration mode/a> of code idnavigating-across-documents:dom-scrollrestoration-auto-2>a href#dom-scrollrestoration-auto>auto/a>/code>.li>p>a href#traverse-the-history idnavigating-across-documents:traverse-the-history-3>Traverse the history/a> to the new entry. If the navigation was initiated with a href#replacement-enabled idnavigating-across-documents:replacement-enabled-4>replacement enabled/a>, then the traversal must itself be initiated with a href#replacement-enabled idnavigating-across-documents:replacement-enabled-5>replacement enabled/a>./p> /ol> /dl> li>p>The a href#navigate idnavigating-across-documents:navigate-16>navigation algorithm/a> has now dfn idconcept-navigate-mature>matured/dfn>.li>p>i>Fragment loop/i>: a href#spin-the-event-loop idnavigating-across-documents:spin-the-event-loop>Spin the event loop/a> for a user-agent-defined amount of time, as desired by the user agent implementor. (This is intended to allow the user agent to optimize the user experience in the face of performance concerns.)li>p>If the code idnavigating-across-documents:document-22>a href#document>Document/a>/code> object has no parser, or its parser has a href#stop-parsing idnavigating-across-documents:stop-parsing>stopped parsing/a>, or the user agent has reason to believe the user is no longer interested in scrolling to the a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idnavigating-across-documents:concept-url-fragment-2 data-x-internalconcept-url-fragment>fragment/a>, then abort these steps.li>p>a href#scroll-to-the-fragment-identifier idnavigating-across-documents:scroll-to-the-fragment-identifier>Scroll to the fragment/a> given in the documents a hrefhttps://dom.spec.whatwg.org/#concept-document-url idnavigating-across-documents:the-documents-address-7 data-x-internalthe-documents-address>URL/a>. If this fails to find a href#the-indicated-part-of-the-document idnavigating-across-documents:the-indicated-part-of-the-document>an indicated part of the document/a>, then return to the i>fragment loop/i> step./ol> p>The a href#task-source idnavigating-across-documents:task-source-2>task source/a> for this a href#concept-task idnavigating-across-documents:concept-task-3>task/a> is the a href#networking-task-source idnavigating-across-documents:networking-task-source-2>networking task source/a>./p> h4 idread-html>span classsecno>7.8.2/span> dfn>Page load processing model for HTML files/dfn>a href#read-html classself-link>/a>/h4> p>When an HTML document is to be loaded in a a href#browsing-context idread-html:browsing-context>browsing context/a>, the user agent must a href#queue-a-task idread-html:queue-a-task>queue a task/a> to create a code idread-html:document>a href#document>Document/a>/code> object, mark it as being an a hrefhttps://dom.spec.whatwg.org/#html-document idread-html:html-documents data-x-internalhtml-documents>HTML document/a>, set its a hrefhttps://dom.spec.whatwg.org/#concept-document-content-type idread-html:concept-document-content-type data-x-internalconcept-document-content-type>content type/a> to code>text/html/code>, a href#initialise-the-document-object idread-html:initialise-the-document-object>initialize the code>Document/code> object/a>, and finally create an a href#html-parser idread-html:html-parser>HTML parser/a> and associate it with the code idread-html:document-2>a href#document>Document/a>/code>. Each a href#concept-task idread-html:concept-task>task/a> that the a href#networking-task-source idread-html:networking-task-source>networking task source/a> places on the a href#task-queue idread-html:task-queue>task queue/a> while fetching runs must then fill the parsers a href#the-input-byte-stream idread-html:the-input-byte-stream>input byte stream/a> with the fetched bytes and cause the a href#html-parser idread-html:html-parser-2>HTML parser/a> to perform the appropriate processing of the input stream./p> p classnote>The a href#the-input-byte-stream idread-html:the-input-byte-stream-2>input byte stream/a> converts bytes into characters for use in the a href#tokenization idread-html:tokenization>tokenizer/a>. This process relies, in part, on character encoding information found in the real a href#content-type idread-html:content-type>Content-Type metadata/a> of the resource; the computed type is not used for this purpose./p> p>When no more bytes are available, the user agent must a href#queue-a-task idread-html:queue-a-task-2>queue a task/a> for the parser to process the implied EOF character, which eventually causes a code idread-html:event-load>a href#event-load>load/a>/code> event to be fired./p> p>After creating the code idread-html:document-3>a href#document>Document/a>/code> object, but before any script execution, certainly before the parser a href#stop-parsing idread-html:stop-parsing>stops/a>, the user agent must a href#update-the-session-history-with-the-new-page idread-html:update-the-session-history-with-the-new-page>update the session history with the new page/a>./p> p classnote>a href#concept-appcache-init idread-html:concept-appcache-init>Application cache selection/a> happens a href#parser-appcache>in the HTML parser/a>./p> p>The a href#task-source idread-html:task-source>task source/a> for the two tasks mentioned in this section must be the a href#networking-task-source idread-html:networking-task-source-2>networking task source/a>./p> h4 idread-xml>span classsecno>7.8.3/span> dfn>Page load processing model for XML files/dfn>a href#read-xml classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id17976 titlexml-stylesheet with typetext/xsl needs to be handled explicitly>17976/a>/div> p>When faced with displaying an XML file inline, user agents must follow the requirements defined in the XML and Namespaces in XML recommendations, RFC 7303, DOM, and other relevant specifications to create a code idread-xml:document>a href#document>Document/a>/code> object and a corresponding a href#xml-parser idread-xml:xml-parser>XML parser/a>. a href#refsXML>XML/a> a href#refsXMLNS>XMLNS/a> a href#refsRFC7303>RFC7303/a> a href#refsDOM>DOM/a>/p> p classnote>At the time of writing, the XML specification community had not actually yet specified how XML and the DOM interact./p> p>After the code idread-xml:document-2>a href#document>Document/a>/code> is created, the user agent must a href#initialise-the-document-object idread-xml:initialise-the-document-object>initialize the code>Document/code> object/a>./p> p>The actual HTTP headers and other metadata, not the headers as mutated or implied by the algorithms given in this specification, are the ones that must be used when determining the character encoding according to the rules given in the above specifications. Once the character encoding is established, the a idread-xml:documents-character-encoding hrefhttps://dom.spec.whatwg.org/#concept-document-encoding data-x-internaldocuments-character-encoding>documents character encoding/a> must be set to that character encoding./p> p>If the a idread-xml:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>, as parsed according to the XML specifications cited above, is found to be an code idread-xml:the-html-element>a href#the-html-element>html/a>/code> element with an attribute code idread-xml:attr-html-manifest>a href#attr-html-manifest>manifest/a>/code> whose value is not the empty string, then, as soon as the element is a href#insert-an-element-into-a-document idread-xml:insert-an-element-into-a-document>inserted into the document/a>, the user agent must a href#parse-a-url idread-xml:parse-a-url>parse/a> the value of that attribute relative to that elements a idread-xml:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, and if that is successful, must apply the a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idread-xml:concept-url-serializer data-x-internalconcept-url-serializer>URL serializer/a> algorithm to the a href#resulting-url-record idread-xml:resulting-url-record>resulting URL record/a> with the i>exclude fragment flag/i> set to obtain var>manifest URL/var>, and then run the a href#concept-appcache-init idread-xml:concept-appcache-init>application cache selection algorithm/a> with var>manifest URL/var> as the manifest URL, passing in the newly-created code idread-xml:document-3>a href#document>Document/a>/code>. Otherwise, if the attribute is absent, its value is the empty string, or parsing its value fails, then as soon as the a idread-xml:document-element-2 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> is a href#insert-an-element-into-a-document idread-xml:insert-an-element-into-a-document-2>inserted into the document/a>, the user agent must run the a href#concept-appcache-init idread-xml:concept-appcache-init-2>application cache selection algorithm/a> with no manifest, and passing in the code idread-xml:document-4>a href#document>Document/a>/code>./p> p classnote>Because the processing of the code idread-xml:attr-html-manifest-2>a href#attr-html-manifest>manifest/a>/code> attribute happens only once the a idread-xml:document-element-3 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> is parsed, any URLs referenced by processing instructions before the a idread-xml:document-element-4 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> (such as code><?xml-stylesheet?>/code> PIs) will be fetched from the network and cannot be cached./p> p>User agents may examine the namespace of the root code idread-xml:element>a data-x-internalelement hrefhttps://dom.spec.whatwg.org/#interface-element>Element/a>/code> node of this code idread-xml:document-5>a href#document>Document/a>/code> object to perform namespace-based dispatch to alternative processing tools, e.g. determining that the content is actually a syndication feed and passing it to a feed handler. If such processing is to take place, abort the steps in this section, and jump to a href#navigate-non-Document>the next step/a> (labeled i>non-document content/i>) in the a href#navigate idread-xml:navigate>navigate/a> steps above./p> p>Otherwise, then, with the newly created code idread-xml:document-6>a href#document>Document/a>/code>, the user agent must a href#update-the-session-history-with-the-new-page idread-xml:update-the-session-history-with-the-new-page>update the session history with the new page/a>. User agents may do this before the complete document has been parsed (thus achieving i>incremental rendering/i>), and must do this before any scripts are to be executed./p> p>Error messages from the parse process (e.g. XML namespace well-formedness errors) may be reported inline by mutating the code idread-xml:document-7>a href#document>Document/a>/code>./p> h4 idread-text>span classsecno>7.8.4/span> dfn>Page load processing model for text files/dfn>a href#read-text classself-link>/a>/h4> p>When a plain text document is to be loaded in a a href#browsing-context idread-text:browsing-context>browsing context/a>, the user agent must a href#queue-a-task idread-text:queue-a-task>queue a task/a> to create a code idread-text:document>a href#document>Document/a>/code> object, mark it as being an a hrefhttps://dom.spec.whatwg.org/#html-document idread-text:html-documents data-x-internalhtml-documents>HTML document/a>, set its a hrefhttps://dom.spec.whatwg.org/#concept-document-content-type idread-text:concept-document-content-type data-x-internalconcept-document-content-type>content type/a> to the a hrefhttps://mimesniff.spec.whatwg.org/#computed-mime-type idread-text:content-type-sniffing-2 data-x-internalcontent-type-sniffing-2>computed MIME type/a> of the resource (var>type/var> in the a href#navigate idread-text:navigate>navigate/a> algorithm), a href#initialise-the-document-object idread-text:initialise-the-document-object>initialize the code>Document/code> object/a>, create an a href#html-parser idread-text:html-parser>HTML parser/a>, associate it with the code idread-text:document-2>a href#document>Document/a>/code>, act as if the tokenizer had emitted a start tag token with the tag name pre followed by a single U+000A LINE FEED (LF) character, and switch the a href#html-parser idread-text:html-parser-2>HTML parser/a>s tokenizer to the a href#plaintext-state idread-text:plaintext-state>PLAINTEXT state/a>. Each a href#concept-task idread-text:concept-task>task/a> that the a href#networking-task-source idread-text:networking-task-source>networking task source/a> places on the a href#task-queue idread-text:task-queue>task queue/a> while fetching runs must then fill the parsers a href#the-input-byte-stream idread-text:the-input-byte-stream>input byte stream/a> with the fetched bytes and cause the a href#html-parser idread-text:html-parser-3>HTML parser/a> to perform the appropriate processing of the input stream./p> p>The rules for how to convert the bytes of the plain text document into actual characters, and the rules for actually rendering the text to the user, are defined by the specifications for the a hrefhttps://mimesniff.spec.whatwg.org/#computed-mime-type idread-text:content-type-sniffing-2-2 data-x-internalcontent-type-sniffing-2>computed MIME type/a> of the resource (var>type/var> in the a href#navigate idread-text:navigate-2>navigate/a> algorithm)./p> p>The a idread-text:documents-character-encoding hrefhttps://dom.spec.whatwg.org/#concept-document-encoding data-x-internaldocuments-character-encoding>documents character encoding/a> must be set to the character encoding used to decode the document./p> p>Upon creation of the code idread-text:document-3>a href#document>Document/a>/code> object, the user agent must run the a href#concept-appcache-init idread-text:concept-appcache-init>application cache selection algorithm/a> with no manifest, and passing in the newly-created code idread-text:document-4>a href#document>Document/a>/code>./p> p>When no more bytes are available, the user agent must a href#queue-a-task idread-text:queue-a-task-2>queue a task/a> for the parser to process the implied EOF character, which eventually causes a code idread-text:event-load>a href#event-load>load/a>/code> event to be fired./p> p>After creating the code idread-text:document-5>a href#document>Document/a>/code> object, but potentially before the page has finished parsing, the user agent must a href#update-the-session-history-with-the-new-page idread-text:update-the-session-history-with-the-new-page>update the session history with the new page/a>./p> p>User agents may add content to the code idread-text:the-head-element>a href#the-head-element>head/a>/code> element of the code idread-text:document-6>a href#document>Document/a>/code>, e.g., linking to a style sheet, providing script, or giving the document a code idread-text:the-title-element>a href#the-title-element>title/a>/code>./p> p classnote>In particular, if the user agent supports the code>FormatFlowed/code> feature of RFC 3676 then the user agent would need to apply extra styling to cause the text to wrap correctly and to handle the quoting feature. This could be performed using, e.g., a CSS extension./p> p>The a href#task-source idread-text:task-source>task source/a> for the two tasks mentioned in this section must be the a href#networking-task-source idread-text:networking-task-source-2>networking task source/a>./p> h4 idread-multipart-x-mixed-replace>span classsecno>7.8.5/span> dfn>Page load processing model for code>multipart/x-mixed-replace/code> resources/dfn>a href#read-multipart-x-mixed-replace classself-link>/a>/h4> p>When a resource with the type code idread-multipart-x-mixed-replace:multipart/x-mixed-replace>a href#multipart/x-mixed-replace>multipart/x-mixed-replace/a>/code> is to be loaded in a a href#browsing-context idread-multipart-x-mixed-replace:browsing-context>browsing context/a>, the user agent must parse the resource using the rules for multipart types. a href#refsRFC2046>RFC2046/a>/p> p>For each body part obtained from the resource, the user agent must run a href#process-a-navigate-response idread-multipart-x-mixed-replace:process-a-navigate-response>process a navigate response/a> using the new body part and the same a href#browsing-context idread-multipart-x-mixed-replace:browsing-context-2>browsing context/a>, with a href#replacement-enabled idread-multipart-x-mixed-replace:replacement-enabled>replacement enabled/a> if a previous body part from the same resource resulted in a code idread-multipart-x-mixed-replace:document>a href#document>Document/a>/code> object being created and a href#initialise-the-document-object idread-multipart-x-mixed-replace:initialise-the-document-object>initialized/a>, and otherwise using the same setup as the a href#navigate idread-multipart-x-mixed-replace:navigate>navigate/a> attempt that caused this section to be invoked in the first place./p> p>For the purposes of algorithms processing these body parts as if they were complete stand-alone resources, the user agent must act as if there were no more bytes for those resources whenever the boundary following the body part is reached./p> p classnote>Thus, code idread-multipart-x-mixed-replace:event-load>a href#event-load>load/a>/code> events (and for that matter code idread-multipart-x-mixed-replace:event-unload>a href#event-unload>unload/a>/code> events) do fire for each body part loaded./p> h4 idread-media>span classsecno>7.8.6/span> dfn>Page load processing model for media/dfn>a href#read-media classself-link>/a>/h4> p>When an image, video, or audio resource is to be loaded in a a href#browsing-context idread-media:browsing-context>browsing context/a>, the user agent should create a code idread-media:document>a href#document>Document/a>/code> object, mark it as being an a hrefhttps://dom.spec.whatwg.org/#html-document idread-media:html-documents data-x-internalhtml-documents>HTML document/a>, set its a hrefhttps://dom.spec.whatwg.org/#concept-document-content-type idread-media:concept-document-content-type data-x-internalconcept-document-content-type>content type/a> to the a hrefhttps://mimesniff.spec.whatwg.org/#computed-mime-type idread-media:content-type-sniffing-2 data-x-internalcontent-type-sniffing-2>computed MIME type/a> of the resource (var>type/var> in the a href#navigate idread-media:navigate>navigate/a> algorithm), a href#initialise-the-document-object idread-media:initialise-the-document-object>initialize the code>Document/code> object/a>, append an code idread-media:the-html-element>a href#the-html-element>html/a>/code> element to the code idread-media:document-2>a href#document>Document/a>/code>, append a code idread-media:the-head-element>a href#the-head-element>head/a>/code> element and a code idread-media:the-body-element>a href#the-body-element>body/a>/code> element to the code idread-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 idread-media:the-body-element-2>a href#the-body-element>body/a>/code> element, and set the appropriate attribute of the element var>host element/var>, as described below, to the address of the image, video, or audio resource./p> p>The element var>host element/var> to create for the media is the element given in the table below in the second cell of the row whose first cell describes the media. The appropriate attribute to set is the one given by the third cell in that same row./p> table>thead>tr>th> Type of media th> Element for the media th> Appropriate attribute tbody>tr>td> Image td> code idread-media:the-img-element>a href#the-img-element>img/a>/code> td> code idread-media:attr-img-src>a href#attr-img-src>src/a>/code> tr>td> Video td> code idread-media:the-video-element>a href#the-video-element>video/a>/code> td> code idread-media:attr-media-src>a href#attr-media-src>src/a>/code> tr>td> Audio td> code idread-media:the-audio-element>a href#the-audio-element>audio/a>/code> td> code idread-media:attr-media-src-2>a href#attr-media-src>src/a>/code> /table> p>Then, the user agent must act as if it had a href#stop-parsing idread-media:stop-parsing>stopped parsing/a>./p> p>Upon creation of the code idread-media:document-3>a href#document>Document/a>/code> object, the user agent must run the a href#concept-appcache-init idread-media:concept-appcache-init>application cache selection algorithm/a> with no manifest, and passing in the newly-created code idread-media:document-4>a href#document>Document/a>/code>./p> p>After creating the code idread-media:document-5>a href#document>Document/a>/code> object, but potentially before the page has finished fully loading, the user agent must a href#update-the-session-history-with-the-new-page idread-media:update-the-session-history-with-the-new-page>update the session history with the new page/a>./p> p>User agents may add content to the code idread-media:the-head-element-2>a href#the-head-element>head/a>/code> element of the code idread-media:document-6>a href#document>Document/a>/code>, or attributes to the element var>host element/var>, e.g., to link to a style sheet, to provide a script, to give the document a code idread-media:the-title-element>a href#the-title-element>title/a>/code>, or to make the media a href#attr-media-autoplay idread-media:attr-media-autoplay>autoplay/a>./p> h4 idread-plugin>span classsecno>7.8.7/span> dfn>Page load processing model for content that uses plugins/dfn>a href#read-plugin classself-link>/a>/h4> p>When a resource that requires an external resource to be rendered is to be loaded in a a href#browsing-context idread-plugin:browsing-context>browsing context/a>, the user agent should create a code idread-plugin:document>a href#document>Document/a>/code> object, mark it as being an a hrefhttps://dom.spec.whatwg.org/#html-document idread-plugin:html-documents data-x-internalhtml-documents>HTML document/a> and mark it as being a dfn idplugin-document>plugin document/dfn>, set its a hrefhttps://dom.spec.whatwg.org/#concept-document-content-type idread-plugin:concept-document-content-type data-x-internalconcept-document-content-type>content type/a> to the a hrefhttps://mimesniff.spec.whatwg.org/#computed-mime-type idread-plugin:content-type-sniffing-2 data-x-internalcontent-type-sniffing-2>computed MIME type/a> of the resource (var>type/var> in the a href#navigate idread-plugin:navigate>navigate/a> algorithm), a href#initialise-the-document-object idread-plugin:initialise-the-document-object>initialize the code>Document/code> object/a>, append an code idread-plugin:the-html-element>a href#the-html-element>html/a>/code> element to the code idread-plugin:document-2>a href#document>Document/a>/code>, append a code idread-plugin:the-head-element>a href#the-head-element>head/a>/code> element and a code idread-plugin:the-body-element>a href#the-body-element>body/a>/code> element to the code idread-plugin:the-html-element-2>a href#the-html-element>html/a>/code> element, append an code idread-plugin:the-embed-element>a href#the-embed-element>embed/a>/code> to the code idread-plugin:the-body-element-2>a href#the-body-element>body/a>/code> element, and set the code idread-plugin:attr-embed-src>a href#attr-embed-src>src/a>/code> attribute of the code idread-plugin:the-embed-element-2>a href#the-embed-element>embed/a>/code> element to the address of the resource./p> p classnote>The term a href#plugin-document idread-plugin:plugin-document>plugin document/a> is used by cite>Content Security Policy/cite> as part of the mechanism that ensures code idread-plugin:the-iframe-element>a href#the-iframe-element>iframe/a>/code>s cant be used to evade code>plugin-types/code> directives. a href#refsCSP>CSP/a>/p> p>Then, the user agent must act as if it had a href#stop-parsing idread-plugin:stop-parsing>stopped parsing/a>./p> p>Upon creation of the code idread-plugin:document-3>a href#document>Document/a>/code> object, the user agent must run the a href#concept-appcache-init idread-plugin:concept-appcache-init>application cache selection algorithm/a> with no manifest, and passing in the newly-created code idread-plugin:document-4>a href#document>Document/a>/code>./p> p>After creating the code idread-plugin:document-5>a href#document>Document/a>/code> object, but potentially before the page has finished fully loading, the user agent must a href#update-the-session-history-with-the-new-page idread-plugin:update-the-session-history-with-the-new-page>update the session history with the new page/a>./p> p>User agents may add content to the code idread-plugin:the-head-element-2>a href#the-head-element>head/a>/code> element of the code idread-plugin:document-6>a href#document>Document/a>/code>, or attributes to the code idread-plugin:the-embed-element-3>a href#the-embed-element>embed/a>/code> element, e.g. to link to a style sheet or to give the document a code idread-plugin:the-title-element>a href#the-title-element>title/a>/code>./p> p idsandboxPluginNavigate classnote>If the code idread-plugin:document-7>a href#document>Document/a>/code>s a href#active-sandboxing-flag-set idread-plugin:active-sandboxing-flag-set>active sandboxing flag set/a> has its a href#sandboxed-plugins-browsing-context-flag idread-plugin:sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag/a> set, the synthesized code idread-plugin:the-embed-element-4>a href#the-embed-element>embed/a>/code> element will a href#sandboxPluginEmbed>fail to render the content/a> if the relevant a href#plugin idread-plugin:plugin>plugin/a> cannot be a href#concept-plugin-secure idread-plugin:concept-plugin-secure>secured/a>./p> h4 idread-ua-inline>span classsecno>7.8.8/span> dfn>Page load processing model for inline content that doesnt have a DOM/dfn>a href#read-ua-inline classself-link>/a>/h4> p>When the user agent is to display a user agent page inline in a a href#browsing-context idread-ua-inline:browsing-context>browsing context/a>, the user agent should create a code idread-ua-inline:document>a href#document>Document/a>/code> object, mark it as being an a hrefhttps://dom.spec.whatwg.org/#html-document idread-ua-inline:html-documents data-x-internalhtml-documents>HTML document/a>, set its a hrefhttps://dom.spec.whatwg.org/#concept-document-content-type idread-ua-inline:concept-document-content-type data-x-internalconcept-document-content-type>content type/a> to code>text/html/code>, a href#initialise-the-document-object idread-ua-inline:initialise-the-document-object>initialize the code>Document/code> object/a>, and then either associate that code idread-ua-inline:document-2>a href#document>Document/a>/code> with a custom rendering that is not rendered using the normal code idread-ua-inline:document-3>a href#document>Document/a>/code> rendering rules, or mutate that code idread-ua-inline:document-4>a href#document>Document/a>/code> until it represents the content the user agent wants to render./p> p>Once the page has been set up, the user agent must act as if it had a href#stop-parsing idread-ua-inline:stop-parsing>stopped parsing/a>./p> p>Upon creation of the code idread-ua-inline:document-5>a href#document>Document/a>/code> object, the user agent must run the a href#concept-appcache-init idread-ua-inline:concept-appcache-init>application cache selection algorithm/a> with no manifest, passing in the newly-created code idread-ua-inline:document-6>a href#document>Document/a>/code>./p> p>After creating the code idread-ua-inline:document-7>a href#document>Document/a>/code> object, but potentially before the page has been completely set up, the user agent must a href#update-the-session-history-with-the-new-page idread-ua-inline:update-the-session-history-with-the-new-page>update the session history with the new page/a>./p> h4 idscroll-to-fragid>span classsecno>7.8.9/span> dfn>Navigating to a fragment/dfn>a href#scroll-to-fragid classself-link>/a>/h4> p>When a user agent is supposed to navigate to a a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idscroll-to-fragid:concept-url-fragment data-x-internalconcept-url-fragment>fragment/a>, optionally with a href#replacement-enabled idscroll-to-fragid:replacement-enabled>replacement enabled/a>, then the user agent must run the following steps:/p> ol>li> p>If not with a href#replacement-enabled idscroll-to-fragid:replacement-enabled-2>replacement enabled/a>, then remove all the entries in the a href#browsing-context idscroll-to-fragid:browsing-context>browsing context/a>s a href#session-history idscroll-to-fragid:session-history>session history/a> after the a href#current-entry idscroll-to-fragid:current-entry>current entry/a>. If the a href#current-entry idscroll-to-fragid:current-entry-2>current entry/a> is the last entry in the session history, then no entries are removed./p> p classnote>This a href#history-notes>doesnt necessarily have to affect/a> the user agents user interface./p> li>p>Remove any a href#concept-task idscroll-to-fragid:concept-task>tasks/a> queued by the a href#history-traversal-task-source idscroll-to-fragid:history-traversal-task-source>history traversal task source/a> that are associated with any code idscroll-to-fragid:document>a href#document>Document/a>/code> objects in the a href#top-level-browsing-context idscroll-to-fragid:top-level-browsing-context>top-level browsing context/a>s a href#document-family idscroll-to-fragid:document-family>document family/a>.li>p>Append a new entry at the end of the code idscroll-to-fragid:history-3>a href#history-3>History/a>/code> object representing the new resource and its code idscroll-to-fragid:document-2>a href#document>Document/a>/code> object, related state, and a href#current-entry idscroll-to-fragid:current-entry-3>current entry/a>s a href#scroll-restoration-mode idscroll-to-fragid:scroll-restoration-mode>scroll restoration mode/a>. Its a idscroll-to-fragid:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> must be set to the address to which the user agent was a href#navigate idscroll-to-fragid:navigate>navigating/a>. The title must be left unset.li>p>a href#traverse-the-history idscroll-to-fragid:traverse-the-history>Traverse the history/a> to the new entry, with a href#replacement-enabled idscroll-to-fragid:replacement-enabled-3>replacement enabled/a> if this was invoked with a href#replacement-enabled idscroll-to-fragid:replacement-enabled-4>replacement enabled/a>, and with the i>non-blocking events/i> flag set. This will a href#scroll-to-the-fragment-identifier idscroll-to-fragid:scroll-to-the-fragment-identifier>scroll to the fragment/a> given in what is now the documents a hrefhttps://dom.spec.whatwg.org/#concept-document-url idscroll-to-fragid:the-documents-address data-x-internalthe-documents-address>URL/a>./ol> p classnote>If the scrolling fails because the relevant a hrefhttps://dom.spec.whatwg.org/#concept-id idscroll-to-fragid:concept-id data-x-internalconcept-id>ID/a> has not yet been parsed, then the original a href#navigate idscroll-to-fragid:navigate-2>navigation/a> algorithm will take care of the scrolling instead, as the last few steps of its a href#update-the-session-history-with-the-new-page idscroll-to-fragid:update-the-session-history-with-the-new-page>update the session history with the new page/a> algorithm./p> hr> p>When the user agent is required to dfn idscroll-to-the-fragment-identifier>scroll to the fragment/dfn> and a href#the-indicated-part-of-the-document idscroll-to-fragid:the-indicated-part-of-the-document>the indicated part of the document/a>, if any, is a href#being-rendered idscroll-to-fragid:being-rendered>being rendered/a>, the user agent must either change the scrolling position of the document using the following algorithm, or perform some other action such that a href#the-indicated-part-of-the-document idscroll-to-fragid:the-indicated-part-of-the-document-2>the indicated part of the document/a> is brought to the users attention. If there is no indicated part, or if the indicated part is not a href#being-rendered idscroll-to-fragid:being-rendered-2>being rendered/a>, then the user agent must do nothing. The aforementioned algorithm is as follows:/p> ol>li>p>If there is no a href#the-indicated-part-of-the-document idscroll-to-fragid:the-indicated-part-of-the-document-3>indicated part of the document/a>, set the code idscroll-to-fragid:document-3>a href#document>Document/a>/code>s a href#target-element idscroll-to-fragid:target-element>target element/a> to null.li> p>If the a href#the-indicated-part-of-the-document idscroll-to-fragid:the-indicated-part-of-the-document-4>indicated part of the document/a> is the top of the document, then:/p> ol>li>p>Set the code idscroll-to-fragid:document-4>a href#document>Document/a>/code>s a href#target-element idscroll-to-fragid:target-element-2>target element/a> to null.li>p>a idscroll-to-fragid:scroll-to-the-beginning-of-the-document hrefhttps://drafts.csswg.org/cssom-view/#scroll-to-the-beginning-of-the-document data-x-internalscroll-to-the-beginning-of-the-document>Scroll to the beginning of the document/a> for the code idscroll-to-fragid:document-5>a href#document>Document/a>/code>. a href#refsCSSOMVIEW>CSSOMVIEW/a>/ol> li> p>Otherwise:/p> ol>li>p>Let var>target/var> be element that is a href#the-indicated-part-of-the-document idscroll-to-fragid:the-indicated-part-of-the-document-5>the indicated part of the document/a>.li>p>Set the code idscroll-to-fragid:document-6>a href#document>Document/a>/code>s a href#target-element idscroll-to-fragid:target-element-3>target element/a> to var>target/var>.li>p>Use the a idscroll-to-fragid:scroll-an-element-into-view hrefhttps://drafts.csswg.org/cssom-view/#scroll-an-element-into-view data-x-internalscroll-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 idscroll-to-fragid:focusing-steps>focusing steps/a> for var>target/var>, with the code idscroll-to-fragid:document-7>a href#document>Document/a>/code>s a idscroll-to-fragid:viewport hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> as the i>fallback target/i>.li>p>Move the a href#sequential-focus-navigation-starting-point idscroll-to-fragid:sequential-focus-navigation-starting-point>sequential focus navigation starting point/a> to var>target/var>./p> /ol> /ol> p>dfn idthe-indicated-part-of-the-document>The indicated part of the document/dfn> is the one that the a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idscroll-to-fragid:concept-url-fragment-2 data-x-internalconcept-url-fragment>fragment/a>, if any, identifies. The semantics of the a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idscroll-to-fragid:concept-url-fragment-3 data-x-internalconcept-url-fragment>fragment/a> in terms of mapping it to a node is defined by the specification that defines the a idscroll-to-fragid:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> used by the code idscroll-to-fragid:document-8>a href#document>Document/a>/code> (for example, the processing of a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idscroll-to-fragid:concept-url-fragment-4 data-x-internalconcept-url-fragment>fragments/a> for a hrefhttps://mimesniff.spec.whatwg.org/#xml-mime-type idscroll-to-fragid:xml-mime-type data-x-internalxml-mime-type>XML MIME types/a> is the responsibility of RFC7303). a href#refsRFC7303>RFC7303/a>/p> p>There is also a dfn idtarget-element>target element/dfn> for each code idscroll-to-fragid:document-9>a href#document>Document/a>/code>, which is used in defining the code idscroll-to-fragid:selector-target>a href#selector-target>:target/a>/code> pseudo-class and is updated by the above algorithm. It is initially null./p> p>For HTML documents (and a hrefhttps://mimesniff.spec.whatwg.org/#html-mime-type idscroll-to-fragid:html-mime-type data-x-internalhtml-mime-type>HTML MIME types/a>), the following processing model must be followed to determine what a href#the-indicated-part-of-the-document idscroll-to-fragid:the-indicated-part-of-the-document-6>the indicated part of the document/a> is./p> ol>li>p>Let var>fragment/var> be the documents a hrefhttps://dom.spec.whatwg.org/#concept-document-url idscroll-to-fragid:the-documents-address-2 data-x-internalthe-documents-address>URL/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idscroll-to-fragid:concept-url-fragment-5 data-x-internalconcept-url-fragment>fragment/a>.li>p>If var>fragment/var> is the empty string, then a href#the-indicated-part-of-the-document idscroll-to-fragid:the-indicated-part-of-the-document-7>the indicated part of the document/a> is the top of the document; return.li>p>If a href#find-a-potential-indicated-element idscroll-to-fragid:find-a-potential-indicated-element>find a potential indicated element/a> with var>fragment/var> returns non-null, than the return value is a href#the-indicated-part-of-the-document idscroll-to-fragid:the-indicated-part-of-the-document-8>the indicated part of the document/a>; return.li>p>Let var>fragmentBytes/var> be the result of a hrefhttps://url.spec.whatwg.org/#percent-decode idscroll-to-fragid:percent-decode data-x-internalpercent-decode>percent-decoding/a> var>fragment/var>.li>p>Let var>decodedFragment/var> be the result of running a idscroll-to-fragid:utf-8-decode-without-bom-or-fail hrefhttps://encoding.spec.whatwg.org/#utf-8-decode-without-bom-or-fail data-x-internalutf-8-decode-without-bom-or-fail>UTF-8 decode without BOM or fail/a> on var>fragmentBytes/var>.li>p>If a href#find-a-potential-indicated-element idscroll-to-fragid:find-a-potential-indicated-element-2>find a potential indicated element/a> with var>decodedFragment/var> returns non-null, than the return value is a href#the-indicated-part-of-the-document idscroll-to-fragid:the-indicated-part-of-the-document-9>the indicated part of the document/a>; return.li>p>If var>decodedFragment/var> is an a idscroll-to-fragid:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>top/code>, then a href#the-indicated-part-of-the-document idscroll-to-fragid:the-indicated-part-of-the-document-10>the indicated part of the document/a> is the top of the document; return.li>p>There is no a href#the-indicated-part-of-the-document idscroll-to-fragid:the-indicated-part-of-the-document-11>indicated part of the document/a>./ol> p>To dfn idfind-a-potential-indicated-element>find a potential indicated element/dfn> given a string var>fragment/var>, run these steps:/p> ol>li>p>If there is an element a hrefhttps://dom.spec.whatwg.org/#in-a-document-tree idscroll-to-fragid:in-a-document-tree data-x-internalin-a-document-tree>in the document tree/a> that has an a hrefhttps://dom.spec.whatwg.org/#concept-id idscroll-to-fragid:concept-id-2 data-x-internalconcept-id>ID/a> equal to var>fragment/var>, then return the first such element in a idscroll-to-fragid:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>.li>p>If there is an code idscroll-to-fragid:the-a-element>a href#the-a-element>a/a>/code> element a hrefhttps://dom.spec.whatwg.org/#in-a-document-tree idscroll-to-fragid:in-a-document-tree-2 data-x-internalin-a-document-tree>in the document tree/a> that has a code idscroll-to-fragid:attr-a-name>a href#attr-a-name>name/a>/code> attribute whose value is equal to var>fragment/var>, then return the first such element in a idscroll-to-fragid:tree-order-2 hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>.li>p>Return null./ol> p>The a href#task-source idscroll-to-fragid:task-source>task source/a> for the task mentioned in this section must be the a href#dom-manipulation-task-source idscroll-to-fragid:dom-manipulation-task-source>DOM manipulation task source/a>./p> h4 idhistory-traversal>span classsecno>7.8.10/span> History traversala href#history-traversal classself-link>/a>/h4> p>When a user agent is required to dfn idtraverse-the-history>traverse the history/dfn> to a a href#session-history-entry idhistory-traversal:session-history-entry>session history entry/a> var>entry/var>, optionally with a href#replacement-enabled idhistory-traversal:replacement-enabled>replacement enabled/a>, and optionally with the i>non-blocking events/i> flag set, the user agent must act as follows./p> p classnote>This algorithm is not just invoked when a href#traverse-the-history-by-a-delta idhistory-traversal:traverse-the-history-by-a-delta>explicitly going back or forwards in the session history/a> — it is also invoked in other situations, for example when a href#navigate idhistory-traversal:navigate>navigating a browsing context/a>, as part of a href#update-the-session-history-with-the-new-page idhistory-traversal:update-the-session-history-with-the-new-page>updating the session history with the new page/a>./p> ol>li> p>If var>entry/var> no longer holds a code idhistory-traversal:document>a href#document>Document/a>/code> object, then a href#navigate idhistory-traversal:navigate-2>navigate/a> the a href#browsing-context idhistory-traversal:browsing-context>browsing context/a> to var>entry/var>s a idhistory-traversal:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> to perform an a href#entry-update idhistory-traversal:entry-update>entry update/a> of var>entry/var>, and abort these steps. The a href#navigate idhistory-traversal:navigate-3>navigate/a> algorithm reinvokes this traverse algorithm to complete the traversal, at which point there em>is/em> a code idhistory-traversal:document-2>a href#document>Document/a>/code> object and so this step gets skipped. The navigation must be done using the same a href#source-browsing-context idhistory-traversal:source-browsing-context>source browsing context/a> as was used the first time var>entry/var> was created. (This can never happen with a href#replacement-enabled idhistory-traversal:replacement-enabled-2>replacement enabled/a>.)/p> p classnote>If the resource was obtained using a non-idempotent action, for example a POST form submission, or if the resource is no longer available, for example because the computer is now offline and the page wasnt cached, navigating to it again might not be possible. In this case, the navigation will result in a different page than previously; for example, it might be an error message explaining the problem or offering to resubmit the form./p> li>p>If the a href#current-entry idhistory-traversal:current-entry>current entry/a>s title was not set by the code idhistory-traversal:dom-history-pushstate>a href#dom-history-pushstate>pushState()/a>/code> or code idhistory-traversal:dom-history-replacestate>a href#dom-history-replacestate>replaceState()/a>/code> methods, then set its title to the value returned by the code idhistory-traversal:document.title>a href#document.title>document.title/a>/code> IDL attribute.li>p>If appropriate, update the a href#current-entry idhistory-traversal:current-entry-2>current entry/a> in the a href#browsing-context idhistory-traversal:browsing-context-2>browsing context/a>s code idhistory-traversal:document-3>a href#document>Document/a>/code> objects code idhistory-traversal:history-3>a href#history-3>History/a>/code> object to reflect any state that the user agent wishes to persist. The entry is then said to be a href#an-entry-with-persisted-user-state idhistory-traversal:an-entry-with-persisted-user-state>an entry with persisted user state/a>.li>p>If var>entry/var> has a different code idhistory-traversal:document-4>a href#document>Document/a>/code> object than the a href#current-entry idhistory-traversal:current-entry-3>current entry/a>, then run the following substeps:/p> ol>li>p>Remove any a href#concept-task idhistory-traversal:concept-task>tasks/a> queued by the a href#history-traversal-task-source idhistory-traversal:history-traversal-task-source>history traversal task source/a> that are associated with any code idhistory-traversal:document-5>a href#document>Document/a>/code> objects in the a href#top-level-browsing-context idhistory-traversal:top-level-browsing-context>top-level browsing context/a>s a href#document-family idhistory-traversal:document-family>document family/a>.li> p>If the a href#concept-origin idhistory-traversal:concept-origin>origin/a> of var>entry/var>s code idhistory-traversal:document-6>a href#document>Document/a>/code> object is not the a href#same-origin idhistory-traversal:same-origin>same/a> as the a href#concept-origin idhistory-traversal:concept-origin-2>origin/a> of the a href#current-entry idhistory-traversal:current-entry-4>current entry/a>s code idhistory-traversal:document-7>a href#document>Document/a>/code> object, then run the following subsubsteps:/p> ol>li>p>The current a href#browsing-context-name idhistory-traversal:browsing-context-name>browsing context name/a> must be stored with all the entries in the history that are associated with code idhistory-traversal:document-8>a href#document>Document/a>/code> objects with the a href#same-origin idhistory-traversal:same-origin-2>same origin/a> as the a href#active-document idhistory-traversal:active-document>active document/a> em>and/em> that are contiguous with the a href#current-entry idhistory-traversal:current-entry-5>current entry/a>.li idresetBCName>p>If the browsing context is a a href#top-level-browsing-context idhistory-traversal:top-level-browsing-context-2>top-level browsing context/a>, but not an a href#auxiliary-browsing-context idhistory-traversal:auxiliary-browsing-context>auxiliary browsing context/a>, then set the browsing contexts a href#browsing-context-name idhistory-traversal:browsing-context-name-2>name/a> to the empty string./ol> li idappcache-history-2>p>a href#set-the-active-document idhistory-traversal:set-the-active-document>Set the active document/a> of the a href#browsing-context idhistory-traversal:browsing-context-3>browsing context/a> to var>entry/var>s code idhistory-traversal:document-9>a href#document>Document/a>/code> object.li> p>If var>entry/var> has a a href#browsing-context-name idhistory-traversal:browsing-context-name-3>browsing context name/a>, then run the following subsubsteps:/p> ol>li>p>Set the browsing contexts a href#browsing-context-name idhistory-traversal:browsing-context-name-4>browsing context name/a> to var>entry/var>s a href#browsing-context-name idhistory-traversal:browsing-context-name-5>browsing context name/a>.li>p>Clear any a href#browsing-context-name idhistory-traversal:browsing-context-name-6>browsing context names/a> of all entries in the history that are associated with code idhistory-traversal:document-10>a href#document>Document/a>/code> objects with the a href#same-origin idhistory-traversal:same-origin-3>same origin/a> as the new a href#active-document idhistory-traversal:active-document-2>active document/a> and that are contiguous with var>entry/var>./ol> li idhistory-autocomplete>p>If var>entry/var>s code idhistory-traversal:document-11>a href#document>Document/a>/code> object has any form controls whose a href#autofill-field-name idhistory-traversal:autofill-field-name>autofill field name/a> is code idhistory-traversal:attr-fe-autocomplete-off>a href#attr-fe-autocomplete-off>off/a>/code>, invoke the a href#concept-form-reset-control idhistory-traversal:concept-form-reset-control>reset algorithm/a> of each of those elements.li> p>If the a href#current-document-readiness idhistory-traversal:current-document-readiness>current document readiness/a> of var>entry/var>s code idhistory-traversal:document-12>a href#document>Document/a>/code> object is code>complete/code>, then a href#queue-a-task idhistory-traversal:queue-a-task>queue a task/a> to run the following subsubsteps:/p> ol>li>p>If the code idhistory-traversal:document-13>a href#document>Document/a>/code>s a href#page-showing idhistory-traversal:page-showing>page showing/a> flag is true, then abort this task (i.e. dont fire the event below).li>p>Set the code idhistory-traversal:document-14>a href#document>Document/a>/code>s a href#page-showing idhistory-traversal:page-showing-2>page showing/a> flag to true.li> p>Run any dfn idsession-history-document-visibility-change-steps>session history document visibility change steps/dfn> for code idhistory-traversal:document-15>a href#document>Document/a>/code> that are defined by a href#other-applicable-specifications idhistory-traversal:other-applicable-specifications>other applicable specifications/a>./p> p classnote>This is specifically intended for use by the Page Visibility specification. a href#refsPAGEVIS>PAGEVIS/a>/p> li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idhistory-traversal:concept-event-fire data-x-internalconcept-event-fire>Fire an event/a> named code idhistory-traversal:event-pageshow>a href#event-pageshow>pageshow/a>/code> at the code idhistory-traversal:document-16>a href#document>Document/a>/code> objects code idhistory-traversal:window>a href#window>Window/a>/code> object, using code idhistory-traversal:pagetransitionevent>a href#pagetransitionevent>PageTransitionEvent/a>/code>, with the code idhistory-traversal:dom-pagetransitionevent-persisted>a href#dom-pagetransitionevent-persisted>persisted/a>/code> attribute initialized to true, and var>legacy target override flag/var> set./ol> /ol> li>p>Set the documents a hrefhttps://dom.spec.whatwg.org/#concept-document-url idhistory-traversal:the-documents-address data-x-internalthe-documents-address>URL/a> to var>entry/var>s a idhistory-traversal:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>.li>p>If var>entry/var> has a a idhistory-traversal:url-3 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> whose a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idhistory-traversal:concept-url-fragment data-x-internalconcept-url-fragment>fragment/a> differs from that of the a href#current-entry idhistory-traversal:current-entry-6>current entry/a>s when compared in a a href#case-sensitive idhistory-traversal:case-sensitive>case-sensitive/a> manner, and the two share the same code idhistory-traversal:document-17>a href#document>Document/a>/code> object, then let var>hash changed/var> be true, and let var>old URL/var> be the a href#current-entry idhistory-traversal:current-entry-7>current entry/a>s a idhistory-traversal:url-4 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> and var>new URL/var> be var>entry/var>s a idhistory-traversal:url-5 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>. Otherwise, let var>hash changed/var> be false.li>p>If the traversal was initiated with dfn idreplacement-enabled data-export>replacement enabled/dfn>, remove the entry immediately before the var>specified entry/var> in the session history.li>p>If var>entry/var> is not a href#an-entry-with-persisted-user-state idhistory-traversal:an-entry-with-persisted-user-state-2>an entry with persisted user state/a>, but its a idhistory-traversal:url-6 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idhistory-traversal:concept-url-fragment-2 data-x-internalconcept-url-fragment>fragment/a> is non-null, then a href#scroll-to-the-fragment-identifier idhistory-traversal:scroll-to-the-fragment-identifier>scroll to the fragment/a>.li>p>Set the a href#current-entry idhistory-traversal:current-entry-8>current entry/a> to var>entry/var>.li>p>Let var>targetRealm/var> be the a idhistory-traversal:current-realm-record hrefhttps://tc39.github.io/ecma262/#current-realm data-x-internalcurrent-realm-record>current Realm Record/a>.li>p>If var>entry/var> has a href#serialized-state idhistory-traversal:serialized-state>serialized state/a>, then let var>state/var> be a href#structureddeserialize idhistory-traversal:structureddeserialize>StructuredDeserialize/a>(var>entry/var>s a href#serialized-state idhistory-traversal:serialized-state-2>serialized state/a>, var>targetRealm/var>). If this throws an exception, catch it, ignore the exception, and let var>state/var>be null.li>p>Otherwise, let var>state/var> be null.li>p>Set code idhistory-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 var>entry/var>s code idhistory-traversal:document-18>a href#document>Document/a>/code> object has a a href#latest-entry idhistory-traversal:latest-entry>latest entry/a>, and that entry is not var>entry/var>; otherwise let it be false./p> li>p>Set var>entry/var>s code idhistory-traversal:document-19>a href#document>Document/a>/code> objects a href#latest-entry idhistory-traversal:latest-entry-2>latest entry/a> to var>entry/var>.li> p>If the i>non-blocking events/i> flag is not set, then run the following substeps a href#immediately idhistory-traversal:immediately>immediately/a>. Otherwise, the i>non-blocking events/i> flag is set; a href#queue-a-task idhistory-traversal:queue-a-task-2>queue a task/a> to run the following substeps instead./p> ol>li>p>If var>state changed/var> is true, then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idhistory-traversal:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idhistory-traversal:event-popstate>a href#event-popstate>popstate/a>/code> at the code idhistory-traversal:document-20>a href#document>Document/a>/code> objects code idhistory-traversal:window-2>a href#window>Window/a>/code> object, using code idhistory-traversal:popstateevent>a href#popstateevent>PopStateEvent/a>/code>, with the code idhistory-traversal:dom-event-bubbles>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true and the code idhistory-traversal:dom-popstateevent-state>a href#dom-popstateevent-state>state/a>/code> attribute initialized var>state/var>.li>p>If var>entry/var> is a href#an-entry-with-persisted-user-state idhistory-traversal:an-entry-with-persisted-user-state-3>an entry with persisted user state/a>, then the user agent may a href#restore-persisted-user-state idhistory-traversal:restore-persisted-user-state>restore persisted user state/a> and update aspects of the document and its rendering.li>p>If var>hash changed/var> is true, then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idhistory-traversal:concept-event-fire-3 data-x-internalconcept-event-fire>fire an event/a> named code idhistory-traversal:event-hashchange>a href#event-hashchange>hashchange/a>/code> at the a href#browsing-context idhistory-traversal:browsing-context-4>browsing context/a>s code idhistory-traversal:window-3>a href#window>Window/a>/code> object, using code idhistory-traversal:hashchangeevent>a href#hashchangeevent>HashChangeEvent/a>/code>, with the code idhistory-traversal:dom-event-bubbles-2>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true, the code idhistory-traversal:dom-hashchangeevent-oldurl>a href#dom-hashchangeevent-oldurl>oldURL/a>/code> attribute initialized to var>old URL/var>, and the code idhistory-traversal:dom-hashchangeevent-newurl>a href#dom-hashchangeevent-newurl>newURL/a>/code> attribute initialized to var>new URL/var>./ol> /ol> p>The a href#task-source idhistory-traversal:task-source>task source/a> for the tasks mentioned above is the a href#dom-manipulation-task-source idhistory-traversal:dom-manipulation-task-source>DOM manipulation task source/a>./p> h5 idpersisted-user-state-restoration>span classsecno>7.8.10.1/span> Persisted user state restorationa href#persisted-user-state-restoration classself-link>/a>/h5> p>When the user agent is to dfn idrestore-persisted-user-state>restore persisted user state/dfn> from a history entry, it must run the following steps immediately:/p> ol>li>p>If the entry has a a href#scroll-restoration-mode idpersisted-user-state-restoration:scroll-restoration-mode>scroll restoration mode/a>, let var>scrollRestoration/var> be that. Otherwise let var>scrollRestoration/var> be code idpersisted-user-state-restoration:dom-scrollrestoration-auto>a href#dom-scrollrestoration-auto>auto/a>/code>li>p>If var>scrollRestoration/var> is code idpersisted-user-state-restoration:dom-scrollrestoration-manual>a href#dom-scrollrestoration-manual>manual/a>/code> the user agent should not restore the scroll position for the code idpersisted-user-state-restoration:document>a href#document>Document/a>/code> or any of its scrollable regions, with the exception of any nested browsing contexts whose scroll restoration is controlled by their own history entrys a href#scroll-restoration-mode idpersisted-user-state-restoration:scroll-restoration-mode-2>scroll restoration mode/a>, otherwise, it may do so.li>p>Optionally, update other aspects of the document and its rendering, for instance values of form fields, that the user agent had previously recorded./ol> p classnote>This can even include updating the code idpersisted-user-state-restoration:the-dir-attribute>a href#the-dir-attribute>dir/a>/code> attribute of code idpersisted-user-state-restoration:the-textarea-element>a href#the-textarea-element>textarea/a>/code> elements or code idpersisted-user-state-restoration:the-input-element>a href#the-input-element>input/a>/code> elements whose code idpersisted-user-state-restoration:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in either the a href#text-(typetext)-state-and-search-state-(typesearch) idpersisted-user-state-restoration:text-(typetext)-state-and-search-state-(typesearch)>Text/a> state or the a href#text-(typetext)-state-and-search-state-(typesearch) idpersisted-user-state-restoration:text-(typetext)-state-and-search-state-(typesearch)-2>Search/a> state, if the persisted state includes the directionality of user input in such controls./p> p classnote>Not restoring the scroll position by user agent does not imply that the scroll position will be left at any particular value (e.g., (0,0)). The actual scroll position depends on the navigation type and the user agents particular caching strategy. So web applications cannot assume any particular scroll position but rather are urged to set it to what they want it to be./p> h5 idthe-popstateevent-interface>span classsecno>7.8.10.2/span> The code idthe-popstateevent-interface:popstateevent>a href#popstateevent>PopStateEvent/a>/code> interfacea href#the-popstateevent-interface classself-link>/a>/h5> pre classidl>ExposedWindow, Constructor(DOMString type, optional a href#popstateeventinit idthe-popstateevent-interface:popstateeventinit>PopStateEventInit/a> eventInitDict)interface dfn idpopstateevent>PopStateEvent/dfn> : a idthe-popstateevent-interface:event hrefhttps://dom.spec.whatwg.org/#interface-event data-x-internalevent>Event/a> { readonly attribute any a href#dom-popstateevent-state idthe-popstateevent-interface:dom-popstateevent-state>state/a>;};dictionary dfn idpopstateeventinit>PopStateEventInit/dfn> : a idthe-popstateevent-interface:eventinit hrefhttps://dom.spec.whatwg.org/#dictdef-eventinit data-x-internaleventinit>EventInit/a> { any state null;};/pre> dl classdomintro>dt>var>event/var> . code idthe-popstateevent-interface:dom-popstateevent-state-2>a href#dom-popstateevent-state>state/a>/code>dd> p>Returns a copy of the information that was provided to code idthe-popstateevent-interface:dom-history-pushstate>a href#dom-history-pushstate>pushState()/a>/code> or code idthe-popstateevent-interface:dom-history-replacestate>a href#dom-history-replacestate>replaceState()/a>/code>./p> /dl> p>The dfn iddom-popstateevent-state>code>state/code>/dfn> attribute must return the value it was initialized to. It represents the context information for the event, or null, if the state represented is the initial state of the code idthe-popstateevent-interface:document>a href#document>Document/a>/code>./p> h5 idthe-hashchangeevent-interface>span classsecno>7.8.10.3/span> The code idthe-hashchangeevent-interface:hashchangeevent>a href#hashchangeevent>HashChangeEvent/a>/code> interfacea href#the-hashchangeevent-interface classself-link>/a>/h5>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> hashchangespan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>5+/span>/span>span classios_saf yes>span>iOS Safari/span> span>4.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>3.6+/span>/span>span classie yes>span>IE/span> span>8+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>5+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.2+/span>/span>span classopera yes>span>Opera/span> span>10.6+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#feathashchange>caniuse.com/a>/div> pre classidl>ExposedWindow, Constructor(DOMString type, optional a href#hashchangeeventinit idthe-hashchangeevent-interface:hashchangeeventinit>HashChangeEventInit/a> eventInitDict)interface dfn idhashchangeevent>HashChangeEvent/dfn> : a idthe-hashchangeevent-interface:event hrefhttps://dom.spec.whatwg.org/#interface-event data-x-internalevent>Event/a> { readonly attribute USVString a href#dom-hashchangeevent-oldurl idthe-hashchangeevent-interface:dom-hashchangeevent-oldurl>oldURL/a>; readonly attribute USVString a href#dom-hashchangeevent-newurl idthe-hashchangeevent-interface:dom-hashchangeevent-newurl>newURL/a>;};dictionary dfn idhashchangeeventinit>HashChangeEventInit/dfn> : a idthe-hashchangeevent-interface:eventinit hrefhttps://dom.spec.whatwg.org/#dictdef-eventinit data-x-internaleventinit>EventInit/a> { USVString oldURL ; USVString newURL ;};/pre> dl classdomintro>dt>var>event/var> . code idthe-hashchangeevent-interface:dom-hashchangeevent-oldurl-2>a href#dom-hashchangeevent-oldurl>oldURL/a>/code>dd> p>Returns the a idthe-hashchangeevent-interface:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the a href#session-history-entry idthe-hashchangeevent-interface:session-history-entry>session history entry/a> that was previously current./p> dt>var>event/var> . code idthe-hashchangeevent-interface:dom-hashchangeevent-newurl-2>a href#dom-hashchangeevent-newurl>newURL/a>/code>dd> p>Returns the a idthe-hashchangeevent-interface:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the a href#session-history-entry idthe-hashchangeevent-interface:session-history-entry-2>session history entry/a> that is now current./p> /dl> p>The dfn iddom-hashchangeevent-oldurl>code>oldURL/code>/dfn> attribute must return the value it was initialized to. It represents context information for the event, specifically the URL of the a href#session-history-entry idthe-hashchangeevent-interface:session-history-entry-3>session history entry/a> that was traversed from./p> p>The dfn iddom-hashchangeevent-newurl>code>newURL/code>/dfn> attribute must return the value it was initialized to. It represents context information for the event, specifically the URL of the a href#session-history-entry idthe-hashchangeevent-interface:session-history-entry-4>session history entry/a> that was traversed to./p> h5 idthe-pagetransitionevent-interface>span classsecno>7.8.10.4/span> The code idthe-pagetransitionevent-interface:pagetransitionevent>a href#pagetransitionevent>PageTransitionEvent/a>/code> interfacea href#the-pagetransitionevent-interface classself-link>/a>/h5> pre classidl>ExposedWindow, Constructor(DOMString type, optional a href#pagetransitioneventinit idthe-pagetransitionevent-interface:pagetransitioneventinit>PageTransitionEventInit/a> eventInitDict)interface dfn idpagetransitionevent>PageTransitionEvent/dfn> : a idthe-pagetransitionevent-interface:event hrefhttps://dom.spec.whatwg.org/#interface-event data-x-internalevent>Event/a> { readonly attribute boolean a href#dom-pagetransitionevent-persisted idthe-pagetransitionevent-interface:dom-pagetransitionevent-persisted>persisted/a>;};dictionary dfn idpagetransitioneventinit>PageTransitionEventInit/dfn> : a idthe-pagetransitionevent-interface:eventinit hrefhttps://dom.spec.whatwg.org/#dictdef-eventinit data-x-internaleventinit>EventInit/a> { boolean persisted false;};/pre> dl classdomintro>dt>var>event/var> . code idthe-pagetransitionevent-interface:dom-pagetransitionevent-persisted-2>a href#dom-pagetransitionevent-persisted>persisted/a>/code>dd> p>For the code idthe-pagetransitionevent-interface:event-pageshow>a href#event-pageshow>pageshow/a>/code> event, returns false if the page is newly being loaded (and the code idthe-pagetransitionevent-interface:event-load>a href#event-load>load/a>/code> event will fire). Otherwise, returns true./p> p>For the code idthe-pagetransitionevent-interface:event-pagehide>a href#event-pagehide>pagehide/a>/code> event, returns false if the page is going away for the last time. Otherwise, returns true, meaning that (if nothing conspires to make the page unsalvageable) the page might be reused if the user navigates back to this page./p> p>Things that can cause the page to be unsalvageable include:/p> ul classbrief>li>code idthe-pagetransitionevent-interface:dom-document-open>a href#dom-document-open>document.open()/a>/code> li>Listening for code idthe-pagetransitionevent-interface:event-beforeunload>a href#event-beforeunload>beforeunload/a>/code> events li>Listening for code idthe-pagetransitionevent-interface:event-unload>a href#event-unload>unload/a>/code> events li>Having code idthe-pagetransitionevent-interface:the-iframe-element>a href#the-iframe-element>iframe/a>/code>s that are not salvageable li>Active code idthe-pagetransitionevent-interface:websocket>a href#websocket>WebSocket/a>/code> objects li>a href#abort-a-document idthe-pagetransitionevent-interface:abort-a-document>Aborting a code>Document/code>/a> /ul> /dl> p>The dfn iddom-pagetransitionevent-persisted>code>persisted/code>/dfn> attribute must return the value it was initialized to. It represents the context information for the event./p> h4 idunloading-documents>span classsecno>7.8.11/span> Unloading documentsa href#unloading-documents classself-link>/a>/h4> p>A code idunloading-documents:document>a href#document>Document/a>/code> has a dfn idconcept-document-salvageable>i>salvageable/i>/dfn> state, which must initially be true, a dfn idfired-unload>fired unload/dfn> flag, which must initially be false, and a dfn idpage-showing>page showing/dfn> flag, which must initially be false. The a href#page-showing idunloading-documents:page-showing>page showing/a> flag is used to ensure that scripts receive code idunloading-documents:event-pageshow>a href#event-pageshow>pageshow/a>/code> and code idunloading-documents:event-pagehide>a href#event-pagehide>pagehide/a>/code> events in a consistent manner (e.g. that they never receive two code idunloading-documents:event-pagehide-2>a href#event-pagehide>pagehide/a>/code> events in a row without an intervening code idunloading-documents:event-pageshow-2>a href#event-pageshow>pageshow/a>/code>, or vice versa)./p> p>a href#event-loop idunloading-documents:event-loop>Event loops/a> have a dfn idtermination-nesting-level>termination nesting level/dfn> counter, which must initially be 0./p> p>To dfn idprompt-to-unload-a-document>prompt to unload/dfn>, given a code idunloading-documents:document-2>a href#document>Document/a>/code> object var>document/var> and optionally a var>recursiveFlag/var>, run these steps:/p> ol>li>p>Increase the a href#event-loop idunloading-documents:event-loop-2>event loop/a>s a href#termination-nesting-level idunloading-documents:termination-nesting-level>termination nesting level/a> by 1.li>p>Increase the var>document/var>s a href#ignore-opens-during-unload-counter idunloading-documents:ignore-opens-during-unload-counter>ignore-opens-during-unload counter/a> by 1.li>p>Let var>event/var> be the result of a idunloading-documents:creating-an-event hrefhttps://dom.spec.whatwg.org/#concept-event-create data-x-internalcreating-an-event>creating an event/a> using code idunloading-documents:beforeunloadevent>a href#beforeunloadevent>BeforeUnloadEvent/a>/code>.li>p>Initialize var>event/var>s code idunloading-documents:dom-event-type>a data-x-internaldom-event-type hrefhttps://dom.spec.whatwg.org/#dom-event-type>type/a>/code> attribute to code idunloading-documents:event-beforeunload>a href#event-beforeunload>beforeunload/a>/code> and its code idunloading-documents:dom-event-cancelable>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute true.li>p>i>Dispatch/i>: a hrefhttps://dom.spec.whatwg.org/#concept-event-dispatch idunloading-documents:concept-event-dispatch data-x-internalconcept-event-dispatch>Dispatch/a> var>event/var> at var>document/var>s code idunloading-documents:window>a href#window>Window/a>/code> object.li>p>Decrease the a href#event-loop idunloading-documents:event-loop-3>event loop/a>s a href#termination-nesting-level idunloading-documents:termination-nesting-level-2>termination nesting level/a> by 1.li>p>If any event listeners were triggered by the earlier i>dispatch/i> step, then set var>document/var>s i idunloading-documents:concept-document-salvageable>a href#concept-document-salvageable>salvageable/a>/i> state to false.li> p>If var>document/var>s a href#active-sandboxing-flag-set idunloading-documents:active-sandboxing-flag-set>active sandboxing flag set/a> does not have its a href#sandboxed-modals-flag idunloading-documents:sandboxed-modals-flag>sandboxed modals flag/a> set, and the code idunloading-documents:dom-beforeunloadevent-returnvalue>a href#dom-beforeunloadevent-returnvalue>returnValue/a>/code> attribute of the var>event/var> object is not the empty string, or if the event was canceled, then the user agent may ask the user to confirm that they wish to unload the document./p> p classnote>The message shown to the user is not customizable, but instead determined by the user agent. In particular, the actual value of the code idunloading-documents:dom-beforeunloadevent-returnvalue-2>a href#dom-beforeunloadevent-returnvalue>returnValue/a>/code> attribute is ignored./p> p>The user agent is encouraged to avoid asking the user for confirmation if it judges that doing so would be annoying, deceptive, or pointless. A simple heuristic might be that if the user has not interacted with the document, the user agent would not ask for confirmation before unloading it./p> p>If the user agent asks the user for confirmation, it must a href#pause idunloading-documents:pause>pause/a> while waiting for the users response./p> p>If the user did not confirm the page navigation, then the user agent dfn idrefused-to-allow-the-document-to-be-unloaded>refused to allow the document to be unloaded/dfn>./p> li> p>If the var>recursiveFlag/var> is not set, then:/p> ol>li>p>Let var>descendants/var> be the a href#list-of-the-descendant-browsing-contexts idunloading-documents:list-of-the-descendant-browsing-contexts>list of the descendant browsing contexts/a> of var>document/var>.li> p>For each var>browsingContext/var> in var>descendants/var>:/p> ol>li>p>a href#prompt-to-unload-a-document idunloading-documents:prompt-to-unload-a-document>Prompt to unload/a> var>browsingContext/var>s a href#active-document idunloading-documents:active-document>active document/a> with the var>recursiveFlag/var> set. If the user a href#refused-to-allow-the-document-to-be-unloaded idunloading-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 idunloading-documents:refused-to-allow-the-document-to-be-unloaded-2>refused to allow var>document/var> to be unloaded/a>; a idunloading-documents:break hrefhttps://infra.spec.whatwg.org/#iteration-break data-x-internalbreak>break/a>.li>p>If the i idunloading-documents:concept-document-salvageable-2>a href#concept-document-salvageable>salvageable/a>/i> state of var>browsingContext/var>s a href#active-document idunloading-documents:active-document-2>active document/a> is false, then set the i idunloading-documents:concept-document-salvageable-3>a href#concept-document-salvageable>salvageable/a>/i> state of var>document/var> to false./ol> /ol> li>p>Decrease the var>document/var>s a href#ignore-opens-during-unload-counter idunloading-documents:ignore-opens-during-unload-counter-2>ignore-opens-during-unload counter/a> by 1./ol> p>When a user agent is to dfn idunload-a-document data-export>unload a document/dfn>, it must run the following steps. These steps are passed an argument, var>recycle/var>, which is either true or false, indicating whether the code idunloading-documents:document-3>a href#document>Document/a>/code> object is going to be re-used. (This is set by the code idunloading-documents:dom-document-open>a href#dom-document-open>document.open()/a>/code> method.)/p> ol>li>p>Increase the a href#event-loop idunloading-documents:event-loop-4>event loop/a>s a href#termination-nesting-level idunloading-documents:termination-nesting-level-3>termination nesting level/a> by one.li>p>Increase the code idunloading-documents:document-4>a href#document>Document/a>/code>s a href#ignore-opens-during-unload-counter idunloading-documents:ignore-opens-during-unload-counter-3>ignore-opens-during-unload counter/a> by one.li>p>If the code idunloading-documents:document-5>a href#document>Document/a>/code>s a href#page-showing idunloading-documents:page-showing-2>page showing/a> flag is false, then jump to the step labeled i>unload event/i> below (i.e. skip firing the code idunloading-documents:event-pagehide-3>a href#event-pagehide>pagehide/a>/code> event and dont rerun the a href#unloading-document-visibility-change-steps idunloading-documents:unloading-document-visibility-change-steps>unloading document visibility change steps/a>).li>p>Set the code idunloading-documents:document-6>a href#document>Document/a>/code>s a href#page-showing idunloading-documents:page-showing-3>page showing/a> flag to false.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idunloading-documents:concept-event-fire data-x-internalconcept-event-fire>Fire an event/a> named code idunloading-documents:event-pagehide-4>a href#event-pagehide>pagehide/a>/code> at the code idunloading-documents:document-7>a href#document>Document/a>/code> objects code idunloading-documents:window-2>a href#window>Window/a>/code> object, using code idunloading-documents:pagetransitionevent>a href#pagetransitionevent>PageTransitionEvent/a>/code>, with the code idunloading-documents:dom-pagetransitionevent-persisted>a href#dom-pagetransitionevent-persisted>persisted/a>/code> attribute initialized to true if the code idunloading-documents:document-8>a href#document>Document/a>/code> objects i idunloading-documents:concept-document-salvageable-4>a href#concept-document-salvageable>salvageable/a>/i> state is true, and false otherwise, and var>legacy target override flag/var> set.li> p>Run any dfn idunloading-document-visibility-change-steps>unloading document visibility change steps/dfn> for code idunloading-documents:document-9>a href#document>Document/a>/code> that are defined by a href#other-applicable-specifications idunloading-documents:other-applicable-specifications>other applicable specifications/a>./p> p classnote>This is specifically intended for use by the Page Visibility specification. a href#refsPAGEVIS>PAGEVIS/a>/p> li>p>i>Unload event/i>: If the code idunloading-documents:document-10>a href#document>Document/a>/code>s a href#fired-unload idunloading-documents:fired-unload>fired unload/a> flag is false, then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idunloading-documents:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idunloading-documents:event-unload>a href#event-unload>unload/a>/code> at the code idunloading-documents:document-11>a href#document>Document/a>/code>s object code idunloading-documents:window-3>a href#window>Window/a>/code> object, with var>legacy target override flag/var> set.li>p>Decrease the a href#event-loop idunloading-documents:event-loop-5>event loop/a>s a href#termination-nesting-level idunloading-documents:termination-nesting-level-4>termination nesting level/a> by one.li>p>If any event listeners were triggered by the earlier i>unload event/i> step, then set the code idunloading-documents:document-12>a href#document>Document/a>/code> objects i idunloading-documents:concept-document-salvageable-5>a href#concept-document-salvageable>salvageable/a>/i> state to false and set the code idunloading-documents:document-13>a href#document>Document/a>/code>s a href#fired-unload idunloading-documents:fired-unload-2>fired unload/a> flag to true.li>p>Run any a href#unloading-document-cleanup-steps idunloading-documents:unloading-document-cleanup-steps>unloading document cleanup steps/a> for code idunloading-documents:document-14>a href#document>Document/a>/code> that are defined by this specification and a href#other-applicable-specifications idunloading-documents:other-applicable-specifications-2>other applicable specifications/a>.li>p>If this algorithm was invoked by another instance of the unload a document algorithm (i.e. by the steps below that invoke this algorithm for all descendant browsing contexts), then jump to the step labeled i>end/i>.li>p>Let var>descendants/var> be the a href#list-of-the-descendant-browsing-contexts idunloading-documents:list-of-the-descendant-browsing-contexts-2>list of the descendant browsing contexts/a> of the code idunloading-documents:document-15>a href#document>Document/a>/code>.li> p>If var>descendants/var> is not an empty list, then for each a href#browsing-context idunloading-documents:browsing-context>browsing context/a> var>b/var> in var>descendants/var> run the following substeps:/p> ol>li>p>a href#unload-a-document idunloading-documents:unload-a-document>Unload/a> the a href#active-document idunloading-documents:active-document-3>active document/a> of the a href#browsing-context idunloading-documents:browsing-context-2>browsing context/a> var>b/var> with the var>recycle/var> parameter set to false.li>p>If the i idunloading-documents:concept-document-salvageable-6>a href#concept-document-salvageable>salvageable/a>/i> state of the a href#active-document idunloading-documents:active-document-4>active document/a> of the a href#browsing-context idunloading-documents:browsing-context-3>browsing context/a> var>b/var> is false, then set the i idunloading-documents:concept-document-salvageable-7>a href#concept-document-salvageable>salvageable/a>/i> state of em>this/em> document to false also./ol> li>p>If both the code idunloading-documents:document-16>a href#document>Document/a>/code>s i idunloading-documents:concept-document-salvageable-8>a href#concept-document-salvageable>salvageable/a>/i> state and var>recycle/var> are false, then the code idunloading-documents:document-17>a href#document>Document/a>/code>s a href#concept-document-bc idunloading-documents:concept-document-bc>browsing context/a> must a href#discard-a-document idunloading-documents:discard-a-document>discard the code>Document/code>/a>.li>p>i>End/i>: Decrease the code idunloading-documents:document-18>a href#document>Document/a>/code>s a href#ignore-opens-during-unload-counter idunloading-documents:ignore-opens-during-unload-counter-4>ignore-opens-during-unload counter/a> by one./ol> p>This specification defines the following dfn idunloading-document-cleanup-steps data-export>unloading document cleanup steps/dfn>. Other specifications can define more./p> ol>li>p>Let var>window/var> be the code idunloading-documents:document-19>a href#document>Document/a>/code>s code idunloading-documents:window-4>a href#window>Window/a>/code> object.li> p>For each code idunloading-documents:websocket>a href#websocket>WebSocket/a>/code> object var>webSocket/var> whose a href#concept-relevant-global idunloading-documents:concept-relevant-global>relevant global object/a> is equal to var>window/var>, a href#make-disappear idunloading-documents:make-disappear>make disappear/a> var>webSocket/var>./p> p>If this affected any code idunloading-documents:websocket-2>a href#websocket>WebSocket/a>/code> objects, then set the code idunloading-documents:document-20>a href#document>Document/a>/code>s i idunloading-documents:concept-document-salvageable-9>a href#concept-document-salvageable>salvageable/a>/i> state to false./p> li> p>If the code idunloading-documents:document-21>a href#document>Document/a>/code>s i idunloading-documents:concept-document-salvageable-10>a href#concept-document-salvageable>salvageable/a>/i> state is false, run the following substeps:/p> ol>li>p>For each code idunloading-documents:eventsource>a href#eventsource>EventSource/a>/code> object var>eventSource/var> whose a href#concept-relevant-global idunloading-documents:concept-relevant-global-2>relevant global object/a> is equal to var>window/var>, a href#concept-eventsource-forcibly-close idunloading-documents:concept-eventsource-forcibly-close>forcibly close/a> var>eventSource/var>.li>p>Empty var>window/var>s a href#list-of-active-timers idunloading-documents:list-of-active-timers>list of active timers/a>./ol> /ol> h5 idthe-beforeunloadevent-interface>span classsecno>7.8.11.1/span> The code idthe-beforeunloadevent-interface:beforeunloadevent>a href#beforeunloadevent>BeforeUnloadEvent/a>/code> interfacea href#the-beforeunloadevent-interface classself-link>/a>/h5> pre classidl>ExposedWindowinterface dfn idbeforeunloadevent>BeforeUnloadEvent/dfn> : a idthe-beforeunloadevent-interface:event hrefhttps://dom.spec.whatwg.org/#interface-event data-x-internalevent>Event/a> { attribute DOMString a href#dom-beforeunloadevent-returnvalue idthe-beforeunloadevent-interface:dom-beforeunloadevent-returnvalue>returnValue/a>;};/pre> p classnote>There are no code idthe-beforeunloadevent-interface:beforeunloadevent-2>a href#beforeunloadevent>BeforeUnloadEvent/a>/code>-specific initialization methods./p> p>The code idthe-beforeunloadevent-interface:beforeunloadevent-3>a href#beforeunloadevent>BeforeUnloadEvent/a>/code> interface is a legacy interface which allows a href#prompt-to-unload-a-document idthe-beforeunloadevent-interface:prompt-to-unload-a-document>prompting to unload/a> to be controlled not only by canceling the event, but by setting the code idthe-beforeunloadevent-interface:dom-beforeunloadevent-returnvalue-2>a href#dom-beforeunloadevent-returnvalue>returnValue/a>/code> attribute to a value besides the empty string. Authors should use the code idthe-beforeunloadevent-interface:dom-event-preventdefault>a data-x-internaldom-event-preventdefault hrefhttps://dom.spec.whatwg.org/#dom-event-preventdefault>preventDefault()/a>/code> method, or other means of canceling events, instead of using code idthe-beforeunloadevent-interface:dom-beforeunloadevent-returnvalue-3>a href#dom-beforeunloadevent-returnvalue>returnValue/a>/code>./p> p>The dfn iddom-beforeunloadevent-returnvalue>code>returnValue/code>/dfn> attribute controls the process of a href#prompt-to-unload-a-document idthe-beforeunloadevent-interface:prompt-to-unload-a-document-2>prompting to unload/a>. When the event is created, the attribute must be set to the empty string. On getting, it must return the last value it was set to. On setting, the attribute must be set to the new value./p> p classnote>This attribute is a code>DOMString/code> only for historical reasons. Any value besides the empty string will be treated as a request to ask the user for confirmation./p> h4 idaborting-a-document-load>span classsecno>7.8.12/span> Aborting a document loada href#aborting-a-document-load classself-link>/a>/h4> p>If a code idaborting-a-document-load:document>a href#document>Document/a>/code> is dfn idabort-a-document>aborted/dfn>, the user agent must run the following steps:/p> ol>li>p>a href#abort-a-document idaborting-a-document-load:abort-a-document>Abort/a> the a href#active-document idaborting-a-document-load:active-document>active documents/a> of every a href#child-browsing-context idaborting-a-document-load:child-browsing-context>child browsing context/a>. If this results in any of those code idaborting-a-document-load:document-2>a href#document>Document/a>/code> objects having their i idaborting-a-document-load:concept-document-salvageable>a href#concept-document-salvageable>salvageable/a>/i> state set to false, then set this code idaborting-a-document-load:document-3>a href#document>Document/a>/code>s i idaborting-a-document-load:concept-document-salvageable-2>a href#concept-document-salvageable>salvageable/a>/i> state to false also.li>p>Cancel any instances of the a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idaborting-a-document-load:concept-fetch data-x-internalconcept-fetch>fetch/a> algorithm in the context of this code idaborting-a-document-load:document-4>a href#document>Document/a>/code>, discarding any a href#concept-task idaborting-a-document-load:concept-task>tasks/a> a href#queue-a-task idaborting-a-document-load:queue-a-task>queued/a> for them, and discarding any further data received from the network for them. If this resulted in any instances of the a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idaborting-a-document-load:concept-fetch-2 data-x-internalconcept-fetch>fetch/a> algorithm being canceled or any a href#queue-a-task idaborting-a-document-load:queue-a-task-2>queued/a> a href#concept-task idaborting-a-document-load:concept-task-2>tasks/a> or any network data getting discarded, then set the code idaborting-a-document-load:document-5>a href#document>Document/a>/code>s i idaborting-a-document-load:concept-document-salvageable-3>a href#concept-document-salvageable>salvageable/a>/i> state to false.li>p>If the code idaborting-a-document-load:document-6>a href#document>Document/a>/code> has an a href#active-parser idaborting-a-document-load:active-parser>active parser/a>, then a href#abort-a-parser idaborting-a-document-load:abort-a-parser>abort that parser/a> and set the code idaborting-a-document-load:document-7>a href#document>Document/a>/code>s i idaborting-a-document-load:concept-document-salvageable-4>a href#concept-document-salvageable>salvageable/a>/i> state to false./ol> p>User agents may allow users to explicitly invoke the a href#abort-a-document idaborting-a-document-load:abort-a-document-2>abort a document/a> algorithm for a code idaborting-a-document-load:document-8>a href#document>Document/a>/code>. If the user does so, then, if that code idaborting-a-document-load:document-9>a href#document>Document/a>/code> is an a href#active-document idaborting-a-document-load:active-document-2>active document/a>, the user agent should a href#queue-a-task idaborting-a-document-load:queue-a-task-3>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idaborting-a-document-load:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idaborting-a-document-load:event-abort>a href#event-abort>abort/a>/code> at that code idaborting-a-document-load:document-10>a href#document>Document/a>/code>s code idaborting-a-document-load:window>a href#window>Window/a>/code> object before invoking the a href#abort-a-document idaborting-a-document-load:abort-a-document-3>abort/a> algorithm./p> h3 idoffline>span classsecno>7.9/span> Offline Web applicationsa href#offline classself-link>/a>/h3>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> offline-appsspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>3.2+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>3.5+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>4+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.1+/span>/span>span classopera yes>span>Opera/span> span>10.6+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featoffline-apps>caniuse.com/a>/div> p classcritical>This feature is in the process of being removed from the Web platform. (This is a long process that takes many years.) Using any of the offline Web application features at this time is highly discouraged. Use service workers instead. a href#refsSW>SW/a>/p> h4 idintroduction-10>span classsecno>7.9.1/span> Introductiona href#introduction-10 classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>In order to enable users to continue interacting with Web applications and documents even when their network connection is unavailable — for instance, because they are traveling outside of their ISPs coverage area — authors can provide a manifest which lists the files that are needed for the Web application to work offline and which causes the users browser to keep a copy of the files for use offline./p> p>To illustrate this, consider a simple clock applet consisting of an HTML page code>clock1.html/code>, a CSS style sheet code>clock.css/code>, and a JavaScript script code>clock.js/code>./p> p>Before adding the manifest, these three files might look like this:/p> pre><!-- clock1.html --><!DOCTYPE HTML><html> <head> <meta charsetutf-8> <title>Clock</title> <script srcclock.js></script> <link relstylesheet hrefclock.css> </head> <body> <p>The time is: <output idclock></output></p> </body></html>/pre> pre>/* clock.css */output { font: 2em sans-serif; }/pre> pre>/* clock.js */setInterval(function () { document.getElementById(clock).value new Date();}, 1000);/pre> p>If the user tries to open the code>clock1.html/code> page while offline, though, the user agent (unless it happens to have it still in the local cache) will fail with an error./p> p>The author can instead provide a manifest of the three files, say code>clock.appcache/code>:/p> pre>CACHE MANIFESTclock2.htmlclock.cssclock.js/pre> p>With a small change to the HTML file, the manifest (served as code idintroduction-10:text/cache-manifest>a href#text/cache-manifest>text/cache-manifest/a>/code>) is linked to the application:/p> pre><!-- clock2.html --><!DOCTYPE HTML><html manifestclock.appcache> <head> <meta charsetutf-8> <title>Clock</title> <script srcclock.js></script> <link relstylesheet hrefclock.css> </head> <body> <p>The time is: <output idclock></output></p> </body></html>/pre> p>Now, if the user goes to the page, the browser will cache the files and make them available even when the user is offline./p> p classnote>Authors are encouraged to include the main page in the manifest also, but in practice the page that referenced the manifest is automatically cached even if it isnt explicitly mentioned./p> p classnote>With the exception of no-store directive, HTTP cache headers and restrictions on caching pages served over TLS (encrypted, using code idintroduction-10:https-protocol>a data-x-internalhttps-protocol hrefhttps://tools.ietf.org/html/rfc7230#section-2.7.2>https:/a>/code>) are overridden by manifests. Thus, pages will not expire from an application cache before the user agent has updated it, and even applications served over TLS can be made to work offline./p> p>a href/demos/offline/clock/clock2.html>View this example online/a>./p> h5 idsupporting-offline-caching-for-legacy-applications>span classsecno>7.9.1.1/span> Supporting offline caching for legacy applicationsa href#supporting-offline-caching-for-legacy-applications classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>The application cache feature works best if the application logic is separate from the application and user data, with the logic (markup, scripts, style sheets, images, etc) listed in the manifest and stored in the application cache, with a finite number of static HTML pages for the application, and with the application and user data stored in Web Storage or a client-side Indexed Database, updated dynamically using Web Sockets, code idsupporting-offline-caching-for-legacy-applications:xmlhttprequest>a data-x-internalxmlhttprequest hrefhttps://xhr.spec.whatwg.org/#xmlhttprequest>XMLHttpRequest/a>/code>, server-sent events, or some other similar mechanism./p> p>This model results in a fast experience for the user: the application immediately loads, and fresh data is obtained as fast as the network will allow it (possibly while stale data shows)./p> p>Legacy applications, however, tend to be designed so that the user data and the logic are mixed together in the HTML, with each operation resulting in a new HTML page from the server./p> div classexample> p>For example, consider a news application. The typical architecture of such an application, when not using the application cache feature, is that the user fetches the main page, and the server returns a dynamically-generated page with the current headlines and the user interface logic mixed together./p> p>A news application designed for the application cache feature, however, would instead have the main page just consist of the logic, and would then have the main page fetch the data separately from the server, e.g. using code idsupporting-offline-caching-for-legacy-applications:xmlhttprequest-2>a data-x-internalxmlhttprequest hrefhttps://xhr.spec.whatwg.org/#xmlhttprequest>XMLHttpRequest/a>/code>./p> /div> p>The mixed-content model does not work well with the application cache feature: since the content is cached, it would result in the user always seeing the stale data from the previous time the cache was updated./p> p>While there is no way to make the legacy model work as fast as the separated model, it em>can/em> at least be retrofitted for offline use using the a href#concept-appcache-mode-prefer-online idsupporting-offline-caching-for-legacy-applications:concept-appcache-mode-prefer-online>prefer-online/a> a href#concept-appcache-mode idsupporting-offline-caching-for-legacy-applications:concept-appcache-mode>application cache mode/a>. To do so, list all the static resources used by the HTML page you want to have work offline in an a href#concept-appcache-manifest idsupporting-offline-caching-for-legacy-applications:concept-appcache-manifest>application cache manifest/a>, use the code idsupporting-offline-caching-for-legacy-applications:attr-html-manifest>a href#attr-html-manifest>manifest/a>/code> attribute to select that manifest from the HTML file, and then add the following line at the bottom of the manifest:/p> pre>SETTINGS:prefer-onlineNETWORK:*/pre> p>This causes the a href#application-cache idsupporting-offline-caching-for-legacy-applications:application-cache>application cache/a> to only be used for a href#concept-appcache-master idsupporting-offline-caching-for-legacy-applications:concept-appcache-master>master entries/a> when the user is offline, and causes the application cache to be used as an atomic HTTP cache (essentially pinning resources listed in the manifest), while allowing all resources not listed in the manifest to be accessed normally when the user is online./p> h5 idappcacheevents>span classsecno>7.9.1.2/span> Event summarya href#appcacheevents classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>When the user visits a page that declares a manifest, the browser will try to update the cache. It does this by fetching a copy of the manifest and, if the manifest has changed since the user agent last saw it, redownloading all the resources it mentions and caching them anew./p> p>As this is going on, a number of events get fired on the code idappcacheevents:applicationcache>a href#applicationcache>ApplicationCache/a>/code> object to keep the script updated as to the state of the cache update, so that the user can be notified appropriately. The events are as follows:/p> table>thead>tr>th> Event name th> Interface th> Fired when... th> Next events tbody>tr>td> dfn idevent-appcache-checking>code>checking/code>/dfn> td> code idappcacheevents:event>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> The user agent is checking for an update, or attempting to download the manifest for the first time. strong>This is always the first event in the sequence./strong> td> code idappcacheevents:event-appcache-noupdate>a href#event-appcache-noupdate>noupdate/a>/code>, code idappcacheevents:event-appcache-downloading>a href#event-appcache-downloading>downloading/a>/code>, code idappcacheevents:event-appcache-obsolete>a href#event-appcache-obsolete>obsolete/a>/code>, code idappcacheevents:event-appcache-error>a href#event-appcache-error>error/a>/code> tr>td> dfn idevent-appcache-noupdate>code>noupdate/code>/dfn> td> code idappcacheevents:event-2>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> The manifest hadnt changed. td> Last event in sequence. tr>td> dfn idevent-appcache-downloading>code>downloading/code>/dfn> td> code idappcacheevents:event-3>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> The user agent has found an update and is fetching it, or is downloading the resources listed by the manifest for the first time. td> code idappcacheevents:event-appcache-progress>a href#event-appcache-progress>progress/a>/code>, code idappcacheevents:event-appcache-error-2>a href#event-appcache-error>error/a>/code>, code idappcacheevents:event-appcache-cached>a href#event-appcache-cached>cached/a>/code>, code idappcacheevents:event-appcache-updateready>a href#event-appcache-updateready>updateready/a>/code> tr>td> dfn idevent-appcache-progress>code>progress/code>/dfn> td> code idappcacheevents:progressevent>a data-x-internalprogressevent hrefhttps://xhr.spec.whatwg.org/#interface-progressevent>ProgressEvent/a>/code> td> The user agent is downloading resources listed by the manifest. The event objects code idappcacheevents:dom-progressevent-total>a data-x-internaldom-progressevent-total hrefhttps://xhr.spec.whatwg.org/#dom-progressevent-total>total/a>/code> attribute returns the total number of files to be downloaded. The event objects code idappcacheevents:dom-progressevent-loaded>a data-x-internaldom-progressevent-loaded hrefhttps://xhr.spec.whatwg.org/#dom-progressevent-loaded>loaded/a>/code> attribute returns the number of files processed so far. td> code idappcacheevents:event-appcache-progress-2>a href#event-appcache-progress>progress/a>/code>, code idappcacheevents:event-appcache-error-3>a href#event-appcache-error>error/a>/code>, code idappcacheevents:event-appcache-cached-2>a href#event-appcache-cached>cached/a>/code>, code idappcacheevents:event-appcache-updateready-2>a href#event-appcache-updateready>updateready/a>/code> tr>td> dfn idevent-appcache-cached>code>cached/code>/dfn> td> code idappcacheevents:event-4>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> The resources listed in the manifest have been downloaded, and the application is now cached. td> Last event in sequence. tr>td> dfn idevent-appcache-updateready>code>updateready/code>/dfn> td> code idappcacheevents:event-5>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> The resources listed in the manifest have been newly redownloaded, and the script can use code idappcacheevents:dom-appcache-swapcache>a href#dom-appcache-swapcache>swapCache()/a>/code> to switch to the new cache. td> Last event in sequence. tr>td> dfn idevent-appcache-obsolete>code>obsolete/code>/dfn> td> code idappcacheevents:event-6>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> The manifest was found to have become a 404 or 410 page, so the application cache is being deleted. td> Last event in sequence. tr>td rowspan4> dfn idevent-appcache-error>code>error/code>/dfn> td rowspan4> code idappcacheevents:event-7>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> The manifest was a 404 or 410 page, so the attempt to cache the application has been aborted. td rowspan3> Last event in sequence. tr>td> The manifest hadnt changed, but the page referencing the manifest failed to download properly. tr>td> A fatal error occurred while fetching the resources listed in the manifest. tr>td> The manifest changed while the update was being run. td> The user agent will try fetching the files again momentarily. /table> p>These events are cancelable; their default action is for the user agent to show download progress information. If the page shows its own update UI, canceling the events will prevent the user agent from showing redundant progress information./p> h4 idappcache>span classsecno>7.9.2/span> Application cachesa href#appcache classself-link>/a>/h4> p>An dfn idapplication-cache data-export>application cache/dfn> is a set of cached resources consisting of:/p> ul>li> p>One or more resources (including their out-of-band metadata, such as HTTP headers, if any), identified by URLs, each falling into one (or more) of the following categories:/p> dl>dt>dfn idconcept-appcache-master>Master entries/dfn> dd>p classnote>These are documents that were added to the cache because a a href#browsing-context idappcache:browsing-context>browsing context/a> was a href#navigate idappcache:navigate>navigated/a> to that document and the document indicated that this was its cache, using the code idappcache:attr-html-manifest>a href#attr-html-manifest>manifest/a>/code> attribute./p> dt>dfn idconcept-appcache-manifest>The manifest/dfn> dd>p classnote>This is the resource corresponding to the URL that was given in a master entrys code idappcache:the-html-element>a href#the-html-element>html/a>/code> elements code idappcache:attr-html-manifest-2>a href#attr-html-manifest>manifest/a>/code> attribute. The manifest is fetched and processed during the a href#application-cache-download-process idappcache:application-cache-download-process>application cache download process/a>. All the a href#concept-appcache-master idappcache:concept-appcache-master>master entries/a> have the a href#same-origin idappcache:same-origin>same origin/a> as the manifest./p> dt>dfn idconcept-appcache-explicit>Explicit entries/dfn> dd>p classnote>These are the resources that were listed in the caches a href#concept-appcache-manifest idappcache:concept-appcache-manifest>manifest/a> in an a href#concept-appcache-manifest-explicit idappcache:concept-appcache-manifest-explicit>explicit section/a>./p> dt>dfn idconcept-appcache-fallback>Fallback entries/dfn> dd>p classnote>These are the resources that were listed in the caches a href#concept-appcache-manifest idappcache:concept-appcache-manifest-2>manifest/a> in a a href#concept-appcache-manifest-fallback idappcache:concept-appcache-manifest-fallback>fallback section/a>./p> /dl> p>a href#concept-appcache-explicit idappcache:concept-appcache-explicit>Explicit entries/a> and a href#concept-appcache-fallback idappcache:concept-appcache-fallback>Fallback entries/a> can be marked as dfn idconcept-appcache-foreign>foreign/dfn>, which means that they have a code idappcache:attr-html-manifest-3>a href#attr-html-manifest>manifest/a>/code> attribute but that it doesnt point at this caches a href#concept-appcache-manifest idappcache:concept-appcache-manifest-3>manifest/a>./p> p classnote>A URL in the list can be flagged with multiple different types, and thus an entry can end up being categorized as multiple entries. For example, an entry can be a manifest entry and an explicit entry at the same time, if the manifest is listed within the manifest./p> li> p>Zero or more dfn idconcept-appcache-fallback-ns>fallback namespaces/dfn>, each of which is mapped to a a href#concept-appcache-fallback idappcache:concept-appcache-fallback-2>fallback entry/a>./p> p classnote>These are URLs used as a href#concept-appcache-matches-fallback idappcache:concept-appcache-matches-fallback>prefix match patterns/a> for resources that are to be fetched from the network if possible, or to be replaced by the corresponding a href#concept-appcache-fallback idappcache:concept-appcache-fallback-3>fallback entry/a> if not. Each namespace URL has the a href#same-origin idappcache:same-origin-2>same origin/a> as a href#concept-appcache-manifest idappcache:concept-appcache-manifest-4>the manifest/a>./p> li> p>Zero or more URLs that form the dfn idconcept-appcache-onlinesafelist>online safelist namespaces/dfn>./p> p classnote>These are used as prefix match patterns, and declare URLs for which the user agent will ignore the application cache, instead fetching them normally (i.e. from the network or local HTTP cache as appropriate)./p> li> p>An dfn idconcept-appcache-onlinesafelist-wildcard>online safelist wildcard flag/dfn>, which is either i>open/i> or i>blocking/i>./p> p classnote>The i>open/i> state indicates that any URL not listed as cached is to be implicitly treated as being in the a href#concept-appcache-onlinesafelist idappcache:concept-appcache-onlinesafelist>online safelist namespaces/a>; the i>blocking/i> state indicates that URLs not listed explicitly in the manifest are to be treated as unavailable./p> li> p>A dfn idconcept-appcache-mode>cache mode flag/dfn>, which is either in the dfn idconcept-appcache-mode-fast>i>fast/i>/dfn> state or the dfn idconcept-appcache-mode-prefer-online>i>prefer-online/i>/dfn> state./p> /ul> p>Each a href#application-cache idappcache:application-cache>application cache/a> has a dfn idconcept-appcache-completeness>completeness flag/dfn>, which is either i>complete/i> or i>incomplete/i>./p> hr> p>An dfn idapplication-cache-group>application cache group/dfn> is a group of a href#application-cache idappcache:application-cache-2>application caches/a>, identified by the a idappcache:absolute-url hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a> of a resource a href#concept-appcache-manifest idappcache:concept-appcache-manifest-5>manifest/a> which is used to populate the caches in the group./p> p>An a href#application-cache idappcache:application-cache-3>application cache/a> is dfn idconcept-appcache-newer>newer/dfn> than another if it was created after the other (in other words, a href#application-cache idappcache:application-cache-4>application caches/a> in an a href#application-cache-group idappcache:application-cache-group>application cache group/a> have a chronological order)./p> p>Only the newest a href#application-cache idappcache:application-cache-5>application cache/a> in an a href#application-cache-group idappcache:application-cache-group-2>application cache group/a> can have its a href#concept-appcache-completeness idappcache:concept-appcache-completeness>completeness flag/a> set to i>incomplete/i>; the others are always all i>complete/i>./p> p>Each a href#application-cache-group idappcache:application-cache-group-3>application cache group/a> has an dfn idconcept-appcache-status>update status/dfn>, which is one of the following: i>idle/i>, i>checking/i>, i>downloading/i>./p> p>A dfn idrelevant-application-cache>relevant application cache/dfn> is an a href#application-cache idappcache:application-cache-6>application cache/a> that is the a href#concept-appcache-newer idappcache:concept-appcache-newer>newest/a> in its a href#application-cache-group idappcache:application-cache-group-4>group/a> to be i>complete/i>./p> p>Each a href#application-cache-group idappcache:application-cache-group-5>application cache group/a> has a dfn idconcept-appcache-pending-masters>list of pending master entries/dfn>. Each entry in this list consists of a resource and a corresponding code idappcache:document>a href#document>Document/a>/code> object. It is used during the a href#application-cache-download-process idappcache:application-cache-download-process-2>application cache download process/a> to ensure that new master entries are cached even if the a href#application-cache-download-process idappcache:application-cache-download-process-3>application cache download process/a> was already running for their a href#application-cache-group idappcache:application-cache-group-6>application cache group/a> when they were loaded./p> p>An a href#application-cache-group idappcache:application-cache-group-7>application cache group/a> can be marked as dfn idconcept-appcache-obsolete>obsolete/dfn>, meaning that it must be ignored when looking at what a href#application-cache-group idappcache:application-cache-group-8>application cache groups/a> exist./p> hr> p>A dfn idcache-host>cache host/dfn> is a code idappcache:document-2>a href#document>Document/a>/code> object./p> p>Each a href#cache-host idappcache:cache-host>cache host/a> has an associated code idappcache:applicationcache>a href#applicationcache>ApplicationCache/a>/code> object./p> p>Each a href#cache-host idappcache:cache-host-2>cache host/a> initially is not associated with an a href#application-cache idappcache:application-cache-7>application cache/a>, but can become associated with one early during the page load process, when steps a href#parser-appcache>in the parser/a> and in the a href#navigate idappcache:navigate-2>navigation/a> sections cause a href#concept-appcache-init idappcache:concept-appcache-init>cache selection/a> to occur./p> hr> p>Multiple a href#application-cache idappcache:application-cache-8>application caches/a> in different a href#application-cache-group idappcache:application-cache-group-9>application cache groups/a> can contain the same resource, e.g. if the manifests all reference that resource. If the user agent is to dfn idconcept-appcache-selection>select an application cache/dfn> from a list of a href#relevant-application-cache idappcache:relevant-application-cache>relevant application caches/a> that contain a resource, the user agent must use the application cache that the user most likely wants to see the resource from, taking into account the following:/p> ul>li>which application cache was most recently updated, li>which application cache was being used to display the resource from which the user decided to look at the new resource, and li>which application cache the user prefers. /ul> hr> p>A URL dfn idconcept-appcache-matches-fallback>matches a fallback namespace/dfn> if there exists a a href#relevant-application-cache idappcache:relevant-application-cache-2>relevant application cache/a> whose a href#concept-appcache-manifest idappcache:concept-appcache-manifest-6>manifest/a>s URL has the a href#same-origin idappcache:same-origin-3>same origin/a> as the URL in question, and that has a a href#concept-appcache-fallback-ns idappcache:concept-appcache-fallback-ns>fallback namespace/a> that is a a href#prefix-match idappcache:prefix-match>prefix match/a> for the URL being examined. If multiple fallback namespaces match the same URL, the longest one is the one that matches. A URL looking for a fallback namespace can match more than one application cache at a time, but only matches one namespace in each cache./p> div classexample> p>If a manifest code>https://example.com/app1/manifest/code> declares that code>https://example.com/resources/images/code> is a fallback namespace, and the user navigates to code>https://example.com:80/resources/images/cat.png/code>, then the user agent will decide that the application cache identified by code>https://example.com/app1/manifest/code> contains a namespace with a match for that URL./p> /div> h4 idmanifests>span classsecno>7.9.3/span> The cache manifest syntaxa href#manifests classself-link>/a>/h4> h5 idsome-sample-manifests>span classsecno>7.9.3.1/span> Some sample manifestsa href#some-sample-manifests classself-link>/a>/h5> p>i>This section is non-normative./i>/p> div classexample> p>This example manifest requires two images and a style sheet to be cached and safelists a CGI script./p> pre>CACHE MANIFEST# the above line is required# this is a comment# there can be as many of these anywhere in the file# they are all ignored # comments can have spaces before them # but must be alone on the line# blank lines are ignored too# these are files that need to be cached they can either be listed# first, or a CACHE: header could be put before them, as is done# lower down.images/sound-icon.pngimages/background.png# note that each file has to be put on its own line# here is a file for the online safelist -- it isnt cached, and# references to this file will bypass the cache, always hitting the# network (or trying to, if the user is offline).NETWORK:comm.cgi# here is another set of files to cache, this time just the CSS file.CACHE:style/default.css/pre> p>It could equally well be written as follows:/p> pre>CACHE MANIFESTNETWORK:comm.cgiCACHE:style/default.cssimages/sound-icon.pngimages/background.png/pre> /div> div classexample> p>Offline application cache manifests can use absolute paths or even absolute URLs:/p> pre>CACHE MANIFEST/main/home/main/app.js/settings/home/settings/app.jshttps://img.example.com/logo.pnghttps://img.example.com/check.pnghttps://img.example.com/cross.png/pre> /div> div classexample> p>The following manifest defines a catch-all error page that is displayed for any page on the site while the user is offline. It also specifies that the a href#concept-appcache-onlinesafelist-wildcard idsome-sample-manifests:concept-appcache-onlinesafelist-wildcard>online safelist wildcard flag/a> is i>open/i>, meaning that accesses to resources on other sites will not be blocked. (Resources on the same site are already not blocked because of the catch-all fallback namespace.)/p> p>So long as all pages on the site reference this manifest, they will get cached locally as they are fetched, so that subsequent hits to the same page will load the page immediately from the cache. Until the manifest is changed, those pages will not be fetched from the server again. When the manifest changes, then all the files will be redownloaded./p> p>Subresources, such as style sheets, images, etc, would only be cached using the regular HTTP caching semantics, however./p> pre>CACHE MANIFESTFALLBACK:/ /offline.htmlNETWORK:*/pre> /div> h5 idwriting-cache-manifests>span classsecno>7.9.3.2/span> Writing cache manifestsa href#writing-cache-manifests classself-link>/a>/h5> p>Manifests must be served using the code idwriting-cache-manifests:text/cache-manifest>a href#text/cache-manifest>text/cache-manifest/a>/code> a idwriting-cache-manifests:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a>. All resources served using the code idwriting-cache-manifests:text/cache-manifest-2>a href#text/cache-manifest>text/cache-manifest/a>/code> a idwriting-cache-manifests:mime-type-2 hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> must follow the syntax of application cache manifests, as described in this section./p> p>An application cache manifest is a text file, whose text is encoded using UTF-8. Data in application cache manifests is line-based. Newlines must be represented by U+000A LINE FEED (LF) characters, U+000D CARRIAGE RETURN (CR) characters, or U+000D CARRIAGE RETURN (CR) U+000A LINE FEED (LF) pairs. a href#refsENCODING>ENCODING/a>/p> p classnote>This is a a href#willful-violation idwriting-cache-manifests:willful-violation>willful violation/a> of RFC 2046, which requires all code>text/*/code> types to only allow CRLF line breaks. This requirement, however, is outdated; the use of CR, LF, and CRLF line breaks is commonly supported and indeed sometimes CRLF is em>not/em> supported by text editors. a href#refsRFC2046>RFC2046/a>/p> p>The first line of an application cache manifest must consist of the string CACHE, a single U+0020 SPACE character, the string MANIFEST, and either a U+0020 SPACE character, a U+0009 CHARACTER TABULATION (tab) character, a U+000A LINE FEED (LF) character, or a U+000D CARRIAGE RETURN (CR) character. The first line may optionally be preceded by a U+FEFF BYTE ORDER MARK (BOM) character. If any other text is found on the first line, it is ignored./p> p>Subsequent lines, if any, must all be one of the following:/p> dl>dt>A blank line dd> p>Blank lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters only./p> dt>A comment dd> p>Comment lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters, followed by a single U+0023 NUMBER SIGN character (#), followed by zero or more characters other than U+000A LINE FEED (LF) and U+000D CARRIAGE RETURN (CR) characters./p> p classnote>Comments need to be on a line on their own. If they were to be included on a line with a URL, the # would be mistaken for part of a a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idwriting-cache-manifests:concept-url-fragment data-x-internalconcept-url-fragment>fragment/a>./p> dt>A section header dd> p>Section headers change the current section. There are four possible section headers: dl>dt>code>CACHE:/code> dd>Switches to the dfn idconcept-appcache-manifest-explicit>explicit section/dfn>. dt>code>FALLBACK:/code> dd>Switches to the dfn idconcept-appcache-manifest-fallback>fallback section/dfn>. dt>code>NETWORK:/code> dd>Switches to the dfn idconcept-appcache-manifest-network>online safelist section/dfn>. dt>code>SETTINGS:/code> dd>Switches to the dfn idconcept-appcache-manifest-settings>settings section/dfn>. /dl> p>Section header lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters, followed by one of the names above (including the U+003A COLON character (:)) followed by zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters./p> p>Ironically, by default, the current section is the a href#concept-appcache-manifest-explicit idwriting-cache-manifests:concept-appcache-manifest-explicit>explicit section/a>./p> dt>Data for the current section dd> p>The format that data lines must take depends on the current section./p> p>When the current section is the a href#concept-appcache-manifest-explicit idwriting-cache-manifests:concept-appcache-manifest-explicit-2>explicit section/a>, data lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters, a a idwriting-cache-manifests:valid-url-string hrefhttps://url.spec.whatwg.org/#valid-url-string data-x-internalvalid-url-string>valid URL string/a> identifying a resource other than the manifest itself, and then zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters./p> p>When the current section is the a href#concept-appcache-manifest-fallback idwriting-cache-manifests:concept-appcache-manifest-fallback>fallback section/a>, data lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters, a a idwriting-cache-manifests:valid-url-string-2 hrefhttps://url.spec.whatwg.org/#valid-url-string data-x-internalvalid-url-string>valid URL string/a> identifying a resource other than the manifest itself, one or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters, another a idwriting-cache-manifests:valid-url-string-3 hrefhttps://url.spec.whatwg.org/#valid-url-string data-x-internalvalid-url-string>valid URL string/a> identifying a resource other than the manifest itself, and then zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters./p> p>When the current section is the a href#concept-appcache-manifest-network idwriting-cache-manifests:concept-appcache-manifest-network>online safelist section/a>, data lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters, either a single U+002A ASTERISK character (*) or a a idwriting-cache-manifests:valid-url-string-4 hrefhttps://url.spec.whatwg.org/#valid-url-string data-x-internalvalid-url-string>valid URL string/a> identifying a resource other than the manifest itself, and then zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters./p> p>When the current section is the a href#concept-appcache-manifest-settings idwriting-cache-manifests:concept-appcache-manifest-settings>settings section/a>, data lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters, a a href#concept-appcache-manifest-setting idwriting-cache-manifests:concept-appcache-manifest-setting>setting/a>, and then zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters./p> p>Currently only one dfn idconcept-appcache-manifest-setting>setting/dfn> is defined:/p> dl>dt>The cache mode settingdd>This consists of the string code>prefer-online/code>. It sets the a href#concept-appcache-mode idwriting-cache-manifests:concept-appcache-mode>cache mode/a> to a href#concept-appcache-mode-prefer-online idwriting-cache-manifests:concept-appcache-mode-prefer-online>prefer-online/a>. (The a href#concept-appcache-mode idwriting-cache-manifests:concept-appcache-mode-2>cache mode/a> defaults to a href#concept-appcache-mode-fast idwriting-cache-manifests:concept-appcache-mode-fast>fast/a>.)/dl> p>Within a a href#concept-appcache-manifest-settings idwriting-cache-manifests:concept-appcache-manifest-settings-2>settings section/a>, each a href#concept-appcache-manifest-setting idwriting-cache-manifests:concept-appcache-manifest-setting-2>setting/a> must occur no more than once./p> /dl> p>Manifests may contain sections more than once. Sections may be empty./p> p>URLs that are to be fallback pages associated with a href#concept-appcache-fallback-ns idwriting-cache-manifests:concept-appcache-fallback-ns>fallback namespaces/a>, and those namespaces themselves, must be given in a href#concept-appcache-manifest-fallback idwriting-cache-manifests:concept-appcache-manifest-fallback-2>fallback sections/a>, with the namespace being the first URL of the data line, and the corresponding fallback page being the second URL. All the other pages to be cached must be listed in a href#concept-appcache-manifest-explicit idwriting-cache-manifests:concept-appcache-manifest-explicit-3>explicit sections/a>./p> p>a href#concept-appcache-fallback-ns idwriting-cache-manifests:concept-appcache-fallback-ns-2>Fallback namespaces/a> and a href#concept-appcache-fallback idwriting-cache-manifests:concept-appcache-fallback>fallback entries/a> must have the a href#same-origin idwriting-cache-manifests:same-origin>same origin/a> as the manifest itself. a href#concept-appcache-fallback-ns idwriting-cache-manifests:concept-appcache-fallback-ns-3>Fallback namespaces/a> must also be in the same path as the manifests URL./p> p>A a href#concept-appcache-fallback-ns idwriting-cache-manifests:concept-appcache-fallback-ns-4>fallback namespace/a> must not be listed more than once./p> p>Namespaces that the user agent is to put into the a href#concept-appcache-onlinesafelist idwriting-cache-manifests:concept-appcache-onlinesafelist>online safelist/a> must all be specified in a href#concept-appcache-manifest-network idwriting-cache-manifests:concept-appcache-manifest-network-2>online safelist sections/a>. (This is needed for any URL that the page is intending to use to communicate back to the server.) To specify that all URLs are automatically safelisted in this way, a U+002A ASTERISK character (*) may be specified as one of the URLs. /p> p>Authors should not include namespaces in the a href#concept-appcache-onlinesafelist idwriting-cache-manifests:concept-appcache-onlinesafelist-2>online safelist/a> for which another namespace in the a href#concept-appcache-onlinesafelist idwriting-cache-manifests:concept-appcache-onlinesafelist-3>online safelist/a> is a a href#prefix-match idwriting-cache-manifests:prefix-match>prefix match/a>./p> p>a hrefhttps://url.spec.whatwg.org/#syntax-url-relative idwriting-cache-manifests:relative-url data-x-internalrelative-url>Relative URLs/a> must be given relative to the manifests own URL. All URLs in the manifest must have the same a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idwriting-cache-manifests:concept-url-scheme data-x-internalconcept-url-scheme>scheme/a> as the manifest itself (either explicitly or implicitly, through the use of a hrefhttps://url.spec.whatwg.org/#syntax-url-relative idwriting-cache-manifests:relative-url-2 data-x-internalrelative-url>relative URLs/a>). a href#refsURL>URL/a>/p> p>URLs in manifests must not have a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idwriting-cache-manifests:concept-url-fragment-2 data-x-internalconcept-url-fragment>fragments/a> (i.e. the U+0023 NUMBER SIGN character isnt allowed in URLs in manifests)./p> p>a href#concept-appcache-fallback-ns idwriting-cache-manifests:concept-appcache-fallback-ns-5>Fallback namespaces/a> and namespaces in the a href#concept-appcache-onlinesafelist idwriting-cache-manifests:concept-appcache-onlinesafelist-4>online safelist/a> are matched by a href#prefix-match idwriting-cache-manifests:prefix-match-2>prefix match/a>./p> h5 idparsing-cache-manifests>span classsecno>7.9.3.3/span> Parsing cache manifestsa href#parsing-cache-manifests classself-link>/a>/h5> p>When a user agent is to dfn idparse-a-manifest>parse a manifest/dfn>, it means that the user agent must run the following steps:/p> ol>li> p>a idparsing-cache-manifests:utf-8-decode hrefhttps://encoding.spec.whatwg.org/#utf-8-decode data-x-internalutf-8-decode>UTF-8 decode/a> the byte stream corresponding with the manifest to be parsed./p> p classnote>The a idparsing-cache-manifests:utf-8-decode-2 hrefhttps://encoding.spec.whatwg.org/#utf-8-decode data-x-internalutf-8-decode>UTF-8 decode/a> algorithm strips a leading BOM, if any./p> li>p>Let var>base URL/var> be the a idparsing-cache-manifests:absolute-url hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a> representing the manifest.li>p>Apply the a idparsing-cache-manifests:url-parser hrefhttps://url.spec.whatwg.org/#concept-url-parser data-x-internalurl-parser>URL parser/a> to var>base URL/var>, and let var>manifest path/var> be the a hrefhttps://url.spec.whatwg.org/#concept-url-path idparsing-cache-manifests:concept-url-path data-x-internalconcept-url-path>path/a> component thus obtained.li>p>Remove all the characters in var>manifest path/var> after the last U+002F SOLIDUS character (/), if any. (The first character and the last character in var>manifest path/var> after this step will both be slashes, the URL path separator character.)li>p>Apply the a idparsing-cache-manifests:url-parser-2 hrefhttps://url.spec.whatwg.org/#concept-url-parser data-x-internalurl-parser>URL parser/a> steps to the var>base URL/var>, so that the components from its a idparsing-cache-manifests:url-record hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a> can be used by the subsequent steps of this algorithm.li>p>Let var>explicit URLs/var> be an initially empty list of a hrefhttps://url.spec.whatwg.org/#syntax-url-absolute idparsing-cache-manifests:absolute-url-2 data-x-internalabsolute-url>absolute URLs/a> for a href#concept-appcache-explicit idparsing-cache-manifests:concept-appcache-explicit>explicit entries/a>.li>p>Let var>fallback URLs/var> be an initially empty mapping of a href#concept-appcache-fallback-ns idparsing-cache-manifests:concept-appcache-fallback-ns>fallback namespaces/a> to a hrefhttps://url.spec.whatwg.org/#syntax-url-absolute idparsing-cache-manifests:absolute-url-3 data-x-internalabsolute-url>absolute URLs/a> for a href#concept-appcache-fallback idparsing-cache-manifests:concept-appcache-fallback>fallback entries/a>.li>p>Let var>online safelist namespaces/var> be an initially empty list of a hrefhttps://url.spec.whatwg.org/#syntax-url-absolute idparsing-cache-manifests:absolute-url-4 data-x-internalabsolute-url>absolute URLs/a> for an a href#concept-appcache-onlinesafelist idparsing-cache-manifests:concept-appcache-onlinesafelist>online safelist/a>.li>p>Let var>online safelist 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 manifests byte stream.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the first character.li>p>If the characters starting from var>position/var> are CACHE, followed by a U+0020 SPACE character, followed by MANIFEST, then advance var>position/var> to the next character after those. Otherwise, this isnt a cache manifest; abort this algorithm with a failure while checking for the magic signature.li>p>If the character at var>position/var> is neither a U+0020 SPACE character, a U+0009 CHARACTER TABULATION (tab) character, U+000A LINE FEED (LF) character, nor a U+000D CARRIAGE RETURN (CR) character, then this isnt a cache manifest; abort this algorithm with a failure while checking for the magic signature.li>p>This is a cache manifest. The algorithm cannot fail beyond this point (though bogus lines can get ignored).li>p>a idparsing-cache-manifests:collect-a-sequence-of-code-points hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are em>not/em> U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters from var>input/var> given var>position/var>, and ignore those characters. (Extra text on the first line, after the signature, is ignored.)li>p>Let var>mode/var> be explicit.li>p>i>Start of line/i>: If var>position/var> is past the end of var>input/var>, then jump to the last step. Otherwise, a idparsing-cache-manifests:collect-a-sequence-of-code-points-2 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>collect a sequence of code points/a> that are U+000A LINE FEED (LF), U+000D CARRIAGE RETURN (CR), U+0020 SPACE, or U+0009 CHARACTER TABULATION (tab) characters from var>input/var> given var>position/var>.li>p>Now, a idparsing-cache-manifests:collect-a-sequence-of-code-points-3 hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>collect a sequence of code points/a> that are em>not/em> U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters from var>input/var> given var>position/var>, and let the result be var>line/var>.li>p>Drop any trailing U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters at the end of var>line/var>.li>p>If var>line/var> is the empty string, then jump back to the step labeled i>start of line/i>.li>p>If the first character in var>line/var> is a U+0023 NUMBER SIGN character (#), then jump back to the step labeled i>start of line/i>.li>p>If var>line/var> equals CACHE: (the word CACHE followed by a U+003A COLON character (:)), then set var>mode/var> to explicit and jump back to the step labeled i>start of line/i>.li>p>If var>line/var> equals FALLBACK: (the word FALLBACK followed by a U+003A COLON character (:)), then set var>mode/var> to fallback and jump back to the step labeled i>start of line/i>.li>p>If var>line/var> equals NETWORK: (the word NETWORK followed by a U+003A COLON character (:)), then set var>mode/var> to online safelist and jump back to the step labeled i>start of line/i>.li>p>If var>line/var> equals SETTINGS: (the word SETTINGS followed by a U+003A COLON character (:)), then set var>mode/var> to settings and jump back to the step labeled i>start of line/i>.li>p>If var>line/var> ends with a U+003A COLON character (:), then set var>mode/var> to unknown and jump back to the step labeled i>start of line/i>.li>p>This is either a data line or it is syntactically incorrect.li>p>Let var>position/var> be a pointer into var>line/var>, initially pointing at the start of the string.li>p>Let var>tokens/var> be a list of strings, initially empty.li> p>While var>position/var> doesnt point past the end of var>line/var>:/p> ol>li>p>Let var>current token/var> be an empty string.li>p>While var>position/var> doesnt point past the end of var>line/var> and the character at var>position/var> is neither a U+0020 SPACE nor a U+0009 CHARACTER TABULATION (tab) character, add the character at var>position/var> to var>current token/var> and advance var>position/var> to the next character in var>input/var>.li>p>Add var>current token/var> to the var>tokens/var> list.li>p>While var>position/var> doesnt point past the end of var>line/var> and the character at var>position/var> is either a U+0020 SPACE or a U+0009 CHARACTER TABULATION (tab) character, advance var>position/var> to the next character in var>input/var>./ol> li> p>Process var>tokens/var> as follows:/p> dl classswitch>dt>If var>mode/var> is explicitdd> p>Let var>urlRecord/var> be the result of a hrefhttps://url.spec.whatwg.org/#concept-url-parser idparsing-cache-manifests:url-parser-3 data-x-internalurl-parser>parsing/a> the first item in var>tokens/var> with var>base URL/var>; ignore the rest./p> p>If var>urlRecord/var> is failure, then jump back to the step labeled i>start of line/i>./p> p>If var>urlRecord/var> has a different a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idparsing-cache-manifests:concept-url-scheme data-x-internalconcept-url-scheme>scheme/a> component than var>base URL/var> (the manifests URL), then jump back to the step labeled i>start of line/i>./p> p>Let var>new URL/var> be the result of applying the a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idparsing-cache-manifests:concept-url-serializer data-x-internalconcept-url-serializer>URL serializer/a> algorithm to var>urlRecord/var>, with the i>exclude fragment flag/i> set./p> p>Add var>new URL/var> to the var>explicit URLs/var>./p> dt>If var>mode/var> is fallbackdd> p>Let var>part one/var> be the first token in var>tokens/var>, and let var>part two/var> be the second token in var>tokens/var>./p> p>Let var>urlRecordOne/var> be the result of a hrefhttps://url.spec.whatwg.org/#concept-url-parser idparsing-cache-manifests:url-parser-4 data-x-internalurl-parser>parsing/a> var>part one/var> with var>base URL/var>./p> p>Let var>urlRecordTwo/var> be the result of a hrefhttps://url.spec.whatwg.org/#concept-url-parser idparsing-cache-manifests:url-parser-5 data-x-internalurl-parser>parsing/a> var>part two/var> with var>base URL/var>./p> p>If either var>urlRecordOne/var> or var>urlRecordTwo/var> are failure, then jump back to the step labeled i>start of line/i>./p> p>If the a hrefhttps://url.spec.whatwg.org/#concept-url-origin idparsing-cache-manifests:concept-url-origin data-x-internalconcept-url-origin>origin/a> of either var>urlRecordOne/var> or var>urlRecordTwo/var> is not a href#same-origin idparsing-cache-manifests:same-origin>same origin/a> with the manifests URL a hrefhttps://url.spec.whatwg.org/#concept-url-origin idparsing-cache-manifests:concept-url-origin-2 data-x-internalconcept-url-origin>origin/a>, then jump back to the step labeled i>start of line/i>./p> p>Let var>part one path/var> be the a hrefhttps://url.spec.whatwg.org/#concept-url-path idparsing-cache-manifests:concept-url-path-2 data-x-internalconcept-url-path>path/a> component of var>urlRecordOne/var>./p> p>If var>manifest path/var> is not a a href#prefix-match idparsing-cache-manifests:prefix-match>prefix match/a> for var>part one path/var>, then jump back to the step labeled i>start of line/i>./p> p>Let var>part one/var> be the result of applying the a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idparsing-cache-manifests:concept-url-serializer-2 data-x-internalconcept-url-serializer>URL serializer/a> algorithm to var>urlRecordOne/var>, with the i>exclude fragment flag/i> set./p> p>Let var>part two/var> be the result of applying the a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idparsing-cache-manifests:concept-url-serializer-3 data-x-internalconcept-url-serializer>URL serializer/a> algorithm to var>urlRecordTwo/var>, with the i>exclude fragment flag/i> set./p> p>If var>part one/var> is already in the var>fallback URLs/var> mapping as a a href#concept-appcache-fallback-ns idparsing-cache-manifests:concept-appcache-fallback-ns-2>fallback namespace/a>, then jump back to the step labeled i>start of line/i>./p> p>Otherwise, add var>part one/var> to the var>fallback URLs/var> mapping as a a href#concept-appcache-fallback-ns idparsing-cache-manifests:concept-appcache-fallback-ns-3>fallback namespace/a>, mapped to var>part two/var> as the a href#concept-appcache-fallback idparsing-cache-manifests:concept-appcache-fallback-2>fallback entry/a>./p> dt>If var>mode/var> is online safelistdd> p>If the first item in var>tokens/var> is a U+002A ASTERISK character (*), then set var>online safelist wildcard flag/var> to i>open/i> and jump back to the step labeled i>start of line/i>./p> p>Otherwise, let var>urlRecord/var> be the result of a hrefhttps://url.spec.whatwg.org/#concept-url-parser idparsing-cache-manifests:url-parser-6 data-x-internalurl-parser>parsing/a> the first item in var>tokens/var> with var>base URL/var>./p> p>If var>urlRecord/var> is failure, then jump back to the step labeled i>start of line/i>./p> p>If var>urlRecord/var> has a different a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idparsing-cache-manifests:concept-url-scheme-2 data-x-internalconcept-url-scheme>scheme/a> component than var>base URL/var> (the manifests URL), then jump back to the step labeled i>start of line/i>./p> p>Let var>new URL/var> be the result of applying the a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idparsing-cache-manifests:concept-url-serializer-4 data-x-internalconcept-url-serializer>URL serializer/a> algorithm to var>urlRecord/var>, with the i>exclude fragment flag/i> set./p> p>Add var>new URL/var> to the var>online safelist namespaces/var>./p> dt>If var>mode/var> is settingsdd> p>If var>tokens/var> contains a single token, and that token is a a href#case-sensitive idparsing-cache-manifests:case-sensitive>case-sensitive/a> match for the string code>prefer-online/code>, then set var>cache mode flag/var> to i>prefer-online/i> and jump back to the step labeled i>start of line/i>./p> p>Otherwise, the line is an unsupported setting: do nothing; the line is ignored./p> dt>If var>mode/var> is unknowndd> p>Do nothing. The line is ignored./p> /dl> li>p>Jump back to the step labeled i>start of line/i>. (That step jumps to the next, and last, step when the end of the file is reached.)li>p>Return the var>explicit URLs/var> list, the var>fallback URLs/var> mapping, the var>online safelist namespaces/var>, the var>online safelist wildcard flag/var>, and the var>cache mode flag/var>./ol> div classnote> p>The resource that declares the manifest (with the code idparsing-cache-manifests:attr-html-manifest>a href#attr-html-manifest>manifest/a>/code> attribute) will always get taken from the cache, whether it is listed in the cache or not, even if it is listed in an a href#concept-appcache-onlinesafelist idparsing-cache-manifests:concept-appcache-onlinesafelist-2>online safelist namespace/a>./p> p>If a resource is listed in the a href#concept-appcache-manifest-explicit idparsing-cache-manifests:concept-appcache-manifest-explicit>explicit section/a> or as a a href#concept-appcache-fallback idparsing-cache-manifests:concept-appcache-fallback-3>fallback entry/a> in the a href#concept-appcache-manifest-fallback idparsing-cache-manifests:concept-appcache-manifest-fallback>fallback section/a>, the resource will always be taken from the cache, regardless of any other matching entries in the a href#concept-appcache-fallback-ns idparsing-cache-manifests:concept-appcache-fallback-ns-4>fallback namespaces/a> or a href#concept-appcache-onlinesafelist idparsing-cache-manifests:concept-appcache-onlinesafelist-3>online safelist namespaces/a>./p> p>When a a href#concept-appcache-fallback-ns idparsing-cache-manifests:concept-appcache-fallback-ns-5>fallback namespace/a> and an a href#concept-appcache-onlinesafelist idparsing-cache-manifests:concept-appcache-onlinesafelist-4>online safelist namespace/a> overlap, the a href#concept-appcache-onlinesafelist idparsing-cache-manifests:concept-appcache-onlinesafelist-5>online safelist namespace/a> has priority./p> p>The a href#concept-appcache-onlinesafelist-wildcard idparsing-cache-manifests:concept-appcache-onlinesafelist-wildcard>online safelist wildcard flag/a> is applied last, only for URLs that match neither the a href#concept-appcache-onlinesafelist idparsing-cache-manifests:concept-appcache-onlinesafelist-6>online safelist namespace/a> nor the a href#concept-appcache-fallback-ns idparsing-cache-manifests:concept-appcache-fallback-ns-6>fallback namespace/a> and that are not listed in the a href#concept-appcache-manifest-explicit idparsing-cache-manifests:concept-appcache-manifest-explicit-2>explicit section/a>./p> /div> h4 iddownloading-or-updating-an-application-cache>span classsecno>7.9.4/span> Downloading or updating an application cachea href#downloading-or-updating-an-application-cache classself-link>/a>/h4> p>When the user agent is required (by other parts of this specification) to start the dfn idapplication-cache-download-process>application cache download process/dfn> for an a iddownloading-or-updating-an-application-cache:absolute-url hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a> purported to identify a a href#concept-appcache-manifest iddownloading-or-updating-an-application-cache:concept-appcache-manifest>manifest/a>, or for an a href#application-cache-group iddownloading-or-updating-an-application-cache:application-cache-group>application cache group/a>, potentially given a particular a href#cache-host iddownloading-or-updating-an-application-cache:cache-host>cache host/a>, and potentially given a a href#concept-appcache-master iddownloading-or-updating-an-application-cache:concept-appcache-master>master/a> resource, the user agent must run the steps below. These steps are always run a href#in-parallel iddownloading-or-updating-an-application-cache:in-parallel>in parallel/a> with the a href#event-loop iddownloading-or-updating-an-application-cache:event-loop>event loop/a> a href#concept-task iddownloading-or-updating-an-application-cache:concept-task>tasks/a>./p> p>Some of these steps have requirements that only apply if the user agent dfn idshows-caching-progress>shows caching progress/dfn>. Support for this is optional. Caching progress UI could consist of a progress bar or message panel in the user agents interface, or an overlay, or something else. Certain events fired during the a href#application-cache-download-process iddownloading-or-updating-an-application-cache:application-cache-download-process>application cache download process/a> allow the script to override the display of such an interface. (Such events are delayed until after the code iddownloading-or-updating-an-application-cache:event-load>a href#event-load>load/a>/code> event has fired.) The goal of this is to allow Web applications to provide more seamless update mechanisms, hiding from the user the mechanics of the application cache mechanism. User agents may display user interfaces independent of this, but are encouraged to not show prominent update progress notifications for applications that cancel the relevant events./p> p>The a href#application-cache-download-process iddownloading-or-updating-an-application-cache:application-cache-download-process-2>application cache download process/a> steps are as follows: ol>li>p>Optionally, wait until the permission to start the a href#application-cache-download-process iddownloading-or-updating-an-application-cache:application-cache-download-process-3>application cache download process/a> has been obtained from the user and until the user agent is confident that the network is available. This could include doing nothing until the user explicitly opts-in to caching the site, or could involve prompting the user for permission. The algorithm might never get past this point. (This step is particularly intended to be used by user agents running on severely space-constrained devices or in highly privacy-sensitive environments).li> p>Atomically, so as to avoid race conditions, perform the following substeps:/p> ol>li> p>Pick the appropriate substeps:/p> dl classswitch>dt>If these steps were invoked with an a iddownloading-or-updating-an-application-cache:absolute-url-2 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a> purported to identify a a href#concept-appcache-manifest iddownloading-or-updating-an-application-cache:concept-appcache-manifest-2>manifest/a>dd> p>Let var>manifest URL/var> be that a iddownloading-or-updating-an-application-cache:absolute-url-3 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a>./p> p>If there is no a href#application-cache-group iddownloading-or-updating-an-application-cache:application-cache-group-2>application cache group/a> identified by var>manifest URL/var>, then create a new a href#application-cache-group iddownloading-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 iddownloading-or-updating-an-application-cache:application-cache>application caches/a>. One will be created later in this algorithm./p> dt>If these steps were invoked with an a href#application-cache-group iddownloading-or-updating-an-application-cache:application-cache-group-4>application cache group/a>dd> p>Let var>manifest URL/var> be the a iddownloading-or-updating-an-application-cache:absolute-url-4 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a> of the a href#concept-appcache-manifest iddownloading-or-updating-an-application-cache:concept-appcache-manifest-3>manifest/a> used to identify the a href#application-cache-group iddownloading-or-updating-an-application-cache:application-cache-group-5>application cache group/a> to be updated./p> p>If that a href#application-cache-group iddownloading-or-updating-an-application-cache:application-cache-group-6>application cache group/a> is a href#concept-appcache-obsolete iddownloading-or-updating-an-application-cache:concept-appcache-obsolete>obsolete/a>, then abort this instance of the a href#application-cache-download-process iddownloading-or-updating-an-application-cache:application-cache-download-process-4>application cache download process/a>. This can happen if another instance of this algorithm found the manifest to be 404 or 410 while this algorithm was waiting in the first step above./p> /dl> li>p>Let var>cache group/var> be the a href#application-cache-group iddownloading-or-updating-an-application-cache:application-cache-group-7>application cache group/a> identified by var>manifest URL/var>.li>p>If these steps were invoked with a a href#concept-appcache-master iddownloading-or-updating-an-application-cache:concept-appcache-master-2>master/a> resource, then add the resource, along with the resources code iddownloading-or-updating-an-application-cache:document>a href#document>Document/a>/code>, to var>cache group/var>s a href#concept-appcache-pending-masters iddownloading-or-updating-an-application-cache:concept-appcache-pending-masters>list of pending master entries/a>.li> p>If these steps were invoked with a a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-2>cache host/a>, and the a href#concept-appcache-status iddownloading-or-updating-an-application-cache:concept-appcache-status>status/a> of var>cache group/var> is i>checking/i> or i>downloading/i>, then a href#queue-a-post-load-task iddownloading-or-updating-an-application-cache:queue-a-post-load-task>queue a post-load task/a> to run these steps:/p> ol>li>p>Let var>showProgress/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire iddownloading-or-updating-an-application-cache:concept-event-fire data-x-internalconcept-event-fire>firing an event/a> named code iddownloading-or-updating-an-application-cache:event-appcache-checking>a href#event-appcache-checking>checking/a>/code> at the code iddownloading-or-updating-an-application-cache:applicationcache>a href#applicationcache>ApplicationCache/a>/code> singleton of that a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-3>cache host/a>, with the code iddownloading-or-updating-an-application-cache:dom-event-cancelable>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true.li>p>If var>showProgress/var> is true and the user agent a href#shows-caching-progress iddownloading-or-updating-an-application-cache:shows-caching-progress>shows caching progress/a>, then display some sort of user interface indicating to the user that the user agent is checking to see if it can download the application./ol> li> p>If these steps were invoked with a a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-4>cache host/a>, and the a href#concept-appcache-status iddownloading-or-updating-an-application-cache:concept-appcache-status-2>status/a> of var>cache group/var> is i>downloading/i>, then also a href#queue-a-post-load-task iddownloading-or-updating-an-application-cache:queue-a-post-load-task-2>queue a post-load task/a> to run these steps:/p> ol>li>p>Let var>showProgress/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire iddownloading-or-updating-an-application-cache:concept-event-fire-2 data-x-internalconcept-event-fire>firing an event/a> named code iddownloading-or-updating-an-application-cache:event-appcache-downloading>a href#event-appcache-downloading>downloading/a>/code> at the code iddownloading-or-updating-an-application-cache:applicationcache-2>a href#applicationcache>ApplicationCache/a>/code> singleton of that a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-5>cache host/a>, with the code iddownloading-or-updating-an-application-cache:dom-event-cancelable-2>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true.li>p>If var>showProgress/var> is true and the user agent a href#shows-caching-progress iddownloading-or-updating-an-application-cache:shows-caching-progress-2>shows caching progress/a>, then display some sort of user interface indicating to the user the application is being downloaded./ol> li>p>If the a href#concept-appcache-status iddownloading-or-updating-an-application-cache:concept-appcache-status-3>status/a> of the var>cache group/var> is either i>checking/i> or i>downloading/i>, then abort this instance of the a href#application-cache-download-process iddownloading-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 iddownloading-or-updating-an-application-cache:concept-appcache-status-4>status/a> of var>cache group/var> to i>checking/i>./p> li> p>For each a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-6>cache host/a> associated with an a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-2>application cache/a> in var>cache group/var>, a href#queue-a-post-load-task iddownloading-or-updating-an-application-cache:queue-a-post-load-task-3>queue a post-load task/a> run these steps:/p> ol>li>p>Let var>showProgress/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire iddownloading-or-updating-an-application-cache:concept-event-fire-3 data-x-internalconcept-event-fire>firing an event/a> named code iddownloading-or-updating-an-application-cache:event-appcache-checking-2>a href#event-appcache-checking>checking/a>/code> at the code iddownloading-or-updating-an-application-cache:applicationcache-3>a href#applicationcache>ApplicationCache/a>/code> singleton of the a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-7>cache host/a>, with the code iddownloading-or-updating-an-application-cache:dom-event-cancelable-3>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true.li>p>If var>showProgress/var> is true and the user agent a href#shows-caching-progress iddownloading-or-updating-an-application-cache:shows-caching-progress-3>shows caching progress/a>, then display some sort of user interface indicating to the user that the user agent is checking for the availability of updates./ol> /ol> p classnote>The remainder of the steps run a href#in-parallel iddownloading-or-updating-an-application-cache:in-parallel-2>in parallel/a>./p> p>If var>cache group/var> already has an a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-3>application cache/a> in it, then this is an dfn idconcept-appcache-upgrade>upgrade attempt/dfn>. Otherwise, this is a dfn idconcept-appcache-cache>cache attempt/dfn>./p> li> p>If this is a a href#concept-appcache-cache iddownloading-or-updating-an-application-cache:concept-appcache-cache>cache attempt/a>, then this algorithm was invoked with a a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-8>cache host/a>; a href#queue-a-post-load-task iddownloading-or-updating-an-application-cache:queue-a-post-load-task-4>queue a post-load task/a> to run these steps:/p> ol>li>p>Let var>showProgress/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire iddownloading-or-updating-an-application-cache:concept-event-fire-4 data-x-internalconcept-event-fire>firing an event/a> named code iddownloading-or-updating-an-application-cache:event-appcache-checking-3>a href#event-appcache-checking>checking/a>/code> at the code iddownloading-or-updating-an-application-cache:applicationcache-4>a href#applicationcache>ApplicationCache/a>/code> singleton of that a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-9>cache host/a>, with the code iddownloading-or-updating-an-application-cache:dom-event-cancelable-4>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true.li>p>If var>showProgress/var> is true and the user agent a href#shows-caching-progress iddownloading-or-updating-an-application-cache:shows-caching-progress-4>shows caching progress/a>, then display some sort of user interface indicating to the user that the user agent is checking for the availability of updates./ol> li>p>Let var>request/var> be a new a hrefhttps://fetch.spec.whatwg.org/#concept-request iddownloading-or-updating-an-application-cache:concept-request data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url iddownloading-or-updating-an-application-cache:concept-request-url data-x-internalconcept-request-url>url/a> is var>manifest URL/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-client iddownloading-or-updating-an-application-cache:concept-request-client data-x-internalconcept-request-client>client/a> is null, a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination iddownloading-or-updating-an-application-cache:concept-request-destination data-x-internalconcept-request-destination>destination/a> is the empty string, a hrefhttps://fetch.spec.whatwg.org/#concept-request-referrer iddownloading-or-updating-an-application-cache:concept-request-referrer data-x-internalconcept-request-referrer>referrer/a> is code>no-referrer/code>, a iddownloading-or-updating-an-application-cache:synchronous-flag hrefhttps://fetch.spec.whatwg.org/#synchronous-flag data-x-internalsynchronous-flag>synchronous flag/a> is set, a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode iddownloading-or-updating-an-application-cache:concept-request-credentials-mode data-x-internalconcept-request-credentials-mode>credentials mode/a> is code>include/code>, and whose a iddownloading-or-updating-an-application-cache:use-url-credentials-flag hrefhttps://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag data-x-internaluse-url-credentials-flag>use-URL-credentials flag/a> is set.li> p>i>Fetching the manifest/i>: Let var>manifest/var> be the result of a hrefhttps://fetch.spec.whatwg.org/#concept-fetch iddownloading-or-updating-an-application-cache:concept-fetch data-x-internalconcept-fetch>fetching/a> var>request/var>. HTTP caching semantics should be honored for this request./p> p>Parse var>manifest/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-body iddownloading-or-updating-an-application-cache:concept-response-body data-x-internalconcept-response-body>body/a> according to the a href#parse-a-manifest iddownloading-or-updating-an-application-cache:parse-a-manifest>rules for parsing manifests/a>, obtaining a list of a href#concept-appcache-explicit iddownloading-or-updating-an-application-cache:concept-appcache-explicit>explicit entries/a>, a href#concept-appcache-fallback iddownloading-or-updating-an-application-cache:concept-appcache-fallback>fallback entries/a> and the a href#concept-appcache-fallback-ns iddownloading-or-updating-an-application-cache:concept-appcache-fallback-ns>fallback namespaces/a> that map to them, entries for the a href#concept-appcache-onlinesafelist iddownloading-or-updating-an-application-cache:concept-appcache-onlinesafelist>online safelist/a>, and values for the a href#concept-appcache-onlinesafelist-wildcard iddownloading-or-updating-an-application-cache:concept-appcache-onlinesafelist-wildcard>online safelist wildcard flag/a> and the a href#concept-appcache-mode iddownloading-or-updating-an-application-cache:concept-appcache-mode>cache mode flag/a>./p> p classnote>The a iddownloading-or-updating-an-application-cache:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> of the resource is ignored — it is assumed to be code iddownloading-or-updating-an-application-cache:text/cache-manifest>a href#text/cache-manifest>text/cache-manifest/a>/code>. In the future, if new manifest formats are supported, the different types will probably be distinguished on the basis of the file signatures (for the current format, that is the code>CACHE MANIFEST/code> string at the top of the file)./p> li> p>If i>fetching the manifest/i> fails due to a 404 or 410 response status, then run these substeps:/p> ol>li>p>Mark var>cache group/var> as a href#concept-appcache-obsolete iddownloading-or-updating-an-application-cache:concept-appcache-obsolete-2>obsolete/a>. This var>cache group/var> no longer exists for any purpose other than the processing of code iddownloading-or-updating-an-application-cache:document-2>a href#document>Document/a>/code> objects already associated with an a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-4>application cache/a> in the var>cache group/var>.li>p>Let var>task list/var> be an empty list of a href#concept-task iddownloading-or-updating-an-application-cache:concept-task-2>tasks/a>./p> li> p>For each a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-10>cache host/a> associated with an a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-5>application cache/a> in var>cache group/var>, create a a href#concept-task iddownloading-or-updating-an-application-cache:concept-task-3>task/a> to run these steps and append it to var>task list/var>:/p> ol>li>p>Let var>showProgress/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire iddownloading-or-updating-an-application-cache:concept-event-fire-5 data-x-internalconcept-event-fire>firing an event/a> named code iddownloading-or-updating-an-application-cache:event-appcache-obsolete>a href#event-appcache-obsolete>obsolete/a>/code> at the code iddownloading-or-updating-an-application-cache:applicationcache-5>a href#applicationcache>ApplicationCache/a>/code> singleton of the a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-11>cache host/a>, with the code iddownloading-or-updating-an-application-cache:dom-event-cancelable-5>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true.li>p>If var>showProgress/var> is true and the user agent a href#shows-caching-progress iddownloading-or-updating-an-application-cache:shows-caching-progress-5>shows caching progress/a>, then display some sort of user interface indicating to the user that the application is no longer available for offline use./ol> li> p>For each entry in var>cache group/var>s a href#concept-appcache-pending-masters iddownloading-or-updating-an-application-cache:concept-appcache-pending-masters-2>list of pending master entries/a>, create a a href#concept-task iddownloading-or-updating-an-application-cache:concept-task-4>task/a> to run these steps and append it to var>task list/var>:/p> ol>li>p>Let var>showProgress/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire iddownloading-or-updating-an-application-cache:concept-event-fire-6 data-x-internalconcept-event-fire>firing an event/a> named code iddownloading-or-updating-an-application-cache:event-appcache-error>a href#event-appcache-error>error/a>/code> (not code iddownloading-or-updating-an-application-cache:event-appcache-obsolete-2>a href#event-appcache-obsolete>obsolete/a>/code>!) at the code iddownloading-or-updating-an-application-cache:applicationcache-6>a href#applicationcache>ApplicationCache/a>/code> singleton of the code iddownloading-or-updating-an-application-cache:document-3>a href#document>Document/a>/code> for this entry, if there still is one, with the code iddownloading-or-updating-an-application-cache:dom-event-cancelable-6>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true.li>p>If var>showProgress/var> is true and the user agent a href#shows-caching-progress iddownloading-or-updating-an-application-cache:shows-caching-progress-6>shows caching progress/a>, then display some sort of user interface indicating to the user that the user agent failed to save the application for offline use./ol> li>p>If var>cache group/var> has an a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-6>application cache/a> whose a href#concept-appcache-completeness iddownloading-or-updating-an-application-cache:concept-appcache-completeness>completeness flag/a> is i>incomplete/i>, then discard that a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-7>application cache/a>./p> li>p>If appropriate, remove any user interface indicating that an update for this cache is in progress.li>p>Let the a href#concept-appcache-status iddownloading-or-updating-an-application-cache:concept-appcache-status-5>status/a> of var>cache group/var> be i>idle/i>.li>p>For each a href#concept-task iddownloading-or-updating-an-application-cache:concept-task-5>task/a> in var>task list/var>, a href#queue-a-post-load-task iddownloading-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 iddownloading-or-updating-an-application-cache:application-cache-download-process-6>application cache download process/a>./ol> li> p>Otherwise, if i>fetching the manifest/i> fails in some other way (e.g. the server returns another 4xx or 5xx response, or there is a DNS error, or the connection times out, or the user cancels the download, or the parser for manifests fails when checking the magic signature), or if the server returned a redirect, then run the a href#cache-failure-steps iddownloading-or-updating-an-application-cache:cache-failure-steps>cache failure steps/a>. a href#refsHTTP>HTTP/a>/p> li> p>If this is an a href#concept-appcache-upgrade iddownloading-or-updating-an-application-cache:concept-appcache-upgrade>upgrade attempt/a> and the newly downloaded var>manifest/var> is byte-for-byte identical to the manifest found in the a href#concept-appcache-newer iddownloading-or-updating-an-application-cache:concept-appcache-newer>newest/a> a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-8>application cache/a> in var>cache group/var>, or the response status is code>304/code>, then run these substeps:/p> ol>li>p>Let var>cache/var> be the a href#concept-appcache-newer iddownloading-or-updating-an-application-cache:concept-appcache-newer-2>newest/a> a href#application-cache iddownloading-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 iddownloading-or-updating-an-application-cache:concept-task-6>tasks/a>./p> li> p>For each entry in var>cache group/var>s a href#concept-appcache-pending-masters iddownloading-or-updating-an-application-cache:concept-appcache-pending-masters-3>list of pending master entries/a>, wait for the resource for this entry to have either completely downloaded or failed./p> p>If the download failed (e.g. the server returns a 4xx or 5xx response, or there is a DNS error, the connection times out, or the user cancels the download), or if the resource is labeled with the no-store cache directive, then create a a href#concept-task iddownloading-or-updating-an-application-cache:concept-task-7>task/a> to run these steps and append it to var>task list/var>:/p> ol>li>p>Let var>showProgress/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire iddownloading-or-updating-an-application-cache:concept-event-fire-7 data-x-internalconcept-event-fire>firing an event/a> named code iddownloading-or-updating-an-application-cache:event-appcache-error-2>a href#event-appcache-error>error/a>/code> at the code iddownloading-or-updating-an-application-cache:applicationcache-7>a href#applicationcache>ApplicationCache/a>/code> singleton of the code iddownloading-or-updating-an-application-cache:document-4>a href#document>Document/a>/code> for this entry, if there still is one, with the code iddownloading-or-updating-an-application-cache:dom-event-cancelable-7>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true.li>p>If var>showProgress/var> is true and the user agent a href#shows-caching-progress iddownloading-or-updating-an-application-cache:shows-caching-progress-7>shows caching progress/a>, then display some sort of user interface indicating to the user that the user agent failed to save the application for offline use./ol> p>Otherwise, associate the code iddownloading-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 isnt already there, and categorize its entry as a a href#concept-appcache-master iddownloading-or-updating-an-application-cache:concept-appcache-master-3>master entry/a>. If applying the a iddownloading-or-updating-an-application-cache:url-parser hrefhttps://url.spec.whatwg.org/#concept-url-parser data-x-internalurl-parser>URL parser/a> algorithm to the resources a iddownloading-or-updating-an-application-cache:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> results in a a iddownloading-or-updating-an-application-cache:url-record hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a> that has a non-null a hrefhttps://url.spec.whatwg.org/#concept-url-fragment iddownloading-or-updating-an-application-cache:concept-url-fragment data-x-internalconcept-url-fragment>fragment/a> component, the a iddownloading-or-updating-an-application-cache:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> used for the entry in var>cache/var> must instead be the a iddownloading-or-updating-an-application-cache:absolute-url-5 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a> obtained from applying the a hrefhttps://url.spec.whatwg.org/#concept-url-serializer iddownloading-or-updating-an-application-cache:concept-url-serializer data-x-internalconcept-url-serializer>URL serializer/a> algorithm to the a iddownloading-or-updating-an-application-cache:url-record-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a> with the i>exclude fragment flag/i> set (application caches never include a hrefhttps://url.spec.whatwg.org/#concept-url-fragment iddownloading-or-updating-an-application-cache:concept-url-fragment-2 data-x-internalconcept-url-fragment>fragments/a>)./p> li> p>For each a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-12>cache host/a> associated with an a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-10>application cache/a> in var>cache group/var>, create a a href#concept-task iddownloading-or-updating-an-application-cache:concept-task-8>task/a> to run these steps and append it to var>task list/var>:/p> ol>li>p>Let var>showProgress/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire iddownloading-or-updating-an-application-cache:concept-event-fire-8 data-x-internalconcept-event-fire>firing an event/a> named code iddownloading-or-updating-an-application-cache:event-appcache-noupdate>a href#event-appcache-noupdate>noupdate/a>/code> at the code iddownloading-or-updating-an-application-cache:applicationcache-8>a href#applicationcache>ApplicationCache/a>/code> singleton of the a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-13>cache host/a>, with the code iddownloading-or-updating-an-application-cache:dom-event-cancelable-8>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true.li>p>If var>showProgress/var> is true and the user agent a href#shows-caching-progress iddownloading-or-updating-an-application-cache:shows-caching-progress-8>shows caching progress/a>, then display some sort of user interface indicating to the user that the application is up to date./ol> li>p>Empty var>cache group/var>s a href#concept-appcache-pending-masters iddownloading-or-updating-an-application-cache:concept-appcache-pending-masters-4>list of pending master entries/a>.li>p>If appropriate, remove any user interface indicating that an update for this cache is in progress.li>p>Let the a href#concept-appcache-status iddownloading-or-updating-an-application-cache:concept-appcache-status-6>status/a> of var>cache group/var> be i>idle/i>.li>p>For each a href#concept-task iddownloading-or-updating-an-application-cache:concept-task-9>task/a> in var>task list/var>, a href#queue-a-post-load-task iddownloading-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 iddownloading-or-updating-an-application-cache:application-cache-download-process-7>application cache download process/a>./ol> li>p>Let var>new cache/var> be a newly created a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-11>application cache/a> in var>cache group/var>. Set its a href#concept-appcache-completeness iddownloading-or-updating-an-application-cache:concept-appcache-completeness-2>completeness flag/a> to i>incomplete/i>.li>p>For each entry in var>cache group/var>s a href#concept-appcache-pending-masters iddownloading-or-updating-an-application-cache:concept-appcache-pending-masters-5>list of pending master entries/a>, associate the code iddownloading-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 iddownloading-or-updating-an-application-cache:concept-appcache-status-7>status/a> of var>cache group/var> to i>downloading/i>.li> p>For each a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-14>cache host/a> associated with an a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-12>application cache/a> in var>cache group/var>, a href#queue-a-post-load-task iddownloading-or-updating-an-application-cache:queue-a-post-load-task-7>queue a post-load task/a> to run these steps:/p> ol>li>p>Let var>showProgress/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire iddownloading-or-updating-an-application-cache:concept-event-fire-9 data-x-internalconcept-event-fire>firing an event/a> named code iddownloading-or-updating-an-application-cache:event-appcache-downloading-2>a href#event-appcache-downloading>downloading/a>/code> at the code iddownloading-or-updating-an-application-cache:applicationcache-9>a href#applicationcache>ApplicationCache/a>/code> singleton of the a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-15>cache host/a>, with the code iddownloading-or-updating-an-application-cache:dom-event-cancelable-9>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true.li>p>If var>showProgress/var> is true and the user agent a href#shows-caching-progress iddownloading-or-updating-an-application-cache:shows-caching-progress-9>shows caching progress/a>, then display some sort of user interface indicating to the user that a new version is being downloaded./ol> 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 iddownloading-or-updating-an-application-cache:concept-appcache-explicit-2>explicit entries/a> obtained by parsing var>manifest/var> to var>file list/var>, each flagged with explicit entry.li>p>Add all the URLs in the list of a href#concept-appcache-fallback iddownloading-or-updating-an-application-cache:concept-appcache-fallback-2>fallback entries/a> obtained by parsing var>manifest/var> to var>file list/var>, each flagged with fallback entry.li>p>If this is an a href#concept-appcache-upgrade iddownloading-or-updating-an-application-cache:concept-appcache-upgrade-2>upgrade attempt/a>, then add all the URLs of a href#concept-appcache-master iddownloading-or-updating-an-application-cache:concept-appcache-master-4>master entries/a> in the a href#concept-appcache-newer iddownloading-or-updating-an-application-cache:concept-appcache-newer-3>newest/a> a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-13>application cache/a> in var>cache group/var> whose a href#concept-appcache-completeness iddownloading-or-updating-an-application-cache:concept-appcache-completeness-3>completeness flag/a> is i>complete/i> to var>file list/var>, each flagged with master entry.li>p>If any URL is in var>file list/var> more than once, then merge the entries into one entry for that URL, that entry having all the flags that the original entries had.li> p>For each URL in var>file list/var>, run the following steps. These steps may be run in parallel for two or more of the URLs at a time. If, while running these steps, the code iddownloading-or-updating-an-application-cache:applicationcache-10>a href#applicationcache>ApplicationCache/a>/code> objects code iddownloading-or-updating-an-application-cache:dom-appcache-abort>a href#dom-appcache-abort>abort()/a>/code> method a href#send-a-signal iddownloading-or-updating-an-application-cache:send-a-signal>sends a signal/a> to this instance of the a href#application-cache-download-process iddownloading-or-updating-an-application-cache:application-cache-download-process-8>application cache download process/a> algorithm, then run the a href#cache-failure-steps iddownloading-or-updating-an-application-cache:cache-failure-steps-2>cache failure steps/a> instead./p> ol>li> p>If the resource URL being processed was flagged as neither an explicit entry nor or a fallback entry, then the user agent may skip this URL./p> p classnote>This is intended to allow user agents to expire resources not listed in the manifest from the cache. Generally, implementors are urged to use an approach that expires lesser-used resources first./p> li> p>For each a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-16>cache host/a> associated with an a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-14>application cache/a> in var>cache group/var>, a href#queue-a-progress-post-load-task iddownloading-or-updating-an-application-cache:queue-a-progress-post-load-task>queue a progress post-load task/a> to run these steps:/p> ol>li>p>Let var>showProgress/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire iddownloading-or-updating-an-application-cache:concept-event-fire-10 data-x-internalconcept-event-fire>firing an event/a> named code iddownloading-or-updating-an-application-cache:event-appcache-progress>a href#event-appcache-progress>progress/a>/code> at the code iddownloading-or-updating-an-application-cache:applicationcache-11>a href#applicationcache>ApplicationCache/a>/code> singleton of the a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-17>cache host/a>, using code iddownloading-or-updating-an-application-cache:progressevent>a data-x-internalprogressevent hrefhttps://xhr.spec.whatwg.org/#interface-progressevent>ProgressEvent/a>/code>, with the code iddownloading-or-updating-an-application-cache:dom-event-cancelable-10>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true, the code iddownloading-or-updating-an-application-cache:dom-progressevent-lengthcomputable>a data-x-internaldom-progressevent-lengthcomputable hrefhttps://xhr.spec.whatwg.org/#dom-progressevent-lengthcomputable>lengthComputable/a>/code> attribute initialized to true, the code iddownloading-or-updating-an-application-cache:dom-progressevent-total>a data-x-internaldom-progressevent-total hrefhttps://xhr.spec.whatwg.org/#dom-progressevent-total>total/a>/code> attribute initialized to the number of files in var>file list/var>, and the code iddownloading-or-updating-an-application-cache:dom-progressevent-loaded>a data-x-internaldom-progressevent-loaded hrefhttps://xhr.spec.whatwg.org/#dom-progressevent-loaded>loaded/a>/code> attribute initialized to the number of files in var>file list/var> that have been either downloaded or skipped so far. a href#refsXHR>XHR/a>li>p>If var>showProgress/var> is true and the user agent a href#shows-caching-progress iddownloading-or-updating-an-application-cache:shows-caching-progress-10>shows caching progress/a>, then display some sort of user interface indicating to the user that a file is being downloaded in preparation for updating the application./ol> li>p>Let var>request/var> be a new a hrefhttps://fetch.spec.whatwg.org/#concept-request iddownloading-or-updating-an-application-cache:concept-request-2 data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url iddownloading-or-updating-an-application-cache:concept-request-url-2 data-x-internalconcept-request-url>url/a> is URL, a hrefhttps://fetch.spec.whatwg.org/#concept-request-client iddownloading-or-updating-an-application-cache:concept-request-client-2 data-x-internalconcept-request-client>client/a> is null, a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination iddownloading-or-updating-an-application-cache:concept-request-destination-2 data-x-internalconcept-request-destination>destination/a> is the empty string, a hrefhttps://fetch.spec.whatwg.org/#concept-request-origin iddownloading-or-updating-an-application-cache:concept-request-origin data-x-internalconcept-request-origin>origin/a> is var>manifest URL/var>s a href#concept-origin iddownloading-or-updating-an-application-cache:concept-origin>origin/a>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-referrer iddownloading-or-updating-an-application-cache:concept-request-referrer-2 data-x-internalconcept-request-referrer>referrer/a> is code>no-referrer/code>, a iddownloading-or-updating-an-application-cache:synchronous-flag-2 hrefhttps://fetch.spec.whatwg.org/#synchronous-flag data-x-internalsynchronous-flag>synchronous flag/a> is set, a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode iddownloading-or-updating-an-application-cache:concept-request-credentials-mode-2 data-x-internalconcept-request-credentials-mode>credentials mode/a> is code>include/code>, a iddownloading-or-updating-an-application-cache:use-url-credentials-flag-2 hrefhttps://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag data-x-internaluse-url-credentials-flag>use-URL-credentials flag/a> is set, and a hrefhttps://fetch.spec.whatwg.org/#concept-request-redirect-mode iddownloading-or-updating-an-application-cache:concept-request-redirect-mode data-x-internalconcept-request-redirect-mode>redirect mode/a> is code>manual/code>.li>p>a hrefhttps://fetch.spec.whatwg.org/#concept-fetch iddownloading-or-updating-an-application-cache:concept-fetch-2 data-x-internalconcept-fetch>Fetch/a> var>request/var>. If this is an a href#concept-appcache-upgrade iddownloading-or-updating-an-application-cache:concept-appcache-upgrade-3>upgrade attempt/a>, then use the a href#concept-appcache-newer iddownloading-or-updating-an-application-cache:concept-appcache-newer-4>newest/a> a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-15>application cache/a> in var>cache group/var> as an HTTP cache, and honor HTTP caching semantics (such as expiration, ETags, and so forth) with respect to that cache. User agents may also have other caches in place that are also honored.li> p>If the previous step fails (e.g. the server returns a 4xx or 5xx response, or there is a DNS error, or the connection times out, or the user cancels the download), or if the server returned a redirect, or if the resource is labeled with the no-store cache directive, then run the first appropriate step from the following list: a href#refsHTTP>HTTP/a>/p> dl classswitch>dt>If the URL being processed was flagged as an explicit entry or a fallback entrydd> p>If these steps are being run in parallel for any other URLs in var>file list/var>, then abort these steps for those other URLs. Run the a href#cache-failure-steps iddownloading-or-updating-an-application-cache:cache-failure-steps-3>cache failure steps/a>./p> p classnote>Redirects are fatal because they are either indicative of a network problem (e.g. a captive portal); or would allow resources to be added to the cache under URLs that differ from any URL that the networking model will allow access to, leaving orphan entries; or would allow resources to be stored under URLs different than their true URLs. All of these situations are bad./p> dt>If the error was a 404 or 410 HTTP responsedt>If the resource was labeled with the no-store cache directivedd> p>Skip this resource. It is dropped from the cache./p> dt>Otherwisedd> p>Copy the resource and its metadata from the a href#concept-appcache-newer iddownloading-or-updating-an-application-cache:concept-appcache-newer-5>newest/a> a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-16>application cache/a> in var>cache group/var> whose a href#concept-appcache-completeness iddownloading-or-updating-an-application-cache:concept-appcache-completeness-4>completeness flag/a> is i>complete/i>, and act as if that was the fetched resource, ignoring the resource obtained from the network./p> /dl> p>User agents may warn the user of these errors as an aid to development./p> p classnote>These rules make errors for resources listed in the manifest fatal, while making it possible for other resources to be removed from caches when they are removed from the server, without errors, and making non-manifest resources survive server-side errors./p> p classnote>Except for the no-store directive, HTTP caching rules that would cause a file to be expired or otherwise not cached are ignored for the purposes of the a href#application-cache-download-process iddownloading-or-updating-an-application-cache:application-cache-download-process-9>application cache download process/a>./p> li> p>Otherwise, the fetching succeeded. Store the resource in the var>new cache/var>./p> p>If the user agent is not able to store the resource (e.g. because of quota restrictions), the user agent may prompt the user or try to resolve the problem in some other manner (e.g. automatically pruning content in other caches). If the problem cannot be resolved, the user agent must run the a href#cache-failure-steps iddownloading-or-updating-an-application-cache:cache-failure-steps-4>cache failure steps/a>./p> li>p>If the URL being processed was flagged as an explicit entry in var>file list/var>, then categorize the entry as an a href#concept-appcache-explicit iddownloading-or-updating-an-application-cache:concept-appcache-explicit-3>explicit entry/a>.li>p>If the URL being processed was flagged as a fallback entry in var>file list/var>, then categorize the entry as a a href#concept-appcache-fallback iddownloading-or-updating-an-application-cache:concept-appcache-fallback-3>fallback entry/a>.li>p>If the URL being processed was flagged as an master entry in var>file list/var>, then categorize the entry as a a href#concept-appcache-master iddownloading-or-updating-an-application-cache:concept-appcache-master-5>master entry/a>.li>p>As an optimization, if the resource is an HTML or XML file whose a iddownloading-or-updating-an-application-cache:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> is an code iddownloading-or-updating-an-application-cache:the-html-element>a href#the-html-element>html/a>/code> element with a code iddownloading-or-updating-an-application-cache:attr-html-manifest>a href#attr-html-manifest>manifest/a>/code> attribute whose value doesnt match the manifest URL of the application cache being processed, then the user agent should mark the entry as being a href#concept-appcache-foreign iddownloading-or-updating-an-application-cache:concept-appcache-foreign>foreign/a>./p> /ol> li> p>For each a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-18>cache host/a> associated with an a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-17>application cache/a> in var>cache group/var>, a href#queue-a-progress-post-load-task iddownloading-or-updating-an-application-cache:queue-a-progress-post-load-task-2>queue a progress post-load task/a> to run these steps:/p> ol>li>p>Let var>showProgress/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire iddownloading-or-updating-an-application-cache:concept-event-fire-11 data-x-internalconcept-event-fire>firing an event /a> named code iddownloading-or-updating-an-application-cache:event-appcache-progress-2>a href#event-appcache-progress>progress/a>/code> at the code iddownloading-or-updating-an-application-cache:applicationcache-12>a href#applicationcache>ApplicationCache/a>/code> singleton of the a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-19>cache host/a>, using code iddownloading-or-updating-an-application-cache:progressevent-2>a data-x-internalprogressevent hrefhttps://xhr.spec.whatwg.org/#interface-progressevent>ProgressEvent/a>/code>, with the code iddownloading-or-updating-an-application-cache:dom-event-cancelable-11>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true, the code iddownloading-or-updating-an-application-cache:dom-progressevent-lengthcomputable-2>a data-x-internaldom-progressevent-lengthcomputable hrefhttps://xhr.spec.whatwg.org/#dom-progressevent-lengthcomputable>lengthComputable/a>/code> attribute initialized to true, and the code iddownloading-or-updating-an-application-cache:dom-progressevent-total-2>a data-x-internaldom-progressevent-total hrefhttps://xhr.spec.whatwg.org/#dom-progressevent-total>total/a>/code> and code iddownloading-or-updating-an-application-cache:dom-progressevent-loaded-2>a data-x-internaldom-progressevent-loaded hrefhttps://xhr.spec.whatwg.org/#dom-progressevent-loaded>loaded/a>/code> attributes initialized to the number of files in var>file list/var>. a href#refsXHR>XHR/a>li>p>If var>showProgress/var> is true and the user agent a href#shows-caching-progress iddownloading-or-updating-an-application-cache:shows-caching-progress-11>shows caching progress/a>, then display some sort of user interface indicating to the user that all the files have been downloaded. /ol> li>p>Store the list of a href#concept-appcache-fallback-ns iddownloading-or-updating-an-application-cache:concept-appcache-fallback-ns-2>fallback namespaces/a>, and the URLs of the a href#concept-appcache-fallback iddownloading-or-updating-an-application-cache:concept-appcache-fallback-4>fallback entries/a> that they map to, in var>new cache/var>.li>p>Store the URLs that form the new a href#concept-appcache-onlinesafelist iddownloading-or-updating-an-application-cache:concept-appcache-onlinesafelist-2>online safelist/a> in var>new cache/var>.li>p>Store the value of the new a href#concept-appcache-onlinesafelist-wildcard iddownloading-or-updating-an-application-cache:concept-appcache-onlinesafelist-wildcard-2>online safelist wildcard flag/a> in var>new cache/var>.li>p>Store the value of the new a href#concept-appcache-mode iddownloading-or-updating-an-application-cache:concept-appcache-mode-2>cache mode flag/a> in var>new cache/var>.li> p>For each entry in var>cache group/var>s a href#concept-appcache-pending-masters iddownloading-or-updating-an-application-cache:concept-appcache-pending-masters-6>list of pending master entries/a>, wait for the resource for this entry to have either completely downloaded or failed./p> p>If the download failed (e.g. the server returns a 4xx or 5xx response, or there is a DNS error, the connection times out, or the user cancels the download), or if the resource is labeled with the no-store cache directive, then run these substeps:/p> ol>li>p>Unassociate the code iddownloading-or-updating-an-application-cache:document-7>a href#document>Document/a>/code> for this entry from var>new cache/var>.li> p>a href#queue-a-post-load-task iddownloading-or-updating-an-application-cache:queue-a-post-load-task-8>Queue a post-load task/a> to run these steps:/p> ol>li>p>Let var>showProgress/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire iddownloading-or-updating-an-application-cache:concept-event-fire-12 data-x-internalconcept-event-fire>firing an event/a> named code iddownloading-or-updating-an-application-cache:event-appcache-error-3>a href#event-appcache-error>error/a>/code> at the code iddownloading-or-updating-an-application-cache:applicationcache-13>a href#applicationcache>ApplicationCache/a>/code> singleton of the code iddownloading-or-updating-an-application-cache:document-8>a href#document>Document/a>/code> for this entry, if there still is one, with the code iddownloading-or-updating-an-application-cache:dom-event-cancelable-12>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true.li>p>If var>showProgress/var> is true and the user agent a href#shows-caching-progress iddownloading-or-updating-an-application-cache:shows-caching-progress-12>shows caching progress/a>, then display some sort of user interface indicating to the user that the user agent failed to save the application for offline use./ol> li> p>If this is a a href#concept-appcache-cache iddownloading-or-updating-an-application-cache:concept-appcache-cache-2>cache attempt/a> and this entry is the last entry in var>cache group/var>s a href#concept-appcache-pending-masters iddownloading-or-updating-an-application-cache:concept-appcache-pending-masters-7>list of pending master entries/a>, then run these further substeps:/p> ol>li>p>Discard var>cache group/var> and its only a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-18>application cache/a>, var>new cache/var>./p> li>p>If appropriate, remove any user interface indicating that an update for this cache is in progress.li>p>Abort the a href#application-cache-download-process iddownloading-or-updating-an-application-cache:application-cache-download-process-10>application cache download process/a>./ol> li>p>Otherwise, remove this entry from var>cache group/var>s a href#concept-appcache-pending-masters iddownloading-or-updating-an-application-cache:concept-appcache-pending-masters-8>list of pending master entries/a>./ol> p>Otherwise, store the resource for this entry in var>new cache/var>, if it isnt already there, and categorize its entry as a a href#concept-appcache-master iddownloading-or-updating-an-application-cache:concept-appcache-master-6>master entry/a>./p> li>p>Let var>request/var> be a new a hrefhttps://fetch.spec.whatwg.org/#concept-request iddownloading-or-updating-an-application-cache:concept-request-3 data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url iddownloading-or-updating-an-application-cache:concept-request-url-3 data-x-internalconcept-request-url>url/a> is var>manifest URL/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-client iddownloading-or-updating-an-application-cache:concept-request-client-3 data-x-internalconcept-request-client>client/a> is null, a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination iddownloading-or-updating-an-application-cache:concept-request-destination-3 data-x-internalconcept-request-destination>destination/a> is the empty string, a hrefhttps://fetch.spec.whatwg.org/#concept-request-referrer iddownloading-or-updating-an-application-cache:concept-request-referrer-3 data-x-internalconcept-request-referrer>referrer/a> is code>no-referrer/code>, a iddownloading-or-updating-an-application-cache:synchronous-flag-3 hrefhttps://fetch.spec.whatwg.org/#synchronous-flag data-x-internalsynchronous-flag>synchronous flag/a> is set, a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode iddownloading-or-updating-an-application-cache:concept-request-credentials-mode-3 data-x-internalconcept-request-credentials-mode>credentials mode/a> is code>include/code>, and whose a iddownloading-or-updating-an-application-cache:use-url-credentials-flag-3 hrefhttps://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag data-x-internaluse-url-credentials-flag>use-URL-credentials flag/a> is set.li> p>Let var>second manifest/var> be the result of a hrefhttps://fetch.spec.whatwg.org/#concept-fetch iddownloading-or-updating-an-application-cache:concept-fetch-3 data-x-internalconcept-fetch>fetching/a> var>request/var>. HTTP caching semantics should again be honored for this request./p> p classnote>Since caching can be honored, authors are encouraged to avoid setting the cache headers on the manifest in such a way that the user agent would simply not contact the network for this second request; otherwise, the user agent would not notice if the cache had changed during the cache update process./p> li> p>If the previous step failed for any reason, or if the fetching attempt involved a redirect, or if var>second manifest/var> and var>manifest/var> are not byte-for-byte identical, then schedule a rerun of the entire algorithm with the same parameters after a short delay, and run the a href#cache-failure-steps iddownloading-or-updating-an-application-cache:cache-failure-steps-5>cache failure steps/a>./p> li> p>Otherwise, store var>manifest/var> in var>new cache/var>, if its not there already, and categorize its entry as a href#concept-appcache-manifest iddownloading-or-updating-an-application-cache:concept-appcache-manifest-4>the manifest/a>./p> li>p>Set the a href#concept-appcache-completeness iddownloading-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 iddownloading-or-updating-an-application-cache:concept-task-10>tasks/a>./p> li> p>If this is a a href#concept-appcache-cache iddownloading-or-updating-an-application-cache:concept-appcache-cache-3>cache attempt/a>, then for each a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-20>cache host/a> associated with an a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-19>application cache/a> in var>cache group/var>, create a a href#concept-task iddownloading-or-updating-an-application-cache:concept-task-11>task/a> to run these steps and append it to var>task list/var>: ol>li>p>Let var>showProgress/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire iddownloading-or-updating-an-application-cache:concept-event-fire-13 data-x-internalconcept-event-fire>firing an event/a> named code iddownloading-or-updating-an-application-cache:event-appcache-cached>a href#event-appcache-cached>cached/a>/code> at the code iddownloading-or-updating-an-application-cache:applicationcache-14>a href#applicationcache>ApplicationCache/a>/code> singleton of the a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-21>cache host/a>, with the code iddownloading-or-updating-an-application-cache:dom-event-cancelable-13>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true.li>p>If var>showProgress/var> is true and the user agent a href#shows-caching-progress iddownloading-or-updating-an-application-cache:shows-caching-progress-13>shows caching progress/a>, then display some sort of user interface indicating to the user that the application has been cached and that they can now use it offline./ol> p>Otherwise, it is an a href#concept-appcache-upgrade iddownloading-or-updating-an-application-cache:concept-appcache-upgrade-4>upgrade attempt/a>. For each a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-22>cache host/a> associated with an a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-20>application cache/a> in var>cache group/var>, create a a href#concept-task iddownloading-or-updating-an-application-cache:concept-task-12>task/a> to run these steps and append it to var>task list/var>:/p> ol>li>p>Let var>showProgress/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire iddownloading-or-updating-an-application-cache:concept-event-fire-14 data-x-internalconcept-event-fire>firing an event/a> named code iddownloading-or-updating-an-application-cache:event-appcache-updateready>a href#event-appcache-updateready>updateready/a>/code> at the code iddownloading-or-updating-an-application-cache:applicationcache-15>a href#applicationcache>ApplicationCache/a>/code> singleton of the a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-23>cache host/a>, with the code iddownloading-or-updating-an-application-cache:dom-event-cancelable-14>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true.li>p>If var>showProgress/var> is true and the user agent a href#shows-caching-progress iddownloading-or-updating-an-application-cache:shows-caching-progress-14>shows caching progress/a>, then display some sort of user interface indicating to the user that a new version is available and that they can activate it by reloading the page./ol> li>p>If appropriate, remove any user interface indicating that an update for this cache is in progress.li>p>Set the a href#concept-appcache-status iddownloading-or-updating-an-application-cache:concept-appcache-status-8>update status/a> of var>cache group/var> to i>idle/i>.li>p>For each a href#concept-task iddownloading-or-updating-an-application-cache:concept-task-13>task/a> in var>task list/var>, a href#queue-a-post-load-task iddownloading-or-updating-an-application-cache:queue-a-post-load-task-9>queue that task as a post-load task/a>./ol> p>The dfn idcache-failure-steps>cache failure steps/dfn> are as follows:/p> ol>li>p>Let var>task list/var> be an empty list of a href#concept-task iddownloading-or-updating-an-application-cache:concept-task-14>tasks/a>./p> li> p>For each entry in var>cache group/var>s a href#concept-appcache-pending-masters iddownloading-or-updating-an-application-cache:concept-appcache-pending-masters-9>list of pending master entries/a>, run the following further substeps. These steps may be run in parallel for two or more entries at a time./p> ol>li>p>Wait for the resource for this entry to have either completely downloaded or failed./p> li>p>Unassociate the code iddownloading-or-updating-an-application-cache:document-9>a href#document>Document/a>/code> for this entry from its a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-21>application cache/a>, if it has one.li> p>Create a a href#concept-task iddownloading-or-updating-an-application-cache:concept-task-15>task/a> to run these steps and append it to var>task list/var>:/p> ol>li>p>Let var>showProgress/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire iddownloading-or-updating-an-application-cache:concept-event-fire-15 data-x-internalconcept-event-fire>firing an event/a> named code iddownloading-or-updating-an-application-cache:event-appcache-error-4>a href#event-appcache-error>error/a>/code> at the code iddownloading-or-updating-an-application-cache:applicationcache-16>a href#applicationcache>ApplicationCache/a>/code> singleton of the code iddownloading-or-updating-an-application-cache:document-10>a href#document>Document/a>/code> for this entry, if there still is one, with the code iddownloading-or-updating-an-application-cache:dom-event-cancelable-15>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true.li>p>If var>showProgress/var> is true and the user agent a href#shows-caching-progress iddownloading-or-updating-an-application-cache:shows-caching-progress-15>shows caching progress/a>, then display some sort of user interface indicating to the user that the user agent failed to save the application for offline use./ol> /ol> li> p>For each a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-24>cache host/a> still associated with an a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-22>application cache/a> in var>cache group/var>, create a a href#concept-task iddownloading-or-updating-an-application-cache:concept-task-16>task/a> to run these steps and append it to var>task list/var>:/p> ol>li>p>Let var>showProgress/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire iddownloading-or-updating-an-application-cache:concept-event-fire-16 data-x-internalconcept-event-fire>firing an event/a> named code iddownloading-or-updating-an-application-cache:event-appcache-error-5>a href#event-appcache-error>error/a>/code> at the code iddownloading-or-updating-an-application-cache:applicationcache-17>a href#applicationcache>ApplicationCache/a>/code> singleton of the a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-25>cache host/a>, with the code iddownloading-or-updating-an-application-cache:dom-event-cancelable-16>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true.li>p>If var>showProgress/var> is true and the user agent a href#shows-caching-progress iddownloading-or-updating-an-application-cache:shows-caching-progress-16>shows caching progress/a>, then display some sort of user interface indicating to the user that the user agent failed to save the application for offline use./ol> li>p>Empty var>cache group/var>s a href#concept-appcache-pending-masters iddownloading-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 iddownloading-or-updating-an-application-cache:application-cache-23>application cache/a> whose a href#concept-appcache-completeness iddownloading-or-updating-an-application-cache:concept-appcache-completeness-6>completeness flag/a> is i>incomplete/i>, then discard that a href#application-cache iddownloading-or-updating-an-application-cache:application-cache-24>application cache/a>./p> li>p>If appropriate, remove any user interface indicating that an update for this cache is in progress.li>p>Let the a href#concept-appcache-status iddownloading-or-updating-an-application-cache:concept-appcache-status-9>status/a> of var>cache group/var> be i>idle/i>.li>p>If this was a a href#concept-appcache-cache iddownloading-or-updating-an-application-cache:concept-appcache-cache-4>cache attempt/a>, discard var>cache group/var> altogether./p> li>p>For each a href#concept-task iddownloading-or-updating-an-application-cache:concept-task-17>task/a> in var>task list/var>, a href#queue-a-post-load-task iddownloading-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 iddownloading-or-updating-an-application-cache:application-cache-download-process-11>application cache download process/a>./ol> p>Attempts to fetch resources as part of the a href#application-cache-download-process iddownloading-or-updating-an-application-cache:application-cache-download-process-12>application cache download process/a> may be done with cache-defeating semantics, to avoid problems with stale or inconsistent intermediary caches./p> hr> p>User agents may invoke the a href#application-cache-download-process iddownloading-or-updating-an-application-cache:application-cache-download-process-13>application cache download process/a>, in the background, for any a href#application-cache-group iddownloading-or-updating-an-application-cache:application-cache-group-8>application cache group/a>, at any time (with no a href#cache-host iddownloading-or-updating-an-application-cache:cache-host-26>cache host/a>). This allows user agents to keep caches primed and to update caches even before the user visits a site./p> hr> p>Each code iddownloading-or-updating-an-application-cache:document-11>a href#document>Document/a>/code> has a list of dfn idpending-application-cache-download-process-tasks>pending application cache download process tasks/dfn> that is used to delay events fired by the algorithm above until the documents code iddownloading-or-updating-an-application-cache:event-load-2>a href#event-load>load/a>/code> event has fired. When the code iddownloading-or-updating-an-application-cache:document-12>a href#document>Document/a>/code> is created, the list must be empty./p> p>When the steps above say to dfn idqueue-a-post-load-task>queue a post-load task/dfn> var>task/var>, where var>task/var> is a a href#concept-task iddownloading-or-updating-an-application-cache:concept-task-18>task/a> that dispatches an event on a target code iddownloading-or-updating-an-application-cache:applicationcache-18>a href#applicationcache>ApplicationCache/a>/code> object var>target/var>, the user agent must run the appropriate steps from the following list:/p> dl>dt>If var>target/var>s a iddownloading-or-updating-an-application-cache:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is a href#ready-for-post-load-tasks iddownloading-or-updating-an-application-cache:ready-for-post-load-tasks>ready for post-load tasks/a>dd>p>a href#queue-a-task iddownloading-or-updating-an-application-cache:queue-a-task>Queue/a> the task var>task/var>.dt>Otherwisedd>p>Add var>task/var> to var>target/var>s a iddownloading-or-updating-an-application-cache:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s list of a href#pending-application-cache-download-process-tasks iddownloading-or-updating-an-application-cache:pending-application-cache-download-process-tasks>pending application cache download process tasks/a>./dl> p>When the steps above say to dfn idqueue-a-progress-post-load-task>queue a progress post-load task/dfn> var>task/var>, where var>task/var> is a a href#concept-task iddownloading-or-updating-an-application-cache:concept-task-19>task/a> that dispatches an event on a target code iddownloading-or-updating-an-application-cache:applicationcache-19>a href#applicationcache>ApplicationCache/a>/code> object var>target/var>, the user agent must run the following steps:/p> ol>li>p>If there is a var>task/var> in var>target/var>s a iddownloading-or-updating-an-application-cache:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s list of a href#pending-application-cache-download-process-tasks iddownloading-or-updating-an-application-cache:pending-application-cache-download-process-tasks-2>pending application cache download process tasks/a> that is labeled as a i>progress task/i>, then remove that task from the list.li>p>Label var>task/var> as a i>progress task/i>.li>p>a href#queue-a-post-load-task iddownloading-or-updating-an-application-cache:queue-a-post-load-task-11>Queue a post-load task/a> var>task/var>./ol> p>The a href#task-source iddownloading-or-updating-an-application-cache:task-source>task source/a> for these a href#concept-task iddownloading-or-updating-an-application-cache:concept-task-20>tasks/a> is the a href#networking-task-source iddownloading-or-updating-an-application-cache:networking-task-source>networking task source/a>./p> h4 idthe-application-cache-selection-algorithm>span classsecno>7.9.5/span> The application cache selection algorithma href#the-application-cache-selection-algorithm classself-link>/a>/h4> p>When the dfn idconcept-appcache-init>application cache selection algorithm/dfn> algorithm is invoked with a code idthe-application-cache-selection-algorithm:document>a href#document>Document/a>/code> var>document/var> and optionally a manifest a idthe-application-cache-selection-algorithm:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> var>manifest URL/var>, the user agent must run the first applicable set of steps from the following list:/p> dl classswitch>dt>If there is a var>manifest URL/var>, and var>document/var> was loaded from an a href#application-cache idthe-application-cache-selection-algorithm:application-cache>application cache/a>, and the URL of the a href#concept-appcache-manifest idthe-application-cache-selection-algorithm:concept-appcache-manifest>manifest/a> of that caches a href#application-cache-group idthe-application-cache-selection-algorithm:application-cache-group>application cache group/a> is em>not/em> the same as var>manifest URL/var>dd> p>Mark the entry for the resource from which var>document/var> was taken in the a href#application-cache idthe-application-cache-selection-algorithm:application-cache-2>application cache/a> from which it was loaded as a href#concept-appcache-foreign idthe-application-cache-selection-algorithm:concept-appcache-foreign>foreign/a>./p> p>Restart the current navigation from the top of the a href#navigate idthe-application-cache-selection-algorithm:navigate>navigation algorithm/a>, undoing any changes that were made as part of the initial load (changes can be avoided by ensuring that the step to a href#update-the-session-history-with-the-new-page idthe-application-cache-selection-algorithm:update-the-session-history-with-the-new-page>update the session history with the new page/a> is only ever completed em>after/em> this a href#concept-appcache-init idthe-application-cache-selection-algorithm:concept-appcache-init>application cache selection algorithm/a> is run, though this is not required)./p> p classnote>The navigation will not result in the same resource being loaded, because foreign entries are never picked during navigation./p> p>User agents may notify the user of the inconsistency between the cache manifest and the documents own metadata, to aid in application development./p> dt>If var>document/var> was loaded from an a href#application-cache idthe-application-cache-selection-algorithm:application-cache-3>application cache/a>, and that a href#application-cache idthe-application-cache-selection-algorithm:application-cache-4>application cache/a> still exists (it is not now a href#concept-appcache-obsolete idthe-application-cache-selection-algorithm:concept-appcache-obsolete>obsolete/a>)dd> p>Associate var>document/var> with the a href#application-cache idthe-application-cache-selection-algorithm:application-cache-5>application cache/a> from which it was loaded. Invoke, in the background, the a href#application-cache-download-process idthe-application-cache-selection-algorithm:application-cache-download-process>application cache download process/a> for that a href#application-cache idthe-application-cache-selection-algorithm:application-cache-6>application cache/a>s a href#application-cache-group idthe-application-cache-selection-algorithm:application-cache-group-2>application cache group/a>, with var>document/var> as the a href#cache-host idthe-application-cache-selection-algorithm:cache-host>cache host/a>./p> dt>If var>document/var> was loaded using `code>GET/code>`, and, there is a var>manifest URL/var>, and var>manifest URL/var> has the a href#same-origin idthe-application-cache-selection-algorithm:same-origin>same origin/a> as var>document/var>dd> p>Invoke, in the background, the a href#application-cache-download-process idthe-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 idthe-application-cache-selection-algorithm:cache-host-2>cache host/a> and with the resource from which var>document/var> was parsed as the a href#concept-appcache-master idthe-application-cache-selection-algorithm:concept-appcache-master>master/a> resource./p> p>If there are a href#relevant-application-cache idthe-application-cache-selection-algorithm:relevant-application-cache>relevant application caches/a> that are identified by a URL with the a href#same-origin idthe-application-cache-selection-algorithm:same-origin-2>same origin/a> as the URL of var>document/var>, and that have this URL as one of their entries, excluding entries marked as a href#concept-appcache-foreign idthe-application-cache-selection-algorithm:concept-appcache-foreign-2>foreign/a>, then the user agent should use the a href#concept-appcache-selection idthe-application-cache-selection-algorithm:concept-appcache-selection>most appropriate application cache/a> of those that match as an HTTP cache for any subresource loads. User agents may also have other caches in place that are also honored./p> dt>Otherwisedd> p>The code idthe-application-cache-selection-algorithm:document-2>a href#document>Document/a>/code> is not associated with any a href#application-cache idthe-application-cache-selection-algorithm:application-cache-7>application cache/a>./p> p>If there was a var>manifest URL/var>, the user agent may report to the user that it was ignored, to aid in application development./p> /dl> h4 idchangesToNetworkingModel>span classsecno>7.9.6/span> Changes to the networking modela href#changesToNetworkingModel classself-link>/a>/h4> p classXXX>If AppCache is not removed as a feature this section needs to be integrated into the Fetch standard./p> p>When a a href#cache-host idchangesToNetworkingModel:cache-host>cache host/a> is associated with an a href#application-cache idchangesToNetworkingModel:application-cache>application cache/a> whose a href#concept-appcache-completeness idchangesToNetworkingModel:concept-appcache-completeness>completeness flag/a> is i>complete/i>, any and all loads for resources related to that a href#cache-host idchangesToNetworkingModel:cache-host-2>cache host/a> other than those for a href#child-browsing-context idchangesToNetworkingModel:child-browsing-context>child browsing contexts/a> must go through the following steps instead of immediately invoking the mechanisms appropriate to that resources scheme:/p> ol>li>p>If the resource is not to be fetched using the GET method, or if applying the a idchangesToNetworkingModel:url-parser hrefhttps://url.spec.whatwg.org/#concept-url-parser data-x-internalurl-parser>URL parser/a> algorithm to both its a idchangesToNetworkingModel:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> and the a href#application-cache idchangesToNetworkingModel:application-cache-2>application cache/a>s a href#concept-appcache-manifest idchangesToNetworkingModel:concept-appcache-manifest>manifest/a>s URL results in two a hrefhttps://url.spec.whatwg.org/#concept-url idchangesToNetworkingModel:url-record data-x-internalurl-record>URL records/a> with different a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idchangesToNetworkingModel:concept-url-scheme data-x-internalconcept-url-scheme>scheme/a> components, then fetch the resource normally and abort these steps.li>p>If the resources URL is a href#concept-appcache-master idchangesToNetworkingModel:concept-appcache-master>a master entry/a>, a href#concept-appcache-manifest idchangesToNetworkingModel:concept-appcache-manifest-2>the manifest/a>, a href#concept-appcache-explicit idchangesToNetworkingModel:concept-appcache-explicit>an explicit entry/a>, or a href#concept-appcache-fallback idchangesToNetworkingModel:concept-appcache-fallback>a fallback entry/a> in the a href#application-cache idchangesToNetworkingModel:application-cache-3>application cache/a>, then get the resource from the cache (instead of fetching it), and abort these steps.li>p>If there is an entry in the a href#application-cache idchangesToNetworkingModel:application-cache-4>application cache/a>s a href#concept-appcache-onlinesafelist idchangesToNetworkingModel:concept-appcache-onlinesafelist>online safelist/a> that has the a href#same-origin idchangesToNetworkingModel:same-origin>same origin/a> as the resources URL and that is a a href#prefix-match idchangesToNetworkingModel:prefix-match>prefix match/a> for the resources URL, then fetch the resource normally and abort these steps.li> p>If the resources URL has the a href#same-origin idchangesToNetworkingModel:same-origin-2>same origin/a> as the manifests URL, and there is a a href#concept-appcache-fallback-ns idchangesToNetworkingModel:concept-appcache-fallback-ns>fallback namespace/a> var>f/var> in the a href#application-cache idchangesToNetworkingModel:application-cache-5>application cache/a> that is a a href#prefix-match idchangesToNetworkingModel:prefix-match-2>prefix match/a> for the resources URL, then:/p> p>Fetch the resource normally. If this results in a redirect to a resource with another a href#concept-origin idchangesToNetworkingModel:concept-origin>origin/a> (indicative of a captive portal), or a 4xx or 5xx status code, or if there were network errors (but not if the user canceled the download), then instead get, from the cache, the resource of the a href#concept-appcache-fallback idchangesToNetworkingModel:concept-appcache-fallback-2>fallback entry/a> corresponding to the a href#concept-appcache-fallback-ns idchangesToNetworkingModel:concept-appcache-fallback-ns-2>fallback namespace/a> var>f/var>. Abort these steps./p> li>p>If the a href#application-cache idchangesToNetworkingModel:application-cache-6>application cache/a>s a href#concept-appcache-onlinesafelist-wildcard idchangesToNetworkingModel:concept-appcache-onlinesafelist-wildcard>online safelist wildcard flag/a> is i>open/i>, then fetch the resource normally and abort these steps.li>p>Fail the resource load as if there had been a generic network error./ol> p classnote>The above algorithm ensures that so long as the a href#concept-appcache-onlinesafelist-wildcard idchangesToNetworkingModel:concept-appcache-onlinesafelist-wildcard-2>online safelist wildcard flag/a> is i>blocking/i>, resources that are not present in the a href#concept-appcache-manifest idchangesToNetworkingModel:concept-appcache-manifest-3>manifest/a> will always fail to load (at least, after the a href#application-cache idchangesToNetworkingModel:application-cache-7>application cache/a> has been primed the first time), making the testing of offline applications simpler./p> h4 idexpiring-application-caches>span classsecno>7.9.7/span> Expiring application cachesa href#expiring-application-caches classself-link>/a>/h4> p>As a general rule, user agents should not expire application caches, except on request from the user, or after having been left unused for an extended period of time./p> p>Application caches and cookies have similar implications with respect to privacy (e.g. if the site can identify the user when providing the cache, it can store data in the cache that can be used for cookie resurrection). Implementors are therefore encouraged to expose application caches in a manner related to HTTP cookies, allowing caches to be expunged together with cookies and other origin-specific data./p> p classexample>For example, a user agent could have a delete site-specific data feature that clears all cookies, application caches, local storage, databases, etc, from an origin all at once./p> h4 iddisk-space>span classsecno>7.9.8/span> Disk spacea href#disk-space classself-link>/a>/h4> p>User agents should consider applying constraints on disk usage of a href#application-cache iddisk-space:application-cache>application caches/a>, and care should be taken to ensure that the restrictions cannot be easily worked around using subdomains./p> p>User agents should allow users to see how much space each domain is using, and may offer the user the ability to delete specific a href#application-cache iddisk-space:application-cache-2>application caches/a>./p> p>For predictability, quotas should be based on the uncompressed size of data stored./p> p classnote>How quotas are presented to the user is not defined by this specification. User agents are encouraged to provide features such as allowing a user to indicate that certain sites are trusted to use more than the default quota, e.g. by presenting a non-modal user interface while a cache is being updated, or by having an explicit safelist in the user agents configuration interface./p> h4 idsecurity-concerns-with-offline-applications-caches>span classsecno>7.9.9/span> Security concerns with offline applications cachesa href#security-concerns-with-offline-applications-caches classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>The main risk introduced by offline application caches is that an injection attack can be elevated into persistent site-wide page replacement. This attack involves using an injection vulnerability to upload two files to the victim site. The first file is an application cache manifest consisting of just a fallback entry pointing to the second file, which is an HTML page whose manifest is declared as that first file. Once the user has been directed to that second file, all subsequent accesses to any file covered by the given fallback namespace while either the user or the site is offline will instead show that second file. Targeted denial-of-service attacks or cookie bombing attacks (where the client is made to send so many cookies that the server refuses to process the request) can be used to ensure that the site appears offline./p> p>To mitigate this, manifests can only specify fallbacks that are in the same path as the manifest itself. This means that a content injection upload vulnerability in a particular directory on a server can only be escalated to a take-over of that directory and its subdirectories. If there is no way to inject a file into the root directory, the entire site cannot be taken over./p> p>If a site has been attacked in this way, simply removing the offending manifest might eventually clear the problem, since the next time the manifest is updated, a 404 error will be seen, and the user agent will clear the cache. Eventually is the key word here, however; while the attack on the user or server is ongoing, such that connections from an affected user to the affected site are blocked, the user agent will simply assume that the user is offline and will continue to use the hostile manifest. Unfortunately, if a cookie bombing attack has also been used, merely removing the manifest is insufficient; in addition, the server has to be configured to return a 404 or 410 response instead of the 413 Request Entity Too Large response./p> p>TLS does not inherently protect a site from this attack, since the attack relies on content being served from the server itself. Not using application caches also does not prevent this attack, since the attack relies on an attacker-provided manifest./p> h4 idapplication-cache-api>span classsecno>7.9.10/span> Application cache APIa href#application-cache-api classself-link>/a>/h4> pre classidl>ExposedWindowinterface dfn idapplicationcache>ApplicationCache/dfn> : a idapplication-cache-api:eventtarget hrefhttps://dom.spec.whatwg.org/#interface-eventtarget data-x-internaleventtarget>EventTarget/a> { // a href#concept-appcache-status idapplication-cache-api:concept-appcache-status>update status/a> const unsigned short a href#dom-appcache-uncached idapplication-cache-api:dom-appcache-uncached>UNCACHED/a> 0; const unsigned short a href#dom-appcache-idle idapplication-cache-api:dom-appcache-idle>IDLE/a> 1; const unsigned short a href#dom-appcache-checking idapplication-cache-api:dom-appcache-checking>CHECKING/a> 2; const unsigned short a href#dom-appcache-downloading idapplication-cache-api:dom-appcache-downloading>DOWNLOADING/a> 3; const unsigned short a href#dom-appcache-updateready idapplication-cache-api:dom-appcache-updateready>UPDATEREADY/a> 4; const unsigned short a href#dom-appcache-obsolete idapplication-cache-api:dom-appcache-obsolete>OBSOLETE/a> 5; readonly attribute unsigned short a href#dom-appcache-status idapplication-cache-api:dom-appcache-status>status/a>; // updates void a href#dom-appcache-update idapplication-cache-api:dom-appcache-update>update/a>(); void a href#dom-appcache-abort idapplication-cache-api:dom-appcache-abort>abort/a>(); void a href#dom-appcache-swapcache idapplication-cache-api:dom-appcache-swapcache>swapCache/a>(); // events attribute a href#eventhandler idapplication-cache-api:eventhandler>EventHandler/a> a href#handler-appcache-onchecking idapplication-cache-api:handler-appcache-onchecking>onchecking/a>; attribute a href#eventhandler idapplication-cache-api:eventhandler-2>EventHandler/a> a href#handler-appcache-onerror idapplication-cache-api:handler-appcache-onerror>onerror/a>; attribute a href#eventhandler idapplication-cache-api:eventhandler-3>EventHandler/a> a href#handler-appcache-onnoupdate idapplication-cache-api:handler-appcache-onnoupdate>onnoupdate/a>; attribute a href#eventhandler idapplication-cache-api:eventhandler-4>EventHandler/a> a href#handler-appcache-ondownloading idapplication-cache-api:handler-appcache-ondownloading>ondownloading/a>; attribute a href#eventhandler idapplication-cache-api:eventhandler-5>EventHandler/a> a href#handler-appcache-onprogress idapplication-cache-api:handler-appcache-onprogress>onprogress/a>; attribute a href#eventhandler idapplication-cache-api:eventhandler-6>EventHandler/a> a href#handler-appcache-onupdateready idapplication-cache-api:handler-appcache-onupdateready>onupdateready/a>; attribute a href#eventhandler idapplication-cache-api:eventhandler-7>EventHandler/a> a href#handler-appcache-oncached idapplication-cache-api:handler-appcache-oncached>oncached/a>; attribute a href#eventhandler idapplication-cache-api:eventhandler-8>EventHandler/a> a href#handler-appcache-onobsolete idapplication-cache-api:handler-appcache-onobsolete>onobsolete/a>;};/pre> dl classdomintro>dt>var>cache/var> var>window/var> . code idapplication-cache-api:dom-applicationcache>a href#dom-applicationcache>applicationCache/a>/code>dd> p>Returns the code idapplication-cache-api:applicationcache>a href#applicationcache>ApplicationCache/a>/code> object that applies to the a href#active-document idapplication-cache-api:active-document>active document/a> of that code idapplication-cache-api:window>a href#window>Window/a>/code>./p> dt>var>cache/var> . code idapplication-cache-api:dom-appcache-status-2>a href#dom-appcache-status>status/a>/code>dd> p>Returns the current status of the application cache, as given by the constants defined below./p> dt>var>cache/var> . code idapplication-cache-api:dom-appcache-update-2>a href#dom-appcache-update>update/a>/code>()dd> p>Invokes the a href#application-cache-download-process idapplication-cache-api:application-cache-download-process>application cache download process/a>./p> p>Throws an a idapplication-cache-api:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idapplication-cache-api:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if there is no application cache to update./p> p>Calling this method is not usually necessary, as user agents will generally take care of updating a href#application-cache idapplication-cache-api:application-cache>application caches/a> automatically./p> p>The method can be useful in situations such as long-lived applications. For example, a Web mail application might stay open in a browser tab for weeks at a time. Such an application could want to test for updates each day./p> dt>var>cache/var> . code idapplication-cache-api:dom-appcache-abort-2>a href#dom-appcache-abort>abort/a>/code>()dd> p>Cancels the a href#application-cache-download-process idapplication-cache-api:application-cache-download-process-2>application cache download process/a>./p> p>This method is intended to be used by Web application showing their own caching progress UI, in case the user wants to stop the update (e.g. because bandwidth is limited)./p> dt>var>cache/var> . code idapplication-cache-api:dom-appcache-swapcache-2>a href#dom-appcache-swapcache>swapCache/a>/code>()dd> p>Switches to the most recent application cache, if there is a newer one. If there isnt, throws an a idapplication-cache-api:invalidstateerror-2 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idapplication-cache-api:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> p>This does not cause previously-loaded resources to be reloaded; for example, images do not suddenly get reloaded and style sheets and scripts do not get reparsed or reevaluated. The only change is that subsequent requests for cached resources will obtain the newer copies./p> p>The code idapplication-cache-api:event-appcache-updateready>a href#event-appcache-updateready>updateready/a>/code> event will fire before this method can be called. Once it fires, the Web application can, at its leisure, call this method to switch the underlying cache to the one with the more recent updates. To make proper use of this, applications have to be able to bring the new features into play; for example, reloading scripts to enable new features./p> p>An easier alternative to code idapplication-cache-api:dom-appcache-swapcache-3>a href#dom-appcache-swapcache>swapCache()/a>/code> is just to reload the entire page at a time suitable for the user, using code idapplication-cache-api:dom-location-reload>a href#dom-location-reload>location.reload()/a>/code>./p> /dl> p>There is a one-to-one mapping from a href#cache-host idapplication-cache-api:cache-host>cache hosts/a> to code idapplication-cache-api:applicationcache-2>a href#applicationcache>ApplicationCache/a>/code> objects. The dfn iddom-applicationcache>code>applicationCache/code>/dfn> attribute on code idapplication-cache-api:window-2>a href#window>Window/a>/code> objects must return the code idapplication-cache-api:applicationcache-3>a href#applicationcache>ApplicationCache/a>/code> object associated with the code idapplication-cache-api:window-3>a href#window>Window/a>/code> objects a href#active-document idapplication-cache-api:active-document-2>active document/a>./p> p classnote>A code idapplication-cache-api:document>a href#document>Document/a>/code> has an associated code idapplication-cache-api:applicationcache-4>a href#applicationcache>ApplicationCache/a>/code> object even if that a href#cache-host idapplication-cache-api:cache-host-2>cache host/a> has no actual a href#application-cache idapplication-cache-api:application-cache-2>application cache/a>./p> hr> p>The dfn iddom-appcache-status>code>status/code>/dfn> attribute, on getting, must return the current state of the a href#application-cache idapplication-cache-api:application-cache-3>application cache/a> that the code idapplication-cache-api:applicationcache-5>a href#applicationcache>ApplicationCache/a>/code> objects a href#cache-host idapplication-cache-api:cache-host-3>cache host/a> is associated with, if any. This must be the appropriate value from the following list:/p> dl>dt>dfn iddom-appcache-uncached>code>UNCACHED/code>/dfn> (numeric value 0)dd>p>The code idapplication-cache-api:applicationcache-6>a href#applicationcache>ApplicationCache/a>/code> objects a href#cache-host idapplication-cache-api:cache-host-4>cache host/a> is not associated with an a href#application-cache idapplication-cache-api:application-cache-4>application cache/a> at this time.dt>dfn iddom-appcache-idle>code>IDLE/code>/dfn> (numeric value 1)dd>p>The code idapplication-cache-api:applicationcache-7>a href#applicationcache>ApplicationCache/a>/code> objects a href#cache-host idapplication-cache-api:cache-host-5>cache host/a> is associated with an a href#application-cache idapplication-cache-api:application-cache-5>application cache/a> whose a href#application-cache-group idapplication-cache-api:application-cache-group>application cache group/a>s a href#concept-appcache-status idapplication-cache-api:concept-appcache-status-2>update status/a> is i>idle/i>, and that a href#application-cache idapplication-cache-api:application-cache-6>application cache/a> is the a href#concept-appcache-newer idapplication-cache-api:concept-appcache-newer>newest/a> cache in its a href#application-cache-group idapplication-cache-api:application-cache-group-2>application cache group/a>, and the a href#application-cache-group idapplication-cache-api:application-cache-group-3>application cache group/a> is not marked as a href#concept-appcache-obsolete idapplication-cache-api:concept-appcache-obsolete>obsolete/a>.dt>dfn iddom-appcache-checking>code>CHECKING/code>/dfn> (numeric value 2)dd>p>The code idapplication-cache-api:applicationcache-8>a href#applicationcache>ApplicationCache/a>/code> objects a href#cache-host idapplication-cache-api:cache-host-6>cache host/a> is associated with an a href#application-cache idapplication-cache-api:application-cache-7>application cache/a> whose a href#application-cache-group idapplication-cache-api:application-cache-group-4>application cache group/a>s a href#concept-appcache-status idapplication-cache-api:concept-appcache-status-3>update status/a> is i>checking/i>.dt>dfn iddom-appcache-downloading>code>DOWNLOADING/code>/dfn> (numeric value 3)dd>p>The code idapplication-cache-api:applicationcache-9>a href#applicationcache>ApplicationCache/a>/code> objects a href#cache-host idapplication-cache-api:cache-host-7>cache host/a> is associated with an a href#application-cache idapplication-cache-api:application-cache-8>application cache/a> whose a href#application-cache-group idapplication-cache-api:application-cache-group-5>application cache group/a>s a href#concept-appcache-status idapplication-cache-api:concept-appcache-status-4>update status/a> is i>downloading/i>.dt>dfn iddom-appcache-updateready>code>UPDATEREADY/code>/dfn> (numeric value 4)dd>p>The code idapplication-cache-api:applicationcache-10>a href#applicationcache>ApplicationCache/a>/code> objects a href#cache-host idapplication-cache-api:cache-host-8>cache host/a> is associated with an a href#application-cache idapplication-cache-api:application-cache-9>application cache/a> whose a href#application-cache-group idapplication-cache-api:application-cache-group-6>application cache group/a>s a href#concept-appcache-status idapplication-cache-api:concept-appcache-status-5>update status/a> is i>idle/i>, and whose a href#application-cache-group idapplication-cache-api:application-cache-group-7>application cache group/a> is not marked as a href#concept-appcache-obsolete idapplication-cache-api:concept-appcache-obsolete-2>obsolete/a>, but that a href#application-cache idapplication-cache-api:application-cache-10>application cache/a> is em>not/em> the a href#concept-appcache-newer idapplication-cache-api:concept-appcache-newer-2>newest/a> cache in its group.dt>dfn iddom-appcache-obsolete>code>OBSOLETE/code>/dfn> (numeric value 5)dd>p>The code idapplication-cache-api:applicationcache-11>a href#applicationcache>ApplicationCache/a>/code> objects a href#cache-host idapplication-cache-api:cache-host-9>cache host/a> is associated with an a href#application-cache idapplication-cache-api:application-cache-11>application cache/a> whose a href#application-cache-group idapplication-cache-api:application-cache-group-8>application cache group/a> is marked as a href#concept-appcache-obsolete idapplication-cache-api:concept-appcache-obsolete-3>obsolete/a>./dl> hr> p>If the dfn iddom-appcache-update>code>update()/code>/dfn> method is invoked, the user agent must invoke the a href#application-cache-download-process idapplication-cache-api:application-cache-download-process-3>application cache download process/a>, in the background, for the a href#application-cache-group idapplication-cache-api:application-cache-group-9>application cache group/a> of the a href#application-cache idapplication-cache-api:application-cache-12>application cache/a> with which the code idapplication-cache-api:applicationcache-12>a href#applicationcache>ApplicationCache/a>/code> objects a href#cache-host idapplication-cache-api:cache-host-10>cache host/a> is associated, but without giving that a href#cache-host idapplication-cache-api:cache-host-11>cache host/a> to the algorithm. If there is no such a href#application-cache idapplication-cache-api:application-cache-13>application cache/a>, or if its a href#application-cache-group idapplication-cache-api:application-cache-group-10>application cache group/a> is marked as a href#concept-appcache-obsolete idapplication-cache-api:concept-appcache-obsolete-4>obsolete/a>, then the method must throw an a idapplication-cache-api:invalidstateerror-3 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idapplication-cache-api:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> instead./p> p>If the dfn iddom-appcache-abort>code>abort()/code>/dfn> method is invoked, the user agent must dfn idsend-a-signal>send a signal/dfn> to the current a href#application-cache-download-process idapplication-cache-api:application-cache-download-process-4>application cache download process/a> for the a href#application-cache-group idapplication-cache-api:application-cache-group-11>application cache group/a> of the a href#application-cache idapplication-cache-api:application-cache-14>application cache/a> with which the code idapplication-cache-api:applicationcache-13>a href#applicationcache>ApplicationCache/a>/code> objects a href#cache-host idapplication-cache-api:cache-host-12>cache host/a> is associated, if any. If there is no such a href#application-cache idapplication-cache-api:application-cache-15>application cache/a>, or it does not have a current a href#application-cache-download-process idapplication-cache-api:application-cache-download-process-5>application cache download process/a>, then do nothing./p> p>If the dfn iddom-appcache-swapcache>code>swapCache()/code>/dfn> method is invoked, the user agent must run the following steps: ol>li>p>Check that code idapplication-cache-api:applicationcache-14>a href#applicationcache>ApplicationCache/a>/code> objects a href#cache-host idapplication-cache-api:cache-host-13>cache host/a> is associated with an a href#application-cache idapplication-cache-api:application-cache-16>application cache/a>. If it is not, then throw an a idapplication-cache-api:invalidstateerror-4 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idapplication-cache-api:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Let var>cache/var> be the a href#application-cache idapplication-cache-api:application-cache-17>application cache/a> with which the code idapplication-cache-api:applicationcache-15>a href#applicationcache>ApplicationCache/a>/code> objects a href#cache-host idapplication-cache-api:cache-host-14>cache host/a> is associated. (By definition, this is the same as the one that was found in the previous step.)li>p>If var>cache/var>s a href#application-cache-group idapplication-cache-api:application-cache-group-12>application cache group/a> is marked as a href#concept-appcache-obsolete idapplication-cache-api:concept-appcache-obsolete-5>obsolete/a>, then unassociate the code idapplication-cache-api:applicationcache-16>a href#applicationcache>ApplicationCache/a>/code> objects a href#cache-host idapplication-cache-api:cache-host-15>cache host/a> from var>cache/var> and abort these steps. (Resources will now load from the network instead of the cache.)li>p>Check that there is an application cache in the same a href#application-cache-group idapplication-cache-api:application-cache-group-13>application cache group/a> as var>cache/var> whose a href#concept-appcache-completeness idapplication-cache-api:concept-appcache-completeness>completeness flag/a> is i>complete/i> and that is a href#concept-appcache-newer idapplication-cache-api:concept-appcache-newer-3>newer/a> than var>cache/var>. If there is not, then throw an a idapplication-cache-api:invalidstateerror-5 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idapplication-cache-api:domexception-5>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> exception and abort these steps.li>p>Let var>new cache/var> be the a href#concept-appcache-newer idapplication-cache-api:concept-appcache-newer-4>newest/a> a href#application-cache idapplication-cache-api:application-cache-18>application cache/a> in the same a href#application-cache-group idapplication-cache-api:application-cache-group-14>application cache group/a> as var>cache/var> whose a href#concept-appcache-completeness idapplication-cache-api:concept-appcache-completeness-2>completeness flag/a> is i>complete/i>.li>p>Unassociate the code idapplication-cache-api:applicationcache-17>a href#applicationcache>ApplicationCache/a>/code> objects a href#cache-host idapplication-cache-api:cache-host-16>cache host/a> from var>cache/var> and instead associate it with var>new cache/var>./ol> p>The following are the a href#event-handlers idapplication-cache-api:event-handlers>event handlers/a> (and their corresponding a href#event-handler-event-type idapplication-cache-api:event-handler-event-type>event handler event types/a>) that must be supported, as a href#event-handler-idl-attributes idapplication-cache-api:event-handler-idl-attributes>event handler IDL attributes/a>, by all objects implementing the code idapplication-cache-api:applicationcache-18>a href#applicationcache>ApplicationCache/a>/code> interface:/p> table>thead>tr>th>a href#event-handlers idapplication-cache-api:event-handlers-2>Event handler/a> th>a href#event-handler-event-type idapplication-cache-api:event-handler-event-type-2>Event handler event type/a> tbody>tr>td>dfn idhandler-appcache-onchecking>code>onchecking/code>/dfn> td> code idapplication-cache-api:event-appcache-checking>a href#event-appcache-checking>checking/a>/code> tr>td>dfn idhandler-appcache-onerror>code>onerror/code>/dfn> td> code idapplication-cache-api:event-appcache-error>a href#event-appcache-error>error/a>/code> tr>td>dfn idhandler-appcache-onnoupdate>code>onnoupdate/code>/dfn> td> code idapplication-cache-api:event-appcache-noupdate>a href#event-appcache-noupdate>noupdate/a>/code> tr>td>dfn idhandler-appcache-ondownloading>code>ondownloading/code>/dfn> td> code idapplication-cache-api:event-appcache-downloading>a href#event-appcache-downloading>downloading/a>/code> tr>td>dfn idhandler-appcache-onprogress>code>onprogress/code>/dfn> td> code idapplication-cache-api:event-appcache-progress>a href#event-appcache-progress>progress/a>/code> tr>td>dfn idhandler-appcache-onupdateready>code>onupdateready/code>/dfn> td> code idapplication-cache-api:event-appcache-updateready-2>a href#event-appcache-updateready>updateready/a>/code> tr>td>dfn idhandler-appcache-oncached>code>oncached/code>/dfn> td> code idapplication-cache-api:event-appcache-cached>a href#event-appcache-cached>cached/a>/code> tr>td>dfn idhandler-appcache-onobsolete>code>onobsolete/code>/dfn> td> code idapplication-cache-api:event-appcache-obsolete>a href#event-appcache-obsolete>obsolete/a>/code> /table> h4 idnavigator.online>span classsecno>7.9.11/span> span idbrowser-state>Browser state/span>a href#navigator.online classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> online-statusspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>14+/span>/span>span classios_saf yes>span>iOS Safari/span> span>4.2+/span>/span>span classand_uc partial>span>UC Browser for Android (limited)/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>41+/span>/span>span classie yes>span>IE/span> span>9+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>5+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.3+/span>/span>span classopera yes>span>Opera/span> span>15+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featonline-status>caniuse.com/a>/div> pre classidl>NoInterfaceObject, Exposed(Window,Worker)interface dfn idnavigatoronline>NavigatorOnLine/dfn> { readonly attribute boolean a href#dom-navigator-online idnavigator.online:dom-navigator-online>onLine/a>;};/pre> dl classdomintro>dt>var>self/var> . code idnavigator.online:dom-navigator>a href#dom-navigator>navigator/a>/code> . code idnavigator.online:dom-navigator-online-2>a href#dom-navigator-online>onLine/a>/code>dd> p>Returns false if the user agent is definitely offline (disconnected from the network). Returns true if the user agent might be online./p> p>The events code idnavigator.online:event-online>a href#event-online>online/a>/code> and code idnavigator.online:event-offline>a href#event-offline>offline/a>/code> are fired when the value of this attribute changes./p> /dl> p>The dfn iddom-navigator-online>code>navigator.onLine/code>/dfn> attribute must return false if the user agent will not contact the network when the user follows links or when a script requests a remote page (or knows that such an attempt would fail), and must return true otherwise./p> p>When the value that would be returned by the code idnavigator.online:dom-navigator-online-3>a href#dom-navigator-online>navigator.onLine/a>/code> attribute of a code idnavigator.online:window>a href#window>Window/a>/code> or code idnavigator.online:workerglobalscope>a href#workerglobalscope>WorkerGlobalScope/a>/code> changes from true to false, the user agent must a href#queue-a-task idnavigator.online:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idnavigator.online:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idnavigator.online:event-offline-2>a href#event-offline>offline/a>/code> at the code idnavigator.online:window-2>a href#window>Window/a>/code> or code idnavigator.online:workerglobalscope-2>a href#workerglobalscope>WorkerGlobalScope/a>/code> object./p> p>On the other hand, when the value that would be returned by the code idnavigator.online:dom-navigator-online-4>a href#dom-navigator-online>navigator.onLine/a>/code> attribute of a code idnavigator.online:window-3>a href#window>Window/a>/code> or code idnavigator.online:workerglobalscope-3>a href#workerglobalscope>WorkerGlobalScope/a>/code> changes from false to true, the user agent must a href#queue-a-task idnavigator.online:queue-a-task-2>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idnavigator.online:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idnavigator.online:event-online-2>a href#event-online>online/a>/code> at the code idnavigator.online:window-4>a href#window>Window/a>/code> or code idnavigator.online:workerglobalscope-4>a href#workerglobalscope>WorkerGlobalScope/a>/code> object./p> p>The a href#task-source idnavigator.online:task-source>task source/a> for these a href#concept-task idnavigator.online:concept-task>tasks/a> is the a href#networking-task-source idnavigator.online:networking-task-source>networking task source/a>./p> p classnote>This attribute is inherently unreliable. A computer can be connected to a network without having Internet access./p> div classexample> p>In this example, an indicator is updated as the browser goes online and offline./p> pre><!DOCTYPE HTML><html langen> <head> <title>Online status</title> <script> function updateIndicator() { document.getElementById(indicator).textContent navigator.onLine ? online : offline; } </script> </head> <body onloadupdateIndicator() ononlineupdateIndicator() onofflineupdateIndicator()> <p>The network is: <span idindicator>(state unknown)</span> </body></html>/pre> /div> h2 idwebappapis>span classsecno>8/span> Web application APIsa href#webappapis classself-link>/a>/h2> h3 idscripting>span classsecno>8.1/span> Scriptinga href#scripting classself-link>/a>/h3> h4 idintroduction-11>span classsecno>8.1.1/span> Introductiona href#introduction-11 classself-link>/a>/h4> p>Various mechanisms can cause author-provided executable code to run in the context of a document. These mechanisms include, but are probably not limited to:/p> ul>li>Processing of code idintroduction-11:the-script-element>a href#the-script-element>script/a>/code> elements.li>Navigating to a href#javascript-protocol idintroduction-11: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 idintroduction-11:event-handler-content-attributes>event handler content attributes/a>, by a href#event-handler-idl-attributes idintroduction-11:event-handler-idl-attributes>event handler IDL attributes/a>, or otherwise.li>Processing of technologies like SVG that have their own scripting features./ul> h4 idenabling-and-disabling-scripting>span classsecno>8.1.2/span> Enabling and disabling scriptinga href#enabling-and-disabling-scripting classself-link>/a>/h4> p>dfn idconcept-bc-script>Scripting is enabled/dfn> in a em>a href#browsing-context idenabling-and-disabling-scripting:browsing-context>browsing context/a>/em> when all of the following conditions are true:/p> ul>li>The user agent supports scripting.li>The user has not disabled scripting for this a href#browsing-context idenabling-and-disabling-scripting:browsing-context-2>browsing context/a> at this time. (User agents may provide users with the option to disable scripting globally, or in a finer-grained manner, e.g. on a per-origin basis.) a href#fingerprinting-vector idenabling-and-disabling-scripting:fingerprinting-vector classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> li idsandboxScriptBlocked>The a href#browsing-context idenabling-and-disabling-scripting:browsing-context-3>browsing context/a>s a href#active-document idenabling-and-disabling-scripting:active-document>active document/a>s a href#active-sandboxing-flag-set idenabling-and-disabling-scripting:active-sandboxing-flag-set>active sandboxing flag set/a> does not have its a href#sandboxed-scripts-browsing-context-flag idenabling-and-disabling-scripting:sandboxed-scripts-browsing-context-flag>sandboxed scripts browsing context flag/a> set./ul> p>dfn idconcept-bc-noscript>Scripting is disabled/dfn> in a a href#browsing-context idenabling-and-disabling-scripting:browsing-context-4>browsing context/a> when any of the above conditions are false (i.e. when scripting is not a href#concept-bc-script idenabling-and-disabling-scripting:concept-bc-script>enabled/a>)./p> hr> p>dfn idconcept-n-script>Scripting is enabled/dfn> for a em>node/em> if the nodes a idenabling-and-disabling-scripting:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> has a a href#concept-document-bc idenabling-and-disabling-scripting:concept-document-bc>browsing context/a>, and a href#concept-bc-script idenabling-and-disabling-scripting:concept-bc-script-2>scripting is enabled/a> in that a href#browsing-context idenabling-and-disabling-scripting:browsing-context-5>browsing context/a>./p> p>dfn idconcept-n-noscript>Scripting is disabled/dfn> for a node if there is no such a href#browsing-context idenabling-and-disabling-scripting:browsing-context-6>browsing context/a>, or if a href#concept-bc-noscript idenabling-and-disabling-scripting:concept-bc-noscript>scripting is disabled/a> in that a href#browsing-context idenabling-and-disabling-scripting:browsing-context-7>browsing context/a>./p> h4 idscripting-processing-model>span classsecno>8.1.3/span> span idprocessing-model-7>/span>Processing modela href#scripting-processing-model classself-link>/a>/h4> h5 iddefinitions-2>span classsecno>8.1.3.1/span> Definitionsa href#definitions-2 classself-link>/a>/h5> p>A dfn idconcept-script data-export>script/dfn> is one of two possible a hrefhttps://infra.spec.whatwg.org/#struct iddefinitions-2:struct data-x-internalstruct>structs/a>. All scripts have:/p> dl>dt>A dfn data-dfn-forscript idsettings-object data-export>settings object/dfn>dd>p>An a href#environment-settings-object iddefinitions-2:environment-settings-object>environment settings object/a>, containing various settings that are shared with other a href#concept-script iddefinitions-2:concept-script>scripts/a> in the same context.dt>A dfn data-dfn-forscript idconcept-script-record data-export>record/dfn>dd>p>Either a a iddefinitions-2:script-record hrefhttps://tc39.github.io/ecma262/#sec-script-records data-x-internalscript-record>Script Record/a>, for a href#classic-script iddefinitions-2:classic-script>classic scripts/a>; a a iddefinitions-2:source-text-module-record hrefhttps://tc39.github.io/ecma262/#sec-source-text-module-records data-x-internalsource-text-module-record>Source Text Module Record/a>, for a href#module-script iddefinitions-2:module-script>module scripts/a>; or null. In the former two cases, it represents a parsed script; null represents a failure parsing.dt>A dfn data-dfn-forscript idconcept-script-parse-error data-export>parse error/dfn>dd>p>A JavaScript value, which has meaning only if the a href#concept-script-record iddefinitions-2:concept-script-record>record/a> is null, indicating that the corresponding script source text could not be parsed.dt>An dfn data-dfn-forscript idconcept-script-error-to-rethrow data-export>error to rethrow/dfn>dd> p>A JavaScript value representing an error that will prevent evaluation from succeeding. It will be re-thrown by any attempts to a href#calling-scripts>run/a> the script./p> p classnote>Since this exception value is provided by the JavaScript specification, we know that it is never null, so we use null to signal that no error has occurred./p> dt>dfn data-dfn-forscript idconcept-script-script-fetch-options data-export>Fetch options/dfn>dd>A a href#script-fetch-options iddefinitions-2:script-fetch-options>script fetch options/a>, containing various options related to fetching this script or a href#module-script iddefinitions-2:module-script-2>module scripts/a> that it imports.dt>A dfn data-dfn-forscript idconcept-script-base-url data-export>base URL/dfn>dd>p>A base a iddefinitions-2:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> used for a href#resolve-a-module-specifier iddefinitions-2:resolve-a-module-specifier>resolving module specifiers/a>. This will either be the URL from which the script was obtained, for external scripts, or the a href#document-base-url iddefinitions-2:document-base-url>document base URL/a> of the containing document, for inline scripts./dl> p>A dfn idclassic-script data-export>classic script/dfn> is a type of a href#concept-script iddefinitions-2:concept-script-2>script/a> that has the following additional a hrefhttps://infra.spec.whatwg.org/#struct-item iddefinitions-2:struct-item data-x-internalstruct-item>item/a>:/p> dl>dt>A dfn idmuted-errors>muted errors/dfn> booleandd>p>A boolean which, if true, means that error information will not be provided for errors in this script. This is used to mute errors for cross-origin scripts, since that can leak private information./dl> p>A dfn idmodule-script data-export>module script/dfn> is another type of a href#concept-script iddefinitions-2:concept-script-3>script/a>. It has no additional a hrefhttps://infra.spec.whatwg.org/#struct-item iddefinitions-2:struct-item-2 data-x-internalstruct-item>items/a>./p> hr> p>An dfn idenvironment data-export>environment/dfn> is an object that identifies the settings of a current or potential execution environment. An a href#environment iddefinitions-2:environment>environment/a> has the following fields:/p> dl>dt>An dfn data-dfn-forenvironment idconcept-environment-id data-export>id/dfn>dd>p>An opaque string that uniquely identifies the a href#environment iddefinitions-2:environment-2>environment/a>.dt>A dfn data-dfn-forenvironment idconcept-environment-creation-url data-export>creation URL/dfn>dd> p>A a iddefinitions-2:url-record hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a> that represents the location of the resource with which the a href#environment iddefinitions-2:environment-3>environment/a> is associated./p> p classnote>In the case of an a href#environment-settings-object iddefinitions-2:environment-settings-object-2>environment settings object/a>, this URL might be distinct from the a href#environment-settings-object iddefinitions-2:environment-settings-object-3>environment settings object/a>s a href#responsible-document iddefinitions-2:responsible-document>responsible document/a>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url iddefinitions-2:the-documents-address data-x-internalthe-documents-address>URL/a>, due to mechanisms such as code iddefinitions-2:dom-history-pushstate>a href#dom-history-pushstate>history.pushState()/a>/code>./p> dt>A dfn data-dfn-forenvironment idconcept-environment-target-browsing-context data-export>target browsing context/dfn>dd>p>Null or a target a href#browsing-context iddefinitions-2:browsing-context>browsing context/a> for a a hrefhttps://fetch.spec.whatwg.org/#navigation-request iddefinitions-2:navigation-request data-x-internalnavigation-request>navigation request/a>.dt>An dfn data-dfn-forenvironment idconcept-environment-active-service-worker data-export>active service worker/dfn>dd>p>Null or a a hrefhttps://w3c.github.io/ServiceWorker/#dfn-service-worker iddefinitions-2:dfn-service-worker data-x-internaldfn-service-worker>service worker/a> that a hrefhttps://w3c.github.io/ServiceWorker/#dfn-control iddefinitions-2:dfn-control data-x-internaldfn-control>controls/a> the a href#environment iddefinitions-2:environment-4>environment/a>.dt>An dfn data-dfn-forenvironment idconcept-environment-execution-ready-flag data-export>execution ready flag/dfn>dd>p>A flag that indicates whether the environment setup is done. It is initially unset./dl> p>An dfn idenvironment-settings-object data-export>environment settings object/dfn> is an a href#environment iddefinitions-2:environment-5>environment/a> that additionally specifies algorithms for:/p> dl>dt>A dfn data-dfn-forenvironment settings object idrealm-execution-context data-export>realm execution context/dfn>dd> p>A a iddefinitions-2:javascript-execution-context hrefhttps://tc39.github.io/ecma262/#sec-execution-contexts data-x-internaljavascript-execution-context>JavaScript execution context/a> shared by all a href#the-script-element iddefinitions-2:the-script-element>scripts/a> that use this settings object, i.e. all scripts in a given a iddefinitions-2:javascript-realm hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript realm/a>. When we a href#run-a-classic-script iddefinitions-2:run-a-classic-script>run a classic script/a> or a href#run-a-module-script iddefinitions-2:run-a-module-script>run a module script/a>, this execution context becomes the top of the a iddefinitions-2:javascript-execution-context-stack hrefhttps://tc39.github.io/ecma262/#execution-context-stack data-x-internaljavascript-execution-context-stack>JavaScript execution context stack/a>, on top of which another execution context specific to the script in question is pushed. (This setup ensures a hrefhttps://tc39.github.io/ecma262/#sec-parse-script iddefinitions-2:js-parsescript data-x-internaljs-parsescript>ParseScript/a> and a iddefinitions-2:source-text-module-record-2 hrefhttps://tc39.github.io/ecma262/#sec-source-text-module-records data-x-internalsource-text-module-record>Source Text Module Record/a>s a hrefhttps://tc39.github.io/ecma262/#sec-moduleevaluation iddefinitions-2:js-evaluate data-x-internaljs-evaluate>Evaluate/a> know which Realm to use.)/p> dt>A dfn data-dfn-forenvironment settings object idconcept-settings-object-module-map data-export>module map/dfn>dd> p>A a href#module-map iddefinitions-2:module-map>module map/a> that is used when importing JavaScript modules./p> dt>A dfn data-dfn-forenvironment settings object idresponsible-browsing-context data-export>responsible browsing context/dfn>dd> p>A a href#browsing-context iddefinitions-2:browsing-context-2>browsing context/a> that is assigned responsibility for actions taken by the scripts that use this a href#environment-settings-object iddefinitions-2:environment-settings-object-4>environment settings object/a>./p> p classexample>When a script creates and a href#navigate iddefinitions-2:navigate>navigates/a> a new a href#top-level-browsing-context iddefinitions-2:top-level-browsing-context>top-level browsing context/a>, the code iddefinitions-2:dom-opener>a href#dom-opener>opener/a>/code> attribute of the new a href#browsing-context iddefinitions-2:browsing-context-3>browsing context/a>s code iddefinitions-2:window>a href#window>Window/a>/code> object will be set to the a href#responsible-browsing-context iddefinitions-2:responsible-browsing-context>responsible browsing context/a>s code iddefinitions-2:windowproxy>a href#windowproxy>WindowProxy/a>/code> object./p> dt>A dfn data-dfn-forenvironment settings object idresponsible-event-loop data-export>responsible event loop/dfn>dd> p>An a href#event-loop iddefinitions-2:event-loop>event loop/a> that is used when it would not be immediately clear what event loop to use./p> dt>A dfn data-dfn-forenvironment settings object idresponsible-document data-export>responsible document/dfn>dd> p>A code iddefinitions-2:document>a href#document>Document/a>/code> that is assigned responsibility for actions taken by the scripts that use this a href#environment-settings-object iddefinitions-2:environment-settings-object-5>environment settings object/a>./p> p classexample>For example, the a hrefhttps://dom.spec.whatwg.org/#concept-document-url iddefinitions-2:the-documents-address-2 data-x-internalthe-documents-address>URL/a> of the a href#responsible-document iddefinitions-2:responsible-document-2>responsible document/a> is used to set the a hrefhttps://dom.spec.whatwg.org/#concept-document-url iddefinitions-2:the-documents-address-3 data-x-internalthe-documents-address>URL/a> of the code iddefinitions-2:document-2>a href#document>Document/a>/code> after it has been reset using code iddefinitions-2:dom-document-open>a href#dom-document-open>document.open()/a>/code>./p> p>If the a href#responsible-event-loop iddefinitions-2:responsible-event-loop>responsible event loop/a> is not a a href#browsing-context iddefinitions-2:browsing-context-4>browsing context/a> a href#event-loop iddefinitions-2:event-loop-2>event loop/a>, then the a href#environment-settings-object iddefinitions-2:environment-settings-object-6>environment settings object/a> has no a href#responsible-document iddefinitions-2:responsible-document-3>responsible document/a>./p> dt>An dfn data-dfn-forenvironment settings object idapi-url-character-encoding data-export>API URL character encoding/dfn>dd> p>A character encoding used to encode URLs by APIs called by scripts that use this a href#environment-settings-object iddefinitions-2:environment-settings-object-7>environment settings object/a>./p> dt>An dfn data-dfn-forenvironment settings object idapi-base-url data-export>API base URL/dfn>dd> p>A a iddefinitions-2:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> used by APIs called by scripts that use this a href#environment-settings-object iddefinitions-2:environment-settings-object-8>environment settings object/a> to a href#parse-a-url iddefinitions-2:parse-a-url>parse URLs/a>./p> dt>An dfn data-dfn-forenvironment settings object idconcept-settings-object-origin data-export>origin/dfn>dd> p>An a href#concept-origin iddefinitions-2:concept-origin>origin/a> used in security checks./p> dt>An dfn data-dfn-forenvironment settings object idhttps-state data-export>HTTPS state/dfn>dd>p>An a iddefinitions-2:https-state-value hrefhttps://fetch.spec.whatwg.org/#concept-https-state-value data-x-internalhttps-state-value>HTTPS state value/a> representing the security properties of the network channel used to deliver the resource with which the a href#environment-settings-object iddefinitions-2:environment-settings-object-9>environment settings object/a> is associated.dt>A dfn data-dfn-forenvironment settings object idconcept-settings-object-referrer-policy data-export>referrer policy/dfn>dd>p>The default a iddefinitions-2:referrer-policy hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>referrer policy/a> for a hrefhttps://fetch.spec.whatwg.org/#concept-fetch iddefinitions-2:concept-fetch data-x-internalconcept-fetch>fetches/a> performed using this a href#environment-settings-object iddefinitions-2:environment-settings-object-10>environment settings object/a> as a a hrefhttps://fetch.spec.whatwg.org/#concept-request-client iddefinitions-2:concept-request-client data-x-internalconcept-request-client>request client/a>. a href#refsREFERRERPOLICY>REFERRERPOLICY/a> /dl> p>An a href#environment-settings-object iddefinitions-2:environment-settings-object-11>environment settings object/a> also has an dfn idoutstanding-rejected-promises-weak-set>outstanding rejected promises weak set/dfn> and an dfn idabout-to-be-notified-rejected-promises-list>about-to-be-notified rejected promises list/dfn>, used to track a href#unhandled-promise-rejections>unhandled promise rejections/a>. The a href#outstanding-rejected-promises-weak-set iddefinitions-2:outstanding-rejected-promises-weak-set>outstanding rejected promises weak set/a> must not create strong references to any of its members, and implementations are free to limit its size, e.g. by removing old entries from it when new ones are added./p> h5 idfetching-scripts>span classsecno>8.1.3.2/span> Fetching scriptsa href#fetching-scripts classself-link>/a>/h5> p>This section introduces a number of algorithms for fetching scripts, taking various necessary inputs and resulting in a href#classic-script idfetching-scripts:classic-script>classic/a> or a href#module-script idfetching-scripts:module-script>module scripts/a>./p> hr> p>dfn idscript-fetch-options>Script fetch options/dfn> is a a idfetching-scripts:struct hrefhttps://infra.spec.whatwg.org/#struct data-x-internalstruct>struct/a> with the following a hrefhttps://infra.spec.whatwg.org/#struct-item idfetching-scripts:struct-item data-x-internalstruct-item>items/a>:/p> dl>dt>dfn idconcept-script-fetch-options-nonce>cryptographic nonce/dfn>dd>p>The a hrefhttps://fetch.spec.whatwg.org/#concept-request-nonce-metadata idfetching-scripts:concept-request-nonce-metadata data-x-internalconcept-request-nonce-metadata>cryptographic nonce metadata/a> used for the initial fetch and for fetching any imported modulesdt>dfn idconcept-script-fetch-options-integrity>integrity metadata/dfn>dd>p>The a hrefhttps://fetch.spec.whatwg.org/#concept-request-integrity-metadata idfetching-scripts:concept-request-integrity-metadata data-x-internalconcept-request-integrity-metadata>integrity metadata/a> used for the initial fetchdt>dfn idconcept-script-fetch-options-parser>parser metadata/dfn>dd>p>The a hrefhttps://fetch.spec.whatwg.org/#concept-request-parser-metadata idfetching-scripts:concept-request-parser-metadata data-x-internalconcept-request-parser-metadata>parser metadata/a> used for the initial fetch and for fetching any imported modulesdt>dfn idconcept-script-fetch-options-credentials>credentials mode/dfn>dd>p>The a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode idfetching-scripts:concept-request-credentials-mode data-x-internalconcept-request-credentials-mode>credentials mode/a> used for the initial fetch (for a href#module-script idfetching-scripts:module-script-2>module scripts/a>) and for fetching any imported modules (for both a href#module-script idfetching-scripts:module-script-3>module scripts/a> and a href#classic-script idfetching-scripts:classic-script-2>classic scripts/a>)/dl> p classnote>Recall that via the code idfetching-scripts:import()>a data-x-internalimport() hrefhttps://tc39.github.io/proposal-dynamic-import/#sec-import-calls>import()/a>/code> feature, a href#classic-script idfetching-scripts:classic-script-3>classic scripts/a> can import a href#module-script idfetching-scripts:module-script-4>module scripts/a>./p> p>The dfn iddefault-classic-script-fetch-options>default classic script fetch options/dfn> are a a href#script-fetch-options idfetching-scripts:script-fetch-options>script fetch options/a> whose a href#concept-script-fetch-options-nonce idfetching-scripts:concept-script-fetch-options-nonce>cryptographic nonce/a> is the empty string, a href#concept-script-fetch-options-integrity idfetching-scripts:concept-script-fetch-options-integrity>integrity metadata/a> is the empty string, a href#concept-script-fetch-options-parser idfetching-scripts:concept-script-fetch-options-parser>parser metadata/a> is code>not-parser-inserted/code>, and a href#concept-script-fetch-options-credentials idfetching-scripts:concept-script-fetch-options-credentials>credentials mode/a> is code>omit/code>./p> p>Given a a hrefhttps://fetch.spec.whatwg.org/#concept-request idfetching-scripts:concept-request data-x-internalconcept-request>request/a> var>request/var> and a a href#script-fetch-options idfetching-scripts:script-fetch-options-2>script fetch options/a> var>options/var>, we define:/p> dl>dt>dfn idset-up-the-classic-script-request>set up the classic script request/dfn>dd>p>Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-nonce-metadata idfetching-scripts:concept-request-nonce-metadata-2 data-x-internalconcept-request-nonce-metadata>cryptographic nonce metadata/a> to var>options/var>s a href#concept-script-fetch-options-nonce idfetching-scripts:concept-script-fetch-options-nonce-2>cryptographic nonce/a>, its a hrefhttps://fetch.spec.whatwg.org/#concept-request-integrity-metadata idfetching-scripts:concept-request-integrity-metadata-2 data-x-internalconcept-request-integrity-metadata>integrity metadata/a> to var>options/var>s a href#concept-script-fetch-options-integrity idfetching-scripts:concept-script-fetch-options-integrity-2>integrity metadata/a>, and its a hrefhttps://fetch.spec.whatwg.org/#concept-request-parser-metadata idfetching-scripts:concept-request-parser-metadata-2 data-x-internalconcept-request-parser-metadata>parser metadata/a> to var>options/var>s a href#concept-script-fetch-options-parser idfetching-scripts:concept-script-fetch-options-parser-2>parser metadata/a>.dt>dfn idset-up-the-module-script-request>set up the module script request/dfn>dd>p>Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-nonce-metadata idfetching-scripts:concept-request-nonce-metadata-3 data-x-internalconcept-request-nonce-metadata>cryptographic nonce metadata/a> to var>options/var>s a href#concept-script-fetch-options-nonce idfetching-scripts:concept-script-fetch-options-nonce-3>cryptographic nonce/a>, its a hrefhttps://fetch.spec.whatwg.org/#concept-request-integrity-metadata idfetching-scripts:concept-request-integrity-metadata-3 data-x-internalconcept-request-integrity-metadata>integrity metadata/a> to var>options/var>s a href#concept-script-fetch-options-integrity idfetching-scripts:concept-script-fetch-options-integrity-3>integrity metadata/a>, its a hrefhttps://fetch.spec.whatwg.org/#concept-request-parser-metadata idfetching-scripts:concept-request-parser-metadata-3 data-x-internalconcept-request-parser-metadata>parser metadata/a> to var>options/var>s a href#concept-script-fetch-options-parser idfetching-scripts:concept-script-fetch-options-parser-3>parser metadata/a>, and its a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode idfetching-scripts:concept-request-credentials-mode-2 data-x-internalconcept-request-credentials-mode>credentials mode/a> to var>options/var>s a href#concept-script-fetch-options-credentials idfetching-scripts:concept-script-fetch-options-credentials-2>credentials mode/a>./dl> p>For any given a href#script-fetch-options idfetching-scripts:script-fetch-options-3>script fetch options/a> var>options/var>, the dfn iddescendant-script-fetch-options>descendant script fetch options/dfn> are a new a href#script-fetch-options idfetching-scripts:script-fetch-options-4>script fetch options/a> whose a hrefhttps://infra.spec.whatwg.org/#struct-item idfetching-scripts:struct-item-2 data-x-internalstruct-item>items/a> all have the same values, except for the a href#concept-script-fetch-options-integrity idfetching-scripts:concept-script-fetch-options-integrity-4>integrity metadata/a>, which is instead the empty string./p> hr> p>The algorithms below can be customized by optionally supplying a custom dfn data-dfn-forfetching scripts idfetching-scripts-perform-fetch data-export>perform the fetch/dfn> hook, which takes a a hrefhttps://fetch.spec.whatwg.org/#concept-request idfetching-scripts:concept-request-2 data-x-internalconcept-request>request/a> and an dfn data-dfn-forfetching scripts idfetching-scripts-is-top-level data-export>var>is top-level/var>/dfn> flag. The algorithm must complete with a a hrefhttps://fetch.spec.whatwg.org/#concept-response idfetching-scripts:concept-response data-x-internalconcept-response>response/a> (which may be a a idfetching-scripts:network-error hrefhttps://fetch.spec.whatwg.org/#concept-network-error data-x-internalnetwork-error>network error/a>), either synchronously (when using a href#fetch-a-classic-worker-imported-script idfetching-scripts:fetch-a-classic-worker-imported-script>fetch a classic worker-imported script/a>) or asynchronously (otherwise). The var idfetching-scripts:fetching-scripts-is-top-level>a href#fetching-scripts-is-top-level>is top-level/a>/var> flag will be set for all a href#classic-script idfetching-scripts:classic-script-4>classic script/a> fetches, and for the initial fetch when a href#fetch-a-module-script-tree idfetching-scripts:fetch-a-module-script-tree>fetching a module script graph/a> or a href#fetch-a-module-worker-script-tree idfetching-scripts:fetch-a-module-worker-script-tree>fetching a module worker script graph/a>, but not for the fetches resulting from code>import/code> statements encountered throughout the graph./p> div classnote> p>By default, not supplying the a href#fetching-scripts-perform-fetch idfetching-scripts:fetching-scripts-perform-fetch>perform the fetch/a> will cause the below algorithms to simply a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idfetching-scripts:concept-fetch data-x-internalconcept-fetch>fetch/a> the given a hrefhttps://fetch.spec.whatwg.org/#concept-request idfetching-scripts:concept-request-3 data-x-internalconcept-request>request/a>, with algorithm-specific customizations to the a hrefhttps://fetch.spec.whatwg.org/#concept-request idfetching-scripts:concept-request-4 data-x-internalconcept-request>request/a> and validations of the resulting a hrefhttps://fetch.spec.whatwg.org/#concept-response idfetching-scripts:concept-response-2 data-x-internalconcept-response>response/a>./p> p>To layer your own customizations on top of these algorithm-specific ones, supply a a href#fetching-scripts-perform-fetch idfetching-scripts:fetching-scripts-perform-fetch-2>perform the fetch/a> hook that modifies the given a hrefhttps://fetch.spec.whatwg.org/#concept-request idfetching-scripts:concept-request-5 data-x-internalconcept-request>request/a>, a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idfetching-scripts:concept-fetch-2 data-x-internalconcept-fetch>fetches/a> it, and then performs specific validations of the resulting a hrefhttps://fetch.spec.whatwg.org/#concept-response idfetching-scripts:concept-response-3 data-x-internalconcept-response>response/a> (completing with a a idfetching-scripts:network-error-2 hrefhttps://fetch.spec.whatwg.org/#concept-network-error data-x-internalnetwork-error>network error/a> if the validations fail)./p> p>The hook can also be used to perform more subtle customizations, such as keeping a cache of a hrefhttps://fetch.spec.whatwg.org/#concept-response idfetching-scripts:concept-response-4 data-x-internalconcept-response>responses/a> and avoiding performing a a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idfetching-scripts:concept-fetch-3 data-x-internalconcept-fetch>fetch/a> at all./p> /div> p classnote>cite>Service Workers/cite> is an example of a specification that runs these algorithms with its own options for the hook. a href#refsSW>SW/a>/p> hr> p>Now for the algorithms themselves./p> p>To dfn idfetch-a-classic-script data-export>fetch a classic script/dfn> given a var>url/var>, a var>settings object/var>, some var>options/var>, a var>CORS setting/var>, and a var>character encoding/var>, run these steps. The algorithm will asynchronously complete with either null (on failure) or a new a href#classic-script idfetching-scripts:classic-script-5>classic script/a> (on success)./p> ol>li>p>Let var>request/var> be the result of a href#create-a-potential-cors-request idfetching-scripts:create-a-potential-cors-request>creating a potential-CORS request/a> given var>url/var>, code>script/code>, and var>CORS setting/var>.li>p>Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-client idfetching-scripts:concept-request-client data-x-internalconcept-request-client>client/a> to var>settings object/var>./p> li>p>a href#set-up-the-classic-script-request idfetching-scripts:set-up-the-classic-script-request>Set up the classic script request/a> given var>request/var> and var>options/var>.li> p>If the caller specified custom steps to a href#fetching-scripts-perform-fetch idfetching-scripts:fetching-scripts-perform-fetch-3>perform the fetch/a>, perform them on var>request/var>, with the var idfetching-scripts:fetching-scripts-is-top-level-2>a href#fetching-scripts-is-top-level>is top-level/a>/var> flag set. Return from this algorithm, and when the custom a href#fetching-scripts-perform-fetch idfetching-scripts:fetching-scripts-perform-fetch-4>perform the fetch/a> steps complete with a hrefhttps://fetch.spec.whatwg.org/#concept-response idfetching-scripts:concept-response-5 data-x-internalconcept-response>response/a> var>response/var>, run the remaining steps./p> p>Otherwise, a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idfetching-scripts:concept-fetch-4 data-x-internalconcept-fetch>fetch/a> var>request/var>. Return from this algorithm, and run the remaining steps as part of the fetchs a idfetching-scripts:process-response hrefhttps://fetch.spec.whatwg.org/#process-response data-x-internalprocess-response>process response/a> for the a hrefhttps://fetch.spec.whatwg.org/#concept-response idfetching-scripts:concept-response-6 data-x-internalconcept-response>response/a> var>response/var>./p> p classnote>var>response/var> can be either a href#cors-same-origin idfetching-scripts:cors-same-origin>CORS-same-origin/a> or a href#cors-cross-origin idfetching-scripts:cors-cross-origin>CORS-cross-origin/a>. This only affects how error reporting happens./p> li>p>Let var>response/var> be var>response/var>s a href#unsafe-response idfetching-scripts:unsafe-response>unsafe response/a>.li>p>If var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-type idfetching-scripts:concept-response-type data-x-internalconcept-response-type>type/a> is code>error/code>, or var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-status idfetching-scripts:concept-response-status data-x-internalconcept-response-status>status/a> is not an a idfetching-scripts:ok-status hrefhttps://fetch.spec.whatwg.org/#ok-status data-x-internalok-status>ok status/a>, asynchronously complete this algorithm with null, and abort these steps.li>p>If var>response/var>s a href#content-type idfetching-scripts:content-type>Content Type metadata/a>, if any, specifies a character encoding, and the user agent supports that encoding, then set var>character encoding/var> to that encoding (ignoring the passed-in value).li> p>Let var>source text/var> be the result of a hrefhttps://encoding.spec.whatwg.org/#decode idfetching-scripts:decode data-x-internaldecode>decoding/a> var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-body idfetching-scripts:concept-response-body data-x-internalconcept-response-body>body/a> to Unicode, using var>character encoding/var> as the fallback encoding./p> p classnote>The a idfetching-scripts:decode-2 hrefhttps://encoding.spec.whatwg.org/#decode data-x-internaldecode>decode/a> algorithm overrides var>character encoding/var> if the file contains a BOM./p> li>p>Let var>muted errors/var> be true if var>response/var> was a href#cors-cross-origin idfetching-scripts:cors-cross-origin-2>CORS-cross-origin/a>, and false otherwise.li>p>Let var>script/var> be the result of a href#creating-a-classic-script idfetching-scripts:creating-a-classic-script>creating a classic script/a> given var>source text/var>, var>settings object/var>, var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-url idfetching-scripts:concept-response-url data-x-internalconcept-response-url>url/a>, var>options/var>, and var>muted errors/var>.li>Asynchronously complete this algorithm with var>script/var>./ol> p>To dfn idfetch-a-classic-worker-script data-export>fetch a classic worker script/dfn> given a var>url/var>, a var>fetch client settings object/var>, a var>destination/var>, and a var>script settings object/var>, run these steps. The algorithm will asynchronously complete with either null (on failure) or a new a href#classic-script idfetching-scripts:classic-script-6>classic script/a> (on success)./p> ol>li>p>Let var>request/var> be a new a hrefhttps://fetch.spec.whatwg.org/#concept-request idfetching-scripts:concept-request-6 data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idfetching-scripts:concept-request-url data-x-internalconcept-request-url>url/a> is var>url/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-client idfetching-scripts:concept-request-client-2 data-x-internalconcept-request-client>client/a> is var>fetch client settings object/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination idfetching-scripts:concept-request-destination data-x-internalconcept-request-destination>destination/a> is var>destination/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-mode idfetching-scripts:concept-request-mode data-x-internalconcept-request-mode>mode/a> is code>same-origin/code>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-credentials-mode idfetching-scripts:concept-request-credentials-mode-3 data-x-internalconcept-request-credentials-mode>credentials mode/a> is code>same-origin/code>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-parser-metadata idfetching-scripts:concept-request-parser-metadata-4 data-x-internalconcept-request-parser-metadata>parser metadata/a> is code>not parser-inserted/code>, and whose a idfetching-scripts:use-url-credentials-flag hrefhttps://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag data-x-internaluse-url-credentials-flag>use-URL-credentials flag/a> is set.li> p>If the caller specified custom steps to a href#fetching-scripts-perform-fetch idfetching-scripts:fetching-scripts-perform-fetch-5>perform the fetch/a>, perform them on var>request/var>, with the var idfetching-scripts:fetching-scripts-is-top-level-3>a href#fetching-scripts-is-top-level>is top-level/a>/var> flag set. Return from this algorithm, and when the custom a href#fetching-scripts-perform-fetch idfetching-scripts:fetching-scripts-perform-fetch-6>perform the fetch/a> steps complete with a hrefhttps://fetch.spec.whatwg.org/#concept-response idfetching-scripts:concept-response-7 data-x-internalconcept-response>response/a> var>response/var>, run the remaining steps./p> p>Otherwise, a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idfetching-scripts:concept-fetch-5 data-x-internalconcept-fetch>fetch/a> var>request/var>. Return from this algorithm, and run the remaining steps as part of the fetchs a idfetching-scripts:process-response-2 hrefhttps://fetch.spec.whatwg.org/#process-response data-x-internalprocess-response>process response/a> for the a hrefhttps://fetch.spec.whatwg.org/#concept-response idfetching-scripts:concept-response-8 data-x-internalconcept-response>response/a> var>response/var>./p> li>p>Let var>response/var> be var>response/var>s a href#unsafe-response idfetching-scripts:unsafe-response-2>unsafe response/a>.li>p>If var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-type idfetching-scripts:concept-response-type-2 data-x-internalconcept-response-type>type/a> is code>error/code>, or var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-status idfetching-scripts:concept-response-status-2 data-x-internalconcept-response-status>status/a> is not an a idfetching-scripts:ok-status-2 hrefhttps://fetch.spec.whatwg.org/#ok-status data-x-internalok-status>ok status/a>, asynchronously complete this algorithm with null, and abort these steps.li>p>Let var>source text/var> be the result of a hrefhttps://encoding.spec.whatwg.org/#utf-8-decode idfetching-scripts:utf-8-decode data-x-internalutf-8-decode>UTF-8 decoding/a> var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-body idfetching-scripts:concept-response-body-2 data-x-internalconcept-response-body>body/a>.li>p>Let var>script/var> be the result of a href#creating-a-classic-script idfetching-scripts:creating-a-classic-script-2>creating a classic script/a> using var>source text/var>, var>script settings object/var>, var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-url idfetching-scripts:concept-response-url-2 data-x-internalconcept-response-url>url/a>, and the a href#default-classic-script-fetch-options idfetching-scripts:default-classic-script-fetch-options>default classic script fetch options/a>.li>Asynchronously complete this algorithm with var>script/var>./ol> p>To dfn idfetch-a-classic-worker-imported-script data-export>fetch a classic worker-imported script/dfn> given a var>url/var> and a var>settings object/var>, run these steps. The algorithm will synchronously complete with a a href#classic-script idfetching-scripts:classic-script-7>classic script/a> on success, or throw an exception on failure./p> ol>li>p>Let var>request/var> be a new a hrefhttps://fetch.spec.whatwg.org/#concept-request idfetching-scripts:concept-request-7 data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idfetching-scripts:concept-request-url-2 data-x-internalconcept-request-url>url/a> is var>url/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-client idfetching-scripts:concept-request-client-3 data-x-internalconcept-request-client>client/a> is var>settings object/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination idfetching-scripts:concept-request-destination-2 data-x-internalconcept-request-destination>destination/a> is code>script/code>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-parser-metadata idfetching-scripts:concept-request-parser-metadata-5 data-x-internalconcept-request-parser-metadata>parser metadata/a> is code>not parser-inserted/code>, a idfetching-scripts:synchronous-flag hrefhttps://fetch.spec.whatwg.org/#synchronous-flag data-x-internalsynchronous-flag>synchronous flag/a> is set, and whose a idfetching-scripts:use-url-credentials-flag-2 hrefhttps://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag data-x-internaluse-url-credentials-flag>use-URL-credentials flag/a> is set.li> p>If the caller specified custom steps to a href#fetching-scripts-perform-fetch idfetching-scripts:fetching-scripts-perform-fetch-7>perform the fetch/a>, perform them on var>request/var>, with the var idfetching-scripts:fetching-scripts-is-top-level-4>a href#fetching-scripts-is-top-level>is top-level/a>/var> flag set. Let var>response/var> be the result./p> p>Otherwise, a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idfetching-scripts:concept-fetch-6 data-x-internalconcept-fetch>fetch/a> var>request/var>, and let var>response/var> be the result./p> p classnote>Unlike other algorithms in this section, the fetching process is synchronous here. Thus any a href#fetching-scripts-perform-fetch idfetching-scripts:fetching-scripts-perform-fetch-8>perform the fetch/a> steps will also finish their work synchronously./p> li>p>Let var>response/var> be var>response/var>s a href#unsafe-response idfetching-scripts:unsafe-response-3>unsafe response/a>.li>p>If var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-type idfetching-scripts:concept-response-type-3 data-x-internalconcept-response-type>type/a> is code>error/code>, or var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-status idfetching-scripts:concept-response-status-3 data-x-internalconcept-response-status>status/a> is not an a idfetching-scripts:ok-status-3 hrefhttps://fetch.spec.whatwg.org/#ok-status data-x-internalok-status>ok status/a>, throw a a idfetching-scripts:networkerror hrefhttps://heycam.github.io/webidl/#networkerror data-x-internalnetworkerror>code>NetworkError/code>/a> code idfetching-scripts:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Let var>source text/var> be the result of a hrefhttps://encoding.spec.whatwg.org/#utf-8-decode idfetching-scripts:utf-8-decode-2 data-x-internalutf-8-decode>UTF-8 decoding/a> var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-body idfetching-scripts:concept-response-body-3 data-x-internalconcept-response-body>body/a>.li>p>Let var>muted errors/var> be true if var>response/var> was a href#cors-cross-origin idfetching-scripts:cors-cross-origin-3>CORS-cross-origin/a>, and false otherwise.li>p>Let var>script/var> be the result of a href#creating-a-classic-script idfetching-scripts:creating-a-classic-script-3>creating a classic script/a> given var>source text/var>, var>settings object/var>, var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-url idfetching-scripts:concept-response-url-3 data-x-internalconcept-response-url>url/a>, the a href#default-classic-script-fetch-options idfetching-scripts:default-classic-script-fetch-options-2>default classic script fetch options/a>, and var>muted errors/var>.li>p>Return var>script/var>./ol> p>To dfn idfetch-a-module-script-tree data-export>fetch a module script graph/dfn> given a var>url/var>, a var>settings object/var>, a var>destination/var>, and some var>options/var>, run these steps. The algorithm will asynchronously complete with either null (on failure) or a a href#module-script idfetching-scripts:module-script-5>module script/a> (on success)./p> ol>li>p>Let var>visited set/var> be « var>url/var> ».li>p>Perform the a href#internal-module-script-graph-fetching-procedure idfetching-scripts:internal-module-script-graph-fetching-procedure>internal module script graph fetching procedure/a> given var>url/var>, var>settings object/var>, var>destination/var>, var>options/var>, var>settings object/var>, var>visited set/var>, code>client/code>, and with the var>top-level module fetch flag/var> set. If the caller of this algorithm specified custom a href#fetching-scripts-perform-fetch idfetching-scripts:fetching-scripts-perform-fetch-9>perform the fetch/a> steps, pass those along as well./p> li>p>When the a href#internal-module-script-graph-fetching-procedure idfetching-scripts:internal-module-script-graph-fetching-procedure-2>internal module script graph fetching procedure/a> asynchronously completes with var>result/var>, asynchronously complete this algorithm with var>result/var>./ol> p>To dfn idfetch-a-module-worker-script-tree data-export>fetch a module worker script graph/dfn> given a var>url/var>, a var>fetch client settings object/var>, a var>destination/var>, a var>credentials mode/var>, and a var>module map settings object/var>, run these steps. The algorithm will asynchronously complete with either null (on failure) or a a href#module-script idfetching-scripts:module-script-6>module script/a> (on success)./p> ol>li>p>Let var>visited set/var> be « var>url/var> ».li>p>Let var>options/var> be a a href#script-fetch-options idfetching-scripts:script-fetch-options-5>script fetch options/a> whose a href#concept-script-fetch-options-nonce idfetching-scripts:concept-script-fetch-options-nonce-4>cryptographic nonce/a> is the empty string, a href#concept-script-fetch-options-integrity idfetching-scripts:concept-script-fetch-options-integrity-5>integrity metadata/a> is the empty string, a href#concept-script-fetch-options-parser idfetching-scripts:concept-script-fetch-options-parser-4>parser metadata/a> is code>not-parser-inserted/code>, and a href#concept-script-fetch-options-credentials idfetching-scripts:concept-script-fetch-options-credentials-3>credentials mode/a> is var>credentials mode/var>./p> li>p>Perform the a href#internal-module-script-graph-fetching-procedure idfetching-scripts:internal-module-script-graph-fetching-procedure-3>internal module script graph fetching procedure/a> given var>url/var>, var>fetch client settings object/var>, var>destination/var>, var>options/var>, var>module map settings object/var>, var>visited set/var>, code>client/code>, and with the var>top-level module fetch flag/var> set. If the caller of this algorithm specified custom a href#fetching-scripts-perform-fetch idfetching-scripts:fetching-scripts-perform-fetch-10>perform the fetch/a> steps, pass those along as well./p> li>p>When the a href#internal-module-script-graph-fetching-procedure idfetching-scripts:internal-module-script-graph-fetching-procedure-4>internal module script graph fetching procedure/a> asynchronously completes with var>result/var>, asynchronously complete this algorithm with var>result/var>./ol> hr> p>The following algorithms are meant for internal use by this specification only as part of a href#fetch-a-module-script-tree idfetching-scripts:fetch-a-module-script-tree-2>fetching a module script graph/a> or a href#prepare-a-script idfetching-scripts:prepare-a-script>preparing a script/a>, and should not be used directly by other specifications./p> p>To perform the dfn idinternal-module-script-graph-fetching-procedure>internal module script graph fetching procedure/dfn> given a var>url/var>, a var>fetch client settings object/var>, a var>destination/var>, a some var>options/var>, a var>module map settings object/var>, a var>visited set/var>, a var>referrer/var>, and a var>top-level module fetch/var> flag, perform these steps. The algorithm will asynchronously complete with either null (on failure) or a a href#module-script idfetching-scripts:module-script-7>module script/a> (on success)./p> ol>li>p>Assert: var>visited set/var> a hrefhttps://infra.spec.whatwg.org/#list-contain idfetching-scripts:list-contains data-x-internallist-contains>contains/a> var>url/var>.li>p>a href#fetch-a-single-module-script idfetching-scripts:fetch-a-single-module-script>Fetch a single module script/a> given var>url/var>, var>fetch client settings object/var>, var>destination/var>, var>options/var>, var>module map settings object/var>, var>referrer/var>, and the var>top-level module fetch/var> flag. If the caller of this algorithm specified custom a href#fetching-scripts-perform-fetch idfetching-scripts:fetching-scripts-perform-fetch-11>perform the fetch/a> steps, pass those along while a href#fetch-a-single-module-script idfetching-scripts:fetch-a-single-module-script-2>fetching a single module script/a>./p> li>p>Return from this algorithm, and run the following steps when a href#fetch-a-single-module-script idfetching-scripts:fetch-a-single-module-script-3>fetching a single module script/a> asynchronously completes with var>result/var>:li>p>If var>result/var> is null, asynchronously complete this algorithm with null, and abort these steps.li>p>If the var>top-level module fetch/var> flag is set, a href#fetch-the-descendants-of-and-instantiate-a-module-script idfetching-scripts:fetch-the-descendants-of-and-instantiate-a-module-script>fetch the descendants of and instantiate/a> var>result/var> given var>destination/var> and var>visited set/var>. Otherwise, a href#fetch-the-descendants-of-a-module-script idfetching-scripts:fetch-the-descendants-of-a-module-script>fetch the descendants of/a> var>result/var> given the same arguments.li>p>When the appropriate algorithm asynchronously completes with var>final result/var>, asynchronously complete this algorithm with var>final result/var>./ol> p>To dfn idfetch-a-single-module-script>fetch a single module script/dfn>, given a var>url/var>, a var>fetch client settings object/var>, a var>destination/var>, some var>options/var>, a var>module map settings object/var>, a var>referrer/var>, and a var>top-level module fetch/var> flag, run these steps. The algorithm will asynchronously complete with either null (on failure) or a a href#module-script idfetching-scripts:module-script-8>module script/a> (on success)./p> ol>li>p>Let var>moduleMap/var> be var>module map settings object/var>s a href#concept-settings-object-module-map idfetching-scripts:concept-settings-object-module-map>module map/a>.li>p>If var>moduleMap/var>var>url/var> is code>fetching/code>, wait a href#in-parallel idfetching-scripts:in-parallel>in parallel/a> until that entrys value changes, then a href#queue-a-task idfetching-scripts:queue-a-task>queue a task/a> on the a href#networking-task-source idfetching-scripts:networking-task-source>networking task source/a> to proceed with running the following steps.li>p>If var>moduleMap/var>var>url/var> a hrefhttps://infra.spec.whatwg.org/#map-exists idfetching-scripts:map-exists data-x-internalmap-exists>exists/a>, asynchronously complete this algorithm with var>moduleMap/var>var>url/var>, and abort these steps.li>p>a hrefhttps://infra.spec.whatwg.org/#map-set idfetching-scripts:map-set data-x-internalmap-set>Set/a> var>moduleMap/var>var>url/var> to code>fetching/code>./p> li>p>Let var>request/var> be a new a hrefhttps://fetch.spec.whatwg.org/#concept-request idfetching-scripts:concept-request-8 data-x-internalconcept-request>request/a> whose a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idfetching-scripts:concept-request-url-3 data-x-internalconcept-request-url>url/a> is var>url/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-destination idfetching-scripts:concept-request-destination-3 data-x-internalconcept-request-destination>destination/a> is var>destination/var>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-mode idfetching-scripts:concept-request-mode-2 data-x-internalconcept-request-mode>mode/a> is code>cors/code>, a hrefhttps://fetch.spec.whatwg.org/#concept-request-referrer idfetching-scripts:concept-request-referrer data-x-internalconcept-request-referrer>referrer/a> is var>referrer/var>, and a hrefhttps://fetch.spec.whatwg.org/#concept-request-client idfetching-scripts:concept-request-client-4 data-x-internalconcept-request-client>client/a> is var>fetch client settings object/var>.li>p>a href#set-up-the-module-script-request idfetching-scripts:set-up-the-module-script-request>Set up the module script request/a> given var>request/var> and var>options/var>.li> p>If the caller specified custom steps to a href#fetching-scripts-perform-fetch idfetching-scripts:fetching-scripts-perform-fetch-12>perform the fetch/a>, perform them on var>request/var>, setting the var idfetching-scripts:fetching-scripts-is-top-level-5>a href#fetching-scripts-is-top-level>is top-level/a>/var> flag if the var>top-level module fetch/var> flag is set. Return from this algorithm, and when the custom a href#fetching-scripts-perform-fetch idfetching-scripts:fetching-scripts-perform-fetch-13>perform the fetch/a> steps complete with a hrefhttps://fetch.spec.whatwg.org/#concept-response idfetching-scripts:concept-response-9 data-x-internalconcept-response>response/a> var>response/var>, run the remaining steps./p> p>Otherwise, a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idfetching-scripts:concept-fetch-7 data-x-internalconcept-fetch>fetch/a> var>request/var>. Return from this algorithm, and run the remaining steps as part of the fetchs a idfetching-scripts:process-response-3 hrefhttps://fetch.spec.whatwg.org/#process-response data-x-internalprocess-response>process response/a> for the a hrefhttps://fetch.spec.whatwg.org/#concept-response idfetching-scripts:concept-response-10 data-x-internalconcept-response>response/a> var>response/var>./p> p classnote>var>response/var> is always a href#cors-same-origin idfetching-scripts:cors-same-origin-2>CORS-same-origin/a>./p> li> p>If any of the following conditions are met, a hrefhttps://infra.spec.whatwg.org/#map-set idfetching-scripts:map-set-2 data-x-internalmap-set>set/a> var>moduleMap/var>var>url/var> to null, asynchronously complete this algorithm with null, and abort these steps:/p> ul classcompact>li>p>var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-type idfetching-scripts:concept-response-type-4 data-x-internalconcept-response-type>type/a> is code>error/code>li>p>var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-status idfetching-scripts:concept-response-status-4 data-x-internalconcept-response-status>status/a> is not an a idfetching-scripts:ok-status-4 hrefhttps://fetch.spec.whatwg.org/#ok-status data-x-internalok-status>ok status/a>li> p>The result of a hrefhttps://fetch.spec.whatwg.org/#concept-header-extract-mime-type idfetching-scripts:extract-a-mime-type data-x-internalextract-a-mime-type>extracting a MIME type/a> from var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-header-list idfetching-scripts:concept-response-header-list data-x-internalconcept-response-header-list>header list/a> (ignoring parameters) is not a a href#javascript-mime-type idfetching-scripts:javascript-mime-type>JavaScript MIME type/a>/p> p classnote>For historical reasons, a href#fetch-a-classic-script idfetching-scripts:fetch-a-classic-script>fetching a classic script/a> does not include MIME type checking. In contrast, module scripts will fail to load if they are not of a correct MIME type./p> /ul> li>p>Let var>source text/var> be the result of a hrefhttps://encoding.spec.whatwg.org/#utf-8-decode idfetching-scripts:utf-8-decode-3 data-x-internalutf-8-decode>UTF-8 decoding/a> var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-body idfetching-scripts:concept-response-body-4 data-x-internalconcept-response-body>body/a>.li>p>Let var>module script/var> be the result of a href#creating-a-module-script idfetching-scripts:creating-a-module-script>creating a module script/a> given var>source text/var>, var>module map settings object/var>, var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-url idfetching-scripts:concept-response-url-4 data-x-internalconcept-response-url>url/a>, and var>options/var>.li> p>a hrefhttps://infra.spec.whatwg.org/#map-set idfetching-scripts:map-set-3 data-x-internalmap-set>Set/a> var>moduleMap/var>var>url/var> to var>module script/var>, and asynchronously complete this algorithm with var>module script/var>./p> p classnote>It is intentional that the a href#module-map idfetching-scripts:module-map>module map/a> is keyed by the a hrefhttps://fetch.spec.whatwg.org/#concept-request-url idfetching-scripts:concept-request-url-4 data-x-internalconcept-request-url>request URL/a>, whereas the a href#concept-script-base-url idfetching-scripts:concept-script-base-url>base URL/a> for the a href#module-script idfetching-scripts:module-script-9>module script/a> is set to the a hrefhttps://fetch.spec.whatwg.org/#concept-response-url idfetching-scripts:concept-response-url-5 data-x-internalconcept-response-url>response URL/a>. The former is used to deduplicate fetches, while the latter is used for URL resolution./p> /ol> p>To dfn idfetch-the-descendants-of-a-module-script>fetch the descendants of a module script/dfn> var>module script/var>, given a var>destination/var> and a var>visited set/var>, run these steps. The algorithm will asynchronously complete with either null (on failure) or with var>module script/var> (on success)./p> ol>li>p>If var>module script/var>s a href#concept-script-record idfetching-scripts:concept-script-record>record/a> is null, then asynchronously complete this algorithm with var>module script/var> and abort these steps.li>p>Let var>record/var> be var>module script/var>s a href#concept-script-record idfetching-scripts:concept-script-record-2>record/a>.li>p>If var>record/var>.RequestedModules a hrefhttps://infra.spec.whatwg.org/#list-is-empty idfetching-scripts:list-is-empty data-x-internallist-is-empty>is empty/a>, asynchronously complete this algorithm with var>module script/var>.li>p>Let var>urls/var> be a new empty a idfetching-scripts:list hrefhttps://infra.spec.whatwg.org/#list data-x-internallist>list/a>.li> p>a hrefhttps://infra.spec.whatwg.org/#list-iterate idfetching-scripts:list-iterate data-x-internallist-iterate>For each/a> string var>requested/var> of var>record/var>.RequestedModules,/p> ol>li>p>Let var>url/var> be the result of a href#resolve-a-module-specifier idfetching-scripts:resolve-a-module-specifier>resolving a module specifier/a> given var>module script/var> and var>requested/var>.li>p>Assert: var>url/var> is never failure, because a href#resolve-a-module-specifier idfetching-scripts:resolve-a-module-specifier-2>resolving a module specifier/a> must have been a href#validate-requested-module-specifiers>previously successful/a> with these same two arguments.li> p>If var>visited set/var> does not a hrefhttps://infra.spec.whatwg.org/#list-contain idfetching-scripts:list-contains-2 data-x-internallist-contains>contain/a> var>url/var>, then:/p> ol>li>p>a hrefhttps://infra.spec.whatwg.org/#list-append idfetching-scripts:list-append data-x-internallist-append>Append/a> var>url/var> to var>urls/var>.li>p>a hrefhttps://infra.spec.whatwg.org/#set-append idfetching-scripts:set-append data-x-internalset-append>Append/a> var>url/var> to var>visited set/var>./ol> /ol> li>p>Let var>options/var> be the a href#descendant-script-fetch-options idfetching-scripts:descendant-script-fetch-options>descendant script fetch options/a> for var>module script/var>s a href#concept-script-script-fetch-options idfetching-scripts:concept-script-script-fetch-options>fetch options/a>.li> p>a hrefhttps://infra.spec.whatwg.org/#list-iterate idfetching-scripts:list-iterate-2 data-x-internallist-iterate>For each/a> var>url/var> in var>urls/var>, perform the a href#internal-module-script-graph-fetching-procedure idfetching-scripts:internal-module-script-graph-fetching-procedure-5>internal module script graph fetching procedure/a> given var>url/var>, var>options/var>, var>destination/var>, var>module script/var>s a href#settings-object idfetching-scripts:settings-object>settings object/a>, var>module script/var>s a href#settings-object idfetching-scripts:settings-object-2>settings object/a>, var>visited set/var>, var>module script/var>s a href#concept-script-base-url idfetching-scripts:concept-script-base-url-2>base URL/a>, and with the var>top-level module fetch/var> flag unset. If the caller of this algorithm specified custom a href#fetching-scripts-perform-fetch idfetching-scripts:fetching-scripts-perform-fetch-14>perform the fetch/a> steps, pass those along while performing the a href#internal-module-script-graph-fetching-procedure idfetching-scripts:internal-module-script-graph-fetching-procedure-6>internal module script graph fetching procedure/a>./p> p>These invocations of the a href#internal-module-script-graph-fetching-procedure idfetching-scripts:internal-module-script-graph-fetching-procedure-7>internal module script graph fetching procedure/a> should be performed in parallel to each other./p> p>If any of the invocations of the a href#internal-module-script-graph-fetching-procedure idfetching-scripts:internal-module-script-graph-fetching-procedure-8>internal module script graph fetching procedure/a> asynchronously complete with null, asynchronously complete this algorithm with null, aborting these steps./p> p>Otherwise, wait until all of the a href#internal-module-script-graph-fetching-procedure idfetching-scripts:internal-module-script-graph-fetching-procedure-9>internal module script graph fetching procedure/a> invocations have asynchronously completed. Asynchronously complete this algorithm with var>module script/var>./p> /ol> p>To dfn idfetch-the-descendants-of-and-instantiate-a-module-script>fetch the descendants of and instantiate a module script/dfn> var>module script/var>, given a var>destination/var> and an optional var>visited set/var>, run these steps. The algorithm will asynchronously complete with either null (on failure) or with var>module script/var> (on success)./p> ol>li>p>If var>visited set/var> was not given, let it be an empty a idfetching-scripts:set hrefhttps://infra.spec.whatwg.org/#ordered-set data-x-internalset>set/a>.li>p>a href#fetch-the-descendants-of-a-module-script idfetching-scripts:fetch-the-descendants-of-a-module-script-2>Fetch the descendants of/a> var>module script/var>, given var>destination/var> and var>visited set/var>.li>p>Return from this algorithm, and run the following steps when a href#fetch-the-descendants-of-a-module-script idfetching-scripts:fetch-the-descendants-of-a-module-script-3>fetching the descendants of a module script/a> asynchronously completes with var>result/var>.li> p>If var>result/var> is null, then asynchronously complete this algorithm with var>result/var>./p> p classnote>In this case, there was an error fetching one or more of the descendants. We will not attempt to instantiate./p> li>p>Let var>parse error/var> be the result of a href#finding-the-first-parse-error idfetching-scripts:finding-the-first-parse-error>finding the first parse error/a> given var>result/var>.li>p>If var>parse error/var> is null, then:/p> ol>li>p>Let var>record/var> be var>result/var>s a href#concept-script-record idfetching-scripts:concept-script-record-3>record/a>.li> p>Perform var>record/var>.a hrefhttps://tc39.github.io/ecma262/#sec-moduledeclarationinstantiation idfetching-scripts:js-instantiate data-x-internaljs-instantiate>Instantiate/a>()./p> p classnote>This step will recursively call a hrefhttps://tc39.github.io/ecma262/#sec-moduledeclarationinstantiation idfetching-scripts:js-instantiate-2 data-x-internaljs-instantiate>Instantiate/a> on all of the modules uninstantiated dependencies./p> p>If this throws an exception, set var>result/var>s a href#concept-script-error-to-rethrow idfetching-scripts:concept-script-error-to-rethrow>error to rethrow/a> to that exception./p> /ol> li>p>Otherwise, set var>result/var>s a href#concept-script-error-to-rethrow idfetching-scripts:concept-script-error-to-rethrow-2>error to rethrow/a> to var>parse error/var>.li>p>Asynchronously complete this algorithm with var>result/var>./ol> p>To dfn idfinding-the-first-parse-error>find the first parse error/dfn> given a root var>moduleScript/var> and an optional var>discoveredSet/var>:/p> ol>li>p>Let var>moduleMap/var> be var>moduleScript/var>s a href#settings-object idfetching-scripts:settings-object-3>settings object/a>s a href#concept-settings-object-module-map idfetching-scripts:concept-settings-object-module-map-2>module map/a>.li>p>If var>discoveredSet/var> was not given, let it be an empty a idfetching-scripts:set-2 hrefhttps://infra.spec.whatwg.org/#ordered-set data-x-internalset>set/a>.li>p>a hrefhttps://infra.spec.whatwg.org/#list-append idfetching-scripts:list-append-2 data-x-internallist-append>Append/a> var>moduleScript/var> to var>discoveredSet/var>.li>p>If var>moduleScript/var>s a href#concept-script-record idfetching-scripts:concept-script-record-4>record/a> is null, then return var>moduleScript/var>s a href#concept-script-parse-error idfetching-scripts:concept-script-parse-error>parse error/a>.li>p>Let var>childSpecifiers/var> be the value of var>moduleScript/var>s a href#concept-script-record idfetching-scripts:concept-script-record-5>record/a>s RequestedModules internal slot.li>p>Let var>childURLs/var> be the a idfetching-scripts:list-2 hrefhttps://infra.spec.whatwg.org/#list data-x-internallist>list/a> obtained by calling a href#resolve-a-module-specifier idfetching-scripts:resolve-a-module-specifier-3>resolve a module specifier/a> once for each item of var>childSpecifiers/var>, given var>moduleScript/var> and that item. (None of these will ever fail, as otherwise var>moduleScript/var> would have been marked as itself having a parse error.)li>p>Let var>childModules/var> be the a idfetching-scripts:list-3 hrefhttps://infra.spec.whatwg.org/#list data-x-internallist>list/a> obtained by a hrefhttps://infra.spec.whatwg.org/#map-get idfetching-scripts:map-get data-x-internalmap-get>getting each value/a> in var>moduleMap/var> whose key is given by an item of var>childURLs/var>.li> p>a hrefhttps://infra.spec.whatwg.org/#list-iterate idfetching-scripts:list-iterate-3 data-x-internallist-iterate>For each/a> var>childModule/var> of var>childModules/var>:/p> ol>li>p>Assert: var>childModule/var> is a a href#module-script idfetching-scripts:module-script-10>module script/a> (i.e., it is not code>fetching/code> or null); by now all a href#module-script idfetching-scripts:module-script-11>module scripts/a> in the graph rooted at var>moduleScript/var> will have successfully been fetched.li>p>If var>discoveredSet/var> already a hrefhttps://infra.spec.whatwg.org/#list-contain idfetching-scripts:list-contains-3 data-x-internallist-contains>contains/a> var>childModule/var>, a idfetching-scripts:continue hrefhttps://infra.spec.whatwg.org/#iteration-continue data-x-internalcontinue>continue/a>.li>p>Let var>childParseError/var> be the result of a href#finding-the-first-parse-error idfetching-scripts:finding-the-first-parse-error-2>finding the first parse error/a> given var>childModule/var> and var>discoveredSet/var>.li>p>If var>childParseError/var> is not null, return var>childParseError/var>./ol> li>p>Return null./ol> h5 idcreating-scripts>span classsecno>8.1.3.3/span> Creating scriptsa href#creating-scripts classself-link>/a>/h5> p>To dfn idcreating-a-classic-script>create a classic script/dfn>, given a a idcreating-scripts:javascript-string hrefhttps://infra.spec.whatwg.org/#javascript-string data-x-internaljavascript-string>JavaScript string/a> var>source/var>, an a href#environment-settings-object idcreating-scripts:environment-settings-object>environment settings object/a> var>settings/var>, a a idcreating-scripts:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> var>baseURL/var>, some a href#script-fetch-options idcreating-scripts:script-fetch-options>script fetch options/a> var>options/var>, and an optional var>muted errors/var> boolean:/p> ol>li>p>If var>muted errors/var> was not provided, let it be false.li>p>If a href#concept-bc-noscript idcreating-scripts:concept-bc-noscript>scripting is disabled/a> for var>settings/var>s a href#responsible-browsing-context idcreating-scripts:responsible-browsing-context>responsible browsing context/a>, then set var>source/var> to the empty string.li>p>Let var>script/var> be a new a href#classic-script idcreating-scripts:classic-script>classic script/a> that this algorithm will subsequently initialize.li>p>Set var>script/var>s a href#settings-object idcreating-scripts:settings-object>settings object/a> to var>settings/var>.li>p>Set var>script/var>s a href#muted-errors idcreating-scripts:muted-errors>muted errors/a> to var>muted errors/var>.li>p>Set var>script/var>s a href#concept-script-parse-error idcreating-scripts:concept-script-parse-error>parse error/a> and a href#concept-script-error-to-rethrow idcreating-scripts:concept-script-error-to-rethrow>error to rethrow/a> to null.li> p>Let var>result/var> be a hrefhttps://tc39.github.io/ecma262/#sec-parse-script idcreating-scripts:js-parsescript data-x-internaljs-parsescript>ParseScript/a>(var>source/var>, var>settings/var>s a href#environment-settings-objects-realm idcreating-scripts:environment-settings-objects-realm>Realm/a>, var>script/var>)./p> p classnote>Passing var>script/var> as the last parameter here ensures var>result/var>.HostDefined will be var>script/var>./p> li> p>If var>result/var> is a a idcreating-scripts:list hrefhttps://infra.spec.whatwg.org/#list data-x-internallist>list/a> of errors, then: ol>li>p>Set var>script/var>s a href#concept-script-parse-error idcreating-scripts:concept-script-parse-error-2>parse error/a> and its a href#concept-script-error-to-rethrow idcreating-scripts:concept-script-error-to-rethrow-2>error to rethrow/a> to var>result/var>0.li>p>Return var>script/var>./ol> li>p>Set var>script/var>s a href#concept-script-record idcreating-scripts:concept-script-record>record/a> to var>result/var>.li>p>Set var>script/var>s a href#concept-script-base-url idcreating-scripts:concept-script-base-url>base URL/a> to var>baseURL/var>.li>p>Set var>script/var>s a href#concept-script-script-fetch-options idcreating-scripts:concept-script-script-fetch-options>fetch options/a> to var>options/var>.li>p>Return var>script/var>./ol> p>To dfn idcreating-a-module-script>create a module script/dfn>, given a a idcreating-scripts:javascript-string-2 hrefhttps://infra.spec.whatwg.org/#javascript-string data-x-internaljavascript-string>JavaScript string/a> var>source/var>, an a href#environment-settings-object idcreating-scripts:environment-settings-object-2>environment settings object/a> var>settings/var>, a a idcreating-scripts:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> var>baseURL/var>, and some a href#script-fetch-options idcreating-scripts:script-fetch-options-2>script fetch options/a> var>options/var>:/p> ol>li>p>If a href#concept-bc-noscript idcreating-scripts:concept-bc-noscript-2>scripting is disabled/a> for var>settings/var>s a href#responsible-browsing-context idcreating-scripts:responsible-browsing-context-2>responsible browsing context/a>, then set var>source/var> to the empty string.li>p>Let var>script/var> be a new a href#module-script idcreating-scripts:module-script>module script/a> that this algorithm will subsequently initialize.li>p>Set var>script/var>s a href#settings-object idcreating-scripts:settings-object-2>settings object/a> to var>settings/var>.li>p>Set var>script/var>s a href#concept-script-parse-error idcreating-scripts:concept-script-parse-error-3>parse error/a> and a href#concept-script-error-to-rethrow idcreating-scripts:concept-script-error-to-rethrow-3>error to rethrow/a> to null.li> p>Let var>result/var> be a hrefhttps://tc39.github.io/ecma262/#sec-parsemodule idcreating-scripts:js-parsemodule data-x-internaljs-parsemodule>ParseModule/a>(var>source/var>, var>settings/var>s a href#environment-settings-objects-realm idcreating-scripts:environment-settings-objects-realm-2>Realm/a>, var>script/var>)./p> p classnote>Passing var>script/var> as the last parameter here ensures var>result/var>.HostDefined will be var>script/var>./p> li> p>If var>result/var> is a a idcreating-scripts:list-2 hrefhttps://infra.spec.whatwg.org/#list data-x-internallist>list/a> of errors, then:/p> ol>li>p>Set var>script/var>s a href#concept-script-parse-error idcreating-scripts:concept-script-parse-error-4>parse error/a> to var>result/var>0.li>p>Return var>script/var>./ol> li idvalidate-requested-module-specifiers> p>a hrefhttps://infra.spec.whatwg.org/#list-iterate idcreating-scripts:list-iterate data-x-internallist-iterate>For each/a> string var>requested/var> of var>result/var>.RequestedModules:/p> ol>li>p>Let var>url/var> be the result of a href#resolve-a-module-specifier idcreating-scripts:resolve-a-module-specifier>resolving a module specifier/a> given var>script/var> and var>requested/var>.li> p>If var>url/var> is failure, then:/p> ol>li>p>Let var>error/var> be a new code idcreating-scripts:typeerror>a data-x-internaltypeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror>TypeError/a>/code> exception.li>p>Set var>script/var>s a href#concept-script-parse-error idcreating-scripts:concept-script-parse-error-5>parse error/a> to var>error/var>.li>p>Return var>script/var>./ol> /ol> p classnote>This step is essentially validating all of the requested module specifiers. We treat a module with unresolvable module specifiers the same as one that cannot be parsed; in both cases, a syntactic issue makes it impossible to ever contemplate instantiating the module later./p> li>p>Set var>script/var>s a href#concept-script-record idcreating-scripts:concept-script-record-2>record/a> to var>result/var>.li>p>Set var>script/var>s a href#concept-script-base-url idcreating-scripts:concept-script-base-url-2>base URL/a> to var>baseURL/var>.li>p>Set var>script/var>s a href#concept-script-script-fetch-options idcreating-scripts:concept-script-script-fetch-options-2>fetch options/a> to var>options/var>.li>p>Return var>script/var>./ol> h5 idcalling-scripts>span classsecno>8.1.3.4/span> Calling scriptsa href#calling-scripts classself-link>/a>/h5> p>To dfn idrun-a-classic-script data-export>run a classic script/dfn> given a a href#classic-script idcalling-scripts:classic-script>classic script/a> var>script/var> and an optional var>rethrow errors/var> boolean:/p> ol>li>p>If var>rethrow errors/var> is not given, let it be false.li>p>Let var>settings/var> be the a href#settings-object idcalling-scripts:settings-object>settings object/a> of var>script/var>.li>p>a href#check-if-we-can-run-script idcalling-scripts:check-if-we-can-run-script>Check if we can run script/a> with var>settings/var>. If this returns do not run then return.li>p>a href#prepare-to-run-script idcalling-scripts:prepare-to-run-script>Prepare to run script/a> given var>settings/var>.li>p>Let var>evaluationStatus/var> be null.li>p>If var>script/var>s a href#concept-script-error-to-rethrow idcalling-scripts:concept-script-error-to-rethrow>error to rethrow/a> is not null, then set var>evaluationStatus/var> to Completion { Type: throw, Value: var>script/var>s a href#concept-script-error-to-rethrow idcalling-scripts:concept-script-error-to-rethrow-2>error to rethrow/a>, Target: empty }.li> p>Otherwise, set var>evaluationStatus/var> to a hrefhttps://tc39.github.io/ecma262/#sec-runtime-semantics-scriptevaluation idcalling-scripts:js-scriptevaluation data-x-internaljs-scriptevaluation>ScriptEvaluation/a>(var>script/var>s a href#concept-script-record idcalling-scripts:concept-script-record>record/a>)./p> p>If a hrefhttps://tc39.github.io/ecma262/#sec-runtime-semantics-scriptevaluation idcalling-scripts:js-scriptevaluation-2 data-x-internaljs-scriptevaluation>ScriptEvaluation/a> does not complete because the user agent has a href#abort-a-running-script idcalling-scripts:abort-a-running-script>aborted the running script/a>, leave var>evaluationStatus/var> as null./p> li> p>If var>evaluationStatus/var> is an abrupt completion, then:/p> ol>li> p>If var>rethrow errors/var> is true and var>script/var>s a href#muted-errors idcalling-scripts:muted-errors>muted errors/a> is false, then:/p> ol>li>p>a href#clean-up-after-running-script idcalling-scripts:clean-up-after-running-script>Clean up after running script/a> with var>settings/var>.li>p>Rethrow var>evaluationStatus/var>.Value./ol> li> p>If var>rethrow errors/var> is true and var>script/var>s a href#muted-errors idcalling-scripts:muted-errors-2>muted errors/a> is true, then:/p> ol>li>p>a href#clean-up-after-running-script idcalling-scripts:clean-up-after-running-script-2>Clean up after running script/a> with var>settings/var>.li>p>Throw a a idcalling-scripts:networkerror hrefhttps://heycam.github.io/webidl/#networkerror data-x-internalnetworkerror>code>NetworkError/code>/a> code idcalling-scripts:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./ol> li> p>Otherwise, var>rethrow errors/var> is false. Perform the following steps:/p> ol>li>p>a href#report-the-exception idcalling-scripts:report-the-exception>Report the exception/a> given by var>evaluationStatus/var>.Value for var>script/var>.li>p>a href#clean-up-after-running-script idcalling-scripts:clean-up-after-running-script-3>Clean up after running script/a> with var>settings/var>.li>p>Return undefined./ol> /ol> li>p>a href#clean-up-after-running-script idcalling-scripts:clean-up-after-running-script-4>Clean up after running script/a> with var>settings/var>.li> p>If var>evaluationStatus/var> is a normal completion, return var>evaluationStatus/var>.Value./p> p classnote>This value is only ever used by the a href#javascript-protocol idcalling-scripts:javascript-protocol>code>javascript:/code> URL steps/a>./p> li>p>If weve reached this point, var>evaluationStatus/var> was left as null because the script was a href#abort-a-running-script idcalling-scripts:abort-a-running-script-2>aborted prematurely/a> during evaluation. Return undefined./ol> p>To dfn idrun-a-module-script data-export>run a module script/dfn> given a a href#module-script idcalling-scripts:module-script>module script/a> var>script/var>, with an optional var>rethrow errors/var> boolean:/p> ol>li>p>If var>rethrow errors/var> is not given, let it be false.li>p>Let var>settings/var> be the a href#settings-object idcalling-scripts:settings-object-2>settings object/a> of var>script/var>.li>p>a href#check-if-we-can-run-script idcalling-scripts:check-if-we-can-run-script-2>Check if we can run script/a> with var>settings/var>. If this returns do not run then return.li>p>a href#prepare-to-run-script idcalling-scripts:prepare-to-run-script-2>Prepare to run script/a> given var>settings/var>.li>p>Let var>evaluationStatus/var> be null.li>p>If var>script/var>s a href#concept-script-error-to-rethrow idcalling-scripts:concept-script-error-to-rethrow-3>error to rethrow/a> is not null, then set var>evaluationStatus/var> to Completion { Type: throw, Value: var>script/var>s a href#concept-script-error-to-rethrow idcalling-scripts:concept-script-error-to-rethrow-4>error to rethrow/a>, Target: empty }.li> p>Otherwise:/p> ol>li>p>Let var>record/var> be var>script/var>s a href#concept-script-record idcalling-scripts:concept-script-record-2>record/a>./p> li> p>Set var>evaluationStatus/var> to var>record/var>.a hrefhttps://tc39.github.io/ecma262/#sec-moduleevaluation idcalling-scripts:js-evaluate data-x-internaljs-evaluate>Evaluate/a>()./p> p classnote>This step will recursively evaluate all of the modules dependencies./p> p>If a hrefhttps://tc39.github.io/ecma262/#sec-moduleevaluation idcalling-scripts:js-evaluate-2 data-x-internaljs-evaluate>Evaluate/a> fails to complete as a result of the user agent a href#abort-a-running-script idcalling-scripts:abort-a-running-script-3>aborting the running script/a>, then set var>evaluationStatus/var> to Completion { Type: throw, Value: a new a idcalling-scripts:quotaexceedederror hrefhttps://heycam.github.io/webidl/#quotaexceedederror data-x-internalquotaexceedederror>code>QuotaExceededError/code>/a> code idcalling-scripts:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>, Target: empty }./p> /ol> li> p>If var>evaluationStatus/var> is an abrupt completion, then:/p> ol>li>p>If var>rethrow errors/var> is true, rethrow the exception given by var>evaluationStatus/var>.Value.li>p>Otherwise, a href#report-the-exception idcalling-scripts:report-the-exception-2>report the exception/a> given by var>evaluationStatus/var>.Value for var>script/var>./ol> li>p>a href#clean-up-after-running-script idcalling-scripts:clean-up-after-running-script-5>Clean up after running script/a> with var>settings/var>./ol> p>The steps to dfn idcheck-if-we-can-run-script>check if we can run script/dfn> with an a href#environment-settings-object idcalling-scripts:environment-settings-object>environment settings object/a> var>settings/var> are as follows. They return either run or do not run./p> ol>li>p>If the a href#concept-settings-object-global idcalling-scripts:concept-settings-object-global>global object/a> specified by var>settings/var> is a code idcalling-scripts:window>a href#window>Window/a>/code> object whose code idcalling-scripts:document>a href#document>Document/a>/code> object is not a href#fully-active idcalling-scripts:fully-active>fully active/a>, then return do not run and abort these steps./p> li>p>If a href#concept-bc-noscript idcalling-scripts:concept-bc-noscript>scripting is disabled/a> for the a href#responsible-browsing-context idcalling-scripts:responsible-browsing-context>responsible browsing context/a> specified by var>settings/var>, then return do not run and abort these steps./p> li>p>Return run./ol> p>The steps to dfn idprepare-to-run-script data-export>prepare to run script/dfn> with an a href#environment-settings-object idcalling-scripts:environment-settings-object-2>environment settings object/a> var>settings/var> are as follows:/p> ol>li>p>Push var>settings/var>s a href#realm-execution-context idcalling-scripts:realm-execution-context>realm execution context/a> onto the a idcalling-scripts:javascript-execution-context-stack hrefhttps://tc39.github.io/ecma262/#execution-context-stack data-x-internaljavascript-execution-context-stack>JavaScript execution context stack/a>; it is now the a idcalling-scripts:running-javascript-execution-context hrefhttps://tc39.github.io/ecma262/#running-execution-context data-x-internalrunning-javascript-execution-context>running JavaScript execution context/a>./ol> p>The steps to dfn idclean-up-after-running-script data-export>clean up after running script/dfn> with an a href#environment-settings-object idcalling-scripts:environment-settings-object-3>environment settings object/a> var>settings/var> are as follows:/p> ol>li>p>Assert: var>settings/var>s a href#realm-execution-context idcalling-scripts:realm-execution-context-2>realm execution context/a> is the a idcalling-scripts:running-javascript-execution-context-2 hrefhttps://tc39.github.io/ecma262/#running-execution-context data-x-internalrunning-javascript-execution-context>running JavaScript execution context/a>.li>p>Remove var>settings/var>s a href#realm-execution-context idcalling-scripts:realm-execution-context-3>realm execution context/a> from the a idcalling-scripts:javascript-execution-context-stack-2 hrefhttps://tc39.github.io/ecma262/#execution-context-stack data-x-internaljavascript-execution-context-stack>JavaScript execution context stack/a>.li>p>If the a idcalling-scripts:javascript-execution-context-stack-3 hrefhttps://tc39.github.io/ecma262/#execution-context-stack data-x-internaljavascript-execution-context-stack>JavaScript execution context stack/a> is now empty, a href#perform-a-microtask-checkpoint idcalling-scripts:perform-a-microtask-checkpoint>perform a microtask checkpoint/a>. (If this runs scripts, these algorithms will be invoked reentrantly.)/ol> p classnote>These algorithms are not invoked by one script directly calling another, but they can be invoked reentrantly in an indirect manner, e.g. if a script dispatches an event which has event listeners registered./p> p>The dfn idrunning-script>running script/dfn> is the a href#the-script-element idcalling-scripts:the-script-element>script/a> in the HostDefined field in the ScriptOrModule component of the a idcalling-scripts:running-javascript-execution-context-3 hrefhttps://tc39.github.io/ecma262/#running-execution-context data-x-internalrunning-javascript-execution-context>running JavaScript execution context/a>./p> h5 idrealms-settings-objects-global-objects>span classsecno>8.1.3.5/span> Realms, settings objects, and global objectsa href#realms-settings-objects-global-objects classself-link>/a>/h5> p>A dfn idglobal-object data-export>global object/dfn> is a JavaScript object that is the GlobalObject field of a a idrealms-settings-objects-global-objects:javascript-realm hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript realm/a>./p> p classnote>In this specification, all a hrefhttps://tc39.github.io/ecma262/#sec-code-realms idrealms-settings-objects-global-objects:javascript-realm-2 data-x-internaljavascript-realm>JavaScript realms/a> are a hrefhttps://tc39.github.io/ecma262/#sec-initializehostdefinedrealm idrealms-settings-objects-global-objects:js-initializehostdefinedrealm data-x-internaljs-initializehostdefinedrealm>initialized/a> with a href#global-object idrealms-settings-objects-global-objects:global-object>global objects/a> that are either code idrealms-settings-objects-global-objects:window>a href#window>Window/a>/code> or code idrealms-settings-objects-global-objects:workerglobalscope>a href#workerglobalscope>WorkerGlobalScope/a>/code> objects./p> p>There is always a 1-to-1-to-1 mapping between a hrefhttps://tc39.github.io/ecma262/#sec-code-realms idrealms-settings-objects-global-objects:javascript-realm-3 data-x-internaljavascript-realm>JavaScript realms/a>, a href#global-object idrealms-settings-objects-global-objects:global-object-2>global objects/a>, and a href#environment-settings-object idrealms-settings-objects-global-objects:environment-settings-object>environment settings objects/a>:/p> ul>li>p>A a idrealms-settings-objects-global-objects:javascript-realm-4 hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript realm/a> has a HostDefined field, which contains dfn data-dfn-forRealm idconcept-realm-settings-object data-ltsettings object data-export>the Realms settings object/dfn>.li>p>A a idrealms-settings-objects-global-objects:javascript-realm-5 hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript realm/a> has a GlobalObject field, which contains dfn data-dfn-forRealm idconcept-realm-global data-ltglobal object data-export>the Realms global object/dfn>.li>p>Each a href#global-object idrealms-settings-objects-global-objects:global-object-3>global object/a> in this specification is created during the a hrefhttps://tc39.github.io/ecma262/#sec-initializehostdefinedrealm idrealms-settings-objects-global-objects:js-initializehostdefinedrealm-2 data-x-internaljs-initializehostdefinedrealm>initialization/a> of a corresponding a idrealms-settings-objects-global-objects:javascript-realm-6 hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript realm/a>, known as dfn data-dfn-forglobal object idconcept-global-object-realm data-ltRealm data-export>the global objects Realm/dfn>.li idrelevant-settings-object-for-a-global-object>p>Each a href#global-object idrealms-settings-objects-global-objects:global-object-4>global object/a> in this specification is created alongside a corresponding a href#environment-settings-object idrealms-settings-objects-global-objects:environment-settings-object-2>environment settings object/a>, known as its a href#relevant-settings-object idrealms-settings-objects-global-objects:relevant-settings-object>relevant settings object/a>./p> li>p>An a href#environment-settings-object idrealms-settings-objects-global-objects:environment-settings-object-3>environment settings object/a>s a href#realm-execution-context idrealms-settings-objects-global-objects:realm-execution-context>realm execution context/a>s Realm component is dfn data-dfn-forenvironment settings object idenvironment-settings-objects-realm data-ltRealm data-export>the environment settings objects Realm/dfn>.li>p>An a href#environment-settings-object idrealms-settings-objects-global-objects:environment-settings-object-4>environment settings object/a>s a href#environment-settings-objects-realm idrealms-settings-objects-global-objects:environment-settings-objects-realm>Realm/a> then has a GlobalObject field, which contains dfn data-dfn-forenvironment settings object idconcept-settings-object-global data-ltglobal object data-export>the environment settings objects global object/dfn>./ul> hr> p>When defining algorithm steps throughout this specification, it is often important to indicate what a idrealms-settings-objects-global-objects:javascript-realm-7 hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript realm/a> is to be used—or, equivalently, what a href#global-object idrealms-settings-objects-global-objects:global-object-5>global object/a> or a href#environment-settings-object idrealms-settings-objects-global-objects:environment-settings-object-5>environment settings object/a> is to be used. In general, there are at least four possibilities:/p> dl>dt>dfn idconcept-entry-everything>Entry/dfn>dd>This corresponds to the script that initiated the currently running script action: i.e., the function or script that the user agent called into when it called into author code.dt>dfn idconcept-incumbent-everything>Incumbent/dfn>dd>This corresponds to the most-recently-entered author function or script on the stack, or the author function or script that originally scheduled the currently-running callback.dt>dfn idconcept-current-everything>Current/dfn>dd>This corresponds to the currently-running function object, including built-in user-agent functions which might not be implemented as JavaScript. (It is derived from the a hrefhttps://tc39.github.io/ecma262/#current-realm idrealms-settings-objects-global-objects:current-realm-record data-x-internalcurrent-realm-record>current JavaScript realm/a>.)dt>dfn idconcept-relevant-everything>Relevant/dfn>dd>Every a idrealms-settings-objects-global-objects:platform-object hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a> has a a href#concept-relevant-realm idrealms-settings-objects-global-objects:concept-relevant-realm>relevant Realm/a>, which is roughly the a idrealms-settings-objects-global-objects:javascript-realm-8 hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript realm/a> in which it was created. When writing algorithms, the most prominent a idrealms-settings-objects-global-objects:platform-object-2 hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a> whose a href#concept-relevant-realm idrealms-settings-objects-global-objects:concept-relevant-realm-2>relevant Realm/a> might be important is the b>this/b> value of the currently-running function object. In some cases, there can be other important a href#concept-relevant-realm idrealms-settings-objects-global-objects:concept-relevant-realm-3>relevant Realms/a>, such as those of any arguments./dl> p>Note how the a href#concept-entry-everything idrealms-settings-objects-global-objects:concept-entry-everything>entry/a>, a href#concept-incumbent-everything idrealms-settings-objects-global-objects:concept-incumbent-everything>incumbent/a>, and a href#concept-current-everything idrealms-settings-objects-global-objects:concept-current-everything>current/a> concepts are usable without qualification, whereas the a href#concept-relevant-everything idrealms-settings-objects-global-objects:concept-relevant-everything>relevant/a> concept must be applied to a particular a idrealms-settings-objects-global-objects:platform-object-3 hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a>./p> div classexample> p>Consider the following pages, with code>a.html/code> being loaded in a browser window, code>b.html/code> being loaded in an code idrealms-settings-objects-global-objects:the-iframe-element>a href#the-iframe-element>iframe/a>/code> as shown, and code>c.html/code> and code>d.html/code> omitted (they can simply be empty documents):/p> pre><!-- a.html --><!DOCTYPE html><html langen><title>Entry page</title><iframe srcb.html></iframe><button onclickframes0.hello()>Hello</button><!--b.html --><!DOCTYPE html><html langen><title>Incumbent page</title><iframe srcc.html idc></iframe><iframe srcd.html idd></iframe><script> const c document.querySelector(#c).contentWindow; const d document.querySelector(#d).contentWindow; window.hello () > { c.print.call(d); };</script>/pre> p>Each page has its own a href#browsing-context idrealms-settings-objects-global-objects:browsing-context>browsing context/a>, and thus its own a idrealms-settings-objects-global-objects:javascript-realm-9 hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript realm/a>, a href#global-object idrealms-settings-objects-global-objects:global-object-6>global object/a>, and a href#environment-settings-object idrealms-settings-objects-global-objects:environment-settings-object-6>environment settings object/a>./p> p>When the code idrealms-settings-objects-global-objects:dom-print>a href#dom-print>print()/a>/code> method is called in response to pressing the button in code>a.html/code>, then:/p> ul>li>p>The a href#concept-entry-realm idrealms-settings-objects-global-objects:concept-entry-realm>entry Realm/a> is that of code>a.html/code>.li>p>The a href#concept-incumbent-realm idrealms-settings-objects-global-objects:concept-incumbent-realm>incumbent Realm/a> is that of code>b.html/code>.li>p>The a hrefhttps://tc39.github.io/ecma262/#current-realm idrealms-settings-objects-global-objects:current-realm-record-2 data-x-internalcurrent-realm-record>current Realm/a> is that of code>c.html/code> (since it is the code idrealms-settings-objects-global-objects:dom-print-2>a href#dom-print>print()/a>/code> method from code>c.html/code> whose code is running).li>p>The a href#concept-relevant-realm idrealms-settings-objects-global-objects:concept-relevant-realm-4>relevant Realm/a> of the object on which the code idrealms-settings-objects-global-objects:dom-print-3>a href#dom-print>print()/a>/code> method is being called is that of code>d.html/code>./ul> /div> p classwarning>The a href#concept-incumbent-everything idrealms-settings-objects-global-objects:concept-incumbent-everything-2>incumbent/a> and a href#concept-entry-everything idrealms-settings-objects-global-objects:concept-entry-everything-2>entry/a> concepts should not be used by new specifications, as they are excessively complicated and unintuitive to work with. We are working to remove almost all existing uses from the platform: see a hrefhttps://github.com/whatwg/html/issues/1430>issue #1430/a> for a href#concept-incumbent-everything idrealms-settings-objects-global-objects:concept-incumbent-everything-3>incumbent/a>, and a hrefhttps://github.com/whatwg/html/issues/1431>issue #1431/a> for a href#concept-entry-everything idrealms-settings-objects-global-objects:concept-entry-everything-3>entry/a>./p> p>In general, web platform specifications should use the a href#concept-relevant-everything idrealms-settings-objects-global-objects:concept-relevant-everything-2>relevant/a> concept, applied to the object being operated on (usually the b>this/b> value of the current method). This mismatches the JavaScript specification, where a href#concept-current-everything idrealms-settings-objects-global-objects:concept-current-everything-2>current/a> is generally used as the default (e.g. in determining the a idrealms-settings-objects-global-objects:javascript-realm-10 hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript realm/a> whose code>Array/code> constructor should be used to construct the result in code>Array.prototype.map/code>). But this inconsistency is so embedded in the platform that we have to accept it going forward./p> p>Note that in constructors, where there is no b>this/b> value yet, the a href#concept-current-everything idrealms-settings-objects-global-objects:concept-current-everything-3>current/a> concept is the appropriate default./p> div classexample> p>One reason why the a href#concept-relevant-everything idrealms-settings-objects-global-objects:concept-relevant-everything-3>relevant/a> concept is generally a better default choice than the a href#concept-current-everything idrealms-settings-objects-global-objects:concept-current-everything-4>current/a> concept is that it is more suitable for creating an object that is to be persisted and returned multiple times. For example, the code idrealms-settings-objects-global-objects:dom-navigator-getbattery>a data-x-internaldom-navigator-getbattery hrefhttps://w3c.github.io/battery/#widl-Navigator-getBattery-Promise-BatteryManager>navigator.getBattery()/a>/code> method creates promises in the a href#concept-relevant-realm idrealms-settings-objects-global-objects:concept-relevant-realm-5>relevant Realm/a> for the code idrealms-settings-objects-global-objects:navigator>a href#navigator>Navigator/a>/code> object on which it is invoked. This has the following impact: a href#refsBATTERY>BATTERY/a> pre><!-- outer.html --><!DOCTYPE html><html langen><title>Relevant Realm demo: outer page</title><script> function doTest() { const promise navigator.getBattery.call(frames0.navigator); console.log(promise instanceof Promise); // logs false console.log(promise instanceof frames0.Promise); // logs true frames0.hello(); }</script><iframe srcinner.html onloaddoTest()></iframe><!-- inner.html --><!DOCTYPE html><html langen><title>Relevant Realm demo: inner page</title><script> function hello() { const promise navigator.getBattery(); console.log(promise instanceof Promise); // logs true console.log(promise instanceof parent.Promise); // logs false }</script>/pre> p>If the algorithm for the code idrealms-settings-objects-global-objects:dom-navigator-getbattery-2>a data-x-internaldom-navigator-getbattery hrefhttps://w3c.github.io/battery/#widl-Navigator-getBattery-Promise-BatteryManager>getBattery()/a>/code> method had instead used the a hrefhttps://tc39.github.io/ecma262/#current-realm idrealms-settings-objects-global-objects:current-realm-record-3 data-x-internalcurrent-realm-record>current Realm/a>, all the results would be reversed. That is, after the first call to code idrealms-settings-objects-global-objects:dom-navigator-getbattery-3>a data-x-internaldom-navigator-getbattery hrefhttps://w3c.github.io/battery/#widl-Navigator-getBattery-Promise-BatteryManager>getBattery()/a>/code> in code>outer.html/code>, the code idrealms-settings-objects-global-objects:navigator-2>a href#navigator>Navigator/a>/code> object in code>inner.html/code> would be permanently storing a code>Promise/code> object created in code>outer.html/code>s a idrealms-settings-objects-global-objects:javascript-realm-11 hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript realm/a>, and calls like that inside the code>hello()/code> function would thus return a promise from the wrong realm. Since this is undesirable, the algorithm instead uses the a href#concept-relevant-realm idrealms-settings-objects-global-objects:concept-relevant-realm-6>relevant Realm/a>, giving the sensible results indicated in the comments above./p> /div> hr> p>The rest of this section deals with formally defining the a href#concept-entry-everything idrealms-settings-objects-global-objects:concept-entry-everything-4>entry/a>, a href#concept-incumbent-everything idrealms-settings-objects-global-objects:concept-incumbent-everything-4>incumbent/a>, a href#concept-current-everything idrealms-settings-objects-global-objects:concept-current-everything-5>current/a>, and a href#concept-relevant-everything idrealms-settings-objects-global-objects:concept-relevant-everything-4>relevant/a> concepts./p> h6 identry>span classsecno>8.1.3.5.1/span> Entrya href#entry classself-link>/a>/h6> p>The process of a href#calling-scripts>calling scripts/a> will push or pop a href#realm-execution-context identry:realm-execution-context>realm execution contexts/a> onto the a identry:javascript-execution-context-stack hrefhttps://tc39.github.io/ecma262/#execution-context-stack data-x-internaljavascript-execution-context-stack>JavaScript execution context stack/a>, interspersed with other a hrefhttps://tc39.github.io/ecma262/#sec-execution-contexts identry:javascript-execution-context data-x-internaljavascript-execution-context>execution contexts/a>./p> p>With this in hand, we define the dfn identry-execution-context>entry execution context/dfn> to be the most recently pushed item in the a identry:javascript-execution-context-stack-2 hrefhttps://tc39.github.io/ecma262/#execution-context-stack data-x-internaljavascript-execution-context-stack>JavaScript execution context stack/a> that is a a href#realm-execution-context identry:realm-execution-context-2>realm execution context/a>. The dfn idconcept-entry-realm>entry Realm/dfn> is the a href#entry-execution-context identry:entry-execution-context>entry execution context/a>s Realm component./p> p>Then, the dfn identry-settings-object>entry settings object/dfn> is the a href#concept-realm-settings-object identry:concept-realm-settings-object>environment settings object/a> of the a href#concept-entry-realm identry:concept-entry-realm>entry Realm/a>./p> p>Similarly, the dfn identry-global-object>entry global object/dfn> is the a href#concept-realm-global identry:concept-realm-global>global object/a> of the a href#concept-entry-realm identry:concept-entry-realm-2>entry Realm/a>./p> h6 idincumbent>span classsecno>8.1.3.5.2/span> Incumbenta href#incumbent classself-link>/a>/h6> p>All a hrefhttps://tc39.github.io/ecma262/#sec-execution-contexts idincumbent:javascript-execution-context data-x-internaljavascript-execution-context>JavaScript execution contexts/a> must contain, as part of their code evaluation state, a dfn idskip-when-determining-incumbent-counter>skip-when-determining-incumbent counter/dfn> value, which is initially zero. In the process of a href#prepare-to-run-a-callback idincumbent:prepare-to-run-a-callback>preparing to run a callback/a> and a href#clean-up-after-running-a-callback idincumbent:clean-up-after-running-a-callback>cleaning up after running a callback/a>, this value will be incremented and decremented./p> p>Every a href#event-loop idincumbent:event-loop>event loop/a> has an associated dfn idbackup-incumbent-settings-object-stack>backup incumbent settings object stack/dfn>, initially empty. Roughly speaking, it is used to determine the a href#incumbent-settings-object idincumbent:incumbent-settings-object>incumbent settings object/a> when no author code is on the stack, but author code is responsible for the current algorithm having been run in some way. The process of a href#prepare-to-run-a-callback idincumbent:prepare-to-run-a-callback-2>preparing to run a callback/a> and a href#clean-up-after-running-a-callback idincumbent:clean-up-after-running-a-callback-2>cleaning up after running a callback/a> manipulate this stack. a href#refsWEBIDL>WEBIDL/a>/p> p>When Web IDL is used to a hrefhttps://heycam.github.io/webidl/#invoke-a-callback-function idincumbent:es-invoking-callback-functions data-x-internales-invoking-callback-functions>invoke/a> author code, or when a href#enqueuejob(queuename,-job,-arguments) idincumbent:enqueuejob(queuename,-job,-arguments)>EnqueueJob/a> invokes a promise job, they use the following algorithms to track relevant data for determining the a href#incumbent-settings-object idincumbent:incumbent-settings-object-2>incumbent settings object/a>:/p> p>To dfn idprepare-to-run-a-callback data-export>prepare to run a callback/dfn> with an a href#environment-settings-object idincumbent:environment-settings-object>environment settings object/a> var>settings/var>:/p> ol>li>p>Push var>settings/var> onto the a href#backup-incumbent-settings-object-stack idincumbent:backup-incumbent-settings-object-stack>backup incumbent settings object stack/a>.li>p>Let var>context/var> be the a href#topmost-script-having-execution-context idincumbent:topmost-script-having-execution-context>topmost script-having execution context/a>.li>p>If var>context/var> is not null, increment var>context/var>s a href#skip-when-determining-incumbent-counter idincumbent:skip-when-determining-incumbent-counter>skip-when-determining-incumbent counter/a>./ol> p>To dfn idclean-up-after-running-a-callback data-export>clean up after running a callback/dfn> with an a href#environment-settings-object idincumbent:environment-settings-object-2>environment settings object/a> var>settings/var>:/p> ol>li> p>Let var>context/var> be the a href#topmost-script-having-execution-context idincumbent:topmost-script-having-execution-context-2>topmost script-having execution context/a>./p> p classnote>This will be the same as the a href#topmost-script-having-execution-context idincumbent:topmost-script-having-execution-context-3>topmost script-having execution context/a> inside the corresponding invocation of a href#prepare-to-run-a-callback idincumbent:prepare-to-run-a-callback-3>prepare to run a callback/a>./p> li>p>If var>context/var> is not null, decrement var>context/var>s a href#skip-when-determining-incumbent-counter idincumbent:skip-when-determining-incumbent-counter-2>skip-when-determining-incumbent counter/a>.li>p>Assert: the topmost entry of the a href#backup-incumbent-settings-object-stack idincumbent:backup-incumbent-settings-object-stack-2>backup incumbent settings object stack/a> is var>settings/var>.li>p>Remove var>settings/var> from the a href#backup-incumbent-settings-object-stack idincumbent:backup-incumbent-settings-object-stack-3>backup incumbent settings object stack/a>./ol> p>Here, the dfn idtopmost-script-having-execution-context>topmost script-having execution context/dfn> is the topmost entry of the a idincumbent:javascript-execution-context-stack hrefhttps://tc39.github.io/ecma262/#execution-context-stack data-x-internaljavascript-execution-context-stack>JavaScript execution context stack/a> that has a non-null ScriptOrModule component, or null if there is no such entry in the a idincumbent:javascript-execution-context-stack-2 hrefhttps://tc39.github.io/ecma262/#execution-context-stack data-x-internaljavascript-execution-context-stack>JavaScript execution context stack/a>./p> p>With all this in place, the dfn idincumbent-settings-object data-export>incumbent settings object/dfn> is determined as follows:/p> ol>li>p>Let var>context/var> be the a href#topmost-script-having-execution-context idincumbent:topmost-script-having-execution-context-4>topmost script-having execution context/a>.li> p>If var>context/var> is null, or if var>context/var>s a href#skip-when-determining-incumbent-counter idincumbent:skip-when-determining-incumbent-counter-3>skip-when-determining-incumbent counter/a> is greater than zero, then:/p> ol>li> p>Assert: the a href#backup-incumbent-settings-object-stack idincumbent:backup-incumbent-settings-object-stack-4>backup incumbent settings object stack/a> is not empty./p> p classnote>This assert would fail if you try to obtain the a href#incumbent-settings-object idincumbent:incumbent-settings-object-3>incumbent settings object/a> from inside an algorithm that was triggered neither by a href#calling-scripts>calling scripts/a> nor by Web IDL a hrefhttps://heycam.github.io/webidl/#invoke-a-callback-function idincumbent:es-invoking-callback-functions-2 data-x-internales-invoking-callback-functions>invoking/a> a callback. For example, it would trigger if you tried to obtain the a href#incumbent-settings-object idincumbent:incumbent-settings-object-4>incumbent settings object/a> inside an algorithm that ran periodically as part of the a href#event-loop idincumbent:event-loop-2>event loop/a>, with no involvement of author code. In such cases the a href#concept-incumbent-everything idincumbent:concept-incumbent-everything>incumbent/a> concept cannot be used./p> li>p>Return the topmost entry of the a href#backup-incumbent-settings-object-stack idincumbent:backup-incumbent-settings-object-stack-5>backup incumbent settings object stack/a>./ol> li>p>Return var>context/var>s Realm components a href#concept-realm-settings-object idincumbent:concept-realm-settings-object>settings object/a>./ol> p>Then, the dfn idconcept-incumbent-realm>incumbent Realm/dfn> is the a href#environment-settings-objects-realm idincumbent:environment-settings-objects-realm>Realm/a> of the a href#incumbent-settings-object idincumbent:incumbent-settings-object-5>incumbent settings object/a>./p> p>Similarly, the dfn idconcept-incumbent-global>incumbent global object/dfn> is the a href#concept-settings-object-global idincumbent:concept-settings-object-global>global object/a> of the a href#incumbent-settings-object idincumbent:incumbent-settings-object-6>incumbent settings object/a>./p> hr> p>The following series of examples is intended to make it clear how all of the different mechanisms contribute to the definition of the a href#incumbent>incumbent/a> concept:/p> div classexample> p>Consider the following very simple example:/p> pre><!DOCTYPE html><iframe></iframe><script> new frames0.MessageChannel();</script>/pre> p>When the code idincumbent:dom-messagechannel>a href#dom-messagechannel>MessageChannel()/a>/code> constructor looks up the a href#incumbent-settings-object idincumbent:incumbent-settings-object-7>incumbent settings object/a> to use as the a href#concept-port-owner idincumbent:concept-port-owner>owner/a> of the new code idincumbent:messageport>a href#messageport>MessagePort/a>/code> objects, the a href#topmost-script-having-execution-context idincumbent:topmost-script-having-execution-context-5>topmost script-having execution context/a> will be that corresponding to the code idincumbent:the-script-element>a href#the-script-element>script/a>/code> element: it was pushed onto the a idincumbent:javascript-execution-context-stack-3 hrefhttps://tc39.github.io/ecma262/#execution-context-stack data-x-internaljavascript-execution-context-stack>JavaScript execution context stack/a> as part of a hrefhttps://tc39.github.io/ecma262/#sec-runtime-semantics-scriptevaluation idincumbent:js-scriptevaluation data-x-internaljs-scriptevaluation>ScriptEvaluation/a> during the a href#run-a-classic-script idincumbent:run-a-classic-script>run a classic script/a> algorithm. Since there are no Web IDL callback invocations involved, the contexts a href#skip-when-determining-incumbent-counter idincumbent:skip-when-determining-incumbent-counter-4>skip-when-determining-incumbent counter/a> is zero, so it is used to determine the a href#incumbent-settings-object idincumbent:incumbent-settings-object-8>incumbent settings object/a>; the result is the a href#environment-settings-object idincumbent:environment-settings-object-3>environment settings object/a> of code>window/code>./p> p>(In this example, the a href#environment-settings-object idincumbent:environment-settings-object-4>environment settings object/a> of code>frames0/code> is not involved at all. It is the a href#current-settings-object idincumbent:current-settings-object>current settings object/a>, but the code idincumbent:dom-messagechannel-2>a href#dom-messagechannel>MessageChannel()/a>/code> constructor cares only about the incumbent, not current.)/p> /div> div classexample> p>Consider the following more complicated example:/p> pre><!DOCTYPE html><iframe></iframe><script> const bound frames0.postMessage.bind(frames0, some data, *); window.setTimeout(bound);</script>/pre> p>There are two interesting a href#environment-settings-object idincumbent:environment-settings-object-5>environment settings objects/a> here: that of code>window/code>, and that of code>frames0/code>. Our concern is: what is the a href#incumbent-settings-object idincumbent:incumbent-settings-object-9>incumbent settings object/a> at the time that the algorithm for code idincumbent:dom-window-postmessage>a href#dom-window-postmessage>postMessage()/a>/code> executes?/p> p>It should be that of code>window/code>, to capture the intuitive notion that the author script responsible for causing the algorithm to happen is executing in code>window/code>, not code>frames0/code>. Another way of capturing the intuition here is that invoking algorithms asynchronously (in this case via code idincumbent:dom-settimeout>a href#dom-settimeout>setTimeout()/a>/code>) should not change the a href#concept-incumbent-everything idincumbent:concept-incumbent-everything-2>incumbent/a> concept./p> p>Let us now explain how the steps given above give us our intuitively-desired result of code>window/code>s a href#relevant-settings-object idincumbent:relevant-settings-object>relevant settings object/a>./p> p>When code>bound/code> is a hrefhttps://heycam.github.io/webidl/#es-type-mapping idincumbent:concept-idl-convert data-x-internalconcept-idl-convert>converted/a> to a Web IDL callback type, the a href#incumbent-settings-object idincumbent:incumbent-settings-object-10>incumbent settings object/a> is that corresponding to code>window/code> (in the same manner as in our simple example above). Web IDL stores this as the resulting callback values a idincumbent:callback-context hrefhttps://heycam.github.io/webidl/#dfn-callback-context data-x-internalcallback-context>callback context/a>./p> p>When the a href#concept-task idincumbent:concept-task>task/a> posted by code idincumbent:dom-settimeout-2>a href#dom-settimeout>setTimeout()/a>/code> executes, the algorithm for that task uses Web IDL to a hrefhttps://heycam.github.io/webidl/#invoke-a-callback-function idincumbent:es-invoking-callback-functions-3 data-x-internales-invoking-callback-functions>invoke/a> the stored callback value. Web IDL in turn calls the above a href#prepare-to-run-a-callback idincumbent:prepare-to-run-a-callback-4>prepare to run a callback/a> algorithm. This pushes the stored a idincumbent:callback-context-2 hrefhttps://heycam.github.io/webidl/#dfn-callback-context data-x-internalcallback-context>callback context/a> onto the a href#backup-incumbent-settings-object-stack idincumbent:backup-incumbent-settings-object-stack-6>backup incumbent settings object stack/a>. At this time (inside the timer task) there is no author code on the stack, so the a href#topmost-script-having-execution-context idincumbent:topmost-script-having-execution-context-6>topmost script-having execution context/a> is null, and nothing gets its a href#skip-when-determining-incumbent-counter idincumbent:skip-when-determining-incumbent-counter-5>skip-when-determining-incumbent counter/a> incremented./p> p>Invoking the callback then calls code>bound/code>, which in turn calls the code idincumbent:dom-window-postmessage-2>a href#dom-window-postmessage>postMessage()/a>/code> method of code>frames0/code>. When the code idincumbent:dom-window-postmessage-3>a href#dom-window-postmessage>postMessage()/a>/code> algorithm looks up the a href#incumbent-settings-object idincumbent:incumbent-settings-object-11>incumbent settings object/a>, there is still no author code on the stack, since the bound function just directly calls the built-in method. So the a href#topmost-script-having-execution-context idincumbent:topmost-script-having-execution-context-7>topmost script-having execution context/a> will be null: the a idincumbent:javascript-execution-context-2 hrefhttps://tc39.github.io/ecma262/#sec-execution-contexts data-x-internaljavascript-execution-context>JavaScript execution context/a> stack only contains an execution context corresponding to code idincumbent:dom-window-postmessage-4>a href#dom-window-postmessage>postMessage()/a>/code>, with no a hrefhttps://tc39.github.io/ecma262/#sec-runtime-semantics-scriptevaluation idincumbent:js-scriptevaluation-2 data-x-internaljs-scriptevaluation>ScriptEvaluation/a> context or similar below it./p> p>This is where we fall back to the a href#backup-incumbent-settings-object-stack idincumbent:backup-incumbent-settings-object-stack-7>backup incumbent settings object stack/a>. As noted above, it will contain as its topmost entry the a href#relevant-settings-object idincumbent:relevant-settings-object-2>relevant settings object/a> of code>window/code>. So that is what is used as the a href#incumbent-settings-object idincumbent:incumbent-settings-object-12>incumbent settings object/a> while executing the code idincumbent:dom-window-postmessage-5>a href#dom-window-postmessage>postMessage()/a>/code> algorithm./p> /div> div classexample> p>Consider this final, even more convoluted example:/p> pre><!-- a.html --><!DOCTYPE html><button>click me</button><iframe></iframe><script>const bound frames0.location.assign.bind(frames0.location, https://example.com/);document.querySelector(button).addEventListener(click, bound);</script><!-- b.html --><!DOCTYPE html><iframe srca.html></iframe><script> const iframe document.querySelector(iframe); iframe.onload function onLoad() { iframe.contentWindow.document.querySelector(button).click(); };</script>/pre> p>Again there are two interesting a href#environment-settings-object idincumbent:environment-settings-object-6>environment settings objects/a> in play: that of code>a.html/code>, and that of code>b.html/code>. When the code idincumbent:dom-location-assign>a href#dom-location-assign>location.assign()/a>/code> method triggers the a href#location-object-navigate idincumbent:location-object-navigate>code>Location/code>-object navigate/a> algorithm, what will be the a href#incumbent-settings-object idincumbent:incumbent-settings-object-13>incumbent settings object/a>? As before, it should intuitively be that of code>a.html/code>: the code idincumbent:event-click>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> listener was originally scheduled by code>a.html/code>, so even if something involving code>b.html/code> causes the listener to fire, the a href#concept-incumbent-everything idincumbent:concept-incumbent-everything-3>incumbent/a> responsible is that of code>a.html/code>./p> p>The callback setup is similar to the previous example: when code>bound/code> is a hrefhttps://heycam.github.io/webidl/#es-type-mapping idincumbent:concept-idl-convert-2 data-x-internalconcept-idl-convert>converted/a> to a Web IDL callback type, the a href#incumbent-settings-object idincumbent:incumbent-settings-object-14>incumbent settings object/a> is that corresponding to code>a.html/code>, which is stored as the callbacks a idincumbent:callback-context-3 hrefhttps://heycam.github.io/webidl/#dfn-callback-context data-x-internalcallback-context>callback context/a>./p> p>When the code idincumbent:dom-click>a href#dom-click>click()/a>/code> method is called inside code>b.html/code>, it a hrefhttps://dom.spec.whatwg.org/#concept-event-dispatch idincumbent:concept-event-dispatch data-x-internalconcept-event-dispatch>dispatches/a> a code idincumbent:event-click-2>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> event on the button that is inside code>a.html/code>. This time, when the a href#prepare-to-run-a-callback idincumbent:prepare-to-run-a-callback-5>prepare to run a callback/a> algorithm executes as part of event dispatch, there em>is/em> author code on the stack; the a href#topmost-script-having-execution-context idincumbent:topmost-script-having-execution-context-8>topmost script-having execution context/a> is that of the code>onLoad/code> function, whose a href#skip-when-determining-incumbent-counter idincumbent:skip-when-determining-incumbent-counter-6>skip-when-determining-incumbent counter/a> gets incremented. Additionally, code>a.html/code>s a href#environment-settings-object idincumbent:environment-settings-object-7>environment settings object/a> (stored as the code idincumbent:eventhandler>a href#eventhandler>EventHandler/a>/code>s a idincumbent:callback-context-4 hrefhttps://heycam.github.io/webidl/#dfn-callback-context data-x-internalcallback-context>callback context/a>) is pushed onto the a href#backup-incumbent-settings-object-stack idincumbent:backup-incumbent-settings-object-stack-8>backup incumbent settings object stack/a>./p> p>Now, when the a href#location-object-navigate idincumbent:location-object-navigate-2>code>Location/code>-object navigate/a> algorithm looks up the a href#incumbent-settings-object idincumbent:incumbent-settings-object-15>incumbent settings object/a>, the a href#topmost-script-having-execution-context idincumbent:topmost-script-having-execution-context-9>topmost script-having execution context/a> is still that of the code>onLoad/code> function (due to the fact we are using a bound function as the callback). Its a href#skip-when-determining-incumbent-counter idincumbent:skip-when-determining-incumbent-counter-7>skip-when-determining-incumbent counter/a> value is one, however, so we fall back to the a href#backup-incumbent-settings-object-stack idincumbent:backup-incumbent-settings-object-stack-9>backup incumbent settings object stack/a>. This gives us the a href#environment-settings-object idincumbent:environment-settings-object-8>environment settings object/a> of code>a.html/code>, as expected./p> p>Note that this means that even though it is the code idincumbent:the-iframe-element>a href#the-iframe-element>iframe/a>/code> inside code>a.html/code> that navigates, it is code>a.html/code> itself that is used as the a href#source-browsing-context idincumbent:source-browsing-context>source browsing context/a>, which determines among other things the a hrefhttps://fetch.spec.whatwg.org/#concept-request-client idincumbent:concept-request-client data-x-internalconcept-request-client>request client/a>. This is a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id26603#c36>perhaps the only justifiable use of the incumbent concept on the web platform/a>; in all other cases the consequences of using it are simply confusing and we hope to one day switch them to use a href#concept-current-everything idincumbent:concept-current-everything>current/a> or a href#concept-relevant-everything idincumbent:concept-relevant-everything>relevant/a> as appropriate./p> /div> h6 idcurrent>span classsecno>8.1.3.5.3/span> Currenta href#current classself-link>/a>/h6> p>The JavaScript specification defines the a idcurrent:current-realm-record hrefhttps://tc39.github.io/ecma262/#current-realm data-x-internalcurrent-realm-record>current Realm Record/a>, sometimes abbreviated to the current Realm. a href#refsJAVASCRIPT>JAVASCRIPT/a>/p> p>Then, the dfn idcurrent-settings-object data-export>current settings object/dfn> is the a href#concept-realm-settings-object idcurrent:concept-realm-settings-object>environment settings object/a> of the a idcurrent:current-realm-record-2 hrefhttps://tc39.github.io/ecma262/#current-realm data-x-internalcurrent-realm-record>current Realm Record/a>./p> p>Similarly, the dfn idcurrent-global-object data-export>current global object/dfn> is the a href#concept-realm-global idcurrent:concept-realm-global>global object/a> of the a idcurrent:current-realm-record-3 hrefhttps://tc39.github.io/ecma262/#current-realm data-x-internalcurrent-realm-record>current Realm Record/a>./p> h6 idrelevant>span classsecno>8.1.3.5.4/span> Relevanta href#relevant classself-link>/a>/h6> p>The dfn idrelevant-settings-object data-export>relevant settings object/dfn> for a a idrelevant:platform-object hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a> is defined as follows:/p> dl classswitch>dt>If the object is a a href#global-object idrelevant:global-object>global object/a>dd>Each a href#global-object idrelevant:global-object-2>global object/a> in this specification is created alongside a corresponding a href#environment-settings-object idrelevant:environment-settings-object>environment settings object/a>; that is its a href#relevant-settings-object idrelevant:relevant-settings-object>relevant settings object/a>.dt>Otherwisedd> p>The a href#relevant-settings-object idrelevant:relevant-settings-object-2>relevant settings object/a> for a non-global a idrelevant:platform-object-2 hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a> var>o/var> is the a href#environment-settings-object idrelevant:environment-settings-object-2>environment settings object/a> whose a href#concept-settings-object-global idrelevant:concept-settings-object-global>global object/a> is the global object of the a idrelevant:global-environment-associated-with hrefhttps://heycam.github.io/webidl/#es-platform-objects data-x-internalglobal-environment-associated-with>global environment associated with/a> var>o/var>./p> p classnote>The a idrelevant:global-environment-associated-with-2 hrefhttps://heycam.github.io/webidl/#es-platform-objects data-x-internalglobal-environment-associated-with>global environment associated with/a> concept is from the olden days, before the modern JavaScript specification and its concept of a hrefhttps://tc39.github.io/ecma262/#sec-code-realms idrelevant:javascript-realm data-x-internaljavascript-realm>realms/a>. We expect that as the Web IDL specification gets updated, every a idrelevant:platform-object-3 hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a> will have a a hrefhttps://tc39.github.io/ecma262/#sec-code-realms idrelevant:javascript-realm-2 data-x-internaljavascript-realm>Realm/a> associated with it, and this definition can be re-cast in those terms. a href#refsJAVASCRIPT>JAVASCRIPT/a> a href#refsWEBIDL>WEBIDL/a>/p> /dl> p>Then, the dfn idconcept-relevant-realm data-export>relevant Realm/dfn> for a a idrelevant:platform-object-4 hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a> is the a href#environment-settings-objects-realm idrelevant:environment-settings-objects-realm>Realm/a> of its a href#relevant-settings-object idrelevant:relevant-settings-object-3>relevant settings object/a>./p> p>Similarly, the dfn idconcept-relevant-global data-export>relevant global object/dfn> for a a idrelevant:platform-object-5 hrefhttps://heycam.github.io/webidl/#dfn-platform-object data-x-internalplatform-object>platform object/a> is the a href#concept-settings-object-global idrelevant:concept-settings-object-global-2>global object/a> of its a href#relevant-settings-object idrelevant:relevant-settings-object-4>relevant settings object/a>./p> h5 idkilling-scripts>span classsecno>8.1.3.6/span> Killing scriptsa href#killing-scripts classself-link>/a>/h5> p>Although the JavaScript specification does not account for this possibility, its sometimes necessary to dfn idabort-a-running-script>abort a running script/dfn>. This causes any a hrefhttps://tc39.github.io/ecma262/#sec-runtime-semantics-scriptevaluation idkilling-scripts:js-scriptevaluation data-x-internaljs-scriptevaluation>ScriptEvaluation/a> or a idkilling-scripts:source-text-module-record hrefhttps://tc39.github.io/ecma262/#sec-source-text-module-records data-x-internalsource-text-module-record>Source Text Module Record/a> a hrefhttps://tc39.github.io/ecma262/#sec-moduleevaluation idkilling-scripts:js-evaluate data-x-internaljs-evaluate>Evaluate/a> invocations to cease immediately, emptying the a idkilling-scripts:javascript-execution-context-stack hrefhttps://tc39.github.io/ecma262/#execution-context-stack data-x-internaljavascript-execution-context-stack>JavaScript execution context stack/a> without triggering any of the normal mechanisms like code>finally/code> blocks. a href#refsJAVASCRIPT>JAVASCRIPT/a>/p> p>User agents may impose resource limitations on scripts, for example CPU quotas, memory limits, total execution time limits, or bandwidth limitations. When a script exceeds a limit, the user agent may either throw a a idkilling-scripts:quotaexceedederror hrefhttps://heycam.github.io/webidl/#quotaexceedederror data-x-internalquotaexceedederror>code>QuotaExceededError/code>/a> code idkilling-scripts:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>, a href#abort-a-running-script idkilling-scripts:abort-a-running-script>abort the script/a> without an exception, prompt the user, or throttle script execution./p> div classexample> p>For example, the following script never terminates. A user agent could, after waiting for a few seconds, prompt the user to either terminate the script or let it continue./p> pre><script> while (true) { /* loop */ }</script>/pre> /div> p>User agents are encouraged to allow users to disable scripting whenever the user is prompted either by a script (e.g. using the code idkilling-scripts:dom-alert>a href#dom-alert>window.alert()/a>/code> API) or because of a scripts actions (e.g. because it has exceeded a time limit)./p> p>If scripting is disabled while a script is executing, the script should be terminated immediately./p> p>User agents may allow users to specifically disable scripts just for the purposes of closing a a href#browsing-context idkilling-scripts:browsing-context>browsing context/a>./p> p classexample>For example, the prompt mentioned in the example above could also offer the user with a mechanism to just close the page entirely, without running any code idkilling-scripts:event-unload>a href#event-unload>unload/a>/code> event handlers./p> h5 idintegration-with-the-javascript-job-queue>span classsecno>8.1.3.7/span> Integration with the JavaScript job queuea href#integration-with-the-javascript-job-queue classself-link>/a>/h5> p>The JavaScript specification defines the JavaScript job and job queue abstractions in order to specify certain invariants about how promise operations execute with a clean a idintegration-with-the-javascript-job-queue:javascript-execution-context-stack hrefhttps://tc39.github.io/ecma262/#execution-context-stack data-x-internaljavascript-execution-context-stack>JavaScript execution context stack/a> and in a certain order. However, as of the time of this writing the definition of a hrefhttps://tc39.github.io/ecma262/#sec-enqueuejob idintegration-with-the-javascript-job-queue:js-enqueuejob data-x-internaljs-enqueuejob>EnqueueJob/a> in that specification is not sufficiently flexible to integrate with HTML as a host environment. a href#refsJAVASCRIPT>JAVASCRIPT/a>/p> p classnote>This is not strictly true. It is in fact possible, by taking liberal advantage of the many implementation defined sections of the algorithm, to contort it to our purposes. However, the end result is a mass of messy indirection and workarounds that essentially bypasses the job queue infrastructure entirely, albeit in a way that is technically sanctioned within the bounds of implementation-defined behavior. We do not take this path, and instead introduce the following a href#willful-violation idintegration-with-the-javascript-job-queue:willful-violation>willful violation/a>./p> p>As such, user agents must instead use the following definition in place of that in the JavaScript specification. These ensure that the promise jobs enqueued by the JavaScript specification are properly integrated into the user agents a href#event-loop idintegration-with-the-javascript-job-queue:event-loop>event loops/a>./p> p>The a idintegration-with-the-javascript-job-queue:runjobs hrefhttps://tc39.github.io/ecma262/#sec-runjobs data-x-internalrunjobs>RunJobs/a> abstract operation from the JavaScript specification must not be used by user agents./p> h6 idenqueuejob(queuename,-job,-arguments)>span classsecno>8.1.3.7.1/span> dfn>EnqueueJob/dfn>(var>queueName/var>, var>job/var>, var>arguments/var>)a href#enqueuejob(queuename,-job,-arguments) classself-link>/a>/h6> p>When the JavaScript specification says to call the EnqueueJob abstract operation, the following algorithm must be used in place of JavaScripts a hrefhttps://tc39.github.io/ecma262/#sec-enqueuejob idenqueuejob(queuename,-job,-arguments):js-enqueuejob data-x-internaljs-enqueuejob>EnqueueJob/a>:/p> ol>li>p>Assert: var>queueName/var> is code>PromiseJobs/code>. (code>ScriptJobs/code> must not be used by user agents.)li> p>Let var>job settings/var> be some appropriate a href#environment-settings-object idenqueuejob(queuename,-job,-arguments):environment-settings-object>environment settings object/a>./p> p classwarning>It is not yet clear how to specify the a href#environment-settings-object idenqueuejob(queuename,-job,-arguments):environment-settings-object-2>environment settings object/a> that should be used here. In practice, this means that the a href#concept-entry-everything idenqueuejob(queuename,-job,-arguments):concept-entry-everything>entry/a> concept is not correctly specified while executing a job. See a hrefhttps://github.com/whatwg/html/pull/1189#issuecomment-224950188>discussion in issue #1189/a>./p> li>p>Let var>incumbent settings/var> be the a href#incumbent-settings-object idenqueuejob(queuename,-job,-arguments):incumbent-settings-object>incumbent settings object/a>.li> p>a href#queue-a-microtask idenqueuejob(queuename,-job,-arguments):queue-a-microtask>Queue a microtask/a>, on var>job settings/var>s a href#responsible-event-loop idenqueuejob(queuename,-job,-arguments):responsible-event-loop>responsible event loop/a>, to perform the following steps:/p> ol>li>p>a href#check-if-we-can-run-script idenqueuejob(queuename,-job,-arguments):check-if-we-can-run-script>Check if we can run script/a> with var>job settings/var>. If this returns do not run then abort these steps.li>p>a href#prepare-to-run-script idenqueuejob(queuename,-job,-arguments):prepare-to-run-script>Prepare to run script/a> with var>job settings/var>.li>p>a href#prepare-to-run-a-callback idenqueuejob(queuename,-job,-arguments):prepare-to-run-a-callback>Prepare to run a callback/a> with var>incumbent settings/var>.li>p>Let var>result/var> be the result of performing the abstract operation specified by var>job/var>, using the elements of var>arguments/var> as its arguments.li>p>a href#clean-up-after-running-a-callback idenqueuejob(queuename,-job,-arguments):clean-up-after-running-a-callback>Clean up after running a callback/a> with var>incumbent settings/var>.li>p>a href#clean-up-after-running-script idenqueuejob(queuename,-job,-arguments):clean-up-after-running-script>Clean up after running script/a> with var>job settings/var>.li>p>If var>result/var> is an abrupt completion, a href#report-the-exception idenqueuejob(queuename,-job,-arguments):report-the-exception>report the exception/a> given by var>result/var>.Value./ol> /ol> h5 idintegration-with-the-javascript-module-system>span classsecno>8.1.3.8/span> Integration with the JavaScript module systema href#integration-with-the-javascript-module-system classself-link>/a>/h5> p>The JavaScript specification defines a syntax for modules, as well as some host-agnostic parts of their processing model. This specification defines the rest of their processing model: how the module system is bootstrapped, via the code idintegration-with-the-javascript-module-system:the-script-element>a href#the-script-element>script/a>/code> element with code idintegration-with-the-javascript-module-system:attr-script-type>a href#attr-script-type>type/a>/code> attribute set to code>module/code>, and how modules are fetched, resolved, and executed. a href#refsJAVASCRIPT>JAVASCRIPT/a>/p> p classnote>Although the JavaScript specification speaks in terms of scripts versus modules, in general this specification speaks in terms of a href#classic-script idintegration-with-the-javascript-module-system:classic-script>classic scripts/a> versus a href#module-script idintegration-with-the-javascript-module-system:module-script>module scripts/a>, since both of them use the code idintegration-with-the-javascript-module-system:the-script-element-2>a href#the-script-element>script/a>/code> element./p> p>A dfn idmodule-map>module map/dfn> is a a hrefhttps://infra.spec.whatwg.org/#ordered-map idintegration-with-the-javascript-module-system:ordered-map data-x-internalordered-map>map/a> of a hrefhttps://url.spec.whatwg.org/#concept-url idintegration-with-the-javascript-module-system:url-record data-x-internalurl-record>URL records/a> to values that are either a a href#module-script idintegration-with-the-javascript-module-system:module-script-2>module script/a>, null (used to represent failed fetches), or a placeholder value code>fetching/code>. a href#module-map idintegration-with-the-javascript-module-system:module-map>Module maps/a> are used to ensure that imported JavaScript modules are only fetched, parsed, and evaluated once per code idintegration-with-the-javascript-module-system:document>a href#document>Document/a>/code> or a href#workers>worker/a>./p> div classexample> p>Since a href#module-map idintegration-with-the-javascript-module-system:module-map-2>module maps/a> are keyed by URL, the following code will create three separate entries in the a href#module-map idintegration-with-the-javascript-module-system:module-map-3>module map/a>, since it results in three different URLs:/p> pre>import https://example.com/module.js;import https://example.com/module.js#map-buster;import https://example.com/module.js?debugtrue;/pre> p>That is, URL a hrefhttps://url.spec.whatwg.org/#concept-url-query idintegration-with-the-javascript-module-system:concept-url-query data-x-internalconcept-url-query>queries/a> and a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idintegration-with-the-javascript-module-system:concept-url-fragment data-x-internalconcept-url-fragment>fragments/a> can be varied to create distinct entries in the a href#module-map idintegration-with-the-javascript-module-system:module-map-4>module map/a>; they are not ignored. Thus, three separate fetches and three separate module evaluations will be performed./p> p>In contrast, the following code would only create a single entry in the a href#module-map idintegration-with-the-javascript-module-system:module-map-5>module map/a>, since after applying the a idintegration-with-the-javascript-module-system:url-parser hrefhttps://url.spec.whatwg.org/#concept-url-parser data-x-internalurl-parser>URL parser/a> to these inputs, the resulting a hrefhttps://url.spec.whatwg.org/#concept-url idintegration-with-the-javascript-module-system:url-record-2 data-x-internalurl-record>URL records/a> are equal:/p> pre>import https://example.com/module2.js;import https:example.com/module2.js;import https://///example.com\\module2.js;import https://example.com/foo/../module2.js;/pre> p>So in this second example, only one fetch and one module evaluation will occur./p> p>Note that this behavior is the same as how a href#sharedworker idintegration-with-the-javascript-module-system:sharedworker>shared workers/a> are keyed by their parsed a href#concept-sharedworkerglobalscope-constructor-url idintegration-with-the-javascript-module-system:concept-sharedworkerglobalscope-constructor-url>constructor url/a>./p> /div> p>To dfn idresolve-a-module-specifier>resolve a module specifier/dfn> given a a href#the-script-element idintegration-with-the-javascript-module-system:the-script-element-3>script/a> var>script/var> and a a idintegration-with-the-javascript-module-system:javascript-string hrefhttps://infra.spec.whatwg.org/#javascript-string data-x-internaljavascript-string>JavaScript string/a> var>specifier/var>, perform the following steps. It will return either a a idintegration-with-the-javascript-module-system:url-record-3 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a> or failure./p> ol>li>p>Apply the a idintegration-with-the-javascript-module-system:url-parser-2 hrefhttps://url.spec.whatwg.org/#concept-url-parser data-x-internalurl-parser>URL parser/a> to var>specifier/var>. If the result is not failure, return the result.li> p>If var>specifier/var> does not start with the character U+002F SOLIDUS (code>//code>), the two-character sequence U+002E FULL STOP, U+002F SOLIDUS (code>.//code>), or the three-character sequence U+002E FULL STOP, U+002E FULL STOP, U+002F SOLIDUS (code>..//code>), return failure and abort these steps./p> p classnote>This restriction is in place so that in the future we can allow custom module loaders to give special meaning to bare import specifiers, like code>import jquery/code> or code>import web/crypto/code>. For now any such imports will fail, instead of being treated as relative URLs./p> li>p>Return the result of applying the a idintegration-with-the-javascript-module-system:url-parser-3 hrefhttps://url.spec.whatwg.org/#concept-url-parser data-x-internalurl-parser>URL parser/a> to var>specifier/var> with var>script/var>s a href#concept-script-base-url idintegration-with-the-javascript-module-system:concept-script-base-url>base URL/a> as the base URL./ol> div idmodule-specifier-examples classexample> p>The following are valid module specifiers according to the above algorithm:/p> ul classbrief>li>code>https://example.com/apples.js/code>li>code>http:example.com\pears.mjs/code> (becomes code>http://example.com/pears.mjs/code> as step 1 parses with no base URL)li>code>//example.com/bananas/code>li>code>./strawberries.js.cgi/code>li>code>../lychees/code>li>code>/limes.jsx/code>li>code>data:text/javascript,export default grapes;/code>li>code>blob:https://whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f/code>/ul> p>The following are valid module specifiers according to the above algorithm, but will invariably cause failures when they are a href#fetch-a-single-module-script idintegration-with-the-javascript-module-system:fetch-a-single-module-script>fetched/a>:/p> ul classbrief>li>code>javascript:export default artichokes;/code>li>code>data:text/plain,export default kale;/code>li>code>about:legumes/code>li>code>wss://example.com/celery/code>/ul> p>The following are not valid module specifiers according to the above algorithm:/p> ul classbrief>li>code>https://eggplant:b/c/code>li>code>pumpkins.js/code>li>code>.tomato/code>li>code>..zucchini.js/code>li>code>.\yam.es/code>/ul> /div> h6 idhostresolveimportedmodule(referencingscriptormodule,-specifier)>span classsecno>8.1.3.8.1/span> dfn>HostResolveImportedModule/dfn>(var>referencingScriptOrModule/var>, var>specifier/var>)a href#hostresolveimportedmodule(referencingscriptormodule,-specifier) classself-link>/a>/h6> p>JavaScript contains an implementation-defined a hrefhttps://tc39.github.io/ecma262/#sec-hostresolveimportedmodule idhostresolveimportedmodule(referencingscriptormodule,-specifier):js-hostresolveimportedmodule data-x-internaljs-hostresolveimportedmodule>HostResolveImportedModule/a> abstract operation, very slightly updated by the cite>import()/cite> proposal. User agents must use the following implementation: a href#refsJAVASCRIPT>JAVASCRIPT/a> a href#refsJSIMPORT>JSIMPORT/a>/p> ol>li>p>Let var>referencing script/var> be var>referencingScriptOrModule/var>.HostDefined.li>p>Let var>moduleMap/var> be var>referencing script/var>s a href#settings-object idhostresolveimportedmodule(referencingscriptormodule,-specifier):settings-object>settings object/a>s a href#concept-settings-object-module-map idhostresolveimportedmodule(referencingscriptormodule,-specifier):concept-settings-object-module-map>module map/a>.li>p>Let var>url/var> be the result of a href#resolve-a-module-specifier idhostresolveimportedmodule(referencingscriptormodule,-specifier):resolve-a-module-specifier>resolving a module specifier/a> given var>referencing script/var> and var>specifier/var>.li>p>Assert: var>url/var> is never failure, because a href#resolve-a-module-specifier idhostresolveimportedmodule(referencingscriptormodule,-specifier):resolve-a-module-specifier-2>resolving a module specifier/a> must have been a href#validate-requested-module-specifiers>previously successful/a> with these same two arguments.li>p>Let var>resolved module script/var> be var>moduleMap/var>var>url/var>. (This entry must a hrefhttps://infra.spec.whatwg.org/#map-exists idhostresolveimportedmodule(referencingscriptormodule,-specifier):map-exists data-x-internalmap-exists>exist/a> for us to have gotten to this point.)li>p>Assert: var>resolved module script/var> is a a href#module-script idhostresolveimportedmodule(referencingscriptormodule,-specifier):module-script>module script/a> (i.e., is not null or code>fetching/code>).li>p>Assert: var>resolved module script/var>s a href#concept-script-record idhostresolveimportedmodule(referencingscriptormodule,-specifier):concept-script-record>record/a> is not null./p> li>p>Return var>resolved module script/var>s a href#concept-script-record idhostresolveimportedmodule(referencingscriptormodule,-specifier):concept-script-record-2>record/a>./ol> h6 idhostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability)>span classsecno>8.1.3.8.2/span> dfn>HostImportModuleDynamically/dfn>(var>referencingScriptOrModule/var>, var>specifier/var>, var>promiseCapability/var>)a href#hostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability) classself-link>/a>/h6> p>The cite>import()/cite> proposal contains an implementation-defined a hrefhttps://tc39.github.io/proposal-dynamic-import/#sec-hostimportmoduledynamically idhostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability):js-hostimportmoduledynamically data-x-internaljs-hostimportmoduledynamically>HostImportModuleDynamically/a> abstract operation. User agents must use the following implementation: a href#refsJSIMPORT>JSIMPORT/a>/p> ol>li>p>Let var>referencing script/var> be var>referencingScriptOrModule/var>.HostDefined.li> p>Run the following steps a href#in-parallel idhostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability):in-parallel>in parallel/a>:/p> ol>li>p>Let var>url/var> be the result of a href#resolve-a-module-specifier idhostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability):resolve-a-module-specifier>resolving a module specifier/a> given var>referencing script/var> and var>specifier/var>.li> p>If var>url/var> is failure, then:/p> ol>li>p>Let var>completion/var> be Completion { Type: throw, Value: a new code idhostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability):typeerror>a data-x-internaltypeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror>TypeError/a>/code>, Target: empty }.li>p>Perform a idhostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability):finishdynamicimport hrefhttps://tc39.github.io/proposal-dynamic-import/#sec-finishdynamicimport data-x-internalfinishdynamicimport>FinishDynamicImport/a>(var>referencingScriptOrModule/var>, var>specifier/var>, var>promiseCapability/var>, var>completion/var>).li>p>Abort these steps./ol> li>p>Let var>options/var> be the a href#descendant-script-fetch-options idhostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability):descendant-script-fetch-options>descendant script fetch options/a> for var>referencing script/var>s a href#concept-script-script-fetch-options idhostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability):concept-script-script-fetch-options>fetch options/a>.li>p>a href#fetch-a-module-script-tree idhostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability):fetch-a-module-script-tree>Fetch a module script graph/a> given var>url/var>, var>settings object/var>, code>script/code>, and var>options/var>. Wait until the algorithm asynchronously completes with var>result/var>.li> p>If var>result/var> is null, then:/p> ol>li>p>Let var>completion/var> be Completion { Type: throw, Value: a new code idhostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability):typeerror-2>a data-x-internaltypeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror>TypeError/a>/code>, Target: empty }.li>p>Perform a idhostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability):finishdynamicimport-2 hrefhttps://tc39.github.io/proposal-dynamic-import/#sec-finishdynamicimport data-x-internalfinishdynamicimport>FinishDynamicImport/a>(var>referencingScriptOrModule/var>, var>specifier/var>, var>promiseCapability/var>, var>completion/var>).li>p>Abort these steps./ol> li>p>a href#run-a-module-script idhostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability):run-a-module-script>Run the module script/a> var>result/var>, with the rethrow errors boolean set to true.li>p>If running the module script throws an exception, then perform a idhostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability):finishdynamicimport-3 hrefhttps://tc39.github.io/proposal-dynamic-import/#sec-finishdynamicimport data-x-internalfinishdynamicimport>FinishDynamicImport/a>(var>referencingScriptOrModule/var>, var>specifier/var>, var>promiseCapability/var>, the thrown exception completion).li>p>Otherwise, perform a idhostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability):finishdynamicimport-4 hrefhttps://tc39.github.io/proposal-dynamic-import/#sec-finishdynamicimport data-x-internalfinishdynamicimport>FinishDynamicImport/a>(var>referencingScriptOrModule/var>, var>specifier/var>, var>promiseCapability/var>, a idhostimportmoduledynamically(referencingscriptormodule,-specifier,-promisecapability):normalcompletion hrefhttps://tc39.github.io/ecma262/#sec-normalcompletion data-x-internalnormalcompletion>NormalCompletion/a>(undefined))./ol> li>p>Return undefined./ol> h5 idintegration-with-the-javascript-agent-formalism>span classsecno>8.1.3.9/span> Integration with the JavaScript agent formalisma href#integration-with-the-javascript-agent-formalism classself-link>/a>/h5> p>JavaScript defines the concept of an a idintegration-with-the-javascript-agent-formalism:agent hrefhttps://tc39.github.io/ecma262/#sec-agents data-x-internalagent>agent/a>. Until such a time that this standard has a better handle on lifetimes, we define five types of a hrefhttps://tc39.github.io/ecma262/#sec-agents idintegration-with-the-javascript-agent-formalism:agent-2 data-x-internalagent>agents/a> that user agents must allocate at the appropriate time./p> p classnote>In the future, when this specification has a better handle on lifetimes, we hope to define exactly when a hrefhttps://tc39.github.io/ecma262/#sec-agents idintegration-with-the-javascript-agent-formalism:agent-3 data-x-internalagent>agents/a> and a hrefhttps://tc39.github.io/ecma262/#sec-agent-clusters idintegration-with-the-javascript-agent-formalism:agent-cluster data-x-internalagent-cluster>agent clusters/a> are created./p> p classXXX>JavaScript is expected to define a hrefhttps://tc39.github.io/ecma262/#sec-agents idintegration-with-the-javascript-agent-formalism:agent-4 data-x-internalagent>agents/a> in more detail; in particular that they hold a set of a href#concept-global-object-realm idintegration-with-the-javascript-agent-formalism:concept-global-object-realm>realms/a>: a hrefhttps://github.com/tc39/ecma262/issues/882>tc39/ecma262 issue #882/a>./p> dl>dt>dfn idsimilar-origin-window-agent data-export>Similar-origin window agent/dfn>dd> p>An a idintegration-with-the-javascript-agent-formalism:agent-5 hrefhttps://tc39.github.io/ecma262/#sec-agents data-x-internalagent>agent/a> whose CanBlock is false and whose set of a hrefhttps://tc39.github.io/ecma262/#sec-code-realms idintegration-with-the-javascript-agent-formalism:javascript-realm data-x-internaljavascript-realm>realms/a> consists of all a href#concept-global-object-realm idintegration-with-the-javascript-agent-formalism:concept-global-object-realm-2>realms/a> of code idintegration-with-the-javascript-agent-formalism:window>a href#window>Window/a>/code> objects whose a href#relevant-settings-object idintegration-with-the-javascript-agent-formalism:relevant-settings-object>relevant settings object/a>s a href#responsible-browsing-context idintegration-with-the-javascript-agent-formalism:responsible-browsing-context>responsible browsing context/a> is in the same a href#unit-of-related-similar-origin-browsing-contexts idintegration-with-the-javascript-agent-formalism:unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts/a>./p> p classnote>Two code idintegration-with-the-javascript-agent-formalism:window-2>a href#window>Window/a>/code> objects that are a href#same-origin idintegration-with-the-javascript-agent-formalism:same-origin>same origin/a> can be in different a href#similar-origin-window-agent idintegration-with-the-javascript-agent-formalism:similar-origin-window-agent>similar-origin window agents/a>, for instance if they are each in their own a href#unit-of-related-similar-origin-browsing-contexts idintegration-with-the-javascript-agent-formalism:unit-of-related-similar-origin-browsing-contexts-2>unit of related similar-origin browsing contexts/a>./p> dt>dfn iddedicated-worker-agent data-export>Dedicated worker agent/dfn>dd>p>An a idintegration-with-the-javascript-agent-formalism:agent-6 hrefhttps://tc39.github.io/ecma262/#sec-agents data-x-internalagent>agent/a> whose CanBlock is true and whose set of a hrefhttps://tc39.github.io/ecma262/#sec-code-realms idintegration-with-the-javascript-agent-formalism:javascript-realm-2 data-x-internaljavascript-realm>realms/a> consists of a single code idintegration-with-the-javascript-agent-formalism:dedicatedworkerglobalscope>a href#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope/a>/code> objects a href#concept-global-object-realm idintegration-with-the-javascript-agent-formalism:concept-global-object-realm-3>Realm/a>.dt>dfn idshared-worker-agent data-export>Shared worker agent/dfn>dd>p>An a idintegration-with-the-javascript-agent-formalism:agent-7 hrefhttps://tc39.github.io/ecma262/#sec-agents data-x-internalagent>agent/a> whose CanBlock is true and whose set of a hrefhttps://tc39.github.io/ecma262/#sec-code-realms idintegration-with-the-javascript-agent-formalism:javascript-realm-3 data-x-internaljavascript-realm>realms/a> consists a single code idintegration-with-the-javascript-agent-formalism:sharedworkerglobalscope>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> objects a href#concept-global-object-realm idintegration-with-the-javascript-agent-formalism:concept-global-object-realm-4>Realm/a>.dt>dfn idservice-worker-agent data-export>Service worker agent/dfn>dd>p>An a idintegration-with-the-javascript-agent-formalism:agent-8 hrefhttps://tc39.github.io/ecma262/#sec-agents data-x-internalagent>agent/a> whose CanBlock is false and whose set of a hrefhttps://tc39.github.io/ecma262/#sec-code-realms idintegration-with-the-javascript-agent-formalism:javascript-realm-4 data-x-internaljavascript-realm>realms/a> consists of a single code idintegration-with-the-javascript-agent-formalism:serviceworkerglobalscope>a data-x-internalserviceworkerglobalscope hrefhttps://w3c.github.io/ServiceWorker/#serviceworkerglobalscope>ServiceWorkerGlobalScope/a>/code> objects a href#concept-global-object-realm idintegration-with-the-javascript-agent-formalism:concept-global-object-realm-5>Realm/a>.dt>dfn idworklet-agent data-export>Worklet agent/dfn>dd> p>An a idintegration-with-the-javascript-agent-formalism:agent-9 hrefhttps://tc39.github.io/ecma262/#sec-agents data-x-internalagent>agent/a> whose CanBlock is false and whose set of a hrefhttps://tc39.github.io/ecma262/#sec-code-realms idintegration-with-the-javascript-agent-formalism:javascript-realm-5 data-x-internaljavascript-realm>realms/a> consists of a single code idintegration-with-the-javascript-agent-formalism:workletglobalscope>a data-x-internalworkletglobalscope hrefhttps://drafts.css-houdini.org/worklets/#workletglobalscope>WorkletGlobalScope/a>/code> objects a href#concept-global-object-realm idintegration-with-the-javascript-agent-formalism:concept-global-object-realm-6>Realm/a>./p> p classnote>While conceptually it might be cleaner for worklets that end up with multiple realms to put all those in the same agent, it is not observable in practice./p> /dl> h5 idintegration-with-the-javascript-agent-cluster-formalism>span classsecno>8.1.3.10/span> Integration with the JavaScript agent cluster formalisma href#integration-with-the-javascript-agent-cluster-formalism classself-link>/a>/h5> p>dfn idcan-share-memory-with>Can share memory with/dfn> defines an equivalence relation. An a idintegration-with-the-javascript-agent-cluster-formalism:agent-cluster hrefhttps://tc39.github.io/ecma262/#sec-agent-clusters data-x-internalagent-cluster>agent cluster/a> consists of all a hrefhttps://tc39.github.io/ecma262/#sec-agents idintegration-with-the-javascript-agent-cluster-formalism:agent data-x-internalagent>agents/a> in the same equivalence class with respect to the a href#can-share-memory-with idintegration-with-the-javascript-agent-cluster-formalism:can-share-memory-with>can share memory with/a> equivalence relation./p> p>A a href#similar-origin-window-agent idintegration-with-the-javascript-agent-cluster-formalism:similar-origin-window-agent>similar-origin window agent/a>, a href#dedicated-worker-agent idintegration-with-the-javascript-agent-cluster-formalism:dedicated-worker-agent>dedicated worker agent/a>, a href#shared-worker-agent idintegration-with-the-javascript-agent-cluster-formalism:shared-worker-agent>shared worker agent/a>, or a href#service-worker-agent idintegration-with-the-javascript-agent-cluster-formalism:service-worker-agent>service worker agent/a>, var>agent/var>, a href#can-share-memory-with idintegration-with-the-javascript-agent-cluster-formalism:can-share-memory-with-2>can share memory with/a> any a href#dedicated-worker-agent idintegration-with-the-javascript-agent-cluster-formalism:dedicated-worker-agent-2>dedicated worker agent/a> whose single a hrefhttps://tc39.github.io/ecma262/#sec-code-realms idintegration-with-the-javascript-agent-cluster-formalism:javascript-realm data-x-internaljavascript-realm>realm/a>s a href#concept-realm-global idintegration-with-the-javascript-agent-cluster-formalism:concept-realm-global>global object/a>s a href#concept-WorkerGlobalScope-owner-set idintegration-with-the-javascript-agent-cluster-formalism:concept-WorkerGlobalScope-owner-set>owner set/a> contains an item whose a href#concept-relevant-realm idintegration-with-the-javascript-agent-cluster-formalism:concept-relevant-realm>relevant Realm/a> belongs to var>agent/var>./p> p classnote>We use item above as an a href#concept-WorkerGlobalScope-owner-set idintegration-with-the-javascript-agent-cluster-formalism:concept-WorkerGlobalScope-owner-set-2>owner set/a> can contain code idintegration-with-the-javascript-agent-cluster-formalism:document>a href#document>Document/a>/code> objects./p> p classXXX>A a href#worklet-agent idintegration-with-the-javascript-agent-cluster-formalism:worklet-agent>worklet agent/a> … currently worklets have no clearly defined owner, see: a hrefhttps://github.com/w3c/css-houdini-drafts/issues/224>w3c/css-houdini-drafts issue #224/a>./p> p>In addition, any a idintegration-with-the-javascript-agent-cluster-formalism:agent-2 hrefhttps://tc39.github.io/ecma262/#sec-agents data-x-internalagent>agent/a> var>A/var> a href#can-share-memory-with idintegration-with-the-javascript-agent-cluster-formalism:can-share-memory-with-3>can share memory with/a>:/p> ul classbrief>li>var>A/var>,li>any a idintegration-with-the-javascript-agent-cluster-formalism:agent-3 hrefhttps://tc39.github.io/ecma262/#sec-agents data-x-internalagent>agent/a> var>B/var> such that var>B/var> a href#can-share-memory-with idintegration-with-the-javascript-agent-cluster-formalism:can-share-memory-with-4>can share memory with/a> var>A/var>, andli>any a idintegration-with-the-javascript-agent-cluster-formalism:agent-4 hrefhttps://tc39.github.io/ecma262/#sec-agents data-x-internalagent>agent/a> var>B/var> such that there exists an a idintegration-with-the-javascript-agent-cluster-formalism:agent-5 hrefhttps://tc39.github.io/ecma262/#sec-agents data-x-internalagent>agent/a> var>C/var>, where var>A/var> a href#can-share-memory-with idintegration-with-the-javascript-agent-cluster-formalism:can-share-memory-with-5>can share memory with/a> var>C/var> and var>C/var> a href#can-share-memory-with idintegration-with-the-javascript-agent-cluster-formalism:can-share-memory-with-6>can share memory with/a> var>B/var>./ul> p>The a idintegration-with-the-javascript-agent-cluster-formalism:agent-cluster-2 hrefhttps://tc39.github.io/ecma262/#sec-agent-clusters data-x-internalagent-cluster>agent cluster/a> concept is crucial for defining the JavaScript memory model, and in particular among which a hrefhttps://tc39.github.io/ecma262/#sec-agents idintegration-with-the-javascript-agent-cluster-formalism:agent-6 data-x-internalagent>agents/a> the backing data of code idintegration-with-the-javascript-agent-cluster-formalism:sharedarraybuffer>a data-x-internalsharedarraybuffer hrefhttps://tc39.github.io/ecma262/#sec-sharedarraybuffer-objects>SharedArrayBuffer/a>/code> objects can be shared./p> div classexample> p>The following pairs of global objects are each within the same a idintegration-with-the-javascript-agent-cluster-formalism:agent-cluster-3 hrefhttps://tc39.github.io/ecma262/#sec-agent-clusters data-x-internalagent-cluster>agent cluster/a>, and thus can use code idintegration-with-the-javascript-agent-cluster-formalism:sharedarraybuffer-2>a data-x-internalsharedarraybuffer hrefhttps://tc39.github.io/ecma262/#sec-sharedarraybuffer-objects>SharedArrayBuffer/a>/code> instances to share memory with each other:/p> ul classbrief>li>A code idintegration-with-the-javascript-agent-cluster-formalism:window>a href#window>Window/a>/code> object and a dedicated worker that it created.li>A worker (of any type) and a dedicated worker it created.li>A code idintegration-with-the-javascript-agent-cluster-formalism:window-2>a href#window>Window/a>/code> object var>A/var> and the code idintegration-with-the-javascript-agent-cluster-formalism:window-3>a href#window>Window/a>/code> object of an code idintegration-with-the-javascript-agent-cluster-formalism:the-iframe-element>a href#the-iframe-element>iframe/a>/code> element that var>A/var> created that could be a href#same-origin-domain idintegration-with-the-javascript-agent-cluster-formalism:same-origin-domain>same origin-domain/a> with var>A/var>.li>A code idintegration-with-the-javascript-agent-cluster-formalism:window-4>a href#window>Window/a>/code> object and a a href#same-origin-domain idintegration-with-the-javascript-agent-cluster-formalism:same-origin-domain-2>same origin-domain/a> code idintegration-with-the-javascript-agent-cluster-formalism:window-5>a href#window>Window/a>/code> object that opened it./ul> p>The following pairs of global objects are em>not/em> within the same a idintegration-with-the-javascript-agent-cluster-formalism:agent-cluster-4 hrefhttps://tc39.github.io/ecma262/#sec-agent-clusters data-x-internalagent-cluster>agent cluster/a>, and thus cannot share memory:/p> ul classbrief>li>A code idintegration-with-the-javascript-agent-cluster-formalism:window-6>a href#window>Window/a>/code> object and a shared worker it created.li>A worker (of any type) and a shared worker it created.li>A code idintegration-with-the-javascript-agent-cluster-formalism:window-7>a href#window>Window/a>/code> object and a service worker it created.li>A code idintegration-with-the-javascript-agent-cluster-formalism:window-8>a href#window>Window/a>/code> object var>/var> and the code idintegration-with-the-javascript-agent-cluster-formalism:window-9>a href#window>Window/a>/code> object of an code idintegration-with-the-javascript-agent-cluster-formalism:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code> element that var>A/var> created that cannot be a href#same-origin-domain idintegration-with-the-javascript-agent-cluster-formalism:same-origin-domain-3>same origin-domain/a> with var>A/var>./ul> /div> h5 idruntime-script-errors>span classsecno>8.1.3.11/span> Runtime script errorsa href#runtime-script-errors classself-link>/a>/h5> p>When the user agent is required to dfn idreport-the-error>report an error/dfn> for a particular a href#concept-script idruntime-script-errors:concept-script>script/a> var>script/var> with a particular position var>line/var>:var>col/var>, using a particular target var>target/var>, it must run these steps, after which the error is either dfn idconcept-error-handled>i>handled/i>/dfn> or dfn idconcept-error-nothandled>i>not handled/i>/dfn>:/p> ol>li>p>If var>target/var> is a href#in-error-reporting-mode idruntime-script-errors:in-error-reporting-mode>in error reporting mode/a>, then abort these steps; the error is i idruntime-script-errors:concept-error-nothandled>a href#concept-error-nothandled>not handled/a>/i>.li>p>Let var>target/var> be dfn idin-error-reporting-mode>in error reporting mode/dfn>.li>p>Let var>message/var> be a user-agent-defined string describing the error in a helpful manner. a href#fingerprinting-vector idruntime-script-errors:fingerprinting-vector classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> li>p>Let var>errorValue/var> be the value that represents the error: in the case of an uncaught exception, that would be the value that was thrown; in the case of a JavaScript error that would be an code idruntime-script-errors:idl-error>a data-x-internalidl-error hrefhttps://heycam.github.io/webidl/#idl-Error>Error/a>/code> object. If there is no corresponding value, then the null value must be used instead.li> p>Let var>urlString/var> be the result of applying the a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idruntime-script-errors:concept-url-serializer data-x-internalconcept-url-serializer>URL serializer/a> to the a idruntime-script-errors:url-record hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a> that corresponds to the resource from which var>script/var> was obtained./p> p classnote>The resource containing the script will typically be the file from which the code idruntime-script-errors:document>a href#document>Document/a>/code> was parsed, e.g. for inline code idruntime-script-errors:the-script-element>a href#the-script-element>script/a>/code> elements or a href#event-handler-content-attributes idruntime-script-errors:event-handler-content-attributes>event handler content attributes/a>; or the JavaScript file that the script was in, for external scripts. Even for dynamically-generated scripts, user agents are strongly encouraged to attempt to keep track of the original source of a script. For example, if an external script uses the code idruntime-script-errors:dom-document-write>a href#dom-document-write>document.write()/a>/code> API to insert an inline code idruntime-script-errors:the-script-element-2>a href#the-script-element>script/a>/code> element during parsing, the URL of the resource containing the script would ideally be reported as being the external script, and the line number might ideally be reported as the line with the code idruntime-script-errors:dom-document-write-2>a href#dom-document-write>document.write()/a>/code> call or where the string passed to that call was first constructed. Naturally, implementing this can be somewhat non-trivial./p> p classnote>User agents are similarly encouraged to keep careful track of the original line numbers, even in the face of code idruntime-script-errors:dom-document-write-3>a href#dom-document-write>document.write()/a>/code> calls mutating the document as it is parsed, or a href#event-handler-content-attributes idruntime-script-errors:event-handler-content-attributes-2>event handler content attributes/a> spanning multiple lines./p> li>p>If var>script/var>s a href#muted-errors idruntime-script-errors:muted-errors>muted errors/a> is true, then set var>message/var> to code>Script error./code>, var>urlString/var> to the empty string, var>line/var> and var>col/var> to 0, and var>errorValue/var> to null.li>p>Let var>notHandled/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idruntime-script-errors:concept-event-fire data-x-internalconcept-event-fire>firing an event/a> named code idruntime-script-errors:event-error>a href#event-error>error/a>/code> at var>target/var>, using code idruntime-script-errors:errorevent>a href#errorevent>ErrorEvent/a>/code>, with the code idruntime-script-errors:dom-event-cancelable>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true, the code idruntime-script-errors:dom-errorevent-message>a href#dom-errorevent-message>message/a>/code> attribute initialized to var>message/var>, the code idruntime-script-errors:dom-errorevent-filename>a href#dom-errorevent-filename>filename/a>/code> attribute initialized to var>urlString/var>, the code idruntime-script-errors:dom-errorevent-lineno>a href#dom-errorevent-lineno>lineno/a>/code> attribute initialized to var>line/var>, the code idruntime-script-errors:dom-errorevent-colno>a href#dom-errorevent-colno>colno/a>/code> attribute initialized to var>col/var>, and the code idruntime-script-errors:dom-errorevent-error>a href#dom-errorevent-error>error/a>/code> attribute initialized to var>errorValue/var>.li>p>Let var>target/var> no longer be a href#in-error-reporting-mode idruntime-script-errors:in-error-reporting-mode-2>in error reporting mode/a>.li> p>If var>notHandled/var> is false, then the error is i idruntime-script-errors:concept-error-handled>a href#concept-error-handled>handled/a>/i>. Otherwise, the error is i idruntime-script-errors:concept-error-nothandled-2>a href#concept-error-nothandled>not handled/a>/i>./p> p classnote>Returning true in an event handler cancels the event per a href#the-event-handler-processing-algorithm idruntime-script-errors:the-event-handler-processing-algorithm>the event handler processing algorithm/a>./p> /ol> h6 idruntime-script-errors-in-documents>span classsecno>8.1.3.11.1/span> Runtime script errors in documentsa href#runtime-script-errors-in-documents classself-link>/a>/h6> p>When the user agent is to dfn idreport-the-exception data-ltreport the exception|report an exception data-export>report an exception/dfn> var>E/var>, the user agent must a href#report-the-error idruntime-script-errors-in-documents:report-the-error>report the error/a> for the relevant a href#concept-script idruntime-script-errors-in-documents:concept-script>script/a>, with the problematic position (line number and column number) in the resource containing the script, using the a href#concept-settings-object-global idruntime-script-errors-in-documents:concept-settings-object-global>global object/a> specified by the scripts a href#settings-object idruntime-script-errors-in-documents:settings-object>settings object/a> as the target. If the error is still i idruntime-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 a developer console./p> h6 idthe-errorevent-interface>span classsecno>8.1.3.11.2/span> The code idthe-errorevent-interface:errorevent>a href#errorevent>ErrorEvent/a>/code> interfacea href#the-errorevent-interface classself-link>/a>/h6> pre classidl>Constructor(DOMString type, optional a href#erroreventinit idthe-errorevent-interface:erroreventinit>ErrorEventInit/a> eventInitDict), Exposed(Window,Worker)interface dfn iderrorevent>ErrorEvent/dfn> : a idthe-errorevent-interface:event hrefhttps://dom.spec.whatwg.org/#interface-event data-x-internalevent>Event/a> { readonly attribute DOMString a href#dom-errorevent-message idthe-errorevent-interface:dom-errorevent-message>message/a>; readonly attribute USVString a href#dom-errorevent-filename idthe-errorevent-interface:dom-errorevent-filename>filename/a>; readonly attribute unsigned long a href#dom-errorevent-lineno idthe-errorevent-interface:dom-errorevent-lineno>lineno/a>; readonly attribute unsigned long a href#dom-errorevent-colno idthe-errorevent-interface:dom-errorevent-colno>colno/a>; readonly attribute any a href#dom-errorevent-error idthe-errorevent-interface:dom-errorevent-error>error/a>;};dictionary dfn iderroreventinit>ErrorEventInit/dfn> : a idthe-errorevent-interface:eventinit hrefhttps://dom.spec.whatwg.org/#dictdef-eventinit data-x-internaleventinit>EventInit/a> { DOMString message ; USVString filename ; unsigned long lineno 0; unsigned long colno 0; any error null;};/pre> p>The dfn iddom-errorevent-message>code>message/code>/dfn> attribute must return the value it was initialized to. It represents the error message./p> p>The dfn iddom-errorevent-filename>code>filename/code>/dfn> attribute must return the value it was initialized to. It represents the a idthe-errorevent-interface:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the script in which the error originally occurred./p> p>The dfn iddom-errorevent-lineno>code>lineno/code>/dfn> attribute must return the value it was initialized to. It represents the line number where the error occurred in the script./p> p>The dfn iddom-errorevent-colno>code>colno/code>/dfn> attribute must return the value it was initialized to. It represents the column number where the error occurred in the script./p> p>The dfn iddom-errorevent-error>code>error/code>/dfn> attribute must return the value it was initialized to. Where appropriate, it is set to the object representing the error (e.g., the exception object in the case of an uncaught DOM exception)./p> h5 idunhandled-promise-rejections>span classsecno>8.1.3.12/span> Unhandled promise rejectionsa href#unhandled-promise-rejections classself-link>/a>/h5> p>In addition to synchronous a href#runtime-script-errors>runtime script errors/a>, scripts may experience asynchronous promise rejections, tracked via the code idunhandled-promise-rejections:event-unhandledrejection>a href#event-unhandledrejection>unhandledrejection/a>/code> and code idunhandled-promise-rejections:event-rejectionhandled>a href#event-rejectionhandled>rejectionhandled/a>/code> events.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> unhandledrejectionspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>36+/span>/span>span classios_saf no>span>iOS Safari/span> span>None/span>/span>span classand_uc no>span>UC Browser for Android/span> span>None/span>/span>span classfirefox no>span>Firefox/span> span>None/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>5+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>11+/span>/span>span classedge no>span>Edge/span> span>None/span>/span>span classandroid yes>span>Android Browser/span> span>56+/span>/span>span classopera yes>span>Opera/span> span>36+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featunhandledrejection>caniuse.com/a>/div> p>When the user agent is to dfn idnotify-about-rejected-promises>notify about rejected promises/dfn> on a given a href#environment-settings-object idunhandled-promise-rejections:environment-settings-object>environment settings object/a> var>settings object/var>, it must run these steps:/p> ol>li>p>Let var>list/var> be a copy of var>settings object/var>s a href#about-to-be-notified-rejected-promises-list idunhandled-promise-rejections:about-to-be-notified-rejected-promises-list>about-to-be-notified rejected promises list/a>.li>p>If var>list/var> is empty, abort these steps.li>p>Clear var>settings object/var>s a href#about-to-be-notified-rejected-promises-list idunhandled-promise-rejections:about-to-be-notified-rejected-promises-list-2>about-to-be-notified rejected promises list/a>.li> p>a href#queue-a-task idunhandled-promise-rejections:queue-a-task>Queue a task/a> to run the following substep:/p> ol>li>p>For each promise var>p/var> in var>list/var>:/p> ol>li>p>If var>p/var>s PromiseIsHandled internal slot is true, continue to the next iteration of the loop.li>p>Let var>notHandled/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idunhandled-promise-rejections:concept-event-fire data-x-internalconcept-event-fire>firing an event/a> named code idunhandled-promise-rejections:event-unhandledrejection-2>a href#event-unhandledrejection>unhandledrejection/a>/code> at var>settings object/var>s a href#concept-settings-object-global idunhandled-promise-rejections:concept-settings-object-global>global object/a>, using code idunhandled-promise-rejections:promiserejectionevent>a href#promiserejectionevent>PromiseRejectionEvent/a>/code>, with the code idunhandled-promise-rejections:dom-event-cancelable>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true, the code idunhandled-promise-rejections:dom-promiserejectionevent-promise>a href#dom-promiserejectionevent-promise>promise/a>/code> attribute initialized to var>p/var>, and the code idunhandled-promise-rejections:dom-promiserejectionevent-reason>a href#dom-promiserejectionevent-reason>reason/a>/code> attribute initialized to the value of var>p/var>s PromiseResult internal slot.li>p>If var>notHandled/var> is false, then the promise rejection is i idunhandled-promise-rejections:concept-promise-rejection-handled>a href#concept-promise-rejection-handled>handled/a>/i>. Otherwise, the promise rejection is i idunhandled-promise-rejections:concept-promise-rejection-nothandled>a href#concept-promise-rejection-nothandled>not handled/a>/i>.li>p>If var>p/var>s PromiseIsHandled internal slot is false, add var>p/var> to var>settings object/var>s a href#outstanding-rejected-promises-weak-set idunhandled-promise-rejections:outstanding-rejected-promises-weak-set>outstanding rejected promises weak set/a>. /ol> /ol> /ol> p>This algorithm results in promise rejections being marked as dfn idconcept-promise-rejection-handled>i>handled/i>/dfn> or dfn idconcept-promise-rejection-nothandled>i>not handled/i>/dfn>. These concepts parallel i idunhandled-promise-rejections:concept-error-handled>a href#concept-error-handled>handled/a>/i> and i idunhandled-promise-rejections:concept-error-nothandled>a href#concept-error-nothandled>not handled/a>/i> script errors. If a rejection is still i idunhandled-promise-rejections:concept-promise-rejection-nothandled-2>a href#concept-promise-rejection-nothandled>not handled/a>/i> after this, then the rejection may be reported to a developer console./p> h6 idthe-hostpromiserejectiontracker-implementation>span classsecno>8.1.3.12.1/span> dfn>HostPromiseRejectionTracker/dfn>(var>promise/var>, var>operation/var>)a href#the-hostpromiserejectiontracker-implementation classself-link>/a>/h6> p>JavaScript contains an implementation-defined a hrefhttps://tc39.github.io/ecma262/#sec-host-promise-rejection-tracker idthe-hostpromiserejectiontracker-implementation:js-hostpromiserejectiontracker data-x-internaljs-hostpromiserejectiontracker>HostPromiseRejectionTracker/a>(var>promise/var>, var>operation/var>) abstract operation. User agents must use the following implementation: a href#refsJAVASCRIPT>JAVASCRIPT/a>/p> ol>li>p>Let var>script/var> be the a href#running-script idthe-hostpromiserejectiontracker-implementation:running-script>running script/a>.li>p>If var>script/var>s a href#muted-errors idthe-hostpromiserejectiontracker-implementation:muted-errors>muted errors/a> is true, terminate these steps.li>p>Let var>settings object/var> be var>script/var>s a href#settings-object idthe-hostpromiserejectiontracker-implementation:settings-object>settings object/a>./p> li> p>If var>operation/var> is code>reject/code>, ol>li>p>Add var>promise/var> to var>settings object/var>s a href#about-to-be-notified-rejected-promises-list idthe-hostpromiserejectiontracker-implementation:about-to-be-notified-rejected-promises-list>about-to-be-notified rejected promises list/a>./ol> li> p>If var>operation/var> is code>handle/code>, ol>li>p>If var>settings object/var>s a href#about-to-be-notified-rejected-promises-list idthe-hostpromiserejectiontracker-implementation:about-to-be-notified-rejected-promises-list-2>about-to-be-notified rejected promises list/a> contains var>promise/var>, remove var>promise/var> from that list and abort these steps.li>p>If var>settings object/var>s a href#outstanding-rejected-promises-weak-set idthe-hostpromiserejectiontracker-implementation:outstanding-rejected-promises-weak-set>outstanding rejected promises weak set/a> does not contain var>promise/var>, abort these steps.li>p>Remove var>promise/var> from var>settings object/var>s a href#outstanding-rejected-promises-weak-set idthe-hostpromiserejectiontracker-implementation:outstanding-rejected-promises-weak-set-2>outstanding rejected promises weak set/a>.li>p>a href#queue-a-task idthe-hostpromiserejectiontracker-implementation:queue-a-task>Queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-hostpromiserejectiontracker-implementation:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idthe-hostpromiserejectiontracker-implementation:event-rejectionhandled>a href#event-rejectionhandled>rejectionhandled/a>/code> at var>settings object/var>s a href#concept-settings-object-global idthe-hostpromiserejectiontracker-implementation:concept-settings-object-global>global object/a>, using code idthe-hostpromiserejectiontracker-implementation:promiserejectionevent>a href#promiserejectionevent>PromiseRejectionEvent/a>/code>, with the code idthe-hostpromiserejectiontracker-implementation:dom-promiserejectionevent-promise>a href#dom-promiserejectionevent-promise>promise/a>/code> attribute initialized to var>promise/var>, and the code idthe-hostpromiserejectiontracker-implementation:dom-promiserejectionevent-reason>a href#dom-promiserejectionevent-reason>reason/a>/code> attribute initialized to the value of var>promise/var>s PromiseResult internal slot./ol> /ol> h6 idthe-promiserejectionevent-interface>span classsecno>8.1.3.12.2/span> The code idthe-promiserejectionevent-interface:promiserejectionevent>a href#promiserejectionevent>PromiseRejectionEvent/a>/code> interfacea href#the-promiserejectionevent-interface classself-link>/a>/h6> pre classidl>Constructor(DOMString type, a href#promiserejectioneventinit idthe-promiserejectionevent-interface:promiserejectioneventinit>PromiseRejectionEventInit/a> eventInitDict), Exposed(Window,Worker)interface dfn idpromiserejectionevent>PromiseRejectionEvent/dfn> : a idthe-promiserejectionevent-interface:event hrefhttps://dom.spec.whatwg.org/#interface-event data-x-internalevent>Event/a> { readonly attribute Promise<any> a href#dom-promiserejectionevent-promise idthe-promiserejectionevent-interface:dom-promiserejectionevent-promise>promise/a>; readonly attribute any a href#dom-promiserejectionevent-reason idthe-promiserejectionevent-interface:dom-promiserejectionevent-reason>reason/a>;};dictionary dfn idpromiserejectioneventinit>PromiseRejectionEventInit/dfn> : a idthe-promiserejectionevent-interface:eventinit hrefhttps://dom.spec.whatwg.org/#dictdef-eventinit data-x-internaleventinit>EventInit/a> { required Promise<any> promise; any reason;};/pre> p>The dfn iddom-promiserejectionevent-promise>code>promise/code>/dfn> attribute must return the value it was initialized to. It represents the promise which this notification is about./p> p>The dfn iddom-promiserejectionevent-reason>code>reason/code>/dfn> attribute must return the value it was initialized to. It represents the rejection reason for the promise./p> h5 idhostensurecancompilestrings(callerrealm,-calleerealm)>span classsecno>8.1.3.13/span> dfn>HostEnsureCanCompileStrings/dfn>(var>callerRealm/var>, var>calleeRealm/var>)a href#hostensurecancompilestrings(callerrealm,-calleerealm) classself-link>/a>/h5> p>JavaScript contains an implementation-defined a hrefhttps://tc39.github.io/ecma262/#sec-hostensurecancompilestrings idhostensurecancompilestrings(callerrealm,-calleerealm):js-hostensurecancompilestrings data-x-internaljs-hostensurecancompilestrings>HostEnsureCanCompileStrings/a>(var>callerRealm/var>, var>calleeRealm/var>) abstract operation. User agents must use the following implementation: a href#refsJAVASCRIPT>JAVASCRIPT/a> ol>li>p>Perform ? a hrefhttps://w3c.github.io/webappsec-csp/#can-compile-strings idhostensurecancompilestrings(callerrealm,-calleerealm):csp-ensurecspdoesnotblockstringcompilation data-x-internalcsp-ensurecspdoesnotblockstringcompilation>EnsureCSPDoesNotBlockStringCompilation/a>(var>callerRealm/var>, var>calleeRealm/var>). a href#refsCSP>CSP/a>/ol> h4 idevent-loops>span classsecno>8.1.4/span> Event loopsa href#event-loops classself-link>/a>/h4> h5 iddefinitions-3>span classsecno>8.1.4.1/span> Definitionsa href#definitions-3 classself-link>/a>/h5> p>To coordinate events, user interaction, scripts, rendering, networking, and so forth, user agents must use dfn idevent-loop data-ltevent loop data-export>event loops/dfn> as described in this section. There are two kinds of event loops: those for a href#browsing-context iddefinitions-3:browsing-context>browsing contexts/a>, and those for a href#workers>workers/a>./p> p>There must be at least one a href#browsing-context iddefinitions-3:browsing-context-2>browsing context/a> a href#event-loop iddefinitions-3:event-loop>event loop/a> per user agent, and at most one per a href#unit-of-related-similar-origin-browsing-contexts iddefinitions-3:unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts/a>./p> p classnote>When there is more than one a href#event-loop iddefinitions-3:event-loop-2>event loop/a> for a a href#unit-of-related-browsing-contexts iddefinitions-3:unit-of-related-browsing-contexts>unit of related browsing contexts/a>, complications arise when a a href#browsing-context iddefinitions-3:browsing-context-3>browsing context/a> in that group is a href#navigate iddefinitions-3:navigate>navigated/a> such that it switches from one a href#unit-of-related-similar-origin-browsing-contexts iddefinitions-3:unit-of-related-similar-origin-browsing-contexts-2>unit of related similar-origin browsing contexts/a> to another. This specification does not currently describe how to handle these complications./p> p>A a href#browsing-context iddefinitions-3:browsing-context-4>browsing context/a> a href#event-loop iddefinitions-3:event-loop-3>event loop/a> always has at least one a href#browsing-context iddefinitions-3:browsing-context-5>browsing context/a>. If such an a href#event-loop iddefinitions-3:event-loop-4>event loop/a>s a href#browsing-context iddefinitions-3:browsing-context-6>browsing contexts/a> all go away, then the a href#event-loop iddefinitions-3:event-loop-5>event loop/a> goes away as well. A a href#browsing-context iddefinitions-3:browsing-context-7>browsing context/a> always has an a href#event-loop iddefinitions-3:event-loop-6>event loop/a> coordinating its activities./p> p>a href#worker-event-loop>Worker event loops/a> are simpler: each worker has one a href#event-loop iddefinitions-3:event-loop-7>event loop/a>, and the a href#run-a-worker iddefinitions-3:run-a-worker>worker processing model/a> manages the a href#event-loop iddefinitions-3:event-loop-8>event loop/a>s lifetime./p> hr> p>An a href#event-loop iddefinitions-3:event-loop-9>event loop/a> has one or more dfn idtask-queue>task queues/dfn>. A a href#task-queue iddefinitions-3:task-queue>task queue/a> is an ordered list of dfn idconcept-task data-lttask data-export>tasks/dfn>, which are algorithms that are responsible for such work as:/p> dl>dt>Eventsdd> p>Dispatching an code iddefinitions-3:event>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> object at a particular code iddefinitions-3:eventtarget>a data-x-internaleventtarget hrefhttps://dom.spec.whatwg.org/#interface-eventtarget>EventTarget/a>/code> object is often done by a dedicated task./p> p classnote>Not all events are dispatched using the a href#task-queue iddefinitions-3:task-queue-2>task queue/a>, many are dispatched during other tasks./p> dt>Parsingdd>p>The a href#html-parser iddefinitions-3:html-parser>HTML parser/a> tokenizing one or more bytes, and then processing any resulting tokens, is typically a task.dt>Callbacksdd>p>Calling a callback is often done by a dedicated task.dt>Using a resourcedd>p>When an algorithm a hrefhttps://fetch.spec.whatwg.org/#concept-fetch iddefinitions-3:concept-fetch data-x-internalconcept-fetch>fetches/a> a resource, if the fetching occurs in a non-blocking fashion then the processing of the resource once some or all of the resource is available is performed by a task.dt>Reacting to DOM manipulationdd>p>Some elements have tasks that trigger in response to DOM manipulation, e.g. when that element is a href#insert-an-element-into-a-document iddefinitions-3:insert-an-element-into-a-document>inserted into the document/a>./p> /dl> p>Each a href#concept-task iddefinitions-3:concept-task>task/a> in a a href#browsing-context iddefinitions-3:browsing-context-8>browsing context/a> a href#event-loop iddefinitions-3:event-loop-10>event loop/a> is associated with a code iddefinitions-3:document>a href#document>Document/a>/code>; if the task was queued in the context of an element, then it is the elements a iddefinitions-3:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>; if the task was queued in the context of a a href#browsing-context iddefinitions-3:browsing-context-9>browsing context/a>, then it is the a href#browsing-context iddefinitions-3:browsing-context-10>browsing context/a>s a href#active-document iddefinitions-3:active-document>active document/a> at the time the task was queued; if the task was queued by or for a a href#concept-script iddefinitions-3:concept-script>script/a> then the document is the a href#responsible-document iddefinitions-3:responsible-document>responsible document/a> specified by the scripts a href#settings-object iddefinitions-3:settings-object>settings object/a>./p> p>A a href#concept-task iddefinitions-3:concept-task-2>task/a> is intended for a specific a href#event-loop iddefinitions-3:event-loop-11>event loop/a>: the a href#event-loop iddefinitions-3:event-loop-12>event loop/a> that is handling a href#concept-task iddefinitions-3:concept-task-3>tasks/a> for the a href#concept-task iddefinitions-3:concept-task-4>task/a>s associated code iddefinitions-3:document-2>a href#document>Document/a>/code> or a href#workers>worker/a>./p> p>When a user agent is to dfn idqueue-a-task data-export>queue a task/dfn>, it must add the given task to one of the a href#task-queue iddefinitions-3:task-queue-3>task queues/a> of the relevant a href#event-loop iddefinitions-3:event-loop-13>event loop/a>./p> p>Each a href#concept-task iddefinitions-3:concept-task-5>task/a> is defined as coming from a specific dfn idtask-source data-export>task source/dfn>. All the tasks from one particular a href#task-source iddefinitions-3:task-source>task source/a> and destined to a particular a href#event-loop iddefinitions-3:event-loop-14>event loop/a> (e.g. the callbacks generated by timers of a code iddefinitions-3:document-3>a href#document>Document/a>/code>, the events fired for mouse movements over that code iddefinitions-3:document-4>a href#document>Document/a>/code>, the tasks queued for the parser of that code iddefinitions-3:document-5>a href#document>Document/a>/code>) must always be added to the same a href#task-queue iddefinitions-3:task-queue-4>task queue/a>, but a href#concept-task iddefinitions-3:concept-task-6>tasks/a> from different a href#task-source iddefinitions-3:task-source-2>task sources/a> may be placed in different a href#task-queue iddefinitions-3:task-queue-5>task queues/a>./p> p classexample>For example, a user agent could have one a href#task-queue iddefinitions-3:task-queue-6>task queue/a> for mouse and key events (the a href#user-interaction-task-source iddefinitions-3:user-interaction-task-source>user interaction task source/a>), and another for everything else. The user agent could then give keyboard and mouse events preference over other tasks three quarters of the time, keeping the interface responsive but not starving other task queues, and never processing events from any one a href#task-source iddefinitions-3:task-source-3>task source/a> out of order./p> p>Each a href#event-loop iddefinitions-3:event-loop-15>event loop/a> has a dfn idcurrently-running-task>currently running task/dfn>. Initially, this is null. It is used to handle reentrancy. Each a href#event-loop iddefinitions-3:event-loop-16>event loop/a> also has a dfn idperforming-a-microtask-checkpoint>performing a microtask checkpoint/dfn> flag, which must initially be false. It is used to prevent reentrant invocation of the a href#perform-a-microtask-checkpoint iddefinitions-3:perform-a-microtask-checkpoint>perform a microtask checkpoint/a> algorithm./p> h5 idevent-loop-processing-model data-dfn-typedfn data-ltevent loop processing model data-export>span classsecno>8.1.4.2/span> span idprocessing-model-8>/span>Processing modela href#event-loop-processing-model classself-link>/a>/h5> p>An a href#event-loop idevent-loop-processing-model:event-loop>event loop/a> must continually run through the following steps for as long as it exists:/p> ol>li idstep1>p>Let var>oldestTask/var> be the oldest a href#concept-task idevent-loop-processing-model:concept-task>task/a> on one of the a href#event-loop idevent-loop-processing-model:event-loop-2>event loop/a>s a href#task-queue idevent-loop-processing-model:task-queue>task queues/a>, if any, ignoring, in the case of a a href#browsing-context idevent-loop-processing-model:browsing-context>browsing context/a> a href#event-loop idevent-loop-processing-model:event-loop-3>event loop/a>, tasks whose associated code idevent-loop-processing-model:document>a href#document>Document/a>/code>s are not a href#fully-active idevent-loop-processing-model:fully-active>fully active/a>. The user agent may pick any a href#task-queue idevent-loop-processing-model:task-queue-2>task queue/a>. If there is no task to select, then jump to the i>microtasks/i> step below.li>p>Set the a href#event-loop idevent-loop-processing-model:event-loop-4>event loop/a>s a href#currently-running-task idevent-loop-processing-model:currently-running-task>currently running task/a> to var>oldestTask/var>.li>p>Run var>oldestTask/var>.li>p>Set the a href#event-loop idevent-loop-processing-model:event-loop-5>event loop/a>s a href#currently-running-task idevent-loop-processing-model:currently-running-task-2>currently running task/a> back to null.li>p>Remove var>oldestTask/var> from its a href#task-queue idevent-loop-processing-model:task-queue-3>task queue/a>.li>p>i>Microtasks/i>: a href#perform-a-microtask-checkpoint idevent-loop-processing-model:perform-a-microtask-checkpoint>Perform a microtask checkpoint/a>.li> p>dfn idupdate-the-rendering data-export>Update the rendering/dfn>: If this a href#event-loop idevent-loop-processing-model:event-loop-6>event loop/a> is a a href#browsing-context idevent-loop-processing-model:browsing-context-2>browsing context/a> a href#event-loop idevent-loop-processing-model:event-loop-7>event loop/a> (as opposed to a a href#workers>worker/a> a href#event-loop idevent-loop-processing-model:event-loop-8>event loop/a>), then run the following substeps./p> ol>li>p>Let var>now/var> be the value that would be returned by the code idevent-loop-processing-model:performance>a data-x-internalperformance hrefhttps://w3c.github.io/hr-time/#the-performance-interface>Performance/a>/code> objects code idevent-loop-processing-model:dom-performance-now>a data-x-internaldom-performance-now hrefhttps://w3c.github.io/hr-time/#dom-performance-now()>now()/a>/code> method. a href#refsHRT>HRT/a>/p> li> p>Let var>docs/var> be the list of code idevent-loop-processing-model:document-2>a href#document>Document/a>/code> objects associated with the a href#event-loop idevent-loop-processing-model:event-loop-9>event loop/a> in question, sorted arbitrarily except that the following conditions must be met:/p> ul>li>p>Any code idevent-loop-processing-model:document-3>a href#document>Document/a>/code> var>B/var> that is a href#browsing-context-nested-through idevent-loop-processing-model:browsing-context-nested-through>nested through/a> a code idevent-loop-processing-model:document-4>a href#document>Document/a>/code> var>A/var> must be listed after var>A/var> in the list.li>p>If there are two documents var>A/var> and var>B/var> whose a href#concept-document-bc idevent-loop-processing-model:concept-document-bc>browsing contexts/a> are both a href#nested-browsing-context idevent-loop-processing-model:nested-browsing-context>nested browsing contexts/a> and their a href#browsing-context-container idevent-loop-processing-model:browsing-context-container>browsing context containers/a> are both elements in the same code idevent-loop-processing-model:document-5>a href#document>Document/a>/code> var>C/var>, then the order of var>A/var> and var>B/var> in the list must match the relative a idevent-loop-processing-model:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a> of their respective a href#browsing-context-container idevent-loop-processing-model:browsing-context-container-2>browsing context containers/a> in var>C/var>./ul> p>In the steps below that iterate over var>docs/var>, each code idevent-loop-processing-model:document-6>a href#document>Document/a>/code> must be processed in the order it is found in the list./p> li> p>If there are a href#top-level-browsing-context idevent-loop-processing-model:top-level-browsing-context>top-level browsing contexts/a> var>B/var> that the user agent believes would not benefit from having their rendering updated at this time, then remove from var>docs/var> all code idevent-loop-processing-model:document-7>a href#document>Document/a>/code> objects whose a href#concept-document-bc idevent-loop-processing-model:concept-document-bc-2>browsing context/a>s a href#top-level-browsing-context idevent-loop-processing-model:top-level-browsing-context-2>top-level browsing context/a> is in var>B/var>./p> div classnote> p>Whether a a href#top-level-browsing-context idevent-loop-processing-model:top-level-browsing-context-3>top-level browsing context/a> would benefit from having its rendering updated depends on various factors, such as the update frequency. For example, if the browser is attempting to achieve a 60Hz refresh rate, then these steps are only necessary every 60th of a second (about 16.7ms). If the browser finds that a a href#top-level-browsing-context idevent-loop-processing-model:top-level-browsing-context-4>top-level browsing context/a> is not able to sustain this rate, it might drop to a more sustainable 30Hz for that set of code idevent-loop-processing-model:document-8>a href#document>Document/a>/code>s, rather than occasionally dropping frames. (This specification does not mandate any particular model for when to update the rendering.) Similarly, if a a href#top-level-browsing-context idevent-loop-processing-model:top-level-browsing-context-5>top-level browsing context/a> is in the background, the user agent might decide to drop that page to a much slower 4Hz, or even less./p> p>Another example of why a browser might skip updating the rendering is to ensure certain a href#concept-task idevent-loop-processing-model:concept-task-2>tasks/a> are executed immediately after each other, with only a href#perform-a-microtask-checkpoint idevent-loop-processing-model:perform-a-microtask-checkpoint-2>microtask checkpoints/a> interleaved (and without, e.g., a href#run-the-animation-frame-callbacks idevent-loop-processing-model:run-the-animation-frame-callbacks>animation frame callbacks/a> interleaved). For example, a user agent might wish to coalesce timer callbacks together, with no intermediate rendering updates./p> /div> li> p>If there are a a href#nested-browsing-context idevent-loop-processing-model:nested-browsing-context-2>nested browsing contexts/a> var>B/var> that the user agent believes would not benefit from having their rendering updated at this time, then remove from var>docs/var> all code idevent-loop-processing-model:document-9>a href#document>Document/a>/code> objects whose a href#concept-document-bc idevent-loop-processing-model:concept-document-bc-3>browsing context/a> is in var>B/var>./p> p classnote>As with a href#top-level-browsing-context idevent-loop-processing-model:top-level-browsing-context-6>top-level browsing contexts/a>, a variety of factors can influence whether it is profitable for a browser to update the rendering of a href#nested-browsing-context idevent-loop-processing-model:nested-browsing-context-3>nested browsing contexts/a>. For example, a user agent might wish to spend less resources rendering third-party content, especially if it is not currently visible to the user or if resources are constrained. In such cases, the browser could decide to update the rendering for such content infrequently or never./p> li>p>For each a href#fully-active idevent-loop-processing-model:fully-active-2>fully active/a> code idevent-loop-processing-model:document-10>a href#document>Document/a>/code> in var>docs/var>, a idevent-loop-processing-model:run-the-resize-steps hrefhttps://drafts.csswg.org/cssom-view/#run-the-resize-steps data-x-internalrun-the-resize-steps>run the resize steps/a> for that code idevent-loop-processing-model:document-11>a href#document>Document/a>/code>, passing in var>now/var> as the timestamp. a href#refsCSSOMVIEW>CSSOMVIEW/a>li>p>For each a href#fully-active idevent-loop-processing-model:fully-active-3>fully active/a> code idevent-loop-processing-model:document-12>a href#document>Document/a>/code> in var>docs/var>, a idevent-loop-processing-model:run-the-scroll-steps hrefhttps://drafts.csswg.org/cssom-view/#run-the-scroll-steps data-x-internalrun-the-scroll-steps>run the scroll steps/a> for that code idevent-loop-processing-model:document-13>a href#document>Document/a>/code>, passing in var>now/var> as the timestamp. a href#refsCSSOMVIEW>CSSOMVIEW/a>li>p>For each a href#fully-active idevent-loop-processing-model:fully-active-4>fully active/a> code idevent-loop-processing-model:document-14>a href#document>Document/a>/code> in var>docs/var>, a idevent-loop-processing-model:evaluate-media-queries-and-report-changes hrefhttps://drafts.csswg.org/cssom-view/#evaluate-media-queries-and-report-changes data-x-internalevaluate-media-queries-and-report-changes>evaluate media queries and report changes/a> for that code idevent-loop-processing-model:document-15>a href#document>Document/a>/code>, passing in var>now/var> as the timestamp. a href#refsCSSOMVIEW>CSSOMVIEW/a>li>p>For each a href#fully-active idevent-loop-processing-model:fully-active-5>fully active/a> code idevent-loop-processing-model:document-16>a href#document>Document/a>/code> in var>docs/var>, dfn idrun-css-animations-and-send-events>run CSS animations and send events/dfn> for that code idevent-loop-processing-model:document-17>a href#document>Document/a>/code>, passing in var>now/var> as the timestamp. a href#refsCSSANIMATIONS>CSSANIMATIONS/a>li>p>For each a href#fully-active idevent-loop-processing-model:fully-active-6>fully active/a> code idevent-loop-processing-model:document-18>a href#document>Document/a>/code> in var>docs/var>, a idevent-loop-processing-model:run-the-fullscreen-steps hrefhttps://fullscreen.spec.whatwg.org/#run-the-fullscreen-steps data-x-internalrun-the-fullscreen-steps>run the fullscreen steps/a> for that code idevent-loop-processing-model:document-19>a href#document>Document/a>/code>, passing in var>now/var> as the timestamp. a href#refsFULLSCREEN>FULLSCREEN/a>li>p>For each a href#fully-active idevent-loop-processing-model:fully-active-7>fully active/a> code idevent-loop-processing-model:document-20>a href#document>Document/a>/code> in var>docs/var>, a href#run-the-animation-frame-callbacks idevent-loop-processing-model:run-the-animation-frame-callbacks-2>run the animation frame callbacks/a> for that code idevent-loop-processing-model:document-21>a href#document>Document/a>/code>, passing in var>now/var> as the timestamp.li>p>For each a href#fully-active idevent-loop-processing-model:fully-active-8>fully active/a> code idevent-loop-processing-model:document-22>a href#document>Document/a>/code> in var>docs/var>, a idevent-loop-processing-model:run-the-update-intersection-observations-steps hrefhttps://w3c.github.io/IntersectionObserver/#run-the-update-intersection-observations-steps data-x-internalrun-the-update-intersection-observations-steps>run the update intersection observations steps/a> for that code idevent-loop-processing-model:document-23>a href#document>Document/a>/code>, passing in var>now/var> as the timestamp. a href#refsINTERSECTIONOBSERVER>INTERSECTIONOBSERVER/a>li>p>For each a href#fully-active idevent-loop-processing-model:fully-active-9>fully active/a> code idevent-loop-processing-model:document-24>a href#document>Document/a>/code> in var>docs/var>, update the rendering or user interface of that code idevent-loop-processing-model:document-25>a href#document>Document/a>/code> and its a href#concept-document-bc idevent-loop-processing-model:concept-document-bc-4>browsing context/a> to reflect the current state./ol> li>p>If this is a a href#workers>worker/a> a href#event-loop idevent-loop-processing-model:event-loop-10>event loop/a> (i.e. one running for a code idevent-loop-processing-model:workerglobalscope>a href#workerglobalscope>WorkerGlobalScope/a>/code>), but there are no a href#concept-task idevent-loop-processing-model:concept-task-3>tasks/a> in the a href#event-loop idevent-loop-processing-model:event-loop-11>event loop/a>s a href#task-queue idevent-loop-processing-model:task-queue-4>task queues/a> and the code idevent-loop-processing-model:workerglobalscope-2>a href#workerglobalscope>WorkerGlobalScope/a>/code> objects a href#dom-workerglobalscope-closing idevent-loop-processing-model:dom-workerglobalscope-closing>closing/a> flag is true, then destroy the a href#event-loop idevent-loop-processing-model:event-loop-12>event loop/a>, aborting these steps, resuming the a href#run-a-worker idevent-loop-processing-model:run-a-worker>run a worker/a> steps described in the a href#workers>Web workers/a> section below./ol> hr> p>Each a href#event-loop idevent-loop-processing-model:event-loop-13>event loop/a> has a dfn idmicrotask-queue>microtask queue/dfn>. A dfn idmicrotask data-export>microtask/dfn> is a a href#concept-task idevent-loop-processing-model:concept-task-4>task/a> that is originally to be queued on the a href#microtask-queue idevent-loop-processing-model:microtask-queue>microtask queue/a> rather than a a href#task-queue idevent-loop-processing-model:task-queue-5>task queue/a>. There are two kinds of a href#microtask idevent-loop-processing-model:microtask>microtasks/a>: dfn idsolitary-callback-microtask data-ltsolitary callback microtask data-export>solitary callback microtasks/dfn>, and dfn idcompound-microtask data-ltcompound microtask data-export>compound microtasks/dfn>./p> p classnote>This specification only has a href#solitary-callback-microtask idevent-loop-processing-model:solitary-callback-microtask>solitary callback microtasks/a>. Specifications that use a href#compound-microtask idevent-loop-processing-model:compound-microtask>compound microtasks/a> have to take extra care to a href#execute-a-compound-microtask-subtask idevent-loop-processing-model:execute-a-compound-microtask-subtask>wrap callbacks/a> to handle a href#spin-the-event-loop idevent-loop-processing-model:spin-the-event-loop>spinning the event loop/a>./p> p>When an algorithm requires a a href#microtask idevent-loop-processing-model:microtask-2>microtask/a> to be dfn idqueue-a-microtask data-ltqueue a microtask data-export>queued/dfn>, it must be appended to the relevant a href#event-loop idevent-loop-processing-model:event-loop-14>event loop/a>s a href#microtask-queue idevent-loop-processing-model:microtask-queue-2>microtask queue/a>; the a href#task-source idevent-loop-processing-model:task-source>task source/a> of such a a href#microtask idevent-loop-processing-model:microtask-3>microtask/a> is the dfn idmicrotask-task-source>microtask task source/dfn>./p> p classnote>It is possible for a a href#microtask idevent-loop-processing-model:microtask-4>microtask/a> to be moved to a regular a href#task-queue idevent-loop-processing-model:task-queue-6>task queue/a>, if, during its initial execution, it a href#spin-the-event-loop idevent-loop-processing-model:spin-the-event-loop-2>spins the event loop/a>. In that case, the a href#microtask-task-source idevent-loop-processing-model:microtask-task-source>microtask task source/a> is the a href#task-source idevent-loop-processing-model:task-source-2>task source/a> used. Normally, the a href#task-source idevent-loop-processing-model:task-source-3>task source/a> of a a href#microtask idevent-loop-processing-model:microtask-5>microtask/a> is irrelevant./p> p>When a user agent is to dfn idperform-a-microtask-checkpoint data-export>perform a microtask checkpoint/dfn>, if the a href#performing-a-microtask-checkpoint idevent-loop-processing-model:performing-a-microtask-checkpoint>performing a microtask checkpoint/a> flag is false, then the user agent must run the following steps:/p> ol>li>p>Set the a href#performing-a-microtask-checkpoint idevent-loop-processing-model:performing-a-microtask-checkpoint-2>performing a microtask checkpoint/a> flag to true.li> p>While the a href#event-loop idevent-loop-processing-model:event-loop-15>event loop/a>s a href#microtask-queue idevent-loop-processing-model:microtask-queue-3>microtask queue/a> is not empty:/p> ol>li>p>Let var>oldestMicrotask/var> be the oldest a href#microtask idevent-loop-processing-model:microtask-6>microtask/a> on the a href#event-loop idevent-loop-processing-model:event-loop-16>event loop/a>s a href#microtask-queue idevent-loop-processing-model:microtask-queue-4>microtask queue/a>.li>p>Set the a href#event-loop idevent-loop-processing-model:event-loop-17>event loop/a>s a href#currently-running-task idevent-loop-processing-model:currently-running-task-3>currently running task/a> to var>oldestMicrotask/var>.li> p>Run var>oldestMicrotask/var>./p> p classnote>This might involve invoking scripted callbacks, which eventually calls the a href#clean-up-after-running-script idevent-loop-processing-model:clean-up-after-running-script>clean up after running script/a> steps, which call this a href#perform-a-microtask-checkpoint idevent-loop-processing-model:perform-a-microtask-checkpoint-3>perform a microtask checkpoint/a> algorithm again, which is why we use the a href#performing-a-microtask-checkpoint idevent-loop-processing-model:performing-a-microtask-checkpoint-3>performing a microtask checkpoint/a> flag to avoid reentrancy./p> li>p>Set the a href#event-loop idevent-loop-processing-model:event-loop-18>event loop/a>s a href#currently-running-task idevent-loop-processing-model:currently-running-task-4>currently running task/a> back to null.li>p>Remove var>oldestMicrotask/var> from the a href#microtask-queue idevent-loop-processing-model:microtask-queue-5>microtask queue/a>./ol> li>p>For each a href#environment-settings-object idevent-loop-processing-model:environment-settings-object>environment settings object/a> whose a href#responsible-event-loop idevent-loop-processing-model:responsible-event-loop>responsible event loop/a> is this a href#event-loop idevent-loop-processing-model:event-loop-19>event loop/a>, a href#notify-about-rejected-promises idevent-loop-processing-model:notify-about-rejected-promises>notify about rejected promises/a> on that a href#environment-settings-object idevent-loop-processing-model:environment-settings-object-2>environment settings object/a>.li>p>a idevent-loop-processing-model:cleanup-indexed-database-transactions hrefhttps://w3c.github.io/IndexedDB/#cleanup-indexed-database-transactions data-x-internalcleanup-indexed-database-transactions>Cleanup Indexed Database transactions/a>.li>p>Set the a href#performing-a-microtask-checkpoint idevent-loop-processing-model:performing-a-microtask-checkpoint-4>performing a microtask checkpoint/a> flag to false./ol> p>If, while a a href#compound-microtask idevent-loop-processing-model:compound-microtask-2>compound microtask/a> is running, the user agent is required to dfn idexecute-a-compound-microtask-subtask data-export>execute a compound microtask subtask/dfn> to run a series of steps, the user agent must run the following steps:/p> ol>li>p>Let var>parent/var> be the a href#event-loop idevent-loop-processing-model:event-loop-20>event loop/a>s a href#currently-running-task idevent-loop-processing-model:currently-running-task-5>currently running task/a> (the currently running a href#compound-microtask idevent-loop-processing-model:compound-microtask-3>compound microtask/a>).li>p>Let var>subtask/var> be a new a href#concept-task idevent-loop-processing-model:concept-task-5>task/a> that consists of running the given series of steps. The a href#task-source idevent-loop-processing-model:task-source-4>task source/a> of such a a href#microtask idevent-loop-processing-model:microtask-7>microtask/a> is the a href#microtask-task-source idevent-loop-processing-model:microtask-task-source-2>microtask task source/a>. This is a dfn idcompound-microtask-subtask>compound microtask subtask/dfn>.li>p>Set the a href#event-loop idevent-loop-processing-model:event-loop-21>event loop/a>s a href#currently-running-task idevent-loop-processing-model: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 idevent-loop-processing-model:event-loop-22>event loop/a>s a href#currently-running-task idevent-loop-processing-model:currently-running-task-7>currently running task/a> back to var>parent/var>./ol> hr> p>When an algorithm running a href#in-parallel idevent-loop-processing-model:in-parallel>in parallel/a> is to dfn idawait-a-stable-state>await a stable state/dfn>, the user agent must a href#queue-a-microtask idevent-loop-processing-model:queue-a-microtask>queue a microtask/a> that runs the following steps, and must then stop executing (execution of the algorithm resumes when the microtask is run, as described in the following steps):/p> ol>li>p>Run the algorithms dfn idsynchronous-section>synchronous section/dfn>.li>p>Resumes execution of the algorithm a href#in-parallel idevent-loop-processing-model:in-parallel-2>in parallel/a>, if appropriate, as described in the algorithms steps./ol> p classnote>Steps in a href#synchronous-section idevent-loop-processing-model:synchronous-section>synchronous sections/a> are marked with ⌛./p> hr> p>When an algorithm says to dfn idspin-the-event-loop>spin the event loop/dfn> until a condition var>goal/var> is met, the user agent must run the following steps:/p> ol>li> p>Let var>task/var> be the a href#event-loop idevent-loop-processing-model:event-loop-23>event loop/a>s a href#currently-running-task idevent-loop-processing-model:currently-running-task-8>currently running task/a>./p> p classnote>This might be a a href#microtask idevent-loop-processing-model:microtask-8>microtask/a>, in which case it is a a href#solitary-callback-microtask idevent-loop-processing-model:solitary-callback-microtask-2>solitary callback microtask/a>. It could also be a a href#compound-microtask-subtask idevent-loop-processing-model:compound-microtask-subtask>compound microtask subtask/a>, or a regular a href#concept-task idevent-loop-processing-model:concept-task-6>task/a> that is not a a href#microtask idevent-loop-processing-model:microtask-9>microtask/a>. It will em>not/em> be a a href#compound-microtask idevent-loop-processing-model:compound-microtask-4>compound microtask/a>./p> li>p>Let var>task source/var> be var>task/var>s a href#task-source idevent-loop-processing-model:task-source-5>task source/a>.li>p>Let var>old stack/var> be a copy of the a idevent-loop-processing-model:javascript-execution-context-stack hrefhttps://tc39.github.io/ecma262/#execution-context-stack data-x-internaljavascript-execution-context-stack>JavaScript execution context stack/a>.li>p>Empty the a idevent-loop-processing-model:javascript-execution-context-stack-2 hrefhttps://tc39.github.io/ecma262/#execution-context-stack data-x-internaljavascript-execution-context-stack>JavaScript execution context stack/a>.li>p>a href#perform-a-microtask-checkpoint idevent-loop-processing-model:perform-a-microtask-checkpoint-4>Perform a microtask checkpoint/a>.li> p>Stop var>task/var>, allowing whatever algorithm that invoked it to resume, but continue these steps a href#in-parallel idevent-loop-processing-model:in-parallel-3>in parallel/a>./p> p classnote>This causes one of the following algorithms to continue: the a href#event-loop idevent-loop-processing-model:event-loop-24>event loop/a>s main set of steps, the a href#perform-a-microtask-checkpoint idevent-loop-processing-model:perform-a-microtask-checkpoint-5>perform a microtask checkpoint/a> algorithm, or the a href#execute-a-compound-microtask-subtask idevent-loop-processing-model:execute-a-compound-microtask-subtask-2>execute a compound microtask subtask/a> algorithm./p> li>p>Wait until the condition var>goal/var> is met.li>p>a href#queue-a-task idevent-loop-processing-model:queue-a-task>Queue a task/a> to continue running these steps, using the a href#task-source idevent-loop-processing-model:task-source-6>task source/a> var>task source/var>. Wait until this new task runs before continuing these steps.li>p>Replace the a idevent-loop-processing-model:javascript-execution-context-stack-3 hrefhttps://tc39.github.io/ecma262/#execution-context-stack data-x-internaljavascript-execution-context-stack>JavaScript execution context stack/a> with the var>old stack/var>.li>p>Return to the caller./ol> hr> p>Some of the algorithms in this specification, for historical reasons, require the user agent to dfn idpause>pause/dfn> while running a a href#concept-task idevent-loop-processing-model:concept-task-7>task/a> until a condition var>goal/var> is met. This means running the following steps:/p> ol>li>p>If necessary, update the rendering or user interface of any code idevent-loop-processing-model:document-26>a href#document>Document/a>/code> or a href#browsing-context idevent-loop-processing-model:browsing-context-3>browsing context/a> to reflect the current state.li>p>Wait until the condition var>goal/var> is met. While a user agent has a paused a href#concept-task idevent-loop-processing-model:concept-task-8>task/a>, the corresponding a href#event-loop idevent-loop-processing-model:event-loop-25>event loop/a> must not run further a href#concept-task idevent-loop-processing-model:concept-task-9>tasks/a>, and any script in the currently running a href#concept-task idevent-loop-processing-model:concept-task-10>task/a> must block. User agents should remain responsive to user input while paused, however, albeit in a reduced capacity since the a href#event-loop idevent-loop-processing-model:event-loop-26>event loop/a> will not be doing anything./ol> div classwarning> p>a href#pause idevent-loop-processing-model:pause>Pausing/a> is highly detrimental to the user experience, especially in scenarios where a single a href#event-loop idevent-loop-processing-model:event-loop-27>event loop/a> is shared among multiple documents. User agents are encouraged to experiment with alternatives to a href#pause idevent-loop-processing-model:pause-2>pausing/a>, such as a href#spin-the-event-loop idevent-loop-processing-model:spin-the-event-loop-3>spinning the event loop/a> or even simply proceeding without any kind of suspended execution at all, insofar as it is possible to do so while preserving compatibility with existing content. This specification will happily change if a less-drastic alternative is discovered to be web-compatible./p> p>In the interim, implementers should be aware that the variety of alternatives that user agents might experiment with can change subtle aspects of a href#event-loop idevent-loop-processing-model:event-loop-28>event loop/a> behavior, including a href#concept-task idevent-loop-processing-model:concept-task-11>task/a> and a href#microtask idevent-loop-processing-model:microtask-10>microtask/a> timing. Implementations should continue experimenting even if doing so causes them to violate the exact semantics implied by the a href#pause idevent-loop-processing-model:pause-3>pause/a> operation./p> /div> h5 idgeneric-task-sources>span classsecno>8.1.4.3/span> Generic task sourcesa href#generic-task-sources classself-link>/a>/h5> p>The following a href#task-source idgeneric-task-sources:task-source>task sources/a> are used by a number of mostly unrelated features in this and other specifications./p> dl>dt>The dfn iddom-manipulation-task-source data-dfn-typedfn data-export>DOM manipulation task source/dfn>dd> p>This a href#task-source idgeneric-task-sources:task-source-2>task source/a> is used for features that react to DOM manipulations, such as things that happen in a non-blocking fashion when an element is a href#insert-an-element-into-a-document idgeneric-task-sources:insert-an-element-into-a-document>inserted into the document/a>./p> dt>The dfn iduser-interaction-task-source data-export>user interaction task source/dfn>dd> p>This a href#task-source idgeneric-task-sources:task-source-3>task source/a> is used for features that react to user interaction, for example keyboard or mouse input./p> p>Events sent in response to user input (e.g. code idgeneric-task-sources:event-click>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> events) must be fired using a href#concept-task idgeneric-task-sources:concept-task>tasks/a> a href#queue-a-task idgeneric-task-sources:queue-a-task>queued/a> with the a href#user-interaction-task-source idgeneric-task-sources:user-interaction-task-source>user interaction task source/a>. a href#refsUIEVENTS>UIEVENTS/a>/p> dt>The dfn idnetworking-task-source data-export>networking task source/dfn>dd> p>This a href#task-source idgeneric-task-sources:task-source-4>task source/a> is used for features that trigger in response to network activity./p> dt>The dfn idhistory-traversal-task-source data-export>history traversal task source/dfn>dd> p>This a href#task-source idgeneric-task-sources:task-source-5>task source/a> is used to queue calls to code idgeneric-task-sources:dom-history-back>a href#dom-history-back>history.back()/a>/code> and similar APIs./p> /dl> h5 idevent-loop-for-spec-authors>span classsecno>8.1.4.4/span> Dealing with the event loop from other specificationsa href#event-loop-for-spec-authors classself-link>/a>/h5> p>Writing specifications that correctly interact with the a href#event-loop idevent-loop-for-spec-authors:event-loop>event loop/a> can be tricky. This is compounded by how this specification uses concurrency-model-independent terminology, so we say things like a href#event-loop idevent-loop-for-spec-authors:event-loop-2>event loop/a> and a href#in-parallel idevent-loop-for-spec-authors:in-parallel>in parallel/a> instead of using more familiar model-specific terms like main thread or on a background thread./p> p>By default, specification text generally runs on the a href#event-loop idevent-loop-for-spec-authors:event-loop-3>event loop/a>. This falls out from the formal a href#event-loop-processing-model>event loop processing model/a>, in that you can eventually trace most algorithms back to a a href#concept-task idevent-loop-for-spec-authors:concept-task>task/a> a href#queue-a-task idevent-loop-for-spec-authors:queue-a-task>queued/a> there./p> p classexample>The algorithm steps for any JavaScript method will be invoked by author code calling that method. And author code can only be run via queued tasks, usually originating somewhere in the a hrefscript-processing-model>code>script/code> processing model/a>./p> p>From this starting point, the overriding guideline is that any work a specification needs to perform that would otherwise block the a href#event-loop idevent-loop-for-spec-authors:event-loop-4>event loop/a> must instead be performed a href#in-parallel idevent-loop-for-spec-authors:in-parallel-2>in parallel/a> with it. This includes (but is not limited to):/p> ul>li>p>performing heavy computation;li>p>displaying a user-facing prompt;li>p>performing operations which could require involving outside systems (i.e. going out of process)./ul> p>The next complication is that, in algorithm sections that are a href#in-parallel idevent-loop-for-spec-authors:in-parallel-3>in parallel/a>, you must not create or manipulate objects associated to a specific a idevent-loop-for-spec-authors:javascript-realm hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript realm/a>, a href#global-object idevent-loop-for-spec-authors:global-object>global/a>, or a href#environment-settings-object idevent-loop-for-spec-authors:environment-settings-object>environment settings object/a>. (Stated in more familiar terms, you must not directly access main-thread artifacts from a background thread.) Doing so would create data races observable to JavaScript code, since after all, your algorithm steps are running em>a href#in-parallel idevent-loop-for-spec-authors:in-parallel-4>in parallel/a>/em> to the JavaScript code./p> p>You can, however, manipulate specification-level data structures and values from the WHATWG Infra Standard, as those are realm-agnostic. They are never directly exposed to JavaScript without a specific conversion taking place (often a hrefhttps://heycam.github.io/webidl/#es-type-mapping idevent-loop-for-spec-authors:concept-idl-convert data-x-internalconcept-idl-convert>via Web IDL/a>). a href#refsINFRA>INFRA/a> a href#refsWEBIDL>WEBIDL/a>/p> p>To affect the world of observable JavaScript objects, then, you must a href#queue-a-task idevent-loop-for-spec-authors:queue-a-task-2>queue a task/a> to perform any such manipulations. This ensures your steps are properly interleaved with respect to other things happening on the a href#event-loop idevent-loop-for-spec-authors:event-loop-5>event loop/a>. Furthermore, you must choose a a href#task-source idevent-loop-for-spec-authors:task-source>task source/a> when a href#queue-a-task idevent-loop-for-spec-authors:queue-a-task-3>queueing a task/a>; this governs the relative order of your steps versus others. If you are unsure which a href#task-source idevent-loop-for-spec-authors:task-source-2>task source/a> to use, pick one of the a href#generic-task-sources>generic task sources/a> that sounds most applicable./p> p>Most invocations of a href#queue-a-task idevent-loop-for-spec-authors:queue-a-task-4>queue a task/a> implicitly use the relevant a href#event-loop idevent-loop-for-spec-authors:event-loop-6>event loop/a>, i.e., the one that is obvious from context. That is because it is very rare for algorithms to be invoked in contexts involving multiple event loops. (Unlike contexts involving multiple global objects, which happen all the time!) So unless you are writing a specification which, e.g., deals with manipulating a href#workers>workers/a>, you can omit this argument when a href#queue-a-task idevent-loop-for-spec-authors:queue-a-task-5>queueing a task/a>./p> p>Putting this all together, we can provide a template for a typical algorithm that needs to do work asynchronously:/p> ol>li>p>Do any synchronous setup work, while still on the a href#event-loop idevent-loop-for-spec-authors:event-loop-7>event loop/a>. This may include converting a hrefhttps://tc39.github.io/ecma262/#sec-code-realms idevent-loop-for-spec-authors:javascript-realm-2 data-x-internaljavascript-realm>realm/a>-specific JavaScript values into realm-agnostic specification-level values.li>p>Perform a set of potentially-expensive steps a href#in-parallel idevent-loop-for-spec-authors:in-parallel-5>in parallel/a>, operating entirely on realm-agnostic values, and producing a realm-agnostic result.li>p>a href#queue-a-task idevent-loop-for-spec-authors:queue-a-task-6>Queue a task/a>, on a specified a href#task-source idevent-loop-for-spec-authors:task-source-3>task source/a>, to convert the realm-agnostic result back into observable effects on the observable world of JavaScript objects on the a href#event-loop idevent-loop-for-spec-authors:event-loop-8>event loop/a>./ol> div idexample-event-loop-using-algorithm classexample> p>The following is an algorithm that encrypts a passed-in a idevent-loop-for-spec-authors:list hrefhttps://infra.spec.whatwg.org/#list data-x-internallist>list/a> of a hrefhttps://infra.spec.whatwg.org/#scalar-value-string idevent-loop-for-spec-authors:scalar-value-string data-x-internalscalar-value-string>scalar value strings/a> var>input/var>, after parsing them as URLs:/p> ol>li>p>Let var>urls/var> be an empty a idevent-loop-for-spec-authors:list-2 hrefhttps://infra.spec.whatwg.org/#list data-x-internallist>list/a>.li> p>a hrefhttps://infra.spec.whatwg.org/#list-iterate idevent-loop-for-spec-authors:list-iterate data-x-internallist-iterate>For each/a> var>string/var> of var>input/var>:/p> ol>li>p>Let var>parsed/var> be the result of a href#parse-a-url idevent-loop-for-spec-authors:parse-a-url>parsing/a> var>string/var> relative to the a href#current-settings-object idevent-loop-for-spec-authors:current-settings-object>current settings object/a>.li>p>If var>parsed/var> is failure, return a promise rejected with a a idevent-loop-for-spec-authors:syntaxerror hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idevent-loop-for-spec-authors:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Let var>serialized/var> be the result of applying the a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idevent-loop-for-spec-authors:concept-url-serializer data-x-internalconcept-url-serializer>URL serializer/a> to var>parsed/var>.li>p>a hrefhttps://infra.spec.whatwg.org/#list-append idevent-loop-for-spec-authors:list-append data-x-internallist-append>Append/a> var>serialized/var> to var>urls/var>./ol> li>p>Let var>realm/var> be the a idevent-loop-for-spec-authors:current-realm-record hrefhttps://tc39.github.io/ecma262/#current-realm data-x-internalcurrent-realm-record>current Realm Record/a>.li>p>Let var>p/var> be a new promise.li> p>Run the following steps a href#in-parallel idevent-loop-for-spec-authors:in-parallel-6>in parallel/a>:/p> ol>li>p>Let var>encryptedURLs/var> be an empty a idevent-loop-for-spec-authors:list-3 hrefhttps://infra.spec.whatwg.org/#list data-x-internallist>list/a>.li> p>a hrefhttps://infra.spec.whatwg.org/#list-iterate idevent-loop-for-spec-authors:list-iterate-2 data-x-internallist-iterate>For each/a> var>url/var> of var>urls/var>:/p> ol>li>p>Wait 100 milliseconds, so that people think were doing heavy-duty encryption.li>p>Let var>encrypted/var> be a new a idevent-loop-for-spec-authors:javascript-string hrefhttps://infra.spec.whatwg.org/#javascript-string data-x-internaljavascript-string>JavaScript string/a> derived from var>url/var>, whose var>n/var>th a idevent-loop-for-spec-authors:code-unit hrefhttps://infra.spec.whatwg.org/#code-unit data-x-internalcode-unit>code unit/a> is equal to var>url/var>s var>n/var>th a idevent-loop-for-spec-authors:code-unit-2 hrefhttps://infra.spec.whatwg.org/#code-unit data-x-internalcode-unit>code unit/a> plus 13.li>p>a hrefhttps://infra.spec.whatwg.org/#list-append idevent-loop-for-spec-authors:list-append-2 data-x-internallist-append>Append/a> var>encrypted/var> to var>encryptedURLs/var>./p> /ol> li> p>a href#queue-a-task idevent-loop-for-spec-authors:queue-a-task-7>Queue a task/a>, on the a href#networking-task-source idevent-loop-for-spec-authors:networking-task-source>networking task source/a>, to perform the following steps:/p> ol>li>p>Let var>array/var> be the result of a hrefhttps://heycam.github.io/webidl/#es-type-mapping idevent-loop-for-spec-authors:concept-idl-convert-2 data-x-internalconcept-idl-convert>converting/a> var>encryptedURLs/var> to a JavaScript array, in var>realm/var>.li>p>Resolve var>p/var> with var>array/var>./ol> /ol> li>p>Return var>p/var>./ol> p>Here are several things to notice about this algorithm:/p> ul>li>p>It does its URL parsing up front, on the a href#event-loop idevent-loop-for-spec-authors:event-loop-9>event loop/a>, before going to the a href#in-parallel idevent-loop-for-spec-authors:in-parallel-7>in parallel/a> steps. This is necessary, since parsing depends on the a href#current-settings-object idevent-loop-for-spec-authors:current-settings-object-2>current settings object/a>, which would no longer be current after going a href#in-parallel idevent-loop-for-spec-authors:in-parallel-8>in parallel/a>.li>p>Alternately, it could have saved a reference to the a href#current-settings-object idevent-loop-for-spec-authors:current-settings-object-3>current settings object/a>s a href#api-base-url idevent-loop-for-spec-authors:api-base-url>API base URL/a> and used it during the a href#in-parallel idevent-loop-for-spec-authors:in-parallel-9>in parallel/a> steps; that would have been equivalent. However, we recommend instead doing as much work as possible up front, as this example does. Attempting to save the correct values can be error prone; for example, if wed saved just the a href#current-settings-object idevent-loop-for-spec-authors:current-settings-object-4>current settings object/a>, instead of its a href#api-base-url idevent-loop-for-spec-authors:api-base-url-2>API base URL/a>, there would have been a potential race.li>p>It implicitly passes a a idevent-loop-for-spec-authors:list-4 hrefhttps://infra.spec.whatwg.org/#list data-x-internallist>list/a> of a hrefhttps://infra.spec.whatwg.org/#javascript-string idevent-loop-for-spec-authors:javascript-string-2 data-x-internaljavascript-string>JavaScript strings/a> from the initial steps to the a href#in-parallel idevent-loop-for-spec-authors:in-parallel-10>in parallel/a> steps. This is OK, as both a hrefhttps://infra.spec.whatwg.org/#list idevent-loop-for-spec-authors:list-5 data-x-internallist>lists/a> and a hrefhttps://infra.spec.whatwg.org/#javascript-string idevent-loop-for-spec-authors:javascript-string-3 data-x-internaljavascript-string>JavaScript strings/a> are a hrefhttps://tc39.github.io/ecma262/#sec-code-realms idevent-loop-for-spec-authors:javascript-realm-3 data-x-internaljavascript-realm>realm/a>-agnostic.li>p>It performs expensive computation (waiting for 100 milliseconds per input URL) during the a href#in-parallel idevent-loop-for-spec-authors:in-parallel-11>in parallel/a> steps, thus not blocking the main a href#event-loop idevent-loop-for-spec-authors:event-loop-10>event loop/a>.li>p>Promises, as observable JavaScript objects, are never created and manipulated during the a href#in-parallel idevent-loop-for-spec-authors:in-parallel-12>in parallel/a> steps. var>p/var> is created before entering those steps, and then is manipulated during a a href#concept-task idevent-loop-for-spec-authors:concept-task-2>task/a> that is a href#queue-a-task idevent-loop-for-spec-authors:queue-a-task-8>queued/a> specifically for that purpose.li>p>The creation of a JavaScript array object also happens during the queued task, and is careful to specify which realm it creates the array in since that is no longer obvious from context./ul> p>(On these last two points, see also a hrefhttps://github.com/w3ctag/promises-guide/issues/52>w3ctag/promises-guide#52/a>, a hrefhttps://github.com/heycam/webidl/issues/135>heycam/webidl#135/a>, and a hrefhttps://github.com/heycam/webidl/issues/371>heycam/webidl#371/a>, where we are still mulling over the subtleties of the above promise-resolution pattern.)/p> p>Another thing to note is that, in the event this algorithm was called from a Web IDL-specified operation taking a code>sequence/code><code idevent-loop-for-spec-authors:idl-usvstring>a data-x-internalidl-usvstring hrefhttps://heycam.github.io/webidl/#idl-USVString>USVString/a>/code>>, there was an automatic conversion from a hrefhttps://tc39.github.io/ecma262/#sec-code-realms idevent-loop-for-spec-authors:javascript-realm-4 data-x-internaljavascript-realm>realm/a>-specific JavaScript objects provided by the author as input, into the realm-agnostic code>sequence/code><code idevent-loop-for-spec-authors:idl-usvstring-2>a data-x-internalidl-usvstring hrefhttps://heycam.github.io/webidl/#idl-USVString>USVString/a>/code>> Web IDL type, which we then treat as a a idevent-loop-for-spec-authors:list-6 hrefhttps://infra.spec.whatwg.org/#list data-x-internallist>list/a> of a hrefhttps://infra.spec.whatwg.org/#scalar-value-string idevent-loop-for-spec-authors:scalar-value-string-2 data-x-internalscalar-value-string>scalar value strings/a>. So depending on how your specification is structured, there may be other implicit steps happening on the main a href#event-loop idevent-loop-for-spec-authors:event-loop-11>event loop/a> that play a part in this whole process of getting you ready to go a href#in-parallel idevent-loop-for-spec-authors:in-parallel-13>in parallel/a>./p> /div> h4 idevents>span classsecno>8.1.5/span> Eventsa href#events classself-link>/a>/h4> h5 idevent-handler-attributes>span classsecno>8.1.5.1/span> Event handlersa href#event-handler-attributes classself-link>/a>/h5> p>Many objects can have dfn idevent-handlers data-ltevent handler data-export>event handlers/dfn> specified. These act as non-capture event listeners for the object on which they are specified. a href#refsDOM>DOM/a>/p> p>An a href#event-handlers idevent-handler-attributes:event-handlers>event handler/a> has a name, which always starts with code>on/code> and is followed by the name of the event for which it is intended./p> p>An a href#event-handlers idevent-handler-attributes:event-handlers-2>event handler/a> has a value, which is either null, or is a callback object, or is an a href#internal-raw-uncompiled-handler idevent-handler-attributes:internal-raw-uncompiled-handler>internal raw uncompiled handler/a>. The code idevent-handler-attributes:eventhandler>a href#eventhandler>EventHandler/a>/code> callback function type describes how this is exposed to scripts. Initially, an a href#event-handlers idevent-handler-attributes:event-handlers-3>event handler/a>s value must be set to null./p> p>Event handlers are exposed in one of two ways./p> p>The first way, common to all event handlers, is as an a href#event-handler-idl-attributes idevent-handler-attributes:event-handler-idl-attributes>event handler IDL attribute/a>./p> p>The second way is as an a href#event-handler-content-attributes idevent-handler-attributes:event-handler-content-attributes>event handler content attribute/a>. Event handlers on a href#html-elements idevent-handler-attributes:html-elements>HTML elements/a> and some of the event handlers on code idevent-handler-attributes:window>a href#window>Window/a>/code> objects are exposed in this way./p> hr> p>An dfn idevent-handler-idl-attributes data-export>event handler IDL attribute/dfn> is an IDL attribute for a specific a href#event-handlers idevent-handler-attributes:event-handlers-4>event handler/a>. The name of the IDL attribute is the same as the name of the a href#event-handlers idevent-handler-attributes:event-handlers-5>event handler/a>./p> p>a href#event-handler-idl-attributes idevent-handler-attributes:event-handler-idl-attributes-2>Event handler IDL attributes/a>, on setting, must set the corresponding a href#event-handlers idevent-handler-attributes:event-handlers-6>event handler/a> to their new value, and on getting, must return the result of a href#getting-the-current-value-of-the-event-handler idevent-handler-attributes:getting-the-current-value-of-the-event-handler>getting the current value of the event handler/a> in question./p> p>If an a href#event-handler-idl-attributes idevent-handler-attributes:event-handler-idl-attributes-3>event handler IDL attribute/a> exposes an a href#event-handlers idevent-handler-attributes:event-handlers-7>event handler/a> of an object that doesnt exist, it must always return null on getting and must do nothing on setting./p> p classnote>This can happen in particular for a href#event-handler-idl-attributes idevent-handler-attributes:event-handler-idl-attributes-4>event handler IDL attribute/a> on code idevent-handler-attributes:the-body-element>a href#the-body-element>body/a>/code> elements that do not have corresponding code idevent-handler-attributes:window-2>a href#window>Window/a>/code> objects./p> p classnote>Certain event handler IDL attributes have additional requirements, in particular the code idevent-handler-attributes:handler-messageport-onmessage>a href#handler-messageport-onmessage>onmessage/a>/code> attribute of code idevent-handler-attributes:messageport>a href#messageport>MessagePort/a>/code> objects./p> hr> p>An dfn idevent-handler-content-attributes data-export>event handler content attribute/dfn> is a content attribute for a specific a href#event-handlers idevent-handler-attributes:event-handlers-8>event handler/a>. The name of the content attribute is the same as the name of the a href#event-handlers idevent-handler-attributes:event-handlers-9>event handler/a>./p> p>a href#event-handler-content-attributes idevent-handler-attributes:event-handler-content-attributes-2>Event handler content attributes/a>, when specified, must contain valid JavaScript code which, when parsed, would match the i idevent-handler-attributes:js-prod-functionbody>a data-x-internaljs-prod-functionbody hrefhttps://tc39.github.io/ecma262/#prod-FunctionBody>FunctionBody/a>/i> production after a idevent-handler-attributes:automatic-semicolon-insertion hrefhttps://tc39.github.io/ecma262/#sec-automatic-semicolon-insertion data-x-internalautomatic-semicolon-insertion>automatic semicolon insertion/a>./p> p>When an a href#event-handler-content-attributes idevent-handler-attributes:event-handler-content-attributes-3>event handler content attribute/a> is set, execute the following steps:/p> ol>li>p>If the a idevent-handler-attributes:should-elements-inline-behavior-be-blocked-by-content-security-policy hrefhttps://w3c.github.io/webappsec-csp/#should-block-inline data-x-internalshould-elements-inline-behavior-be-blocked-by-content-security-policy>Should elements inline behavior be blocked by Content Security Policy?/a> algorithm returns code>Blocked/code> when executed upon the attributes a idevent-handler-attributes:element hrefhttps://dom.spec.whatwg.org/#interface-element data-x-internalelement>element/a>, code>script attribute/code>, and the attributes value, then abort these steps. a href#refsCSP>CSP/a>li>p>Set the corresponding a href#event-handlers idevent-handler-attributes:event-handlers-10>event handler/a> to an a href#internal-raw-uncompiled-handler idevent-handler-attributes:internal-raw-uncompiled-handler-2>internal raw uncompiled handler/a> consisting of the attributes new value and the script location where the attribute was set to this value/ol> p>When an event handler content attribute is removed, the user agent must set the corresponding a href#event-handlers idevent-handler-attributes:event-handlers-11>event handler/a> to null./p> hr> p>When an a href#event-handlers idevent-handler-attributes:event-handlers-12>event handler/a> var>H/var> of an element or object var>T/var> implementing the code idevent-handler-attributes:eventtarget>a data-x-internaleventtarget hrefhttps://dom.spec.whatwg.org/#interface-eventtarget>EventTarget/a>/code> interface is first set to a non-null value, the user agent must append an a hrefhttps://dom.spec.whatwg.org/#concept-event-listener idevent-handler-attributes:concept-event-listener data-x-internalconcept-event-listener>event listener/a> to the list of a hrefhttps://dom.spec.whatwg.org/#concept-event-listener idevent-handler-attributes:concept-event-listener-2 data-x-internalconcept-event-listener>event listeners/a> associated with var>T/var> with b>type/b> set to the dfn idevent-handler-event-type data-export>event handler event type/dfn> corresponding to var>H/var> and b>callback/b> set to the result of creating a Web IDL code idevent-handler-attributes:dom-eventlistener>a data-x-internaldom-eventlistener hrefhttps://dom.spec.whatwg.org/#callbackdef-eventlistener>EventListener/a>/code> instance representing a reference to a function of one argument that executes the steps of a href#the-event-handler-processing-algorithm idevent-handler-attributes:the-event-handler-processing-algorithm>the event handler processing algorithm/a>, given var>H/var> and its argument. The code idevent-handler-attributes:dom-eventlistener-2>a data-x-internaldom-eventlistener hrefhttps://dom.spec.whatwg.org/#callbackdef-eventlistener>EventListener/a>/code>s a idevent-handler-attributes:callback-context hrefhttps://heycam.github.io/webidl/#dfn-callback-context data-x-internalcallback-context>callback context/a> can be arbitrary; it does not impact the steps of a href#the-event-handler-processing-algorithm idevent-handler-attributes:the-event-handler-processing-algorithm-2>the event handler processing algorithm/a>. a href#refsDOM>DOM/a>/p> p classnote>The b>callback/b> is emphatically em>not/em> the a href#event-handlers idevent-handler-attributes:event-handlers-13>event handler/a> itself. Every event handler ends up registering the same b>callback/b>, the algorithm defined below, which takes care of invoking the right callback, and processing the callbacks return value./p> p classnote>This only happens the first time the a href#event-handlers idevent-handler-attributes:event-handlers-14>event handler/a>s value is set. Since listeners are called in the order they were registered, the order of event listeners for a particular event type will always be first the event listeners registered with code idevent-handler-attributes:dom-eventtarget-addeventlistener>a data-x-internaldom-eventtarget-addeventlistener hrefhttps://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener>addEventListener()/a>/code> before the first time the a href#event-handlers idevent-handler-attributes:event-handlers-15>event handler/a> was set to a non-null value, then the callback to which it is currently set, if any, and finally the event listeners registered with code idevent-handler-attributes:dom-eventtarget-addeventlistener-2>a data-x-internaldom-eventtarget-addeventlistener hrefhttps://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener>addEventListener()/a>/code> em>after/em> the first time the a href#event-handlers idevent-handler-attributes:event-handlers-16>event handler/a> was set to a non-null value./p> div classexample> p>This example demonstrates the order in which event listeners are invoked. If the button in this example is clicked by the user, the page will show four alerts, with the text ONE, TWO, THREE, and FOUR respectively./p> pre><button idtest>Start Demo</button><script> var button document.getElementById(test); button.addEventListener(click, function () { alert(ONE) }, false); button.setAttribute(onclick, alert(NOT CALLED)); // event handler listener is registered here button.addEventListener(click, function () { alert(THREE) }, false); button.onclick function () { alert(TWO); }; button.addEventListener(click, function () { alert(FOUR) }, false);</script>/pre> /div> p classnote>The interfaces implemented by the event object do not influence whether an a href#event-handlers idevent-handler-attributes:event-handlers-17>event handler/a> is triggered or not./p> p>dfn idthe-event-handler-processing-algorithm>The event handler processing algorithm/dfn> for an a href#event-handlers idevent-handler-attributes:event-handlers-18>event handler/a> var>H/var> and an code idevent-handler-attributes:event>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> object var>E/var> is as follows:/p> ol>li> p>Let var>callback/var> be the result of a href#getting-the-current-value-of-the-event-handler idevent-handler-attributes:getting-the-current-value-of-the-event-handler-2>getting the current value of the event handler/a> var>H/var>./p> li>p>If var>callback/var> is null, then abort these steps.li>p>Let var>special error event handling/var> be true if var>E/var> is an code idevent-handler-attributes:errorevent>a href#errorevent>ErrorEvent/a>/code> object, var>E/var>s code idevent-handler-attributes:dom-event-type>a data-x-internaldom-event-type hrefhttps://dom.spec.whatwg.org/#dom-event-type>type/a>/code> is code idevent-handler-attributes:event-error>a href#event-error>error/a>/code>, and var>E/var>s code idevent-handler-attributes:dom-event-currenttarget>a data-x-internaldom-event-currenttarget hrefhttps://dom.spec.whatwg.org/#dom-event-currenttarget>currentTarget/a>/code> implements the code idevent-handler-attributes:windoworworkerglobalscope>a href#windoworworkerglobalscope>WindowOrWorkerGlobalScope/a>/code> mixin. Otherwise, let var>special error event handling/var> be false.li> p>Process the code idevent-handler-attributes:event-2>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> object var>E/var> as follows:/p> dl classswitch>dt>If var>special error event handling/var> is truedd> p>a hrefhttps://heycam.github.io/webidl/#invoke-a-callback-function idevent-handler-attributes:es-invoking-callback-functions data-x-internales-invoking-callback-functions>Invoke/a> var>callback/var> with five arguments, the first one having the value of var>E/var>s code idevent-handler-attributes:dom-errorevent-message>a href#dom-errorevent-message>message/a>/code> attribute, the second having the value of var>E/var>s code idevent-handler-attributes:dom-errorevent-filename>a href#dom-errorevent-filename>filename/a>/code> attribute, the third having the value of var>E/var>s code idevent-handler-attributes:dom-errorevent-lineno>a href#dom-errorevent-lineno>lineno/a>/code> attribute, the fourth having the value of var>E/var>s code idevent-handler-attributes:dom-errorevent-colno>a href#dom-errorevent-colno>colno/a>/code> attribute, the fifth having the value of var>E/var>s code idevent-handler-attributes:dom-errorevent-error>a href#dom-errorevent-error>error/a>/code> attribute, and with the i idevent-handler-attributes:dfn-callback-this-value>a data-x-internaldfn-callback-this-value hrefhttps://heycam.github.io/webidl/#dfn-callback-this-value>callback this value/a>/i> set to var>E/var>s code idevent-handler-attributes:dom-event-currenttarget-2>a data-x-internaldom-event-currenttarget hrefhttps://dom.spec.whatwg.org/#dom-event-currenttarget>currentTarget/a>/code>. Let var>return value/var> be the callbacks return value. a href#refsWEBIDL>WEBIDL/a>/p> dt>Otherwisedd> p>a hrefhttps://heycam.github.io/webidl/#invoke-a-callback-function idevent-handler-attributes:es-invoking-callback-functions-2 data-x-internales-invoking-callback-functions>Invoke/a> var>callback/var> with one argument, the value of which is the code idevent-handler-attributes:event-3>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> object var>E/var>, with the i idevent-handler-attributes:dfn-callback-this-value-2>a data-x-internaldfn-callback-this-value hrefhttps://heycam.github.io/webidl/#dfn-callback-this-value>callback this value/a>/i> set to var>E/var>s code idevent-handler-attributes:dom-event-currenttarget-3>a data-x-internaldom-event-currenttarget hrefhttps://dom.spec.whatwg.org/#dom-event-currenttarget>currentTarget/a>/code>. Let var>return value/var> be the callbacks return value. a href#refsWEBIDL>WEBIDL/a>/p> /dl> p>If an exception gets thrown by the callback, end these steps and allow the exception to propagate. (It will propagate to the a hrefhttps://dom.spec.whatwg.org/#concept-event-dispatch idevent-handler-attributes:concept-event-dispatch data-x-internalconcept-event-dispatch>DOM event dispatch logic/a>, which will then a href#report-the-exception idevent-handler-attributes:report-the-exception>report the exception/a>.)/p> li> p>Process var>return value/var> as follows:/p> dl classswitch>dt>If var>E/var> is a code idevent-handler-attributes:beforeunloadevent>a href#beforeunloadevent>BeforeUnloadEvent/a>/code> object and var>E/var>s code idevent-handler-attributes:dom-event-type-2>a data-x-internaldom-event-type hrefhttps://dom.spec.whatwg.org/#dom-event-type>type/a>/code> is code idevent-handler-attributes:event-beforeunload>a href#event-beforeunload>beforeunload/a>/code>dd> p classnote>In this case, the a href#event-handler-idl-attributes idevent-handler-attributes:event-handler-idl-attributes-5>event handler IDL attribute/a>s type will be code idevent-handler-attributes:onbeforeunloadeventhandler>a href#onbeforeunloadeventhandler>OnBeforeUnloadEventHandler/a>/code>, so var>return value/var> will have been coerced into either null or a code idevent-handler-attributes:idl-domstring>a data-x-internalidl-domstring hrefhttps://heycam.github.io/webidl/#idl-DOMString>DOMString/a>/code>./p> p>If var>return value/var> is not null, then:/p> ol>li>p>Set var>E/var>s a idevent-handler-attributes:canceled-flag hrefhttps://dom.spec.whatwg.org/#canceled-flag data-x-internalcanceled-flag>canceled flag/a>.li>p>If var>E/var>s code idevent-handler-attributes:dom-beforeunloadevent-returnvalue>a href#dom-beforeunloadevent-returnvalue>returnValue/a>/code> attributes value is the empty string, then set var>E/var>s code idevent-handler-attributes:dom-beforeunloadevent-returnvalue-2>a href#dom-beforeunloadevent-returnvalue>returnValue/a>/code> attributes value to var>return value/var>./ol> dt>If var>special error event handling/var> is truedd>p>If var>return value/var> is true, then set var>E/var>s a idevent-handler-attributes:canceled-flag-2 hrefhttps://dom.spec.whatwg.org/#canceled-flag data-x-internalcanceled-flag>canceled flag/a>.dt>Otherwisedd> p>If var>return value/var> is false, then set var>E/var>s a idevent-handler-attributes:canceled-flag-3 hrefhttps://dom.spec.whatwg.org/#canceled-flag data-x-internalcanceled-flag>canceled flag/a>./p> p classnote>If weve gotten to this Otherwise clause because var>E/var>s code idevent-handler-attributes:dom-event-type-3>a data-x-internaldom-event-type hrefhttps://dom.spec.whatwg.org/#dom-event-type>type/a>/code> is code idevent-handler-attributes:event-beforeunload-2>a href#event-beforeunload>beforeunload/a>/code> but var>E/var> is em>not/em> a code idevent-handler-attributes:beforeunloadevent-2>a href#beforeunloadevent>BeforeUnloadEvent/a>/code> object, then var>return value/var> will never be false, since in such cases var>return value/var> will have been coerced into either null or a code idevent-handler-attributes:idl-domstring-2>a data-x-internalidl-domstring hrefhttps://heycam.github.io/webidl/#idl-DOMString>DOMString/a>/code>./p> /dl> /ol> hr> p>The code idevent-handler-attributes:eventhandler-2>a href#eventhandler>EventHandler/a>/code> callback function type represents a callback used for event handlers. It is represented in Web IDL as follows:/p> pre classidl>TreatNonObjectAsNullcallback dfn ideventhandlernonnull>EventHandlerNonNull/dfn> any (a idevent-handler-attributes:event-4 hrefhttps://dom.spec.whatwg.org/#interface-event data-x-internalevent>Event/a> event);typedef a href#eventhandlernonnull idevent-handler-attributes:eventhandlernonnull>EventHandlerNonNull/a>? dfn ideventhandler>EventHandler/dfn>;/pre> p classnote>In JavaScript, any code idevent-handler-attributes:idl-function>a data-x-internalidl-function hrefhttps://heycam.github.io/webidl/#common-Function>Function/a>/code> object implements this interface./p> div classexample> p>For example, the following document fragment:/p> pre><body onloadalert(this) onclickalert(this)>/pre> p>...leads to an alert saying code>object Window/code> when the document is loaded, and an alert saying code>object HTMLBodyElement/code> whenever the user clicks something in the page./p> /div> div classnote> p>The return value of the function affects whether the event is canceled or not: as described above, if the return value is false, the event is canceled./p> p>There are two exceptions in the platform, for historical reasons:/p> ul>li>p>The code idevent-handler-attributes:handler-onerror>a href#handler-onerror>onerror/a>/code> handlers on global objects, where returning em>true/em> cancels the eventli>p>The code idevent-handler-attributes:handler-window-onbeforeunload>a href#handler-window-onbeforeunload>onbeforeunload/a>/code> handler, where returning any non-null and non-undefined value will cancel the event./ul> /div> p>For historical reasons, the code idevent-handler-attributes:handler-onerror-2>a href#handler-onerror>onerror/a>/code> handler has different arguments:/p> pre classidl>TreatNonObjectAsNullcallback dfn idonerroreventhandlernonnull>OnErrorEventHandlerNonNull/dfn> any ((a idevent-handler-attributes:event-5 hrefhttps://dom.spec.whatwg.org/#interface-event data-x-internalevent>Event/a> or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long colno, optional any error);typedef a href#onerroreventhandlernonnull idevent-handler-attributes:onerroreventhandlernonnull>OnErrorEventHandlerNonNull/a>? dfn idonerroreventhandler>OnErrorEventHandler/dfn>;/pre> div classexample> pre>window.onerror (message, source, lineno, colno, error) > { … };/pre> /div> p>Similarly, the code idevent-handler-attributes:handler-window-onbeforeunload-2>a href#handler-window-onbeforeunload>onbeforeunload/a>/code> handler has a different return value:/p> pre classidl>TreatNonObjectAsNullcallback dfn idonbeforeunloadeventhandlernonnull>OnBeforeUnloadEventHandlerNonNull/dfn> DOMString? (a idevent-handler-attributes:event-6 hrefhttps://dom.spec.whatwg.org/#interface-event data-x-internalevent>Event/a> event);typedef a href#onbeforeunloadeventhandlernonnull idevent-handler-attributes:onbeforeunloadeventhandlernonnull>OnBeforeUnloadEventHandlerNonNull/a>? dfn idonbeforeunloadeventhandler>OnBeforeUnloadEventHandler/dfn>;/pre> hr> p>An dfn idinternal-raw-uncompiled-handler>internal raw uncompiled handler/dfn> is a tuple with the following information:/p> ul classbrief>li>An uncompiled script body li>A location where the script body originated, in case an error needs to be reported /ul> p>When the user agent is to dfn idgetting-the-current-value-of-the-event-handler>get the current value of the event handler/dfn> var>H/var>, it must run these steps:/p> ol>li> p>If var>H/var>s value is an a href#internal-raw-uncompiled-handler idevent-handler-attributes:internal-raw-uncompiled-handler-3>internal raw uncompiled handler/a>, run these substeps:/p> ol>li> p>If var>H/var> is an elements a href#event-handlers idevent-handler-attributes:event-handlers-19>event handler/a>, then let var>element/var> be the element, and var>document/var> be the elements a idevent-handler-attributes:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>./p> p>Otherwise, var>H/var> is a code idevent-handler-attributes:window-3>a href#window>Window/a>/code> objects a href#event-handlers idevent-handler-attributes:event-handlers-20>event handler/a>: let var>element/var> be null, and let var>document/var> be var>H/var>s a href#concept-document-window idevent-handler-attributes:concept-document-window>associated code>Document/code>/a>./p> li>p>If a href#concept-n-noscript idevent-handler-attributes:concept-n-noscript>scripting is disabled/a> for var>document/var>, then return null.li>p>Let var>body/var> be the uncompiled script body in the a href#internal-raw-uncompiled-handler idevent-handler-attributes:internal-raw-uncompiled-handler-4>internal raw uncompiled handler/a>.li>p>Let var>location/var> be the location where the script body originated, as given by the a href#internal-raw-uncompiled-handler idevent-handler-attributes:internal-raw-uncompiled-handler-5>internal raw uncompiled handler/a>.li>p>If var>element/var> is not null and var>element/var> has a a href#form-owner idevent-handler-attributes:form-owner>form owner/a>, let var>form owner/var> be that a href#form-owner idevent-handler-attributes:form-owner-2>form owner/a>. Otherwise, let var>form owner/var> be null.li>p>Let var>settings object/var> be the a href#relevant-settings-object idevent-handler-attributes:relevant-settings-object>relevant settings object/a> of var>document/var>.li> p>If var>body/var> is not parsable as i idevent-handler-attributes:js-prod-functionbody-2>a data-x-internaljs-prod-functionbody hrefhttps://tc39.github.io/ecma262/#prod-FunctionBody>FunctionBody/a>/i> or if parsing detects an a idevent-handler-attributes:early-error hrefhttps://tc39.github.io/ecma262/#early-error-rule data-x-internalearly-error>early error/a>, then follow these substeps:/p> ol>li>p>Set var>H/var>s value to null.li>p>a href#report-the-error idevent-handler-attributes:report-the-error>Report the error/a> for the appropriate a href#concept-script idevent-handler-attributes:concept-script>script/a> and with the appropriate position (line number and column number) given by var>location/var>, using var>settings object/var>s a href#concept-settings-object-global idevent-handler-attributes:concept-settings-object-global>global object/a>. If the error is still i idevent-handler-attributes:concept-error-nothandled>a href#concept-error-nothandled>not handled/a>/i> after this, then the error may be reported to a developer console.li>p>Return null./ol> li> p>If var>body/var> begins with a a idevent-handler-attributes:directive-prologue hrefhttps://tc39.github.io/ecma262/#directive-prologue data-x-internaldirective-prologue>Directive Prologue/a> that contains a a idevent-handler-attributes:use-strict-directive hrefhttps://tc39.github.io/ecma262/#use-strict-directive data-x-internaluse-strict-directive>Use Strict Directive/a> then let var>strict/var> be true, otherwise let var>strict/var> be false./p> li> p>Push var>settings object/var>s a href#realm-execution-context idevent-handler-attributes:realm-execution-context>realm execution context/a> onto the a idevent-handler-attributes:javascript-execution-context-stack hrefhttps://tc39.github.io/ecma262/#execution-context-stack data-x-internaljavascript-execution-context-stack>JavaScript execution context stack/a>; it is now the a idevent-handler-attributes:running-javascript-execution-context hrefhttps://tc39.github.io/ecma262/#running-execution-context data-x-internalrunning-javascript-execution-context>running JavaScript execution context/a>./p> p classnote>This is necessary so the subsequent invocation of a hrefhttps://tc39.github.io/ecma262/#sec-functioncreate idevent-handler-attributes:js-functioncreate data-x-internaljs-functioncreate>FunctionCreate/a> takes place in the correct a idevent-handler-attributes:javascript-realm hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript Realm/a>./p> li> p>Let var>function/var> be the result of calling a hrefhttps://tc39.github.io/ecma262/#sec-functioncreate idevent-handler-attributes:js-functioncreate-2 data-x-internaljs-functioncreate>FunctionCreate/a>, with arguments:/p> dl>dt>var>kind/var>dd>Normaldt>var>ParameterList/var>dd> dl classswitch>dt>If var>H/var> is an code idevent-handler-attributes:handler-onerror-3>a href#handler-onerror>onerror/a>/code> a href#event-handlers idevent-handler-attributes:event-handlers-21>event handler/a> of a code idevent-handler-attributes:window-4>a href#window>Window/a>/code> objectdd>Let the function have five arguments, named code>event/code>, code>source/code>, code>lineno/code>, code>colno/code>, and code>error/code>.dt>Otherwisedd>Let the function have a single argument called code>event/code>./dl> dt>var>Body/var>dd>The result of parsing var>body/var> above.dt>var>Scope/var>dd> ol>li> p>If var>H/var> is an elements a href#event-handlers idevent-handler-attributes:event-handlers-22>event handler/a>, then let var>Scope/var> be a hrefhttps://tc39.github.io/ecma262/#sec-newobjectenvironment idevent-handler-attributes:js-newobjectenvironment data-x-internaljs-newobjectenvironment>NewObjectEnvironment/a>(var>document/var>, the var>global environment/var>)./p> p>Otherwise, var>H/var> is a code idevent-handler-attributes:window-5>a href#window>Window/a>/code> objects a href#event-handlers idevent-handler-attributes:event-handlers-23>event handler/a>: let var>Scope/var> be the var>global environment/var>./p> li>p>If var>form owner/var> is not null, let var>Scope/var> be a hrefhttps://tc39.github.io/ecma262/#sec-newobjectenvironment idevent-handler-attributes:js-newobjectenvironment-2 data-x-internaljs-newobjectenvironment>NewObjectEnvironment/a>(var>form owner/var>, var>Scope/var>).li>p>If var>element/var> is not null, let var>Scope/var> be a hrefhttps://tc39.github.io/ecma262/#sec-newobjectenvironment idevent-handler-attributes:js-newobjectenvironment-3 data-x-internaljs-newobjectenvironment>NewObjectEnvironment/a>(var>element/var>, var>Scope/var>)./ol> dt>var>Strict/var>dd>The value of var>strict/var>./dl> li>p>Remove var>settings object/var>s a href#realm-execution-context idevent-handler-attributes:realm-execution-context-2>realm execution context/a> from the a idevent-handler-attributes:javascript-execution-context-stack-2 hrefhttps://tc39.github.io/ecma262/#execution-context-stack data-x-internaljavascript-execution-context-stack>JavaScript execution context stack/a>.li>p>Set var>H/var>s value to the result of creating a Web IDL callback function whose object reference is var>function/var> and whose a idevent-handler-attributes:callback-context-2 hrefhttps://heycam.github.io/webidl/#dfn-callback-context data-x-internalcallback-context>callback context/a> is var>settings object/var>./ol> li>p>Return var>H/var>s value./ol> h5 idevent-handlers-on-elements,-document-objects,-and-window-objects>span classsecno>8.1.5.2/span> Event handlers on elements, code idevent-handlers-on-elements,-document-objects,-and-window-objects:document>a href#document>Document/a>/code> objects, and code idevent-handlers-on-elements,-document-objects,-and-window-objects:window>a href#window>Window/a>/code> objectsa href#event-handlers-on-elements,-document-objects,-and-window-objects classself-link>/a>/h5> p>The following are the a href#event-handlers idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handlers>event handlers/a> (and their corresponding a href#event-handler-event-type idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-event-type>event handler event types/a>) that must be supported by all a href#html-elements idevent-handlers-on-elements,-document-objects,-and-window-objects:html-elements>HTML elements/a>, as both a href#event-handler-content-attributes idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-content-attributes>event handler content attributes/a> and a href#event-handler-idl-attributes idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes>event handler IDL attributes/a>; and that must be supported by all code idevent-handlers-on-elements,-document-objects,-and-window-objects:document-2>a href#document>Document/a>/code> and code idevent-handlers-on-elements,-document-objects,-and-window-objects:window-2>a href#window>Window/a>/code> objects, as a href#event-handler-idl-attributes idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes-2>event handler IDL attributes/a>:/p> table>thead>tr>th>a href#event-handlers idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-2>Event handler/a> th>a href#event-handler-event-type idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-event-type-2>Event handler event type/a> tbody>tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onabort data-dfn-typeattribute data-export>code>onabort/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-abort>a href#event-abort>abort/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onauxclick data-dfn-typeattribute data-export>code>onauxclick/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-auxclick>a data-x-internalevent-auxclick hrefhttps://w3c.github.io/uievents/#event-type-auxclick>auxclick/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-oncancel data-dfn-typeattribute data-export>code>oncancel/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-cancel>a href#event-cancel>cancel/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-oncanplay data-dfn-typeattribute data-export>code>oncanplay/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-canplay>a href#event-media-canplay>canplay/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-oncanplaythrough data-dfn-typeattribute data-export>code>oncanplaythrough/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-canplaythrough>a href#event-media-canplaythrough>canplaythrough/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onchange data-dfn-typeattribute data-export>code>onchange/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-change>a href#event-change>change/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onclick data-dfn-typeattribute data-export>code>onclick/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-click>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onclose data-dfn-typeattribute data-export>code>onclose/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-close>a href#event-close>close/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-oncontextmenu data-dfn-typeattribute data-export>code>oncontextmenu/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-contextmenu>a href#event-contextmenu>contextmenu/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-oncuechange data-dfn-typeattribute data-export>code>oncuechange/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-cuechange>a href#event-media-cuechange>cuechange/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-ondblclick data-dfn-typeattribute data-export>code>ondblclick/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-dblclick>a data-x-internalevent-dblclick hrefhttps://w3c.github.io/uievents/#event-type-dblclick>dblclick/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-ondrag data-dfn-typeattribute data-export>code>ondrag/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-dnd-drag>a href#event-dnd-drag>drag/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-ondragend data-dfn-typeattribute data-export>code>ondragend/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-dnd-dragend>a href#event-dnd-dragend>dragend/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-ondragenter data-dfn-typeattribute data-export>code>ondragenter/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-dnd-dragenter>a href#event-dnd-dragenter>dragenter/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-ondragexit data-dfn-typeattribute data-export>code>ondragexit/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-dnd-dragexit>a href#event-dnd-dragexit>dragexit/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-ondragleave data-dfn-typeattribute data-export>code>ondragleave/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-dnd-dragleave>a href#event-dnd-dragleave>dragleave/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-ondragover data-dfn-typeattribute data-export>code>ondragover/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-dnd-dragover>a href#event-dnd-dragover>dragover/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-ondragstart data-dfn-typeattribute data-export>code>ondragstart/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-dnd-dragstart>a href#event-dnd-dragstart>dragstart/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-ondrop data-dfn-typeattribute data-export>code>ondrop/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-dnd-drop>a href#event-dnd-drop>drop/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-ondurationchange data-dfn-typeattribute data-export>code>ondurationchange/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-durationchange>a href#event-media-durationchange>durationchange/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onemptied data-dfn-typeattribute data-export>code>onemptied/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-emptied>a href#event-media-emptied>emptied/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onended data-dfn-typeattribute data-export>code>onended/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-ended>a href#event-media-ended>ended/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-oninput data-dfn-typeattribute data-export>code>oninput/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-input>a href#event-input>input/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-oninvalid data-dfn-typeattribute data-export>code>oninvalid/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-invalid>a href#event-invalid>invalid/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onkeydown data-dfn-typeattribute data-export>code>onkeydown/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-keydown>a data-x-internalevent-keydown hrefhttps://w3c.github.io/uievents/#event-type-keydown>keydown/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onkeypress data-dfn-typeattribute data-export>code>onkeypress/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-keypress>a data-x-internalevent-keypress hrefhttps://w3c.github.io/uievents/#event-type-keypress>keypress/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onkeyup data-dfn-typeattribute data-export>code>onkeyup/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-keyup>a data-x-internalevent-keyup hrefhttps://w3c.github.io/uievents/#event-type-keyup>keyup/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onloadeddata data-dfn-typeattribute data-export>code>onloadeddata/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-loadeddata>a href#event-media-loadeddata>loadeddata/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onloadedmetadata data-dfn-typeattribute data-export>code>onloadedmetadata/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-loadedmetadata>a href#event-media-loadedmetadata>loadedmetadata/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onloadend data-dfn-typeattribute data-export>code>onloadend/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-loadend>a href#event-loadend>loadend/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onloadstart data-dfn-typeattribute data-export>code>onloadstart/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-loadstart>a href#event-media-loadstart>loadstart/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onmousedown data-dfn-typeattribute data-export>code>onmousedown/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-mousedown>a data-x-internalevent-mousedown hrefhttps://w3c.github.io/uievents/#event-type-mousedown>mousedown/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onmouseenter data-dfn-typeattribute data-export>code>onmouseenter/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-mouseenter>a data-x-internalevent-mouseenter hrefhttps://w3c.github.io/uievents/#event-type-mouseenter>mouseenter/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onmouseleave data-dfn-typeattribute data-export>code>onmouseleave/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-mouseleave>a data-x-internalevent-mouseleave hrefhttps://w3c.github.io/uievents/#event-type-mouseleave>mouseleave/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onmousemove data-dfn-typeattribute data-export>code>onmousemove/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-mousemove>a data-x-internalevent-mousemove hrefhttps://w3c.github.io/uievents/#event-type-mousemove>mousemove/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onmouseout data-dfn-typeattribute data-export>code>onmouseout/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-mouseout>a data-x-internalevent-mouseout hrefhttps://w3c.github.io/uievents/#event-type-mouseout>mouseout/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onmouseover data-dfn-typeattribute data-export>code>onmouseover/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-mouseover>a data-x-internalevent-mouseover hrefhttps://w3c.github.io/uievents/#event-type-mouseover>mouseover/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onmouseup data-dfn-typeattribute data-export>code>onmouseup/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-mouseup>a data-x-internalevent-mouseup hrefhttps://w3c.github.io/uievents/#event-type-mouseup>mouseup/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onwheel data-dfn-typeattribute data-export>code>onwheel/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-wheel>a data-x-internalevent-wheel hrefhttps://w3c.github.io/uievents/#event-type-wheel>wheel/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onpause data-dfn-typeattribute data-export>code>onpause/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-pause>a href#event-media-pause>pause/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onplay data-dfn-typeattribute data-export>code>onplay/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-play>a href#event-media-play>play/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onplaying data-dfn-typeattribute data-export>code>onplaying/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-playing>a href#event-media-playing>playing/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onprogress data-dfn-typeattribute data-export>code>onprogress/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-progress>a href#event-media-progress>progress/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onratechange data-dfn-typeattribute data-export>code>onratechange/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-ratechange>a href#event-media-ratechange>ratechange/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onreset data-dfn-typeattribute data-export>code>onreset/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-reset>a href#event-reset>reset/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onsecuritypolicyviolation data-dfn-typeattribute data-export>code>onsecuritypolicyviolation/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-securitypolicyviolation>a href#event-securitypolicyviolation>securitypolicyviolation/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onseeked data-dfn-typeattribute data-export>code>onseeked/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-seeked>a href#event-media-seeked>seeked/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onseeking data-dfn-typeattribute data-export>code>onseeking/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-seeking>a href#event-media-seeking>seeking/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onselect data-dfn-typeattribute data-export>code>onselect/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-select>a href#event-select>select/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onstalled data-dfn-typeattribute data-export>code>onstalled/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-stalled>a href#event-media-stalled>stalled/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onsubmit data-dfn-typeattribute data-export>code>onsubmit/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-submit>a href#event-submit>submit/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onsuspend data-dfn-typeattribute data-export>code>onsuspend/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-suspend>a href#event-media-suspend>suspend/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-ontimeupdate data-dfn-typeattribute data-export>code>ontimeupdate/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-timeupdate>a href#event-media-timeupdate>timeupdate/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-ontoggle data-dfn-typeattribute data-export>code>ontoggle/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-toggle>a href#event-toggle>toggle/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onvolumechange data-dfn-typeattribute data-export>code>onvolumechange/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-volumechange>a href#event-media-volumechange>volumechange/a>/code> tr>td>dfn data-dfn-forHTMLElement,Document,Window,GlobalEventHandlers idhandler-onwaiting data-dfn-typeattribute data-export>code>onwaiting/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-media-waiting>a href#event-media-waiting>waiting/a>/code> /table> hr> p>The following are the a href#event-handlers idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-3>event handlers/a> (and their corresponding a href#event-handler-event-type idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-event-type-3>event handler event types/a>) that must be supported by all a href#html-elements idevent-handlers-on-elements,-document-objects,-and-window-objects:html-elements-2>HTML elements/a> other than code idevent-handlers-on-elements,-document-objects,-and-window-objects:the-body-element>a href#the-body-element>body/a>/code> and code idevent-handlers-on-elements,-document-objects,-and-window-objects:frameset>a href#frameset>frameset/a>/code> elements, as both a href#event-handler-content-attributes idevent-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 idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes-3>event handler IDL attributes/a>; that must be supported by all code idevent-handlers-on-elements,-document-objects,-and-window-objects:document-3>a href#document>Document/a>/code> objects, as a href#event-handler-idl-attributes idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes-4>event handler IDL attributes/a>; and that must be supported by all code idevent-handlers-on-elements,-document-objects,-and-window-objects:window-3>a href#window>Window/a>/code> objects, as a href#event-handler-idl-attributes idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes-5>event handler IDL attributes/a> on the code idevent-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 idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-content-attributes-3>event handler content attributes/a> and a href#event-handler-idl-attributes idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes-6>event handler IDL attributes/a> exposed on all code idevent-handlers-on-elements,-document-objects,-and-window-objects:the-body-element-2>a href#the-body-element>body/a>/code> and code idevent-handlers-on-elements,-document-objects,-and-window-objects:frameset-2>a href#frameset>frameset/a>/code> elements that are owned by that code idevent-handlers-on-elements,-document-objects,-and-window-objects:window-5>a href#window>Window/a>/code> objects a href#concept-document-window idevent-handlers-on-elements,-document-objects,-and-window-objects:concept-document-window>associated code>Document/code>/a>:/p> table>thead>tr>th>a href#event-handlers idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-4>Event handler/a> th>a href#event-handler-event-type idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-event-type-4>Event handler event type/a> tbody>tr>td>dfn idhandler-onblur>code>onblur/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-blur>a href#event-blur>blur/a>/code> tr>td>dfn idhandler-onerror>code>onerror/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-error>a href#event-error>error/a>/code> tr>td>dfn idhandler-onfocus>code>onfocus/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-focus>a href#event-focus>focus/a>/code> tr>td>dfn idhandler-onload>code>onload/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-load>a href#event-load>load/a>/code> tr>td>dfn idhandler-onresize>code>onresize/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-resize>a data-x-internalevent-resize hrefhttps://drafts.csswg.org/cssom-view/#eventdef-window-resize>resize/a>/code> tr>td>dfn idhandler-onscroll>code>onscroll/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-scroll>a data-x-internalevent-scroll hrefhttps://drafts.csswg.org/cssom-view/#eventdef-document-scroll>scroll/a>/code> /table> hr> p>The following are the a href#event-handlers idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-5>event handlers/a> (and their corresponding a href#event-handler-event-type idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-event-type-5>event handler event types/a>) that must be supported by code idevent-handlers-on-elements,-document-objects,-and-window-objects:window-6>a href#window>Window/a>/code> objects, as a href#event-handler-idl-attributes idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes-7>event handler IDL attributes/a> on the code idevent-handlers-on-elements,-document-objects,-and-window-objects:window-7>a href#window>Window/a>/code> objects themselves, and with corresponding a href#event-handler-content-attributes idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-content-attributes-4>event handler content attributes/a> and a href#event-handler-idl-attributes idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes-8>event handler IDL attributes/a> exposed on all code idevent-handlers-on-elements,-document-objects,-and-window-objects:the-body-element-3>a href#the-body-element>body/a>/code> and code idevent-handlers-on-elements,-document-objects,-and-window-objects:frameset-3>a href#frameset>frameset/a>/code> elements that are owned by that code idevent-handlers-on-elements,-document-objects,-and-window-objects:window-8>a href#window>Window/a>/code> objects a href#concept-document-window idevent-handlers-on-elements,-document-objects,-and-window-objects:concept-document-window-2>associated code>Document/code>/a>:/p> table>thead>tr>th>a href#event-handlers idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-6>Event handler/a> th>a href#event-handler-event-type idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-event-type-6>Event handler event type/a> tbody>tr>td>dfn idhandler-window-onafterprint>code>onafterprint/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-afterprint>a href#event-afterprint>afterprint/a>/code> tr>td>dfn idhandler-window-onbeforeprint>code>onbeforeprint/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-beforeprint>a href#event-beforeprint>beforeprint/a>/code> tr>td>dfn idhandler-window-onbeforeunload>code>onbeforeunload/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-beforeunload>a href#event-beforeunload>beforeunload/a>/code> tr>td>dfn idhandler-window-onhashchange>code>onhashchange/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-hashchange>a href#event-hashchange>hashchange/a>/code> tr>td>dfn idhandler-window-onlanguagechange>code>onlanguagechange/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-languagechange>a href#event-languagechange>languagechange/a>/code> tr>td>dfn idhandler-window-onmessage>code>onmessage/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-message>a href#event-message>message/a>/code> tr>td>dfn idhandler-window-onmessageerror>code>onmessageerror/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-messageerror>a href#event-messageerror>messageerror/a>/code> tr>td>dfn idhandler-window-onoffline>code>onoffline/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-offline>a href#event-offline>offline/a>/code> tr>td>dfn idhandler-window-ononline>code>ononline/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-online>a href#event-online>online/a>/code> tr>td>dfn idhandler-window-onpagehide>code>onpagehide/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-pagehide>a href#event-pagehide>pagehide/a>/code> tr>td>dfn idhandler-window-onpageshow>code>onpageshow/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-pageshow>a href#event-pageshow>pageshow/a>/code> tr>td>dfn idhandler-window-onpopstate>code>onpopstate/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-popstate>a href#event-popstate>popstate/a>/code> tr>td>dfn idhandler-window-onrejectionhandled>code>onrejectionhandled/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-rejectionhandled>a href#event-rejectionhandled>rejectionhandled/a>/code> tr>td>dfn idhandler-window-onstorage>code>onstorage/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-storage>a href#event-storage>storage/a>/code> tr>td>dfn idhandler-window-onunhandledrejection>code>onunhandledrejection/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-unhandledrejection>a href#event-unhandledrejection>unhandledrejection/a>/code> tr>td>dfn idhandler-window-onunload>code>onunload/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-unload>a href#event-unload>unload/a>/code> /table> hr> p>The following are the a href#event-handlers idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-7>event handlers/a> (and their corresponding a href#event-handler-event-type idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-event-type-7>event handler event types/a>) that must be supported by all a href#html-elements idevent-handlers-on-elements,-document-objects,-and-window-objects:html-elements-3>HTML elements/a>, as both a href#event-handler-content-attributes idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-content-attributes-5>event handler content attributes/a> and a href#event-handler-idl-attributes idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes-9>event handler IDL attributes/a>; and that must be supported by all code idevent-handlers-on-elements,-document-objects,-and-window-objects:document-4>a href#document>Document/a>/code> objects, as a href#event-handler-idl-attributes idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes-10>event handler IDL attributes/a>:/p> table>thead>tr>th>a href#event-handlers idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-8>Event handler/a> th>a href#event-handler-event-type idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-event-type-8>Event handler event type/a> tbody>tr>td>dfn idhandler-oncut>code>oncut/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-cut>a href#event-cut>cut/a>/code> tr>td>dfn idhandler-oncopy>code>oncopy/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-copy>a href#event-copy>copy/a>/code> tr>td>dfn idhandler-onpaste>code>onpaste/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-paste>a href#event-paste>paste/a>/code> /table> hr> p>The following are the a href#event-handlers idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-9>event handlers/a> (and their corresponding a href#event-handler-event-type idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-event-type-9>event handler event types/a>) that must be supported on code idevent-handlers-on-elements,-document-objects,-and-window-objects:document-5>a href#document>Document/a>/code> objects as a href#event-handler-idl-attributes idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes-11>event handler IDL attributes/a>:/p> table>thead>tr>th>a href#event-handlers idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-10>Event handler/a> th>a href#event-handler-event-type idevent-handlers-on-elements,-document-objects,-and-window-objects:event-handler-event-type-10>Event handler event type/a> tbody>tr>td>dfn data-dfn-forDocument idhandler-onreadystatechange data-dfn-typeattribute data-export>code>onreadystatechange/code>/dfn> td> code idevent-handlers-on-elements,-document-objects,-and-window-objects:event-readystatechange>a href#event-readystatechange>readystatechange/a>/code> /table> h6 ididl-definitions>span classsecno>8.1.5.2.1/span> IDL definitionsa href#idl-definitions classself-link>/a>/h6> pre classidl>ExposedWindow, NoInterfaceObjectinterface dfn idglobaleventhandlers>GlobalEventHandlers/dfn> { attribute a href#eventhandler ididl-definitions:eventhandler>EventHandler/a> a href#handler-onabort ididl-definitions:handler-onabort>onabort/a>; attribute a href#eventhandler ididl-definitions:eventhandler-2>EventHandler/a> a href#handler-onauxclick ididl-definitions:handler-onauxclick>onauxclick/a>; attribute a href#eventhandler ididl-definitions:eventhandler-3>EventHandler/a> a href#handler-onblur ididl-definitions:handler-onblur>onblur/a>; attribute a href#eventhandler ididl-definitions:eventhandler-4>EventHandler/a> a href#handler-oncancel ididl-definitions:handler-oncancel>oncancel/a>; attribute a href#eventhandler ididl-definitions:eventhandler-5>EventHandler/a> a href#handler-oncanplay ididl-definitions:handler-oncanplay>oncanplay/a>; attribute a href#eventhandler ididl-definitions:eventhandler-6>EventHandler/a> a href#handler-oncanplaythrough ididl-definitions:handler-oncanplaythrough>oncanplaythrough/a>; attribute a href#eventhandler ididl-definitions:eventhandler-7>EventHandler/a> a href#handler-onchange ididl-definitions:handler-onchange>onchange/a>; attribute a href#eventhandler ididl-definitions:eventhandler-8>EventHandler/a> a href#handler-onclick ididl-definitions:handler-onclick>onclick/a>; attribute a href#eventhandler ididl-definitions:eventhandler-9>EventHandler/a> a href#handler-onclose ididl-definitions:handler-onclose>onclose/a>; attribute a href#eventhandler ididl-definitions:eventhandler-10>EventHandler/a> a href#handler-oncontextmenu ididl-definitions:handler-oncontextmenu>oncontextmenu/a>; attribute a href#eventhandler ididl-definitions:eventhandler-11>EventHandler/a> a href#handler-oncuechange ididl-definitions:handler-oncuechange>oncuechange/a>; attribute a href#eventhandler ididl-definitions:eventhandler-12>EventHandler/a> a href#handler-ondblclick ididl-definitions:handler-ondblclick>ondblclick/a>; attribute a href#eventhandler ididl-definitions:eventhandler-13>EventHandler/a> a href#handler-ondrag ididl-definitions:handler-ondrag>ondrag/a>; attribute a href#eventhandler ididl-definitions:eventhandler-14>EventHandler/a> a href#handler-ondragend ididl-definitions:handler-ondragend>ondragend/a>; attribute a href#eventhandler ididl-definitions:eventhandler-15>EventHandler/a> a href#handler-ondragenter ididl-definitions:handler-ondragenter>ondragenter/a>; attribute a href#eventhandler ididl-definitions:eventhandler-16>EventHandler/a> a href#handler-ondragexit ididl-definitions:handler-ondragexit>ondragexit/a>; attribute a href#eventhandler ididl-definitions:eventhandler-17>EventHandler/a> a href#handler-ondragleave ididl-definitions:handler-ondragleave>ondragleave/a>; attribute a href#eventhandler ididl-definitions:eventhandler-18>EventHandler/a> a href#handler-ondragover ididl-definitions:handler-ondragover>ondragover/a>; attribute a href#eventhandler ididl-definitions:eventhandler-19>EventHandler/a> a href#handler-ondragstart ididl-definitions:handler-ondragstart>ondragstart/a>; attribute a href#eventhandler ididl-definitions:eventhandler-20>EventHandler/a> a href#handler-ondrop ididl-definitions:handler-ondrop>ondrop/a>; attribute a href#eventhandler ididl-definitions:eventhandler-21>EventHandler/a> a href#handler-ondurationchange ididl-definitions:handler-ondurationchange>ondurationchange/a>; attribute a href#eventhandler ididl-definitions:eventhandler-22>EventHandler/a> a href#handler-onemptied ididl-definitions:handler-onemptied>onemptied/a>; attribute a href#eventhandler ididl-definitions:eventhandler-23>EventHandler/a> a href#handler-onended ididl-definitions:handler-onended>onended/a>; attribute a href#onerroreventhandler ididl-definitions:onerroreventhandler>OnErrorEventHandler/a> a href#handler-onerror ididl-definitions:handler-onerror>onerror/a>; attribute a href#eventhandler ididl-definitions:eventhandler-24>EventHandler/a> a href#handler-onfocus ididl-definitions:handler-onfocus>onfocus/a>; attribute a href#eventhandler ididl-definitions:eventhandler-25>EventHandler/a> a href#handler-oninput ididl-definitions:handler-oninput>oninput/a>; attribute a href#eventhandler ididl-definitions:eventhandler-26>EventHandler/a> a href#handler-oninvalid ididl-definitions:handler-oninvalid>oninvalid/a>; attribute a href#eventhandler ididl-definitions:eventhandler-27>EventHandler/a> a href#handler-onkeydown ididl-definitions:handler-onkeydown>onkeydown/a>; attribute a href#eventhandler ididl-definitions:eventhandler-28>EventHandler/a> a href#handler-onkeypress ididl-definitions:handler-onkeypress>onkeypress/a>; attribute a href#eventhandler ididl-definitions:eventhandler-29>EventHandler/a> a href#handler-onkeyup ididl-definitions:handler-onkeyup>onkeyup/a>; attribute a href#eventhandler ididl-definitions:eventhandler-30>EventHandler/a> a href#handler-onload ididl-definitions:handler-onload>onload/a>; attribute a href#eventhandler ididl-definitions:eventhandler-31>EventHandler/a> a href#handler-onloadeddata ididl-definitions:handler-onloadeddata>onloadeddata/a>; attribute a href#eventhandler ididl-definitions:eventhandler-32>EventHandler/a> a href#handler-onloadedmetadata ididl-definitions:handler-onloadedmetadata>onloadedmetadata/a>; attribute a href#eventhandler ididl-definitions:eventhandler-33>EventHandler/a> a href#handler-onloadend ididl-definitions:handler-onloadend>onloadend/a>; attribute a href#eventhandler ididl-definitions:eventhandler-34>EventHandler/a> a href#handler-onloadstart ididl-definitions:handler-onloadstart>onloadstart/a>; attribute a href#eventhandler ididl-definitions:eventhandler-35>EventHandler/a> a href#handler-onmousedown ididl-definitions:handler-onmousedown>onmousedown/a>; LenientThis attribute a href#eventhandler ididl-definitions:eventhandler-36>EventHandler/a> a href#handler-onmouseenter ididl-definitions:handler-onmouseenter>onmouseenter/a>; LenientThis attribute a href#eventhandler ididl-definitions:eventhandler-37>EventHandler/a> a href#handler-onmouseleave ididl-definitions:handler-onmouseleave>onmouseleave/a>; attribute a href#eventhandler ididl-definitions:eventhandler-38>EventHandler/a> a href#handler-onmousemove ididl-definitions:handler-onmousemove>onmousemove/a>; attribute a href#eventhandler ididl-definitions:eventhandler-39>EventHandler/a> a href#handler-onmouseout ididl-definitions:handler-onmouseout>onmouseout/a>; attribute a href#eventhandler ididl-definitions:eventhandler-40>EventHandler/a> a href#handler-onmouseover ididl-definitions:handler-onmouseover>onmouseover/a>; attribute a href#eventhandler ididl-definitions:eventhandler-41>EventHandler/a> a href#handler-onmouseup ididl-definitions:handler-onmouseup>onmouseup/a>; attribute a href#eventhandler ididl-definitions:eventhandler-42>EventHandler/a> a href#handler-onwheel ididl-definitions:handler-onwheel>onwheel/a>; attribute a href#eventhandler ididl-definitions:eventhandler-43>EventHandler/a> a href#handler-onpause ididl-definitions:handler-onpause>onpause/a>; attribute a href#eventhandler ididl-definitions:eventhandler-44>EventHandler/a> a href#handler-onplay ididl-definitions:handler-onplay>onplay/a>; attribute a href#eventhandler ididl-definitions:eventhandler-45>EventHandler/a> a href#handler-onplaying ididl-definitions:handler-onplaying>onplaying/a>; attribute a href#eventhandler ididl-definitions:eventhandler-46>EventHandler/a> a href#handler-onprogress ididl-definitions:handler-onprogress>onprogress/a>; attribute a href#eventhandler ididl-definitions:eventhandler-47>EventHandler/a> a href#handler-onratechange ididl-definitions:handler-onratechange>onratechange/a>; attribute a href#eventhandler ididl-definitions:eventhandler-48>EventHandler/a> a href#handler-onreset ididl-definitions:handler-onreset>onreset/a>; attribute a href#eventhandler ididl-definitions:eventhandler-49>EventHandler/a> a href#handler-onresize ididl-definitions:handler-onresize>onresize/a>; attribute a href#eventhandler ididl-definitions:eventhandler-50>EventHandler/a> a href#handler-onscroll ididl-definitions:handler-onscroll>onscroll/a>; attribute a href#eventhandler ididl-definitions:eventhandler-51>EventHandler/a> a href#handler-onsecuritypolicyviolation ididl-definitions:handler-onsecuritypolicyviolation>onsecuritypolicyviolation/a>; attribute a href#eventhandler ididl-definitions:eventhandler-52>EventHandler/a> a href#handler-onseeked ididl-definitions:handler-onseeked>onseeked/a>; attribute a href#eventhandler ididl-definitions:eventhandler-53>EventHandler/a> a href#handler-onseeking ididl-definitions:handler-onseeking>onseeking/a>; attribute a href#eventhandler ididl-definitions:eventhandler-54>EventHandler/a> a href#handler-onselect ididl-definitions:handler-onselect>onselect/a>; attribute a href#eventhandler ididl-definitions:eventhandler-55>EventHandler/a> a href#handler-onstalled ididl-definitions:handler-onstalled>onstalled/a>; attribute a href#eventhandler ididl-definitions:eventhandler-56>EventHandler/a> a href#handler-onsubmit ididl-definitions:handler-onsubmit>onsubmit/a>; attribute a href#eventhandler ididl-definitions:eventhandler-57>EventHandler/a> a href#handler-onsuspend ididl-definitions:handler-onsuspend>onsuspend/a>; attribute a href#eventhandler ididl-definitions:eventhandler-58>EventHandler/a> a href#handler-ontimeupdate ididl-definitions:handler-ontimeupdate>ontimeupdate/a>; attribute a href#eventhandler ididl-definitions:eventhandler-59>EventHandler/a> a href#handler-ontoggle ididl-definitions:handler-ontoggle>ontoggle/a>; attribute a href#eventhandler ididl-definitions:eventhandler-60>EventHandler/a> a href#handler-onvolumechange ididl-definitions:handler-onvolumechange>onvolumechange/a>; attribute a href#eventhandler ididl-definitions:eventhandler-61>EventHandler/a> a href#handler-onwaiting ididl-definitions:handler-onwaiting>onwaiting/a>;};ExposedWindow, NoInterfaceObjectinterface dfn idwindoweventhandlers>WindowEventHandlers/dfn> { attribute a href#eventhandler ididl-definitions:eventhandler-62>EventHandler/a> a href#handler-window-onafterprint ididl-definitions:handler-window-onafterprint>onafterprint/a>; attribute a href#eventhandler ididl-definitions:eventhandler-63>EventHandler/a> a href#handler-window-onbeforeprint ididl-definitions:handler-window-onbeforeprint>onbeforeprint/a>; attribute a href#onbeforeunloadeventhandler ididl-definitions:onbeforeunloadeventhandler>OnBeforeUnloadEventHandler/a> a href#handler-window-onbeforeunload ididl-definitions:handler-window-onbeforeunload>onbeforeunload/a>; attribute a href#eventhandler ididl-definitions:eventhandler-64>EventHandler/a> a href#handler-window-onhashchange ididl-definitions:handler-window-onhashchange>onhashchange/a>; attribute a href#eventhandler ididl-definitions:eventhandler-65>EventHandler/a> a href#handler-window-onlanguagechange ididl-definitions:handler-window-onlanguagechange>onlanguagechange/a>; attribute a href#eventhandler ididl-definitions:eventhandler-66>EventHandler/a> a href#handler-window-onmessage ididl-definitions:handler-window-onmessage>onmessage/a>; attribute a href#eventhandler ididl-definitions:eventhandler-67>EventHandler/a> a href#handler-window-onmessageerror ididl-definitions:handler-window-onmessageerror>onmessageerror/a>; attribute a href#eventhandler ididl-definitions:eventhandler-68>EventHandler/a> a href#handler-window-onoffline ididl-definitions:handler-window-onoffline>onoffline/a>; attribute a href#eventhandler ididl-definitions:eventhandler-69>EventHandler/a> a href#handler-window-ononline ididl-definitions:handler-window-ononline>ononline/a>; attribute a href#eventhandler ididl-definitions:eventhandler-70>EventHandler/a> a href#handler-window-onpagehide ididl-definitions:handler-window-onpagehide>onpagehide/a>; attribute a href#eventhandler ididl-definitions:eventhandler-71>EventHandler/a> a href#handler-window-onpageshow ididl-definitions:handler-window-onpageshow>onpageshow/a>; attribute a href#eventhandler ididl-definitions:eventhandler-72>EventHandler/a> a href#handler-window-onpopstate ididl-definitions:handler-window-onpopstate>onpopstate/a>; attribute a href#eventhandler ididl-definitions:eventhandler-73>EventHandler/a> a href#handler-window-onrejectionhandled ididl-definitions:handler-window-onrejectionhandled>onrejectionhandled/a>; attribute a href#eventhandler ididl-definitions:eventhandler-74>EventHandler/a> a href#handler-window-onstorage ididl-definitions:handler-window-onstorage>onstorage/a>; attribute a href#eventhandler ididl-definitions:eventhandler-75>EventHandler/a> a href#handler-window-onunhandledrejection ididl-definitions:handler-window-onunhandledrejection>onunhandledrejection/a>; attribute a href#eventhandler ididl-definitions:eventhandler-76>EventHandler/a> a href#handler-window-onunload ididl-definitions:handler-window-onunload>onunload/a>;};ExposedWindow, NoInterfaceObjectinterface dfn iddocumentandelementeventhandlers>DocumentAndElementEventHandlers/dfn> { attribute a href#eventhandler ididl-definitions:eventhandler-77>EventHandler/a> a href#handler-oncopy ididl-definitions:handler-oncopy>oncopy/a>; attribute a href#eventhandler ididl-definitions:eventhandler-78>EventHandler/a> a href#handler-oncut ididl-definitions:handler-oncut>oncut/a>; attribute a href#eventhandler ididl-definitions:eventhandler-79>EventHandler/a> a href#handler-onpaste ididl-definitions:handler-onpaste>onpaste/a>;};/pre> h5 idevent-firing>span classsecno>8.1.5.3/span> Event firinga href#event-firing classself-link>/a>/h5> p>Certain operations and methods are defined as firing events on elements. For example, the code idevent-firing:dom-click>a href#dom-click>click()/a>/code> method on the code idevent-firing:htmlelement>a href#htmlelement>HTMLElement/a>/code> interface is defined as firing a code idevent-firing:event-click>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> event on the element. a href#refsUIEVENTS>UIEVENTS/a>/p> p>dfn idfire-a-synthetic-mouse-event>Firing a synthetic mouse event named var>e/var>/dfn> at var>target/var>, with an optional var>not trusted flag/var>, means running these steps:/p> ol>li>p>Let var>event/var> be the result of a idevent-firing:creating-an-event hrefhttps://dom.spec.whatwg.org/#concept-event-create data-x-internalcreating-an-event>creating an event/a> using code idevent-firing:mouseevent>a data-x-internalmouseevent hrefhttps://w3c.github.io/uievents/#mouseevent>MouseEvent/a>/code>.li>p>Initialize var>event/var>s code idevent-firing:dom-event-type>a data-x-internaldom-event-type hrefhttps://dom.spec.whatwg.org/#dom-event-type>type/a>/code> attribute to var>e/var>.li>p>Initialize var>event/var>s code idevent-firing:dom-event-bubbles>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> and code idevent-firing:dom-event-cancelable>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attributes to true.li>p>Set var>event/var>s a idevent-firing:composed-flag hrefhttps://dom.spec.whatwg.org/#composed-flag data-x-internalcomposed-flag>composed flag/a>.li>p>If the var>not trusted flag/var> is set, initialize var>event/var>s code idevent-firing:dom-event-istrusted>a data-x-internaldom-event-istrusted hrefhttps://dom.spec.whatwg.org/#dom-event-istrusted>isTrusted/a>/code> attribute to false.li>p>Initialize var>event/var>s code>ctrlKey/code>, code>shiftKey/code>, code>altKey/code>, and code>metaKey/code> attributes according to the current state of the key input device, if any (false for any keys that are not available).li>p>Initialize var>event/var>s code idevent-firing:dom-uievent-view>a data-x-internaldom-uievent-view hrefhttps://w3c.github.io/uievents/#dom-uievent-view>view/a>/code> attribute to var>target/var>s a idevent-firing:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s code idevent-firing:window>a href#window>Window/a>/code> object, if any, and null otherwise.li>p>var>event/var>s code>getModifierState()/code> method is to return values appropriately describing the current state of the key input device.li>p>Return the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-dispatch idevent-firing:concept-event-dispatch data-x-internalconcept-event-dispatch>dispatching/a> var>event/var> at var>target/var>./ol> p>dfn idfire-a-click-event>Firing a code>click/code> event/dfn> at var>target/var> means a href#fire-a-synthetic-mouse-event idevent-firing:fire-a-synthetic-mouse-event>firing a synthetic mouse event named code>click/code>/a> at var>target/var>./p> h3 idwindoworworkerglobalscope-mixin>span classsecno>8.2/span> The code idwindoworworkerglobalscope-mixin:windoworworkerglobalscope>a href#windoworworkerglobalscope>WindowOrWorkerGlobalScope/a>/code> mixina href#windoworworkerglobalscope-mixin classself-link>/a>/h3> p>The code idwindoworworkerglobalscope-mixin:windoworworkerglobalscope-2>a href#windoworworkerglobalscope>WindowOrWorkerGlobalScope/a>/code> mixin is for use of APIs that are to be exposed on code idwindoworworkerglobalscope-mixin:window>a href#window>Window/a>/code> and code idwindoworworkerglobalscope-mixin:workerglobalscope>a href#workerglobalscope>WorkerGlobalScope/a>/code> objects./p> p classnote>Other standards are encouraged to further extend it using code>partial interface a href#windoworworkerglobalscope idwindoworworkerglobalscope-mixin:windoworworkerglobalscope-3>WindowOrWorkerGlobalScope/a> { … };/code> along with an appropriate reference./p> pre classidl>typedef (DOMString or a hrefhttps://heycam.github.io/webidl/#common-Function idwindoworworkerglobalscope-mixin:idl-function data-x-internalidl-function>Function/a>) dfn idtimerhandler>TimerHandler/dfn>;NoInterfaceObject, Exposed(Window,Worker)interface dfn idwindoworworkerglobalscope>WindowOrWorkerGlobalScope/dfn> { Replaceable readonly attribute USVString a href#dom-origin idwindoworworkerglobalscope-mixin:dom-origin>origin/a>; // base64 utility methods DOMString a href#dom-btoa idwindoworworkerglobalscope-mixin:dom-btoa>btoa/a>(DOMString data); ByteString a href#dom-atob idwindoworworkerglobalscope-mixin:dom-atob>atob/a>(DOMString data); // timers long a href#dom-settimeout idwindoworworkerglobalscope-mixin:dom-settimeout>setTimeout/a>(a href#timerhandler idwindoworworkerglobalscope-mixin:timerhandler>TimerHandler/a> handler, optional long timeout 0, any... arguments); void a href#dom-cleartimeout idwindoworworkerglobalscope-mixin:dom-cleartimeout>clearTimeout/a>(optional long handle 0); long a href#dom-setinterval idwindoworworkerglobalscope-mixin:dom-setinterval>setInterval/a>(a href#timerhandler idwindoworworkerglobalscope-mixin:timerhandler-2>TimerHandler/a> handler, optional long timeout 0, any... arguments); void a href#dom-clearinterval idwindoworworkerglobalscope-mixin:dom-clearinterval>clearInterval/a>(optional long handle 0); // ImageBitmap Promise<a href#imagebitmap idwindoworworkerglobalscope-mixin:imagebitmap>ImageBitmap/a>> a href#dom-createimagebitmap idwindoworworkerglobalscope-mixin:dom-createimagebitmap>createImageBitmap/a>(a href#imagebitmapsource idwindoworworkerglobalscope-mixin:imagebitmapsource>ImageBitmapSource/a> image, optional a href#imagebitmapoptions idwindoworworkerglobalscope-mixin:imagebitmapoptions>ImageBitmapOptions/a> options); Promise<a href#imagebitmap idwindoworworkerglobalscope-mixin:imagebitmap-2>ImageBitmap/a>> a href#dom-createimagebitmap idwindoworworkerglobalscope-mixin:dom-createimagebitmap-2>createImageBitmap/a>(a href#imagebitmapsource idwindoworworkerglobalscope-mixin:imagebitmapsource-2>ImageBitmapSource/a> image, long sx, long sy, long sw, long sh, optional a href#imagebitmapoptions idwindoworworkerglobalscope-mixin:imagebitmapoptions-2>ImageBitmapOptions/a> options);};a href#window idwindoworworkerglobalscope-mixin:window-2>Window/a> implements a href#windoworworkerglobalscope idwindoworworkerglobalscope-mixin:windoworworkerglobalscope-4>WindowOrWorkerGlobalScope/a>;a href#workerglobalscope idwindoworworkerglobalscope-mixin:workerglobalscope-2>WorkerGlobalScope/a> implements a href#windoworworkerglobalscope idwindoworworkerglobalscope-mixin:windoworworkerglobalscope-5>WindowOrWorkerGlobalScope/a>;/pre> dl classdomintro>dt>var>origin/var> self . code idwindoworworkerglobalscope-mixin:dom-origin-2>a href#dom-origin>origin/a>/code>dd>p>Returns the global objects a href#concept-origin idwindoworworkerglobalscope-mixin:concept-origin>origin/a>, serialized as string./dl> div classexample> p>Developers are strongly encouraged to use code>self.origin/code> over code>location.origin/code>. The former returns the a href#concept-origin idwindoworworkerglobalscope-mixin:concept-origin-2>origin/a> of the environment, the latter of the URL of the environment. Imagine the following script executing in a document on code>https://stargate.example//code>:/p> pre>var frame document.createElement(iframe)frame.onload function() { var frameWin frame.contentWindow console.log(frameWin.location.origin) // null console.log(frameWin.origin) // https://stargate.example}document.body.appendChild(frame)/pre> p>code>self.origin/code> is a more reliable security indicator./p> /div> p>The dfn iddom-origin>code>origin/code>/dfn> attributes getter must return this objects a href#relevant-settings-object idwindoworworkerglobalscope-mixin:relevant-settings-object>relevant settings object/a>s a href#concept-settings-object-origin idwindoworworkerglobalscope-mixin:concept-settings-object-origin>origin/a>, a href#ascii-serialisation-of-an-origin idwindoworworkerglobalscope-mixin:ascii-serialisation-of-an-origin>serialized/a>./p> h3 idatob>span classsecno>8.3/span> Base64 utility methodsa href#atob classself-link>/a>/h3>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> atob-btoaspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>3.2+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>2+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>3.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.1+/span>/span>span classopera yes>span>Opera/span> span>10.6+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featatob-btoa>caniuse.com/a>/div> p>The code idatob:dom-atob>a href#dom-atob>atob()/a>/code> and code idatob:dom-btoa>a href#dom-btoa>btoa()/a>/code> methods allow developers to transform content to and from the base64 encoding./p> p classnote>In these APIs, for mnemonic purposes, the b can be considered to stand for binary, and the a for ASCII. In practice, though, for primarily historical reasons, both the input and output of these functions are Unicode strings./p> dl classdomintro>dt>var>result/var> self . code idatob:dom-btoa-2>a href#dom-btoa>btoa/a>/code>( var>data/var> )dd> p>Takes the input data, in the form of a Unicode string containing only characters in the range U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF respectively, and converts it to its base64 representation, which it returns./p> p>Throws an a idatob:invalidcharactererror hrefhttps://heycam.github.io/webidl/#invalidcharactererror data-x-internalinvalidcharactererror>code>InvalidCharacterError/code>/a> code idatob:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> exception if the input string contains any out-of-range characters./p> dt>var>result/var> self . code idatob:dom-atob-2>a href#dom-atob>atob/a>/code>( var>data/var> )dd> p>Takes the input data, in the form of a Unicode string containing base64-encoded binary data, decodes it, and returns a string consisting of characters in the range U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF respectively, corresponding to that binary data./p> p>Throws an a idatob:invalidcharactererror-2 hrefhttps://heycam.github.io/webidl/#invalidcharactererror data-x-internalinvalidcharactererror>code>InvalidCharacterError/code>/a> code idatob:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the input string is not valid base64 data./p> /dl> p>The dfn iddom-btoa>code iddom-windowbase64-btoa>btoa(var>data/var>)/code>/dfn> method must throw an a idatob:invalidcharactererror-3 hrefhttps://heycam.github.io/webidl/#invalidcharactererror data-x-internalinvalidcharactererror>code>InvalidCharacterError/code>/a> code idatob:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if var>data/var> contains any character whose code point is greater than U+00FF. Otherwise, the user agent must convert var>data/var> to a byte sequence whose var>n/var>th byte is the eight-bit representation of the var>n/var>th code point of var>data/var>, and then must apply a idatob:forgiving-base64-encode hrefhttps://infra.spec.whatwg.org/#forgiving-base64-encode data-x-internalforgiving-base64-encode>forgiving-base64 encode/a> to that byte sequence and return the result./p> p>The dfn iddom-atob>code iddom-windowbase64-atob>atob(var>data/var>)/code>/dfn> method, when invoked, must run the following steps:/p> ol>li>p>Let var>decodedData/var> be the result of running a idatob:forgiving-base64-decode hrefhttps://infra.spec.whatwg.org/#forgiving-base64-decode data-x-internalforgiving-base64-decode>forgiving-base64 decode/a> on var>data/var>.li>p>If var>decodedData/var> is failure, then throw an a idatob:invalidcharactererror-4 hrefhttps://heycam.github.io/webidl/#invalidcharactererror data-x-internalinvalidcharactererror>code>InvalidCharacterError/code>/a> code idatob:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Return var>decodedData/var>./ol> h3 iddynamic-markup-insertion>span classsecno>8.4/span> dfn>Dynamic markup insertion/dfn>a href#dynamic-markup-insertion classself-link>/a>/h3> p classnote>APIs for dynamically inserting markup into the document interact with the parser, and thus their behavior varies depending on whether they are used with a iddynamic-markup-insertion:html-documents hrefhttps://dom.spec.whatwg.org/#html-document data-x-internalhtml-documents>HTML documents/a> (and the a href#html-parser iddynamic-markup-insertion:html-parser>HTML parser/a>) or a iddynamic-markup-insertion:xml-documents hrefhttps://dom.spec.whatwg.org/#xml-document data-x-internalxml-documents>XML documents/a> (and the a href#xml-parser iddynamic-markup-insertion:xml-parser>XML parser/a>)./p> p>code iddynamic-markup-insertion:document>a href#document>Document/a>/code> objects have a dfn idthrow-on-dynamic-markup-insertion-counter>throw-on-dynamic-markup-insertion counter/dfn>, which is used in conjunction with the a href#create-an-element-for-the-token iddynamic-markup-insertion:create-an-element-for-the-token>create an element for the token/a> algorithm to prevent a href#custom-element-constructor iddynamic-markup-insertion:custom-element-constructor>custom element constructors/a> from being able to use code iddynamic-markup-insertion:dom-document-open>a href#dom-document-open>document.open()/a>/code>, code iddynamic-markup-insertion:dom-document-close>a href#dom-document-close>document.close()/a>/code>, and code iddynamic-markup-insertion:dom-document-write>a href#dom-document-write>document.write()/a>/code> when they are invoked by the parser. Initially, the counter must be set to zero./p> h4 idopening-the-input-stream>span classsecno>8.4.1/span> Opening the input streama href#opening-the-input-stream classself-link>/a>/h4> p>The dfn iddom-document-open>code>open()/code>/dfn> method comes in several variants with different numbers of arguments./p> dl classdomintro>dt>var>document/var> var>document/var> . code idopening-the-input-stream:dom-document-open>a href#dom-document-open>open/a>/code>( var>type/var> , var>replace/var> )dd> p>Causes the code idopening-the-input-stream:document>a href#document>Document/a>/code> to be replaced in-place, as if it was a new code idopening-the-input-stream:document-2>a href#document>Document/a>/code> object, but reusing the previous object, which is then returned./p> p>If the var>type/var> argument is omitted or has the value code idopening-the-input-stream:text/html>a href#text/html>text/html/a>/code>, then the resulting code idopening-the-input-stream:document-3>a href#document>Document/a>/code> has an HTML parser associated with it, which can be given data to parse using code idopening-the-input-stream:dom-document-write>a href#dom-document-write>document.write()/a>/code>. Otherwise, all content passed to code idopening-the-input-stream:dom-document-write-2>a href#dom-document-write>document.write()/a>/code> will be parsed as plain text./p> p>If the var>replace/var> argument is present and has the value code>replace/code>, the existing entries in the session history for the code idopening-the-input-stream:document-4>a href#document>Document/a>/code> object are removed./p> p>The method has no effect if the code idopening-the-input-stream:document-5>a href#document>Document/a>/code> is still being parsed./p> p>Throws an a idopening-the-input-stream:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idopening-the-input-stream:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the code idopening-the-input-stream:document-6>a href#document>Document/a>/code> is an a hrefhttps://dom.spec.whatwg.org/#xml-document idopening-the-input-stream:xml-documents data-x-internalxml-documents>XML document/a>./p> p>Throws an a idopening-the-input-stream:invalidstateerror-2 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idopening-the-input-stream:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the parser is currently executing a a href#custom-element-constructor idopening-the-input-stream:custom-element-constructor>custom element constructor/a>./p> dt>var>window/var> var>document/var> . code idopening-the-input-stream:dom-document-open-2>a href#dom-document-open>open/a>/code>( var>url/var>, var>name/var>, var>features/var> )dd> p>Works like the code idopening-the-input-stream:dom-open>a href#dom-open>window.open()/a>/code> method./p> /dl> p>code idopening-the-input-stream:document-7>a href#document>Document/a>/code> objects have an dfn idignore-opens-during-unload-counter>ignore-opens-during-unload counter/dfn>, which is used to prevent scripts from invoking the code idopening-the-input-stream:dom-document-open-3>a href#dom-document-open>document.open()/a>/code> method (directly or indirectly) while the document is a href#unload-a-document idopening-the-input-stream:unload-a-document>being unloaded/a>. Initially, the counter must be set to zero./p> p>The dfn iddocument-open-steps>document open steps/dfn>, given a var>document/var>, var>type/var>, and var>replaceInput/var>, are as follows:/p> ol>li>p>If var>document/var> is an a hrefhttps://dom.spec.whatwg.org/#xml-document idopening-the-input-stream:xml-documents-2 data-x-internalxml-documents>XML document/a>, then throw an a idopening-the-input-stream:invalidstateerror-3 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idopening-the-input-stream:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> exception.li>p>If var>document/var>s a href#throw-on-dynamic-markup-insertion-counter idopening-the-input-stream:throw-on-dynamic-markup-insertion-counter>throw-on-dynamic-markup-insertion counter/a> is greater than 0, then throw an a idopening-the-input-stream:invalidstateerror-4 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idopening-the-input-stream:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If var>document/var> is not an a href#active-document idopening-the-input-stream:active-document>active document/a>, then return var>document/var>.li>p>If var>document/var>s a href#concept-origin idopening-the-input-stream:concept-origin>origin/a> is not a href#same-origin idopening-the-input-stream:same-origin>same origin/a> to the a href#concept-origin idopening-the-input-stream:concept-origin-2>origin/a> of the a href#responsible-document idopening-the-input-stream:responsible-document>responsible document/a> specified by the a href#entry-settings-object idopening-the-input-stream:entry-settings-object>entry settings object/a>, then throw a a idopening-the-input-stream:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idopening-the-input-stream:domexception-5>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li> p>If var>document/var> has an a href#active-parser idopening-the-input-stream:active-parser>active parser/a> whose a href#script-nesting-level idopening-the-input-stream:script-nesting-level>script nesting level/a> is greater than 0, then return var>document/var>./p> p classnote>This basically causes code idopening-the-input-stream:dom-document-open-4>a href#dom-document-open>document.open()/a>/code> to be ignored when its called in an inline script found during parsing, while still letting it have an effect when called from a non-parser task such as a timer callback or event handler./p> li> p>Similarly, if var>document/var>s a href#ignore-opens-during-unload-counter idopening-the-input-stream:ignore-opens-during-unload-counter>ignore-opens-during-unload counter/a> is greater than 0, then return var>document/var>./p> p classnote>This basically causes code idopening-the-input-stream:dom-document-open-5>a href#dom-document-open>document.open()/a>/code> to be ignored when its called from a code idopening-the-input-stream:event-beforeunload>a href#event-beforeunload>beforeunload/a>/code>, code idopening-the-input-stream:event-pagehide>a href#event-pagehide>pagehide/a>/code>, or code idopening-the-input-stream:event-unload>a href#event-unload>unload/a>/code> event handler while the code idopening-the-input-stream:document-8>a href#document>Document/a>/code> is being unloaded./p> li>p>Let var>replace/var> be false. li> p>If var>replaceInput/var> is an a idopening-the-input-stream:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for code>replace/code>, then set var>replace/var> to true./p> p>Otherwise, if var>document/var>s a href#browsing-context idopening-the-input-stream:browsing-context>browsing context/a>s a href#session-history idopening-the-input-stream:session-history>session history/a> contains only one code idopening-the-input-stream:document-9>a href#document>Document/a>/code> object, and that was the code idopening-the-input-stream:about:blank>a href#about:blank>about:blank/a>/code> code idopening-the-input-stream:document-10>a href#document>Document/a>/code> created when var>document/var>s a href#browsing-context idopening-the-input-stream:browsing-context-2>browsing context/a> was a href#creating-a-new-browsing-context idopening-the-input-stream:creating-a-new-browsing-context>created/a>, and that code idopening-the-input-stream:document-11>a href#document>Document/a>/code> object has never had the a href#unload-a-document idopening-the-input-stream:unload-a-document-2>unload a document/a> algorithm invoked on it (e.g., by a previous call to code idopening-the-input-stream:dom-document-open-6>a href#dom-document-open>document.open()/a>/code>), then set var>replace/var> to true./p> li>p>Set var>document/var>s i idopening-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 idopening-the-input-stream:prompt-to-unload-a-document>Prompt to unload/a> var>document/var>. If the user a href#refused-to-allow-the-document-to-be-unloaded idopening-the-input-stream:refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be unloaded/a>, then return var>document/var>.li>p>a href#unload-a-document idopening-the-input-stream:unload-a-document-3>Unload/a> var>document/var>, with the var>recycle/var> parameter set to true.li>p>a href#abort-a-document idopening-the-input-stream:abort-a-document>Abort/a> var>document/var>.li>p>Unregister all event listeners registered on var>document/var> and its descendants./p> li>p>Remove any a href#concept-task idopening-the-input-stream:concept-task>tasks/a> associated with var>document/var> in any a href#task-source idopening-the-input-stream:task-source>task source/a>.li>p>Remove all child nodes of var>document/var>, without firing any mutation events.li> p>Call the JavaScript a hrefhttps://tc39.github.io/ecma262/#sec-initializehostdefinedrealm idopening-the-input-stream:js-initializehostdefinedrealm data-x-internaljs-initializehostdefinedrealm>InitializeHostDefinedRealm()/a> abstract operation with the following customizations:/p> ul>li>p>For the global object, create a new code idopening-the-input-stream:window>a href#window>Window/a>/code> object var>window/var>.li>p>For the global b>this/b> value, use var>document/var>s a href#browsing-context idopening-the-input-stream:browsing-context-3>browsing context/a>s associated code idopening-the-input-stream:windowproxy>a href#windowproxy>WindowProxy/a>/code>.li>p>Let var>realm execution context/var> be the created a idopening-the-input-stream:javascript-execution-context hrefhttps://tc39.github.io/ecma262/#sec-execution-contexts data-x-internaljavascript-execution-context>JavaScript execution context/a>./ul> p classXXX>This is not universally implemented and can perhaps be removed; see a hrefhttps://github.com/whatwg/html/issues/1698>issue #1698/a>./p> li>p>a href#set-up-a-window-environment-settings-object idopening-the-input-stream:set-up-a-window-environment-settings-object>Set up a window environment settings object/a> with var>realm execution context/var>.li>p>a href#set-the-active-document idopening-the-input-stream:set-the-active-document>Set the active document/a> of var>document/var>s a href#browsing-context idopening-the-input-stream:browsing-context-4>browsing context/a> to var>document/var> with var>window/var>.li>p>Replace var>document/var>s singleton objects with new instances of those objects, created in var>window/var>s a href#concept-global-object-realm idopening-the-input-stream:concept-global-object-realm>Realm/a>. (This includes in particular the code idopening-the-input-stream:history-3>a href#history-3>History/a>/code>, code idopening-the-input-stream:applicationcache>a href#applicationcache>ApplicationCache/a>/code>, and code idopening-the-input-stream:navigator>a href#navigator>Navigator/a>/code>, objects, the various code idopening-the-input-stream:barprop>a href#barprop>BarProp/a>/code> objects, the two code idopening-the-input-stream:storage-2>a href#storage-2>Storage/a>/code> objects, the various code idopening-the-input-stream:htmlcollection>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> objects, and objects defined by other specifications, like code idopening-the-input-stream:selection>a data-x-internalselection hrefhttps://w3c.github.io/selection-api/#selection-interface>Selection/a>/code>. It also includes all the Web IDL prototypes in the JavaScript binding, including var>document/var>s prototype.)li>p>Change var>document/var>s a hrefhttps://dom.spec.whatwg.org/#concept-document-encoding idopening-the-input-stream:documents-character-encoding data-x-internaldocuments-character-encoding>character encoding/a> to a idopening-the-input-stream:utf-8 hrefhttps://encoding.spec.whatwg.org/#utf-8 data-x-internalutf-8>UTF-8/a>.li>p>If var>document/var> is a href#ready-for-post-load-tasks idopening-the-input-stream:ready-for-post-load-tasks>ready for post-load tasks/a>, then set var>document/var>s a href#reload-override-flag idopening-the-input-stream:reload-override-flag>reload override flag/a> and set var>document/var>s a href#reload-override-buffer idopening-the-input-stream:reload-override-buffer>reload override buffer/a> to the empty string.li>p>Set var>document/var>s i idopening-the-input-stream:concept-document-salvageable-2>a href#concept-document-salvageable>salvageable/a>/i> state back to true.li>p>Change var>document/var>s a hrefhttps://dom.spec.whatwg.org/#concept-document-url idopening-the-input-stream:the-documents-address data-x-internalthe-documents-address>URL/a> to the a hrefhttps://dom.spec.whatwg.org/#concept-document-url idopening-the-input-stream:the-documents-address-2 data-x-internalthe-documents-address>URL/a> of the a href#responsible-document idopening-the-input-stream:responsible-document-2>responsible document/a> specified by the a href#entry-settings-object idopening-the-input-stream:entry-settings-object-2>entry settings object/a>.li>p>If var>document/var>s a href#iframe-load-in-progress idopening-the-input-stream:iframe-load-in-progress>iframe load in progress/a> flag is set, then set var>document/var>s a href#mute-iframe-load idopening-the-input-stream:mute-iframe-load>mute iframe load/a> flag.li>p>Create a new a href#html-parser idopening-the-input-stream:html-parser>HTML parser/a> and associate it with var>document/var>. This is a dfn idscript-created-parser>script-created parser/dfn> (meaning that it can be closed by the code idopening-the-input-stream:dom-document-open-7>a href#dom-document-open>document.open()/a>/code> and code idopening-the-input-stream:dom-document-close>a href#dom-document-close>document.close()/a>/code> methods, and that the tokenizer will wait for an explicit call to code idopening-the-input-stream:dom-document-close-2>a href#dom-document-close>document.close()/a>/code> before emitting an end-of-file token). The encoding a href#concept-encoding-confidence idopening-the-input-stream:concept-encoding-confidence>confidence/a> is i>irrelevant/i>.li>p>Set the a href#current-document-readiness idopening-the-input-stream:current-document-readiness>current document readiness/a> of var>document/var> to code>loading/code>.li> p>If var>type/var> is an a idopening-the-input-stream:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>replace/code>, then, for historical reasons, set it to the string code>text/html/code>./p> p>Otherwise:/p> p>If the var>type/var> string contains a U+003B SEMICOLON character (;), remove the first such character and all characters from it up to the end of the string./p> p>a idopening-the-input-stream:strip-leading-and-trailing-ascii-whitespace hrefhttps://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace data-x-internalstrip-leading-and-trailing-ascii-whitespace>Strip leading and trailing ASCII whitespace/a> from var>type/var>./p> li> p>If var>type/var> is em>not/em> now an a idopening-the-input-stream:ascii-case-insensitive-3 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code idopening-the-input-stream:text/html-2>a href#text/html>text/html/a>/code>, then act as if the tokenizer had emitted a start tag token with the tag name pre followed by a single U+000A LINE FEED (LF) character, then switch the a href#html-parser idopening-the-input-stream:html-parser-2>HTML parser/a>s tokenizer to the a href#plaintext-state idopening-the-input-stream:plaintext-state>PLAINTEXT state/a>./p> li>p>Remove any a href#concept-task idopening-the-input-stream:concept-task-2>tasks/a> queued by the a href#history-traversal-task-source idopening-the-input-stream:history-traversal-task-source>history traversal task source/a> that are associated with any code idopening-the-input-stream:document-12>a href#document>Document/a>/code> objects in the a href#top-level-browsing-context idopening-the-input-stream:top-level-browsing-context>top-level browsing context/a>s a href#document-family idopening-the-input-stream:document-family>document family/a>.li> p>Remove all the entries in the a href#browsing-context idopening-the-input-stream:browsing-context-5>browsing context/a>s a href#session-history idopening-the-input-stream:session-history-2>session history/a> after the a href#current-entry idopening-the-input-stream:current-entry>current entry/a>. If the a href#current-entry idopening-the-input-stream:current-entry-2>current entry/a> is the last entry in the session history, then no entries are removed./p> p classnote>This a href#history-notes>doesnt necessarily have to affect/a> the user agents user interface./p> li>p>Remove any earlier entries whose code idopening-the-input-stream:document-13>a href#document>Document/a>/code> object is var>document/var>.li>p>If var>replace/var> is false, then add a new entry, just before the last entry, and associate with the new entry the text that was parsed by the previous parser associated with var>document/var>, as well as the state of var>document/var> at the start of these steps. This allows the user to step backwards in the session history to see the page before it was blown away by the code idopening-the-input-stream:dom-document-open-8>a href#dom-document-open>document.open()/a>/code> call. This new entry does not have a code idopening-the-input-stream:document-14>a href#document>Document/a>/code> object, so a new one will be created if the session history is traversed to that entry.li>p>Set var>document/var>s a href#fired-unload idopening-the-input-stream:fired-unload>fired unload/a> flag to false. (It could have been set to true during the a href#unload-a-document idopening-the-input-stream:unload-a-document-4>unload/a> step above.)li>p>Finally, set the a href#insertion-point idopening-the-input-stream:insertion-point>insertion point/a> to point at just before the end of the a href#input-stream idopening-the-input-stream:input-stream>input stream/a> (which at this point will be empty).li>p>Return var>document/var>./ol> p>When invoked with two arguments or fewer, the code idopening-the-input-stream:dom-document-open-9>a href#dom-document-open>document.open(var>type/var>, var>replace/var>)/a>/code> method must return the result of running the a href#document-open-steps idopening-the-input-stream:document-open-steps>document open steps/a> with this code idopening-the-input-stream:document-15>a href#document>Document/a>/code> object, var>type/var>, and var>replace/var>. p classnote>The code idopening-the-input-stream:dom-document-open-10>a href#dom-document-open>document.open()/a>/code> method does not affect whether a code idopening-the-input-stream:document-16>a href#document>Document/a>/code> is a href#ready-for-post-load-tasks idopening-the-input-stream:ready-for-post-load-tasks-2>ready for post-load tasks/a> or a href#completely-loaded idopening-the-input-stream:completely-loaded>completely loaded/a>./p> p>When invoked with three arguments, the code idopening-the-input-stream:dom-document-open-11>a href#dom-document-open>open(var>url/var>, var>name/var>, var>features/var>)/a>/code> method must run these steps:/p> ol>li>p>If this code idopening-the-input-stream:document-17>a href#document>Document/a>/code> object is not an a href#active-document idopening-the-input-stream:active-document-2>active document/a>, then throw an a idopening-the-input-stream:invalidstateerror-5 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idopening-the-input-stream:domexception-6>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> exception.li>p>Return the result of running the a href#window-open-steps idopening-the-input-stream:window-open-steps>window open steps/a> with var>url/var>, var>name/var>, and var>features/var>./ol> h4 idclosing-the-input-stream>span classsecno>8.4.2/span> Closing the input streama href#closing-the-input-stream classself-link>/a>/h4> dl classdomintro>dt>var>document/var> . code idclosing-the-input-stream:dom-document-close>a href#dom-document-close>close/a>/code>()dd> p>Closes the input stream that was opened by the code idclosing-the-input-stream:dom-document-open>a href#dom-document-open>document.open()/a>/code> method./p> p>Throws an a idclosing-the-input-stream:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idclosing-the-input-stream:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the code idclosing-the-input-stream:document>a href#document>Document/a>/code> is an a hrefhttps://dom.spec.whatwg.org/#xml-document idclosing-the-input-stream:xml-documents data-x-internalxml-documents>XML document/a>./p> p>Throws an a idclosing-the-input-stream:invalidstateerror-2 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idclosing-the-input-stream:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the parser is currently executing a a href#custom-element-constructor idclosing-the-input-stream:custom-element-constructor>custom element constructor/a>./p> /dl> p>The dfn iddom-document-close>code>close()/code>/dfn> method must run the following steps:/p> ol>li>p>If the code idclosing-the-input-stream:document-2>a href#document>Document/a>/code> object is an a hrefhttps://dom.spec.whatwg.org/#xml-document idclosing-the-input-stream:xml-documents-2 data-x-internalxml-documents>XML document/a>, then throw an a idclosing-the-input-stream:invalidstateerror-3 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idclosing-the-input-stream:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>If the code idclosing-the-input-stream:document-3>a href#document>Document/a>/code> objects a href#throw-on-dynamic-markup-insertion-counter idclosing-the-input-stream:throw-on-dynamic-markup-insertion-counter>throw-on-dynamic-markup-insertion counter/a> is greater than zero, then throw an a idclosing-the-input-stream:invalidstateerror-4 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idclosing-the-input-stream:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>If there is no a href#script-created-parser idclosing-the-input-stream:script-created-parser>script-created parser/a> associated with the document, then abort these steps.li>p>Insert an a href#explicit-eof-character idclosing-the-input-stream:explicit-eof-character>explicit EOF character/a> at the end of the parsers a href#input-stream idclosing-the-input-stream:input-stream>input stream/a>.li>p>If there is a a href#pending-parsing-blocking-script idclosing-the-input-stream:pending-parsing-blocking-script>pending parsing-blocking script/a>, then abort these steps.li>p>Run the tokenizer, processing resulting tokens as they are emitted, and stopping when the tokenizer reaches the a href#explicit-eof-character idclosing-the-input-stream:explicit-eof-character-2>explicit EOF character/a> or a href#spin-the-event-loop idclosing-the-input-stream:spin-the-event-loop>spins the event loop/a>./ol> h4 iddocument.write()>span classsecno>8.4.3/span> code iddocument.write():dom-document-write>a href#dom-document-write>document.write()/a>/code>a href#document.write() classself-link>/a>/h4> dl classdomintro>dt>var>document/var> . code iddocument.write():dom-document-write-2>a href#dom-document-write>write/a>/code>(var>text/var>...)dd> p>In general, adds the given string(s) to the code iddocument.write():document>a href#document>Document/a>/code>s input stream./p> p classwarning>This method has very idiosyncratic behavior. In some cases, this method can affect the state of the a href#html-parser iddocument.write():html-parser>HTML parser/a> while the parser is running, resulting in a DOM that does not correspond to the source of the document (e.g. if the string written is the string code><plaintext>/code> or code><!--/code>). In other cases, the call can clear the current page first, as if code iddocument.write():dom-document-open>a href#dom-document-open>document.open()/a>/code> had been called. In yet more cases, the method is simply ignored, or throws an exception. Users agents are a href#document-written-scripts-intervention>explicitly allowed to avoid executing code>script/code> elements inserted via this method/a>. And to make matters even worse, the exact behavior of this method can in some cases be dependent on network latency, which can lead to failures that are very hard to debug. strong>For all these reasons, use of this method is strongly discouraged./strong>/p> p>Throws an a iddocument.write():invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code iddocument.write():domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> when invoked on a iddocument.write():xml-documents hrefhttps://dom.spec.whatwg.org/#xml-document data-x-internalxml-documents>XML documents/a>./p> p>Throws an a iddocument.write():invalidstateerror-2 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code iddocument.write():domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the parser is currently executing a a href#custom-element-constructor iddocument.write():custom-element-constructor>custom element constructor/a>./p> /dl> p>code iddocument.write():document-2>a href#document>Document/a>/code> objects have an dfn idignore-destructive-writes-counter>ignore-destructive-writes counter/dfn>, which is used in conjunction with the processing of code iddocument.write():the-script-element>a href#the-script-element>script/a>/code> elements to prevent external scripts from being able to use code iddocument.write():dom-document-write-3>a href#dom-document-write>document.write()/a>/code> to blow away the document by implicitly calling code iddocument.write():dom-document-open-2>a href#dom-document-open>document.open()/a>/code>. Initially, the counter must be set to zero./p> p>The dfn iddocument-write-steps>document write steps/dfn>, given a code iddocument.write():document-3>a href#document>Document/a>/code> object var>document/var> and a string var>input/var>, are as follows:/p> ol>li>p>If var>document/var> is an a hrefhttps://dom.spec.whatwg.org/#xml-document iddocument.write():xml-documents-2 data-x-internalxml-documents>XML document/a>, then throw an a iddocument.write():invalidstateerror-3 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code iddocument.write():domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If var>document/var>s a href#throw-on-dynamic-markup-insertion-counter iddocument.write():throw-on-dynamic-markup-insertion-counter>throw-on-dynamic-markup-insertion counter/a> is greater than 0, then throw an a iddocument.write():invalidstateerror-4 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code iddocument.write():domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If var>document/var> is not an a href#active-document iddocument.write():active-document>active document/a>, then return.li> p>If the a href#insertion-point iddocument.write():insertion-point>insertion point/a> is undefined, then: ol>li>p>If var>document/var>s a href#ignore-opens-during-unload-counter iddocument.write():ignore-opens-during-unload-counter>ignore-opens-during-unload counter/a> is greater than 0 or var>document/var>s a href#ignore-destructive-writes-counter iddocument.write():ignore-destructive-writes-counter>ignore-destructive-writes counter/a> is greater than 0, then return.li>p>Run the a href#document-open-steps iddocument.write():document-open-steps>document open steps/a> with var>document/var>, code>text/html/code>, and the empty string. If the user a href#refused-to-allow-the-document-to-be-unloaded iddocument.write():refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be unloaded/a>, then abort these steps. Otherwise, the a href#insertion-point iddocument.write():insertion-point-2>insertion point/a> will point at just before the end of the (empty) a href#input-stream iddocument.write():input-stream>input stream/a>./ol> li>p>Insert var>input/var> into the a href#input-stream iddocument.write():input-stream-2>input stream/a> just before the a href#insertion-point iddocument.write():insertion-point-3>insertion point/a>.li>p>If var>document/var>s a href#reload-override-flag iddocument.write():reload-override-flag>reload override flag/a> is set, then append var>input/var> to var>document/var>s a href#reload-override-buffer iddocument.write():reload-override-buffer>reload override buffer/a>.li> p>If there is no a href#pending-parsing-blocking-script iddocument.write():pending-parsing-blocking-script>pending parsing-blocking script/a>, have the a href#html-parser iddocument.write():html-parser-2>HTML parser/a> process var>input/var>, one code point at a time, processing resulting tokens as they are emitted, and stopping when the tokenizer reaches the insertion point or when the processing of the tokenizer is aborted by the tree construction stage (this can happen if a code iddocument.write():the-script-element-2>a href#the-script-element>script/a>/code> end tag token is emitted by the tokenizer). p classnote>If the code iddocument.write():dom-document-write-4>a href#dom-document-write>document.write()/a>/code> method was called from script executing inline (i.e. executing because the parser parsed a set of code iddocument.write():the-script-element-3>a href#the-script-element>script/a>/code> tags), then this is a a href#nestedParsing>reentrant invocation of the parser/a>. If the a href#parser-pause-flag iddocument.write():parser-pause-flag>parser pause flag/a> is set, the tokenizer will abort immediately and no HTML will be parsed, per the tokenizers a href#check-parser-pause-flag>parser pause flag check/a>./p> /ol> p>The dfn iddom-document-write>code>document.write(...)/code>/dfn> method, when invoked, must run the a href#document-write-steps iddocument.write():document-write-steps>document write steps/a> with this code iddocument.write():document-4>a href#document>Document/a>/code> object and a string that is the concatanation of all arguments passed./p> h4 iddocument.writeln()>span classsecno>8.4.4/span> code iddocument.writeln():dom-document-writeln>a href#dom-document-writeln>document.writeln()/a>/code>a href#document.writeln() classself-link>/a>/h4> dl classdomintro>dt>var>document/var> . code iddocument.writeln():dom-document-writeln-2>a href#dom-document-writeln>writeln/a>/code>(var>text/var>...)dd> p>Adds the given string(s) to the code iddocument.writeln():document>a href#document>Document/a>/code>s input stream, followed by a newline character. If necessary, calls the code iddocument.writeln():dom-document-open>a href#dom-document-open>open()/a>/code> method implicitly first./p> p>Throws an a iddocument.writeln():invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code iddocument.writeln():domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> when invoked on a iddocument.writeln():xml-documents hrefhttps://dom.spec.whatwg.org/#xml-document data-x-internalxml-documents>XML documents/a>./p> p>Throws an a iddocument.writeln():invalidstateerror-2 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code iddocument.writeln():domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the parser is currently executing a a href#custom-element-constructor iddocument.writeln():custom-element-constructor>custom element constructor/a>./p> /dl> p>The dfn iddom-document-writeln>code>document.writeln(...)/code>/dfn> method, when invoked, must run the a href#document-write-steps iddocument.writeln():document-write-steps>document write steps/a> with this code iddocument.writeln():document-2>a href#document>Document/a>/code> object and a string that is the concatanation of all arguments passed and U+000A LINE FEED./p> h3 idtimers>span classsecno>8.5/span> Timersa href#timers classself-link>/a>/h3> p>The code idtimers:dom-settimeout>a href#dom-settimeout>setTimeout()/a>/code> and code idtimers:dom-setinterval>a href#dom-setinterval>setInterval()/a>/code> methods allow authors to schedule timer-based callbacks./p> dl classdomintro>dt>var>handle/var> self . code idtimers:dom-settimeout-2>a href#dom-settimeout>setTimeout/a>/code>( var>handler/var> , var>timeout/var> , var>arguments/var>... )dd> p>Schedules a timeout to run var>handler/var> after var>timeout/var> milliseconds. Any var>arguments/var> are passed straight through to the var>handler/var>./p> dt>var>handle/var> self . code idtimers:dom-settimeout-3>a href#dom-settimeout>setTimeout/a>/code>( var>code/var> , var>timeout/var> )dd> p>Schedules a timeout to compile and run var>code/var> after var>timeout/var> milliseconds./p> dt>self . code idtimers:dom-cleartimeout>a href#dom-cleartimeout>clearTimeout/a>/code>( var>handle/var> )dd> p>Cancels the timeout set with code idtimers:dom-settimeout-4>a href#dom-settimeout>setTimeout()/a>/code> or code idtimers:dom-setinterval-2>a href#dom-setinterval>setInterval()/a>/code> identified by var>handle/var>./p> dt>var>handle/var> self . code idtimers:dom-setinterval-3>a href#dom-setinterval>setInterval/a>/code>( var>handler/var> , var>timeout/var> , var>arguments/var>... )dd> p>Schedules a timeout to run var>handler/var> every var>timeout/var> milliseconds. Any var>arguments/var> are passed straight through to the var>handler/var>./p> dt>var>handle/var> self . code idtimers:dom-setinterval-4>a href#dom-setinterval>setInterval/a>/code>( var>code/var> , var>timeout/var> )dd> p>Schedules a timeout to compile and run var>code/var> every var>timeout/var> milliseconds./p> dt>self . code idtimers:dom-clearinterval>a href#dom-clearinterval>clearInterval/a>/code>( var>handle/var> )dd> p>Cancels the timeout set with code idtimers:dom-setinterval-5>a href#dom-setinterval>setInterval()/a>/code> or code idtimers:dom-settimeout-5>a href#dom-settimeout>setTimeout()/a>/code> identified by var>handle/var>./p> /dl> p classnote>Timers can be nested; after five such nested timers, however, the interval is forced to be at least four milliseconds./p> p classnote>This API does not guarantee that timers will run exactly on schedule. Delays due to CPU load, other tasks, etc, are to be expected./p> p>Objects that implement the code idtimers:windoworworkerglobalscope>a href#windoworworkerglobalscope>WindowOrWorkerGlobalScope/a>/code> mixin have a dfn idlist-of-active-timers data-export>list of active timers/dfn>. Each entry in this lists is identified by a number, which must be unique within the list for the lifetime of the object that implements the code idtimers:windoworworkerglobalscope-2>a href#windoworworkerglobalscope>WindowOrWorkerGlobalScope/a>/code> mixin./p> hr> p>The dfn iddom-settimeout>code iddom-windowtimers-setTimeout>setTimeout()/code>/dfn> method must return the value returned by the a href#timer-initialisation-steps idtimers:timer-initialisation-steps>timer initialization steps/a>, passing them the methods arguments, the object on which the method for which the algorithm is running is implemented (a code idtimers:window>a href#window>Window/a>/code> or code idtimers:workerglobalscope>a href#workerglobalscope>WorkerGlobalScope/a>/code> object) as the var>method context/var>, and the var>repeat/var> flag set to false./p> p>The dfn iddom-setinterval>code iddom-windowtimers-setInterval>setInterval()/code>/dfn> method must return the value returned by the a href#timer-initialisation-steps idtimers:timer-initialisation-steps-2>timer initialization steps/a>, passing them the methods arguments, the object on which the method for which the algorithm is running is implemented (a code idtimers:window-2>a href#window>Window/a>/code> or code idtimers:workerglobalscope-2>a href#workerglobalscope>WorkerGlobalScope/a>/code> object) as the var>method context/var>, and the var>repeat/var> flag set to true./p> p>The dfn iddom-cleartimeout>code iddom-windowtimers-clearTimeout>clearTimeout()/code>/dfn> and dfn iddom-clearinterval>code iddom-windowtimers-clearInterval>clearInterval()/code>/dfn> methods must clear the entry identified as var>handle/var> from the a href#list-of-active-timers idtimers:list-of-active-timers>list of active timers/a> of the code idtimers:windoworworkerglobalscope-3>a href#windoworworkerglobalscope>WindowOrWorkerGlobalScope/a>/code> object on which the method was invoked, if any, where var>handle/var> is the argument passed to the method. (If var>handle/var> does not identify an entry in the a href#list-of-active-timers idtimers:list-of-active-timers-2>list of active timers/a> of the code idtimers:windoworworkerglobalscope-4>a href#windoworworkerglobalscope>WindowOrWorkerGlobalScope/a>/code> object on which the method was invoked, the method does nothing.)/p> p classnote>Because code idtimers:dom-cleartimeout-2>a href#dom-cleartimeout>clearTimeout()/a>/code> and code idtimers:dom-clearinterval-2>a href#dom-clearinterval>clearInterval()/a>/code> clear entries from the same list, either method can be used to clear timers created by code idtimers:dom-settimeout-6>a href#dom-settimeout>setTimeout()/a>/code> or code idtimers:dom-setinterval-6>a href#dom-setinterval>setInterval()/a>/code>./p> hr> p>The dfn idtimer-initialisation-steps>timer initialization steps/dfn>, which are invoked with some method arguments, a var>method context/var>, a var>repeat/var> flag which can be true or false, and optionally (and only if the var>repeat/var> flag is true) a var>previous handle/var>, are as follows:/p> ol>li>p>Let var>method context proxy/var> be var>method context/var> if that is a code idtimers:workerglobalscope-3>a href#workerglobalscope>WorkerGlobalScope/a>/code> object, or else the code idtimers:windowproxy>a href#windowproxy>WindowProxy/a>/code> that corresponds to var>method context/var>.li>p>If var>previous handle/var> was provided, let var>handle/var> be var>previous handle/var>; otherwise, let var>handle/var> be a user-agent-defined integer that is greater than zero that will identify the timeout to be set by this call in the a href#list-of-active-timers idtimers: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 idtimers:list-of-active-timers-4>list of active timers/a> for var>handle/var>.li>p>Let var>callerRealm/var> be the a idtimers:current-realm-record hrefhttps://tc39.github.io/ecma262/#current-realm data-x-internalcurrent-realm-record>current Realm Record/a>, and var>calleeRealm/var> be var>method context/var>s a idtimers:javascript-realm hrefhttps://tc39.github.io/ecma262/#sec-code-realms data-x-internaljavascript-realm>JavaScript realm/a>.li> p>Let var>task/var> be a a href#concept-task idtimers:concept-task>task/a> that runs the following substeps:/p> ol>li>p>If the entry for var>handle/var> in the a href#list-of-active-timers idtimers:list-of-active-timers-5>list of active timers/a> has been cleared, then abort this a href#concept-task idtimers:concept-task-2>task/a>s substeps.li> p>Run the appropriate set of steps from the following list:/p> dl classswitch>dt>If the first method argument is a code idtimers:idl-function>a data-x-internalidl-function hrefhttps://heycam.github.io/webidl/#common-Function>Function/a>/code>dd> p>a hrefhttps://heycam.github.io/webidl/#invoke-a-callback-function idtimers:es-invoking-callback-functions data-x-internales-invoking-callback-functions>Invoke/a> the code idtimers:idl-function-2>a data-x-internalidl-function hrefhttps://heycam.github.io/webidl/#common-Function>Function/a>/code>. Use the third and subsequent method arguments (if any) as the arguments for invoking the code idtimers:idl-function-3>a data-x-internalidl-function hrefhttps://heycam.github.io/webidl/#common-Function>Function/a>/code>. Use var>method context proxy/var> as the a hrefhttps://heycam.github.io/webidl/#dfn-callback-this-value idtimers:dfn-callback-this-value data-x-internaldfn-callback-this-value>callback this value/a>./p> dt>Otherwisedd> ol>li>p>Perform a href#hostensurecancompilestrings(callerrealm,-calleerealm) idtimers:hostensurecancompilestrings(callerrealm,-calleerealm)>HostEnsureCanCompileStrings/a>(var>callerRealm/var>, var>calleeRealm/var>). If this throws an exception, catch it, and a href#report-the-exception idtimers:report-the-exception>report the exception/a>.li>p>Let var>script source/var> be the first method argument.li>p>Let var>settings object/var> be var>method context/var>s a href#environment-settings-object idtimers:environment-settings-object>environment settings object/a>.li>p>Let var>base URL/var> be var>settings object/var>s a href#api-base-url idtimers:api-base-url>API base URL/a>.li>p>Let var>script/var> be the result of a href#creating-a-classic-script idtimers:creating-a-classic-script>creating a classic script/a> given var>script source/var>, var>settings object/var>, var>base URL/var>, and the a href#default-classic-script-fetch-options idtimers:default-classic-script-fetch-options>default classic script fetch options/a>.li>p>a href#run-a-classic-script idtimers:run-a-classic-script>Run the classic script/a> var>script/var>./ol> /dl> li>p>If the var>repeat/var> flag is true, then call a href#timer-initialisation-steps idtimers:timer-initialisation-steps-3>timer initialization steps/a> again, passing them the same method arguments, the same var>method context/var>, with the var>repeat/var> flag still set to true, and with the var>previous handle/var> set to var>handler/var>./ol> li>p>Let var>timeout/var> be the second method argument.li> p>If the currently running a href#concept-task idtimers:concept-task-3>task/a> is a task that was created by this algorithm, then let var>nesting level/var> be the a href#concept-task idtimers:concept-task-4>task/a>s a href#timer-nesting-level idtimers:timer-nesting-level>timer nesting level/a>. Otherwise, let var>nesting level/var> be zero./p> p classnote>The tasks a href#timer-nesting-level idtimers:timer-nesting-level-2>timer nesting level/a> is used both for nested calls to code idtimers:dom-settimeout-7>a href#dom-settimeout>setTimeout()/a>/code>, and for the repeating timers created by code idtimers:dom-setinterval-7>a href#dom-setinterval>setInterval()/a>/code>. (Or, indeed, for any combination of the two.) In other words, it represents nested invocations of this algorithm, not of a particular method./p> li>p>If var>timeout/var> is less than 0, then set var>timeout/var> to 0.li>p>If var>nesting level/var> is greater than 5, and var>timeout/var> is less than 4, then set var>timeout/var> to 4.li>p>Increment var>nesting level/var> by one.li>p>Let var>task/var>s dfn idtimer-nesting-level>timer nesting level/dfn> be var>nesting level/var>.li>p>Return var>handle/var>, and then continue running this algorithm a href#in-parallel idtimers:in-parallel>in parallel/a>.li> p>If var>method context/var> is a code idtimers:window-3>a href#window>Window/a>/code> object, wait until the code idtimers:document>a href#document>Document/a>/code> associated with var>method context/var> has been a href#fully-active idtimers:fully-active>fully active/a> for a further var>timeout/var> milliseconds (not necessarily consecutively)./p> p>Otherwise, var>method context/var> is a code idtimers:workerglobalscope-4>a href#workerglobalscope>WorkerGlobalScope/a>/code> object; wait until var>timeout/var> milliseconds have passed with the worker not suspended (not necessarily consecutively)./p> li> p>Wait until any invocations of this algorithm that had the same var>method context/var>, that started before this one, and whose var>timeout/var> is equal to or less than this ones, have completed./p> p classnote>Argument conversion as defined by Web IDL (for example, invoking code>toString()/code> methods on objects passed as the first argument) happens in the algorithms defined in Web IDL, before this algorithm is invoked./p> div classexample> p>So for example, the following rather silly code will result in the log containing code>ONE TWO /code>:/p> pre>var log ;function logger(s) { log + s + ; }setTimeout({ toString: function () { setTimeout(logger(ONE), 100); return logger(TWO);} }, 100);/pre> /div> li> p>Optionally, wait a further user-agent defined length of time./p> p classnote>This is intended to allow user agents to pad timeouts as needed to optimize the power usage of the device. For example, some processors have a low-power mode where the granularity of timers is reduced; on such platforms, user agents can slow timers down to fit this schedule instead of requiring the processor to use the more accurate mode with its associated higher power usage./p> li> p>a href#queue-a-task idtimers:queue-a-task>Queue/a> the a href#concept-task idtimers:concept-task-5>task/a> var>task/var>./p> p classnote>Once the task has been processed, if the var>repeat/var> flag is false, it is safe to remove the entry for var>handle/var> from the a href#list-of-active-timers idtimers:list-of-active-timers-6>list of active timers/a> (there is no way for the entrys existence to be detected past this point, so it does not technically matter one way or the other)./p> /ol> p>The a href#task-source idtimers:task-source>task source/a> for these a href#concept-task idtimers:concept-task-6>tasks/a> is the dfn idtimer-task-source>timer task source/dfn>./p> div classexample> p>To run tasks of several milliseconds back to back without any delay, while still yielding back to the browser to avoid starving the user interface (and to avoid the browser killing the script for hogging the CPU), simply queue the next timer before performing work:/p> pre>function doExpensiveWork() { var done false; // ... // this part of the function takes up to five milliseconds // set done to true if were done // ... return done;}function rescheduleWork() { var handle setTimeout(rescheduleWork, 0); // preschedule next iteration if (doExpensiveWork()) clearTimeout(handle); // clear the timeout if we dont need it}function scheduleWork() { setTimeout(rescheduleWork, 0);}scheduleWork(); // queues a task to do lots of work/pre> /div> h3 iduser-prompts>span classsecno>8.6/span> User promptsa href#user-prompts classself-link>/a>/h3> h4 idsimple-dialogs>span classsecno>8.6.1/span> Simple dialogsa href#simple-dialogs classself-link>/a>/h4> dl classdomintro>dt>var>window/var> . code idsimple-dialogs:dom-alert>a href#dom-alert>alert/a>/code>(var>message/var>)dd> p>Displays a modal alert with the given message, and waits for the user to dismiss it./p> dt>var>result/var> var>window/var> . code idsimple-dialogs:dom-confirm>a href#dom-confirm>confirm/a>/code>(var>message/var>)dd> p>Displays a modal OK/Cancel prompt with the given message, waits for the user to dismiss it, and returns true if the user clicks OK and false if the user clicks Cancel./p> dt>var>result/var> var>window/var> . code idsimple-dialogs:dom-prompt>a href#dom-prompt>prompt/a>/code>(var>message/var> , var>default/var> )dd> p>Displays a modal text control prompt with the given message, waits for the user to dismiss it, and returns the value that the user entered. If the user cancels the prompt, then returns null instead. If the second argument is present, then the given value is used as a default./p> /dl> p classnote>Logic that depends on a href#concept-task idsimple-dialogs:concept-task>tasks/a> or a href#microtask idsimple-dialogs:microtask>microtasks/a>, such as a href#media-element idsimple-dialogs:media-element>media elements/a> loading their a href#media-data idsimple-dialogs:media-data>media data/a>, are stalled when these methods are invoked./p> p>To dfn idoptionally-truncate-a-simple-dialog-string>optionally truncate a simple dialog string/dfn> var>s/var>, return either var>s/var> itself or some string derived from var>s/var> that is shorter. User agents should not provide UI for displaying the elided portion of var>s/var>, as this makes it too easy for abusers to create dialogs of the form Important security alert! Click Show More for full details!./p> p classnote>For example, a user agent might want to only display the first 100 characters of a message. Or, a user agent might replace the middle of the string with …. These types of modifications can be useful in limiting the abuse potential of unnaturally large, trustworthy-looking system dialogs./p> p>The dfn iddom-alert>code>alert(var>message/var>)/code>/dfn> method, when invoked, must run the following steps:/p> ol>li>p>If the a href#event-loop idsimple-dialogs:event-loop>event loop/a>s a href#termination-nesting-level idsimple-dialogs:termination-nesting-level>termination nesting level/a> is nonzero, optionally abort these steps.li>p>If the a href#active-sandboxing-flag-set idsimple-dialogs:active-sandboxing-flag-set>active sandboxing flag set/a> of this code idsimple-dialogs:window>a href#window>Window/a>/code> objects a href#concept-document-window idsimple-dialogs:concept-document-window>associated code>Document/code>/a> has the a href#sandboxed-modals-flag idsimple-dialogs:sandboxed-modals-flag>sandboxed modals flag/a> set, then abort these steps.li>p>Optionally, abort these steps. (For example, the user agent might give the user the option to ignore all alerts, and would thus abort at this step whenever the method was invoked.)li>p>If the method was invoked with no arguments, then let var>message/var> be the empty string; otherwise, let var>message/var> be the methods first argument.li>p>Set var>message/var> to the result of a href#optionally-truncate-a-simple-dialog-string idsimple-dialogs:optionally-truncate-a-simple-dialog-string>optionally truncating/a> var>message/var>.li>p>Show var>message/var> to the user.li>p>Optionally, a href#pause idsimple-dialogs:pause>pause/a> while waiting for the user to acknowledge the message./ol> p>The dfn iddom-confirm>code>confirm(var>message/var>)/code>/dfn> method, when invoked, must run the following steps:/p> ol>li>p>If the a href#event-loop idsimple-dialogs:event-loop-2>event loop/a>s a href#termination-nesting-level idsimple-dialogs:termination-nesting-level-2>termination nesting level/a> is nonzero, optionally abort these steps, returning false.li>p>If the a href#active-sandboxing-flag-set idsimple-dialogs:active-sandboxing-flag-set-2>active sandboxing flag set/a> of this code idsimple-dialogs:window-2>a href#window>Window/a>/code> objects a href#concept-document-window idsimple-dialogs:concept-document-window-2>associated code>Document/code>/a> has the a href#sandboxed-modals-flag idsimple-dialogs:sandboxed-modals-flag-2>sandboxed modals flag/a> set, then abort these steps.li>p>Optionally, return false and abort these steps. (For example, the user agent might give the user the option to ignore all prompts, and would thus abort at this step whenever the method was invoked.)li>p>Set var>message/var> to the result of a href#optionally-truncate-a-simple-dialog-string idsimple-dialogs:optionally-truncate-a-simple-dialog-string-2>optionally truncating/a> var>message/var>.li>p>Show var>message/var> to the user, and ask the user to respond with a positive or negative response.li>p>a href#pause idsimple-dialogs:pause-2>Pause/a> until the user responds either positively or negatively.li>p>If the user responded positively, return true; otherwise, the user responded negatively: return false./ol> p>The dfn iddom-prompt>code>prompt(var>message/var>, var>default/var>)/code>/dfn> method, when invoked, must run the following steps:/p> ol>li>p>If the a href#event-loop idsimple-dialogs:event-loop-3>event loop/a>s a href#termination-nesting-level idsimple-dialogs:termination-nesting-level-3>termination nesting level/a> is nonzero, optionally abort these steps, returning null.li>p>If the a href#active-sandboxing-flag-set idsimple-dialogs:active-sandboxing-flag-set-3>active sandboxing flag set/a> of this code idsimple-dialogs:window-3>a href#window>Window/a>/code> objects a href#concept-document-window idsimple-dialogs:concept-document-window-3>associated code>Document/code>/a> has the a href#sandboxed-modals-flag idsimple-dialogs:sandboxed-modals-flag-3>sandboxed modals flag/a> set, then abort these steps.li>p>Optionally, return null and abort these steps. (For example, the user agent might give the user the option to ignore all prompts, and would thus abort at this step whenever the method was invoked.)li>p>Set var>message/var> to the result of a href#optionally-truncate-a-simple-dialog-string idsimple-dialogs:optionally-truncate-a-simple-dialog-string-3>optionally truncating/a> var>message/var>.li>p>Set var>default/var> to the result of a href#optionally-truncate-a-simple-dialog-string idsimple-dialogs:optionally-truncate-a-simple-dialog-string-4>optionally truncating/a> var>default/var>.li>p>Show var>message/var> to the user, and ask the user to either respond with a string value or abort. The response must be defaulted to the value given by var>default/var>.li>p>a href#pause idsimple-dialogs:pause-3>Pause/a> while waiting for the users response.li>p>If the user aborts, then return null; otherwise, return the string that the user responded with./ol> h4 idprinting>span classsecno>8.6.2/span> Printinga href#printing classself-link>/a>/h4> dl classdomintro>dt>var>window/var> . code idprinting:dom-print>a href#dom-print>print/a>/code>()dd> p>Prompts the user to print the page./p> /dl> p>When the dfn iddom-print>code>print()/code>/dfn> method is invoked, if the code idprinting:document>a href#document>Document/a>/code> is a href#ready-for-post-load-tasks idprinting:ready-for-post-load-tasks>ready for post-load tasks/a>, then the user agent must run the a href#printing-steps idprinting:printing-steps>printing steps/a> a href#in-parallel idprinting:in-parallel>in parallel/a>. Otherwise, the user agent must only set the dfn idprint-when-loaded>print when loaded/dfn> flag on the code idprinting:document-2>a href#document>Document/a>/code>./p> p>User agents should also run the a href#printing-steps idprinting:printing-steps-2>printing steps/a> whenever the user asks for the opportunity to a href#obtain-a-physical-form idprinting:obtain-a-physical-form>obtain a physical form/a> (e.g. printed copy), or the representation of a physical form (e.g. PDF copy), of a document./p> p>The dfn idprinting-steps>printing steps/dfn> are as follows:div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id27864 titlePrinting steps should apply "img environment changed" algorithm before and after printing and wait u ...>27864/a>/div> ol>li> p>The user agent may display a message to the user or abort these steps (or both)./p> p classexample>For instance, a kiosk browser could silently ignore any invocations of the code idprinting:dom-print-2>a href#dom-print>print()/a>/code> method./p> p classexample>For instance, a browser on a mobile device could detect that there are no printers in the vicinity and display a message saying so before continuing to offer a save to PDF option./p> li> p>If the a href#active-sandboxing-flag-set idprinting:active-sandboxing-flag-set>active sandboxing flag set/a> of this code idprinting:window>a href#window>Window/a>/code> objects a href#concept-document-window idprinting:concept-document-window>associated code>Document/code>/a> has the a href#sandboxed-modals-flag idprinting:sandboxed-modals-flag>sandboxed modals flag/a> set, then abort these steps./p> p classnote>If the printing dialog is blocked by a code idprinting:document-3>a href#document>Document/a>/code>s sandbox, then neither the code idprinting:event-beforeprint>a href#event-beforeprint>beforeprint/a>/code> nor code idprinting:event-afterprint>a href#event-afterprint>afterprint/a>/code> events will be fired./p> li> p>The user agent must a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idprinting:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idprinting:event-beforeprint-2>a href#event-beforeprint>beforeprint/a>/code> at the code idprinting:window-2>a href#window>Window/a>/code> object of the code idprinting:document-4>a href#document>Document/a>/code> that is being printed, as well as any a href#nested-browsing-context idprinting:nested-browsing-context>nested browsing contexts/a> in it./p> p classexample>The code idprinting:event-beforeprint-3>a href#event-beforeprint>beforeprint/a>/code> event can be used to annotate the printed copy, for instance adding the time at which the document was printed./p> li> p>The user agent should offer the user the opportunity to a href#obtain-a-physical-form idprinting:obtain-a-physical-form-2>obtain a physical form/a> (or the representation of a physical form) of the document. The user agent may wait for the user to either accept or decline before returning; if so, the user agent must a href#pause idprinting:pause>pause/a> while the method is waiting. Even if the user agent doesnt wait at this point, the user agent must use the state of the relevant documents as they are at this point in the algorithm if and when it eventually creates the alternate form./p> li> p>The user agent must a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idprinting:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idprinting:event-afterprint-2>a href#event-afterprint>afterprint/a>/code> at the code idprinting:window-3>a href#window>Window/a>/code> object of the code idprinting:document-5>a href#document>Document/a>/code> that is being printed, as well as any a href#nested-browsing-context idprinting:nested-browsing-context-2>nested browsing contexts/a> in it./p> p classexample>The code idprinting:event-afterprint-3>a href#event-afterprint>afterprint/a>/code> event can be used to revert annotations added in the earlier event, as well as showing post-printing UI. For instance, if a page is walking the user through the steps of applying for a home loan, the script could automatically advance to the next step after having printed a form or other./p> /ol> h3 idsystem-state-and-capabilities>span classsecno>8.7/span> System state and capabilitiesa href#system-state-and-capabilities classself-link>/a>/h3> h4 idthe-navigator-object>span classsecno>8.7.1/span> The code idthe-navigator-object:navigator>a href#navigator>Navigator/a>/code> objecta href#the-navigator-object classself-link>/a>/h4> p>The dfn iddom-navigator>code>navigator/code>/dfn> attribute of the code idthe-navigator-object:window>a href#window>Window/a>/code> interface must return an instance of the code idthe-navigator-object:navigator-2>a href#navigator>Navigator/a>/code> interface, which represents the identity and state of the user agent (the client), and allows Web pages to register themselves as potential protocol handlers:/p> pre classidl>ExposedWindowinterface dfn idnavigator>Navigator/dfn> { // objects implementing this interface also implement the interfaces given below};a href#navigator idthe-navigator-object:navigator-3>Navigator/a> implements a href#navigatorid idthe-navigator-object:navigatorid>NavigatorID/a>;a href#navigator idthe-navigator-object:navigator-4>Navigator/a> implements a href#navigatorlanguage idthe-navigator-object:navigatorlanguage>NavigatorLanguage/a>;a href#navigator idthe-navigator-object:navigator-5>Navigator/a> implements a href#navigatoronline idthe-navigator-object:navigatoronline>NavigatorOnLine/a>;a href#navigator idthe-navigator-object:navigator-6>Navigator/a> implements a href#navigatorcontentutils idthe-navigator-object:navigatorcontentutils>NavigatorContentUtils/a>;a href#navigator idthe-navigator-object:navigator-7>Navigator/a> implements a href#navigatorcookies idthe-navigator-object:navigatorcookies>NavigatorCookies/a>;a href#navigator idthe-navigator-object:navigator-8>Navigator/a> implements a href#navigatorplugins idthe-navigator-object:navigatorplugins>NavigatorPlugins/a>;a href#navigator idthe-navigator-object:navigator-9>Navigator/a> implements a href#navigatorconcurrenthardware idthe-navigator-object:navigatorconcurrenthardware>NavigatorConcurrentHardware/a>;/pre> p>These interfaces are defined separately so that code idthe-navigator-object:workernavigator>a href#workernavigator>WorkerNavigator/a>/code> can re-use parts of the code idthe-navigator-object:navigator-10>a href#navigator>Navigator/a>/code> interface./p> h5 idclient-identification>span classsecno>8.7.1.1/span> Client identificationa href#client-identification classself-link>/a>/h5> pre classidl>NoInterfaceObject, Exposed(Window,Worker)interface dfn idnavigatorid>NavigatorID/dfn> { readonly attribute DOMString a href#dom-navigator-appcodename idclient-identification:dom-navigator-appcodename>appCodeName/a>; // constant Mozilla readonly attribute DOMString a href#dom-navigator-appname idclient-identification:dom-navigator-appname>appName/a>; // constant Netscape readonly attribute DOMString a href#dom-navigator-appversion idclient-identification:dom-navigator-appversion>appVersion/a>; readonly attribute DOMString a href#dom-navigator-platform idclient-identification:dom-navigator-platform>platform/a>; readonly attribute DOMString a href#dom-navigator-product idclient-identification:dom-navigator-product>product/a>; // constant Gecko ExposedWindow readonly attribute DOMString a href#dom-navigator-productsub idclient-identification:dom-navigator-productsub>productSub/a>; readonly attribute DOMString a href#dom-navigator-useragent idclient-identification:dom-navigator-useragent>userAgent/a>; ExposedWindow readonly attribute DOMString a href#dom-navigator-vendor idclient-identification:dom-navigator-vendor>vendor/a>; ExposedWindow readonly attribute DOMString a href#dom-navigator-vendorsub idclient-identification:dom-navigator-vendorsub>vendorSub/a>; // constant // a href#NavigatorID-partial>also has additional members in a partial interface/a>};/pre> p>In certain cases, despite the best efforts of the entire industry, Web browsers have bugs and limitations that Web authors are forced to work around./p> p>This section defines a collection of attributes that can be used to determine, from script, the kind of user agent in use, in order to work around these issues./p> p>The user agent has a dfn idconcept-navigator-compatibility-mode>navigator compatibility mode/dfn>, which is either i>Chrome/i>, i>Gecko/i>, or i>WebKit/i>./p> p classnote>The a href#concept-navigator-compatibility-mode idclient-identification:concept-navigator-compatibility-mode>navigator compatibility mode/a> constrains the a href#navigatorid idclient-identification:navigatorid>NavigatorID/a> interface to the combinations of attribute values and presence of code idclient-identification:dom-navigator-taintenabled>a href#dom-navigator-taintenabled>taintEnabled()/a>/code> and code idclient-identification:dom-navigator-oscpu>a href#dom-navigator-oscpu>oscpu/a>/code> that are known to be compatible with existing Web content./p> p>Client detection should always be limited to detecting known current versions; future versions and unknown versions should always be assumed to be fully compliant./p> dl classdomintro>dt>var>self/var> . code idclient-identification:dom-navigator>a href#dom-navigator>navigator/a>/code> . code idclient-identification:dom-navigator-appcodename-2>a href#dom-navigator-appcodename>appCodeName/a>/code>dd>p>Returns the string code>Mozilla/code>.dt>var>self/var> . code idclient-identification:dom-navigator-2>a href#dom-navigator>navigator/a>/code> . code idclient-identification:dom-navigator-appname-2>a href#dom-navigator-appname>appName/a>/code>dd>p>Returns the string code>Netscape/code>.dt>var>self/var> . code idclient-identification:dom-navigator-3>a href#dom-navigator>navigator/a>/code> . code idclient-identification:dom-navigator-appversion-2>a href#dom-navigator-appversion>appVersion/a>/code>dd>p>Returns the version of the browser.dt>var>self/var> . code idclient-identification:dom-navigator-4>a href#dom-navigator>navigator/a>/code> . code idclient-identification:dom-navigator-platform-2>a href#dom-navigator-platform>platform/a>/code>dd>p>Returns the name of the platform.dt>var>self/var> . code idclient-identification:dom-navigator-5>a href#dom-navigator>navigator/a>/code> . code idclient-identification:dom-navigator-product-2>a href#dom-navigator-product>product/a>/code>dd>p>Returns the string code>Gecko/code>.dt>var>window/var> . code idclient-identification:dom-navigator-6>a href#dom-navigator>navigator/a>/code> . code idclient-identification:dom-navigator-productsub-2>a href#dom-navigator-productsub>productSub/a>/code>dd>p>Returns either the string code>20030107/code>, or the string code>20100101/code>.dt>var>self/var> . code idclient-identification:dom-navigator-7>a href#dom-navigator>navigator/a>/code> . code idclient-identification:dom-navigator-useragent-2>a href#dom-navigator-useragent>userAgent/a>/code>dd>p>Returns the complete `code>User-Agent/code>` header.dt>var>window/var> . code idclient-identification:dom-navigator-8>a href#dom-navigator>navigator/a>/code> . code idclient-identification:dom-navigator-vendor-2>a href#dom-navigator-vendor>vendor/a>/code>dd>p>Returns either the empty string, the string code>Apple Computer, Inc./code>, or the string code>Google Inc./code>.dt>var>window/var> . code idclient-identification:dom-navigator-9>a href#dom-navigator>navigator/a>/code> . code idclient-identification:dom-navigator-vendorsub-2>a href#dom-navigator-vendorsub>vendorSub/a>/code>dd>p>Returns the empty string./dl> dl>dt>dfn iddom-navigator-appcodename>code>appCodeName/code>/dfn>dd>p>Must return the string code>Mozilla/code>.dt>dfn iddom-navigator-appname>code>appName/code>/dfn>dd>p>Must return the string code>Netscape/code>.dt>dfn iddom-navigator-appversion>code>appVersion/code>/dfn>dd>p>Must return either the string code>4.0/code> or a string representing the version of the browser in detail, e.g. code>1.0 (VMS; en-US) Mellblomenator/9000/code>.dt>dfn iddom-navigator-platform>code>platform/code>/dfn>dd>p>Must return either the empty string or a string representing the platform on which the browser is executing, e.g. code>MacIntel/code>, code>Win32/code>, code>FreeBSD i386/code>, code>WebTV OS/code>.dt>dfn iddom-navigator-product>code>product/code>/dfn>dd>p>Must return the string code>Gecko/code>.dt>dfn iddom-navigator-productsub>code>productSub/code>/dfn>dd> p>Must return the appropriate string from the following list:/p> dl classswitch>dt>If the a href#concept-navigator-compatibility-mode idclient-identification:concept-navigator-compatibility-mode-2>navigator compatibility mode/a> is i>Chrome/i> or i>WebKit/i>dd>p>The string code>20030107/code>.dt>If the a href#concept-navigator-compatibility-mode idclient-identification:concept-navigator-compatibility-mode-3>navigator compatibility mode/a> is i>Gecko/i>dd>p>The string code>20100101/code>./dl> dt>dfn iddom-navigator-useragent>code>userAgent/code>/dfn>dd>p>Must return the a hrefhttps://fetch.spec.whatwg.org/#default-user-agent-value idclient-identification:default-user-agent-value data-x-internaldefault-user-agent-value>default `code>User-Agent/code>` value/a>.dt>dfn iddom-navigator-vendor>code>vendor/code>/dfn>dd> p>Must return the appropriate string from the following list:/p> dl classswitch>dt>If the a href#concept-navigator-compatibility-mode idclient-identification:concept-navigator-compatibility-mode-4>navigator compatibility mode/a> is i>Chrome/i>dd>p>The string code>Google Inc./code>.dt>If the a href#concept-navigator-compatibility-mode idclient-identification:concept-navigator-compatibility-mode-5>navigator compatibility mode/a> is i>Gecko/i>dd>p>The empty string.dt>If the a href#concept-navigator-compatibility-mode idclient-identification:concept-navigator-compatibility-mode-6>navigator compatibility mode/a> is i>WebKit/i>dd>p>The string code>Apple Computer, Inc./code>./dl> dt>dfn iddom-navigator-vendorsub>code>vendorSub/code>/dfn>dd>p>Must return the empty string./dl> p>If the a href#concept-navigator-compatibility-mode idclient-identification:concept-navigator-compatibility-mode-7>navigator compatibility mode/a> is i>Gecko/i>, then the user agent must also support the following partial interface:/p> pre classidl>partial interface a href#navigatorid idNavigatorID-partial>NavigatorID/a> { ExposedWindow boolean a href#dom-navigator-taintenabled idclient-identification:dom-navigator-taintenabled-2>taintEnabled/a>(); // constant false ExposedWindow readonly attribute DOMString a href#dom-navigator-oscpu idclient-identification:dom-navigator-oscpu-2>oscpu/a>;};/pre> p>The dfn iddom-navigator-taintenabled>code>taintEnabled()/code>/dfn> method must return false./p> p>The dfn iddom-navigator-oscpu>code>oscpu/code>/dfn> attributes getter must return either the empty string or a string representing the platform on which the browser is executing, e.g. code>Windows NT 10.0; Win64; x64/code>, code>Linux x86_64/code>./p> p classwarning>Any information in this API that varies from user to user can be used to profile the user. In fact, if enough such information is available, a user can actually be uniquely identified. For this reason, user agent implementors are strongly urged to include as little information in this API as possible. a href#fingerprinting-vector idclient-identification:fingerprinting-vector classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> h5 idlanguage-preferences>span classsecno>8.7.1.2/span> Language preferencesa href#language-preferences classself-link>/a>/h5> pre classidl>NoInterfaceObject, Exposed(Window,Worker)interface dfn idnavigatorlanguage>NavigatorLanguage/dfn> { readonly attribute DOMString a href#dom-navigator-language idlanguage-preferences:dom-navigator-language>language/a>; readonly attribute FrozenArray<DOMString> a href#dom-navigator-languages idlanguage-preferences:dom-navigator-languages>languages/a>;};/pre> dl classdomintro>dt>var>self/var> . code idlanguage-preferences:dom-navigator>a href#dom-navigator>navigator/a>/code> . code idlanguage-preferences:dom-navigator-language-2>a href#dom-navigator-language>language/a>/code>dd>p>Returns a language tag representing the users preferred language.dt>var>self/var> . code idlanguage-preferences:dom-navigator-2>a href#dom-navigator>navigator/a>/code> . code idlanguage-preferences:dom-navigator-languages-2>a href#dom-navigator-languages>languages/a>/code>dd> p>Returns an array of language tags representing the users preferred languages, with the most preferred language first./p> p>The most preferred language is the one returned by code idlanguage-preferences:dom-navigator-language-3>a href#dom-navigator-language>navigator.language/a>/code>./p> /dl> p classnote>A code idlanguage-preferences:event-languagechange>a href#event-languagechange>languagechange/a>/code> event is fired at the code idlanguage-preferences:window>a href#window>Window/a>/code> or code idlanguage-preferences:workerglobalscope>a href#workerglobalscope>WorkerGlobalScope/a>/code> object when the user agents understanding of what the users preferred languages are changes./p> dl>dt>dfn iddom-navigator-language>code>language/code>/dfn>dd>p>Must return a valid BCP 47 language tag representing either a href#a-plausible-language idlanguage-preferences:a-plausible-language>a plausible language/a> or the users most preferred language. a href#refsBCP47>BCP47/a>dt>dfn iddom-navigator-languages>code>languages/code>/dfn>dd> p>Must return a a idlanguage-preferences:frozen-array hrefhttps://heycam.github.io/webidl/#dfn-frozen-array-type data-x-internalfrozen-array>frozen array/a> of valid BCP 47 language tags representing either one or more a href#a-plausible-language idlanguage-preferences:a-plausible-language-2>plausible languages/a>, or the users preferred languages, ordered by preference with the most preferred language first. The same object must be returned until the user agent needs to return different values, or values in a different order. a href#refsBCP47>BCP47/a>/p> p>Whenever the user agent needs to make the code idlanguage-preferences:dom-navigator-languages-3>a href#dom-navigator-languages>navigator.languages/a>/code> attribute of a code idlanguage-preferences:window-2>a href#window>Window/a>/code> or code idlanguage-preferences:workerglobalscope-2>a href#workerglobalscope>WorkerGlobalScope/a>/code> object return a new set of language tags, the user agent must a href#queue-a-task idlanguage-preferences:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idlanguage-preferences:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idlanguage-preferences:event-languagechange-2>a href#event-languagechange>languagechange/a>/code> at the code idlanguage-preferences:window-3>a href#window>Window/a>/code> or code idlanguage-preferences:workerglobalscope-3>a href#workerglobalscope>WorkerGlobalScope/a>/code> object and wait until that task begins to be executed before actually returning a new value./p> p>The a href#task-source idlanguage-preferences:task-source>task source/a> for this a href#concept-task idlanguage-preferences:concept-task>task/a> is the a href#dom-manipulation-task-source idlanguage-preferences:dom-manipulation-task-source>DOM manipulation task source/a>./p> /dl> p>To determine dfn ida-plausible-language>a plausible language/dfn>, the user agent should bear in mind the following:/p> ul>li>Any information in this API that varies from user to user can be used to profile or identify the user. a href#fingerprinting-vector idlanguage-preferences:fingerprinting-vector classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> li>If the user is not using a service that obfuscates the users point of origin (e.g. the Tor anonymity network), then the value that is least likely to distinguish the user from other users with similar origins (e.g. from the same IP address block) is the language used by the majority of such users. a href#refsTOR>TOR/a>li>If the user is using an anonymizing service, then the value code>en-US/code> is suggested; if all users of the service use that same value, that reduces the possibility of distinguishing the users from each other./ul> p>To avoid introducing any more fingerprinting vectors, user agents should use the same list for the APIs defined in this function as for the HTTP `code idlanguage-preferences:http-accept-language>a data-x-internalhttp-accept-language hrefhttps://tools.ietf.org/html/rfc7231#section-5.3.5>Accept-Language/a>/code>` header. a href#fingerprinting-vector idlanguage-preferences:fingerprinting-vector-2 classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> h5 idcustom-handlers>span classsecno>8.7.1.3/span> Custom scheme handlers: the code idcustom-handlers:dom-navigator-registerprotocolhandler>a href#dom-navigator-registerprotocolhandler>registerProtocolHandler()/a>/code> methoda href#custom-handlers classself-link>/a>/h5>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> registerprotocolhandlerspan classand_chr no>span>Chrome for Android/span> span>None/span>/span>span classchrome yes>span>Chrome/span> span>13+/span>/span>span classios_saf no>span>iOS Safari/span> span>None/span>/span>span classand_uc no>span>UC Browser for Android/span> span>None/span>/span>span classfirefox yes>span>Firefox/span> span>3+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung no>span>Samsung Internet/span> span>None/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari no>span>Safari/span> span>None/span>/span>span classedge no>span>Edge/span> span>None/span>/span>span classandroid no>span>Android Browser/span> span>None/span>/span>span classopera yes>span>Opera/span> span>11.6+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featregisterprotocolhandler>caniuse.com/a>/div> pre classidl>ExposedWindow, NoInterfaceObjectinterface dfn idnavigatorcontentutils>NavigatorContentUtils/dfn> { void a href#dom-navigator-registerprotocolhandler idcustom-handlers:dom-navigator-registerprotocolhandler-2>registerProtocolHandler/a>(DOMString scheme, USVString url, DOMString title); void a href#dom-navigator-unregisterprotocolhandler idcustom-handlers:dom-navigator-unregisterprotocolhandler>unregisterProtocolHandler/a>(DOMString scheme, USVString url);};/pre> p>The dfn iddom-navigator-registerprotocolhandler>code>registerProtocolHandler()/code>/dfn> method allows Web sites to register themselves as possible handlers for particular schemes. For example, an online telephone messaging service could register itself as a handler of the code idcustom-handlers:sms-protocol>a data-x-internalsms-protocol hrefhttps://tools.ietf.org/html/rfc5724#section-2>sms:/a>/code> scheme, so that if the user clicks on such a link, they are given the opportunity to use that web site. a href#refsSMS>SMS/a>/p> dl classdomintro>dt>var>window/var> . code idcustom-handlers:dom-navigator>a href#dom-navigator>navigator/a>/code> . code idcustom-handlers:dom-navigator-registerprotocolhandler-3>a href#dom-navigator-registerprotocolhandler>registerProtocolHandler/a>/code>(var>scheme/var>, var>url/var>, var>title/var>)dd> p>Registers a handler for the given scheme, at the given URL, with the given title./p> p>The string code>%s/code> in the URL is used as a placeholder for where to put the URL of the content to be handled./p> p>Throws a a idcustom-handlers:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idcustom-handlers:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the user agent blocks the registration (this might happen if trying to register as a handler for http, for instance)./p> p>Throws a a idcustom-handlers:syntaxerror hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idcustom-handlers:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the code>%s/code> string is missing in the URL./p> /dl> p>User agents may, within the constraints described in this section, do whatever they like when the method is called. A UA could, for instance, prompt the user and offer the user the opportunity to add the site to a shortlist of handlers, or make the handlers their default, or cancel the request. UAs could provide such a UI through modal UI or through a non-modal transient notification interface. UAs could also simply silently collect the information, providing it only when relevant to the user./p> p>User agents should keep track of which sites have registered handlers (even if the user has declined such registrations) so that the user is not repeatedly prompted with the same request./p> p>The arguments to the method have the following meanings and corresponding implementation requirements. The requirements that involve throwing exceptions must be processed in the order given below, stopping at the first exception thrown. (So the exceptions for the first argument take precedence over the exceptions for the second argument.)/p> dl>dt>var>scheme/var>dd> p>A scheme, such as code>mailto/code> or code>web+auth/code>. The scheme must be compared in an a idcustom-handlers:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> manner by user agents for the purposes of comparing with the scheme part of URLs that they consider against the list of registered handlers./p> p>The var>scheme/var> value, if it contains a colon (as in code>mailto:/code>), will never match anything, since schemes dont contain colons./p> p>If the code idcustom-handlers:dom-navigator-registerprotocolhandler-4>a href#dom-navigator-registerprotocolhandler>registerProtocolHandler()/a>/code> method is invoked with a scheme that is neither a a href#safelisted-scheme idcustom-handlers:safelisted-scheme>safelisted scheme/a> nor a scheme whose value starts with the substring code>web+/code> and otherwise contains only a hrefhttps://infra.spec.whatwg.org/#ascii-lower-alpha idcustom-handlers:lowercase-ascii-letters data-x-internallowercase-ascii-letters>ASCII lower alphas/a>, and whose length is at least five characters (including the code>web+/code> prefix), the user agent must throw a a idcustom-handlers:securityerror-2 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idcustom-handlers:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> p>The following schemes are the dfn idsafelisted-scheme>safelisted schemes/dfn>:/p> ul classbrief>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>openpgp4fpr/code>li>code>sip/code>li>code>sms/code>li>code>smsto/code>li>code>ssh/code>li>code>tel/code>li>code>urn/code>li>code>webcal/code>li>code>wtai/code>li>code>xmpp/code>/ul> p classnote>This list can be changed. If there are schemes that ought to be added, please send feedback./p> p classnote>This list excludes any schemes that could reasonably be expected to be supported inline, e.g. in an code idcustom-handlers:the-iframe-element>a href#the-iframe-element>iframe/a>/code>, such as code>http/code> or (more theoretically) code>gopher/code>. If those were supported, they could potentially be used in man-in-the-middle attacks, by replacing pages that have frames with such content with content under the control of the protocol handler. If the user agent has native support for the schemes, this could further be used for cookie-theft attacks./p> dt>var>url/var>dd> p>A string used to build the a idcustom-handlers:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the page that will handle the requests./p> p>User agents must throw a a idcustom-handlers:syntaxerror-2 hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idcustom-handlers:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the var>url/var> argument passed to one of these methods does not contain the exact literal string code>%s/code>./p> p>User agents must throw a a idcustom-handlers:syntaxerror-3 hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idcustom-handlers:domexception-5>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if a href#parse-a-url idcustom-handlers:parse-a-url>parsing/a> the var>url/var> argument relative to the a href#relevant-settings-object idcustom-handlers:relevant-settings-object>relevant settings object/a> of this code idcustom-handlers:navigatorcontentutils>a href#navigatorcontentutils>NavigatorContentUtils/a>/code> object is not successful./p> p classnote>The a href#resulting-url-string idcustom-handlers:resulting-url-string>resulting URL string/a> would by definition not be a a idcustom-handlers:valid-url-string hrefhttps://url.spec.whatwg.org/#valid-url-string data-x-internalvalid-url-string>valid URL string/a> as it would include the string code>%s/code> which is not a valid component in a URL./p> p>User agents must throw a a idcustom-handlers:securityerror-3 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idcustom-handlers:domexception-6>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the a href#resulting-url-record idcustom-handlers:resulting-url-record>resulting URL record/a> has an a hrefhttps://url.spec.whatwg.org/#concept-url-origin idcustom-handlers:concept-url-origin data-x-internalconcept-url-origin>origin/a> that differs from the a href#concept-settings-object-origin idcustom-handlers:concept-settings-object-origin>origin/a> specified by the a href#relevant-settings-object idcustom-handlers:relevant-settings-object-2>relevant settings object/a> of this code idcustom-handlers:navigatorcontentutils-2>a href#navigatorcontentutils>NavigatorContentUtils/a>/code> object./p> p classnote>This is forcibly the case if the code>%s/code> placeholder is in the scheme, host, or port parts of the URL./p> p>The a href#resulting-url-string idcustom-handlers:resulting-url-string-2>resulting URL string/a> is the dfn idproto-url>proto-URL/dfn>. It identifies the handler for the purposes of the methods described below./p> p>When the user agent uses this handler, it must replace the first occurrence of the exact literal string code>%s/code> in the var>url/var> argument with an escaped version of the a idcustom-handlers:absolute-url hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a> of the content in question (as defined below), then a href#parse-a-url idcustom-handlers:parse-a-url-2>parse/a> the resulting URL, relative to the a href#relevant-settings-object idcustom-handlers:relevant-settings-object-3>relevant settings object/a> of the code idcustom-handlers:navigatorcontentutils-3>a href#navigatorcontentutils>NavigatorContentUtils/a>/code> object on which the code idcustom-handlers:dom-navigator-registerprotocolhandler-5>a href#dom-navigator-registerprotocolhandler>registerProtocolHandler()/a>/code> method was invoked, and then a href#navigate idcustom-handlers:navigate>navigate/a> an appropriate a href#browsing-context idcustom-handlers:browsing-context>browsing context/a> to the resulting URL./p> p>To get the escaped version of the a idcustom-handlers:absolute-url-2 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a> of the content in question, the user agent must replace every character in that a idcustom-handlers:absolute-url-3 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a> that is not a character in the URL a idcustom-handlers:default-encode-set hrefhttps://url.spec.whatwg.org/#default-encode-set data-x-internaldefault-encode-set>default encode set/a> with the result of a hrefhttps://url.spec.whatwg.org/#utf-8-percent-encode idcustom-handlers:utf-8-percent-encode data-x-internalutf-8-percent-encode>UTF-8 percent encoding/a> that character./p> div classexample> p>If the user had visited a site at code>https://example.com//code> that made the following call:/p> pre>navigator.registerProtocolHandler(web+soup, soup?url%s, SoupWeb™)/pre> p>...and then, much later, while visiting code>https://www.example.net//code>, clicked on a link such as:/p> pre><a hrefweb+soup:chicken-kïwi>Download our Chicken Kïwi soup!</a>/pre> p>...then the UA might navigate to the following URL:/p> pre>https://example.com/soup?urlweb+soup:chicken-k%C3%AFwi/pre> p>This site could then do whatever it is that it does with soup (synthesize it and ship it to the user, or whatever)./p> /div> dt>var>title/var>dd> p>A descriptive title of the handler, which the UA might use to remind the user what the site in question is./p> /dl> p>This section does not define how the pages registered by this method are used, beyond the requirements on how to process the var>url/var> value (see above). To some extent, the a href#navigate idcustom-handlers:navigate-2>processing model for navigating across documents/a> defines some cases where these methods are relevant, but in general UAs may use this information wherever they would otherwise consider handing content to native plugins or helper applications./p> hr> p>In addition to the registration method, there is also a method for unregistering handlers./p> dl classdomintro>dt>var>window/var> . code idcustom-handlers:dom-navigator-2>a href#dom-navigator>navigator/a>/code> . code idcustom-handlers:dom-navigator-unregisterprotocolhandler-2>a href#dom-navigator-unregisterprotocolhandler>unregisterProtocolHandler/a>/code>(var>scheme/var>, var>url/var>)dd> p>Unregisters the handler given by the arguments./p> /dl> p>The dfn iddom-navigator-unregisterprotocolhandler>code>unregisterProtocolHandler()/code>/dfn> method must unregister the handler described by the two arguments to the method, where the first argument gives the scheme and the second gives the string used to build the a idcustom-handlers:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the page that will handle the requests./p> p>The first argument must be compared to the schemes for which custom protocol handlers are registered in an a idcustom-handlers:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> manner to find the relevant handlers./p> p>The second argument must be preprocessed as described below, and if that is successful, must then be matched against the a href#proto-url idcustom-handlers:proto-url>proto-URLs/a> of the relevant handlers to find the described handler./p> p>The second argument must be preprocessed as follows:/p> ol>li>p>If the string does not contain the substring code>%s/code>, abort these steps. Theres no matching handler.li>p>a href#parse-a-url idcustom-handlers:parse-a-url-3>Parse/a> the string relative to the a href#relevant-settings-object idcustom-handlers:relevant-settings-object-4>relevant settings object/a> of this code idcustom-handlers:navigatorcontentutils-4>a href#navigatorcontentutils>NavigatorContentUtils/a>/code> object. If this fails, then throw a a idcustom-handlers:syntaxerror-4 hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idcustom-handlers:domexception-7>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If the a href#resulting-url-record idcustom-handlers:resulting-url-record-2>resulting URL record/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-origin idcustom-handlers:concept-url-origin-2 data-x-internalconcept-url-origin>origin/a> is not the a href#same-origin idcustom-handlers:same-origin>same origin/a> as the a href#concept-settings-object-origin idcustom-handlers:concept-settings-object-origin-2>origin/a> of the a href#relevant-settings-object idcustom-handlers:relevant-settings-object-5>relevant settings object/a> of this code idcustom-handlers:navigatorcontentutils-5>a href#navigatorcontentutils>NavigatorContentUtils/a>/code> object, throw a a idcustom-handlers:securityerror-4 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idcustom-handlers:domexception-8>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Return the a href#resulting-url-string idcustom-handlers:resulting-url-string-3>resulting URL string/a> as the result of preprocessing the argument./ol> h6 idsecurity-and-privacy>span classsecno>8.7.1.3.1/span> Security and privacya href#security-and-privacy classself-link>/a>/h6> p>These mechanisms can introduce a number of concerns, in particular privacy concerns./p> p>strong>Hijacking all Web usage./strong> User agents should not allow schemes that are key to its normal operation, such as an a idsecurity-and-privacy:http(s)-scheme hrefhttps://fetch.spec.whatwg.org/#http-scheme data-x-internalhttp(s)-scheme>HTTP(S) scheme/a>, to be rerouted through third-party sites. This would allow a users activities to be trivially tracked, and would allow user information, even in secure connections, to be collected./p> p>strong>Hijacking defaults./strong> User agents are strongly urged to not automatically change any defaults, as this could lead the user to send data to remote hosts that the user is not expecting. New handlers registering themselves should never automatically cause those sites to be used./p> p>strong>Registration spamming./strong> User agents should consider the possibility that a site will attempt to register a large number of handlers, possibly from multiple domains (e.g., by redirecting through a series of pages each on a different domain, and each registering a handler for code>web+spam:/code> — analogous practices abusing other web browser features have been used by pornography Web sites for many years). User agents should gracefully handle such hostile attempts, protecting the user./p> p>strong>Misleading titles./strong> User agents should not rely wholly on the var>title/var> argument to the methods when presenting the registered handlers to the user, since sites could easily lie. For example, a site code>hostile.example.net/code> could claim that it was registering the Cuddly Bear Happy Scheme Handler. User agents should therefore use the handlers origin in any UI along with any title./p> p>strong>Hostile handler metadata./strong> User agents should protect against typical attacks against strings embedded in their interface, for example ensuring that markup or escape characters in such strings are not executed, that null bytes are properly handled, that over-long strings do not cause crashes or buffer overruns, and so forth./p> p>strong>Leaking Intranet URLs./strong> The mechanism described in this section can result in secret Intranet URLs being leaked, in the following manner:/p> ol>li>The user registers a third-party scheme handler as the default handler for a scheme.li>The user then browses their corporate Intranet site and accesses a URL that uses that scheme.li>The user agent contacts the third party and hands the third party the URL to the Intranet content./ol> p>No actual confidential file data is leaked in this manner, but the URLs themselves could contain confidential information. For example, the URL could be code>https://www.corp.example.com/upcoming-aquisitions/the-sample-company.egf/code>, which might tell the third party that Example Corporation is intending to merge with The Sample Company. Implementors might wish to consider allowing administrators to disable this feature for certain subdomains, content types, or schemes./p> p>strong>Leaking credentials./strong> User agents must never send username or password information in the URLs that are escaped and included sent to the handler sites. User agents may even avoid attempting to pass to Web-based handlers the URLs of resources that are known to require authentication to access, as such sites would be unable to access the resources in question without prompting the user for credentials themselves (a practice that would require the user to know whether to trust the third-party handler, a decision many users are unable to make or even understand)./p> p>strong>Interface interference./strong> User agents should be prepared to handle intentionally long arguments to the methods. For example, if the user interface exposed consists of an accept button and a deny button, with the accept binding containing the name of the handler, its important that a long name not cause the deny button to be pushed off the screen./p> h5 idcookies>span classsecno>8.7.1.4/span> Cookiesa href#cookies classself-link>/a>/h5> pre classidl>ExposedWindow, NoInterfaceObjectinterface dfn idnavigatorcookies>NavigatorCookies/dfn> { readonly attribute boolean a href#dom-navigator-cookieenabled idcookies:dom-navigator-cookieenabled>cookieEnabled/a>;};/pre> dl classdomintro>dt>var>window/var> . code idcookies:dom-navigator>a href#dom-navigator>navigator/a>/code> . code idcookies:dom-navigator-cookieenabled-2>a href#dom-navigator-cookieenabled>cookieEnabled/a>/code>dd> p>Returns false if setting a cookie will be ignored, and true otherwise./p> /dl> p>The dfn iddom-navigator-cookieenabled>code>cookieEnabled/code>/dfn> attribute must return true if the user agent attempts to handle cookies according to the cookie specification, and false if it ignores cookie change requests. a href#refsCOOKIES>COOKIES/a>/p> h5 idplugins-2>span classsecno>8.7.1.5/span> Pluginsa href#plugins-2 classself-link>/a>/h5> pre classidl>ExposedWindow, NoInterfaceObjectinterface dfn idnavigatorplugins>NavigatorPlugins/dfn> { SameObject readonly attribute a href#pluginarray idplugins-2:pluginarray>PluginArray/a> a href#dom-navigator-plugins idplugins-2:dom-navigator-plugins>plugins/a>; SameObject readonly attribute a href#mimetypearray idplugins-2:mimetypearray>MimeTypeArray/a> a href#dom-navigator-mimetypes idplugins-2:dom-navigator-mimetypes>mimeTypes/a>; boolean a href#dom-navigator-javaenabled idplugins-2:dom-navigator-javaenabled>javaEnabled()/a>;};ExposedWindow, LegacyUnenumerableNamedPropertiesinterface dfn idpluginarray>PluginArray/dfn> { void a href#dom-pluginarray-refresh idplugins-2:dom-pluginarray-refresh>refresh/a>(optional boolean reload false); readonly attribute unsigned long a href#dom-pluginarray-length idplugins-2:dom-pluginarray-length>length/a>; getter a href#dom-plugin idplugins-2:dom-plugin>Plugin/a>? a href#dom-pluginarray-item idplugins-2:dom-pluginarray-item>item/a>(unsigned long index); getter a href#dom-plugin idplugins-2:dom-plugin-2>Plugin/a>? a href#dom-pluginarray-nameditem idplugins-2:dom-pluginarray-nameditem>namedItem/a>(DOMString name);};ExposedWindow, LegacyUnenumerableNamedPropertiesinterface dfn idmimetypearray>MimeTypeArray/dfn> { readonly attribute unsigned long a href#dom-mimetypearray-length idplugins-2:dom-mimetypearray-length>length/a>; getter a href#mimetype idplugins-2:mimetype>MimeType/a>? a href#dom-mimetypearray-item idplugins-2:dom-mimetypearray-item>item/a>(unsigned long index); getter a href#mimetype idplugins-2:mimetype-2>MimeType/a>? a href#dom-mimetypearray-nameditem idplugins-2:dom-mimetypearray-nameditem>namedItem/a>(DOMString name);};ExposedWindow, LegacyUnenumerableNamedPropertiesinterface dfn iddom-plugin>Plugin/dfn> { readonly attribute DOMString a href#dom-plugin-name idplugins-2:dom-plugin-name>name/a>; readonly attribute DOMString a href#dom-plugin-description idplugins-2:dom-plugin-description>description/a>; readonly attribute DOMString a href#dom-plugin-filename idplugins-2:dom-plugin-filename>filename/a>; readonly attribute unsigned long a href#dom-plugin-length idplugins-2:dom-plugin-length>length/a>; getter a href#mimetype idplugins-2:mimetype-3>MimeType/a>? a href#dom-plugin-item idplugins-2:dom-plugin-item>item/a>(unsigned long index); getter a href#mimetype idplugins-2:mimetype-4>MimeType/a>? a href#dom-plugin-nameditem idplugins-2:dom-plugin-nameditem>namedItem/a>(DOMString name);};ExposedWindowinterface dfn idmimetype>MimeType/dfn> { readonly attribute DOMString a href#dom-mimetype-type idplugins-2:dom-mimetype-type>type/a>; readonly attribute DOMString a href#dom-mimetype-description idplugins-2:dom-mimetype-description>description/a>; readonly attribute DOMString a href#dom-mimetype-suffixes idplugins-2:dom-mimetype-suffixes>suffixes/a>; // comma-separated readonly attribute a href#dom-plugin idplugins-2:dom-plugin-3>Plugin/a> a href#dom-mimetype-enabledplugin idplugins-2:dom-mimetype-enabledplugin>enabledPlugin/a>;};/pre> dl classdomintro>dt>var>window/var> . code idplugins-2:dom-navigator>a href#dom-navigator>navigator/a>/code> . code idplugins-2:dom-navigator-plugins-2>a href#dom-navigator-plugins>plugins/a>/code> . code idplugins-2:dom-pluginarray-refresh-2>a href#dom-pluginarray-refresh>refresh/a>/code>( var>refresh/var> )dd> p>Updates the lists of supported plugins and MIME types for this page, and reloads the page if the lists have changed./p> dt>var>window/var> . code idplugins-2:dom-navigator-2>a href#dom-navigator>navigator/a>/code> . code idplugins-2:dom-navigator-plugins-3>a href#dom-navigator-plugins>plugins/a>/code> . code idplugins-2:dom-pluginarray-length-2>a href#dom-pluginarray-length>length/a>/code>dd> p>Returns the number of plugins, represented by code idplugins-2:dom-plugin-4>a href#dom-plugin>Plugin/a>/code> objects, that the user agent reports./p> dt>var>plugin/var> var>window/var> . code idplugins-2:dom-navigator-3>a href#dom-navigator>navigator/a>/code> . code idplugins-2:dom-navigator-plugins-4>a href#dom-navigator-plugins>plugins/a>/code> . code idplugins-2:dom-pluginarray-item-2>a href#dom-pluginarray-item>item/a>/code>(var>index/var>)dt>var>window/var> . code idplugins-2:dom-navigator-4>a href#dom-navigator>navigator/a>/code> . code idplugins-2:dom-navigator-plugins-5>a href#dom-navigator-plugins>plugins/a>/code>var>index/var>dd> p>Returns the specified code idplugins-2:dom-plugin-5>a href#dom-plugin>Plugin/a>/code> object./p> dt>var>plugin/var> var>window/var> . code idplugins-2:dom-navigator-5>a href#dom-navigator>navigator/a>/code> . code idplugins-2:dom-navigator-plugins-6>a href#dom-navigator-plugins>plugins/a>/code> . code idplugins-2:dom-pluginarray-item-3>a href#dom-pluginarray-item>item/a>/code>(var>name/var>)dt>var>window/var> . code idplugins-2:dom-navigator-6>a href#dom-navigator>navigator/a>/code> . code idplugins-2:dom-navigator-plugins-7>a href#dom-navigator-plugins>plugins/a>/code>var>name/var>dd> p>Returns the code idplugins-2:dom-plugin-6>a href#dom-plugin>Plugin/a>/code> object for the plugin with the given name./p> dt>var>window/var> . code idplugins-2:dom-navigator-7>a href#dom-navigator>navigator/a>/code> . code idplugins-2:dom-navigator-mimetypes-2>a href#dom-navigator-mimetypes>mimeTypes/a>/code> . code idplugins-2:dom-mimetypearray-length-2>a href#dom-mimetypearray-length>length/a>/code>dd> p>Returns the number of MIME types, represented by code idplugins-2:mimetype-5>a href#mimetype>MimeType/a>/code> objects, supported by the plugins that the user agent reports./p> dt>var>mimeType/var> var>window/var> . code idplugins-2:dom-navigator-8>a href#dom-navigator>navigator/a>/code> . code idplugins-2:dom-navigator-mimetypes-3>a href#dom-navigator-mimetypes>mimeTypes/a>/code> . code idplugins-2:dom-mimetypearray-item-2>a href#dom-mimetypearray-item>item/a>/code>(var>index/var>)dt>var>window/var> . code idplugins-2:dom-navigator-9>a href#dom-navigator>navigator/a>/code> . code idplugins-2:dom-navigator-mimetypes-4>a href#dom-navigator-mimetypes>mimeTypes/a>/code>var>index/var>dd> p>Returns the specified code idplugins-2:mimetype-6>a href#mimetype>MimeType/a>/code> object./p> dt>var>mimeType/var> var>window/var> . code idplugins-2:dom-navigator-10>a href#dom-navigator>navigator/a>/code> . code idplugins-2:dom-navigator-mimetypes-5>a href#dom-navigator-mimetypes>mimeTypes/a>/code> . code idplugins-2:dom-mimetypearray-item-3>a href#dom-mimetypearray-item>item/a>/code>(var>name/var>)dt>var>window/var> . code idplugins-2:dom-navigator-11>a href#dom-navigator>navigator/a>/code> . code idplugins-2:dom-navigator-mimetypes-6>a href#dom-navigator-mimetypes>mimeTypes/a>/code>var>name/var>dd> p>Returns the code idplugins-2:mimetype-7>a href#mimetype>MimeType/a>/code> object for the given MIME type./p> dt>var>plugin/var> . code idplugins-2:dom-plugin-name-2>a href#dom-plugin-name>name/a>/code> dd> p>Returns the plugins name./p> dt>var>plugin/var> . code idplugins-2:dom-plugin-description-2>a href#dom-plugin-description>description/a>/code> dd> p>Returns the plugins description./p> dt>var>plugin/var> . code idplugins-2:dom-plugin-filename-2>a href#dom-plugin-filename>filename/a>/code> dd> p>Returns the plugin librarys filename, if applicable on the current platform./p> dt>var>plugin/var> . code idplugins-2:dom-plugin-length-2>a href#dom-plugin-length>length/a>/code>dd> p>Returns the number of MIME types, represented by code idplugins-2:mimetype-8>a href#mimetype>MimeType/a>/code> objects, supported by the plugin./p> dt>var>mimeType/var> var>plugin/var> . code idplugins-2:dom-plugin-item-2>a href#dom-plugin-item>item/a>/code>(var>index/var>)dt>var>plugin/var>var>index/var>dd> p>Returns the specified code idplugins-2:mimetype-9>a href#mimetype>MimeType/a>/code> object./p> dt>var>mimeType/var> var>plugin/var> . code idplugins-2:dom-plugin-item-3>a href#dom-plugin-item>item/a>/code>(var>name/var>)dt>var>plugin/var>var>name/var>dd> p>Returns the code idplugins-2:mimetype-10>a href#mimetype>MimeType/a>/code> object for the given MIME type./p> dt>var>mimeType/var> . code idplugins-2:dom-mimetype-type-2>a href#dom-mimetype-type>type/a>/code> dd> p>Returns the MIME type./p> dt>var>mimeType/var> . code idplugins-2:dom-mimetype-description-2>a href#dom-mimetype-description>description/a>/code> dd> p>Returns the MIME types description./p> dt>var>mimeType/var> . code idplugins-2:dom-mimetype-suffixes-2>a href#dom-mimetype-suffixes>suffixes/a>/code> dd> p>Returns the MIME types typical file extensions, in a comma-separated list./p> dt>var>mimeType/var> . code idplugins-2:dom-mimetype-enabledplugin-2>a href#dom-mimetype-enabledplugin>enabledPlugin/a>/code> dd> p>Returns the code idplugins-2:dom-plugin-7>a href#dom-plugin>Plugin/a>/code> object that implements this MIME type./p> dt>var>window/var> . code idplugins-2:dom-navigator-12>a href#dom-navigator>navigator/a>/code> . code idplugins-2:dom-navigator-javaenabled-2>a href#dom-navigator-javaenabled>javaEnabled()/a>/code>dd> p>Returns true if theres a plugin that supports the MIME type code>application/x-java-vm/code>./p> /dl> p>The dfn iddom-navigator-plugins>code>navigator.plugins/code>/dfn> attribute must return a code idplugins-2:pluginarray-2>a href#pluginarray>PluginArray/a>/code> object./p> p>The dfn iddom-navigator-mimetypes>code>navigator.mimeTypes/code>/dfn> attribute must return a code idplugins-2:mimetypearray-2>a href#mimetypearray>MimeTypeArray/a>/code> object./p> hr> p>A code idplugins-2:pluginarray-3>a href#pluginarray>PluginArray/a>/code> object represents none, some, or all of the a href#plugin idplugins-2:plugin>plugins/a> supported by the user agent, each of which is represented by a code idplugins-2:dom-plugin-8>a href#dom-plugin>Plugin/a>/code> object. Each of these code idplugins-2:dom-plugin-9>a href#dom-plugin>Plugin/a>/code> objects may be dfn idhidden-plugin>hidden plugins/dfn>. A a href#hidden-plugin idplugins-2:hidden-plugin>hidden plugin/a> cant be enumerated, but can still be inspected by using its name./p> p classnote>The fewer a href#plugin idplugins-2:plugin-2>plugins/a> are represented by the code idplugins-2:pluginarray-4>a href#pluginarray>PluginArray/a>/code> object, and of those, the more that are a href#hidden-plugin idplugins-2:hidden-plugin-2>hidden/a>, the more the users privacy will be protected. Each exposed plugin increases the number of bits that can be derived for fingerprinting. Hiding a plugin helps, but unless it is an extremely rare plugin, it is likely that a site attempting to derive the list of plugins can still determine whether the plugin is supported or not by probing for it by name (the names of popular plugins are widely known). Therefore not exposing a plugin at all is preferred. Unfortunately, many legacy sites use this feature to determine, for example, which plugin to use to play video. Not exposing any plugins at all might therefore not be entirely plausible./p> p>The code idplugins-2:pluginarray-5>a href#pluginarray>PluginArray/a>/code> objects created by a user agent must not be a href#live idplugins-2:live>live/a>. The set of plugins represented by the objects must not change once an object is created, except when it is updated by the code idplugins-2:dom-pluginarray-refresh-3>a href#dom-pluginarray-refresh>refresh()/a>/code> method./p> p>Each a href#plugin idplugins-2:plugin-3>plugin/a> represented by a code idplugins-2:pluginarray-6>a href#pluginarray>PluginArray/a>/code> can support a number of a hrefhttps://mimesniff.spec.whatwg.org/#mime-type idplugins-2:mime-type data-x-internalmime-type>MIME types/a>. For each such a href#plugin idplugins-2:plugin-4>plugin/a>, the user agent must pick one or more of these a hrefhttps://mimesniff.spec.whatwg.org/#mime-type idplugins-2:mime-type-2 data-x-internalmime-type>MIME types/a> to be those that are dfn idexplicitly-supported>explicitly supported/dfn>./p> p classnote>The a href#explicitly-supported idplugins-2:explicitly-supported>explicitly supported/a> a hrefhttps://mimesniff.spec.whatwg.org/#mime-type idplugins-2:mime-type-3 data-x-internalmime-type>MIME types/a> of a a href#plugin idplugins-2:plugin-5>plugin/a> are those that are exposed through the code idplugins-2:dom-plugin-10>a href#dom-plugin>Plugin/a>/code> and code idplugins-2:mimetypearray-3>a href#mimetypearray>MimeTypeArray/a>/code> interfaces. As with a href#plugin idplugins-2:plugin-6>plugins/a> themselves, any variation between users regarding what is exposed allows sites to fingerprint users. User agents are therefore encouraged to expose the same a hrefhttps://mimesniff.spec.whatwg.org/#mime-type idplugins-2:mime-type-4 data-x-internalmime-type>MIME types/a> for all users of a a href#plugin idplugins-2:plugin-7>plugin/a>, regardless of the actual types supported... at least, within the constraints imposed by compatibility with legacy content./p> p>The a idplugins-2:supported-property-indices hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a> of a code idplugins-2:pluginarray-7>a href#pluginarray>PluginArray/a>/code> object are the numbers from zero to the number of non-a href#hidden-plugin idplugins-2:hidden-plugin-3>hidden/a> a href#plugin idplugins-2:plugin-8>plugins/a> represented by the object, if any. a href#fingerprinting-vector idplugins-2:fingerprinting-vector classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> p>The dfn iddom-pluginarray-length>code>length/code>/dfn> attribute must return the number of non-a href#hidden-plugin idplugins-2:hidden-plugin-4>hidden/a> a href#plugin idplugins-2:plugin-9>plugins/a> represented by the object. a href#fingerprinting-vector idplugins-2:fingerprinting-vector-2 classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> p>The dfn iddom-pluginarray-item>code>item()/code>/dfn> method of a code idplugins-2:pluginarray-8>a href#pluginarray>PluginArray/a>/code> object must return null if the argument is not one of the objects a idplugins-2:supported-property-indices-2 hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a>, and otherwise must return the result of running the following steps, using the methods argument as var>index/var>:/p> ol>li>p>Let var>list/var> be the code idplugins-2:dom-plugin-11>a href#dom-plugin>Plugin/a>/code> objects representing the non-a href#hidden-plugin idplugins-2:hidden-plugin-5>hidden/a> a href#plugin idplugins-2:plugin-10>plugins/a> represented by the code idplugins-2:pluginarray-9>a href#pluginarray>PluginArray/a>/code> object.li>p>Sort var>list/var> alphabetically by the code idplugins-2:dom-plugin-name-3>a href#dom-plugin-name>name/a>/code> of each code idplugins-2:dom-plugin-12>a href#dom-plugin>Plugin/a>/code>.li>p>Return the var>index/var>th entry in var>list/var>./ol> p classnote>It is important a href#fingerprinting-vector idplugins-2:fingerprinting-vector-3 classno-backref>for privacy/a> that the order of plugins not leak additional information, e.g. the order in which plugins were installed./p> p>The a idplugins-2:supported-property-names hrefhttps://heycam.github.io/webidl/#dfn-supported-property-names data-x-internalsupported-property-names>supported property names/a> of a code idplugins-2:pluginarray-10>a href#pluginarray>PluginArray/a>/code> object are the values of the code idplugins-2:dom-plugin-name-4>a href#dom-plugin-name>name/a>/code> attributes of all the code idplugins-2:dom-plugin-13>a href#dom-plugin>Plugin/a>/code> objects represented by the code idplugins-2:pluginarray-11>a href#pluginarray>PluginArray/a>/code> object. a href#fingerprinting-vector idplugins-2:fingerprinting-vector-4 classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> p>The dfn iddom-pluginarray-nameditem>code>namedItem()/code>/dfn> method of a code idplugins-2:pluginarray-12>a href#pluginarray>PluginArray/a>/code> object must return null if the argument is not one of the objects a idplugins-2:supported-property-names-2 hrefhttps://heycam.github.io/webidl/#dfn-supported-property-names data-x-internalsupported-property-names>supported property names/a>, and otherwise must return the code idplugins-2:dom-plugin-14>a href#dom-plugin>Plugin/a>/code> object, of those represented by the code idplugins-2:pluginarray-13>a href#pluginarray>PluginArray/a>/code> object, that has a code idplugins-2:dom-plugin-name-5>a href#dom-plugin-name>name/a>/code> equal to the methods argument./p> p>The dfn iddom-pluginarray-refresh>code>refresh()/code>/dfn> method of the code idplugins-2:pluginarray-14>a href#pluginarray>PluginArray/a>/code> object of a code idplugins-2:navigator>a href#navigator>Navigator/a>/code> object, when invoked, must check to see if any a href#plugin idplugins-2:plugin-11>plugins/a> have been installed or reconfigured since the user agent created the code idplugins-2:pluginarray-15>a href#pluginarray>PluginArray/a>/code> object. If so, and the methods argument is true, then the user agent must act as if the code idplugins-2:dom-location-reload>a href#dom-location-reload>location.reload()/a>/code> method was called instead. Otherwise, the user agent must update the code idplugins-2:pluginarray-16>a href#pluginarray>PluginArray/a>/code> object and code idplugins-2:mimetypearray-4>a href#mimetypearray>MimeTypeArray/a>/code> object created for attributes of that code idplugins-2:navigator-2>a href#navigator>Navigator/a>/code> object, and the code idplugins-2:dom-plugin-15>a href#dom-plugin>Plugin/a>/code> and code idplugins-2:mimetype-11>a href#mimetype>MimeType/a>/code> objects created for those code idplugins-2:pluginarray-17>a href#pluginarray>PluginArray/a>/code> and code idplugins-2:mimetypearray-5>a href#mimetypearray>MimeTypeArray/a>/code> objects, using the same code idplugins-2:dom-plugin-16>a href#dom-plugin>Plugin/a>/code> objects for cases where the code idplugins-2:dom-plugin-name-6>a href#dom-plugin-name>name/a>/code> is the same, and the same code idplugins-2:mimetype-12>a href#mimetype>MimeType/a>/code> objects for cases where the code idplugins-2:dom-mimetype-type-3>a href#dom-mimetype-type>type/a>/code> is the same, and creating new objects for cases where there were no matching objects immediately prior to the code idplugins-2:dom-pluginarray-refresh-4>a href#dom-pluginarray-refresh>refresh()/a>/code> call. Old code idplugins-2:dom-plugin-17>a href#dom-plugin>Plugin/a>/code> and code idplugins-2:mimetype-13>a href#mimetype>MimeType/a>/code> objects must continue to return the same values that they had prior to the update, though naturally now the data is stale and may appear inconsistent (for example, an old code idplugins-2:mimetype-14>a href#mimetype>MimeType/a>/code> entry might list as its code idplugins-2:dom-mimetype-enabledplugin-3>a href#dom-mimetype-enabledplugin>enabledPlugin/a>/code> a code idplugins-2:dom-plugin-18>a href#dom-plugin>Plugin/a>/code> object that no longer lists that code idplugins-2:mimetype-15>a href#mimetype>MimeType/a>/code> as a supported code idplugins-2:mimetype-16>a href#mimetype>MimeType/a>/code>)./p> hr> p>A code idplugins-2:mimetypearray-6>a href#mimetypearray>MimeTypeArray/a>/code> object represents the a hrefhttps://mimesniff.spec.whatwg.org/#mime-type idplugins-2:mime-type-5 data-x-internalmime-type>MIME types/a> a href#explicitly-supported idplugins-2:explicitly-supported-2>explicitly supported/a> by a href#plugin idplugins-2:plugin-12>plugins/a> supported by the user agent, each of which is represented by a code idplugins-2:mimetype-17>a href#mimetype>MimeType/a>/code> object./p> p>The code idplugins-2:mimetypearray-7>a href#mimetypearray>MimeTypeArray/a>/code> objects created by a user agent must not be a href#live idplugins-2:live-2>live/a>. The set of MIME types represented by the objects must not change once an object is created, except when it is updated by the code idplugins-2:pluginarray-18>a href#pluginarray>PluginArray/a>/code> objects code idplugins-2:dom-pluginarray-refresh-5>a href#dom-pluginarray-refresh>refresh()/a>/code> method./p> p>The a idplugins-2:supported-property-indices-3 hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a> of a code idplugins-2:mimetypearray-8>a href#mimetypearray>MimeTypeArray/a>/code> object are the numbers from zero to the number of a hrefhttps://mimesniff.spec.whatwg.org/#mime-type idplugins-2:mime-type-6 data-x-internalmime-type>MIME types/a> a href#explicitly-supported idplugins-2:explicitly-supported-3>explicitly supported/a> by non-a href#hidden-plugin idplugins-2:hidden-plugin-6>hidden/a> a href#plugin idplugins-2:plugin-13>plugins/a> represented by the corresponding code idplugins-2:pluginarray-19>a href#pluginarray>PluginArray/a>/code> object, if any. a href#fingerprinting-vector idplugins-2:fingerprinting-vector-5 classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> p>The dfn iddom-mimetypearray-length>code>length/code>/dfn> attribute must return the number of a hrefhttps://mimesniff.spec.whatwg.org/#mime-type idplugins-2:mime-type-7 data-x-internalmime-type>MIME types/a> a href#explicitly-supported idplugins-2:explicitly-supported-4>explicitly supported/a> by non-a href#hidden-plugin idplugins-2:hidden-plugin-7>hidden/a> a href#plugin idplugins-2:plugin-14>plugins/a> represented by the corresponding code idplugins-2:pluginarray-20>a href#pluginarray>PluginArray/a>/code> object, if any. a href#fingerprinting-vector idplugins-2:fingerprinting-vector-6 classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> p>The dfn iddom-mimetypearray-item>code>item()/code>/dfn> method of a code idplugins-2:mimetypearray-9>a href#mimetypearray>MimeTypeArray/a>/code> object must return null if the argument is not one of the objects a idplugins-2:supported-property-indices-4 hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a>, and otherwise must return the result of running the following steps, using the methods argument as var>index/var>:/p> ol>li>p>Let var>list/var> be the code idplugins-2:mimetype-18>a href#mimetype>MimeType/a>/code> objects representing the a hrefhttps://mimesniff.spec.whatwg.org/#mime-type idplugins-2:mime-type-8 data-x-internalmime-type>MIME types/a> a href#explicitly-supported idplugins-2:explicitly-supported-5>explicitly supported/a> by non-a href#hidden-plugin idplugins-2:hidden-plugin-8>hidden/a> a href#plugin idplugins-2:plugin-15>plugins/a> represented by the corresponding code idplugins-2:pluginarray-21>a href#pluginarray>PluginArray/a>/code> object, if any.li>p>Sort var>list/var> alphabetically by the code idplugins-2:dom-mimetype-type-4>a href#dom-mimetype-type>type/a>/code> of each code idplugins-2:mimetype-19>a href#mimetype>MimeType/a>/code>.li>p>Return the var>index/var>th entry in var>list/var>./ol> p classnote>It is important a href#fingerprinting-vector idplugins-2:fingerprinting-vector-7 classno-backref>for privacy/a> that the order of MIME types not leak additional information, e.g. the order in which plugins were installed./p> p>The a idplugins-2:supported-property-names-3 hrefhttps://heycam.github.io/webidl/#dfn-supported-property-names data-x-internalsupported-property-names>supported property names/a> of a code idplugins-2:mimetypearray-10>a href#mimetypearray>MimeTypeArray/a>/code> object are the values of the code idplugins-2:dom-mimetype-type-5>a href#dom-mimetype-type>type/a>/code> attributes of all the code idplugins-2:mimetype-20>a href#mimetype>MimeType/a>/code> objects represented by the code idplugins-2:mimetypearray-11>a href#mimetypearray>MimeTypeArray/a>/code> object. a href#fingerprinting-vector idplugins-2:fingerprinting-vector-8 classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> p>The dfn iddom-mimetypearray-nameditem>code>namedItem()/code>/dfn> method of a code idplugins-2:mimetypearray-12>a href#mimetypearray>MimeTypeArray/a>/code> object must return null if the argument is not one of the objects a idplugins-2:supported-property-names-4 hrefhttps://heycam.github.io/webidl/#dfn-supported-property-names data-x-internalsupported-property-names>supported property names/a>, and otherwise must return the code idplugins-2:mimetype-21>a href#mimetype>MimeType/a>/code> object that has a code idplugins-2:dom-mimetype-type-6>a href#dom-mimetype-type>type/a>/code> equal to the methods argument./p> hr> p>A code idplugins-2:dom-plugin-19>a href#dom-plugin>Plugin/a>/code> object represents a a href#plugin idplugins-2:plugin-16>plugin/a>. It has several attributes to provide details about the plugin, and can be enumerated to obtain the list of a hrefhttps://mimesniff.spec.whatwg.org/#mime-type idplugins-2:mime-type-9 data-x-internalmime-type>MIME types/a> that it a href#explicitly-supported idplugins-2:explicitly-supported-6>explicitly supports/a>./p> p>The code idplugins-2:dom-plugin-20>a href#dom-plugin>Plugin/a>/code> objects created by a user agent must not be a href#live idplugins-2:live-3>live/a>. The set of MIME types represented by the objects, and the values of the objects attributes, must not change once an object is created, except when updated by the code idplugins-2:pluginarray-22>a href#pluginarray>PluginArray/a>/code> objects code idplugins-2:dom-pluginarray-refresh-6>a href#dom-pluginarray-refresh>refresh()/a>/code> method./p> p>The dfn idreported-mime-types>reported MIME types/dfn> for a code idplugins-2:dom-plugin-21>a href#dom-plugin>Plugin/a>/code> object are the a hrefhttps://mimesniff.spec.whatwg.org/#mime-type idplugins-2:mime-type-10 data-x-internalmime-type>MIME types/a> a href#explicitly-supported idplugins-2:explicitly-supported-7>explicitly supported/a> by the corresponding a href#plugin idplugins-2:plugin-17>plugin/a> when this object was last created or updated by code idplugins-2:dom-pluginarray-refresh-7>a href#dom-pluginarray-refresh>PluginArray.refresh()/a>/code>, whichever happened most recently./p> p>The a idplugins-2:supported-property-indices-5 hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a> of a code idplugins-2:dom-plugin-22>a href#dom-plugin>Plugin/a>/code> object are the numbers from zero to the number of a href#reported-mime-types idplugins-2:reported-mime-types>reported MIME types/a>. a href#fingerprinting-vector idplugins-2:fingerprinting-vector-9 classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> p>The dfn iddom-plugin-length>code>length/code>/dfn> attribute must return the number of a href#reported-mime-types idplugins-2:reported-mime-types-2>reported MIME types/a>. a href#fingerprinting-vector idplugins-2:fingerprinting-vector-10 classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> p>The dfn iddom-plugin-item>code>item()/code>/dfn> method of a code idplugins-2:dom-plugin-23>a href#dom-plugin>Plugin/a>/code> object must return null if the argument is not one of the objects a idplugins-2:supported-property-indices-6 hrefhttps://heycam.github.io/webidl/#dfn-supported-property-indices data-x-internalsupported-property-indices>supported property indices/a>, and otherwise must return the result of running the following steps, using the methods argument as var>index/var>:/p> ol>li>p>Let var>list/var> be the code idplugins-2:mimetype-22>a href#mimetype>MimeType/a>/code> objects representing the a href#reported-mime-types idplugins-2:reported-mime-types-3>reported MIME types/a>.li>p>Sort var>list/var> alphabetically by the code idplugins-2:dom-mimetype-type-7>a href#dom-mimetype-type>type/a>/code> of each code idplugins-2:mimetype-23>a href#mimetype>MimeType/a>/code>.li>p>Return the var>index/var>th entry in var>list/var>./ol> p classnote>It is important a href#fingerprinting-vector idplugins-2:fingerprinting-vector-11 classno-backref>for privacy/a> that the order of MIME types not leak additional information, e.g. the order in which plugins were installed./p> p>The a idplugins-2:supported-property-names-5 hrefhttps://heycam.github.io/webidl/#dfn-supported-property-names data-x-internalsupported-property-names>supported property names/a> of a code idplugins-2:dom-plugin-24>a href#dom-plugin>Plugin/a>/code> object are the values of the code idplugins-2:dom-mimetype-type-8>a href#dom-mimetype-type>type/a>/code> attributes of the code idplugins-2:mimetype-24>a href#mimetype>MimeType/a>/code> objects representing the a href#reported-mime-types idplugins-2:reported-mime-types-4>reported MIME types/a>. a href#fingerprinting-vector idplugins-2:fingerprinting-vector-12 classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> p>The dfn iddom-plugin-nameditem>code>namedItem()/code>/dfn> method of a code idplugins-2:dom-plugin-25>a href#dom-plugin>Plugin/a>/code> object must return null if the argument is not one of the objects a idplugins-2:supported-property-names-6 hrefhttps://heycam.github.io/webidl/#dfn-supported-property-names data-x-internalsupported-property-names>supported property names/a>, and otherwise must return the code idplugins-2:mimetype-25>a href#mimetype>MimeType/a>/code> object that has a code idplugins-2:dom-mimetype-type-9>a href#dom-mimetype-type>type/a>/code> equal to the methods argument./p> p>The dfn iddom-plugin-name>code>name/code>/dfn> attribute must return the a href#plugin idplugins-2:plugin-18>plugin/a>s name./p> p>The dfn iddom-plugin-description>code>description/code>/dfn> and dfn iddom-plugin-filename>code>filename/code>/dfn> attributes must return user-agent-defined (or, in all likelihood, a href#plugin idplugins-2:plugin-19>plugin/a>-defined) strings. In each case, the same string must be returned each time, except that the strings returned may change when the code idplugins-2:dom-pluginarray-refresh-8>a href#dom-pluginarray-refresh>PluginArray.refresh()/a>/code> method updates the object./p> p classwarning>If the values returned by the code idplugins-2:dom-plugin-description-3>a href#dom-plugin-description>description/a>/code> or code idplugins-2:dom-plugin-filename-3>a href#dom-plugin-filename>filename/a>/code> attributes vary between versions of a a href#plugin idplugins-2:plugin-20>plugin/a>, they can be used both as a fingerprinting vector and, even more importantly, as a trivial way to determine what security vulnerabilities a a href#plugin idplugins-2:plugin-21>plugin/a> (and thus a browser) may have. It is thus highly recommended that the code idplugins-2:dom-plugin-description-4>a href#dom-plugin-description>description/a>/code> attribute just return the same value as the code idplugins-2:dom-plugin-name-7>a href#dom-plugin-name>name/a>/code> attribute, and that the code idplugins-2:dom-plugin-filename-4>a href#dom-plugin-filename>filename/a>/code> attribute return the empty string. a href#fingerprinting-vector idplugins-2:fingerprinting-vector-13 classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> hr> p>A code idplugins-2:mimetype-26>a href#mimetype>MimeType/a>/code> object represents a a idplugins-2:mime-type-11 hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> that is, or was, a href#explicitly-supported idplugins-2:explicitly-supported-8>explicitly supported/a> by a a href#plugin idplugins-2:plugin-22>plugin/a>./p> p>The code idplugins-2:mimetype-27>a href#mimetype>MimeType/a>/code> objects created by a user agent must not be a href#live idplugins-2:live-4>live/a>. The values of the objects attributes must not change once an object is created, except when updated by the code idplugins-2:pluginarray-23>a href#pluginarray>PluginArray/a>/code> objects code idplugins-2:dom-pluginarray-refresh-9>a href#dom-pluginarray-refresh>refresh()/a>/code> method./p> p>The dfn iddom-mimetype-type>code>type/code>/dfn> attribute must return the a idplugins-2:valid-mime-type-with-no-parameters hrefhttps://mimesniff.spec.whatwg.org/#valid-mime-type-with-no-parameters data-x-internalvalid-mime-type-with-no-parameters>valid MIME type with no parameters/a> describing the a idplugins-2:mime-type-12 hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a>./p> p>The dfn iddom-mimetype-description>code>description/code>/dfn> and dfn iddom-mimetype-suffixes>code>suffixes/code>/dfn> attributes must return user-agent-defined (or, in all likelihood, a href#plugin idplugins-2:plugin-23>plugin/a>-defined) strings. In each case, the same string must be returned each time, except that the strings returned may change when the code idplugins-2:dom-pluginarray-refresh-10>a href#dom-pluginarray-refresh>PluginArray.refresh()/a>/code> method updates the object./p> p classwarning>If the values returned by the code idplugins-2:dom-mimetype-description-3>a href#dom-mimetype-description>description/a>/code> or code idplugins-2:dom-mimetype-suffixes-3>a href#dom-mimetype-suffixes>suffixes/a>/code> attributes vary between versions of a a href#plugin idplugins-2:plugin-24>plugin/a>, they can be used both as a fingerprinting vector and, even more importantly, as a trivial way to determine what security vulnerabilities a a href#plugin idplugins-2:plugin-25>plugin/a> (and thus a browser) may have. It is thus highly recommended that the code idplugins-2:dom-mimetype-description-4>a href#dom-mimetype-description>description/a>/code> attribute just return the same value as the code idplugins-2:dom-mimetype-type-10>a href#dom-mimetype-type>type/a>/code> attribute, and that the code idplugins-2:dom-mimetype-suffixes-4>a href#dom-mimetype-suffixes>suffixes/a>/code> attribute return the empty string. a href#fingerprinting-vector idplugins-2:fingerprinting-vector-14 classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> p classnote>Commas in the code idplugins-2:dom-mimetype-suffixes-5>a href#dom-mimetype-suffixes>suffixes/a>/code> attribute are interpreted as separating subsequent filename extensions, as in code>htm,html/code>./p> p>The dfn iddom-mimetype-enabledplugin>code>enabledPlugin/code>/dfn> attribute must return the code idplugins-2:dom-plugin-26>a href#dom-plugin>Plugin/a>/code> object that represents the a href#plugin idplugins-2:plugin-26>plugin/a> that a href#explicitly-supported idplugins-2:explicitly-supported-9>explicitly supported/a> the a idplugins-2:mime-type-13 hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> that this code idplugins-2:mimetype-28>a href#mimetype>MimeType/a>/code> object represents when this object was last created or updated by code idplugins-2:dom-pluginarray-refresh-11>a href#dom-pluginarray-refresh>PluginArray.refresh()/a>/code>, whichever happened most recently./p> hr> p>The dfn iddom-navigator-javaenabled>code>navigator.javaEnabled()/code>/dfn> method must return true if the user agent supports a a href#plugin idplugins-2:plugin-27>plugin/a> that supports the a idplugins-2:mime-type-14 hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> code>application/x-java-vm/code>; otherwise it must return false. a href#fingerprinting-vector idplugins-2:fingerprinting-vector-15 classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> h3 idimages-2>span classsecno>8.8/span> Imagesa href#images-2 classself-link>/a>/h3> pre classidl>Exposed(Window,Worker), a href#serializable idimages-2:serializable>Serializable/a>, a href#transferable idimages-2:transferable>Transferable/a>interface dfn idimagebitmap>ImageBitmap/dfn> { readonly attribute unsigned long a href#dom-imagebitmap-width idimages-2:dom-imagebitmap-width>width/a>; readonly attribute unsigned long a href#dom-imagebitmap-height idimages-2:dom-imagebitmap-height>height/a>; void a href#dom-imagebitmap-close idimages-2:dom-imagebitmap-close>close/a>();};typedef (a href#canvasimagesource idimages-2:canvasimagesource>CanvasImageSource/a> or a idimages-2:blob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob data-x-internalblob>Blob/a> or a href#imagedata idimages-2:imagedata>ImageData/a>) dfn idimagebitmapsource>ImageBitmapSource/dfn>;enum dfn idimageorientation>ImageOrientation/dfn> { a href#dom-imageorientation-none idimages-2:dom-imageorientation-none>none/a>, a href#dom-imageorientation-flipy idimages-2:dom-imageorientation-flipy>flipY/a> };enum dfn idpremultiplyalpha>PremultiplyAlpha/dfn> { a href#dom-premultiplyalpha-none idimages-2:dom-premultiplyalpha-none>none/a>, a href#dom-premultiplyalpha-premultiply idimages-2:dom-premultiplyalpha-premultiply>premultiply/a>, a href#dom-premultiplyalpha-default idimages-2:dom-premultiplyalpha-default>default/a> };enum dfn idcolorspaceconversion>ColorSpaceConversion/dfn> { a href#dom-colorspaceconversion-none idimages-2:dom-colorspaceconversion-none>none/a>, a href#dom-colorspaceconversion-default idimages-2:dom-colorspaceconversion-default>default/a> };enum dfn idresizequality>ResizeQuality/dfn> { a href#dom-resizequality-pixelated idimages-2:dom-resizequality-pixelated>pixelated/a>, a href#dom-resizequality-low idimages-2:dom-resizequality-low>low/a>, a href#dom-resizequality-medium idimages-2:dom-resizequality-medium>medium/a>, a href#dom-resizequality-high idimages-2:dom-resizequality-high>high/a> };dictionary dfn idimagebitmapoptions>ImageBitmapOptions/dfn> { a href#imageorientation idimages-2:imageorientation>ImageOrientation/a> a href#dom-imagebitmapoptions-imageorientation idimages-2:dom-imagebitmapoptions-imageorientation>imageOrientation/a> a href#dom-imageorientation-none idimages-2:dom-imageorientation-none-2>none/a>; a href#premultiplyalpha idimages-2:premultiplyalpha>PremultiplyAlpha/a> a href#dom-imagebitmapoptions-premultiplyalpha idimages-2:dom-imagebitmapoptions-premultiplyalpha>premultiplyAlpha/a> a href#dom-premultiplyalpha-default idimages-2:dom-premultiplyalpha-default-2>default/a>; a href#colorspaceconversion idimages-2:colorspaceconversion>ColorSpaceConversion/a> a href#dom-imagebitmapoptions-colorspaceconversion idimages-2:dom-imagebitmapoptions-colorspaceconversion>colorSpaceConversion/a> a href#dom-colorspaceconversion-default idimages-2:dom-colorspaceconversion-default-2>default/a>; EnforceRange unsigned long a href#dom-imagebitmapoptions-resizewidth idimages-2:dom-imagebitmapoptions-resizewidth>resizeWidth/a>; EnforceRange unsigned long a href#dom-imagebitmapoptions-resizeheight idimages-2:dom-imagebitmapoptions-resizeheight>resizeHeight/a>; a href#resizequality idimages-2:resizequality>ResizeQuality/a> a href#dom-imagebitmapoptions-resizequality idimages-2:dom-imagebitmapoptions-resizequality>resizeQuality/a> a href#dom-resizequality-low idimages-2:dom-resizequality-low-2>low/a>;};/pre> p>An code idimages-2:imagebitmap>a href#imagebitmap>ImageBitmap/a>/code> object represents a bitmap image that can be painted to a canvas without undue latency./p> p classnote>The exact judgement of what is undue latency of this is left up to the implementer, but in general if making use of the bitmap requires network I/O, or even local disk I/O, then the latency is probably undue; whereas if it only requires a blocking read from a GPU or system RAM, the latency is probably acceptable./p> dl classdomintro>dt>var>promise/var> self . code idimages-2:dom-createimagebitmap>a href#dom-createimagebitmap>createImageBitmap/a>/code>(var>image/var> , var>options/var> )dt>var>promise/var> self . code idimages-2: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> , var>options/var> )dd> p>Takes var>image/var>, which can be an code idimages-2:the-img-element>a href#the-img-element>img/a>/code> element, an a idimages-2:svg-image hrefhttps://www.w3.org/TR/SVG11/struct.html#ImageElement data-x-internalsvg-image>SVG code>image/code>/a> element, a code idimages-2:the-video-element>a href#the-video-element>video/a>/code> element, a code idimages-2:the-canvas-element>a href#the-canvas-element>canvas/a>/code> element, a code idimages-2:blob-2>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> object, an code idimages-2:imagedata-2>a href#imagedata>ImageData/a>/code> object, or another code idimages-2:imagebitmap-2>a href#imagebitmap>ImageBitmap/a>/code> object, and returns a promise that is resolved when a new code idimages-2:imagebitmap-3>a href#imagebitmap>ImageBitmap/a>/code> is created./p> p>If no code idimages-2:imagebitmap-4>a href#imagebitmap>ImageBitmap/a>/code> object can be constructed, for example because the provided var>image/var> data is not actually an image, then the promise is rejected instead./p> p>If var>sx/var>, var>sy/var>, var>sw/var>, and var>sh/var> arguments are provided, the source image is cropped to the given pixels, with any pixels missing in the original replaced by a href#transparent-black idimages-2:transparent-black>transparent black/a>. These coordinates are in the source images pixel coordinate space, em>not/em> in a hrefhttps://drafts.csswg.org/css-values/#px idimages-2:px data-x-internalpx>CSS pixels/a>./p> p>If var>options/var> is provided, the code idimages-2:imagebitmap-5>a href#imagebitmap>ImageBitmap/a>/code> objects bitmap data is modified according to var>options/var>. For example, if the code idimages-2:dom-imagebitmapoptions-premultiplyalpha-2>a href#dom-imagebitmapoptions-premultiplyalpha>premultiplyAlpha/a>/code> option is set to code idimages-2:dom-premultiplyalpha-premultiply-2>a href#dom-premultiplyalpha-premultiply>premultiply/a>/code>, the a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data>bitmap data/a>s color channels are premultiplied by its alpha channel. p>Rejects the promise with an a idimages-2:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idimages-2:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the source image is not in a valid state (e.g. an code idimages-2:the-img-element-2>a href#the-img-element>img/a>/code> element that hasnt loaded successfully, an code idimages-2:imagebitmap-6>a href#imagebitmap>ImageBitmap/a>/code> object whose a href#detached idimages-2:detached>Detached/a> internal slot value is true, an code idimages-2:imagedata-3>a href#imagedata>ImageData/a>/code> object whose code idimages-2:dom-imagedata-data>a href#dom-imagedata-data>data/a>/code> attribute values a href#detached idimages-2:detached-2>Detached/a> internal slot value is true, or a code idimages-2:blob-3>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> whose data cannot be interpreted as a bitmap image)./p> p>Rejects the promise with a a idimages-2:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idimages-2:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if the script is not allowed to access the image data of the source image (e.g. a code idimages-2:the-video-element-2>a href#the-video-element>video/a>/code> that is a href#cors-cross-origin idimages-2:cors-cross-origin>CORS-cross-origin/a>, or a code idimages-2:the-canvas-element-2>a href#the-canvas-element>canvas/a>/code> being drawn on by a script in a worker from another a href#concept-origin idimages-2:concept-origin>origin/a>)./p> dt>var>imageBitmap/var> . code idimages-2:dom-imagebitmap-close-2>a href#dom-imagebitmap-close>close/a>/code>()dd> p>Releases var>imageBitmap/var>s underlying a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data-2>bitmap data/a>./p> dt>var>imageBitmap/var> . code idimages-2:dom-imagebitmap-width-2>a href#dom-imagebitmap-width>width/a>/code>dd> p>Returns the a href#intrinsic-width idimages-2:intrinsic-width>intrinsic width/a> of the image, in a hrefhttps://drafts.csswg.org/css-values/#px idimages-2:px-2 data-x-internalpx>CSS pixels/a>./p> dt>var>imageBitmap/var> . code idimages-2:dom-imagebitmap-height-2>a href#dom-imagebitmap-height>height/a>/code>dd> p>Returns the a href#intrinsic-height idimages-2:intrinsic-height>intrinsic height/a> of the image, in a hrefhttps://drafts.csswg.org/css-values/#px idimages-2:px-3 data-x-internalpx>CSS pixels/a>./p> /dl> p>An code idimages-2:imagebitmap-7>a href#imagebitmap>ImageBitmap/a>/code> object whose a href#detached idimages-2:detached-3>Detached/a> internal slot value is false always has associated dfn idconcept-imagebitmap-bitmap-data>bitmap data/dfn>, with a width and a height. However, it is possible for this data to be corrupted. If an code idimages-2:imagebitmap-8>a href#imagebitmap>ImageBitmap/a>/code> objects media data can be decoded without errors, it is said to be dfn idconcept-imagebitmap-good>fully decodable/dfn>./p> p>An code idimages-2:imagebitmap-9>a href#imagebitmap>ImageBitmap/a>/code> objects bitmap has an a href#concept-canvas-origin-clean idimages-2:concept-canvas-origin-clean>origin-clean/a> flag, which indicates whether the bitmap is tainted by content from a different a href#concept-origin idimages-2:concept-origin-2>origin/a>. The flag is initially set to true and may be changed to false by the steps of code idimages-2:dom-createimagebitmap-3>a href#dom-createimagebitmap>createImageBitmap()/a>/code>./p> hr> p>code idimages-2:imagebitmap-10>a href#imagebitmap>ImageBitmap/a>/code> objects are a href#serializable-objects idimages-2:serializable-objects>serializable objects/a> and a href#transferable-objects idimages-2:transferable-objects>transferable objects/a>./p> p>Their a href#serialization-steps idimages-2:serialization-steps>serialization steps/a>, given var>value/var> and var>serialized/var>, are:/p> ol>li>p>Set var>serialized/var>.BitmapData to a copy of var>value/var>s a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data-3>bitmap data/a>.li>p>Set var>serialized/var>.OriginClean to true if var>value/var>s a href#concept-canvas-origin-clean idimages-2:concept-canvas-origin-clean-2>origin-clean/a> flag is set, and false otherwise./ol> p>Their a href#deserialization-steps idimages-2:deserialization-steps>deserialization steps/a>, given var>serialized/var> and var>value/var>, are:/p> ol>li>p>Set var>value/var>s a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data-4>bitmap data/a> to var>serialized/var>.BitmapData.li>p>If var>serialized/var>.OriginClean is true, set var>value/var>s a href#concept-canvas-origin-clean idimages-2:concept-canvas-origin-clean-3>origin-clean/a> flag./ol> p>Their a href#transfer-steps idimages-2:transfer-steps>transfer steps/a>, given var>value/var> and var>dataHolder/var>, are:/p> ol>li>p>Set var>dataHolder/var>.BitmapData to var>value/var>s a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data-5>bitmap data/a>.li>p>Set var>dataHolder/var>.OriginClean to true if var>value/var>s a href#concept-canvas-origin-clean idimages-2:concept-canvas-origin-clean-4>origin-clean/a> flag is set, and false otherwise.li>p>Unset var>value/var>s a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data-6>bitmap data/a>./ol> p>Their a href#transfer-receiving-steps idimages-2:transfer-receiving-steps>transfer-receiving steps/a>, given var>dataHolder/var> and var>value/var>, are:/p> ol>li>p>Set var>value/var>s a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data-7>bitmap data/a> to var>dataHolder/var>.BitmapData.li>p>If var>dataHolder/var>.OriginClean is true, set var>value/var>s a href#concept-canvas-origin-clean idimages-2:concept-canvas-origin-clean-5>origin-clean/a> flag./ol> hr> p>An code idimages-2:imagebitmap-11>a href#imagebitmap>ImageBitmap/a>/code> object can be obtained from a variety of different objects, using the dfn iddom-createimagebitmap>code>createImageBitmap()/code>/dfn> method. When invoked, the method must act as follows:/p> dl>dt>If var>image/var> is an code idimages-2:the-img-element-3>a href#the-img-element>img/a>/code> element dt>If var>image/var> is an a idimages-2:svg-image-2 hrefhttps://www.w3.org/TR/SVG11/struct.html#ImageElement data-x-internalsvg-image>SVG code>image/code>/a> element dd> ol>li>p>If either the var>sw/var> or var>sh/var> arguments are specified but zero, return a promise rejected with a code idimages-2:js-rangeerror>a data-x-internaljs-rangeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-rangeerror>RangeError/a>/code>.li>p>If var>image/var> is not a href#img-all idimages-2:img-all>completely available/a>, then return a promise rejected with an a idimages-2:invalidstateerror-2 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idimages-2:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If var>image/var>s media data has no a idimages-2:intrinsic-dimensions hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic data-x-internalintrinsic-dimensions>intrinsic dimensions/a> (e.g. its a vector graphic with no specified content size), and both or either of the dfn iddom-imagebitmapoptions-resizewidth>code>resizeWidth/code>/dfn> and dfn iddom-imagebitmapoptions-resizeheight>code>resizeHeight/code>/dfn> options are not specified, then return a promise rejected with an a idimages-2:invalidstateerror-3 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idimages-2:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If var>image/var>s media data has no a idimages-2:intrinsic-dimensions-2 hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic data-x-internalintrinsic-dimensions>intrinsic dimensions/a> (e.g. its a vector graphics with no specified content size), it should be rendered to a bitmap of the size specified by the code idimages-2:dom-imagebitmapoptions-resizewidth-2>a href#dom-imagebitmapoptions-resizewidth>resizeWidth/a>/code> and the code idimages-2:dom-imagebitmapoptions-resizeheight-2>a href#dom-imagebitmapoptions-resizeheight>resizeHeight/a>/code> options.li>p>If the var>sw/var> and var>sh/var> arguments are not specified and var>image/var>s media data has both or either of its a href#intrinsic-width idimages-2:intrinsic-width-2>intrinsic width/a> and a href#intrinsic-height idimages-2:intrinsic-height-2>intrinsic height/a> values equal to 0, then return a promise rejected with an a idimages-2:invalidstateerror-4 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idimages-2:domexception-5>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If the var>sh/var> argument is not specified and var>image/var>s media data has an a href#intrinsic-height idimages-2:intrinsic-height-3>intrinsic height/a> of 0, then return a promise rejected with an a idimages-2:invalidstateerror-5 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idimages-2:domexception-6>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Create a new code idimages-2:imagebitmap-12>a href#imagebitmap>ImageBitmap/a>/code> object.li>p>Let the code idimages-2:imagebitmap-13>a href#imagebitmap>ImageBitmap/a>/code> objects a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data-8>bitmap data/a> be a copy of var>image/var>s media data, a href#cropped-to-the-source-rectangle-with-formatting idimages-2:cropped-to-the-source-rectangle-with-formatting>cropped to the source rectangle with formatting/a>. If this is an animated image, the code idimages-2:imagebitmap-14>a href#imagebitmap>ImageBitmap/a>/code> objects a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data-9>bitmap data/a> must only be taken from the default image of the animation (the one that the format defines is to be used when animation is not supported or is disabled), or, if there is no such image, the first frame of the animation.li>p>If the a href#concept-origin idimages-2:concept-origin-3>origin/a> of var>image/var>s image is not the a href#same-origin idimages-2:same-origin>same origin/a> as the a href#concept-settings-object-origin idimages-2:concept-settings-object-origin>origin/a> specified by the a href#entry-settings-object idimages-2:entry-settings-object>entry settings object/a>, then set the a href#concept-canvas-origin-clean idimages-2:concept-canvas-origin-clean-6>origin-clean/a> flag of the code idimages-2:imagebitmap-15>a href#imagebitmap>ImageBitmap/a>/code> objects bitmap to false.li>p>Return a new promise, but continue running these steps a href#in-parallel idimages-2:in-parallel>in parallel/a>.li>p>Resolve the promise with the new code idimages-2:imagebitmap-16>a href#imagebitmap>ImageBitmap/a>/code> object as the value./ol> dt>If var>image/var> is a code idimages-2:the-video-element-3>a href#the-video-element>video/a>/code> element dd> ol>li>p>If either the var>sw/var> or var>sh/var> arguments are specified but zero, return a promise rejected with a code idimages-2:js-rangeerror-2>a data-x-internaljs-rangeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-rangeerror>RangeError/a>/code>.li>p>If the code idimages-2:the-video-element-4>a href#the-video-element>video/a>/code> elements code idimages-2:dom-media-networkstate>a href#dom-media-networkstate>networkState/a>/code> attribute is code idimages-2:dom-media-network_empty>a href#dom-media-network_empty>NETWORK_EMPTY/a>/code>, then return a promise rejected with an a idimages-2:invalidstateerror-6 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idimages-2:domexception-7>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>If the code idimages-2:the-video-element-5>a href#the-video-element>video/a>/code> elements code idimages-2:dom-media-readystate>a href#dom-media-readystate>readyState/a>/code> attribute is either code idimages-2:dom-media-have_nothing>a href#dom-media-have_nothing>HAVE_NOTHING/a>/code> or code idimages-2:dom-media-have_metadata>a href#dom-media-have_metadata>HAVE_METADATA/a>/code>, then return a promise rejected with an a idimages-2:invalidstateerror-7 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idimages-2:domexception-8>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Create a new code idimages-2:imagebitmap-17>a href#imagebitmap>ImageBitmap/a>/code> object.li>p>Let the code idimages-2:imagebitmap-18>a href#imagebitmap>ImageBitmap/a>/code> objects a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data-10>bitmap data/a> be a copy of the frame at the a href#current-playback-position idimages-2:current-playback-position>current playback position/a>, at the a href#media-resource idimages-2:media-resource>media resource/a>s a href#concept-video-intrinsic-width idimages-2:concept-video-intrinsic-width>intrinsic width/a> and a href#concept-video-intrinsic-height idimages-2:concept-video-intrinsic-height>intrinsic height/a> (i.e. after any aspect-ratio correction has been applied), a href#cropped-to-the-source-rectangle-with-formatting idimages-2:cropped-to-the-source-rectangle-with-formatting-2>cropped to the source rectangle with formatting/a>./p> li>p>If the a href#concept-origin idimages-2:concept-origin-4>origin/a> of the code idimages-2:the-video-element-6>a href#the-video-element>video/a>/code> element is not the a href#same-origin idimages-2:same-origin-2>same origin/a> as the a href#concept-settings-object-origin idimages-2:concept-settings-object-origin-2>origin/a> specified by the a href#entry-settings-object idimages-2:entry-settings-object-2>entry settings object/a>, then set the a href#concept-canvas-origin-clean idimages-2:concept-canvas-origin-clean-7>origin-clean/a> flag of the code idimages-2:imagebitmap-19>a href#imagebitmap>ImageBitmap/a>/code> objects bitmap to false.li>p>Return a new promise, but continue running these steps a href#in-parallel idimages-2:in-parallel-2>in parallel/a>.li>p>Resolve the promise with the new code idimages-2:imagebitmap-20>a href#imagebitmap>ImageBitmap/a>/code> object as the value./ol> dt>If var>image/var> is a code idimages-2:the-canvas-element-3>a href#the-canvas-element>canvas/a>/code> element dd> ol>li>p>If either the var>sw/var> or var>sh/var> arguments are specified but zero, return a promise rejected with a code idimages-2:js-rangeerror-3>a data-x-internaljs-rangeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-rangeerror>RangeError/a>/code>.li>p>If the code idimages-2:the-canvas-element-4>a href#the-canvas-element>canvas/a>/code> elements bitmap has either a horizontal dimension or a vertical dimension equal to zero, then return a promise rejected with an a idimages-2:invalidstateerror-8 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idimages-2:domexception-9>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Create a new code idimages-2:imagebitmap-21>a href#imagebitmap>ImageBitmap/a>/code> object.li>p>Let the code idimages-2:imagebitmap-22>a href#imagebitmap>ImageBitmap/a>/code> objects a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data-11>bitmap data/a> be a copy of the code idimages-2:the-canvas-element-5>a href#the-canvas-element>canvas/a>/code> elements a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data-12>bitmap data/a>, a href#cropped-to-the-source-rectangle-with-formatting idimages-2:cropped-to-the-source-rectangle-with-formatting-3>cropped to the source rectangle with formatting/a>.li>p>Set the a href#concept-canvas-origin-clean idimages-2:concept-canvas-origin-clean-8>origin-clean/a> flag of the code idimages-2:imagebitmap-23>a href#imagebitmap>ImageBitmap/a>/code> objects bitmap to the same value as the a href#concept-canvas-origin-clean idimages-2:concept-canvas-origin-clean-9>origin-clean/a> flag of the code idimages-2:the-canvas-element-6>a href#the-canvas-element>canvas/a>/code> elements bitmap.li>p>Return a new promise, but continue running these steps a href#in-parallel idimages-2:in-parallel-3>in parallel/a>.li>p>Resolve the promise with the new code idimages-2:imagebitmap-24>a href#imagebitmap>ImageBitmap/a>/code> object as the value./ol> dt>If var>image/var> is a code idimages-2:blob-4>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> object dd> ol>li>p>If either the var>sw/var> or var>sh/var> arguments are specified but zero, return a promise rejected with a code idimages-2:js-rangeerror-4>a data-x-internaljs-rangeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-rangeerror>RangeError/a>/code>.li>p>Return a new promise, but continue running these steps a href#in-parallel idimages-2:in-parallel-4>in parallel/a>.li>p>Read the code idimages-2:blob-5>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> objects data. If an a href#file-error-read idimages-2:file-error-read>error occurs during reading of the object/a>, then reject the promise with an a idimages-2:invalidstateerror-9 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idimages-2:domexception-10>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>, and abort these steps.li>p>Apply the a hrefhttps://mimesniff.spec.whatwg.org/#rules-for-sniffing-images-specifically idimages-2:content-type-sniffing:-image data-x-internalcontent-type-sniffing:-image>image sniffing rules/a> to determine the file format of the image data, with MIME type of the code idimages-2:blob-6>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> (as given by the code idimages-2:blob-7>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> objects code idimages-2:dom-blob-type>a data-x-internaldom-blob-type hrefhttps://w3c.github.io/FileAPI/#dfn-type>type/a>/code> attribute) giving the official type.li>p>If the image data is not in a supported image file format (e.g. its not an image at all), or if the image data is corrupted in some fatal way such that the image dimensions cannot be obtained (e.g. a vector graphic with no intrinsic size), then reject the promise with an a idimages-2:invalidstateerror-10 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idimages-2:domexception-11>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>, and abort these steps.li>p>Create a new code idimages-2:imagebitmap-25>a href#imagebitmap>ImageBitmap/a>/code> object.li>p>Let the code idimages-2:imagebitmap-26>a href#imagebitmap>ImageBitmap/a>/code> objects a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data-13>bitmap data/a> be the image data read from the code idimages-2:blob-8>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> object, a href#cropped-to-the-source-rectangle-with-formatting idimages-2:cropped-to-the-source-rectangle-with-formatting-4>cropped to the source rectangle with formatting/a>. If this is an animated image, the code idimages-2:imagebitmap-27>a href#imagebitmap>ImageBitmap/a>/code> objects a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data-14>bitmap data/a> must only be taken from the default image of the animation (the one that the format defines is to be used when animation is not supported or is disabled), or, if there is no such image, the first frame of the animation.li>p>Resolve the promise with the new code idimages-2:imagebitmap-28>a href#imagebitmap>ImageBitmap/a>/code> object as the value./ol> dt>If var>image/var> is an code idimages-2:imagedata-4>a href#imagedata>ImageData/a>/code> object dd> ol>li>p>If either the var>sw/var> or var>sh/var> arguments are specified but zero, return a promise rejected with a code idimages-2:js-rangeerror-5>a data-x-internaljs-rangeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-rangeerror>RangeError/a>/code>.li>p>If the var>image/var> objects code idimages-2:dom-imagedata-data-2>a href#dom-imagedata-data>data/a>/code> attribute values a href#detached idimages-2:detached-4>Detached/a> internal slot value is true, return a promise rejected with an a idimages-2:invalidstateerror-11 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idimages-2:domexception-12>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Create a new code idimages-2:imagebitmap-29>a href#imagebitmap>ImageBitmap/a>/code> object.li>p>Let the code idimages-2:imagebitmap-30>a href#imagebitmap>ImageBitmap/a>/code> objects a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data-15>bitmap data/a> be the image data given by the code idimages-2:imagedata-5>a href#imagedata>ImageData/a>/code> object, a href#cropped-to-the-source-rectangle-with-formatting idimages-2:cropped-to-the-source-rectangle-with-formatting-5>cropped to the source rectangle with formatting/a>.li>p>Return a new promise, but continue running these steps a href#in-parallel idimages-2:in-parallel-5>in parallel/a>.li>p>Resolve the promise with the new code idimages-2:imagebitmap-31>a href#imagebitmap>ImageBitmap/a>/code> object as the value./ol> dt>If var>image/var> is an code idimages-2:imagebitmap-32>a href#imagebitmap>ImageBitmap/a>/code> object dd> ol>li>p>If either the var>sw/var> or var>sh/var> arguments are specified but zero, return a promise rejected with a code idimages-2:js-rangeerror-6>a data-x-internaljs-rangeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-rangeerror>RangeError/a>/code>.li>p>If var>image/var>s a href#detached idimages-2:detached-5>Detached/a> internal slot value is true, return a promise rejected with an a idimages-2:invalidstateerror-12 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idimages-2:domexception-13>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Create a new code idimages-2:imagebitmap-33>a href#imagebitmap>ImageBitmap/a>/code> object.li>p>Let the code idimages-2:imagebitmap-34>a href#imagebitmap>ImageBitmap/a>/code> objects a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data-16>bitmap data/a> be a copy of the var>image/var> arguments a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data-17>bitmap data/a>, a href#cropped-to-the-source-rectangle-with-formatting idimages-2:cropped-to-the-source-rectangle-with-formatting-6>cropped to the source rectangle with formatting/a>.li>p>Set the a href#concept-canvas-origin-clean idimages-2:concept-canvas-origin-clean-10>origin-clean/a> flag of the code idimages-2:imagebitmap-35>a href#imagebitmap>ImageBitmap/a>/code> objects bitmap to the same value as the a href#concept-canvas-origin-clean idimages-2:concept-canvas-origin-clean-11>origin-clean/a> flag of the bitmap of the var>image/var> argument.li>p>Return a new promise, but continue running these steps a href#in-parallel idimages-2:in-parallel-6>in parallel/a>.li>p>Resolve the promise with the new code idimages-2:imagebitmap-36>a href#imagebitmap>ImageBitmap/a>/code> object as the value./ol> /dl> p>When the steps above require that the user agent dfn idcropped-to-the-source-rectangle-with-formatting>crop bitmap data to the source rectangle with formatting/dfn>, the user agent must run the following steps:/p> ol>li>p>Let var>input/var> be the a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data-18>bitmap data/a> being transformed.li>p>If either or both of code idimages-2:dom-imagebitmapoptions-resizewidth-3>a href#dom-imagebitmapoptions-resizewidth>resizeWidth/a>/code> and code idimages-2:dom-imagebitmapoptions-resizeheight-3>a href#dom-imagebitmapoptions-resizeheight>resizeHeight/a>/code> members of var>options/var> are less than or equal to 0, then return a promise rejected with a idimages-2:invalidstateerror-13 hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idimages-2:domexception-14>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li> p>If var>sx/var>, var>sy/var>, var>sw/var> and var>sh/var> are specified, let var>sourceRectangle/var> be a rectangle whose corners are the four points (var>sx/var>, var>sy/var>), (var>sx/var>+var>sw/var>, var>sy/var>),(var>sx/var>+var>sw/var>, var>sy/var>+var>sh/var>), (var>sx/var>,var>sy/var>+var>sh/var>). Otherwise let var>sourceRectangle/var> be a rectangle whose corners are the four points (0,0), (width of var>input/var>, 0), (width of var>input/var>, height of var>input/var>), (0, height of var>input/var>)./p> p classnote>If either var>sw/var> or var>sh/var> are negative, then the top-left corner of this rectangle will be to the left or above the (var>sx/var>, var>sy/var>) point./p> li>p>Clip var>sourceRectangle/var> to the dimensions of var>input/var>.li> p>Let var>outputWidth/var> be determined as follows:/p> dl classswitch>dt>If the code idimages-2:dom-imagebitmapoptions-resizewidth-4>a href#dom-imagebitmapoptions-resizewidth>resizeWidth/a>/code> member of var>options/var> is specifieddd>the value of the code idimages-2:dom-imagebitmapoptions-resizewidth-5>a href#dom-imagebitmapoptions-resizewidth>resizeWidth/a>/code> member of var>options/var>dt>If the code idimages-2:dom-imagebitmapoptions-resizewidth-6>a href#dom-imagebitmapoptions-resizewidth>resizeWidth/a>/code> member of var>options/var> is not specified, but the code idimages-2:dom-imagebitmapoptions-resizeheight-4>a href#dom-imagebitmapoptions-resizeheight>resizeHeight/a>/code> member is specifieddd>the width of var>sourceRectangle/var>, times the value of the code idimages-2:dom-imagebitmapoptions-resizeheight-5>a href#dom-imagebitmapoptions-resizeheight>resizeHeight/a>/code> member of var>options/var>, divided by the height of var>sourceRectangle/var>, rounded up to the nearest integerdt>If neither code idimages-2:dom-imagebitmapoptions-resizewidth-7>a href#dom-imagebitmapoptions-resizewidth>resizeWidth/a>/code> nor code idimages-2:dom-imagebitmapoptions-resizeheight-6>a href#dom-imagebitmapoptions-resizeheight>resizeHeight/a>/code> are specifieddd>the width of var>sourceRectangle/var>/dl> li> p>Let var>outputHeight/var> be determined as follows:/p> dl classswitch>dt>If the code idimages-2:dom-imagebitmapoptions-resizeheight-7>a href#dom-imagebitmapoptions-resizeheight>resizeHeight/a>/code> member of var>options/var> is specifieddd>the value of the code idimages-2:dom-imagebitmapoptions-resizeheight-8>a href#dom-imagebitmapoptions-resizeheight>resizeHeight/a>/code> member of var>options/var>dt>If the code idimages-2:dom-imagebitmapoptions-resizeheight-9>a href#dom-imagebitmapoptions-resizeheight>resizeHeight/a>/code> member of var>options/var> is not specified, but the code idimages-2:dom-imagebitmapoptions-resizewidth-8>a href#dom-imagebitmapoptions-resizewidth>resizeWidth/a>/code> member is specifieddd>the height of var>sourceRectangle/var>, times the value of the code idimages-2:dom-imagebitmapoptions-resizewidth-9>a href#dom-imagebitmapoptions-resizewidth>resizeWidth/a>/code> member of var>options/var>, divided by the width of var>sourceRectangle/var>, rounded up to the nearest integerdt>If neither code idimages-2:dom-imagebitmapoptions-resizewidth-10>a href#dom-imagebitmapoptions-resizewidth>resizeWidth/a>/code> nor code idimages-2:dom-imagebitmapoptions-resizeheight-10>a href#dom-imagebitmapoptions-resizeheight>resizeHeight/a>/code> are specifieddd>the height of var>sourceRectangle/var>/dl> li>p>Place var>input/var> on an infinite a href#transparent-black idimages-2:transparent-black-2>transparent black/a> grid plane, positioned so that its top left corner is at the origin of the plane, with the var>x/var>-coordinate increasing to the right, and the var>y/var>-coordinate increasing down, and with each pixel in the var>input/var> image data occupying a cell on the planes grid.li>p>Let var>output/var> be the rectangle on the plane denoted by var>sourceRectangle/var>.li>p>Scale var>output/var> to the size specified by var>outputWidth/var> and var>outputHeight/var>. The user agent should use the value of the dfn iddom-imagebitmapoptions-resizequality>code>resizeQuality/code>/dfn> option to guide the choice of scaling algorithm.li> p>If the value of the dfn iddom-imagebitmapoptions-imageorientation>code>imageOrientation/code>/dfn> member of var>options/var> is dfn iddom-imageorientation-flipy>code>flipY/code>/dfn>, var>output/var> must be flipped vertically, disregarding any image orientation metadata of the source (such as EXIF metadata), if any. a href#refsEXIF>EXIF/a>/p> p classnote>If the value is dfn iddom-imageorientation-none>code>none/code>/dfn>, no extra step is required./p> li> p>If var>image/var> is an code idimages-2:the-img-element-4>a href#the-img-element>img/a>/code> element or a code idimages-2:blob-9>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> object, let var>val/var> be the value of the dfn iddom-imagebitmapoptions-colorspaceconversion>code>colorSpaceConversion/code>/dfn> member of var>options/var>, and then run these substeps:/p> ol>li>p>If var>val/var> is dfn iddom-colorspaceconversion-default>code>default/code>/dfn>, the color space conversion behavior is implementation-specific, and should be chosen according to the color space that the implementation uses for drawing images onto the canvas.li>p>If var>val/var> is dfn iddom-colorspaceconversion-none>code>none/code>/dfn>, var>output/var> must be decoded without performing any color space conversions. This means that the image decoding algorithm must ignore color profile metadata embedded in the source data as well as the display device color profile./ol> p classnote>The native color space of canvas is currently unspecified, but this is expected to change in the future./p> li> p>Let var>val/var> be the value of dfn iddom-imagebitmapoptions-premultiplyalpha>code>premultiplyAlpha/code>/dfn> member of var>options/var>, and then run these substeps:/p> ol>li>p>If var>val/var> is dfn iddom-premultiplyalpha-default>code>default/code>/dfn>, the alpha premultiplication behavior is implementation-specific, and should be chosen according to implementation deems optimal for drawing images onto the canvas.li>p>If var>val/var> is dfn iddom-premultiplyalpha-premultiply>code>premultiply/code>/dfn>, the var>output/var> that is not premultiplied by alpha must have its color components multiplied by alpha and that is premultiplied by alpha must be left untouched.li>p>If var>val/var> is dfn iddom-premultiplyalpha-none>code>none/code>/dfn>, the var>output/var> that is not premultiplied by alpha must be left untouched and that is premultiplied by alpha must have its color components divided by alpha./ol> li>p>Return var>output/var>./ol> p>When the dfn iddom-imagebitmap-close>code>close()/code>/dfn> method is called, the user agent must run these steps:/p> ol>li>p>Set this code idimages-2:imagebitmap-37>a href#imagebitmap>ImageBitmap/a>/code> objects a href#detached idimages-2:detached-6>Detached/a> internal slot value to true.li>p>Unset this code idimages-2:imagebitmap-38>a href#imagebitmap>ImageBitmap/a>/code> objects a href#concept-imagebitmap-bitmap-data idimages-2:concept-imagebitmap-bitmap-data-19>bitmap data/a>./ol> p>The dfn iddom-imagebitmap-width>code>width/code>/dfn> attributes getter must run these steps:/p> ol>li>p>If this code idimages-2:imagebitmap-39>a href#imagebitmap>ImageBitmap/a>/code> objects a href#detached idimages-2:detached-7>Detached/a> internal slots value is true, then return 0.li>p>Return this code idimages-2:imagebitmap-40>a href#imagebitmap>ImageBitmap/a>/code> objects width, in a hrefhttps://drafts.csswg.org/css-values/#px idimages-2:px-4 data-x-internalpx>CSS pixels/a>./ol> p>The dfn iddom-imagebitmap-height>code>height/code>/dfn> attributes getter must run these steps:/p> ol>li>p>If this code idimages-2:imagebitmap-41>a href#imagebitmap>ImageBitmap/a>/code> objects a href#detached idimages-2:detached-8>Detached/a> internal slots value is true, then return 0.li>p>Return this code idimages-2:imagebitmap-42>a href#imagebitmap>ImageBitmap/a>/code> objects height, in a hrefhttps://drafts.csswg.org/css-values/#px idimages-2:px-5 data-x-internalpx>CSS pixels/a>./ol> p>The a href#resizequality idimages-2:resizequality-2>ResizeQuality/a> enumeration is used to express a preference for the interpolation quality to use when scaling images./p> p>The dfn iddom-resizequality-pixelated>code>pixelated/code>/dfn> value indicates a preference to scale the image that maximizes the appearance. Scaling algorithms that smooth colors are acceptable, such as bilinear interpolation./p> p>The dfn iddom-resizequality-low>code>low/code>/dfn> value indicates a preference for a low level of image interpolation quality. Low-quality image interpolation may be more computationally efficient than higher settings./p> p>The dfn iddom-resizequality-medium>code>medium/code>/dfn> value indicates a preference for a medium level of image interpolation quality./p> p>The dfn iddom-resizequality-high>code>high/code>/dfn> value indicates a preference for a high level of image interpolation quality. High-quality image interpolation may be more computationally expensive than lower settings./p> p classnote>Bilinear scaling is an example of a relatively fast, lower-quality image-smoothing algorithm. Bicubic or Lanczos scaling are examples of image-scaling algorithms that produce higher-quality output. This specification does not mandate that specific interpolation algorithms be used unless the value is a href#dom-resizequality-pixelated idimages-2:dom-resizequality-pixelated-2>pixelated/a>./p> div classexample> p>Using this API, a sprite sheet can be precut and prepared:/p> pre>var sprites {};function loadMySprites() { var image new Image(); image.src mysprites.png; var resolver; var promise new Promise(function (arg) { resolver arg }); image.onload function () { resolver(Promise.all( createImageBitmap(image, 0, 0, 40, 40).then(function (image) { sprites.woman image }), createImageBitmap(image, 40, 0, 40, 40).then(function (image) { sprites.man image }), createImageBitmap(image, 80, 0, 40, 40).then(function (image) { sprites.tree image }), createImageBitmap(image, 0, 40, 40, 40).then(function (image) { sprites.hut image }), createImageBitmap(image, 40, 40, 40, 40).then(function (image) { sprites.apple image }), createImageBitmap(image, 80, 40, 40, 40).then(function (image) { sprites.snake image }) )); }; return promise;}function runDemo() { var canvas document.querySelector(canvas#demo); var context canvas.getContext(2d); context.drawImage(sprites.tree, 30, 10); context.drawImage(sprites.snake, 70, 10);}loadMySprites().then(runDemo);/pre> /div> h3 idanimation-frames>span classsecno>8.9/span> Animation framesa href#animation-frames classself-link>/a>/h3>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> requestanimationframespan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>24+/span>/span>span classios_saf yes>span>iOS Safari/span> span>7.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>23+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>6.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>4.4+/span>/span>span classopera yes>span>Opera/span> span>15+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featrequestanimationframe>caniuse.com/a>/div> p>Each code idanimation-frames:document>a href#document>Document/a>/code> has a dfn idlist-of-animation-frame-callbacks>list of animation frame callbacks/dfn>, which must be initially empty, and an dfn idanimation-frame-callback-identifier>animation frame callback identifier/dfn>, which is a number which must initially be zero./p> p>When the dfn iddom-window-requestanimationframe>code>requestAnimationFrame()/code>/dfn> method is called, the user agent must run the following steps:/p> ol>li>p>Let var>document/var> be this code idanimation-frames:window>a href#window>Window/a>/code> objects a href#concept-document-window idanimation-frames:concept-document-window>associated code>Document/code>/a>.li>p>Increment var>document/var>s a href#animation-frame-callback-identifier idanimation-frames:animation-frame-callback-identifier>animation frame callback identifier/a> by one.li>p>Append the methods argument to var>document/var>s a href#list-of-animation-frame-callbacks idanimation-frames:list-of-animation-frame-callbacks>list of animation frame callbacks/a>, associated with var>document/var>s a href#animation-frame-callback-identifier idanimation-frames:animation-frame-callback-identifier-2>animation frame callback identifier/a>s current value.li>p>Return var>document/var>s a href#animation-frame-callback-identifier idanimation-frames:animation-frame-callback-identifier-3>animation frame callback identifier/a>s current value./ol> p>When the dfn iddom-window-cancelanimationframe>code>cancelAnimationFrame()/code>/dfn> method is called, the user agent must run the following steps:/p> ol>li>p>Let var>document/var> be this code idanimation-frames:window-2>a href#window>Window/a>/code> objects a href#concept-document-window idanimation-frames:concept-document-window-2>associated code>Document/code>/a>.li>p>Find the entry in var>document/var>s a href#list-of-animation-frame-callbacks idanimation-frames:list-of-animation-frame-callbacks-2>list of animation frame callbacks/a> that is associated with the value given by the methods argument.li>p>If there is such an entry, remove it from var>document/var>s a href#list-of-animation-frame-callbacks idanimation-frames:list-of-animation-frame-callbacks-3>list of animation frame callbacks/a>./ol> p>When the user agent is to dfn idrun-the-animation-frame-callbacks>run the animation frame callbacks/dfn> for a code idanimation-frames:document-2>a href#document>Document/a>/code> var>doc/var> with a timestamp var>now/var>, it must run the following steps:/p> ol>li>p>Let var>callbacks/var> be a list of the entries in var>doc/var>s a href#list-of-animation-frame-callbacks idanimation-frames:list-of-animation-frame-callbacks-4>list of animation frame callbacks/a>, in the order in which they were added to the list.li>p>Set var>doc/var>s a href#list-of-animation-frame-callbacks idanimation-frames:list-of-animation-frame-callbacks-5>list of animation frame callbacks/a> to the empty list.li>p>For each entry in var>callbacks/var>, in order: a hrefhttps://heycam.github.io/webidl/#invoke-a-callback-function idanimation-frames:es-invoking-callback-functions data-x-internales-invoking-callback-functions>invoke the callback/a>, passing var>now/var> as the only argument, and if an exception is thrown, a href#report-the-exception idanimation-frames:report-the-exception>report the exception/a>. a href#refsWEBIDL>WEBIDL/a>/ol> h2 idcomms>span classsecno>9/span> Communicationa href#comms classself-link>/a>/h2> h3 idthe-messageevent-interface>span classsecno>9.1/span> The code idthe-messageevent-interface:messageevent>a href#messageevent>MessageEvent/a>/code> interfacea href#the-messageevent-interface classself-link>/a>/h3> p>Messages in a href#server-sent-events idthe-messageevent-interface:server-sent-events>server-sent events/a>, a href#network idthe-messageevent-interface:network>Web sockets/a>, a href#web-messaging idthe-messageevent-interface:web-messaging>cross-document messaging/a>, a href#channel-messaging idthe-messageevent-interface:channel-messaging>channel messaging/a>, and a href#broadcasting-to-other-browsing-contexts idthe-messageevent-interface:broadcasting-to-other-browsing-contexts>broadcast channels/a> use the code idthe-messageevent-interface:messageevent-2>a href#messageevent>MessageEvent/a>/code> interface for their code idthe-messageevent-interface:event-message>a href#event-message>message/a>/code> events:/p> pre classidl>Constructor(DOMString type, optional a href#messageeventinit idthe-messageevent-interface:messageeventinit>MessageEventInit/a> eventInitDict), Exposed(Window,Worker,AudioWorklet)interface dfn idmessageevent>MessageEvent/dfn> : a idthe-messageevent-interface:event hrefhttps://dom.spec.whatwg.org/#interface-event data-x-internalevent>Event/a> { readonly attribute any a href#dom-messageevent-data idthe-messageevent-interface:dom-messageevent-data>data/a>; readonly attribute USVString a href#dom-messageevent-origin idthe-messageevent-interface:dom-messageevent-origin>origin/a>; readonly attribute DOMString a href#dom-messageevent-lasteventid idthe-messageevent-interface:dom-messageevent-lasteventid>lastEventId/a>; readonly attribute a href#messageeventsource idthe-messageevent-interface:messageeventsource>MessageEventSource/a>? a href#dom-messageevent-source idthe-messageevent-interface:dom-messageevent-source>source/a>; readonly attribute FrozenArray<a href#messageport idthe-messageevent-interface:messageport>MessagePort/a>> a href#dom-messageevent-ports idthe-messageevent-interface:dom-messageevent-ports>ports/a>; void a href#dom-messageevent-initmessageevent idthe-messageevent-interface:dom-messageevent-initmessageevent>initMessageEvent/a>(DOMString type, optional boolean bubbles false, optional boolean cancelable false, optional any data null, optional USVString origin , optional DOMString lastEventId , optional a href#messageeventsource idthe-messageevent-interface:messageeventsource-2>MessageEventSource/a>? source null, optional sequence<a href#messageport idthe-messageevent-interface:messageport-2>MessagePort/a>> ports );};dictionary dfn idmessageeventinit>MessageEventInit/dfn> : a idthe-messageevent-interface:eventinit hrefhttps://dom.spec.whatwg.org/#dictdef-eventinit data-x-internaleventinit>EventInit/a> { any data null; USVString origin ; DOMString lastEventId ; a href#messageeventsource idthe-messageevent-interface:messageeventsource-3>MessageEventSource/a>? source null; sequence<a href#messageport idthe-messageevent-interface:messageport-3>MessagePort/a>> ports ;};typedef (a href#windowproxy idthe-messageevent-interface:windowproxy>WindowProxy/a> or a href#messageport idthe-messageevent-interface:messageport-4>MessagePort/a> or a idthe-messageevent-interface:serviceworker hrefhttps://w3c.github.io/ServiceWorker/#serviceworker data-x-internalserviceworker>ServiceWorker/a>) dfn idmessageeventsource>MessageEventSource/dfn>;/pre> dl classdomintro>dt>var>event/var> . code idthe-messageevent-interface:dom-messageevent-data-2>a href#dom-messageevent-data>data/a>/code>dd> p>Returns the data of the message./p> dt>var>event/var> . code idthe-messageevent-interface:dom-messageevent-origin-2>a href#dom-messageevent-origin>origin/a>/code>dd> p>Returns the origin of the message, for a href#server-sent-events idthe-messageevent-interface:server-sent-events-2>server-sent events/a> and a href#web-messaging idthe-messageevent-interface:web-messaging-2>cross-document messaging/a>./p> dt>var>event/var> . code idthe-messageevent-interface:dom-messageevent-lasteventid-2>a href#dom-messageevent-lasteventid>lastEventId/a>/code>dd> p>Returns the a href#concept-event-stream-last-event-id idthe-messageevent-interface:concept-event-stream-last-event-id>last event ID string/a>, for a href#server-sent-events idthe-messageevent-interface:server-sent-events-3>server-sent events/a>./p> dt>var>event/var> . code idthe-messageevent-interface:dom-messageevent-source-2>a href#dom-messageevent-source>source/a>/code>dd> p>Returns the code idthe-messageevent-interface:windowproxy-2>a href#windowproxy>WindowProxy/a>/code> of the source window, for a href#web-messaging idthe-messageevent-interface:web-messaging-3>cross-document messaging/a>, and the code idthe-messageevent-interface:messageport-5>a href#messageport>MessagePort/a>/code> being attached, in the code idthe-messageevent-interface:event-workerglobalscope-connect>a href#event-workerglobalscope-connect>connect/a>/code> event fired at code idthe-messageevent-interface:sharedworkerglobalscope>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> objects./p> dt>var>event/var> . code idthe-messageevent-interface:dom-messageevent-ports-2>a href#dom-messageevent-ports>ports/a>/code>dd> p>Returns the code idthe-messageevent-interface:messageport-6>a href#messageport>MessagePort/a>/code> array sent with the message, for a href#web-messaging idthe-messageevent-interface:web-messaging-4>cross-document messaging/a> and a href#channel-messaging idthe-messageevent-interface:channel-messaging-2>channel messaging/a>./p> /dl> p>The dfn iddom-messageevent-data>code>data/code>/dfn> attribute must return the value it was initialized to. It represents the message being sent./p> p>The dfn iddom-messageevent-origin>code>origin/code>/dfn> attribute must return the value it was initialized to. It represents, in a href#server-sent-events idthe-messageevent-interface:server-sent-events-4>server-sent events/a> and a href#web-messaging idthe-messageevent-interface:web-messaging-5>cross-document messaging/a>, the a href#concept-origin idthe-messageevent-interface:concept-origin>origin/a> of the document that sent the message (typically the scheme, hostname, and port of the document, but not its path or a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idthe-messageevent-interface:concept-url-fragment data-x-internalconcept-url-fragment>fragment/a>)./p> p>The dfn iddom-messageevent-lasteventid>code>lastEventId/code>/dfn> attribute must return the value it was initialized to. It represents, in a href#server-sent-events idthe-messageevent-interface:server-sent-events-5>server-sent events/a>, the a href#concept-event-stream-last-event-id idthe-messageevent-interface:concept-event-stream-last-event-id-2>last event ID string/a> of the event source./p> p>The dfn iddom-messageevent-source>code>source/code>/dfn> attribute must return the value it was initialized to. It represents, in a href#web-messaging idthe-messageevent-interface:web-messaging-6>cross-document messaging/a>, the code idthe-messageevent-interface:windowproxy-3>a href#windowproxy>WindowProxy/a>/code> of the a href#browsing-context idthe-messageevent-interface:browsing-context>browsing context/a> of the code idthe-messageevent-interface:window>a href#window>Window/a>/code> object from which the message came; and in the code idthe-messageevent-interface:event-workerglobalscope-connect-2>a href#event-workerglobalscope-connect>connect/a>/code> events used by a href#sharedworkerglobalscope idthe-messageevent-interface:sharedworkerglobalscope-2>shared workers/a>, the newly connecting code idthe-messageevent-interface:messageport-7>a href#messageport>MessagePort/a>/code>./p> p>The dfn iddom-messageevent-ports>code>ports/code>/dfn> attribute must return the value it was initialized to. It represents, in a href#web-messaging idthe-messageevent-interface:web-messaging-7>cross-document messaging/a> and a href#channel-messaging idthe-messageevent-interface:channel-messaging-3>channel messaging/a>, the code idthe-messageevent-interface:messageport-8>a href#messageport>MessagePort/a>/code> array being sent./p> p>The dfn iddom-messageevent-initmessageevent>code>initMessageEvent()/code>/dfn> method must initialize the event in a manner analogous to the similarly-named code idthe-messageevent-interface:dom-event-initevent>a data-x-internaldom-event-initevent hrefhttps://dom.spec.whatwg.org/#dom-event-initevent>initEvent()/a>/code> method. a href#refsDOM>DOM/a>/p> p classnote>Various APIs (e.g., code idthe-messageevent-interface:websocket>a href#websocket>WebSocket/a>/code>, code idthe-messageevent-interface:eventsource>a href#eventsource>EventSource/a>/code>) use the code idthe-messageevent-interface:messageevent-3>a href#messageevent>MessageEvent/a>/code> interface for their code idthe-messageevent-interface:event-message-2>a href#event-message>message/a>/code> event without using the code idthe-messageevent-interface:messageport-9>a href#messageport>MessagePort/a>/code> API./p> h3 idserver-sent-events>span classsecno>9.2/span> dfn>Server-sent events/dfn>a href#server-sent-events classself-link>/a>/h3>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> eventsourcespan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>6+/span>/span>span classios_saf yes>span>iOS Safari/span> span>4.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>6+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>5+/span>/span>span classedge no>span>Edge/span> span>None/span>/span>span classandroid yes>span>Android Browser/span> span>4.4+/span>/span>span classopera yes>span>Opera/span> span>11+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#feateventsource>caniuse.com/a>/div> h4 idserver-sent-events-intro>span classsecno>9.2.1/span> Introductiona href#server-sent-events-intro classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>To enable servers to push data to Web pages over HTTP or using dedicated server-push protocols, this specification introduces the code idserver-sent-events-intro:eventsource>a href#eventsource>EventSource/a>/code> interface./p> p>Using this API consists of creating an code idserver-sent-events-intro:eventsource-2>a href#eventsource>EventSource/a>/code> object and registering an event listener./p> pre>var source new EventSource(updates.cgi);source.onmessage function (event) { alert(event.data);};/pre> p>On the server-side, the script (code>updates.cgi/code> in this case) sends messages in the following form, with the code idserver-sent-events-intro:text/event-stream>a href#text/event-stream>text/event-stream/a>/code> MIME type:/p> pre>data: This is the first message.data: This is the second message, itdata: has two lines.data: This is the third message./pre> hr> p>Authors can separate events by using different event types. Here is a stream that has two event types, add and remove:/p> pre>event: adddata: 73857293event: removedata: 2153event: adddata: 113411/pre> p>The script to handle such a stream would look like this (where code>addHandler/code> and code>removeHandler/code> are functions that take one argument, the event):/p> pre>var source new EventSource(updates.cgi);source.addEventListener(add, addHandler, false);source.addEventListener(remove, removeHandler, false);/pre> p>The default event type is message./p> p>Event streams are always decoded as UTF-8. There is no way to specify another character encoding./p> hr> p>Event stream requests can be redirected using HTTP 301 and 307 redirects as with normal HTTP requests. Clients will reconnect if the connection is closed; a client can be told to stop reconnecting using the HTTP 204 No Content response code./p> p>Using this API rather than emulating it using code idserver-sent-events-intro:xmlhttprequest>a data-x-internalxmlhttprequest hrefhttps://xhr.spec.whatwg.org/#xmlhttprequest>XMLHttpRequest/a>/code> or an code idserver-sent-events-intro:the-iframe-element>a href#the-iframe-element>iframe/a>/code> allows the user agent to make better use of network resources in cases where the user agent implementor and the network operator are able to coordinate in advance. Amongst other benefits, this can result in significant savings in battery life on portable devices. This is discussed further in the section below on a href#eventsource-push>connectionless push/a>./p> h4 idthe-eventsource-interface>span classsecno>9.2.2/span> The code idthe-eventsource-interface:eventsource>a href#eventsource>EventSource/a>/code> interfacea href#the-eventsource-interface classself-link>/a>/h4> pre classidl>a href#dom-eventsource idthe-eventsource-interface:dom-eventsource>Constructor/a>(USVString url, optional a href#eventsourceinit idthe-eventsource-interface:eventsourceinit>EventSourceInit/a> eventSourceInitDict), Exposed(Window,Worker)interface dfn ideventsource>EventSource/dfn> : a idthe-eventsource-interface:eventtarget hrefhttps://dom.spec.whatwg.org/#interface-eventtarget data-x-internaleventtarget>EventTarget/a> { readonly attribute USVString a href#dom-eventsource-url idthe-eventsource-interface:dom-eventsource-url>url/a>; readonly attribute boolean a href#dom-eventsource-withcredentials idthe-eventsource-interface:dom-eventsource-withcredentials>withCredentials/a>; // ready state const unsigned short a href#dom-eventsource-connecting idthe-eventsource-interface:dom-eventsource-connecting>CONNECTING/a> 0; const unsigned short a href#dom-eventsource-open idthe-eventsource-interface:dom-eventsource-open>OPEN/a> 1; const unsigned short a href#dom-eventsource-closed idthe-eventsource-interface:dom-eventsource-closed>CLOSED/a> 2; readonly attribute unsigned short a href#dom-eventsource-readystate idthe-eventsource-interface:dom-eventsource-readystate>readyState/a>; // networking attribute a href#eventhandler idthe-eventsource-interface:eventhandler>EventHandler/a> a href#handler-eventsource-onopen idthe-eventsource-interface:handler-eventsource-onopen>onopen/a>; attribute a href#eventhandler idthe-eventsource-interface:eventhandler-2>EventHandler/a> a href#handler-eventsource-onmessage idthe-eventsource-interface:handler-eventsource-onmessage>onmessage/a>; attribute a href#eventhandler idthe-eventsource-interface:eventhandler-3>EventHandler/a> a href#handler-eventsource-onerror idthe-eventsource-interface:handler-eventsource-onerror>onerror/a>; void a href#dom-eventsource-close idthe-eventsource-interface:dom-eventsource-close>close/a>();};dictionary dfn ideventsourceinit>EventSourceInit/dfn> { boolean dfn iddom-eventsourceinit-withcredentials>withCredentials/dfn> false;};/pre> p>Each code idthe-eventsource-interface:eventsource-2>a href#eventsource>EventSource/a>/code> object has the following associated with it:/p> ul>li>p>A dfn data-dfn-forEventSource idconcept-eventsource-url>url/dfn> (a a idthe-eventsource-interface:url-record hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a>). Set during construction.li>p>A dfn idconcept-event-stream-request>request/dfn>. This must initially be null.li>p>A dfn idconcept-event-stream-reconnection-time>reconnection time/dfn>, in milliseconds. This must initially be a user-agent-defined value, probably in the region of a few seconds.li>p>A dfn idconcept-event-stream-last-event-id>last event ID string/dfn>. This must initially be the empty string./ul> p>Apart from a href#concept-eventsource-url idthe-eventsource-interface:concept-eventsource-url>url/a> these are not currently exposed on the code idthe-eventsource-interface:eventsource-3>a href#eventsource>EventSource/a>/code> object./p> p>The dfn iddom-eventsource>code>EventSource(var>url/var>, var>eventSourceInitDict/var>)/code>/dfn> constructor, when invoked, must run these steps:/p> ol>li>p>Let var>ev/var> be a new code idthe-eventsource-interface:eventsource-4>a href#eventsource>EventSource/a>/code> object.li>p>Let var>settings/var> be var>ev/var>s a href#relevant-settings-object idthe-eventsource-interface:relevant-settings-object>relevant settings object/a>. li>p>Let var>urlRecord/var> be the result of a hrefhttps://url.spec.whatwg.org/#concept-url-parser idthe-eventsource-interface:url-parser data-x-internalurl-parser>parsing/a> var>url/var> with var>settings/var>s a href#api-base-url idthe-eventsource-interface:api-base-url>API base URL/a> and var>settings/var>s a href#api-url-character-encoding idthe-eventsource-interface:api-url-character-encoding>API URL character encoding/a>.li>p>If var>urlRecord/var> is failure, then throw a a idthe-eventsource-interface:syntaxerror hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idthe-eventsource-interface:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Set var>ev/var>s a href#concept-eventsource-url idthe-eventsource-interface:concept-eventsource-url-2>url/a> to var>urlRecord/var>./p> li>p>Let var>corsAttributeState/var> be a href#attr-crossorigin-anonymous idthe-eventsource-interface:attr-crossorigin-anonymous>Anonymous/a>.li>p>If the value of var>eventSourceInitDict/var>s code idthe-eventsource-interface:dom-eventsourceinit-withcredentials>a href#dom-eventsourceinit-withcredentials>withCredentials/a>/code> member is true, then set var>corsAttributeState/var> to a href#attr-crossorigin-use-credentials idthe-eventsource-interface:attr-crossorigin-use-credentials>Use Credentials/a> and set var>ev/var>s code idthe-eventsource-interface:dom-eventsource-withcredentials-2>a href#dom-eventsource-withcredentials>withCredentials/a>/code> attribute to true.li>p>Let var>request/var> be the result of a href#create-a-potential-cors-request idthe-eventsource-interface:create-a-potential-cors-request>creating a potential-CORS request/a> given var>urlRecord/var>, the empty string, and var>corsAttributeState/var>, and with the i>same-origin fallback flag/i> set.li>p>Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-client idthe-eventsource-interface:concept-request-client data-x-internalconcept-request-client>client/a> to var>settings/var>.li>p>User agents may a hrefhttps://fetch.spec.whatwg.org/#concept-header-list-set idthe-eventsource-interface:concept-header-list-set data-x-internalconcept-header-list-set>set/a> `code idthe-eventsource-interface:http-accept>a data-x-internalhttp-accept hrefhttps://tools.ietf.org/html/rfc7231#section-5.3.2>Accept/a>/code>`/`code idthe-eventsource-interface:text/event-stream>a href#text/event-stream>text/event-stream/a>/code>` in var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-header-list idthe-eventsource-interface:concept-request-header-list data-x-internalconcept-request-header-list>header list/a>.li>p>Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-cache-mode idthe-eventsource-interface:concept-request-cache-mode data-x-internalconcept-request-cache-mode>cache mode/a> to code>no-store/code>.li>p>Set var>ev/var>s a href#concept-event-stream-request idthe-eventsource-interface:concept-event-stream-request>request/a> to var>request/var>.li>p>Return var>ev/var>, but continue these steps a href#in-parallel idthe-eventsource-interface:in-parallel>in parallel/a>.li>p>a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idthe-eventsource-interface:concept-fetch data-x-internalconcept-fetch>Fetch/a> var>request/var>./ol> hr> p>The dfn iddom-eventsource-url>code>url/code>/dfn> attributes getter must return the a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idthe-eventsource-interface:concept-url-serializer data-x-internalconcept-url-serializer>serialization/a> of this code idthe-eventsource-interface:eventsource-5>a href#eventsource>EventSource/a>/code> objects a href#concept-eventsource-url idthe-eventsource-interface:concept-eventsource-url-3>url/a>./p> p>The dfn iddom-eventsource-withcredentials>code>withCredentials/code>/dfn> attribute must return the value to which it was last initialized. When the object is created, it must be initialized to false./p> p>The dfn iddom-eventsource-readystate>code>readyState/code>/dfn> attribute represents the state of the connection. It can have the following values:/p> dl>dt>dfn iddom-eventsource-connecting>code>CONNECTING/code>/dfn> (numeric value 0)dd>The connection has not yet been established, or it was closed and the user agent is reconnecting.dt>dfn iddom-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 iddom-eventsource-closed>code>CLOSED/code>/dfn> (numeric value 2)dd>The connection is not open, and the user agent is not trying to reconnect. Either there was a fatal error or the code idthe-eventsource-interface:dom-eventsource-close-2>a href#dom-eventsource-close>close()/a>/code> method was invoked./dl> p>When the object is created its code idthe-eventsource-interface:dom-eventsource-readystate-2>a href#dom-eventsource-readystate>readyState/a>/code> must be set to code idthe-eventsource-interface:dom-eventsource-connecting-2>a href#dom-eventsource-connecting>CONNECTING/a>/code> (0). The rules given below for handling the connection define when the value changes./p> p>The dfn iddom-eventsource-close>code>close()/code>/dfn> method must abort any instances of the a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idthe-eventsource-interface:concept-fetch-2 data-x-internalconcept-fetch>fetch/a> algorithm started for this code idthe-eventsource-interface:eventsource-6>a href#eventsource>EventSource/a>/code> object, and must set the code idthe-eventsource-interface:dom-eventsource-readystate-3>a href#dom-eventsource-readystate>readyState/a>/code> attribute to code idthe-eventsource-interface:dom-eventsource-closed-2>a href#dom-eventsource-closed>CLOSED/a>/code>./p> p>The following are the a href#event-handlers idthe-eventsource-interface:event-handlers>event handlers/a> (and their corresponding a href#event-handler-event-type idthe-eventsource-interface:event-handler-event-type>event handler event types/a>) that must be supported, as a href#event-handler-idl-attributes idthe-eventsource-interface:event-handler-idl-attributes>event handler IDL attributes/a>, by all objects implementing the code idthe-eventsource-interface:eventsource-7>a href#eventsource>EventSource/a>/code> interface:/p> table>thead>tr>th>a href#event-handlers idthe-eventsource-interface:event-handlers-2>Event handler/a> th>a href#event-handler-event-type idthe-eventsource-interface:event-handler-event-type-2>Event handler event type/a> tbody>tr>td>dfn idhandler-eventsource-onopen>code>onopen/code>/dfn> td> code idthe-eventsource-interface:event-open>a href#event-open>open/a>/code> tr>td>dfn idhandler-eventsource-onmessage>code>onmessage/code>/dfn> td> code idthe-eventsource-interface:event-message>a href#event-message>message/a>/code> tr>td>dfn idhandler-eventsource-onerror>code>onerror/code>/dfn> td> code idthe-eventsource-interface:event-error>a href#event-error>error/a>/code> /table> hr> h4 idsse-processing-model>span classsecno>9.2.3/span> span idprocessing-model-9>/span>Processing modela href#sse-processing-model classself-link>/a>/h4> p>The resource indicated in the argument to the code idsse-processing-model:dom-eventsource>a href#dom-eventsource>EventSource/a>/code> constructor is fetched when the constructor is run./p> p>As data is received, the a href#concept-task idsse-processing-model:concept-task>tasks/a> queued by the a href#networking-task-source idsse-processing-model:networking-task-source>networking task source/a> to handle the data must act as follows./p> p>HTTP 200 OK responses with a `a href#content-type idsse-processing-model:content-type>Content-Type/a>` header specifying the type `code idsse-processing-model:text/event-stream>a href#text/event-stream>text/event-stream/a>/code>`, ignoring any a idsse-processing-model:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> parameters, must be processed line by line a href#event-stream-interpretation>as described below/a>./p> p>When a successful response with a supported a idsse-processing-model:mime-type-2 hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> is received, such that the user agent begins parsing the contents of the stream, the user agent must a href#announce-the-connection idsse-processing-model:announce-the-connection>announce the connection/a>./p> p>The a href#concept-task idsse-processing-model:concept-task-2>task/a> that the a href#networking-task-source idsse-processing-model:networking-task-source-2>networking task source/a> places on the a href#task-queue idsse-processing-model:task-queue>task queue/a> once fetching for such a resource (with the correct a idsse-processing-model:mime-type-3 hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a>) has completed must cause the user agent to a href#reestablish-the-connection idsse-processing-model:reestablish-the-connection>reestablish the connection/a> a href#in-parallel idsse-processing-model:in-parallel>in parallel/a>. This applies whether the connection is closed gracefully or unexpectedly (but does not apply when fetching is canceled by the user agent, e.g., in response to code idsse-processing-model:dom-window-stop>a href#dom-window-stop>window.stop()/a>/code>, since in those cases the final a href#concept-task idsse-processing-model:concept-task-3>task/a> is actually discarded). It doesnt apply for the error conditions listed below except where explicitly specified./p> p>HTTP 200 OK responses that have a a href#content-type idsse-processing-model:content-type-2>Content-Type/a> specifying an unsupported type, or that have no a href#content-type idsse-processing-model:content-type-3>Content-Type/a> at all, must cause the user agent to a href#fail-the-connection idsse-processing-model:fail-the-connection>fail the connection/a>./p> p idevent-source-network-errors-reconnect>Network errors that prevents the connection from being established in the first place (e.g. DNS errors), should cause the user agent to a href#reestablish-the-connection idsse-processing-model:reestablish-the-connection-2>reestablish the connection/a> a href#in-parallel idsse-processing-model:in-parallel-2>in parallel/a>, unless the user agent knows that to be futile, in which case the user agent may a href#fail-the-connection idsse-processing-model:fail-the-connection-2>fail the connection/a>./p> p idevent-source-fail-reasons>Any other HTTP response code not listed here, as well as the cancelation of the fetch algorithm by the user agent (e.g. in response to code idsse-processing-model:dom-window-stop-2>a href#dom-window-stop>window.stop()/a>/code> or the user canceling the network connection manually) must cause the user agent to a href#fail-the-connection idsse-processing-model:fail-the-connection-3>fail the connection/a>./p> hr> p>When a user agent is to dfn idannounce-the-connection>announce the connection/dfn>, the user agent must a href#queue-a-task idsse-processing-model:queue-a-task>queue a task/a> which, if the code idsse-processing-model:dom-eventsource-readystate>a href#dom-eventsource-readystate>readyState/a>/code> attribute is set to a value other than code idsse-processing-model:dom-eventsource-closed>a href#dom-eventsource-closed>CLOSED/a>/code>, sets the code idsse-processing-model:dom-eventsource-readystate-2>a href#dom-eventsource-readystate>readyState/a>/code> attribute to code idsse-processing-model:dom-eventsource-open>a href#dom-eventsource-open>OPEN/a>/code> and a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idsse-processing-model:concept-event-fire data-x-internalconcept-event-fire>fires an event/a> named code idsse-processing-model:event-open>a href#event-open>open/a>/code> at the code idsse-processing-model:eventsource>a href#eventsource>EventSource/a>/code> object./p> p>When a user agent is to dfn idreestablish-the-connection>reestablish the connection/dfn>, the user agent must run the following steps. These steps are run a href#in-parallel idsse-processing-model:in-parallel-3>in parallel/a>, not as part of a a href#concept-task idsse-processing-model:concept-task-4>task/a>. (The tasks that it queues, of course, are run like normal tasks and not themselves a href#in-parallel idsse-processing-model:in-parallel-4>in parallel/a>.)/p> ol>li> p>a href#queue-a-task idsse-processing-model:queue-a-task-2>Queue a task/a> to run the following steps:/p> ol>li>p>If the code idsse-processing-model:dom-eventsource-readystate-3>a href#dom-eventsource-readystate>readyState/a>/code> attribute is set to code idsse-processing-model:dom-eventsource-closed-2>a href#dom-eventsource-closed>CLOSED/a>/code>, abort the task.li>p>Set the code idsse-processing-model:dom-eventsource-readystate-4>a href#dom-eventsource-readystate>readyState/a>/code> attribute to code idsse-processing-model:dom-eventsource-connecting>a href#dom-eventsource-connecting>CONNECTING/a>/code>.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idsse-processing-model:concept-event-fire-2 data-x-internalconcept-event-fire>Fire an event/a> named code idsse-processing-model:event-error>a href#event-error>error/a>/code> at the code idsse-processing-model:eventsource-2>a href#eventsource>EventSource/a>/code> object./ol> li>p>Wait a delay equal to the reconnection time of the event source.li>p>Optionally, wait some more. In particular, if the previous attempt failed, then user agents might introduce an exponential backoff delay to avoid overloading a potentially already overloaded server. Alternatively, if the operating system has reported that there is no network connectivity, user agents might wait for the operating system to announce that the network connection has returned before retrying.li>p>Wait until the aforementioned task has run, if it has not yet run.li> p>a href#queue-a-task idsse-processing-model:queue-a-task-3>Queue a task/a> to run the following steps:/p> ol>li>p>If the code idsse-processing-model:eventsource-3>a href#eventsource>EventSource/a>/code> objects code idsse-processing-model:dom-eventsource-readystate-5>a href#dom-eventsource-readystate>readyState/a>/code> attribute is not set to code idsse-processing-model:dom-eventsource-connecting-2>a href#dom-eventsource-connecting>CONNECTING/a>/code>, abort these steps.li>p>Let var>request/var> be the code idsse-processing-model:eventsource-4>a href#eventsource>EventSource/a>/code> objects a href#concept-event-stream-request idsse-processing-model:concept-event-stream-request>request/a>. li>p>If the code idsse-processing-model:eventsource-5>a href#eventsource>EventSource/a>/code> objects a href#concept-event-stream-last-event-id idsse-processing-model:concept-event-stream-last-event-id>last event ID string/a> is not the empty string, a hrefhttps://fetch.spec.whatwg.org/#concept-header-list-set idsse-processing-model:concept-header-list-set data-x-internalconcept-header-list-set>set/a> `code idsse-processing-model:last-event-id>a href#last-event-id>Last-Event-ID/a>/code>`/a href#concept-event-stream-last-event-id idsse-processing-model:concept-event-stream-last-event-id-2>last event ID string/a>, a hrefhttps://encoding.spec.whatwg.org/#utf-8-encode idsse-processing-model:utf-8-encode data-x-internalutf-8-encode>encoded as UTF-8/a>, in var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-header-list idsse-processing-model:concept-request-header-list data-x-internalconcept-request-header-list>header list/a>.li>p>a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idsse-processing-model:concept-fetch data-x-internalconcept-fetch>Fetch/a> var>request/var> and process the response obtained in this fashion, if any, as described earlier in this section./ol> /ol> p>When a user agent is to dfn idfail-the-connection>fail the connection/dfn>, the user agent must a href#queue-a-task idsse-processing-model:queue-a-task-4>queue a task/a> which, if the code idsse-processing-model:dom-eventsource-readystate-6>a href#dom-eventsource-readystate>readyState/a>/code> attribute is set to a value other than code idsse-processing-model:dom-eventsource-closed-3>a href#dom-eventsource-closed>CLOSED/a>/code>, sets the code idsse-processing-model:dom-eventsource-readystate-7>a href#dom-eventsource-readystate>readyState/a>/code> attribute to code idsse-processing-model:dom-eventsource-closed-4>a href#dom-eventsource-closed>CLOSED/a>/code> and a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idsse-processing-model:concept-event-fire-3 data-x-internalconcept-event-fire>fires an event/a> named code idsse-processing-model:event-error-2>a href#event-error>error/a>/code> at the code idsse-processing-model:eventsource-6>a href#eventsource>EventSource/a>/code> object. strong>Once the user agent has a href#fail-the-connection idsse-processing-model:fail-the-connection-4>failed the connection/a>, it does em>not/em> attempt to reconnect!/strong>/p> hr> p>The a href#task-source idsse-processing-model:task-source>task source/a> for any a href#concept-task idsse-processing-model:concept-task-5>tasks/a> that are a href#queue-a-task idsse-processing-model:queue-a-task-5>queued/a> by code idsse-processing-model:eventsource-7>a href#eventsource>EventSource/a>/code> objects is the dfn idremote-event-task-source>remote event task source/dfn>./p> h4 idparsing-an-event-stream>span classsecno>9.2.4/span> Parsing an event streama href#parsing-an-event-stream classself-link>/a>/h4> p>This event stream formats a idparsing-an-event-stream:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> is code idparsing-an-event-stream:text/event-stream>a href#text/event-stream>text/event-stream/a>/code>./p> p>The event stream format is as described by the code>stream/code> production of the following ABNF, the character set for which is Unicode. a href#refsABNF>ABNF/a>/p> pre>stream bom *eventevent *( comment / field ) end-of-linecomment colon *any-char end-of-linefield 1*name-char colon space *any-char end-of-lineend-of-line ( cr lf / cr / lf ); characterslf %x000A ; U+000A LINE FEED (LF)cr %x000D ; U+000D CARRIAGE RETURN (CR)space %x0020 ; U+0020 SPACEcolon %x003A ; U+003A COLON (:)bom %xFEFF ; U+FEFF BYTE ORDER MARKname-char %x0000-0009 / %x000B-000C / %x000E-0039 / %x003B-10FFFF ; a a idparsing-an-event-stream:scalar-value hrefhttps://infra.spec.whatwg.org/#scalar-value data-x-internalscalar-value>scalar value/a> other than U+000A LINE FEED (LF), U+000D CARRIAGE RETURN (CR), or U+003A COLON (:)any-char %x0000-0009 / %x000B-000C / %x000E-10FFFF ; a a idparsing-an-event-stream:scalar-value-2 hrefhttps://infra.spec.whatwg.org/#scalar-value data-x-internalscalar-value>scalar value/a> other than U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR)/pre> p>Event streams in this format must always be encoded as UTF-8. a href#refsENCODING>ENCODING/a>/p> p>Lines must be separated by either a U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pair, a single U+000A LINE FEED (LF) character, or a single U+000D CARRIAGE RETURN (CR) character./p> p>Since connections established to remote servers for such resources are expected to be long-lived, UAs should ensure that appropriate buffering is used. In particular, while line buffering with lines are defined to end with a single U+000A LINE FEED (LF) character is safe, block buffering or line buffering with different expected line endings can cause delays in event dispatch./p> h4 idevent-stream-interpretation>span classsecno>9.2.5/span> Interpreting an event streama href#event-stream-interpretation classself-link>/a>/h4> p>Streams must be decoded using the a idevent-stream-interpretation:utf-8-decode hrefhttps://encoding.spec.whatwg.org/#utf-8-decode data-x-internalutf-8-decode>UTF-8 decode/a> algorithm./p> p classnote>The a idevent-stream-interpretation:utf-8-decode-2 hrefhttps://encoding.spec.whatwg.org/#utf-8-decode data-x-internalutf-8-decode>UTF-8 decode/a> algorithm strips one leading UTF-8 Byte Order Mark (BOM), if any./p> p>The stream must then be parsed by reading everything line by line, with a U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pair, a single U+000A LINE FEED (LF) character not preceded by a U+000D CARRIAGE RETURN (CR) character, and a single U+000D CARRIAGE RETURN (CR) character not followed by a U+000A LINE FEED (LF) character being the ways in which a line can end./p> p>When a stream is parsed, a var>data/var> buffer, an var>event type/var> buffer, and a var>last event ID/var> buffer must be associated with it. They must be initialized to the empty string/p> p>Lines must be processed, in the order they are received, as follows:/p> dl classswitch>dt>If the line is empty (a blank line)dd>p>a href#dispatchMessage idevent-stream-interpretation:dispatchMessage>Dispatch the event/a>, as defined below.dt>If the line starts with a U+003A COLON character (:)dd>p>Ignore the line.dt>If the line contains a U+003A COLON character (:)dd> p>Collect the characters on the line before the first U+003A COLON character (:), and let var>field/var> be that string./p> p>Collect the characters on the line after the first U+003A COLON character (:), and let var>value/var> be that string. If var>value/var> starts with a U+0020 SPACE character, remove it from var>value/var>./p> p>a href#processField>Process the field/a> using the steps described below, using var>field/var> as the field name and var>value/var> as the field value./p> dt>Otherwise, the string is not empty but does not contain a U+003A COLON character (:)dd> p>a href#processField>Process the field/a> using the steps described below, using the whole line as the field name, and the empty string as the field value./p> /dl> p>Once the end of the file is reached, any pending data must be discarded. (If the file ends in the middle of an event, before the final empty line, the incomplete event is not dispatched.)/p> hr> p idprocessField>The steps to dfn>process the field/dfn> given a field name and a field value depend on the field name, as given in the following list. Field names must be compared literally, with no case folding performed./p> dl classswitch>dt>If the field name is eventdd>p>Set the var>event type/var> buffer to field value.dt>If the field name is datadd>p>Append the field value to the var>data/var> buffer, then append a single U+000A LINE FEED (LF) character to the var>data/var> buffer.dt>If the field name is iddd>p>If the field value does not contain U+0000 NULL, then set the var>last event ID/var> buffer to the field value. Otherwise, ignore the field.dt>If the field name is retrydd>p>If the field value consists of only a idevent-stream-interpretation:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, then interpret the field value as an integer in base ten, and set the event streams a href#concept-event-stream-reconnection-time idevent-stream-interpretation:concept-event-stream-reconnection-time>reconnection time/a> to that integer. Otherwise, ignore the field.dt>Otherwisedd>p>The field is ignored./dl> p>When the user agent is required to dfn iddispatchMessage>dispatch the event/dfn>, the user agent must process the var>data/var> buffer, the var>event type/var> buffer, and the var>last event ID/var> buffer using steps appropriate for the user agent./p> p>For Web browsers, the appropriate steps to a href#dispatchMessage idevent-stream-interpretation:dispatchMessage-2>dispatch the event/a> are as follows:/p> ol>li>p>Set the a href#concept-event-stream-last-event-id idevent-stream-interpretation:concept-event-stream-last-event-id>last event ID string/a> of the event source to the value of the var>last event ID/var> buffer. The buffer does not get reset, so the a href#concept-event-stream-last-event-id idevent-stream-interpretation:concept-event-stream-last-event-id-2>last event ID string/a> of the event source remains set to this value until the next time it is set by the server.li>p>If the var>data/var> buffer is an empty string, set the var>data/var> buffer and the var>event type/var> buffer to the empty string and abort these steps.li>p>If the var>data/var> buffers last character is a U+000A LINE FEED (LF) character, then remove the last character from the var>data/var> buffer.li>p>Let var>event/var> be the result of a idevent-stream-interpretation:creating-an-event hrefhttps://dom.spec.whatwg.org/#concept-event-create data-x-internalcreating-an-event>creating an event/a> using code idevent-stream-interpretation:messageevent>a href#messageevent>MessageEvent/a>/code>, in the a href#concept-relevant-realm idevent-stream-interpretation:concept-relevant-realm>relevant Realm/a> of the code idevent-stream-interpretation:eventsource>a href#eventsource>EventSource/a>/code> object.li>p>Initialize var>event/var>s code idevent-stream-interpretation:dom-event-type>a data-x-internaldom-event-type hrefhttps://dom.spec.whatwg.org/#dom-event-type>type/a>/code> attribute to code idevent-stream-interpretation:event-message>a href#event-message>message/a>/code>, its code idevent-stream-interpretation:dom-messageevent-data>a href#dom-messageevent-data>data/a>/code> attribute to var>data/var>, its code idevent-stream-interpretation:dom-messageevent-origin>a href#dom-messageevent-origin>origin/a>/code> attribute to the a href#ascii-serialisation-of-an-origin idevent-stream-interpretation:ascii-serialisation-of-an-origin>serialization/a> of the a hrefhttps://url.spec.whatwg.org/#concept-url-origin idevent-stream-interpretation:concept-url-origin data-x-internalconcept-url-origin>origin/a> of the event streams final URL (i.e., the URL after redirects), and its code idevent-stream-interpretation:dom-messageevent-lasteventid>a href#dom-messageevent-lasteventid>lastEventId/a>/code> attribute to the a href#concept-event-stream-last-event-id idevent-stream-interpretation:concept-event-stream-last-event-id-3>last event ID string/a> of the event source.li>p>If the var>event type/var> buffer has a value other than the empty string, change the a hrefhttps://dom.spec.whatwg.org/#dom-event-type idevent-stream-interpretation:concept-event-type data-x-internalconcept-event-type>type/a> of the newly created event to equal the value of the var>event type/var> buffer.li>p>Set the var>data/var> buffer and the var>event type/var> buffer to the empty string.li>p>a href#queue-a-task idevent-stream-interpretation:queue-a-task>Queue a task/a> which, if the code idevent-stream-interpretation:dom-eventsource-readystate>a href#dom-eventsource-readystate>readyState/a>/code> attribute is set to a value other than code idevent-stream-interpretation:dom-eventsource-closed>a href#dom-eventsource-closed>CLOSED/a>/code>, a hrefhttps://dom.spec.whatwg.org/#concept-event-dispatch idevent-stream-interpretation:concept-event-dispatch data-x-internalconcept-event-dispatch>dispatches/a> the newly created event at the code idevent-stream-interpretation:eventsource-2>a href#eventsource>EventSource/a>/code> object./ol> p classnote>If an event doesnt have an id field, but an earlier event did set the event sources a href#concept-event-stream-last-event-id idevent-stream-interpretation:concept-event-stream-last-event-id-4>last event ID string/a>, then the events code idevent-stream-interpretation:dom-messageevent-lasteventid-2>a href#dom-messageevent-lasteventid>lastEventId/a>/code> field will be set to the value of whatever the last seen id field was./p> p>For other user agents, the appropriate steps to a href#dispatchMessage idevent-stream-interpretation:dispatchMessage-3>dispatch the event/a> are implementation dependent, but at a minimum they must set the var>data/var> and var>event type/var> buffers to the empty string before returning./p> div classexample> p>The following event stream, once followed by a blank line:/p> pre>data: YHOOdata: +2data: 10/pre> p>...would cause an event code idevent-stream-interpretation:event-message-2>a href#event-message>message/a>/code> with the interface code idevent-stream-interpretation:messageevent-2>a href#messageevent>MessageEvent/a>/code> to be dispatched on the code idevent-stream-interpretation:eventsource-3>a href#eventsource>EventSource/a>/code> object. The events code idevent-stream-interpretation:dom-messageevent-data-2>a href#dom-messageevent-data>data/a>/code> attribute would contain the string code>YHOO\n+2\n10/code> (where code>\n/code> represents a newline)./p> p>This could be used as follows: pre>var stocks new EventSource(https://stocks.example.com/ticker.php);stocks.onmessage function (event) { var data event.data.split(\n); updateStocks(data0, data1, data2);};/pre> p>...where code>updateStocks()/code> is a function defined as:/p> pre>function updateStocks(symbol, delta, value) { ... }/pre> p>...or some such./p> /div> div classexample> p>The following stream contains four blocks. The first block has just a comment, and will fire nothing. The second block has two fields with names data and id respectively; an event will be fired for this block, with the data first event, and will then set the last event ID to 1 so that if the connection died between this block and the next, the server would be sent a `code idevent-stream-interpretation:last-event-id>a href#last-event-id>Last-Event-ID/a>/code>` header with the value 1. The third block fires an event with data second event, and also has an id field, this time with no value, which resets the last event ID to the empty string (meaning no `code idevent-stream-interpretation:last-event-id-2>a href#last-event-id>Last-Event-ID/a>/code>` header will now be sent in the event of a reconnection being attempted). Finally, the last block just fires an event with the data third event (with a single leading space character). Note that the last still has to end with a blank line, the end of the stream is not enough to trigger the dispatch of the last event./p> pre>: test streamdata: first eventid: 1data:second eventiddata: third event/pre> /div> div classexample> p>The following stream fires two events:/p> pre>datadatadatadata:/pre> p>The first block fires events with the data set to the empty string, as would the last block if it was followed by a blank line. The middle block fires an event with the data set to a single newline character. The last block is discarded because it is not followed by a blank line./p> /div> div classexample> p>The following stream fires two identical events:/p> pre>data:testdata: test/pre> p>This is because the space after the colon is ignored if present./p> /div> h4 idauthoring-notes>span classsecno>9.2.6/span> Authoring notesa href#authoring-notes classself-link>/a>/h4> p>Legacy proxy servers are known to, in certain cases, drop HTTP connections after a short timeout. To protect against such proxy servers, authors can include a comment line (one starting with a : character) every 15 seconds or so./p> p>Authors wishing to relate event source connections to each other or to specific documents previously served might find that relying on IP addresses doesnt work, as individual clients can have multiple IP addresses (due to having multiple proxy servers) and individual IP addresses can have multiple clients (due to sharing a proxy server). It is better to include a unique identifier in the document when it is served and then pass that identifier as part of the URL when the connection is established./p> p>Authors are also cautioned that HTTP chunking can have unexpected negative effects on the reliability of this protocol, in particular if the chunking is done by a different layer unaware of the timing requirements. If this is a problem, chunking can be disabled for serving event streams./p> p>Clients that support HTTPs per-server connection limitation might run into trouble when opening multiple pages from a site if each page has an code idauthoring-notes:eventsource>a href#eventsource>EventSource/a>/code> to the same domain. Authors can avoid this using the relatively complex mechanism of using unique domain names per connection, or by allowing the user to enable or disable the code idauthoring-notes:eventsource-2>a href#eventsource>EventSource/a>/code> functionality on a per-page basis, or by sharing a single code idauthoring-notes:eventsource-3>a href#eventsource>EventSource/a>/code> object using a a href#sharedworkerglobalscope idauthoring-notes:sharedworkerglobalscope>shared worker/a>./p> h4 ideventsource-push>span classsecno>9.2.7/span> Connectionless push and other featuresa href#eventsource-push classself-link>/a>/h4> p>User agents running in controlled environments, e.g. browsers on mobile handsets tied to specific carriers, may offload the management of the connection to a proxy on the network. In such a situation, the user agent for the purposes of conformance is considered to include both the handset software and the network proxy./p> div classexample> p>For example, a browser on a mobile device, after having established a connection, might detect that it is on a supporting network and request that a proxy server on the network take over the management of the connection. The timeline for such a situation might be as follows:/p> ol>li>Browser connects to a remote HTTP server and requests the resource specified by the author in the code ideventsource-push:dom-eventsource>a href#dom-eventsource>EventSource/a>/code> constructor.li>The server sends occasional messages.li>In between two messages, the browser detects that it is idle except for the network activity involved in keeping the TCP connection alive, and decides to switch to sleep mode to save power.li>The browser disconnects from the server.li>The browser contacts a service on the network, and requests that the service, a push proxy, maintain the connection instead.li>The push proxy service contacts the remote HTTP server and requests the resource specified by the author in the code ideventsource-push:dom-eventsource-2>a href#dom-eventsource>EventSource/a>/code> constructor (possibly including a `code ideventsource-push:last-event-id>a href#last-event-id>Last-Event-ID/a>/code>` HTTP header, etc).li>The browser allows the mobile device to go to sleep.li>The server sends another message.li>The push proxy service uses a technology such as OMA push to convey the event to the mobile device, which wakes only enough to process the event and then returns to sleep./ol> /div> p>This can reduce the total data usage, and can therefore result in considerable power savings./p> p>As well as implementing the existing API and code ideventsource-push:text/event-stream>a href#text/event-stream>text/event-stream/a>/code> wire format as defined by this specification and in more distributed ways as described above, formats of event framing defined by a href#other-applicable-specifications ideventsource-push:other-applicable-specifications>other applicable specifications/a> may be supported. This specification does not define how they are to be parsed or processed./p> h4 idgarbage-collection-2>span classsecno>9.2.8/span> Garbage collectiona href#garbage-collection-2 classself-link>/a>/h4> p>While an code idgarbage-collection-2:eventsource>a href#eventsource>EventSource/a>/code> objects code idgarbage-collection-2:dom-eventsource-readystate>a href#dom-eventsource-readystate>readyState/a>/code> is code idgarbage-collection-2:dom-eventsource-connecting>a href#dom-eventsource-connecting>CONNECTING/a>/code>, and the object has one or more event listeners registered for code idgarbage-collection-2:event-open>a href#event-open>open/a>/code>, code idgarbage-collection-2:event-message>a href#event-message>message/a>/code> or code idgarbage-collection-2:event-error>a href#event-error>error/a>/code> events, there must be a strong reference from the code idgarbage-collection-2:window>a href#window>Window/a>/code> or code idgarbage-collection-2:workerglobalscope>a href#workerglobalscope>WorkerGlobalScope/a>/code> object that the code idgarbage-collection-2:eventsource-2>a href#eventsource>EventSource/a>/code> objects constructor was invoked from to the code idgarbage-collection-2:eventsource-3>a href#eventsource>EventSource/a>/code> object itself./p> p>While an code idgarbage-collection-2:eventsource-4>a href#eventsource>EventSource/a>/code> objects code idgarbage-collection-2:dom-eventsource-readystate-2>a href#dom-eventsource-readystate>readyState/a>/code> is code idgarbage-collection-2:dom-eventsource-open>a href#dom-eventsource-open>OPEN/a>/code>, and the object has one or more event listeners registered for code idgarbage-collection-2:event-message-2>a href#event-message>message/a>/code> or code idgarbage-collection-2:event-error-2>a href#event-error>error/a>/code> events, there must be a strong reference from the code idgarbage-collection-2:window-2>a href#window>Window/a>/code> or code idgarbage-collection-2:workerglobalscope-2>a href#workerglobalscope>WorkerGlobalScope/a>/code> object that the code idgarbage-collection-2:eventsource-5>a href#eventsource>EventSource/a>/code> objects constructor was invoked from to the code idgarbage-collection-2:eventsource-6>a href#eventsource>EventSource/a>/code> object itself./p> p>While there is a task queued by an code idgarbage-collection-2:eventsource-7>a href#eventsource>EventSource/a>/code> object on the a href#remote-event-task-source idgarbage-collection-2:remote-event-task-source>remote event task source/a>, there must be a strong reference from the code idgarbage-collection-2:window-3>a href#window>Window/a>/code> or code idgarbage-collection-2:workerglobalscope-3>a href#workerglobalscope>WorkerGlobalScope/a>/code> object that the code idgarbage-collection-2:eventsource-8>a href#eventsource>EventSource/a>/code> objects constructor was invoked from to that code idgarbage-collection-2:eventsource-9>a href#eventsource>EventSource/a>/code> object./p> p>If a user agent is to dfn idconcept-eventsource-forcibly-close>forcibly close/dfn> an code idgarbage-collection-2:eventsource-10>a href#eventsource>EventSource/a>/code> object (this happens when a code idgarbage-collection-2:document>a href#document>Document/a>/code> object goes away permanently), the user agent must abort any instances of the a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idgarbage-collection-2:concept-fetch data-x-internalconcept-fetch>fetch/a> algorithm started for this code idgarbage-collection-2:eventsource-11>a href#eventsource>EventSource/a>/code> object, and must set the code idgarbage-collection-2:dom-eventsource-readystate-3>a href#dom-eventsource-readystate>readyState/a>/code> attribute to code idgarbage-collection-2:dom-eventsource-closed>a href#dom-eventsource-closed>CLOSED/a>/code>./p> p>If an code idgarbage-collection-2:eventsource-12>a href#eventsource>EventSource/a>/code> object is garbage collected while its connection is still open, the user agent must abort any instance of the a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idgarbage-collection-2:concept-fetch-2 data-x-internalconcept-fetch>fetch/a> algorithm opened by this code idgarbage-collection-2:eventsource-13>a href#eventsource>EventSource/a>/code>./p> h4 idimplementation-advice>span classsecno>9.2.9/span> Implementation advicea href#implementation-advice classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>User agents are strongly urged to provide detailed diagnostic information about code idimplementation-advice:eventsource>a href#eventsource>EventSource/a>/code> objects and their related network connections in their development consoles, to aid authors in debugging code using this API./p> p>For example, a user agent could have a panel displaying all the code idimplementation-advice:eventsource-2>a href#eventsource>EventSource/a>/code> objects a page has created, each listing the constructors arguments, whether there was a network error, what the CORS status of the connection is and what headers were sent by the client and received from the server to lead to that status, the messages that were received and how they were parsed, and so forth./p> p>Implementations are especially encouraged to report detailed information to their development consoles whenever an code idimplementation-advice:event-error>a href#event-error>error/a>/code> event is fired, since little to no information can be made available in the events themselves./p> h3 idnetwork>span classsecno>9.3/span> dfn>Web sockets/dfn>a href#network classself-link>/a>/h3>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> websocketsspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>16+/span>/span>span classios_saf yes>span>iOS Safari/span> span>6.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>11+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>7+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>4.4+/span>/span>span classopera yes>span>Opera/span> span>12.1+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featwebsockets>caniuse.com/a>/div> h4 idnetwork-intro>span classsecno>9.3.1/span> Introductiona href#network-intro classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>To enable Web applications to maintain bidirectional communications with server-side processes, this specification introduces the code idnetwork-intro:websocket>a href#websocket>WebSocket/a>/code> interface./p> p classnote>This interface does not allow for raw access to the underlying network. For example, this interface could not be used to implement an IRC client without proxying messages through a custom server./p> h4 idthe-websocket-interface>span classsecno>9.3.2/span> The code idthe-websocket-interface:websocket>a href#websocket>WebSocket/a>/code> interfacea href#the-websocket-interface classself-link>/a>/h4> pre classidl>enum dfn idbinarytype>BinaryType/dfn> { a href#dom-binarytype-blob idthe-websocket-interface:dom-binarytype-blob>blob/a>, a href#dom-binarytype-arraybuffer idthe-websocket-interface:dom-binarytype-arraybuffer>arraybuffer/a> };a href#dom-websocket idthe-websocket-interface:dom-websocket>Constructor/a>(USVString url, optional (DOMString or sequence<DOMString>) protocols ), Exposed(Window,Worker)interface dfn idwebsocket>WebSocket/dfn> : a idthe-websocket-interface:eventtarget hrefhttps://dom.spec.whatwg.org/#interface-eventtarget data-x-internaleventtarget>EventTarget/a> { readonly attribute USVString a href#dom-websocket-url idthe-websocket-interface:dom-websocket-url>url/a>; // ready state const unsigned short a href#dom-websocket-connecting idthe-websocket-interface:dom-websocket-connecting>CONNECTING/a> 0; const unsigned short a href#dom-websocket-open idthe-websocket-interface:dom-websocket-open>OPEN/a> 1; const unsigned short a href#dom-websocket-closing idthe-websocket-interface:dom-websocket-closing>CLOSING/a> 2; const unsigned short a href#dom-websocket-closed idthe-websocket-interface:dom-websocket-closed>CLOSED/a> 3; readonly attribute unsigned short a href#dom-websocket-readystate idthe-websocket-interface:dom-websocket-readystate>readyState/a>; readonly attribute unsigned long long a href#dom-websocket-bufferedamount idthe-websocket-interface:dom-websocket-bufferedamount>bufferedAmount/a>; // networking attribute a href#eventhandler idthe-websocket-interface:eventhandler>EventHandler/a> a href#handler-websocket-onopen idthe-websocket-interface:handler-websocket-onopen>onopen/a>; attribute a href#eventhandler idthe-websocket-interface:eventhandler-2>EventHandler/a> a href#handler-websocket-onerror idthe-websocket-interface:handler-websocket-onerror>onerror/a>; attribute a href#eventhandler idthe-websocket-interface:eventhandler-3>EventHandler/a> a href#handler-websocket-onclose idthe-websocket-interface:handler-websocket-onclose>onclose/a>; readonly attribute DOMString a href#dom-websocket-extensions idthe-websocket-interface:dom-websocket-extensions>extensions/a>; readonly attribute DOMString a href#dom-websocket-protocol idthe-websocket-interface:dom-websocket-protocol>protocol/a>; void a href#dom-websocket-close idthe-websocket-interface:dom-websocket-close>close/a>(optional Clamp unsigned short code, optional a hrefhttps://heycam.github.io/webidl/#idl-USVString idthe-websocket-interface:idl-usvstring data-x-internalidl-usvstring>USVString/a> reason); // messaging attribute a href#eventhandler idthe-websocket-interface:eventhandler-4>EventHandler/a> a href#handler-websocket-onmessage idthe-websocket-interface:handler-websocket-onmessage>onmessage/a>; attribute a href#binarytype idthe-websocket-interface:binarytype>BinaryType/a> a href#dom-websocket-binarytype idthe-websocket-interface:dom-websocket-binarytype>binaryType/a>; void a href#dom-websocket-send idthe-websocket-interface:dom-websocket-send>send/a>(a hrefhttps://heycam.github.io/webidl/#idl-USVString idthe-websocket-interface:idl-usvstring-2 data-x-internalidl-usvstring>USVString/a> data); void a href#dom-websocket-send idthe-websocket-interface:dom-websocket-send-2>send/a>(a idthe-websocket-interface:blob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob data-x-internalblob>Blob/a> data); void a href#dom-websocket-send idthe-websocket-interface:dom-websocket-send-3>send/a>(a hrefhttps://heycam.github.io/webidl/#idl-ArrayBuffer idthe-websocket-interface:idl-arraybuffer data-x-internalidl-arraybuffer>ArrayBuffer/a> data); void a href#dom-websocket-send idthe-websocket-interface:dom-websocket-send-4>send/a>(a hrefhttps://heycam.github.io/webidl/#common-ArrayBufferView idthe-websocket-interface:idl-arraybufferview data-x-internalidl-arraybufferview>ArrayBufferView/a> data);};/pre> p>Each code idthe-websocket-interface:websocket-2>a href#websocket>WebSocket/a>/code> object has an associated dfn idconcept-websocket-url>url/dfn> (a a idthe-websocket-interface:url-record hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl-record>URL record/a>). dl classdomintro>dt>var>socket/var> new code idthe-websocket-interface:dom-websocket-2>a href#dom-websocket>WebSocket/a>/code>(var>url/var> , var>protocols/var> )dd> p>Creates a new code idthe-websocket-interface:websocket-3>a href#websocket>WebSocket/a>/code> object, immediately establishing the associated WebSocket connection./p> p>var>url/var> is a string giving the a idthe-websocket-interface:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> over which the connection is established. Only code>ws/code> or code>wss/code> schemes are allowed; others will cause a a idthe-websocket-interface:syntaxerror hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idthe-websocket-interface:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>. URLs with a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idthe-websocket-interface:concept-url-fragment data-x-internalconcept-url-fragment>fragments/a> will also cause such an exception./p> p>var>protocols/var> is either a string or an array of strings. If it is a string, it is equivalent to an array consisting of just that string; if it is omitted, it is equivalent to the empty array. Each string in the array is a subprotocol name. The connection will only be established if the server reports that it has selected one of these subprotocols. The subprotocol names have to match the requirements for elements that comprise the value of code idthe-websocket-interface:http-sec-websocket-protocol>a href#http-sec-websocket-protocol>Sec-WebSocket-Protocol/a>/code> fields as defined by the WebSocket protocol specification. a href#refsWSP>WSP/a>/p> dt>var>socket/var> . code idthe-websocket-interface:dom-websocket-send-5>a href#dom-websocket-send>send/a>/code>( var>data/var> )dd> p>Transmits var>data/var> using the WebSocket connection. var>data/var> can be a string, a code idthe-websocket-interface:blob-2>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code>, an code idthe-websocket-interface:idl-arraybuffer-2>a data-x-internalidl-arraybuffer hrefhttps://heycam.github.io/webidl/#idl-ArrayBuffer>ArrayBuffer/a>/code>, or an code idthe-websocket-interface:idl-arraybufferview-2>a data-x-internalidl-arraybufferview hrefhttps://heycam.github.io/webidl/#common-ArrayBufferView>ArrayBufferView/a>/code>./p> dt>var>socket/var> . code idthe-websocket-interface:dom-websocket-close-2>a href#dom-websocket-close>close/a>/code>( var>code/var> , var>reason/var> )dd> p>Closes the WebSocket connection, optionally using var>code/var> as the a href#concept-websocket-close-code idthe-websocket-interface:concept-websocket-close-code>the WebSocket connection close code/a> and var>reason/var> as the a href#concept-websocket-close-reason idthe-websocket-interface:concept-websocket-close-reason>the WebSocket connection close reason/a>./p> dt>var>socket/var> . code idthe-websocket-interface:dom-websocket-url-2>a href#dom-websocket-url>url/a>/code>dd> p>Returns the a href#concept-websocket-url idthe-websocket-interface:concept-websocket-url>URL that was used/a> to establish the WebSocket connection./p> dt>var>socket/var> . code idthe-websocket-interface:dom-websocket-readystate-2>a href#dom-websocket-readystate>readyState/a>/code>dd> p>Returns the state of the code idthe-websocket-interface:websocket-4>a href#websocket>WebSocket/a>/code> objects connection. It can have the values described below./p> dt>var>socket/var> . code idthe-websocket-interface:dom-websocket-bufferedamount-2>a href#dom-websocket-bufferedamount>bufferedAmount/a>/code>dd> p>Returns the number of bytes of application data (UTF-8 text and binary data) that have been queued using code idthe-websocket-interface:dom-websocket-send-6>a href#dom-websocket-send>send()/a>/code> but not yet been transmitted to the network./p> p>If the WebSocket connection is closed, this attributes value will only increase with each call to the code idthe-websocket-interface:dom-websocket-send-7>a href#dom-websocket-send>send()/a>/code> method. (The number does not reset to zero once the connection closes.)/p> dt>var>socket/var> . code idthe-websocket-interface:dom-websocket-extensions-2>a href#dom-websocket-extensions>extensions/a>/code>dd> p>Returns the extensions selected by the server, if any./p> dt>var>socket/var> . code idthe-websocket-interface:dom-websocket-protocol-2>a href#dom-websocket-protocol>protocol/a>/code>dd> p>Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructors second argument to perform subprotocol negotiation./p> dt>var>socket/var> . code idthe-websocket-interface:dom-websocket-binarytype-2>a href#dom-websocket-binarytype>binaryType/a>/code> var>value/var> dd> p>Returns a string that indicates how binary data from the code idthe-websocket-interface:websocket-5>a href#websocket>WebSocket/a>/code> object is exposed to scripts:/p> dl>dt>code idthe-websocket-interface:dom-binarytype-blob-2>a href#dom-binarytype-blob>blob/a>/code>dd> p>Binary data is returned in code idthe-websocket-interface:blob-3>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> form./p> dt>code idthe-websocket-interface:dom-binarytype-arraybuffer-2>a href#dom-binarytype-arraybuffer>arraybuffer/a>/code>dd> p>Binary data is returned in code idthe-websocket-interface:idl-arraybuffer-3>a data-x-internalidl-arraybuffer hrefhttps://heycam.github.io/webidl/#idl-ArrayBuffer>ArrayBuffer/a>/code> form./p> /dl> p>Can be set, to change how binary data is returned. The default is code idthe-websocket-interface:dom-binarytype-blob-3>a href#dom-binarytype-blob>blob/a>/code>./p> /dl> p>The dfn iddom-websocket>code>WebSocket(var>url/var>, var>protocols/var>)/code>/dfn> constructor, when invoked, must run these steps:/p> ol>li>p>Let var>urlRecord/var> be the result of applying the a idthe-websocket-interface:url-parser hrefhttps://url.spec.whatwg.org/#concept-url-parser data-x-internalurl-parser>URL parser/a> to var>url/var>.li>p>If var>urlRecord/var> is failure, then throw a a idthe-websocket-interface:syntaxerror-2 hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idthe-websocket-interface:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If var>urlRecord/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idthe-websocket-interface:concept-url-scheme data-x-internalconcept-url-scheme>scheme/a> is not code>ws/code> or code>wss/code>, then throw a a idthe-websocket-interface:syntaxerror-3 hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idthe-websocket-interface:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If var>urlRecord/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idthe-websocket-interface:concept-url-fragment-2 data-x-internalconcept-url-fragment>fragment/a> is non-null, then throw a a idthe-websocket-interface:syntaxerror-4 hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idthe-websocket-interface:domexception-4>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>If var>protocols/var> is a string, set var>protocols/var> to a sequence consisting of just that string.li>p>If any of the values in var>protocols/var> occur more than once or otherwise fail to match the requirements for elements that comprise the value of code idthe-websocket-interface:http-sec-websocket-protocol-2>a href#http-sec-websocket-protocol>Sec-WebSocket-Protocol/a>/code> fields as defined by the WebSocket protocol specification, then throw a a idthe-websocket-interface:syntaxerror-5 hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idthe-websocket-interface:domexception-5>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps. a href#refsWSP>WSP/a>li>p>Return a new code idthe-websocket-interface:websocket-6>a href#websocket>WebSocket/a>/code> object whose a href#concept-websocket-url idthe-websocket-interface:concept-websocket-url-2>url/a> is var>urlRecord/var>, but continue these steps a href#in-parallel idthe-websocket-interface:in-parallel>in parallel/a>.li> p>a hrefhttps://fetch.spec.whatwg.org/#concept-websocket-establish idthe-websocket-interface:concept-websocket-establish data-x-internalconcept-websocket-establish>Establish a WebSocket connection/a> given var>urlRecord/var>, var>protocols/var>, and the a href#entry-settings-object idthe-websocket-interface:entry-settings-object>entry settings object/a>. a href#refsFETCH>FETCH/a>/p> p classnote>If the a hrefhttps://fetch.spec.whatwg.org/#concept-websocket-establish idthe-websocket-interface:concept-websocket-establish-2 data-x-internalconcept-websocket-establish>establish a WebSocket connection/a> algorithm fails, it triggers the i idthe-websocket-interface:concept-websocket-fail>a href#concept-websocket-fail>fail the WebSocket connection/a>/i> algorithm, which then invokes the i idthe-websocket-interface:concept-websocket-close>a href#concept-websocket-close>close the WebSocket connection/a>/i> algorithm, which then establishes that i idthe-websocket-interface:concept-websocket-closed>a href#concept-websocket-closed>the WebSocket connection is closed/a>/i>, which fires the code idthe-websocket-interface:event-close>a href#event-close>close/a>/code> event a href#closeWebSocket>as described below/a>./p> /ol> hr> p>The dfn iddom-websocket-url>code>url/code>/dfn> attributes getter must return this code idthe-websocket-interface:websocket-7>a href#websocket>WebSocket/a>/code> objects a href#concept-websocket-url idthe-websocket-interface:concept-websocket-url-3>url/a>, a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idthe-websocket-interface:concept-url-serializer data-x-internalconcept-url-serializer>serialized/a>./p> p>The dfn iddom-websocket-readystate>code>readyState/code>/dfn> attribute represents the state of the connection. It can have the following values:/p> dl>dt>dfn iddom-websocket-connecting>code>CONNECTING/code>/dfn> (numeric value 0)dd>The connection has not yet been established.dt>dfn iddom-websocket-open>code>OPEN/code>/dfn> (numeric value 1)dd>i idthe-websocket-interface:concept-websocket-established>a href#concept-websocket-established>The WebSocket connection is established/a>/i> and communication is possible.dt>dfn iddom-websocket-closing>code>CLOSING/code>/dfn> (numeric value 2)dd>The connection is going through the closing handshake, or the code idthe-websocket-interface:dom-websocket-close-3>a href#dom-websocket-close>close()/a>/code> method has been invoked.dt>dfn iddom-websocket-closed>code>CLOSED/code>/dfn> (numeric value 3)dd>The connection has been closed or could not be opened./dl> p>When the object is created its code idthe-websocket-interface:dom-websocket-readystate-3>a href#dom-websocket-readystate>readyState/a>/code> must be set to code idthe-websocket-interface:dom-websocket-connecting-2>a href#dom-websocket-connecting>CONNECTING/a>/code> (0)./p> p>The dfn iddom-websocket-extensions>code>extensions/code>/dfn> attribute must initially return the empty string. After i idthe-websocket-interface:concept-websocket-established-2>a href#concept-websocket-established>the WebSocket connection is established/a>/i>, its value might change, as defined below./p> p>The dfn iddom-websocket-protocol>code>protocol/code>/dfn> attribute must initially return the empty string. After i idthe-websocket-interface:concept-websocket-established-3>a href#concept-websocket-established>the WebSocket connection is established/a>/i>, its value might change, as defined below./p> p>The dfn iddom-websocket-close>code>close(var>code/var>, var>reason/var>)/code>/dfn> method, when invoked, must run these steps:/p> ol>li>p>If var>code/var> is present, but is neither an integer equal to 1000 nor an integer in the range 3000 to 4999, inclusive, throw an a idthe-websocket-interface:invalidaccesserror hrefhttps://heycam.github.io/webidl/#invalidaccesserror data-x-internalinvalidaccesserror>code>InvalidAccessError/code>/a> code idthe-websocket-interface:domexception-6>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li> p>If var>reason/var> is present, then run these substeps:/p> ol>li>p>Let var>reasonBytes/var> be the result of a hrefhttps://encoding.spec.whatwg.org/#utf-8-encode idthe-websocket-interface:utf-8-encode data-x-internalutf-8-encode>encoding/a> var>reason/var>.li>p>If var>reasonBytes/var> is longer than 123 bytes, then throw a a idthe-websocket-interface:syntaxerror-6 hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idthe-websocket-interface:domexception-7>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./ol> li>p>Run the first matching steps from the following list:/p> dl classswitch>dt>If the code idthe-websocket-interface:dom-websocket-readystate-4>a href#dom-websocket-readystate>readyState/a>/code> attribute is in the code idthe-websocket-interface:dom-websocket-closing-2>a href#dom-websocket-closing>CLOSING/a>/code> (2) or code idthe-websocket-interface:dom-websocket-closed-2>a href#dom-websocket-closed>CLOSED/a>/code> (3) statedd> p>Do nothing./p> p classnote>The connection is already closing or is already closed. If it has not already, a code idthe-websocket-interface:event-close-2>a href#event-close>close/a>/code> event will eventually fire a href#closeWebSocket>as described below/a>./p> dt>If the WebSocket connection is not yet i idthe-websocket-interface:concept-websocket-established-4>a href#concept-websocket-established>established/a>/i> a href#refsWSP>WSP/a>dd> p>i idthe-websocket-interface:concept-websocket-fail-2>a href#concept-websocket-fail>Fail the WebSocket connection/a>/i> and set the code idthe-websocket-interface:dom-websocket-readystate-5>a href#dom-websocket-readystate>readyState/a>/code> attributes value to code idthe-websocket-interface:dom-websocket-closing-3>a href#dom-websocket-closing>CLOSING/a>/code> (2). a href#refsWSP>WSP/a>/p> p classnote>The i idthe-websocket-interface:concept-websocket-fail-3>a href#concept-websocket-fail>fail the WebSocket connection/a>/i> algorithm invokes the i idthe-websocket-interface:concept-websocket-close-2>a href#concept-websocket-close>close the WebSocket connection/a>/i> algorithm, which then establishes that i idthe-websocket-interface:concept-websocket-closed-2>a href#concept-websocket-closed>the WebSocket connection is closed/a>/i>, which fires the code idthe-websocket-interface:event-close-3>a href#event-close>close/a>/code> event a href#closeWebSocket>as described below/a>./p> dt>If the WebSocket closing handshake has not yet been i idthe-websocket-interface:concept-websocket-closing-handshake>a href#concept-websocket-closing-handshake>started/a>/i> a href#refsWSP>WSP/a>dd> p>i idthe-websocket-interface:concept-websocket-start-closing-handshake>a href#concept-websocket-start-closing-handshake>Start the WebSocket closing handshake/a>/i> and set the code idthe-websocket-interface:dom-websocket-readystate-6>a href#dom-websocket-readystate>readyState/a>/code> attributes value to code idthe-websocket-interface:dom-websocket-closing-4>a href#dom-websocket-closing>CLOSING/a>/code> (2). a href#refsWSP>WSP/a>/p> p>If neither var>code/var> nor var>reason/var> is present, the WebSocket Close message must not have a body./p> p classnote>The WebSocket Protocol specification erroneously states that the status code is required for the i idthe-websocket-interface:concept-websocket-start-closing-handshake-2>a href#concept-websocket-start-closing-handshake>start the WebSocket closing handshake/a>/i> algorithm./p> p>If var>code/var> is present, then the status code to use in the WebSocket Close message must be the integer given by var>close/var>. a href#refsWSP>WSP/a>/p> p>If var>reason/var> is also present, then var>reasonBytes/var> must be provided in the Close message after the status code. a href#refsWSP>WSP/a>/p> p classnote>The i idthe-websocket-interface:concept-websocket-start-closing-handshake-3>a href#concept-websocket-start-closing-handshake>start the WebSocket closing handshake/a>/i> algorithm eventually invokes the i idthe-websocket-interface:concept-websocket-close-3>a href#concept-websocket-close>close the WebSocket connection/a>/i> algorithm, which then establishes that i idthe-websocket-interface:concept-websocket-closed-3>a href#concept-websocket-closed>the WebSocket connection is closed/a>/i>, which fires the code idthe-websocket-interface:event-close-4>a href#event-close>close/a>/code> event a href#closeWebSocket>as described below/a>./p> dt>Otherwisedd> p>Set the code idthe-websocket-interface:dom-websocket-readystate-7>a href#dom-websocket-readystate>readyState/a>/code> attributes value to code idthe-websocket-interface:dom-websocket-closing-5>a href#dom-websocket-closing>CLOSING/a>/code> (2)./p> p classnote>i idthe-websocket-interface:concept-websocket-closing-handshake-2>a href#concept-websocket-closing-handshake>The WebSocket closing handshake is started/a>/i>, and will eventually invoke the i idthe-websocket-interface:concept-websocket-close-4>a href#concept-websocket-close>close the WebSocket connection/a>/i> algorithm, which will establish that i idthe-websocket-interface:concept-websocket-closed-4>a href#concept-websocket-closed>the WebSocket connection is closed/a>/i>, and thus the code idthe-websocket-interface:event-close-5>a href#event-close>close/a>/code> event will fire, a href#closeWebSocket>as described below/a>./p> /dl> /ol> p classnote>The code idthe-websocket-interface:dom-websocket-close-4>a href#dom-websocket-close>close()/a>/code> method does not discard previously sent messages before starting the WebSocket closing handshake — even if, in practice, the user agent is still busy sending those messages, the handshake will only start after the messages are sent./p> hr> p>The dfn iddom-websocket-bufferedamount>code>bufferedAmount/code>/dfn> attribute must return the number of bytes of application data (UTF-8 text and binary data) that have been queued using code idthe-websocket-interface:dom-websocket-send-8>a href#dom-websocket-send>send()/a>/code> but that, as of the last time the a href#event-loop idthe-websocket-interface:event-loop>event loop/a> reached a href#step1>step 1/a>, had not yet been transmitted to the network. (This thus includes any text sent during the execution of the current task, regardless of whether the user agent is able to transmit text in the background a href#in-parallel idthe-websocket-interface:in-parallel-2>in parallel/a> with script execution.) This does not include framing overhead incurred by the protocol, or buffering done by the operating system or network hardware./p> div classexample> p>In this simple example, the code idthe-websocket-interface:dom-websocket-bufferedamount-3>a href#dom-websocket-bufferedamount>bufferedAmount/a>/code> attribute is used to ensure that updates are sent either at the rate of one update every 50ms, if the network can handle that rate, or at whatever rate the network em>can/em> handle, if that is too fast./p> pre>var socket new WebSocket(ws://game.example.com:12010/updates);socket.onopen function () { setInterval(function() { if (socket.bufferedAmount 0) socket.send(getUpdateData()); }, 50);};/pre> p>The code idthe-websocket-interface:dom-websocket-bufferedamount-4>a href#dom-websocket-bufferedamount>bufferedAmount/a>/code> attribute can also be used to saturate the network without sending the data at a higher rate than the network can handle, though this requires more careful monitoring of the value of the attribute over time./p> /div> hr> p>When a code idthe-websocket-interface:websocket-8>a href#websocket>WebSocket/a>/code> object is created, its dfn iddom-websocket-binarytype>code>binaryType/code>/dfn> IDL attribute must be set to the string code idthe-websocket-interface:dom-binarytype-blob-4>a href#dom-binarytype-blob>blob/a>/code>. On getting, it must return the last value it was set to. On setting, the user agent must set the IDL attribute to the new value./p> p classnote>User agents can use the code idthe-websocket-interface:dom-websocket-binarytype-3>a href#dom-websocket-binarytype>binaryType/a>/code> attribute as a hint for how to handle incoming binary data: if the attribute is set to code idthe-websocket-interface:dom-binarytype-blob-5>a href#dom-binarytype-blob>blob/a>/code>, it is safe to spool it to disk, and if it is set to code idthe-websocket-interface:dom-binarytype-arraybuffer-3>a href#dom-binarytype-arraybuffer>arraybuffer/a>/code>, it is likely more efficient to keep the data in memory. Naturally, user agents are encouraged to use more subtle heuristics to decide whether to keep incoming data in memory or not, e.g. based on how big the data is or how common it is for a script to change the attribute at the last minute. This latter aspect is important in particular because it is quite possible for the attribute to be changed after the user agent has received the data but before the user agent has fired the event for it./p> p>The dfn iddom-websocket-send>code>send(var>data/var>)/code>/dfn> method transmits data using the connection. If the code idthe-websocket-interface:dom-websocket-readystate-8>a href#dom-websocket-readystate>readyState/a>/code> attribute is code idthe-websocket-interface:dom-websocket-connecting-3>a href#dom-websocket-connecting>CONNECTING/a>/code>, it must throw an a idthe-websocket-interface:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idthe-websocket-interface:domexception-8>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>. Otherwise, the user agent must run the appropriate set of steps from the following list:/p> dl>dt>If the argument is a stringdd> p>If i idthe-websocket-interface:concept-websocket-established-5>a href#concept-websocket-established>the WebSocket connection is established/a>/i> and i idthe-websocket-interface:concept-websocket-closing-handshake-3>a href#concept-websocket-closing-handshake>the WebSocket closing handshake has not yet started/a>/i>, then the user agent must i idthe-websocket-interface:concept-websocket-send>a href#concept-websocket-send>send a WebSocket Message/a>/i> comprised of the var>data/var> argument using a text frame opcode; if the data cannot be sent, e.g. because it would need to be buffered but the buffer is full, the user agent must a href#concept-websocket-close-fail idthe-websocket-interface:concept-websocket-close-fail>flag the WebSocket as full/a> and then i idthe-websocket-interface:concept-websocket-close-5>a href#concept-websocket-close>close the WebSocket connection/a>/i>. Any invocation of this method with a string argument that does not throw an exception must increase the code idthe-websocket-interface:dom-websocket-bufferedamount-5>a href#dom-websocket-bufferedamount>bufferedAmount/a>/code> attribute by the number of bytes needed to express the argument as UTF-8. a href#refsUNICODE>UNICODE/a> a href#refsENCODING>ENCODING/a> a href#refsWSP>WSP/a>/p> dt>If the argument is a code idthe-websocket-interface:blob-4>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> objectdd> p>If i idthe-websocket-interface:concept-websocket-established-6>a href#concept-websocket-established>the WebSocket connection is established/a>/i>, and i idthe-websocket-interface:concept-websocket-closing-handshake-4>a href#concept-websocket-closing-handshake>the WebSocket closing handshake has not yet started/a>/i>, then the user agent must i idthe-websocket-interface:concept-websocket-send-2>a href#concept-websocket-send>send a WebSocket Message/a>/i> comprised of var>data/var> using a binary frame opcode; if the data cannot be sent, e.g. because it would need to be buffered but the buffer is full, the user agent must a href#concept-websocket-close-fail idthe-websocket-interface:concept-websocket-close-fail-2>flag the WebSocket as full/a> and then i idthe-websocket-interface:concept-websocket-close-6>a href#concept-websocket-close>close the WebSocket connection/a>/i>. The data to be sent is the raw data represented by the code idthe-websocket-interface:blob-5>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> object. Any invocation of this method with a code idthe-websocket-interface:blob-6>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> argument that does not throw an exception must increase the code idthe-websocket-interface:dom-websocket-bufferedamount-6>a href#dom-websocket-bufferedamount>bufferedAmount/a>/code> attribute by the size of the code idthe-websocket-interface:blob-7>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> objects raw data, in bytes. a href#refsWSP>WSP/a> a href#refsFILEAPI>FILEAPI/a>/p> dt>If the argument is an code idthe-websocket-interface:idl-arraybuffer-4>a data-x-internalidl-arraybuffer hrefhttps://heycam.github.io/webidl/#idl-ArrayBuffer>ArrayBuffer/a>/code> objectdd> p>If i idthe-websocket-interface:concept-websocket-established-7>a href#concept-websocket-established>the WebSocket connection is established/a>/i>, and i idthe-websocket-interface:concept-websocket-closing-handshake-5>a href#concept-websocket-closing-handshake>the WebSocket closing handshake has not yet started/a>/i>, then the user agent must i idthe-websocket-interface:concept-websocket-send-3>a href#concept-websocket-send>send a WebSocket Message/a>/i> comprised of var>data/var> using a binary frame opcode; if the data cannot be sent, e.g. because it would need to be buffered but the buffer is full, the user agent must a href#concept-websocket-close-fail idthe-websocket-interface:concept-websocket-close-fail-3>flag the WebSocket as full/a> and then i idthe-websocket-interface:concept-websocket-close-7>a href#concept-websocket-close>close the WebSocket connection/a>/i>. The data to be sent is the data stored in the buffer described by the code idthe-websocket-interface:idl-arraybuffer-5>a data-x-internalidl-arraybuffer hrefhttps://heycam.github.io/webidl/#idl-ArrayBuffer>ArrayBuffer/a>/code> object. Any invocation of this method with an code idthe-websocket-interface:idl-arraybuffer-6>a data-x-internalidl-arraybuffer hrefhttps://heycam.github.io/webidl/#idl-ArrayBuffer>ArrayBuffer/a>/code> argument that does not throw an exception must increase the code idthe-websocket-interface:dom-websocket-bufferedamount-7>a href#dom-websocket-bufferedamount>bufferedAmount/a>/code> attribute by the length of the code idthe-websocket-interface:idl-arraybuffer-7>a data-x-internalidl-arraybuffer hrefhttps://heycam.github.io/webidl/#idl-ArrayBuffer>ArrayBuffer/a>/code> in bytes. a href#refsWSP>WSP/a>/p> dt>If the argument is an object that matches the code idthe-websocket-interface:idl-arraybufferview-3>a data-x-internalidl-arraybufferview hrefhttps://heycam.github.io/webidl/#common-ArrayBufferView>ArrayBufferView/a>/code> type definitiondd> p>If i idthe-websocket-interface:concept-websocket-established-8>a href#concept-websocket-established>the WebSocket connection is established/a>/i>, and i idthe-websocket-interface:concept-websocket-closing-handshake-6>a href#concept-websocket-closing-handshake>the WebSocket closing handshake has not yet started/a>/i>, then the user agent must i idthe-websocket-interface:concept-websocket-send-4>a href#concept-websocket-send>send a WebSocket Message/a>/i> comprised of var>data/var> using a binary frame opcode; if the data cannot be sent, e.g. because it would need to be buffered but the buffer is full, the user agent must a href#concept-websocket-close-fail idthe-websocket-interface:concept-websocket-close-fail-4>flag the WebSocket as full/a> and then i idthe-websocket-interface:concept-websocket-close-8>a href#concept-websocket-close>close the WebSocket connection/a>/i>. The data to be sent is the data stored in the section of the buffer described by the code idthe-websocket-interface:idl-arraybuffer-8>a data-x-internalidl-arraybuffer hrefhttps://heycam.github.io/webidl/#idl-ArrayBuffer>ArrayBuffer/a>/code> object that var>data/var> references. Any invocation of this method with this kind of argument that does not throw an exception must increase the code idthe-websocket-interface:dom-websocket-bufferedamount-8>a href#dom-websocket-bufferedamount>bufferedAmount/a>/code> attribute by the length of var>data/var>s buffer in bytes. a href#refsWSP>WSP/a>/p> /dl> hr> p>The following are the a href#event-handlers idthe-websocket-interface:event-handlers>event handlers/a> (and their corresponding a href#event-handler-event-type idthe-websocket-interface:event-handler-event-type>event handler event types/a>) that must be supported, as a href#event-handler-idl-attributes idthe-websocket-interface:event-handler-idl-attributes>event handler IDL attributes/a>, by all objects implementing the code idthe-websocket-interface:websocket-9>a href#websocket>WebSocket/a>/code> interface:/p> table>thead>tr>th>a href#event-handlers idthe-websocket-interface:event-handlers-2>Event handler/a> th>a href#event-handler-event-type idthe-websocket-interface:event-handler-event-type-2>Event handler event type/a> tbody>tr>td>dfn idhandler-websocket-onopen>code>onopen/code>/dfn> td> code idthe-websocket-interface:event-open>a href#event-open>open/a>/code> tr>td>dfn idhandler-websocket-onmessage>code>onmessage/code>/dfn> td> code idthe-websocket-interface:event-message>a href#event-message>message/a>/code> tr>td>dfn idhandler-websocket-onerror>code>onerror/code>/dfn> td> code idthe-websocket-interface:event-error>a href#event-error>error/a>/code> tr>td>dfn idhandler-websocket-onclose>code>onclose/code>/dfn> td> code idthe-websocket-interface:event-close-6>a href#event-close>close/a>/code> /table> h4 idfeedback-from-the-protocol>span classsecno>9.3.3/span> Feedback from the protocola href#feedback-from-the-protocol classself-link>/a>/h4> p>When i idfeedback-from-the-protocol:concept-websocket-established>a href#concept-websocket-established>the WebSocket connection is established/a>/i>, the user agent must a href#queue-a-task idfeedback-from-the-protocol:queue-a-task>queue a task/a> to run these steps:/p> ol>li>p>Change the code idfeedback-from-the-protocol:dom-websocket-readystate>a href#dom-websocket-readystate>readyState/a>/code> attributes value to code idfeedback-from-the-protocol:dom-websocket-open>a href#dom-websocket-open>OPEN/a>/code> (1).li>p>Change the code idfeedback-from-the-protocol:dom-websocket-extensions>a href#dom-websocket-extensions>extensions/a>/code> attributes value to the i idfeedback-from-the-protocol:concept-websockets-active-extensions>a href#concept-websockets-active-extensions>extensions in use/a>/i>, if is not the null value. a href#refsWSP>WSP/a>li>p>Change the code idfeedback-from-the-protocol:dom-websocket-protocol>a href#dom-websocket-protocol>protocol/a>/code> attributes value to the i idfeedback-from-the-protocol:concept-websocket-subprotocol>a href#concept-websocket-subprotocol>subprotocol in use/a>/i>, if is not the null value. a href#refsWSP>WSP/a>li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idfeedback-from-the-protocol:concept-event-fire data-x-internalconcept-event-fire>Fire an event/a> named code idfeedback-from-the-protocol:event-open>a href#event-open>open/a>/code> at the code idfeedback-from-the-protocol:websocket>a href#websocket>WebSocket/a>/code> object./p> /ol> p classnote>Since the algorithm above is a href#queue-a-task idfeedback-from-the-protocol:queue-a-task-2>queued as a task/a>, there is no race condition between i idfeedback-from-the-protocol:concept-websocket-established-2>a href#concept-websocket-established>the WebSocket connection being established/a>/i> and the script setting up an event listener for the code idfeedback-from-the-protocol:event-open-2>a href#event-open>open/a>/code> event./p> hr> p>When i idfeedback-from-the-protocol:concept-websocket-message-received>a href#concept-websocket-message-received>a WebSocket message has been received/a>/i> with type var>type/var> and data var>data/var>, the user agent must a href#queue-a-task idfeedback-from-the-protocol:queue-a-task-3>queue a task/a> to follow these steps: a href#refsWSP>WSP/a>/p> ol>li> p>If the code idfeedback-from-the-protocol:dom-websocket-readystate-2>a href#dom-websocket-readystate>readyState/a>/code> attributes value is not code idfeedback-from-the-protocol:dom-websocket-open-2>a href#dom-websocket-open>OPEN/a>/code> (1), then abort these steps./p> li> p>Let var>dataForEvent/var> be determined by switching on var>type/var> and code idfeedback-from-the-protocol:dom-websocket-binarytype>a href#dom-websocket-binarytype>binaryType/a>/code>:/p> dl classswitch>dt>var>type/var> indicates that the data is Textdd>a new code idfeedback-from-the-protocol:idl-domstring>a data-x-internalidl-domstring hrefhttps://heycam.github.io/webidl/#idl-DOMString>DOMString/a>/code> containing var>data/var>dt>var>type/var> indicates that the data is Binary and code idfeedback-from-the-protocol:dom-websocket-binarytype-2>a href#dom-websocket-binarytype>binaryType/a>/code> is dfn iddom-binarytype-blob>code>blob/code>/dfn>dd>a new code idfeedback-from-the-protocol:blob>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code> object, created in the a href#concept-relevant-realm idfeedback-from-the-protocol:concept-relevant-realm>relevant Realm/a> of the code idfeedback-from-the-protocol:websocket-2>a href#websocket>WebSocket/a>/code> object, that represents var>data/var> as its raw data a href#refsFILEAPI>FILEAPI/a>dt>var>type/var> indicates that the data is Binary and code idfeedback-from-the-protocol:dom-websocket-binarytype-3>a href#dom-websocket-binarytype>binaryType/a>/code> is dfn iddom-binarytype-arraybuffer>code>arraybuffer/code>/dfn>dd>a new code idfeedback-from-the-protocol:idl-arraybuffer>a data-x-internalidl-arraybuffer hrefhttps://heycam.github.io/webidl/#idl-ArrayBuffer>ArrayBuffer/a>/code> object, created in the a href#concept-relevant-realm idfeedback-from-the-protocol:concept-relevant-realm-2>relevant Realm/a> of the code idfeedback-from-the-protocol:websocket-3>a href#websocket>WebSocket/a>/code> object, whose contents are var>data/var>/dl> li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idfeedback-from-the-protocol:concept-event-fire-2 data-x-internalconcept-event-fire>Fire an event/a> named code idfeedback-from-the-protocol:event-message>a href#event-message>message/a>/code> at the code idfeedback-from-the-protocol:websocket-4>a href#websocket>WebSocket/a>/code> object, using code idfeedback-from-the-protocol:messageevent>a href#messageevent>MessageEvent/a>/code>, with the code idfeedback-from-the-protocol:dom-messageevent-origin>a href#dom-messageevent-origin>origin/a>/code> attribute initialized to the a href#ascii-serialisation-of-an-origin idfeedback-from-the-protocol:ascii-serialisation-of-an-origin>serialization/a> of the code idfeedback-from-the-protocol:websocket-5>a href#websocket>WebSocket/a>/code> objects a href#concept-websocket-url idfeedback-from-the-protocol:concept-websocket-url>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-origin idfeedback-from-the-protocol:concept-url-origin data-x-internalconcept-url-origin>origin/a>, and the code idfeedback-from-the-protocol:dom-messageevent-data>a href#dom-messageevent-data>data/a>/code> attribute initialized to var>dataForEvent/var>./ol> p classnote>User agents are encouraged to check if they can perform the above steps efficiently before they run the task, picking tasks from other a href#task-queue idfeedback-from-the-protocol:task-queue>task queues/a> while they prepare the buffers if not. For example, if the code idfeedback-from-the-protocol:dom-websocket-binarytype-4>a href#dom-websocket-binarytype>binaryType/a>/code> attribute was set to code idfeedback-from-the-protocol:dom-binarytype-blob>a href#dom-binarytype-blob>blob/a>/code> when the data arrived, and the user agent spooled all the data to disk, but just before running the above a href#concept-task idfeedback-from-the-protocol:concept-task>task/a> for this particular message the script switched code idfeedback-from-the-protocol:dom-websocket-binarytype-5>a href#dom-websocket-binarytype>binaryType/a>/code> to code idfeedback-from-the-protocol:dom-binarytype-arraybuffer>a href#dom-binarytype-arraybuffer>arraybuffer/a>/code>, the user agent would want to page the data back to RAM before running this a href#concept-task idfeedback-from-the-protocol:concept-task-2>task/a> so as to avoid stalling the main thread while it created the code idfeedback-from-the-protocol:idl-arraybuffer-2>a data-x-internalidl-arraybuffer hrefhttps://heycam.github.io/webidl/#idl-ArrayBuffer>ArrayBuffer/a>/code> object./p> div classexample> p>Here is an example of how to define a handler for the code idfeedback-from-the-protocol:event-message-2>a href#event-message>message/a>/code> event in the case of text frames:/p> pre>mysocket.onmessage function (event) { if (event.data on) { turnLampOn(); } else if (event.data off) { turnLampOff(); }};/pre> p>The protocol here is a trivial one, with the server just sending on or off messages./p> /div> hr> p>When i idfeedback-from-the-protocol:concept-websocket-closing-handshake>a href#concept-websocket-closing-handshake>the WebSocket closing handshake is started/a>/i>, the user agent must a href#queue-a-task idfeedback-from-the-protocol:queue-a-task-4>queue a task/a> to change the code idfeedback-from-the-protocol:dom-websocket-readystate-3>a href#dom-websocket-readystate>readyState/a>/code> attributes value to code idfeedback-from-the-protocol:dom-websocket-closing>a href#dom-websocket-closing>CLOSING/a>/code> (2). (If the code idfeedback-from-the-protocol:dom-websocket-close>a href#dom-websocket-close>close()/a>/code> method was called, the code idfeedback-from-the-protocol:dom-websocket-readystate-4>a href#dom-websocket-readystate>readyState/a>/code> attributes value will already be set to code idfeedback-from-the-protocol:dom-websocket-closing-2>a href#dom-websocket-closing>CLOSING/a>/code> (2) when this task runs.) a href#refsWSP>WSP/a>/p> hr> p idcloseWebSocket>When i idfeedback-from-the-protocol:concept-websocket-closed>a href#concept-websocket-closed>the WebSocket connection is closed/a>/i>, possibly i>cleanly/i>, the user agent must a href#queue-a-task idfeedback-from-the-protocol:queue-a-task-5>queue a task/a> to run the following substeps:/p> ol>li>p>Change the code idfeedback-from-the-protocol:dom-websocket-readystate-5>a href#dom-websocket-readystate>readyState/a>/code> attributes value to code idfeedback-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 idfeedback-from-the-protocol:concept-websocket-fail>a href#concept-websocket-fail>fail the WebSocket connection/a>/i>, or if the i idfeedback-from-the-protocol:concept-websocket-closed-2>a href#concept-websocket-closed>the WebSocket connection was closed/a>/i> after being dfn idconcept-websocket-close-fail>flagged as full/dfn>, a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idfeedback-from-the-protocol:concept-event-fire-3 data-x-internalconcept-event-fire>fire an event/a> named code>error/code> at the code idfeedback-from-the-protocol:websocket-6>a href#websocket>WebSocket/a>/code> object. a href#refsWSP>WSP/a>li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idfeedback-from-the-protocol:concept-event-fire-4 data-x-internalconcept-event-fire>Fire an event/a> named code idfeedback-from-the-protocol:event-close>a href#event-close>close/a>/code> at the code idfeedback-from-the-protocol:websocket-7>a href#websocket>WebSocket/a>/code> object, using code idfeedback-from-the-protocol:closeevent>a href#closeevent>CloseEvent/a>/code>, with the code idfeedback-from-the-protocol:dom-closeevent-wasclean>a href#dom-closeevent-wasclean>wasClean/a>/code> attribute initialized to true if the connection closed i>cleanly/i> and false otherwise, the code idfeedback-from-the-protocol:dom-closeevent-code>a href#dom-closeevent-code>code/a>/code> attribute initialized to i idfeedback-from-the-protocol:concept-websocket-close-code>a href#concept-websocket-close-code>the WebSocket connection close code/a>/i>, and the code idfeedback-from-the-protocol:dom-closeevent-reason>a href#dom-closeevent-reason>reason/a>/code> attribute initialized to the result of applying a idfeedback-from-the-protocol:utf-8-decode-without-bom hrefhttps://encoding.spec.whatwg.org/#utf-8-decode-without-bom data-x-internalutf-8-decode-without-bom>UTF-8 decode without BOM/a> to i idfeedback-from-the-protocol:concept-websocket-close-reason>a href#concept-websocket-close-reason>the WebSocket connection close reason/a>/i>. a href#refsWSP>WSP/a>/ol> div classwarning> p>User agents must not convey any failure information to scripts in a way that would allow a script to distinguish the following situations:/p> ul>li>A server whose host name could not be resolved. li>A server to which packets could not successfully be routed. li>A server that refused the connection on the specified port. li>A server that failed to correctly perform a TLS handshake (e.g., the server certificate cant be verified). li>A server that did not complete the opening handshake (e.g. because it was not a WebSocket server). li>A WebSocket server that sent a correct opening handshake, but that specified options that caused the client to drop the connection (e.g. the server specified a subprotocol that the client did not offer). li>A WebSocket server that abruptly closed the connection after successfully completing the opening handshake. /ul> p>In all of these cases, the i idfeedback-from-the-protocol:concept-websocket-close-code-2>a href#concept-websocket-close-code>the WebSocket connection close code/a>/i> would be 1006, as required by the WebSocket Protocol specification. a href#refsWSP>WSP/a>/p> p>Allowing a script to distinguish these cases would allow a script to probe the users local network in preparation for an attack./p> p classnote>In particular, this means the code 1015 is not used by the user agent (unless the server erroneously uses it in its close frame, of course)./p> /div> hr> p>The a href#task-source idfeedback-from-the-protocol:task-source>task source/a> for all a href#concept-task idfeedback-from-the-protocol:concept-task-3>tasks/a> a href#queue-a-task idfeedback-from-the-protocol:queue-a-task-6>queued/a> in this section is the dfn idwebsocket-task-source>WebSocket task source/dfn>./p> h4 idping-and-pong-frames>span classsecno>9.3.4/span> Ping and Pong framesa href#ping-and-pong-frames classself-link>/a>/h4> p>The WebSocket protocol specification defines Ping and Pong frames that can be used for keep-alive, heart-beats, network status probing, latency instrumentation, and so forth. These are not currently exposed in the API./p> p>User agents may send ping and unsolicited pong frames as desired, for example in an attempt to maintain local network NAT mappings, to detect failed connections, or to display latency metrics to the user. User agents must not use pings or unsolicited pongs to aid the server; it is assumed that servers will solicit pongs whenever appropriate for the servers needs./p> h4 idthe-closeevent-interface>span classsecno>9.3.5/span> The code idthe-closeevent-interface:closeevent>a href#closeevent>CloseEvent/a>/code> interfacea href#the-closeevent-interface classself-link>/a>/h4> p>code idthe-closeevent-interface:websocket>a href#websocket>WebSocket/a>/code> objects use the code idthe-closeevent-interface:closeevent-2>a href#closeevent>CloseEvent/a>/code> interface for their code idthe-closeevent-interface:event-close>a href#event-close>close/a>/code> events:/p> pre classidl>Constructor(DOMString type, optional a href#closeeventinit idthe-closeevent-interface:closeeventinit>CloseEventInit/a> eventInitDict), Exposed(Window,Worker)interface dfn idcloseevent>CloseEvent/dfn> : a idthe-closeevent-interface:event hrefhttps://dom.spec.whatwg.org/#interface-event data-x-internalevent>Event/a> { readonly attribute boolean a href#dom-closeevent-wasclean idthe-closeevent-interface:dom-closeevent-wasclean>wasClean/a>; readonly attribute unsigned short a href#dom-closeevent-code idthe-closeevent-interface:dom-closeevent-code>code/a>; readonly attribute USVString a href#dom-closeevent-reason idthe-closeevent-interface:dom-closeevent-reason>reason/a>;};dictionary dfn idcloseeventinit>CloseEventInit/dfn> : a idthe-closeevent-interface:eventinit hrefhttps://dom.spec.whatwg.org/#dictdef-eventinit data-x-internaleventinit>EventInit/a> { boolean wasClean false; unsigned short code 0; USVString reason ;};/pre> dl classdomintro>dt>var>event/var> . code idthe-closeevent-interface:dom-closeevent-wasclean-2>a href#dom-closeevent-wasclean>wasClean/a>/code>dd> p>Returns true if the connection closed cleanly; false otherwise./p> dt>var>event/var> . code idthe-closeevent-interface:dom-closeevent-code-2>a href#dom-closeevent-code>code/a>/code>dd> p>Returns the WebSocket connection close code provided by the server./p> dt>var>event/var> . code idthe-closeevent-interface:dom-closeevent-reason-2>a href#dom-closeevent-reason>reason/a>/code>dd> p>Returns the WebSocket connection close reason provided by the server./p> /dl> p>The dfn iddom-closeevent-wasclean>code>wasClean/code>/dfn> attribute must return the value it was initialized to. It represents whether the connection closed cleanly or not./p> p>The dfn iddom-closeevent-code>code>code/code>/dfn> attribute must return the value it was initialized to. It represents the WebSocket connection close code provided by the server./p> p>The dfn iddom-closeevent-reason>code>reason/code>/dfn> attribute must return the value it was initialized to. It represents the WebSocket connection close reason provided by the server./p> h4 idgarbage-collection-3>span classsecno>9.3.6/span> Garbage collectiona href#garbage-collection-3 classself-link>/a>/h4> p>A code idgarbage-collection-3:websocket>a href#websocket>WebSocket/a>/code> object whose code idgarbage-collection-3:dom-websocket-readystate>a href#dom-websocket-readystate>readyState/a>/code> attributes value was set to code idgarbage-collection-3:dom-websocket-connecting>a href#dom-websocket-connecting>CONNECTING/a>/code> (0) as of the last time the a href#event-loop idgarbage-collection-3:event-loop>event loop/a> reached a href#step1>step 1/a> must not be garbage collected if there are any event listeners registered for code idgarbage-collection-3:event-open>a href#event-open>open/a>/code> events, code idgarbage-collection-3:event-message>a href#event-message>message/a>/code> events, code idgarbage-collection-3:event-error>a href#event-error>error/a>/code> events, or code idgarbage-collection-3:event-close>a href#event-close>close/a>/code> events./p> p>A code idgarbage-collection-3:websocket-2>a href#websocket>WebSocket/a>/code> object whose code idgarbage-collection-3:dom-websocket-readystate-2>a href#dom-websocket-readystate>readyState/a>/code> attributes value was set to code idgarbage-collection-3:dom-websocket-open>a href#dom-websocket-open>OPEN/a>/code> (1) as of the last time the a href#event-loop idgarbage-collection-3:event-loop-2>event loop/a> reached a href#step1>step 1/a> must not be garbage collected if there are any event listeners registered for code idgarbage-collection-3:event-message-2>a href#event-message>message/a>/code> events, code idgarbage-collection-3:event-error-2>a href#event-error>error/a>/code>, or code idgarbage-collection-3:event-close-2>a href#event-close>close/a>/code> events./p> p>A code idgarbage-collection-3:websocket-3>a href#websocket>WebSocket/a>/code> object whose code idgarbage-collection-3:dom-websocket-readystate-3>a href#dom-websocket-readystate>readyState/a>/code> attributes value was set to code idgarbage-collection-3:dom-websocket-closing>a href#dom-websocket-closing>CLOSING/a>/code> (2) as of the last time the a href#event-loop idgarbage-collection-3:event-loop-3>event loop/a> reached a href#step1>step 1/a> must not be garbage collected if there are any event listeners registered for code idgarbage-collection-3:event-error-3>a href#event-error>error/a>/code> or code idgarbage-collection-3:event-close-3>a href#event-close>close/a>/code> events./p> p>A code idgarbage-collection-3:websocket-4>a href#websocket>WebSocket/a>/code> object with i idgarbage-collection-3:concept-websocket-established>a href#concept-websocket-established>an established connection/a>/i> that has data queued to be transmitted to the network must not be garbage collected. a href#refsWSP>WSP/a>/p> p>If a code idgarbage-collection-3:websocket-5>a href#websocket>WebSocket/a>/code> object is garbage collected while its connection is still open, the user agent must i idgarbage-collection-3:concept-websocket-start-closing-handshake>a href#concept-websocket-start-closing-handshake>start the WebSocket closing handshake/a>/i>, with no status code for the Close message. a href#refsWSP>WSP/a>/p> hr> p>If a user agent is to dfn idmake-disappear>make disappear/dfn> a code idgarbage-collection-3:websocket-6>a href#websocket>WebSocket/a>/code> object (this happens when a code idgarbage-collection-3:document>a href#document>Document/a>/code> object goes away), the user agent must follow the first appropriate set of steps from the following list:/p> dl classswitch>dt>If the WebSocket connection is not yet i idgarbage-collection-3:concept-websocket-established-2>a href#concept-websocket-established>established/a>/i> a href#refsWSP>WSP/a>dd> p>i idgarbage-collection-3:concept-websocket-fail>a href#concept-websocket-fail>Fail the WebSocket connection/a>/i>. a href#refsWSP>WSP/a>/p> dt>If the WebSocket closing handshake has not yet been i idgarbage-collection-3:concept-websocket-closing-handshake>a href#concept-websocket-closing-handshake>started/a>/i> a href#refsWSP>WSP/a>dd> p>i idgarbage-collection-3:concept-websocket-start-closing-handshake-2>a href#concept-websocket-start-closing-handshake>Start the WebSocket closing handshake/a>/i>, with the status code to use in the WebSocket Close message being 1001. a href#refsWSP>WSP/a>/p> dt>Otherwisedd> p>Do nothing./p> /dl> h3 idweb-messaging>span classsecno>9.4/span> dfn idcrossDocumentMessages>Cross-document messaging/dfn>a href#web-messaging classself-link>/a>/h3>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> x-doc-messagingspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>3.2+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>3+/span>/span>span classie partial>span>IE (limited)/span> span>8+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>4+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.1+/span>/span>span classopera yes>span>Opera/span> span>9.5+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featx-doc-messaging>caniuse.com/a>/div> p>Web browsers, for security and privacy reasons, prevent documents in different domains from affecting each other; that is, cross-site scripting is disallowed./p> p>While this is an important security feature, it prevents pages from different domains from communicating even when those pages are not hostile. This section introduces a messaging system that allows documents to communicate with each other regardless of their source domain, in a way designed to not enable cross-site scripting attacks./p> p classnote>This API a href#fingerprint-postMessage>has some privacy implications/a> that might not be immediately obvious./p> p>The a href#task-source idweb-messaging:task-source>task source/a> for the a href#concept-task idweb-messaging:concept-task>tasks/a> in a href#web-messaging idweb-messaging:web-messaging>cross-document messaging/a> is the dfn idposted-message-task-source>posted message task source/dfn>./p> h4 idintroduction-12>span classsecno>9.4.1/span> Introductiona href#introduction-12 classself-link>/a>/h4> p>i>This section is non-normative./i>/p> div classexample> p>For example, if document A contains an code idintroduction-12:the-iframe-element>a href#the-iframe-element>iframe/a>/code> element that contains document B, and script in document A calls code idintroduction-12:dom-window-postmessage>a href#dom-window-postmessage>postMessage()/a>/code> on the code idintroduction-12:window>a href#window>Window/a>/code> object of document B, then a message event will be fired on that object, marked as originating from the code idintroduction-12:window-2>a href#window>Window/a>/code> of document A. The script in document A might look like:/p> pre>var o document.getElementsByTagName(iframe)0;o.contentWindow.postMessage(Hello world, https://b.example.org/);/pre> p>To register an event handler for incoming events, the script would use code>addEventListener()/code> (or similar mechanisms). For example, the script in document B might look like:/p> pre>window.addEventListener(message, receiver, false);function receiver(e) { if (e.origin https://example.com) { if (e.data Hello world) { e.source.postMessage(Hello, e.origin); } else { alert(e.data); } }}/pre> p>This script first checks the domain is the expected domain, and then looks at the message, which it either displays to the user, or responds to by sending a message back to the document which sent the message in the first place./p> /div> h4 idsecurity-postmsg>span classsecno>9.4.2/span> Securitya href#security-postmsg classself-link>/a>/h4> h5 idauthors>span classsecno>9.4.2.1/span> Authorsa href#authors classself-link>/a>/h5> p idsecurity-4 classwarning>Use of this API requires extra care to protect users from hostile entities abusing a site for their own purposes./p> p>Authors should check the code idauthors:dom-messageevent-origin>a href#dom-messageevent-origin>origin/a>/code> attribute to ensure that messages are only accepted from domains that they expect to receive messages from. Otherwise, bugs in the authors message handling code could be exploited by hostile sites./p> p>Furthermore, even after checking the code idauthors:dom-messageevent-origin-2>a href#dom-messageevent-origin>origin/a>/code> attribute, authors should also check that the data in question is of the expected format. Otherwise, if the source of the event has been attacked using a cross-site scripting flaw, further unchecked processing of information sent using the code idauthors:dom-window-postmessage>a href#dom-window-postmessage>postMessage()/a>/code> method could result in the attack being propagated into the receiver./p> p>Authors should not use the wildcard keyword (*) in the var>targetOrigin/var> argument in messages that contain any confidential information, as otherwise there is no way to guarantee that the message is only delivered to the recipient to which it was intended./p> hr> p>Authors who accept messages from any origin are encouraged to consider the risks of a denial-of-service attack. An attacker could send a high volume of messages; if the receiving page performs expensive computation or causes network traffic to be sent for each such message, the attackers message could be multiplied into a denial-of-service attack. Authors are encouraged to employ rate limiting (only accepting a certain number of messages per minute) to make such attacks impractical./p> h5 iduser-agents>span classsecno>9.4.2.2/span> User agentsa href#user-agents classself-link>/a>/h5> p>The integrity of this API is based on the inability for scripts of one a href#concept-origin iduser-agents:concept-origin>origin/a> to post arbitrary events (using code>dispatchEvent()/code> or otherwise) to objects in other origins (those that are not the a href#same-origin iduser-agents:same-origin>same/a>)./p> p classnote>Implementors are urged to take extra care in the implementation of this feature. It allows authors to transmit information from one domain to another domain, which is normally disallowed for security reasons. It also requires that UAs be careful to allow access to certain properties but not others./p> hr> p>User agents are also encouraged to consider rate-limiting message traffic between different a href#concept-origin iduser-agents:concept-origin-2>origins/a>, to protect naïve sites from denial-of-service attacks./p> h4 idposting-messages>span classsecno>9.4.3/span> Posting messagesa href#posting-messages classself-link>/a>/h4> dl classdomintro>dt>var>window/var> . code idposting-messages:dom-window-postmessage>a href#dom-window-postmessage>postMessage/a>/code>(var>message/var>, var>targetOrigin/var> , var>transfer/var> )dd> p>Posts a message to the given window. Messages can be structured objects, e.g. nested objects and arrays, can contain JavaScript values (strings, numbers, code idposting-messages:date>a data-x-internaldate hrefhttps://tc39.github.io/ecma262/#sec-date-objects>Date/a>/code> objects, etc), and can contain certain data objects such as code idposting-messages:file>a data-x-internalfile hrefhttps://w3c.github.io/FileAPI/#dfn-file>File/a>/code> code idposting-messages:blob>a data-x-internalblob hrefhttps://w3c.github.io/FileAPI/#dfn-Blob>Blob/a>/code>, code idposting-messages:filelist>a data-x-internalfilelist hrefhttps://w3c.github.io/FileAPI/#filelist-section>FileList/a>/code>, and code idposting-messages:idl-arraybuffer>a data-x-internalidl-arraybuffer hrefhttps://heycam.github.io/webidl/#idl-ArrayBuffer>ArrayBuffer/a>/code> objects./p> p>Objects listed in var>transfer/var> are transferred, not just cloned, meaning that they are no longer usable on the sending side./p> p>If the origin of the target window doesnt match the given origin, the message is discarded, to avoid information leakage. To send the message to the target regardless of origin, set the target origin to code>*/code>. To restrict the message to same-origin targets only, without needing to explicitly state the origin, set the target origin to code>//code>./p> p>Throws a a idposting-messages:datacloneerror hrefhttps://heycam.github.io/webidl/#datacloneerror data-x-internaldatacloneerror>code>DataCloneError/code>/a> code idposting-messages:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if var>transfer/var> array contains duplicate objects or if var>message/var> could not be cloned./p> /dl> p classnote>When posting a message to a code idposting-messages:window>a href#window>Window/a>/code> of a a href#browsing-context idposting-messages:browsing-context>browsing context/a> that has just been navigated to a new code idposting-messages:document>a href#document>Document/a>/code> is likely to result in the message not receiving its intended recipient: the scripts in the target a href#browsing-context idposting-messages:browsing-context-2>browsing context/a> have to have had time to set up listeners for the messages. Thus, for instance, in situations where a message is to be sent to the code idposting-messages:window-2>a href#window>Window/a>/code> of newly created child code idposting-messages:the-iframe-element>a href#the-iframe-element>iframe/a>/code>, authors are advised to have the child code idposting-messages:document-2>a href#document>Document/a>/code> post a message to their parent announcing their readiness to receive messages, and for the parent to wait for this message before beginning posting messages./p> p>The dfn iddom-window-postmessage>code>postMessage(var>message/var>, var>targetOrigin/var>, var>transfer/var>)/code>/dfn> method, when invoked on a code idposting-messages:window-3>a href#window>Window/a>/code> object must run the following steps:/p> ol>li>p>Let var>targetWindow/var> be this code idposting-messages:window-4>a href#window>Window/a>/code> object./p> li>p>Let var>targetRealm/var> be var>targetWindow/var>s a href#concept-global-object-realm idposting-messages:concept-global-object-realm>Realm/a>.li>p>Let var>incumbentSettings/var> be the a href#incumbent-settings-object idposting-messages:incumbent-settings-object>incumbent settings object/a>.li>p>If var>targetOrigin/var> is a single U+002F SOLIDUS character (/), then set var>targetOrigin/var> to var>incumbentSettings/var>s a href#concept-settings-object-origin idposting-messages:concept-settings-object-origin>origin/a>./p> li> p>Otherwise, if var>targetOrigin/var> is not a single U+002A ASTERISK character (*), then:/p> ol>li>p>Let var>parsedURL/var> be the result of running the a idposting-messages:url-parser hrefhttps://url.spec.whatwg.org/#concept-url-parser data-x-internalurl-parser>URL parser/a> on var>targetOrigin/var>.li>p>If var>parsedURL/var> is failure, then throw a a idposting-messages:syntaxerror hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idposting-messages:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>.li>p>Set var>targetOrigin/var> to var>parsedURL/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-origin idposting-messages:concept-url-origin data-x-internalconcept-url-origin>origin/a>./ol> li>p>Let var>serializeWithTransferResult/var> be a href#structuredserializewithtransfer idposting-messages:structuredserializewithtransfer>StructuredSerializeWithTransfer/a>(var>message/var>, var>transfer/var>). Rethrow any exceptions.li> p>a href#queue-a-task idposting-messages:queue-a-task>Queue a task/a> on the a href#posted-message-task-source idposting-messages:posted-message-task-source>posted message task source/a> to run the following steps:/p> ol>li>p>If the var>targetOrigin/var> argument is not a single literal U+002A ASTERISK character (*) and var>targetWindow/var>s a href#concept-document-window idposting-messages:concept-document-window>associated code>Document/code>/a>s a href#concept-origin idposting-messages:concept-origin>origin/a> is not a href#same-origin idposting-messages:same-origin>same origin/a> with var>targetOrigin/var>, then abort these steps.li>p>Let var>origin/var> be the a href#ascii-serialisation-of-an-origin idposting-messages:ascii-serialisation-of-an-origin>serialization/a> of var>incumbentSettings/var>s a href#concept-settings-object-origin idposting-messages:concept-settings-object-origin-2>origin/a>.li>p>Let var>source/var> be the code idposting-messages:windowproxy>a href#windowproxy>WindowProxy/a>/code> objects corresponding to var>incumbentSettings/var>s a href#concept-settings-object-global idposting-messages:concept-settings-object-global>global object/a> (a code idposting-messages:window-5>a href#window>Window/a>/code> object).li> p>Let var>deserializeRecord/var> be a href#structureddeserializewithtransfer idposting-messages:structureddeserializewithtransfer>StructuredDeserializeWithTransfer/a>(var>serializeWithTransferResult/var>, var>targetRealm/var>)./p> p>If this throws an exception, catch it, a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idposting-messages:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idposting-messages:event-messageerror>a href#event-messageerror>messageerror/a>/code> at var>targetWindow/var>, using code idposting-messages:messageevent>a href#messageevent>MessageEvent/a>/code>, with the code idposting-messages:dom-messageevent-origin>a href#dom-messageevent-origin>origin/a>/code> attribute initialized to var>origin/var> and the code idposting-messages:dom-messageevent-source>a href#dom-messageevent-source>source/a>/code> attribute initialized to var>source/var>, and then abort these steps./p> li>p>Let var>messageClone/var> be var>deserializeRecord/var>.Deserialized.li>p>Let var>newPorts/var> be a new a idposting-messages:frozen-array hrefhttps://heycam.github.io/webidl/#dfn-frozen-array-type data-x-internalfrozen-array>frozen array/a> consisting of all code idposting-messages:messageport>a href#messageport>MessagePort/a>/code> objects in var>deserializeRecord/var>.TransferredValues, if any, maintaining their relative order.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idposting-messages:concept-event-fire-2 data-x-internalconcept-event-fire>Fire an event/a> named code idposting-messages:event-message>a href#event-message>message/a>/code> at var>targetWindow/var>, using code idposting-messages:messageevent-2>a href#messageevent>MessageEvent/a>/code>, with the code idposting-messages:dom-messageevent-origin-2>a href#dom-messageevent-origin>origin/a>/code> attribute initialized to var>origin/var>, the code idposting-messages:dom-messageevent-source-2>a href#dom-messageevent-source>source/a>/code> attribute initialized to var>source/var>, the code idposting-messages:dom-messageevent-data>a href#dom-messageevent-data>data/a>/code> attribute initialized to var>messageClone/var>, and the code idposting-messages:dom-messageevent-ports>a href#dom-messageevent-ports>ports/a>/code> attribute initialized to var>newPorts/var>./ol> /ol> h3 idchannel-messaging>span classsecno>9.5/span> dfn>Channel messaging/dfn>a href#channel-messaging classself-link>/a>/h3>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> channel-messagingspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>5.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>41+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>5+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>4.4+/span>/span>span classopera yes>span>Opera/span> span>10.6+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featchannel-messaging>caniuse.com/a>/div> h4 idintroduction-13>span classsecno>9.5.1/span> Introductiona href#introduction-13 classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>To enable independent pieces of code (e.g. running in different a href#browsing-context idintroduction-13:browsing-context>browsing contexts/a>) to communicate directly, authors can use a href#channel-messaging idintroduction-13:channel-messaging>channel messaging/a>./p> p>Communication channels in this mechanism are implemented as two-ways pipes, with a port at each end. Messages sent in one port are delivered at the other port, and vice-versa. Messages are delivered as DOM events, without interrupting or blocking running a href#concept-task idintroduction-13:concept-task>tasks/a>./p> p>To create a connection (two entangled ports), the code>MessageChannel()/code> constructor is called:/p> pre>var channel new MessageChannel();/pre> p>One of the ports is kept as the local port, and the other port is sent to the remote code, e.g. using code idintroduction-13:dom-window-postmessage>a href#dom-window-postmessage>postMessage()/a>/code>:/p> pre>otherWindow.postMessage(hello, https://example.com, channel.port2);/pre> p>To send messages, the code idintroduction-13:dom-messageport-postmessage>a href#dom-messageport-postmessage>postMessage()/a>/code> method on the port is used:/p> pre>channel.port1.postMessage(hello);/pre> p>To receive messages, one listens to code idintroduction-13:event-message>a href#event-message>message/a>/code> events:/p> pre>channel.port1.onmessage handleMessage;function handleMessage(event) { // message is in event.data // ...}/pre> p>Data sent on a port can be structured data; for example here an array of strings is passed on a code idintroduction-13:messageport>a href#messageport>MessagePort/a>/code>:/p> pre>port1.postMessage(hello, world);/pre> h5 idexamples-5>span classsecno>9.5.1.1/span> Examplesa href#examples-5 classself-link>/a>/h5> p>i>This section is non-normative./i>/p> div classexample> p>In this example, two JavaScript libraries are connected to each other using code idexamples-5:messageport>a href#messageport>MessagePort/a>/code>s. This allows the libraries to later be hosted in different frames, or in code idexamples-5:worker>a href#worker>Worker/a>/code> objects, without any change to the APIs./p> pre><script srccontacts.js></script> <!-- exposes a contacts object --><script srccompose-mail.js></script> <!-- exposes a composer object --><script> var channel new MessageChannel(); composer.addContactsProvider(channel.port1); contacts.registerConsumer(channel.port2);</script>/pre> p>Heres what the addContactsProvider() functions implementation could look like:/p> pre>function addContactsProvider(port) { port.onmessage function (event) { switch (event.data.messageType) { search-result: handleSearchResult(event.data.results); break; search-done: handleSearchDone(); break; search-error: handleSearchError(event.data.message); break; // ... } };};/pre> p>Alternatively, it could be implemented as follows:/p> pre>function addContactsProvider(port) { port.addEventListener(message, function (event) { if (event.data.messageType search-result) handleSearchResult(event.data.results); }); port.addEventListener(message, function (event) { if (event.data.messageType search-done) handleSearchDone(); }); port.addEventListener(message, function (event) { if (event.data.messageType search-error) handleSearchError(event.data.message); }); // ... port.start();};/pre> p>The key difference is that when using code idexamples-5:dom-eventtarget-addeventlistener>a data-x-internaldom-eventtarget-addeventlistener hrefhttps://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener>addEventListener()/a>/code>, the code idexamples-5:dom-messageport-start>a href#dom-messageport-start>start()/a>/code> method must also be invoked. When using code idexamples-5:handler-messageport-onmessage>a href#handler-messageport-onmessage>onmessage/a>/code>, the call to code idexamples-5:dom-messageport-start-2>a href#dom-messageport-start>start()/a>/code> is implied./p> p>The code idexamples-5:dom-messageport-start-3>a href#dom-messageport-start>start()/a>/code> method, whether called explicitly or implicitly (by setting code idexamples-5:handler-messageport-onmessage-2>a href#handler-messageport-onmessage>onmessage/a>/code>), starts the flow of messages: messages posted on message ports are initially paused, so that they dont get dropped on the floor before the script has had a chance to set up its handlers./p> /div> h5 idports-as-the-basis-of-an-object-capability-model-on-the-web>span classsecno>9.5.1.2/span> Ports as the basis of an object-capability model on the Weba href#ports-as-the-basis-of-an-object-capability-model-on-the-web classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>Ports can be viewed as a way to expose limited capabilities (in the object-capability model sense) to other actors in the system. This can either be a weak capability system, where the ports are merely used as a convenient model within a particular origin, or as a strong capability model, where they are provided by one origin var>provider/var> as the only mechanism by which another origin var>consumer/var> can effect change in or obtain information from var>provider/var>./p> p>For example, consider a situation in which a social Web site embeds in one code idports-as-the-basis-of-an-object-capability-model-on-the-web:the-iframe-element>a href#the-iframe-element>iframe/a>/code> the users e-mail contacts provider (an address book site, from a second origin), and in a second code idports-as-the-basis-of-an-object-capability-model-on-the-web:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code> a game (from a third origin). The outer social site and the game in the second code idports-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 idports-as-the-basis-of-an-object-capability-model-on-the-web:the-iframe-element-4>a href#the-iframe-element>iframe/a>/code>; together they can only:/p> ul classbrief>li>a href#navigate idports-as-the-basis-of-an-object-capability-model-on-the-web:navigate>Navigate/a> the code idports-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 idports-as-the-basis-of-an-object-capability-model-on-the-web:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>, such as the same a idports-as-the-basis-of-an-object-capability-model-on-the-web:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> but with a different a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idports-as-the-basis-of-an-object-capability-model-on-the-web:concept-url-fragment data-x-internalconcept-url-fragment>fragment/a>, causing the code idports-as-the-basis-of-an-object-capability-model-on-the-web:window>a href#window>Window/a>/code> in the code idports-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 idports-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 idports-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 idports-as-the-basis-of-an-object-capability-model-on-the-web:window-2>a href#window>Window/a>/code> in the code idports-as-the-basis-of-an-object-capability-model-on-the-web:the-iframe-element-8>a href#the-iframe-element>iframe/a>/code> to receive a code idports-as-the-basis-of-an-object-capability-model-on-the-web:event-resize>a data-x-internalevent-resize hrefhttps://drafts.csswg.org/cssom-view/#eventdef-window-resize>resize/a>/code> event.li>Send a code idports-as-the-basis-of-an-object-capability-model-on-the-web:event-message>a href#event-message>message/a>/code> event to the code idports-as-the-basis-of-an-object-capability-model-on-the-web:window-3>a href#window>Window/a>/code> in the code idports-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 idports-as-the-basis-of-an-object-capability-model-on-the-web:dom-window-postmessage>a href#dom-window-postmessage>window.postMessage()/a>/code> API./ul> p>The contacts provider can use these methods, most particularly the third one, to provide an API that can be accessed by other origins to manipulate the users address book. For example, it could respond to a message code>add-contact Guillaume Tell <tell@pomme.example.net>/code> by adding the given person and e-mail address to the users address book./p> p>To avoid any site on the Web being able to manipulate the users contacts, the contacts provider might only allow certain trusted sites, such as the social site, to do this./p> p>Now suppose the game wanted to add a contact to the users address book, and that the social site was willing to allow it to do so on its behalf, essentially sharing the trust that the contacts provider had with the social site. There are several ways it could do this; most simply, it could just proxy messages between the game site and the contacts site. However, this solution has a number of difficulties: it requires the social site to either completely trust the game site not to abuse the privilege, or it requires that the social site verify each request to make sure its not a request that it doesnt want to allow (such as adding multiple contacts, reading the contacts, or deleting them); it also requires some additional complexity if theres ever the possibility of multiple games simultaneously trying to interact with the contacts provider./p> p>Using message channels and code idports-as-the-basis-of-an-object-capability-model-on-the-web:messageport>a href#messageport>MessagePort/a>/code> objects, however, all of these problems can go away. When the game tells the social site that it wants to add a contact, the social site can ask the contacts provider not for it to add a contact, but for the em>capability/em> to add a single contact. The contacts provider then creates a pair of code idports-as-the-basis-of-an-object-capability-model-on-the-web:messageport-2>a href#messageport>MessagePort/a>/code> objects, and sends one of them back to the social site, who forwards it on to the game. The game and the contacts provider then have a direct connection, and the contacts provider knows to only honor a single add contact request, nothing else. In other words, the game has been granted the capability to add a single contact./p> h5 idports-as-the-basis-of-abstracting-out-service-implementations>span classsecno>9.5.1.3/span> Ports as the basis of abstracting out service implementationsa href#ports-as-the-basis-of-abstracting-out-service-implementations classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>Continuing the example from the previous section, consider the contacts provider in particular. While an initial implementation might have simply used code idports-as-the-basis-of-abstracting-out-service-implementations:xmlhttprequest>a data-x-internalxmlhttprequest hrefhttps://xhr.spec.whatwg.org/#xmlhttprequest>XMLHttpRequest/a>/code> objects in the services code idports-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 idports-as-the-basis-of-abstracting-out-service-implementations:sharedworker>shared worker/a> with a single code idports-as-the-basis-of-abstracting-out-service-implementations:websocket>a href#websocket>WebSocket/a>/code> connection./p> p>If the initial design used code idports-as-the-basis-of-abstracting-out-service-implementations:messageport>a href#messageport>MessagePort/a>/code> objects to grant capabilities, or even just to allow multiple simultaneous independent sessions, the service implementation can switch from the code idports-as-the-basis-of-abstracting-out-service-implementations:xmlhttprequest-2>a data-x-internalxmlhttprequest hrefhttps://xhr.spec.whatwg.org/#xmlhttprequest>XMLHttpRequest/a>/code>s-in-each-code idports-as-the-basis-of-abstracting-out-service-implementations:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code> model to the shared-code idports-as-the-basis-of-abstracting-out-service-implementations:websocket-2>a href#websocket>WebSocket/a>/code> model without changing the API at all: the ports on the service provider side can all be forwarded to the shared worker without it affecting the users of the API in the slightest./p> h4 idmessage-channels>span classsecno>9.5.2/span> Message channelsa href#message-channels classself-link>/a>/h4> pre classidl>a href#dom-messagechannel idmessage-channels:dom-messagechannel>Constructor/a>, Exposed(Window,Worker)interface dfn idmessagechannel>MessageChannel/dfn> { readonly attribute a href#messageport idmessage-channels:messageport>MessagePort/a> a href#dom-messagechannel-port1 idmessage-channels:dom-messagechannel-port1>port1/a>; readonly attribute a href#messageport idmessage-channels:messageport-2>MessagePort/a> a href#dom-messagechannel-port2 idmessage-channels:dom-messagechannel-port2>port2/a>;};/pre> dl classdomintro>dt>var>channel/var> new code idmessage-channels:dom-messagechannel-2>a href#dom-messagechannel>MessageChannel/a>/code>()dd> p>Returns a new code idmessage-channels:messagechannel>a href#messagechannel>MessageChannel/a>/code> object with two new code idmessage-channels:messageport-3>a href#messageport>MessagePort/a>/code> objects./p> dt>var>channel/var> . code idmessage-channels:dom-messagechannel-port1-2>a href#dom-messagechannel-port1>port1/a>/code>dd> p>Returns the first code idmessage-channels:messageport-4>a href#messageport>MessagePort/a>/code> object./p> dt>var>channel/var> . code idmessage-channels:dom-messagechannel-port2-2>a href#dom-messagechannel-port2>port2/a>/code>dd> p>Returns the second code idmessage-channels:messageport-5>a href#messageport>MessagePort/a>/code> object./p> /dl> p>When the dfn iddom-messagechannel>code>MessageChannel()/code>/dfn> constructor is called, it must run the following algorithm:/p> ol>li>p>a href#create-a-new-messageport-object idmessage-channels:create-a-new-messageport-object>Create a new code>MessagePort/code> object/a> whose a href#concept-port-owner idmessage-channels:concept-port-owner>owner/a> is the a href#incumbent-settings-object idmessage-channels:incumbent-settings-object>incumbent settings object/a>, and let var>port1/var> be that object.li>p>a href#create-a-new-messageport-object idmessage-channels:create-a-new-messageport-object-2>Create a new code>MessagePort/code> object/a> whose a href#concept-port-owner idmessage-channels:concept-port-owner-2>owner/a> is the a href#incumbent-settings-object idmessage-channels:incumbent-settings-object-2>incumbent settings object/a>, and let var>port2/var> be that object.li>p>a href#entangle idmessage-channels:entangle>Entangle/a> the var>port1/var> and var>port2/var> objects.li>p>Instantiate a new code idmessage-channels:messagechannel-2>a href#messagechannel>MessageChannel/a>/code> object, and let var>channel/var> be that object.li>p>Let the code idmessage-channels:dom-messagechannel-port1-3>a href#dom-messagechannel-port1>port1/a>/code> attribute of the var>channel/var> object be var>port1/var>./p> li>p>Let the code idmessage-channels:dom-messagechannel-port2-3>a href#dom-messagechannel-port2>port2/a>/code> attribute of the var>channel/var> object be var>port2/var>./p> li>p>Return var>channel/var>./ol> p>The dfn iddom-messagechannel-port1>code>port1/code>/dfn> and dfn iddom-messagechannel-port2>code>port2/code>/dfn> attributes must return the values they were assigned when the code idmessage-channels:messagechannel-3>a href#messagechannel>MessageChannel/a>/code> object was created./p> h4 idmessage-ports>span classsecno>9.5.3/span> Message portsa href#message-ports classself-link>/a>/h4> p>Each channel has two message ports. Data sent through one port is received by the other port, and vice versa./p> pre classidl>Exposed(Window,Worker,AudioWorklet), a href#transferable idmessage-ports:transferable>Transferable/a>interface dfn idmessageport>MessagePort/dfn> : a idmessage-ports:eventtarget hrefhttps://dom.spec.whatwg.org/#interface-eventtarget data-x-internaleventtarget>EventTarget/a> { void a href#dom-messageport-postmessage idmessage-ports:dom-messageport-postmessage>postMessage/a>(any message, optional sequence<a hrefhttps://heycam.github.io/webidl/#idl-object idmessage-ports:idl-object data-x-internalidl-object>object/a>> transfer ); void a href#dom-messageport-start idmessage-ports:dom-messageport-start>start/a>(); void a href#dom-messageport-close idmessage-ports:dom-messageport-close>close/a>(); // event handlers attribute a href#eventhandler idmessage-ports:eventhandler>EventHandler/a> a href#handler-messageport-onmessage idmessage-ports:handler-messageport-onmessage>onmessage/a>; attribute a href#eventhandler idmessage-ports:eventhandler-2>EventHandler/a> a href#handler-messageport-onmessageerror idmessage-ports:handler-messageport-onmessageerror>onmessageerror/a>;};/pre> dl classdomintro>dt>var>port/var> . code idmessage-ports:dom-messageport-postmessage-2>a href#dom-messageport-postmessage>postMessage/a>/code>(var>message/var> , var>transfer/var> )dd> p>Posts a message through the channel. Objects listed in var>transfer/var> are transferred, not just cloned, meaning that they are no longer usable on the sending side./p> p>Throws a a idmessage-ports:datacloneerror hrefhttps://heycam.github.io/webidl/#datacloneerror data-x-internaldatacloneerror>code>DataCloneError/code>/a> code idmessage-ports:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> if var>transfer/var> array contains duplicate objects or the source or target ports, or if var>message/var> could not be cloned./p> dt>var>port/var> . code idmessage-ports:dom-messageport-start-2>a href#dom-messageport-start>start/a>/code>()dd> p>Begins dispatching messages received on the port./p> dt>var>port/var> . code idmessage-ports:dom-messageport-close-2>a href#dom-messageport-close>close/a>/code>()dd> p>Disconnects the port, so that it is no longer active./p> /dl> p>Each code idmessage-ports:messageport>a href#messageport>MessagePort/a>/code> object can be entangled with another (a symmetric relationship). Each code idmessage-ports:messageport-2>a href#messageport>MessagePort/a>/code> object also has a a href#task-source idmessage-ports:task-source>task source/a> called the dfn idport-message-queue>port message queue/dfn>, initially empty. A a href#port-message-queue idmessage-ports:port-message-queue>port message queue/a> can be enabled or disabled, and is initially disabled. Once enabled, a port can never be disabled again (though messages in the queue can get moved to another queue or removed altogether, which has much the same effect). A code idmessage-ports:messageport-3>a href#messageport>MessagePort/a>/code> also has a dfn idhas-been-shipped>has been shipped/dfn> flag, which must initially be false, and an dfn idconcept-port-owner>owner/dfn>, which is a a href#settings-object idmessage-ports:settings-object>settings object/a> set when the object is created, as described below./p> p>When a ports a href#port-message-queue idmessage-ports:port-message-queue-2>port message queue/a> is enabled, the a href#event-loop idmessage-ports:event-loop>event loop/a> must use it as one of its a href#task-source idmessage-ports:task-source-2>task sources/a>. When a ports a href#concept-port-owner idmessage-ports:concept-port-owner>owner/a> specifies a a href#responsible-event-loop idmessage-ports:responsible-event-loop>responsible event loop/a> that is a a href#browsing-context idmessage-ports:browsing-context>browsing context/a> a href#event-loop idmessage-ports:event-loop-2>event loop/a>, all a href#concept-task idmessage-ports:concept-task>tasks/a> a href#queue-a-task idmessage-ports:queue-a-task>queued/a> on its a href#port-message-queue idmessage-ports:port-message-queue-3>port message queue/a> must be associated with the a href#responsible-document idmessage-ports:responsible-document>responsible document/a> specified by the ports a href#concept-port-owner idmessage-ports:concept-port-owner-2>owner/a>./p> p classnote>If the ports a href#concept-port-owner idmessage-ports:concept-port-owner-3>owner/a> specifies a a href#responsible-document idmessage-ports:responsible-document-2>responsible document/a> that is a href#fully-active idmessage-ports:fully-active>fully active/a>, but the event listeners all have scripts whose a href#settings-object idmessage-ports:settings-object-2>settings objects/a> specify a href#responsible-document idmessage-ports:responsible-document-3>responsible documents/a> that are em>not/em> a href#fully-active idmessage-ports:fully-active-2>fully active/a>, then the messages will be lost./p> p>Each a href#event-loop idmessage-ports:event-loop-3>event loop/a> has a a href#task-source idmessage-ports:task-source-3>task source/a> called the dfn idunshipped-port-message-queue>unshipped port message queue/dfn>. This is a virtual a href#task-source idmessage-ports:task-source-4>task source/a>: it must act as if it contained the a href#concept-task idmessage-ports:concept-task-2>tasks/a> of each a href#port-message-queue idmessage-ports:port-message-queue-4>port message queue/a> of each code idmessage-ports:messageport-4>a href#messageport>MessagePort/a>/code> whose a href#has-been-shipped idmessage-ports:has-been-shipped>has been shipped/a> flag is false, whose a href#port-message-queue idmessage-ports:port-message-queue-5>port message queue/a> is enabled, and whose a href#concept-port-owner idmessage-ports:concept-port-owner-4>owner/a> specifies that a href#event-loop idmessage-ports:event-loop-4>event loop/a> as the a href#responsible-event-loop idmessage-ports:responsible-event-loop-2>responsible event loop/a>, in the order in which they were added to their respective a href#task-source idmessage-ports:task-source-5>task source/a>. When a a href#concept-task idmessage-ports:concept-task-3>task/a> would be removed from the a href#unshipped-port-message-queue idmessage-ports:unshipped-port-message-queue>unshipped port message queue/a>, it must instead be removed from its a href#port-message-queue idmessage-ports:port-message-queue-6>port message queue/a>./p> p>When a code idmessage-ports:messageport-5>a href#messageport>MessagePort/a>/code>s a href#has-been-shipped idmessage-ports:has-been-shipped-2>has been shipped/a> flag is false, its a href#port-message-queue idmessage-ports:port-message-queue-7>port message queue/a> must be ignored for the purposes of the a href#event-loop idmessage-ports:event-loop-5>event loop/a>. (The a href#unshipped-port-message-queue idmessage-ports:unshipped-port-message-queue-2>unshipped port message queue/a> is used instead.)/p> p classnote>The a href#has-been-shipped idmessage-ports:has-been-shipped-3>has been shipped/a> flag is set to true when a port, its twin, or the object it was cloned from, is or has been transferred. When a code idmessage-ports:messageport-6>a href#messageport>MessagePort/a>/code>s a href#has-been-shipped idmessage-ports:has-been-shipped-4>has been shipped/a> flag is true, its a href#port-message-queue idmessage-ports:port-message-queue-8>port message queue/a> acts as a first-class a href#task-source idmessage-ports:task-source-6>task source/a>, unaffected to any a href#unshipped-port-message-queue idmessage-ports:unshipped-port-message-queue-3>unshipped port message queue/a>./p> p>When the user agent is to dfn idcreate-a-new-messageport-object>create a new code>MessagePort/code> object/dfn> with a particular a href#environment-settings-object idmessage-ports:environment-settings-object>environment settings object/a> as its var>owner/var>, it must instantiate a new code idmessage-ports:messageport-7>a href#messageport>MessagePort/a>/code> object, and let its a href#concept-port-owner idmessage-ports:concept-port-owner-5>owner/a> be var>owner/var>./p> p>When the user agent is to dfn identangle>entangle/dfn> two code idmessage-ports:messageport-8>a href#messageport>MessagePort/a>/code> objects, it must run the following steps:/p> ol>li> p>If one of the ports is already entangled, then disentangle it and the port that it was entangled with./p> p classnote>If those two previously entangled ports were the two ports of a code idmessage-ports:messagechannel>a href#messagechannel>MessageChannel/a>/code> object, then that code idmessage-ports:messagechannel-2>a href#messagechannel>MessageChannel/a>/code> object no longer represents an actual channel: the two ports in that object are no longer entangled./p> li> p>Associate the two ports to be entangled, so that they form the two parts of a new channel. (There is no code idmessage-ports:messagechannel-3>a href#messagechannel>MessageChannel/a>/code> object that represents this channel.)/p> p>Two ports var>A/var> and var>B/var> that have gone through this step are now said to be entangled; one is entangled to the other, and vice versa./p> p classnote>While this specification describes this process as instantaneous, implementations are more likely to implement it via message passing. As with all algorithms, the key is merely that the end result be indistinguishable, in a black-box sense, from the specification./p> /ol> hr> p idtransferMessagePort>code idmessage-ports:messageport-9>a href#messageport>MessagePort/a>/code> objects are a href#transferable-objects idmessage-ports:transferable-objects>transferable objects/a>. Their a href#transfer-steps idmessage-ports:transfer-steps>transfer steps/a>, given var>value/var> and var>dataHolder/var>, are:/p> ol>li>p>Set var>value/var>s a href#has-been-shipped idmessage-ports:has-been-shipped-5>has been shipped/a> flag to true.li>p>Set var>dataHolder/var>.PortMessageQueue to var>value/var>s a href#port-message-queue idmessage-ports:port-message-queue-9>port message queue/a>.li> p>If var>value/var> is entangled with another port var>remotePort/var>, then:/p> ol>li>p>Set var>remotePort/var>s a href#has-been-shipped idmessage-ports:has-been-shipped-6>has been shipped/a> flag to true.li>p>Set var>dataHolder/var>.RemotePort to var>remotePort/var>./ol> li>p>Otherwise, set var>dataHolder/var>.RemotePort to null./ol> p>Their a href#transfer-receiving-steps idmessage-ports:transfer-receiving-steps>transfer-receiving steps/a>, given var>dataHolder/var> and var>value/var>, are:/p> ol>li>p>Set var>value/var>s a href#has-been-shipped idmessage-ports:has-been-shipped-7>has been shipped/a> flag to true.li>p>Set var>value/var>s a href#concept-port-owner idmessage-ports:concept-port-owner-6>owner/a> to var>value/var>s a href#relevant-settings-object idmessage-ports:relevant-settings-object>relevant settings object/a>.li>p>Move all the a href#concept-task idmessage-ports:concept-task-4>tasks/a> that are to fire code idmessage-ports:event-message>a href#event-message>message/a>/code> events in var>dataHolder/var>.PortMessageQueue to the a href#port-message-queue idmessage-ports:port-message-queue-10>port message queue/a> of var>value/var>, if any, leaving var>value/var>s a href#port-message-queue idmessage-ports:port-message-queue-11>port message queue/a> in its initial disabled state, and, if var>value/var>s a href#concept-port-owner idmessage-ports:concept-port-owner-7>owner/a> specifies a a href#responsible-event-loop idmessage-ports:responsible-event-loop-3>responsible event loop/a> that is a a href#browsing-context idmessage-ports:browsing-context-2>browsing context/a> a href#event-loop idmessage-ports:event-loop-6>event loop/a>, associating the moved a href#concept-task idmessage-ports:concept-task-5>tasks/a> with the a href#responsible-document idmessage-ports:responsible-document-4>responsible document/a> specified by var>value/var>s a href#concept-port-owner idmessage-ports:concept-port-owner-8>owner/a>.li>p>If var>dataHolder/var>.RemotePort is not null, then a href#entangle idmessage-ports:entangle>entangle/a> var>dataHolder/var>.RemotePort and var>value/var>. (This will disentangle var>dataHolder/var>.RemotePort from the original port that was transferred.)/ol> hr> p>The dfn iddom-messageport-postmessage>code>postMessage(var>message/var>, var>transfer/var>)/code>/dfn> method, when invoked on a code idmessage-ports:messageport-10>a href#messageport>MessagePort/a>/code> object, must run the following steps:/p> ol>li>p>Let var>targetPort/var> be the port with which this code idmessage-ports:messageport-11>a href#messageport>MessagePort/a>/code> is entangled, if any; otherwise let it be null.li>p>If any of the objects in var>transfer/var> are this code idmessage-ports:messageport-12>a href#messageport>MessagePort/a>/code>, then throw a a idmessage-ports:datacloneerror-2 hrefhttps://heycam.github.io/webidl/#datacloneerror data-x-internaldatacloneerror>code>DataCloneError/code>/a> code idmessage-ports:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Let var>doomed/var> be false.li>p>If var>targetPort/var> is not null and any of the objects in var>transfer/var> are var>targetPort/var>, then set var>doomed/var> to true, and optionally report to a developer console that the target port was posted to itself, causing the communication channel to be lost.li>p>Let var>serializeWithTransferResult/var> be a href#structuredserializewithtransfer idmessage-ports:structuredserializewithtransfer>StructuredSerializeWithTransfer/a>(var>message/var>, var>transfer/var>). Rethrow any exceptions.li>p>If there is no var>targetPort/var> (i.e. if this code idmessage-ports:messageport-13>a href#messageport>MessagePort/a>/code> is not entangled), or if var>doomed/var> is true, then abort these steps.li> p>Add a a href#concept-task idmessage-ports:concept-task-6>task/a> that runs the following steps to the a href#port-message-queue idmessage-ports:port-message-queue-12>port message queue/a> of var>targetPort/var>:/p> ol>li> p>Let var>finalTargetPort/var> be the code idmessage-ports:messageport-14>a href#messageport>MessagePort/a>/code> in whose a href#port-message-queue idmessage-ports:port-message-queue-13>port message queue/a> the task now finds itself./p> p classnote>This can be different from var>targetPort/var>, if var>targetPort/var> itself was transferred and thus all its tasks moved along with it./p> li>p>Let var>targetRealm/var> be var>finalTargetPort/var>s a href#concept-relevant-realm idmessage-ports:concept-relevant-realm>relevant Realm/a>.li> p>Let var>deserializeRecord/var> be a href#structureddeserializewithtransfer idmessage-ports:structureddeserializewithtransfer>StructuredDeserializeWithTransfer/a>(var>serializeWithTransferResult/var>, var>targetRealm/var>)./p> p>If this throws an exception, catch it, a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idmessage-ports:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idmessage-ports:event-messageerror>a href#event-messageerror>messageerror/a>/code> at var>finalTargetPort/var>, using code idmessage-ports:messageevent>a href#messageevent>MessageEvent/a>/code>, and then abort these steps. li>p>Let var>messageClone/var> be var>deserializeRecord/var>.Deserialized.li>p>Let var>newPorts/var> be a new a idmessage-ports:frozen-array hrefhttps://heycam.github.io/webidl/#dfn-frozen-array-type data-x-internalfrozen-array>frozen array/a> consisting of all code idmessage-ports:messageport-15>a href#messageport>MessagePort/a>/code> objects in var>deserializeRecord/var>.TransferredValues, if any, maintaining their relative order.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idmessage-ports:concept-event-fire-2 data-x-internalconcept-event-fire>Fire an event/a> named code idmessage-ports:event-message-2>a href#event-message>message/a>/code> at var>finalTargetPort/var>, using code idmessage-ports:messageevent-2>a href#messageevent>MessageEvent/a>/code>, with the code idmessage-ports:dom-messageevent-data>a href#dom-messageevent-data>data/a>/code> attribute initialized to var>messageClone/var> and the code idmessage-ports:dom-messageevent-ports>a href#dom-messageevent-ports>ports/a>/code> attribute initialized to var>newPorts/var>./ol> /ol> hr> p>The dfn iddom-messageport-start>code>start()/code>/dfn> method must enable its ports a href#port-message-queue idmessage-ports:port-message-queue-14>port message queue/a>, if it is not already enabled./p> hr> p>The dfn iddom-messageport-close>code>close()/code>/dfn> method, when called on a port var>local port/var> that is entangled with another port, must cause the user agent to disentangle the two ports. If the method is called on a port that is not entangled, then the method must do nothing./p> hr> p>The following are the a href#event-handlers idmessage-ports:event-handlers>event handlers/a> (and their corresponding a href#event-handler-event-type idmessage-ports:event-handler-event-type>event handler event types/a>) that must be supported, as a href#event-handler-idl-attributes idmessage-ports:event-handler-idl-attributes>event handler IDL attributes/a>, by all objects implementing the code idmessage-ports:messageport-16>a href#messageport>MessagePort/a>/code> interface:/p> table>thead>tr>th>a href#event-handlers idmessage-ports:event-handlers-2>Event handler/a> th>a href#event-handler-event-type idmessage-ports:event-handler-event-type-2>Event handler event type/a> tbody>tr>td>dfn idhandler-messageport-onmessage>code>onmessage/code>/dfn> td> code idmessage-ports:event-message-3>a href#event-message>message/a>/code> tr>td>dfn idhandler-messageport-onmessageerror>code>onmessageerror/code>/dfn> td> code idmessage-ports:event-messageerror-2>a href#event-messageerror>messageerror/a>/code> /table> p>The first time a code idmessage-ports:messageport-17>a href#messageport>MessagePort/a>/code> objects code idmessage-ports:handler-messageport-onmessage-2>a href#handler-messageport-onmessage>onmessage/a>/code> IDL attribute is set, the ports a href#port-message-queue idmessage-ports:port-message-queue-15>port message queue/a> must be enabled, as if the code idmessage-ports:dom-messageport-start-3>a href#dom-messageport-start>start()/a>/code> method had been called./p> h4 idbroadcasting-to-many-ports>span classsecno>9.5.4/span> Broadcasting to many portsa href#broadcasting-to-many-ports classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>Broadcasting to many ports is in principle relatively simple: keep an array of code idbroadcasting-to-many-ports:messageport>a href#messageport>MessagePort/a>/code> objects to send messages to, and iterate through the array to send a message. However, this has one rather unfortunate effect: it prevents the ports from being garbage collected, even if the other side has gone away. To avoid this problem, implement a simple protocol whereby the other side acknowledges it still exists. If it doesnt do so after a certain amount of time, assume its gone, close the code idbroadcasting-to-many-ports:messageport-2>a href#messageport>MessagePort/a>/code> object, and let it be garbage collected./p> h4 idports-and-garbage-collection>span classsecno>9.5.5/span> Ports and garbage collectiona href#ports-and-garbage-collection classself-link>/a>/h4> p>When a code idports-and-garbage-collection:messageport>a href#messageport>MessagePort/a>/code> object var>o/var> is entangled, user agents must either act as if var>o/var>s entangled code idports-and-garbage-collection:messageport-2>a href#messageport>MessagePort/a>/code> object has a strong reference to var>o/var>, or as if the a href#concept-settings-object-global idports-and-garbage-collection:concept-settings-object-global>global object/a> specified by var>o/var>s a href#concept-port-owner idports-and-garbage-collection:concept-port-owner>owner/a> has a strong reference to var>o/var>./p> div classnote> p>Thus, a message port can be received, given an event listener, and then forgotten, and so long as that event listener could receive a message, the channel will be maintained./p> p>Of course, if this was to occur on both sides of the channel, then both ports could be garbage collected, since they would not be reachable from live code, despite having a strong reference to each other./p> /div> p>Furthermore, a code idports-and-garbage-collection:messageport-3>a href#messageport>MessagePort/a>/code> object must not be garbage collected while there exists an event referenced by a a href#concept-task idports-and-garbage-collection:concept-task>task/a> in a a href#task-queue idports-and-garbage-collection:task-queue>task queue/a> that is to be dispatched on that code idports-and-garbage-collection:messageport-4>a href#messageport>MessagePort/a>/code> object, or while the code idports-and-garbage-collection:messageport-5>a href#messageport>MessagePort/a>/code> objects a href#port-message-queue idports-and-garbage-collection:port-message-queue>port message queue/a> is enabled and not empty./p> p classnote>Authors are strongly encouraged to explicitly close code idports-and-garbage-collection:messageport-6>a href#messageport>MessagePort/a>/code> objects to disentangle them, so that their resources can be recollected. Creating many code idports-and-garbage-collection:messageport-7>a href#messageport>MessagePort/a>/code> objects and discarding them without closing them can lead to high transient memory usage since garbage collection is not necessarily performed promptly, especially for code idports-and-garbage-collection:messageport-8>a href#messageport>MessagePort/a>/code>s where garbage collection can involve cross-process coordination./p> h3 idbroadcasting-to-other-browsing-contexts>span classsecno>9.6/span> dfn>Broadcasting to other browsing contexts/dfn>a href#broadcasting-to-other-browsing-contexts classself-link>/a>/h3>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> broadcastchannelspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>54+/span>/span>span classios_saf no>span>iOS Safari/span> span>None/span>/span>span classand_uc no>span>UC Browser for Android/span> span>None/span>/span>span classfirefox yes>span>Firefox/span> span>38+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung no>span>Samsung Internet/span> span>None/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari no>span>Safari/span> span>None/span>/span>span classedge no>span>Edge/span> span>None/span>/span>span classandroid yes>span>Android Browser/span> span>56+/span>/span>span classopera yes>span>Opera/span> span>41+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featbroadcastchannel>caniuse.com/a>/div> p>Pages on a single a href#concept-origin idbroadcasting-to-other-browsing-contexts:concept-origin>origin/a> opened by the same user in the same user agent but in different unrelated a href#browsing-context idbroadcasting-to-other-browsing-contexts:browsing-context>browsing contexts/a> sometimes need to send notifications to each other, for example hey, the user logged in over here, check your credentials again./p> p>For elaborate cases, e.g. to manage locking of shared state, to manage synchronization of resources between a server and multiple local clients, to share a code idbroadcasting-to-other-browsing-contexts:websocket>a href#websocket>WebSocket/a>/code> connection with a remote host, and so forth, a href#sharedworker idbroadcasting-to-other-browsing-contexts:sharedworker>shared workers/a> are the most appropriate solution./p> p>For simple cases, though, where a shared worker would be an unreasonable overhead, authors can use the simple channel-based broadcast mechanism described in this section./p> pre classidl>a href#dom-broadcastchannel idbroadcasting-to-other-browsing-contexts:dom-broadcastchannel>Constructor/a>(DOMString name), Exposed(Window,Worker)interface dfn idbroadcastchannel>BroadcastChannel/dfn> : a idbroadcasting-to-other-browsing-contexts:eventtarget hrefhttps://dom.spec.whatwg.org/#interface-eventtarget data-x-internaleventtarget>EventTarget/a> { readonly attribute DOMString a href#dom-broadcastchannel-name idbroadcasting-to-other-browsing-contexts:dom-broadcastchannel-name>name/a>; void a href#dom-broadcastchannel-postmessage idbroadcasting-to-other-browsing-contexts:dom-broadcastchannel-postmessage>postMessage/a>(any message); void a href#dom-broadcastchannel-close idbroadcasting-to-other-browsing-contexts:dom-broadcastchannel-close>close/a>(); attribute a href#eventhandler idbroadcasting-to-other-browsing-contexts:eventhandler>EventHandler/a> a href#handler-broadcastchannel-onmessage idbroadcasting-to-other-browsing-contexts:handler-broadcastchannel-onmessage>onmessage/a>; attribute a href#eventhandler idbroadcasting-to-other-browsing-contexts:eventhandler-2>EventHandler/a> a href#handler-broadcastchannel-onmessageerror idbroadcasting-to-other-browsing-contexts:handler-broadcastchannel-onmessageerror>onmessageerror/a>;};/pre> dl classdomintro>dt>var>broadcastChannel/var> new code idbroadcasting-to-other-browsing-contexts:dom-broadcastchannel-2>a href#dom-broadcastchannel>BroadcastChannel/a>/code>(var>name/var>)dd> p>Returns a new code idbroadcasting-to-other-browsing-contexts:broadcastchannel>a href#broadcastchannel>BroadcastChannel/a>/code> object via which messages for the given channel name can be sent and received./p> dt>var>broadcastChannel/var> . code idbroadcasting-to-other-browsing-contexts:dom-broadcastchannel-name-2>a href#dom-broadcastchannel-name>name/a>/code>dd> p>Returns the channel name (as passed to the constructor)./p> dt>var>broadcastChannel/var> . code idbroadcasting-to-other-browsing-contexts:dom-broadcastchannel-postmessage-2>a href#dom-broadcastchannel-postmessage>postMessage/a>/code>(var>message/var>)dd> p>Sends the given message to other code idbroadcasting-to-other-browsing-contexts:broadcastchannel-2>a href#broadcastchannel>BroadcastChannel/a>/code> objects set up for this channel. Messages can be structured objects, e.g. nested objects and arrays./p> dt>var>broadcastChannel/var> . code idbroadcasting-to-other-browsing-contexts:dom-broadcastchannel-close-2>a href#dom-broadcastchannel-close>close/a>/code>()dd> p>Closes the code idbroadcasting-to-other-browsing-contexts:broadcastchannel-3>a href#broadcastchannel>BroadcastChannel/a>/code> object, opening it up to garbage collection./p> /dl> p>A code idbroadcasting-to-other-browsing-contexts:broadcastchannel-4>a href#broadcastchannel>BroadcastChannel/a>/code> object has a dfn idchannel-name>channel name/dfn>, a dfn idbroadcastchannel-settings-object>code>BroadcastChannel/code> settings object/dfn>, and a dfn idconcept-broadcastchannel-closed>closed flag/dfn>./p> p>The dfn iddom-broadcastchannel>code>BroadcastChannel()/code>/dfn> constructor, when invoked, must create and return a code idbroadcasting-to-other-browsing-contexts:broadcastchannel-5>a href#broadcastchannel>BroadcastChannel/a>/code> object whose a href#channel-name idbroadcasting-to-other-browsing-contexts:channel-name>channel name/a> is the constructors first argument, whose a href#broadcastchannel-settings-object idbroadcasting-to-other-browsing-contexts:broadcastchannel-settings-object>code>BroadcastChannel/code> settings object/a> is the a href#incumbent-settings-object idbroadcasting-to-other-browsing-contexts:incumbent-settings-object>incumbent settings object/a>, and whose a href#concept-broadcastchannel-closed idbroadcasting-to-other-browsing-contexts:concept-broadcastchannel-closed>closed flag/a> is false./p> p>The dfn iddom-broadcastchannel-name>code>name/code>/dfn> attribute must return the a href#channel-name idbroadcasting-to-other-browsing-contexts:channel-name-2>channel name/a>./p> p>The dfn iddom-broadcastchannel-postmessage>code>postMessage(var>message/var>)/code>/dfn> method, when invoked on a code idbroadcasting-to-other-browsing-contexts:broadcastchannel-6>a href#broadcastchannel>BroadcastChannel/a>/code> object, must run the following steps:/p> ol>li>p>Let var>source/var> be this code idbroadcasting-to-other-browsing-contexts:broadcastchannel-7>a href#broadcastchannel>BroadcastChannel/a>/code>.li>p>Let var>sourceSettings/var> be var>source/var>s a href#broadcastchannel-settings-object idbroadcasting-to-other-browsing-contexts:broadcastchannel-settings-object-2>code>BroadcastChannel/code> settings object/a>.li>p>If var>source/var>s a href#concept-broadcastchannel-closed idbroadcasting-to-other-browsing-contexts:concept-broadcastchannel-closed-2>closed flag/a> is true, then throw an a idbroadcasting-to-other-browsing-contexts:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idbroadcasting-to-other-browsing-contexts:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Let var>sourceChannel/var> be var>source/var>s a href#channel-name idbroadcasting-to-other-browsing-contexts:channel-name-3>channel name/a>.li>p>Let var>targetRealm/var> be a user-agent defined Realm.li>p>Let var>serialized/var> be a href#structuredserialize idbroadcasting-to-other-browsing-contexts:structuredserialize>StructuredSerialize/a>(var>message/var>). Rethrow any exceptions.li> p>Let var>destinations/var> be a list of code idbroadcasting-to-other-browsing-contexts:broadcastchannel-8>a href#broadcastchannel>BroadcastChannel/a>/code> objects that match the following criteria:/p> ul>li> p>Their a href#broadcastchannel-settings-object idbroadcasting-to-other-browsing-contexts:broadcastchannel-settings-object-3>code>BroadcastChannel/code> settings object/a> specifies either:/p> ul>li>p>a a href#concept-settings-object-global idbroadcasting-to-other-browsing-contexts:concept-settings-object-global>global object/a> that is a code idbroadcasting-to-other-browsing-contexts:window>a href#window>Window/a>/code> object and a a href#responsible-document idbroadcasting-to-other-browsing-contexts:responsible-document>responsible document/a> that is a href#fully-active idbroadcasting-to-other-browsing-contexts:fully-active>fully active/a>, orli>p>a a href#concept-settings-object-global idbroadcasting-to-other-browsing-contexts:concept-settings-object-global-2>global object/a> that is a code idbroadcasting-to-other-browsing-contexts:workerglobalscope>a href#workerglobalscope>WorkerGlobalScope/a>/code> object whose a href#dom-workerglobalscope-closing idbroadcasting-to-other-browsing-contexts:dom-workerglobalscope-closing>closing/a> flag is false and whose a href#worker idbroadcasting-to-other-browsing-contexts:worker>worker/a> is not a a href#suspendable-worker idbroadcasting-to-other-browsing-contexts:suspendable-worker>suspendable worker/a>./ul> li>p>Their a href#broadcastchannel-settings-object idbroadcasting-to-other-browsing-contexts:broadcastchannel-settings-object-4>code>BroadcastChannel/code> settings object/a>s a href#concept-settings-object-origin idbroadcasting-to-other-browsing-contexts:concept-settings-object-origin>origin/a> is a href#same-origin idbroadcasting-to-other-browsing-contexts:same-origin>same origin/a> with var>sourceSettings/var>s a href#concept-settings-object-origin idbroadcasting-to-other-browsing-contexts:concept-settings-object-origin-2>origin/a>.li>p>Their a href#channel-name idbroadcasting-to-other-browsing-contexts:channel-name-4>channel name/a> is a a href#case-sensitive idbroadcasting-to-other-browsing-contexts:case-sensitive>case-sensitive/a> match for var>sourceChannel/var>.li>p>Their a href#concept-broadcastchannel-closed idbroadcasting-to-other-browsing-contexts:concept-broadcastchannel-closed-3>closed flag/a> is false./ul> li>p>Remove var>source/var> from var>destinations/var>.li>p>Sort var>destinations/var> such that all code idbroadcasting-to-other-browsing-contexts:broadcastchannel-9>a href#broadcastchannel>BroadcastChannel/a>/code> objects whose a href#broadcastchannel-settings-object idbroadcasting-to-other-browsing-contexts:broadcastchannel-settings-object-5>code>BroadcastChannel/code> settings objects/a> specify the same a href#responsible-event-loop idbroadcasting-to-other-browsing-contexts:responsible-event-loop>responsible event loop/a> are sorted in creation order, oldest first. (This does not define a complete ordering. Within this constraint, user agents may sort the list in any user-agent defined manner.)li> p>For each code idbroadcasting-to-other-browsing-contexts:broadcastchannel-10>a href#broadcastchannel>BroadcastChannel/a>/code> object var>destination/var> in var>destinations/var>, a href#queue-a-task idbroadcasting-to-other-browsing-contexts:queue-a-task>queue a task/a> that runs the following steps:/p> ol>li>p>Let var>targetRealm/var> be var>destination/var>s a href#concept-relevant-realm idbroadcasting-to-other-browsing-contexts:concept-relevant-realm>relevant Realm/a>.li> p>Let var>data/var> be a href#structureddeserialize idbroadcasting-to-other-browsing-contexts:structureddeserialize>StructuredDeserialize/a>(var>serialized/var>, var>targetRealm/var>)./p> p>If this throws an exception, catch it, a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idbroadcasting-to-other-browsing-contexts:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idbroadcasting-to-other-browsing-contexts:event-messageerror>a href#event-messageerror>messageerror/a>/code> at var>destination/var>, using code idbroadcasting-to-other-browsing-contexts:messageevent>a href#messageevent>MessageEvent/a>/code>, with the code idbroadcasting-to-other-browsing-contexts:dom-messageevent-origin>a href#dom-messageevent-origin>origin/a>/code> attribute initialized to the a href#ascii-serialisation-of-an-origin idbroadcasting-to-other-browsing-contexts:ascii-serialisation-of-an-origin>serialization/a> of var>sourceSettings/var>s a href#concept-settings-object-origin idbroadcasting-to-other-browsing-contexts:concept-settings-object-origin-3>origin/a>, and then abort these steps./p> li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idbroadcasting-to-other-browsing-contexts:concept-event-fire-2 data-x-internalconcept-event-fire>Fire an event/a> named code idbroadcasting-to-other-browsing-contexts:event-message>a href#event-message>message/a>/code> at var>destination/var>, using code idbroadcasting-to-other-browsing-contexts:messageevent-2>a href#messageevent>MessageEvent/a>/code>, with the code idbroadcasting-to-other-browsing-contexts:dom-messageevent-data>a href#dom-messageevent-data>data/a>/code> attribute initialized to var>data/var> and the code idbroadcasting-to-other-browsing-contexts:dom-messageevent-origin-2>a href#dom-messageevent-origin>origin/a>/code> attribute initialized to the a href#ascii-serialisation-of-an-origin idbroadcasting-to-other-browsing-contexts:ascii-serialisation-of-an-origin-2>serialization/a> of var>sourceSettings/var>s a href#concept-settings-object-origin idbroadcasting-to-other-browsing-contexts:concept-settings-object-origin-4>origin/a>./ol> p>The a href#concept-task idbroadcasting-to-other-browsing-contexts:concept-task>tasks/a> must use the a href#dom-manipulation-task-source idbroadcasting-to-other-browsing-contexts:dom-manipulation-task-source>DOM manipulation task source/a>, and, for those where the a href#event-loop idbroadcasting-to-other-browsing-contexts:event-loop>event loop/a> specified by the target code idbroadcasting-to-other-browsing-contexts:broadcastchannel-11>a href#broadcastchannel>BroadcastChannel/a>/code> objects a href#broadcastchannel-settings-object idbroadcasting-to-other-browsing-contexts:broadcastchannel-settings-object-6>code>BroadcastChannel/code> settings object/a> is a a href#browsing-context idbroadcasting-to-other-browsing-contexts:browsing-context-2>browsing context/a> a href#event-loop idbroadcasting-to-other-browsing-contexts:event-loop-2>event loop/a>, must be associated with the a href#responsible-document idbroadcasting-to-other-browsing-contexts:responsible-document-2>responsible document/a> specified by that target code idbroadcasting-to-other-browsing-contexts:broadcastchannel-12>a href#broadcastchannel>BroadcastChannel/a>/code> objects a href#broadcastchannel-settings-object idbroadcasting-to-other-browsing-contexts:broadcastchannel-settings-object-7>code>BroadcastChannel/code> settings object/a>./p> /ol> p>While a code idbroadcasting-to-other-browsing-contexts:broadcastchannel-13>a href#broadcastchannel>BroadcastChannel/a>/code> object whose a href#concept-broadcastchannel-closed idbroadcasting-to-other-browsing-contexts:concept-broadcastchannel-closed-4>closed flag/a> is false has an event listener registered for code idbroadcasting-to-other-browsing-contexts:event-message-2>a href#event-message>message/a>/code> events, there must be a strong reference from a href#concept-settings-object-global idbroadcasting-to-other-browsing-contexts:concept-settings-object-global-3>global object/a> specified by the code idbroadcasting-to-other-browsing-contexts:broadcastchannel-14>a href#broadcastchannel>BroadcastChannel/a>/code> objects a href#broadcastchannel-settings-object idbroadcasting-to-other-browsing-contexts:broadcastchannel-settings-object-8>code>BroadcastChannel/code> settings object/a> to the code idbroadcasting-to-other-browsing-contexts:broadcastchannel-15>a href#broadcastchannel>BroadcastChannel/a>/code> object itself./p> p>The dfn iddom-broadcastchannel-close>code>close()/code>/dfn> method must set the a href#concept-broadcastchannel-closed idbroadcasting-to-other-browsing-contexts:concept-broadcastchannel-closed-5>closed flag/a> of the code idbroadcasting-to-other-browsing-contexts:broadcastchannel-16>a href#broadcastchannel>BroadcastChannel/a>/code> object on which it was invoked to true./p> p classnote>Authors are strongly encouraged to explicitly close code idbroadcasting-to-other-browsing-contexts:broadcastchannel-17>a href#broadcastchannel>BroadcastChannel/a>/code> objects when they are no longer needed, so that they can be garbage collected. Creating many code idbroadcasting-to-other-browsing-contexts:broadcastchannel-18>a href#broadcastchannel>BroadcastChannel/a>/code> objects and discarding them while leaving them with an event listener and without closing them can lead to an apparent memory leak, since the objects will continue to live for as long as they have an event listener (or until their page or worker is closed)./p> hr> p>The following are the a href#event-handlers idbroadcasting-to-other-browsing-contexts:event-handlers>event handlers/a> (and their corresponding a href#event-handler-event-type idbroadcasting-to-other-browsing-contexts:event-handler-event-type>event handler event types/a>) that must be supported, as a href#event-handler-idl-attributes idbroadcasting-to-other-browsing-contexts:event-handler-idl-attributes>event handler IDL attributes/a>, by all objects implementing the code idbroadcasting-to-other-browsing-contexts:broadcastchannel-19>a href#broadcastchannel>BroadcastChannel/a>/code> interface:/p> table>thead>tr>th>a href#event-handlers idbroadcasting-to-other-browsing-contexts:event-handlers-2>Event handler/a> th>a href#event-handler-event-type idbroadcasting-to-other-browsing-contexts:event-handler-event-type-2>Event handler event type/a> tbody>tr>td>dfn idhandler-broadcastchannel-onmessage>code>onmessage/code>/dfn> td> code idbroadcasting-to-other-browsing-contexts:event-message-3>a href#event-message>message/a>/code> tr>td>dfn idhandler-broadcastchannel-onmessageerror>code>onmessageerror/code>/dfn> td> code idbroadcasting-to-other-browsing-contexts:event-messageerror-2>a href#event-messageerror>messageerror/a>/code> /table> div classexample> p>Suppose a page wants to know when the user logs out, even when the user does so from another tab at the same site:/p> pre>var authChannel new BroadcastChannel(auth);authChannel.onmessage function (event) { if (event.data logout) showLogout();}function logoutRequested() { // called when the user asks us to log them out doLogout(); showLogout(); authChannel.postMessage(logout);}function doLogout() { // actually log the user out (e.g. clearing cookies) // ...}function showLogout() { // update the UI to indicate were logged out // ...}/pre> /div> h2 idworkers data-dfn-typedfn data-ltweb worker data-export>span classsecno>10/span> Web workersa href#workers classself-link>/a>/h2> h3 idintroduction-14>span classsecno>10.1/span> Introductiona href#introduction-14 classself-link>/a>/h3> h4 idscope-2>span classsecno>10.1.1/span> Scopea href#scope-2 classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>This specification defines an API for running scripts in the background independently of any user interface scripts./p> p>This allows for long-running scripts that are not interrupted by scripts that respond to clicks or other user interactions, and allows long tasks to be executed without yielding to keep the page responsive./p> p>Workers (as these background scripts are called herein) are relatively heavy-weight, and are not intended to be used in large numbers. For example, it would be inappropriate to launch one worker for each pixel of a four megapixel image. The examples below show some appropriate uses of workers./p> p>Generally, workers are expected to be long-lived, have a high start-up performance cost, and a high per-instance memory cost./p> h4 idexamples-6>span classsecno>10.1.2/span> Examplesa href#examples-6 classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>There are a variety of uses that workers can be put to. The following subsections show various examples of this use./p> h5 ida-background-number-crunching-worker>span classsecno>10.1.2.1/span> A background number-crunching workera href#a-background-number-crunching-worker classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>The simplest use of workers is for performing a computationally expensive task without interrupting the user interface./p> p>In this example, the main document spawns a worker to (naïvely) compute prime numbers, and progressively displays the most recently found prime number./p> p>The main page is as follows:/p> pre><!DOCTYPE HTML><html> <head> <meta charsetutf-8> <title>Worker example: One-core computation</title> </head> <body> <p>The highest prime number discovered so far is: <output idresult></output></p> <script> var worker new Worker(worker.js); worker.onmessage function (event) { document.getElementById(result).textContent event.data; }; </script> </body></html>/pre> p>The code ida-background-number-crunching-worker:dom-worker>a href#dom-worker>Worker()/a>/code> constructor call creates a worker and returns a code ida-background-number-crunching-worker:worker>a href#worker>Worker/a>/code> object representing that worker, which is used to communicate with the worker. That objects code ida-background-number-crunching-worker:handler-worker-onmessage>a href#handler-worker-onmessage>onmessage/a>/code> event handler allows the code to receive messages from the worker./p> p>The worker itself is as follows:/p> pre>var n 1;search: while (true) { n + 1; for (var i 2; i < Math.sqrt(n); i + 1) if (n % i 0) continue search; // found a prime! postMessage(n);}/pre> p>The bulk of this code is simply an unoptimized search for a prime number. The code ida-background-number-crunching-worker:dom-dedicatedworkerglobalscope-postmessage>a href#dom-dedicatedworkerglobalscope-postmessage>postMessage()/a>/code> method is used to send a message back to the page when a prime is found./p> p>a href/demos/workers/primes/page.html>View this example online/a>./p> h5 idworker-used-for-background-i/o>span classsecno>10.1.2.2/span> Worker used for background I/Oa href#worker-used-for-background-i/o classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>In this example, the main document uses two workers, one for fetching stock updates at regular intervals, and one for performing search queries that the user requests./p> p>The main page is as follows:/p> pre><!DOCTYPE HTML><html> <head> <meta charsetutf-8> <title>Worker example: Stock ticker</title> <script> // TICKER var symbol GOOG; // default symbol to watch var ticker new Worker(ticker.js); // SEARCHER var searcher new Worker(searcher.js); function search(query) { searcher.postMessage(query); } // SYMBOL SELECTION UI function select(newSymbol) { symbol newSymbol; ticker.postMessage(symbol); } </script> <meta http-equivRefresh content120; URL../> </head> <body onloadsearch()> <p><output idsymbol></output> <output idvalue></output></p> <script> ticker.onmessage function (event) { var data event.data.split( ); document.getElementById(symbol).textContent data0; document.getElementById(value).textContent data1; }; ticker.postMessage(symbol); </script> <p><label>Search: <input typetext autofocus oninputsearch(this.value)></label></p> <ul idresults></ul> <script> searcher.onmessage function (event) { var data event.data.split( ); var results document.getElementById(results); while (results.hasChildNodes()) // clear previous results results.removeChild(results.firstChild); for (var i 0; i < data.length; i + 1) { // add a list item with a button for each result var li document.createElement(li); var button document.createElement(button); button.value datai; button.type button; button.onclick function () { select(this.value); }; button.textContent datai; li.appendChild(button); results.appendChild(li); } }; </script> <p>(The data in this example is not real. Try searching for Google or Apple.)</p> </body></html>/pre> p>The two workers use a common library for performing the actual network calls. This library is as follows:/p> pre>function get(url) { try { var xhr new XMLHttpRequest(); xhr.open(GET, url, false); xhr.send(); return xhr.responseText; } catch (e) { return ; // turn all errors into empty results }}/pre> p>The stock updater worker is as follows:/p> pre>importScripts(io.js);var timer;var symbol;function update() { postMessage(symbol + + get(stock.cgi? + symbol)); timer setTimeout(update, 10000);}onmessage function (event) { if (timer) clearTimeout(timer); symbol event.data; update();};/pre> p>The search query worker is as follows:/p> pre>importScripts(io.js);onmessage function (event) { postMessage(get(search.cgi? + event.data));};/pre> p>a href/demos/workers/stocks/page.html>View this example online/a>./p> h5 idmodule-worker-example>span classsecno>10.1.2.3/span> Using a JavaScript module as a workera href#module-worker-example classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>All of our examples so far show workers that run a href#classic-script idmodule-worker-example:classic-script>classic scripts/a>. Workers can instead be instantiated using a href#module-script idmodule-worker-example:module-script>module scripts/a>, which have the usual benefits: the ability to use the JavaScript code>import/code> statement to import other modules; strict mode by default; and top-level declarations not polluting the workers global scope./p> p>Note that such module-based workers follow different restrictions regarding cross-origin content, compared to classic workers. Unlike classic workers, module workers can be instantiated using a cross-origin script, as long as that script is exposed using the a idmodule-worker-example:cors-protocol hrefhttps://fetch.spec.whatwg.org/#http-cors-protocol data-x-internalcors-protocol>CORS protocol/a>. Additionally, the code idmodule-worker-example:dom-workerglobalscope-importscripts>a href#dom-workerglobalscope-importscripts>importScripts()/a>/code> method will automatically fail inside module workers; the JavaScript code>import/code> statement is generally a better choice./p> p>In this example, the main document uses a worker to do off-main-thread image manipulation. It imports the filters used from another module./p> p>The main page is as follows:/p> pre><!DOCTYPE html><meta charsetutf-8><title>Worker example: image decoding</title><p> <label> Type an image URL to decode <input typeurl idimage-url listimage-list> <datalist idimage-list> <option valuehttps://html.spec.whatwg.org/images/drawImage.png> <option valuehttps://html.spec.whatwg.org/images/robots.jpeg> <option valuehttps://html.spec.whatwg.org/images/arcTo2.png> </datalist> </label></p><p> <label> Choose a filter to apply <select idfilter> <option valuenone>none</option> <option valuegrayscale>grayscale</option> <option valuebrighten>brighten by 20%</option> </select> </label></p><canvas idoutput></canvas><script typemodule> const worker new Worker(worker.js, { type: module }); worker.onmessage receiveFromWorker; const url document.querySelector(#image-url); const filter document.querySelector(#filter); const output document.querySelector(#output); url.oninput updateImage; filter.oninput sendToWorker; let imageData, context; function updateImage() { const img new Image(); img.src url.value; img.onload () > { output.innerHTML ; const canvas document.createElement(canvas); canvas.width img.width; canvas.height img.height; context canvas.getContext(2d); context.drawImage(img, 0, 0); imageData context.getImageData(0, 0, canvas.width, canvas.height); sendToWorker(); output.appendChild(canvas); }; } function sendToWorker() { worker.postMessage({ imageData, filter: filter.value }); } function receiveFromWorker(e) { context.putImageData(e.data, 0, 0); }</script>/pre> p>The worker file is then:/p> pre>import * as filters from ./filters.js;self.onmessage e > { const { imageData, filter } e.data; filtersfilter(imageData); self.postMessage(imageData, imageData.data.buffer);};/pre> p>Which imports the file code>filters.js/code>:/p> pre>export function none() {}export function grayscale({ data: d }) { for (let i 0; i < d.length; i + 4) { const r, g, b di, di + 1, di + 2; // CIE luminance for the RGB // The human eye is bad at seeing red and blue, so we de-emphasize them. di di + 1 di + 2 0.2126 * r + 0.7152 * g + 0.0722 * b; }};export function brighten({ data: d }) { for (let i 0; i < d.length; ++i) { di * 1.2; }};/pre> p>a href/demos/workers/modules/page.html>View this example online/a>./p> h5 idshared-workers-introduction>span classsecno>10.1.2.4/span> Shared workers introductiona href#shared-workers-introduction classself-link>/a>/h5>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> sharedworkersspan classand_chr no>span>Chrome for Android/span> span>None/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf no>span>iOS Safari/span> span>None/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>29+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung no>span>Samsung Internet/span> span>None/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari no>span>Safari/span> span>None/span>/span>span classedge no>span>Edge/span> span>None/span>/span>span classandroid no>span>Android Browser/span> span>None/span>/span>span classopera yes>span>Opera/span> span>10.6+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featsharedworkers>caniuse.com/a>/div> p>i>This section is non-normative./i>/p> p>This section introduces shared workers using a Hello World example. Shared workers use slightly different APIs, since each worker can have multiple connections./p> p>This first example shows how you connect to a worker and how a worker can send a message back to the page when it connects to it. Received messages are displayed in a log./p> p>Here is the HTML page:/p> pre><!DOCTYPE HTML><meta charsetutf-8><title>Shared workers: demo 1</title><pre idlog>Log:</pre><script> var worker new SharedWorker(test.js); var log document.getElementById(log); worker.port.onmessage function(e) { // note: not worker.onmessage! log.textContent + \n + e.data; }</script>/pre> p>Here is the JavaScript worker:/p> pre>onconnect function(e) { var port e.ports0; port.postMessage(Hello World!);}/pre> p>a href/demos/workers/shared/001/test.html>View this example online/a>./p> hr> p>This second example extends the first one by changing two things: first, messages are received using code>addEventListener()/code> instead of an a href#event-handler-idl-attributes idshared-workers-introduction:event-handler-idl-attributes>event handler IDL attribute/a>, and second, a message is sent em>to/em> the worker, causing the worker to send another message in return. Received messages are again displayed in a log./p> p>Here is the HTML page:/p> pre><!DOCTYPE HTML><meta charsetutf-8><title>Shared workers: demo 2</title><pre idlog>Log:</pre><script> var worker new SharedWorker(test.js); var log document.getElementById(log); worker.port.addEventListener(message, function(e) { log.textContent + \n + e.data; }, false); worker.port.start(); // note: need this when using addEventListener worker.port.postMessage(ping);</script>/pre> p>Here is the JavaScript worker:/p> pre>onconnect function(e) { var port e.ports0; port.postMessage(Hello World!); port.onmessage function(e) { port.postMessage(pong); // not e.ports0.postMessage! // e.target.postMessage(pong); would work also }}/pre> p>a href/demos/workers/shared/002/test.html>View this example online/a>./p> hr> p>Finally, the example is extended to show how two pages can connect to the same worker; in this case, the second page is merely in an code idshared-workers-introduction:the-iframe-element>a href#the-iframe-element>iframe/a>/code> on the first page, but the same principle would apply to an entirely separate page in a separate a href#top-level-browsing-context idshared-workers-introduction:top-level-browsing-context>top-level browsing context/a>./p> p>Here is the outer HTML page:/p> pre><!DOCTYPE HTML><meta charsetutf-8><title>Shared workers: demo 3</title><pre idlog>Log:</pre><script> var worker new SharedWorker(test.js); var log document.getElementById(log); worker.port.addEventListener(message, function(e) { log.textContent + \n + e.data; }, false); worker.port.start(); worker.port.postMessage(ping);</script><iframe srcinner.html></iframe>/pre> p>Here is the inner HTML page:/p> pre><!DOCTYPE HTML><meta charsetutf-8><title>Shared workers: demo 3 inner frame</title><pre idlog>Inner log:</pre><script> var worker new SharedWorker(test.js); var log document.getElementById(log); worker.port.onmessage function(e) { log.textContent + \n + e.data; }</script>/pre> p>Here is the JavaScript worker:/p> pre>var count 0;onconnect function(e) { count + 1; var port e.ports0; port.postMessage(Hello World! You are connection # + count); port.onmessage function(e) { port.postMessage(pong); }}/pre> p>a href/demos/workers/shared/003/test.html>View this example online/a>./p> h5 idshared-state-using-a-shared-worker>span classsecno>10.1.2.5/span> Shared state using a shared workera href#shared-state-using-a-shared-worker classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>In this example, multiple windows (viewers) can be opened that are all viewing the same map. All the windows share the same map information, with a single worker coordinating all the viewers. Each viewer can move around independently, but if they set any data on the map, all the viewers are updated./p> p>The main page isnt interesting, it merely provides a way to open the viewers:/p> pre><!DOCTYPE HTML><html> <head> <meta charsetutf-8> <title>Workers example: Multiviewer</title> <script> function openViewer() { window.open(viewer.html); } </script> </head> <body> <p><button typebutton onclickopenViewer()>Open a new viewer</button></p> <p>Each viewer opens in a new window. You can have as many viewers as you like, they all view the same data.</p> </body></html>/pre> p>The viewer is more involved:/p> pre><!DOCTYPE HTML><html> <head> <meta charsetutf-8> <title>Workers example: Multiviewer viewer</title> <script> var worker new SharedWorker(worker.js, core); // CONFIGURATION function configure(event) { if (event.data.substr(0, 4) ! cfg ) return; var name event.data.substr(4).split( , 1)0; // update display to mention our name is name document.getElementsByTagName(h1)0.textContent + + name; // no longer need this listener worker.port.removeEventListener(message, configure, false); } worker.port.addEventListener(message, configure, false); // MAP function paintMap(event) { if (event.data.substr(0, 4) ! map ) return; var data event.data.substr(4).split(,); // display tiles data0 .. data8 var canvas document.getElementById(map); var context canvas.getContext(2d); for (var y 0; y < 3; y + 1) { for (var x 0; x < 3; x + 1) { var tile datay * 3 + x; if (tile 0) context.fillStyle green; else context.fillStyle maroon; context.fillRect(x * 50, y * 50, 50, 50); } } } worker.port.addEventListener(message, paintMap, false); // PUBLIC CHAT function updatePublicChat(event) { if (event.data.substr(0, 4) ! txt ) return; var name event.data.substr(4).split( , 1)0; var message event.data.substr(4 + name.length + 1); // display <name> message in public chat var public document.getElementById(public); var p document.createElement(p); var n document.createElement(button); n.textContent < + name + > ; n.onclick function () { worker.port.postMessage(msg + name); }; p.appendChild(n); var m document.createElement(span); m.textContent message; p.appendChild(m); public.appendChild(p); } worker.port.addEventListener(message, updatePublicChat, false); // PRIVATE CHAT function startPrivateChat(event) { if (event.data.substr(0, 4) ! msg ) return; var name event.data.substr(4).split( , 1)0; var port event.ports0; // display a private chat UI var ul document.getElementById(private); var li document.createElement(li); var h3 document.createElement(h3); h3.textContent Private chat with + name; li.appendChild(h3); var div document.createElement(div); var addMessage function(name, message) { var p document.createElement(p); var n document.createElement(strong); n.textContent < + name + > ; p.appendChild(n); var t document.createElement(span); t.textContent message; p.appendChild(t); div.appendChild(p); }; port.onmessage function (event) { addMessage(name, event.data); }; li.appendChild(div); var form document.createElement(form); var p document.createElement(p); var input document.createElement(input); input.size 50; p.appendChild(input); p.appendChild(document.createTextNode( )); var button document.createElement(button); button.textContent Post; p.appendChild(button); form.onsubmit function () { port.postMessage(input.value); addMessage(me, input.value); input.value ; return false; }; form.appendChild(p); li.appendChild(form); ul.appendChild(li); } worker.port.addEventListener(message, startPrivateChat, false); worker.port.start(); </script> </head> <body> <h1>Viewer</h1> <h2>Map</h2> <p><canvas idmap height150 width150></canvas></p> <p> <button typebutton onclickworker.port.postMessage(mov left)>Left</button> <button typebutton onclickworker.port.postMessage(mov up)>Up</button> <button typebutton onclickworker.port.postMessage(mov down)>Down</button> <button typebutton onclickworker.port.postMessage(mov right)>Right</button> <button typebutton onclickworker.port.postMessage(set 0)>Set 0</button> <button typebutton onclickworker.port.postMessage(set 1)>Set 1</button> </p> <h2>Public Chat</h2> <div idpublic></div> <form onsubmitworker.port.postMessage(txt + message.value); message.value ; return false;> <p> <input typetext namemessage size50> <button>Post</button> </p> </form> <h2>Private Chat</h2> <ul idprivate></ul> </body></html>/pre> p>There are several key things worth noting about the way the viewer is written./p> p>strong>Multiple listeners/strong>. Instead of a single message processing function, the code here attaches multiple event listeners, each one performing a quick check to see if it is relevant for the message. In this example it doesnt make much difference, but if multiple authors wanted to collaborate using a single port to communicate with a worker, it would allow for independent code instead of changes having to all be made to a single event handling function./p> p>Registering event listeners in this way also allows you to unregister specific listeners when you are done with them, as is done with the code>configure()/code> method in this example./p> p>Finally, the worker:/p> pre>var nextName 0;function getNextName() { // this could use more friendly names // but for now just return a number return nextName++;}var map 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1,;function wrapX(x) { if (x < 0) return wrapX(x + map0.length); if (x > map0.length) return wrapX(x - map0.length); return x;}function wrapY(y) { if (y < 0) return wrapY(y + map.length); if (y > map0.length) return wrapY(y - map.length); return y;}function wrap(val, min, max) { if (val < min) return val + (max-min)+1; if (val > max) return val - (max-min)-1; return val;}function sendMapData(viewer) { var data ; for (var y viewer.y-1; y < viewer.y+1; y + 1) { for (var x viewer.x-1; x < viewer.x+1; x + 1) { if (data ! ) data + ,; data + mapwrap(y, 0, map0.length-1)wrap(x, 0, map.length-1); } } viewer.port.postMessage(map + data);}var viewers {};onconnect function (event) { var name getNextName(); event.ports0._data { port: event.ports0, name: name, x: 0, y: 0, }; viewersname event.ports0._data; event.ports0.postMessage(cfg + name); event.ports0.onmessage getMessage; sendMapData(event.ports0._data);};function getMessage(event) { switch (event.data.substr(0, 4)) { case mov : var direction event.data.substr(4); var dx 0; var dy 0; switch (direction) { case up: dy -1; break; case down: dy 1; break; case left: dx -1; break; case right: dx 1; break; } event.target._data.x wrapX(event.target._data.x + dx); event.target._data.y wrapY(event.target._data.y + dy); sendMapData(event.target._data); break; case set : var value event.data.substr(4); mapevent.target._data.yevent.target._data.x value; for (var viewer in viewers) sendMapData(viewersviewer); break; case txt : var name event.target._data.name; var message event.data.substr(4); for (var viewer in viewers) viewersviewer.port.postMessage(txt + name + + message); break; case msg : var party1 event.target._data; var party2 viewersevent.data.substr(4).split( , 1)0; if (party2) { var channel new MessageChannel(); party1.port.postMessage(msg + party2.name, channel.port1); party2.port.postMessage(msg + party1.name, channel.port2); } break; }}/pre> p>strong>Connecting to multiple pages/strong>. The script uses the code idshared-state-using-a-shared-worker:handler-sharedworkerglobalscope-onconnect>a href#handler-sharedworkerglobalscope-onconnect>onconnect/a>/code> event listener to listen for multiple connections./p> p>strong>Direct channels/strong>. When the worker receives a msg message from one viewer naming another viewer, it sets up a direct connection between the two, so that the two viewers can communicate directly without the worker having to proxy all the messages./p> p>a href/demos/workers/multiviewer/page.html>View this example online/a>./p> h5 iddelegation>span classsecno>10.1.2.6/span> Delegationa href#delegation classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>With multicore CPUs becoming prevalent, one way to obtain better performance is to split computationally expensive tasks amongst multiple workers. In this example, a computationally expensive task that is to be performed for every number from 1 to 10,000,000 is farmed out to ten subworkers./p> p>The main page is as follows, it just reports the result:/p> pre><!DOCTYPE HTML><html> <head> <meta charsetutf-8> <title>Worker example: Multicore computation</title> </head> <body> <p>Result: <output idresult></output></p> <script> var worker new Worker(worker.js); worker.onmessage function (event) { document.getElementById(result).textContent event.data; }; </script> </body></html>/pre> p>The worker itself is as follows:/p> pre>// settingsvar num_workers 10;var items_per_worker 1000000;// start the workersvar result 0;var pending_workers num_workers;for (var i 0; i < num_workers; i + 1) { var worker new Worker(core.js); worker.postMessage(i * items_per_worker); worker.postMessage((i+1) * items_per_worker); worker.onmessage storeResult;}// handle the resultsfunction storeResult(event) { result + 1*event.data; pending_workers - 1; if (pending_workers < 0) postMessage(result); // finished!}/pre> p>It consists of a loop to start the subworkers, and then a handler that waits for all the subworkers to respond./p> p>The subworkers are implemented as follows:/p> pre>var start;onmessage getStart;function getStart(event) { start 1*event.data; onmessage getEnd;}var end;function getEnd(event) { end 1*event.data; onmessage null; work();}function work() { var result 0; for (var i start; i < end; i + 1) { // perform some complex calculation here result + 1; } postMessage(result); close();}/pre> p>They receive two numbers in two events, perform the computation for the range of numbers thus specified, and then report the result back to the parent./p> p>a href/demos/workers/multicore/page.html>View this example online/a>./p> h5 idproviding-libraries>span classsecno>10.1.2.7/span> Providing librariesa href#providing-libraries classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>Suppose that a cryptography library is made available that provides three tasks:/p> dl>dt>Generate a public/private key pairdd>Takes a port, on which it will send two messages, first the public key and then the private key.dt>Given a plaintext and a public key, return the corresponding cyphertextdd>Takes a port, to which any number of messages can be sent, the first giving the public key, and the remainder giving the plaintext, each of which is encrypted and then sent on that same channel as the cyphertext. The user can close the port when it is done encrypting content.dt>Given a cyphertext and a private key, return the corresponding plaintextdd>Takes a port, to which any number of messages can be sent, the first giving the private key, and the remainder giving the cyphertext, each of which is decrypted and then sent on that same channel as the plaintext. The user can close the port when it is done decrypting content./dl> p>The library itself is as follows:/p> pre>function handleMessage(e) { if (e.data genkeys) genkeys(e.ports0); else if (e.data encrypt) encrypt(e.ports0); else if (e.data decrypt) decrypt(e.ports0);}function genkeys(p) { var keys _generateKeyPair(); p.postMessage(keys0); p.postMessage(keys1);}function encrypt(p) { var key, state 0; p.onmessage function (e) { if (state 0) { key e.data; state 1; } else { p.postMessage(_encrypt(key, e.data)); } };}function decrypt(p) { var key, state 0; p.onmessage function (e) { if (state 0) { key e.data; state 1; } else { p.postMessage(_decrypt(key, e.data)); } };}// support being used as a shared worker as well as a dedicated workerif (onmessage in this) // dedicated worker onmessage handleMessage;else // shared worker onconnect function (e) { e.port.onmessage handleMessage; }// the crypto functions:function _generateKeyPair() { return Math.random(), Math.random();}function _encrypt(k, s) { return encrypted- + k + + s;}function _decrypt(k, s) { return s.substr(s.indexOf( )+1);}/pre> p>Note that the crypto functions here are just stubs and dont do real cryptography./p> p>This library could be used as follows:/p> pre><!DOCTYPE HTML><html> <head> <meta charsetutf-8> <title>Worker example: Crypto library</title> <script> const cryptoLib new Worker(libcrypto-v1.js); // or could use libcrypto-v2.js function startConversation(source, message) { const messageChannel new MessageChannel(); source.postMessage(message, messageChannel.port2); return messageChannel.port1; } function getKeys() { let state 0; startConversation(cryptoLib, genkeys).onmessage function (e) { if (state 0) document.getElementById(public).value e.data; else if (state 1) document.getElementById(private).value e.data; state + 1; }; } function enc() { const port startConversation(cryptoLib, encrypt); port.postMessage(document.getElementById(public).value); port.postMessage(document.getElementById(input).value); port.onmessage function (e) { document.getElementById(input).value e.data; port.close(); }; } function dec() { const port startConversation(cryptoLib, decrypt); port.postMessage(document.getElementById(private).value); port.postMessage(document.getElementById(input).value); port.onmessage function (e) { document.getElementById(input).value e.data; port.close(); }; } </script> <style> textarea { display: block; } </style> </head> <body onloadgetKeys()> <fieldset> <legend>Keys</legend> <p><label>Public Key: <textarea idpublic></textarea></label></p> <p><label>Private Key: <textarea idprivate></textarea></label></p> </fieldset> <p><label>Input: <textarea idinput></textarea></label></p> <p><button onclickenc()>Encrypt</button> <button onclickdec()>Decrypt</button></p> </body></html>/pre> p>A later version of the API, though, might want to offload all the crypto work onto subworkers. This could be done as follows:/p> pre>function handleMessage(e) { if (e.data genkeys) genkeys(e.ports0); else if (e.data encrypt) encrypt(e.ports0); else if (e.data decrypt) decrypt(e.ports0);}function genkeys(p) { var generator new Worker(libcrypto-v2-generator.js); generator.postMessage(, p);}function encrypt(p) { p.onmessage function (e) { var key e.data; var encryptor new Worker(libcrypto-v2-encryptor.js); encryptor.postMessage(key, p); };}function encrypt(p) { p.onmessage function (e) { var key e.data; var decryptor new Worker(libcrypto-v2-decryptor.js); decryptor.postMessage(key, p); };}// support being used as a shared worker as well as a dedicated workerif (onmessage in this) // dedicated worker onmessage handleMessage;else // shared worker onconnect function (e) { e.ports0.onmessage handleMessage };/pre> p>The little subworkers would then be as follows./p> p>For generating key pairs:/p> pre>onmessage function (e) { var k _generateKeyPair(); e.ports0.postMessage(k0); e.ports0.postMessage(k1); close();}function _generateKeyPair() { return Math.random(), Math.random();}/pre> p>For encrypting:/p> pre>onmessage function (e) { var key e.data; e.ports0.onmessage function (e) { var s e.data; postMessage(_encrypt(key, s)); }}function _encrypt(k, s) { return encrypted- + k + + s;}/pre> p>For decrypting:/p> pre>onmessage function (e) { var key e.data; e.ports0.onmessage function (e) { var s e.data; postMessage(_decrypt(key, s)); }}function _decrypt(k, s) { return s.substr(s.indexOf( )+1);}/pre> p>Notice how the users of the API dont have to even know that this is happening — the API hasnt changed; the library can delegate to subworkers without changing its API, even though it is accepting data using message channels./p> p>a href/demos/workers/crypto/page.html>View this example online/a>./p> h4 idtutorials>span classsecno>10.1.3/span> Tutorialsa href#tutorials classself-link>/a>/h4> h5 idcreating-a-dedicated-worker>span classsecno>10.1.3.1/span> Creating a dedicated workera href#creating-a-dedicated-worker classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>Creating a worker requires a URL to a JavaScript file. The code idcreating-a-dedicated-worker:dom-worker>a href#dom-worker>Worker()/a>/code> constructor is invoked with the URL to that file as its only argument; a worker is then created and returned:/p> pre>var worker new Worker(helper.js);/pre> p>If you want your worker script to be interpreted as a a href#module-script idcreating-a-dedicated-worker:module-script>module script/a> instead of the default a href#classic-script idcreating-a-dedicated-worker:classic-script>classic script/a>, you need to use a slightly different signature:/p> pre>var worker new Worker(helper.js, { type: module });/pre> h5 idcommunicating-with-a-dedicated-worker>span classsecno>10.1.3.2/span> Communicating with a dedicated workera href#communicating-with-a-dedicated-worker classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>Dedicated workers use code idcommunicating-with-a-dedicated-worker:messageport>a href#messageport>MessagePort/a>/code> objects behind the scenes, and thus support all the same features, such as sending structured data, transferring binary data, and transferring other ports./p> p>To receive messages from a dedicated worker, use the code idcommunicating-with-a-dedicated-worker:handler-worker-onmessage>a href#handler-worker-onmessage>onmessage/a>/code> a href#event-handler-idl-attributes idcommunicating-with-a-dedicated-worker:event-handler-idl-attributes>event handler IDL attribute/a> on the code idcommunicating-with-a-dedicated-worker:worker>a href#worker>Worker/a>/code> object:/p> pre>worker.onmessage function (event) { ... };/pre> p>You can also use the code idcommunicating-with-a-dedicated-worker:dom-eventtarget-addeventlistener>a data-x-internaldom-eventtarget-addeventlistener hrefhttps://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener>addEventListener()/a>/code> method./p> p classnote>The implicit code idcommunicating-with-a-dedicated-worker:messageport-2>a href#messageport>MessagePort/a>/code> used by dedicated workers has its a href#port-message-queue idcommunicating-with-a-dedicated-worker:port-message-queue>port message queue/a> implicitly enabled when it is created, so there is no equivalent to the code idcommunicating-with-a-dedicated-worker:messageport-3>a href#messageport>MessagePort/a>/code> interfaces code idcommunicating-with-a-dedicated-worker:dom-messageport-start>a href#dom-messageport-start>start()/a>/code> method on the code idcommunicating-with-a-dedicated-worker:worker-2>a href#worker>Worker/a>/code> interface./p> p>To em>send/em> data to a worker, use the code idcommunicating-with-a-dedicated-worker:dom-worker-postmessage>a href#dom-worker-postmessage>postMessage()/a>/code> method. Structured data can be sent over this communication channel. To send code idcommunicating-with-a-dedicated-worker:idl-arraybuffer>a data-x-internalidl-arraybuffer hrefhttps://heycam.github.io/webidl/#idl-ArrayBuffer>ArrayBuffer/a>/code> objects efficiently (by transferring them rather than cloning them), list them in an array in the second argument./p> pre>worker.postMessage({ operation: find-edges, input: buffer, // an ArrayBuffer object threshold: 0.6,}, buffer);/pre> p>To receive a message inside the worker, the code idcommunicating-with-a-dedicated-worker:handler-dedicatedworkerglobalscope-onmessage>a href#handler-dedicatedworkerglobalscope-onmessage>onmessage/a>/code> a href#event-handler-idl-attributes idcommunicating-with-a-dedicated-worker:event-handler-idl-attributes-2>event handler IDL attribute/a> is used./p> pre>onmessage function (event) { ... };/pre> p>You can again also use the code idcommunicating-with-a-dedicated-worker:dom-eventtarget-addeventlistener-2>a data-x-internaldom-eventtarget-addeventlistener hrefhttps://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener>addEventListener()/a>/code> method./p> p>In either case, the data is provided in the event objects code idcommunicating-with-a-dedicated-worker:dom-messageevent-data>a href#dom-messageevent-data>data/a>/code> attribute./p> p>To send messages back, you again use code idcommunicating-with-a-dedicated-worker:dom-dedicatedworkerglobalscope-postmessage>a href#dom-dedicatedworkerglobalscope-postmessage>postMessage()/a>/code>. It supports the structured data in the same manner./p> pre>postMessage(event.data.input, event.data.input); // transfer the buffer back/pre> h5 idshared-workers data-dfn-typedfn data-ltshared worker data-export>span classsecno>10.1.3.3/span> Shared workersa href#shared-workers classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>Shared workers are identified by the URL of the script used to create it, optionally with an explicit name. The name allows multiple instances of a particular shared worker to be started./p> p>Shared workers are scoped by a href#concept-origin idshared-workers:concept-origin>origin/a>. Two different sites using the same names will not collide. However, if a page tries to use the same shared worker name as another page on the same site, but with a different script URL, it will fail./p> p>Creating shared workers is done using the code idshared-workers:dom-sharedworker>a href#dom-sharedworker>SharedWorker()/a>/code> constructor. This constructor takes the URL to the script to use for its first argument, and the name of the worker, if any, as the second argument./p> pre>var worker new SharedWorker(service.js);/pre> p>Communicating with shared workers is done with explicit code idshared-workers:messageport>a href#messageport>MessagePort/a>/code> objects. The object returned by the code idshared-workers:dom-sharedworker-2>a href#dom-sharedworker>SharedWorker()/a>/code> constructor holds a reference to the port on its code idshared-workers:dom-sharedworker-port>a href#dom-sharedworker-port>port/a>/code> attribute./p> pre>worker.port.onmessage function (event) { ... };worker.port.postMessage(some message);worker.port.postMessage({ foo: structured, bar: data, also, possible});/pre> p>Inside the shared worker, new clients of the worker are announced using the code idshared-workers:event-workerglobalscope-connect>a href#event-workerglobalscope-connect>connect/a>/code> event. The port for the new client is given by the event objects code idshared-workers:dom-messageevent-source>a href#dom-messageevent-source>source/a>/code> attribute./p> pre>onconnect function (event) { var newPort event.source; // set up a listener newPort.onmessage function (event) { ... }; // send a message back to the port newPort.postMessage(ready!); // can also send structured data, of course};/pre> h3 idinfrastructure-2>span classsecno>10.2/span> Infrastructurea href#infrastructure-2 classself-link>/a>/h3> p>There are two kinds of workers; dedicated workers, and shared workers. Dedicated workers, once created, are linked to their creator; but message ports can be used to communicate from a dedicated worker to multiple other browsing contexts or workers. Shared workers, on the other hand, are named, and once created any script running in the same a href#concept-origin idinfrastructure-2:concept-origin>origin/a> can obtain a reference to that worker and communicate with it./p> h4 idthe-global-scope>span classsecno>10.2.1/span> The global scopea href#the-global-scope classself-link>/a>/h4> p>The global scope is the inside of a worker./p> h5 idthe-workerglobalscope-common-interface>span classsecno>10.2.1.1/span> The code idthe-workerglobalscope-common-interface:workerglobalscope>a href#workerglobalscope>WorkerGlobalScope/a>/code> common interfacea href#the-workerglobalscope-common-interface classself-link>/a>/h5> pre classidl>ExposedWorkerinterface dfn idworkerglobalscope>WorkerGlobalScope/dfn> : a idthe-workerglobalscope-common-interface:eventtarget hrefhttps://dom.spec.whatwg.org/#interface-eventtarget data-x-internaleventtarget>EventTarget/a> { readonly attribute a href#workerglobalscope idthe-workerglobalscope-common-interface:workerglobalscope-2>WorkerGlobalScope/a> a href#dom-workerglobalscope-self idthe-workerglobalscope-common-interface:dom-workerglobalscope-self>self/a>; readonly attribute a href#workerlocation idthe-workerglobalscope-common-interface:workerlocation>WorkerLocation/a> a href#dom-workerglobalscope-location idthe-workerglobalscope-common-interface:dom-workerglobalscope-location>location/a>; readonly attribute a href#workernavigator idthe-workerglobalscope-common-interface:workernavigator>WorkerNavigator/a> a href#dom-worker-navigator idthe-workerglobalscope-common-interface:dom-worker-navigator>navigator/a>; void a href#dom-workerglobalscope-importscripts idthe-workerglobalscope-common-interface:dom-workerglobalscope-importscripts>importScripts/a>(USVString... urls); attribute a href#onerroreventhandler idthe-workerglobalscope-common-interface:onerroreventhandler>OnErrorEventHandler/a> a href#handler-workerglobalscope-onerror idthe-workerglobalscope-common-interface:handler-workerglobalscope-onerror>onerror/a>; attribute a href#eventhandler idthe-workerglobalscope-common-interface:eventhandler>EventHandler/a> a href#handler-workerglobalscope-onlanguagechange idthe-workerglobalscope-common-interface:handler-workerglobalscope-onlanguagechange>onlanguagechange/a>; attribute a href#eventhandler idthe-workerglobalscope-common-interface:eventhandler-2>EventHandler/a> a href#handler-workerglobalscope-onoffline idthe-workerglobalscope-common-interface:handler-workerglobalscope-onoffline>onoffline/a>; attribute a href#eventhandler idthe-workerglobalscope-common-interface:eventhandler-3>EventHandler/a> a href#handler-workerglobalscope-ononline idthe-workerglobalscope-common-interface:handler-workerglobalscope-ononline>ononline/a>; attribute a href#eventhandler idthe-workerglobalscope-common-interface:eventhandler-4>EventHandler/a> a href#handler-workerglobalscope-onrejectionhandled idthe-workerglobalscope-common-interface:handler-workerglobalscope-onrejectionhandled>onrejectionhandled/a>; attribute a href#eventhandler idthe-workerglobalscope-common-interface:eventhandler-5>EventHandler/a> a href#handler-workerglobalscope-onunhandledrejection idthe-workerglobalscope-common-interface:handler-workerglobalscope-onunhandledrejection>onunhandledrejection/a>;};/pre> p>code idthe-workerglobalscope-common-interface:workerglobalscope-3>a href#workerglobalscope>WorkerGlobalScope/a>/code> serves as the base class for specific types of worker global scope objects, including code idthe-workerglobalscope-common-interface:dedicatedworkerglobalscope>a href#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope/a>/code>, code idthe-workerglobalscope-common-interface:sharedworkerglobalscope>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code>, and code idthe-workerglobalscope-common-interface:serviceworkerglobalscope>a data-x-internalserviceworkerglobalscope hrefhttps://w3c.github.io/ServiceWorker/#serviceworkerglobalscope>ServiceWorkerGlobalScope/a>/code>./p> p idthe-workers-documents>A code idthe-workerglobalscope-common-interface:workerglobalscope-4>a href#workerglobalscope>WorkerGlobalScope/a>/code> object has an associated dfn data-dfn-forWorkerGlobalScope idconcept-WorkerGlobalScope-owner-set data-export>owner set/dfn> (a a idthe-workerglobalscope-common-interface:set hrefhttps://infra.spec.whatwg.org/#ordered-set data-x-internalset>set/a> of code idthe-workerglobalscope-common-interface:document>a href#document>Document/a>/code> and code idthe-workerglobalscope-common-interface:workerglobalscope-5>a href#workerglobalscope>WorkerGlobalScope/a>/code> objects). It is initially empty and populated when the worker is created or obtained./p> p classnote>It is a a idthe-workerglobalscope-common-interface:set-2 hrefhttps://infra.spec.whatwg.org/#ordered-set data-x-internalset>set/a>, instead of a single owner, to accomodate code idthe-workerglobalscope-common-interface:sharedworkerglobalscope-2>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> objects./p> p>A code idthe-workerglobalscope-common-interface:workerglobalscope-6>a href#workerglobalscope>WorkerGlobalScope/a>/code> object has an associated dfn data-dfn-forWorkerGlobalScope idthe-workers-workers data-export>worker set/dfn> (a a idthe-workerglobalscope-common-interface:set-3 hrefhttps://infra.spec.whatwg.org/#ordered-set data-x-internalset>set/a> of code idthe-workerglobalscope-common-interface:workerglobalscope-7>a href#workerglobalscope>WorkerGlobalScope/a>/code> objects). It is initially empty and populated when the worker creates or obtains further workers./p> p>A code idthe-workerglobalscope-common-interface:workerglobalscope-8>a href#workerglobalscope>WorkerGlobalScope/a>/code> object has an associated dfn data-dfn-forWorkerGlobalScope idconcept-workerglobalscope-type data-export>type/dfn> (code>classic/code> or code>module/code>). It is set during creation./p> p>A code idthe-workerglobalscope-common-interface:workerglobalscope-9>a href#workerglobalscope>WorkerGlobalScope/a>/code> object has an associated dfn data-dfn-forWorkerGlobalScope idconcept-workerglobalscope-url data-export>url/dfn> (null or a a idthe-workerglobalscope-common-interface:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>). It is initially null./p> p>A code idthe-workerglobalscope-common-interface:workerglobalscope-10>a href#workerglobalscope>WorkerGlobalScope/a>/code> object has an associated dfn data-dfn-forWorkerGlobalScope idconcept-workerglobalscope-name data-export>name/dfn> (a string). It is set during creation./p> p classnote>The a href#concept-workerglobalscope-name idthe-workerglobalscope-common-interface:concept-workerglobalscope-name>name/a> can have different semantics for each subclass of of code idthe-workerglobalscope-common-interface:workerglobalscope-11>a href#workerglobalscope>WorkerGlobalScope/a>/code>. For code idthe-workerglobalscope-common-interface:dedicatedworkerglobalscope-2>a href#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope/a>/code> instances, it is simply a developer-supplied name, useful mostly for debugging purposes. For code idthe-workerglobalscope-common-interface:sharedworkerglobalscope-3>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> instances, it allows obtaining a reference to a common shared worker via the code idthe-workerglobalscope-common-interface:dom-sharedworker>a href#dom-sharedworker>SharedWorker()/a>/code> constructor. For code idthe-workerglobalscope-common-interface:serviceworkerglobalscope-2>a data-x-internalserviceworkerglobalscope hrefhttps://w3c.github.io/ServiceWorker/#serviceworkerglobalscope>ServiceWorkerGlobalScope/a>/code> objects, it doesnt make sense (and as such isnt exposed through the JavaScript API at all)./p> p>A code idthe-workerglobalscope-common-interface:workerglobalscope-12>a href#workerglobalscope>WorkerGlobalScope/a>/code> object has an associated dfn data-dfn-forWorkerGlobalScope idconcept-workerglobalscope-https-state data-export>HTTPS state/dfn> (an a idthe-workerglobalscope-common-interface:https-state-value hrefhttps://fetch.spec.whatwg.org/#concept-https-state-value data-x-internalhttps-state-value>HTTPS state value/a>). It is initially code>none/code>./p> p>A code idthe-workerglobalscope-common-interface:workerglobalscope-13>a href#workerglobalscope>WorkerGlobalScope/a>/code> object has an associated dfn data-dfn-forWorkerGlobalScope idconcept-workerglobalscope-referrer-policy data-export>referrer policy/dfn> (a a idthe-workerglobalscope-common-interface:referrer-policy hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>referrer policy/a>). It is initially the empty string./p> p>A code idthe-workerglobalscope-common-interface:workerglobalscope-14>a href#workerglobalscope>WorkerGlobalScope/a>/code> object has an associated dfn data-dfn-forWorkerGlobalScope idconcept-workerglobalscope-csp-list data-export>CSP list/dfn>. It is initially an empty list./p> p>A code idthe-workerglobalscope-common-interface:workerglobalscope-15>a href#workerglobalscope>WorkerGlobalScope/a>/code> object has an associated dfn data-dfn-forWorkerGlobalScope idconcept-workerglobalscope-module-map data-export>module map/dfn>. It is a a href#module-map idthe-workerglobalscope-common-interface:module-map>module map/a>, initially empty./p> dl classdomintro>dt>var>workerGlobal/var> . code idthe-workerglobalscope-common-interface:dom-workerglobalscope-self-2>a href#dom-workerglobalscope-self>self/a>/code>dd>Returns var>workerGlobal/var>.dt>var>workerGlobal/var> . code idthe-workerglobalscope-common-interface:dom-workerglobalscope-location-2>a href#dom-workerglobalscope-location>location/a>/code>dd>Returns var>workerGlobal/var>s code idthe-workerglobalscope-common-interface:workerlocation-2>a href#workerlocation>WorkerLocation/a>/code> object.dt>var>workerGlobal/var> . code idthe-workerglobalscope-common-interface:dom-worker-navigator-2>a href#dom-worker-navigator>navigator/a>/code>dd>Returns var>workerGlobal/var>s code idthe-workerglobalscope-common-interface:workernavigator-2>a href#workernavigator>WorkerNavigator/a>/code> object.dt>var>workerGlobal/var> . code idthe-workerglobalscope-common-interface:dom-workerglobalscope-importscripts-2>a href#dom-workerglobalscope-importscripts>importScripts/a>/code>(var>urls/var>...)dd>Fetches each a idthe-workerglobalscope-common-interface:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> in var>urls/var>, executes them one-by-one in the order they are passed, and then returns (or throws if something went amiss)./dl> p>The dfn iddom-workerglobalscope-self>code>self/code>/dfn> attribute must return the code idthe-workerglobalscope-common-interface:workerglobalscope-16>a href#workerglobalscope>WorkerGlobalScope/a>/code> object itself./p> p>The dfn iddom-workerglobalscope-location>code>location/code>/dfn> attribute must return the code idthe-workerglobalscope-common-interface:workerlocation-3>a href#workerlocation>WorkerLocation/a>/code> object whose associated a href#concept-workerlocation-workerglobalscope idthe-workerglobalscope-common-interface:concept-workerlocation-workerglobalscope>code>WorkerGlobalScope/code> object/a> is the code idthe-workerglobalscope-common-interface:workerglobalscope-17>a href#workerglobalscope>WorkerGlobalScope/a>/code> object./p> p classnote>While the code idthe-workerglobalscope-common-interface:workerlocation-4>a href#workerlocation>WorkerLocation/a>/code> object is created after the code idthe-workerglobalscope-common-interface:workerglobalscope-18>a href#workerglobalscope>WorkerGlobalScope/a>/code> object, this is not problematic as it cannot be observed from script./p> hr> p>The following are the a href#event-handlers idthe-workerglobalscope-common-interface:event-handlers>event handlers/a> (and their corresponding a href#event-handler-event-type idthe-workerglobalscope-common-interface:event-handler-event-type>event handler event types/a>) that must be supported, as a href#event-handler-idl-attributes idthe-workerglobalscope-common-interface:event-handler-idl-attributes>event handler IDL attributes/a>, by objects implementing the code idthe-workerglobalscope-common-interface:workerglobalscope-19>a href#workerglobalscope>WorkerGlobalScope/a>/code> interface:/p> table>thead>tr>th>a href#event-handlers idthe-workerglobalscope-common-interface:event-handlers-2>Event handler/a> th>a href#event-handler-event-type idthe-workerglobalscope-common-interface:event-handler-event-type-2>Event handler event type/a> tbody>tr>td>dfn idhandler-workerglobalscope-onerror>code>onerror/code>/dfn> td> code idthe-workerglobalscope-common-interface:event-error>a href#event-error>error/a>/code> tr>td>dfn idhandler-workerglobalscope-onlanguagechange>code>onlanguagechange/code>/dfn> td> code idthe-workerglobalscope-common-interface:event-languagechange>a href#event-languagechange>languagechange/a>/code> tr>td>dfn idhandler-workerglobalscope-onoffline>code>onoffline/code>/dfn> td> code idthe-workerglobalscope-common-interface:event-offline>a href#event-offline>offline/a>/code> tr>td>dfn idhandler-workerglobalscope-ononline>code>ononline/code>/dfn> td> code idthe-workerglobalscope-common-interface:event-online>a href#event-online>online/a>/code> tr>td>dfn idhandler-workerglobalscope-onrejectionhandled>code>onrejectionhandled/code>/dfn> td> code idthe-workerglobalscope-common-interface:event-rejectionhandled>a href#event-rejectionhandled>rejectionhandled/a>/code> tr>td>dfn idhandler-workerglobalscope-onunhandledrejection>code>onunhandledrejection/code>/dfn> td> code idthe-workerglobalscope-common-interface:event-unhandledrejection>a href#event-unhandledrejection>unhandledrejection/a>/code> /table> h5 iddedicated-workers-and-the-dedicatedworkerglobalscope-interface>span classsecno>10.2.1.2/span> Dedicated workers and the code iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:dedicatedworkerglobalscope>a href#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope/a>/code> interfacea href#dedicated-workers-and-the-dedicatedworkerglobalscope-interface classself-link>/a>/h5> pre classidl>Global(Worker,DedicatedWorker),ExposedDedicatedWorkerinterface dfn iddedicatedworkerglobalscope>DedicatedWorkerGlobalScope/dfn> : a href#workerglobalscope iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:workerglobalscope>WorkerGlobalScope/a> { Replaceable readonly attribute DOMString a href#dom-dedicatedworkerglobalscope-name iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:dom-dedicatedworkerglobalscope-name>name/a>; void a href#dom-dedicatedworkerglobalscope-postmessage iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:dom-dedicatedworkerglobalscope-postmessage>postMessage/a>(any message, optional sequence<a hrefhttps://heycam.github.io/webidl/#idl-object iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:idl-object data-x-internalidl-object>object/a>> transfer ); void a href#dom-dedicatedworkerglobalscope-close iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:dom-dedicatedworkerglobalscope-close>close/a>(); attribute a href#eventhandler iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:eventhandler>EventHandler/a> a href#handler-dedicatedworkerglobalscope-onmessage iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:handler-dedicatedworkerglobalscope-onmessage>onmessage/a>; attribute a href#eventhandler iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:eventhandler-2>EventHandler/a> a href#handler-dedicatedworkerglobalscope-onmessageerror iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:handler-dedicatedworkerglobalscope-onmessageerror>onmessageerror/a>;};/pre> p>code iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:dedicatedworkerglobalscope-2>a href#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope/a>/code> objects act as if they had an implicit code iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:messageport>a href#messageport>MessagePort/a>/code> associated with them. This port is part of a channel that is set up when the worker is created, but it is not exposed. This object must never be garbage collected before the code iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:dedicatedworkerglobalscope-3>a href#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope/a>/code> object./p> p>All messages received by that port must immediately be retargeted at the code iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:dedicatedworkerglobalscope-4>a href#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope/a>/code> object./p> dl classdomintro>dt>var>dedicatedWorkerGlobal/var> . code iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:dom-dedicatedworkerglobalscope-name-2>a href#dom-dedicatedworkerglobalscope-name>name/a>/code>dd>Returns var>dedicatedWorkerGlobal/var>s a href#concept-workerglobalscope-name iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:concept-workerglobalscope-name>name/a>, i.e. the value given to the code iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:worker>a href#worker>Worker/a>/code> constructor. Primarily useful for debugging.dt>var>dedicatedWorkerGlobal/var> . code iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:dom-dedicatedworkerglobalscope-postmessage-2>a href#dom-dedicatedworkerglobalscope-postmessage>postMessage/a>/code>(var>message/var> , var>transfer/var> )dd>Clones var>message/var> and transmits it to the code iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:worker-2>a href#worker>Worker/a>/code> object associated with var>dedicatedWorkerGlobal/var>. var>transfer/var> can be passed as a list of objects that are to be transferred rather than cloned.dt>var>dedicatedWorkerGlobal/var> . code iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:dom-dedicatedworkerglobalscope-close-2>a href#dom-dedicatedworkerglobalscope-close>close/a>/code>()dd>Aborts var>dedicatedWorkerGlobal/var>./dl> p>The dfn iddom-dedicatedworkerglobalscope-name>code>name/code>/dfn> attribute must return the code iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:dedicatedworkerglobalscope-5>a href#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope/a>/code> objects a href#concept-workerglobalscope-name iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:concept-workerglobalscope-name-2>name/a>. Its value represents the name given to the worker using the code iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:worker-3>a href#worker>Worker/a>/code> constructor, used primarily for debugging purposes./p> p>The dfn iddom-dedicatedworkerglobalscope-postmessage>code>postMessage()/code>/dfn> method on code iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:dedicatedworkerglobalscope-6>a href#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope/a>/code> objects must act as if, when invoked, it immediately invoked a href#dom-messageport-postmessage iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:dom-messageport-postmessage>the method of the same name/a> on the port, with the same arguments, and returned the same return value./p> p>To dfn idclose-a-worker data-export>close a worker/dfn>, given a var>workerGlobal/var>, run these steps:/p> ol>li>p>Discard any a href#concept-task iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:concept-task>tasks/a> that have been added to var>workerGlobal/var>s a href#event-loop iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:event-loop>event loop/a>s a href#task-queue iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:task-queue>task queues/a>./p> li>p>Set var>workerGlobal/var>s a href#dom-workerglobalscope-closing iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:dom-workerglobalscope-closing>closing/a> flag to true. (This prevents any further tasks from being queued.)/ol> p>The dfn iddom-dedicatedworkerglobalscope-close>code>close()/code>/dfn> method, when invoked, must a href#close-a-worker iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:close-a-worker>close a worker/a> with this code iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:dedicatedworkerglobalscope-7>a href#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope/a>/code> object./p> hr> p>The following are the a href#event-handlers iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:event-handlers>event handlers/a> (and their corresponding a href#event-handler-event-type iddedicated-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 iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:event-handler-idl-attributes>event handler IDL attributes/a>, by objects implementing the code iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:dedicatedworkerglobalscope-8>a href#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope/a>/code> interface:/p> table>thead>tr>th>a href#event-handlers iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:event-handlers-2>Event handler/a> th>a href#event-handler-event-type iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:event-handler-event-type-2>Event handler event type/a> tbody>tr>td>dfn idhandler-dedicatedworkerglobalscope-onmessage>code>onmessage/code>/dfn> td> code iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:event-message>a href#event-message>message/a>/code> tr>td>dfn idhandler-dedicatedworkerglobalscope-onmessageerror>code>onmessageerror/code>/dfn> td> code iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:event-messageerror>a href#event-messageerror>messageerror/a>/code> /table> p>For the purposes of the a href#application-cache iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:application-cache>application cache/a> networking model, a dedicated worker is an extension of the a href#cache-host iddedicated-workers-and-the-dedicatedworkerglobalscope-interface:cache-host>cache host/a> from which it was created./p> h5 idshared-workers-and-the-sharedworkerglobalscope-interface>span classsecno>10.2.1.3/span> Shared workers and the code idshared-workers-and-the-sharedworkerglobalscope-interface:sharedworkerglobalscope>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> interfacea href#shared-workers-and-the-sharedworkerglobalscope-interface classself-link>/a>/h5> pre classidl>Global(Worker,SharedWorker),ExposedSharedWorkerinterface dfn idsharedworkerglobalscope>SharedWorkerGlobalScope/dfn> : a href#workerglobalscope idshared-workers-and-the-sharedworkerglobalscope-interface:workerglobalscope>WorkerGlobalScope/a> { Replaceable readonly attribute DOMString a href#dom-sharedworkerglobalscope-name idshared-workers-and-the-sharedworkerglobalscope-interface:dom-sharedworkerglobalscope-name>name/a>; void a href#dom-sharedworkerglobalscope-close idshared-workers-and-the-sharedworkerglobalscope-interface:dom-sharedworkerglobalscope-close>close/a>(); attribute a href#eventhandler idshared-workers-and-the-sharedworkerglobalscope-interface:eventhandler>EventHandler/a> a href#handler-sharedworkerglobalscope-onconnect idshared-workers-and-the-sharedworkerglobalscope-interface:handler-sharedworkerglobalscope-onconnect>onconnect/a>;};/pre> p>A code idshared-workers-and-the-sharedworkerglobalscope-interface:sharedworkerglobalscope-2>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> object has an associated dfn data-dfn-forSharedWorkerGlobalScope idconcept-sharedworkerglobalscope-constructor-origin>constructor origin/dfn>, and dfn data-dfn-forSharedWorkerGlobalScope idconcept-sharedworkerglobalscope-constructor-url>constructor url/dfn>. They are initialized when the code idshared-workers-and-the-sharedworkerglobalscope-interface:sharedworkerglobalscope-3>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> object is created, in the a href#run-a-worker idshared-workers-and-the-sharedworkerglobalscope-interface:run-a-worker>run a worker/a> algorithm./p> p>Shared workers receive message ports through code idshared-workers-and-the-sharedworkerglobalscope-interface:event-workerglobalscope-connect>a href#event-workerglobalscope-connect>connect/a>/code> events on their code idshared-workers-and-the-sharedworkerglobalscope-interface:sharedworkerglobalscope-4>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> object for each connection./p> dl classdomintro>dt>var>sharedWorkerGlobal/var> . code idshared-workers-and-the-sharedworkerglobalscope-interface:dom-sharedworkerglobalscope-name-2>a href#dom-sharedworkerglobalscope-name>name/a>/code>dd>Returns var>sharedWorkerGlobal/var>s a href#concept-workerglobalscope-name idshared-workers-and-the-sharedworkerglobalscope-interface:concept-workerglobalscope-name>name/a>, i.e. the value given to the code idshared-workers-and-the-sharedworkerglobalscope-interface:sharedworker>a href#sharedworker>SharedWorker/a>/code> constructor. Multiple code idshared-workers-and-the-sharedworkerglobalscope-interface:sharedworker-2>a href#sharedworker>SharedWorker/a>/code> objects can correspond to the same shared worker (and code idshared-workers-and-the-sharedworkerglobalscope-interface:sharedworkerglobalscope-5>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code>), by reusing the same name.dt>var>sharedWorkerGlobal/var> . code idshared-workers-and-the-sharedworkerglobalscope-interface:dom-sharedworkerglobalscope-close-2>a href#dom-sharedworkerglobalscope-close>close/a>/code>()dd>Aborts var>sharedWorkerGlobal/var>./dl> p>The dfn iddom-sharedworkerglobalscope-name>code>name/code>/dfn> attribute must return the code idshared-workers-and-the-sharedworkerglobalscope-interface:sharedworkerglobalscope-6>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> objects a href#concept-workerglobalscope-name idshared-workers-and-the-sharedworkerglobalscope-interface:concept-workerglobalscope-name-2>name/a>. Its value represents the name that can be used to obtain a reference to the worker using the code idshared-workers-and-the-sharedworkerglobalscope-interface:sharedworker-3>a href#sharedworker>SharedWorker/a>/code> constructor./p> p>The dfn iddom-sharedworkerglobalscope-close>code>close()/code>/dfn> method, when invoked, must a href#close-a-worker idshared-workers-and-the-sharedworkerglobalscope-interface:close-a-worker>close a worker/a> with this code idshared-workers-and-the-sharedworkerglobalscope-interface:sharedworkerglobalscope-7>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> object./p> hr> p>The following are the a href#event-handlers idshared-workers-and-the-sharedworkerglobalscope-interface:event-handlers>event handlers/a> (and their corresponding a href#event-handler-event-type idshared-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 idshared-workers-and-the-sharedworkerglobalscope-interface:event-handler-idl-attributes>event handler IDL attributes/a>, by objects implementing the code idshared-workers-and-the-sharedworkerglobalscope-interface:sharedworkerglobalscope-8>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> interface:/p> table>thead>tr>th>a href#event-handlers idshared-workers-and-the-sharedworkerglobalscope-interface:event-handlers-2>Event handler/a> th>a href#event-handler-event-type idshared-workers-and-the-sharedworkerglobalscope-interface:event-handler-event-type-2>Event handler event type/a> tbody>tr>td>dfn idhandler-sharedworkerglobalscope-onconnect>code>onconnect/code>/dfn> td> code idshared-workers-and-the-sharedworkerglobalscope-interface:event-workerglobalscope-connect-2>a href#event-workerglobalscope-connect>connect/a>/code> /table> h4 idworker-event-loop>span classsecno>10.2.2/span> The event loopa href#worker-event-loop classself-link>/a>/h4> p>Each code idworker-event-loop:workerglobalscope>a href#workerglobalscope>WorkerGlobalScope/a>/code> object has a distinct a href#event-loop idworker-event-loop:event-loop>event loop/a>, separate from those used by a href#unit-of-related-similar-origin-browsing-contexts idworker-event-loop:unit-of-related-similar-origin-browsing-contexts>units of related similar-origin browsing contexts/a>. This a href#event-loop idworker-event-loop:event-loop-2>event loop/a> has no associated a href#browsing-context idworker-event-loop:browsing-context>browsing context/a>, and its a href#task-queue idworker-event-loop:task-queue>task queues/a> only have events, callbacks, and networking activity as a href#concept-task idworker-event-loop:concept-task>tasks/a>. These a href#event-loop idworker-event-loop:event-loop-3>event loops/a> are created by the a href#run-a-worker idworker-event-loop:run-a-worker>run a worker/a> algorithm./p> p>Each code idworker-event-loop:workerglobalscope-2>a href#workerglobalscope>WorkerGlobalScope/a>/code> object also has a dfn data-dfn-forWorkerGlobalScope iddom-workerglobalscope-closing data-dfn-typedfn data-export>closing/dfn> flag, which must initially be false, but which can get set to true by the algorithms in the processing model section below./p> p>Once the code idworker-event-loop:workerglobalscope-3>a href#workerglobalscope>WorkerGlobalScope/a>/code>s a href#dom-workerglobalscope-closing idworker-event-loop:dom-workerglobalscope-closing>closing/a> flag is set to true, the a href#event-loop idworker-event-loop:event-loop-4>event loop/a>s a href#task-queue idworker-event-loop:task-queue-2>task queues/a> must discard any further a href#concept-task idworker-event-loop:concept-task-2>tasks/a> that would be added to them (tasks already on the queue are unaffected except where otherwise specified). Effectively, once the a href#dom-workerglobalscope-closing idworker-event-loop:dom-workerglobalscope-closing-2>closing/a> flag is true, timers stop firing, notifications for all pending background operations are dropped, etc./p> h4 idthe-workers-lifetime>span classsecno>10.2.3/span> The workers lifetimea href#the-workers-lifetime classself-link>/a>/h4> p>Workers communicate with other workers and with a href#browsing-context idthe-workers-lifetime:browsing-context>browsing contexts/a> through a href#channel-messaging idthe-workers-lifetime:channel-messaging>message channels/a> and their code idthe-workers-lifetime:messageport>a href#messageport>MessagePort/a>/code> objects./p> p>Each code idthe-workers-lifetime:workerglobalscope>a href#workerglobalscope>WorkerGlobalScope/a>/code> object var>worker global scope/var> has a list of dfn idthe-workers-ports data-export>the workers ports/dfn>, which consists of all the code idthe-workers-lifetime:messageport-2>a href#messageport>MessagePort/a>/code> objects that are entangled with another port and that have one (but only one) port owned by var>worker global scope/var>. This list includes the implicit code idthe-workers-lifetime:messageport-3>a href#messageport>MessagePort/a>/code> in the case of a href#dedicatedworkerglobalscope idthe-workers-lifetime:dedicatedworkerglobalscope>dedicated workers/a>./p> p>Whenever a code idthe-workers-lifetime:document>a href#document>Document/a>/code> object is a href#discard-a-document idthe-workers-lifetime:discard-a-document>discarded/a>, it must be a hrefhttps://infra.spec.whatwg.org/#list-remove idthe-workers-lifetime:list-remove data-x-internallist-remove>removed/a> from the a href#concept-WorkerGlobalScope-owner-set idthe-workers-lifetime:concept-WorkerGlobalScope-owner-set>owner set/a> of each code idthe-workers-lifetime:workerglobalscope-2>a href#workerglobalscope>WorkerGlobalScope/a>/code> object whose set a hrefhttps://infra.spec.whatwg.org/#list-contain idthe-workers-lifetime:list-contains data-x-internallist-contains>contains/a> that code idthe-workers-lifetime:document-2>a href#document>Document/a>/code> object./p> p idlist-of-relevant-document-objects-to-add>Given an a href#environment-settings-object idthe-workers-lifetime:environment-settings-object>environment settings object/a> var>o/var> when creating or obtaining a worker, the dfn idrelevant-owner-to-add>relevant owner to add/dfn> depends on the type of a href#concept-settings-object-global idthe-workers-lifetime:concept-settings-object-global>global object/a> specified by var>o/var>. If var>o/var> specifies a a href#concept-settings-object-global idthe-workers-lifetime:concept-settings-object-global-2>global object/a> that is a code idthe-workers-lifetime:workerglobalscope-3>a href#workerglobalscope>WorkerGlobalScope/a>/code> object (i.e., if we are creating a nested worker), then the relevant owner is that global object. Otherwise, var>o/var> specifies a a href#concept-settings-object-global idthe-workers-lifetime:concept-settings-object-global-3>global object/a> that is a code idthe-workers-lifetime:window>a href#window>Window/a>/code> object, and the relevant owner is the a href#responsible-document idthe-workers-lifetime:responsible-document>responsible document/a> specified by var>o/var>./p> hr> p>A worker is said to be a dfn idpermissible-worker>permissible worker/dfn> if its code idthe-workers-lifetime:workerglobalscope-4>a href#workerglobalscope>WorkerGlobalScope/a>/code>s a href#concept-WorkerGlobalScope-owner-set idthe-workers-lifetime:concept-WorkerGlobalScope-owner-set-2>owner set/a> is not a hrefhttps://infra.spec.whatwg.org/#list-is-empty idthe-workers-lifetime:list-is-empty data-x-internallist-is-empty>empty/a> or:/p> ul classbrief>li>its a href#concept-WorkerGlobalScope-owner-set idthe-workers-lifetime:concept-WorkerGlobalScope-owner-set-3>owner set/a> has been a hrefhttps://infra.spec.whatwg.org/#list-is-empty idthe-workers-lifetime:list-is-empty-2 data-x-internallist-is-empty>empty/a> for no more than a short user-agent-defined timeout value,li>its code idthe-workers-lifetime:workerglobalscope-5>a href#workerglobalscope>WorkerGlobalScope/a>/code> object is a code idthe-workers-lifetime:sharedworkerglobalscope>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> object (i.e., the worker is a shared worker), andli>the user agent has a a href#browsing-context idthe-workers-lifetime:browsing-context-2>browsing context/a> whose code idthe-workers-lifetime:document-3>a href#document>Document/a>/code> object is not a href#completely-loaded idthe-workers-lifetime:completely-loaded>completely loaded/a>./ul> p classnote>The second part of this definition allows a shared worker to survive for a short time while a page is loading, in case that page is going to contact the shared worker again. This can be used by user agents as a way to avoid the cost of restarting a shared worker used by a site when the user is navigating from page to page within that site./p> p>A worker is said to be an dfn idactive-needed-worker>active needed worker/dfn> if any its a href#concept-WorkerGlobalScope-owner-set idthe-workers-lifetime:concept-WorkerGlobalScope-owner-set-4>owners/a> are either code idthe-workers-lifetime:document-4>a href#document>Document/a>/code> objects that are a href#fully-active idthe-workers-lifetime:fully-active>fully active/a> or a href#active-needed-worker idthe-workers-lifetime:active-needed-worker>active needed workers/a>./p> p>A worker is said to be a dfn idprotected-worker>protected worker/dfn> if it is an a href#active-needed-worker idthe-workers-lifetime:active-needed-worker-2>active needed worker/a> and either it has outstanding timers, database transactions, or network connections, or its list of a href#the-workers-ports idthe-workers-lifetime:the-workers-ports>the workers ports/a> is not empty, or its code idthe-workers-lifetime:workerglobalscope-6>a href#workerglobalscope>WorkerGlobalScope/a>/code> is actually a code idthe-workers-lifetime:sharedworkerglobalscope-2>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> object (i.e. the worker is a shared worker)./p> p>A worker is said to be a dfn idsuspendable-worker>suspendable worker/dfn> if it is not an a href#active-needed-worker idthe-workers-lifetime:active-needed-worker-3>active needed worker/a> but it is a a href#permissible-worker idthe-workers-lifetime:permissible-worker>permissible worker/a>./p> h4 idworker-processing-model>span classsecno>10.2.4/span> span idprocessing-model-10>/span>Processing modela href#worker-processing-model classself-link>/a>/h4> p>When a user agent is to dfn idrun-a-worker data-export>run a worker/dfn> for a script with code idworker-processing-model:worker>a href#worker>Worker/a>/code> or code idworker-processing-model:sharedworker>a href#sharedworker>SharedWorker/a>/code> object var>worker/var>, a idworker-processing-model:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> var>url/var>, a href#environment-settings-object idworker-processing-model:environment-settings-object>environment settings object/a> var>outside settings/var>, code idworker-processing-model:messageport>a href#messageport>MessagePort/a>/code> var>outside port/var>, and a code idworker-processing-model:workeroptions>a href#workeroptions>WorkerOptions/a>/code> dictionary var>options/var>, it must run the following steps./p> ol>li idworker-processing-model-top> p>Create a separate parallel execution environment (i.e. a separate thread or process or equivalent construct), and run the rest of these steps in that context./p> p>For the purposes of timing APIs, this is the dfn idofficial-moment-of-creation data-export>official moment of creation/dfn> of the worker./p> li>p>Let var>is shared/var> be true if var>worker/var> is a code idworker-processing-model:sharedworker-2>a href#sharedworker>SharedWorker/a>/code> object, and false otherwise.li>p>Let var>owner/var> be the a href#relevant-owner-to-add idworker-processing-model:relevant-owner-to-add>relevant owner to add/a> given var>outside settings/var>.li>p>Let var>parent worker global scope/var> be null./p> li>p>If var>owner/var> is a code idworker-processing-model:workerglobalscope>a href#workerglobalscope>WorkerGlobalScope/a>/code> object (i.e., we are creating a nested worker), then set var>parent worker global scope/var> to var>owner/var>.li> p>Call the JavaScript a hrefhttps://tc39.github.io/ecma262/#sec-initializehostdefinedrealm idworker-processing-model:js-initializehostdefinedrealm data-x-internaljs-initializehostdefinedrealm>InitializeHostDefinedRealm()/a> abstract operation with the following customizations:/p> ul>li>p>For the global object, if var>is shared/var> is true, create a new code idworker-processing-model:sharedworkerglobalscope>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> object. Otherwise, create a new code idworker-processing-model:dedicatedworkerglobalscope>a href#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope/a>/code> object. Let var>worker global scope/var> be the created object.li>p>Let var>realm execution context/var> be the created a idworker-processing-model:javascript-execution-context hrefhttps://tc39.github.io/ecma262/#sec-execution-contexts data-x-internaljavascript-execution-context>JavaScript execution context/a>./ul> li>p>a href#set-up-a-worker-environment-settings-object idworker-processing-model:set-up-a-worker-environment-settings-object>Set up a worker environment settings object/a> with var>realm execution context/var> and var>outside settings/var>, and let var>inside settings/var> be the result.li>p>Set var>worker global scope/var>s a href#concept-workerglobalscope-name idworker-processing-model:concept-workerglobalscope-name>name/a> to the value of var>options/var>s code>name/code> member.li> p>If var>is shared/var> is true, then:/p> ol>li>p>Set var>worker global scope/var>s a href#concept-sharedworkerglobalscope-constructor-origin idworker-processing-model:concept-sharedworkerglobalscope-constructor-origin>constructor origin/a> to var>outside settings/var>s a href#concept-settings-object-origin idworker-processing-model:concept-settings-object-origin>origin/a>.li>p>Set var>worker global scope/var>s a href#concept-sharedworkerglobalscope-constructor-url idworker-processing-model:concept-sharedworkerglobalscope-constructor-url>constructor url/a> to var>url/var>./ol> li>p>Let var>destination/var> be code>sharedworker/code> if var>is shared/var> is true, and code>worker/code> otherwise.li> p>Obtain var>script/var> by switching on the value of var>options/var>s code>type/code> member:/p> dl classswitch>dt>code>classic/code>dd>a href#fetch-a-classic-worker-script idworker-processing-model:fetch-a-classic-worker-script>Fetch a classic worker script/a> given var>url/var>, var>outside settings/var>, var>destination/var>, and var>inside settings/var>.dt>code>module/code>dd>a href#fetch-a-module-worker-script-tree idworker-processing-model:fetch-a-module-worker-script-tree>Fetch a module worker script graph/a> given var>url/var>, var>outside settings/var>, var>destination/var>, the value of the code>credentials/code> member of var>options/var>, and var>inside settings/var>./dl> p>In both cases, to a href#fetching-scripts-perform-fetch idworker-processing-model:fetching-scripts-perform-fetch>perform the fetch/a> given var>request/var>, perform the following steps if the var idworker-processing-model:fetching-scripts-is-top-level>a href#fetching-scripts-is-top-level>is top-level/a>/var> flag is set:/p> ol>li>Set var>request/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-request-reserved-client idworker-processing-model:concept-request-reserved-client data-x-internalconcept-request-reserved-client>reserved client/a> to var>inside settings/var>.li>p>a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idworker-processing-model:concept-fetch data-x-internalconcept-fetch>Fetch/a> var>request/var>, and asynchronously wait to run the remaining steps as part of fetchs a idworker-processing-model:process-response hrefhttps://fetch.spec.whatwg.org/#process-response data-x-internalprocess-response>process response/a> for the a hrefhttps://fetch.spec.whatwg.org/#concept-response idworker-processing-model:concept-response data-x-internalconcept-response>response/a> var>response/var>.li>p>Set var>worker global scope/var>s a href#concept-workerglobalscope-url idworker-processing-model:concept-workerglobalscope-url>url/a> to var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-url idworker-processing-model:concept-response-url data-x-internalconcept-response-url>url/a>.li>p>Set var>worker global scope/var>s a href#concept-workerglobalscope-https-state idworker-processing-model:concept-workerglobalscope-https-state>HTTPS state/a> to var>response/var>s a hrefhttps://fetch.spec.whatwg.org/#concept-response-https-state idworker-processing-model:concept-response-https-state data-x-internalconcept-response-https-state>HTTPS state/a>.li>p>Set var>worker global scope/var>s a href#concept-workerglobalscope-referrer-policy idworker-processing-model:concept-workerglobalscope-referrer-policy>referrer policy/a> to the result of a hrefhttps://w3c.github.io/webappsec-referrer-policy/#parse-referrer-policy-from-header idworker-processing-model:parse-referrer-policy-header data-x-internalparse-referrer-policy-header>parsing the `code>Referrer-Policy/code>` header/a> of var>response/var>.li>p>Execute the a idworker-processing-model:initialize-a-global-objects-csp-list hrefhttps://w3c.github.io/webappsec-csp/#initialize-global-object-csp data-x-internalinitialize-a-global-objects-csp-list>Initialize a code>global object/code>s CSP list/a> algorithm on var>worker global scope/var> and var>response/var>. a href#refsCSP>CSP/a>li>p>Asynchronously complete the a href#fetching-scripts-perform-fetch idworker-processing-model:fetching-scripts-perform-fetch-2>perform the fetch/a> steps with var>response/var>./ol> p>If the algorithm asynchronously completes with null, a href#queue-a-task idworker-processing-model:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idworker-processing-model:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idworker-processing-model:event-error>a href#event-error>error/a>/code> at var>worker/var>, and abort these steps. Otherwise, continue the rest of these steps after the algorithms asynchronous completion, with var>script/var> being the asynchronous completion value./p> li>p>Associate var>worker/var> with var>worker global scope/var>.li>p>a href#create-a-new-messageport-object idworker-processing-model:create-a-new-messageport-object>Create a new code>MessagePort/code> object/a> whose a href#concept-port-owner idworker-processing-model:concept-port-owner>owner/a> is var>inside settings/var>. Let var>inside port/var> be this new object.li>p>Associate var>inside port/var> with var>worker global scope/var>.li>p>a href#entangle idworker-processing-model:entangle>Entangle/a> var>outside port/var> and var>inside port/var>.li>p>a hrefhttps://infra.spec.whatwg.org/#set-append idworker-processing-model:set-append data-x-internalset-append>Append/a> var>owner/var> to var>worker global scope/var>s a href#concept-WorkerGlobalScope-owner-set idworker-processing-model:concept-WorkerGlobalScope-owner-set>owner set/a>.li>p>If var>parent worker global scope/var> is not null, then a hrefhttps://infra.spec.whatwg.org/#set-append idworker-processing-model:set-append-2 data-x-internalset-append>append/a> var>worker global scope/var> to var>parent worker global scope/var>s a href#the-workers-workers idworker-processing-model:the-workers-workers>worker set/a>.li>p>Set var>worker global scope/var>s a href#concept-workerglobalscope-type idworker-processing-model:concept-workerglobalscope-type>type/a> to the value of the code>type/code> member of var>options/var>.li>p>Create a new code idworker-processing-model:workerlocation>a href#workerlocation>WorkerLocation/a>/code> object and associate it with var>worker global scope/var>./p> li> p>strong>Closing orphan workers/strong>: Start monitoring the worker such that no sooner than it stops being a a href#protected-worker idworker-processing-model:protected-worker>protected worker/a>, and no later than it stops being a a href#permissible-worker idworker-processing-model:permissible-worker>permissible worker/a>, var>worker global scope/var>s a href#dom-workerglobalscope-closing idworker-processing-model:dom-workerglobalscope-closing>closing/a> flag is set to true./p> li> p>strong>Suspending workers/strong>: Start monitoring the worker, such that whenever var>worker global scope/var>s a href#dom-workerglobalscope-closing idworker-processing-model:dom-workerglobalscope-closing-2>closing/a> flag is false and the worker is a a href#suspendable-worker idworker-processing-model:suspendable-worker>suspendable worker/a>, the user agent suspends execution of script in that worker until such time as either the a href#dom-workerglobalscope-closing idworker-processing-model:dom-workerglobalscope-closing-3>closing/a> flag switches to true or the worker stops being a a href#suspendable-worker idworker-processing-model:suspendable-worker-2>suspendable worker/a>./p> li>p>Set var>inside settings/var>s a href#concept-environment-execution-ready-flag idworker-processing-model:concept-environment-execution-ready-flag>execution ready flag/a>.li> p>If var>script/var> is a a href#classic-script idworker-processing-model:classic-script>classic script/a>, then a href#run-a-classic-script idworker-processing-model:run-a-classic-script>run the classic script/a> var>script/var>. Otherwise, it is a a href#module-script idworker-processing-model:module-script>module script/a>; a href#run-a-module-script idworker-processing-model:run-a-module-script>run the module script/a> var>script/var>./p> p classnote>In addition to the usual possibilities of returning a value or failing due to an exception, this could be a href#abort-a-running-script idworker-processing-model:abort-a-running-script>prematurely aborted/a> by the a href#terminate-a-worker idworker-processing-model:terminate-a-worker>terminate a worker/a> algorithm defined below./p> li>p>Enable var>outside port/var>s a href#port-message-queue idworker-processing-model:port-message-queue>port message queue/a>.li>p>If var>is shared/var> is false, enable the a href#port-message-queue idworker-processing-model:port-message-queue-2>port message queue/a> of the workers implicit port.li>p>If var>is shared/var> is true, then a href#queue-a-task idworker-processing-model:queue-a-task-2>queue a task/a>, using the a href#dom-manipulation-task-source idworker-processing-model:dom-manipulation-task-source>DOM manipulation task source/a>, to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idworker-processing-model:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idworker-processing-model:event-workerglobalscope-connect>a href#event-workerglobalscope-connect>connect/a>/code> at var>worker global scope/var>, using code idworker-processing-model:messageevent>a href#messageevent>MessageEvent/a>/code>, with the code idworker-processing-model:dom-messageevent-data>a href#dom-messageevent-data>data/a>/code> attribute initialized to the empty string, the code idworker-processing-model:dom-messageevent-ports>a href#dom-messageevent-ports>ports/a>/code> attribute initialized to a new a idworker-processing-model:frozen-array hrefhttps://heycam.github.io/webidl/#dfn-frozen-array-type data-x-internalfrozen-array>frozen array/a> containing var>inside port/var>, and the code idworker-processing-model:dom-messageevent-source>a href#dom-messageevent-source>source/a>/code> attribute initialized to var>inside port/var>.li>p>Enable the a hrefhttps://w3c.github.io/ServiceWorker/#dfn-client-message-queue idworker-processing-model:dfn-client-message-queue data-x-internaldfn-client-message-queue>client message queue/a> of the code idworker-processing-model:serviceworkercontainer>a data-x-internalserviceworkercontainer hrefhttps://w3c.github.io/ServiceWorker/#serviceworkercontainer>ServiceWorkerContainer/a>/code> object whose associated a hrefhttps://w3c.github.io/ServiceWorker/#serviceworkercontainer-service-worker-client idworker-processing-model:serviceworkercontainer-service-worker-client data-x-internalserviceworkercontainer-service-worker-client>service worker client/a> is var>worker global scope/var>s a href#relevant-settings-object idworker-processing-model:relevant-settings-object>relevant settings object/a>.li> p>strong>Event loop/strong>: Run the a href#responsible-event-loop idworker-processing-model:responsible-event-loop>responsible event loop/a> specified by var>inside settings/var> until it is destroyed./p> p classnote>The handling of events or the execution of callbacks by a href#concept-task idworker-processing-model:concept-task>tasks/a> run by the a href#event-loop idworker-processing-model:event-loop>event loop/a> might get a href#abort-a-running-script idworker-processing-model:abort-a-running-script-2>prematurely aborted/a> by the a href#terminate-a-worker idworker-processing-model:terminate-a-worker-2>terminate a worker/a> algorithm defined below./p> p classnote>The worker processing model remains on this step until the event loop is destroyed, which happens after the a href#dom-workerglobalscope-closing idworker-processing-model:dom-workerglobalscope-closing-4>closing/a> flag is set to true, as described in the a href#event-loop idworker-processing-model:event-loop-2>event loop/a> processing model./p> li> p>Empty the var>worker global scope/var>s a href#list-of-active-timers idworker-processing-model:list-of-active-timers>list of active timers/a>./p> li> p>Disentangle all the ports in the list of a href#the-workers-ports idworker-processing-model:the-workers-ports>the workers ports/a>./p> li> p>a hrefhttps://infra.spec.whatwg.org/#list-empty idworker-processing-model:list-empty data-x-internallist-empty>Empty/a> var>worker global scope/var>s a href#concept-WorkerGlobalScope-owner-set idworker-processing-model:concept-WorkerGlobalScope-owner-set-2>owner set/a>./p> /ol> hr> p>When a user agent is to dfn idterminate-a-worker data-export>terminate a worker/dfn> it must run the following steps a href#in-parallel idworker-processing-model:in-parallel>in parallel/a> with the workers main loop (the a href#run-a-worker idworker-processing-model:run-a-worker>run a worker/a> processing model defined above):/p> ol>li>p>Set the workers code idworker-processing-model:workerglobalscope-2>a href#workerglobalscope>WorkerGlobalScope/a>/code> objects a href#dom-workerglobalscope-closing idworker-processing-model:dom-workerglobalscope-closing-5>closing/a> flag to true.li>p>If there are any a href#concept-task idworker-processing-model:concept-task-2>tasks/a> queued in the code idworker-processing-model:workerglobalscope-3>a href#workerglobalscope>WorkerGlobalScope/a>/code> objects a href#event-loop idworker-processing-model:event-loop-3>event loop/a>s a href#task-queue idworker-processing-model:task-queue>task queues/a>, discard them without processing them.li>p>a href#abort-a-running-script idworker-processing-model:abort-a-running-script-3>Abort the script/a> currently running in the worker.li>p>If the workers code idworker-processing-model:workerglobalscope-4>a href#workerglobalscope>WorkerGlobalScope/a>/code> object is actually a code idworker-processing-model:dedicatedworkerglobalscope-2>a href#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope/a>/code> object (i.e. the worker is a dedicated worker), then empty the a href#port-message-queue idworker-processing-model:port-message-queue-3>port message queue/a> of the port that the workers implicit port is entangled with./ol> p>User agents may invoke the a href#terminate-a-worker idworker-processing-model:terminate-a-worker-3>terminate a worker/a> algorithm when a worker stops being an a href#active-needed-worker idworker-processing-model:active-needed-worker>active needed worker/a> and the worker continues executing even after its a href#dom-workerglobalscope-closing idworker-processing-model:dom-workerglobalscope-closing-6>closing/a> flag was set to true./p> hr> p>The a href#task-source idworker-processing-model:task-source>task source/a> for the tasks mentioned above is the a href#dom-manipulation-task-source idworker-processing-model:dom-manipulation-task-source-2>DOM manipulation task source/a>./p> h4 idruntime-script-errors-2>span classsecno>10.2.5/span> Runtime script errorsa href#runtime-script-errors-2 classself-link>/a>/h4> p>Whenever an uncaught runtime script error occurs in one of the workers scripts, if the error did not occur while handling a previous script error, the user agent must a href#report-the-error idruntime-script-errors-2:report-the-error>report the error/a> for that a href#concept-script idruntime-script-errors-2:concept-script>script/a>, with the position (line number and column number) where the error occurred, using the code idruntime-script-errors-2:workerglobalscope>a href#workerglobalscope>WorkerGlobalScope/a>/code> object as the target./p> p>For shared workers, if the error is still i idruntime-script-errors-2:concept-error-nothandled>a href#concept-error-nothandled>not handled/a>/i> afterwards, the error may be reported to a developer console./p> p>For dedicated workers, if the error is still i idruntime-script-errors-2:concept-error-nothandled-2>a href#concept-error-nothandled>not handled/a>/i> afterwards, the user agent must a href#queue-a-task idruntime-script-errors-2:queue-a-task>queue a task/a> to run these steps:/p> ol>li>p>Let var>notHandled/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idruntime-script-errors-2:concept-event-fire data-x-internalconcept-event-fire>firing an event/a> named code idruntime-script-errors-2:event-error>a href#event-error>error/a>/code> at code idruntime-script-errors-2:worker>a href#worker>Worker/a>/code> object associated with the worker, using code idruntime-script-errors-2:errorevent>a href#errorevent>ErrorEvent/a>/code>, with the code idruntime-script-errors-2:dom-event-cancelable>a data-x-internaldom-event-cancelable hrefhttps://dom.spec.whatwg.org/#dom-event-cancelable>cancelable/a>/code> attribute initialized to true, the code idruntime-script-errors-2:dom-errorevent-message>a href#dom-errorevent-message>message/a>/code>, code idruntime-script-errors-2:dom-errorevent-filename>a href#dom-errorevent-filename>filename/a>/code>, code idruntime-script-errors-2:dom-errorevent-lineno>a href#dom-errorevent-lineno>lineno/a>/code>, and code idruntime-script-errors-2:dom-errorevent-colno>a href#dom-errorevent-colno>colno/a>/code> attributes initialized appropriately, and the code idruntime-script-errors-2:dom-errorevent-error>a href#dom-errorevent-error>error/a>/code> attribute initialized to null.li>p>If var>notHandled/var> is true, then the user agent must act as if the uncaught runtime script error had occurred in the global scope that the code idruntime-script-errors-2:worker-2>a href#worker>Worker/a>/code> object is in, thus repeating the entire runtime script error reporting process one level up./ol> p>If the implicit port connecting the worker to its code idruntime-script-errors-2:worker-3>a href#worker>Worker/a>/code> object has been disentangled (i.e. if the parent worker has been terminated), then the user agent must act as if the code idruntime-script-errors-2:worker-4>a href#worker>Worker/a>/code> object had no code idruntime-script-errors-2:event-error-2>a href#event-error>error/a>/code> event handler and as if that workers code idruntime-script-errors-2:handler-workerglobalscope-onerror>a href#handler-workerglobalscope-onerror>onerror/a>/code> attribute was null, but must otherwise act as described above./p> p classnote>Thus, error reports propagate up to the chain of dedicated workers up to the original code idruntime-script-errors-2:document>a href#document>Document/a>/code>, even if some of the workers along this chain have been terminated and garbage collected./p> p>The a href#task-source idruntime-script-errors-2:task-source>task source/a> for the task mentioned above is the a href#dom-manipulation-task-source idruntime-script-errors-2:dom-manipulation-task-source>DOM manipulation task source/a>./p> h4 idcreating-workers>span classsecno>10.2.6/span> Creating workersa href#creating-workers classself-link>/a>/h4> h5 idthe-abstractworker-abstract-interface>span classsecno>10.2.6.1/span> The code idthe-abstractworker-abstract-interface:abstractworker>a href#abstractworker>AbstractWorker/a>/code> abstract interfacea href#the-abstractworker-abstract-interface classself-link>/a>/h5> pre classidl>NoInterfaceObject, Exposed(Window,Worker)interface dfn idabstractworker>AbstractWorker/dfn> { attribute a href#eventhandler idthe-abstractworker-abstract-interface:eventhandler>EventHandler/a> a href#handler-abstractworker-onerror idthe-abstractworker-abstract-interface:handler-abstractworker-onerror>onerror/a>;};/pre> p>The following are the a href#event-handlers idthe-abstractworker-abstract-interface:event-handlers>event handlers/a> (and their corresponding a href#event-handler-event-type idthe-abstractworker-abstract-interface:event-handler-event-type>event handler event types/a>) that must be supported, as a href#event-handler-idl-attributes idthe-abstractworker-abstract-interface:event-handler-idl-attributes>event handler IDL attributes/a>, by objects implementing the code idthe-abstractworker-abstract-interface:abstractworker-2>a href#abstractworker>AbstractWorker/a>/code> interface:/p> table>thead>tr>th>a href#event-handlers idthe-abstractworker-abstract-interface:event-handlers-2>Event handler/a> th>a href#event-handler-event-type idthe-abstractworker-abstract-interface:event-handler-event-type-2>Event handler event type/a> tbody>tr>td>dfn idhandler-abstractworker-onerror>code>onerror/code>/dfn> td> code idthe-abstractworker-abstract-interface:event-error>a href#event-error>error/a>/code> /table> h5 idscript-settings-for-workers>span classsecno>10.2.6.2/span> Script settings for workersa href#script-settings-for-workers classself-link>/a>/h5> p>When the user agent is required to dfn idset-up-a-worker-environment-settings-object>set up a worker environment settings object/dfn>, given a a idscript-settings-for-workers:javascript-execution-context hrefhttps://tc39.github.io/ecma262/#sec-execution-contexts data-x-internaljavascript-execution-context>JavaScript execution context/a> var>execution context/var> and a href#environment-settings-object idscript-settings-for-workers:environment-settings-object>environment settings object/a> var>outside settings/var>, it must run the following steps:/p> ol>li>p>Let var>inherited responsible browsing context/var> be var>outside settings/var>s a href#responsible-browsing-context idscript-settings-for-workers:responsible-browsing-context>responsible browsing context/a>.li>p>Let var>inherited origin/var> be var>outside settings/var>s a href#concept-settings-object-origin idscript-settings-for-workers:concept-settings-object-origin>origin/a>.li>p>Let var>worker event loop/var> be a newly created a href#event-loop idscript-settings-for-workers:event-loop>event loop/a>.li>p>Let var>realm/var> be the value of var>execution context/var>s Realm component.li>p>Let var>worker global scope/var> be var>realm/var>s a href#concept-realm-global idscript-settings-for-workers:concept-realm-global>global object/a>.li> p>Let var>settings object/var> be a new a href#environment-settings-object idscript-settings-for-workers:environment-settings-object-2>environment settings object/a> whose algorithms are defined as follows:/p> dl>dt>The a href#realm-execution-context idscript-settings-for-workers:realm-execution-context>realm execution context/a>dd> p>Return var>execution context/var>. dt>The a href#concept-settings-object-module-map idscript-settings-for-workers:concept-settings-object-module-map>module map/a>dd> p>Return var>worker global scope/var>s a href#concept-workerglobalscope-module-map idscript-settings-for-workers:concept-workerglobalscope-module-map>module map/a>./p> dt>The a href#responsible-browsing-context idscript-settings-for-workers:responsible-browsing-context-2>responsible browsing context/a>dd> p>Return var>inherited responsible browsing context/var>./p> dt>The a href#responsible-event-loop idscript-settings-for-workers:responsible-event-loop>responsible event loop/a>dd> p>Return var>worker event loop/var>./p> dt>The a href#responsible-document idscript-settings-for-workers:responsible-document>responsible document/a>dd> p>Not applicable (the a href#responsible-event-loop idscript-settings-for-workers:responsible-event-loop-2>responsible event loop/a> is not a a href#browsing-context idscript-settings-for-workers:browsing-context>browsing context/a> a href#event-loop idscript-settings-for-workers:event-loop-2>event loop/a>)./p> dt>The a href#api-url-character-encoding idscript-settings-for-workers:api-url-character-encoding>API URL character encoding/a>dd> p>Return a idscript-settings-for-workers:utf-8 hrefhttps://encoding.spec.whatwg.org/#utf-8 data-x-internalutf-8>UTF-8/a>./p> dt>The a href#api-base-url idscript-settings-for-workers:api-base-url>API base URL/a>dd> p>Return var>worker global scope/var>s a href#concept-workerglobalscope-url idscript-settings-for-workers:concept-workerglobalscope-url>url/a>./p> dt>The a href#concept-settings-object-origin idscript-settings-for-workers:concept-settings-object-origin-2>origin/a>dd> p>Return a unique a href#concept-origin-opaque idscript-settings-for-workers:concept-origin-opaque>opaque origin/a> if var>worker global scope/var>s a href#concept-workerglobalscope-url idscript-settings-for-workers:concept-workerglobalscope-url-2>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idscript-settings-for-workers:concept-url-scheme data-x-internalconcept-url-scheme>scheme/a> is code>data/code>, and var>inherited origin/var> otherwise./p> dt>The a href#https-state idscript-settings-for-workers:https-state>HTTPS state/a>dd> p>Return var>worker global scope/var>s a href#concept-workerglobalscope-https-state idscript-settings-for-workers:concept-workerglobalscope-https-state>HTTPS state/a>./p> dt>The a href#concept-settings-object-referrer-policy idscript-settings-for-workers:concept-settings-object-referrer-policy>referrer policy/a>dd> p>Return var>worker global scope/var>s a href#concept-workerglobalscope-referrer-policy idscript-settings-for-workers:concept-workerglobalscope-referrer-policy>referrer policy/a>./p> /dl> li>p>Set var>settings object/var>s a href#concept-environment-id idscript-settings-for-workers:concept-environment-id>id/a> to a new unique opaque string, var>settings object/var>s a href#concept-environment-creation-url idscript-settings-for-workers:concept-environment-creation-url>creation URL/a> to var>worker global scope/var>s a idscript-settings-for-workers:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>url/a>, var>settings object/var>s a href#concept-environment-target-browsing-context idscript-settings-for-workers:concept-environment-target-browsing-context>target browsing context/a> to null, and var>settings object/var>s a href#concept-environment-active-service-worker idscript-settings-for-workers:concept-environment-active-service-worker>active service worker/a> to null.li>p>Set var>realm/var>s HostDefined field to var>settings object/var>.li>p>Return var>settings object/var>./ol> h5 iddedicated-workers-and-the-worker-interface>span classsecno>10.2.6.3/span> Dedicated workers and the code iddedicated-workers-and-the-worker-interface:worker>a href#worker>Worker/a>/code> interfacea href#dedicated-workers-and-the-worker-interface classself-link>/a>/h5> pre classidl>a href#dom-worker iddedicated-workers-and-the-worker-interface:dom-worker>Constructor/a>(USVString scriptURL, optional a href#workeroptions iddedicated-workers-and-the-worker-interface:workeroptions>WorkerOptions/a> options), Exposed(Window,Worker)interface dfn idworker>Worker/dfn> : a iddedicated-workers-and-the-worker-interface:eventtarget hrefhttps://dom.spec.whatwg.org/#interface-eventtarget data-x-internaleventtarget>EventTarget/a> { void a href#dom-worker-terminate iddedicated-workers-and-the-worker-interface:dom-worker-terminate>terminate/a>(); void a href#dom-worker-postmessage iddedicated-workers-and-the-worker-interface:dom-worker-postmessage>postMessage/a>(any message, optional sequence<a hrefhttps://heycam.github.io/webidl/#idl-object iddedicated-workers-and-the-worker-interface:idl-object data-x-internalidl-object>object/a>> transfer ); attribute a href#eventhandler iddedicated-workers-and-the-worker-interface:eventhandler>EventHandler/a> a href#handler-worker-onmessage iddedicated-workers-and-the-worker-interface:handler-worker-onmessage>onmessage/a>; attribute a href#eventhandler iddedicated-workers-and-the-worker-interface:eventhandler-2>EventHandler/a> a href#handler-worker-onmessageerror iddedicated-workers-and-the-worker-interface:handler-worker-onmessageerror>onmessageerror/a>;};dictionary dfn idworkeroptions>WorkerOptions/dfn> { a href#workertype iddedicated-workers-and-the-worker-interface:workertype>WorkerType/a> type classic; a iddedicated-workers-and-the-worker-interface:requestcredentials hrefhttps://fetch.spec.whatwg.org/#requestcredentials data-x-internalrequestcredentials>RequestCredentials/a> credentials omit; // credentials is only used if type is module DOMString name ;};enum dfn idworkertype>WorkerType/dfn> { classic, module };a href#worker iddedicated-workers-and-the-worker-interface:worker-2>Worker/a> implements a href#abstractworker iddedicated-workers-and-the-worker-interface:abstractworker>AbstractWorker/a>;/pre> dl classdomintro>dt>var>worker/var> new code iddedicated-workers-and-the-worker-interface:dom-worker-2>a href#dom-worker>Worker/a>/code>(var>scriptURL/var> , var>options/var> )dd>Returns a new code iddedicated-workers-and-the-worker-interface:worker-3>a href#worker>Worker/a>/code> object. var>scriptURL/var> will be fetched and executed in the background, creating a new global environment for which var>worker/var> represents the communication channel. var>options/var> can be used to define the a href#concept-workerglobalscope-name iddedicated-workers-and-the-worker-interface:concept-workerglobalscope-name>name/a> of that global environment via the code>name/code> option, primarily for debugging purposes. It can also ensure this new global environment supports JavaScript modules (specify code>type: module/code>), and if that is specified, can also be used to specify how var>scriptURL/var> is fetched through the code>credentials/code> option. dt>var>worker/var> . code iddedicated-workers-and-the-worker-interface:dom-worker-terminate-2>a href#dom-worker-terminate>terminate/a>/code>()dd>Aborts var>worker/var>s associated global environment.dt>var>worker/var> . code iddedicated-workers-and-the-worker-interface:dom-worker-postmessage-2>a href#dom-worker-postmessage>postMessage/a>/code>(var>message/var> , var>transfer/var> ) dd>Clones var>message/var> and transmits it to var>worker/var>s global environment. var>transfer/var> can be passed as a list of objects that are to be transferred rather than cloned./dl> p>The dfn iddom-worker-terminate>code>terminate()/code>/dfn> method, when invoked, must cause the a href#terminate-a-worker iddedicated-workers-and-the-worker-interface:terminate-a-worker>terminate a worker/a> algorithm to be run on the worker with which the object is associated./p> p>code iddedicated-workers-and-the-worker-interface:worker-4>a href#worker>Worker/a>/code> objects act as if they had an implicit code iddedicated-workers-and-the-worker-interface:messageport>a href#messageport>MessagePort/a>/code> associated with them. This port is part of a channel that is set up when the worker is created, but it is not exposed. This object must never be garbage collected before the code iddedicated-workers-and-the-worker-interface:worker-5>a href#worker>Worker/a>/code> object./p> p>All messages received by that port must immediately be retargeted at the code iddedicated-workers-and-the-worker-interface:worker-6>a href#worker>Worker/a>/code> object./p> p>The dfn iddom-worker-postmessage>code>postMessage()/code>/dfn> method on code iddedicated-workers-and-the-worker-interface:worker-7>a href#worker>Worker/a>/code> objects must act as if, when invoked, it immediately invoked a href#dom-messageport-postmessage iddedicated-workers-and-the-worker-interface:dom-messageport-postmessage>the method of the same name/a> on the port, with the same arguments, and returned the same return value./p> div classexample> p>The code iddedicated-workers-and-the-worker-interface:dom-worker-postmessage-3>a href#dom-worker-postmessage>postMessage()/a>/code> methods first argument can be structured data:/p> pre>worker.postMessage({opcode: activate, device: 1938, parameters: 23, 102});/pre> /div> p>The following are the a href#event-handlers iddedicated-workers-and-the-worker-interface:event-handlers>event handlers/a> (and their corresponding a href#event-handler-event-type iddedicated-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 iddedicated-workers-and-the-worker-interface:event-handler-idl-attributes>event handler IDL attributes/a>, by objects implementing the code iddedicated-workers-and-the-worker-interface:worker-8>a href#worker>Worker/a>/code> interface:/p> table>thead>tr>th>a href#event-handlers iddedicated-workers-and-the-worker-interface:event-handlers-2>Event handler/a> th>a href#event-handler-event-type iddedicated-workers-and-the-worker-interface:event-handler-event-type-2>Event handler event type/a> tbody>tr>td>dfn idhandler-worker-onmessage>code>onmessage/code>/dfn> td> code iddedicated-workers-and-the-worker-interface:event-message>a href#event-message>message/a>/code> tr>td>dfn idhandler-worker-onmessageerror>code>onmessageerror/code>/dfn> td> code iddedicated-workers-and-the-worker-interface:event-messageerror>a href#event-messageerror>messageerror/a>/code> /table> hr> p>When the dfn iddom-worker>code>Worker(var>scriptURL/var>, var>options/var>)/code>/dfn> constructor is invoked, the user agent must run the following steps:/p> ol>li>p>The user agent may throw a a iddedicated-workers-and-the-worker-interface:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code iddedicated-workers-and-the-worker-interface:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps if the request violates a policy decision (e.g. if the user agent is configured to not allow the page to start dedicated workers).li>p>Let var>outside settings/var> be the a href#current-settings-object iddedicated-workers-and-the-worker-interface:current-settings-object>current settings object/a>./p> li>p>a href#parse-a-url iddedicated-workers-and-the-worker-interface:parse-a-url>Parse/a> the var>scriptURL/var> argument relative to var>outside settings/var>.li>p>If this fails, throw a a iddedicated-workers-and-the-worker-interface:syntaxerror hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code iddedicated-workers-and-the-worker-interface:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li> p>Let var>worker URL/var> be the a href#resulting-url-record iddedicated-workers-and-the-worker-interface:resulting-url-record>resulting URL record/a>./p> p classnote>Any a href#same-origin iddedicated-workers-and-the-worker-interface:same-origin>same-origin/a> URL (including code iddedicated-workers-and-the-worker-interface:blob-protocol>a data-x-internalblob-protocol hrefhttps://w3c.github.io/FileAPI/#DefinitionOfScheme>blob:/a>/code> URLs) can be used. code iddedicated-workers-and-the-worker-interface:data-protocol>a data-x-internaldata-protocol hrefhttps://tools.ietf.org/html/rfc2397#section-2>data:/a>/code> URLs can also be used, but they create a worker with an a href#concept-origin-opaque iddedicated-workers-and-the-worker-interface:concept-origin-opaque>opaque origin/a>./p> li>p>Let var>worker/var> be a new code iddedicated-workers-and-the-worker-interface:worker-9>a href#worker>Worker/a>/code> object.li>p>a href#create-a-new-messageport-object iddedicated-workers-and-the-worker-interface:create-a-new-messageport-object>Create a new code>MessagePort/code> object/a> whose a href#concept-port-owner iddedicated-workers-and-the-worker-interface:concept-port-owner>owner/a> is var>outside settings/var>. Let this be the var>outside port/var>.li>p>Associate the var>outside port/var> with var>worker/var>.li>p>Return var>worker/var>, and run the following step a href#in-parallel iddedicated-workers-and-the-worker-interface:in-parallel>in parallel/a>.li>p>a href#run-a-worker iddedicated-workers-and-the-worker-interface:run-a-worker>Run a worker/a> given var>worker/var>, var>worker URL/var>, var>outside settings/var>, var>outside port/var>, and var>options/var>./ol> h5 idshared-workers-and-the-sharedworker-interface>span classsecno>10.2.6.4/span> Shared workers and the code idshared-workers-and-the-sharedworker-interface:sharedworker>a href#sharedworker>SharedWorker/a>/code> interfacea href#shared-workers-and-the-sharedworker-interface classself-link>/a>/h5> pre classidl>a href#dom-sharedworker idshared-workers-and-the-sharedworker-interface:dom-sharedworker>Constructor/a>(USVString scriptURL, optional (DOMString or a href#workeroptions idshared-workers-and-the-sharedworker-interface:workeroptions>WorkerOptions/a>) options), Exposed(Window,Worker)interface dfn idsharedworker>SharedWorker/dfn> : a idshared-workers-and-the-sharedworker-interface:eventtarget hrefhttps://dom.spec.whatwg.org/#interface-eventtarget data-x-internaleventtarget>EventTarget/a> { readonly attribute a href#messageport idshared-workers-and-the-sharedworker-interface:messageport>MessagePort/a> a href#dom-sharedworker-port idshared-workers-and-the-sharedworker-interface:dom-sharedworker-port>port/a>;};a href#sharedworker idshared-workers-and-the-sharedworker-interface:sharedworker-2>SharedWorker/a> implements a href#abstractworker idshared-workers-and-the-sharedworker-interface:abstractworker>AbstractWorker/a>;/pre> dl classdomintro>dt>var>sharedWorker/var> new code idshared-workers-and-the-sharedworker-interface:dom-sharedworker-2>a href#dom-sharedworker>SharedWorker/a>/code>(var>scriptURL/var> , var>name/var> )dd>Returns a new code idshared-workers-and-the-sharedworker-interface:sharedworker-3>a href#sharedworker>SharedWorker/a>/code> object. var>scriptURL/var> will be fetched and executed in the background, creating a new global environment for which var>sharedWorker/var> represents the communication channel. var>name/var> can be used to define the a href#concept-workerglobalscope-name idshared-workers-and-the-sharedworker-interface:concept-workerglobalscope-name>name/a> of that global environment.dt>var>sharedWorker/var> new code idshared-workers-and-the-sharedworker-interface:dom-sharedworker-3>a href#dom-sharedworker>SharedWorker/a>/code>(var>scriptURL/var> , var>options/var> )dd>Returns a new code idshared-workers-and-the-sharedworker-interface:sharedworker-4>a href#sharedworker>SharedWorker/a>/code> object. var>scriptURL/var> will be fetched and executed in the background, creating a new global environment for which var>sharedWorker/var> represents the communication channel. var>options/var> can be used to define the a href#concept-workerglobalscope-name idshared-workers-and-the-sharedworker-interface:concept-workerglobalscope-name-2>name/a> of that global environment via the code>name/code> option. It can also ensure this new global environment supports JavaScript modules (specify code>type: module/code>), and if that is specified, can also be used to specify how var>scriptURL/var> is fetched through the code>credentials/code> option.dt>var>sharedWorker/var> . code idshared-workers-and-the-sharedworker-interface:dom-sharedworker-port-2>a href#dom-sharedworker-port>port/a>/code>dd>Returns var>sharedWorker/var>s code idshared-workers-and-the-sharedworker-interface:messageport-2>a href#messageport>MessagePort/a>/code> object which can be used to communicate with the global environment./dl> p>The dfn iddom-sharedworker-port>code>port/code>/dfn> attribute must return the value it was assigned by the objects constructor. It represents the code idshared-workers-and-the-sharedworker-interface:messageport-3>a href#messageport>MessagePort/a>/code> for communicating with the shared worker./p> p>A user agent has an associated dfn idshared-worker-manager>shared worker manager/dfn> which is the result of a href#starting-a-new-parallel-queue idshared-workers-and-the-sharedworker-interface:starting-a-new-parallel-queue>starting a new parallel queue/a>./p> p classnote>Each user agent has a single a href#shared-worker-manager idshared-workers-and-the-sharedworker-interface:shared-worker-manager>shared worker manager/a> for simplicity. Implementations could use one per a href#concept-origin idshared-workers-and-the-sharedworker-interface:concept-origin>origin/a>; that would not be observably different and enables more concurrency./p> p>When the dfn iddom-sharedworker>code>SharedWorker(var>scriptURL/var>, var>options/var>)/code>/dfn> constructor is invoked:/p> ol>li>p>Optionally, throw a a idshared-workers-and-the-sharedworker-interface:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idshared-workers-and-the-sharedworker-interface:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps if the request violates a policy decision (e.g. if the user agent is configured to not allow the page to start shared workers).li>p>If var>options/var> is a code idshared-workers-and-the-sharedworker-interface:idl-domstring>a data-x-internalidl-domstring hrefhttps://heycam.github.io/webidl/#idl-DOMString>DOMString/a>/code>, set var>options/var> to a new code idshared-workers-and-the-sharedworker-interface:workeroptions-2>a href#workeroptions>WorkerOptions/a>/code> dictionary whose code>name/code> member is set to the value of var>options/var> and whose other members are set to their default values.li>p>Let var>outside settings/var> be the a href#current-settings-object idshared-workers-and-the-sharedworker-interface:current-settings-object>current settings object/a>.li>p>a href#parse-a-url idshared-workers-and-the-sharedworker-interface:parse-a-url>Parse/a> var>scriptURL/var> relative to var>outside settings/var>.li>p>If this fails, throw a a idshared-workers-and-the-sharedworker-interface:syntaxerror hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idshared-workers-and-the-sharedworker-interface:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li> p>Otherwise, let var>urlRecord/var> be the a href#resulting-url-record idshared-workers-and-the-sharedworker-interface:resulting-url-record>resulting URL record/a>./p> p classnote>Any a href#same-origin idshared-workers-and-the-sharedworker-interface:same-origin>same-origin/a> URL (including code idshared-workers-and-the-sharedworker-interface:blob-protocol>a data-x-internalblob-protocol hrefhttps://w3c.github.io/FileAPI/#DefinitionOfScheme>blob:/a>/code> URLs) can be used. code idshared-workers-and-the-sharedworker-interface:data-protocol>a data-x-internaldata-protocol hrefhttps://tools.ietf.org/html/rfc2397#section-2>data:/a>/code> URLs can also be used, but they create a worker with an a href#concept-origin-opaque idshared-workers-and-the-sharedworker-interface:concept-origin-opaque>opaque origin/a>./p> li>p>Let var>worker/var> be a new code idshared-workers-and-the-sharedworker-interface:sharedworker-5>a href#sharedworker>SharedWorker/a>/code> object.li>p>a href#create-a-new-messageport-object idshared-workers-and-the-sharedworker-interface:create-a-new-messageport-object>Create a new code>MessagePort/code> object/a> whose a href#concept-port-owner idshared-workers-and-the-sharedworker-interface:concept-port-owner>owner/a> is var>outside settings/var>. Let this be the var>outside port/var>.li>p>Assign var>outside port/var> to the code idshared-workers-and-the-sharedworker-interface:dom-sharedworker-port-3>a href#dom-sharedworker-port>port/a>/code> attribute of var>worker/var>.li>p>Let var>isSecureContext/var> be the result of executing a idshared-workers-and-the-sharedworker-interface:is-environment-settings-object-a-secure-context hrefhttps://w3c.github.io/webappsec-secure-contexts/#settings-object data-x-internalis-environment-settings-object-a-secure-context>Is environment settings object a secure context?/a> on var>outside settings/var>.li> p>a href#enqueue-the-following-steps idshared-workers-and-the-sharedworker-interface:enqueue-the-following-steps>Enqueue the following steps/a> to the a href#shared-worker-manager idshared-workers-and-the-sharedworker-interface:shared-worker-manager-2>shared worker manager/a>:/p> ol>li>p>Let var>worker global scope/var> be null.li> p>If there exists a code idshared-workers-and-the-sharedworker-interface:sharedworkerglobalscope>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> object whose a href#dom-workerglobalscope-closing idshared-workers-and-the-sharedworker-interface:dom-workerglobalscope-closing>closing/a> flag is false, a href#concept-sharedworkerglobalscope-constructor-origin idshared-workers-and-the-sharedworker-interface:concept-sharedworkerglobalscope-constructor-origin>constructor origin/a> is a href#same-origin idshared-workers-and-the-sharedworker-interface:same-origin-2>same origin/a> with var>outside settings/var>s a href#concept-settings-object-origin idshared-workers-and-the-sharedworker-interface:concept-settings-object-origin>origin/a>, a href#concept-sharedworkerglobalscope-constructor-url idshared-workers-and-the-sharedworker-interface:concept-sharedworkerglobalscope-constructor-url>constructor url/a> a hrefhttps://url.spec.whatwg.org/#concept-url-equals idshared-workers-and-the-sharedworker-interface:concept-url-equals data-x-internalconcept-url-equals>equals/a> var>urlRecord/var>, and a href#concept-workerglobalscope-name idshared-workers-and-the-sharedworker-interface:concept-workerglobalscope-name-3>name/a> equals the value of var>options/var>s code>name/code> member, then set var>worker global scope/var> to that code idshared-workers-and-the-sharedworker-interface:sharedworkerglobalscope-2>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> object./p> p classnote>code idshared-workers-and-the-sharedworker-interface:data-protocol-2>a data-x-internaldata-protocol hrefhttps://tools.ietf.org/html/rfc2397#section-2>data:/a>/code> URLs create a worker with an a href#concept-origin-opaque idshared-workers-and-the-sharedworker-interface:concept-origin-opaque-2>opaque origin/a>. Both the a href#concept-sharedworkerglobalscope-constructor-origin idshared-workers-and-the-sharedworker-interface:concept-sharedworkerglobalscope-constructor-origin-2>constructor origin/a> and a href#concept-sharedworkerglobalscope-constructor-url idshared-workers-and-the-sharedworker-interface:concept-sharedworkerglobalscope-constructor-url-2>constructor url/a> are compared so the same code idshared-workers-and-the-sharedworker-interface:data-protocol-3>a data-x-internaldata-protocol hrefhttps://tools.ietf.org/html/rfc2397#section-2>data:/a>/code> URL can be used within an a href#concept-origin idshared-workers-and-the-sharedworker-interface:concept-origin-2>origin/a> to get to the same code idshared-workers-and-the-sharedworker-interface:sharedworkerglobalscope-3>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> object, but cannot be used to bypass the a href#same-origin idshared-workers-and-the-sharedworker-interface:same-origin-3>same origin/a> restriction./p> li> p>If var>worker global scope/var> is not null, but the user agent has been configured to disallow communication between the worker represented by the var>worker global scope/var> and the a href#concept-script idshared-workers-and-the-sharedworker-interface:concept-script>scripts/a> whose a href#settings-object idshared-workers-and-the-sharedworker-interface:settings-object>settings object/a> is var>outside settings/var>, then set var>worker global scope/var> to null./p> p classnote>For example, a user agent could have a development mode that isolates a particular a href#top-level-browsing-context idshared-workers-and-the-sharedworker-interface:top-level-browsing-context>top-level browsing context/a> from all other pages, and scripts in that development mode could be blocked from connecting to shared workers running in the normal browser mode./p> li> p>If var>worker global scope/var> is not null, then run these subsubsteps:/p> ol>li>p>Let var>settings object/var> be the a href#relevant-settings-object idshared-workers-and-the-sharedworker-interface:relevant-settings-object>relevant settings object/a> for var>worker global scope/var>.li>p>If the result of executing a idshared-workers-and-the-sharedworker-interface:is-environment-settings-object-a-secure-context-2 hrefhttps://w3c.github.io/webappsec-secure-contexts/#settings-object data-x-internalis-environment-settings-object-a-secure-context>Is environment settings object a secure context?/a> on var>settings object/var> is not var>isSecureContext/var>, then a href#queue-a-task idshared-workers-and-the-sharedworker-interface:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idshared-workers-and-the-sharedworker-interface:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idshared-workers-and-the-sharedworker-interface:event-error>a href#event-error>error/a>/code> at var>worker/var> and abort these subsubsteps. a href#refsSECURE-CONTEXTS>SECURE-CONTEXTS/a>li>p>Associate var>worker/var> with var>worker global scope/var>.li>p>a href#create-a-new-messageport-object idshared-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 idshared-workers-and-the-sharedworker-interface:concept-port-owner-2>owner/a> is var>settings object/var>. Let this be the var>inside port/var>.li>p>a href#entangle idshared-workers-and-the-sharedworker-interface:entangle>Entangle/a> var>outside port/var> and var>inside port/var>.li>p>a href#queue-a-task idshared-workers-and-the-sharedworker-interface:queue-a-task-2>Queue a task/a>, using the a href#dom-manipulation-task-source idshared-workers-and-the-sharedworker-interface:dom-manipulation-task-source>DOM manipulation task source/a>, to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idshared-workers-and-the-sharedworker-interface:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idshared-workers-and-the-sharedworker-interface:event-workerglobalscope-connect>a href#event-workerglobalscope-connect>connect/a>/code> at var>worker global scope/var>, using code idshared-workers-and-the-sharedworker-interface:messageevent>a href#messageevent>MessageEvent/a>/code>, with the code idshared-workers-and-the-sharedworker-interface:dom-messageevent-data>a href#dom-messageevent-data>data/a>/code> attribute initialized to the empty string, the code idshared-workers-and-the-sharedworker-interface:dom-messageevent-ports>a href#dom-messageevent-ports>ports/a>/code> attribute initialized to a new a idshared-workers-and-the-sharedworker-interface:frozen-array hrefhttps://heycam.github.io/webidl/#dfn-frozen-array-type data-x-internalfrozen-array>frozen array/a> containing only var>inside port/var>, and the code idshared-workers-and-the-sharedworker-interface:dom-messageevent-source>a href#dom-messageevent-source>source/a>/code> attribute initialized to var>inside port/var>.li>p>a hrefhttps://infra.spec.whatwg.org/#set-append idshared-workers-and-the-sharedworker-interface:set-append data-x-internalset-append>Append/a> the a href#relevant-owner-to-add idshared-workers-and-the-sharedworker-interface:relevant-owner-to-add>relevant owner to add/a> given var>outside settings/var> to var>worker global scope/var>s a href#concept-WorkerGlobalScope-owner-set idshared-workers-and-the-sharedworker-interface:concept-WorkerGlobalScope-owner-set>owner set/a>.li>p>If var>outside settings/var>s a href#concept-settings-object-global idshared-workers-and-the-sharedworker-interface:concept-settings-object-global>global object/a> is a code idshared-workers-and-the-sharedworker-interface:workerglobalscope>a href#workerglobalscope>WorkerGlobalScope/a>/code> object, then a hrefhttps://infra.spec.whatwg.org/#set-append idshared-workers-and-the-sharedworker-interface:set-append-2 data-x-internalset-append>append/a> var>worker global scope/var> to var>outside settings/var>s a href#concept-settings-object-global idshared-workers-and-the-sharedworker-interface:concept-settings-object-global-2>global object/a>s a href#the-workers-workers idshared-workers-and-the-sharedworker-interface:the-workers-workers>worker set/a>./ol> li>p>Otherwise, a href#in-parallel idshared-workers-and-the-sharedworker-interface:in-parallel>in parallel/a>, a href#run-a-worker idshared-workers-and-the-sharedworker-interface:run-a-worker>run a worker/a> given var>worker/var>, var>urlRecord/var>, var>outside settings/var>, var>outside port/var>, and var>options/var>./ol> li>p>Return var>worker/var>./ol> h4 idnavigator.hardwareconcurrency>span classsecno>10.2.7/span> Concurrent hardware capabilitiesa href#navigator.hardwareconcurrency classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> hardwareconcurrencyspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>37+/span>/span>span classios_saf yes>span>iOS Safari/span> span>10.3+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>48+/span>/span>span classie no>span>IE/span> span>None/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>10.1+/span>/span>span classedge yes>span>Edge/span> span>15+/span>/span>span classandroid yes>span>Android Browser/span> span>56+/span>/span>span classopera yes>span>Opera/span> span>24+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#feathardwareconcurrency>caniuse.com/a>/div> pre classidl>NoInterfaceObject, Exposed(Window,Worker)interface dfn idnavigatorconcurrenthardware>NavigatorConcurrentHardware/dfn> { readonly attribute unsigned long long a href#dom-navigator-hardwareconcurrency idnavigator.hardwareconcurrency:dom-navigator-hardwareconcurrency>hardwareConcurrency/a>;};/pre> dl classdomintro>dt>var>self/var> . code idnavigator.hardwareconcurrency:dom-navigator>a href#dom-navigator>navigator/a>/code> . code idnavigator.hardwareconcurrency:dom-navigator-hardwareconcurrency-2>a href#dom-navigator-hardwareconcurrency>hardwareConcurrency/a>/code>dd>p>Returns the number of logical processors potentially available to the user agent./dl> p>The dfn iddom-navigator-hardwareconcurrency>code>navigator.hardwareConcurrency/code>/dfn> attributes getter must return a number between 1 and the number of logical processors potentially available to the user agent. If this cannot be determined, the getter must return 1. a href#fingerprinting-vector idnavigator.hardwareconcurrency:fingerprinting-vector classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a>/p> p>User agents should err toward exposing the number of logical processors available, using lower values only in cases where there are user-agent specific limits in place (such as a limitation on the number of a href#worker idnavigator.hardwareconcurrency:worker>workers/a> that can be created) or when the user agent desires to limit fingerprinting possibilities./p> h3 idapis-available-to-workers>span classsecno>10.3/span> APIs available to workersa href#apis-available-to-workers classself-link>/a>/h3> h4 idimporting-scripts-and-libraries>span classsecno>10.3.1/span> Importing scripts and librariesa href#importing-scripts-and-libraries classself-link>/a>/h4> p>When a script invokes the dfn iddom-workerglobalscope-importscripts>code>importScripts(var>urls/var>)/code>/dfn> method on a code idimporting-scripts-and-libraries:workerglobalscope>a href#workerglobalscope>WorkerGlobalScope/a>/code> object, the user agent must a href#import-scripts-into-worker-global-scope idimporting-scripts-and-libraries:import-scripts-into-worker-global-scope>import scripts into worker global scope/a> given this code idimporting-scripts-and-libraries:workerglobalscope-2>a href#workerglobalscope>WorkerGlobalScope/a>/code> object and var>urls/var>./p> p>To dfn idimport-scripts-into-worker-global-scope data-export>import scripts into worker global scope/dfn>, given a code idimporting-scripts-and-libraries:workerglobalscope-3>a href#workerglobalscope>WorkerGlobalScope/a>/code> object var>worker global scope/var> and a code>sequence<DOMString>/code> var>urls/var>, run these steps. The algorithm may optionally be customized by supplying custom a href#fetching-scripts-perform-fetch idimporting-scripts-and-libraries:fetching-scripts-perform-fetch>perform the fetch/a> hooks, which if provided will be used when invoking a href#fetch-a-classic-worker-imported-script idimporting-scripts-and-libraries:fetch-a-classic-worker-imported-script>fetch a classic worker-imported script/a>./p> ol>li>p>If var>worker global scope/var>s a href#concept-workerglobalscope-type idimporting-scripts-and-libraries:concept-workerglobalscope-type>type/a> is code>module/code>, throw a code idimporting-scripts-and-libraries:typeerror>a data-x-internaltypeerror hrefhttps://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror>TypeError/a>/code> exception and abort these steps.li>p>Let var>settings object/var> be the a href#current-settings-object idimporting-scripts-and-libraries:current-settings-object>current settings object/a>.li>p>If var>urls/var> is empty, abort these steps.li>p>a href#parse-a-url idimporting-scripts-and-libraries:parse-a-url>Parse/a> each value in var>urls/var> relative to var>settings object/var>. If any fail, throw a a idimporting-scripts-and-libraries:syntaxerror hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idimporting-scripts-and-libraries:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li> p>For each var>url/var> in the a href#resulting-url-record idimporting-scripts-and-libraries:resulting-url-record>resulting URL records/a>, run these substeps:/p> ol>li>p>a href#fetch-a-classic-worker-imported-script idimporting-scripts-and-libraries:fetch-a-classic-worker-imported-script-2>Fetch a classic worker-imported script/a> given var>url/var> and var>settings object/var>, passing along any custom a href#fetching-scripts-perform-fetch idimporting-scripts-and-libraries:fetching-scripts-perform-fetch-2>perform the fetch/a> steps provided. If this succeeds, let var>script/var> be the result. Otherwise, rethrow the exception.li> p>a href#run-a-classic-script idimporting-scripts-and-libraries:run-a-classic-script>Run the classic script/a> var>script/var>, with the rethrow errors argument set to true./p> p classnote>var>script/var> will run until it either returns, fails to parse, fails to catch an exception, or gets a href#abort-a-running-script idimporting-scripts-and-libraries:abort-a-running-script>prematurely aborted/a> by the a href#terminate-a-worker idimporting-scripts-and-libraries:terminate-a-worker>terminate a worker/a> algorithm defined above./p> p>If an exception was thrown or if the script was a href#abort-a-running-script idimporting-scripts-and-libraries:abort-a-running-script-2>prematurely aborted/a>, then abort all these steps, letting the exception or aborting continue to be processed by the calling a href#concept-script idimporting-scripts-and-libraries:concept-script>script/a>./p> /ol> /ol> p classnote>cite>Service Workers/cite> is an example of a specification that runs this algorithm with its own options for the a href#fetching-scripts-perform-fetch idimporting-scripts-and-libraries:fetching-scripts-perform-fetch-3>perform the fetch/a> hook. a href#refsSW>SW/a>/p> h4 idthe-workernavigator-object>span classsecno>10.3.2/span> The code idthe-workernavigator-object:workernavigator>a href#workernavigator>WorkerNavigator/a>/code> interfacea href#the-workernavigator-object classself-link>/a>/h4> p>The dfn iddom-worker-navigator>code>navigator/code>/dfn> attribute of the code idthe-workernavigator-object:workerglobalscope>a href#workerglobalscope>WorkerGlobalScope/a>/code> interface must return an instance of the code idthe-workernavigator-object:workernavigator-2>a href#workernavigator>WorkerNavigator/a>/code> interface, which represents the identity and state of the user agent (the client):/p> pre classidl>ExposedWorkerinterface dfn idworkernavigator>WorkerNavigator/dfn> {};a href#workernavigator idthe-workernavigator-object:workernavigator-3>WorkerNavigator/a> implements a href#navigatorid idthe-workernavigator-object:navigatorid>NavigatorID/a>;a href#workernavigator idthe-workernavigator-object:workernavigator-4>WorkerNavigator/a> implements a href#navigatorlanguage idthe-workernavigator-object:navigatorlanguage>NavigatorLanguage/a>;a href#workernavigator idthe-workernavigator-object:workernavigator-5>WorkerNavigator/a> implements a href#navigatoronline idthe-workernavigator-object:navigatoronline>NavigatorOnLine/a>;a href#workernavigator idthe-workernavigator-object:workernavigator-6>WorkerNavigator/a> implements a href#navigatorconcurrenthardware idthe-workernavigator-object:navigatorconcurrenthardware>NavigatorConcurrentHardware/a>;/pre> h4 idworker-locations>span classsecno>10.3.3/span> The code idworker-locations:workerlocation>a href#workerlocation>WorkerLocation/a>/code> interfacea href#worker-locations classself-link>/a>/h4> pre classidl>ExposedWorkerinterface dfn idworkerlocation>WorkerLocation/dfn> { stringifier readonly attribute USVString a href#dom-workerlocation-href idworker-locations:dom-workerlocation-href>href/a>; readonly attribute USVString a href#dom-workerlocation-origin idworker-locations:dom-workerlocation-origin>origin/a>; readonly attribute USVString a href#dom-workerlocation-protocol idworker-locations:dom-workerlocation-protocol>protocol/a>; readonly attribute USVString a href#dom-workerlocation-host idworker-locations:dom-workerlocation-host>host/a>; readonly attribute USVString a href#dom-workerlocation-hostname idworker-locations:dom-workerlocation-hostname>hostname/a>; readonly attribute USVString a href#dom-workerlocation-port idworker-locations:dom-workerlocation-port>port/a>; readonly attribute USVString a href#dom-workerlocation-pathname idworker-locations:dom-workerlocation-pathname>pathname/a>; readonly attribute USVString a href#dom-workerlocation-search idworker-locations:dom-workerlocation-search>search/a>; readonly attribute USVString a href#dom-workerlocation-hash idworker-locations:dom-workerlocation-hash>hash/a>;};/pre> p>A code idworker-locations:workerlocation-2>a href#workerlocation>WorkerLocation/a>/code> object has an associated dfn idconcept-workerlocation-workerglobalscope>code>WorkerGlobalScope/code> object/dfn> (a code idworker-locations:workerglobalscope>a href#workerglobalscope>WorkerGlobalScope/a>/code> object). p>The dfn iddom-workerlocation-href>code>href/code>/dfn> attributes getter must return the associated a href#concept-workerlocation-workerglobalscope idworker-locations:concept-workerlocation-workerglobalscope>code>WorkerGlobalScope/code> object/a>s a href#concept-workerglobalscope-url idworker-locations:concept-workerglobalscope-url>url/a>, a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idworker-locations:concept-url-serializer data-x-internalconcept-url-serializer>serialized/a>./p> p>The dfn iddom-workerlocation-origin>code>origin/code>/dfn> attributes getter must return the a href#ascii-serialisation-of-an-origin idworker-locations:ascii-serialisation-of-an-origin>serialization/a> of the associated a href#concept-workerlocation-workerglobalscope idworker-locations:concept-workerlocation-workerglobalscope-2>code>WorkerGlobalScope/code> object/a>s a href#concept-workerglobalscope-url idworker-locations:concept-workerglobalscope-url-2>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-origin idworker-locations:concept-url-origin data-x-internalconcept-url-origin>origin/a>./p> p>The dfn iddom-workerlocation-protocol>code>protocol/code>/dfn> attributes getter must return the associated a href#concept-workerlocation-workerglobalscope idworker-locations:concept-workerlocation-workerglobalscope-3>code>WorkerGlobalScope/code> object/a>s a href#concept-workerglobalscope-url idworker-locations:concept-workerglobalscope-url-3>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-scheme idworker-locations:concept-url-scheme data-x-internalconcept-url-scheme>scheme/a>, followed by code>:/code>./p> p>The dfn iddom-workerlocation-host>code>host/code>/dfn> attributes getter must run these steps:/p> ol>li>p>Let var>url/var> be the associated a href#concept-workerlocation-workerglobalscope idworker-locations:concept-workerlocation-workerglobalscope-4>code>WorkerGlobalScope/code> object/a>s a href#concept-workerglobalscope-url idworker-locations:concept-workerglobalscope-url-4>url/a>.li>p>If var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-host idworker-locations:concept-url-host data-x-internalconcept-url-host>host/a> is null, return the empty string.li>p>If var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-port idworker-locations:concept-url-port data-x-internalconcept-url-port>port/a> is null, return var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-host idworker-locations:concept-url-host-2 data-x-internalconcept-url-host>host/a>, a hrefhttps://url.spec.whatwg.org/#concept-host-serializer idworker-locations:host-serializer data-x-internalhost-serializer>serialized/a>.li>p>Return var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-host idworker-locations:concept-url-host-3 data-x-internalconcept-url-host>host/a>, a hrefhttps://url.spec.whatwg.org/#concept-host-serializer idworker-locations:host-serializer-2 data-x-internalhost-serializer>serialized/a>, followed by code>:/code> and var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-port idworker-locations:concept-url-port-2 data-x-internalconcept-url-port>port/a>, a hrefhttps://url.spec.whatwg.org/#serialize-an-integer idworker-locations:serialize-an-integer data-x-internalserialize-an-integer>serialized/a>./ol> p>The dfn iddom-workerlocation-hostname>code>hostname/code>/dfn> attributes getter must run these steps:/p> ol>li>p>Let var>host/var> be the associated a href#concept-workerlocation-workerglobalscope idworker-locations:concept-workerlocation-workerglobalscope-5>code>WorkerGlobalScope/code> object/a>s a href#concept-workerglobalscope-url idworker-locations:concept-workerglobalscope-url-5>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-host idworker-locations:concept-url-host-4 data-x-internalconcept-url-host>host/a>.li>p>If var>host/var> is null, return the empty string.li>p>Return var>host/var>, a hrefhttps://url.spec.whatwg.org/#concept-host-serializer idworker-locations:host-serializer-3 data-x-internalhost-serializer>serialized/a>./ol> p>The dfn iddom-workerlocation-port>code>port/code>/dfn> attributes getter must run these steps:/p> ol>li>p>Let var>port/var> be the associated a href#concept-workerlocation-workerglobalscope idworker-locations:concept-workerlocation-workerglobalscope-6>code>WorkerGlobalScope/code> object/a>s a href#concept-workerglobalscope-url idworker-locations:concept-workerglobalscope-url-6>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-port idworker-locations:concept-url-port-3 data-x-internalconcept-url-port>port/a>.li>p>If var>port/var> is null, return the empty string.li>p>Return var>port/var>, a hrefhttps://url.spec.whatwg.org/#serialize-an-integer idworker-locations:serialize-an-integer-2 data-x-internalserialize-an-integer>serialized/a>./ol> p>The dfn iddom-workerlocation-pathname>code>pathname/code>/dfn> attributes getter must run these steps:/p> ol>li>p>Let var>url/var> be the associated a href#concept-workerlocation-workerglobalscope idworker-locations:concept-workerlocation-workerglobalscope-7>code>WorkerGlobalScope/code> object/a>s a href#concept-workerglobalscope-url idworker-locations:concept-workerglobalscope-url-7>url/a>.li>p>If var>url/var>s a idworker-locations:cannot-be-a-base-url-flag hrefhttps://url.spec.whatwg.org/#url-cannot-be-a-base-url-flag data-x-internalcannot-be-a-base-url-flag>cannot-be-a-base-URL flag/a> is set, return the first string in var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-path idworker-locations:concept-url-path data-x-internalconcept-url-path>path/a>.li>p>Return code>//code>, followed by the strings in var>url/var>s a hrefhttps://url.spec.whatwg.org/#concept-url-path idworker-locations:concept-url-path-2 data-x-internalconcept-url-path>path/a> (including empty strings), separated from each other by code>//code>./ol> p>The dfn iddom-workerlocation-search>code>search/code>/dfn> attributes getter must run these steps:/p> ol>li>p>Let var>query/var> be the associated a href#concept-workerlocation-workerglobalscope idworker-locations:concept-workerlocation-workerglobalscope-8>code>WorkerGlobalScope/code> object/a>s a href#concept-workerglobalscope-url idworker-locations:concept-workerglobalscope-url-8>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-query idworker-locations:concept-url-query data-x-internalconcept-url-query>query/a>.li>p>If var>query/var> is either null or the empty string, return the empty string.li>p>Return code>?/code>, followed by var>query/var>./ol> p>The dfn iddom-workerlocation-hash>code>hash/code>/dfn> attributes getter must run these steps:/p> ol>li>p>Let var>fragment/var> be the associated a href#concept-workerlocation-workerglobalscope idworker-locations:concept-workerlocation-workerglobalscope-9>code>WorkerGlobalScope/code> object/a>s a href#concept-workerglobalscope-url idworker-locations:concept-workerglobalscope-url-9>url/a>s a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idworker-locations:concept-url-fragment data-x-internalconcept-url-fragment>fragment/a>.li>p>If var>fragment/var> is either null or the empty string, return the empty string.li>p>Return code>#/code>, followed by var>fragment/var>./ol> h2 idwebstorage>span classsecno>11/span> Web storagea href#webstorage classself-link>/a>/h2> h3 idintroduction-15>span classsecno>11.1/span> Introductiona href#introduction-15 classself-link>/a>/h3> p>i>This section is non-normative./i>/p> p>This specification introduces two related mechanisms, similar to HTTP session cookies, for storing name-value pairs on the client side. a href#refsCOOKIES>COOKIES/a>/p> p>The first is designed for scenarios where the user is carrying out a single transaction, but could be carrying out multiple transactions in different windows at the same time./p> p>Cookies dont really handle this case well. For example, a user could be buying plane tickets in two different windows, using the same site. If the site used cookies to keep track of which ticket the user was buying, then as the user clicked from page to page in both windows, the ticket currently being purchased would leak from one window to the other, potentially causing the user to buy two tickets for the same flight without really noticing./p> p>To address this, this specification introduces the code idintroduction-15:dom-sessionstorage>a href#dom-sessionstorage>sessionStorage/a>/code> IDL attribute. Sites can add data to the session storage, and it will be accessible to any page from the same site opened in that window./p> div classexample> p>For example, a page could have a checkbox that the user ticks to indicate that they want insurance:/p> pre><label> <input typecheckbox onchangesessionStorage.insurance checked ? true : > I want insurance on this trip.</label>/pre> p>A later page could then check, from script, whether the user had checked the checkbox or not:/p> pre>if (sessionStorage.insurance) { ... }/pre> p>If the user had multiple windows opened on the site, each one would have its own individual copy of the session storage object./p> /div> p>The second storage mechanism is designed for storage that spans multiple windows, and lasts beyond the current session. In particular, Web applications may wish to store megabytes of user data, such as entire user-authored documents or a users mailbox, on the client side for performance reasons./p> p>Again, cookies do not handle this case well, because they are transmitted with every request./p> p>The code idintroduction-15:dom-localstorage>a href#dom-localstorage>localStorage/a>/code> IDL attribute is used to access a pages local storage area./p> div classexample> p>The site at example.com can display a count of how many times the user has loaded its page by putting the following at the bottom of its page:/p> pre><p> You have viewed this page <span idcount>an untold number of</span> time(s).</p><script> if (!localStorage.pageLoadCount) localStorage.pageLoadCount 0; localStorage.pageLoadCount parseInt(localStorage.pageLoadCount) + 1; document.getElementById(count).textContent localStorage.pageLoadCount;</script>/pre> /div> p>Each site has its own separate storage area./p> h3 idstorage>span classsecno>11.2/span> The APIa href#storage classself-link>/a>/h3>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> namevalue-storagespan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>3.2+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>3.5+/span>/span>span classie yes>span>IE/span> span>8+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>4+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.1+/span>/span>span classopera yes>span>Opera/span> span>10.5+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featnamevalue-storage>caniuse.com/a>/div> h4 idthe-storage-interface>span classsecno>11.2.1/span> The code idthe-storage-interface:storage-2>a href#storage-2>Storage/a>/code> interfacea href#the-storage-interface classself-link>/a>/h4> pre classidl>ExposedWindowinterface dfn idstorage-2>Storage/dfn> { readonly attribute unsigned long a href#dom-storage-length idthe-storage-interface:dom-storage-length>length/a>; DOMString? a href#dom-storage-key idthe-storage-interface:dom-storage-key>key/a>(unsigned long index); getter DOMString? a href#dom-storage-getitem idthe-storage-interface:dom-storage-getitem>getItem/a>(DOMString key); setter void a href#dom-storage-setitem idthe-storage-interface:dom-storage-setitem>setItem/a>(DOMString key, DOMString value); deleter void a href#dom-storage-removeitem idthe-storage-interface:dom-storage-removeitem>removeItem/a>(DOMString key); void a href#dom-storage-clear idthe-storage-interface:dom-storage-clear>clear/a>();};/pre> p>Each code idthe-storage-interface:storage-2-2>a href#storage-2>Storage/a>/code> object provides access to a list of key/value pairs, which are sometimes called items. Keys are strings. Any string (including the empty string) is a valid key. Values are similarly strings./p> p>Each code idthe-storage-interface:storage-2-3>a href#storage-2>Storage/a>/code> object is associated with a list of key/value pairs when it is created, as defined in the sections on the code idthe-storage-interface:dom-sessionstorage>a href#dom-sessionstorage>sessionStorage/a>/code> and code idthe-storage-interface:dom-localstorage>a href#dom-localstorage>localStorage/a>/code> attributes. Multiple separate objects implementing the code idthe-storage-interface:storage-2-4>a href#storage-2>Storage/a>/code> interface can all be associated with the same list of key/value pairs simultaneously./p> p>The dfn iddom-storage-length>code>length/code>/dfn> attribute must return the number of key/value pairs currently present in the list associated with the object./p> p>The dfn iddom-storage-key>code>key(var>n/var>)/code>/dfn> method must return the name of the var>n/var>th key in the list. The order of keys is user-agent defined, but must be consistent within an object so long as the number of keys doesnt change. (Thus, a href#dom-storage-setitem idthe-storage-interface:dom-storage-setitem-2>adding/a> or a href#dom-storage-removeitem idthe-storage-interface:dom-storage-removeitem-2>removing/a> a key may change the order of the keys, but merely changing the value of an existing key must not.) If var>n/var> is greater than or equal to the number of key/value pairs in the object, then this method must return null./p> p>The a idthe-storage-interface:supported-property-names hrefhttps://heycam.github.io/webidl/#dfn-supported-property-names data-x-internalsupported-property-names>supported property names/a> on a code idthe-storage-interface:storage-2-5>a href#storage-2>Storage/a>/code> object are the keys of each key/value pair currently present in the list associated with the object, in the order that the keys were last added to the storage area./p> p>The dfn iddom-storage-getitem>code>getItem(var>key/var>)/code>/dfn> method must return the current value associated with the given var>key/var>. If the given var>key/var> does not exist in the list associated with the object then this method must return null. /p> p>The dfn iddom-storage-setitem>code>setItem(var>key/var>, var>value/var>)/code>/dfn> method must first check if a key/value pair with the given var>key/var> already exists in the list associated with the object./p> p>If it does not, then a new key/value pair must be added to the list, with the given var>key/var> and with its value set to var>value/var>./p> p>If the given var>key/var> em>does/em> exist in the list, and its value is not equal to var>value/var>, then it must have its value updated to var>value/var>. If its previous value em>is/em> equal to var>value/var>, then the method must do nothing./p> p>If it couldnt set the new value, the method must throw a a idthe-storage-interface:quotaexceedederror hrefhttps://heycam.github.io/webidl/#quotaexceedederror data-x-internalquotaexceedederror>code>QuotaExceededError/code>/a> code idthe-storage-interface:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> exception. (Setting could fail if, e.g., the user has disabled storage for the site, or if the quota has been exceeded.)/p> p>The dfn iddom-storage-removeitem>code>removeItem(var>key/var>)/code>/dfn> method must cause the key/value pair with the given var>key/var> to be removed from the list associated with the object, if it exists. If no item with that key exists, the method must do nothing./p> p>The code idthe-storage-interface:dom-storage-setitem-3>a href#dom-storage-setitem>setItem()/a>/code> and code idthe-storage-interface:dom-storage-removeitem-3>a href#dom-storage-removeitem>removeItem()/a>/code> methods must be atomic with respect to failure. In the case of failure, the method does nothing. That is, changes to the data storage area must either be successful, or the data storage area must not be changed at all./p> p>The dfn iddom-storage-clear>code>clear()/code>/dfn> method must atomically cause the list associated with the object to be emptied of all key/value pairs, if there are any. If there are none, then the method must do nothing./p> p classnote>When the code idthe-storage-interface:dom-storage-setitem-4>a href#dom-storage-setitem>setItem()/a>/code>, code idthe-storage-interface:dom-storage-removeitem-4>a href#dom-storage-removeitem>removeItem()/a>/code>, and code idthe-storage-interface:dom-storage-clear-2>a href#dom-storage-clear>clear()/a>/code> methods are invoked, events are fired on the code idthe-storage-interface:window>a href#window>Window/a>/code> objects of other code idthe-storage-interface:document>a href#document>Document/a>/code>s that can access the newly stored or removed data, as defined in the sections on the code idthe-storage-interface:dom-sessionstorage-2>a href#dom-sessionstorage>sessionStorage/a>/code> and code idthe-storage-interface:dom-localstorage-2>a href#dom-localstorage>localStorage/a>/code> attributes./p> p classnote>This specification does not require that the above methods wait until the data has been physically written to disk. Only consistency in what different scripts accessing the same underlying list of key/value pairs see is required./p> h4 idthe-sessionstorage-attribute>span classsecno>11.2.2/span> The code idthe-sessionstorage-attribute:dom-sessionstorage>a href#dom-sessionstorage>sessionStorage/a>/code> attributea href#the-sessionstorage-attribute classself-link>/a>/h4> pre classidl>ExposedWindow, NoInterfaceObjectinterface dfn idwindowsessionstorage>WindowSessionStorage/dfn> { readonly attribute a href#storage-2 idthe-sessionstorage-attribute:storage-2>Storage/a> a href#dom-sessionstorage idthe-sessionstorage-attribute:dom-sessionstorage-2>sessionStorage/a>;};a href#window idthe-sessionstorage-attribute:window>Window/a> implements a href#windowsessionstorage idthe-sessionstorage-attribute:windowsessionstorage>WindowSessionStorage/a>;/pre> p>The dfn iddom-sessionstorage>code>sessionStorage/code>/dfn> attribute represents the set of storage areas specific to the current a href#top-level-browsing-context idthe-sessionstorage-attribute:top-level-browsing-context>top-level browsing context/a>./p> p>Each a href#top-level-browsing-context idthe-sessionstorage-attribute:top-level-browsing-context-2>top-level browsing context/a> has a unique set of session storage areas, one for each a href#concept-origin idthe-sessionstorage-attribute:concept-origin>origin/a>./p> p>User agents should not expire data from a browsing contexts session storage areas, but may do so when the user requests that such data be deleted, or when the UA detects that it has limited storage space, or for security reasons. User agents should always avoid deleting data while a script that could access that data is running. When a top-level browsing context is destroyed (and therefore permanently inaccessible to the user) the data stored in its session storage areas can be discarded with it, as the API described in this specification provides no way for that data to ever be subsequently retrieved./p> p classnote>The lifetime of a browsing context can be unrelated to the lifetime of the actual user agent process itself, as the user agent can support resuming sessions after a restart./p> p>When a new code idthe-sessionstorage-attribute:document>a href#document>Document/a>/code> is created in a a href#browsing-context idthe-sessionstorage-attribute:browsing-context>browsing context/a> which has a a href#top-level-browsing-context idthe-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 idthe-sessionstorage-attribute:top-level-browsing-context-4>top-level browsing context/a> has a session storage area for that documents a href#concept-origin idthe-sessionstorage-attribute:concept-origin-2>origin/a>. If it does, then that is the code idthe-sessionstorage-attribute:document-2>a href#document>Document/a>/code>s assigned session storage area. If it does not, a new storage area for that documents a href#concept-origin idthe-sessionstorage-attribute:concept-origin-3>origin/a> must be created, and then em>that/em> is the code idthe-sessionstorage-attribute:document-3>a href#document>Document/a>/code>s assigned session storage area. A code idthe-sessionstorage-attribute:document-4>a href#document>Document/a>/code>s assigned storage area does not change during the lifetime of a code idthe-sessionstorage-attribute:document-5>a href#document>Document/a>/code>./p> p classnote>In the case of an code idthe-sessionstorage-attribute:the-iframe-element>a href#the-iframe-element>iframe/a>/code> being moved to another code idthe-sessionstorage-attribute:document-6>a href#document>Document/a>/code>, the nested browsing context is destroyed and a new one created./p> p>The code idthe-sessionstorage-attribute:dom-sessionstorage-3>a href#dom-sessionstorage>sessionStorage/a>/code> attribute must return a code idthe-sessionstorage-attribute:storage-2-2>a href#storage-2>Storage/a>/code> object associated with the code idthe-sessionstorage-attribute:document-7>a href#document>Document/a>/code>s assigned session storage area, if any, or null if there isnt one. Each code idthe-sessionstorage-attribute:document-8>a href#document>Document/a>/code> object must have a separate object for its code idthe-sessionstorage-attribute:window-2>a href#window>Window/a>/code>s code idthe-sessionstorage-attribute:dom-sessionstorage-4>a href#dom-sessionstorage>sessionStorage/a>/code> attribute./p> p>While a href#creating-a-new-browsing-context idthe-sessionstorage-attribute:creating-a-new-browsing-context>creating a new browsing context/a>, the session storage area a href#copy-session-storage>is sometimes copied/a> over./p> p idsessionStorageEvent>When the code idthe-sessionstorage-attribute:dom-storage-setitem>a href#dom-storage-setitem>setItem()/a>/code>, code idthe-sessionstorage-attribute:dom-storage-removeitem>a href#dom-storage-removeitem>removeItem()/a>/code>, and code idthe-sessionstorage-attribute:dom-storage-clear>a href#dom-storage-clear>clear()/a>/code> methods are called on a code idthe-sessionstorage-attribute:storage-2-3>a href#storage-2>Storage/a>/code> object var>x/var> that is associated with a session storage area, if the methods did not throw an exception or do nothing as defined above, then for every code idthe-sessionstorage-attribute:document-9>a href#document>Document/a>/code> object whose code idthe-sessionstorage-attribute:window-3>a href#window>Window/a>/code> objects code idthe-sessionstorage-attribute:dom-sessionstorage-5>a href#dom-sessionstorage>sessionStorage/a>/code> attributes code idthe-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 idthe-sessionstorage-attribute:send-a-storage-notification>send a storage notification/a>./p> h4 idthe-localstorage-attribute>span classsecno>11.2.3/span> The code idthe-localstorage-attribute:dom-localstorage>a href#dom-localstorage>localStorage/a>/code> attributea href#the-localstorage-attribute classself-link>/a>/h4> pre classidl>ExposedWindow, NoInterfaceObjectinterface dfn idwindowlocalstorage>WindowLocalStorage/dfn> { readonly attribute a href#storage-2 idthe-localstorage-attribute:storage-2>Storage/a> a href#dom-localstorage idthe-localstorage-attribute:dom-localstorage-2>localStorage/a>;};a href#window idthe-localstorage-attribute:window>Window/a> implements a href#windowlocalstorage idthe-localstorage-attribute:windowlocalstorage>WindowLocalStorage/a>;/pre> p>The dfn iddom-localstorage>code>localStorage/code>/dfn> object provides a code idthe-localstorage-attribute:storage-2-2>a href#storage-2>Storage/a>/code> object for an a href#concept-origin idthe-localstorage-attribute:concept-origin>origin/a>. a href#fingerprinting-vector idthe-localstorage-attribute:fingerprinting-vector classfingerprint titleThere is a potential fingerprinting vector here.>img alt(This is a fingerprinting vector.) src/images/fingerprint.png width46 height64>/a> /p> p>User agents must have a set of local storage areas, one for each a href#concept-origin idthe-localstorage-attribute:concept-origin-2>origin/a>./p> p>User agents should expire data from the local storage areas only for security reasons or when requested to do so by the user. User agents should always avoid deleting data while a script that could access that data is running./p> p>When the code idthe-localstorage-attribute:dom-localstorage-3>a href#dom-localstorage>localStorage/a>/code> attribute is accessed, the user agent must run the following steps, which are known as the dfn idstorage-object-initialisation-steps>code>Storage/code> object initialization steps/dfn>:/p> ol>li>p>The user agent may throw a a idthe-localstorage-attribute:securityerror hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-localstorage-attribute:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps instead of returning a code idthe-localstorage-attribute:storage-2-3>a href#storage-2>Storage/a>/code> object if the request violates a policy decisions (e.g. if the user agent is configured to not allow the page to persist data).li>p>If the code idthe-localstorage-attribute:document>a href#document>Document/a>/code>s a href#concept-origin idthe-localstorage-attribute:concept-origin-3>origin/a> is an a href#concept-origin-opaque idthe-localstorage-attribute:concept-origin-opaque>opaque origin/a>, then throw a a idthe-localstorage-attribute:securityerror-2 hrefhttps://heycam.github.io/webidl/#securityerror data-x-internalsecurityerror>code>SecurityError/code>/a> code idthe-localstorage-attribute:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps.li>p>Check to see if the user agent has allocated a local storage area for the a href#concept-origin idthe-localstorage-attribute:concept-origin-4>origin/a> of the code idthe-localstorage-attribute:document-2>a href#document>Document/a>/code> of the code idthe-localstorage-attribute:window-2>a href#window>Window/a>/code> object on which the attribute was accessed. If it has not, create a new storage area for that a href#concept-origin idthe-localstorage-attribute:concept-origin-5>origin/a>.li>p>Return the code idthe-localstorage-attribute:storage-2-4>a href#storage-2>Storage/a>/code> object associated with that origins local storage area. Each code idthe-localstorage-attribute:document-3>a href#document>Document/a>/code> object must have a separate object for its code idthe-localstorage-attribute:window-3>a href#window>Window/a>/code>s code idthe-localstorage-attribute:dom-localstorage-4>a href#dom-localstorage>localStorage/a>/code> attribute./p> /ol> p idlocalStorageEvent>When the code idthe-localstorage-attribute:dom-storage-setitem>a href#dom-storage-setitem>setItem()/a>/code>, code idthe-localstorage-attribute:dom-storage-removeitem>a href#dom-storage-removeitem>removeItem()/a>/code>, and code idthe-localstorage-attribute:dom-storage-clear>a href#dom-storage-clear>clear()/a>/code> methods are called on a code idthe-localstorage-attribute:storage-2-5>a href#storage-2>Storage/a>/code> object var>x/var> that is associated with a local storage area, if the methods did not throw an exception or do nothing as defined above, then for every code idthe-localstorage-attribute:document-4>a href#document>Document/a>/code> object whose code idthe-localstorage-attribute:window-4>a href#window>Window/a>/code> objects code idthe-localstorage-attribute:dom-localstorage-5>a href#dom-localstorage>localStorage/a>/code> attributes code idthe-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 idthe-localstorage-attribute:send-a-storage-notification>send a storage notification/a>. p classwarning>The code idthe-localstorage-attribute:dom-localstorage-6>a href#dom-localstorage>localStorage/a>/code> attribute provides access to shared state. This specification does not define the interaction with other browsing contexts in a multiprocess user agent, and authors are encouraged to assume that there is no locking mechanism. A site could, for instance, try to read the value of a key, increment its value, then write it back out, using the new value as a unique identifier for the session; if the site does this twice in two different browser windows at the same time, it might end up using the same unique identifier for both sessions, with potentially disastrous effects./p> h4 idthe-storage-event>span classsecno>11.2.4/span> The code idthe-storage-event:event-storage>a href#event-storage>storage/a>/code> eventa href#the-storage-event classself-link>/a>/h4> p>The code idthe-storage-event:event-storage-2>a href#event-storage>storage/a>/code> event is fired on a code idthe-storage-event:document>a href#document>Document/a>/code>s code idthe-storage-event:window>a href#window>Window/a>/code> object when a storage area changes, as described in the previous two sections (a href#sessionStorageEvent>for session storage/a>, a href#localStorageEvent>for local storage/a>)./p> p>When a user agent is to dfn idsend-a-storage-notification>send a storage notification/dfn> for a code idthe-storage-event:document-2>a href#document>Document/a>/code>, the user agent must a href#queue-a-task idthe-storage-event:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-storage-event:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idthe-storage-event:storage-2>a href#storage-2>storage/a>/code> at the code idthe-storage-event:document-3>a href#document>Document/a>/code> objects code idthe-storage-event:window-2>a href#window>Window/a>/code> object, using code idthe-storage-event:storageevent>a href#storageevent>StorageEvent/a>/code>./p> p classnote>Such a code idthe-storage-event:document-4>a href#document>Document/a>/code> object is not necessarily a href#fully-active idthe-storage-event:fully-active>fully active/a>, but events fired on such objects are ignored by the a href#event-loop idthe-storage-event:event-loop>event loop/a> until the code idthe-storage-event:document-5>a href#document>Document/a>/code> becomes a href#fully-active idthe-storage-event:fully-active-2>fully active/a> again./p> p>The a href#task-source idthe-storage-event:task-source>task source/a> for these tasks is the a href#dom-manipulation-task-source idthe-storage-event:dom-manipulation-task-source>DOM manipulation task source/a>./p> p>If the event is being fired due to an invocation of the code idthe-storage-event:dom-storage-setitem>a href#dom-storage-setitem>setItem()/a>/code> or code idthe-storage-event:dom-storage-removeitem>a href#dom-storage-removeitem>removeItem()/a>/code> methods, the event must have its code idthe-storage-event:dom-storageevent-key>a href#dom-storageevent-key>key/a>/code> attribute initialized to the name of the key in question, its code idthe-storage-event:dom-storageevent-oldvalue>a href#dom-storageevent-oldvalue>oldValue/a>/code> attribute initialized to the old value of the key in question, or null if the key is newly added, and its code idthe-storage-event:dom-storageevent-newvalue>a href#dom-storageevent-newvalue>newValue/a>/code> attribute initialized to the new value of the key in question, or null if the key was removed./p> p>Otherwise, if the event is being fired due to an invocation of the code idthe-storage-event:dom-storage-clear>a href#dom-storage-clear>clear()/a>/code> method, the event must have its code idthe-storage-event:dom-storageevent-key-2>a href#dom-storageevent-key>key/a>/code>, code idthe-storage-event:dom-storageevent-oldvalue-2>a href#dom-storageevent-oldvalue>oldValue/a>/code>, and code idthe-storage-event:dom-storageevent-newvalue-2>a href#dom-storageevent-newvalue>newValue/a>/code> attributes initialized to null./p> p>In addition, the event must have its code idthe-storage-event:dom-storageevent-url>a href#dom-storageevent-url>url/a>/code> attribute initialized to the a hrefhttps://dom.spec.whatwg.org/#concept-document-url idthe-storage-event:the-documents-address data-x-internalthe-documents-address>URL/a> of the document whose code idthe-storage-event:storage-2-2>a href#storage-2>Storage/a>/code> object was affected; and its code idthe-storage-event:dom-storageevent-storagearea>a href#dom-storageevent-storagearea>storageArea/a>/code> attribute initialized to the code idthe-storage-event:storage-2-3>a href#storage-2>Storage/a>/code> object from the code idthe-storage-event:window-3>a href#window>Window/a>/code> object of the target code idthe-storage-event:document-6>a href#document>Document/a>/code> that represents the same kind of code idthe-storage-event:storage-2-4>a href#storage-2>Storage/a>/code> area as was affected (i.e. session or local)./p> h5 idthe-storageevent-interface>span classsecno>11.2.4.1/span> The code idthe-storageevent-interface:storageevent>a href#storageevent>StorageEvent/a>/code> interfacea href#the-storageevent-interface classself-link>/a>/h5> pre classidl>ExposedWindow, Constructor(DOMString type, optional a href#storageeventinit idthe-storageevent-interface:storageeventinit>StorageEventInit/a> eventInitDict)interface dfn idstorageevent>StorageEvent/dfn> : a idthe-storageevent-interface:event hrefhttps://dom.spec.whatwg.org/#interface-event data-x-internalevent>Event/a> { readonly attribute DOMString? a href#dom-storageevent-key idthe-storageevent-interface:dom-storageevent-key>key/a>; readonly attribute DOMString? a href#dom-storageevent-oldvalue idthe-storageevent-interface:dom-storageevent-oldvalue>oldValue/a>; readonly attribute DOMString? a href#dom-storageevent-newvalue idthe-storageevent-interface:dom-storageevent-newvalue>newValue/a>; readonly attribute USVString a href#dom-storageevent-url idthe-storageevent-interface:dom-storageevent-url>url/a>; readonly attribute a href#storage-2 idthe-storageevent-interface:storage-2>Storage/a>? a href#dom-storageevent-storagearea idthe-storageevent-interface:dom-storageevent-storagearea>storageArea/a>;};dictionary dfn idstorageeventinit>StorageEventInit/dfn> : a idthe-storageevent-interface:eventinit hrefhttps://dom.spec.whatwg.org/#dictdef-eventinit data-x-internaleventinit>EventInit/a> { DOMString? key null; DOMString? oldValue null; DOMString? newValue null; USVString url ; a href#storage-2 idthe-storageevent-interface:storage-2-2>Storage/a>? storageArea null;};/pre> p>The dfn iddom-storageevent-key>code>key/code>/dfn> attribute must return the value it was initialized to. It represents the key being changed./p> p>The dfn iddom-storageevent-oldvalue>code>oldValue/code>/dfn> attribute must return the value it was initialized to. It represents the old value of the key being changed./p> p>The dfn iddom-storageevent-newvalue>code>newValue/code>/dfn> attribute must return the value it was initialized to. It represents the new value of the key being changed./p> p>The dfn iddom-storageevent-url>code>url/code>/dfn> attribute must return the value it was initialized to. It represents the a idthe-storageevent-interface:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> of the document whose key changed./p> p>The dfn iddom-storageevent-storagearea>code>storageArea/code>/dfn> attribute must return the value it was initialized to. It represents the code idthe-storageevent-interface:storage-2-3>a href#storage-2>Storage/a>/code> object that was affected./p> h3 iddisk-space-2>span classsecno>11.3/span> Disk spacea href#disk-space-2 classself-link>/a>/h3> p>User agents should limit the total amount of space allowed for storage areas, because hostile authors could otherwise use this feature to exhaust the users available disk space./p> p>User agents should guard against sites storing data under their origins other affiliated sites, e.g. storing up to the limit in a1.example.com, a2.example.com, a3.example.com, etc, circumventing the main example.com storage limit./p> p>User agents may prompt the user when quotas are reached, allowing the user to grant a site more space. This enables sites to store many user-created documents on the users computer, for instance./p> p>User agents should allow users to see how much space each domain is using./p> p>A mostly arbitrary limit of five megabytes per a href#concept-origin iddisk-space-2:concept-origin>origin/a> is suggested. Implementation feedback is welcome and will be used to update this suggestion in the future./p> p>For predictability, quotas should be based on the uncompressed size of data stored./p> h3 idprivacy>span classsecno>11.4/span> Privacya href#privacy classself-link>/a>/h3> h4 iduser-tracking>span classsecno>11.4.1/span> User trackinga href#user-tracking classself-link>/a>/h4> p>A third-party advertiser (or any entity capable of getting content distributed to multiple sites) could use a unique identifier stored in its local storage area to track a user across multiple sessions, building a profile of the users interests to allow for highly targeted advertising. In conjunction with a site that is aware of the users real identity (for example an e-commerce site that requires authenticated credentials), this could allow oppressive groups to target individuals with greater accuracy than in a world with purely anonymous Web usage./p> p>There are a number of techniques that can be used to mitigate the risk of user tracking:/p> dl>dt>Blocking third-party storagedd> p>User agents may restrict access to the code iduser-tracking:dom-localstorage>a href#dom-localstorage>localStorage/a>/code> objects to scripts originating at the domain of the a href#active-document iduser-tracking:active-document>active document/a> of the a href#top-level-browsing-context iduser-tracking:top-level-browsing-context>top-level browsing context/a>, for instance denying access to the API for pages from other domains running in code iduser-tracking:the-iframe-element>a href#the-iframe-element>iframe/a>/code>s./p> dt>Expiring stored datadd> p>User agents may, possibly in a manner configured by the user, automatically delete stored data after a period of time./p> p>For example, a user agent could be configured to treat third-party local storage areas as session-only storage, deleting the data once the user had closed all the a href#browsing-context iduser-tracking:browsing-context>browsing contexts/a> that could access it./p> p>This can restrict the ability of a site to track a user, as the site would then only be able to track the user across multiple sessions when they authenticate with the site itself (e.g. by making a purchase or logging in to a service)./p> p>However, this also reduces the usefulness of the API as a long-term storage mechanism. It can also put the users data at risk, if the user does not fully understand the implications of data expiration./p> dt>Treating persistent storage as cookiesdd> p>If users attempt to protect their privacy by clearing cookies without also clearing data stored in the local storage area, sites can defeat those attempts by using the two features as redundant backup for each other. User agents should present the interfaces for clearing these in a way that helps users to understand this possibility and enables them to delete data in all persistent storage features simultaneously. a href#refsCOOKIES>COOKIES/a>/p> dt>Site-specific safelisting of access to local storage areasdd> p>User agents may allow sites to access session storage areas in an unrestricted manner, but require the user to authorize access to local storage areas./p> dt>Origin-tracking of stored datadd> p>User agents may record the a href#concept-origin iduser-tracking:concept-origin>origins/a> of sites that contained content from third-party origins that caused data to be stored./p> p>If this information is then used to present the view of data currently in persistent storage, it would allow the user to make informed decisions about which parts of the persistent storage to prune. Combined with a blocklist (delete this data and prevent this domain from ever storing data again), the user can restrict the use of persistent storage to sites that they trust./p> dt>Shared blocklistsdd> p>User agents may allow users to share their persistent storage domain blocklists./p> p>This would allow communities to act together to protect their privacy./p> /dl> p>While these suggestions prevent trivial use of this API for user tracking, they do not block it altogether. Within a single domain, a site can continue to track the user during a session, and can then pass all this information to the third party along with any identifying information (names, credit card numbers, addresses) obtained by the site. If a third party cooperates with multiple sites to obtain such information, a profile can still be created./p> p>However, user tracking is to some extent possible even with no cooperation from the user agent whatsoever, for instance by using session identifiers in URLs, a technique already commonly used for innocuous purposes but easily repurposed for user tracking (even retroactively). This information can then be shared with other sites, using visitors IP addresses and other user-specific data (e.g. user-agent headers and configuration settings) to combine separate sessions into coherent user profiles./p> h4 idsensitivity-of-data>span classsecno>11.4.2/span> Sensitivity of dataa href#sensitivity-of-data classself-link>/a>/h4> p>User agents should treat persistently stored data as potentially sensitive; its quite possible for e-mails, calendar appointments, health records, or other confidential documents to be stored in this mechanism./p> p>To this end, user agents should ensure that when deleting data, it is promptly deleted from the underlying storage./p> h3 idsecurity-storage>span classsecno>11.5/span> Securitya href#security-storage classself-link>/a>/h3> h4 iddns-spoofing-attacks>span classsecno>11.5.1/span> DNS spoofing attacksa href#dns-spoofing-attacks classself-link>/a>/h4> p>Because of the potential for DNS spoofing attacks, one cannot guarantee that a host claiming to be in a certain domain really is from that domain. To mitigate this, pages can use TLS. Pages using TLS can be sure that only the user, software working on behalf of the user, and other pages using TLS that have certificates identifying them as being from the same domain, can access their storage areas./p> h4 idcross-directory-attacks>span classsecno>11.5.2/span> Cross-directory attacksa href#cross-directory-attacks classself-link>/a>/h4> p>Different authors sharing one host name, for example users hosting content on the now defunct code>geocities.com/code>, all share one local storage object. There is no feature to restrict the access by pathname. Authors on shared hosts are therefore urged to avoid using these features, as it would be trivial for other authors to read the data and overwrite it./p> p classnote>Even if a path-restriction feature was made available, the usual DOM scripting security model would make it trivial to bypass this protection and access the data from any path./p> h4 idimplementation-risks>span classsecno>11.5.3/span> Implementation risksa href#implementation-risks classself-link>/a>/h4> p>The two primary risks when implementing these persistent storage features are letting hostile sites read information from other domains, and letting hostile sites write information that is then read from other domains./p> p>Letting third-party sites read data that is not supposed to be read from their domain causes em>information leakage/em>, For example, a users shopping wishlist on one domain could be used by another domain for targeted advertising; or a users work-in-progress confidential documents stored by a word-processing site could be examined by the site of a competing company./p> p>Letting third-party sites write data to the persistent storage of other domains can result in em>information spoofing/em>, which is equally dangerous. For example, a hostile site could add items to a users wishlist; or a hostile site could set a users session identifier to a known ID that the hostile site can then use to track the users actions on the victim site./p> p>Thus, strictly following the a href#concept-origin idimplementation-risks:concept-origin>origin/a> model described in this specification is important for user security./p> h2 idsyntax>span classsecno>12/span> dfn>The HTML syntax/dfn>a href#syntax classself-link>/a>/h2> p classnote>This section only describes the rules for resources labeled with an a idsyntax:html-mime-type hrefhttps://mimesniff.spec.whatwg.org/#html-mime-type data-x-internalhtml-mime-type>HTML MIME type/a>. Rules for XML resources are discussed in the section below entitled a href#the-xhtml-syntax idsyntax:the-xhtml-syntax>The XML syntax/a>./p> h3 idwriting>span classsecno>12.1/span> Writing HTML documentsa href#writing classself-link>/a>/h3> p>i>This section only applies to documents, authoring tools, and markup generators. In particular, it does not apply to conformance checkers; conformance checkers must use the requirements given in the next section (parsing HTML documents)./i>/p> p>Documents must consist of the following parts, in the given order:/p> ol>li>Optionally, a single U+FEFF BYTE ORDER MARK (BOM) character.li>Any number of a href#syntax-comments idwriting:syntax-comments>comments/a> and a idwriting:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>.li>A a href#syntax-doctype idwriting:syntax-doctype>DOCTYPE/a>. li>Any number of a href#syntax-comments idwriting:syntax-comments-2>comments/a> and a idwriting:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>.li>The a idwriting:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>, in the form of an code idwriting:the-html-element>a href#the-html-element>html/a>/code> a href#syntax-elements idwriting:syntax-elements>element/a>.li>Any number of a href#syntax-comments idwriting:syntax-comments-3>comments/a> and a idwriting:space-characters-3 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>./ol> p>The various types of content mentioned above are described in the next few sections./p> p>In addition, there are some restrictions on how a href#character-encoding-declaration idwriting:character-encoding-declaration>character encoding declarations/a> are to be serialized, as discussed in the section on that topic./p> div classnote> p>a idwriting:space-characters-4 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> before the code idwriting:the-html-element-2>a href#the-html-element>html/a>/code> element, at the start of the code idwriting:the-html-element-3>a href#the-html-element>html/a>/code> element and before the code idwriting:the-head-element>a href#the-head-element>head/a>/code> element, will be dropped when the document is parsed; a idwriting:space-characters-5 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> em>after/em> the code idwriting:the-html-element-4>a href#the-html-element>html/a>/code> element will be parsed as if it were at the end of the code idwriting:the-body-element>a href#the-body-element>body/a>/code> element. Thus, a idwriting:space-characters-6 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> around the a idwriting:document-element-2 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> does not round-trip./p> p>It is suggested that newlines be inserted after the DOCTYPE, after any comments that are before the document element, after the code idwriting:the-html-element-5>a href#the-html-element>html/a>/code> elements start tag (if it is not a href#syntax-tag-omission idwriting:syntax-tag-omission>omitted/a>), and after any comments that are inside the code idwriting:the-html-element-6>a href#the-html-element>html/a>/code> element but before the code idwriting:the-head-element-2>a href#the-head-element>head/a>/code> element./p> /div> p>Many strings in the HTML syntax (e.g. the names of elements and their attributes) are case-insensitive, but only for a hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha idwriting:uppercase-ascii-letters data-x-internaluppercase-ascii-letters>ASCII upper alphas/a> and a hrefhttps://infra.spec.whatwg.org/#ascii-lower-alpha idwriting:lowercase-ascii-letters data-x-internallowercase-ascii-letters>ASCII lower alphas/a>. For convenience, in this section this is just referred to as case-insensitive./p> h4 idthe-doctype>span classsecno>12.1.1/span> The DOCTYPEa href#the-doctype classself-link>/a>/h4> p>A dfn idsyntax-doctype>DOCTYPE/dfn> is a required preamble./p> p classnote>DOCTYPEs are required for legacy reasons. When omitted, browsers tend to use a different rendering mode that is incompatible with some specifications. Including the DOCTYPE in a document ensures that the browser makes a best-effort attempt at following the relevant specifications./p> p>A DOCTYPE must consist of the following components, in this order:/p> ol classbrief>li>A string that is an a idthe-doctype:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code><!DOCTYPE/code>.li>One or more a idthe-doctype:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>.li>A string that is an a idthe-doctype:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>html/code>.li>Optionally, a a href#doctype-legacy-string idthe-doctype:doctype-legacy-string>DOCTYPE legacy string/a>.li>Zero or more a idthe-doctype:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>.li>A U+003E GREATER-THAN SIGN character (>)./ol> p classnote>In other words, code><!DOCTYPE html>/code>, case-insensitively./p> hr> p>For the purposes of HTML generators that cannot output HTML markup with the short DOCTYPE code><!DOCTYPE html>/code>, a dfn iddoctype-legacy-string>DOCTYPE legacy string/dfn> may be inserted into the DOCTYPE (in the position defined above). This string must consist of:/p> ol classbrief>li>One or more a idthe-doctype:space-characters-3 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>.li>A string that is an a idthe-doctype:ascii-case-insensitive-3 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>SYSTEM/code>.li>One or more a idthe-doctype:space-characters-4 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>.li>A U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (the i>quote mark/i>).li>The literal string code idthe-doctype:about:legacy-compat>a href#about:legacy-compat>about:legacy-compat/a>/code>.li>A matching U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (i.e. the same character as in the earlier step labeled i>quote mark/i>)./ol> p classnote>In other words, code><!DOCTYPE html SYSTEM about:legacy-compat>/code> or code><!DOCTYPE html SYSTEM about:legacy-compat>/code>, case-insensitively except for the part in single or double quotes./p> p>The a href#doctype-legacy-string idthe-doctype:doctype-legacy-string-2>DOCTYPE legacy string/a> should not be used unless the document is generated from a system that cannot output the shorter string./p> h4 idelements-2>span classsecno>12.1.2/span> Elementsa href#elements-2 classself-link>/a>/h4> p>There are six different kinds of dfn idsyntax-elements>elements/dfn>: a href#void-elements idelements-2:void-elements>void elements/a>, a href#the-template-element-2 idelements-2:the-template-element-2>the code>template/code> element/a>, a href#raw-text-elements idelements-2:raw-text-elements>raw text elements/a>, a href#escapable-raw-text-elements idelements-2:escapable-raw-text-elements>escapable raw text elements/a>, a href#foreign-elements idelements-2:foreign-elements>foreign elements/a>, and a href#normal-elements idelements-2:normal-elements>normal elements/a>./p> dl>dt>dfn idvoid-elements>Void elements/dfn>dd>code idelements-2:the-area-element>a href#the-area-element>area/a>/code>, code idelements-2:the-base-element>a href#the-base-element>base/a>/code>, code idelements-2:the-br-element>a href#the-br-element>br/a>/code>, code idelements-2:the-col-element>a href#the-col-element>col/a>/code>, code idelements-2:the-embed-element>a href#the-embed-element>embed/a>/code>, code idelements-2:the-hr-element>a href#the-hr-element>hr/a>/code>, code idelements-2:the-img-element>a href#the-img-element>img/a>/code>, code idelements-2:the-input-element>a href#the-input-element>input/a>/code>, code idelements-2:the-link-element>a href#the-link-element>link/a>/code>, code idelements-2:the-meta-element>a href#the-meta-element>meta/a>/code>, code idelements-2:the-param-element>a href#the-param-element>param/a>/code>, code idelements-2:the-source-element>a href#the-source-element>source/a>/code>, code idelements-2:the-track-element>a href#the-track-element>track/a>/code>, code idelements-2:the-wbr-element>a href#the-wbr-element>wbr/a>/code>dt>dfn idthe-template-element-2>The code>template/code> element/dfn>dd>code idelements-2:the-template-element>a href#the-template-element>template/a>/code>dt>dfn idraw-text-elements>Raw text elements/dfn>dd>code idelements-2:the-script-element>a href#the-script-element>script/a>/code>, code idelements-2:the-style-element>a href#the-style-element>style/a>/code>dt>dfn idescapable-raw-text-elements>escapable raw text elements/dfn>dd>code idelements-2:the-textarea-element>a href#the-textarea-element>textarea/a>/code>, code idelements-2:the-title-element>a href#the-title-element>title/a>/code>dt>dfn idforeign-elements>Foreign elements/dfn>dd>Elements from the a idelements-2:mathml-namespace hrefhttps://infra.spec.whatwg.org/#mathml-namespace data-x-internalmathml-namespace>MathML namespace/a> and the a idelements-2:svg-namespace hrefhttps://infra.spec.whatwg.org/#svg-namespace data-x-internalsvg-namespace>SVG namespace/a>.dt>dfn idnormal-elements>Normal elements/dfn>dd>All other allowed a href#html-elements idelements-2:html-elements>HTML elements/a> are normal elements./dl> p>dfn idsyntax-tags>Tags/dfn> are used to delimit the start and end of elements in the markup. a href#raw-text-elements idelements-2:raw-text-elements-2>Raw text/a>, a href#escapable-raw-text-elements idelements-2:escapable-raw-text-elements-2>escapable raw text/a>, and a href#normal-elements idelements-2:normal-elements-2>normal/a> elements have a a href#syntax-start-tag idelements-2:syntax-start-tag>start tag/a> to indicate where they begin, and an a href#syntax-end-tag idelements-2:syntax-end-tag>end tag/a> to indicate where they end. The start and end tags of certain a href#normal-elements idelements-2:normal-elements-3>normal elements/a> can be a href#syntax-tag-omission idelements-2:syntax-tag-omission>omitted/a>, as described below in the section on a href#syntax-tag-omission idelements-2:syntax-tag-omission-2>optional tags/a>. Those that cannot be omitted must not be omitted. a href#void-elements idelements-2:void-elements-2>Void elements/a> only have a start tag; end tags must not be specified for a href#void-elements idelements-2:void-elements-3>void elements/a>. a href#foreign-elements idelements-2:foreign-elements-2>Foreign elements/a> must either have a start tag and an end tag, or a start tag that is marked as self-closing, in which case they must not have an end tag./p> p>The a href#concept-html-contents idelements-2:concept-html-contents>contents/a> of the element must be placed between just after the start tag (which a href#syntax-tag-omission idelements-2:syntax-tag-omission-3>might be implied, in certain cases/a>) and just before the end tag (which again, a href#syntax-tag-omission idelements-2:syntax-tag-omission-4>might be implied in certain cases/a>). The exact allowed contents of each individual element depend on the a href#content-models idelements-2:content-models>content model/a> of that element, as described earlier in this specification. Elements must not contain content that their content model disallows. In addition to the restrictions placed on the contents by those content models, however, the five types of elements have additional em>syntactic/em> requirements./p> p>a href#void-elements idelements-2:void-elements-4>Void elements/a> cant have any contents (since theres no end tag, no content can be put between the start tag and the end tag)./p> p idtemplate-syntax>a href#the-template-element-2 idelements-2:the-template-element-2-2>The code>template/code> element/a> can have a href#template-contents idelements-2:template-contents>template contents/a>, but such a href#template-contents idelements-2:template-contents-2>template contents/a> are not children of the code idelements-2:the-template-element-3>a href#the-template-element>template/a>/code> element itself. Instead, they are stored in a code idelements-2:documentfragment>a data-x-internaldocumentfragment hrefhttps://dom.spec.whatwg.org/#interface-documentfragment>DocumentFragment/a>/code> associated with a different code idelements-2:document>a href#document>Document/a>/code> — without a a href#browsing-context idelements-2:browsing-context>browsing context/a> — so as to avoid the code idelements-2:the-template-element-4>a href#the-template-element>template/a>/code> contents interfering with the main code idelements-2:document-2>a href#document>Document/a>/code>. The markup for the a href#template-contents idelements-2:template-contents-3>template contents/a> of a code idelements-2:the-template-element-5>a href#the-template-element>template/a>/code> element is placed just after the code idelements-2:the-template-element-6>a href#the-template-element>template/a>/code> elements start tag and just before code idelements-2:the-template-element-7>a href#the-template-element>template/a>/code> elements end tag (as with other elements), and may consist of any a href#syntax-text idelements-2:syntax-text>text/a>, a href#syntax-charref idelements-2:syntax-charref>character references/a>, a href#syntax-elements idelements-2:syntax-elements>elements/a>, and a href#syntax-comments idelements-2:syntax-comments>comments/a>, but but the text must not contain the character U+003C LESS-THAN SIGN (<) or an a href#syntax-ambiguous-ampersand idelements-2:syntax-ambiguous-ampersand>ambiguous ampersand/a>./p> p>a href#raw-text-elements idelements-2:raw-text-elements-3>Raw text elements/a> can have a href#syntax-text idelements-2:syntax-text-2>text/a>, though it has a href#cdata-rcdata-restrictions>restrictions/a> described below./p> p>a href#escapable-raw-text-elements idelements-2:escapable-raw-text-elements-3>Escapable raw text elements/a> can have a href#syntax-text idelements-2:syntax-text-3>text/a> and a href#syntax-charref idelements-2:syntax-charref-2>character references/a>, but the text must not contain an a href#syntax-ambiguous-ampersand idelements-2:syntax-ambiguous-ampersand-2>ambiguous ampersand/a>. There are also a href#cdata-rcdata-restrictions>further restrictions/a> described below./p> p>a href#foreign-elements idelements-2:foreign-elements-3>Foreign elements/a> whose start tag is marked as self-closing cant have any contents (since, again, as theres no end tag, no content can be put between the start tag and the end tag). a href#foreign-elements idelements-2:foreign-elements-4>Foreign elements/a> whose start tag is em>not/em> marked as self-closing can have a href#syntax-text idelements-2:syntax-text-4>text/a>, a href#syntax-charref idelements-2:syntax-charref-3>character references/a>, a href#syntax-cdata idelements-2:syntax-cdata>CDATA sections/a>, other a href#syntax-elements idelements-2:syntax-elements-2>elements/a>, and a href#syntax-comments idelements-2:syntax-comments-2>comments/a>, but the text must not contain the character U+003C LESS-THAN SIGN (<) or an a href#syntax-ambiguous-ampersand idelements-2:syntax-ambiguous-ampersand-3>ambiguous ampersand/a>./p> div classnote> p>The HTML syntax does not support namespace declarations, even in a href#foreign-elements idelements-2:foreign-elements-5>foreign elements/a>./p> p>For instance, consider the following HTML fragment:/p> pre><p> <svg> <metadata> <!-- this is invalid --> <cdr:license xmlns:cdrhttps://www.example.com/cdr/metadata nameMIT/> </metadata> </svg></p>/pre> p>The innermost element, code>cdr:license/code>, is actually in the SVG namespace, as the code>xmlns:cdr/code> attribute has no effect (unlike in XML). In fact, as the comment in the fragment above says, the fragment is actually non-conforming. This is because the SVG specification does not define any elements called code>cdr:license/code> in the SVG namespace./p> /div> p>a href#normal-elements idelements-2:normal-elements-4>Normal elements/a> can have a href#syntax-text idelements-2:syntax-text-5>text/a>, a href#syntax-charref idelements-2:syntax-charref-4>character references/a>, other a href#syntax-elements idelements-2:syntax-elements-3>elements/a>, and a href#syntax-comments idelements-2:syntax-comments-3>comments/a>, but the text must not contain the character U+003C LESS-THAN SIGN (<) or an a href#syntax-ambiguous-ampersand idelements-2:syntax-ambiguous-ampersand-4>ambiguous ampersand/a>. Some a href#normal-elements idelements-2:normal-elements-5>normal elements/a> also have a href#element-restrictions>yet more restrictions/a> on what content they are allowed to hold, beyond the restrictions imposed by the content model and those described in this paragraph. Those restrictions are described below./p> p>Tags contain a dfn idsyntax-tag-name>tag name/dfn>, giving the elements name. HTML elements all have names that only use a hrefhttps://infra.spec.whatwg.org/#ascii-alphanumeric idelements-2:alphanumeric-ascii-characters data-x-internalalphanumeric-ascii-characters>ASCII alphanumerics/a>. In the HTML syntax, tag names, even those for a href#foreign-elements idelements-2:foreign-elements-6>foreign elements/a>, may be written with any mix of lower- and uppercase letters that, when converted to all-lowercase, matches the elements tag name; tag names are case-insensitive./p> h5 idstart-tags>span classsecno>12.1.2.1/span> Start tagsa href#start-tags classself-link>/a>/h5> p>dfn idsyntax-start-tag>Start tags/dfn> must have the following format:/p> ol>li>The first character of a start tag must be a U+003C LESS-THAN SIGN character (<).li>The next few characters of a start tag must be the elements a href#syntax-tag-name idstart-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 idstart-tags:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>.li>Then, the start tag may have a number of attributes, the a href#syntax-attributes idstart-tags:syntax-attributes>syntax for which/a> is described below. Attributes must be separated from each other by one or more a idstart-tags:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>.li>After the attributes, or after the a href#syntax-tag-name idstart-tags:syntax-tag-name-2>tag name/a> if there are no attributes, there may be one or more a idstart-tags:space-characters-3 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>. (Some attributes are required to be followed by a space. See the a href#syntax-attributes idstart-tags:syntax-attributes-2>attributes section/a> below.)li>Then, if the element is one of the a href#void-elements idstart-tags:void-elements>void elements/a>, or if the element is a a href#foreign-elements idstart-tags:foreign-elements>foreign element/a>, then there may be a single U+002F SOLIDUS character (/). This character has no effect on a href#void-elements idstart-tags:void-elements-2>void elements/a>, but on a href#foreign-elements idstart-tags:foreign-elements-2>foreign elements/a> it marks the start tag as self-closing.li>Finally, start tags must be closed by a U+003E GREATER-THAN SIGN character (>)./ol> h5 idend-tags>span classsecno>12.1.2.2/span> End tagsa href#end-tags classself-link>/a>/h5> p>dfn idsyntax-end-tag>End tags/dfn> must have the following format:/p> ol>li>The first character of an end tag must be a U+003C LESS-THAN SIGN character (<).li>The second character of an end tag must be a U+002F SOLIDUS character (/).li>The next few characters of an end tag must be the elements a href#syntax-tag-name idend-tags:syntax-tag-name>tag name/a>.li>After the tag name, there may be one or more a idend-tags:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>.li>Finally, end tags must be closed by a U+003E GREATER-THAN SIGN character (>)./ol> h5 idattributes-2>span classsecno>12.1.2.3/span> Attributesa href#attributes-2 classself-link>/a>/h5> p>dfn idsyntax-attributes>Attributes/dfn> for an element are expressed inside the elements start tag./p> p>Attributes have a name and a value. dfn idsyntax-attribute-name>Attribute names/dfn> must consist of one or more characters other than a hrefhttps://infra.spec.whatwg.org/#control idattributes-2:control data-x-internalcontrol>controls/a>, U+0020 SPACE, U+0022 (), U+0027 (), U+003E (>), U+002F (/), U+003D (), and a hrefhttps://infra.spec.whatwg.org/#noncharacter idattributes-2:noncharacter data-x-internalnoncharacter>noncharacters/a>. In the HTML syntax, attribute names, even those for a href#foreign-elements idattributes-2:foreign-elements>foreign elements/a>, may be written with any mix of a hrefhttps://infra.spec.whatwg.org/#ascii-lower-alpha idattributes-2:lowercase-ascii-letters data-x-internallowercase-ascii-letters>ASCII lower/a> and a hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha idattributes-2:uppercase-ascii-letters data-x-internaluppercase-ascii-letters>ASCII upper alphas/a>./p> p>dfn idsyntax-attribute-value>Attribute values/dfn> are a mixture of a href#syntax-text idattributes-2:syntax-text>text/a> and a href#syntax-charref idattributes-2:syntax-charref>character references/a>, except with the additional restriction that the text cannot contain an a href#syntax-ambiguous-ampersand idattributes-2:syntax-ambiguous-ampersand>ambiguous ampersand/a>./p> p>Attributes can be specified in four different ways:/p> dl>dt>Empty attribute syntaxdd> p>Just the a href#syntax-attribute-name idattributes-2:syntax-attribute-name>attribute name/a>. The value is implicitly the empty string./p> div classexample> p>In the following example, the code idattributes-2:attr-fe-disabled>a href#attr-fe-disabled>disabled/a>/code> attribute is given with the empty attribute syntax:/p> pre><input em>disabled/em>>/pre> /div> p>If an attribute using the empty attribute syntax is to be followed by another attribute, then there must be a idattributes-2:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> separating the two./p> dt idunquoted>Unquoted attribute value syntaxdd> p>The a href#syntax-attribute-name idattributes-2:syntax-attribute-name-2>attribute name/a>, followed by zero or more a idattributes-2:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, followed by a single U+003D EQUALS SIGN character, followed by zero or more a idattributes-2:space-characters-3 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, followed by the a href#syntax-attribute-value idattributes-2:syntax-attribute-value>attribute value/a>, which, in addition to the requirements given above for attribute values, must not contain any literal a idattributes-2:space-characters-4 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, any U+0022 QUOTATION MARK characters (), U+0027 APOSTROPHE characters (), U+003D EQUALS SIGN characters (), U+003C LESS-THAN SIGN characters (<), U+003E GREATER-THAN SIGN characters (>), or U+0060 GRAVE ACCENT characters (`), and must not be the empty string./p> div classexample> p>In the following example, the code idattributes-2:attr-input-value>a href#attr-input-value>value/a>/code> attribute is given with the unquoted attribute value syntax:/p> pre><input em>valueyes/em>>/pre> /div> p>If an attribute using the unquoted attribute syntax is to be followed by another attribute or by the optional U+002F SOLIDUS character (/) allowed in step 6 of the a href#syntax-start-tag idattributes-2:syntax-start-tag>start tag/a> syntax above, then there must be a idattributes-2:space-characters-5 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> separating the two./p> dt>Single-quoted attribute value syntaxdd> p>The a href#syntax-attribute-name idattributes-2:syntax-attribute-name-3>attribute name/a>, followed by zero or more a idattributes-2:space-characters-6 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, followed by a single U+003D EQUALS SIGN character, followed by zero or more a idattributes-2:space-characters-7 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, followed by a single U+0027 APOSTROPHE character (), followed by the a href#syntax-attribute-value idattributes-2:syntax-attribute-value-2>attribute value/a>, which, in addition to the requirements given above for attribute values, must not contain any literal U+0027 APOSTROPHE characters (), and finally followed by a second single U+0027 APOSTROPHE character ()./p> div classexample> p>In the following example, the code idattributes-2:attr-input-type>a href#attr-input-type>type/a>/code> attribute is given with the single-quoted attribute value syntax:/p> pre><input em>typecheckbox/em>>/pre> /div> p>If an attribute using the single-quoted attribute syntax is to be followed by another attribute, then there must be a idattributes-2:space-characters-8 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> separating the two./p> dt>Double-quoted attribute value syntaxdd> p>The a href#syntax-attribute-name idattributes-2:syntax-attribute-name-4>attribute name/a>, followed by zero or more a idattributes-2:space-characters-9 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, followed by a single U+003D EQUALS SIGN character, followed by zero or more a idattributes-2:space-characters-10 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, followed by a single U+0022 QUOTATION MARK character (), followed by the a href#syntax-attribute-value idattributes-2:syntax-attribute-value-3>attribute value/a>, which, in addition to the requirements given above for attribute values, must not contain any literal U+0022 QUOTATION MARK characters (), and finally followed by a second single U+0022 QUOTATION MARK character ()./p> div classexample> p>In the following example, the code idattributes-2:attr-fe-name>a href#attr-fe-name>name/a>/code> attribute is given with the double-quoted attribute value syntax:/p> pre><input em>namebe evil/em>>/pre> /div> p>If an attribute using the double-quoted attribute syntax is to be followed by another attribute, then there must be a idattributes-2:space-characters-11 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> separating the two./p> /dl> p>There must never be two or more attributes on the same start tag whose names are an a idattributes-2:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for each other./p> hr> p>When a a href#foreign-elements idattributes-2:foreign-elements-2>foreign element/a> has one of the namespaced attributes given by the local name and namespace of the first and second cells of a row from the following table, it must be written using the name given by the third cell from the same row./p> table>thead>tr>th> Local name th> Namespace th> Attribute name tbody>tr>td> code>actuate/code> td> a idattributes-2:xlink-namespace hrefhttps://infra.spec.whatwg.org/#xlink-namespace data-x-internalxlink-namespace>XLink namespace/a> td> code>xlink:actuate/code> tr>td> code>arcrole/code> td> a idattributes-2:xlink-namespace-2 hrefhttps://infra.spec.whatwg.org/#xlink-namespace data-x-internalxlink-namespace>XLink namespace/a> td> code>xlink:arcrole/code> tr>td> code>href/code> td> a idattributes-2:xlink-namespace-3 hrefhttps://infra.spec.whatwg.org/#xlink-namespace data-x-internalxlink-namespace>XLink namespace/a> td> code>xlink:href/code> tr>td> code>role/code> td> a idattributes-2:xlink-namespace-4 hrefhttps://infra.spec.whatwg.org/#xlink-namespace data-x-internalxlink-namespace>XLink namespace/a> td> code>xlink:role/code> tr>td> code>show/code> td> a idattributes-2:xlink-namespace-5 hrefhttps://infra.spec.whatwg.org/#xlink-namespace data-x-internalxlink-namespace>XLink namespace/a> td> code>xlink:show/code> tr>td> code>title/code> td> a idattributes-2:xlink-namespace-6 hrefhttps://infra.spec.whatwg.org/#xlink-namespace data-x-internalxlink-namespace>XLink namespace/a> td> code>xlink:title/code> tr>td> code>type/code> td> a idattributes-2:xlink-namespace-7 hrefhttps://infra.spec.whatwg.org/#xlink-namespace data-x-internalxlink-namespace>XLink namespace/a> td> code>xlink:type/code> tr>td> code>lang/code> td> a idattributes-2:xml-namespace hrefhttps://infra.spec.whatwg.org/#xml-namespace data-x-internalxml-namespace>XML namespace/a> td> code>xml:lang/code> tr>td> code>space/code> td> a idattributes-2:xml-namespace-2 hrefhttps://infra.spec.whatwg.org/#xml-namespace data-x-internalxml-namespace>XML namespace/a> td> code>xml:space/code> tr>td> code>xmlns/code> td> a idattributes-2:xmlns-namespace hrefhttps://infra.spec.whatwg.org/#xmlns-namespace data-x-internalxmlns-namespace>XMLNS namespace/a> td> code>xmlns/code> tr>td> code>xlink/code> td> a idattributes-2:xmlns-namespace-2 hrefhttps://infra.spec.whatwg.org/#xmlns-namespace data-x-internalxmlns-namespace>XMLNS namespace/a> td> code>xmlns:xlink/code> /table> p>No other namespaced attribute can be expressed in a href#syntax idattributes-2:syntax>the HTML syntax/a>./p> p classnote>Whether the attributes in the table above are conforming or not is defined by other specifications (e.g. the SVG and MathML specifications); this section only describes the syntax rules if the attributes are serialized using the HTML syntax./p> h5 idoptional-tags>span classsecno>12.1.2.4/span> Optional tagsa href#optional-tags classself-link>/a>/h5> p>Certain tags can be dfn idsyntax-tag-omission>omitted/dfn>./p> p classnote>Omitting an elements a href#syntax-start-tag idoptional-tags:syntax-start-tag>start tag/a> in the situations described below does not mean the element is not present; it is implied, but it is still there. For example, an HTML document always has a root code idoptional-tags:the-html-element>a href#the-html-element>html/a>/code> element, even if the string code><html>/code> doesnt appear anywhere in the markup./p> p>An code idoptional-tags:the-html-element-2>a href#the-html-element>html/a>/code> elements a href#syntax-start-tag idoptional-tags:syntax-start-tag-2>start tag/a> may be omitted if the first thing inside the code idoptional-tags:the-html-element-3>a href#the-html-element>html/a>/code> element is not a a href#syntax-comments idoptional-tags:syntax-comments>comment/a>./p> div classexample> p>For example, in the following case its ok to remove the code><html>/code> tag:/p> pre><!DOCTYPE HTML>strong><html>/strong> <head> <title>Hello</title> </head> <body> <p>Welcome to this example.</p> </body></html>/pre> p>Doing so would make the document look like this:/p> pre><!DOCTYPE HTML> <head> <title>Hello</title> </head> <body> <p>Welcome to this example.</p> </body></html>/pre> p>This has the exact same DOM. In particular, note that whitespace around the a idoptional-tags:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> is ignored by the parser. The following example would also have the exact same DOM:/p> pre><!DOCTYPE HTML><head> <title>Hello</title> </head> <body> <p>Welcome to this example.</p> </body></html>/pre> p>However, in the following example, removing the start tag moves the comment to before the code idoptional-tags:the-html-element-4>a href#the-html-element>html/a>/code> element:/p> pre><!DOCTYPE HTML><html> strong><!-- where is this comment in the DOM? -->/strong> <head> <title>Hello</title> </head> <body> <p>Welcome to this example.</p> </body></html>/pre> p>With the tag removed, the document actually turns into the same as this:/p> pre><!DOCTYPE HTML><!-- where is this comment in the DOM? -->small><html>/small> <head> <title>Hello</title> </head> <body> <p>Welcome to this example.</p> </body></html>/pre> p>This is why the tag can only be removed if it is not followed by a comment: removing the tag when there is a comment there changes the documents resulting parse tree. Of course, if the position of the comment does not matter, then the tag can be omitted, as if the comment had been moved to before the start tag in the first place./p> /div> p>An code idoptional-tags:the-html-element-5>a href#the-html-element>html/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag>end tag/a> may be omitted if the code idoptional-tags:the-html-element-6>a href#the-html-element>html/a>/code> element is not immediately followed by a a href#syntax-comments idoptional-tags:syntax-comments-2>comment/a>./p> p>A code idoptional-tags:the-head-element>a href#the-head-element>head/a>/code> elements a href#syntax-start-tag idoptional-tags:syntax-start-tag-3>start tag/a> may be omitted if the element is empty, or if the first thing inside the code idoptional-tags:the-head-element-2>a href#the-head-element>head/a>/code> element is an element./p> p>A code idoptional-tags:the-head-element-3>a href#the-head-element>head/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag-2>end tag/a> may be omitted if the code idoptional-tags:the-head-element-4>a href#the-head-element>head/a>/code> element is not immediately followed by a idoptional-tags:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> or a a href#syntax-comments idoptional-tags:syntax-comments-3>comment/a>./p> p>A code idoptional-tags:the-body-element>a href#the-body-element>body/a>/code> elements a href#syntax-start-tag idoptional-tags:syntax-start-tag-4>start tag/a> may be omitted if the element is empty, or if the first thing inside the code idoptional-tags:the-body-element-2>a href#the-body-element>body/a>/code> element is not a idoptional-tags:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> or a a href#syntax-comments idoptional-tags:syntax-comments-4>comment/a>, except if the first thing inside the code idoptional-tags:the-body-element-3>a href#the-body-element>body/a>/code> element is a code idoptional-tags:the-meta-element>a href#the-meta-element>meta/a>/code>, code idoptional-tags:the-link-element>a href#the-link-element>link/a>/code>, code idoptional-tags:the-script-element>a href#the-script-element>script/a>/code>, code idoptional-tags:the-style-element>a href#the-style-element>style/a>/code>, or code idoptional-tags:the-template-element>a href#the-template-element>template/a>/code> element. /p> p>A code idoptional-tags:the-body-element-4>a href#the-body-element>body/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag-3>end tag/a> may be omitted if the code idoptional-tags:the-body-element-5>a href#the-body-element>body/a>/code> element is not immediately followed by a a href#syntax-comments idoptional-tags:syntax-comments-5>comment/a>./p> div classexample> p>Note that in the example above, the code idoptional-tags:the-head-element-5>a href#the-head-element>head/a>/code> element start and end tags, and the code idoptional-tags:the-body-element-6>a href#the-body-element>body/a>/code> element start tag, cant be omitted, because they are surrounded by whitespace:/p> pre><!DOCTYPE HTML><html>strong> /strong><head>strong> /strong><title>Hello</title>strong> /strong></head>strong> /strong><body>strong> /strong><p>Welcome to this example.</p> </body></html>/pre> p>(The code idoptional-tags:the-body-element-7>a href#the-body-element>body/a>/code> and code idoptional-tags:the-html-element-7>a href#the-html-element>html/a>/code> element end tags could be omitted without trouble; any spaces after those get parsed into the code idoptional-tags:the-body-element-8>a href#the-body-element>body/a>/code> element anyway.)/p> p>Usually, however, whitespace isnt an issue. If we first remove the whitespace we dont care about:/p> pre><!DOCTYPE HTML><html><head><title>Hello</title></head><body><p>Welcome to this example.</p></body></html>/pre> p>Then we can omit a number of tags without affecting the DOM:/p> pre><!DOCTYPE HTML><title>Hello</title><p>Welcome to this example.</p>/pre> p>At that point, we can also add some whitespace back:/p> pre><!DOCTYPE HTML><title>Hello</title><p>Welcome to this example.</p>/pre> p>This would be equivalent to this document, with the omitted tags shown in their parser-implied positions; the only whitespace text node that results from this is the newline at the end of the code idoptional-tags:the-head-element-6>a href#the-head-element>head/a>/code> element:/p> pre><!DOCTYPE HTML>small><html><head>/small><title>Hello</title>small></head><body>/small><p>Welcome to this example.</p>small></body></html>/small>/pre> /div> p>An code idoptional-tags:the-li-element>a href#the-li-element>li/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag-4>end tag/a> may be omitted if the code idoptional-tags:the-li-element-2>a href#the-li-element>li/a>/code> element is immediately followed by another code idoptional-tags:the-li-element-3>a href#the-li-element>li/a>/code> element or if there is no more content in the parent element./p> p>A code idoptional-tags:the-dt-element>a href#the-dt-element>dt/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag-5>end tag/a> may be omitted if the code idoptional-tags:the-dt-element-2>a href#the-dt-element>dt/a>/code> element is immediately followed by another code idoptional-tags:the-dt-element-3>a href#the-dt-element>dt/a>/code> element or a code idoptional-tags:the-dd-element>a href#the-dd-element>dd/a>/code> element./p> p>A code idoptional-tags:the-dd-element-2>a href#the-dd-element>dd/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag-6>end tag/a> may be omitted if the code idoptional-tags:the-dd-element-3>a href#the-dd-element>dd/a>/code> element is immediately followed by another code idoptional-tags:the-dd-element-4>a href#the-dd-element>dd/a>/code> element or a code idoptional-tags:the-dt-element-4>a href#the-dt-element>dt/a>/code> element, or if there is no more content in the parent element./p> p>A code idoptional-tags:the-p-element>a href#the-p-element>p/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag-7>end tag/a> may be omitted if the code idoptional-tags:the-p-element-2>a href#the-p-element>p/a>/code> element is immediately followed by an code idoptional-tags:the-address-element>a href#the-address-element>address/a>/code>, code idoptional-tags:the-article-element>a href#the-article-element>article/a>/code>, code idoptional-tags:the-aside-element>a href#the-aside-element>aside/a>/code>, code idoptional-tags:the-blockquote-element>a href#the-blockquote-element>blockquote/a>/code>, code idoptional-tags:the-details-element>a href#the-details-element>details/a>/code>, code idoptional-tags:the-div-element>a href#the-div-element>div/a>/code>, code idoptional-tags:the-dl-element>a href#the-dl-element>dl/a>/code>, code idoptional-tags:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code>, code idoptional-tags:the-figcaption-element>a href#the-figcaption-element>figcaption/a>/code>, code idoptional-tags:the-figure-element>a href#the-figure-element>figure/a>/code>, code idoptional-tags:the-footer-element>a href#the-footer-element>footer/a>/code>, code idoptional-tags:the-form-element>a href#the-form-element>form/a>/code>, code idoptional-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 idoptional-tags:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2/a>/code>, code idoptional-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 idoptional-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 idoptional-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 idoptional-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 idoptional-tags:the-header-element>a href#the-header-element>header/a>/code>, code idoptional-tags:the-hgroup-element>a href#the-hgroup-element>hgroup/a>/code>, code idoptional-tags:the-hr-element>a href#the-hr-element>hr/a>/code>, code idoptional-tags:the-main-element>a href#the-main-element>main/a>/code>, code idoptional-tags:the-menu-element>a href#the-menu-element>menu/a>/code>, code idoptional-tags:the-nav-element>a href#the-nav-element>nav/a>/code>, code idoptional-tags:the-ol-element>a href#the-ol-element>ol/a>/code>, code idoptional-tags:the-p-element-3>a href#the-p-element>p/a>/code>, code idoptional-tags:the-pre-element>a href#the-pre-element>pre/a>/code>, code idoptional-tags:the-section-element>a href#the-section-element>section/a>/code>, code idoptional-tags:the-table-element>a href#the-table-element>table/a>/code>, or code idoptional-tags:the-ul-element>a href#the-ul-element>ul/a>/code> element, or if there is no more content in the parent element and the parent element is an a href#html-elements idoptional-tags:html-elements>HTML element/a> that is not an code idoptional-tags:the-a-element>a href#the-a-element>a/a>/code>, code idoptional-tags:the-audio-element>a href#the-audio-element>audio/a>/code>, code idoptional-tags:the-del-element>a href#the-del-element>del/a>/code>, code idoptional-tags:the-ins-element>a href#the-ins-element>ins/a>/code>, code idoptional-tags:the-map-element>a href#the-map-element>map/a>/code>, code idoptional-tags:the-noscript-element>a href#the-noscript-element>noscript/a>/code>, or code idoptional-tags:the-video-element>a href#the-video-element>video/a>/code> element, or an a href#autonomous-custom-element idoptional-tags:autonomous-custom-element>autonomous custom element/a>./p> div classexample> p>We can thus simplify the earlier example further: pre><!DOCTYPE HTML><title>Hello</title><p>Welcome to this example.small></p>/small>/pre> /div> p>An code idoptional-tags:the-rt-element>a href#the-rt-element>rt/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag-8>end tag/a> may be omitted if the code idoptional-tags:the-rt-element-2>a href#the-rt-element>rt/a>/code> element is immediately followed by an code idoptional-tags:the-rt-element-3>a href#the-rt-element>rt/a>/code> or code idoptional-tags:the-rp-element>a href#the-rp-element>rp/a>/code> element, or if there is no more content in the parent element./p> p>An code idoptional-tags:the-rp-element-2>a href#the-rp-element>rp/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag-9>end tag/a> may be omitted if the code idoptional-tags:the-rp-element-3>a href#the-rp-element>rp/a>/code> element is immediately followed by an code idoptional-tags:the-rt-element-4>a href#the-rt-element>rt/a>/code> or code idoptional-tags:the-rp-element-4>a href#the-rp-element>rp/a>/code> element, or if there is no more content in the parent element./p> p>An code idoptional-tags:the-optgroup-element>a href#the-optgroup-element>optgroup/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag-10>end tag/a> may be omitted if the code idoptional-tags:the-optgroup-element-2>a href#the-optgroup-element>optgroup/a>/code> element is immediately followed by another code idoptional-tags:the-optgroup-element-3>a href#the-optgroup-element>optgroup/a>/code> element, or if there is no more content in the parent element./p> p>An code idoptional-tags:the-option-element>a href#the-option-element>option/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag-11>end tag/a> may be omitted if the code idoptional-tags:the-option-element-2>a href#the-option-element>option/a>/code> element is immediately followed by another code idoptional-tags:the-option-element-3>a href#the-option-element>option/a>/code> element, or if it is immediately followed by an code idoptional-tags:the-optgroup-element-4>a href#the-optgroup-element>optgroup/a>/code> element, or if there is no more content in the parent element./p> p>A code idoptional-tags:the-colgroup-element>a href#the-colgroup-element>colgroup/a>/code> elements a href#syntax-start-tag idoptional-tags:syntax-start-tag-5>start tag/a> may be omitted if the first thing inside the code idoptional-tags:the-colgroup-element-2>a href#the-colgroup-element>colgroup/a>/code> element is a code idoptional-tags:the-col-element>a href#the-col-element>col/a>/code> element, and if the element is not immediately preceded by another code idoptional-tags:the-colgroup-element-3>a href#the-colgroup-element>colgroup/a>/code> element whose a href#syntax-end-tag idoptional-tags:syntax-end-tag-12>end tag/a> has been omitted. (It cant be omitted if the element is empty.)/p> p>A code idoptional-tags:the-colgroup-element-4>a href#the-colgroup-element>colgroup/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag-13>end tag/a> may be omitted if the code idoptional-tags:the-colgroup-element-5>a href#the-colgroup-element>colgroup/a>/code> element is not immediately followed by a idoptional-tags:space-characters-3 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> or a a href#syntax-comments idoptional-tags:syntax-comments-6>comment/a>./p> p>A code idoptional-tags:the-caption-element>a href#the-caption-element>caption/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag-14>end tag/a> may be omitted if the code idoptional-tags:the-caption-element-2>a href#the-caption-element>caption/a>/code> element is not immediately followed by a idoptional-tags:space-characters-4 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> or a a href#syntax-comments idoptional-tags:syntax-comments-7>comment/a>./p> p>A code idoptional-tags:the-thead-element>a href#the-thead-element>thead/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag-15>end tag/a> may be omitted if the code idoptional-tags:the-thead-element-2>a href#the-thead-element>thead/a>/code> element is immediately followed by a code idoptional-tags:the-tbody-element>a href#the-tbody-element>tbody/a>/code> or code idoptional-tags:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code> element./p> p>A code idoptional-tags:the-tbody-element-2>a href#the-tbody-element>tbody/a>/code> elements a href#syntax-start-tag idoptional-tags:syntax-start-tag-6>start tag/a> may be omitted if the first thing inside the code idoptional-tags:the-tbody-element-3>a href#the-tbody-element>tbody/a>/code> element is a code idoptional-tags:the-tr-element>a href#the-tr-element>tr/a>/code> element, and if the element is not immediately preceded by a code idoptional-tags:the-tbody-element-4>a href#the-tbody-element>tbody/a>/code>, code idoptional-tags:the-thead-element-3>a href#the-thead-element>thead/a>/code>, or code idoptional-tags:the-tfoot-element-2>a href#the-tfoot-element>tfoot/a>/code> element whose a href#syntax-end-tag idoptional-tags:syntax-end-tag-16>end tag/a> has been omitted. (It cant be omitted if the element is empty.)/p> p>A code idoptional-tags:the-tbody-element-5>a href#the-tbody-element>tbody/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag-17>end tag/a> may be omitted if the code idoptional-tags:the-tbody-element-6>a href#the-tbody-element>tbody/a>/code> element is immediately followed by a code idoptional-tags:the-tbody-element-7>a href#the-tbody-element>tbody/a>/code> or code idoptional-tags:the-tfoot-element-3>a href#the-tfoot-element>tfoot/a>/code> element, or if there is no more content in the parent element./p> p>A code idoptional-tags:the-tfoot-element-4>a href#the-tfoot-element>tfoot/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag-18>end tag/a> may be omitted if there is no more content in the parent element./p> p>A code idoptional-tags:the-tr-element-2>a href#the-tr-element>tr/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag-19>end tag/a> may be omitted if the code idoptional-tags:the-tr-element-3>a href#the-tr-element>tr/a>/code> element is immediately followed by another code idoptional-tags:the-tr-element-4>a href#the-tr-element>tr/a>/code> element, or if there is no more content in the parent element./p> p>A code idoptional-tags:the-td-element>a href#the-td-element>td/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag-20>end tag/a> may be omitted if the code idoptional-tags:the-td-element-2>a href#the-td-element>td/a>/code> element is immediately followed by a code idoptional-tags:the-td-element-3>a href#the-td-element>td/a>/code> or code idoptional-tags:the-th-element>a href#the-th-element>th/a>/code> element, or if there is no more content in the parent element./p> p>A code idoptional-tags:the-th-element-2>a href#the-th-element>th/a>/code> elements a href#syntax-end-tag idoptional-tags:syntax-end-tag-21>end tag/a> may be omitted if the code idoptional-tags:the-th-element-3>a href#the-th-element>th/a>/code> element is immediately followed by a code idoptional-tags:the-td-element-4>a href#the-td-element>td/a>/code> or code idoptional-tags:the-th-element-4>a href#the-th-element>th/a>/code> element, or if there is no more content in the parent element./p> div classexample> p>The ability to omit all these table-related tags makes table markup much terser./p> p>Take this example:/p> pre><table> <caption>37547 TEE Electric Powered Rail Car Train Functions (Abbreviated)</caption> <colgroup><col><col><col></colgroup> <thead> <tr> <th>Function</th> <th>Control Unit</th> <th>Central Station</th> </tr> </thead> <tbody> <tr> <td>Headlights</td> <td>✔</td> <td>✔</td> </tr> <tr> <td>Interior Lights</td> <td>✔</td> <td>✔</td> </tr> <tr> <td>Electric locomotive operating sounds</td> <td>✔</td> <td>✔</td> </tr> <tr> <td>Engineers cab lighting</td> <td></td> <td>✔</td> </tr> <tr> <td>Station Announcements - Swiss</td> <td></td> <td>✔</td> </tr> </tbody></table>/pre> p>The exact same table, modulo some whitespace differences, could be marked up as follows:/p> pre><table> <caption>37547 TEE Electric Powered Rail Car Train Functions (Abbreviated) <colgroup><col><col><col> <thead> <tr> <th>Function <th>Control Unit <th>Central Station <tbody> <tr> <td>Headlights <td>✔ <td>✔ <tr> <td>Interior Lights <td>✔ <td>✔ <tr> <td>Electric locomotive operating sounds <td>✔ <td>✔ <tr> <td>Engineers cab lighting <td> <td>✔ <tr> <td>Station Announcements - Swiss <td> <td>✔</table>/pre> p>Since the cells take up much less room this way, this can be made even terser by having each row on one line:/p> pre><table> <caption>37547 TEE Electric Powered Rail Car Train Functions (Abbreviated) <colgroup><col><col><col> <thead> <tr> <th>Function <th>Control Unit <th>Central Station <tbody> <tr> <td>Headlights <td>✔ <td>✔ <tr> <td>Interior Lights <td>✔ <td>✔ <tr> <td>Electric locomotive operating sounds <td>✔ <td>✔ <tr> <td>Engineers cab lighting <td> <td>✔ <tr> <td>Station Announcements - Swiss <td> <td>✔</table>/pre> p>The only differences between these tables, at the DOM level, is with the precise position of the (in any case semantically-neutral) whitespace./p> /div> p>strong>However/strong>, a a href#syntax-start-tag idoptional-tags:syntax-start-tag-7>start tag/a> must never be omitted if it has any attributes./p> div classexample> p>Returning to the earlier example with all the whitespace removed and then all the optional tags removed:/p> pre><!DOCTYPE HTML><title>Hello</title><p>Welcome to this example./pre> p>If the code idoptional-tags:the-body-element-9>a href#the-body-element>body/a>/code> element in this example had to have a code idoptional-tags:classes>a href#classes>class/a>/code> attribute and the code idoptional-tags:the-html-element-8>a href#the-html-element>html/a>/code> element had to have a code idoptional-tags:attr-lang>a href#attr-lang>lang/a>/code> attribute, the markup would have to become:/p> pre><!DOCTYPE HTML><html langen><title>Hello</title><body classdemo><p>Welcome to this example./pre> /div> p classnote>This section assumes that the document is conforming, in particular, that there are no a href#content-models idoptional-tags:content-models>content model/a> violations. Omitting tags in the fashion described in this section in a document that does not conform to the a href#content-models idoptional-tags:content-models-2>content models/a> described in this specification is likely to result in unexpected DOM differences (this is, in part, what the content models are designed to avoid)./p> h5 idelement-restrictions>span classsecno>12.1.2.5/span> Restrictions on content modelsa href#element-restrictions classself-link>/a>/h5> p>For historical reasons, certain elements have extra restrictions beyond even the restrictions given by their content model./p> p>A code idelement-restrictions:the-table-element>a href#the-table-element>table/a>/code> element must not contain code idelement-restrictions:the-tr-element>a href#the-tr-element>tr/a>/code> elements, even though these elements are technically allowed inside code idelement-restrictions:the-table-element-2>a href#the-table-element>table/a>/code> elements according to the content models described in this specification. (If a code idelement-restrictions:the-tr-element-2>a href#the-tr-element>tr/a>/code> element is put inside a code idelement-restrictions:the-table-element-3>a href#the-table-element>table/a>/code> in the markup, it will in fact imply a code idelement-restrictions:the-tbody-element>a href#the-tbody-element>tbody/a>/code> start tag before it.)/p> p>A single a href#syntax-newlines idelement-restrictions:syntax-newlines>newline/a> may be placed immediately after the a href#syntax-start-tag idelement-restrictions:syntax-start-tag>start tag/a> of code idelement-restrictions:the-pre-element>a href#the-pre-element>pre/a>/code> and code idelement-restrictions:the-textarea-element>a href#the-textarea-element>textarea/a>/code> elements. This does not affect the processing of the element. The otherwise optional a href#syntax-newlines idelement-restrictions:syntax-newlines-2>newline/a> em>must/em> be included if the elements contents themselves start with a a href#syntax-newlines idelement-restrictions:syntax-newlines-3>newline/a> (because otherwise the leading newline in the contents would be treated like the optional newline, and ignored)./p> div classexample> p>The following two code idelement-restrictions:the-pre-element-2>a href#the-pre-element>pre/a>/code> blocks are equivalent:/p> pre><pre>Hello</pre>/pre> pre><pre>br>Hello</pre>/pre> /div> h5 idcdata-rcdata-restrictions>span classsecno>12.1.2.6/span> Restrictions on the contents of raw text and escapable raw text elementsa href#cdata-rcdata-restrictions classself-link>/a>/h5> p>The text in a href#raw-text-elements idcdata-rcdata-restrictions:raw-text-elements>raw text/a> and a href#escapable-raw-text-elements idcdata-rcdata-restrictions:escapable-raw-text-elements>escapable raw text elements/a> must not contain any occurrences of the string code><//code> (U+003C LESS-THAN SIGN, U+002F SOLIDUS) followed by characters that case-insensitively match the tag name of the element followed by one of U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), U+0020 SPACE, U+003E GREATER-THAN SIGN (>), or U+002F SOLIDUS (/)./p> h4 idtext-2>span classsecno>12.1.3/span> Texta href#text-2 classself-link>/a>/h4> p>dfn idsyntax-text>Text/dfn> is allowed inside elements, attribute values, and comments. Extra constraints are placed on what is and what is not allowed in text based on where the text is to be put, as described in the other sections./p> h5 idnewlines>span classsecno>12.1.3.1/span> Newlinesa href#newlines classself-link>/a>/h5> p>dfn idsyntax-newlines>Newlines/dfn> in HTML may be represented either as U+000D CARRIAGE RETURN (CR) characters, U+000A LINE FEED (LF) characters, or pairs of U+000D CARRIAGE RETURN (CR), U+000A LINE FEED (LF) characters in that order./p> p>Where a href#syntax-charref idnewlines:syntax-charref>character references/a> are allowed, a character reference of a U+000A LINE FEED (LF) character (but not a U+000D CARRIAGE RETURN (CR) character) also represents a a href#syntax-newlines idnewlines:syntax-newlines>newline/a>./p> h4 idcharacter-references>span classsecno>12.1.4/span> Character referencesa href#character-references classself-link>/a>/h4> p>In certain cases described in other sections, a href#syntax-text idcharacter-references:syntax-text>text/a> may be mixed with dfn idsyntax-charref>character references/dfn>. These can be used to escape characters that couldnt otherwise legally be included in a href#syntax-text idcharacter-references:syntax-text-2>text/a>./p> p>Character references must start with a U+0026 AMPERSAND character (&). Following this, there are three possible kinds of character references:/p> dl>dt>Named character referencesdd>The ampersand must be followed by one of the names given in the a href#named-character-references idcharacter-references:named-character-references>named character references/a> section, using the same case. The name must be one that is terminated by a U+003B SEMICOLON character (;).dt>Decimal numeric character referencedd>The ampersand must be followed by a U+0023 NUMBER SIGN character (#), followed by one or more a idcharacter-references:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>, representing a base-ten integer that corresponds to a code point that is allowed according to the definition below. The digits must then be followed by a U+003B SEMICOLON character (;).dt>Hexadecimal numeric character referencedd>The ampersand must be followed by a U+0023 NUMBER SIGN character (#), which must be followed by either a U+0078 LATIN SMALL LETTER X character (x) or a U+0058 LATIN CAPITAL LETTER X character (X), which must then be followed by one or more a idcharacter-references:ascii-hex-digits hrefhttps://infra.spec.whatwg.org/#ascii-hex-digit data-x-internalascii-hex-digits>ASCII hex digits/a>, representing a hexadecimal integer that corresponds to a code point that is allowed according to the definition below. The digits must then be followed by a U+003B SEMICOLON character (;)./dl> p>The numeric character reference forms described above are allowed to reference any code point excluding U+000D CR, a hrefhttps://infra.spec.whatwg.org/#noncharacter idcharacter-references:noncharacter data-x-internalnoncharacter>noncharacters/a>, and a hrefhttps://infra.spec.whatwg.org/#control idcharacter-references:control data-x-internalcontrol>controls/a> other than a idcharacter-references:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>./p> p>An dfn idsyntax-ambiguous-ampersand>ambiguous ampersand/dfn> is a U+0026 AMPERSAND character (&) that is followed by one or more a hrefhttps://infra.spec.whatwg.org/#ascii-alphanumeric idcharacter-references:alphanumeric-ascii-characters data-x-internalalphanumeric-ascii-characters>ASCII alphanumerics/a>, followed by a U+003B SEMICOLON character (;), where these characters do not match any of the names given in the a href#named-character-references idcharacter-references:named-character-references-2>named character references/a> section./p> h4 idcdata-sections>span classsecno>12.1.5/span> CDATA sectionsa href#cdata-sections classself-link>/a>/h4> p>dfn idsyntax-cdata>CDATA sections/dfn> must consist of the following components, in this order:/p> ol>li>The string code><!CDATA/code>.li>Optionally, a href#syntax-text idcdata-sections:syntax-text>text/a>, with the additional restriction that the text must not contain the string code>>/code>.li>The string code>>/code>./ol> div classexample> p>CDATA sections can only be used in foreign content (MathML or SVG). In this example, a CDATA section is used to escape the contents of a a idcdata-sections:mathml-ms hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.ms data-x-internalmathml-ms>MathML code>ms/code>/a> element:/p> pre><p>You can add a string to a number, but this stringifies the number:</p><math> <ms><!CDATAx<y></ms> <mo>+</mo> <mn>3</mn> <mo></mo> <ms><!CDATAx<y3></ms></math>/pre> /div> h4 idcomments>span classsecno>12.1.6/span> Commentsa href#comments classself-link>/a>/h4> p>dfn idsyntax-comments>Comments/dfn> must have the following format:/p> ol>li>The string code><!--/code>.li>Optionally, a href#syntax-text idcomments:syntax-text>text/a>, with the additional restriction that the text must not start with the string code>>/code>, nor start with the string code>->/code>, nor contain the strings code><!--/code>, code>-->/code>, or code>--!>/code>, nor end with the string code><!-/code>.li>The string code>-->/code>./ol> p classnote>The a href#syntax-text idcomments:syntax-text-2>text/a> is allowed to end with the string code><!/code>, as in code><!--My favorite operators are > and <!-->/code>./p> h3 idparsing>span classsecno>12.2/span> Parsing HTML documentsa href#parsing classself-link>/a>/h3> p>i>This section only applies to user agents, data mining tools, and conformance checkers./i>/p> p classnote>The rules for parsing XML documents into DOM trees are covered by the next section, entitled a href#the-xhtml-syntax idparsing:the-xhtml-syntax>The XML syntax/a>./p> p>User agents must use the parsing rules described in this section to generate the DOM trees from code idparsing:text/html>a href#text/html>text/html/a>/code> resources. Together, these rules define what is referred to as the dfn idhtml-parser data-export>HTML parser/dfn>./p> div classnote> p>While the HTML syntax described in this specification bears a close resemblance to SGML and XML, it is a separate language with its own parsing rules./p> p>Some earlier versions of HTML (in particular from HTML2 to HTML4) were based on SGML and used SGML parsing rules. However, few (if any) web browsers ever implemented true SGML parsing for HTML documents; the only user agents to strictly handle HTML as an SGML application have historically been validators. The resulting confusion — with validators claiming documents to have one representation while widely deployed Web browsers interoperably implemented a different representation — has wasted decades of productivity. This version of HTML thus returns to a non-SGML basis./p> p>Authors interested in using SGML tools in their authoring pipeline are encouraged to use XML tools and the XML serialization of HTML./p> /div> p>For the purposes of conformance checkers, if a resource is determined to be in a href#syntax idparsing:syntax>the HTML syntax/a>, then it is an a hrefhttps://dom.spec.whatwg.org/#html-document idparsing:html-documents data-x-internalhtml-documents>HTML document/a>./p> p classnote>As stated a href#html-elements idparsing:html-elements classno-backref>in the terminology section/a>, references to a href#element-type idparsing:element-type>element types/a> that do not explicitly specify a namespace always refer to elements in the a idparsing:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>. For example, if the spec talks about a code idparsing:the-menu-element>a href#the-menu-element>menu/a>/code> element, then that is an element with the local name code>menu/code>, the namespace code>http://www.w3.org/1999/xhtml/code>, and the interface code idparsing:htmlmenuelement>a href#htmlmenuelement>HTMLMenuElement/a>/code>. Where possible, references to such elements are hyperlinked to their definition./p> h4 idoverview-of-the-parsing-model>span classsecno>12.2.1/span> Overview of the parsing modela href#overview-of-the-parsing-model classself-link>/a>/h4> p classoverview>img src/images/parsing-model-overview.svg width345 alt height535>/p> p>The input to the HTML parsing process consists of a stream of a hrefhttps://infra.spec.whatwg.org/#code-point idoverview-of-the-parsing-model:code-point data-x-internalcode-point>code points/a>, which is passed through a a href#tokenization idoverview-of-the-parsing-model:tokenization>tokenization/a> stage followed by a a href#tree-construction idoverview-of-the-parsing-model:tree-construction>tree construction/a> stage. The output is a code idoverview-of-the-parsing-model:document>a href#document>Document/a>/code> object./p> p classnote>Implementations that a href#non-scripted>do not support scripting/a> do not have to actually create a DOM code idoverview-of-the-parsing-model:document-2>a href#document>Document/a>/code> object, but the DOM tree in such cases is still used as the model for the rest of the specification./p> p>In the common case, the data handled by the tokenization stage comes from the network, but a href#dynamic-markup-insertion idoverview-of-the-parsing-model:dynamic-markup-insertion>it can also come from script/a> running in the user agent, e.g. using the code idoverview-of-the-parsing-model:dom-document-write>a href#dom-document-write>document.write()/a>/code> API./p> p idnestedParsing>There is only one set of states for the tokenizer stage and the tree construction stage, but the tree construction stage is reentrant, meaning that while the tree construction stage is handling one token, the tokenizer might be resumed, causing further tokens to be emitted and processed before the first tokens processing is complete./p> div classexample> p>In the following example, the tree construction stage will be called upon to handle a p start tag token while handling the script end tag token:/p> pre>...<script> document.write(<p>);</script>.../pre> /div> p>To handle these cases, parsers have a dfn idscript-nesting-level>script nesting level/dfn>, which must be initially set to zero, and a dfn idparser-pause-flag>parser pause flag/dfn>, which must be initially set to false./p> h4 idparse-errors>span classsecno>12.2.2/span> dfn>Parse errors/dfn>a href#parse-errors classself-link>/a>/h4> p>This specification defines the parsing rules for HTML documents, whether they are syntactically correct or not. Certain points in the parsing algorithm are said to be a href#parse-errors idparse-errors:parse-errors>parse errors/a>. The error handling for parse errors is well-defined (thats the processing rules described throughout this specification), but user agents, while parsing an HTML document, may a href#abort-a-parser idparse-errors:abort-a-parser>abort the parser/a> at the first a href#parse-errors idparse-errors:parse-errors-2>parse error/a> that they encounter for which they do not wish to apply the rules described in this specification./p> p>Conformance checkers must report at least one parse error condition to the user if one or more parse error conditions exist in the document and must not report parse error conditions if none exist in the document. Conformance checkers may report more than one parse error condition if more than one parse error condition exists in the document./p> p classnote>Parse errors are only errors with the em>syntax/em> of HTML. In addition to checking for parse errors, conformance checkers will also verify that the document obeys all the other conformance requirements described in this specification./p> p>Some parse errors have dedicated codes outlined in the table below that should be used by conformance checkers in reports./p> p>i>Error descriptions in the table below are non-normative./i>/p> table classparse-error-table>thead>tr>th>Code th>Description tbody>tr>td>dfn idparse-error-abrupt-closing-of-empty-comment>abrupt-closing-of-empty-comment/dfn> td>p>This error occurs if the parser encounters an empty a href#syntax-comments idparse-errors:syntax-comments>comment/a> that is abruptly closed by a U+003E (>) a idparse-errors:code-point hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> (i.e., code><!-->/code> or code><!--->/code>). The parser behaves as if the comment is closed correctly./p> tr>td>dfn idparse-error-abrupt-doctype-public-identifier>abrupt-doctype-public-identifier/dfn> td>p>This error occurs if the parser encounters a U+003E (>) a idparse-errors:code-point-2 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> in the a href#syntax-doctype idparse-errors:syntax-doctype>DOCTYPE/a> public identifier (e.g., code><!DOCTYPE html PUBLIC foo>/code>). In such a case, if the DOCTYPE is correctly placed as a document preamble, the parser sets the code idparse-errors:document>a href#document>Document/a>/code> to a idparse-errors:quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>./p> tr>td>dfn idparse-error-abrupt-doctype-system-identifier>abrupt-doctype-system-identifier/dfn> td>p>This error occurs if the parser encounters a U+003E (>) a idparse-errors:code-point-3 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> in the a href#syntax-doctype idparse-errors:syntax-doctype-2>DOCTYPE/a> system identifier (e.g., code><!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01//EN foo>/code>). In such a case, if the DOCTYPE is correctly placed as a document preamble, the parser sets the code idparse-errors:document-2>a href#document>Document/a>/code> to a idparse-errors:quirks-mode-2 hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>./p> tr>td>dfn idparse-error-absence-of-digits-in-numeric-character-reference>absence-of-digits-in-numeric-character-reference/dfn> td>p>This error occurs if the parser encounters a numeric a href#syntax-charref idparse-errors:syntax-charref>character reference/a> that doesnt contain any digits (e.g., code>&#qux;/code>). In this case the parser doesnt resolve the character reference./p> tr>td>dfn idparse-error-cdata-in-html-content>cdata-in-html-content/dfn> td>p>This error occurs if the parser encounters a a href#syntax-cdata idparse-errors:syntax-cdata>CDATA section/a> outside of foreign content (SVG or MathML). The parser treats such CDATA sections (including leading code>CDATA/code> and trailing code>/code> strings) as comments./p> tr>td>dfn idparse-error-character-reference-outside-unicode-range>character-reference-outside-unicode-range/dfn> td>p>This error occurs if the parser encounters a numeric a href#syntax-charref idparse-errors:syntax-charref-2>character reference/a> that references a a idparse-errors:code-point-4 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> that is greater than the valid Unicode range. The parser resolves such a character reference to a U+FFFD REPLACEMENT CHARACTER./p> tr>td>dfn idparse-error-control-character-in-input-stream>control-character-in-input-stream/dfn> td>p>This error occurs if the a href#input-stream idparse-errors:input-stream>input stream/a> contains a a hrefhttps://infra.spec.whatwg.org/#control idparse-errors:control data-x-internalcontrol>control/a> a idparse-errors:code-point-5 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> that is not a idparse-errors:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> or U+0000 NULL. Such code points are parsed as-is and usually, where parsing rules dont apply any additional restrictions, make their way into the DOM./p> tr>td>dfn idparse-error-control-character-reference>control-character-reference/dfn> td>p>This error occurs if the parser encounters a numeric a href#syntax-charref idparse-errors:syntax-charref-3>character reference/a> that references a a hrefhttps://infra.spec.whatwg.org/#control idparse-errors:control-2 data-x-internalcontrol>control/a> a idparse-errors:code-point-6 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> that is not a idparse-errors:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, a U+000D CARRIAGE RETURN, or U+0000 NULL. The parser resolves such character references as-is except C1 control references that are replaced according to the a href#numeric-character-reference-end-state idparse-errors:numeric-character-reference-end-state>numeric character reference end state/a>./p> tr>td>dfn idparse-error-end-tag-with-attributes>end-tag-with-attributes/dfn> td>p>This error occurs if the parser encounters an a href#syntax-end-tag idparse-errors:syntax-end-tag>end tag/a> with a href#syntax-attributes idparse-errors:syntax-attributes>attributes/a>. Attributes in end tags are completely ignored and do not make their way into the DOM./p> tr>td>dfn idparse-error-duplicate-attribute>duplicate-attribute/dfn> td>p>This error occurs if the parser encounters an a href#syntax-attributes idparse-errors:syntax-attributes-2>attribute/a> in a tag that already has an attribute with the same name. The parser ignores all such duplicate occurrences of the attribute. tr>td>dfn idparse-error-end-tag-with-trailing-solidus>end-tag-with-trailing-solidus/dfn> td>p>This error occurs if the parser encounters an a href#syntax-end-tag idparse-errors:syntax-end-tag-2>end tag/a> that has a U+002F (/) a idparse-errors:code-point-7 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> right before the closing U+003E (>) code point (e.g., code></div/>/code>). Such a tag is treated as a regular end tag./p> tr>td>dfn idparse-error-eof-before-tag-name>eof-before-tag-name/dfn> td>p>This error occurs if the parser encounters the end of the a href#input-stream idparse-errors:input-stream-2>input stream/a> where a tag name is expected. In this case the parser treats the beginning of a a href#syntax-start-tag idparse-errors:syntax-start-tag>start tag/a> (i.e., code></code>) or an a href#syntax-end-tag idparse-errors:syntax-end-tag-3>end tag/a> (i.e., code><//code>) as text content./p> tr>td>dfn idparse-error-eof-in-cdata>eof-in-cdata/dfn> td>p>This error occurs if the parser encounters the end of the a href#input-stream idparse-errors:input-stream-3>input stream/a> in a a href#syntax-cdata idparse-errors:syntax-cdata-2>CDATA section/a>. The parser treats such CDATA sections as if they are closed immediately before the end of the input stream./p> tr>td>dfn idparse-error-eof-in-comment>eof-in-comment/dfn> td>p>This error occurs if the parser encounters the end of the a href#input-stream idparse-errors:input-stream-4>input stream/a> in a a href#syntax-comments idparse-errors:syntax-comments-2>comment/a>. The parser treats such comments as if they are closed immediately before the end of the input stream./p> tr>td>dfn idparse-error-eof-in-doctype>eof-in-doctype/dfn> td>p>This error occurs if the parser encounters the end of the input stream in a a href#syntax-doctype idparse-errors:syntax-doctype-3>DOCTYPE/a>. In such a case, if the DOCTYPE is correctly placed as a document preamble, the parser sets the code idparse-errors:document-3>a href#document>Document/a>/code> to a idparse-errors:quirks-mode-3 hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>./p> tr>td>dfn idparse-error-eof-in-script-html-comment-like-text>eof-in-script-html-comment-like-text/dfn> td> p>This error occurs if the parser encounters the end of the a href#input-stream idparse-errors:input-stream-5>input stream/a> in text that resembles an a href#syntax-comments idparse-errors:syntax-comments-3>HTML comment/a> inside code idparse-errors:the-script-element>a href#the-script-element>script/a>/code> element content (e.g., code><script><!-- foo/code>)./p> p classnote>Syntactic structures that resemble HTML comments in code idparse-errors:the-script-element-2>a href#the-script-element>script/a>/code> elements are parsed as text content. They can be a part of a scripting language-specific syntactic structure or be treated as an HTML-like comment, if the scripting language supports them (e.g., parsing rules for HTML-like comments can be found in Annex B of the JavaScript specification). The common reason for this error is a violation of the a href#restrictions-for-contents-of-script-elements idparse-errors:restrictions-for-contents-of-script-elements>restrictions for contents of code>script/code> elements/a>. a href#refsJAVASCRIPT>JAVASCRIPT/a>/p> tr>td>dfn idparse-error-eof-in-tag>eof-in-tag/dfn> td>p>This error occurs if the parser encounters the end of the a href#input-stream idparse-errors:input-stream-6>input stream/a> in a a href#syntax-start-tag idparse-errors:syntax-start-tag-2>start tag/a> or an a href#syntax-end-tag idparse-errors:syntax-end-tag-4>end tag/a> (e.g., code><div id/code>). Such a tag is completely ignored./p> tr>td>dfn idparse-error-incorrectly-closed-comment>incorrectly-closed-comment/dfn> td>p>This error occurs if the parser encounters a a href#syntax-comments idparse-errors:syntax-comments-4>comment/a> that is closed by the code>--!>/code> a idparse-errors:code-point-8 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> sequence. The parser treats such comments as if they are correctly closed by the code>-->/code> code point sequence./p> tr>td>dfn idparse-error-incorrectly-opened-comment>incorrectly-opened-comment/dfn> td> p>This error occurs if the parser encounters the code><!/code> a idparse-errors:code-point-9 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> sequence that is not immidiately followed by two U+002D (-) code points and that is not the start of a a href#syntax-doctype idparse-errors:syntax-doctype-4>DOCTYPE/a> or a a href#syntax-cdata idparse-errors:syntax-cdata-3>CDATA section/a>. All content that follows the code><!/code> code point sequence up to a U+003E (>) code point (if present) or to the end of the a href#input-stream idparse-errors:input-stream-7>input stream/a> is treated as a comment./p> p classnote>One possible cause of this error is using an XML markup declaration (e.g., code><!ELEMENT br EMPTY>/code>) in HTML./p> tr>td>dfn idparse-error-invalid-character-sequence-after-doctype-name>invalid-character-sequence-after-doctype-name/dfn> td>p>This error occurs if the parser encounters any a idparse-errors:code-point-10 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> sequence other than code>PUBLIC/code> and code>SYSTEM/code> keywords after a a href#syntax-doctype idparse-errors:syntax-doctype-5>DOCTYPE/a> name. In such a case, the parser ignores any following public or system identifiers, and if the DOCTYPE is correctly placed as a document preamble, sets the code idparse-errors:document-4>a href#document>Document/a>/code> to a idparse-errors:quirks-mode-4 hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>./p> tr>td>dfn idparse-error-invalid-first-character-of-tag-name>invalid-first-character-of-tag-name/dfn> td> p>This error occurs if the parser encounters a a idparse-errors:code-point-11 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> that is not an a idparse-errors:ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-alpha data-x-internalascii-letters>ASCII alpha/a> where first code point of a a href#syntax-start-tag idparse-errors:syntax-start-tag-3>start tag/a> name or an a href#syntax-end-tag idparse-errors:syntax-end-tag-5>end tag/a> name is expected. If a start tag was expected such code point and a preceding U+003C (<) is treated as text content, and all content that follows is treated as markup. Whereas, if an end tag was expected, such code point and all content that follows up to a U+003E (>) code point (if present) or to the end of the a href#input-stream idparse-errors:input-stream-8>input stream/a> is treated as a comment./p> div classexample> p>For example, consider the following markup:/p> pre><42></42>/pre> p>This will be parsed into:/p> ul classdomTree>li classt1>code idparse-errors:the-html-element>a href#the-html-element>html/a>/code>ul>li classt1>code idparse-errors:the-head-element>a href#the-head-element>head/a>/code>li classt1>code idparse-errors:the-body-element>a href#the-body-element>body/a>/code>ul>li classt3>code idparse-errors:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span><42>/span>li classt8>code idparse-errors:comment-2>a data-x-internalcomment-2 hrefhttps://dom.spec.whatwg.org/#interface-comment>#comment/a>/code>: span>42/span>/ul>/ul>/ul> /div> p classnote>While the first code point of a tag name is limited to an a idparse-errors:ascii-letters-2 hrefhttps://infra.spec.whatwg.org/#ascii-alpha data-x-internalascii-letters>ASCII alpha/a>, a wide range of code points (including a idparse-errors:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a>) is allowed in subsequent positions./p> tr>td>dfn idparse-error-missing-attribute-value>missing-attribute-value/dfn> td>p>This error occurs if the parser encounters a U+003E (>) a idparse-errors:code-point-12 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> where an a href#syntax-attributes idparse-errors:syntax-attributes-3>attribute/a> value is expected (e.g., code><div id>/code>). The parser treats the attribute as having an empty value./p> tr>td>dfn idparse-error-missing-doctype-name>missing-doctype-name/dfn> td>p>This error occurs if the parser encounters a a href#syntax-doctype idparse-errors:syntax-doctype-6>DOCTYPE/a> that is missing a name (e.g., code><!DOCTYPE>/code>). In such a case, if the DOCTYPE is correctly placed as a document preamble, the parser sets the code idparse-errors:document-5>a href#document>Document/a>/code> to a idparse-errors:quirks-mode-5 hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>./p> tr>td>dfn idparse-error-missing-doctype-public-identifier>missing-doctype-public-identifier/dfn> td>p>This error occurs if the parser encounters a U+003E (>) a idparse-errors:code-point-13 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> where start of the a href#syntax-doctype idparse-errors:syntax-doctype-7>DOCTYPE/a> public identifier is expected (e.g., code><!DOCTYPE html PUBLIC >/code>). In such a case, if the DOCTYPE is correctly placed as a document preamble, the parser sets the code idparse-errors:document-6>a href#document>Document/a>/code> to a idparse-errors:quirks-mode-6 hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>./p> tr>td>dfn idparse-error-missing-doctype-system-identifier>missing-doctype-system-identifier/dfn> td>p>This error occurs if the parser encounters a U+003E (>) a idparse-errors:code-point-14 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> where start of the a href#syntax-doctype idparse-errors:syntax-doctype-8>DOCTYPE/a> system identifier is expected (e.g., code><!DOCTYPE html SYSTEM >/code>). In such a case, if the DOCTYPE is correctly placed as a document preamble, the parser sets the code idparse-errors:document-7>a href#document>Document/a>/code> to a idparse-errors:quirks-mode-7 hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>./p> tr>td>dfn idparse-error-missing-end-tag-name>missing-end-tag-name/dfn> td>p>This error occurs if the parser encounters a U+003E (>) a idparse-errors:code-point-15 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> where an a href#syntax-end-tag idparse-errors:syntax-end-tag-6>end tag/a> name is expected, i.e., code></>/code>. The parser completely ignores whole code></>/code> code point sequence./p> tr>td>dfn idparse-error-missing-quote-before-doctype-public-identifier>missing-quote-before-doctype-public-identifier/dfn> td>p>This error occurs if the parser encounters the a href#syntax-doctype idparse-errors:syntax-doctype-9>DOCTYPE/a> public identifier that is not preceded by a quote (e.g., code><!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01//EN>/code>). In such a case, the parser ignores the public identifier, and if the DOCTYPE is correctly placed as a document preamble, sets the code idparse-errors:document-8>a href#document>Document/a>/code> to a idparse-errors:quirks-mode-8 hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>./p> tr>td>dfn idparse-error-missing-quote-before-doctype-system-identifier>missing-quote-before-doctype-system-identifier/dfn> td>p>This error occurs if the parser encounters the a href#syntax-doctype idparse-errors:syntax-doctype-10>DOCTYPE/a> system identifier that is not preceded by a quote (e.g., code><!DOCTYPE html SYSTEM http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>/code>). In such a case, the parser ignores the system identifier, and if the DOCTYPE is correctly placed as a document preamble, sets the code idparse-errors:document-9>a href#document>Document/a>/code> to a idparse-errors:quirks-mode-9 hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>./p> tr>td>dfn idparse-error-missing-semicolon-after-character-reference>missing-semicolon-after-character-reference/dfn> td> p>This error occurs if the parser encounters a a href#syntax-charref idparse-errors:syntax-charref-4>character reference/a> that is not terminated by a U+003B (;) a idparse-errors:code-point-16 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a>. Usually the parser behaves as if character reference is terminated by the U+003B (;) code point; however, there are some ambiguous cases in which the parser includes subsequent code points in the character reference./p> p classexample>For example, code>¬in/code> will be parsed as code>¬in/code> whereas code>¬in/code> will be parsed as code>∉/code>./p> tr>td>dfn idparse-error-missing-whitespace-after-doctype-public-keyword>missing-whitespace-after-doctype-public-keyword/dfn> td>p>This error occurs if the parser encounters a a href#syntax-doctype idparse-errors:syntax-doctype-11>DOCTYPE/a> whose code>PUBLIC/code> keyword and public identifier are not separated by a idparse-errors:space-characters-3 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>. In this case the parser behaves as if ASCII whitespace is present./p> tr>td>dfn idparse-error-missing-whitespace-after-doctype-system-keyword>missing-whitespace-after-doctype-system-keyword/dfn> td>p>This error occurs if the parser encounters a a href#syntax-doctype idparse-errors:syntax-doctype-12>DOCTYPE/a> whose code>SYSTEM/code> keyword and system identifier are not separated by a idparse-errors:space-characters-4 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>. In this case the parser behaves as if ASCII whitespace is present./p> tr>td>dfn idparse-error-missing-whitespace-before-doctype-name>missing-whitespace-before-doctype-name/dfn> td>p>This error occurs if the parser encounters a a href#syntax-doctype idparse-errors:syntax-doctype-13>DOCTYPE/a> whose code>DOCTYPE/code> keyword and name are not separated by a idparse-errors:space-characters-5 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>. In this case the parser behaves as if ASCII whitespace is present./p> tr>td>dfn idparse-error-missing-whitespace-between-attributes>missing-whitespace-between-attributes/dfn> td>p>This error occurs if the parser encounters a href#syntax-attributes idparse-errors:syntax-attributes-4>attributes/a> that are not separated by a idparse-errors:space-characters-6 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> (e.g., code><div idfooclassbar>/code>). In this case the parser behaves as if ASCII whitespace is present./p> tr>td>dfn idparse-error-missing-whitespace-between-doctype-public-and-system-identifiers>missing-whitespace-between-doctype-public-and-system-identifiers/dfn> td>p>This error occurs if the parser encounters a a href#syntax-doctype idparse-errors:syntax-doctype-14>DOCTYPE/a> whose public and system identifiers are not separated by a idparse-errors:space-characters-7 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>. In this case the parser behaves as if ASCII whitespace is present./p> tr>td>dfn idparse-error-nested-comment>nested-comment/dfn> td>p>This error occurs if the parser encounters a nested a href#syntax-comments idparse-errors:syntax-comments-5>comment/a> (e.g., code><!-- <!-- nested --> -->/code>). Such a comment will be closed by the first occuring code>-->/code> a idparse-errors:code-point-17 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> sequence and everything that follows will be treated as markup./p> tr>td>dfn idparse-error-noncharacter-character-reference>noncharacter-character-reference/dfn> td>p>This error occurs if the parser encounters a numeric a href#syntax-charref idparse-errors:syntax-charref-5>character reference/a> that references a a idparse-errors:noncharacter hrefhttps://infra.spec.whatwg.org/#noncharacter data-x-internalnoncharacter>noncharacter/a>. The parser resolves such character references as-is./p> tr>td>dfn idparse-error-noncharacter-in-input-stream>noncharacter-in-input-stream/dfn> td>p>This error occurs if the a href#input-stream idparse-errors:input-stream-9>input stream/a> contains a a idparse-errors:noncharacter-2 hrefhttps://infra.spec.whatwg.org/#noncharacter data-x-internalnoncharacter>noncharacter/a>. Such a hrefhttps://infra.spec.whatwg.org/#code-point idparse-errors:code-point-18 data-x-internalcode-point>code points/a> are parsed as-is and usually, where parsing rules dont apply any additional restrictions, make their way into the DOM./p> tr>td>dfn idparse-error-non-void-html-element-start-tag-with-trailing-solidus>non-void-html-element-start-tag-with-trailing-solidus/dfn> td> p>This error occurs if the parser encounters a a href#syntax-start-tag idparse-errors:syntax-start-tag-4>start tag/a> for an element that is not in the list of a href#void-elements idparse-errors:void-elements>void elements/a> or is not a part of foreign content (i.e., not an SVG or MathML element) that has a U+002F (/) a idparse-errors:code-point-19 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> right before the closing U+003E (>) code point. The parser behaves as if the U+002F (/) is not present./p> div classexample> p>For example, consider the following markup:/p> pre><div/><span></span><span></span>/pre> p>This will be parsed into:/p> ul classdomTree>li classt1>code idparse-errors:the-html-element-2>a href#the-html-element>html/a>/code>ul>li classt1>code idparse-errors:the-head-element-2>a href#the-head-element>head/a>/code>li classt1>code idparse-errors:the-body-element-2>a href#the-body-element>body/a>/code>ul>li classt1>code idparse-errors:the-div-element>a href#the-div-element>div/a>/code>ul>li classt1>code idparse-errors:the-span-element>a href#the-span-element>span/a>/code>li classt1>code idparse-errors:the-span-element-2>a href#the-span-element>span/a>/code>/ul>/ul>/ul>/ul> /div> p classnote>The trailing U+002F (/) in a start tag name can be used only in foreign content to specify self-closing tags. (Self-closing tags dont exist in HTML.) It is also allowed for void elements, but doesnt have any effect in this case./p> tr>td>dfn idparse-error-null-character-reference>null-character-reference/dfn> td>p>This error occurs if the parser encounters a numeric a href#syntax-charref idparse-errors:syntax-charref-6>character reference/a> that references a U+0000 NULL a idparse-errors:code-point-20 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a>. The parser resolves such character references to a U+FFFD REPLACEMENT CHARACTER./p> tr>td>dfn idparse-error-surrogate-character-reference>surrogate-character-reference/dfn> td>p>This error occurs if the parser encounters a numeric a href#syntax-charref idparse-errors:syntax-charref-7>character reference/a> that references a a idparse-errors:surrogate hrefhttps://infra.spec.whatwg.org/#surrogate data-x-internalsurrogate>surrogate/a>. The parser resolves such character references to a U+FFFD REPLACEMENT CHARACTER./p> tr>td>dfn idparse-error-surrogate-in-input-stream>surrogate-in-input-stream/dfn> td> p>This error occurs if the a href#input-stream idparse-errors:input-stream-10>input stream/a> contains a a hrefhttps://infra.spec.whatwg.org/#surrogate idparse-errors:surrogate-2 data-x-internalsurrogate>surrogate/a>. Such a hrefhttps://infra.spec.whatwg.org/#code-point idparse-errors:code-point-21 data-x-internalcode-point>code points/a> are parsed as-is and usually, where parsing rules dont apply any additional restrictions, make their way into the DOM./p> p classnote>Surrogates can only find their way into the input stream via script APIs such as code idparse-errors:dom-document-write>a href#dom-document-write>document.write()/a>/code>./p> tr>td>dfn idparse-error-unexpected-character-after-doctype-system-identifier>unexpected-character-after-doctype-system-identifier/dfn> td>p>This error occurs if the parser encounters any a hrefhttps://infra.spec.whatwg.org/#code-point idparse-errors:code-point-22 data-x-internalcode-point>code points/a> other than a idparse-errors:space-characters-8 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> or closing U+003E (>) after the a href#syntax-doctype idparse-errors:syntax-doctype-15>DOCTYPE/a> system identifier. The parser ignores these code points./p> tr>td>dfn idparse-error-unexpected-character-in-attribute-name>unexpected-character-in-attribute-name/dfn> td> p>This error occurs if the parser encounters a U+0022 (), U+0027 (), or U+003C (<) a idparse-errors:code-point-23 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> in an a href#syntax-attribute-name idparse-errors:syntax-attribute-name>attribute name/a>. The parser includes such code points in the attribute name./p> p classnote>Code points that trigger this error are usually a part of another syntactic construct and can be a sign of a typo around the attribute name./p> div classexample> p>For example, consider the following markup:/p> pre><div foo<div>/pre> p>Due to a forgotten U+003E (>) code point after code>foo/code> the parser treats this markup as a single code idparse-errors:the-div-element-2>a href#the-div-element>div/a>/code> element with a code>foo<div/code> attribute./p> p>As another example of this error, consider the following markup:/p> pre><div idbar>/pre> p>Due to a forgotten U+003D () code point between an attribute name and value the parser treats this markup as a code idparse-errors:the-div-element-3>a href#the-div-element>div/a>/code> element with the attribute code>idbar/code> that has an empty value./p> /div> tr>td>dfn idparse-error-unexpected-character-in-unquoted-attribute-value>unexpected-character-in-unquoted-attribute-value/dfn> td> p>This error occurs if the parser encounters a U+0022 (), U+0027 (), U+003C (<), U+003D (), or U+0060 (`) a idparse-errors:code-point-24 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> in an unquoted a href#syntax-attribute-value idparse-errors:syntax-attribute-value>attribute value/a>. The parser includes such code points in the attribute value./p> p classnote>Code points that trigger this error are usually a part of another syntactic construct and can be a sign of a typo around the attribute value./p> p classnote>U+0060 (`) is in the list of code points that trigger this error because certain legacy user agents treat it as a quote./p> div classexample> p>For example, consider the following markup:/p> pre><div foobar>/pre> p>Due to a misplaced U+0027 () code point the parser sets the value of the code>foo/code> attribute to code>bar/code>./p> /div> tr>td>dfn idparse-error-unexpected-equals-sign-before-attribute-name>unexpected-equals-sign-before-attribute-name/dfn> td> p>This error occurs if the parser encounters a U+003D () a idparse-errors:code-point-25 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> before an attribute name. In this case the parser treats U+003D () as the first code point of the attribute name./p> p classnote>The common reason for this error is a forgotten attribute name./p> div classexample> p>For example, consider the following markup:/p> pre><div foobar baz>/pre> p>Due to a forgotten attribute name the parser treats this markup as a code idparse-errors:the-div-element-4>a href#the-div-element>div/a>/code> element with two attributes: a code>foo/code> attribute with a code>bar/code> value and a code>baz/code> attribute with an empty value./p> /div> tr>td>dfn idparse-error-unexpected-null-character>unexpected-null-character/dfn> td>p>This error occurs if the parser encounters a U+0000 NULL a idparse-errors:code-point-26 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> in the a href#input-stream idparse-errors:input-stream-11>input stream/a> in certain positions. In general, such code points are either completely ignored or, for security reasons, replaced with a U+FFFD REPLACEMENT CHARACTER./p> tr>td>dfn idparse-error-unexpected-question-mark-instead-of-tag-name>unexpected-question-mark-instead-of-tag-name/dfn> td> p>This error occurs if the parser encounters a U+003F (?) a idparse-errors:code-point-27 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> where first code point of a a href#syntax-start-tag idparse-errors:syntax-start-tag-5>start tag/a> name is expected. The U+003F (?) and all content that follows up to a U+003E (>) code point (if present) or to the end of the a href#input-stream idparse-errors:input-stream-12>input stream/a> is treated as a comment./p> div classexample> p>For example, consider the following markup:/p> pre><?xml-stylesheet typetext/css hrefstyle.css?>/pre> p>This will be parsed into:/p> ul classdomTree>li classt8>code idparse-errors:comment-2-2>a data-x-internalcomment-2 hrefhttps://dom.spec.whatwg.org/#interface-comment>#comment/a>/code>: span>?xml-stylesheet typetext/css hrefstyle.css?/span>li classt1>code idparse-errors:the-html-element-3>a href#the-html-element>html/a>/code>ul>li classt1>code idparse-errors:the-head-element-3>a href#the-head-element>head/a>/code>li classt1>code idparse-errors:the-body-element-3>a href#the-body-element>body/a>/code>/ul>/ul> /div> p classnote>The common reason for this error is an XML processing instruction (e.g., code><?xml-stylesheet typetext/css hrefstyle.css?>/code>) or an XML declaration (e.g., code><?xml version1.0 encodingUTF-8?>/code>) being used in HTML./p> tr>td>dfn idparse-error-unexpected-solidus-in-tag>unexpected-solidus-in-tag/dfn> td>p>This error occurs if the parser encounters a U+002F (/) a idparse-errors:code-point-28 hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> that is not a part of a quoted a href#syntax-attributes idparse-errors:syntax-attributes-5>attribute/a> value and not immediately followed by a U+003E (>) code point in a tag (e.g., code><div / idfoo>/code>). In this case the parser behaves as if it encountered a idparse-errors:space-characters-9 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>./p> tr>td>dfn idparse-error-unknown-named-character-reference>unknown-named-character-reference/dfn> td>p>This error occurs if the parser encounters an a href#syntax-ambiguous-ampersand idparse-errors:syntax-ambiguous-ampersand>ambiguous ampersand/a>. In this case the parser doesnt resolve the a href#syntax-charref idparse-errors:syntax-charref-8>character reference/a>./p> /table> h4 idthe-input-byte-stream>span classsecno>12.2.3/span> The dfn>input byte stream/dfn>a href#the-input-byte-stream classself-link>/a>/h4> p>The stream of code points that comprises the input to the tokenization stage will be initially seen by the user agent as a stream of bytes (typically coming over the network or from the local file system). The bytes encode the actual characters according to a particular i>character encoding/i>, which the user agent uses to decode the bytes into characters./p> p classnote>For XML documents, the algorithm user agents are required to use to determine the character encoding is given by the XML specification. This section does not apply to XML documents. a href#refsXML>XML/a>/p> p>Usually, the a href#encoding-sniffing-algorithm idthe-input-byte-stream:encoding-sniffing-algorithm>encoding sniffing algorithm/a> defined below is used to determine the character encoding./p> p>Given a character encoding, the bytes in the a href#the-input-byte-stream idthe-input-byte-stream:the-input-byte-stream>input byte stream/a> must be converted to characters for the tokenizers a href#input-stream idthe-input-byte-stream:input-stream>input stream/a>, by passing the a href#the-input-byte-stream idthe-input-byte-stream:the-input-byte-stream-2>input byte stream/a> and character encoding to a idthe-input-byte-stream:decode hrefhttps://encoding.spec.whatwg.org/#decode data-x-internaldecode>decode/a>./p> p classnote>A leading Byte Order Mark (BOM) causes the character encoding argument to be ignored and will itself be skipped./p> p classnote>Bytes or sequences of bytes in the original byte stream that did not conform to the Encoding standard (e.g. invalid UTF-8 byte sequences in a UTF-8 input byte stream) are errors that conformance checkers are expected to report. a href#refsENCODING>ENCODING/a>/p> p classwarning>The decoder algorithms describe how to handle invalid input; for security reasons, it is imperative that those rules be followed precisely. Differences in how invalid byte sequences are handled can result in, amongst other problems, script injection vulnerabilities (XSS)./p> p>When the HTML parser is decoding an input byte stream, it uses a character encoding and a dfn idconcept-encoding-confidence>confidence/dfn>. The confidence is either i>tentative/i>, i>certain/i>, or i>irrelevant/i>. The encoding used, and whether the confidence in that encoding is i>tentative/i> or i>certain/i>, is a href#meta-charset-during-parse>used during the parsing/a> to determine whether to a href#change-the-encoding idthe-input-byte-stream:change-the-encoding>change the encoding/a>. If no encoding is necessary, e.g. because the parser is operating on a Unicode stream and doesnt have to use a character encoding at all, then the a href#concept-encoding-confidence idthe-input-byte-stream:concept-encoding-confidence>confidence/a> is i>irrelevant/i>./p> p classnote>Some algorithms feed the parser by directly adding characters to the a href#input-stream idthe-input-byte-stream:input-stream-2>input stream/a> rather than adding bytes to the a href#the-input-byte-stream idthe-input-byte-stream:the-input-byte-stream-3>input byte stream/a>./p> h5 idparsing-with-a-known-character-encoding>span classsecno>12.2.3.1/span> Parsing with a known character encodinga href#parsing-with-a-known-character-encoding classself-link>/a>/h5> p>When the HTML parser is to operate on an input byte stream that has dfn ida-known-definite-encoding data-export>a known definite encoding/dfn>, then the character encoding is that encoding and the a href#concept-encoding-confidence idparsing-with-a-known-character-encoding:concept-encoding-confidence>confidence/a> is i>certain/i>./p> h5 iddetermining-the-character-encoding>span classsecno>12.2.3.2/span> Determining the character encodinga href#determining-the-character-encoding classself-link>/a>/h5> p>In some cases, it might be impractical to unambiguously determine the encoding before parsing the document. Because of this, this specification provides for a two-pass mechanism with an optional pre-scan. Implementations are allowed, as described below, to apply a simplified parsing algorithm to whatever bytes they have available before beginning to parse the document. Then, the real parser is started, using a tentative encoding derived from this pre-parse and other out-of-band metadata. If, while the document is being loaded, the user agent discovers a character encoding declaration that conflicts with this information, then the parser can get reinvoked to perform a parse of the document with the real encoding./p> p iddocumentEncoding>User agents must use the following algorithm, called the dfn idencoding-sniffing-algorithm>encoding sniffing algorithm/dfn>, to determine the character encoding to use when decoding a document in the first pass. This algorithm takes as input any out-of-band metadata available to the user agent (e.g. the a href#content-type iddetermining-the-character-encoding:content-type>Content-Type metadata/a> of the document) and all the bytes available so far, and returns a character encoding and a a href#concept-encoding-confidence iddetermining-the-character-encoding:concept-encoding-confidence>confidence/a> that is either i>tentative/i> or i>certain/i>./p> ol>li> p>If the user has explicitly instructed the user agent to override the documents character encoding with a specific encoding, optionally return that encoding with the a href#concept-encoding-confidence iddetermining-the-character-encoding:concept-encoding-confidence-2>confidence/a> i>certain/i> and abort these steps./p> p classnote>Typically, user agents remember such user requests across sessions, and in some cases apply them to documents in code iddetermining-the-character-encoding:the-iframe-element>a href#the-iframe-element>iframe/a>/code>s as well./p> li> p>The user agent may wait for more bytes of the resource to be available, either in this step or at any later step in this algorithm. For instance, a user agent might wait 500ms or 1024 bytes, whichever came first. In general preparsing the source to find the encoding improves performance, as it reduces the need to throw away the data structures used when parsing upon finding the encoding information. However, if the user agent delays too long to obtain data to determine the encoding, then the cost of the delay could outweigh any performance improvements from the preparse./p> p classnote>The authoring conformance requirements for character encoding declarations limit them to only appearing a href#charset1024>in the first 1024 bytes/a>. User agents are therefore encouraged to use the prescan algorithm below (as invoked by these steps) on the first 1024 bytes, but not to stall beyond that./p> li>p>If the transport layer specifies a character encoding, and it is supported, return that encoding with the a href#concept-encoding-confidence iddetermining-the-character-encoding:concept-encoding-confidence-3>confidence/a> i>certain/i>, and abort these steps.li> p>Optionally a href#prescan-a-byte-stream-to-determine-its-encoding iddetermining-the-character-encoding:prescan-a-byte-stream-to-determine-its-encoding>prescan the byte stream to determine its encoding/a>. The var>end condition/var> is that the user agent decides that scanning further bytes would not be efficient. User agents are encouraged to only prescan the first 1024 bytes. User agents may decide that scanning em>any/em> bytes is not efficient, in which case these substeps are entirely skipped./p> p>The aforementioned algorithm either aborts unsuccessfully or returns a character encoding. If it returns a character encoding, then this algorithm must be aborted, returning the same encoding, with a href#concept-encoding-confidence iddetermining-the-character-encoding:concept-encoding-confidence-4>confidence/a> i>tentative/i>./p> li> p>If the a href#html-parser iddetermining-the-character-encoding:html-parser>HTML parser/a> for which this algorithm is being run is associated with a code iddetermining-the-character-encoding:document>a href#document>Document/a>/code> that is itself in a a href#nested-browsing-context iddetermining-the-character-encoding:nested-browsing-context>nested browsing context/a>, run these substeps:/p> ol>li>p>Let var>new document/var> be the code iddetermining-the-character-encoding:document-2>a href#document>Document/a>/code> with which the a href#html-parser iddetermining-the-character-encoding:html-parser-2>HTML parser/a> is associated.li>p>Let var>parent document/var> be the code iddetermining-the-character-encoding:document-3>a href#document>Document/a>/code> a href#browsing-context-nested-through iddetermining-the-character-encoding:browsing-context-nested-through>through which var>new document/var> is nested/a> (the a href#active-document iddetermining-the-character-encoding:active-document>active document/a> of the a href#parent-browsing-context iddetermining-the-character-encoding:parent-browsing-context>parent browsing context/a> of var>new document/var>).li>p>If var>parent document/var>s a href#concept-origin iddetermining-the-character-encoding:concept-origin>origin/a> is not the a href#same-origin iddetermining-the-character-encoding:same-origin>same origin/a> as var>new document/var>s a href#concept-origin iddetermining-the-character-encoding:concept-origin-2>origin/a>, then abort these substeps.li>p>If var>parent document/var>s a hrefhttps://dom.spec.whatwg.org/#concept-document-encoding iddetermining-the-character-encoding:documents-character-encoding data-x-internaldocuments-character-encoding>character encoding/a> is not an a href#ascii-compatible-encoding iddetermining-the-character-encoding:ascii-compatible-encoding>ASCII-compatible encoding/a>, then abort these substeps.li>p>Return var>parent document/var>s a hrefhttps://dom.spec.whatwg.org/#concept-document-encoding iddetermining-the-character-encoding:documents-character-encoding-2 data-x-internaldocuments-character-encoding>character encoding/a>, with the a href#concept-encoding-confidence iddetermining-the-character-encoding:concept-encoding-confidence-5>confidence/a> i>tentative/i>, and abort the a href#encoding-sniffing-algorithm iddetermining-the-character-encoding:encoding-sniffing-algorithm>encoding sniffing algorithm/a>s steps./ol> li>p>Otherwise, if the user agent has information on the likely encoding for this page, e.g. based on the encoding of the page when it was last visited, then return that encoding, with the a href#concept-encoding-confidence iddetermining-the-character-encoding:concept-encoding-confidence-6>confidence/a> i>tentative/i>, and abort these steps.li> p>The user agent may attempt to autodetect the character encoding from applying frequency analysis or other algorithms to the data stream. Such algorithms may use information about the resource other than the resources contents, including the address of the resource. If autodetection succeeds in determining a character encoding, and that encoding is a supported encoding, then return that encoding, with the a href#concept-encoding-confidence iddetermining-the-character-encoding:concept-encoding-confidence-7>confidence/a> i>tentative/i>, and abort these steps. a href#refsUNIVCHARDET>UNIVCHARDET/a>/p> p classnote>User agents are generally discouraged from attempting to autodetect encodings for resources obtained over the network, since doing so involves inherently non-interoperable heuristics. Attempting to detect encodings based on an HTML documents preamble is especially tricky since HTML markup typically uses only ASCII characters, and HTML documents tend to begin with a lot of markup rather than with text content./p> p classnote>The UTF-8 encoding has a highly detectable bit pattern. Files from the local file system that contain bytes with values greater than 0x7F which match the UTF-8 pattern are very likely to be UTF-8, while documents with byte sequences that do not match it are very likely not. When a user agent can examine the whole file, rather than just the preamble, detecting for UTF-8 specifically can be especially effective. a href#refsPPUTF8>PPUTF8/a> a href#refsUTF8DET>UTF8DET/a>/p> li> p>Otherwise, return an implementation-defined or user-specified default character encoding, with the a href#concept-encoding-confidence iddetermining-the-character-encoding:concept-encoding-confidence-8>confidence/a> i>tentative/i>./p> p>In controlled environments or in environments where the encoding of documents can be prescribed (for example, for user agents intended for dedicated use in new networks), the comprehensive code>UTF-8/code> encoding is suggested./p> p>In other environments, the default encoding is typically dependent on the users locale (an approximation of the languages, and thus often encodings, of the pages that the user is likely to frequent). The following table gives suggested defaults based on the users locale, for compatibility with legacy content. Locales are identified by BCP 47 language tags. a href#refsBCP47>BCP47/a> a href#refsENCODING>ENCODING/a>/p> table>thead>tr>th colspan2>Locale language th>Suggested default encoding tbody>tr>td>ar td>Arabic td>a iddetermining-the-character-encoding:windows-1256 hrefhttps://encoding.spec.whatwg.org/#windows-1256 data-x-internalwindows-1256>windows-1256/a> tr>td>ba td>Bashkir td>a iddetermining-the-character-encoding:windows-1251 hrefhttps://encoding.spec.whatwg.org/#windows-1251 data-x-internalwindows-1251>windows-1251/a> tr>td>be td>Belarusian td>a iddetermining-the-character-encoding:windows-1251-2 hrefhttps://encoding.spec.whatwg.org/#windows-1251 data-x-internalwindows-1251>windows-1251/a> tr>td>bg td>Bulgarian td>a iddetermining-the-character-encoding:windows-1251-3 hrefhttps://encoding.spec.whatwg.org/#windows-1251 data-x-internalwindows-1251>windows-1251/a> tr>td>cs td>Czech td>a iddetermining-the-character-encoding:windows-1250 hrefhttps://encoding.spec.whatwg.org/#windows-1250 data-x-internalwindows-1250>windows-1250/a> tr>td>el td>Greek td>a iddetermining-the-character-encoding:iso-8859-7 hrefhttps://encoding.spec.whatwg.org/#iso-8859-7 data-x-internaliso-8859-7>ISO-8859-7/a> tr>td>et td>Estonian td>a iddetermining-the-character-encoding:windows-1257 hrefhttps://encoding.spec.whatwg.org/#windows-1257 data-x-internalwindows-1257>windows-1257/a> tr>td>fa td>Persian td>a iddetermining-the-character-encoding:windows-1256-2 hrefhttps://encoding.spec.whatwg.org/#windows-1256 data-x-internalwindows-1256>windows-1256/a> tr>td>he td>Hebrew td>a iddetermining-the-character-encoding:windows-1255 hrefhttps://encoding.spec.whatwg.org/#windows-1255 data-x-internalwindows-1255>windows-1255/a> tr>td>hr td>Croatian td>a iddetermining-the-character-encoding:windows-1250-2 hrefhttps://encoding.spec.whatwg.org/#windows-1250 data-x-internalwindows-1250>windows-1250/a> tr>td>hu td>Hungarian td>a iddetermining-the-character-encoding:iso-8859-2 hrefhttps://encoding.spec.whatwg.org/#iso-8859-2 data-x-internaliso-8859-2>ISO-8859-2/a> tr>td>ja td>Japanese td>a iddetermining-the-character-encoding:shift_jis hrefhttps://encoding.spec.whatwg.org/#shift_jis data-x-internalshift_jis>Shift_JIS/a> tr>td>kk td>Kazakh td>a iddetermining-the-character-encoding:windows-1251-4 hrefhttps://encoding.spec.whatwg.org/#windows-1251 data-x-internalwindows-1251>windows-1251/a> tr>td>ko td>Korean td>a iddetermining-the-character-encoding:euc-kr hrefhttps://encoding.spec.whatwg.org/#euc-kr data-x-internaleuc-kr>EUC-KR/a> tr>td>ku td>Kurdish td>a iddetermining-the-character-encoding:windows-1254 hrefhttps://encoding.spec.whatwg.org/#windows-1254 data-x-internalwindows-1254>windows-1254/a> tr>td>ky td>Kyrgyz td>a iddetermining-the-character-encoding:windows-1251-5 hrefhttps://encoding.spec.whatwg.org/#windows-1251 data-x-internalwindows-1251>windows-1251/a> tr>td>lt td>Lithuanian td>a iddetermining-the-character-encoding:windows-1257-2 hrefhttps://encoding.spec.whatwg.org/#windows-1257 data-x-internalwindows-1257>windows-1257/a> tr>td>lv td>Latvian td>a iddetermining-the-character-encoding:windows-1257-3 hrefhttps://encoding.spec.whatwg.org/#windows-1257 data-x-internalwindows-1257>windows-1257/a> tr>td>mk td>Macedonian td>a iddetermining-the-character-encoding:windows-1251-6 hrefhttps://encoding.spec.whatwg.org/#windows-1251 data-x-internalwindows-1251>windows-1251/a> tr>td>pl td>Polish td>a iddetermining-the-character-encoding:iso-8859-2-2 hrefhttps://encoding.spec.whatwg.org/#iso-8859-2 data-x-internaliso-8859-2>ISO-8859-2/a> tr>td>ru td>Russian td>a iddetermining-the-character-encoding:windows-1251-7 hrefhttps://encoding.spec.whatwg.org/#windows-1251 data-x-internalwindows-1251>windows-1251/a> tr>td>sah td>Yakut td>a iddetermining-the-character-encoding:windows-1251-8 hrefhttps://encoding.spec.whatwg.org/#windows-1251 data-x-internalwindows-1251>windows-1251/a> tr>td>sk td>Slovak td>a iddetermining-the-character-encoding:windows-1250-3 hrefhttps://encoding.spec.whatwg.org/#windows-1250 data-x-internalwindows-1250>windows-1250/a> tr>td>sl td>Slovenian td>a iddetermining-the-character-encoding:iso-8859-2-3 hrefhttps://encoding.spec.whatwg.org/#iso-8859-2 data-x-internaliso-8859-2>ISO-8859-2/a> tr>td>sr td>Serbian td>a iddetermining-the-character-encoding:windows-1251-9 hrefhttps://encoding.spec.whatwg.org/#windows-1251 data-x-internalwindows-1251>windows-1251/a> tr>td>tg td>Tajik td>a iddetermining-the-character-encoding:windows-1251-10 hrefhttps://encoding.spec.whatwg.org/#windows-1251 data-x-internalwindows-1251>windows-1251/a> tr>td>th td>Thai td>a iddetermining-the-character-encoding:windows-874 hrefhttps://encoding.spec.whatwg.org/#windows-874 data-x-internalwindows-874>windows-874/a> tr>td>tr td>Turkish td>a iddetermining-the-character-encoding:windows-1254-2 hrefhttps://encoding.spec.whatwg.org/#windows-1254 data-x-internalwindows-1254>windows-1254/a> tr>td>tt td>Tatar td>a iddetermining-the-character-encoding:windows-1251-11 hrefhttps://encoding.spec.whatwg.org/#windows-1251 data-x-internalwindows-1251>windows-1251/a> tr>td>uk td>Ukrainian td>a iddetermining-the-character-encoding:windows-1251-12 hrefhttps://encoding.spec.whatwg.org/#windows-1251 data-x-internalwindows-1251>windows-1251/a> tr>td>vi td>Vietnamese td>a iddetermining-the-character-encoding:windows-1258 hrefhttps://encoding.spec.whatwg.org/#windows-1258 data-x-internalwindows-1258>windows-1258/a> tr>td>zh-CN td>Chinese (Peoples Republic of China) td>a iddetermining-the-character-encoding:gb18030 hrefhttps://encoding.spec.whatwg.org/#gb18030 data-x-internalgb18030>gb18030/a> tr>td>zh-TW td>Chinese (Taiwan) td>a iddetermining-the-character-encoding:big5 hrefhttps://encoding.spec.whatwg.org/#big5 data-x-internalbig5>Big5/a> tr>td colspan2>All other locales td>a iddetermining-the-character-encoding:windows-1252 hrefhttps://encoding.spec.whatwg.org/#windows-1252 data-x-internalwindows-1252>windows-1252/a> /table> p classtablenote>small>The contents of this table are derived from the intersection of Windows, Chrome, and Firefox defaults./small>/p> /ol> p>The a iddetermining-the-character-encoding:documents-character-encoding-3 hrefhttps://dom.spec.whatwg.org/#concept-document-encoding data-x-internaldocuments-character-encoding>documents character encoding/a> must immediately be set to the value returned from this algorithm, at the same time as the user agent uses the returned value to select the decoder to use for the input byte stream./p> hr> p>When an algorithm requires a user agent to dfn idprescan-a-byte-stream-to-determine-its-encoding data-export>prescan a byte stream to determine its encoding/dfn>, given some defined var>end condition/var>, then it must run the following steps. These steps either abort unsuccessfully or return a character encoding. If at any point during these steps (including during instances of the a href#concept-get-attributes-when-sniffing iddetermining-the-character-encoding:concept-get-attributes-when-sniffing>get an attribute/a> algorithm invoked by this one) the user agent either runs out of bytes (meaning the var>position/var> pointer created in the first step below goes beyond the end of the byte stream obtained so far) or reaches its var>end condition/var>, then abort the a href#prescan-a-byte-stream-to-determine-its-encoding iddetermining-the-character-encoding:prescan-a-byte-stream-to-determine-its-encoding-2>prescan a byte stream to determine its encoding/a> algorithm unsuccessfully./p> ol>li> p>Let var>position/var> be a pointer to a byte in the input byte stream, initially pointing at the first byte./p> li> p>i>Loop/i>: If var>position/var> points to:/p> dl classswitch>dt>A sequence of bytes starting with: 0x3C 0x21 0x2D 0x2D (`code><!--/code>`)dd> p>Advance the var>position/var> pointer so that it points at the first 0x3E byte which is preceded by two 0x2D bytes (i.e. at the end of an ASCII --> sequence) and comes after the 0x3C byte that was found. (The two 0x2D bytes can be the same as those in the <!-- sequence.)/p> dt>A sequence of bytes starting with: 0x3C, 0x4D or 0x6D, 0x45 or 0x65, 0x54 or 0x74, 0x41 or 0x61, and one of 0x09, 0x0A, 0x0C, 0x0D, 0x20, 0x2F (case-insensitive ASCII <meta followed by a space or slash)dd> ol>li>p>Advance the var>position/var> pointer so that it points at the next 0x09, 0x0A, 0x0C, 0x0D, 0x20, or 0x2F byte (the one in sequence of characters matched above).li>p>Let var>attribute list/var> be an empty list of strings.li>p>Let var>got pragma/var> be false.li>p>Let var>need pragma/var> be null.li>p>Let var>charset/var> be the null value (which, for the purposes of this algorithm, is distinct from an unrecognized encoding or the empty string).li>p>i>Attributes/i>: a href#concept-get-attributes-when-sniffing iddetermining-the-character-encoding:concept-get-attributes-when-sniffing-2>Get an attribute/a> and its value. If no attribute was sniffed, then jump to the i>processing/i> step below.li>p>If the attributes name is already in var>attribute list/var>, then return to the step labeled i>attributes/i>./p> li>p>Add the attributes name to var>attribute list/var>./p> li> p>Run the appropriate step from the following list, if one applies:/p> dl classswitch>dt>If the attributes name is code>http-equiv/code>dd>p>If the attributes value is code>content-type/code>, then set var>got pragma/var> to true.dt>If the attributes name is code>content/code>dd>p>Apply the a href#algorithm-for-extracting-a-character-encoding-from-a-meta-element iddetermining-the-character-encoding:algorithm-for-extracting-a-character-encoding-from-a-meta-element>algorithm for extracting a character encoding from a code>meta/code> element/a>, giving the attributes value as the string to parse. If a character encoding is returned, and if var>charset/var> is still set to null, let var>charset/var> be the encoding returned, and set var>need pragma/var> to true.dt>If the attributes name is code>charset/code>dd>p>Let var>charset/var> be the result of a iddetermining-the-character-encoding:getting-an-encoding hrefhttps://encoding.spec.whatwg.org/#concept-encoding-get data-x-internalgetting-an-encoding>getting an encoding/a> from the attributes value, and set var>need pragma/var> to false./dl> li>p>Return to the step labeled i>attributes/i>.li>p>i>Processing/i>: If var>need pragma/var> is null, then jump to the step below labeled i>next byte/i>.li>p>If var>need pragma/var> is true but var>got pragma/var> is false, then jump to the step below labeled i>next byte/i>.li>p>If var>charset/var> is failure, then jump to the step below labeled i>next byte/i>.li>p>If var>charset/var> is a a href#utf-16-encoding iddetermining-the-character-encoding:utf-16-encoding>UTF-16 encoding/a>, then set var>charset/var> to a iddetermining-the-character-encoding:utf-8 hrefhttps://encoding.spec.whatwg.org/#utf-8 data-x-internalutf-8>UTF-8/a>. li>p>If var>charset/var> is a iddetermining-the-character-encoding:x-user-defined hrefhttps://encoding.spec.whatwg.org/#x-user-defined data-x-internalx-user-defined>x-user-defined/a>, then set var>charset/var> to a iddetermining-the-character-encoding:windows-1252-2 hrefhttps://encoding.spec.whatwg.org/#windows-1252 data-x-internalwindows-1252>windows-1252/a>.li>p>Abort the a href#prescan-a-byte-stream-to-determine-its-encoding iddetermining-the-character-encoding:prescan-a-byte-stream-to-determine-its-encoding-3>prescan a byte stream to determine its encoding/a> algorithm, returning the encoding given by var>charset/var>./ol> dt>A sequence of bytes starting with a 0x3C byte (<), optionally a 0x2F byte (/), and finally a byte in the range 0x41-0x5A or 0x61-0x7A (A-Z or a-z)dd> ol>li>p>Advance the var>position/var> pointer so that it points at the next 0x09 (HT), 0x0A (LF), 0x0C (FF), 0x0D (CR), 0x20 (SP), or 0x3E (>) byte.li>p>Repeatedly a href#concept-get-attributes-when-sniffing iddetermining-the-character-encoding:concept-get-attributes-when-sniffing-3>get an attribute/a> until no further attributes can be found, then jump to the step below labeled i>next byte/i>./ol> dt>A sequence of bytes starting with: 0x3C 0x21 (`code><!/code>`)dt>A sequence of bytes starting with: 0x3C 0x2F (`code><//code>`)dt>A sequence of bytes starting with: 0x3C 0x3F (`code><?/code>`)dd> p>Advance the var>position/var> pointer so that it points at the first 0x3E byte (>) that comes after the 0x3C byte that was found./p> dt>Any other bytedd> p>Do nothing with that byte./p> /dl> li>i>Next byte/i>: Move var>position/var> so it points at the next byte in the input byte stream, and return to the step above labeled i>loop/i>./ol> p>When the a href#prescan-a-byte-stream-to-determine-its-encoding iddetermining-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 idconcept-get-attributes-when-sniffing>get an attribute/dfn>, it means doing this:/p> ol>li>p>If the byte at var>position/var> is one of 0x09 (HT), 0x0A (LF), 0x0C (FF), 0x0D (CR), 0x20 (SP), or 0x2F (/) then advance var>position/var> to the next byte and redo this step.li>p>If the byte at var>position/var> is 0x3E (>), then abort the a href#concept-get-attributes-when-sniffing iddetermining-the-character-encoding:concept-get-attributes-when-sniffing-4>get an attribute/a> algorithm. There isnt one.li>p>Otherwise, the byte at var>position/var> is the start of the attribute name. Let var>attribute name/var> and var>attribute value/var> be the empty string.li>p>Process the byte at var>position/var> as follows:/p> dl classswitch>dt>If it is 0x3D (), and the var>attribute name/var> is longer than the empty stringdd>Advance var>position/var> to the next byte and jump to the step below labeled i>value/i>.dt>If it is 0x09 (HT), 0x0A (LF), 0x0C (FF), 0x0D (CR), or 0x20 (SP)dd>Jump to the step below labeled i>spaces/i>.dt>If it is 0x2F (/) or 0x3E (>)dd>Abort the a href#concept-get-attributes-when-sniffing iddetermining-the-character-encoding:concept-get-attributes-when-sniffing-5>get an attribute/a> algorithm. The attributes name is the value of var>attribute name/var>, its value is the empty string.dt>If it is in the range 0x41 (A) to 0x5A (Z)dd>Append the code point var>b/var>+0x20 to var>attribute name/var> (where var>b/var> is the value of the byte at var>position/var>). (This converts the input to lowercase.)dt>Anything elsedd>Append the code point with the same value as the byte at var>position/var> to var>attribute name/var>. (It doesnt actually matter how bytes outside the ASCII range are handled here, since only ASCII bytes can contribute to the detection of a character encoding.)/dl> li>p>Advance var>position/var> to the next byte and return to the previous step.li>p>i>Spaces/i>: If the byte at var>position/var> is one of 0x09 (HT), 0x0A (LF), 0x0C (FF), 0x0D (CR), or 0x20 (SP) 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 (), abort the a href#concept-get-attributes-when-sniffing iddetermining-the-character-encoding:concept-get-attributes-when-sniffing-6>get an attribute/a> algorithm. The attributes name is the value of var>attribute name/var>, its value is the empty string.li>p>Advance var>position/var> past the 0x3D () byte.li>p>i>Value/i>: If the byte at var>position/var> is one of 0x09 (HT), 0x0A (LF), 0x0C (FF), 0x0D (CR), or 0x20 (SP) then advance var>position/var> to the next byte, then, repeat this step.li>p>Process the byte at var>position/var> as follows:/p> dl classswitch>dt>If it is 0x22 () or 0x27 ()dd> ol>li>Let var>b/var> be the value of the byte at var>position/var>.li>i>Quote loop/i>: Advance var>position/var> to the next byte.li>If the value of the byte at var>position/var> is the value of var>b/var>, then advance var>position/var> to the next byte and abort the get an attribute algorithm. The attributes name is the value of var>attribute name/var>, and its value is the value of var>attribute value/var>.li>Otherwise, if the value of the byte at var>position/var> is in the range 0x41 (A) to 0x5A (Z), then append a code point to var>attribute value/var> whose value is 0x20 more than the value of the byte at var>position/var>.li>Otherwise, append a code point to var>attribute value/var> whose value is the same as the value of the byte at var>position/var>.li>Return to the step above labeled i>quote loop/i>./ol> dt>If it is 0x3E (>)dd>Abort the a href#concept-get-attributes-when-sniffing iddetermining-the-character-encoding:concept-get-attributes-when-sniffing-7>get an attribute/a> algorithm. The attributes name is the value of var>attribute name/var>, its value is the empty string.dt>If it is in the range 0x41 (A) to 0x5A (Z)dd>Append a code point var>b/var>+0x20 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 elsedd>Append a code point with the same value as the byte at var>position/var> to var>attribute value/var>. Advance var>position/var> to the next byte./dl> li>p>Process the byte at var>position/var> as follows:/p> dl classswitch>dt>If it is 0x09 (HT), 0x0A (LF), 0x0C (FF), 0x0D (CR), 0x20 (SP), or 0x3E (>)dd>Abort the a href#concept-get-attributes-when-sniffing iddetermining-the-character-encoding:concept-get-attributes-when-sniffing-8>get an attribute/a> algorithm. The attributes name is the value of var>attribute name/var> and its value is the value of var>attribute value/var>.dt>If it is in the range 0x41 (A) to 0x5A (Z)dd>Append a code point var>b/var>+0x20 to var>attribute value/var> (where var>b/var> is the value of the byte at var>position/var>).dt>Anything elsedd>Append a code point with the same value as the byte at var>position/var> to var>attribute value/var>./dl> li>p>Advance var>position/var> to the next byte and return to the previous step./ol> p>For the sake of interoperability, user agents should not use a pre-scan algorithm that returns different results than the one described above. (But, if you do, please at least let us know, so that we can improve this algorithm and benefit everyone...)/p> h5 idcharacter-encodings>span classsecno>12.2.3.3/span> Character encodingsa href#character-encodings classself-link>/a>/h5> p>User agents must support the encodings defined in the WHATWG Encoding standard, including, but not limited to, dfn idutf-8>a hrefhttps://encoding.spec.whatwg.org/#utf-8>UTF-8/a>/dfn>, dfn idiso-8859-2>a hrefhttps://encoding.spec.whatwg.org/#iso-8859-2>ISO-8859-2/a>/dfn>, dfn idiso-8859-7>a hrefhttps://encoding.spec.whatwg.org/#iso-8859-7>ISO-8859-7/a>/dfn>, dfn idiso-8859-8>a hrefhttps://encoding.spec.whatwg.org/#iso-8859-8>ISO-8859-8/a>/dfn>, dfn idwindows-874>a hrefhttps://encoding.spec.whatwg.org/#windows-874>windows-874/a>/dfn>, dfn idwindows-1250>a hrefhttps://encoding.spec.whatwg.org/#windows-1250>windows-1250/a>/dfn>, dfn idwindows-1251>a hrefhttps://encoding.spec.whatwg.org/#windows-1251>windows-1251/a>/dfn>, dfn idwindows-1252>a hrefhttps://encoding.spec.whatwg.org/#windows-1252>windows-1252/a>/dfn>, dfn idwindows-1254>a hrefhttps://encoding.spec.whatwg.org/#windows-1254>windows-1254/a>/dfn>, dfn idwindows-1255>a hrefhttps://encoding.spec.whatwg.org/#windows-1255>windows-1255/a>/dfn>, dfn idwindows-1256>a hrefhttps://encoding.spec.whatwg.org/#windows-1256>windows-1256/a>/dfn>, dfn idwindows-1257>a hrefhttps://encoding.spec.whatwg.org/#windows-1257>windows-1257/a>/dfn>, dfn idwindows-1258>a hrefhttps://encoding.spec.whatwg.org/#windows-1258>windows-1258/a>/dfn>, dfn idgb18030>a hrefhttps://encoding.spec.whatwg.org/#gb18030>gb18030/a>/dfn>, dfn idbig5>a hrefhttps://encoding.spec.whatwg.org/#big5>Big5/a>/dfn>, dfn idiso-2022-jp>a hrefhttps://encoding.spec.whatwg.org/#iso-2022-jp>ISO-2022-JP/a>/dfn>, dfn idshift_jis>a hrefhttps://encoding.spec.whatwg.org/#shift_jis>Shift_JIS/a>/dfn>, dfn ideuc-kr>a hrefhttps://encoding.spec.whatwg.org/#euc-kr>EUC-KR/a>/dfn>, dfn idutf-16be>a hrefhttps://encoding.spec.whatwg.org/#utf-16be>UTF-16BE/a>/dfn>, dfn idutf-16le>a hrefhttps://encoding.spec.whatwg.org/#utf-16le>UTF-16LE/a>/dfn>, and dfn idx-user-defined>a hrefhttps://encoding.spec.whatwg.org/#x-user-defined>x-user-defined/a>/dfn>. User agents must not support other encodings./p> p classnote>The above prohibits supporting, for example, CESU-8, UTF-7, BOCU-1, SCSU, EBCDIC, and UTF-32. This specification does not make any attempt to support prohibited encodings in its algorithms; support and use of prohibited encodings would thus lead to unexpected behavior. a href#refsCESU8>CESU8/a> a href#refsUTF7>UTF7/a> a href#refsBOCU1>BOCU1/a> a href#refsSCSU>SCSU/a>/p> h5 idchanging-the-encoding-while-parsing>span classsecno>12.2.3.4/span> Changing the encoding while parsinga href#changing-the-encoding-while-parsing classself-link>/a>/h5> p>When the parser requires the user agent to dfn idchange-the-encoding>change the encoding/dfn>, it must run the following steps. This might happen if the a href#encoding-sniffing-algorithm idchanging-the-encoding-while-parsing:encoding-sniffing-algorithm>encoding sniffing algorithm/a> described above failed to find a character encoding, or if it found a character encoding that was not the actual encoding of the file./p> ol>li>p>If the encoding that is already being used to interpret the input stream is a a href#utf-16-encoding idchanging-the-encoding-while-parsing:utf-16-encoding>UTF-16 encoding/a>, then set the a href#concept-encoding-confidence idchanging-the-encoding-while-parsing:concept-encoding-confidence>confidence/a> to i>certain/i> and abort these steps. The new encoding is ignored; if it was anything but the same encoding, then it would be clearly incorrect.li>p>If the new encoding is a a href#utf-16-encoding idchanging-the-encoding-while-parsing:utf-16-encoding-2>UTF-16 encoding/a>, then change it to a idchanging-the-encoding-while-parsing:utf-8 hrefhttps://encoding.spec.whatwg.org/#utf-8 data-x-internalutf-8>UTF-8/a>.li>p>If the new encoding is a idchanging-the-encoding-while-parsing:x-user-defined hrefhttps://encoding.spec.whatwg.org/#x-user-defined data-x-internalx-user-defined>x-user-defined/a>, then change it to a idchanging-the-encoding-while-parsing:windows-1252 hrefhttps://encoding.spec.whatwg.org/#windows-1252 data-x-internalwindows-1252>windows-1252/a>.li>p>If the new encoding is identical or equivalent to the encoding that is already being used to interpret the input stream, then set the a href#concept-encoding-confidence idchanging-the-encoding-while-parsing:concept-encoding-confidence-2>confidence/a> to i>certain/i> and abort these steps. This happens when the encoding information found in the file matches what the a href#encoding-sniffing-algorithm idchanging-the-encoding-while-parsing:encoding-sniffing-algorithm-2>encoding sniffing algorithm/a> determined to be the encoding, and in the second pass through the parser if the first pass found that the encoding sniffing algorithm described in the earlier section failed to find the right encoding.li>p>If all the bytes up to the last byte converted by the current decoder have the same Unicode interpretations in both the current encoding and the new encoding, and if the user agent supports changing the converter on the fly, then the user agent may change to the new converter for the encoding on the fly. Set the a idchanging-the-encoding-while-parsing:documents-character-encoding hrefhttps://dom.spec.whatwg.org/#concept-document-encoding data-x-internaldocuments-character-encoding>documents character encoding/a> and the encoding used to convert the input stream to the new encoding, set the a href#concept-encoding-confidence idchanging-the-encoding-while-parsing:concept-encoding-confidence-3>confidence/a> to i>certain/i>, and abort these steps.li>p>Otherwise, a href#navigate idchanging-the-encoding-while-parsing:navigate>navigate/a> to the document again, with a href#replacement-enabled idchanging-the-encoding-while-parsing:replacement-enabled>replacement enabled/a>, and using the same a href#source-browsing-context idchanging-the-encoding-while-parsing:source-browsing-context>source browsing context/a>, but this time skip the a href#encoding-sniffing-algorithm idchanging-the-encoding-while-parsing:encoding-sniffing-algorithm-3>encoding sniffing algorithm/a> and instead just set the encoding to the new encoding and the a href#concept-encoding-confidence idchanging-the-encoding-while-parsing:concept-encoding-confidence-4>confidence/a> to i>certain/i>. Whenever possible, this should be done without actually contacting the network layer (the bytes should be re-parsed from memory), even if, e.g., the document is marked as not being cacheable. If this is not possible and contacting the network layer would involve repeating a request that uses a method other than `code>GET/code>`), then instead set the a href#concept-encoding-confidence idchanging-the-encoding-while-parsing:concept-encoding-confidence-5>confidence/a> to i>certain/i> and ignore the new encoding. The resource will be misinterpreted. User agents may notify the user of the situation, to aid in application development./ol> p classnote>This algorithm is only invoked when a new encoding is found declared on a code idchanging-the-encoding-while-parsing:the-meta-element>a href#the-meta-element>meta/a>/code> element./p> h5 idpreprocessing-the-input-stream>span classsecno>12.2.3.5/span> Preprocessing the input streama href#preprocessing-the-input-stream classself-link>/a>/h5> p>The dfn idinput-stream>input stream/dfn> consists of the characters pushed into it as the a href#the-input-byte-stream idpreprocessing-the-input-stream:the-input-byte-stream>input byte stream/a> is decoded or from the various APIs that directly manipulate the input stream./p> p>Any occurrences of a hrefhttps://infra.spec.whatwg.org/#surrogate idpreprocessing-the-input-stream:surrogate data-x-internalsurrogate>surrogates/a> are a href#parse-error-surrogate-in-input-stream idpreprocessing-the-input-stream:parse-error-surrogate-in-input-stream>surrogate-in-input-stream/a> a href#parse-errors idpreprocessing-the-input-stream:parse-errors>parse errors/a>. Any occurrences of a hrefhttps://infra.spec.whatwg.org/#noncharacter idpreprocessing-the-input-stream:noncharacter data-x-internalnoncharacter>noncharacters/a> are a href#parse-error-noncharacter-in-input-stream idpreprocessing-the-input-stream:parse-error-noncharacter-in-input-stream>noncharacter-in-input-stream/a> a href#parse-errors idpreprocessing-the-input-stream:parse-errors-2>parse errors/a> and any occurrences of a hrefhttps://infra.spec.whatwg.org/#control idpreprocessing-the-input-stream:control data-x-internalcontrol>controls/a> other than a idpreprocessing-the-input-stream:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> and U+0000 NULL characters are a href#parse-error-control-character-in-input-stream idpreprocessing-the-input-stream:parse-error-control-character-in-input-stream>control-character-in-input-stream/a> a href#parse-errors idpreprocessing-the-input-stream:parse-errors-3>parse errors/a>./p> p classnote>The handling of U+0000 NULL characters varies based on where the characters are found and happens at the later stages of the parsing. They are either ignored or, for security reasons, replaced with a U+FFFD REPLACEMENT CHARACTER. This handling is, by necessity, spread across both the tokenization stage and the tree construction stage./p> p>U+000D CARRIAGE RETURN (CR) characters and U+000A LINE FEED (LF) characters are treated specially. Any LF character that immediately follows a CR character must be ignored, and all CR characters must then be converted to LF characters. Thus, newlines in HTML DOMs are represented by LF characters, and there are never any CR characters in the input to the a href#tokenization idpreprocessing-the-input-stream:tokenization>tokenization/a> stage./p> p>The dfn idnext-input-character>next input character/dfn> is the first character in the a href#input-stream idpreprocessing-the-input-stream:input-stream>input stream/a> that has not yet been dfn>consumed/dfn> or explicitly ignored by the requirements in this section. Initially, the i idpreprocessing-the-input-stream:next-input-character>a href#next-input-character>next input character/a>/i> is the first character in the input. The dfn idcurrent-input-character>current input character/dfn> is the last character to have been i>consumed/i>./p> p>The dfn idinsertion-point>insertion point/dfn> is the position (just before a character or just before the end of the input stream) where content inserted using code idpreprocessing-the-input-stream:dom-document-write>a href#dom-document-write>document.write()/a>/code> is actually inserted. The insertion point is relative to the position of the character immediately after it, it is not an absolute offset into the input stream. Initially, the insertion point is undefined./p> p>The EOF character in the tables below is a conceptual character representing the end of the a href#input-stream idpreprocessing-the-input-stream:input-stream-2>input stream/a>. If the parser is a a href#script-created-parser idpreprocessing-the-input-stream:script-created-parser>script-created parser/a>, then the end of the a href#input-stream idpreprocessing-the-input-stream:input-stream-3>input stream/a> is reached when an dfn idexplicit-eof-character>explicit EOF character/dfn> (inserted by the code idpreprocessing-the-input-stream:dom-document-close>a href#dom-document-close>document.close()/a>/code> method) is consumed. Otherwise, the EOF character is not a real character in the stream, but rather the lack of any further characters./p> h4 idparse-state>span classsecno>12.2.4/span> Parse statea href#parse-state classself-link>/a>/h4> h5 idthe-insertion-mode>span classsecno>12.2.4.1/span> The insertion modea href#the-insertion-mode classself-link>/a>/h5> p>The dfn idinsertion-mode>insertion mode/dfn> is a state variable that controls the primary operation of the tree construction stage./p> p>Initially, the a href#insertion-mode idthe-insertion-mode:insertion-mode>insertion mode/a> is a href#the-initial-insertion-mode idthe-insertion-mode:the-initial-insertion-mode>initial/a>. It can change to a href#the-before-html-insertion-mode idthe-insertion-mode:the-before-html-insertion-mode>before html/a>, a href#the-before-head-insertion-mode idthe-insertion-mode:the-before-head-insertion-mode>before head/a>, a href#parsing-main-inhead idthe-insertion-mode:parsing-main-inhead>in head/a>, a href#parsing-main-inheadnoscript idthe-insertion-mode:parsing-main-inheadnoscript>in head noscript/a>, a href#the-after-head-insertion-mode idthe-insertion-mode:the-after-head-insertion-mode>after head/a>, a href#parsing-main-inbody idthe-insertion-mode:parsing-main-inbody>in body/a>, a href#parsing-main-incdata idthe-insertion-mode:parsing-main-incdata>text/a>, a href#parsing-main-intable idthe-insertion-mode:parsing-main-intable>in table/a>, a href#parsing-main-intabletext idthe-insertion-mode:parsing-main-intabletext>in table text/a>, a href#parsing-main-incaption idthe-insertion-mode:parsing-main-incaption>in caption/a>, a href#parsing-main-incolgroup idthe-insertion-mode:parsing-main-incolgroup>in column group/a>, a href#parsing-main-intbody idthe-insertion-mode:parsing-main-intbody>in table body/a>, a href#parsing-main-intr idthe-insertion-mode:parsing-main-intr>in row/a>, a href#parsing-main-intd idthe-insertion-mode:parsing-main-intd>in cell/a>, a href#parsing-main-inselect idthe-insertion-mode:parsing-main-inselect>in select/a>, a href#parsing-main-inselectintable idthe-insertion-mode:parsing-main-inselectintable>in select in table/a>, a href#parsing-main-intemplate idthe-insertion-mode:parsing-main-intemplate>in template/a>, a href#parsing-main-afterbody idthe-insertion-mode:parsing-main-afterbody>after body/a>, a href#parsing-main-inframeset idthe-insertion-mode:parsing-main-inframeset>in frameset/a>, a href#parsing-main-afterframeset idthe-insertion-mode:parsing-main-afterframeset>after frameset/a>, a href#the-after-after-body-insertion-mode idthe-insertion-mode:the-after-after-body-insertion-mode>after after body/a>, and a href#the-after-after-frameset-insertion-mode idthe-insertion-mode:the-after-after-frameset-insertion-mode>after after frameset/a> during the course of the parsing, as described in the a href#tree-construction idthe-insertion-mode:tree-construction>tree construction/a> stage. The insertion mode affects how tokens are processed and whether CDATA sections are supported./p> p>Several of these modes, namely a href#parsing-main-inhead idthe-insertion-mode:parsing-main-inhead-2>in head/a>, a href#parsing-main-inbody idthe-insertion-mode:parsing-main-inbody-2>in body/a>, a href#parsing-main-intable idthe-insertion-mode:parsing-main-intable-2>in table/a>, and a href#parsing-main-inselect idthe-insertion-mode:parsing-main-inselect-2>in select/a>, are special, in that the other modes defer to them at various times. When the algorithm below says that the user agent is to do something dfn idusing-the-rules-for>using the rules for/dfn> the var>m/var> insertion mode, where var>m/var> is one of these modes, the user agent must use the rules described under the var>m/var> a href#insertion-mode idthe-insertion-mode:insertion-mode-2>insertion mode/a>s section, but must leave the a href#insertion-mode idthe-insertion-mode:insertion-mode-3>insertion mode/a> unchanged unless the rules in var>m/var> themselves switch the a href#insertion-mode idthe-insertion-mode:insertion-mode-4>insertion mode/a> to a new value./p> p>When the insertion mode is switched to a href#parsing-main-incdata idthe-insertion-mode:parsing-main-incdata-2>text/a> or a href#parsing-main-intabletext idthe-insertion-mode:parsing-main-intabletext-2>in table text/a>, the dfn idoriginal-insertion-mode>original insertion mode/dfn> is also set. This is the insertion mode to which the tree construction stage will return./p> p>Similarly, to parse nested code idthe-insertion-mode:the-template-element>a href#the-template-element>template/a>/code> elements, a dfn idstack-of-template-insertion-modes>stack of template insertion modes/dfn> is used. It is initially empty. The dfn idcurrent-template-insertion-mode>current template insertion mode/dfn> is the insertion mode that was most recently added to the a href#stack-of-template-insertion-modes idthe-insertion-mode:stack-of-template-insertion-modes>stack of template insertion modes/a>. The algorithms in the sections below will i>push/i> insertion modes onto this stack, meaning that the specified insertion mode is to be added to the stack, and i>pop/i> insertion modes from the stack, which means that the most recently added insertion mode must be removed from the stack./p> hr> p>When the steps below require the UA to dfn idreset-the-insertion-mode-appropriately>reset the insertion mode appropriately/dfn>, it means the UA must follow these steps:/p> ol>li>p>Let var>last/var> be false.li>p>Let var>node/var> be the last node in the a href#stack-of-open-elements idthe-insertion-mode:stack-of-open-elements>stack of open elements/a>.li>p>i>Loop/i>: If var>node/var> is the first node in the stack of open elements, then set var>last/var> to true, and, if the parser was originally created as part of the a href#html-fragment-parsing-algorithm idthe-insertion-mode:html-fragment-parsing-algorithm>HTML fragment parsing algorithm/a> (a href#fragment-case idthe-insertion-mode:fragment-case>fragment case/a>), set var>node/var> to the var idthe-insertion-mode:concept-frag-parse-context>a href#concept-frag-parse-context>context/a>/var> element passed to that algorithm.li> p>If var>node/var> is a code idthe-insertion-mode:the-select-element>a href#the-select-element>select/a>/code> element, run these substeps:/p> ol>li>p>If var>last/var> is true, jump to the step below labeled i>done/i>.li>p>Let var>ancestor/var> be var>node/var>.li>p>i>Loop/i>: If var>ancestor/var> is the first node in the a href#stack-of-open-elements idthe-insertion-mode:stack-of-open-elements-2>stack of open elements/a>, jump to the step below labeled i>done/i>.li>p>Let var>ancestor/var> be the node before var>ancestor/var> in the a href#stack-of-open-elements idthe-insertion-mode:stack-of-open-elements-3>stack of open elements/a>.li>p>If var>ancestor/var> is a code idthe-insertion-mode:the-template-element-2>a href#the-template-element>template/a>/code> node, jump to the step below labeled i>done/i>.li>p>If var>ancestor/var> is a code idthe-insertion-mode:the-table-element>a href#the-table-element>table/a>/code> node, switch the a href#insertion-mode idthe-insertion-mode:insertion-mode-5>insertion mode/a> to a href#parsing-main-inselectintable idthe-insertion-mode:parsing-main-inselectintable-2>in select in table/a> and abort these steps.li>p>Jump back to the step labeled i>loop/i>.li>p>i>Done/i>: Switch the a href#insertion-mode idthe-insertion-mode:insertion-mode-6>insertion mode/a> to a href#parsing-main-inselect idthe-insertion-mode:parsing-main-inselect-3>in select/a> and abort these steps./ol> li>p>If var>node/var> is a code idthe-insertion-mode:the-td-element>a href#the-td-element>td/a>/code> or code idthe-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 idthe-insertion-mode:insertion-mode-7>insertion mode/a> to a href#parsing-main-intd idthe-insertion-mode:parsing-main-intd-2>in cell/a> and abort these steps.li>p>If var>node/var> is a code idthe-insertion-mode:the-tr-element>a href#the-tr-element>tr/a>/code> element, then switch the a href#insertion-mode idthe-insertion-mode:insertion-mode-8>insertion mode/a> to a href#parsing-main-intr idthe-insertion-mode:parsing-main-intr-2>in row/a> and abort these steps.li>p>If var>node/var> is a code idthe-insertion-mode:the-tbody-element>a href#the-tbody-element>tbody/a>/code>, code idthe-insertion-mode:the-thead-element>a href#the-thead-element>thead/a>/code>, or code idthe-insertion-mode:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code> element, then switch the a href#insertion-mode idthe-insertion-mode:insertion-mode-9>insertion mode/a> to a href#parsing-main-intbody idthe-insertion-mode:parsing-main-intbody-2>in table body/a> and abort these steps.li>p>If var>node/var> is a code idthe-insertion-mode:the-caption-element>a href#the-caption-element>caption/a>/code> element, then switch the a href#insertion-mode idthe-insertion-mode:insertion-mode-10>insertion mode/a> to a href#parsing-main-incaption idthe-insertion-mode:parsing-main-incaption-2>in caption/a> and abort these steps.li>p>If var>node/var> is a code idthe-insertion-mode:the-colgroup-element>a href#the-colgroup-element>colgroup/a>/code> element, then switch the a href#insertion-mode idthe-insertion-mode:insertion-mode-11>insertion mode/a> to a href#parsing-main-incolgroup idthe-insertion-mode:parsing-main-incolgroup-2>in column group/a> and abort these steps.li>p>If var>node/var> is a code idthe-insertion-mode:the-table-element-2>a href#the-table-element>table/a>/code> element, then switch the a href#insertion-mode idthe-insertion-mode:insertion-mode-12>insertion mode/a> to a href#parsing-main-intable idthe-insertion-mode:parsing-main-intable-3>in table/a> and abort these steps.li>p>If var>node/var> is a code idthe-insertion-mode:the-template-element-3>a href#the-template-element>template/a>/code> element, then switch the a href#insertion-mode idthe-insertion-mode:insertion-mode-13>insertion mode/a> to the a href#current-template-insertion-mode idthe-insertion-mode:current-template-insertion-mode>current template insertion mode/a> and abort these steps.li>p>If var>node/var> is a code idthe-insertion-mode:the-head-element>a href#the-head-element>head/a>/code> element and var>last/var> is false, then switch the a href#insertion-mode idthe-insertion-mode:insertion-mode-14>insertion mode/a> to a href#parsing-main-inhead idthe-insertion-mode:parsing-main-inhead-3>in head/a> and abort these steps.li>p>If var>node/var> is a code idthe-insertion-mode:the-body-element>a href#the-body-element>body/a>/code> element, then switch the a href#insertion-mode idthe-insertion-mode:insertion-mode-15>insertion mode/a> to a href#parsing-main-inbody idthe-insertion-mode:parsing-main-inbody-3>in body/a> and abort these steps.li>p>If var>node/var> is a code idthe-insertion-mode:frameset>a href#frameset>frameset/a>/code> element, then switch the a href#insertion-mode idthe-insertion-mode:insertion-mode-16>insertion mode/a> to a href#parsing-main-inframeset idthe-insertion-mode:parsing-main-inframeset-2>in frameset/a> and abort these steps. (a href#fragment-case idthe-insertion-mode:fragment-case-2>fragment case/a>)li> p>If var>node/var> is an code idthe-insertion-mode:the-html-element>a href#the-html-element>html/a>/code> element, run these substeps:/p> ol>li>p>If the a href#head-element-pointer idthe-insertion-mode:head-element-pointer>code>head/code> element pointer/a> is null, switch the a href#insertion-mode idthe-insertion-mode:insertion-mode-17>insertion mode/a> to a href#the-before-head-insertion-mode idthe-insertion-mode:the-before-head-insertion-mode-2>before head/a> and abort these steps. (a href#fragment-case idthe-insertion-mode:fragment-case-3>fragment case/a>)li>p>Otherwise, the a href#head-element-pointer idthe-insertion-mode:head-element-pointer-2>code>head/code> element pointer/a> is not null, switch the a href#insertion-mode idthe-insertion-mode:insertion-mode-18>insertion mode/a> to a href#the-after-head-insertion-mode idthe-insertion-mode:the-after-head-insertion-mode-2>after head/a> and abort these steps./ol> li>p>If var>last/var> is true, then switch the a href#insertion-mode idthe-insertion-mode:insertion-mode-19>insertion mode/a> to a href#parsing-main-inbody idthe-insertion-mode:parsing-main-inbody-4>in body/a> and abort these steps. (a href#fragment-case idthe-insertion-mode:fragment-case-4>fragment case/a>)li>p>Let var>node/var> now be the node before var>node/var> in the a href#stack-of-open-elements idthe-insertion-mode:stack-of-open-elements-4>stack of open elements/a>.li>p>Return to the step labeled i>loop/i>./ol> h5 idthe-stack-of-open-elements>span classsecno>12.2.4.2/span> The stack of open elementsa href#the-stack-of-open-elements classself-link>/a>/h5> p>Initially, the dfn idstack-of-open-elements>stack of open elements/dfn> is empty. The stack grows downwards; the topmost node on the stack is the first one added to the stack, and the bottommost node of the stack is the most recently added node in the stack (notwithstanding when the stack is manipulated in a random access fashion as part of a href#adoptionAgency>the handling for misnested tags/a>)./p> p classnote>The a href#the-before-html-insertion-mode idthe-stack-of-open-elements:the-before-html-insertion-mode>before html/a> a href#insertion-mode idthe-stack-of-open-elements:insertion-mode>insertion mode/a> creates the code idthe-stack-of-open-elements:the-html-element>a href#the-html-element>html/a>/code> a idthe-stack-of-open-elements:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a>, which is then added to the stack./p> p classnote>In the a href#fragment-case idthe-stack-of-open-elements:fragment-case>fragment case/a>, the a href#stack-of-open-elements idthe-stack-of-open-elements:stack-of-open-elements>stack of open elements/a> is initialized to contain an code idthe-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 idthe-stack-of-open-elements:html-fragment-parsing-algorithm>that algorithm/a>. (The a href#fragment-case idthe-stack-of-open-elements:fragment-case-2>fragment case/a> skips the a href#the-before-html-insertion-mode idthe-stack-of-open-elements:the-before-html-insertion-mode-2>before html/a> a href#insertion-mode idthe-stack-of-open-elements:insertion-mode-2>insertion mode/a>.)/p> p>The code idthe-stack-of-open-elements:the-html-element-3>a href#the-html-element>html/a>/code> node, however it is created, is the topmost node of the stack. It only gets popped off the stack when the parser a href#stop-parsing idthe-stack-of-open-elements:stop-parsing>finishes/a>./p> p>The dfn idcurrent-node>current node/dfn> is the bottommost node in this a href#stack-of-open-elements idthe-stack-of-open-elements:stack-of-open-elements-2>stack of open elements/a>./p> p>The dfn idadjusted-current-node>adjusted current node/dfn> is the i idthe-stack-of-open-elements:concept-frag-parse-context>a href#concept-frag-parse-context>context/a>/i> element if the parser was created by the a href#html-fragment-parsing-algorithm idthe-stack-of-open-elements:html-fragment-parsing-algorithm-2>HTML fragment parsing algorithm/a> and the a href#stack-of-open-elements idthe-stack-of-open-elements:stack-of-open-elements-3>stack of open elements/a> has only one element in it (a href#fragment-case idthe-stack-of-open-elements:fragment-case-3>fragment case/a>); otherwise, the a href#adjusted-current-node idthe-stack-of-open-elements:adjusted-current-node>adjusted current node/a> is the a href#current-node idthe-stack-of-open-elements:current-node>current node/a>.div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id27314 titleParser: "adjusted current node" not clear enough>27314/a>/div> p>Elements in the a href#stack-of-open-elements idthe-stack-of-open-elements:stack-of-open-elements-4>stack of open elements/a> fall into the following categories:/p> dl>dt>dfn idspecial>Special/dfn>dd> p>The following elements have varying levels of special parsing rules: HTMLs code idthe-stack-of-open-elements:the-address-element>a href#the-address-element>address/a>/code>, code idthe-stack-of-open-elements:applet>a href#applet>applet/a>/code>, code idthe-stack-of-open-elements:the-area-element>a href#the-area-element>area/a>/code>, code idthe-stack-of-open-elements:the-article-element>a href#the-article-element>article/a>/code>, code idthe-stack-of-open-elements:the-aside-element>a href#the-aside-element>aside/a>/code>, code idthe-stack-of-open-elements:the-base-element>a href#the-base-element>base/a>/code>, code idthe-stack-of-open-elements:basefont>a href#basefont>basefont/a>/code>, code idthe-stack-of-open-elements:bgsound>a href#bgsound>bgsound/a>/code>, code idthe-stack-of-open-elements:the-blockquote-element>a href#the-blockquote-element>blockquote/a>/code>, code idthe-stack-of-open-elements:the-body-element>a href#the-body-element>body/a>/code>, code idthe-stack-of-open-elements:the-br-element>a href#the-br-element>br/a>/code>, code idthe-stack-of-open-elements:the-button-element>a href#the-button-element>button/a>/code>, code idthe-stack-of-open-elements:the-caption-element>a href#the-caption-element>caption/a>/code>, code idthe-stack-of-open-elements:center>a href#center>center/a>/code>, code idthe-stack-of-open-elements:the-col-element>a href#the-col-element>col/a>/code>, code idthe-stack-of-open-elements:the-colgroup-element>a href#the-colgroup-element>colgroup/a>/code>, code idthe-stack-of-open-elements:the-dd-element>a href#the-dd-element>dd/a>/code>, code idthe-stack-of-open-elements:the-details-element>a href#the-details-element>details/a>/code>, code idthe-stack-of-open-elements:dir>a href#dir>dir/a>/code>, code idthe-stack-of-open-elements:the-div-element>a href#the-div-element>div/a>/code>, code idthe-stack-of-open-elements:the-dl-element>a href#the-dl-element>dl/a>/code>, code idthe-stack-of-open-elements:the-dt-element>a href#the-dt-element>dt/a>/code>, code idthe-stack-of-open-elements:the-embed-element>a href#the-embed-element>embed/a>/code>, code idthe-stack-of-open-elements:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code>, code idthe-stack-of-open-elements:the-figcaption-element>a href#the-figcaption-element>figcaption/a>/code>, code idthe-stack-of-open-elements:the-figure-element>a href#the-figure-element>figure/a>/code>, code idthe-stack-of-open-elements:the-footer-element>a href#the-footer-element>footer/a>/code>, code idthe-stack-of-open-elements:the-form-element>a href#the-form-element>form/a>/code>, code idthe-stack-of-open-elements:frame>a href#frame>frame/a>/code>, code idthe-stack-of-open-elements:frameset>a href#frameset>frameset/a>/code>, code idthe-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 idthe-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 idthe-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 idthe-stack-of-open-elements:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4/a>/code>, code idthe-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 idthe-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 idthe-stack-of-open-elements:the-head-element>a href#the-head-element>head/a>/code>, code idthe-stack-of-open-elements:the-header-element>a href#the-header-element>header/a>/code>, code idthe-stack-of-open-elements:the-hgroup-element>a href#the-hgroup-element>hgroup/a>/code>, code idthe-stack-of-open-elements:the-hr-element>a href#the-hr-element>hr/a>/code>, code idthe-stack-of-open-elements:the-html-element-4>a href#the-html-element>html/a>/code>, code idthe-stack-of-open-elements:the-iframe-element>a href#the-iframe-element>iframe/a>/code>, code idthe-stack-of-open-elements:the-img-element>a href#the-img-element>img/a>/code>, code idthe-stack-of-open-elements:the-input-element>a href#the-input-element>input/a>/code>, code idthe-stack-of-open-elements:keygen>a href#keygen>keygen/a>/code>, code idthe-stack-of-open-elements:the-li-element>a href#the-li-element>li/a>/code>, code idthe-stack-of-open-elements:the-link-element>a href#the-link-element>link/a>/code>, code idthe-stack-of-open-elements:listing>a href#listing>listing/a>/code>, code idthe-stack-of-open-elements:the-main-element>a href#the-main-element>main/a>/code>, code idthe-stack-of-open-elements:the-marquee-element>a href#the-marquee-element>marquee/a>/code>, code idthe-stack-of-open-elements:the-menu-element>a href#the-menu-element>menu/a>/code>, code idthe-stack-of-open-elements:the-meta-element>a href#the-meta-element>meta/a>/code>, code idthe-stack-of-open-elements:the-nav-element>a href#the-nav-element>nav/a>/code>, code idthe-stack-of-open-elements:noembed>a href#noembed>noembed/a>/code>, code idthe-stack-of-open-elements:noframes>a href#noframes>noframes/a>/code>, code idthe-stack-of-open-elements:the-noscript-element>a href#the-noscript-element>noscript/a>/code>, code idthe-stack-of-open-elements:the-object-element>a href#the-object-element>object/a>/code>, code idthe-stack-of-open-elements:the-ol-element>a href#the-ol-element>ol/a>/code>, code idthe-stack-of-open-elements:the-p-element>a href#the-p-element>p/a>/code>, code idthe-stack-of-open-elements:the-param-element>a href#the-param-element>param/a>/code>, code idthe-stack-of-open-elements:plaintext>a href#plaintext>plaintext/a>/code>, code idthe-stack-of-open-elements:the-pre-element>a href#the-pre-element>pre/a>/code>, code idthe-stack-of-open-elements:the-script-element>a href#the-script-element>script/a>/code>, code idthe-stack-of-open-elements:the-section-element>a href#the-section-element>section/a>/code>, code idthe-stack-of-open-elements:the-select-element>a href#the-select-element>select/a>/code>, code idthe-stack-of-open-elements:the-source-element>a href#the-source-element>source/a>/code>, code idthe-stack-of-open-elements:the-style-element>a href#the-style-element>style/a>/code>, code idthe-stack-of-open-elements:the-summary-element>a href#the-summary-element>summary/a>/code>, code idthe-stack-of-open-elements:the-table-element>a href#the-table-element>table/a>/code>, code idthe-stack-of-open-elements:the-tbody-element>a href#the-tbody-element>tbody/a>/code>, code idthe-stack-of-open-elements:the-td-element>a href#the-td-element>td/a>/code>, code idthe-stack-of-open-elements:the-template-element>a href#the-template-element>template/a>/code>, code idthe-stack-of-open-elements:the-textarea-element>a href#the-textarea-element>textarea/a>/code>, code idthe-stack-of-open-elements:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code>, code idthe-stack-of-open-elements:the-th-element>a href#the-th-element>th/a>/code>, code idthe-stack-of-open-elements:the-thead-element>a href#the-thead-element>thead/a>/code>, code idthe-stack-of-open-elements:the-title-element>a href#the-title-element>title/a>/code>, code idthe-stack-of-open-elements:the-tr-element>a href#the-tr-element>tr/a>/code>, code idthe-stack-of-open-elements:the-track-element>a href#the-track-element>track/a>/code>, code idthe-stack-of-open-elements:the-ul-element>a href#the-ul-element>ul/a>/code>, code idthe-stack-of-open-elements:the-wbr-element>a href#the-wbr-element>wbr/a>/code>, code idthe-stack-of-open-elements:xmp>a href#xmp>xmp/a>/code>; a idthe-stack-of-open-elements:mathml-mi hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mi data-x-internalmathml-mi>MathML code>mi/code>/a>, a idthe-stack-of-open-elements:mathml-mo hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mo data-x-internalmathml-mo>MathML code>mo/code>/a>, a idthe-stack-of-open-elements:mathml-mn hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mn data-x-internalmathml-mn>MathML code>mn/code>/a>, a idthe-stack-of-open-elements:mathml-ms hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.ms data-x-internalmathml-ms>MathML code>ms/code>/a>, a idthe-stack-of-open-elements:mathml-mtext hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mtext data-x-internalmathml-mtext>MathML code>mtext/code>/a>, and a idthe-stack-of-open-elements:mathml-annotation-xml hrefhttps://www.w3.org/Math/draft-spec/chapter5.html#mixing.elements.annotation.xml data-x-internalmathml-annotation-xml>MathML code>annotation-xml/code>/a>; and a idthe-stack-of-open-elements:svg-foreignobject hrefhttps://www.w3.org/TR/SVG11/extend.html#ForeignObjectElement data-x-internalsvg-foreignobject>SVG code>foreignObject/code>/a>, a idthe-stack-of-open-elements:svg-desc hrefhttps://www.w3.org/TR/SVG11/struct.html#DescElement data-x-internalsvg-desc>SVG code>desc/code>/a>, and a idthe-stack-of-open-elements:svg-title hrefhttps://www.w3.org/TR/SVG11/struct.html#TitleElement data-x-internalsvg-title>SVG code>title/code>/a>./p> p classnote>An code>image/code> start tag token is handled by the tree builder, but it is not in this list because it is not an element; it gets turned into an code idthe-stack-of-open-elements:the-img-element-2>a href#the-img-element>img/a>/code> element./p> dt>dfn idformatting>Formatting/dfn>dd>p>The following HTML elements are those that end up in the a href#list-of-active-formatting-elements idthe-stack-of-open-elements:list-of-active-formatting-elements>list of active formatting elements/a>: code idthe-stack-of-open-elements:the-a-element>a href#the-a-element>a/a>/code>, code idthe-stack-of-open-elements:the-b-element>a href#the-b-element>b/a>/code>, code idthe-stack-of-open-elements:big>a href#big>big/a>/code>, code idthe-stack-of-open-elements:the-code-element>a href#the-code-element>code/a>/code>, code idthe-stack-of-open-elements:the-em-element>a href#the-em-element>em/a>/code>, code idthe-stack-of-open-elements:font>a href#font>font/a>/code>, code idthe-stack-of-open-elements:the-i-element>a href#the-i-element>i/a>/code>, code idthe-stack-of-open-elements:nobr>a href#nobr>nobr/a>/code>, code idthe-stack-of-open-elements:the-s-element>a href#the-s-element>s/a>/code>, code idthe-stack-of-open-elements:the-small-element>a href#the-small-element>small/a>/code>, code idthe-stack-of-open-elements:strike>a href#strike>strike/a>/code>, code idthe-stack-of-open-elements:the-strong-element>a href#the-strong-element>strong/a>/code>, code idthe-stack-of-open-elements:tt>a href#tt>tt/a>/code>, and code idthe-stack-of-open-elements:the-u-element>a href#the-u-element>u/a>/code>.dt>dfn idordinary>Ordinary/dfn>dd>p>All other elements found while parsing an HTML document./dl> p classnote>Typically, the a href#special idthe-stack-of-open-elements:special>special/a> elements have the start and end tag tokens handled specifically, while a href#ordinary idthe-stack-of-open-elements:ordinary>ordinary/a> elements tokens fall into any other start tag and any other end tag clauses, and some parts of the tree builder check if a particular element in the a href#stack-of-open-elements idthe-stack-of-open-elements:stack-of-open-elements-5>stack of open elements/a> is in the a href#special idthe-stack-of-open-elements:special-2>special/a> category. However, some elements (e.g., the code idthe-stack-of-open-elements:the-option-element>a href#the-option-element>option/a>/code> element) have their start or end tag tokens handled specifically, but are still not in the a href#special idthe-stack-of-open-elements:special-3>special/a> category, so that they get the a href#ordinary idthe-stack-of-open-elements:ordinary-2>ordinary/a> handling elsewhere./p> p>The a href#stack-of-open-elements idthe-stack-of-open-elements:stack-of-open-elements-6>stack of open elements/a> is said to dfn idhas-an-element-in-the-specific-scope>have an element var>target node/var> in a specific scope/dfn> consisting of a list of element types var>list/var> when the following algorithm terminates in a match state:/p> ol>li>p>Initialize var>node/var> to be the a href#current-node idthe-stack-of-open-elements:current-node-2>current node/a> (the bottommost node of the stack).li>p>If var>node/var> is the target node, terminate in a match state.li>p>Otherwise, if var>node/var> is one of the element types in var>list/var>, terminate in a failure state.li>p>Otherwise, set var>node/var> to the previous entry in the a href#stack-of-open-elements idthe-stack-of-open-elements:stack-of-open-elements-7>stack of open elements/a> and return to step 2. (This will never fail, since the loop will always terminate in the previous step if the top of the stack — an code idthe-stack-of-open-elements:the-html-element-5>a href#the-html-element>html/a>/code> element — is reached.)/ol> p>The a href#stack-of-open-elements idthe-stack-of-open-elements:stack-of-open-elements-8>stack of open elements/a> is said to dfn idhas-an-element-in-scope>have a particular element in scope/dfn> when it a href#has-an-element-in-the-specific-scope idthe-stack-of-open-elements:has-an-element-in-the-specific-scope>has that element in the specific scope/a> consisting of the following element types:/p> ul classbrief>li>code idthe-stack-of-open-elements:applet-2>a href#applet>applet/a>/code>li>code idthe-stack-of-open-elements:the-caption-element-2>a href#the-caption-element>caption/a>/code>li>code idthe-stack-of-open-elements:the-html-element-6>a href#the-html-element>html/a>/code>li>code idthe-stack-of-open-elements:the-table-element-2>a href#the-table-element>table/a>/code>li>code idthe-stack-of-open-elements:the-td-element-2>a href#the-td-element>td/a>/code>li>code idthe-stack-of-open-elements:the-th-element-2>a href#the-th-element>th/a>/code>li>code idthe-stack-of-open-elements:the-marquee-element-2>a href#the-marquee-element>marquee/a>/code>li>code idthe-stack-of-open-elements:the-object-element-2>a href#the-object-element>object/a>/code>li>code idthe-stack-of-open-elements:the-template-element-2>a href#the-template-element>template/a>/code>li>a idthe-stack-of-open-elements:mathml-mi-2 hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mi data-x-internalmathml-mi>MathML code>mi/code>/a>li>a idthe-stack-of-open-elements:mathml-mo-2 hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mo data-x-internalmathml-mo>MathML code>mo/code>/a>li>a idthe-stack-of-open-elements:mathml-mn-2 hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mn data-x-internalmathml-mn>MathML code>mn/code>/a>li>a idthe-stack-of-open-elements:mathml-ms-2 hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.ms data-x-internalmathml-ms>MathML code>ms/code>/a>li>a idthe-stack-of-open-elements:mathml-mtext-2 hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mtext data-x-internalmathml-mtext>MathML code>mtext/code>/a>li>a idthe-stack-of-open-elements:mathml-annotation-xml-2 hrefhttps://www.w3.org/Math/draft-spec/chapter5.html#mixing.elements.annotation.xml data-x-internalmathml-annotation-xml>MathML code>annotation-xml/code>/a>li>a idthe-stack-of-open-elements:svg-foreignobject-2 hrefhttps://www.w3.org/TR/SVG11/extend.html#ForeignObjectElement data-x-internalsvg-foreignobject>SVG code>foreignObject/code>/a>li>a idthe-stack-of-open-elements:svg-desc-2 hrefhttps://www.w3.org/TR/SVG11/struct.html#DescElement data-x-internalsvg-desc>SVG code>desc/code>/a>li>a idthe-stack-of-open-elements:svg-title-2 hrefhttps://www.w3.org/TR/SVG11/struct.html#TitleElement data-x-internalsvg-title>SVG code>title/code>/a>/ul> p>The a href#stack-of-open-elements idthe-stack-of-open-elements:stack-of-open-elements-9>stack of open elements/a> is said to dfn idhas-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 idthe-stack-of-open-elements:has-an-element-in-the-specific-scope-2>has that element in the specific scope/a> consisting of the following element types:/p> ul classbrief>li>All the element types listed above for the i idthe-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 idthe-stack-of-open-elements:the-ol-element-2>a href#the-ol-element>ol/a>/code> in the a idthe-stack-of-open-elements:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>li>code idthe-stack-of-open-elements:the-ul-element-2>a href#the-ul-element>ul/a>/code> in the a idthe-stack-of-open-elements:html-namespace-2-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>/ul> p>The a href#stack-of-open-elements idthe-stack-of-open-elements:stack-of-open-elements-10>stack of open elements/a> is said to dfn idhas-an-element-in-button-scope>have a particular element in button scope/dfn> when it a href#has-an-element-in-the-specific-scope idthe-stack-of-open-elements:has-an-element-in-the-specific-scope-3>has that element in the specific scope/a> consisting of the following element types:/p> ul classbrief>li>All the element types listed above for the i idthe-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 idthe-stack-of-open-elements:the-button-element-2>a href#the-button-element>button/a>/code> in the a idthe-stack-of-open-elements:html-namespace-2-3 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>/ul> p>The a href#stack-of-open-elements idthe-stack-of-open-elements:stack-of-open-elements-11>stack of open elements/a> is said to dfn idhas-an-element-in-table-scope>have a particular element in table scope/dfn> when it a href#has-an-element-in-the-specific-scope idthe-stack-of-open-elements:has-an-element-in-the-specific-scope-4>has that element in the specific scope/a> consisting of the following element types:/p> ul classbrief>li>code idthe-stack-of-open-elements:the-html-element-7>a href#the-html-element>html/a>/code> in the a idthe-stack-of-open-elements:html-namespace-2-4 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>li>code idthe-stack-of-open-elements:the-table-element-3>a href#the-table-element>table/a>/code> in the a idthe-stack-of-open-elements:html-namespace-2-5 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>li>code idthe-stack-of-open-elements:the-template-element-3>a href#the-template-element>template/a>/code> in the a idthe-stack-of-open-elements:html-namespace-2-6 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>/ul> p>The a href#stack-of-open-elements idthe-stack-of-open-elements:stack-of-open-elements-12>stack of open elements/a> is said to dfn idhas-an-element-in-select-scope>have a particular element in select scope/dfn> when it a href#has-an-element-in-the-specific-scope idthe-stack-of-open-elements:has-an-element-in-the-specific-scope-5>has that element in the specific scope/a> consisting of all element types em>except/em> the following:/p> ul classbrief>li>code idthe-stack-of-open-elements:the-optgroup-element>a href#the-optgroup-element>optgroup/a>/code> in the a idthe-stack-of-open-elements:html-namespace-2-7 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>li>code idthe-stack-of-open-elements:the-option-element-2>a href#the-option-element>option/a>/code> in the a idthe-stack-of-open-elements:html-namespace-2-8 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>/ul> p>Nothing happens if at any time any of the elements in the a href#stack-of-open-elements idthe-stack-of-open-elements:stack-of-open-elements-13>stack of open elements/a> are moved to a new location in, or removed from, the code idthe-stack-of-open-elements:document>a href#document>Document/a>/code> tree. In particular, the stack is not changed in this situation. This can cause, amongst other strange effects, content to be appended to nodes that are no longer in the DOM./p> p classnote>In some cases (namely, when a href#adoptionAgency>closing misnested formatting elements/a>), the stack is manipulated in a random-access fashion./p> h5 idthe-list-of-active-formatting-elements>span classsecno>12.2.4.3/span> The list of active formatting elementsa href#the-list-of-active-formatting-elements classself-link>/a>/h5> p>Initially, the dfn idlist-of-active-formatting-elements>list of active formatting elements/dfn> is empty. It is used to handle mis-nested a href#formatting idthe-list-of-active-formatting-elements:formatting>formatting element tags/a>./p> p>The list contains elements in the a href#formatting idthe-list-of-active-formatting-elements:formatting-2>formatting/a> category, and a href#concept-parser-marker idthe-list-of-active-formatting-elements:concept-parser-marker>markers/a>. The dfn idconcept-parser-marker>markers/dfn> are inserted when entering code idthe-list-of-active-formatting-elements:applet>a href#applet>applet/a>/code>, code idthe-list-of-active-formatting-elements:the-object-element>a href#the-object-element>object/a>/code>, code idthe-list-of-active-formatting-elements:the-marquee-element>a href#the-marquee-element>marquee/a>/code>, code idthe-list-of-active-formatting-elements:the-template-element>a href#the-template-element>template/a>/code>, code idthe-list-of-active-formatting-elements:the-td-element>a href#the-td-element>td/a>/code>, code idthe-list-of-active-formatting-elements:the-th-element>a href#the-th-element>th/a>/code>, and code idthe-list-of-active-formatting-elements:the-caption-element>a href#the-caption-element>caption/a>/code> elements, and are used to prevent formatting from leaking em>into/em> code idthe-list-of-active-formatting-elements:applet-2>a href#applet>applet/a>/code>, code idthe-list-of-active-formatting-elements:the-object-element-2>a href#the-object-element>object/a>/code>, code idthe-list-of-active-formatting-elements:the-marquee-element-2>a href#the-marquee-element>marquee/a>/code>, code idthe-list-of-active-formatting-elements:the-template-element-2>a href#the-template-element>template/a>/code>, code idthe-list-of-active-formatting-elements:the-td-element-2>a href#the-td-element>td/a>/code>, code idthe-list-of-active-formatting-elements:the-th-element-2>a href#the-th-element>th/a>/code>, and code idthe-list-of-active-formatting-elements:the-caption-element-2>a href#the-caption-element>caption/a>/code> elements./p> p>In addition, each element in the a href#list-of-active-formatting-elements idthe-list-of-active-formatting-elements:list-of-active-formatting-elements>list of active formatting elements/a> is associated with the token for which it was created, so that further elements can be created for that token if necessary./p> p>When the steps below require the UA to dfn idpush-onto-the-list-of-active-formatting-elements>push onto the list of active formatting elements/dfn> an element var>element/var>, the UA must perform the following steps:/p> ol idnoah>li>p>If there are already three elements in the a href#list-of-active-formatting-elements idthe-list-of-active-formatting-elements:list-of-active-formatting-elements-2>list of active formatting elements/a> after the last a href#concept-parser-marker idthe-list-of-active-formatting-elements:concept-parser-marker-2>marker/a>, if any, or anywhere in the list if there are no a href#concept-parser-marker idthe-list-of-active-formatting-elements:concept-parser-marker-3>markers/a>, that have the same tag name, namespace, and attributes as var>element/var>, then remove the earliest such element from the a href#list-of-active-formatting-elements idthe-list-of-active-formatting-elements:list-of-active-formatting-elements-3>list of active formatting elements/a>. For these purposes, the attributes must be compared as they were when the elements were created by the parser; two elements have the same attributes if all their parsed attributes can be paired such that the two attributes in each pair have identical names, namespaces, and values (the order of the attributes does not matter)./p> p classnote>This is the Noahs 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 idthe-list-of-active-formatting-elements:list-of-active-formatting-elements-4>list of active formatting elements/a>./ol> p>When the steps below require the UA to dfn idreconstruct-the-active-formatting-elements>reconstruct the active formatting elements/dfn>, the UA must perform the following steps:/p> ol>li>p>If there are no entries in the a href#list-of-active-formatting-elements idthe-list-of-active-formatting-elements:list-of-active-formatting-elements-5>list of active formatting elements/a>, then there is nothing to reconstruct; stop this algorithm.li>p>If the last (most recently added) entry in the a href#list-of-active-formatting-elements idthe-list-of-active-formatting-elements:list-of-active-formatting-elements-6>list of active formatting elements/a> is a a href#concept-parser-marker idthe-list-of-active-formatting-elements:concept-parser-marker-4>marker/a>, or if it is an element that is in the a href#stack-of-open-elements idthe-list-of-active-formatting-elements:stack-of-open-elements>stack of open elements/a>, then there is nothing to reconstruct; stop this algorithm.li>p>Let var>entry/var> be the last (most recently added) element in the a href#list-of-active-formatting-elements idthe-list-of-active-formatting-elements:list-of-active-formatting-elements-7>list of active formatting elements/a>.li>p>i>Rewind/i>: If there are no entries before var>entry/var> in the a href#list-of-active-formatting-elements idthe-list-of-active-formatting-elements:list-of-active-formatting-elements-8>list of active formatting elements/a>, then jump to the step labeled i>create/i>.li>p>Let var>entry/var> be the entry one earlier than var>entry/var> in the a href#list-of-active-formatting-elements idthe-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 idthe-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 idthe-list-of-active-formatting-elements:stack-of-open-elements-2>stack of open elements/a>, go to the step labeled i>rewind/i>.li>p>i>Advance/i>: Let var>entry/var> be the element one later than var>entry/var> in the a href#list-of-active-formatting-elements idthe-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 idthe-list-of-active-formatting-elements:insert-an-html-element>Insert an HTML element/a> for the token for which the element var>entry/var> was created, to obtain var>new element/var>.li>p>Replace the entry for var>entry/var> in the list with an entry for var>new element/var>.li>p>If the entry for var>new element/var> in the a href#list-of-active-formatting-elements idthe-list-of-active-formatting-elements:list-of-active-formatting-elements-11>list of active formatting elements/a> is not the last entry in the list, return to the step labeled i>advance/i>./ol> p>This has the effect of reopening all the formatting elements that were opened in the current body, cell, or caption (whichever is youngest) that havent been explicitly closed./p> p classnote>The way this specification is written, the a href#list-of-active-formatting-elements idthe-list-of-active-formatting-elements:list-of-active-formatting-elements-12>list of active formatting elements/a> always consists of elements in chronological order with the least recently added element first and the most recently added element last (except for while steps 7 to 10 of the above algorithm are being executed, of course)./p> p>When the steps below require the UA to dfn idclear-the-list-of-active-formatting-elements-up-to-the-last-marker>clear the list of active formatting elements up to the last marker/dfn>, the UA must perform the following steps:/p> ol>li>p>Let var>entry/var> be the last (most recently added) entry in the a href#list-of-active-formatting-elements idthe-list-of-active-formatting-elements:list-of-active-formatting-elements-13>list of active formatting elements/a>.li>p>Remove var>entry/var> from the a href#list-of-active-formatting-elements idthe-list-of-active-formatting-elements:list-of-active-formatting-elements-14>list of active formatting elements/a>.li>p>If var>entry/var> was a a href#concept-parser-marker idthe-list-of-active-formatting-elements:concept-parser-marker-6>marker/a>, then stop the algorithm at this point. The list has been cleared up to the last a href#concept-parser-marker idthe-list-of-active-formatting-elements:concept-parser-marker-7>marker/a>.li>p>Go to step 1./ol> h5 idthe-element-pointers>span classsecno>12.2.4.4/span> The element pointersa href#the-element-pointers classself-link>/a>/h5> p>Initially, the dfn idhead-element-pointer>code>head/code> element pointer/dfn> and the dfn idform-element-pointer>code>form/code> element pointer/dfn> are both null./p> p>Once a code idthe-element-pointers:the-head-element>a href#the-head-element>head/a>/code> element has been parsed (whether implicitly or explicitly) the a href#head-element-pointer idthe-element-pointers:head-element-pointer>code>head/code> element pointer/a> gets set to point to this node./p> p>The a href#form-element-pointer idthe-element-pointers:form-element-pointer>code>form/code> element pointer/a> points to the last code idthe-element-pointers:the-form-element>a href#the-form-element>form/a>/code> element that was opened and whose end tag has not yet been seen. It is used to make form controls associate with forms in the face of dramatically bad markup, for historical reasons. It is ignored inside code idthe-element-pointers:the-template-element>a href#the-template-element>template/a>/code> elements./p> h5 idother-parsing-state-flags>span classsecno>12.2.4.5/span> Other parsing state flagsa href#other-parsing-state-flags classself-link>/a>/h5> p>The dfn idscripting-flag>scripting flag/dfn> is set to enabled if a href#concept-n-script idother-parsing-state-flags:concept-n-script>scripting was enabled/a> for the code idother-parsing-state-flags:document>a href#document>Document/a>/code> with which the parser is associated when the parser was created, and disabled otherwise./p> p classnote>The a href#scripting-flag idother-parsing-state-flags:scripting-flag>scripting flag/a> can be enabled even when the parser was originally created for the a href#html-fragment-parsing-algorithm idother-parsing-state-flags:html-fragment-parsing-algorithm>HTML fragment parsing algorithm/a>, even though code idother-parsing-state-flags:the-script-element>a href#the-script-element>script/a>/code> elements dont execute in that case./p> p>The dfn idframeset-ok-flag>frameset-ok flag/dfn> is set to ok when the parser is created. It is set to not ok after certain tokens are seen./p> h4 idtokenization>span classsecno>12.2.5/span> dfn>Tokenization/dfn>a href#tokenization classself-link>/a>/h4> p>Implementations must act as if they used the following state machine to tokenize HTML. The state machine must start in the a href#data-state idtokenization:data-state>data state/a>. Most states consume a single character, which may have various side-effects, and either switches the state machine to a new state to a href#reconsume idtokenization:reconsume>reconsume/a> the a href#current-input-character idtokenization:current-input-character>current input character/a>, or switches it to a new state to consume the a href#next-input-character idtokenization:next-input-character>next character/a>, or stays in the same state to consume the next character. Some states have more complicated behavior and can consume several characters before switching to another state. In some cases, the tokenizer state is also changed by the tree construction stage./p> p>When a state says to dfn idreconsume>reconsume/dfn> a matched character in a specified state, that means to switch to that state, but when it attempts to consume the a href#next-input-character idtokenization:next-input-character-2>next input character/a>, provide it with the a href#current-input-character idtokenization:current-input-character-2>current input character/a> instead./p> p>The exact behavior of certain states depends on the a href#insertion-mode idtokenization:insertion-mode>insertion mode/a> and the a href#stack-of-open-elements idtokenization:stack-of-open-elements>stack of open elements/a>. Certain states also use a dfn idtemporary-buffer>var>temporary buffer/var>/dfn> to track progress, and the a href#character-reference-state idtokenization:character-reference-state>character reference state/a> uses a dfn idreturn-state>var>return state/var>/dfn> to return to the state it was invoked from./p> p>The output of the tokenization step is a series of zero or more of the following tokens: DOCTYPE, start tag, end tag, comment, character, end-of-file. DOCTYPE tokens have a name, a public identifier, a system identifier, and a dfn idforce-quirks-flag>i>force-quirks flag/i>/dfn>. When a DOCTYPE token is created, its name, public identifier, and system identifier must be marked as missing (which is a distinct state from the empty string), and the i idtokenization:force-quirks-flag>a href#force-quirks-flag>force-quirks flag/a>/i> must be set to i>off/i> (its other state is i>on/i>). Start and end tag tokens have a tag name, a dfn idself-closing-flag>self-closing flag/dfn>, and a list of attributes, each of which has a name and a value. When a start or end tag token is created, its i idtokenization:self-closing-flag>a href#self-closing-flag>self-closing flag/a>/i> must be unset (its other state is that it be set), and its attributes list must be empty. Comment and character tokens have data./p> p>When a token is emitted, it must immediately be handled by the a href#tree-construction idtokenization:tree-construction>tree construction/a> stage. The tree construction stage can affect the state of the tokenization stage, and can insert additional characters into the stream. (For example, the code idtokenization:the-script-element>a href#the-script-element>script/a>/code> element can result in scripts executing and using the a href#dynamic-markup-insertion idtokenization:dynamic-markup-insertion>dynamic markup insertion/a> APIs to insert characters into the stream being tokenized.)/p> p classnote>Creating a token and emitting it are distinct actions. It is possible for a token to be created but implicitly abandoned (never emitted), e.g. if the file ends unexpectedly while processing the characters that are being parsed into a start tag token./p> p>When a start tag token is emitted with its i idtokenization:self-closing-flag-2>a href#self-closing-flag>self-closing flag/a>/i> set, if the flag is not dfn idacknowledge-self-closing-flag>acknowledged/dfn> when it is processed by the tree construction stage, that is a a href#parse-error-non-void-html-element-start-tag-with-trailing-solidus idtokenization:parse-error-non-void-html-element-start-tag-with-trailing-solidus>non-void-html-element-start-tag-with-trailing-solidus/a> a href#parse-errors idtokenization:parse-errors>parse error/a>./p> p>When an end tag token is emitted with attributes, that is an a href#parse-error-end-tag-with-attributes idtokenization:parse-error-end-tag-with-attributes>end-tag-with-attributes/a> a href#parse-errors idtokenization:parse-errors-2>parse error/a>./p> p>When an end tag token is emitted with its i idtokenization:self-closing-flag-3>a href#self-closing-flag>self-closing flag/a>/i> set, that is an a href#parse-error-end-tag-with-trailing-solidus idtokenization:parse-error-end-tag-with-trailing-solidus>end-tag-with-trailing-solidus/a> a href#parse-errors idtokenization:parse-errors-3>parse error/a>./p> p>An dfn idappropriate-end-tag-token>appropriate end tag token/dfn> is an end tag token whose tag name matches the tag name of the last start tag to have been emitted from this tokenizer, if any. If no start tag has been emitted from this tokenizer, then no end tag token is appropriate./p> p>A a href#syntax-charref idtokenization:syntax-charref>character reference/a> is said to be dfn idcharref-in-attribute>consumed as part of an attribute/dfn> if the var idtokenization:return-state>a href#return-state>return state/a>/var> is either a href#attribute-value-(double-quoted)-state idtokenization:attribute-value-(double-quoted)-state>attribute value (double-quoted) state/a>, a href#attribute-value-(single-quoted)-state idtokenization:attribute-value-(single-quoted)-state>attribute value (single-quoted) state/a> or a href#attribute-value-(unquoted)-state idtokenization:attribute-value-(unquoted)-state>attribute value (unquoted) state/a>./p> p>When a state says to dfn idflush-code-points-consumed-as-a-character-reference>flush code points consumed as a character reference/dfn>, it means that for each a idtokenization:code-point hrefhttps://infra.spec.whatwg.org/#code-point data-x-internalcode-point>code point/a> in the var idtokenization:temporary-buffer>a href#temporary-buffer>temporary buffer/a>/var> (in the order they were added to the buffer) user agent must append the code point from the buffer to the current attributes value if the character reference was a href#charref-in-attribute idtokenization:charref-in-attribute>consumed as part of an attribute/a>, or emit the code point as a character token otherwise./p> p idcheck-parser-pause-flag>Before each step of the tokenizer, the user agent must first check the a href#parser-pause-flag idtokenization:parser-pause-flag>parser pause flag/a>. If it is true, then the tokenizer must abort the processing of any nested invocations of the tokenizer, yielding control back to the caller./p> p>The tokenizer state machine consists of the states defined in the following subsections./p> h5 iddata-state>span classsecno>12.2.5.1/span> dfn>Data state/dfn>a href#data-state classself-link>/a>/h5> p>Consume the a href#next-input-character iddata-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0026 AMPERSAND (&)dd>Set the var iddata-state:return-state>a href#return-state>return state/a>/var> to the a href#data-state iddata-state:data-state>data state/a>. Switch to the a href#character-reference-state iddata-state:character-reference-state>character reference state/a>.dt>U+003C LESS-THAN SIGN (<)dd>Switch to the a href#tag-open-state iddata-state:tag-open-state>tag open state/a>.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character iddata-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors iddata-state:parse-errors>parse error/a>. Emit the a href#current-input-character iddata-state:current-input-character>current input character/a> as a character token.dt>EOFdd>Emit an end-of-file token.dt>Anything elsedd>Emit the a href#current-input-character iddata-state:current-input-character-2>current input character/a> as a character token./dl> h5 idrcdata-state>span classsecno>12.2.5.2/span> dfn>RCDATA state/dfn>a href#rcdata-state classself-link>/a>/h5> p>Consume the a href#next-input-character idrcdata-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0026 AMPERSAND (&)dd>Set the var idrcdata-state:return-state>a href#return-state>return state/a>/var> to the a href#rcdata-state idrcdata-state:rcdata-state>RCDATA state/a>. Switch to the a href#character-reference-state idrcdata-state:character-reference-state>character reference state/a>.dt>U+003C LESS-THAN SIGN (<)dd>Switch to the a href#rcdata-less-than-sign-state idrcdata-state:rcdata-less-than-sign-state>RCDATA less-than sign state/a>.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idrcdata-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idrcdata-state:parse-errors>parse error/a>. Emit a U+FFFD REPLACEMENT CHARACTER character token.dt>EOFdd>Emit an end-of-file token.dt>Anything elsedd>Emit the a href#current-input-character idrcdata-state:current-input-character>current input character/a> as a character token./dl> h5 idrawtext-state>span classsecno>12.2.5.3/span> dfn>RAWTEXT state/dfn>a href#rawtext-state classself-link>/a>/h5> p>Consume the a href#next-input-character idrawtext-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+003C LESS-THAN SIGN (<)dd>Switch to the a href#rawtext-less-than-sign-state idrawtext-state:rawtext-less-than-sign-state>RAWTEXT less-than sign state/a>.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idrawtext-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idrawtext-state:parse-errors>parse error/a>. Emit a U+FFFD REPLACEMENT CHARACTER character token.dt>EOFdd>Emit an end-of-file token.dt>Anything elsedd>Emit the a href#current-input-character idrawtext-state:current-input-character>current input character/a> as a character token./dl> h5 idscript-data-state>span classsecno>12.2.5.4/span> dfn>Script data state/dfn>a href#script-data-state classself-link>/a>/h5> p>Consume the a href#next-input-character idscript-data-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+003C LESS-THAN SIGN (<)dd>Switch to the a href#script-data-less-than-sign-state idscript-data-state:script-data-less-than-sign-state>script data less-than sign state/a>.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idscript-data-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idscript-data-state:parse-errors>parse error/a>. Emit a U+FFFD REPLACEMENT CHARACTER character token.dt>EOFdd>Emit an end-of-file token.dt>Anything elsedd>Emit the a href#current-input-character idscript-data-state:current-input-character>current input character/a> as a character token./dl> h5 idplaintext-state>span classsecno>12.2.5.5/span> dfn>PLAINTEXT state/dfn>a href#plaintext-state classself-link>/a>/h5> p>Consume the a href#next-input-character idplaintext-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idplaintext-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idplaintext-state:parse-errors>parse error/a>. Emit a U+FFFD REPLACEMENT CHARACTER character token.dt>EOFdd>Emit an end-of-file token.dt>Anything elsedd>Emit the a href#current-input-character idplaintext-state:current-input-character>current input character/a> as a character token./dl> h5 idtag-open-state>span classsecno>12.2.5.6/span> dfn>Tag open state/dfn>a href#tag-open-state classself-link>/a>/h5> p>Consume the a href#next-input-character idtag-open-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0021 EXCLAMATION MARK (!)dd>Switch to the a href#markup-declaration-open-state idtag-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 idtag-open-state:end-tag-open-state>end tag open state/a>.dt>a idtag-open-state:ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-alpha data-x-internalascii-letters>ASCII alpha/a>dd>Create a new start tag token, set its tag name to the empty string. a href#reconsume idtag-open-state:reconsume>Reconsume/a> in the a href#tag-name-state idtag-open-state:tag-name-state>tag name state/a>. dt>U+003F QUESTION MARK (?)dd>This is an a href#parse-error-unexpected-question-mark-instead-of-tag-name idtag-open-state:parse-error-unexpected-question-mark-instead-of-tag-name>unexpected-question-mark-instead-of-tag-name/a> a href#parse-errors idtag-open-state:parse-errors>parse error/a>. Create a comment token whose data is the empty string. a href#reconsume idtag-open-state:reconsume-2>Reconsume/a> in the a href#bogus-comment-state idtag-open-state:bogus-comment-state>bogus comment state/a>.dt>EOFdd>This is an a href#parse-error-eof-before-tag-name idtag-open-state:parse-error-eof-before-tag-name>eof-before-tag-name/a> a href#parse-errors idtag-open-state:parse-errors-2>parse error/a>. Emit a U+003C LESS-THAN SIGN character token and an end-of-file token.dt>Anything elsedd>This is an a href#parse-error-invalid-first-character-of-tag-name idtag-open-state:parse-error-invalid-first-character-of-tag-name>invalid-first-character-of-tag-name/a> a href#parse-errors idtag-open-state:parse-errors-3>parse error/a>. Emit a U+003C LESS-THAN SIGN character token. a href#reconsume idtag-open-state:reconsume-3>Reconsume/a> in the a href#data-state idtag-open-state:data-state>data state/a>./dl> h5 idend-tag-open-state>span classsecno>12.2.5.7/span> dfn>End tag open state/dfn>a href#end-tag-open-state classself-link>/a>/h5> p>Consume the a href#next-input-character idend-tag-open-state:next-input-character>next input character/a>:/p> dl classswitch>dt>a idend-tag-open-state:ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-alpha data-x-internalascii-letters>ASCII alpha/a>dd>Create a new end tag token, set its tag name to the empty string. a href#reconsume idend-tag-open-state:reconsume>Reconsume/a> in the a href#tag-name-state idend-tag-open-state:tag-name-state>tag name state/a>. dt>U+003E GREATER-THAN SIGN (>)dd>This is a a href#parse-error-missing-end-tag-name idend-tag-open-state:parse-error-missing-end-tag-name>missing-end-tag-name/a> a href#parse-errors idend-tag-open-state:parse-errors>parse error/a>. Switch to the a href#data-state idend-tag-open-state:data-state>data state/a>.dt>EOFdd>This is an a href#parse-error-eof-before-tag-name idend-tag-open-state:parse-error-eof-before-tag-name>eof-before-tag-name/a> a href#parse-errors idend-tag-open-state:parse-errors-2>parse error/a>. Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS character token and an end-of-file token. dt>Anything elsedd>This is an a href#parse-error-invalid-first-character-of-tag-name idend-tag-open-state:parse-error-invalid-first-character-of-tag-name>invalid-first-character-of-tag-name/a> a href#parse-errors idend-tag-open-state:parse-errors-3>parse error/a>. Create a comment token whose data is the empty string. a href#reconsume idend-tag-open-state:reconsume-2>Reconsume/a> in the a href#bogus-comment-state idend-tag-open-state:bogus-comment-state>bogus comment state/a>./dl> h5 idtag-name-state>span classsecno>12.2.5.8/span> dfn>Tag name state/dfn>a href#tag-name-state classself-link>/a>/h5> p>Consume the a href#next-input-character idtag-name-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>Switch to the a href#before-attribute-name-state idtag-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 idtag-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 idtag-name-state:data-state>data state/a>. Emit the current tag token.dt>a idtag-name-state:uppercase-ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha data-x-internaluppercase-ascii-letters>ASCII upper alpha/a>dd>Append the lowercase version of the a href#current-input-character idtag-name-state:current-input-character>current input character/a> (add 0x0020 to the characters code point) to the current tag tokens tag name.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idtag-name-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idtag-name-state:parse-errors>parse error/a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current tag tokens tag name.dt>EOFdd>This is an a href#parse-error-eof-in-tag idtag-name-state:parse-error-eof-in-tag>eof-in-tag/a> a href#parse-errors idtag-name-state:parse-errors-2>parse error/a>. Emit an end-of-file token.dt>Anything elsedd>Append the a href#current-input-character idtag-name-state:current-input-character-2>current input character/a> to the current tag tokens tag name./dl> h5 idrcdata-less-than-sign-state>span classsecno>12.2.5.9/span> dfn>RCDATA less-than sign state/dfn>a href#rcdata-less-than-sign-state classself-link>/a>/h5> p>Consume the a href#next-input-character idrcdata-less-than-sign-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002F SOLIDUS (/)dd>Set the var idrcdata-less-than-sign-state:temporary-buffer>a href#temporary-buffer>temporary buffer/a>/var> to the empty string. Switch to the a href#rcdata-end-tag-open-state idrcdata-less-than-sign-state:rcdata-end-tag-open-state>RCDATA end tag open state/a>.dt>Anything elsedd>Emit a U+003C LESS-THAN SIGN character token. a href#reconsume idrcdata-less-than-sign-state:reconsume>Reconsume/a> in the a href#rcdata-state idrcdata-less-than-sign-state:rcdata-state>RCDATA state/a>./dl> h5 idrcdata-end-tag-open-state>span classsecno>12.2.5.10/span> dfn>RCDATA end tag open state/dfn>a href#rcdata-end-tag-open-state classself-link>/a>/h5> p>Consume the a href#next-input-character idrcdata-end-tag-open-state:next-input-character>next input character/a>:/p> dl classswitch>dt>a idrcdata-end-tag-open-state:ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-alpha data-x-internalascii-letters>ASCII alpha/a>dd>Create a new end tag token, set its tag name to the empty string. a href#reconsume idrcdata-end-tag-open-state:reconsume>Reconsume/a> in the a href#rcdata-end-tag-name-state idrcdata-end-tag-open-state:rcdata-end-tag-name-state>RCDATA end tag name state/a>. dt>Anything elsedd>Emit a U+003C LESS-THAN SIGN character token and a U+002F SOLIDUS character token. a href#reconsume idrcdata-end-tag-open-state:reconsume-2>Reconsume/a> in the a href#rcdata-state idrcdata-end-tag-open-state:rcdata-state>RCDATA state/a>./dl> h5 idrcdata-end-tag-name-state>span classsecno>12.2.5.11/span> dfn>RCDATA end tag name state/dfn>a href#rcdata-end-tag-name-state classself-link>/a>/h5> p>Consume the a href#next-input-character idrcdata-end-tag-name-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>If the current end tag token is an a href#appropriate-end-tag-token idrcdata-end-tag-name-state:appropriate-end-tag-token>appropriate end tag token/a>, then switch to the a href#before-attribute-name-state idrcdata-end-tag-name-state:before-attribute-name-state>before attribute name state/a>. Otherwise, treat it as per the anything else entry below.dt>U+002F SOLIDUS (/)dd>If the current end tag token is an a href#appropriate-end-tag-token idrcdata-end-tag-name-state:appropriate-end-tag-token-2>appropriate end tag token/a>, then switch to the a href#self-closing-start-tag-state idrcdata-end-tag-name-state:self-closing-start-tag-state>self-closing start tag state/a>. Otherwise, treat it as per the anything else entry below.dt>U+003E GREATER-THAN SIGN (>)dd>If the current end tag token is an a href#appropriate-end-tag-token idrcdata-end-tag-name-state:appropriate-end-tag-token-3>appropriate end tag token/a>, then switch to the a href#data-state idrcdata-end-tag-name-state:data-state>data state/a> and emit the current tag token. Otherwise, treat it as per the anything else entry below.dt>a idrcdata-end-tag-name-state:uppercase-ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha data-x-internaluppercase-ascii-letters>ASCII upper alpha/a>dd>Append the lowercase version of the a href#current-input-character idrcdata-end-tag-name-state:current-input-character>current input character/a> (add 0x0020 to the characters code point) to the current tag tokens tag name. Append the a href#current-input-character idrcdata-end-tag-name-state:current-input-character-2>current input character/a> to the var idrcdata-end-tag-name-state:temporary-buffer>a href#temporary-buffer>temporary buffer/a>/var>.dt>a idrcdata-end-tag-name-state:lowercase-ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-lower-alpha data-x-internallowercase-ascii-letters>ASCII lower alpha/a>dd>Append the a href#current-input-character idrcdata-end-tag-name-state:current-input-character-3>current input character/a> to the current tag tokens tag name. Append the a href#current-input-character idrcdata-end-tag-name-state:current-input-character-4>current input character/a> to the var idrcdata-end-tag-name-state:temporary-buffer-2>a href#temporary-buffer>temporary buffer/a>/var>.dt>Anything elsedd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS character token, and a character token for each of the characters in the var idrcdata-end-tag-name-state:temporary-buffer-3>a href#temporary-buffer>temporary buffer/a>/var> (in the order they were added to the buffer). a href#reconsume idrcdata-end-tag-name-state:reconsume>Reconsume/a> in the a href#rcdata-state idrcdata-end-tag-name-state:rcdata-state>RCDATA state/a>./dl> h5 idrawtext-less-than-sign-state>span classsecno>12.2.5.12/span> dfn>RAWTEXT less-than sign state/dfn>a href#rawtext-less-than-sign-state classself-link>/a>/h5> p>Consume the a href#next-input-character idrawtext-less-than-sign-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002F SOLIDUS (/)dd>Set the var idrawtext-less-than-sign-state:temporary-buffer>a href#temporary-buffer>temporary buffer/a>/var> to the empty string. Switch to the a href#rawtext-end-tag-open-state idrawtext-less-than-sign-state:rawtext-end-tag-open-state>RAWTEXT end tag open state/a>.dt>Anything elsedd>Emit a U+003C LESS-THAN SIGN character token. a href#reconsume idrawtext-less-than-sign-state:reconsume>Reconsume/a> in the a href#rawtext-state idrawtext-less-than-sign-state:rawtext-state>RAWTEXT state/a>./dl> h5 idrawtext-end-tag-open-state>span classsecno>12.2.5.13/span> dfn>RAWTEXT end tag open state/dfn>a href#rawtext-end-tag-open-state classself-link>/a>/h5> p>Consume the a href#next-input-character idrawtext-end-tag-open-state:next-input-character>next input character/a>:/p> dl classswitch>dt>a idrawtext-end-tag-open-state:ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-alpha data-x-internalascii-letters>ASCII alpha/a>dd>Create a new end tag token, set its tag name to the empty string. a href#reconsume idrawtext-end-tag-open-state:reconsume>Reconsume/a> in the a href#rawtext-end-tag-name-state idrawtext-end-tag-open-state:rawtext-end-tag-name-state>RAWTEXT end tag name state/a>. dt>Anything elsedd>Emit a U+003C LESS-THAN SIGN character token and a U+002F SOLIDUS character token. a href#reconsume idrawtext-end-tag-open-state:reconsume-2>Reconsume/a> in the a href#rawtext-state idrawtext-end-tag-open-state:rawtext-state>RAWTEXT state/a>./dl> h5 idrawtext-end-tag-name-state>span classsecno>12.2.5.14/span> dfn>RAWTEXT end tag name state/dfn>a href#rawtext-end-tag-name-state classself-link>/a>/h5> p>Consume the a href#next-input-character idrawtext-end-tag-name-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>If the current end tag token is an a href#appropriate-end-tag-token idrawtext-end-tag-name-state:appropriate-end-tag-token>appropriate end tag token/a>, then switch to the a href#before-attribute-name-state idrawtext-end-tag-name-state:before-attribute-name-state>before attribute name state/a>. Otherwise, treat it as per the anything else entry below.dt>U+002F SOLIDUS (/)dd>If the current end tag token is an a href#appropriate-end-tag-token idrawtext-end-tag-name-state:appropriate-end-tag-token-2>appropriate end tag token/a>, then switch to the a href#self-closing-start-tag-state idrawtext-end-tag-name-state:self-closing-start-tag-state>self-closing start tag state/a>. Otherwise, treat it as per the anything else entry below.dt>U+003E GREATER-THAN SIGN (>)dd>If the current end tag token is an a href#appropriate-end-tag-token idrawtext-end-tag-name-state:appropriate-end-tag-token-3>appropriate end tag token/a>, then switch to the a href#data-state idrawtext-end-tag-name-state:data-state>data state/a> and emit the current tag token. Otherwise, treat it as per the anything else entry below.dt>a idrawtext-end-tag-name-state:uppercase-ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha data-x-internaluppercase-ascii-letters>ASCII upper alpha/a>dd>Append the lowercase version of the a href#current-input-character idrawtext-end-tag-name-state:current-input-character>current input character/a> (add 0x0020 to the characters code point) to the current tag tokens tag name. Append the a href#current-input-character idrawtext-end-tag-name-state:current-input-character-2>current input character/a> to the var idrawtext-end-tag-name-state:temporary-buffer>a href#temporary-buffer>temporary buffer/a>/var>.dt>a idrawtext-end-tag-name-state:lowercase-ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-lower-alpha data-x-internallowercase-ascii-letters>ASCII lower alpha/a>dd>Append the a href#current-input-character idrawtext-end-tag-name-state:current-input-character-3>current input character/a> to the current tag tokens tag name. Append the a href#current-input-character idrawtext-end-tag-name-state:current-input-character-4>current input character/a> to the var idrawtext-end-tag-name-state:temporary-buffer-2>a href#temporary-buffer>temporary buffer/a>/var>.dt>Anything elsedd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS character token, and a character token for each of the characters in the var idrawtext-end-tag-name-state:temporary-buffer-3>a href#temporary-buffer>temporary buffer/a>/var> (in the order they were added to the buffer). a href#reconsume idrawtext-end-tag-name-state:reconsume>Reconsume/a> in the a href#rawtext-state idrawtext-end-tag-name-state:rawtext-state>RAWTEXT state/a>./dl> h5 idscript-data-less-than-sign-state>span classsecno>12.2.5.15/span> dfn>Script data less-than sign state/dfn>a href#script-data-less-than-sign-state classself-link>/a>/h5> p>Consume the a href#next-input-character idscript-data-less-than-sign-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002F SOLIDUS (/)dd>Set the var idscript-data-less-than-sign-state:temporary-buffer>a href#temporary-buffer>temporary buffer/a>/var> to the empty string. Switch to the a href#script-data-end-tag-open-state idscript-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 idscript-data-less-than-sign-state:script-data-escape-start-state>script data escape start state/a>. Emit a U+003C LESS-THAN SIGN character token and a U+0021 EXCLAMATION MARK character token.dt>Anything elsedd>Emit a U+003C LESS-THAN SIGN character token. a href#reconsume idscript-data-less-than-sign-state:reconsume>Reconsume/a> in the a href#script-data-state idscript-data-less-than-sign-state:script-data-state>script data state/a>./dl> h5 idscript-data-end-tag-open-state>span classsecno>12.2.5.16/span> dfn>Script data end tag open state/dfn>a href#script-data-end-tag-open-state classself-link>/a>/h5> p>Consume the a href#next-input-character idscript-data-end-tag-open-state:next-input-character>next input character/a>:/p> dl classswitch>dt>a idscript-data-end-tag-open-state:ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-alpha data-x-internalascii-letters>ASCII alpha/a>dd>Create a new end tag token, set its tag name to the empty string. a href#reconsume idscript-data-end-tag-open-state:reconsume>Reconsume/a> in the a href#script-data-end-tag-name-state idscript-data-end-tag-open-state:script-data-end-tag-name-state>script data end tag name state/a>. dt>Anything elsedd>Emit a U+003C LESS-THAN SIGN character token and a U+002F SOLIDUS character token. a href#reconsume idscript-data-end-tag-open-state:reconsume-2>Reconsume/a> in the a href#script-data-state idscript-data-end-tag-open-state:script-data-state>script data state/a>./dl> h5 idscript-data-end-tag-name-state>span classsecno>12.2.5.17/span> dfn>Script data end tag name state/dfn>a href#script-data-end-tag-name-state classself-link>/a>/h5> p>Consume the a href#next-input-character idscript-data-end-tag-name-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>If the current end tag token is an a href#appropriate-end-tag-token idscript-data-end-tag-name-state:appropriate-end-tag-token>appropriate end tag token/a>, then switch to the a href#before-attribute-name-state idscript-data-end-tag-name-state:before-attribute-name-state>before attribute name state/a>. Otherwise, treat it as per the anything else entry below.dt>U+002F SOLIDUS (/)dd>If the current end tag token is an a href#appropriate-end-tag-token idscript-data-end-tag-name-state:appropriate-end-tag-token-2>appropriate end tag token/a>, then switch to the a href#self-closing-start-tag-state idscript-data-end-tag-name-state:self-closing-start-tag-state>self-closing start tag state/a>. Otherwise, treat it as per the anything else entry below.dt>U+003E GREATER-THAN SIGN (>)dd>If the current end tag token is an a href#appropriate-end-tag-token idscript-data-end-tag-name-state:appropriate-end-tag-token-3>appropriate end tag token/a>, then switch to the a href#data-state idscript-data-end-tag-name-state:data-state>data state/a> and emit the current tag token. Otherwise, treat it as per the anything else entry below.dt>a idscript-data-end-tag-name-state:uppercase-ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha data-x-internaluppercase-ascii-letters>ASCII upper alpha/a>dd>Append the lowercase version of the a href#current-input-character idscript-data-end-tag-name-state:current-input-character>current input character/a> (add 0x0020 to the characters code point) to the current tag tokens tag name. Append the a href#current-input-character idscript-data-end-tag-name-state:current-input-character-2>current input character/a> to the var idscript-data-end-tag-name-state:temporary-buffer>a href#temporary-buffer>temporary buffer/a>/var>.dt>a idscript-data-end-tag-name-state:lowercase-ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-lower-alpha data-x-internallowercase-ascii-letters>ASCII lower alpha/a>dd>Append the a href#current-input-character idscript-data-end-tag-name-state:current-input-character-3>current input character/a> to the current tag tokens tag name. Append the a href#current-input-character idscript-data-end-tag-name-state:current-input-character-4>current input character/a> to the var idscript-data-end-tag-name-state:temporary-buffer-2>a href#temporary-buffer>temporary buffer/a>/var>.dt>Anything elsedd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS character token, and a character token for each of the characters in the var idscript-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). a href#reconsume idscript-data-end-tag-name-state:reconsume>Reconsume/a> in the a href#script-data-state idscript-data-end-tag-name-state:script-data-state>script data state/a>./dl> h5 idscript-data-escape-start-state>span classsecno>12.2.5.18/span> dfn>Script data escape start state/dfn>a href#script-data-escape-start-state classself-link>/a>/h5> p>Consume the a href#next-input-character idscript-data-escape-start-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002D HYPHEN-MINUS (-)dd>Switch to the a href#script-data-escape-start-dash-state idscript-data-escape-start-state:script-data-escape-start-dash-state>script data escape start dash state/a>. Emit a U+002D HYPHEN-MINUS character token.dt>Anything elsedd>a href#reconsume idscript-data-escape-start-state:reconsume>Reconsume/a> in the a href#script-data-state idscript-data-escape-start-state:script-data-state>script data state/a>./dl> h5 idscript-data-escape-start-dash-state>span classsecno>12.2.5.19/span> dfn>Script data escape start dash state/dfn>a href#script-data-escape-start-dash-state classself-link>/a>/h5> p>Consume the a href#next-input-character idscript-data-escape-start-dash-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002D HYPHEN-MINUS (-)dd>Switch to the a href#script-data-escaped-dash-dash-state idscript-data-escape-start-dash-state:script-data-escaped-dash-dash-state>script data escaped dash dash state/a>. Emit a U+002D HYPHEN-MINUS character token.dt>Anything elsedd>a href#reconsume idscript-data-escape-start-dash-state:reconsume>Reconsume/a> in the a href#script-data-state idscript-data-escape-start-dash-state:script-data-state>script data state/a>./dl> h5 idscript-data-escaped-state>span classsecno>12.2.5.20/span> dfn>Script data escaped state/dfn>a href#script-data-escaped-state classself-link>/a>/h5> p>Consume the a href#next-input-character idscript-data-escaped-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002D HYPHEN-MINUS (-)dd>Switch to the a href#script-data-escaped-dash-state idscript-data-escaped-state:script-data-escaped-dash-state>script data escaped dash state/a>. Emit a U+002D HYPHEN-MINUS character token.dt>U+003C LESS-THAN SIGN (<)dd>Switch to the a href#script-data-escaped-less-than-sign-state idscript-data-escaped-state:script-data-escaped-less-than-sign-state>script data escaped less-than sign state/a>.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idscript-data-escaped-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idscript-data-escaped-state:parse-errors>parse error/a>. Emit a U+FFFD REPLACEMENT CHARACTER character token.dt>EOFdd>This is an a href#parse-error-eof-in-script-html-comment-like-text idscript-data-escaped-state:parse-error-eof-in-script-html-comment-like-text>eof-in-script-html-comment-like-text/a> a href#parse-errors idscript-data-escaped-state:parse-errors-2>parse error/a>. Emit an end-of-file token.dt>Anything elsedd>Emit the a href#current-input-character idscript-data-escaped-state:current-input-character>current input character/a> as a character token./dl> h5 idscript-data-escaped-dash-state>span classsecno>12.2.5.21/span> dfn>Script data escaped dash state/dfn>a href#script-data-escaped-dash-state classself-link>/a>/h5> p>Consume the a href#next-input-character idscript-data-escaped-dash-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002D HYPHEN-MINUS (-)dd>Switch to the a href#script-data-escaped-dash-dash-state idscript-data-escaped-dash-state:script-data-escaped-dash-dash-state>script data escaped dash dash state/a>. Emit a U+002D HYPHEN-MINUS character token.dt>U+003C LESS-THAN SIGN (<)dd>Switch to the a href#script-data-escaped-less-than-sign-state idscript-data-escaped-dash-state:script-data-escaped-less-than-sign-state>script data escaped less-than sign state/a>.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idscript-data-escaped-dash-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idscript-data-escaped-dash-state:parse-errors>parse error/a>. Switch to the a href#script-data-escaped-state idscript-data-escaped-dash-state:script-data-escaped-state>script data escaped state/a>. Emit a U+FFFD REPLACEMENT CHARACTER character token.dt>EOFdd>This is an a href#parse-error-eof-in-script-html-comment-like-text idscript-data-escaped-dash-state:parse-error-eof-in-script-html-comment-like-text>eof-in-script-html-comment-like-text/a> a href#parse-errors idscript-data-escaped-dash-state:parse-errors-2>parse error/a>. Emit an end-of-file token.dt>Anything elsedd>Switch to the a href#script-data-escaped-state idscript-data-escaped-dash-state:script-data-escaped-state-2>script data escaped state/a>. Emit the a href#current-input-character idscript-data-escaped-dash-state:current-input-character>current input character/a> as a character token./dl> h5 idscript-data-escaped-dash-dash-state>span classsecno>12.2.5.22/span> dfn>Script data escaped dash dash state/dfn>a href#script-data-escaped-dash-dash-state classself-link>/a>/h5> p>Consume the a href#next-input-character idscript-data-escaped-dash-dash-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002D HYPHEN-MINUS (-)dd>Emit a U+002D HYPHEN-MINUS character token.dt>U+003C LESS-THAN SIGN (<)dd>Switch to the a href#script-data-escaped-less-than-sign-state idscript-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 idscript-data-escaped-dash-dash-state:script-data-state>script data state/a>. Emit a U+003E GREATER-THAN SIGN character token.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idscript-data-escaped-dash-dash-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idscript-data-escaped-dash-dash-state:parse-errors>parse error/a>. Switch to the a href#script-data-escaped-state idscript-data-escaped-dash-dash-state:script-data-escaped-state>script data escaped state/a>. Emit a U+FFFD REPLACEMENT CHARACTER character token.dt>EOFdd>This is an a href#parse-error-eof-in-script-html-comment-like-text idscript-data-escaped-dash-dash-state:parse-error-eof-in-script-html-comment-like-text>eof-in-script-html-comment-like-text/a> a href#parse-errors idscript-data-escaped-dash-dash-state:parse-errors-2>parse error/a>. Emit an end-of-file token.dt>Anything elsedd>Switch to the a href#script-data-escaped-state idscript-data-escaped-dash-dash-state:script-data-escaped-state-2>script data escaped state/a>. Emit the a href#current-input-character idscript-data-escaped-dash-dash-state:current-input-character>current input character/a> as a character token./dl> h5 idscript-data-escaped-less-than-sign-state>span classsecno>12.2.5.23/span> dfn>Script data escaped less-than sign state/dfn>a href#script-data-escaped-less-than-sign-state classself-link>/a>/h5> p>Consume the a href#next-input-character idscript-data-escaped-less-than-sign-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002F SOLIDUS (/)dd>Set the var idscript-data-escaped-less-than-sign-state:temporary-buffer>a href#temporary-buffer>temporary buffer/a>/var> to the empty string. Switch to the a href#script-data-escaped-end-tag-open-state idscript-data-escaped-less-than-sign-state:script-data-escaped-end-tag-open-state>script data escaped end tag open state/a>.dt>a idscript-data-escaped-less-than-sign-state:ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-alpha data-x-internalascii-letters>ASCII alpha/a>dd>Set the var idscript-data-escaped-less-than-sign-state:temporary-buffer-2>a href#temporary-buffer>temporary buffer/a>/var> to the empty string. Emit a U+003C LESS-THAN SIGN character token. a href#reconsume idscript-data-escaped-less-than-sign-state:reconsume>Reconsume/a> in the a href#script-data-double-escape-start-state idscript-data-escaped-less-than-sign-state:script-data-double-escape-start-state>script data double escape start state/a>.dt>Anything elsedd>Emit a U+003C LESS-THAN SIGN character token. a href#reconsume idscript-data-escaped-less-than-sign-state:reconsume-2>Reconsume/a> in the a href#script-data-escaped-state idscript-data-escaped-less-than-sign-state:script-data-escaped-state>script data escaped state/a>./dl> h5 idscript-data-escaped-end-tag-open-state>span classsecno>12.2.5.24/span> dfn>Script data escaped end tag open state/dfn>a href#script-data-escaped-end-tag-open-state classself-link>/a>/h5> p>Consume the a href#next-input-character idscript-data-escaped-end-tag-open-state:next-input-character>next input character/a>:/p> dl classswitch>dt>a idscript-data-escaped-end-tag-open-state:ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-alpha data-x-internalascii-letters>ASCII alpha/a>dd>Create a new end tag token. a href#reconsume idscript-data-escaped-end-tag-open-state:reconsume>Reconsume/a> in the a href#script-data-escaped-end-tag-name-state idscript-data-escaped-end-tag-open-state:script-data-escaped-end-tag-name-state>script data escaped end tag name state/a>. (Dont emit the token yet; further details will be filled in before it is emitted.)dt>Anything elsedd>Emit a U+003C LESS-THAN SIGN character token and a U+002F SOLIDUS character token. a href#reconsume idscript-data-escaped-end-tag-open-state:reconsume-2>Reconsume/a> in the a href#script-data-escaped-state idscript-data-escaped-end-tag-open-state:script-data-escaped-state>script data escaped state/a>./dl> h5 idscript-data-escaped-end-tag-name-state>span classsecno>12.2.5.25/span> dfn>Script data escaped end tag name state/dfn>a href#script-data-escaped-end-tag-name-state classself-link>/a>/h5> p>Consume the a href#next-input-character idscript-data-escaped-end-tag-name-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>If the current end tag token is an a href#appropriate-end-tag-token idscript-data-escaped-end-tag-name-state:appropriate-end-tag-token>appropriate end tag token/a>, then switch to the a href#before-attribute-name-state idscript-data-escaped-end-tag-name-state:before-attribute-name-state>before attribute name state/a>. Otherwise, treat it as per the anything else entry below.dt>U+002F SOLIDUS (/)dd>If the current end tag token is an a href#appropriate-end-tag-token idscript-data-escaped-end-tag-name-state:appropriate-end-tag-token-2>appropriate end tag token/a>, then switch to the a href#self-closing-start-tag-state idscript-data-escaped-end-tag-name-state:self-closing-start-tag-state>self-closing start tag state/a>. Otherwise, treat it as per the anything else entry below.dt>U+003E GREATER-THAN SIGN (>)dd>If the current end tag token is an a href#appropriate-end-tag-token idscript-data-escaped-end-tag-name-state:appropriate-end-tag-token-3>appropriate end tag token/a>, then switch to the a href#data-state idscript-data-escaped-end-tag-name-state:data-state>data state/a> and emit the current tag token. Otherwise, treat it as per the anything else entry below.dt>a idscript-data-escaped-end-tag-name-state:uppercase-ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha data-x-internaluppercase-ascii-letters>ASCII upper alpha/a>dd>Append the lowercase version of the a href#current-input-character idscript-data-escaped-end-tag-name-state:current-input-character>current input character/a> (add 0x0020 to the characters code point) to the current tag tokens tag name. Append the a href#current-input-character idscript-data-escaped-end-tag-name-state:current-input-character-2>current input character/a> to the var idscript-data-escaped-end-tag-name-state:temporary-buffer>a href#temporary-buffer>temporary buffer/a>/var>.dt>a idscript-data-escaped-end-tag-name-state:lowercase-ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-lower-alpha data-x-internallowercase-ascii-letters>ASCII lower alpha/a>dd>Append the a href#current-input-character idscript-data-escaped-end-tag-name-state:current-input-character-3>current input character/a> to the current tag tokens tag name. Append the a href#current-input-character idscript-data-escaped-end-tag-name-state:current-input-character-4>current input character/a> to the var idscript-data-escaped-end-tag-name-state:temporary-buffer-2>a href#temporary-buffer>temporary buffer/a>/var>.dt>Anything elsedd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS character token, and a character token for each of the characters in the var idscript-data-escaped-end-tag-name-state:temporary-buffer-3>a href#temporary-buffer>temporary buffer /a>/var> (in the order they were added to the buffer). a href#reconsume idscript-data-escaped-end-tag-name-state:reconsume>Reconsume/a> in the a href#script-data-escaped-state idscript-data-escaped-end-tag-name-state:script-data-escaped-state>script data escaped state/a>./dl> h5 idscript-data-double-escape-start-state>span classsecno>12.2.5.26/span> dfn>Script data double escape start state/dfn>a href#script-data-double-escape-start-state classself-link>/a>/h5> p>Consume the a href#next-input-character idscript-data-double-escape-start-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdt>U+002F SOLIDUS (/)dt>U+003E GREATER-THAN SIGN (>)dd>If the var idscript-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 idscript-data-double-escape-start-state:script-data-double-escaped-state>script data double escaped state/a>. Otherwise, switch to the a href#script-data-escaped-state idscript-data-double-escape-start-state:script-data-escaped-state>script data escaped state/a>. Emit the a href#current-input-character idscript-data-double-escape-start-state:current-input-character>current input character/a> as a character token.dt>a idscript-data-double-escape-start-state:uppercase-ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha data-x-internaluppercase-ascii-letters>ASCII upper alpha/a>dd>Append the lowercase version of the a href#current-input-character idscript-data-double-escape-start-state:current-input-character-2>current input character/a> (add 0x0020 to the characters code point) to the var idscript-data-double-escape-start-state:temporary-buffer-2>a href#temporary-buffer>temporary buffer/a>/var>. Emit the a href#current-input-character idscript-data-double-escape-start-state:current-input-character-3>current input character/a> as a character token.dt>a idscript-data-double-escape-start-state:lowercase-ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-lower-alpha data-x-internallowercase-ascii-letters>ASCII lower alpha/a>dd>Append the a href#current-input-character idscript-data-double-escape-start-state:current-input-character-4>current input character/a> to the var idscript-data-double-escape-start-state:temporary-buffer-3>a href#temporary-buffer>temporary buffer/a>/var>. Emit the a href#current-input-character idscript-data-double-escape-start-state:current-input-character-5>current input character/a> as a character token.dt>Anything elsedd>a href#reconsume idscript-data-double-escape-start-state:reconsume>Reconsume/a> in the a href#script-data-escaped-state idscript-data-double-escape-start-state:script-data-escaped-state-2>script data escaped state/a>./dl> h5 idscript-data-double-escaped-state>span classsecno>12.2.5.27/span> dfn>Script data double escaped state/dfn>a href#script-data-double-escaped-state classself-link>/a>/h5> p>Consume the a href#next-input-character idscript-data-double-escaped-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002D HYPHEN-MINUS (-)dd>Switch to the a href#script-data-double-escaped-dash-state idscript-data-double-escaped-state:script-data-double-escaped-dash-state>script data double escaped dash state/a>. Emit a U+002D HYPHEN-MINUS character token.dt>U+003C LESS-THAN SIGN (<)dd>Switch to the a href#script-data-double-escaped-less-than-sign-state idscript-data-double-escaped-state:script-data-double-escaped-less-than-sign-state>script data double escaped less-than sign state/a>. Emit a U+003C LESS-THAN SIGN character token.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idscript-data-double-escaped-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idscript-data-double-escaped-state:parse-errors>parse error/a>. Emit a U+FFFD REPLACEMENT CHARACTER character token.dt>EOFdd>This is an a href#parse-error-eof-in-script-html-comment-like-text idscript-data-double-escaped-state:parse-error-eof-in-script-html-comment-like-text>eof-in-script-html-comment-like-text/a> a href#parse-errors idscript-data-double-escaped-state:parse-errors-2>parse error/a>. Emit an end-of-file token.dt>Anything elsedd>Emit the a href#current-input-character idscript-data-double-escaped-state:current-input-character>current input character/a> as a character token./dl> h5 idscript-data-double-escaped-dash-state>span classsecno>12.2.5.28/span> dfn>Script data double escaped dash state/dfn>a href#script-data-double-escaped-dash-state classself-link>/a>/h5> p>Consume the a href#next-input-character idscript-data-double-escaped-dash-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002D HYPHEN-MINUS (-)dd>Switch to the a href#script-data-double-escaped-dash-dash-state idscript-data-double-escaped-dash-state:script-data-double-escaped-dash-dash-state>script data double escaped dash dash state/a>. Emit a U+002D HYPHEN-MINUS character token.dt>U+003C LESS-THAN SIGN (<)dd>Switch to the a href#script-data-double-escaped-less-than-sign-state idscript-data-double-escaped-dash-state:script-data-double-escaped-less-than-sign-state>script data double escaped less-than sign state/a>. Emit a U+003C LESS-THAN SIGN character token.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idscript-data-double-escaped-dash-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idscript-data-double-escaped-dash-state:parse-errors>parse error/a>. Switch to the a href#script-data-double-escaped-state idscript-data-double-escaped-dash-state:script-data-double-escaped-state>script data double escaped state/a>. Emit a U+FFFD REPLACEMENT CHARACTER character token.dt>EOFdd>This is an a href#parse-error-eof-in-script-html-comment-like-text idscript-data-double-escaped-dash-state:parse-error-eof-in-script-html-comment-like-text>eof-in-script-html-comment-like-text/a> a href#parse-errors idscript-data-double-escaped-dash-state:parse-errors-2>parse error/a>. Emit an end-of-file token.dt>Anything elsedd>Switch to the a href#script-data-double-escaped-state idscript-data-double-escaped-dash-state:script-data-double-escaped-state-2>script data double escaped state/a>. Emit the a href#current-input-character idscript-data-double-escaped-dash-state:current-input-character>current input character/a> as a character token./dl> h5 idscript-data-double-escaped-dash-dash-state>span classsecno>12.2.5.29/span> dfn>Script data double escaped dash dash state/dfn>a href#script-data-double-escaped-dash-dash-state classself-link>/a>/h5> p>Consume the a href#next-input-character idscript-data-double-escaped-dash-dash-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002D HYPHEN-MINUS (-)dd>Emit a U+002D HYPHEN-MINUS character token.dt>U+003C LESS-THAN SIGN (<)dd>Switch to the a href#script-data-double-escaped-less-than-sign-state idscript-data-double-escaped-dash-dash-state:script-data-double-escaped-less-than-sign-state>script data double escaped less-than sign state/a>. Emit a U+003C LESS-THAN SIGN character token.dt>U+003E GREATER-THAN SIGN (>)dd>Switch to the a href#script-data-state idscript-data-double-escaped-dash-dash-state:script-data-state>script data state/a>. Emit a U+003E GREATER-THAN SIGN character token.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idscript-data-double-escaped-dash-dash-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idscript-data-double-escaped-dash-dash-state:parse-errors>parse error/a>. Switch to the a href#script-data-double-escaped-state idscript-data-double-escaped-dash-dash-state:script-data-double-escaped-state>script data double escaped state/a>. Emit a U+FFFD REPLACEMENT CHARACTER character token.dt>EOFdd>This is an a href#parse-error-eof-in-script-html-comment-like-text idscript-data-double-escaped-dash-dash-state:parse-error-eof-in-script-html-comment-like-text>eof-in-script-html-comment-like-text/a> a href#parse-errors idscript-data-double-escaped-dash-dash-state:parse-errors-2>parse error/a>. Emit an end-of-file token.dt>Anything elsedd>Switch to the a href#script-data-double-escaped-state idscript-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 idscript-data-double-escaped-dash-dash-state:current-input-character>current input character/a> as a character token./dl> h5 idscript-data-double-escaped-less-than-sign-state>span classsecno>12.2.5.30/span> dfn>Script data double escaped less-than sign state/dfn>a href#script-data-double-escaped-less-than-sign-state classself-link>/a>/h5> p>Consume the a href#next-input-character idscript-data-double-escaped-less-than-sign-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002F SOLIDUS (/)dd>Set the var idscript-data-double-escaped-less-than-sign-state:temporary-buffer>a href#temporary-buffer>temporary buffer/a>/var> to the empty string. Switch to the a href#script-data-double-escape-end-state idscript-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 elsedd>a href#reconsume idscript-data-double-escaped-less-than-sign-state:reconsume>Reconsume/a> in the a href#script-data-double-escaped-state idscript-data-double-escaped-less-than-sign-state:script-data-double-escaped-state>script data double escaped state/a>./dl> h5 idscript-data-double-escape-end-state>span classsecno>12.2.5.31/span> dfn>Script data double escape end state/dfn>a href#script-data-double-escape-end-state classself-link>/a>/h5> p>Consume the a href#next-input-character idscript-data-double-escape-end-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdt>U+002F SOLIDUS (/)dt>U+003E GREATER-THAN SIGN (>)dd>If the var idscript-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 idscript-data-double-escape-end-state:script-data-escaped-state>script data escaped state/a>. Otherwise, switch to the a href#script-data-double-escaped-state idscript-data-double-escape-end-state:script-data-double-escaped-state>script data double escaped state/a>. Emit the a href#current-input-character idscript-data-double-escape-end-state:current-input-character>current input character/a> as a character token.dt>a idscript-data-double-escape-end-state:uppercase-ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha data-x-internaluppercase-ascii-letters>ASCII upper alpha/a>dd>Append the lowercase version of the a href#current-input-character idscript-data-double-escape-end-state:current-input-character-2>current input character/a> (add 0x0020 to the characters code point) to the var idscript-data-double-escape-end-state:temporary-buffer-2>a href#temporary-buffer>temporary buffer/a>/var>. Emit the a href#current-input-character idscript-data-double-escape-end-state:current-input-character-3>current input character/a> as a character token.dt>a idscript-data-double-escape-end-state:lowercase-ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-lower-alpha data-x-internallowercase-ascii-letters>ASCII lower alpha/a>dd>Append the a href#current-input-character idscript-data-double-escape-end-state:current-input-character-4>current input character/a> to the var idscript-data-double-escape-end-state:temporary-buffer-3>a href#temporary-buffer>temporary buffer/a>/var>. Emit the a href#current-input-character idscript-data-double-escape-end-state:current-input-character-5>current input character/a> as a character token.dt>Anything elsedd>a href#reconsume idscript-data-double-escape-end-state:reconsume>Reconsume/a> in the a href#script-data-double-escaped-state idscript-data-double-escape-end-state:script-data-double-escaped-state-2>script data double escaped state/a>./dl> h5 idbefore-attribute-name-state>span classsecno>12.2.5.32/span> dfn>Before attribute name state/dfn>a href#before-attribute-name-state classself-link>/a>/h5> p>Consume the a href#next-input-character idbefore-attribute-name-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>Ignore the character.dt>U+002F SOLIDUS (/)dt>U+003E GREATER-THAN SIGN (>)dt>EOFdd>a href#reconsume idbefore-attribute-name-state:reconsume>Reconsume/a> in the a href#after-attribute-name-state idbefore-attribute-name-state:after-attribute-name-state>after attribute name state/a>.dt>U+003D EQUALS SIGN ()dd>This is an a href#parse-error-unexpected-equals-sign-before-attribute-name idbefore-attribute-name-state:parse-error-unexpected-equals-sign-before-attribute-name>unexpected-equals-sign-before-attribute-name/a> a href#parse-errors idbefore-attribute-name-state:parse-errors>parse error/a>. Start a new attribute in the current tag token. Set that attributes name to the a href#current-input-character idbefore-attribute-name-state:current-input-character>current input character/a>, and its value to the empty string. Switch to the a href#attribute-name-state idbefore-attribute-name-state:attribute-name-state>attribute name state/a>.dt>Anything elsedd>Start a new attribute in the current tag token. Set that attribute name and value to the empty string. a href#reconsume idbefore-attribute-name-state:reconsume-2>Reconsume/a> in the a href#attribute-name-state idbefore-attribute-name-state:attribute-name-state-2>attribute name state/a>./dl> h5 idattribute-name-state>span classsecno>12.2.5.33/span> dfn>Attribute name state/dfn>a href#attribute-name-state classself-link>/a>/h5> p>Consume the a href#next-input-character idattribute-name-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdt>U+002F SOLIDUS (/)dt>U+003E GREATER-THAN SIGN (>)dt>EOFdd>a href#reconsume idattribute-name-state:reconsume>Reconsume/a> in the a href#after-attribute-name-state idattribute-name-state:after-attribute-name-state>after attribute name state/a>.dt>U+003D EQUALS SIGN ()dd>Switch to the a href#before-attribute-value-state idattribute-name-state:before-attribute-value-state>before attribute value state/a>.dt>a idattribute-name-state:uppercase-ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha data-x-internaluppercase-ascii-letters>ASCII upper alpha/a>dd>Append the lowercase version of the a href#current-input-character idattribute-name-state:current-input-character>current input character/a> (add 0x0020 to the characters code point) to the current attributes name.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idattribute-name-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idattribute-name-state:parse-errors>parse error/a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current attributes name.dt>U+0022 QUOTATION MARK ()dt>U+0027 APOSTROPHE ()dt>U+003C LESS-THAN SIGN (<)dd>This is an a href#parse-error-unexpected-character-in-attribute-name idattribute-name-state:parse-error-unexpected-character-in-attribute-name>unexpected-character-in-attribute-name/a> a href#parse-errors idattribute-name-state:parse-errors-2>parse error/a>. Treat it as per the anything else entry below.dt>Anything elsedd>Append the a href#current-input-character idattribute-name-state:current-input-character-2>current input character/a> to the current attributes name./dl> p>When the user agent leaves the attribute name state (and before emitting the tag token, if appropriate), the complete attributes name must be compared to the other attributes on the same token; if there is already an attribute on the token with the exact same name, then this is a a href#parse-error-duplicate-attribute idattribute-name-state:parse-error-duplicate-attribute>duplicate-attribute/a> a href#parse-errors idattribute-name-state:parse-errors-3>parse error/a> and the new attribute must be removed from the token./p> p classnote>If an attribute is so removed from a token, it, and the value that gets associated with it, if any, are never subsequently used by the parser, and are therefore effectively discarded. Removing the attribute in this way does not change its status as the current attribute for the purposes of the tokenizer, however./p> h5 idafter-attribute-name-state>span classsecno>12.2.5.34/span> dfn>After attribute name state/dfn>a href#after-attribute-name-state classself-link>/a>/h5> p>Consume the a href#next-input-character idafter-attribute-name-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>Ignore the character.dt>U+002F SOLIDUS (/)dd>Switch to the a href#self-closing-start-tag-state idafter-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 idafter-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 idafter-attribute-name-state:data-state>data state/a>. Emit the current tag token.dt>EOFdd>This is an a href#parse-error-eof-in-tag idafter-attribute-name-state:parse-error-eof-in-tag>eof-in-tag/a> a href#parse-errors idafter-attribute-name-state:parse-errors>parse error/a>. Emit an end-of-file token.dt>Anything elsedd>Start a new attribute in the current tag token. Set that attribute name and value to the empty string. a href#reconsume idafter-attribute-name-state:reconsume>Reconsume/a> in the a href#attribute-name-state idafter-attribute-name-state:attribute-name-state>attribute name state/a>./dl> h5 idbefore-attribute-value-state>span classsecno>12.2.5.35/span> dfn>Before attribute value state/dfn>a href#before-attribute-value-state classself-link>/a>/h5> p>Consume the a href#next-input-character idbefore-attribute-value-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>Ignore the character.dt>U+0022 QUOTATION MARK ()dd>Switch to the a href#attribute-value-(double-quoted)-state idbefore-attribute-value-state:attribute-value-(double-quoted)-state>attribute value (double-quoted) state/a>.dt>U+0027 APOSTROPHE ()dd>Switch to the a href#attribute-value-(single-quoted)-state idbefore-attribute-value-state:attribute-value-(single-quoted)-state>attribute value (single-quoted) state/a>.dt>U+003E GREATER-THAN SIGN (>)dd>This is a a href#parse-error-missing-attribute-value idbefore-attribute-value-state:parse-error-missing-attribute-value>missing-attribute-value/a> a href#parse-errors idbefore-attribute-value-state:parse-errors>parse error/a>. Switch to the a href#data-state idbefore-attribute-value-state:data-state>data state/a>. Emit the current tag token.dt>Anything elsedd>a href#reconsume idbefore-attribute-value-state:reconsume>Reconsume/a> in the a href#attribute-value-(unquoted)-state idbefore-attribute-value-state:attribute-value-(unquoted)-state>attribute value (unquoted) state/a>./dl> h5 idattribute-value-(double-quoted)-state>span classsecno>12.2.5.36/span> dfn>Attribute value (double-quoted) state/dfn>a href#attribute-value-(double-quoted)-state classself-link>/a>/h5> p>Consume the a href#next-input-character idattribute-value-(double-quoted)-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0022 QUOTATION MARK ()dd>Switch to the a href#after-attribute-value-(quoted)-state idattribute-value-(double-quoted)-state:after-attribute-value-(quoted)-state>after attribute value (quoted) state/a>.dt>U+0026 AMPERSAND (&)dd>Set the var idattribute-value-(double-quoted)-state:return-state>a href#return-state>return state/a>/var> to the a href#attribute-value-(double-quoted)-state idattribute-value-(double-quoted)-state:attribute-value-(double-quoted)-state>attribute value (double-quoted) state/a>. Switch to the a href#character-reference-state idattribute-value-(double-quoted)-state:character-reference-state>character reference state/a>.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idattribute-value-(double-quoted)-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idattribute-value-(double-quoted)-state:parse-errors>parse error/a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current attributes value.dt>EOFdd>This is an a href#parse-error-eof-in-tag idattribute-value-(double-quoted)-state:parse-error-eof-in-tag>eof-in-tag/a> a href#parse-errors idattribute-value-(double-quoted)-state:parse-errors-2>parse error/a>. Emit an end-of-file token.dt>Anything elsedd>Append the a href#current-input-character idattribute-value-(double-quoted)-state:current-input-character>current input character/a> to the current attributes value./dl> h5 idattribute-value-(single-quoted)-state>span classsecno>12.2.5.37/span> dfn>Attribute value (single-quoted) state/dfn>a href#attribute-value-(single-quoted)-state classself-link>/a>/h5> p>Consume the a href#next-input-character idattribute-value-(single-quoted)-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0027 APOSTROPHE ()dd>Switch to the a href#after-attribute-value-(quoted)-state idattribute-value-(single-quoted)-state:after-attribute-value-(quoted)-state>after attribute value (quoted) state/a>.dt>U+0026 AMPERSAND (&)dd>Set the var idattribute-value-(single-quoted)-state:return-state>a href#return-state>return state/a>/var> to the a href#attribute-value-(single-quoted)-state idattribute-value-(single-quoted)-state:attribute-value-(single-quoted)-state>attribute value (single-quoted) state/a>. Switch to the a href#character-reference-state idattribute-value-(single-quoted)-state:character-reference-state>character reference state/a>.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idattribute-value-(single-quoted)-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idattribute-value-(single-quoted)-state:parse-errors>parse error/a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current attributes value.dt>EOFdd>This is an a href#parse-error-eof-in-tag idattribute-value-(single-quoted)-state:parse-error-eof-in-tag>eof-in-tag/a> a href#parse-errors idattribute-value-(single-quoted)-state:parse-errors-2>parse error/a>. Emit an end-of-file token.dt>Anything elsedd>Append the a href#current-input-character idattribute-value-(single-quoted)-state:current-input-character>current input character/a> to the current attributes value./dl> h5 idattribute-value-(unquoted)-state>span classsecno>12.2.5.38/span> dfn>Attribute value (unquoted) state/dfn>a href#attribute-value-(unquoted)-state classself-link>/a>/h5> p>Consume the a href#next-input-character idattribute-value-(unquoted)-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>Switch to the a href#before-attribute-name-state idattribute-value-(unquoted)-state:before-attribute-name-state>before attribute name state/a>.dt>U+0026 AMPERSAND (&)dd>Set the var idattribute-value-(unquoted)-state:return-state>a href#return-state>return state/a>/var> to the a href#attribute-value-(unquoted)-state idattribute-value-(unquoted)-state:attribute-value-(unquoted)-state>attribute value (unquoted) state/a>. Switch to the a href#character-reference-state idattribute-value-(unquoted)-state:character-reference-state>character reference state/a>.dt>U+003E GREATER-THAN SIGN (>)dd>Switch to the a href#data-state idattribute-value-(unquoted)-state:data-state>data state/a>. Emit the current tag token.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idattribute-value-(unquoted)-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idattribute-value-(unquoted)-state:parse-errors>parse error/a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current attributes value.dt>U+0022 QUOTATION MARK ()dt>U+0027 APOSTROPHE ()dt>U+003C LESS-THAN SIGN (<)dt>U+003D EQUALS SIGN ()dt>U+0060 GRAVE ACCENT (`)dd>This is an a href#parse-error-unexpected-character-in-unquoted-attribute-value idattribute-value-(unquoted)-state:parse-error-unexpected-character-in-unquoted-attribute-value>unexpected-character-in-unquoted-attribute-value/a> a href#parse-errors idattribute-value-(unquoted)-state:parse-errors-2>parse error/a>. Treat it as per the anything else entry below.dt>EOFdd>This is an a href#parse-error-eof-in-tag idattribute-value-(unquoted)-state:parse-error-eof-in-tag>eof-in-tag/a> a href#parse-errors idattribute-value-(unquoted)-state:parse-errors-3>parse error/a>. Emit an end-of-file token.dt>Anything elsedd>Append the a href#current-input-character idattribute-value-(unquoted)-state:current-input-character>current input character/a> to the current attributes value./dl> h5 idafter-attribute-value-(quoted)-state>span classsecno>12.2.5.39/span> dfn>After attribute value (quoted) state/dfn>a href#after-attribute-value-(quoted)-state classself-link>/a>/h5> p>Consume the a href#next-input-character idafter-attribute-value-(quoted)-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>Switch to the a href#before-attribute-name-state idafter-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 idafter-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 idafter-attribute-value-(quoted)-state:data-state>data state/a>. Emit the current tag token.dt>EOFdd>This is an a href#parse-error-eof-in-tag idafter-attribute-value-(quoted)-state:parse-error-eof-in-tag>eof-in-tag/a> a href#parse-errors idafter-attribute-value-(quoted)-state:parse-errors>parse error/a>. Emit an end-of-file token.dt>Anything elsedd>This is a a href#parse-error-missing-whitespace-between-attributes idafter-attribute-value-(quoted)-state:parse-error-missing-whitespace-between-attributes>missing-whitespace-between-attributes/a> a href#parse-errors idafter-attribute-value-(quoted)-state:parse-errors-2>parse error/a>. a href#reconsume idafter-attribute-value-(quoted)-state:reconsume>Reconsume/a> in the a href#before-attribute-name-state idafter-attribute-value-(quoted)-state:before-attribute-name-state-2>before attribute name state/a>. /dl> h5 idself-closing-start-tag-state>span classsecno>12.2.5.40/span> dfn>Self-closing start tag state/dfn>a href#self-closing-start-tag-state classself-link>/a>/h5> p>Consume the a href#next-input-character idself-closing-start-tag-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+003E GREATER-THAN SIGN (>)dd>Set the i idself-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 idself-closing-start-tag-state:data-state>data state/a>. Emit the current tag token.dt>EOFdd>This is an a href#parse-error-eof-in-tag idself-closing-start-tag-state:parse-error-eof-in-tag>eof-in-tag/a> a href#parse-errors idself-closing-start-tag-state:parse-errors>parse error/a>. Emit an end-of-file token.dt>Anything elsedd>This is an a href#parse-error-unexpected-solidus-in-tag idself-closing-start-tag-state:parse-error-unexpected-solidus-in-tag>unexpected-solidus-in-tag/a> a href#parse-errors idself-closing-start-tag-state:parse-errors-2>parse error/a>. a href#reconsume idself-closing-start-tag-state:reconsume>Reconsume/a> in the a href#before-attribute-name-state idself-closing-start-tag-state:before-attribute-name-state>before attribute name state/a>./dl> h5 idbogus-comment-state>span classsecno>12.2.5.41/span> dfn>Bogus comment state/dfn>a href#bogus-comment-state classself-link>/a>/h5> p>Consume the a href#next-input-character idbogus-comment-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+003E GREATER-THAN SIGN (>)dd>Switch to the a href#data-state idbogus-comment-state:data-state>data state/a>. Emit the comment token.dt>EOFdd>Emit the comment. Emit an end-of-file token.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idbogus-comment-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idbogus-comment-state:parse-errors>parse error/a>. Append a U+FFFD REPLACEMENT CHARACTER character to the comment tokens data.dt>Anything elsedd>Append the a href#current-input-character idbogus-comment-state:current-input-character>current input character/a> to the comment tokens data./dl> h5 idmarkup-declaration-open-state>span classsecno>12.2.5.42/span> dfn>Markup declaration open state/dfn>a href#markup-declaration-open-state classself-link>/a>/h5> p>If the next few characters are:p> dl classswitch>dt>Two U+002D HYPHEN-MINUS characters (-)dd>Consume those two characters, create a comment token whose data is the empty string, and switch to the a href#comment-start-state idmarkup-declaration-open-state:comment-start-state>comment start state/a>.dt>a idmarkup-declaration-open-state:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the word DOCTYPEdd>Consume those characters and switch to the a href#doctype-state idmarkup-declaration-open-state:doctype-state>DOCTYPE state/a>.dt>a href#case-sensitive idmarkup-declaration-open-state:case-sensitive>Case-sensitive/a> match for the string CDATA (the five uppercase letters CDATA with a U+005B LEFT SQUARE BRACKET character before and after)dd>Consume those characters. If there is an a href#adjusted-current-node idmarkup-declaration-open-state:adjusted-current-node>adjusted current node/a> and it is not an element in the a idmarkup-declaration-open-state:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>, then switch to the a href#cdata-section-state idmarkup-declaration-open-state:cdata-section-state>CDATA section state/a>. Otherwise, this is a a href#parse-error-cdata-in-html-content idmarkup-declaration-open-state:parse-error-cdata-in-html-content>cdata-in-html-content/a> a href#parse-errors idmarkup-declaration-open-state:parse-errors>parse error/a>. Create a comment token whose data is the CDATA string. Switch to the a href#bogus-comment-state idmarkup-declaration-open-state:bogus-comment-state>bogus comment state/a>.dt>Anything elsedd>This is an a href#parse-error-incorrectly-opened-comment idmarkup-declaration-open-state:parse-error-incorrectly-opened-comment>incorrectly-opened-comment/a> a href#parse-errors idmarkup-declaration-open-state:parse-errors-2>parse error/a>. Create a comment token whose data is the empty string. Switch to the a href#bogus-comment-state idmarkup-declaration-open-state:bogus-comment-state-2>bogus comment state/a> (dont consume anything in the current state)./dl> h5 idcomment-start-state>span classsecno>12.2.5.43/span> dfn>Comment start state/dfn>a href#comment-start-state classself-link>/a>/h5> p>Consume the a href#next-input-character idcomment-start-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002D HYPHEN-MINUS (-)dd>Switch to the a href#comment-start-dash-state idcomment-start-state:comment-start-dash-state>comment start dash state/a>.dt>U+003E GREATER-THAN SIGN (>)dd>This is an a href#parse-error-abrupt-closing-of-empty-comment idcomment-start-state:parse-error-abrupt-closing-of-empty-comment>abrupt-closing-of-empty-comment/a> a href#parse-errors idcomment-start-state:parse-errors>parse error/a>. Switch to the a href#data-state idcomment-start-state:data-state>data state/a>. Emit the comment token.dt>Anything elsedd>a href#reconsume idcomment-start-state:reconsume>Reconsume/a> in the a href#comment-state idcomment-start-state:comment-state>comment state/a>./dl> h5 idcomment-start-dash-state>span classsecno>12.2.5.44/span> dfn>Comment start dash state/dfn>a href#comment-start-dash-state classself-link>/a>/h5> p>Consume the a href#next-input-character idcomment-start-dash-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002D HYPHEN-MINUS (-)dd>Switch to the a href#comment-end-state idcomment-start-dash-state:comment-end-state>comment end state/a>dt>U+003E GREATER-THAN SIGN (>)dd>This is an a href#parse-error-abrupt-closing-of-empty-comment idcomment-start-dash-state:parse-error-abrupt-closing-of-empty-comment>abrupt-closing-of-empty-comment/a> a href#parse-errors idcomment-start-dash-state:parse-errors>parse error/a>. Switch to the a href#data-state idcomment-start-dash-state:data-state>data state/a>. Emit the comment token.dt>EOFdd>This is an a href#parse-error-eof-in-comment idcomment-start-dash-state:parse-error-eof-in-comment>eof-in-comment/a> a href#parse-errors idcomment-start-dash-state:parse-errors-2>parse error/a>. Emit the comment token. Emit an end-of-file token.dt>Anything elsedd>Append a U+002D HYPHEN-MINUS character (-) to the comment tokens data. a href#reconsume idcomment-start-dash-state:reconsume>Reconsume/a> in the a href#comment-state idcomment-start-dash-state:comment-state>comment state/a>./dl> h5 idcomment-state>span classsecno>12.2.5.45/span> dfn idcomment>Comment state/dfn>a href#comment-state classself-link>/a>/h5> p>Consume the a href#next-input-character idcomment-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+003C LESS-THAN SIGN (<)dd>Append the a href#current-input-character idcomment-state:current-input-character>current input character/a> to the comment tokens data. Switch to the a href#comment-less-than-sign-state idcomment-state:comment-less-than-sign-state>comment less-than sign state/a>.dt>U+002D HYPHEN-MINUS (-)dd>Switch to the a href#comment-end-dash-state idcomment-state:comment-end-dash-state>comment end dash state/a>.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idcomment-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idcomment-state:parse-errors>parse error/a>. Append a U+FFFD REPLACEMENT CHARACTER character to the comment tokens data.dt>EOFdd>This is an a href#parse-error-eof-in-comment idcomment-state:parse-error-eof-in-comment>eof-in-comment/a> a href#parse-errors idcomment-state:parse-errors-2>parse error/a>. Emit the comment token. Emit an end-of-file token.dt>Anything elsedd>Append the a href#current-input-character idcomment-state:current-input-character-2>current input character/a> to the comment tokens data./dl> h5 idcomment-less-than-sign-state>span classsecno>12.2.5.46/span> dfn>Comment less-than sign state/dfn>a href#comment-less-than-sign-state classself-link>/a>/h5> p>Consume the a href#next-input-character idcomment-less-than-sign-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0021 EXCLAMATION MARK (!)dd>Append the a href#current-input-character idcomment-less-than-sign-state:current-input-character>current input character/a> to the comment tokens data. Switch to the a href#comment-less-than-sign-bang-state idcomment-less-than-sign-state:comment-less-than-sign-bang-state>comment less-than sign bang state/a>.dt>U+003C LESS-THAN SIGN (<)dd>Append the a href#current-input-character idcomment-less-than-sign-state:current-input-character-2>current input character/a> to the comment tokens data.dt>Anything elsedd>a href#reconsume idcomment-less-than-sign-state:reconsume>Reconsume/a> in the a href#comment-state idcomment-less-than-sign-state:comment-state>comment state/a>./dl> h5 idcomment-less-than-sign-bang-state>span classsecno>12.2.5.47/span> dfn>Comment less-than sign bang state/dfn>a href#comment-less-than-sign-bang-state classself-link>/a>/h5> p>Consume the a href#next-input-character idcomment-less-than-sign-bang-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002D HYPHEN-MINUS (-)dd>Switch to the a href#comment-less-than-sign-bang-dash-state idcomment-less-than-sign-bang-state:comment-less-than-sign-bang-dash-state>comment less-than sign bang dash state/a>.dt>Anything elsedd>a href#reconsume idcomment-less-than-sign-bang-state:reconsume>Reconsume/a> in the a href#comment-state idcomment-less-than-sign-bang-state:comment-state>comment state/a>./dl> h5 idcomment-less-than-sign-bang-dash-state>span classsecno>12.2.5.48/span> dfn>Comment less-than sign bang dash state/dfn>a href#comment-less-than-sign-bang-dash-state classself-link>/a>/h5> p>Consume the a href#next-input-character idcomment-less-than-sign-bang-dash-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002D HYPHEN-MINUS (-)dd>Switch to the a href#comment-less-than-sign-bang-dash-dash-state idcomment-less-than-sign-bang-dash-state:comment-less-than-sign-bang-dash-dash-state>comment less-than sign bang dash dash state/a>.dt>Anything elsedd>a href#reconsume idcomment-less-than-sign-bang-dash-state:reconsume>Reconsume/a> in the a href#comment-end-dash-state idcomment-less-than-sign-bang-dash-state:comment-end-dash-state>comment end dash state/a>./dl> h5 idcomment-less-than-sign-bang-dash-dash-state>span classsecno>12.2.5.49/span> dfn>Comment less-than sign bang dash dash state/dfn>a href#comment-less-than-sign-bang-dash-dash-state classself-link>/a>/h5> p>Consume the a href#next-input-character idcomment-less-than-sign-bang-dash-dash-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+003E GREATER-THAN SIGN (>)dt>EOFdd>a href#reconsume idcomment-less-than-sign-bang-dash-dash-state:reconsume>Reconsume/a> in the a href#comment-end-state idcomment-less-than-sign-bang-dash-dash-state:comment-end-state>comment end state/a>.dt>Anything elsedd>This is a a href#parse-error-nested-comment idcomment-less-than-sign-bang-dash-dash-state:parse-error-nested-comment>nested-comment/a> a href#parse-errors idcomment-less-than-sign-bang-dash-dash-state:parse-errors>parse error/a>. a href#reconsume idcomment-less-than-sign-bang-dash-dash-state:reconsume-2>Reconsume/a> in the a href#comment-end-state idcomment-less-than-sign-bang-dash-dash-state:comment-end-state-2>comment end state/a>./dl> h5 idcomment-end-dash-state>span classsecno>12.2.5.50/span> dfn>Comment end dash state/dfn>a href#comment-end-dash-state classself-link>/a>/h5> p>Consume the a href#next-input-character idcomment-end-dash-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002D HYPHEN-MINUS (-)dd>Switch to the a href#comment-end-state idcomment-end-dash-state:comment-end-state>comment end state/a>dt>EOFdd>This is an a href#parse-error-eof-in-comment idcomment-end-dash-state:parse-error-eof-in-comment>eof-in-comment/a> a href#parse-errors idcomment-end-dash-state:parse-errors>parse error/a>. Emit the comment token. Emit an end-of-file token.dt>Anything elsedd>Append a U+002D HYPHEN-MINUS character (-) to the comment tokens data. a href#reconsume idcomment-end-dash-state:reconsume>Reconsume/a> in the a href#comment-state idcomment-end-dash-state:comment-state>comment state/a>./dl> h5 idcomment-end-state>span classsecno>12.2.5.51/span> dfn>Comment end state/dfn>a href#comment-end-state classself-link>/a>/h5> p>Consume the a href#next-input-character idcomment-end-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+003E GREATER-THAN SIGN (>)dd>Switch to the a href#data-state idcomment-end-state:data-state>data state/a>. Emit the comment token.dt>U+0021 EXCLAMATION MARK (!)dd>Switch to the a href#comment-end-bang-state idcomment-end-state:comment-end-bang-state>comment end bang state/a>.dt>U+002D HYPHEN-MINUS (-)dd>Append a U+002D HYPHEN-MINUS character (-) to the comment tokens data.dt>EOFdd>This is an a href#parse-error-eof-in-comment idcomment-end-state:parse-error-eof-in-comment>eof-in-comment/a> a href#parse-errors idcomment-end-state:parse-errors>parse error/a>. Emit the comment token. Emit an end-of-file token.dt>Anything elsedd>Append two U+002D HYPHEN-MINUS characters (-) to the comment tokens data. a href#reconsume idcomment-end-state:reconsume>Reconsume/a> in the a href#comment-state idcomment-end-state:comment-state>comment state/a>./dl> h5 idcomment-end-bang-state>span classsecno>12.2.5.52/span> dfn>Comment end bang state/dfn>a href#comment-end-bang-state classself-link>/a>/h5> p>Consume the a href#next-input-character idcomment-end-bang-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+002D HYPHEN-MINUS (-)dd>Append two U+002D HYPHEN-MINUS characters (-) and a U+0021 EXCLAMATION MARK character (!) to the comment tokens data. Switch to the a href#comment-end-dash-state idcomment-end-bang-state:comment-end-dash-state>comment end dash state/a>.dt>U+003E GREATER-THAN SIGN (>)dd>This is an a href#parse-error-incorrectly-closed-comment idcomment-end-bang-state:parse-error-incorrectly-closed-comment>incorrectly-closed-comment/a> a href#parse-errors idcomment-end-bang-state:parse-errors>parse error/a>. Switch to the a href#data-state idcomment-end-bang-state:data-state>data state/a>. Emit the comment token.dt>EOFdd>This is an a href#parse-error-eof-in-comment idcomment-end-bang-state:parse-error-eof-in-comment>eof-in-comment/a> a href#parse-errors idcomment-end-bang-state:parse-errors-2>parse error/a>. Emit the comment token. Emit an end-of-file token.dt>Anything elsedd>Append two U+002D HYPHEN-MINUS characters (-) and a U+0021 EXCLAMATION MARK character (!) to the comment tokens data. a href#reconsume idcomment-end-bang-state:reconsume>Reconsume/a> in the a href#comment-state idcomment-end-bang-state:comment-state>comment state/a>./dl> h5 iddoctype-state>span classsecno>12.2.5.53/span> dfn>DOCTYPE state/dfn>a href#doctype-state classself-link>/a>/h5> p>Consume the a href#next-input-character iddoctype-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>Switch to the a href#before-doctype-name-state iddoctype-state:before-doctype-name-state>before DOCTYPE name state/a>.dt>U+003E GREATER-THAN SIGN (>)dd>a href#reconsume iddoctype-state:reconsume>Reconsume/a> in the a href#before-doctype-name-state iddoctype-state:before-doctype-name-state-2>before DOCTYPE name state/a>.dt>EOFdd>This is an a href#parse-error-eof-in-doctype iddoctype-state:parse-error-eof-in-doctype>eof-in-doctype/a> a href#parse-errors iddoctype-state:parse-errors>parse error/a>. Create a new DOCTYPE token. Set its i iddoctype-state:force-quirks-flag>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. Emit the token. Emit an end-of-file token.dt>Anything elsedd>This is a a href#parse-error-missing-whitespace-before-doctype-name iddoctype-state:parse-error-missing-whitespace-before-doctype-name>missing-whitespace-before-doctype-name/a> a href#parse-errors iddoctype-state:parse-errors-2>parse error/a>. a href#reconsume iddoctype-state:reconsume-2>Reconsume/a> in the a href#before-doctype-name-state iddoctype-state:before-doctype-name-state-3>before DOCTYPE name state/a>. /dl> h5 idbefore-doctype-name-state>span classsecno>12.2.5.54/span> dfn>Before DOCTYPE name state/dfn>a href#before-doctype-name-state classself-link>/a>/h5> p>Consume the a href#next-input-character idbefore-doctype-name-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>Ignore the character.dt>a idbefore-doctype-name-state:uppercase-ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha data-x-internaluppercase-ascii-letters>ASCII upper alpha/a>dd>Create a new DOCTYPE token. Set the tokens name to the lowercase version of the a href#current-input-character idbefore-doctype-name-state:current-input-character>current input character/a> (add 0x0020 to the characters code point). Switch to the a href#doctype-name-state idbefore-doctype-name-state:doctype-name-state>DOCTYPE name state/a>.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idbefore-doctype-name-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idbefore-doctype-name-state:parse-errors>parse error/a>. Create a new DOCTYPE token. Set the tokens name to a U+FFFD REPLACEMENT CHARACTER character. Switch to the a href#doctype-name-state idbefore-doctype-name-state:doctype-name-state-2>DOCTYPE name state/a>.dt>U+003E GREATER-THAN SIGN (>)dd>This is a a href#parse-error-missing-doctype-name idbefore-doctype-name-state:parse-error-missing-doctype-name>missing-doctype-name/a> a href#parse-errors idbefore-doctype-name-state:parse-errors-2>parse error/a>. Create a new DOCTYPE token. Set its i idbefore-doctype-name-state:force-quirks-flag>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. Switch to the a href#data-state idbefore-doctype-name-state:data-state>data state/a>. Emit the token.dt>EOFdd>This is an a href#parse-error-eof-in-doctype idbefore-doctype-name-state:parse-error-eof-in-doctype>eof-in-doctype/a> a href#parse-errors idbefore-doctype-name-state:parse-errors-3>parse error/a>. Create a new DOCTYPE token. Set its i idbefore-doctype-name-state:force-quirks-flag-2>a href#force-quirks-flag> force-quirks flag/a>/i> to i>on/i>. Emit the token. Emit an end-of-file token.dt>Anything elsedd>Create a new DOCTYPE token. Set the tokens name to the a href#current-input-character idbefore-doctype-name-state:current-input-character-2>current input character/a>. Switch to the a href#doctype-name-state idbefore-doctype-name-state:doctype-name-state-3>DOCTYPE name state/a>./dl> h5 iddoctype-name-state>span classsecno>12.2.5.55/span> dfn>DOCTYPE name state/dfn>a href#doctype-name-state classself-link>/a>/h5> p>Consume the a href#next-input-character iddoctype-name-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>Switch to the a href#after-doctype-name-state iddoctype-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 iddoctype-name-state:data-state>data state/a>. Emit the current DOCTYPE token.dt>a iddoctype-name-state:uppercase-ascii-letters hrefhttps://infra.spec.whatwg.org/#ascii-upper-alpha data-x-internaluppercase-ascii-letters>ASCII upper alpha/a>dd>Append the lowercase version of the a href#current-input-character iddoctype-name-state:current-input-character>current input character/a> (add 0x0020 to the characters code point) to the current DOCTYPE tokens name.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character iddoctype-name-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors iddoctype-name-state:parse-errors>parse error/a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current DOCTYPE tokens name.dt>EOFdd>This is an a href#parse-error-eof-in-doctype iddoctype-name-state:parse-error-eof-in-doctype>eof-in-doctype/a> a href#parse-errors iddoctype-name-state:parse-errors-2>parse error/a>. Set the DOCTYPE tokens i iddoctype-name-state:force-quirks-flag>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. Emit that DOCTYPE token. Emit an end-of-file token.dt>Anything elsedd>Append the a href#current-input-character iddoctype-name-state:current-input-character-2>current input character/a> to the current DOCTYPE tokens name./dl> h5 idafter-doctype-name-state>span classsecno>12.2.5.56/span> dfn>After DOCTYPE name state/dfn>a href#after-doctype-name-state classself-link>/a>/h5> p>Consume the a href#next-input-character idafter-doctype-name-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>Ignore the character.dt>U+003E GREATER-THAN SIGN (>)dd>Switch to the a href#data-state idafter-doctype-name-state:data-state>data state/a>. Emit the current DOCTYPE token.dt>EOFdd>This is an a href#parse-error-eof-in-doctype idafter-doctype-name-state:parse-error-eof-in-doctype>eof-in-doctype/a> a href#parse-errors idafter-doctype-name-state:parse-errors>parse error/a>. Set the DOCTYPE tokens i idafter-doctype-name-state:force-quirks-flag>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. Emit that DOCTYPE token. Emit an end-of-file token.dt>Anything elsedd> p>If the six characters starting from the a href#current-input-character idafter-doctype-name-state:current-input-character>current input character/a> are an a idafter-doctype-name-state:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the word PUBLIC, then consume those characters and switch to the a href#after-doctype-public-keyword-state idafter-doctype-name-state:after-doctype-public-keyword-state>after DOCTYPE public keyword state/a>./p> p>Otherwise, if the six characters starting from the a href#current-input-character idafter-doctype-name-state:current-input-character-2>current input character/a> are an a idafter-doctype-name-state:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the word SYSTEM, then consume those characters and switch to the a href#after-doctype-system-keyword-state idafter-doctype-name-state:after-doctype-system-keyword-state>after DOCTYPE system keyword state/a>./p> p>Otherwise, this is an a href#parse-error-invalid-character-sequence-after-doctype-name idafter-doctype-name-state:parse-error-invalid-character-sequence-after-doctype-name>invalid-character-sequence-after-doctype-name/a> a href#parse-errors idafter-doctype-name-state:parse-errors-2>parse error/a>. Set the DOCTYPE tokens i idafter-doctype-name-state:force-quirks-flag-2>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. a href#reconsume idafter-doctype-name-state:reconsume>Reconsume/a> in the a href#bogus-doctype-state idafter-doctype-name-state:bogus-doctype-state>bogus DOCTYPE state/a>./p> /dl> h5 idafter-doctype-public-keyword-state>span classsecno>12.2.5.57/span> dfn>After DOCTYPE public keyword state/dfn>a href#after-doctype-public-keyword-state classself-link>/a>/h5> p>Consume the a href#next-input-character idafter-doctype-public-keyword-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>Switch to the a href#before-doctype-public-identifier-state idafter-doctype-public-keyword-state:before-doctype-public-identifier-state>before DOCTYPE public identifier state/a>.dt>U+0022 QUOTATION MARK ()dd>This is a a href#parse-error-missing-whitespace-after-doctype-public-keyword idafter-doctype-public-keyword-state:parse-error-missing-whitespace-after-doctype-public-keyword>missing-whitespace-after-doctype-public-keyword/a> a href#parse-errors idafter-doctype-public-keyword-state:parse-errors>parse error/a>. Set the DOCTYPE tokens public identifier to the empty string (not missing), then switch to the a href#doctype-public-identifier-(double-quoted)-state idafter-doctype-public-keyword-state:doctype-public-identifier-(double-quoted)-state>DOCTYPE public identifier (double-quoted) state/a>.dt>U+0027 APOSTROPHE ()dd>This is a a href#parse-error-missing-whitespace-after-doctype-public-keyword idafter-doctype-public-keyword-state:parse-error-missing-whitespace-after-doctype-public-keyword-2>missing-whitespace-after-doctype-public-keyword/a> a href#parse-errors idafter-doctype-public-keyword-state:parse-errors-2>parse error/a>. Set the DOCTYPE tokens public identifier to the empty string (not missing), then switch to the a href#doctype-public-identifier-(single-quoted)-state idafter-doctype-public-keyword-state:doctype-public-identifier-(single-quoted)-state>DOCTYPE public identifier (single-quoted) state/a>.dt>U+003E GREATER-THAN SIGN (>)dd>This is a a href#parse-error-missing-doctype-public-identifier idafter-doctype-public-keyword-state:parse-error-missing-doctype-public-identifier>missing-doctype-public-identifier/a> a href#parse-errors idafter-doctype-public-keyword-state:parse-errors-3>parse error/a>. Set the DOCTYPE tokens i idafter-doctype-public-keyword-state:force-quirks-flag>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. Switch to the a href#data-state idafter-doctype-public-keyword-state:data-state>data state/a>. Emit that DOCTYPE token.dt>EOFdd>This is an a href#parse-error-eof-in-doctype idafter-doctype-public-keyword-state:parse-error-eof-in-doctype>eof-in-doctype/a> a href#parse-errors idafter-doctype-public-keyword-state:parse-errors-4>parse error/a>. Set the DOCTYPE tokens i idafter-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. Emit an end-of-file token.dt>Anything elsedd>This is a a href#parse-error-missing-quote-before-doctype-public-identifier idafter-doctype-public-keyword-state:parse-error-missing-quote-before-doctype-public-identifier>missing-quote-before-doctype-public-identifier/a> a href#parse-errors idafter-doctype-public-keyword-state:parse-errors-5>parse error/a>. Set the DOCTYPE tokens i idafter-doctype-public-keyword-state:force-quirks-flag-3>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. a href#reconsume idafter-doctype-public-keyword-state:reconsume>Reconsume/a> in the a href#bogus-doctype-state idafter-doctype-public-keyword-state:bogus-doctype-state>bogus DOCTYPE state/a>./dl> h5 idbefore-doctype-public-identifier-state>span classsecno>12.2.5.58/span> dfn>Before DOCTYPE public identifier state/dfn>a href#before-doctype-public-identifier-state classself-link>/a>/h5> p>Consume the a href#next-input-character idbefore-doctype-public-identifier-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>Ignore the character.dt>U+0022 QUOTATION MARK ()dd>Set the DOCTYPE tokens public identifier to the empty string (not missing), then switch to the a href#doctype-public-identifier-(double-quoted)-state idbefore-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 tokens public identifier to the empty string (not missing), then switch to the a href#doctype-public-identifier-(single-quoted)-state idbefore-doctype-public-identifier-state:doctype-public-identifier-(single-quoted)-state>DOCTYPE public identifier (single-quoted) state/a>.dt>U+003E GREATER-THAN SIGN (>)dd>This is a a href#parse-error-missing-doctype-public-identifier idbefore-doctype-public-identifier-state:parse-error-missing-doctype-public-identifier>missing-doctype-public-identifier/a> a href#parse-errors idbefore-doctype-public-identifier-state:parse-errors>parse error/a>. Set the DOCTYPE tokens i idbefore-doctype-public-identifier-state:force-quirks-flag>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. Switch to the a href#data-state idbefore-doctype-public-identifier-state:data-state>data state/a>. Emit that DOCTYPE token.dt>EOFdd>This is an a href#parse-error-eof-in-doctype idbefore-doctype-public-identifier-state:parse-error-eof-in-doctype>eof-in-doctype/a> a href#parse-errors idbefore-doctype-public-identifier-state:parse-errors-2>parse error/a>. Set the DOCTYPE tokens i idbefore-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. Emit an end-of-file token.dt>Anything elsedd>This is a a href#parse-error-missing-quote-before-doctype-public-identifier idbefore-doctype-public-identifier-state:parse-error-missing-quote-before-doctype-public-identifier>missing-quote-before-doctype-public-identifier/a> a href#parse-errors idbefore-doctype-public-identifier-state:parse-errors-3>parse error/a>. Set the DOCTYPE tokens i idbefore-doctype-public-identifier-state:force-quirks-flag-3>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. a href#reconsume idbefore-doctype-public-identifier-state:reconsume>Reconsume/a> in the a href#bogus-doctype-state idbefore-doctype-public-identifier-state:bogus-doctype-state>bogus DOCTYPE state/a>./dl> h5 iddoctype-public-identifier-(double-quoted)-state>span classsecno>12.2.5.59/span> dfn>DOCTYPE public identifier (double-quoted) state/dfn>a href#doctype-public-identifier-(double-quoted)-state classself-link>/a>/h5> p>Consume the a href#next-input-character iddoctype-public-identifier-(double-quoted)-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0022 QUOTATION MARK ()dd>Switch to the a href#after-doctype-public-identifier-state iddoctype-public-identifier-(double-quoted)-state:after-doctype-public-identifier-state>after DOCTYPE public identifier state/a>.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character iddoctype-public-identifier-(double-quoted)-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors iddoctype-public-identifier-(double-quoted)-state:parse-errors>parse error/a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current DOCTYPE tokens public identifier.dt>U+003E GREATER-THAN SIGN (>)dd>This is an a href#parse-error-abrupt-doctype-public-identifier iddoctype-public-identifier-(double-quoted)-state:parse-error-abrupt-doctype-public-identifier>abrupt-doctype-public-identifier/a> a href#parse-errors iddoctype-public-identifier-(double-quoted)-state:parse-errors-2>parse error/a>. Set the DOCTYPE tokens i iddoctype-public-identifier-(double-quoted)-state:force-quirks-flag>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. Switch to the a href#data-state iddoctype-public-identifier-(double-quoted)-state:data-state>data state/a>. Emit that DOCTYPE token.dt>EOFdd>This is an a href#parse-error-eof-in-doctype iddoctype-public-identifier-(double-quoted)-state:parse-error-eof-in-doctype>eof-in-doctype/a> a href#parse-errors iddoctype-public-identifier-(double-quoted)-state:parse-errors-3>parse error/a>. Set the DOCTYPE tokens i iddoctype-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. Emit an end-of-file token.dt>Anything elsedd>Append the a href#current-input-character iddoctype-public-identifier-(double-quoted)-state:current-input-character>current input character/a> to the current DOCTYPE tokens public identifier./dl> h5 iddoctype-public-identifier-(single-quoted)-state>span classsecno>12.2.5.60/span> dfn>DOCTYPE public identifier (single-quoted) state/dfn>a href#doctype-public-identifier-(single-quoted)-state classself-link>/a>/h5> p>Consume the a href#next-input-character iddoctype-public-identifier-(single-quoted)-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0027 APOSTROPHE ()dd>Switch to the a href#after-doctype-public-identifier-state iddoctype-public-identifier-(single-quoted)-state:after-doctype-public-identifier-state>after DOCTYPE public identifier state/a>.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character iddoctype-public-identifier-(single-quoted)-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors iddoctype-public-identifier-(single-quoted)-state:parse-errors>parse error/a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current DOCTYPE tokens public identifier.dt>U+003E GREATER-THAN SIGN (>)dd>This is an a href#parse-error-abrupt-doctype-public-identifier iddoctype-public-identifier-(single-quoted)-state:parse-error-abrupt-doctype-public-identifier>abrupt-doctype-public-identifier/a> a href#parse-errors iddoctype-public-identifier-(single-quoted)-state:parse-errors-2>parse error/a>. Set the DOCTYPE tokens i iddoctype-public-identifier-(single-quoted)-state:force-quirks-flag>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. Switch to the a href#data-state iddoctype-public-identifier-(single-quoted)-state:data-state>data state/a>. Emit that DOCTYPE token.dt>EOFdd>This is an a href#parse-error-eof-in-doctype iddoctype-public-identifier-(single-quoted)-state:parse-error-eof-in-doctype>eof-in-doctype/a> a href#parse-errors iddoctype-public-identifier-(single-quoted)-state:parse-errors-3>parse error/a>. Set the DOCTYPE tokens i iddoctype-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. Emit an end-of-file token.dt>Anything elsedd>Append the a href#current-input-character iddoctype-public-identifier-(single-quoted)-state:current-input-character>current input character/a> to the current DOCTYPE tokens public identifier./dl> h5 idafter-doctype-public-identifier-state>span classsecno>12.2.5.61/span> dfn>After DOCTYPE public identifier state/dfn>a href#after-doctype-public-identifier-state classself-link>/a>/h5> p>Consume the a href#next-input-character idafter-doctype-public-identifier-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>Switch to the a href#between-doctype-public-and-system-identifiers-state idafter-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 idafter-doctype-public-identifier-state:data-state>data state/a>. Emit the current DOCTYPE token.dt>U+0022 QUOTATION MARK ()dd>This is a a href#parse-error-missing-whitespace-between-doctype-public-and-system-identifiers idafter-doctype-public-identifier-state:parse-error-missing-whitespace-between-doctype-public-and-system-identifiers>missing-whitespace-between-doctype-public-and-system-identifiers/a> a href#parse-errors idafter-doctype-public-identifier-state:parse-errors>parse error/a>. Set the DOCTYPE tokens system identifier to the empty string (not missing), then switch to the a href#doctype-system-identifier-(double-quoted)-state idafter-doctype-public-identifier-state:doctype-system-identifier-(double-quoted)-state>DOCTYPE system identifier (double-quoted) state/a>.dt>U+0027 APOSTROPHE ()dd>This is a a href#parse-error-missing-whitespace-between-doctype-public-and-system-identifiers idafter-doctype-public-identifier-state:parse-error-missing-whitespace-between-doctype-public-and-system-identifiers-2>missing-whitespace-between-doctype-public-and-system-identifiers/a> a href#parse-errors idafter-doctype-public-identifier-state:parse-errors-2>parse error/a>. Set the DOCTYPE tokens system identifier to the empty string (not missing), then switch to the a href#doctype-system-identifier-(single-quoted)-state idafter-doctype-public-identifier-state:doctype-system-identifier-(single-quoted)-state>DOCTYPE system identifier (single-quoted) state/a>.dt>EOFdd>This is an a href#parse-error-eof-in-doctype idafter-doctype-public-identifier-state:parse-error-eof-in-doctype>eof-in-doctype/a> a href#parse-errors idafter-doctype-public-identifier-state:parse-errors-3>parse error/a>. Set the DOCTYPE tokens i idafter-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. Emit an end-of-file token.dt>Anything elsedd>This is a a href#parse-error-missing-quote-before-doctype-system-identifier idafter-doctype-public-identifier-state:parse-error-missing-quote-before-doctype-system-identifier>missing-quote-before-doctype-system-identifier/a> a href#parse-errors idafter-doctype-public-identifier-state:parse-errors-4>parse error/a>. Set the DOCTYPE tokens i idafter-doctype-public-identifier-state:force-quirks-flag-2>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. a href#reconsume idafter-doctype-public-identifier-state:reconsume>Reconsume/a> in the a href#bogus-doctype-state idafter-doctype-public-identifier-state:bogus-doctype-state>bogus DOCTYPE state/a>./dl> h5 idbetween-doctype-public-and-system-identifiers-state>span classsecno>12.2.5.62/span> dfn>Between DOCTYPE public and system identifiers state/dfn>a href#between-doctype-public-and-system-identifiers-state classself-link>/a>/h5> p>Consume the a href#next-input-character idbetween-doctype-public-and-system-identifiers-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>Ignore the character.dt>U+003E GREATER-THAN SIGN (>)dd>Switch to the a href#data-state idbetween-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 tokens system identifier to the empty string (not missing), then switch to the a href#doctype-system-identifier-(double-quoted)-state idbetween-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 tokens system identifier to the empty string (not missing), then switch to the a href#doctype-system-identifier-(single-quoted)-state idbetween-doctype-public-and-system-identifiers-state:doctype-system-identifier-(single-quoted)-state>DOCTYPE system identifier (single-quoted) state/a>.dt>EOFdd>This is an a href#parse-error-eof-in-doctype idbetween-doctype-public-and-system-identifiers-state:parse-error-eof-in-doctype>eof-in-doctype/a> a href#parse-errors idbetween-doctype-public-and-system-identifiers-state:parse-errors>parse error/a>. Set the DOCTYPE tokens i idbetween-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. Emit an end-of-file token.dt>Anything elsedd>This is a a href#parse-error-missing-quote-before-doctype-system-identifier idbetween-doctype-public-and-system-identifiers-state:parse-error-missing-quote-before-doctype-system-identifier>missing-quote-before-doctype-system-identifier/a> a href#parse-errors idbetween-doctype-public-and-system-identifiers-state:parse-errors-2>parse error/a>. Set the DOCTYPE tokens i idbetween-doctype-public-and-system-identifiers-state:force-quirks-flag-2>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. a href#reconsume idbetween-doctype-public-and-system-identifiers-state:reconsume>Reconsume/a> in the a href#bogus-doctype-state idbetween-doctype-public-and-system-identifiers-state:bogus-doctype-state>bogus DOCTYPE state/a>./dl> h5 idafter-doctype-system-keyword-state>span classsecno>12.2.5.63/span> dfn>After DOCTYPE system keyword state/dfn>a href#after-doctype-system-keyword-state classself-link>/a>/h5> p>Consume the a href#next-input-character idafter-doctype-system-keyword-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>Switch to the a href#before-doctype-system-identifier-state idafter-doctype-system-keyword-state:before-doctype-system-identifier-state>before DOCTYPE system identifier state/a>.dt>U+0022 QUOTATION MARK ()dd>This is a a href#parse-error-missing-whitespace-after-doctype-system-keyword idafter-doctype-system-keyword-state:parse-error-missing-whitespace-after-doctype-system-keyword>missing-whitespace-after-doctype-system-keyword/a> a href#parse-errors idafter-doctype-system-keyword-state:parse-errors>parse error/a>. Set the DOCTYPE tokens system identifier to the empty string (not missing), then switch to the a href#doctype-system-identifier-(double-quoted)-state idafter-doctype-system-keyword-state:doctype-system-identifier-(double-quoted)-state>DOCTYPE system identifier (double-quoted) state/a>.dt>U+0027 APOSTROPHE ()dd>This is a a href#parse-error-missing-whitespace-after-doctype-system-keyword idafter-doctype-system-keyword-state:parse-error-missing-whitespace-after-doctype-system-keyword-2>missing-whitespace-after-doctype-system-keyword/a> a href#parse-errors idafter-doctype-system-keyword-state:parse-errors-2>parse error/a>. Set the DOCTYPE tokens system identifier to the empty string (not missing), then switch to the a href#doctype-system-identifier-(single-quoted)-state idafter-doctype-system-keyword-state:doctype-system-identifier-(single-quoted)-state>DOCTYPE system identifier (single-quoted) state/a>.dt>U+003E GREATER-THAN SIGN (>)dd>This is a a href#parse-error-missing-doctype-system-identifier idafter-doctype-system-keyword-state:parse-error-missing-doctype-system-identifier>missing-doctype-system-identifier/a> a href#parse-errors idafter-doctype-system-keyword-state:parse-errors-3>parse error/a>. Set the DOCTYPE tokens i idafter-doctype-system-keyword-state:force-quirks-flag>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. Switch to the a href#data-state idafter-doctype-system-keyword-state:data-state>data state/a>. Emit that DOCTYPE token.dt>EOFdd>This is an a href#parse-error-eof-in-doctype idafter-doctype-system-keyword-state:parse-error-eof-in-doctype>eof-in-doctype/a> a href#parse-errors idafter-doctype-system-keyword-state:parse-errors-4>parse error/a>. Set the DOCTYPE tokens i idafter-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. Emit an end-of-file token.dt>Anything elsedd>This is a a href#parse-error-missing-quote-before-doctype-system-identifier idafter-doctype-system-keyword-state:parse-error-missing-quote-before-doctype-system-identifier>missing-quote-before-doctype-system-identifier/a> a href#parse-errors idafter-doctype-system-keyword-state:parse-errors-5>parse error/a>. Set the DOCTYPE tokens i idafter-doctype-system-keyword-state:force-quirks-flag-3>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. a href#reconsume idafter-doctype-system-keyword-state:reconsume>Reconsume/a> in the a href#bogus-doctype-state idafter-doctype-system-keyword-state:bogus-doctype-state>bogus DOCTYPE state/a>./dl> h5 idbefore-doctype-system-identifier-state>span classsecno>12.2.5.64/span> dfn>Before DOCTYPE system identifier state/dfn>a href#before-doctype-system-identifier-state classself-link>/a>/h5> p>Consume the a href#next-input-character idbefore-doctype-system-identifier-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>Ignore the character.dt>U+0022 QUOTATION MARK ()dd>Set the DOCTYPE tokens system identifier to the empty string (not missing), then switch to the a href#doctype-system-identifier-(double-quoted)-state idbefore-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 tokens system identifier to the empty string (not missing), then switch to the a href#doctype-system-identifier-(single-quoted)-state idbefore-doctype-system-identifier-state:doctype-system-identifier-(single-quoted)-state>DOCTYPE system identifier (single-quoted) state/a>.dt>U+003E GREATER-THAN SIGN (>)dd>This is a a href#parse-error-missing-doctype-system-identifier idbefore-doctype-system-identifier-state:parse-error-missing-doctype-system-identifier>missing-doctype-system-identifier/a> a href#parse-errors idbefore-doctype-system-identifier-state:parse-errors>parse error/a>. Set the DOCTYPE tokens i idbefore-doctype-system-identifier-state:force-quirks-flag>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. Switch to the a href#data-state idbefore-doctype-system-identifier-state:data-state>data state/a>. Emit that DOCTYPE token.dt>EOFdd>This is an a href#parse-error-eof-in-doctype idbefore-doctype-system-identifier-state:parse-error-eof-in-doctype>eof-in-doctype/a> a href#parse-errors idbefore-doctype-system-identifier-state:parse-errors-2>parse error/a>. Set the DOCTYPE tokens i idbefore-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. Emit an end-of-file token.dt>Anything elsedd>This is a a href#parse-error-missing-quote-before-doctype-system-identifier idbefore-doctype-system-identifier-state:parse-error-missing-quote-before-doctype-system-identifier>missing-quote-before-doctype-system-identifier/a> a href#parse-errors idbefore-doctype-system-identifier-state:parse-errors-3>parse error/a>. Set the DOCTYPE tokens i idbefore-doctype-system-identifier-state:force-quirks-flag-3>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. a href#reconsume idbefore-doctype-system-identifier-state:reconsume>Reconsume/a> in the a href#bogus-doctype-state idbefore-doctype-system-identifier-state:bogus-doctype-state>bogus DOCTYPE state/a>./dl> h5 iddoctype-system-identifier-(double-quoted)-state>span classsecno>12.2.5.65/span> dfn>DOCTYPE system identifier (double-quoted) state/dfn>a href#doctype-system-identifier-(double-quoted)-state classself-link>/a>/h5> p>Consume the a href#next-input-character iddoctype-system-identifier-(double-quoted)-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0022 QUOTATION MARK ()dd>Switch to the a href#after-doctype-system-identifier-state iddoctype-system-identifier-(double-quoted)-state:after-doctype-system-identifier-state>after DOCTYPE system identifier state/a>.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character iddoctype-system-identifier-(double-quoted)-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors iddoctype-system-identifier-(double-quoted)-state:parse-errors>parse error/a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current DOCTYPE tokens system identifier.dt>U+003E GREATER-THAN SIGN (>)dd>This is an a href#parse-error-abrupt-doctype-system-identifier iddoctype-system-identifier-(double-quoted)-state:parse-error-abrupt-doctype-system-identifier>abrupt-doctype-system-identifier/a> a href#parse-errors iddoctype-system-identifier-(double-quoted)-state:parse-errors-2>parse error/a>. Set the DOCTYPE tokens i iddoctype-system-identifier-(double-quoted)-state:force-quirks-flag>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. Switch to the a href#data-state iddoctype-system-identifier-(double-quoted)-state:data-state>data state/a>. Emit that DOCTYPE token.dt>EOFdd>This is an a href#parse-error-eof-in-doctype iddoctype-system-identifier-(double-quoted)-state:parse-error-eof-in-doctype>eof-in-doctype/a> a href#parse-errors iddoctype-system-identifier-(double-quoted)-state:parse-errors-3>parse error/a>. Set the DOCTYPE tokens i iddoctype-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. Emit an end-of-file token.dt>Anything elsedd>Append the a href#current-input-character iddoctype-system-identifier-(double-quoted)-state:current-input-character>current input character/a> to the current DOCTYPE tokens system identifier./dl> h5 iddoctype-system-identifier-(single-quoted)-state>span classsecno>12.2.5.66/span> dfn>DOCTYPE system identifier (single-quoted) state/dfn>a href#doctype-system-identifier-(single-quoted)-state classself-link>/a>/h5> p>Consume the a href#next-input-character iddoctype-system-identifier-(single-quoted)-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0027 APOSTROPHE ()dd>Switch to the a href#after-doctype-system-identifier-state iddoctype-system-identifier-(single-quoted)-state:after-doctype-system-identifier-state>after DOCTYPE system identifier state/a>.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character iddoctype-system-identifier-(single-quoted)-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors iddoctype-system-identifier-(single-quoted)-state:parse-errors>parse error/a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current DOCTYPE tokens system identifier.dt>U+003E GREATER-THAN SIGN (>)dd>This is an a href#parse-error-abrupt-doctype-system-identifier iddoctype-system-identifier-(single-quoted)-state:parse-error-abrupt-doctype-system-identifier>abrupt-doctype-system-identifier/a> a href#parse-errors iddoctype-system-identifier-(single-quoted)-state:parse-errors-2>parse error/a>. Set the DOCTYPE tokens i iddoctype-system-identifier-(single-quoted)-state:force-quirks-flag>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>. Switch to the a href#data-state iddoctype-system-identifier-(single-quoted)-state:data-state>data state/a>. Emit that DOCTYPE token.dt>EOFdd>This is an a href#parse-error-eof-in-doctype iddoctype-system-identifier-(single-quoted)-state:parse-error-eof-in-doctype>eof-in-doctype/a> a href#parse-errors iddoctype-system-identifier-(single-quoted)-state:parse-errors-3>parse error/a>. Set the DOCTYPE tokens i iddoctype-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. Emit an end-of-file token.dt>Anything elsedd>Append the a href#current-input-character iddoctype-system-identifier-(single-quoted)-state:current-input-character>current input character/a> to the current DOCTYPE tokens system identifier./dl> h5 idafter-doctype-system-identifier-state>span classsecno>12.2.5.67/span> dfn>After DOCTYPE system identifier state/dfn>a href#after-doctype-system-identifier-state classself-link>/a>/h5> p>Consume the a href#next-input-character idafter-doctype-system-identifier-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0009 CHARACTER TABULATION (tab)dt>U+000A LINE FEED (LF)dt>U+000C FORM FEED (FF)dt>U+0020 SPACEdd>Ignore the character.dt>U+003E GREATER-THAN SIGN (>)dd>Switch to the a href#data-state idafter-doctype-system-identifier-state:data-state>data state/a>. Emit the current DOCTYPE token.dt>EOFdd>This is an a href#parse-error-eof-in-doctype idafter-doctype-system-identifier-state:parse-error-eof-in-doctype>eof-in-doctype/a> a href#parse-errors idafter-doctype-system-identifier-state:parse-errors>parse error/a>. Set the DOCTYPE tokens i idafter-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. Emit an end-of-file token.dt>Anything elsedd>This is an a href#parse-error-unexpected-character-after-doctype-system-identifier idafter-doctype-system-identifier-state:parse-error-unexpected-character-after-doctype-system-identifier>unexpected-character-after-doctype-system-identifier/a> a href#parse-errors idafter-doctype-system-identifier-state:parse-errors-2>parse error/a>. a href#reconsume idafter-doctype-system-identifier-state:reconsume>Reconsume/a> in the a href#bogus-doctype-state idafter-doctype-system-identifier-state:bogus-doctype-state>bogus DOCTYPE state/a>. (This does em>not/em> set the DOCTYPE tokens i idafter-doctype-system-identifier-state:force-quirks-flag-2>a href#force-quirks-flag>force-quirks flag/a>/i> to i>on/i>.)/dl> h5 idbogus-doctype-state>span classsecno>12.2.5.68/span> dfn>Bogus DOCTYPE state/dfn>a href#bogus-doctype-state classself-link>/a>/h5> p>Consume the a href#next-input-character idbogus-doctype-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+003E GREATER-THAN SIGN (>)dd>Switch to the a href#data-state idbogus-doctype-state:data-state>data state/a>. Emit the DOCTYPE token.dt>U+0000 NULLdd>This is an a href#parse-error-unexpected-null-character idbogus-doctype-state:parse-error-unexpected-null-character>unexpected-null-character/a> a href#parse-errors idbogus-doctype-state:parse-errors>parse error/a>. Ignore the character.dt>EOFdd>Emit the DOCTYPE token. Emit an end-of-file token.dt>Anything elsedd>Ignore the character./dl> h5 idcdata-section-state>span classsecno>12.2.5.69/span> dfn>CDATA section state/dfn>a href#cdata-section-state classself-link>/a>/h5> p>Consume the a href#next-input-character idcdata-section-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+005D RIGHT SQUARE BRACKET ()dd>Switch to the a href#cdata-section-bracket-state idcdata-section-state:cdata-section-bracket-state>CDATA section bracket state/a>.dt>EOFdd>This is an a href#parse-error-eof-in-cdata idcdata-section-state:parse-error-eof-in-cdata>eof-in-cdata/a> a href#parse-errors idcdata-section-state:parse-errors>parse error/a>. Emit an end-of-file token.dt>Anything elsedd>Emit the a href#current-input-character idcdata-section-state:current-input-character>current input character/a> as a character token./dl> p classnote>U+0000 NULL characters are handled in the tree construction stage, as part of the a href#parsing-main-inforeign idcdata-section-state:parsing-main-inforeign>in foreign content/a> insertion mode, which is the only place where CDATA sections can appear./p> h5 idcdata-section-bracket-state>span classsecno>12.2.5.70/span> dfn>CDATA section bracket state/dfn>a href#cdata-section-bracket-state classself-link>/a>/h5> p>Consume the a href#next-input-character idcdata-section-bracket-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+005D RIGHT SQUARE BRACKET ()dd>Switch to the a href#cdata-section-end-state idcdata-section-bracket-state:cdata-section-end-state>CDATA section end state/a>.dt>Anything elsedd>Emit a U+005D RIGHT SQUARE BRACKET character token. a href#reconsume idcdata-section-bracket-state:reconsume>Reconsume/a> in the a href#cdata-section-state idcdata-section-bracket-state:cdata-section-state>CDATA section state/a>./dl> h5 idcdata-section-end-state>span classsecno>12.2.5.71/span> dfn>CDATA section end state/dfn>a href#cdata-section-end-state classself-link>/a>/h5> p>Consume the a href#next-input-character idcdata-section-end-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+005D RIGHT SQUARE BRACKET ()dd>Emit a U+005D RIGHT SQUARE BRACKET character token.dt>U+003E GREATER-THAN SIGN characterdd>Switch to the a href#data-state idcdata-section-end-state:data-state>data state/a>.dt>Anything elsedd>Emit two U+005D RIGHT SQUARE BRACKET character tokens. a href#reconsume idcdata-section-end-state:reconsume>Reconsume/a> in the a href#cdata-section-state idcdata-section-end-state:cdata-section-state>CDATA section state/a>./dl> h5 idcharacter-reference-state>span classsecno>12.2.5.72/span> dfn>Character reference state/dfn>a href#character-reference-state classself-link>/a>/h5> p>Set the var idcharacter-reference-state:temporary-buffer>a href#temporary-buffer>temporary buffer/a>/var> to the empty string. Append a U+0026 AMPERSAND (&) character to the var idcharacter-reference-state:temporary-buffer-2>a href#temporary-buffer>temporary buffer/a>/var>. Consume the a href#next-input-character idcharacter-reference-state:next-input-character>next input character/a>:/p> dl classswitch>dt>a hrefhttps://infra.spec.whatwg.org/#ascii-alphanumeric idcharacter-reference-state:alphanumeric-ascii-characters data-x-internalalphanumeric-ascii-characters>ASCII alphanumeric/a>dd>a href#reconsume idcharacter-reference-state:reconsume>Reconsume/a> in the a href#named-character-reference-state idcharacter-reference-state:named-character-reference-state>named character reference state/a>.dt>U+0023 NUMBER SIGN (#)dd>Append the a href#current-input-character idcharacter-reference-state:current-input-character>current input character/a> to the var idcharacter-reference-state:temporary-buffer-3>a href#temporary-buffer>temporary buffer/a>/var>. Switch to the a href#numeric-character-reference-state idcharacter-reference-state:numeric-character-reference-state>numeric character reference state/a>.dt>Anything elsedd>a href#flush-code-points-consumed-as-a-character-reference idcharacter-reference-state:flush-code-points-consumed-as-a-character-reference>Flush code points consumed as a character reference/a>. a href#reconsume idcharacter-reference-state:reconsume-2>Reconsume/a> in the var idcharacter-reference-state:return-state>a href#return-state>return state/a>/var>./dl> h5 idnamed-character-reference-state>span classsecno>12.2.5.73/span> dfn>Named character reference state/dfn>a href#named-character-reference-state classself-link>/a>/h5> p>Consume the maximum number of characters possible, with the consumed characters matching one of the identifiers in the first column of the a href#named-character-references idnamed-character-reference-state:named-character-references>named character references/a> table (in a a href#case-sensitive idnamed-character-reference-state:case-sensitive>case-sensitive/a> manner). Append each character to the var idnamed-character-reference-state:temporary-buffer>a href#temporary-buffer>temporary buffer/a>/var> when its consumed./p> dl classswitch>dt>If there is a matchdd> p>If the character reference was a href#charref-in-attribute idnamed-character-reference-state:charref-in-attribute>consumed as part of an attribute/a>, and the last character matched is not a U+003B SEMICOLON character (;), and the a href#next-input-character idnamed-character-reference-state:next-input-character>next input character/a> is either a U+003D EQUALS SIGN character () or an a idnamed-character-reference-state:alphanumeric-ascii-characters hrefhttps://infra.spec.whatwg.org/#ascii-alphanumeric data-x-internalalphanumeric-ascii-characters>ASCII alphanumeric/a>, then, for historical reasons, a href#flush-code-points-consumed-as-a-character-reference idnamed-character-reference-state:flush-code-points-consumed-as-a-character-reference>flush code points consumed as a character reference/a> and switch to the var idnamed-character-reference-state:return-state>a href#return-state>return state/a>/var>. /p> p>Otherwise:/p> ol>li>p>If the last character matched is not a U+003B SEMICOLON character (;), then this is a a href#parse-error-missing-semicolon-after-character-reference idnamed-character-reference-state:parse-error-missing-semicolon-after-character-reference>missing-semicolon-after-character-reference/a> a href#parse-errors idnamed-character-reference-state:parse-errors>parse error/a>.li>p>Set the var idnamed-character-reference-state:temporary-buffer-2>a href#temporary-buffer>temporary buffer/a>/var> to the empty string. Append one or two characters corresponding to the character reference name (as given by the second column of the a href#named-character-references idnamed-character-reference-state:named-character-references-2>named character references/a> table) to the var idnamed-character-reference-state:temporary-buffer-3>a href#temporary-buffer>temporary buffer/a>/var>.li>a href#flush-code-points-consumed-as-a-character-reference idnamed-character-reference-state:flush-code-points-consumed-as-a-character-reference-2>Flush code points consumed as a character reference/a>. Switch to the var idnamed-character-reference-state:return-state-2>a href#return-state>return state/a>/var>./ol> dt>Otherwisedd>a href#flush-code-points-consumed-as-a-character-reference idnamed-character-reference-state:flush-code-points-consumed-as-a-character-reference-3>Flush code points consumed as a character reference/a>. Switch to the a href#ambiguous-ampersand-state idnamed-character-reference-state:ambiguous-ampersand-state>ambiguous ampersand state/a>./dl> div classexample> p>If the markup contains (not in an attribute) the string code>Im ¬it; I tell you/code>, the character reference is parsed as not, as in, code>Im ¬it; I tell you/code> (and this is a parse error). But if the markup was code>Im ∉ I tell you/code>, the character reference would be parsed as notin;, resulting in code>Im ∉ I tell you/code> (and no parse error)./p> p>However, if the markup contains the string code>Im ¬it; I tell you/code> in an attribute, no character reference is parsed and string remains intact (and there is no parse error)./p> /div> h5 idambiguous-ampersand-state>span classsecno>12.2.5.74/span> dfn>Ambiguous ampersand state/dfn>a href#ambiguous-ampersand-state classself-link>/a>/h5> p>Consume the a href#next-input-character idambiguous-ampersand-state:next-input-character>next input character/a>:/p> dl classswitch>dt>a hrefhttps://infra.spec.whatwg.org/#ascii-alphanumeric idambiguous-ampersand-state:alphanumeric-ascii-characters data-x-internalalphanumeric-ascii-characters>ASCII alphanumeric/a>dd>If the character reference was a href#charref-in-attribute idambiguous-ampersand-state:charref-in-attribute>consumed as part of an attribute/a>, then append the a href#current-input-character idambiguous-ampersand-state:current-input-character>current input character/a> to the current attributes value. Otherwise, emit the a href#current-input-character idambiguous-ampersand-state:current-input-character-2>current input character/a> as a character token.dt>U+003B SEMICOLON (;)dd>This is an a href#parse-error-unknown-named-character-reference idambiguous-ampersand-state:parse-error-unknown-named-character-reference>unknown-named-character-reference/a> a href#parse-errors idambiguous-ampersand-state:parse-errors>parse error/a>. a href#reconsume idambiguous-ampersand-state:reconsume>Reconsume/a> in the var idambiguous-ampersand-state:return-state>a href#return-state>return state/a>/var>. dt>Anything elsedd>a href#reconsume idambiguous-ampersand-state:reconsume-2>Reconsume/a> in the var idambiguous-ampersand-state:return-state-2>a href#return-state>return state/a>/var>./dl> h5 idnumeric-character-reference-state>span classsecno>12.2.5.75/span> dfn>Numeric character reference state/dfn>a href#numeric-character-reference-state classself-link>/a>/h5> p>Set the dfn idcharacter-reference-code>var>character reference code/var>/dfn> to zero (0)./p> p>Consume the a href#next-input-character idnumeric-character-reference-state:next-input-character>next input character/a>:/p> dl classswitch>dt>U+0078 LATIN SMALL LETTER Xdt>U+0058 LATIN CAPITAL LETTER Xdd>Append the a href#current-input-character idnumeric-character-reference-state:current-input-character>current input character/a> to the var idnumeric-character-reference-state:temporary-buffer>a href#temporary-buffer>temporary buffer/a>/var>. Switch to the a href#hexademical-character-reference-start-state idnumeric-character-reference-state:hexademical-character-reference-start-state>hexademical character reference start state/a>.dt>Anything elsedd>a href#reconsume idnumeric-character-reference-state:reconsume>Reconsume/a> in the a href#decimal-character-reference-start-state idnumeric-character-reference-state:decimal-character-reference-start-state>decimal character reference start state/a>./dl> h5 idhexademical-character-reference-start-state>span classsecno>12.2.5.76/span> dfn>Hexademical character reference start state/dfn>a href#hexademical-character-reference-start-state classself-link>/a>/h5> p>Consume the a href#next-input-character idhexademical-character-reference-start-state:next-input-character>next input character/a>:/p> dl classswitch>dt>a hrefhttps://infra.spec.whatwg.org/#ascii-hex-digit idhexademical-character-reference-start-state:ascii-hex-digits data-x-internalascii-hex-digits>ASCII hex digit/a>dd>a href#reconsume idhexademical-character-reference-start-state:reconsume>Reconsume/a> in the a href#hexademical-character-reference-state idhexademical-character-reference-start-state:hexademical-character-reference-state>hexademical character reference state/a>.dt>Anything elsedd>This is an a href#parse-error-absence-of-digits-in-numeric-character-reference idhexademical-character-reference-start-state:parse-error-absence-of-digits-in-numeric-character-reference>absence-of-digits-in-numeric-character-reference/a> a href#parse-errors idhexademical-character-reference-start-state:parse-errors>parse error/a>. a href#flush-code-points-consumed-as-a-character-reference idhexademical-character-reference-start-state:flush-code-points-consumed-as-a-character-reference>Flush code points consumed as a character reference/a>. a href#reconsume idhexademical-character-reference-start-state:reconsume-2>Reconsume/a> in the var idhexademical-character-reference-start-state:return-state>a href#return-state>return state/a>/var>./dl> h5 iddecimal-character-reference-start-state>span classsecno>12.2.5.77/span> dfn>Decimal character reference start state/dfn>a href#decimal-character-reference-start-state classself-link>/a>/h5> p>Consume the a href#next-input-character iddecimal-character-reference-start-state:next-input-character>next input character/a>:/p> dl classswitch>dt>a hrefhttps://infra.spec.whatwg.org/#ascii-digit iddecimal-character-reference-start-state:ascii-digits data-x-internalascii-digits>ASCII digit/a>dd>a href#reconsume iddecimal-character-reference-start-state:reconsume>Reconsume/a> in the a href#decimal-character-reference-state iddecimal-character-reference-start-state:decimal-character-reference-state>decimal character reference state/a>.dt>Anything elsedd>This is an a href#parse-error-absence-of-digits-in-numeric-character-reference iddecimal-character-reference-start-state:parse-error-absence-of-digits-in-numeric-character-reference>absence-of-digits-in-numeric-character-reference/a> a href#parse-errors iddecimal-character-reference-start-state:parse-errors>parse error/a>. a href#flush-code-points-consumed-as-a-character-reference iddecimal-character-reference-start-state:flush-code-points-consumed-as-a-character-reference>Flush code points consumed as a character reference/a>. a href#reconsume iddecimal-character-reference-start-state:reconsume-2>Reconsume/a> in the var iddecimal-character-reference-start-state:return-state>a href#return-state>return state/a>/var>./dl> h5 idhexademical-character-reference-state>span classsecno>12.2.5.78/span> dfn>Hexademical character reference state/dfn>a href#hexademical-character-reference-state classself-link>/a>/h5> p>Consume the a href#next-input-character idhexademical-character-reference-state:next-input-character>next input character/a>:/p> dl classswitch>dt>a hrefhttps://infra.spec.whatwg.org/#ascii-digit idhexademical-character-reference-state:ascii-digits data-x-internalascii-digits>ASCII digit/a>dd>Multiply the var idhexademical-character-reference-state:character-reference-code>a href#character-reference-code>character reference code/a>/var> by 16. Add a numeric version of the a href#current-input-character idhexademical-character-reference-state:current-input-character>current input character/a> (subtract 0x0030 from the characters code point) to the var idhexademical-character-reference-state:character-reference-code-2>a href#character-reference-code>character reference code/a>/var>.dt>a idhexademical-character-reference-state:uppercase-ascii-hex-digits hrefhttps://infra.spec.whatwg.org/#ascii-upper-hex-digit data-x-internaluppercase-ascii-hex-digits>ASCII upper hex digit/a>dd>Multiply the var idhexademical-character-reference-state:character-reference-code-3>a href#character-reference-code>character reference code/a>/var> by 16. Add a numeric version of the a href#current-input-character idhexademical-character-reference-state:current-input-character-2>current input character/a> as a hexademical digit (subtract 0x0037 from the characters code point) to the var idhexademical-character-reference-state:character-reference-code-4>a href#character-reference-code>character reference code/a>/var>.dt>a idhexademical-character-reference-state:lowercase-ascii-hex-digits hrefhttps://infra.spec.whatwg.org/#ascii-lower-hex-digit data-x-internallowercase-ascii-hex-digits>ASCII lower hex digit/a>dd>Multiply the var idhexademical-character-reference-state:character-reference-code-5>a href#character-reference-code>character reference code/a>/var> by 16. Add a numeric version of the a href#current-input-character idhexademical-character-reference-state:current-input-character-3>current input character/a> as a hexademical digit (subtract 0x0057 from the characters code point) to the var idhexademical-character-reference-state:character-reference-code-6>a href#character-reference-code>character reference code/a>/var>.dt>U+003B SEMICOLONdd>Switch to the a href#numeric-character-reference-end-state idhexademical-character-reference-state:numeric-character-reference-end-state>numeric character reference end state/a>.dt>Anything elsedd>This is a a href#parse-error-missing-semicolon-after-character-reference idhexademical-character-reference-state:parse-error-missing-semicolon-after-character-reference>missing-semicolon-after-character-reference/a> a href#parse-errors idhexademical-character-reference-state:parse-errors>parse error/a>. a href#reconsume idhexademical-character-reference-state:reconsume>Reconsume/a> in the a href#numeric-character-reference-end-state idhexademical-character-reference-state:numeric-character-reference-end-state-2>numeric character reference end state/a>./dl> h5 iddecimal-character-reference-state>span classsecno>12.2.5.79/span> dfn>Decimal character reference state/dfn>a href#decimal-character-reference-state classself-link>/a>/h5> p>Consume the a href#next-input-character iddecimal-character-reference-state:next-input-character>next input character/a>:/p> dl classswitch>dt>a hrefhttps://infra.spec.whatwg.org/#ascii-digit iddecimal-character-reference-state:ascii-digits data-x-internalascii-digits>ASCII digit/a>dd>Multiply the var iddecimal-character-reference-state:character-reference-code>a href#character-reference-code>character reference code/a>/var> by 10. Add a numeric version of the a href#current-input-character iddecimal-character-reference-state:current-input-character>current input character/a> (subtract 0x0030 from the characters code point) to the var iddecimal-character-reference-state:character-reference-code-2>a href#character-reference-code>character reference code/a>/var>.dt>U+003B SEMICOLONdd>Switch to the a href#numeric-character-reference-end-state iddecimal-character-reference-state:numeric-character-reference-end-state>numeric character reference end state/a>.dt>Anything elsedd>This is a a href#parse-error-missing-semicolon-after-character-reference iddecimal-character-reference-state:parse-error-missing-semicolon-after-character-reference>missing-semicolon-after-character-reference/a> a href#parse-errors iddecimal-character-reference-state:parse-errors>parse error/a>. a href#reconsume iddecimal-character-reference-state:reconsume>Reconsume/a> in the a href#numeric-character-reference-end-state iddecimal-character-reference-state:numeric-character-reference-end-state-2>numeric character reference end state/a>./dl> h5 idnumeric-character-reference-end-state>span classsecno>12.2.5.80/span> dfn>Numeric character reference end state/dfn>a href#numeric-character-reference-end-state classself-link>/a>/h5> p>Check the var idnumeric-character-reference-end-state:character-reference-code>a href#character-reference-code>character reference code/a>/var>:/p> ul>li>p>If the number is 0x00, then this is a a href#parse-error-null-character-reference idnumeric-character-reference-end-state:parse-error-null-character-reference>null-character-reference/a> a href#parse-errors idnumeric-character-reference-end-state:parse-errors>parse error/a>. Set the var idnumeric-character-reference-end-state:character-reference-code-2>a href#character-reference-code>character reference code/a>/var> to 0xFFFD.li>p>If the number is greater than 0x10FFFF, then this is a a href#parse-error-character-reference-outside-unicode-range idnumeric-character-reference-end-state:parse-error-character-reference-outside-unicode-range>character-reference-outside-unicode-range/a> a href#parse-errors idnumeric-character-reference-end-state:parse-errors-2>parse error/a>. Set the var idnumeric-character-reference-end-state:character-reference-code-3>a href#character-reference-code>character reference code/a>/var> to 0xFFFD.li>p>If the number is a a hrefhttps://infra.spec.whatwg.org/#surrogate idnumeric-character-reference-end-state:surrogate data-x-internalsurrogate>surrogate/a>, then this is a a href#parse-error-surrogate-character-reference idnumeric-character-reference-end-state:parse-error-surrogate-character-reference>surrogate-character-reference/a> a href#parse-errors idnumeric-character-reference-end-state:parse-errors-3>parse error/a>. Set the var idnumeric-character-reference-end-state:character-reference-code-4>a href#character-reference-code>character reference code/a>/var> to 0xFFFD.li>p>If the number is a a hrefhttps://infra.spec.whatwg.org/#noncharacter idnumeric-character-reference-end-state:noncharacter data-x-internalnoncharacter>noncharacter/a>, then this is a a href#parse-error-noncharacter-character-reference idnumeric-character-reference-end-state:parse-error-noncharacter-character-reference>noncharacter-character-reference/a> a href#parse-errors idnumeric-character-reference-end-state:parse-errors-4>parse error/a>.li>p>If the number is 0x0D, or a a hrefhttps://infra.spec.whatwg.org/#control idnumeric-character-reference-end-state:control data-x-internalcontrol>control/a> thats not a idnumeric-character-reference-end-state:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, then this is a a href#parse-error-control-character-reference idnumeric-character-reference-end-state:parse-error-control-character-reference>control-character-reference/a> a href#parse-errors idnumeric-character-reference-end-state:parse-errors-5>parse error/a>. If the number is one of the numbers in the first column of the following table, then find the row with that number in the first column, and set the var idnumeric-character-reference-end-state:character-reference-code-5>a href#character-reference-code>character reference code/a>/var> to the number in the second column of that row./p> table idtable-charref-overrides>thead>tr>th>Number th colspan2>Code point tbody>tr>td>0x80 td>0x20AC td>EURO SIGN (€) tr>td>0x82 td>0x201A td>SINGLE LOW-9 QUOTATION MARK (‚) tr>td>0x83 td>0x0192 td>LATIN SMALL LETTER F WITH HOOK (ƒ) tr>td>0x84 td>0x201E td>DOUBLE LOW-9 QUOTATION MARK („) tr>td>0x85 td>0x2026 td>HORIZONTAL ELLIPSIS (…) tr>td>0x86 td>0x2020 td>DAGGER (†) tr>td>0x87 td>0x2021 td>DOUBLE DAGGER (‡) tr>td>0x88 td>0x02C6 td>MODIFIER LETTER CIRCUMFLEX ACCENT (ˆ) tr>td>0x89 td>0x2030 td>PER MILLE SIGN (‰) tr>td>0x8A td>0x0160 td>LATIN CAPITAL LETTER S WITH CARON (Š) tr>td>0x8B td>0x2039 td>SINGLE LEFT-POINTING ANGLE QUOTATION MARK (‹) tr>td>0x8C td>0x0152 td>LATIN CAPITAL LIGATURE OE (Œ) tr>td>0x8E td>0x017D td>LATIN CAPITAL LETTER Z WITH CARON (Ž) tr>td>0x91 td>0x2018 td>LEFT SINGLE QUOTATION MARK (‘) tr>td>0x92 td>0x2019 td>RIGHT SINGLE QUOTATION MARK (’) tr>td>0x93 td>0x201C td>LEFT DOUBLE QUOTATION MARK (“) tr>td>0x94 td>0x201D td>RIGHT DOUBLE QUOTATION MARK (”) tr>td>0x95 td>0x2022 td>BULLET (•) tr>td>0x96 td>0x2013 td>EN DASH (–) tr>td>0x97 td>0x2014 td>EM DASH (—) tr>td>0x98 td>0x02DC td>SMALL TILDE (˜) tr>td>0x99 td>0x2122 td>TRADE MARK SIGN (™) tr>td>0x9A td>0x0161 td>LATIN SMALL LETTER S WITH CARON (š) tr>td>0x9B td>0x203A td>SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (›) tr>td>0x9C td>0x0153 td>LATIN SMALL LIGATURE OE (œ) tr>td>0x9E td>0x017E td>LATIN SMALL LETTER Z WITH CARON (ž) tr>td>0x9F td>0x0178 td>LATIN CAPITAL LETTER Y WITH DIAERESIS (Ÿ) /table>/ul> p>Set the var idnumeric-character-reference-end-state:temporary-buffer>a href#temporary-buffer>temporary buffer/a>/var> to the empty string. Append a code point equal to the var idnumeric-character-reference-end-state:character-reference-code-6>a href#character-reference-code>character reference code/a>/var> to the var idnumeric-character-reference-end-state:temporary-buffer-2>a href#temporary-buffer>temporary buffer/a>/var>. a href#flush-code-points-consumed-as-a-character-reference idnumeric-character-reference-end-state:flush-code-points-consumed-as-a-character-reference>Flush code points consumed as a character reference/a>. Switch to the var idnumeric-character-reference-end-state:return-state>a href#return-state>return state/a>/var>./p> h4 idtree-construction>span classsecno>12.2.6/span> dfn>Tree construction/dfn>a href#tree-construction classself-link>/a>/h4> p>The input to the tree construction stage is a sequence of tokens from the a href#tokenization idtree-construction:tokenization>tokenization/a> stage. The tree construction stage is associated with a DOM code idtree-construction:document>a href#document>Document/a>/code> object when a parser is created. The output of this stage consists of dynamically modifying or extending that documents DOM tree./p> p>This specification does not define when an interactive user agent has to render the code idtree-construction:document-2>a href#document>Document/a>/code> so that it is available to the user, or when it has to begin accepting user input./p> hr> p>As each token is emitted from the tokenizer, the user agent must follow the appropriate steps from the following list, known as the dfn idtree-construction-dispatcher>tree construction dispatcher/dfn>:/p> dl classswitch>dt>If the a href#stack-of-open-elements idtree-construction:stack-of-open-elements>stack of open elements/a> is emptydt>If the a href#adjusted-current-node idtree-construction:adjusted-current-node>adjusted current node/a> is an element in the a idtree-construction:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>dt>If the a href#adjusted-current-node idtree-construction:adjusted-current-node-2>adjusted current node/a> is a a href#mathml-text-integration-point idtree-construction:mathml-text-integration-point>MathML text integration point/a> and the token is a start tag whose tag name is neither mglyph nor malignmarkdt>If the a href#adjusted-current-node idtree-construction:adjusted-current-node-3>adjusted current node/a> is a a href#mathml-text-integration-point idtree-construction:mathml-text-integration-point-2>MathML text integration point/a> and the token is a character tokendt>If the a href#adjusted-current-node idtree-construction:adjusted-current-node-4>adjusted current node/a> is a a idtree-construction:mathml-annotation-xml hrefhttps://www.w3.org/Math/draft-spec/chapter5.html#mixing.elements.annotation.xml data-x-internalmathml-annotation-xml>MathML code>annotation-xml/code>/a> element and the token is a start tag whose tag name is svgdt>If the a href#adjusted-current-node idtree-construction:adjusted-current-node-5>adjusted current node/a> is an a href#html-integration-point idtree-construction:html-integration-point>HTML integration point/a> and the token is a start tagdt>If the a href#adjusted-current-node idtree-construction:adjusted-current-node-6>adjusted current node/a> is an a href#html-integration-point idtree-construction:html-integration-point-2>HTML integration point/a> and the token is a character tokendt>If the token is an end-of-file tokendd>Process the token according to the rules given in the section corresponding to the current a href#insertion-mode idtree-construction:insertion-mode>insertion mode/a> in HTML content.dt>Otherwisedd>Process the token according to the rules given in the section for parsing tokens a href#parsing-main-inforeign idtree-construction:parsing-main-inforeign>in foreign content/a>./dl> p>The dfn idnext-token>next token/dfn> is the token that is about to be processed by the a href#tree-construction-dispatcher idtree-construction:tree-construction-dispatcher>tree construction dispatcher/a> (even if the token is subsequently just ignored)./p> p>A node is a dfn idmathml-text-integration-point>MathML text integration point/dfn> if it is one of the following elements:/p> ul classbrief>li>A a idtree-construction:mathml-mi hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mi data-x-internalmathml-mi>MathML code>mi/code>/a> elementli>A a idtree-construction:mathml-mo hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mo data-x-internalmathml-mo>MathML code>mo/code>/a> elementli>A a idtree-construction:mathml-mn hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mn data-x-internalmathml-mn>MathML code>mn/code>/a> elementli>A a idtree-construction:mathml-ms hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.ms data-x-internalmathml-ms>MathML code>ms/code>/a> elementli>A a idtree-construction:mathml-mtext hrefhttps://www.w3.org/Math/draft-spec/chapter3.html#presm.mtext data-x-internalmathml-mtext>MathML code>mtext/code>/a> element/ul> p>A node is an dfn idhtml-integration-point>HTML integration point/dfn> if it is one of the following elements:/p> ul classbrief>li>A a idtree-construction:mathml-annotation-xml-2 hrefhttps://www.w3.org/Math/draft-spec/chapter5.html#mixing.elements.annotation.xml data-x-internalmathml-annotation-xml>MathML code>annotation-xml/code>/a> element whose start tag token had an attribute with the name encoding whose value was an a idtree-construction:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>text/html/code>li>A a idtree-construction:mathml-annotation-xml-3 hrefhttps://www.w3.org/Math/draft-spec/chapter5.html#mixing.elements.annotation.xml data-x-internalmathml-annotation-xml>MathML code>annotation-xml/code>/a> element whose start tag token had an attribute with the name encoding whose value was an a idtree-construction:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>application/xhtml+xml/code>li>An a idtree-construction:svg-foreignobject hrefhttps://www.w3.org/TR/SVG11/extend.html#ForeignObjectElement data-x-internalsvg-foreignobject>SVG code>foreignObject/code>/a> elementli>An a idtree-construction:svg-desc hrefhttps://www.w3.org/TR/SVG11/struct.html#DescElement data-x-internalsvg-desc>SVG code>desc/code>/a> elementli>An a idtree-construction:svg-title hrefhttps://www.w3.org/TR/SVG11/struct.html#TitleElement data-x-internalsvg-title>SVG code>title/code>/a> element/ul> p classnote>If the node in question is the var idtree-construction:concept-frag-parse-context>a href#concept-frag-parse-context>context/a>/var> element passed to the a href#html-fragment-parsing-algorithm idtree-construction:html-fragment-parsing-algorithm>HTML fragment parsing algorithm/a>, then the start tag token for that element is the fake token created during by that a href#html-fragment-parsing-algorithm idtree-construction:html-fragment-parsing-algorithm-2>HTML fragment parsing algorithm/a>./p> hr> p classnote>Not all of the tag names mentioned below are conformant tag names in this specification; many are included to handle legacy content. They still form part of the algorithm that implementations are required to implement to claim conformance./p> p classnote>The algorithm described below places no limit on the depth of the DOM tree generated, or on the length of tag names, attribute names, attribute values, code idtree-construction:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes, etc. While implementors are encouraged to avoid arbitrary limits, it is recognized that a href#hardwareLimitations>practical concerns/a> will likely force user agents to impose nesting depth constraints./p> h5 idcreating-and-inserting-nodes>span classsecno>12.2.6.1/span> Creating and inserting nodesa href#creating-and-inserting-nodes classself-link>/a>/h5> p>While the parser is processing a token, it can enable or disable dfn idfoster-parent>foster parenting/dfn>. This affects the following algorithm./p> p>The dfn idappropriate-place-for-inserting-a-node>appropriate place for inserting a node/dfn>, optionally using a particular i>override target/i>, is the position in an element returned by running the following steps:/p> ol>li> p>If there was an i>override target/i> specified, then let var>target/var> be the i>override target/i>./p> p>Otherwise, let var>target/var> be the a href#current-node idcreating-and-inserting-nodes:current-node>current node/a>./p> li> p>Determine the var>adjusted insertion location/var> using the first matching steps from the following list:/p> dl classswitch>dt>If a href#foster-parent idcreating-and-inserting-nodes:foster-parent>foster parenting/a> is enabled and var>target/var> is a code idcreating-and-inserting-nodes:the-table-element>a href#the-table-element>table/a>/code>, code idcreating-and-inserting-nodes:the-tbody-element>a href#the-tbody-element>tbody/a>/code>, code idcreating-and-inserting-nodes:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code>, code idcreating-and-inserting-nodes:the-thead-element>a href#the-thead-element>thead/a>/code>, or code idcreating-and-inserting-nodes:the-tr-element>a href#the-tr-element>tr/a>/code> elementdd> p classnote>Foster parenting happens when content is misnested in tables./p> p>Run these substeps:/p> ol>li>p>Let var>last template/var> be the last code idcreating-and-inserting-nodes:the-template-element>a href#the-template-element>template/a>/code> element in the a href#stack-of-open-elements idcreating-and-inserting-nodes:stack-of-open-elements>stack of open elements/a>, if any./p> li>p>Let var>last table/var> be the last code idcreating-and-inserting-nodes:the-table-element-2>a href#the-table-element>table/a>/code> element in the a href#stack-of-open-elements idcreating-and-inserting-nodes:stack-of-open-elements-2>stack of open elements/a>, if any./p> li>p>If there is a var>last template/var> and either there is no var>last table/var>, or there is one, but var>last template/var> is lower (more recently added) than var>last table/var> in the a href#stack-of-open-elements idcreating-and-inserting-nodes:stack-of-open-elements-3>stack of open elements/a>, then: let var>adjusted insertion location/var> be inside var>last template/var>s a href#template-contents idcreating-and-inserting-nodes:template-contents>template contents/a>, after its last child (if any), and abort these substeps.li>p>If there is no var>last table/var>, then let var>adjusted insertion location/var> be inside the first element in the a href#stack-of-open-elements idcreating-and-inserting-nodes:stack-of-open-elements-4>stack of open elements/a> (the code idcreating-and-inserting-nodes:the-html-element>a href#the-html-element>html/a>/code> element), after its last child (if any), and abort these substeps. (a href#fragment-case idcreating-and-inserting-nodes:fragment-case>fragment case/a>)/p> li>p>If var>last table/var> has a parent node, then let var>adjusted insertion location/var> be inside var>last table/var>s parent node, immediately before var>last table/var>, and abort these substeps.li>p>Let var>previous element/var> be the element immediately above var>last table/var> in the a href#stack-of-open-elements idcreating-and-inserting-nodes:stack-of-open-elements-5>stack of open elements/a>.li>p>Let var>adjusted insertion location/var> be inside var>previous element/var>, after its last child (if any)./ol> p classnote>These steps are involved in part because its possible for elements, the code idcreating-and-inserting-nodes:the-table-element-3>a href#the-table-element>table/a>/code> element in this case in particular, to have been moved by a script around in the DOM, or indeed removed from the DOM entirely, after the element was inserted by the parser./p> dt>Otherwisedd> p>Let var>adjusted insertion location/var> be inside var>target/var>, after its last child (if any)./p> /dl> li> p>If the var>adjusted insertion location/var> is inside a code idcreating-and-inserting-nodes:the-template-element-2>a href#the-template-element>template/a>/code> element, let it instead be inside the code idcreating-and-inserting-nodes:the-template-element-3>a href#the-template-element>template/a>/code> elements a href#template-contents idcreating-and-inserting-nodes:template-contents-2>template contents/a>, after its last child (if any)./p> li> p>Return the var>adjusted insertion location/var>./p> /ol> hr> p>When the steps below require the UA to dfn idcreate-an-element-for-the-token>create an element for a token/dfn> in a particular var>given namespace/var> and with a particular var>intended parent/var>, the UA must run the following steps:/p> ol>li>p>Let var>document/var> be var>intended parent/var>s a idcreating-and-inserting-nodes:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>.li>p>Let var>local name/var> be the tag name of the token.li>p>Let var>is/var> be the value of the code idcreating-and-inserting-nodes:attr-is>a href#attr-is>is/a>/code> attribute in the given token, if such an attribute exists, or null otherwise.li>p>Let var>definition/var> be the result of a href#look-up-a-custom-element-definition idcreating-and-inserting-nodes:look-up-a-custom-element-definition>looking up a custom element definition/a> given var>document/var>, var>given namespace/var>, var>local name/var>, and var>is/var>.li>p>If var>definition/var> is non-null and the parser was not originally created for the a href#html-fragment-parsing-algorithm idcreating-and-inserting-nodes:html-fragment-parsing-algorithm>HTML fragment parsing algorithm/a>, then let var>will execute script/var> be true. Otherwise, let it be false.li> p>If var>will execute script/var> is true, then:/p> ol>li>p>Increment var>document/var>s a href#throw-on-dynamic-markup-insertion-counter idcreating-and-inserting-nodes:throw-on-dynamic-markup-insertion-counter>throw-on-dynamic-markup-insertion counter/a>.li>p>If the a idcreating-and-inserting-nodes:javascript-execution-context-stack hrefhttps://tc39.github.io/ecma262/#execution-context-stack data-x-internaljavascript-execution-context-stack>JavaScript execution context stack/a> is empty, then a href#perform-a-microtask-checkpoint idcreating-and-inserting-nodes:perform-a-microtask-checkpoint>perform a microtask checkpoint/a>.li>p>Push a new a href#element-queue idcreating-and-inserting-nodes:element-queue>element queue/a> onto the a href#custom-element-reactions-stack idcreating-and-inserting-nodes:custom-element-reactions-stack>custom element reactions stack/a>./ol> li> p>Let var>element/var> be the result of a hrefhttps://dom.spec.whatwg.org/#concept-create-element idcreating-and-inserting-nodes:create-an-element data-x-internalcreate-an-element>creating an element/a> given var>document/var>, var>localName/var>, var>given namespace/var>, null, and var>is/var>. If var>will execute script/var> is true, set the var>synchronous custom elements flag/var>; otherwise, leave it unset./p> p classnote>This will cause a href#custom-element-constructor idcreating-and-inserting-nodes:custom-element-constructor>custom element constructors/a> to run, if var>will execute script/var> is true. However, since we incremented the a href#throw-on-dynamic-markup-insertion-counter idcreating-and-inserting-nodes:throw-on-dynamic-markup-insertion-counter-2>throw-on-dynamic-markup-insertion counter/a>, this cannot cause a href#dom-document-write idcreating-and-inserting-nodes:dom-document-write>new characters to be inserted into the tokenizer/a>, or a href#dom-document-open idcreating-and-inserting-nodes:dom-document-open>the document to be blown away/a>./p> li> p>a hrefhttps://dom.spec.whatwg.org/#concept-element-attributes-append idcreating-and-inserting-nodes:concept-element-attributes-append data-x-internalconcept-element-attributes-append>Append/a> each attribute in the given token to var>element/var>./p> p classnote>This can a href#enqueue-a-custom-element-callback-reaction idcreating-and-inserting-nodes:enqueue-a-custom-element-callback-reaction>enqueue a custom element callback reaction/a> for the code>attributeChangedCallback/code>, which might run immediately (in the next step)./p> p classnote>Even though the code idcreating-and-inserting-nodes:attr-is-2>a href#attr-is>is/a>/code> attribute governs the a hrefhttps://dom.spec.whatwg.org/#concept-create-element idcreating-and-inserting-nodes:create-an-element-2 data-x-internalcreate-an-element>creation/a> of a a href#customized-built-in-element idcreating-and-inserting-nodes:customized-built-in-element>customized built-in element/a>, it is not present during the execution of the relevant a href#custom-element-constructor idcreating-and-inserting-nodes:custom-element-constructor-2>custom element constructor/a>; it is appended in this step, along with all other attributes./p> li> p>If var>will execute script/var> is true, then:/p> ol>li>p>Let var>queue/var> be the result of popping the a href#current-element-queue idcreating-and-inserting-nodes:current-element-queue>current element queue/a> from the a href#custom-element-reactions-stack idcreating-and-inserting-nodes:custom-element-reactions-stack-2>custom element reactions stack/a>. (This will be the same a href#element-queue idcreating-and-inserting-nodes:element-queue-2>element queue/a> as was pushed above.)li>p>a href#invoke-custom-element-reactions idcreating-and-inserting-nodes:invoke-custom-element-reactions>Invoke custom element reactions/a> in var>queue/var>.li>p>Decrement var>document/var>s a href#throw-on-dynamic-markup-insertion-counter idcreating-and-inserting-nodes:throw-on-dynamic-markup-insertion-counter-3>throw-on-dynamic-markup-insertion counter/a>./ol> li>p>If var>element/var> has an code>xmlns/code> attribute em>in the a idcreating-and-inserting-nodes:xmlns-namespace hrefhttps://infra.spec.whatwg.org/#xmlns-namespace data-x-internalxmlns-namespace>XMLNS namespace/a>/em> whose value is not exactly the same as the elements namespace, that is a a href#parse-errors idcreating-and-inserting-nodes:parse-errors>parse error/a>. Similarly, if var>element/var> has an code>xmlns:xlink/code> attribute in the a idcreating-and-inserting-nodes:xmlns-namespace-2 hrefhttps://infra.spec.whatwg.org/#xmlns-namespace data-x-internalxmlns-namespace>XMLNS namespace/a> whose value is not the a idcreating-and-inserting-nodes:xlink-namespace hrefhttps://infra.spec.whatwg.org/#xlink-namespace data-x-internalxlink-namespace>XLink Namespace/a>, that is a a href#parse-errors idcreating-and-inserting-nodes:parse-errors-2>parse error/a>.li>p>If var>element/var> is a a href#category-reset idcreating-and-inserting-nodes:category-reset>resettable element/a>, invoke its a href#concept-form-reset-control idcreating-and-inserting-nodes:concept-form-reset-control>reset algorithm/a>. (This initializes the elements a href#concept-fe-value idcreating-and-inserting-nodes:concept-fe-value>value/a> and a href#concept-fe-checked idcreating-and-inserting-nodes:concept-fe-checked>checkedness/a> based on the elements attributes.)li>p>If var>element/var> is a a href#form-associated-element idcreating-and-inserting-nodes:form-associated-element>form-associated element/a>, the a href#form-element-pointer idcreating-and-inserting-nodes:form-element-pointer>code>form/code> element pointer/a> is not null, there is no code idcreating-and-inserting-nodes:the-template-element-4>a href#the-template-element>template/a>/code> element on the a href#stack-of-open-elements idcreating-and-inserting-nodes:stack-of-open-elements-6>stack of open elements/a>, var>element/var> is either not a href#category-listed idcreating-and-inserting-nodes:category-listed>listed/a> or doesnt have a code idcreating-and-inserting-nodes:attr-fae-form>a href#attr-fae-form>form/a>/code> attribute, and the var>intended parent/var> is in the same a idcreating-and-inserting-nodes:tree hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a> as the element pointed to by the a href#form-element-pointer idcreating-and-inserting-nodes:form-element-pointer-2>code>form/code> element pointer/a>, then a href#concept-form-association idcreating-and-inserting-nodes:concept-form-association>associate/a> var>element/var> with the code idcreating-and-inserting-nodes:the-form-element>a href#the-form-element>form/a>/code> element pointed to by the a href#form-element-pointer idcreating-and-inserting-nodes:form-element-pointer-3>code>form/code> element pointer/a> and set var>element/var>s a href#parser-inserted-flag idcreating-and-inserting-nodes:parser-inserted-flag>parser inserted flag/a>.li>p>Return var>element/var>./ol> hr> p>When the steps below require the user agent to dfn idinsert-a-foreign-element>insert a foreign element/dfn> for a token in a given namespace, the user agent must run these steps:/p> ol>li>p>Let the var>adjusted insertion location/var> be the a href#appropriate-place-for-inserting-a-node idcreating-and-inserting-nodes:appropriate-place-for-inserting-a-node>appropriate place for inserting a node/a>.li>p>Let var>element/var> be the result of a href#create-an-element-for-the-token idcreating-and-inserting-nodes:create-an-element-for-the-token>creating an element for the token/a> in the given namespace, with the intended parent being the element in which the var>adjusted insertion location/var> finds itself.li> p>If it is possible to insert var>element/var> at the var>adjusted insertion location/var>, then:/p> ol>li>p>Push a new a href#element-queue idcreating-and-inserting-nodes:element-queue-3>element queue/a> onto the a href#custom-element-reactions-stack idcreating-and-inserting-nodes:custom-element-reactions-stack-3>custom element reactions stack/a>.li>p>Insert var>element/var> at the var>adjusted insertion location/var>.li>p>Pop the a href#element-queue idcreating-and-inserting-nodes:element-queue-4>element queue/a> from the a href#custom-element-reactions-stack idcreating-and-inserting-nodes:custom-element-reactions-stack-4>custom element reactions stack/a>, and a href#invoke-custom-element-reactions idcreating-and-inserting-nodes:invoke-custom-element-reactions-2>invoke custom element reactions/a> in that queue./ol> p classnote>If the var>adjusted insertion location/var> cannot accept more elements, e.g. because its a code idcreating-and-inserting-nodes:document>a href#document>Document/a>/code> that already has an element child, then var>element/var> is dropped on the floor./p> li>p>Push var>element/var> onto the a href#stack-of-open-elements idcreating-and-inserting-nodes:stack-of-open-elements-7>stack of open elements/a> so that it is the new a href#current-node idcreating-and-inserting-nodes:current-node-2>current node/a>.li>p>Return var>element/var>./ol> p>When the steps below require the user agent to dfn idinsert-an-html-element>insert an HTML element/dfn> for a token, the user agent must a href#insert-a-foreign-element idcreating-and-inserting-nodes:insert-a-foreign-element>insert a foreign element/a> for the token, in the a idcreating-and-inserting-nodes:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>./p> hr> p>When the steps below require the user agent to dfn idadjust-mathml-attributes>adjust MathML attributes/dfn> for a token, then, if the token has an attribute named code>definitionurl/code>, change its name to code>definitionURL/code> (note the case difference)./p> p>When the steps below require the user agent to dfn idadjust-svg-attributes>adjust SVG attributes/dfn> for a token, then, for each attribute on the token whose attribute name is one of the ones in the first column of the following table, change the attributes name to the name given in the corresponding cell in the second column. (This fixes the case of SVG attributes that are not all lowercase.)/p> table>thead>tr>th> Attribute name on token th> Attribute name on element tbody>tr>td> code>attributename/code> td> code>attributeName/code> tr>td> code>attributetype/code> td> code>attributeType/code> tr>td> code>basefrequency/code> td> code>baseFrequency/code> tr>td> code>baseprofile/code> td> code>baseProfile/code> tr>td> code>calcmode/code> td> code>calcMode/code> tr>td> code>clippathunits/code> td> code>clipPathUnits/code> tr>td> code>diffuseconstant/code> td> code>diffuseConstant/code> tr>td> code>edgemode/code> td> code>edgeMode/code> tr>td> code>filterunits/code> td> code>filterUnits/code> tr>td> code>glyphref/code> td> code>glyphRef/code> tr>td> code>gradienttransform/code> td> code>gradientTransform/code> tr>td> code>gradientunits/code> td> code>gradientUnits/code> tr>td> code>kernelmatrix/code> td> code>kernelMatrix/code> tr>td> code>kernelunitlength/code> td> code>kernelUnitLength/code> tr>td> code>keypoints/code> td> code>keyPoints/code> tr>td> code>keysplines/code> td> code>keySplines/code> tr>td> code>keytimes/code> td> code>keyTimes/code> tr>td> code>lengthadjust/code> td> code>lengthAdjust/code> tr>td> code>limitingconeangle/code> td> code>limitingConeAngle/code> tr>td> code>markerheight/code> td> code>markerHeight/code> tr>td> code>markerunits/code> td> code>markerUnits/code> tr>td> code>markerwidth/code> td> code>markerWidth/code> tr>td> code>maskcontentunits/code> td> code>maskContentUnits/code> tr>td> code>maskunits/code> td> code>maskUnits/code> tr>td> code>numoctaves/code> td> code>numOctaves/code> tr>td> code>pathlength/code> td> code>pathLength/code> tr>td> code>patterncontentunits/code> td> code>patternContentUnits/code> tr>td> code>patterntransform/code> td> code>patternTransform/code> tr>td> code>patternunits/code> td> code>patternUnits/code> tr>td> code>pointsatx/code> td> code>pointsAtX/code> tr>td> code>pointsaty/code> td> code>pointsAtY/code> tr>td> code>pointsatz/code> td> code>pointsAtZ/code> tr>td> code>preservealpha/code> td> code>preserveAlpha/code> tr>td> code>preserveaspectratio/code> td> code>preserveAspectRatio/code> tr>td> code>primitiveunits/code> td> code>primitiveUnits/code> tr>td> code>refx/code> td> code>refX/code> tr>td> code>refy/code> td> code>refY/code> tr>td> code>repeatcount/code> td> code>repeatCount/code> tr>td> code>repeatdur/code> td> code>repeatDur/code> tr>td> code>requiredextensions/code> td> code>requiredExtensions/code> tr>td> code>requiredfeatures/code> td> code>requiredFeatures/code> tr>td> code>specularconstant/code> td> code>specularConstant/code> tr>td> code>specularexponent/code> td> code>specularExponent/code> tr>td> code>spreadmethod/code> td> code>spreadMethod/code> tr>td> code>startoffset/code> td> code>startOffset/code> tr>td> code>stddeviation/code> td> code>stdDeviation/code> tr>td> code>stitchtiles/code> td> code>stitchTiles/code> tr>td> code>surfacescale/code> td> code>surfaceScale/code> tr>td> code>systemlanguage/code> td> code>systemLanguage/code> tr>td> code>tablevalues/code> td> code>tableValues/code> tr>td> code>targetx/code> td> code>targetX/code> tr>td> code>targety/code> td> code>targetY/code> tr>td> code>textlength/code> td> code>textLength/code> tr>td> code>viewbox/code> td> code>viewBox/code> tr>td> code>viewtarget/code> td> code>viewTarget/code> tr>td> code>xchannelselector/code> td> code>xChannelSelector/code> tr>td> code>ychannelselector/code> td> code>yChannelSelector/code> tr>td> code>zoomandpan/code> td> code>zoomAndPan/code> /table> p>When the steps below require the user agent to dfn idadjust-foreign-attributes>adjust foreign attributes/dfn> for a token, then, if any of the attributes on the token match the strings given in the first column of the following table, let the attribute be a namespaced attribute, with the prefix being the string given in the corresponding cell in the second column, the local name being the string given in the corresponding cell in the third column, and the namespace being the namespace given in the corresponding cell in the fourth column. (This fixes the use of namespaced attributes, in particular a href#attr-xml-lang idcreating-and-inserting-nodes:attr-xml-lang>code>lang/code> attributes in the span>XML namespace/span>/a>.)/p> table>thead>tr>th> Attribute name th> Prefix th> Local name th> Namespace tbody>tr>td> code>xlink:actuate/code> td> code>xlink/code> td> code>actuate/code> td> a idcreating-and-inserting-nodes:xlink-namespace-2 hrefhttps://infra.spec.whatwg.org/#xlink-namespace data-x-internalxlink-namespace>XLink namespace/a> tr>td> code>xlink:arcrole/code> td> code>xlink/code> td> code>arcrole/code> td> a idcreating-and-inserting-nodes:xlink-namespace-3 hrefhttps://infra.spec.whatwg.org/#xlink-namespace data-x-internalxlink-namespace>XLink namespace/a> tr>td> code>xlink:href/code> td> code>xlink/code> td> code>href/code> td> a idcreating-and-inserting-nodes:xlink-namespace-4 hrefhttps://infra.spec.whatwg.org/#xlink-namespace data-x-internalxlink-namespace>XLink namespace/a> tr>td> code>xlink:role/code> td> code>xlink/code> td> code>role/code> td> a idcreating-and-inserting-nodes:xlink-namespace-5 hrefhttps://infra.spec.whatwg.org/#xlink-namespace data-x-internalxlink-namespace>XLink namespace/a> tr>td> code>xlink:show/code> td> code>xlink/code> td> code>show/code> td> a idcreating-and-inserting-nodes:xlink-namespace-6 hrefhttps://infra.spec.whatwg.org/#xlink-namespace data-x-internalxlink-namespace>XLink namespace/a> tr>td> code>xlink:title/code> td> code>xlink/code> td> code>title/code> td> a idcreating-and-inserting-nodes:xlink-namespace-7 hrefhttps://infra.spec.whatwg.org/#xlink-namespace data-x-internalxlink-namespace>XLink namespace/a> tr>td> code>xlink:type/code> td> code>xlink/code> td> code>type/code> td> a idcreating-and-inserting-nodes:xlink-namespace-8 hrefhttps://infra.spec.whatwg.org/#xlink-namespace data-x-internalxlink-namespace>XLink namespace/a> tr>td> code>xml:lang/code> td> code>xml/code> td> code>lang/code> td> a idcreating-and-inserting-nodes:xml-namespace hrefhttps://infra.spec.whatwg.org/#xml-namespace data-x-internalxml-namespace>XML namespace/a> tr>td> code>xml:space/code> td> code>xml/code> td> code>space/code> td> a idcreating-and-inserting-nodes:xml-namespace-2 hrefhttps://infra.spec.whatwg.org/#xml-namespace data-x-internalxml-namespace>XML namespace/a> tr>td> code>xmlns/code> td> (none) td> code>xmlns/code> td> a idcreating-and-inserting-nodes:xmlns-namespace-3 hrefhttps://infra.spec.whatwg.org/#xmlns-namespace data-x-internalxmlns-namespace>XMLNS namespace/a> tr>td> code>xmlns:xlink/code> td> code>xmlns/code> td> code>xlink/code> td> a idcreating-and-inserting-nodes:xmlns-namespace-4 hrefhttps://infra.spec.whatwg.org/#xmlns-namespace data-x-internalxmlns-namespace>XMLNS namespace/a> /table> hr> p>When the steps below require the user agent to dfn idinsert-a-character>insert a character/dfn> while processing a token, the user agent must run the following steps:/p> ol>li>p>Let var>data/var> be the characters passed to the algorithm, or, if no characters were explicitly specified, the character of the character token being processed.li>p>Let the var>adjusted insertion location/var> be the a href#appropriate-place-for-inserting-a-node idcreating-and-inserting-nodes:appropriate-place-for-inserting-a-node-2>appropriate place for inserting a node/a>.li> p>If the var>adjusted insertion location/var> is in a code idcreating-and-inserting-nodes:document-2>a href#document>Document/a>/code> node, then abort these steps. p classnote>The DOM will not let code idcreating-and-inserting-nodes:document-3>a href#document>Document/a>/code> nodes have code idcreating-and-inserting-nodes:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node children, so they are dropped on the floor./p> li> p>If there is a code idcreating-and-inserting-nodes:text-2>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node immediately before the var>adjusted insertion location/var>, then append var>data/var> to that code idcreating-and-inserting-nodes:text-3>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes data./p> p>Otherwise, create a new code idcreating-and-inserting-nodes:text-4>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node whose data is var>data/var> and whose a idcreating-and-inserting-nodes:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is the same as that of the element in which the var>adjusted insertion location/var> finds itself, and insert the newly created node at the var>adjusted insertion location/var>./p> /ol> div classexample> p>Here are some sample inputs to the parser and the corresponding number of code idcreating-and-inserting-nodes:text-5>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes that they result in, assuming a user agent that executes scripts./p> table>thead>tr>th>Input th>Number of code idcreating-and-inserting-nodes:text-6>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes tbody>tr>td>pre>A<script>var script document.getElementsByTagName(script)0;document.body.removeChild(script);</script>B/pre> td>One code idcreating-and-inserting-nodes:text-7>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node in the document, containing AB. tr>td>pre>A<script>var text document.createTextNode(B);document.body.appendChild(text);</script>C/pre> td>Three code idcreating-and-inserting-nodes:text-8>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes; A before the script, the scripts contents, and BC after the script (the parser appends to the code idcreating-and-inserting-nodes:text-9>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node created by the script). tr>td>pre>A<script>var text document.getElementsByTagName(script)0.firstChild;text.data B;document.body.appendChild(text);</script>C/pre> td>Two adjacent code idcreating-and-inserting-nodes:text-10>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes in the document, containing A and BC. tr>td>pre>A<table>B<tr>C</tr>D</table>/pre> td>One code idcreating-and-inserting-nodes:text-11>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node before the table, containing ABCD. (This is caused by a href#foster-parent idcreating-and-inserting-nodes:foster-parent-2>foster parenting/a>.) tr>td>pre>A<table><tr> B</tr> C</table>/pre> td>One code idcreating-and-inserting-nodes:text-12>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-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 idcreating-and-inserting-nodes:foster-parent-3>foster parenting/a>.) tr>td>pre>A<table><tr> B</tr> </em>C</table>/pre> td>One code idcreating-and-inserting-nodes:text-13>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node before the table, containing A BC (A-space-B-C), and one code idcreating-and-inserting-nodes:text-14>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node inside the table (as a child of a code idcreating-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 idcreating-and-inserting-nodes:foster-parent-4>foster parenting/a>, even if those other tokens then get ignored.) /table> /div> hr> p>When the steps below require the user agent to dfn idinsert-a-comment>insert a comment/dfn> while processing a comment token, optionally with an explicitly insertion position var>position/var>, the user agent must run the following steps:/p> ol>li>p>Let var>data/var> be the data given in the comment token being processed.li>p>If var>position/var> was specified, then let the var>adjusted insertion location/var> be var>position/var>. Otherwise, let var>adjusted insertion location/var> be the a href#appropriate-place-for-inserting-a-node idcreating-and-inserting-nodes:appropriate-place-for-inserting-a-node-3>appropriate place for inserting a node/a>.li>p>Create a code idcreating-and-inserting-nodes:comment-2>a data-x-internalcomment-2 hrefhttps://dom.spec.whatwg.org/#interface-comment>Comment/a>/code> node whose code>data/code> attribute is set to var>data/var> and whose a idcreating-and-inserting-nodes:node-document-3 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is the same as that of the node in which the var>adjusted insertion location/var> finds itself./p> li>p>Insert the newly created node at the var>adjusted insertion location/var>./ol> hr> p idmutation-during-parsing>DOM mutation events must not fire for changes caused by the UA parsing the document. This includes the parsing of any content inserted using code idcreating-and-inserting-nodes:dom-document-write-2>a href#dom-document-write>document.write()/a>/code> and code idcreating-and-inserting-nodes:dom-document-writeln>a href#dom-document-writeln>document.writeln()/a>/code> calls. a href#refsUIEVENTS>UIEVENTS/a>/p> p>However, a idcreating-and-inserting-nodes:mutation-observers hrefhttps://dom.spec.whatwg.org/#mutation-observers data-x-internalmutation-observers>mutation observers/a> em>do/em> fire, as required by the WHATWG DOM Standard./p> h5 idparsing-elements-that-contain-only-text>span classsecno>12.2.6.2/span> Parsing elements that contain only texta href#parsing-elements-that-contain-only-text classself-link>/a>/h5> p>The dfn idgeneric-raw-text-element-parsing-algorithm>generic raw text element parsing algorithm/dfn> and the dfn idgeneric-rcdata-element-parsing-algorithm>generic RCDATA element parsing algorithm/dfn> consist of the following steps. These algorithms are always invoked in response to a start tag token./p> ol>li>p>a href#insert-an-html-element idparsing-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 idparsing-elements-that-contain-only-text:generic-raw-text-element-parsing-algorithm>generic raw text element parsing algorithm/a>, switch the tokenizer to the a href#rawtext-state idparsing-elements-that-contain-only-text:rawtext-state>RAWTEXT state/a>; otherwise the algorithm invoked was the a href#generic-rcdata-element-parsing-algorithm idparsing-elements-that-contain-only-text:generic-rcdata-element-parsing-algorithm>generic RCDATA element parsing algorithm/a>, switch the tokenizer to the a href#rcdata-state idparsing-elements-that-contain-only-text:rcdata-state>RCDATA state/a>.li>p>Let the a href#original-insertion-mode idparsing-elements-that-contain-only-text:original-insertion-mode>original insertion mode/a> be the current a href#insertion-mode idparsing-elements-that-contain-only-text:insertion-mode>insertion mode/a>./p> li>p>Then, switch the a href#insertion-mode idparsing-elements-that-contain-only-text:insertion-mode-2>insertion mode/a> to a href#parsing-main-incdata idparsing-elements-that-contain-only-text:parsing-main-incdata>text/a>./ol> h5 idclosing-elements-that-have-implied-end-tags>span classsecno>12.2.6.3/span> Closing elements that have implied end tagsa href#closing-elements-that-have-implied-end-tags classself-link>/a>/h5> p>When the steps below require the UA to dfn idgenerate-implied-end-tags>generate implied end tags/dfn>, then, while the a href#current-node idclosing-elements-that-have-implied-end-tags:current-node>current node/a> is a code idclosing-elements-that-have-implied-end-tags:the-dd-element>a href#the-dd-element>dd/a>/code> element, a code idclosing-elements-that-have-implied-end-tags:the-dt-element>a href#the-dt-element>dt/a>/code> element, an code idclosing-elements-that-have-implied-end-tags:the-li-element>a href#the-li-element>li/a>/code> element, an code idclosing-elements-that-have-implied-end-tags:the-optgroup-element>a href#the-optgroup-element>optgroup/a>/code> element, an code idclosing-elements-that-have-implied-end-tags:the-option-element>a href#the-option-element>option/a>/code> element, a code idclosing-elements-that-have-implied-end-tags:the-p-element>a href#the-p-element>p/a>/code> element, an code idclosing-elements-that-have-implied-end-tags:rb>a href#rb>rb/a>/code> element, an code idclosing-elements-that-have-implied-end-tags:the-rp-element>a href#the-rp-element>rp/a>/code> element, an code idclosing-elements-that-have-implied-end-tags:the-rt-element>a href#the-rt-element>rt/a>/code> element, or an code idclosing-elements-that-have-implied-end-tags:rtc>a href#rtc>rtc/a>/code> element, the UA must pop the a href#current-node idclosing-elements-that-have-implied-end-tags:current-node-2>current node/a> off the a href#stack-of-open-elements idclosing-elements-that-have-implied-end-tags:stack-of-open-elements>stack of open elements/a>./p> p>If a step requires the UA to generate implied end tags but lists an element to exclude from the process, then the UA must perform the above steps as if that element was not in the above list./p> p>When the steps below require the UA to dfn idgenerate-all-implied-end-tags-thoroughly>generate all implied end tags thoroughly/dfn>, then, while the a href#current-node idclosing-elements-that-have-implied-end-tags:current-node-3>current node/a> is a code idclosing-elements-that-have-implied-end-tags:the-caption-element>a href#the-caption-element>caption/a>/code> element, a code idclosing-elements-that-have-implied-end-tags:the-colgroup-element>a href#the-colgroup-element>colgroup/a>/code> element, a code idclosing-elements-that-have-implied-end-tags:the-dd-element-2>a href#the-dd-element>dd/a>/code> element, a code idclosing-elements-that-have-implied-end-tags:the-dt-element-2>a href#the-dt-element>dt/a>/code> element, an code idclosing-elements-that-have-implied-end-tags:the-li-element-2>a href#the-li-element>li/a>/code> element, an code idclosing-elements-that-have-implied-end-tags:the-optgroup-element-2>a href#the-optgroup-element>optgroup/a>/code> element, an code idclosing-elements-that-have-implied-end-tags:the-option-element-2>a href#the-option-element>option/a>/code> element, a code idclosing-elements-that-have-implied-end-tags:the-p-element-2>a href#the-p-element>p/a>/code> element, an code idclosing-elements-that-have-implied-end-tags:rb-2>a href#rb>rb/a>/code> element, an code idclosing-elements-that-have-implied-end-tags:the-rp-element-2>a href#the-rp-element>rp/a>/code> element, an code idclosing-elements-that-have-implied-end-tags:the-rt-element-2>a href#the-rt-element>rt/a>/code> element, an code idclosing-elements-that-have-implied-end-tags:rtc-2>a href#rtc>rtc/a>/code> element, a code idclosing-elements-that-have-implied-end-tags:the-tbody-element>a href#the-tbody-element>tbody/a>/code> element, a code idclosing-elements-that-have-implied-end-tags:the-td-element>a href#the-td-element>td/a>/code> element, a code idclosing-elements-that-have-implied-end-tags:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code> element, a code idclosing-elements-that-have-implied-end-tags:the-th-element>a href#the-th-element>th/a>/code> element, a code idclosing-elements-that-have-implied-end-tags:the-thead-element>a href#the-thead-element>thead/a>/code> element, or a code idclosing-elements-that-have-implied-end-tags:the-tr-element>a href#the-tr-element>tr/a>/code> element, the UA must pop the a href#current-node idclosing-elements-that-have-implied-end-tags:current-node-4>current node/a> off the a href#stack-of-open-elements idclosing-elements-that-have-implied-end-tags:stack-of-open-elements-2>stack of open elements/a>./p> h5 idparsing-main-inhtml>span classsecno>12.2.6.4/span> The rules for parsing tokens in HTML contenta href#parsing-main-inhtml classself-link>/a>/h5> h6 idthe-initial-insertion-mode>span classsecno>12.2.6.4.1/span> The dfn>initial/dfn> insertion modea href#the-initial-insertion-mode classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#the-initial-insertion-mode idthe-initial-insertion-mode:the-initial-insertion-mode>initial/a> a href#insertion-mode idthe-initial-insertion-mode:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACEdd> p>Ignore the token./p> dt>A comment tokendd> p>a href#insert-a-comment idthe-initial-insertion-mode:insert-a-comment>Insert a comment/a> as the last child of the code idthe-initial-insertion-mode:document>a href#document>Document/a>/code> object./p> dt>A DOCTYPE tokendd> p>If the DOCTYPE tokens name is not a a href#case-sensitive idthe-initial-insertion-mode:case-sensitive>case-sensitive/a> match for the string code>html/code>, or the tokens public identifier is not missing, or the tokens system identifier is neither missing nor a a href#case-sensitive idthe-initial-insertion-mode:case-sensitive-2>case-sensitive/a> match for the string code idthe-initial-insertion-mode:about:legacy-compat>a href#about:legacy-compat>about:legacy-compat/a>/code>, then there is a a href#parse-errors idthe-initial-insertion-mode:parse-errors>parse error/a>./p> p>Append a code idthe-initial-insertion-mode:documenttype>a data-x-internaldocumenttype hrefhttps://dom.spec.whatwg.org/#interface-documenttype>DocumentType/a>/code> node to the code idthe-initial-insertion-mode:document-2>a href#document>Document/a>/code> node, with the code>name/code> attribute set to the name given in the DOCTYPE token, or the empty string if the name was missing; the code>publicId/code> attribute set to the public identifier given in the DOCTYPE token, or the empty string if the public identifier was missing; the code>systemId/code> attribute set to the system identifier given in the DOCTYPE token, or the empty string if the system identifier was missing; and the other attributes specific to code idthe-initial-insertion-mode:documenttype-2>a data-x-internaldocumenttype hrefhttps://dom.spec.whatwg.org/#interface-documenttype>DocumentType/a>/code> objects set to null and empty lists as appropriate. Associate the code idthe-initial-insertion-mode:documenttype-3>a data-x-internaldocumenttype hrefhttps://dom.spec.whatwg.org/#interface-documenttype>DocumentType/a>/code> node with the code idthe-initial-insertion-mode:document-3>a href#document>Document/a>/code> object so that it is returned as the value of the code>doctype/code> attribute of the code idthe-initial-insertion-mode:document-4>a href#document>Document/a>/code> object./p> p idquirks-mode-doctypes>Then, if the document is em>not/em> a href#an-iframe-srcdoc-document idthe-initial-insertion-mode:an-iframe-srcdoc-document>an code>iframe/code> code>srcdoc/code> document/a>, and the DOCTYPE token matches one of the conditions in the following list, then set the code idthe-initial-insertion-mode:document-5>a href#document>Document/a>/code> to a idthe-initial-insertion-mode:quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>:/p> ul classbrief>li> The i idthe-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 idthe-initial-insertion-mode:case-sensitive-3>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>-//OReilly and Associates//DTD HTML 2.0///code> li> The public identifier starts with: code>-//OReilly and Associates//DTD HTML Extended 1.0///code> li> The public identifier starts with: code>-//OReilly and Associates//DTD HTML Extended Relaxed 1.0///code> li> The public identifier starts with: code>-//SQ//DTD HTML 2.0 HoTMetaL + extensions///code> li> The public identifier starts with: code>-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0///code> li> The public identifier starts with: code>-//SoftQuad//DTD HoTMetaL PRO 4.0::19971010::extensions to HTML 4.0///code> li> The public identifier starts with: code>-//Spyglass//DTD HTML 2.0 Extended///code> li> The public identifier starts with: code>-//Sun Microsystems Corp.//DTD HotJava HTML///code> li> The public identifier starts with: code>-//Sun Microsystems Corp.//DTD HotJava Strict HTML///code> li> The public identifier starts with: code>-//W3C//DTD HTML 3 1995-03-24///code> li> The public identifier starts with: code>-//W3C//DTD HTML 3.2 Draft///code> li> The public identifier starts with: code>-//W3C//DTD HTML 3.2 Final///code> li> The public identifier starts with: code>-//W3C//DTD HTML 3.2///code> li> The public identifier starts with: code>-//W3C//DTD HTML 3.2S Draft///code> li> The public identifier starts with: code>-//W3C//DTD HTML 4.0 Frameset///code> li> The public identifier starts with: code>-//W3C//DTD HTML 4.0 Transitional///code> li> The public identifier starts with: code>-//W3C//DTD HTML Experimental 19960712///code> li> The public identifier starts with: code>-//W3C//DTD HTML Experimental 970421///code> li> The public identifier starts with: code>-//W3C//DTD W3 HTML///code> li> The public identifier starts with: code>-//W3O//DTD W3 HTML 3.0///code> li> The public identifier starts with: code>-//WebTechs//DTD Mozilla HTML 2.0///code> li> The public identifier starts with: code>-//WebTechs//DTD Mozilla HTML///code> li> The system identifier is missing and the public identifier starts with: code>-//W3C//DTD HTML 4.01 Frameset///code> li> The system identifier is missing and the public identifier starts with: code>-//W3C//DTD HTML 4.01 Transitional///code> /ul> p>Otherwise, if the document is em>not/em> a href#an-iframe-srcdoc-document idthe-initial-insertion-mode:an-iframe-srcdoc-document-2>an code>iframe/code> code>srcdoc/code> document/a>, and the DOCTYPE token matches one of the conditions in the following list, then set the code idthe-initial-insertion-mode:document-6>a href#document>Document/a>/code> to a idthe-initial-insertion-mode:limited-quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-limited-quirks data-x-internallimited-quirks-mode>limited-quirks mode/a>:/p> ul classbrief>li> The public identifier starts with: code>-//W3C//DTD XHTML 1.0 Frameset///code> li> The public identifier starts with: code>-//W3C//DTD XHTML 1.0 Transitional///code> li> The system identifier is not missing and the public identifier starts with: code>-//W3C//DTD HTML 4.01 Frameset///code> li> The system identifier is not missing and the public identifier starts with: code>-//W3C//DTD HTML 4.01 Transitional///code> /ul> p>The system identifier and public identifier strings must be compared to the values given in the lists above in an a idthe-initial-insertion-mode:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> manner. A system identifier whose value is the empty string is not considered missing for the purposes of the conditions above./p> p>Then, switch the a href#insertion-mode idthe-initial-insertion-mode:insertion-mode-2>insertion mode/a> to a href#the-before-html-insertion-mode idthe-initial-insertion-mode:the-before-html-insertion-mode>before html/a>./p> dt>Anything elsedd> p>If the document is em>not/em> a href#an-iframe-srcdoc-document idthe-initial-insertion-mode:an-iframe-srcdoc-document-3>an code>iframe/code> code>srcdoc/code> document/a>, then this is a a href#parse-errors idthe-initial-insertion-mode:parse-errors-2>parse error/a>; set the code idthe-initial-insertion-mode:document-7>a href#document>Document/a>/code> to a idthe-initial-insertion-mode:quirks-mode-2 hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>./p> p>In any case, switch the a href#insertion-mode idthe-initial-insertion-mode:insertion-mode-3>insertion mode/a> to a href#the-before-html-insertion-mode idthe-initial-insertion-mode:the-before-html-insertion-mode-2>before html/a>, then reprocess the token./p> /dl> h6 idthe-before-html-insertion-mode>span classsecno>12.2.6.4.2/span> The dfn>before html/dfn> insertion modea href#the-before-html-insertion-mode classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#the-before-html-insertion-mode idthe-before-html-insertion-mode:the-before-html-insertion-mode>before html/a> a href#insertion-mode idthe-before-html-insertion-mode:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A DOCTYPE tokendd> p>a href#parse-errors idthe-before-html-insertion-mode:parse-errors>Parse error/a>. Ignore the token./p> dt>A comment tokendd> p>a href#insert-a-comment idthe-before-html-insertion-mode:insert-a-comment>Insert a comment/a> as the last child of the code idthe-before-html-insertion-mode:document>a href#document>Document/a>/code> object./p> dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACEdd> p>Ignore the token./p> dt>A start tag whose tag name is htmldd> p>a href#create-an-element-for-the-token idthe-before-html-insertion-mode:create-an-element-for-the-token>Create an element for the token/a> in the a idthe-before-html-insertion-mode:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>, with the code idthe-before-html-insertion-mode:document-2>a href#document>Document/a>/code> as the intended parent. Append it to the code idthe-before-html-insertion-mode:document-3>a href#document>Document/a>/code> object. Put this element in the a href#stack-of-open-elements idthe-before-html-insertion-mode:stack-of-open-elements>stack of open elements/a>./p> p idparser-appcache>If the code idthe-before-html-insertion-mode:document-4>a href#document>Document/a>/code> is being loaded as part of a href#navigate idthe-before-html-insertion-mode:navigate>navigation/a> of a a href#browsing-context idthe-before-html-insertion-mode:browsing-context>browsing context/a>, run these steps:/p> ol>li>p>If the result of running a hrefhttps://w3c.github.io/ServiceWorker/#scope-match-algorithm idthe-before-html-insertion-mode:scope-match-algorithm data-x-internalscope-match-algorithm>match service worker registration/a> for the documents a hrefhttps://dom.spec.whatwg.org/#concept-document-url idthe-before-html-insertion-mode:the-documents-address data-x-internalthe-documents-address>URL/a> is non-null, run the a href#concept-appcache-init idthe-before-html-insertion-mode:concept-appcache-init>application cache selection algorithm/a> passing the code idthe-before-html-insertion-mode:document-5>a href#document>Document/a>/code> object with no manifest.li> p>Otherwise, run these substeps:/p> ol>li>p>If the newly created element has a code idthe-before-html-insertion-mode:attr-html-manifest>a href#attr-html-manifest>manifest/a>/code> attribute whose value is not the empty string, then a href#parse-a-url idthe-before-html-insertion-mode:parse-a-url>parse/a> the value of that attribute, relative to the newly created elements a idthe-before-html-insertion-mode:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, and if that is successful, run the a href#concept-appcache-init idthe-before-html-insertion-mode:concept-appcache-init-2>application cache selection algorithm/a> passing the code idthe-before-html-insertion-mode:document-6>a href#document>Document/a>/code> object with the result of applying the a hrefhttps://url.spec.whatwg.org/#concept-url-serializer idthe-before-html-insertion-mode:concept-url-serializer data-x-internalconcept-url-serializer>URL serializer/a> algorithm to the a href#resulting-url-record idthe-before-html-insertion-mode:resulting-url-record>resulting URL record/a> with the i>exclude fragment flag/i> set.li>p>Otherwise, run the a href#concept-appcache-init idthe-before-html-insertion-mode:concept-appcache-init-3>application cache selection algorithm/a> passing the code idthe-before-html-insertion-mode:document-7>a href#document>Document/a>/code> object with no manifest./ol> /ol> p>Switch the a href#insertion-mode idthe-before-html-insertion-mode:insertion-mode-2>insertion mode/a> to a href#the-before-head-insertion-mode idthe-before-html-insertion-mode:the-before-head-insertion-mode>before head/a>./p> dt>An end tag whose tag name is one of: head, body, html, brdd> p>Act as described in the anything else entry below./p> dt>Any other end tagdd> p>a href#parse-errors idthe-before-html-insertion-mode:parse-errors-2>Parse error/a>. Ignore the token./p> dt>Anything elsedd> p>Create an code idthe-before-html-insertion-mode:the-html-element>a href#the-html-element>html/a>/code> element whose a idthe-before-html-insertion-mode:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> is the code idthe-before-html-insertion-mode:document-8>a href#document>Document/a>/code> object. Append it to the code idthe-before-html-insertion-mode:document-9>a href#document>Document/a>/code> object. Put this element in the a href#stack-of-open-elements idthe-before-html-insertion-mode:stack-of-open-elements-2>stack of open elements/a>./p> p>If the code idthe-before-html-insertion-mode:document-10>a href#document>Document/a>/code> is being loaded as part of a href#navigate idthe-before-html-insertion-mode:navigate-2>navigation/a> of a a href#browsing-context idthe-before-html-insertion-mode:browsing-context-2>browsing context/a>, then: run the a href#concept-appcache-init idthe-before-html-insertion-mode:concept-appcache-init-4>application cache selection algorithm/a> with no manifest, passing it the code idthe-before-html-insertion-mode:document-11>a href#document>Document/a>/code> object./p> p>Switch the a href#insertion-mode idthe-before-html-insertion-mode:insertion-mode-3>insertion mode/a> to a href#the-before-head-insertion-mode idthe-before-html-insertion-mode:the-before-head-insertion-mode-2>before head/a>, then reprocess the token./p> /dl> p>The a idthe-before-html-insertion-mode:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> can end up being removed from the code idthe-before-html-insertion-mode:document-12>a href#document>Document/a>/code> object, e.g. by scripts; nothing in particular happens in such cases, content continues being appended to the nodes as described in the next section./p> h6 idthe-before-head-insertion-mode>span classsecno>12.2.6.4.3/span> The dfn>before head/dfn> insertion modea href#the-before-head-insertion-mode classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#the-before-head-insertion-mode idthe-before-head-insertion-mode:the-before-head-insertion-mode>before head/a> a href#insertion-mode idthe-before-head-insertion-mode:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACEdd> p>Ignore the token./p> dt>A comment tokendd> p>a href#insert-a-comment idthe-before-head-insertion-mode:insert-a-comment>Insert a comment/a>./p> dt>A DOCTYPE tokendd> p>a href#parse-errors idthe-before-head-insertion-mode:parse-errors>Parse error/a>. Ignore the token./p> dt>A start tag whose tag name is htmldd> p>Process the token a href#using-the-rules-for idthe-before-head-insertion-mode:using-the-rules-for>using the rules for/a> the a href#parsing-main-inbody idthe-before-head-insertion-mode:parsing-main-inbody>in body/a> a href#insertion-mode idthe-before-head-insertion-mode:insertion-mode-2>insertion mode/a>./p> dt>A start tag whose tag name is headdd> p>a href#insert-an-html-element idthe-before-head-insertion-mode:insert-an-html-element>Insert an HTML element/a> for the token./p> p>Set the a href#head-element-pointer idthe-before-head-insertion-mode:head-element-pointer>code>head/code> element pointer/a> to the newly created code idthe-before-head-insertion-mode:the-head-element>a href#the-head-element>head/a>/code> element./p> p>Switch the a href#insertion-mode idthe-before-head-insertion-mode:insertion-mode-3>insertion mode/a> to a href#parsing-main-inhead idthe-before-head-insertion-mode:parsing-main-inhead>in head/a>./p> dt>An end tag whose tag name is one of: head, body, html, brdd> p>Act as described in the anything else entry below./p> dt>Any other end tagdd> p>a href#parse-errors idthe-before-head-insertion-mode:parse-errors-2>Parse error/a>. Ignore the token./p> dt>Anything elsedd> p>a href#insert-an-html-element idthe-before-head-insertion-mode:insert-an-html-element-2>Insert an HTML element/a> for a head start tag token with no attributes./p> p>Set the a href#head-element-pointer idthe-before-head-insertion-mode:head-element-pointer-2>code>head/code> element pointer/a> to the newly created code idthe-before-head-insertion-mode:the-head-element-2>a href#the-head-element>head/a>/code> element./p> p>Switch the a href#insertion-mode idthe-before-head-insertion-mode:insertion-mode-4>insertion mode/a> to a href#parsing-main-inhead idthe-before-head-insertion-mode:parsing-main-inhead-2>in head/a>./p> p>Reprocess the current token./p> /dl> h6 idparsing-main-inhead>span classsecno>12.2.6.4.4/span> The dfn>in head/dfn> insertion modea href#parsing-main-inhead classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#parsing-main-inhead idparsing-main-inhead:parsing-main-inhead>in head/a> a href#insertion-mode idparsing-main-inhead:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACEdd> p>a href#insert-a-character idparsing-main-inhead:insert-a-character>Insert the character/a>./p> dt>A comment tokendd> p>a href#insert-a-comment idparsing-main-inhead:insert-a-comment>Insert a comment/a>./p> dt>A DOCTYPE tokendd> p>a href#parse-errors idparsing-main-inhead:parse-errors>Parse error/a>. Ignore the token./p> dt>A start tag whose tag name is htmldd> p>Process the token a href#using-the-rules-for idparsing-main-inhead:using-the-rules-for>using the rules for/a> the a href#parsing-main-inbody idparsing-main-inhead:parsing-main-inbody>in body/a> a href#insertion-mode idparsing-main-inhead:insertion-mode-2>insertion mode/a>./p> dt>A start tag whose tag name is one of: base, basefont, bgsound, linkdd> p>a href#insert-an-html-element idparsing-main-inhead:insert-an-html-element>Insert an HTML element/a> for the token. Immediately pop the a href#current-node idparsing-main-inhead:current-node>current node/a> off the a href#stack-of-open-elements idparsing-main-inhead:stack-of-open-elements>stack of open elements/a>./p> p>a href#acknowledge-self-closing-flag idparsing-main-inhead:acknowledge-self-closing-flag>Acknowledge the tokens i>self-closing flag/i>/a>, if it is set./p> dt>A start tag whose tag name is metadd> p>a href#insert-an-html-element idparsing-main-inhead:insert-an-html-element-2>Insert an HTML element/a> for the token. Immediately pop the a href#current-node idparsing-main-inhead:current-node-2>current node/a> off the a href#stack-of-open-elements idparsing-main-inhead:stack-of-open-elements-2>stack of open elements/a>./p> p>a href#acknowledge-self-closing-flag idparsing-main-inhead:acknowledge-self-closing-flag-2>Acknowledge the tokens i>self-closing flag/i>/a>, if it is set./p> p idmeta-charset-during-parse>If the element has a code idparsing-main-inhead:attr-meta-charset>a href#attr-meta-charset>charset/a>/code> attribute, and a idparsing-main-inhead:getting-an-encoding hrefhttps://encoding.spec.whatwg.org/#concept-encoding-get data-x-internalgetting-an-encoding>getting an encoding/a> from its value results in an a idparsing-main-inhead:encoding hrefhttps://encoding.spec.whatwg.org/#encoding data-x-internalencoding>encoding/a>, and the a href#concept-encoding-confidence idparsing-main-inhead:concept-encoding-confidence>confidence/a> is currently i>tentative/i>, then a href#change-the-encoding idparsing-main-inhead:change-the-encoding>change the encoding/a> to the resulting encoding./p> p>Otherwise, if the element has an code idparsing-main-inhead:attr-meta-http-equiv>a href#attr-meta-http-equiv>http-equiv/a>/code> attribute whose value is an a idparsing-main-inhead:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>Content-Type/code>, and the element has a code idparsing-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 idparsing-main-inhead:algorithm-for-extracting-a-character-encoding-from-a-meta-element>algorithm for extracting a character encoding from a code>meta/code> element/a> to that attributes value returns an a idparsing-main-inhead:encoding-2 hrefhttps://encoding.spec.whatwg.org/#encoding data-x-internalencoding>encoding/a>, and the a href#concept-encoding-confidence idparsing-main-inhead:concept-encoding-confidence-2>confidence/a> is currently i>tentative/i>, then a href#change-the-encoding idparsing-main-inhead:change-the-encoding-2>change the encoding/a> to the extracted encoding./p> dt>A start tag whose tag name is titledd> p>Follow the a href#generic-rcdata-element-parsing-algorithm idparsing-main-inhead:generic-rcdata-element-parsing-algorithm>generic RCDATA element parsing algorithm/a>./p> dt>A start tag whose tag name is noscript, if the a href#scripting-flag idparsing-main-inhead:scripting-flag>scripting flag/a> is enableddt>A start tag whose tag name is one of: noframes, styledd> p>Follow the a href#generic-raw-text-element-parsing-algorithm idparsing-main-inhead:generic-raw-text-element-parsing-algorithm>generic raw text element parsing algorithm/a>./p> dt>A start tag whose tag name is noscript, if the a href#scripting-flag idparsing-main-inhead:scripting-flag-2>scripting flag/a> is disableddd> p>a href#insert-an-html-element idparsing-main-inhead:insert-an-html-element-3>Insert an HTML element/a> for the token./p> p>Switch the a href#insertion-mode idparsing-main-inhead:insertion-mode-3>insertion mode/a> to a href#parsing-main-inheadnoscript idparsing-main-inhead:parsing-main-inheadnoscript>in head noscript/a>./p> dt idscriptTag>A start tag whose tag name is scriptdd> p>Run these steps:/p> ol>li>p>Let the var>adjusted insertion location/var> be the a href#appropriate-place-for-inserting-a-node idparsing-main-inhead:appropriate-place-for-inserting-a-node>appropriate place for inserting a node/a>.li>p>a href#create-an-element-for-the-token idparsing-main-inhead:create-an-element-for-the-token>Create an element for the token/a> in the a idparsing-main-inhead:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>, with the intended parent being the element in which the var>adjusted insertion location/var> finds itself.li> p>Mark the element as being a href#parser-inserted idparsing-main-inhead:parser-inserted>parser-inserted/a> and unset the elements a href#non-blocking idparsing-main-inhead:non-blocking>non-blocking/a> flag./p> p classnote>This ensures that, if the script is external, any code idparsing-main-inhead:dom-document-write>a href#dom-document-write>document.write()/a>/code> calls in the script will execute in-line, instead of blowing the document away, as would happen in most other cases. It also prevents the script from executing until the end tag is seen./p> li>p>If the parser was originally created for the a href#html-fragment-parsing-algorithm idparsing-main-inhead:html-fragment-parsing-algorithm>HTML fragment parsing algorithm/a>, then mark the code idparsing-main-inhead:the-script-element>a href#the-script-element>script/a>/code> element as a href#already-started idparsing-main-inhead:already-started>already started/a>. (a href#fragment-case idparsing-main-inhead:fragment-case>fragment case/a>)li iddocument-written-scripts-intervention>p>If the parser was invoked via the code idparsing-main-inhead:dom-document-write-2>a href#dom-document-write>document.write()/a>/code> or code idparsing-main-inhead:dom-document-writeln>a href#dom-document-writeln>document.writeln()/a>/code> methods, then optionally mark the code idparsing-main-inhead:the-script-element-2>a href#the-script-element>script/a>/code> element as a href#already-started idparsing-main-inhead:already-started-2>already started/a>. (For example, the user agent might use this clause to prevent execution of a href#concept-origin idparsing-main-inhead:concept-origin>cross-origin/a> scripts inserted via code idparsing-main-inhead:dom-document-write-3>a href#dom-document-write>document.write()/a>/code> under slow network conditions, or when the page has already taken a long time to load.)li>p>Insert the newly created element at the var>adjusted insertion location/var>.li>p>Push the element onto the a href#stack-of-open-elements idparsing-main-inhead:stack-of-open-elements-3>stack of open elements/a> so that it is the new a href#current-node idparsing-main-inhead:current-node-3>current node/a>.li>p>Switch the tokenizer to the a href#script-data-state idparsing-main-inhead:script-data-state>script data state/a>.li>p>Let the a href#original-insertion-mode idparsing-main-inhead:original-insertion-mode>original insertion mode/a> be the current a href#insertion-mode idparsing-main-inhead:insertion-mode-4>insertion mode/a>./p> li>p>Switch the a href#insertion-mode idparsing-main-inhead:insertion-mode-5>insertion mode/a> to a href#parsing-main-incdata idparsing-main-inhead:parsing-main-incdata>text/a>./ol> dt>An end tag whose tag name is headdd> p>Pop the a href#current-node idparsing-main-inhead:current-node-4>current node/a> (which will be the code idparsing-main-inhead:the-head-element>a href#the-head-element>head/a>/code> element) off the a href#stack-of-open-elements idparsing-main-inhead:stack-of-open-elements-4>stack of open elements/a>./p> p>Switch the a href#insertion-mode idparsing-main-inhead:insertion-mode-6>insertion mode/a> to a href#the-after-head-insertion-mode idparsing-main-inhead:the-after-head-insertion-mode>after head/a>./p> dt>An end tag whose tag name is one of: body, html, brdd> p>Act as described in the anything else entry below./p> dt>A start tag whose tag name is templatedd> p>a href#insert-an-html-element idparsing-main-inhead:insert-an-html-element-4>Insert an HTML element/a> for the token./p> p>Insert a a href#concept-parser-marker idparsing-main-inhead:concept-parser-marker>marker/a> at the end of the a href#list-of-active-formatting-elements idparsing-main-inhead:list-of-active-formatting-elements>list of active formatting elements/a>./p> p>Set the a href#frameset-ok-flag idparsing-main-inhead:frameset-ok-flag>frameset-ok flag/a> to not ok./p> p>Switch the a href#insertion-mode idparsing-main-inhead:insertion-mode-7>insertion mode/a> to a href#parsing-main-intemplate idparsing-main-inhead:parsing-main-intemplate>in template/a>./p> p>Push a href#parsing-main-intemplate idparsing-main-inhead:parsing-main-intemplate-2>in template/a> onto the a href#stack-of-template-insertion-modes idparsing-main-inhead:stack-of-template-insertion-modes>stack of template insertion modes/a> so that it is the new a href#current-template-insertion-mode idparsing-main-inhead:current-template-insertion-mode>current template insertion mode/a>./p> dt>An end tag whose tag name is templatedd> p>If there is no code idparsing-main-inhead:the-template-element>a href#the-template-element>template/a>/code> element on the a href#stack-of-open-elements idparsing-main-inhead:stack-of-open-elements-5>stack of open elements/a>, then this is a a href#parse-errors idparsing-main-inhead:parse-errors-2>parse error/a>; ignore the token./p> p>Otherwise, run these steps:/p> ol>li>p>a href#generate-all-implied-end-tags-thoroughly idparsing-main-inhead:generate-all-implied-end-tags-thoroughly>Generate all implied end tags thoroughly/a>.li>p>If the a href#current-node idparsing-main-inhead:current-node-5>current node/a> is not a code idparsing-main-inhead:the-template-element-2>a href#the-template-element>template/a>/code> element, then this is a a href#parse-errors idparsing-main-inhead:parse-errors-3>parse error/a>.li>p>Pop elements from the a href#stack-of-open-elements idparsing-main-inhead:stack-of-open-elements-6>stack of open elements/a> until a code idparsing-main-inhead:the-template-element-3>a href#the-template-element>template/a>/code> element has been popped from the stack.li>a href#clear-the-list-of-active-formatting-elements-up-to-the-last-marker idparsing-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 idparsing-main-inhead:current-template-insertion-mode-2>current template insertion mode/a> off the a href#stack-of-template-insertion-modes idparsing-main-inhead:stack-of-template-insertion-modes-2>stack of template insertion modes/a>./p> li>p>a href#reset-the-insertion-mode-appropriately idparsing-main-inhead:reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately/a>./ol> dt>A start tag whose tag name is headdt>Any other end tagdd> p>a href#parse-errors idparsing-main-inhead:parse-errors-4>Parse error/a>. Ignore the token./p> dt>Anything elsedd> p>Pop the a href#current-node idparsing-main-inhead:current-node-6>current node/a> (which will be the code idparsing-main-inhead:the-head-element-2>a href#the-head-element>head/a>/code> element) off the a href#stack-of-open-elements idparsing-main-inhead:stack-of-open-elements-7>stack of open elements/a>./p> p>Switch the a href#insertion-mode idparsing-main-inhead:insertion-mode-8>insertion mode/a> to a href#the-after-head-insertion-mode idparsing-main-inhead:the-after-head-insertion-mode-2>after head/a>./p> p>Reprocess the token./p> /dl> h6 idparsing-main-inheadnoscript>span classsecno>12.2.6.4.5/span> The dfn>in head noscript/dfn> insertion modea href#parsing-main-inheadnoscript classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#parsing-main-inheadnoscript idparsing-main-inheadnoscript:parsing-main-inheadnoscript>in head noscript/a> a href#insertion-mode idparsing-main-inheadnoscript:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A DOCTYPE tokendd> p>a href#parse-errors idparsing-main-inheadnoscript:parse-errors>Parse error/a>. Ignore the token./p> dt>A start tag whose tag name is htmldd> p>Process the token a href#using-the-rules-for idparsing-main-inheadnoscript:using-the-rules-for>using the rules for/a> the a href#parsing-main-inbody idparsing-main-inheadnoscript:parsing-main-inbody>in body/a> a href#insertion-mode idparsing-main-inheadnoscript:insertion-mode-2>insertion mode/a>./p> dt>An end tag whose tag name is noscriptdd> p>Pop the a href#current-node idparsing-main-inheadnoscript:current-node>current node/a> (which will be a code idparsing-main-inheadnoscript:the-noscript-element>a href#the-noscript-element>noscript/a>/code> element) from the a href#stack-of-open-elements idparsing-main-inheadnoscript:stack-of-open-elements>stack of open elements/a>; the new a href#current-node idparsing-main-inheadnoscript:current-node-2>current node/a> will be a code idparsing-main-inheadnoscript:the-head-element>a href#the-head-element>head/a>/code> element./p> p>Switch the a href#insertion-mode idparsing-main-inheadnoscript:insertion-mode-3>insertion mode/a> to a href#parsing-main-inhead idparsing-main-inheadnoscript:parsing-main-inhead>in head/a>./p> dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACEdt>A comment tokendt>A start tag whose tag name is one of: basefont, bgsound, link, meta, noframes, styledd> p>Process the token a href#using-the-rules-for idparsing-main-inheadnoscript:using-the-rules-for-2>using the rules for/a> the a href#parsing-main-inhead idparsing-main-inheadnoscript:parsing-main-inhead-2>in head/a> a href#insertion-mode idparsing-main-inheadnoscript:insertion-mode-4>insertion mode/a>./p> dt>An end tag whose tag name is brdd> p>Act as described in the anything else entry below./p> dt>A start tag whose tag name is one of: head, noscriptdt>Any other end tagdd> p>a href#parse-errors idparsing-main-inheadnoscript:parse-errors-2>Parse error/a>. Ignore the token./p> dt>Anything elsedd> p>a href#parse-errors idparsing-main-inheadnoscript:parse-errors-3>Parse error/a>./p> p>Pop the a href#current-node idparsing-main-inheadnoscript:current-node-3>current node/a> (which will be a code idparsing-main-inheadnoscript:the-noscript-element-2>a href#the-noscript-element>noscript/a>/code> element) from the a href#stack-of-open-elements idparsing-main-inheadnoscript:stack-of-open-elements-2>stack of open elements/a>; the new a href#current-node idparsing-main-inheadnoscript:current-node-4>current node/a> will be a code idparsing-main-inheadnoscript:the-head-element-2>a href#the-head-element>head/a>/code> element./p> p>Switch the a href#insertion-mode idparsing-main-inheadnoscript:insertion-mode-5>insertion mode/a> to a href#parsing-main-inhead idparsing-main-inheadnoscript:parsing-main-inhead-3>in head/a>./p> p>Reprocess the token./p> /dl> h6 idthe-after-head-insertion-mode>span classsecno>12.2.6.4.6/span> The dfn>after head/dfn> insertion modea href#the-after-head-insertion-mode classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#the-after-head-insertion-mode idthe-after-head-insertion-mode:the-after-head-insertion-mode>after head/a> a href#insertion-mode idthe-after-head-insertion-mode:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACEdd> p>a href#insert-a-character idthe-after-head-insertion-mode:insert-a-character>Insert the character/a>./p> dt>A comment tokendd> p>a href#insert-a-comment idthe-after-head-insertion-mode:insert-a-comment>Insert a comment/a>./p> dt>A DOCTYPE tokendd> p>a href#parse-errors idthe-after-head-insertion-mode:parse-errors>Parse error/a>. Ignore the token./p> dt>A start tag whose tag name is htmldd> p>Process the token a href#using-the-rules-for idthe-after-head-insertion-mode:using-the-rules-for>using the rules for/a> the a href#parsing-main-inbody idthe-after-head-insertion-mode:parsing-main-inbody>in body/a> a href#insertion-mode idthe-after-head-insertion-mode:insertion-mode-2>insertion mode/a>./p> dt>A start tag whose tag name is bodydd> p>a href#insert-an-html-element idthe-after-head-insertion-mode:insert-an-html-element>Insert an HTML element/a> for the token./p> p>Set the a href#frameset-ok-flag idthe-after-head-insertion-mode:frameset-ok-flag>frameset-ok flag/a> to not ok./p> p>Switch the a href#insertion-mode idthe-after-head-insertion-mode:insertion-mode-3>insertion mode/a> to a href#parsing-main-inbody idthe-after-head-insertion-mode:parsing-main-inbody-2>in body/a>./p> dt>A start tag whose tag name is framesetdd> p>a href#insert-an-html-element idthe-after-head-insertion-mode:insert-an-html-element-2>Insert an HTML element/a> for the token./p> p>Switch the a href#insertion-mode idthe-after-head-insertion-mode:insertion-mode-4>insertion mode/a> to a href#parsing-main-inframeset idthe-after-head-insertion-mode:parsing-main-inframeset>in frameset/a>./p> dt>A start tag whose tag name is one of: base, basefont, bgsound, link, meta, noframes, script, style, template, titledd> p>a href#parse-errors idthe-after-head-insertion-mode:parse-errors-2>Parse error/a>./p> p>Push the node pointed to by the a href#head-element-pointer idthe-after-head-insertion-mode:head-element-pointer>code>head/code> element pointer/a> onto the a href#stack-of-open-elements idthe-after-head-insertion-mode:stack-of-open-elements>stack of open elements/a>./p> p>Process the token a href#using-the-rules-for idthe-after-head-insertion-mode:using-the-rules-for-2>using the rules for/a> the a href#parsing-main-inhead idthe-after-head-insertion-mode:parsing-main-inhead>in head/a> a href#insertion-mode idthe-after-head-insertion-mode:insertion-mode-5>insertion mode/a>./p> p>Remove the node pointed to by the a href#head-element-pointer idthe-after-head-insertion-mode:head-element-pointer-2>code>head/code> element pointer/a> from the a href#stack-of-open-elements idthe-after-head-insertion-mode:stack-of-open-elements-2>stack of open elements/a>. (It might not be the a href#current-node idthe-after-head-insertion-mode:current-node>current node/a> at this point.)/p> p classnote>The a href#head-element-pointer idthe-after-head-insertion-mode:head-element-pointer-3>code>head/code> element pointer/a> cannot be null at this point./p> dt>An end tag whose tag name is templatedd> p>Process the token a href#using-the-rules-for idthe-after-head-insertion-mode:using-the-rules-for-3>using the rules for/a> the a href#parsing-main-inhead idthe-after-head-insertion-mode:parsing-main-inhead-2>in head/a> a href#insertion-mode idthe-after-head-insertion-mode:insertion-mode-6>insertion mode/a>./p> dt>An end tag whose tag name is one of: body, html, brdd> p>Act as described in the anything else entry below./p> dt>A start tag whose tag name is headdt>Any other end tagdd> p>a href#parse-errors idthe-after-head-insertion-mode:parse-errors-3>Parse error/a>. Ignore the token./p> dt>Anything elsedd> p>a href#insert-an-html-element idthe-after-head-insertion-mode:insert-an-html-element-3>Insert an HTML element/a> for a body start tag token with no attributes./p> p>Switch the a href#insertion-mode idthe-after-head-insertion-mode:insertion-mode-7>insertion mode/a> to a href#parsing-main-inbody idthe-after-head-insertion-mode:parsing-main-inbody-3>in body/a>./p> p>Reprocess the current token./p> /dl> h6 idparsing-main-inbody>span classsecno>12.2.6.4.7/span> The dfn>in body/dfn> insertion modea href#parsing-main-inbody classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#parsing-main-inbody idparsing-main-inbody:parsing-main-inbody>in body/a> a href#insertion-mode idparsing-main-inbody:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A character token that is U+0000 NULLdd> p>a href#parse-errors idparsing-main-inbody:parse-errors>Parse error/a>. Ignore the token./p> dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACEdd> p>a href#reconstruct-the-active-formatting-elements idparsing-main-inbody:reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements/a>, if any./p> p>a href#insert-a-character idparsing-main-inbody:insert-a-character>Insert the tokens character/a>./p> dt>Any other character tokendd> p>a href#reconstruct-the-active-formatting-elements idparsing-main-inbody:reconstruct-the-active-formatting-elements-2>Reconstruct the active formatting elements/a>, if any./p> p>a href#insert-a-character idparsing-main-inbody:insert-a-character-2>Insert the tokens character/a>./p> p>Set the a href#frameset-ok-flag idparsing-main-inbody:frameset-ok-flag>frameset-ok flag/a> to not ok./p> dt>A comment tokendd> p>a href#insert-a-comment idparsing-main-inbody:insert-a-comment>Insert a comment/a>./p> dt>A DOCTYPE tokendd> p>a href#parse-errors idparsing-main-inbody:parse-errors-2>Parse error/a>. Ignore the token./p> dt>A start tag whose tag name is htmldd> p>a href#parse-errors idparsing-main-inbody:parse-errors-3>Parse error/a>./p> p>If there is a code idparsing-main-inbody:the-template-element>a href#the-template-element>template/a>/code> element on the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements>stack of open elements/a>, then ignore the token./p> p>Otherwise, for each attribute on the token, check to see if the attribute is already present on the top element of the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-2>stack of open elements/a>. If it is not, add the attribute and its corresponding value to that element./p> dt>A start tag whose tag name is one of: base, basefont, bgsound, link, meta, noframes, script, style, template, titledt>An end tag whose tag name is templatedd> p>Process the token a href#using-the-rules-for idparsing-main-inbody:using-the-rules-for>using the rules for/a> the a href#parsing-main-inhead idparsing-main-inbody:parsing-main-inhead>in head/a> a href#insertion-mode idparsing-main-inbody:insertion-mode-2>insertion mode/a>./p> dt>A start tag whose tag name is bodydd> p>a href#parse-errors idparsing-main-inbody:parse-errors-4>Parse error/a>./p> p>If the second element on the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-3>stack of open elements/a> is not a code idparsing-main-inbody:the-body-element>a href#the-body-element>body/a>/code> element, if the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-4>stack of open elements/a> has only one node on it, or if there is a code idparsing-main-inbody:the-template-element-2>a href#the-template-element>template/a>/code> element on the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-5>stack of open elements/a>, then ignore the token. (a href#fragment-case idparsing-main-inbody:fragment-case>fragment case/a>)/p> p>Otherwise, set the a href#frameset-ok-flag idparsing-main-inbody:frameset-ok-flag-2>frameset-ok flag/a> to not ok; then, for each attribute on the token, check to see if the attribute is already present on the code idparsing-main-inbody:the-body-element-2>a href#the-body-element>body/a>/code> element (the second element) on the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-6>stack of open elements/a>, and if it is not, add the attribute and its corresponding value to that element./p> dt>A start tag whose tag name is framesetdd> p>a href#parse-errors idparsing-main-inbody:parse-errors-5>Parse error/a>./p> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-7>stack of open elements/a> has only one node on it, or if the second element on the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-8>stack of open elements/a> is not a code idparsing-main-inbody:the-body-element-3>a href#the-body-element>body/a>/code> element, then ignore the token. (a href#fragment-case idparsing-main-inbody:fragment-case-2>fragment case/a>)/p> p>If the a href#frameset-ok-flag idparsing-main-inbody:frameset-ok-flag-3>frameset-ok flag/a> is set to not ok, ignore the token./p> p>Otherwise, run the following steps:/p> ol>li>p>Remove the second element on the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-9>stack of open elements/a> from its parent node, if it has one.li>p>Pop all the nodes from the bottom of the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-10>stack of open elements/a>, from the a href#current-node idparsing-main-inbody:current-node>current node/a> up to, but not including, the root code idparsing-main-inbody:the-html-element>a href#the-html-element>html/a>/code> element./p> li>p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element>Insert an HTML element/a> for the token.li>p>Switch the a href#insertion-mode idparsing-main-inbody:insertion-mode-3>insertion mode/a> to a href#parsing-main-inframeset idparsing-main-inbody:parsing-main-inframeset>in frameset/a>./p> /ol> dt>An end-of-file tokendd> p>If the a href#stack-of-template-insertion-modes idparsing-main-inbody:stack-of-template-insertion-modes>stack of template insertion modes/a> is not empty, then process the token a href#using-the-rules-for idparsing-main-inbody:using-the-rules-for-2>using the rules for/a> the a href#parsing-main-intemplate idparsing-main-inbody:parsing-main-intemplate>in template/a> a href#insertion-mode idparsing-main-inbody:insertion-mode-4>insertion mode/a>./p> p>Otherwise, follow these steps:/p> ol>li>p>If there is a node in the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-11>stack of open elements/a> that is not either a code idparsing-main-inbody:the-dd-element>a href#the-dd-element>dd/a>/code> element, a code idparsing-main-inbody:the-dt-element>a href#the-dt-element>dt/a>/code> element, an code idparsing-main-inbody:the-li-element>a href#the-li-element>li/a>/code> element, an code idparsing-main-inbody:the-optgroup-element>a href#the-optgroup-element>optgroup/a>/code> element, an code idparsing-main-inbody:the-option-element>a href#the-option-element>option/a>/code> element, a code idparsing-main-inbody:the-p-element>a href#the-p-element>p/a>/code> element, an code idparsing-main-inbody:rb>a href#rb>rb/a>/code> element, an code idparsing-main-inbody:the-rp-element>a href#the-rp-element>rp/a>/code> element, an code idparsing-main-inbody:the-rt-element>a href#the-rt-element>rt/a>/code> element, an code idparsing-main-inbody:rtc>a href#rtc>rtc/a>/code> element, a code idparsing-main-inbody:the-tbody-element>a href#the-tbody-element>tbody/a>/code> element, a code idparsing-main-inbody:the-td-element>a href#the-td-element>td/a>/code> element, a code idparsing-main-inbody:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code> element, a code idparsing-main-inbody:the-th-element>a href#the-th-element>th/a>/code> element, a code idparsing-main-inbody:the-thead-element>a href#the-thead-element>thead/a>/code> element, a code idparsing-main-inbody:the-tr-element>a href#the-tr-element>tr/a>/code> element, the code idparsing-main-inbody:the-body-element-4>a href#the-body-element>body/a>/code> element, or the code idparsing-main-inbody:the-html-element-2>a href#the-html-element>html/a>/code> element, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-6>parse error/a>.li>p>a href#stop-parsing idparsing-main-inbody:stop-parsing>Stop parsing/a>./ol> dt>An end tag whose tag name is bodydd> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-12>stack of open elements/a> does not a href#has-an-element-in-scope idparsing-main-inbody:has-an-element-in-scope>have a code>body/code> element in scope/a>, this is a a href#parse-errors idparsing-main-inbody:parse-errors-7>parse error/a>; ignore the token./p> p>Otherwise, if there is a node in the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-13>stack of open elements/a> that is not either a code idparsing-main-inbody:the-dd-element-2>a href#the-dd-element>dd/a>/code> element, a code idparsing-main-inbody:the-dt-element-2>a href#the-dt-element>dt/a>/code> element, an code idparsing-main-inbody:the-li-element-2>a href#the-li-element>li/a>/code> element, an code idparsing-main-inbody:the-optgroup-element-2>a href#the-optgroup-element>optgroup/a>/code> element, an code idparsing-main-inbody:the-option-element-2>a href#the-option-element>option/a>/code> element, a code idparsing-main-inbody:the-p-element-2>a href#the-p-element>p/a>/code> element, an code idparsing-main-inbody:rb-2>a href#rb>rb/a>/code> element, an code idparsing-main-inbody:the-rp-element-2>a href#the-rp-element>rp/a>/code> element, an code idparsing-main-inbody:the-rt-element-2>a href#the-rt-element>rt/a>/code> element, an code idparsing-main-inbody:rtc-2>a href#rtc>rtc/a>/code> element, a code idparsing-main-inbody:the-tbody-element-2>a href#the-tbody-element>tbody/a>/code> element, a code idparsing-main-inbody:the-td-element-2>a href#the-td-element>td/a>/code> element, a code idparsing-main-inbody:the-tfoot-element-2>a href#the-tfoot-element>tfoot/a>/code> element, a code idparsing-main-inbody:the-th-element-2>a href#the-th-element>th/a>/code> element, a code idparsing-main-inbody:the-thead-element-2>a href#the-thead-element>thead/a>/code> element, a code idparsing-main-inbody:the-tr-element-2>a href#the-tr-element>tr/a>/code> element, the code idparsing-main-inbody:the-body-element-5>a href#the-body-element>body/a>/code> element, or the code idparsing-main-inbody:the-html-element-3>a href#the-html-element>html/a>/code> element, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-8>parse error/a>./p> p>Switch the a href#insertion-mode idparsing-main-inbody:insertion-mode-5>insertion mode/a> to a href#parsing-main-afterbody idparsing-main-inbody:parsing-main-afterbody>after body/a>./p> dt>An end tag whose tag name is htmldd> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-14>stack of open elements/a> does not a href#has-an-element-in-scope idparsing-main-inbody:has-an-element-in-scope-2>have a code>body/code> element in scope/a>, this is a a href#parse-errors idparsing-main-inbody:parse-errors-9>parse error/a>; ignore the token./p> p>Otherwise, if there is a node in the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-15>stack of open elements/a> that is not either a code idparsing-main-inbody:the-dd-element-3>a href#the-dd-element>dd/a>/code> element, a code idparsing-main-inbody:the-dt-element-3>a href#the-dt-element>dt/a>/code> element, an code idparsing-main-inbody:the-li-element-3>a href#the-li-element>li/a>/code> element, an code idparsing-main-inbody:the-optgroup-element-3>a href#the-optgroup-element>optgroup/a>/code> element, an code idparsing-main-inbody:the-option-element-3>a href#the-option-element>option/a>/code> element, a code idparsing-main-inbody:the-p-element-3>a href#the-p-element>p/a>/code> element, an code idparsing-main-inbody:rb-3>a href#rb>rb/a>/code> element, an code idparsing-main-inbody:the-rp-element-3>a href#the-rp-element>rp/a>/code> element, an code idparsing-main-inbody:the-rt-element-3>a href#the-rt-element>rt/a>/code> element, an code idparsing-main-inbody:rtc-3>a href#rtc>rtc/a>/code> element, a code idparsing-main-inbody:the-tbody-element-3>a href#the-tbody-element>tbody/a>/code> element, a code idparsing-main-inbody:the-td-element-3>a href#the-td-element>td/a>/code> element, a code idparsing-main-inbody:the-tfoot-element-3>a href#the-tfoot-element>tfoot/a>/code> element, a code idparsing-main-inbody:the-th-element-3>a href#the-th-element>th/a>/code> element, a code idparsing-main-inbody:the-thead-element-3>a href#the-thead-element>thead/a>/code> element, a code idparsing-main-inbody:the-tr-element-3>a href#the-tr-element>tr/a>/code> element, the code idparsing-main-inbody:the-body-element-6>a href#the-body-element>body/a>/code> element, or the code idparsing-main-inbody:the-html-element-4>a href#the-html-element>html/a>/code> element, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-10>parse error/a>./p> p>Switch the a href#insertion-mode idparsing-main-inbody:insertion-mode-6>insertion mode/a> to a href#parsing-main-afterbody idparsing-main-inbody:parsing-main-afterbody-2>after body/a>./p> p>Reprocess the token./p> dt>A start tag whose tag name is one of: address, article, aside, blockquote, center, details, dialog, dir, div, dl, fieldset, figcaption, figure, footer, header, hgroup, main, menu, nav, ol, p, section, summary, uldd> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-16>stack of open elements/a> a href#has-an-element-in-button-scope idparsing-main-inbody:has-an-element-in-button-scope>has a code>p/code> element in button scope/a>, then a href#close-a-p-element idparsing-main-inbody:close-a-p-element>close a code>p/code> element/a>./p> p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-2>Insert an HTML element/a> for the token./p> dt>A start tag whose tag name is one of: h1, h2, h3, h4, h5, h6dd> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-17>stack of open elements/a> a href#has-an-element-in-button-scope idparsing-main-inbody:has-an-element-in-button-scope-2>has a code>p/code> element in button scope/a>, then a href#close-a-p-element idparsing-main-inbody:close-a-p-element-2>close a code>p/code> element/a>./p> p>If the a href#current-node idparsing-main-inbody:current-node-2>current node/a> is an a href#html-elements idparsing-main-inbody:html-elements>HTML element/a> whose tag name is one of h1, h2, h3, h4, h5, or h6, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-11>parse error/a>; pop the a href#current-node idparsing-main-inbody:current-node-3>current node/a> off the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-18>stack of open elements/a>./p> p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-3>Insert an HTML element/a> for the token./p> dt>A start tag whose tag name is one of: pre, listingdd> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-19>stack of open elements/a> a href#has-an-element-in-button-scope idparsing-main-inbody:has-an-element-in-button-scope-3>has a code>p/code> element in button scope/a>, then a href#close-a-p-element idparsing-main-inbody:close-a-p-element-3>close a code>p/code> element/a>./p> p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-4>Insert an HTML element/a> for the token./p> p>If the a href#next-token idparsing-main-inbody:next-token>next token/a> is a U+000A LINE FEED (LF) character token, then ignore that token and move on to the next one. (Newlines at the start of code idparsing-main-inbody:the-pre-element>a href#the-pre-element>pre/a>/code> blocks are ignored as an authoring convenience.)/p> p>Set the a href#frameset-ok-flag idparsing-main-inbody:frameset-ok-flag-4>frameset-ok flag/a> to not ok./p> dt>A start tag whose tag name is formdd> p>If the a href#form-element-pointer idparsing-main-inbody:form-element-pointer>code>form/code> element pointer/a> is not null, and there is no code idparsing-main-inbody:the-template-element-3>a href#the-template-element>template/a>/code> element on the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-20>stack of open elements/a>, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-12>parse error/a>; ignore the token./p> p>Otherwise:/p> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-21>stack of open elements/a> a href#has-an-element-in-button-scope idparsing-main-inbody:has-an-element-in-button-scope-4>has a code>p/code> element in button scope/a>, then a href#close-a-p-element idparsing-main-inbody:close-a-p-element-4>close a code>p/code> element/a>./p> p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-5>Insert an HTML element/a> for the token, and, if there is no code idparsing-main-inbody:the-template-element-4>a href#the-template-element>template/a>/code> element on the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-22>stack of open elements/a>, set the a href#form-element-pointer idparsing-main-inbody:form-element-pointer-2>code>form/code> element pointer/a> to point to the element created./p> dt>A start tag whose tag name is lidd> p>Run these steps:/p> ol>li>p>Set the a href#frameset-ok-flag idparsing-main-inbody:frameset-ok-flag-5>frameset-ok flag/a> to not ok.li>p>Initialize var>node/var> to be the a href#current-node idparsing-main-inbody:current-node-4>current node/a> (the bottommost node of the stack).li> p>i>Loop/i>: If var>node/var> is an code idparsing-main-inbody:the-li-element-4>a href#the-li-element>li/a>/code> element, then run these substeps:/p> ol>li>p>a href#generate-implied-end-tags idparsing-main-inbody:generate-implied-end-tags>Generate implied end tags/a>, except for code idparsing-main-inbody:the-li-element-5>a href#the-li-element>li/a>/code> elements.li>p>If the a href#current-node idparsing-main-inbody:current-node-5>current node/a> is not an code idparsing-main-inbody:the-li-element-6>a href#the-li-element>li/a>/code> element, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-13>parse error/a>.li>p>Pop elements from the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-23>stack of open elements/a> until an code idparsing-main-inbody:the-li-element-7>a href#the-li-element>li/a>/code> element has been popped from the stack.li>p>Jump to the step labeled i>done/i> below./ol> li>p>If var>node/var> is in the a href#special idparsing-main-inbody:special>special/a> category, but is not an code idparsing-main-inbody:the-address-element>a href#the-address-element>address/a>/code>, code idparsing-main-inbody:the-div-element>a href#the-div-element>div/a>/code>, or code idparsing-main-inbody:the-p-element-4>a href#the-p-element>p/a>/code> element, then jump to the step labeled i>done/i> below.li>p>Otherwise, set var>node/var> to the previous entry in the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-24>stack of open elements/a> and return to the step labeled i>loop/i>.li>p>i>Done/i>: If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-25>stack of open elements/a> a href#has-an-element-in-button-scope idparsing-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 idparsing-main-inbody:close-a-p-element-5>close a code>p/code> element/a>.li>p>Finally, a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-6>insert an HTML element/a> for the token./ol> dt>A start tag whose tag name is one of: dd, dtdd> p>Run these steps:/p> ol>li>p>Set the a href#frameset-ok-flag idparsing-main-inbody:frameset-ok-flag-6>frameset-ok flag/a> to not ok.li>p>Initialize var>node/var> to be the a href#current-node idparsing-main-inbody:current-node-6>current node/a> (the bottommost node of the stack).li> p>i>Loop/i>: If var>node/var> is a code idparsing-main-inbody:the-dd-element-4>a href#the-dd-element>dd/a>/code> element, then run these substeps:/p> ol>li>p>a href#generate-implied-end-tags idparsing-main-inbody:generate-implied-end-tags-2>Generate implied end tags/a>, except for code idparsing-main-inbody:the-dd-element-5>a href#the-dd-element>dd/a>/code> elements.li>p>If the a href#current-node idparsing-main-inbody:current-node-7>current node/a> is not a code idparsing-main-inbody:the-dd-element-6>a href#the-dd-element>dd/a>/code> element, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-14>parse error/a>.li>p>Pop elements from the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-26>stack of open elements/a> until a code idparsing-main-inbody:the-dd-element-7>a href#the-dd-element>dd/a>/code> element has been popped from the stack.li>p>Jump to the step labeled i>done/i> below./ol> li> p>If var>node/var> is a code idparsing-main-inbody:the-dt-element-4>a href#the-dt-element>dt/a>/code> element, then run these substeps:/p> ol>li>p>a href#generate-implied-end-tags idparsing-main-inbody:generate-implied-end-tags-3>Generate implied end tags/a>, except for code idparsing-main-inbody:the-dt-element-5>a href#the-dt-element>dt/a>/code> elements.li>p>If the a href#current-node idparsing-main-inbody:current-node-8>current node/a> is not a code idparsing-main-inbody:the-dt-element-6>a href#the-dt-element>dt/a>/code> element, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-15>parse error/a>.li>p>Pop elements from the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-27>stack of open elements/a> until a code idparsing-main-inbody:the-dt-element-7>a href#the-dt-element>dt/a>/code> element has been popped from the stack.li>p>Jump to the step labeled i>done/i> below./ol> li>p>If var>node/var> is in the a href#special idparsing-main-inbody:special-2>special/a> category, but is not an code idparsing-main-inbody:the-address-element-2>a href#the-address-element>address/a>/code>, code idparsing-main-inbody:the-div-element-2>a href#the-div-element>div/a>/code>, or code idparsing-main-inbody:the-p-element-5>a href#the-p-element>p/a>/code> element, then jump to the step labeled i>done/i> below.li>p>Otherwise, set var>node/var> to the previous entry in the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-28>stack of open elements/a> and return to the step labeled i>loop/i>.li>p>i>Done/i>: If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-29>stack of open elements/a> a href#has-an-element-in-button-scope idparsing-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 idparsing-main-inbody:close-a-p-element-6>close a code>p/code> element/a>.li>p>Finally, a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-7>insert an HTML element/a> for the token./ol> dt>A start tag whose tag name is plaintextdd> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-30>stack of open elements/a> a href#has-an-element-in-button-scope idparsing-main-inbody:has-an-element-in-button-scope-7>has a code>p/code> element in button scope/a>, then a href#close-a-p-element idparsing-main-inbody:close-a-p-element-7>close a code>p/code> element/a>./p> p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-8>Insert an HTML element/a> for the token./p> p>Switch the tokenizer to the a href#plaintext-state idparsing-main-inbody:plaintext-state>PLAINTEXT state/a>./p> p classnote>Once a start tag with the tag name plaintext has been seen, that will be the last token ever seen other than character tokens (and the end-of-file token), because there is no way to switch out of the a href#plaintext-state idparsing-main-inbody:plaintext-state-2>PLAINTEXT state/a>./p> dt>A start tag whose tag name is buttondd> ol>li> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-31>stack of open elements/a> a href#has-an-element-in-scope idparsing-main-inbody:has-an-element-in-scope-3>has a code>button/code> element in scope/a>, then run these substeps:/p> ol>li>p>a href#parse-errors idparsing-main-inbody:parse-errors-16>Parse error/a>.li>p>a href#generate-implied-end-tags idparsing-main-inbody:generate-implied-end-tags-4>Generate implied end tags/a>.li>p>Pop elements from the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-32>stack of open elements/a> until a code idparsing-main-inbody:the-button-element>a href#the-button-element>button/a>/code> element has been popped from the stack./ol> li>p>a href#reconstruct-the-active-formatting-elements idparsing-main-inbody:reconstruct-the-active-formatting-elements-3>Reconstruct the active formatting elements/a>, if any.li>p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-9>Insert an HTML element/a> for the token.li>p>Set the a href#frameset-ok-flag idparsing-main-inbody:frameset-ok-flag-7>frameset-ok flag/a> to not ok./ol> dt>An end tag whose tag name is one of: address, article, aside, blockquote, button, center, details, dialog, dir, div, dl, fieldset, figcaption, figure, footer, header, hgroup, listing, main, menu, nav, ol, pre, section, summary, uldd> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-33>stack of open elements/a> does not a href#has-an-element-in-scope idparsing-main-inbody:has-an-element-in-scope-4>have an element in scope/a> that is an a href#html-elements idparsing-main-inbody:html-elements-2>HTML element/a> with the same tag name as that of the token, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-17>parse error/a>; ignore the token./p> p>Otherwise, run these steps:/p> ol>li>p>a href#generate-implied-end-tags idparsing-main-inbody:generate-implied-end-tags-5>Generate implied end tags/a>.li>p>If the a href#current-node idparsing-main-inbody:current-node-9>current node/a> is not an a href#html-elements idparsing-main-inbody:html-elements-3>HTML element/a> with the same tag name as that of the token, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-18>parse error/a>.li>p>Pop elements from the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-34>stack of open elements/a> until an a href#html-elements idparsing-main-inbody:html-elements-4>HTML element/a> with the same tag name as the token has been popped from the stack./ol> dt>An end tag whose tag name is formdd> p>If there is no code idparsing-main-inbody:the-template-element-5>a href#the-template-element>template/a>/code> element on the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-35>stack of open elements/a>, then run these substeps:/p> ol>li>p>Let var>node/var> be the element that the a href#form-element-pointer idparsing-main-inbody:form-element-pointer-3>code>form/code> element pointer/a> is set to, or null if it is not set to an element.li>p>Set the a href#form-element-pointer idparsing-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 idparsing-main-inbody:stack-of-open-elements-36>stack of open elements/a> does not a href#has-an-element-in-scope idparsing-main-inbody:has-an-element-in-scope-5>have var>node/var> in scope/a>, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-19>parse error/a>; abort these steps and ignore the token.li>p>a href#generate-implied-end-tags idparsing-main-inbody:generate-implied-end-tags-6>Generate implied end tags/a>.li>p>If the a href#current-node idparsing-main-inbody:current-node-10>current node/a> is not var>node/var>, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-20>parse error/a>.li>p>Remove var>node/var> from the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-37>stack of open elements/a>./ol> p>If there em>is/em> a code idparsing-main-inbody:the-template-element-6>a href#the-template-element>template/a>/code> element on the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-38>stack of open elements/a>, then run these substeps instead:/p> ol>li>p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-39>stack of open elements/a> does not a href#has-an-element-in-scope idparsing-main-inbody:has-an-element-in-scope-6>have a code>form/code> element in scope/a>, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-21>parse error/a>; abort these steps and ignore the token.li>p>a href#generate-implied-end-tags idparsing-main-inbody:generate-implied-end-tags-7>Generate implied end tags/a>.li>p>If the a href#current-node idparsing-main-inbody:current-node-11>current node/a> is not a code idparsing-main-inbody:the-form-element>a href#the-form-element>form/a>/code> element, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-22>parse error/a>.li>p>Pop elements from the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-40>stack of open elements/a> until a code idparsing-main-inbody:the-form-element-2>a href#the-form-element>form/a>/code> element has been popped from the stack./ol> dt>An end tag whose tag name is pdd> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-41>stack of open elements/a> does not a href#has-an-element-in-button-scope idparsing-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-errors idparsing-main-inbody:parse-errors-23>parse error/a>; a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-10>insert an HTML element/a> for a p start tag token with no attributes./p> p>a href#close-a-p-element idparsing-main-inbody:close-a-p-element-8>Close a code>p/code> element/a>./p> dt>An end tag whose tag name is lidd> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-42>stack of open elements/a> does not a href#has-an-element-in-list-item-scope idparsing-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-errors idparsing-main-inbody:parse-errors-24>parse error/a>; ignore the token./p> p>Otherwise, run these steps:/p> ol>li>p>a href#generate-implied-end-tags idparsing-main-inbody:generate-implied-end-tags-8>Generate implied end tags/a>, except for code idparsing-main-inbody:the-li-element-8>a href#the-li-element>li/a>/code> elements.li>p>If the a href#current-node idparsing-main-inbody:current-node-12>current node/a> is not an code idparsing-main-inbody:the-li-element-9>a href#the-li-element>li/a>/code> element, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-25>parse error/a>.li>p>Pop elements from the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-43>stack of open elements/a> until an code idparsing-main-inbody:the-li-element-10>a href#the-li-element>li/a>/code> element has been popped from the stack./ol> dt>An end tag whose tag name is one of: dd, dtdd> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-44>stack of open elements/a> does not a href#has-an-element-in-scope idparsing-main-inbody:has-an-element-in-scope-7>have an element in scope/a> that is an a href#html-elements idparsing-main-inbody:html-elements-5>HTML element/a> with the same tag name as that of the token, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-26>parse error/a>; ignore the token./p> p>Otherwise, run these steps:/p> ol>li>p>a href#generate-implied-end-tags idparsing-main-inbody:generate-implied-end-tags-9>Generate implied end tags/a>, except for a href#html-elements idparsing-main-inbody:html-elements-6>HTML elements/a> with the same tag name as the token.li>p>If the a href#current-node idparsing-main-inbody:current-node-13>current node/a> is not an a href#html-elements idparsing-main-inbody:html-elements-7>HTML element/a> with the same tag name as that of the token, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-27>parse error/a>.li>p>Pop elements from the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-45>stack of open elements/a> until an a href#html-elements idparsing-main-inbody:html-elements-8>HTML element/a> with the same tag name as the token has been popped from the stack./ol> dt>An end tag whose tag name is one of: h1, h2, h3, h4, h5, h6dd> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-46>stack of open elements/a> does not a href#has-an-element-in-scope idparsing-main-inbody:has-an-element-in-scope-8>have an element in scope/a> that is an a href#html-elements idparsing-main-inbody:html-elements-9>HTML element/a> and whose tag name is one of h1, h2, h3, h4, h5, or h6, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-28>parse error/a>; ignore the token./p> p>Otherwise, run these steps:/p> ol>li>p>a href#generate-implied-end-tags idparsing-main-inbody:generate-implied-end-tags-10>Generate implied end tags/a>.li>p>If the a href#current-node idparsing-main-inbody:current-node-14>current node/a> is not an a href#html-elements idparsing-main-inbody:html-elements-10>HTML element/a> with the same tag name as that of the token, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-29>parse error/a>.li>p>Pop elements from the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-47>stack of open elements/a> until an a href#html-elements idparsing-main-inbody:html-elements-11>HTML element/a> whose tag name is one of h1, h2, h3, h4, h5, or h6 has been popped from the stack./ol> dt>An end tag whose tag name is sarcasmdd> p>Take a deep breath, then act as described in the any other end tag entry below./p> dt>A start tag whose tag name is add> p>If the a href#list-of-active-formatting-elements idparsing-main-inbody:list-of-active-formatting-elements>list of active formatting elements/a> contains an code idparsing-main-inbody:the-a-element>a href#the-a-element>a/a>/code> element between the end of the list and the last a href#concept-parser-marker idparsing-main-inbody:concept-parser-marker>marker/a> on the list (or the start of the list if there is no a href#concept-parser-marker idparsing-main-inbody:concept-parser-marker-2>marker/a> on the list), then this is a a href#parse-errors idparsing-main-inbody:parse-errors-30>parse error/a>; run the a href#adoption-agency-algorithm idparsing-main-inbody:adoption-agency-algorithm>adoption agency algorithm/a> for the token, then remove that element from the a href#list-of-active-formatting-elements idparsing-main-inbody:list-of-active-formatting-elements-2>list of active formatting elements/a> and the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-48>stack of open elements/a> if the a href#adoption-agency-algorithm idparsing-main-inbody:adoption-agency-algorithm-2>adoption agency algorithm/a> didnt already remove it (it might not have if the element is not a href#has-an-element-in-table-scope idparsing-main-inbody:has-an-element-in-table-scope>in table scope/a>)./p> p classexample>In the non-conforming stream code><a hrefa>a<table><a hrefb>b</table>x/code>, the first code idparsing-main-inbody:the-a-element-2>a href#the-a-element>a/a>/code> element would be closed upon seeing the second one, and the x character would be inside a link to b, not to a. This is despite the fact that the outer code idparsing-main-inbody:the-a-element-3>a href#the-a-element>a/a>/code> element is not in table scope (meaning that a regular code></a>/code> end tag at the start of the table wouldnt close the outer code idparsing-main-inbody:the-a-element-4>a href#the-a-element>a/a>/code> element). The result is that the two code idparsing-main-inbody:the-a-element-5>a href#the-a-element>a/a>/code> elements are indirectly nested inside each other — non-conforming markup will often result in non-conforming DOMs when parsed./p> p>a href#reconstruct-the-active-formatting-elements idparsing-main-inbody:reconstruct-the-active-formatting-elements-4>Reconstruct the active formatting elements/a>, if any./p> p>a href#insert-an-html-element idparsing-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 idparsing-main-inbody:push-onto-the-list-of-active-formatting-elements>Push onto the list of active formatting elements/a> that element./p> dt>A start tag whose tag name is one of: b, big, code, em, font, i, s, small, strike, strong, tt, udd> p>a href#reconstruct-the-active-formatting-elements idparsing-main-inbody:reconstruct-the-active-formatting-elements-5>Reconstruct the active formatting elements/a>, if any./p> p>a href#insert-an-html-element idparsing-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 idparsing-main-inbody:push-onto-the-list-of-active-formatting-elements-2>Push onto the list of active formatting elements/a> that element./p> dt>A start tag whose tag name is nobrdd> p>a href#reconstruct-the-active-formatting-elements idparsing-main-inbody:reconstruct-the-active-formatting-elements-6>Reconstruct the active formatting elements/a>, if any./p> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-49>stack of open elements/a> a href#has-an-element-in-scope idparsing-main-inbody:has-an-element-in-scope-9>has a code>nobr/code> element in scope/a>, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-31>parse error/a>; run the a href#adoption-agency-algorithm idparsing-main-inbody:adoption-agency-algorithm-3>adoption agency algorithm/a> for the token, then once again a href#reconstruct-the-active-formatting-elements idparsing-main-inbody:reconstruct-the-active-formatting-elements-7>reconstruct the active formatting elements/a>, if any./p> p>a href#insert-an-html-element idparsing-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 idparsing-main-inbody:push-onto-the-list-of-active-formatting-elements-3>Push onto the list of active formatting elements/a> that element./p> dt>An end tag whose tag name is one of: a, b, big, code, em, font, i, nobr, s, small, strike, strong, tt, udd> p>Run the a href#adoption-agency-algorithm idparsing-main-inbody:adoption-agency-algorithm-4>adoption agency algorithm/a> for the token./p> dt>A start tag whose tag name is one of: applet, marquee, objectdd> p>a href#reconstruct-the-active-formatting-elements idparsing-main-inbody:reconstruct-the-active-formatting-elements-8>Reconstruct the active formatting elements/a>, if any./p> p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-14>Insert an HTML element/a> for the token./p> p>Insert a a href#concept-parser-marker idparsing-main-inbody:concept-parser-marker-3>marker/a> at the end of the a href#list-of-active-formatting-elements idparsing-main-inbody:list-of-active-formatting-elements-3>list of active formatting elements/a>./p> p>Set the a href#frameset-ok-flag idparsing-main-inbody:frameset-ok-flag-8>frameset-ok flag/a> to not ok./p> dt>An end tag token whose tag name is one of: applet, marquee, objectdd> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-50>stack of open elements/a> does not a href#has-an-element-in-scope idparsing-main-inbody:has-an-element-in-scope-10>have an element in scope/a> that is an a href#html-elements idparsing-main-inbody:html-elements-12>HTML element/a> with the same tag name as that of the token, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-32>parse error/a>; ignore the token./p> p>Otherwise, run these steps:/p> ol>li>p>a href#generate-implied-end-tags idparsing-main-inbody:generate-implied-end-tags-11>Generate implied end tags/a>.li>p>If the a href#current-node idparsing-main-inbody:current-node-15>current node/a> is not an a href#html-elements idparsing-main-inbody:html-elements-13>HTML element/a> with the same tag name as that of the token, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-33>parse error/a>.li>p>Pop elements from the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-51>stack of open elements/a> until an a href#html-elements idparsing-main-inbody:html-elements-14>HTML element/a> with the same tag name as the token has been popped from the stack.li>a href#clear-the-list-of-active-formatting-elements-up-to-the-last-marker idparsing-main-inbody:clear-the-list-of-active-formatting-elements-up-to-the-last-marker>Clear the list of active formatting elements up to the last marker/a>./ol> dt>A start tag whose tag name is tabledd> p>If the code idparsing-main-inbody:document>a href#document>Document/a>/code> is em>not/em> set to a idparsing-main-inbody:quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>, and the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-52>stack of open elements/a> a href#has-an-element-in-button-scope idparsing-main-inbody:has-an-element-in-button-scope-9>has a code>p/code> element in button scope/a>, then a href#close-a-p-element idparsing-main-inbody:close-a-p-element-9>close a code>p/code> element/a>./p> p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-15>Insert an HTML element/a> for the token./p> p>Set the a href#frameset-ok-flag idparsing-main-inbody:frameset-ok-flag-9>frameset-ok flag/a> to not ok./p> p>Switch the a href#insertion-mode idparsing-main-inbody:insertion-mode-7>insertion mode/a> to a href#parsing-main-intable idparsing-main-inbody:parsing-main-intable>in table/a>./p> dt>An end tag whose tag name is brdd> p>a href#parse-errors idparsing-main-inbody:parse-errors-34>Parse error/a>. Drop the attributes from the token, and act as described in the next entry; i.e. act as if this was a br start tag token with no attributes, rather than the end tag token that it actually is./p> dt>A start tag whose tag name is one of: area, br, embed, img, keygen, wbrdd> p>a href#reconstruct-the-active-formatting-elements idparsing-main-inbody:reconstruct-the-active-formatting-elements-9>Reconstruct the active formatting elements/a>, if any./p> p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-16>Insert an HTML element/a> for the token. Immediately pop the a href#current-node idparsing-main-inbody:current-node-16>current node/a> off the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-53>stack of open elements/a>./p> p>a href#acknowledge-self-closing-flag idparsing-main-inbody:acknowledge-self-closing-flag>Acknowledge the tokens i>self-closing flag/i>/a>, if it is set./p> p>Set the a href#frameset-ok-flag idparsing-main-inbody:frameset-ok-flag-10>frameset-ok flag/a> to not ok./p> dt>A start tag whose tag name is inputdd> p>a href#reconstruct-the-active-formatting-elements idparsing-main-inbody:reconstruct-the-active-formatting-elements-10>Reconstruct the active formatting elements/a>, if any./p> p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-17>Insert an HTML element/a> for the token. Immediately pop the a href#current-node idparsing-main-inbody:current-node-17>current node/a> off the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-54>stack of open elements/a>./p> p>a href#acknowledge-self-closing-flag idparsing-main-inbody:acknowledge-self-closing-flag-2>Acknowledge the tokens i>self-closing flag/i>/a>, if it is set./p> p>If the token does not have an attribute with the name type, or if it does, but that attributes value is not an a idparsing-main-inbody:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>hidden/code>, then: set the a href#frameset-ok-flag idparsing-main-inbody:frameset-ok-flag-11>frameset-ok flag/a> to not ok./p> dt>A start tag whose tag name is one of: param, source, trackdd> p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-18>Insert an HTML element/a> for the token. Immediately pop the a href#current-node idparsing-main-inbody:current-node-18>current node/a> off the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-55>stack of open elements/a>./p> p>a href#acknowledge-self-closing-flag idparsing-main-inbody:acknowledge-self-closing-flag-3>Acknowledge the tokens i>self-closing flag/i>/a>, if it is set./p> dt>A start tag whose tag name is hrdd> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-56>stack of open elements/a> a href#has-an-element-in-button-scope idparsing-main-inbody:has-an-element-in-button-scope-10>has a code>p/code> element in button scope/a>, then a href#close-a-p-element idparsing-main-inbody:close-a-p-element-10>close a code>p/code> element/a>./p> p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-19>Insert an HTML element/a> for the token. Immediately pop the a href#current-node idparsing-main-inbody:current-node-19>current node/a> off the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-57>stack of open elements/a>./p> p>a href#acknowledge-self-closing-flag idparsing-main-inbody:acknowledge-self-closing-flag-4>Acknowledge the tokens i>self-closing flag/i>/a>, if it is set./p> p>Set the a href#frameset-ok-flag idparsing-main-inbody:frameset-ok-flag-12>frameset-ok flag/a> to not ok./p> dt>A start tag whose tag name is imagedd> p>a href#parse-errors idparsing-main-inbody:parse-errors-35>Parse error/a>. Change the tokens tag name to img and reprocess it. (Dont ask.)/p> dt>A start tag whose tag name is textareadd> p>Run these steps:/p> ol>li>p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-20>Insert an HTML element/a> for the token.li>p>If the a href#next-token idparsing-main-inbody:next-token-2>next token/a> is a U+000A LINE FEED (LF) character token, then ignore that token and move on to the next one. (Newlines at the start of code idparsing-main-inbody:the-textarea-element>a href#the-textarea-element>textarea/a>/code> elements are ignored as an authoring convenience.)li>p>Switch the tokenizer to the a href#rcdata-state idparsing-main-inbody:rcdata-state>RCDATA state/a>.li>p>Let the a href#original-insertion-mode idparsing-main-inbody:original-insertion-mode>original insertion mode/a> be the current a href#insertion-mode idparsing-main-inbody:insertion-mode-8>insertion mode/a>./p> li>p>Set the a href#frameset-ok-flag idparsing-main-inbody:frameset-ok-flag-13>frameset-ok flag/a> to not ok.li>p>Switch the a href#insertion-mode idparsing-main-inbody:insertion-mode-9>insertion mode/a> to a href#parsing-main-incdata idparsing-main-inbody:parsing-main-incdata>text/a>./ol> dt>A start tag whose tag name is xmpdd> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-58>stack of open elements/a> a href#has-an-element-in-button-scope idparsing-main-inbody:has-an-element-in-button-scope-11>has a code>p/code> element in button scope/a>, then a href#close-a-p-element idparsing-main-inbody:close-a-p-element-11>close a code>p/code> element/a>./p> p>a href#reconstruct-the-active-formatting-elements idparsing-main-inbody:reconstruct-the-active-formatting-elements-11>Reconstruct the active formatting elements/a>, if any./p> p>Set the a href#frameset-ok-flag idparsing-main-inbody:frameset-ok-flag-14>frameset-ok flag/a> to not ok./p> p>Follow the a href#generic-raw-text-element-parsing-algorithm idparsing-main-inbody:generic-raw-text-element-parsing-algorithm>generic raw text element parsing algorithm/a>./p> dt>A start tag whose tag name is iframedd> p>Set the a href#frameset-ok-flag idparsing-main-inbody:frameset-ok-flag-15>frameset-ok flag/a> to not ok./p> p>Follow the a href#generic-raw-text-element-parsing-algorithm idparsing-main-inbody:generic-raw-text-element-parsing-algorithm-2>generic raw text element parsing algorithm/a>./p> dt>A start tag whose tag name is noembeddt>A start tag whose tag name is noscript, if the a href#scripting-flag idparsing-main-inbody:scripting-flag>scripting flag/a> is enableddd> p>Follow the a href#generic-raw-text-element-parsing-algorithm idparsing-main-inbody:generic-raw-text-element-parsing-algorithm-3>generic raw text element parsing algorithm/a>./p> dt>A start tag whose tag name is selectdd> p>a href#reconstruct-the-active-formatting-elements idparsing-main-inbody:reconstruct-the-active-formatting-elements-12>Reconstruct the active formatting elements/a>, if any./p> p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-21>Insert an HTML element/a> for the token./p> p>Set the a href#frameset-ok-flag idparsing-main-inbody:frameset-ok-flag-16>frameset-ok flag/a> to not ok./p> p>If the a href#insertion-mode idparsing-main-inbody:insertion-mode-10>insertion mode/a> is one of a href#parsing-main-intable idparsing-main-inbody:parsing-main-intable-2>in table/a>, a href#parsing-main-incaption idparsing-main-inbody:parsing-main-incaption>in caption/a>, a href#parsing-main-intbody idparsing-main-inbody:parsing-main-intbody>in table body/a>, a href#parsing-main-intr idparsing-main-inbody:parsing-main-intr>in row/a>, or a href#parsing-main-intd idparsing-main-inbody:parsing-main-intd>in cell/a>, then switch the a href#insertion-mode idparsing-main-inbody:insertion-mode-11>insertion mode/a> to a href#parsing-main-inselectintable idparsing-main-inbody:parsing-main-inselectintable>in select in table/a>. Otherwise, switch the a href#insertion-mode idparsing-main-inbody:insertion-mode-12>insertion mode/a> to a href#parsing-main-inselect idparsing-main-inbody:parsing-main-inselect>in select/a>./p> dt>A start tag whose tag name is one of: optgroup, optiondd> p>If the a href#current-node idparsing-main-inbody:current-node-20>current node/a> is an code idparsing-main-inbody:the-option-element-4>a href#the-option-element>option/a>/code> element, then pop the a href#current-node idparsing-main-inbody:current-node-21>current node/a> off the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-59>stack of open elements/a>./p> p>a href#reconstruct-the-active-formatting-elements idparsing-main-inbody:reconstruct-the-active-formatting-elements-13>Reconstruct the active formatting elements/a>, if any./p> p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-22>Insert an HTML element/a> for the token./p> dt>A start tag whose tag name is one of: rb, rtcdd> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-60>stack of open elements/a> a href#has-an-element-in-scope idparsing-main-inbody:has-an-element-in-scope-11>has a code>ruby/code> element in scope/a>, then a href#generate-implied-end-tags idparsing-main-inbody:generate-implied-end-tags-12>generate implied end tags/a>. If the a href#current-node idparsing-main-inbody:current-node-22>current node/a> is not now a code idparsing-main-inbody:the-ruby-element>a href#the-ruby-element>ruby/a>/code> element, this is a a href#parse-errors idparsing-main-inbody:parse-errors-36>parse error/a>./p> p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-23>Insert an HTML element/a> for the token./p> dt>A start tag whose tag name is one of: rp, rtdd> p>If the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-61>stack of open elements/a> a href#has-an-element-in-scope idparsing-main-inbody:has-an-element-in-scope-12>has a code>ruby/code> element in scope/a>, then a href#generate-implied-end-tags idparsing-main-inbody:generate-implied-end-tags-13>generate implied end tags/a>, except for code idparsing-main-inbody:rtc-4>a href#rtc>rtc/a>/code> elements. If the a href#current-node idparsing-main-inbody:current-node-23>current node/a> is not now a code idparsing-main-inbody:rtc-5>a href#rtc>rtc/a>/code> element or a code idparsing-main-inbody:the-ruby-element-2>a href#the-ruby-element>ruby/a>/code> element, this is a a href#parse-errors idparsing-main-inbody:parse-errors-37>parse error/a>./p> p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-24>Insert an HTML element/a> for the token./p> dt>A start tag whose tag name is mathdd> p>a href#reconstruct-the-active-formatting-elements idparsing-main-inbody:reconstruct-the-active-formatting-elements-14>Reconstruct the active formatting elements/a>, if any./p> p>a href#adjust-mathml-attributes idparsing-main-inbody:adjust-mathml-attributes>Adjust MathML attributes/a> for the token. (This fixes the case of MathML attributes that are not all lowercase.)/p> p>a href#adjust-foreign-attributes idparsing-main-inbody:adjust-foreign-attributes>Adjust foreign attributes/a> for the token. (This fixes the use of namespaced attributes, in particular XLink.)/p> p>a href#insert-a-foreign-element idparsing-main-inbody:insert-a-foreign-element>Insert a foreign element/a> for the token, in the a idparsing-main-inbody:mathml-namespace hrefhttps://infra.spec.whatwg.org/#mathml-namespace data-x-internalmathml-namespace>MathML namespace/a>./p> p>If the token has its i idparsing-main-inbody:self-closing-flag>a href#self-closing-flag>self-closing flag/a>/i> set, pop the a href#current-node idparsing-main-inbody:current-node-24>current node/a> off the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-62>stack of open elements/a> and a href#acknowledge-self-closing-flag idparsing-main-inbody:acknowledge-self-closing-flag-5>acknowledge the tokens i>self-closing flag/i>/a>./p> dt>A start tag whose tag name is svgdd> p>a href#reconstruct-the-active-formatting-elements idparsing-main-inbody:reconstruct-the-active-formatting-elements-15>Reconstruct the active formatting elements/a>, if any./p> p>a href#adjust-svg-attributes idparsing-main-inbody:adjust-svg-attributes>Adjust SVG attributes/a> for the token. (This fixes the case of SVG attributes that are not all lowercase.)/p> p>a href#adjust-foreign-attributes idparsing-main-inbody:adjust-foreign-attributes-2>Adjust foreign attributes/a> for the token. (This fixes the use of namespaced attributes, in particular XLink in SVG.)/p> p>a href#insert-a-foreign-element idparsing-main-inbody:insert-a-foreign-element-2>Insert a foreign element/a> for the token, in the a idparsing-main-inbody:svg-namespace hrefhttps://infra.spec.whatwg.org/#svg-namespace data-x-internalsvg-namespace>SVG namespace/a>./p> p>If the token has its i idparsing-main-inbody:self-closing-flag-2>a href#self-closing-flag>self-closing flag/a>/i> set, pop the a href#current-node idparsing-main-inbody:current-node-25>current node/a> off the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-63>stack of open elements/a> and a href#acknowledge-self-closing-flag idparsing-main-inbody:acknowledge-self-closing-flag-6>acknowledge the tokens i>self-closing flag/i>/a>./p> dt>A start tag whose tag name is one of: caption, col, colgroup, frame, head, tbody, td, tfoot, th, thead, trdd> p>a href#parse-errors idparsing-main-inbody:parse-errors-38>Parse error/a>. Ignore the token./p> dt>Any other start tagdd> p>a href#reconstruct-the-active-formatting-elements idparsing-main-inbody:reconstruct-the-active-formatting-elements-16>Reconstruct the active formatting elements/a>, if any./p> p>a href#insert-an-html-element idparsing-main-inbody:insert-an-html-element-25>Insert an HTML element/a> for the token./p> p classnote>This element will be an a href#ordinary idparsing-main-inbody:ordinary>ordinary/a> element./p> dt>Any other end tagdd> p>Run these steps:/p> ol>li>p>Initialize var>node/var> to be the a href#current-node idparsing-main-inbody:current-node-26>current node/a> (the bottommost node of the stack).li>p>i>Loop/i>: If var>node/var> is an a href#html-elements idparsing-main-inbody:html-elements-15>HTML element/a> with the same tag name as the token, then:/p> ol>li>p>a href#generate-implied-end-tags idparsing-main-inbody:generate-implied-end-tags-14>Generate implied end tags/a>, except for a href#html-elements idparsing-main-inbody:html-elements-16>HTML elements/a> with the same tag name as the token.li>p>If var>node/var> is not the a href#current-node idparsing-main-inbody:current-node-27>current node/a>, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-39>parse error/a>.li>p>Pop all the nodes from the a href#current-node idparsing-main-inbody:current-node-28>current node/a> up to var>node/var>, including var>node/var>, then stop these steps./ol> li>p>Otherwise, if var>node/var> is in the a href#special idparsing-main-inbody:special-3>special/a> category, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-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 idparsing-main-inbody:stack-of-open-elements-64>stack of open elements/a>.li>p>Return to the step labeled i>loop/i>./ol> /dl> p>When the steps above say the user agent is to dfn idclose-a-p-element>close a code>p/code> element/dfn>, it means that the user agent must run the following steps:/p> ol>li>p>a href#generate-implied-end-tags idparsing-main-inbody:generate-implied-end-tags-15>Generate implied end tags/a>, except for code idparsing-main-inbody:the-p-element-6>a href#the-p-element>p/a>/code> elements.li>p>If the a href#current-node idparsing-main-inbody:current-node-29>current node/a> is not a code idparsing-main-inbody:the-p-element-7>a href#the-p-element>p/a>/code> element, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-41>parse error/a>.li>p>Pop elements from the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-65>stack of open elements/a> until a code idparsing-main-inbody:the-p-element-8>a href#the-p-element>p/a>/code> element has been popped from the stack./ol> p idadoptionAgency>The dfn idadoption-agency-algorithm>adoption agency algorithm/dfn>, which takes as its only argument a token var>token/var> for which the algorithm is being run, consists of the following steps:/p> ol>li>p>Let var>subject/var> be var>token/var>s tag name.li>p>If the a href#current-node idparsing-main-inbody:current-node-30>current node/a> is an a href#html-elements idparsing-main-inbody:html-elements-17>HTML element/a> whose tag name is var>subject/var>, and the a href#current-node idparsing-main-inbody:current-node-31>current node/a> is not in the a href#list-of-active-formatting-elements idparsing-main-inbody:list-of-active-formatting-elements-4>list of active formatting elements/a>, then pop the a href#current-node idparsing-main-inbody:current-node-32>current node/a> off the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-66>stack of open elements/a>, and abort these steps.li>p>Let var>outer loop counter/var> be zero.li>p>i>Outer loop/i>: If var>outer loop counter/var> is greater than or equal to eight, then abort these steps.li>p>Increment var>outer loop counter/var> by one.li> p>Let var>formatting element/var> be the last element in the a href#list-of-active-formatting-elements idparsing-main-inbody:list-of-active-formatting-elements-5>list of active formatting elements/a> that:/p> ul>li>is between the end of the list and the last a href#concept-parser-marker idparsing-main-inbody:concept-parser-marker-4>marker/a> in the list, if any, or the start of the list otherwise, andli>has the tag name var>subject/var>./ul> p>If there is no such element, then abort these steps and instead act as described in the any other end tag entry above./p> li>p>If var>formatting element/var> is not in the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-67>stack of open elements/a>, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-42>parse error/a>; remove the element from the list, and abort these steps.li>p>If var>formatting element/var> is in the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-68>stack of open elements/a>, but the element is not a href#has-an-element-in-scope idparsing-main-inbody:has-an-element-in-scope-13>in scope/a>, then this is a a href#parse-errors idparsing-main-inbody:parse-errors-43>parse error/a>; abort these steps.li>p>If var>formatting element/var> is not the a href#current-node idparsing-main-inbody:current-node-33>current node/a>, this is a a href#parse-errors idparsing-main-inbody:parse-errors-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 idparsing-main-inbody:stack-of-open-elements-69>stack of open elements/a> that is lower in the stack than var>formatting element/var>, and is an element in the a href#special idparsing-main-inbody:special-4>special/a> category. There might not be one.li>p>If there is no var>furthest block/var>, then the UA must first pop all the nodes from the bottom of the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-70>stack of open elements/a>, from the a href#current-node idparsing-main-inbody:current-node-34>current node/a> up to and including var>formatting element/var>, then remove var>formatting element/var> from the a href#list-of-active-formatting-elements idparsing-main-inbody:list-of-active-formatting-elements-6>list of active formatting elements/a>, and finally abort these steps.li>p>Let var>common ancestor/var> be the element immediately above var>formatting element/var> in the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-71>stack of open elements/a>.li>p>Let a bookmark note the position of var>formatting element/var> in the a href#list-of-active-formatting-elements idparsing-main-inbody:list-of-active-formatting-elements-7>list of active formatting elements/a> relative to the elements on either side of it in the list.li> p>Let var>node/var> and var>last node/var> be var>furthest block/var>. Follow these steps:/p> ol>li>p>Let var>inner loop counter/var> be zero.li>p>i>Inner loop/i>: Increment var>inner loop counter/var> by one.li>p>Let var>node/var> be the element immediately above var>node/var> in the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-72>stack of open elements/a>, or if var>node/var> is no longer in the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-73>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 idparsing-main-inbody:stack-of-open-elements-74>stack of open elements/a> before var>node/var> was removed.li>p>If var>node/var> is var>formatting element/var>, then go to the next step in the overall algorithm.li>p>If var>inner loop counter/var> is greater than three and var>node/var> is in the a href#list-of-active-formatting-elements idparsing-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 idparsing-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 idparsing-main-inbody:list-of-active-formatting-elements-10>list of active formatting elements/a>, then remove var>node/var> from the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-75>stack of open elements/a> and then go back to the step labeled i>inner loop/i>.li>p>a href#create-an-element-for-the-token idparsing-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 idparsing-main-inbody:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>, with var>common ancestor/var> as the intended parent; replace the entry for var>node/var> in the a href#list-of-active-formatting-elements idparsing-main-inbody:list-of-active-formatting-elements-11>list of active formatting elements/a> with an entry for the new element, replace the entry for var>node/var> in the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-76>stack of open elements/a> with an entry for the new element, and let var>node/var> be the new element.li>p>If var>last node/var> is var>furthest block/var>, then move the aforementioned bookmark to be immediately after the new var>node/var> in the a href#list-of-active-formatting-elements idparsing-main-inbody:list-of-active-formatting-elements-12>list of active formatting elements/a>.li>p>Insert var>last node/var> into var>node/var>, first removing it from its previous parent node if any.li>p>Let var>last node/var> be var>node/var>.li>p>Return to the step labeled i>inner loop/i>./ol> li>p>Insert whatever var>last node/var> ended up being in the previous step at the a href#appropriate-place-for-inserting-a-node idparsing-main-inbody:appropriate-place-for-inserting-a-node>appropriate place for inserting a node/a>, but using var>common ancestor/var> as the i>override target/i>.li>p>a href#create-an-element-for-the-token idparsing-main-inbody:create-an-element-for-the-token-2>Create an element for the token/a> for which var>formatting element/var> was created, in the a idparsing-main-inbody:html-namespace-2-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>, with var>furthest block/var> as the intended parent.li>p>Take all of the child nodes of var>furthest block/var> and append them to the element created in the last step.li>p>Append that new element to var>furthest block/var>.li>p>Remove var>formatting element/var> from the a href#list-of-active-formatting-elements idparsing-main-inbody:list-of-active-formatting-elements-13>list of active formatting elements/a>, and insert the new element into the a href#list-of-active-formatting-elements idparsing-main-inbody:list-of-active-formatting-elements-14>list of active formatting elements/a> at the position of the aforementioned bookmark.li>p>Remove var>formatting element/var> from the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-77>stack of open elements/a>, and insert the new element into the a href#stack-of-open-elements idparsing-main-inbody:stack-of-open-elements-78>stack of open elements/a> immediately below the position of var>furthest block/var> in that stack.li>p>Jump back to the step labeled i>outer loop/i>./ol> p classnote>This algorithms name, the adoption agency algorithm, comes from the way it causes elements to change parents, and is in contrast with other possible algorithms for dealing with misnested content, which included the incest algorithm, the secret affair algorithm, and the Heisenberg algorithm./p> h6 idparsing-main-incdata>span classsecno>12.2.6.4.8/span> The dfn>text/dfn> insertion modea href#parsing-main-incdata classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#parsing-main-incdata idparsing-main-incdata:parsing-main-incdata>text/a> a href#insertion-mode idparsing-main-incdata:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A character tokendd> p>a href#insert-a-character idparsing-main-incdata:insert-a-character>Insert the tokens character/a>./p> p classnote>This can never be a U+0000 NULL character; the tokenizer converts those to U+FFFD REPLACEMENT CHARACTER characters./p> dt>An end-of-file tokendd> p>a href#parse-errors idparsing-main-incdata:parse-errors>Parse error/a>./p> p>If the a href#current-node idparsing-main-incdata:current-node>current node/a> is a code idparsing-main-incdata:the-script-element>a href#the-script-element>script/a>/code> element, mark the code idparsing-main-incdata:the-script-element-2>a href#the-script-element>script/a>/code> element as a href#already-started idparsing-main-incdata:already-started>already started/a>./p> p>Pop the a href#current-node idparsing-main-incdata:current-node-2>current node/a> off the a href#stack-of-open-elements idparsing-main-incdata:stack-of-open-elements>stack of open elements/a>./p> p>Switch the a href#insertion-mode idparsing-main-incdata:insertion-mode-2>insertion mode/a> to the a href#original-insertion-mode idparsing-main-incdata:original-insertion-mode>original insertion mode/a> and reprocess the token./p> dt idscriptEndTag>An end tag whose tag name is scriptdd> p>If the a idparsing-main-incdata:javascript-execution-context-stack hrefhttps://tc39.github.io/ecma262/#execution-context-stack data-x-internaljavascript-execution-context-stack>JavaScript execution context stack/a> is empty, a href#perform-a-microtask-checkpoint idparsing-main-incdata:perform-a-microtask-checkpoint>perform a microtask checkpoint/a>./p> p>Let var>script/var> be the a href#current-node idparsing-main-incdata:current-node-3>current node/a> (which will be a code idparsing-main-incdata:the-script-element-3>a href#the-script-element>script/a>/code> element)./p> p>Pop the a href#current-node idparsing-main-incdata:current-node-4>current node/a> off the a href#stack-of-open-elements idparsing-main-incdata:stack-of-open-elements-2>stack of open elements/a>./p> p>Switch the a href#insertion-mode idparsing-main-incdata:insertion-mode-3>insertion mode/a> to the a href#original-insertion-mode idparsing-main-incdata:original-insertion-mode-2>original insertion mode/a>./p> p>Let the var>old insertion point/var> have the same value as the current a href#insertion-point idparsing-main-incdata:insertion-point>insertion point/a>. Let the a href#insertion-point idparsing-main-incdata:insertion-point-2>insertion point/a> be just before the a href#next-input-character idparsing-main-incdata:next-input-character>next input character/a>./p> p>Increment the parsers a href#script-nesting-level idparsing-main-incdata:script-nesting-level>script nesting level/a> by one./p> p>a href#prepare-a-script idparsing-main-incdata:prepare-a-script>Prepare/a> the var>script/var>. This might cause some script to execute, which might cause a href#dom-document-write idparsing-main-incdata:dom-document-write>new characters to be inserted into the tokenizer/a>, and might cause the tokenizer to output more tokens, resulting in a a href#nestedParsing>reentrant invocation of the parser/a>./p> p>Decrement the parsers a href#script-nesting-level idparsing-main-incdata:script-nesting-level-2>script nesting level/a> by one. If the parsers a href#script-nesting-level idparsing-main-incdata:script-nesting-level-3>script nesting level/a> is zero, then set the a href#parser-pause-flag idparsing-main-incdata:parser-pause-flag>parser pause flag/a> to false./p> p>Let the a href#insertion-point idparsing-main-incdata:insertion-point-3>insertion point/a> have the value of the var>old insertion point/var>. (In other words, restore the a href#insertion-point idparsing-main-incdata:insertion-point-4>insertion point/a> to its previous value. This value might be the undefined value.)/p> p idscriptTagParserResumes>At this stage, if there is a a href#pending-parsing-blocking-script idparsing-main-incdata:pending-parsing-blocking-script>pending parsing-blocking script/a>, then:/p> dl classswitch>dt>If the a href#script-nesting-level idparsing-main-incdata:script-nesting-level-4>script nesting level/a> is not zero:dd> p>Set the a href#parser-pause-flag idparsing-main-incdata:parser-pause-flag-2>parser pause flag/a> to true, and abort the processing of any nested invocations of the tokenizer, yielding control back to the caller. (Tokenization will resume when the caller returns to the outer tree construction stage.)/p> p classnote>The tree construction stage of this particular parser is a href#nestedParsing>being called reentrantly/a>, say from a call to code idparsing-main-incdata:dom-document-write-2>a href#dom-document-write>document.write()/a>/code>./p> dt>Otherwise:dd> p>Run these steps:/p> ol>li>p>Let var>the script/var> be the a href#pending-parsing-blocking-script idparsing-main-incdata:pending-parsing-blocking-script-2>pending parsing-blocking script/a>. There is no longer a a href#pending-parsing-blocking-script idparsing-main-incdata:pending-parsing-blocking-script-3>pending parsing-blocking script/a>.li>p>Block the a href#tokenization idparsing-main-incdata:tokenization>tokenizer/a> for this instance of the a href#html-parser idparsing-main-incdata:html-parser>HTML parser/a>, such that the a href#event-loop idparsing-main-incdata:event-loop>event loop/a> will not run a href#concept-task idparsing-main-incdata:concept-task>tasks/a> that invoke the a href#tokenization idparsing-main-incdata:tokenization-2>tokenizer/a>.li>p>If the parsers code idparsing-main-incdata:document>a href#document>Document/a>/code> a href#has-a-style-sheet-that-is-blocking-scripts idparsing-main-incdata:has-a-style-sheet-that-is-blocking-scripts>has a style sheet that is blocking scripts/a> or var>the script/var>s a href#ready-to-be-parser-executed idparsing-main-incdata:ready-to-be-parser-executed>ready to be parser-executed/a> flag is not set: a href#spin-the-event-loop idparsing-main-incdata:spin-the-event-loop>spin the event loop/a> until the parsers code idparsing-main-incdata:document-2>a href#document>Document/a>/code> a href#has-no-style-sheet-that-is-blocking-scripts idparsing-main-incdata:has-no-style-sheet-that-is-blocking-scripts>has no style sheet that is blocking scripts/a> and var>the script/var>s a href#ready-to-be-parser-executed idparsing-main-incdata:ready-to-be-parser-executed-2>ready to be parser-executed/a> flag is set.li> p>If this a href#abort-a-parser idparsing-main-incdata:abort-a-parser>parser has been aborted/a> in the meantime, abort these steps./p> p classnote>This could happen if, e.g., while the a href#spin-the-event-loop idparsing-main-incdata:spin-the-event-loop-2>spin the event loop/a> algorithm is running, the a href#browsing-context idparsing-main-incdata:browsing-context>browsing context/a> gets closed, or the code idparsing-main-incdata:dom-document-open>a href#dom-document-open>document.open()/a>/code> method gets invoked on the code idparsing-main-incdata:document-3>a href#document>Document/a>/code>./p> li>p>Unblock the a href#tokenization idparsing-main-incdata:tokenization-3>tokenizer/a> for this instance of the a href#html-parser idparsing-main-incdata:html-parser-2>HTML parser/a>, such that a href#concept-task idparsing-main-incdata:concept-task-2>tasks/a> that invoke the a href#tokenization idparsing-main-incdata:tokenization-4>tokenizer/a> can again be run.li>p>Let the a href#insertion-point idparsing-main-incdata:insertion-point-5>insertion point/a> be just before the a href#next-input-character idparsing-main-incdata:next-input-character-2>next input character/a>.li>p>Increment the parsers a href#script-nesting-level idparsing-main-incdata:script-nesting-level-5>script nesting level/a> by one (it should be zero before this step, so this sets it to one).li>p>a href#execute-the-script-block idparsing-main-incdata:execute-the-script-block>Execute/a> var>the script/var>.li>p>Decrement the parsers a href#script-nesting-level idparsing-main-incdata:script-nesting-level-6>script nesting level/a> by one. If the parsers a href#script-nesting-level idparsing-main-incdata:script-nesting-level-7>script nesting level/a> is zero (which it always should be at this point), then set the a href#parser-pause-flag idparsing-main-incdata:parser-pause-flag-3>parser pause flag/a> to false./p> li>p>Let the a href#insertion-point idparsing-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 idparsing-main-incdata:pending-parsing-blocking-script-4>pending parsing-blocking script/a>, then repeat these steps from step 1./ol> /dl> dt>Any other end tagdd> p>Pop the a href#current-node idparsing-main-incdata:current-node-5>current node/a> off the a href#stack-of-open-elements idparsing-main-incdata:stack-of-open-elements-3>stack of open elements/a>./p> p>Switch the a href#insertion-mode idparsing-main-incdata:insertion-mode-4>insertion mode/a> to the a href#original-insertion-mode idparsing-main-incdata:original-insertion-mode-3>original insertion mode/a>./p> /dl> h6 idparsing-main-intable>span classsecno>12.2.6.4.9/span> The dfn>in table/dfn> insertion modea href#parsing-main-intable classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#parsing-main-intable idparsing-main-intable:parsing-main-intable>in table/a> a href#insertion-mode idparsing-main-intable:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A character token, if the a href#current-node idparsing-main-intable:current-node>current node/a> is code idparsing-main-intable:the-table-element>a href#the-table-element>table/a>/code>, code idparsing-main-intable:the-tbody-element>a href#the-tbody-element>tbody/a>/code>, code idparsing-main-intable:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code>, code idparsing-main-intable:the-thead-element>a href#the-thead-element>thead/a>/code>, or code idparsing-main-intable:the-tr-element>a href#the-tr-element>tr/a>/code> elementdd> p>Let the dfn idconcept-pending-table-char-tokens>var>pending table character tokens/var>/dfn> be an empty list of tokens./p> p>Let the a href#original-insertion-mode idparsing-main-intable:original-insertion-mode>original insertion mode/a> be the current a href#insertion-mode idparsing-main-intable:insertion-mode-2>insertion mode/a>./p> p>Switch the a href#insertion-mode idparsing-main-intable:insertion-mode-3>insertion mode/a> to a href#parsing-main-intabletext idparsing-main-intable:parsing-main-intabletext>in table text/a> and reprocess the token./p> dt>A comment tokendd> p>a href#insert-a-comment idparsing-main-intable:insert-a-comment>Insert a comment/a>./p> dt>A DOCTYPE tokendd> p>a href#parse-errors idparsing-main-intable:parse-errors>Parse error/a>. Ignore the token./p> dt>A start tag whose tag name is captiondd> p>a href#clear-the-stack-back-to-a-table-context idparsing-main-intable:clear-the-stack-back-to-a-table-context>Clear the stack back to a table context/a>. (See below.)/p> p>Insert a a href#concept-parser-marker idparsing-main-intable:concept-parser-marker>marker/a> at the end of the a href#list-of-active-formatting-elements idparsing-main-intable:list-of-active-formatting-elements>list of active formatting elements/a>./p> p>a href#insert-an-html-element idparsing-main-intable:insert-an-html-element>Insert an HTML element/a> for the token, then switch the a href#insertion-mode idparsing-main-intable:insertion-mode-4>insertion mode/a> to a href#parsing-main-incaption idparsing-main-intable:parsing-main-incaption>in caption/a>./p> dt>A start tag whose tag name is colgroupdd> p>a href#clear-the-stack-back-to-a-table-context idparsing-main-intable:clear-the-stack-back-to-a-table-context-2>Clear the stack back to a table context/a>. (See below.)/p> p>a href#insert-an-html-element idparsing-main-intable:insert-an-html-element-2>Insert an HTML element/a> for the token, then switch the a href#insertion-mode idparsing-main-intable:insertion-mode-5>insertion mode/a> to a href#parsing-main-incolgroup idparsing-main-intable:parsing-main-incolgroup>in column group/a>./p> dt>A start tag whose tag name is coldd> p>a href#clear-the-stack-back-to-a-table-context idparsing-main-intable:clear-the-stack-back-to-a-table-context-3>Clear the stack back to a table context/a>. (See below.)/p> p>a href#insert-an-html-element idparsing-main-intable:insert-an-html-element-3>Insert an HTML element/a> for a colgroup start tag token with no attributes, then switch the a href#insertion-mode idparsing-main-intable:insertion-mode-6>insertion mode/a> to a href#parsing-main-incolgroup idparsing-main-intable:parsing-main-incolgroup-2>in column group/a>./p> p>Reprocess the current token./p> dt>A start tag whose tag name is one of: tbody, tfoot, theaddd> p>a href#clear-the-stack-back-to-a-table-context idparsing-main-intable:clear-the-stack-back-to-a-table-context-4>Clear the stack back to a table context/a>. (See below.)/p> p>a href#insert-an-html-element idparsing-main-intable:insert-an-html-element-4>Insert an HTML element/a> for the token, then switch the a href#insertion-mode idparsing-main-intable:insertion-mode-7>insertion mode/a> to a href#parsing-main-intbody idparsing-main-intable:parsing-main-intbody>in table body/a>./p> dt>A start tag whose tag name is one of: td, th, trdd> p>a href#clear-the-stack-back-to-a-table-context idparsing-main-intable:clear-the-stack-back-to-a-table-context-5>Clear the stack back to a table context/a>. (See below.)/p> p>a href#insert-an-html-element idparsing-main-intable:insert-an-html-element-5>Insert an HTML element/a> for a tbody start tag token with no attributes, then switch the a href#insertion-mode idparsing-main-intable:insertion-mode-8>insertion mode/a> to a href#parsing-main-intbody idparsing-main-intable:parsing-main-intbody-2>in table body/a>./p> p>Reprocess the current token./p> dt>A start tag whose tag name is tabledd> p>a href#parse-errors idparsing-main-intable:parse-errors-2>Parse error/a>./p> p>If the a href#stack-of-open-elements idparsing-main-intable:stack-of-open-elements>stack of open elements/a> does not a href#has-an-element-in-table-scope idparsing-main-intable:has-an-element-in-table-scope>have a code>table/code> element in table scope/a>, ignore the token./p> p>Otherwise:/p> p>Pop elements from this stack until a code idparsing-main-intable:the-table-element-2>a href#the-table-element>table/a>/code> element has been popped from the stack./p> p>a href#reset-the-insertion-mode-appropriately idparsing-main-intable:reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately/a>./p> p>Reprocess the token./p> dt>An end tag whose tag name is tabledd> p>If the a href#stack-of-open-elements idparsing-main-intable:stack-of-open-elements-2>stack of open elements/a> does not a href#has-an-element-in-table-scope idparsing-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-errors idparsing-main-intable:parse-errors-3>parse error/a>; ignore the token./p> p>Otherwise:/p> p>Pop elements from this stack until a code idparsing-main-intable:the-table-element-3>a href#the-table-element>table/a>/code> element has been popped from the stack./p> p>a href#reset-the-insertion-mode-appropriately idparsing-main-intable:reset-the-insertion-mode-appropriately-2>Reset the insertion mode appropriately/a>./p> dt>An end tag whose tag name is one of: body, caption, col, colgroup, html, tbody, td, tfoot, th, thead, trdd> p>a href#parse-errors idparsing-main-intable:parse-errors-4>Parse error/a>. Ignore the token./p> dt>A start tag whose tag name is one of: style, script, templatedt>An end tag whose tag name is templatedd> p>Process the token a href#using-the-rules-for idparsing-main-intable:using-the-rules-for>using the rules for/a> the a href#parsing-main-inhead idparsing-main-intable:parsing-main-inhead>in head/a> a href#insertion-mode idparsing-main-intable:insertion-mode-9>insertion mode/a>./p> dt>A start tag whose tag name is inputdd> p>If the token does not have an attribute with the name type, or if it does, but that attributes value is not an a idparsing-main-intable:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>hidden/code>, then: act as described in the anything else entry below./p> p>Otherwise:/p> p>a href#parse-errors idparsing-main-intable:parse-errors-5>Parse error/a>./p> p>a href#insert-an-html-element idparsing-main-intable:insert-an-html-element-6>Insert an HTML element/a> for the token./p> p>Pop that code idparsing-main-intable:the-input-element>a href#the-input-element>input/a>/code> element off the a href#stack-of-open-elements idparsing-main-intable:stack-of-open-elements-3>stack of open elements/a>./p> p>a href#acknowledge-self-closing-flag idparsing-main-intable:acknowledge-self-closing-flag>Acknowledge the tokens i>self-closing flag/i>/a>, if it is set./p> dt>A start tag whose tag name is formdd> p>a href#parse-errors idparsing-main-intable:parse-errors-6>Parse error/a>./p> p>If there is a code idparsing-main-intable:the-template-element>a href#the-template-element>template/a>/code> element on the a href#stack-of-open-elements idparsing-main-intable:stack-of-open-elements-4>stack of open elements/a>, or if the a href#form-element-pointer idparsing-main-intable:form-element-pointer>code>form/code> element pointer/a> is not null, ignore the token./p> p>Otherwise:/p> p>a href#insert-an-html-element idparsing-main-intable:insert-an-html-element-7>Insert an HTML element/a> for the token, and set the a href#form-element-pointer idparsing-main-intable:form-element-pointer-2>code>form/code> element pointer/a> to point to the element created./p> p>Pop that code idparsing-main-intable:the-form-element>a href#the-form-element>form/a>/code> element off the a href#stack-of-open-elements idparsing-main-intable:stack-of-open-elements-5>stack of open elements/a>./p> dt>An end-of-file tokendd> p>Process the token a href#using-the-rules-for idparsing-main-intable:using-the-rules-for-2>using the rules for/a> the a href#parsing-main-inbody idparsing-main-intable:parsing-main-inbody>in body/a> a href#insertion-mode idparsing-main-intable:insertion-mode-10>insertion mode/a>./p> dt>Anything elsedd> p>a href#parse-errors idparsing-main-intable:parse-errors-7>Parse error/a>. Enable a href#foster-parent idparsing-main-intable:foster-parent>foster parenting/a>, process the token a href#using-the-rules-for idparsing-main-intable:using-the-rules-for-3>using the rules for/a> the a href#parsing-main-inbody idparsing-main-intable:parsing-main-inbody-2>in body/a> a href#insertion-mode idparsing-main-intable:insertion-mode-11>insertion mode/a>, and then disable a href#foster-parent idparsing-main-intable:foster-parent-2>foster parenting/a>./p> /dl> p>When the steps above require the UA to dfn idclear-the-stack-back-to-a-table-context>clear the stack back to a table context/dfn>, it means that the UA must, while the a href#current-node idparsing-main-intable:current-node-2>current node/a> is not a code idparsing-main-intable:the-table-element-4>a href#the-table-element>table/a>/code>, code idparsing-main-intable:the-template-element-2>a href#the-template-element>template/a>/code>, or code idparsing-main-intable:the-html-element>a href#the-html-element>html/a>/code> element, pop elements from the a href#stack-of-open-elements idparsing-main-intable:stack-of-open-elements-6>stack of open elements/a>./p> p classnote>This is the same list of elements as used in the i idparsing-main-intable:has-an-element-in-table-scope-3>a href#has-an-element-in-table-scope>has an element in table scope/a>/i> steps./p> p classnote>The a href#current-node idparsing-main-intable:current-node-3>current node/a> being an code idparsing-main-intable:the-html-element-2>a href#the-html-element>html/a>/code> element after this process is a a href#fragment-case idparsing-main-intable:fragment-case>fragment case/a>./p> h6 idparsing-main-intabletext>span classsecno>12.2.6.4.10/span> The dfn>in table text/dfn> insertion modea href#parsing-main-intabletext classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#parsing-main-intabletext idparsing-main-intabletext:parsing-main-intabletext>in table text/a> a href#insertion-mode idparsing-main-intabletext:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A character token that is U+0000 NULLdd> p>a href#parse-errors idparsing-main-intabletext:parse-errors>Parse error/a>. Ignore the token./p> dt>Any other character tokendd> p>Append the character token to the var idparsing-main-intabletext:concept-pending-table-char-tokens>a href#concept-pending-table-char-tokens>pending table character tokens/a>/var> list./p> dt>Anything elsedd> p>If any of the tokens in the var idparsing-main-intabletext:concept-pending-table-char-tokens-2>a href#concept-pending-table-char-tokens>pending table character tokens/a>/var> list are character tokens that are not a idparsing-main-intabletext:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a>, then this is a a href#parse-errors idparsing-main-intabletext:parse-errors-2>parse error/a>: reprocess the character tokens in the var idparsing-main-intabletext:concept-pending-table-char-tokens-3>a href#concept-pending-table-char-tokens>pending table character tokens/a>/var> list using the rules given in the anything else entry in the a href#parsing-main-intable idparsing-main-intabletext:parsing-main-intable>in table/a> insertion mode./p> p>Otherwise, a href#insert-a-character idparsing-main-intabletext:insert-a-character>insert the characters/a> given by the var idparsing-main-intabletext:concept-pending-table-char-tokens-4>a href#concept-pending-table-char-tokens>pending table character tokens/a>/var> list./p> p>Switch the a href#insertion-mode idparsing-main-intabletext:insertion-mode-2>insertion mode/a> to the a href#original-insertion-mode idparsing-main-intabletext:original-insertion-mode>original insertion mode/a> and reprocess the token./p> /dl> h6 idparsing-main-incaption>span classsecno>12.2.6.4.11/span> The dfn>in caption/dfn> insertion modea href#parsing-main-incaption classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#parsing-main-incaption idparsing-main-incaption:parsing-main-incaption>in caption/a> a href#insertion-mode idparsing-main-incaption:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>An end tag whose tag name is captiondd> p>If the a href#stack-of-open-elements idparsing-main-incaption:stack-of-open-elements>stack of open elements/a> does not a href#has-an-element-in-table-scope idparsing-main-incaption:has-an-element-in-table-scope>have a code>caption/code> element in table scope/a>, this is a a href#parse-errors idparsing-main-incaption:parse-errors>parse error/a>; ignore the token. (a href#fragment-case idparsing-main-incaption:fragment-case>fragment case/a>)/p> p>Otherwise:/p> p>a href#generate-implied-end-tags idparsing-main-incaption:generate-implied-end-tags>Generate implied end tags/a>./p> p>Now, if the a href#current-node idparsing-main-incaption:current-node>current node/a> is not a code idparsing-main-incaption:the-caption-element>a href#the-caption-element>caption/a>/code> element, then this is a a href#parse-errors idparsing-main-incaption:parse-errors-2>parse error/a>./p> p>Pop elements from this stack until a code idparsing-main-incaption:the-caption-element-2>a href#the-caption-element>caption/a>/code> element has been popped from the stack./p> p>a href#clear-the-list-of-active-formatting-elements-up-to-the-last-marker idparsing-main-incaption:clear-the-list-of-active-formatting-elements-up-to-the-last-marker>Clear the list of active formatting elements up to the last marker/a>./p> p>Switch the a href#insertion-mode idparsing-main-incaption:insertion-mode-2>insertion mode/a> to a href#parsing-main-intable idparsing-main-incaption:parsing-main-intable>in table/a>./p> dt>A start tag whose tag name is one of: caption, col, colgroup, tbody, td, tfoot, th, thead, trdt>An end tag whose tag name is tabledd> p>If the a href#stack-of-open-elements idparsing-main-incaption:stack-of-open-elements-2>stack of open elements/a> does not a href#has-an-element-in-table-scope idparsing-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-errors idparsing-main-incaption:parse-errors-3>parse error/a>; ignore the token. (a href#fragment-case idparsing-main-incaption:fragment-case-2>fragment case/a>)/p> p>Otherwise:/p> p>a href#generate-implied-end-tags idparsing-main-incaption:generate-implied-end-tags-2>Generate implied end tags/a>./p> p>Now, if the a href#current-node idparsing-main-incaption:current-node-2>current node/a> is not a code idparsing-main-incaption:the-caption-element-3>a href#the-caption-element>caption/a>/code> element, then this is a a href#parse-errors idparsing-main-incaption:parse-errors-4>parse error/a>./p> p>Pop elements from this stack until a code idparsing-main-incaption:the-caption-element-4>a href#the-caption-element>caption/a>/code> element has been popped from the stack./p> p>a href#clear-the-list-of-active-formatting-elements-up-to-the-last-marker idparsing-main-incaption:clear-the-list-of-active-formatting-elements-up-to-the-last-marker-2>Clear the list of active formatting elements up to the last marker/a>./p> p>Switch the a href#insertion-mode idparsing-main-incaption:insertion-mode-3>insertion mode/a> to a href#parsing-main-intable idparsing-main-incaption:parsing-main-intable-2>in table/a>./p> p>Reprocess the token./p> dt>An end tag whose tag name is one of: body, col, colgroup, html, tbody, td, tfoot, th, thead, trdd> p>a href#parse-errors idparsing-main-incaption:parse-errors-5>Parse error/a>. Ignore the token./p> dt>Anything elsedd> p>Process the token a href#using-the-rules-for idparsing-main-incaption:using-the-rules-for>using the rules for/a> the a href#parsing-main-inbody idparsing-main-incaption:parsing-main-inbody>in body/a> a href#insertion-mode idparsing-main-incaption:insertion-mode-4>insertion mode/a>./p> /dl> h6 idparsing-main-incolgroup>span classsecno>12.2.6.4.12/span> The dfn>in column group/dfn> insertion modea href#parsing-main-incolgroup classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#parsing-main-incolgroup idparsing-main-incolgroup:parsing-main-incolgroup>in column group/a> a href#insertion-mode idparsing-main-incolgroup:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACEdd> p>a href#insert-a-character idparsing-main-incolgroup:insert-a-character>Insert the character/a>./p> dt>A comment tokendd> p>a href#insert-a-comment idparsing-main-incolgroup:insert-a-comment>Insert a comment/a>./p> dt>A DOCTYPE tokendd> p>a href#parse-errors idparsing-main-incolgroup:parse-errors>Parse error/a>. Ignore the token./p> dt>A start tag whose tag name is htmldd> p>Process the token a href#using-the-rules-for idparsing-main-incolgroup:using-the-rules-for>using the rules for/a> the a href#parsing-main-inbody idparsing-main-incolgroup:parsing-main-inbody>in body/a> a href#insertion-mode idparsing-main-incolgroup:insertion-mode-2>insertion mode/a>./p> dt>A start tag whose tag name is coldd> p>a href#insert-an-html-element idparsing-main-incolgroup:insert-an-html-element>Insert an HTML element/a> for the token. Immediately pop the a href#current-node idparsing-main-incolgroup:current-node>current node/a> off the a href#stack-of-open-elements idparsing-main-incolgroup:stack-of-open-elements>stack of open elements/a>./p> p>a href#acknowledge-self-closing-flag idparsing-main-incolgroup:acknowledge-self-closing-flag>Acknowledge the tokens i>self-closing flag/i>/a>, if it is set./p> dt>An end tag whose tag name is colgroupdd> p>If the a href#current-node idparsing-main-incolgroup:current-node-2>current node/a> is not a code idparsing-main-incolgroup:the-colgroup-element>a href#the-colgroup-element>colgroup/a>/code> element, then this is a a href#parse-errors idparsing-main-incolgroup:parse-errors-2>parse error/a>; ignore the token./p> p>Otherwise, pop the a href#current-node idparsing-main-incolgroup:current-node-3>current node/a> from the a href#stack-of-open-elements idparsing-main-incolgroup:stack-of-open-elements-2>stack of open elements/a>. Switch the a href#insertion-mode idparsing-main-incolgroup:insertion-mode-3>insertion mode/a> to a href#parsing-main-intable idparsing-main-incolgroup:parsing-main-intable>in table/a>./p> dt>An end tag whose tag name is coldd> p>a href#parse-errors idparsing-main-incolgroup:parse-errors-3>Parse error/a>. Ignore the token./p> dt>A start tag whose tag name is templatedt>An end tag whose tag name is templatedd> p>Process the token a href#using-the-rules-for idparsing-main-incolgroup:using-the-rules-for-2>using the rules for/a> the a href#parsing-main-inhead idparsing-main-incolgroup:parsing-main-inhead>in head/a> a href#insertion-mode idparsing-main-incolgroup:insertion-mode-4>insertion mode/a>./p> dt>An end-of-file tokendd> p>Process the token a href#using-the-rules-for idparsing-main-incolgroup:using-the-rules-for-3>using the rules for/a> the a href#parsing-main-inbody idparsing-main-incolgroup:parsing-main-inbody-2>in body/a> a href#insertion-mode idparsing-main-incolgroup:insertion-mode-5>insertion mode/a>./p> dt>Anything elsedd> p>If the a href#current-node idparsing-main-incolgroup:current-node-4>current node/a> is not a code idparsing-main-incolgroup:the-colgroup-element-2>a href#the-colgroup-element>colgroup/a>/code> element, then this is a a href#parse-errors idparsing-main-incolgroup:parse-errors-4>parse error/a>; ignore the token./p> p>Otherwise, pop the a href#current-node idparsing-main-incolgroup:current-node-5>current node/a> from the a href#stack-of-open-elements idparsing-main-incolgroup:stack-of-open-elements-3>stack of open elements/a>./p> p>Switch the a href#insertion-mode idparsing-main-incolgroup:insertion-mode-6>insertion mode/a> to a href#parsing-main-intable idparsing-main-incolgroup:parsing-main-intable-2>in table/a>./p> p>Reprocess the token./p> /dl> h6 idparsing-main-intbody>span classsecno>12.2.6.4.13/span> The dfn>in table body/dfn> insertion modea href#parsing-main-intbody classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#parsing-main-intbody idparsing-main-intbody:parsing-main-intbody>in table body/a> a href#insertion-mode idparsing-main-intbody:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A start tag whose tag name is trdd> p>a href#clear-the-stack-back-to-a-table-body-context idparsing-main-intbody:clear-the-stack-back-to-a-table-body-context>Clear the stack back to a table body context/a>. (See below.)/p> p>a href#insert-an-html-element idparsing-main-intbody:insert-an-html-element>Insert an HTML element/a> for the token, then switch the a href#insertion-mode idparsing-main-intbody:insertion-mode-2>insertion mode/a> to a href#parsing-main-intr idparsing-main-intbody:parsing-main-intr>in row/a>./p> dt>A start tag whose tag name is one of: th, tddd> p>a href#parse-errors idparsing-main-intbody:parse-errors>Parse error/a>./p> p>a href#clear-the-stack-back-to-a-table-body-context idparsing-main-intbody:clear-the-stack-back-to-a-table-body-context-2>Clear the stack back to a table body context/a>. (See below.)/p> p>a href#insert-an-html-element idparsing-main-intbody:insert-an-html-element-2>Insert an HTML element/a> for a tr start tag token with no attributes, then switch the a href#insertion-mode idparsing-main-intbody:insertion-mode-3>insertion mode/a> to a href#parsing-main-intr idparsing-main-intbody:parsing-main-intr-2>in row/a>./p> p>Reprocess the current token./p> dt>An end tag whose tag name is one of: tbody, tfoot, theaddd> p>If the a href#stack-of-open-elements idparsing-main-intbody:stack-of-open-elements>stack of open elements/a> does not a href#has-an-element-in-table-scope idparsing-main-intbody:has-an-element-in-table-scope>have an element in table scope/a> that is an a href#html-elements idparsing-main-intbody:html-elements>HTML element/a> with the same tag name as the token, this is a a href#parse-errors idparsing-main-intbody:parse-errors-2>parse error/a>; ignore the token./p> p>Otherwise:/p> p>a href#clear-the-stack-back-to-a-table-body-context idparsing-main-intbody:clear-the-stack-back-to-a-table-body-context-3>Clear the stack back to a table body context/a>. (See below.)/p> p>Pop the a href#current-node idparsing-main-intbody:current-node>current node/a> from the a href#stack-of-open-elements idparsing-main-intbody:stack-of-open-elements-2>stack of open elements/a>. Switch the a href#insertion-mode idparsing-main-intbody:insertion-mode-4>insertion mode/a> to a href#parsing-main-intable idparsing-main-intbody:parsing-main-intable>in table/a>./p> dt>A start tag whose tag name is one of: caption, col, colgroup, tbody, tfoot, theaddt>An end tag whose tag name is tabledd> p>If the a href#stack-of-open-elements idparsing-main-intbody:stack-of-open-elements-3>stack of open elements/a> does not a href#has-an-element-in-table-scope idparsing-main-intbody:has-an-element-in-table-scope-2>have a code>tbody/code>, code>thead/code>, or code>tfoot/code> element in table scope/a>, this is a a href#parse-errors idparsing-main-intbody:parse-errors-3>parse error/a>; ignore the token./p> p>Otherwise:/p> p>a href#clear-the-stack-back-to-a-table-body-context idparsing-main-intbody:clear-the-stack-back-to-a-table-body-context-4>Clear the stack back to a table body context/a>. (See below.)/p> p>Pop the a href#current-node idparsing-main-intbody:current-node-2>current node/a> from the a href#stack-of-open-elements idparsing-main-intbody:stack-of-open-elements-4>stack of open elements/a>. Switch the a href#insertion-mode idparsing-main-intbody:insertion-mode-5>insertion mode/a> to a href#parsing-main-intable idparsing-main-intbody:parsing-main-intable-2>in table/a>./p> p>Reprocess the token./p> dt>An end tag whose tag name is one of: body, caption, col, colgroup, html, td, th, trdd> p>a href#parse-errors idparsing-main-intbody:parse-errors-4>Parse error/a>. Ignore the token./p> dt>Anything elsedd> p>Process the token a href#using-the-rules-for idparsing-main-intbody:using-the-rules-for>using the rules for/a> the a href#parsing-main-intable idparsing-main-intbody:parsing-main-intable-3>in table/a> a href#insertion-mode idparsing-main-intbody:insertion-mode-6>insertion mode/a>./p> /dl> p>When the steps above require the UA to dfn idclear-the-stack-back-to-a-table-body-context>clear the stack back to a table body context/dfn>, it means that the UA must, while the a href#current-node idparsing-main-intbody:current-node-3>current node/a> is not a code idparsing-main-intbody:the-tbody-element>a href#the-tbody-element>tbody/a>/code>, code idparsing-main-intbody:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code>, code idparsing-main-intbody:the-thead-element>a href#the-thead-element>thead/a>/code>, code idparsing-main-intbody:the-template-element>a href#the-template-element>template/a>/code>, or code idparsing-main-intbody:the-html-element>a href#the-html-element>html/a>/code> element, pop elements from the a href#stack-of-open-elements idparsing-main-intbody:stack-of-open-elements-5>stack of open elements/a>./p> p classnote>The a href#current-node idparsing-main-intbody:current-node-4>current node/a> being an code idparsing-main-intbody:the-html-element-2>a href#the-html-element>html/a>/code> element after this process is a a href#fragment-case idparsing-main-intbody:fragment-case>fragment case/a>./p> h6 idparsing-main-intr>span classsecno>12.2.6.4.14/span> The dfn>in row/dfn> insertion modea href#parsing-main-intr classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#parsing-main-intr idparsing-main-intr:parsing-main-intr>in row/a> a href#insertion-mode idparsing-main-intr:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A start tag whose tag name is one of: th, tddd> p>a href#clear-the-stack-back-to-a-table-row-context idparsing-main-intr:clear-the-stack-back-to-a-table-row-context>Clear the stack back to a table row context/a>. (See below.)/p> p>a href#insert-an-html-element idparsing-main-intr:insert-an-html-element>Insert an HTML element/a> for the token, then switch the a href#insertion-mode idparsing-main-intr:insertion-mode-2>insertion mode/a> to a href#parsing-main-intd idparsing-main-intr:parsing-main-intd>in cell/a>./p> p>Insert a a href#concept-parser-marker idparsing-main-intr:concept-parser-marker>marker/a> at the end of the a href#list-of-active-formatting-elements idparsing-main-intr:list-of-active-formatting-elements>list of active formatting elements/a>./p> dt>An end tag whose tag name is trdd> p>If the a href#stack-of-open-elements idparsing-main-intr:stack-of-open-elements>stack of open elements/a> does not a href#has-an-element-in-table-scope idparsing-main-intr:has-an-element-in-table-scope>have a code>tr/code> element in table scope/a>, this is a a href#parse-errors idparsing-main-intr:parse-errors>parse error/a>; ignore the token./p> p>Otherwise:/p> p>a href#clear-the-stack-back-to-a-table-row-context idparsing-main-intr:clear-the-stack-back-to-a-table-row-context-2>Clear the stack back to a table row context/a>. (See below.)/p> p>Pop the a href#current-node idparsing-main-intr:current-node>current node/a> (which will be a code idparsing-main-intr:the-tr-element>a href#the-tr-element>tr/a>/code> element) from the a href#stack-of-open-elements idparsing-main-intr:stack-of-open-elements-2>stack of open elements/a>. Switch the a href#insertion-mode idparsing-main-intr:insertion-mode-3>insertion mode/a> to a href#parsing-main-intbody idparsing-main-intr:parsing-main-intbody>in table body/a>./p> dt>A start tag whose tag name is one of: caption, col, colgroup, tbody, tfoot, thead, trdt>An end tag whose tag name is tabledd> p>If the a href#stack-of-open-elements idparsing-main-intr:stack-of-open-elements-3>stack of open elements/a> does not a href#has-an-element-in-table-scope idparsing-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-errors idparsing-main-intr:parse-errors-2>parse error/a>; ignore the token./p> p>Otherwise:/p> p>a href#clear-the-stack-back-to-a-table-row-context idparsing-main-intr:clear-the-stack-back-to-a-table-row-context-3>Clear the stack back to a table row context/a>. (See below.)/p> p>Pop the a href#current-node idparsing-main-intr:current-node-2>current node/a> (which will be a code idparsing-main-intr:the-tr-element-2>a href#the-tr-element>tr/a>/code> element) from the a href#stack-of-open-elements idparsing-main-intr:stack-of-open-elements-4>stack of open elements/a>. Switch the a href#insertion-mode idparsing-main-intr:insertion-mode-4>insertion mode/a> to a href#parsing-main-intbody idparsing-main-intr:parsing-main-intbody-2>in table body/a>./p> p>Reprocess the token./p> dt>An end tag whose tag name is one of: tbody, tfoot, theaddd> p>If the a href#stack-of-open-elements idparsing-main-intr:stack-of-open-elements-5>stack of open elements/a> does not a href#has-an-element-in-table-scope idparsing-main-intr:has-an-element-in-table-scope-3>have an element in table scope/a> that is an a href#html-elements idparsing-main-intr:html-elements>HTML element/a> with the same tag name as the token, this is a a href#parse-errors idparsing-main-intr:parse-errors-3>parse error/a>; ignore the token./p> p>If the a href#stack-of-open-elements idparsing-main-intr:stack-of-open-elements-6>stack of open elements/a> does not a href#has-an-element-in-table-scope idparsing-main-intr:has-an-element-in-table-scope-4>have a code>tr/code> element in table scope/a>, ignore the token./p> p>Otherwise:/p> p>a href#clear-the-stack-back-to-a-table-row-context idparsing-main-intr:clear-the-stack-back-to-a-table-row-context-4>Clear the stack back to a table row context/a>. (See below.)/p> p>Pop the a href#current-node idparsing-main-intr:current-node-3>current node/a> (which will be a code idparsing-main-intr:the-tr-element-3>a href#the-tr-element>tr/a>/code> element) from the a href#stack-of-open-elements idparsing-main-intr:stack-of-open-elements-7>stack of open elements/a>. Switch the a href#insertion-mode idparsing-main-intr:insertion-mode-5>insertion mode/a> to a href#parsing-main-intbody idparsing-main-intr:parsing-main-intbody-3>in table body/a>./p> p>Reprocess the token./p> dt>An end tag whose tag name is one of: body, caption, col, colgroup, html, td, thdd> p>a href#parse-errors idparsing-main-intr:parse-errors-4>Parse error/a>. Ignore the token./p> dt>Anything elsedd> p>Process the token a href#using-the-rules-for idparsing-main-intr:using-the-rules-for>using the rules for/a> the a href#parsing-main-intable idparsing-main-intr:parsing-main-intable>in table/a> a href#insertion-mode idparsing-main-intr:insertion-mode-6>insertion mode/a>./p> /dl> p>When the steps above require the UA to dfn idclear-the-stack-back-to-a-table-row-context>clear the stack back to a table row context/dfn>, it means that the UA must, while the a href#current-node idparsing-main-intr:current-node-4>current node/a> is not a code idparsing-main-intr:the-tr-element-4>a href#the-tr-element>tr/a>/code>, code idparsing-main-intr:the-template-element>a href#the-template-element>template/a>/code>, or code idparsing-main-intr:the-html-element>a href#the-html-element>html/a>/code> element, pop elements from the a href#stack-of-open-elements idparsing-main-intr:stack-of-open-elements-8>stack of open elements/a>./p> p classnote>The a href#current-node idparsing-main-intr:current-node-5>current node/a> being an code idparsing-main-intr:the-html-element-2>a href#the-html-element>html/a>/code> element after this process is a a href#fragment-case idparsing-main-intr:fragment-case>fragment case/a>./p> h6 idparsing-main-intd>span classsecno>12.2.6.4.15/span> The dfn>in cell/dfn> insertion modea href#parsing-main-intd classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#parsing-main-intd idparsing-main-intd:parsing-main-intd>in cell/a> a href#insertion-mode idparsing-main-intd:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>An end tag whose tag name is one of: td, thdd> p>If the a href#stack-of-open-elements idparsing-main-intd:stack-of-open-elements>stack of open elements/a> does not a href#has-an-element-in-table-scope idparsing-main-intd:has-an-element-in-table-scope>have an element in table scope/a> that is an a href#html-elements idparsing-main-intd:html-elements>HTML element/a> with the same tag name as that of the token, then this is a a href#parse-errors idparsing-main-intd:parse-errors>parse error/a>; ignore the token./p> p>Otherwise:/p> p>a href#generate-implied-end-tags idparsing-main-intd:generate-implied-end-tags>Generate implied end tags/a>./p> p>Now, if the a href#current-node idparsing-main-intd:current-node>current node/a> is not an a href#html-elements idparsing-main-intd:html-elements-2>HTML element/a> with the same tag name as the token, then this is a a href#parse-errors idparsing-main-intd:parse-errors-2>parse error/a>./p> p>Pop elements from the a href#stack-of-open-elements idparsing-main-intd:stack-of-open-elements-2>stack of open elements/a> stack until an a href#html-elements idparsing-main-intd:html-elements-3>HTML element/a> with the same tag name as the token has been popped from the stack./p> p>a href#clear-the-list-of-active-formatting-elements-up-to-the-last-marker idparsing-main-intd:clear-the-list-of-active-formatting-elements-up-to-the-last-marker>Clear the list of active formatting elements up to the last marker/a>./p> p>Switch the a href#insertion-mode idparsing-main-intd:insertion-mode-2>insertion mode/a> to a href#parsing-main-intr idparsing-main-intd:parsing-main-intr>in row/a>./p> dt>A start tag whose tag name is one of: caption, col, colgroup, tbody, td, tfoot, th, thead, trdd> p>If the a href#stack-of-open-elements idparsing-main-intd:stack-of-open-elements-3>stack of open elements/a> does em>not/em> a href#has-an-element-in-table-scope idparsing-main-intd:has-an-element-in-table-scope-2>have a code>td/code> or code>th/code> element in table scope/a>, then this is a a href#parse-errors idparsing-main-intd:parse-errors-3>parse error/a>; ignore the token. (a href#fragment-case idparsing-main-intd:fragment-case>fragment case/a>)/p> p>Otherwise, a href#close-the-cell idparsing-main-intd:close-the-cell>close the cell/a> (see below) and reprocess the token./p> dt>An end tag whose tag name is one of: body, caption, col, colgroup, htmldd> p>a href#parse-errors idparsing-main-intd:parse-errors-4>Parse error/a>. Ignore the token./p> dt>An end tag whose tag name is one of: table, tbody, tfoot, thead, trdd> p>If the a href#stack-of-open-elements idparsing-main-intd:stack-of-open-elements-4>stack of open elements/a> does not a href#has-an-element-in-table-scope idparsing-main-intd:has-an-element-in-table-scope-3>have an element in table scope/a> that is an a href#html-elements idparsing-main-intd:html-elements-4>HTML element/a> with the same tag name as that of the token, then this is a a href#parse-errors idparsing-main-intd:parse-errors-5>parse error/a>; ignore the token./p> p>Otherwise, a href#close-the-cell idparsing-main-intd:close-the-cell-2>close the cell/a> (see below) and reprocess the token./p> dt>Anything elsedd> p>Process the token a href#using-the-rules-for idparsing-main-intd:using-the-rules-for>using the rules for/a> the a href#parsing-main-inbody idparsing-main-intd:parsing-main-inbody>in body/a> a href#insertion-mode idparsing-main-intd:insertion-mode-3>insertion mode/a>./p> /dl> p>Where the steps above say to dfn idclose-the-cell>close the cell/dfn>, they mean to run the following algorithm:/p> ol>li>p>a href#generate-implied-end-tags idparsing-main-intd:generate-implied-end-tags-2>Generate implied end tags/a>.li>p>If the a href#current-node idparsing-main-intd:current-node-2>current node/a> is not now a code idparsing-main-intd:the-td-element>a href#the-td-element>td/a>/code> element or a code idparsing-main-intd:the-th-element>a href#the-th-element>th/a>/code> element, then this is a a href#parse-errors idparsing-main-intd:parse-errors-6>parse error/a>.li>p>Pop elements from the a href#stack-of-open-elements idparsing-main-intd:stack-of-open-elements-5>stack of open elements/a> stack until a code idparsing-main-intd:the-td-element-2>a href#the-td-element>td/a>/code> element or a code idparsing-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 idparsing-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 idparsing-main-intd:insertion-mode-4>insertion mode/a> to a href#parsing-main-intr idparsing-main-intd:parsing-main-intr-2>in row/a>./ol> p classnote>The a href#stack-of-open-elements idparsing-main-intd:stack-of-open-elements-6>stack of open elements/a> cannot have both a code idparsing-main-intd:the-td-element-3>a href#the-td-element>td/a>/code> and a code idparsing-main-intd:the-th-element-3>a href#the-th-element>th/a>/code> element a href#has-an-element-in-table-scope idparsing-main-intd:has-an-element-in-table-scope-4>in table scope/a> at the same time, nor can it have neither when the a href#close-the-cell idparsing-main-intd:close-the-cell-3>close the cell/a> algorithm is invoked./p> h6 idparsing-main-inselect>span classsecno>12.2.6.4.16/span> The dfn>in select/dfn> insertion modea href#parsing-main-inselect classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#parsing-main-inselect idparsing-main-inselect:parsing-main-inselect>in select/a> a href#insertion-mode idparsing-main-inselect:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A character token that is U+0000 NULLdd> p>a href#parse-errors idparsing-main-inselect:parse-errors>Parse error/a>. Ignore the token./p> dt>Any other character tokendd> p>a href#insert-a-character idparsing-main-inselect:insert-a-character>Insert the tokens character/a>./p> dt>A comment tokendd> p>a href#insert-a-comment idparsing-main-inselect:insert-a-comment>Insert a comment/a>./p> dt>A DOCTYPE tokendd> p>a href#parse-errors idparsing-main-inselect:parse-errors-2>Parse error/a>. Ignore the token./p> dt>A start tag whose tag name is htmldd> p>Process the token a href#using-the-rules-for idparsing-main-inselect:using-the-rules-for>using the rules for/a> the a href#parsing-main-inbody idparsing-main-inselect:parsing-main-inbody>in body/a> a href#insertion-mode idparsing-main-inselect:insertion-mode-2>insertion mode/a>./p> dt>A start tag whose tag name is optiondd> p>If the a href#current-node idparsing-main-inselect:current-node>current node/a> is an code idparsing-main-inselect:the-option-element>a href#the-option-element>option/a>/code> element, pop that node from the a href#stack-of-open-elements idparsing-main-inselect:stack-of-open-elements>stack of open elements/a>./p> p>a href#insert-an-html-element idparsing-main-inselect:insert-an-html-element>Insert an HTML element/a> for the token./p> dt>A start tag whose tag name is optgroupdd> p>If the a href#current-node idparsing-main-inselect:current-node-2>current node/a> is an code idparsing-main-inselect:the-option-element-2>a href#the-option-element>option/a>/code> element, pop that node from the a href#stack-of-open-elements idparsing-main-inselect:stack-of-open-elements-2>stack of open elements/a>./p> p>If the a href#current-node idparsing-main-inselect:current-node-3>current node/a> is an code idparsing-main-inselect:the-optgroup-element>a href#the-optgroup-element>optgroup/a>/code> element, pop that node from the a href#stack-of-open-elements idparsing-main-inselect:stack-of-open-elements-3>stack of open elements/a>./p> p>a href#insert-an-html-element idparsing-main-inselect:insert-an-html-element-2>Insert an HTML element/a> for the token./p> dt>An end tag whose tag name is optgroupdd> p>First, if the a href#current-node idparsing-main-inselect:current-node-4>current node/a> is an code idparsing-main-inselect:the-option-element-3>a href#the-option-element>option/a>/code> element, and the node immediately before it in the a href#stack-of-open-elements idparsing-main-inselect:stack-of-open-elements-4>stack of open elements/a> is an code idparsing-main-inselect:the-optgroup-element-2>a href#the-optgroup-element>optgroup/a>/code> element, then pop the a href#current-node idparsing-main-inselect:current-node-5>current node/a> from the a href#stack-of-open-elements idparsing-main-inselect:stack-of-open-elements-5>stack of open elements/a>./p> p>If the a href#current-node idparsing-main-inselect:current-node-6>current node/a> is an code idparsing-main-inselect:the-optgroup-element-3>a href#the-optgroup-element>optgroup/a>/code> element, then pop that node from the a href#stack-of-open-elements idparsing-main-inselect:stack-of-open-elements-6>stack of open elements/a>. Otherwise, this is a a href#parse-errors idparsing-main-inselect:parse-errors-3>parse error/a>; ignore the token./p> dt>An end tag whose tag name is optiondd> p>If the a href#current-node idparsing-main-inselect:current-node-7>current node/a> is an code idparsing-main-inselect:the-option-element-4>a href#the-option-element>option/a>/code> element, then pop that node from the a href#stack-of-open-elements idparsing-main-inselect:stack-of-open-elements-7>stack of open elements/a>. Otherwise, this is a a href#parse-errors idparsing-main-inselect:parse-errors-4>parse error/a>; ignore the token./p> dt>An end tag whose tag name is selectdd> p>If the a href#stack-of-open-elements idparsing-main-inselect:stack-of-open-elements-8>stack of open elements/a> does not a href#has-an-element-in-select-scope idparsing-main-inselect:has-an-element-in-select-scope>have a code>select/code> element in select scope/a>, this is a a href#parse-errors idparsing-main-inselect:parse-errors-5>parse error/a>; ignore the token. (a href#fragment-case idparsing-main-inselect:fragment-case>fragment case/a>)/p> p>Otherwise:/p> p>Pop elements from the a href#stack-of-open-elements idparsing-main-inselect:stack-of-open-elements-9>stack of open elements/a> until a code idparsing-main-inselect:the-select-element>a href#the-select-element>select/a>/code> element has been popped from the stack./p> p>a href#reset-the-insertion-mode-appropriately idparsing-main-inselect:reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately/a>./p> dt>A start tag whose tag name is selectdd> p>a href#parse-errors idparsing-main-inselect:parse-errors-6>Parse error/a>./p> p>If the a href#stack-of-open-elements idparsing-main-inselect:stack-of-open-elements-10>stack of open elements/a> does not a href#has-an-element-in-select-scope idparsing-main-inselect:has-an-element-in-select-scope-2>have a code>select/code> element in select scope/a>, ignore the token. (a href#fragment-case idparsing-main-inselect:fragment-case-2>fragment case/a>)/p> p>Otherwise:/p> p>Pop elements from the a href#stack-of-open-elements idparsing-main-inselect:stack-of-open-elements-11>stack of open elements/a> until a code idparsing-main-inselect:the-select-element-2>a href#the-select-element>select/a>/code> element has been popped from the stack./p> p>a href#reset-the-insertion-mode-appropriately idparsing-main-inselect:reset-the-insertion-mode-appropriately-2>Reset the insertion mode appropriately/a>./p> p classnote>It just gets treated like an end tag./p> dt>A start tag whose tag name is one of: input, keygen, textareadd> p>a href#parse-errors idparsing-main-inselect:parse-errors-7>Parse error/a>./p> p>If the a href#stack-of-open-elements idparsing-main-inselect:stack-of-open-elements-12>stack of open elements/a> does not a href#has-an-element-in-select-scope idparsing-main-inselect:has-an-element-in-select-scope-3>have a code>select/code> element in select scope/a>, ignore the token. (a href#fragment-case idparsing-main-inselect:fragment-case-3>fragment case/a>)/p> p>Otherwise:/p> p>Pop elements from the a href#stack-of-open-elements idparsing-main-inselect:stack-of-open-elements-13>stack of open elements/a> until a code idparsing-main-inselect:the-select-element-3>a href#the-select-element>select/a>/code> element has been popped from the stack./p> p>a href#reset-the-insertion-mode-appropriately idparsing-main-inselect:reset-the-insertion-mode-appropriately-3>Reset the insertion mode appropriately/a>./p> p>Reprocess the token./p> dt>A start tag whose tag name is one of: script, templatedt>An end tag whose tag name is templatedd> p>Process the token a href#using-the-rules-for idparsing-main-inselect:using-the-rules-for-2>using the rules for/a> the a href#parsing-main-inhead idparsing-main-inselect:parsing-main-inhead>in head/a> a href#insertion-mode idparsing-main-inselect:insertion-mode-3>insertion mode/a>./p> dt>An end-of-file tokendd> p>Process the token a href#using-the-rules-for idparsing-main-inselect:using-the-rules-for-3>using the rules for/a> the a href#parsing-main-inbody idparsing-main-inselect:parsing-main-inbody-2>in body/a> a href#insertion-mode idparsing-main-inselect:insertion-mode-4>insertion mode/a>./p> dt>Anything elsedd> p>a href#parse-errors idparsing-main-inselect:parse-errors-8>Parse error/a>. Ignore the token./p> /dl> h6 idparsing-main-inselectintable>span classsecno>12.2.6.4.17/span> The dfn>in select in table/dfn> insertion modea href#parsing-main-inselectintable classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#parsing-main-inselectintable idparsing-main-inselectintable:parsing-main-inselectintable>in select in table/a> a href#insertion-mode idparsing-main-inselectintable:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A start tag whose tag name is one of: caption, table, tbody, tfoot, thead, tr, td, thdd> p>a href#parse-errors idparsing-main-inselectintable:parse-errors>Parse error/a>./p> p>Pop elements from the a href#stack-of-open-elements idparsing-main-inselectintable:stack-of-open-elements>stack of open elements/a> until a code idparsing-main-inselectintable:the-select-element>a href#the-select-element>select/a>/code> element has been popped from the stack./p> p>a href#reset-the-insertion-mode-appropriately idparsing-main-inselectintable:reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately/a>./p> p>Reprocess the token./p> dt>An end tag whose tag name is one of: caption, table, tbody, tfoot, thead, tr, td, thdd> p>a href#parse-errors idparsing-main-inselectintable:parse-errors-2>Parse error/a>./p> p>If the a href#stack-of-open-elements idparsing-main-inselectintable:stack-of-open-elements-2>stack of open elements/a> does not a href#has-an-element-in-table-scope idparsing-main-inselectintable:has-an-element-in-table-scope>have an element in table scope/a> that is an a href#html-elements idparsing-main-inselectintable:html-elements>HTML element/a> with the same tag name as that of the token, then ignore the token./p> p>Otherwise:/p> p>Pop elements from the a href#stack-of-open-elements idparsing-main-inselectintable:stack-of-open-elements-3>stack of open elements/a> until a code idparsing-main-inselectintable:the-select-element-2>a href#the-select-element>select/a>/code> element has been popped from the stack./p> p>a href#reset-the-insertion-mode-appropriately idparsing-main-inselectintable:reset-the-insertion-mode-appropriately-2>Reset the insertion mode appropriately/a>./p> p>Reprocess the token./p> dt>Anything elsedd> p>Process the token a href#using-the-rules-for idparsing-main-inselectintable:using-the-rules-for>using the rules for/a> the a href#parsing-main-inselect idparsing-main-inselectintable:parsing-main-inselect>in select/a> a href#insertion-mode idparsing-main-inselectintable:insertion-mode-2>insertion mode/a>./p> /dl> h6 idparsing-main-intemplate>span classsecno>12.2.6.4.18/span> The dfn>in template/dfn> insertion modea href#parsing-main-intemplate classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#parsing-main-intemplate idparsing-main-intemplate:parsing-main-intemplate>in template/a> a href#insertion-mode idparsing-main-intemplate:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A character tokendt>A comment tokendt>A DOCTYPE tokendd> p>Process the token a href#using-the-rules-for idparsing-main-intemplate:using-the-rules-for>using the rules for/a> the a href#parsing-main-inbody idparsing-main-intemplate:parsing-main-inbody>in body/a> a href#insertion-mode idparsing-main-intemplate:insertion-mode-2>insertion mode/a>./p> dt>A start tag whose tag name is one of: base, basefont, bgsound, link, meta, noframes, script, style, template, titledt>An end tag whose tag name is templatedd> p>Process the token a href#using-the-rules-for idparsing-main-intemplate:using-the-rules-for-2>using the rules for/a> the a href#parsing-main-inhead idparsing-main-intemplate:parsing-main-inhead>in head/a> a href#insertion-mode idparsing-main-intemplate:insertion-mode-3>insertion mode/a>./p> dt>A start tag whose tag name is one of: caption, colgroup, tbody, tfoot, theaddd> p>Pop the a href#current-template-insertion-mode idparsing-main-intemplate:current-template-insertion-mode>current template insertion mode/a> off the a href#stack-of-template-insertion-modes idparsing-main-intemplate:stack-of-template-insertion-modes>stack of template insertion modes/a>./p> p>Push a href#parsing-main-intable idparsing-main-intemplate:parsing-main-intable>in table/a> onto the a href#stack-of-template-insertion-modes idparsing-main-intemplate:stack-of-template-insertion-modes-2>stack of template insertion modes/a> so that it is the new a href#current-template-insertion-mode idparsing-main-intemplate:current-template-insertion-mode-2>current template insertion mode/a>./p> p>Switch the a href#insertion-mode idparsing-main-intemplate:insertion-mode-4>insertion mode/a> to a href#parsing-main-intable idparsing-main-intemplate:parsing-main-intable-2>in table/a>, and reprocess the token./p> dt>A start tag whose tag name is coldd> p>Pop the a href#current-template-insertion-mode idparsing-main-intemplate:current-template-insertion-mode-3>current template insertion mode/a> off the a href#stack-of-template-insertion-modes idparsing-main-intemplate:stack-of-template-insertion-modes-3>stack of template insertion modes/a>./p> p>Push a href#parsing-main-incolgroup idparsing-main-intemplate:parsing-main-incolgroup>in column group/a> onto the a href#stack-of-template-insertion-modes idparsing-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 idparsing-main-intemplate:current-template-insertion-mode-4>current template insertion mode/a>./p> p>Switch the a href#insertion-mode idparsing-main-intemplate:insertion-mode-5>insertion mode/a> to a href#parsing-main-incolgroup idparsing-main-intemplate:parsing-main-incolgroup-2>in column group/a>, and reprocess the token./p> dt>A start tag whose tag name is trdd> p>Pop the a href#current-template-insertion-mode idparsing-main-intemplate:current-template-insertion-mode-5>current template insertion mode/a> off the a href#stack-of-template-insertion-modes idparsing-main-intemplate:stack-of-template-insertion-modes-5>stack of template insertion modes/a>./p> p>Push a href#parsing-main-intbody idparsing-main-intemplate:parsing-main-intbody>in table body/a> onto the a href#stack-of-template-insertion-modes idparsing-main-intemplate:stack-of-template-insertion-modes-6>stack of template insertion modes/a> so that it is the new a href#current-template-insertion-mode idparsing-main-intemplate:current-template-insertion-mode-6>current template insertion mode/a>./p> p>Switch the a href#insertion-mode idparsing-main-intemplate:insertion-mode-6>insertion mode/a> to a href#parsing-main-intbody idparsing-main-intemplate:parsing-main-intbody-2>in table body/a>, and reprocess the token./p> dt>A start tag whose tag name is one of: td, thdd> p>Pop the a href#current-template-insertion-mode idparsing-main-intemplate:current-template-insertion-mode-7>current template insertion mode/a> off the a href#stack-of-template-insertion-modes idparsing-main-intemplate:stack-of-template-insertion-modes-7>stack of template insertion modes/a>./p> p>Push a href#parsing-main-intr idparsing-main-intemplate:parsing-main-intr>in row/a> onto the a href#stack-of-template-insertion-modes idparsing-main-intemplate:stack-of-template-insertion-modes-8>stack of template insertion modes/a> so that it is the new a href#current-template-insertion-mode idparsing-main-intemplate:current-template-insertion-mode-8>current template insertion mode/a>./p> p>Switch the a href#insertion-mode idparsing-main-intemplate:insertion-mode-7>insertion mode/a> to a href#parsing-main-intr idparsing-main-intemplate:parsing-main-intr-2>in row/a>, and reprocess the token./p> dt>Any other start tagdd> p>Pop the a href#current-template-insertion-mode idparsing-main-intemplate:current-template-insertion-mode-9>current template insertion mode/a> off the a href#stack-of-template-insertion-modes idparsing-main-intemplate:stack-of-template-insertion-modes-9>stack of template insertion modes/a>./p> p>Push a href#parsing-main-inbody idparsing-main-intemplate:parsing-main-inbody-2>in body/a> onto the a href#stack-of-template-insertion-modes idparsing-main-intemplate:stack-of-template-insertion-modes-10>stack of template insertion modes/a> so that it is the new a href#current-template-insertion-mode idparsing-main-intemplate:current-template-insertion-mode-10>current template insertion mode/a>./p> p>Switch the a href#insertion-mode idparsing-main-intemplate:insertion-mode-8>insertion mode/a> to a href#parsing-main-inbody idparsing-main-intemplate:parsing-main-inbody-3>in body/a>, and reprocess the token./p> dt>Any other end tagdd> p>a href#parse-errors idparsing-main-intemplate:parse-errors>Parse error/a>. Ignore the token./p> dt>An end-of-file tokendd> p>If there is no code idparsing-main-intemplate:the-template-element>a href#the-template-element>template/a>/code> element on the a href#stack-of-open-elements idparsing-main-intemplate:stack-of-open-elements>stack of open elements/a>, then a href#stop-parsing idparsing-main-intemplate:stop-parsing>stop parsing/a>. (a href#fragment-case idparsing-main-intemplate:fragment-case>fragment case/a>)/p> p>Otherwise, this is a a href#parse-errors idparsing-main-intemplate:parse-errors-2>parse error/a>./p> p>Pop elements from the a href#stack-of-open-elements idparsing-main-intemplate:stack-of-open-elements-2>stack of open elements/a> until a code idparsing-main-intemplate:the-template-element-2>a href#the-template-element>template/a>/code> element has been popped from the stack./p> p>a href#clear-the-list-of-active-formatting-elements-up-to-the-last-marker idparsing-main-intemplate:clear-the-list-of-active-formatting-elements-up-to-the-last-marker>Clear the list of active formatting elements up to the last marker/a>./p> p>Pop the a href#current-template-insertion-mode idparsing-main-intemplate:current-template-insertion-mode-11>current template insertion mode/a> off the a href#stack-of-template-insertion-modes idparsing-main-intemplate:stack-of-template-insertion-modes-11>stack of template insertion modes/a>./p> p>a href#reset-the-insertion-mode-appropriately idparsing-main-intemplate:reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately/a>./p> p>Reprocess the token./p> /dl> h6 idparsing-main-afterbody>span classsecno>12.2.6.4.19/span> The dfn>after body/dfn> insertion modea href#parsing-main-afterbody classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#parsing-main-afterbody idparsing-main-afterbody:parsing-main-afterbody>after body/a> a href#insertion-mode idparsing-main-afterbody:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACEdd> p>Process the token a href#using-the-rules-for idparsing-main-afterbody:using-the-rules-for>using the rules for/a> the a href#parsing-main-inbody idparsing-main-afterbody:parsing-main-inbody>in body/a> a href#insertion-mode idparsing-main-afterbody:insertion-mode-2>insertion mode/a>./p> dt>A comment tokendd> p>a href#insert-a-comment idparsing-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 idparsing-main-afterbody:stack-of-open-elements>stack of open elements/a> (the code idparsing-main-afterbody:the-html-element>a href#the-html-element>html/a>/code> element)./p> dt>A DOCTYPE tokendd> p>a href#parse-errors idparsing-main-afterbody:parse-errors>Parse error/a>. Ignore the token./p> dt>A start tag whose tag name is htmldd> p>Process the token a href#using-the-rules-for idparsing-main-afterbody:using-the-rules-for-2>using the rules for/a> the a href#parsing-main-inbody idparsing-main-afterbody:parsing-main-inbody-2>in body/a> a href#insertion-mode idparsing-main-afterbody:insertion-mode-3>insertion mode/a>./p> dt>An end tag whose tag name is htmldd> p>If the parser was originally created as part of the a href#html-fragment-parsing-algorithm idparsing-main-afterbody:html-fragment-parsing-algorithm>HTML fragment parsing algorithm/a>, this is a a href#parse-errors idparsing-main-afterbody:parse-errors-2>parse error/a>; ignore the token. (a href#fragment-case idparsing-main-afterbody:fragment-case>fragment case/a>)/p> p>Otherwise, switch the a href#insertion-mode idparsing-main-afterbody:insertion-mode-4>insertion mode/a> to a href#the-after-after-body-insertion-mode idparsing-main-afterbody:the-after-after-body-insertion-mode>after after body/a>./p> dt>An end-of-file tokendd> p>a href#stop-parsing idparsing-main-afterbody:stop-parsing>Stop parsing/a>./p> dt>Anything elsedd> p>a href#parse-errors idparsing-main-afterbody:parse-errors-3>Parse error/a>. Switch the a href#insertion-mode idparsing-main-afterbody:insertion-mode-5>insertion mode/a> to a href#parsing-main-inbody idparsing-main-afterbody:parsing-main-inbody-3>in body/a> and reprocess the token./p> /dl> h6 idparsing-main-inframeset>span classsecno>12.2.6.4.20/span> The dfn>in frameset/dfn> insertion modea href#parsing-main-inframeset classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#parsing-main-inframeset idparsing-main-inframeset:parsing-main-inframeset>in frameset/a> a href#insertion-mode idparsing-main-inframeset:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACEdd> p>a href#insert-a-character idparsing-main-inframeset:insert-a-character>Insert the character/a>./p> dt>A comment tokendd> p>a href#insert-a-comment idparsing-main-inframeset:insert-a-comment>Insert a comment/a>./p> dt>A DOCTYPE tokendd> p>a href#parse-errors idparsing-main-inframeset:parse-errors>Parse error/a>. Ignore the token./p> dt>A start tag whose tag name is htmldd> p>Process the token a href#using-the-rules-for idparsing-main-inframeset:using-the-rules-for>using the rules for/a> the a href#parsing-main-inbody idparsing-main-inframeset:parsing-main-inbody>in body/a> a href#insertion-mode idparsing-main-inframeset:insertion-mode-2>insertion mode/a>./p> dt>A start tag whose tag name is framesetdd> p>a href#insert-an-html-element idparsing-main-inframeset:insert-an-html-element>Insert an HTML element/a> for the token./p> dt>An end tag whose tag name is framesetdd> p>If the a href#current-node idparsing-main-inframeset:current-node>current node/a> is the root code idparsing-main-inframeset:the-html-element>a href#the-html-element>html/a>/code> element, then this is a a href#parse-errors idparsing-main-inframeset:parse-errors-2>parse error/a>; ignore the token. (a href#fragment-case idparsing-main-inframeset:fragment-case>fragment case/a>)/p> p>Otherwise, pop the a href#current-node idparsing-main-inframeset:current-node-2>current node/a> from the a href#stack-of-open-elements idparsing-main-inframeset:stack-of-open-elements>stack of open elements/a>./p> p>If the parser was em>not/em> originally created as part of the a href#html-fragment-parsing-algorithm idparsing-main-inframeset:html-fragment-parsing-algorithm>HTML fragment parsing algorithm/a> (a href#fragment-case idparsing-main-inframeset:fragment-case-2>fragment case/a>), and the a href#current-node idparsing-main-inframeset:current-node-3>current node/a> is no longer a code idparsing-main-inframeset:frameset>a href#frameset>frameset/a>/code> element, then switch the a href#insertion-mode idparsing-main-inframeset:insertion-mode-3>insertion mode/a> to a href#parsing-main-afterframeset idparsing-main-inframeset:parsing-main-afterframeset>after frameset/a>./p> dt>A start tag whose tag name is framedd> p>a href#insert-an-html-element idparsing-main-inframeset:insert-an-html-element-2>Insert an HTML element/a> for the token. Immediately pop the a href#current-node idparsing-main-inframeset:current-node-4>current node/a> off the a href#stack-of-open-elements idparsing-main-inframeset:stack-of-open-elements-2>stack of open elements/a>./p> p>a href#acknowledge-self-closing-flag idparsing-main-inframeset:acknowledge-self-closing-flag>Acknowledge the tokens i>self-closing flag/i>/a>, if it is set./p> dt>A start tag whose tag name is noframesdd> p>Process the token a href#using-the-rules-for idparsing-main-inframeset:using-the-rules-for-2>using the rules for/a> the a href#parsing-main-inhead idparsing-main-inframeset:parsing-main-inhead>in head/a> a href#insertion-mode idparsing-main-inframeset:insertion-mode-4>insertion mode/a>./p> dt>An end-of-file tokendd> p>If the a href#current-node idparsing-main-inframeset:current-node-5>current node/a> is not the root code idparsing-main-inframeset:the-html-element-2>a href#the-html-element>html/a>/code> element, then this is a a href#parse-errors idparsing-main-inframeset:parse-errors-3>parse error/a>./p> p classnote>The a href#current-node idparsing-main-inframeset:current-node-6>current node/a> can only be the root code idparsing-main-inframeset:the-html-element-3>a href#the-html-element>html/a>/code> element in the a href#fragment-case idparsing-main-inframeset:fragment-case-3>fragment case/a>./p> p>a href#stop-parsing idparsing-main-inframeset:stop-parsing>Stop parsing/a>./p> dt>Anything elsedd> p>a href#parse-errors idparsing-main-inframeset:parse-errors-4>Parse error/a>. Ignore the token./p> /dl> h6 idparsing-main-afterframeset>span classsecno>12.2.6.4.21/span> The dfn>after frameset/dfn> insertion modea href#parsing-main-afterframeset classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#parsing-main-afterframeset idparsing-main-afterframeset:parsing-main-afterframeset>after frameset/a> a href#insertion-mode idparsing-main-afterframeset:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACEdd> p>a href#insert-a-character idparsing-main-afterframeset:insert-a-character>Insert the character/a>./p> dt>A comment tokendd> p>a href#insert-a-comment idparsing-main-afterframeset:insert-a-comment>Insert a comment/a>./p> dt>A DOCTYPE tokendd> p>a href#parse-errors idparsing-main-afterframeset:parse-errors>Parse error/a>. Ignore the token./p> dt>A start tag whose tag name is htmldd> p>Process the token a href#using-the-rules-for idparsing-main-afterframeset:using-the-rules-for>using the rules for/a> the a href#parsing-main-inbody idparsing-main-afterframeset:parsing-main-inbody>in body/a> a href#insertion-mode idparsing-main-afterframeset:insertion-mode-2>insertion mode/a>./p> dt>An end tag whose tag name is htmldd> p>Switch the a href#insertion-mode idparsing-main-afterframeset:insertion-mode-3>insertion mode/a> to a href#the-after-after-frameset-insertion-mode idparsing-main-afterframeset:the-after-after-frameset-insertion-mode>after after frameset/a>./p> dt>A start tag whose tag name is noframesdd> p>Process the token a href#using-the-rules-for idparsing-main-afterframeset:using-the-rules-for-2>using the rules for/a> the a href#parsing-main-inhead idparsing-main-afterframeset:parsing-main-inhead>in head/a> a href#insertion-mode idparsing-main-afterframeset:insertion-mode-4>insertion mode/a>./p> dt>An end-of-file tokendd> p>a href#stop-parsing idparsing-main-afterframeset:stop-parsing>Stop parsing/a>./p> dt>Anything elsedd> p>a href#parse-errors idparsing-main-afterframeset:parse-errors-2>Parse error/a>. Ignore the token./p> /dl> h6 idthe-after-after-body-insertion-mode>span classsecno>12.2.6.4.22/span> The dfn>after after body/dfn> insertion modea href#the-after-after-body-insertion-mode classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#the-after-after-body-insertion-mode idthe-after-after-body-insertion-mode:the-after-after-body-insertion-mode>after after body/a> a href#insertion-mode idthe-after-after-body-insertion-mode:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A comment tokendd> p>a href#insert-a-comment idthe-after-after-body-insertion-mode:insert-a-comment>Insert a comment/a> as the last child of the code idthe-after-after-body-insertion-mode:document>a href#document>Document/a>/code> object./p> dt>A DOCTYPE tokendt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACEdt>A start tag whose tag name is htmldd> p>Process the token a href#using-the-rules-for idthe-after-after-body-insertion-mode:using-the-rules-for>using the rules for/a> the a href#parsing-main-inbody idthe-after-after-body-insertion-mode:parsing-main-inbody>in body/a> a href#insertion-mode idthe-after-after-body-insertion-mode:insertion-mode-2>insertion mode/a>./p> dt>An end-of-file tokendd> p>a href#stop-parsing idthe-after-after-body-insertion-mode:stop-parsing>Stop parsing/a>./p> dt>Anything elsedd> p>a href#parse-errors idthe-after-after-body-insertion-mode:parse-errors>Parse error/a>. Switch the a href#insertion-mode idthe-after-after-body-insertion-mode:insertion-mode-3>insertion mode/a> to a href#parsing-main-inbody idthe-after-after-body-insertion-mode:parsing-main-inbody-2>in body/a> and reprocess the token./p> /dl> h6 idthe-after-after-frameset-insertion-mode>span classsecno>12.2.6.4.23/span> The dfn>after after frameset/dfn> insertion modea href#the-after-after-frameset-insertion-mode classself-link>/a>/h6> p>When the user agent is to apply the rules for the a href#the-after-after-frameset-insertion-mode idthe-after-after-frameset-insertion-mode:the-after-after-frameset-insertion-mode>after after frameset/a> a href#insertion-mode idthe-after-after-frameset-insertion-mode:insertion-mode>insertion mode/a>, the user agent must handle the token as follows:/p> dl classswitch>dt>A comment tokendd> p>a href#insert-a-comment idthe-after-after-frameset-insertion-mode:insert-a-comment>Insert a comment/a> as the last child of the code idthe-after-after-frameset-insertion-mode:document>a href#document>Document/a>/code> object./p> dt>A DOCTYPE tokendt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACEdt>A start tag whose tag name is htmldd> p>Process the token a href#using-the-rules-for idthe-after-after-frameset-insertion-mode:using-the-rules-for>using the rules for/a> the a href#parsing-main-inbody idthe-after-after-frameset-insertion-mode:parsing-main-inbody>in body/a> a href#insertion-mode idthe-after-after-frameset-insertion-mode:insertion-mode-2>insertion mode/a>./p> dt>An end-of-file tokendd> p>a href#stop-parsing idthe-after-after-frameset-insertion-mode:stop-parsing>Stop parsing/a>./p> dt>A start tag whose tag name is noframesdd> p>Process the token a href#using-the-rules-for idthe-after-after-frameset-insertion-mode:using-the-rules-for-2>using the rules for/a> the a href#parsing-main-inhead idthe-after-after-frameset-insertion-mode:parsing-main-inhead>in head/a> a href#insertion-mode idthe-after-after-frameset-insertion-mode:insertion-mode-3>insertion mode/a>./p> dt>Anything elsedd> p>a href#parse-errors idthe-after-after-frameset-insertion-mode:parse-errors>Parse error/a>. Ignore the token./p> /dl> h5 idparsing-main-inforeign>span classsecno>12.2.6.5/span> The rules for parsing tokens dfn>in foreign content/dfn>a href#parsing-main-inforeign classself-link>/a>/h5> p>When the user agent is to apply the rules for parsing tokens in foreign content, the user agent must handle the token as follows:/p> dl classswitch>dt>A character token that is U+0000 NULLdd> p>a href#parse-errors idparsing-main-inforeign:parse-errors>Parse error/a>. a href#insert-a-character idparsing-main-inforeign:insert-a-character>Insert a U+FFFD REPLACEMENT CHARACTER character/a>./p> dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACEdd> p>a href#insert-a-character idparsing-main-inforeign:insert-a-character-2>Insert the tokens character/a>./p> dt>Any other character tokendd> p>a href#insert-a-character idparsing-main-inforeign:insert-a-character-3>Insert the tokens character/a>./p> p>Set the a href#frameset-ok-flag idparsing-main-inforeign:frameset-ok-flag>frameset-ok flag/a> to not ok./p> dt>A comment tokendd> p>a href#insert-a-comment idparsing-main-inforeign:insert-a-comment>Insert a comment/a>./p> dt>A DOCTYPE tokendd> p>a href#parse-errors idparsing-main-inforeign:parse-errors-2>Parse error/a>. Ignore the token./p> dt>A start tag whose tag name is one of: b, big, blockquote, body, br, center, code, dd, div, dl, dt, em, embed, h1, h2, h3, h4, h5, h6, head, hr, i, img, li, listing, menu, meta, nobr, ol, p, pre, ruby, s, small, span, strong, strike, sub, sup, table, tt, u, ul, vardt>A start tag whose tag name is font, if the token has any attributes named color, face, or sizedd> p>a href#parse-errors idparsing-main-inforeign:parse-errors-3>Parse error/a>./p> p>If the parser was originally created for the a href#html-fragment-parsing-algorithm idparsing-main-inforeign:html-fragment-parsing-algorithm>HTML fragment parsing algorithm/a>, then act as described in the any other start tag entry below. (a href#fragment-case idparsing-main-inforeign:fragment-case>fragment case/a>)/p> p>Otherwise:/p> p>Pop an element from the a href#stack-of-open-elements idparsing-main-inforeign:stack-of-open-elements>stack of open elements/a>, and then keep popping more elements from the a href#stack-of-open-elements idparsing-main-inforeign:stack-of-open-elements-2>stack of open elements/a> until the a href#current-node idparsing-main-inforeign:current-node>current node/a> is a a href#mathml-text-integration-point idparsing-main-inforeign:mathml-text-integration-point>MathML text integration point/a>, an a href#html-integration-point idparsing-main-inforeign:html-integration-point>HTML integration point/a>, or an element in the a idparsing-main-inforeign:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>./p> p>Then, reprocess the token./p> dt>Any other start tagdd> p>If the a href#adjusted-current-node idparsing-main-inforeign:adjusted-current-node>adjusted current node/a> is an element in the a idparsing-main-inforeign:mathml-namespace hrefhttps://infra.spec.whatwg.org/#mathml-namespace data-x-internalmathml-namespace>MathML namespace/a>, a href#adjust-mathml-attributes idparsing-main-inforeign:adjust-mathml-attributes>adjust MathML attributes/a> for the token. (This fixes the case of MathML attributes that are not all lowercase.)/p> p>If the a href#adjusted-current-node idparsing-main-inforeign:adjusted-current-node-2>adjusted current node/a> is an element in the a idparsing-main-inforeign:svg-namespace hrefhttps://infra.spec.whatwg.org/#svg-namespace data-x-internalsvg-namespace>SVG namespace/a>, and the tokens tag name is one of the ones in the first column of the following table, change the tag name to the name given in the corresponding cell in the second column. (This fixes the case of SVG elements that are not all lowercase.)/p> table>thead>tr>th> Tag name th> Element name tbody>tr>td> code>altglyph/code> td> code>altGlyph/code> tr>td> code>altglyphdef/code> td> code>altGlyphDef/code> tr>td> code>altglyphitem/code> td> code>altGlyphItem/code> tr>td> code>animatecolor/code> td> code>animateColor/code> tr>td> code>animatemotion/code> td> code>animateMotion/code> tr>td> code>animatetransform/code> td> code>animateTransform/code> tr>td> code>clippath/code> td> code>clipPath/code> tr>td> code>feblend/code> td> code>feBlend/code> tr>td> code>fecolormatrix/code> td> code>feColorMatrix/code> tr>td> code>fecomponenttransfer/code> td> code>feComponentTransfer/code> tr>td> code>fecomposite/code> td> code>feComposite/code> tr>td> code>feconvolvematrix/code> td> code>feConvolveMatrix/code> tr>td> code>fediffuselighting/code> td> code>feDiffuseLighting/code> tr>td> code>fedisplacementmap/code> td> code>feDisplacementMap/code> tr>td> code>fedistantlight/code> td> code>feDistantLight/code> tr>td> code>fedropshadow/code> td> code>feDropShadow/code> tr>td> code>feflood/code> td> code>feFlood/code> tr>td> code>fefunca/code> td> code>feFuncA/code> tr>td> code>fefuncb/code> td> code>feFuncB/code> tr>td> code>fefuncg/code> td> code>feFuncG/code> tr>td> code>fefuncr/code> td> code>feFuncR/code> tr>td> code>fegaussianblur/code> td> code>feGaussianBlur/code> tr>td> code>feimage/code> td> code>feImage/code> tr>td> code>femerge/code> td> code>feMerge/code> tr>td> code>femergenode/code> td> code>feMergeNode/code> tr>td> code>femorphology/code> td> code>feMorphology/code> tr>td> code>feoffset/code> td> code>feOffset/code> tr>td> code>fepointlight/code> td> code>fePointLight/code> tr>td> code>fespecularlighting/code> td> code>feSpecularLighting/code> tr>td> code>fespotlight/code> td> code>feSpotLight/code> tr>td> code>fetile/code> td> code>feTile/code> tr>td> code>feturbulence/code> td> code>feTurbulence/code> tr>td> code>foreignobject/code> td> code>foreignObject/code> tr>td> code>glyphref/code> td> code>glyphRef/code> tr>td> code>lineargradient/code> td> code>linearGradient/code> tr>td> code>radialgradient/code> td> code>radialGradient/code> tr>td> code>textpath/code> td> code>textPath/code> /table> p>If the a href#adjusted-current-node idparsing-main-inforeign:adjusted-current-node-3>adjusted current node/a> is an element in the a idparsing-main-inforeign:svg-namespace-2 hrefhttps://infra.spec.whatwg.org/#svg-namespace data-x-internalsvg-namespace>SVG namespace/a>, a href#adjust-svg-attributes idparsing-main-inforeign:adjust-svg-attributes>adjust SVG attributes/a> for the token. (This fixes the case of SVG attributes that are not all lowercase.)/p> p>a href#adjust-foreign-attributes idparsing-main-inforeign:adjust-foreign-attributes>Adjust foreign attributes/a> for the token. (This fixes the use of namespaced attributes, in particular XLink in SVG.)/p> p>a href#insert-a-foreign-element idparsing-main-inforeign:insert-a-foreign-element>Insert a foreign element/a> for the token, in the same namespace as the a href#adjusted-current-node idparsing-main-inforeign:adjusted-current-node-4>adjusted current node/a>./p> p>If the token has its i idparsing-main-inforeign:self-closing-flag>a href#self-closing-flag>self-closing flag/a>/i> set, then run the appropriate steps from the following list:/p> dl classswitch>dt>If the tokens tag name is script, and the new a href#current-node idparsing-main-inforeign:current-node-2>current node/a> is in the a idparsing-main-inforeign:svg-namespace-3 hrefhttps://infra.spec.whatwg.org/#svg-namespace data-x-internalsvg-namespace>SVG namespace/a>dd> p>a href#acknowledge-self-closing-flag idparsing-main-inforeign:acknowledge-self-closing-flag>Acknowledge the tokens i>self-closing flag/i>/a>, and then act as described in the steps for a script end tag below./p> dt>Otherwisedd> p>Pop the a href#current-node idparsing-main-inforeign:current-node-3>current node/a> off the a href#stack-of-open-elements idparsing-main-inforeign:stack-of-open-elements-3>stack of open elements/a> and a href#acknowledge-self-closing-flag idparsing-main-inforeign:acknowledge-self-closing-flag-2>acknowledge the tokens i>self-closing flag/i>/a>./p> /dl> dt idscriptForeignEndTag>An end tag whose tag name is script, if the a href#current-node idparsing-main-inforeign:current-node-4>current node/a> is an a idparsing-main-inforeign:svg-script hrefhttps://www.w3.org/TR/SVG11/script.html#ScriptElement data-x-internalsvg-script>SVG code>script/code>/a> elementdd> p>Pop the a href#current-node idparsing-main-inforeign:current-node-5>current node/a> off the a href#stack-of-open-elements idparsing-main-inforeign:stack-of-open-elements-4>stack of open elements/a>./p> p>Let the var>old insertion point/var> have the same value as the current a href#insertion-point idparsing-main-inforeign:insertion-point>insertion point/a>. Let the a href#insertion-point idparsing-main-inforeign:insertion-point-2>insertion point/a> be just before the a href#next-input-character idparsing-main-inforeign:next-input-character>next input character/a>./p> p>Increment the parsers a href#script-nesting-level idparsing-main-inforeign:script-nesting-level>script nesting level/a> by one. Set the a href#parser-pause-flag idparsing-main-inforeign:parser-pause-flag>parser pause flag/a> to true./p> p>a hrefhttps://www.w3.org/TR/SVGMobile12/script.html#ScriptContentProcessing>Process the SVG code>script/code> element/a> according to the SVG rules, if the user agent supports SVG. a href#refsSVG>SVG/a>/p> p classnote>Even if this causes a href#dom-document-write idparsing-main-inforeign:dom-document-write>new characters to be inserted into the tokenizer/a>, the parser will not be executed reentrantly, since the a href#parser-pause-flag idparsing-main-inforeign:parser-pause-flag-2>parser pause flag/a> is true./p> p>Decrement the parsers a href#script-nesting-level idparsing-main-inforeign:script-nesting-level-2>script nesting level/a> by one. If the parsers a href#script-nesting-level idparsing-main-inforeign:script-nesting-level-3>script nesting level/a> is zero, then set the a href#parser-pause-flag idparsing-main-inforeign:parser-pause-flag-3>parser pause flag/a> to false./p> p>Let the a href#insertion-point idparsing-main-inforeign:insertion-point-3>insertion point/a> have the value of the var>old insertion point/var>. (In other words, restore the a href#insertion-point idparsing-main-inforeign:insertion-point-4>insertion point/a> to its previous value. This value might be the undefined value.)/p> dt>Any other end tagdd> p>Run these steps:/p> ol>li>p>Initialize var>node/var> to be the a href#current-node idparsing-main-inforeign:current-node-6>current node/a> (the bottommost node of the stack).li>p>If var>node/var>s tag name, a idparsing-main-inforeign:converted-to-ascii-lowercase hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>, is not the same as the tag name of the token, then this is a a href#parse-errors idparsing-main-inforeign:parse-errors-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 idparsing-main-inforeign:stack-of-open-elements-5>stack of open elements/a>, abort these steps. (a href#fragment-case idparsing-main-inforeign:fragment-case-2>fragment case/a>)li>p>If var>node/var>s tag name, a idparsing-main-inforeign:converted-to-ascii-lowercase-2 hrefhttps://infra.spec.whatwg.org/#ascii-lowercase data-x-internalconverted-to-ascii-lowercase>converted to ASCII lowercase/a>, is the same as the tag name of the token, pop elements from the a href#stack-of-open-elements idparsing-main-inforeign:stack-of-open-elements-6>stack of open elements/a> until var>node/var> has been popped from the stack, and then abort these steps.li>p>Set var>node/var> to the previous entry in the a href#stack-of-open-elements idparsing-main-inforeign:stack-of-open-elements-7>stack of open elements/a>.li>p>If var>node/var> is not an element in the a idparsing-main-inforeign:html-namespace-2-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>, return to the step labeled i>loop/i>.li>p>Otherwise, process the token according to the rules given in the section corresponding to the current a href#insertion-mode idparsing-main-inforeign:insertion-mode>insertion mode/a> in HTML content./ol> /dl> h4 idthe-end>span classsecno>12.2.7/span> The enda href#the-end classself-link>/a>/h4> p>Once the user agent dfn idstop-parsing>stops parsing/dfn> the document, the user agent must run the following steps:div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> domcontentloadedspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>3.2+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>2+/span>/span>span classie yes>span>IE/span> span>9+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>3.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.1+/span>/span>span classopera yes>span>Opera/span> span>9+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featdomcontentloaded>caniuse.com/a>/div> ol>li>p>Set the a href#current-document-readiness idthe-end:current-document-readiness>current document readiness/a> to code>interactive/code> and the a href#insertion-point idthe-end:insertion-point>insertion point/a> to undefined.li>p>Pop em>all/em> the nodes off the a href#stack-of-open-elements idthe-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 idthe-end:list-of-scripts-that-will-execute-when-the-document-has-finished-parsing>list of scripts that will execute when the document has finished parsing/a> is not empty, run these substeps:/p> ol>li>p>a href#spin-the-event-loop idthe-end:spin-the-event-loop>Spin the event loop/a> until the first code idthe-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 idthe-end:list-of-scripts-that-will-execute-when-the-document-has-finished-parsing-2>list of scripts that will execute when the document has finished parsing/a> has its a href#ready-to-be-parser-executed idthe-end:ready-to-be-parser-executed>ready to be parser-executed/a> flag set em>and/em> the parsers code idthe-end:document>a href#document>Document/a>/code> a href#has-no-style-sheet-that-is-blocking-scripts idthe-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 idthe-end:execute-the-script-block>Execute/a> the first code idthe-end:the-script-element-2>a href#the-script-element>script/a>/code> in the a href#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing idthe-end:list-of-scripts-that-will-execute-when-the-document-has-finished-parsing-3>list of scripts that will execute when the document has finished parsing/a>.li>p>Remove the first code idthe-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 idthe-end:list-of-scripts-that-will-execute-when-the-document-has-finished-parsing-4>list of scripts that will execute when the document has finished parsing/a> (i.e. shift out the first entry in the list).li>p>If the a href#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing idthe-end:list-of-scripts-that-will-execute-when-the-document-has-finished-parsing-5>list of scripts that will execute when the document has finished parsing/a> is still not empty, repeat these substeps again from substep 1./p> /ol> li> p>a href#queue-a-task idthe-end:queue-a-task>Queue a task/a> to run the following substeps:/p> ol>li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-end:concept-event-fire data-x-internalconcept-event-fire>Fire an event/a> named code idthe-end:event-domcontentloaded>a href#event-domcontentloaded>DOMContentLoaded/a>/code> at the code idthe-end:document-2>a href#document>Document/a>/code> object, with its code idthe-end:dom-event-bubbles>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true.li>p>Enable the a hrefhttps://w3c.github.io/ServiceWorker/#dfn-client-message-queue idthe-end:dfn-client-message-queue data-x-internaldfn-client-message-queue>client message queue/a> of the code idthe-end:serviceworkercontainer>a data-x-internalserviceworkercontainer hrefhttps://w3c.github.io/ServiceWorker/#serviceworkercontainer>ServiceWorkerContainer/a>/code> object whose associated a hrefhttps://w3c.github.io/ServiceWorker/#serviceworkercontainer-service-worker-client idthe-end:serviceworkercontainer-service-worker-client data-x-internalserviceworkercontainer-service-worker-client>service worker client/a> is the code idthe-end:document-3>a href#document>Document/a>/code> objects a href#relevant-settings-object idthe-end:relevant-settings-object>relevant settings object/a>./ol> li>p>a href#spin-the-event-loop idthe-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 idthe-end:set-of-scripts-that-will-execute-as-soon-as-possible>set of scripts that will execute as soon as possible/a> and the a href#list-of-scripts-that-will-execute-in-order-as-soon-as-possible idthe-end:list-of-scripts-that-will-execute-in-order-as-soon-as-possible>list of scripts that will execute in order as soon as possible/a> are empty.li>p>a href#spin-the-event-loop idthe-end:spin-the-event-loop-3>Spin the event loop/a> until there is nothing that dfn iddelay-the-load-event>delays the load event/dfn> in the code idthe-end:document-4>a href#document>Document/a>/code>.li> p>a href#queue-a-task idthe-end:queue-a-task-2>Queue a task/a> to run the following substeps:/p> ol>li>p>Set the a href#current-document-readiness idthe-end:current-document-readiness-2>current document readiness/a> to code>complete/code>.li>p>i>Load event/i>: If the code idthe-end:document-5>a href#document>Document/a>/code> has a a href#concept-document-bc idthe-end:concept-document-bc>browsing context/a>, then a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-end:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idthe-end:event-load>a href#event-load>load/a>/code> at the code idthe-end:document-6>a href#document>Document/a>/code> objects code idthe-end:window>a href#window>Window/a>/code> object, with var>legacy target override flag/var> set./ol> li> p>If the code idthe-end:document-7>a href#document>Document/a>/code> has a a href#concept-document-bc idthe-end:concept-document-bc-2>browsing context/a>, then a href#queue-a-task idthe-end:queue-a-task-3>queue a task/a> to run the following substeps:/p> ol>li>p>If the code idthe-end:document-8>a href#document>Document/a>/code>s a href#page-showing idthe-end:page-showing>page showing/a> flag is true, then abort this task (i.e. dont fire the event below).li>p>Set the code idthe-end:document-9>a href#document>Document/a>/code>s a href#page-showing idthe-end:page-showing-2>page showing/a> flag to true.li>p>a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-end:concept-event-fire-3 data-x-internalconcept-event-fire>Fire an event/a> named code idthe-end:event-pageshow>a href#event-pageshow>pageshow/a>/code> at the code idthe-end:document-10>a href#document>Document/a>/code> objects code idthe-end:window-2>a href#window>Window/a>/code> object, using code idthe-end:pagetransitionevent>a href#pagetransitionevent>PageTransitionEvent/a>/code>, with the code idthe-end:dom-pagetransitionevent-persisted>a href#dom-pagetransitionevent-persisted>persisted/a>/code> attribute initialized to false, and var>legacy target override flag/var> set./ol> li>p>If the code idthe-end:document-11>a href#document>Document/a>/code> has any a href#pending-application-cache-download-process-tasks idthe-end:pending-application-cache-download-process-tasks>pending application cache download process tasks/a>, then a href#queue-a-task idthe-end:queue-a-task-4>queue/a> each such a href#concept-task idthe-end:concept-task>task/a> in the order they were added to the list of a href#pending-application-cache-download-process-tasks idthe-end:pending-application-cache-download-process-tasks-2>pending application cache download process tasks/a>, and then empty the list of a href#pending-application-cache-download-process-tasks idthe-end:pending-application-cache-download-process-tasks-3>pending application cache download process tasks/a>. The a href#task-source idthe-end:task-source>task source/a> for these a href#concept-task idthe-end:concept-task-2>tasks/a> is the a href#networking-task-source idthe-end:networking-task-source>networking task source/a>.li>p>If the code idthe-end:document-12>a href#document>Document/a>/code>s a href#print-when-loaded idthe-end:print-when-loaded>print when loaded/a> flag is set, then run the a href#printing-steps idthe-end:printing-steps>printing steps/a>.li>p>The code idthe-end:document-13>a href#document>Document/a>/code> is now dfn idready-for-post-load-tasks>ready for post-load tasks/dfn>.li>p>a href#queue-a-task idthe-end:queue-a-task-5>Queue a task/a> to mark the code idthe-end:document-14>a href#document>Document/a>/code> as dfn idcompletely-loaded>completely loaded/dfn>./ol> p>When the user agent is to dfn idabort-a-parser>abort a parser/dfn>, it must run the following steps:/p> ol>li>p>Throw away any pending content in the a href#input-stream idthe-end:input-stream>input stream/a>, and discard any future content that would have been added to it.li>p>Set the a href#current-document-readiness idthe-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 idthe-end:stack-of-open-elements-2>stack of open elements/a>.li>p>Set the a href#current-document-readiness idthe-end:current-document-readiness-4>current document readiness/a> to code>complete/code>./ol> p>Except where otherwise specified, the a href#task-source idthe-end:task-source-2>task source/a> for the a href#concept-task idthe-end:concept-task-3>tasks/a> mentioned in this section is the a href#dom-manipulation-task-source idthe-end:dom-manipulation-task-source>DOM manipulation task source/a>./p> h4 idcoercing-an-html-dom-into-an-infoset>span classsecno>12.2.8/span> Coercing an HTML DOM into an infoseta href#coercing-an-html-dom-into-an-infoset classself-link>/a>/h4> p>When an application uses an a href#html-parser idcoercing-an-html-dom-into-an-infoset:html-parser>HTML parser/a> in conjunction with an XML pipeline, it is possible that the constructed DOM is not compatible with the XML tool chain in certain subtle ways. For example, an XML toolchain might not be able to represent attributes with the name code>xmlns/code>, since they conflict with the Namespaces in XML syntax. There is also some data that the a href#html-parser idcoercing-an-html-dom-into-an-infoset:html-parser-2>HTML parser/a> generates that isnt included in the DOM itself. This section specifies some rules for handling these issues./p> p>If the XML API being used doesnt support DOCTYPEs, the tool may drop DOCTYPEs altogether./p> p>If the XML API doesnt support attributes in no namespace that are named code>xmlns/code>, attributes whose names start with code>xmlns:/code>, or attributes in the a idcoercing-an-html-dom-into-an-infoset:xmlns-namespace hrefhttps://infra.spec.whatwg.org/#xmlns-namespace data-x-internalxmlns-namespace>XMLNS namespace/a>, then the tool may drop such attributes./p> p>The tool may annotate the output with any namespace declarations required for proper operation./p> p>If the XML API being used restricts the allowable characters in the local names of elements and attributes, then the tool may map all element and attribute local names that the API wouldnt support to a set of names that em>are/em> allowed, by replacing any character that isnt supported with the uppercase letter U and the six digits of the characters code point when expressed in hexadecimal, using digits 0-9 and capital letters A-F as the symbols, in increasing numeric order./p> p classexample>For example, the element name code>foo<bar/code>, which can be output by the a href#html-parser idcoercing-an-html-dom-into-an-infoset:html-parser-3>HTML parser/a>, though it is neither a legal HTML element name nor a well-formed XML element name, would be converted into code>fooU00003Cbar/code>, which em>is/em> a well-formed XML element name (though its still not legal in HTML by any means)./p> p classexample>As another example, consider the attribute code>xlink:href/code>. Used on a MathML element, it becomes, after being a href#adjust-foreign-attributes idcoercing-an-html-dom-into-an-infoset:adjust-foreign-attributes>adjusted/a>, an attribute with a prefix code>xlink/code> and a local name code>href/code>. However, used on an HTML element, it becomes an attribute with no prefix and the local name code>xlink:href/code>, which is not a valid NCName, and thus might not be accepted by an XML API. It could thus get converted, becoming code>xlinkU00003Ahref/code>./p> p classnote>The resulting names from this conversion conveniently cant clash with any attribute generated by the a href#html-parser idcoercing-an-html-dom-into-an-infoset:html-parser-4>HTML parser/a>, since those are all either lowercase or those listed in the a href#adjust-foreign-attributes idcoercing-an-html-dom-into-an-infoset:adjust-foreign-attributes-2>adjust foreign attributes/a> algorithms table./p> p>If the XML API restricts comments from having two consecutive U+002D HYPHEN-MINUS characters (--), the tool may insert a single U+0020 SPACE character between any such offending characters./p> p>If the XML API restricts comments from ending in a U+002D HYPHEN-MINUS character (-), the tool may insert a single U+0020 SPACE character at the end of such comments./p> p>If the XML API restricts allowed characters in character data, attribute values, or comments, the tool may replace any U+000C FORM FEED (FF) character with a U+0020 SPACE character, and any other literal non-XML character with a U+FFFD REPLACEMENT CHARACTER./p> p>If the tool has no way to convey out-of-band information, then the tool may drop the following information:/p> ul>li>Whether the document is set to i idcoercing-an-html-dom-into-an-infoset:no-quirks-mode>a data-x-internalno-quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-no-quirks>no-quirks mode/a>/i>, i idcoercing-an-html-dom-into-an-infoset:limited-quirks-mode>a data-x-internallimited-quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-limited-quirks>limited-quirks mode/a>/i>, or i idcoercing-an-html-dom-into-an-infoset:quirks-mode>a data-x-internalquirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-quirks>quirks mode/a>/i>li>The association between form controls and forms that arent their nearest code idcoercing-an-html-dom-into-an-infoset:the-form-element>a href#the-form-element>form/a>/code> element ancestor (use of the a href#form-element-pointer idcoercing-an-html-dom-into-an-infoset:form-element-pointer>code>form/code> element pointer/a> in the parser)li>The a href#template-contents idcoercing-an-html-dom-into-an-infoset:template-contents>template contents/a> of any code idcoercing-an-html-dom-into-an-infoset:the-template-element>a href#the-template-element>template/a>/code> elements./ul> p classnote>The mutations allowed by this section apply em>after/em> the a href#html-parser idcoercing-an-html-dom-into-an-infoset:html-parser-5>HTML parser/a>s rules have been applied. For example, a code><a::>/code> start tag will be closed by a code></a::>/code> end tag, and never by a code></aU00003AU00003A>/code> end tag, even if the user agent is using the rules above to then generate an actual element in the DOM with the name code>aU00003AU00003A/code> for that start tag./p> h4 idan-introduction-to-error-handling-and-strange-cases-in-the-parser>span classsecno>12.2.9/span> An introduction to error handling and strange cases in the parsera href#an-introduction-to-error-handling-and-strange-cases-in-the-parser classself-link>/a>/h4> p>i>This section is non-normative./i>/p> p>This section examines some erroneous markup and discusses how the a href#html-parser idan-introduction-to-error-handling-and-strange-cases-in-the-parser:html-parser>HTML parser/a> handles these cases./p> h5 idmisnested-tags:-b-i-/b-/i>span classsecno>12.2.9.1/span> Misnested tags: <b><i></b></i>a href#misnested-tags:-b-i-/b-/i classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>The most-often discussed example of erroneous markup is as follows:/p> pre><p>1<b>2<i>3</b>4</i>5</p>/pre> p>The parsing of this markup is straightforward up to the 3. At this point, the DOM looks like this:/p> ul classdomTree>li classt1>code idmisnested-tags:-b-i-/b-/i:the-html-element>a href#the-html-element>html/a>/code>ul>li classt1>code idmisnested-tags:-b-i-/b-/i:the-head-element>a href#the-head-element>head/a>/code>li classt1>code idmisnested-tags:-b-i-/b-/i:the-body-element>a href#the-body-element>body/a>/code>ul>li classt1>code idmisnested-tags:-b-i-/b-/i:the-p-element>a href#the-p-element>p/a>/code>ul>li classt3>code idmisnested-tags:-b-i-/b-/i:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>1/span>li classt1>code idmisnested-tags:-b-i-/b-/i:the-b-element>a href#the-b-element>b/a>/code>ul>li classt3>code idmisnested-tags:-b-i-/b-/i:text-2>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>2/span>li classt1>code idmisnested-tags:-b-i-/b-/i:the-i-element>a href#the-i-element>i/a>/code>ul>li classt3>code idmisnested-tags:-b-i-/b-/i:text-3>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>3/span>/ul>/ul>/ul>/ul>/ul>/ul> p>Here, the a href#stack-of-open-elements idmisnested-tags:-b-i-/b-/i:stack-of-open-elements>stack of open elements/a> has five elements on it: code idmisnested-tags:-b-i-/b-/i:the-html-element-2>a href#the-html-element>html/a>/code>, code idmisnested-tags:-b-i-/b-/i:the-body-element-2>a href#the-body-element>body/a>/code>, code idmisnested-tags:-b-i-/b-/i:the-p-element-2>a href#the-p-element>p/a>/code>, code idmisnested-tags:-b-i-/b-/i:the-b-element-2>a href#the-b-element>b/a>/code>, and code idmisnested-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 idmisnested-tags:-b-i-/b-/i:list-of-active-formatting-elements>list of active formatting elements/a> just has two: code idmisnested-tags:-b-i-/b-/i:the-b-element-3>a href#the-b-element>b/a>/code> and code idmisnested-tags:-b-i-/b-/i:the-i-element-3>a href#the-i-element>i/a>/code>. The a href#insertion-mode idmisnested-tags:-b-i-/b-/i:insertion-mode>insertion mode/a> is a href#parsing-main-inbody idmisnested-tags:-b-i-/b-/i:parsing-main-inbody>in body/a>./p> p>Upon receiving the end tag token with the tag name b, the a href#adoptionAgency>adoption agency algorithm/a> is invoked. This is a simple case, in that the var>formatting element/var> is the code idmisnested-tags:-b-i-/b-/i:the-b-element-4>a href#the-b-element>b/a>/code> element, and there is no var>furthest block/var>. Thus, the a href#stack-of-open-elements idmisnested-tags:-b-i-/b-/i:stack-of-open-elements-2>stack of open elements/a> ends up with just three elements: code idmisnested-tags:-b-i-/b-/i:the-html-element-3>a href#the-html-element>html/a>/code>, code idmisnested-tags:-b-i-/b-/i:the-body-element-3>a href#the-body-element>body/a>/code>, and code idmisnested-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 idmisnested-tags:-b-i-/b-/i:list-of-active-formatting-elements-2>list of active formatting elements/a> has just one: code idmisnested-tags:-b-i-/b-/i:the-i-element-4>a href#the-i-element>i/a>/code>. The DOM tree is unmodified at this point./p> p>The next token is a character (4), triggers the a href#reconstruct-the-active-formatting-elements idmisnested-tags:-b-i-/b-/i:reconstruct-the-active-formatting-elements>reconstruction of the active formatting elements/a>, in this case just the code idmisnested-tags:-b-i-/b-/i:the-i-element-5>a href#the-i-element>i/a>/code> element. A new code idmisnested-tags:-b-i-/b-/i:the-i-element-6>a href#the-i-element>i/a>/code> element is thus created for the 4 code idmisnested-tags:-b-i-/b-/i:text-4>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node. After the end tag token for the i is also received, and the 5 code idmisnested-tags:-b-i-/b-/i:text-5>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node is inserted, the DOM looks as follows:/p> ul classdomTree>li classt1>code idmisnested-tags:-b-i-/b-/i:the-html-element-4>a href#the-html-element>html/a>/code>ul>li classt1>code idmisnested-tags:-b-i-/b-/i:the-head-element-2>a href#the-head-element>head/a>/code>li classt1>code idmisnested-tags:-b-i-/b-/i:the-body-element-4>a href#the-body-element>body/a>/code>ul>li classt1>code idmisnested-tags:-b-i-/b-/i:the-p-element-4>a href#the-p-element>p/a>/code>ul>li classt3>code idmisnested-tags:-b-i-/b-/i:text-6>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>1/span>li classt1>code idmisnested-tags:-b-i-/b-/i:the-b-element-5>a href#the-b-element>b/a>/code>ul>li classt3>code idmisnested-tags:-b-i-/b-/i:text-7>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>2/span>li classt1>code idmisnested-tags:-b-i-/b-/i:the-i-element-7>a href#the-i-element>i/a>/code>ul>li classt3>code idmisnested-tags:-b-i-/b-/i:text-8>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>3/span>/ul>/ul>li classt1>code idmisnested-tags:-b-i-/b-/i:the-i-element-8>a href#the-i-element>i/a>/code>ul>li classt3>code idmisnested-tags:-b-i-/b-/i:text-9>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>4/span>/ul>li classt3>code idmisnested-tags:-b-i-/b-/i:text-10>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>5/span>/ul>/ul>/ul>/ul> h5 idmisnested-tags:-b-p-/b-/p>span classsecno>12.2.9.2/span> Misnested tags: <b><p></b></p>a href#misnested-tags:-b-p-/b-/p classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>A case similar to the previous one is the following:/p> pre><b>1<p>2</b>3</p>/pre> p>Up to the 2 the parsing here is straightforward:/p> ul classdomTree>li classt1>code idmisnested-tags:-b-p-/b-/p:the-html-element>a href#the-html-element>html/a>/code>ul>li classt1>code idmisnested-tags:-b-p-/b-/p:the-head-element>a href#the-head-element>head/a>/code>li classt1>code idmisnested-tags:-b-p-/b-/p:the-body-element>a href#the-body-element>body/a>/code>ul>li classt1>code idmisnested-tags:-b-p-/b-/p:the-b-element>a href#the-b-element>b/a>/code>ul>li classt3>code idmisnested-tags:-b-p-/b-/p:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>1/span>li classt1>code idmisnested-tags:-b-p-/b-/p:the-p-element>a href#the-p-element>p/a>/code>ul>li classt3>code idmisnested-tags:-b-p-/b-/p:text-2>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>2/span>/ul>/ul>/ul>/ul>/ul> p>The interesting part is when the end tag token with the tag name b is parsed./p> p>Before that token is seen, the a href#stack-of-open-elements idmisnested-tags:-b-p-/b-/p:stack-of-open-elements>stack of open elements/a> has four elements on it: code idmisnested-tags:-b-p-/b-/p:the-html-element-2>a href#the-html-element>html/a>/code>, code idmisnested-tags:-b-p-/b-/p:the-body-element-2>a href#the-body-element>body/a>/code>, code idmisnested-tags:-b-p-/b-/p:the-b-element-2>a href#the-b-element>b/a>/code>, and code idmisnested-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 idmisnested-tags:-b-p-/b-/p:list-of-active-formatting-elements>list of active formatting elements/a> just has the one: code idmisnested-tags:-b-p-/b-/p:the-b-element-3>a href#the-b-element>b/a>/code>. The a href#insertion-mode idmisnested-tags:-b-p-/b-/p:insertion-mode>insertion mode/a> is a href#parsing-main-inbody idmisnested-tags:-b-p-/b-/p:parsing-main-inbody>in body/a>./p> p>Upon receiving the end tag token with the tag name b, the a href#adoptionAgency>adoption agency algorithm/a> is invoked, as in the previous example. However, in this case, there em>is/em> a var>furthest block/var>, namely the code idmisnested-tags:-b-p-/b-/p:the-p-element-3>a href#the-p-element>p/a>/code> element. Thus, this time the adoption agency algorithm isnt skipped over./p> p>The var>common ancestor/var> is the code idmisnested-tags:-b-p-/b-/p:the-body-element-3>a href#the-body-element>body/a>/code> element. A conceptual bookmark marks the position of the code idmisnested-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 idmisnested-tags:-b-p-/b-/p:list-of-active-formatting-elements-2>list of active formatting elements/a>, but since that list has only one element in it, the bookmark wont have much effect./p> p>As the algorithm progresses, var>node/var> ends up set to the formatting element (code idmisnested-tags:-b-p-/b-/p:the-b-element-5>a href#the-b-element>b/a>/code>), and var>last node/var> ends up set to the var>furthest block/var> (code idmisnested-tags:-b-p-/b-/p:the-p-element-4>a href#the-p-element>p/a>/code>)./p> p>The var>last node/var> gets appended (moved) to the var>common ancestor/var>, so that the DOM looks like:/p> ul classdomTree>li classt1>code idmisnested-tags:-b-p-/b-/p:the-html-element-3>a href#the-html-element>html/a>/code>ul>li classt1>code idmisnested-tags:-b-p-/b-/p:the-head-element-2>a href#the-head-element>head/a>/code>li classt1>code idmisnested-tags:-b-p-/b-/p:the-body-element-4>a href#the-body-element>body/a>/code>ul>li classt1>code idmisnested-tags:-b-p-/b-/p:the-b-element-6>a href#the-b-element>b/a>/code>ul>li classt3>code idmisnested-tags:-b-p-/b-/p:text-3>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>1/span>/ul>li classt1>code idmisnested-tags:-b-p-/b-/p:the-p-element-5>a href#the-p-element>p/a>/code>ul>li classt3>code idmisnested-tags:-b-p-/b-/p:text-4>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>2/span>/ul>/ul>/ul>/ul> p>A new code idmisnested-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 idmisnested-tags:-b-p-/b-/p:the-p-element-6>a href#the-p-element>p/a>/code> element are moved to it:/p> ul classdomTree>li classt1>code idmisnested-tags:-b-p-/b-/p:the-html-element-4>a href#the-html-element>html/a>/code>ul>li classt1>code idmisnested-tags:-b-p-/b-/p:the-head-element-3>a href#the-head-element>head/a>/code>li classt1>code idmisnested-tags:-b-p-/b-/p:the-body-element-5>a href#the-body-element>body/a>/code>ul>li classt1>code idmisnested-tags:-b-p-/b-/p:the-b-element-8>a href#the-b-element>b/a>/code>ul>li classt3>code idmisnested-tags:-b-p-/b-/p:text-5>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>1/span>/ul>li classt1>code idmisnested-tags:-b-p-/b-/p:the-p-element-7>a href#the-p-element>p/a>/code>/ul>/ul>/ul> ul classdomTree>li classt1>code idmisnested-tags:-b-p-/b-/p:the-b-element-9>a href#the-b-element>b/a>/code>ul>li classt3>code idmisnested-tags:-b-p-/b-/p:text-6>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>2/span>/ul>/ul> p>Finally, the new code idmisnested-tags:-b-p-/b-/p:the-b-element-10>a href#the-b-element>b/a>/code> element is appended to the code idmisnested-tags:-b-p-/b-/p:the-p-element-8>a href#the-p-element>p/a>/code> element, so that the DOM looks like:/p> ul classdomTree>li classt1>code idmisnested-tags:-b-p-/b-/p:the-html-element-5>a href#the-html-element>html/a>/code>ul>li classt1>code idmisnested-tags:-b-p-/b-/p:the-head-element-4>a href#the-head-element>head/a>/code>li classt1>code idmisnested-tags:-b-p-/b-/p:the-body-element-6>a href#the-body-element>body/a>/code>ul>li classt1>code idmisnested-tags:-b-p-/b-/p:the-b-element-11>a href#the-b-element>b/a>/code>ul>li classt3>code idmisnested-tags:-b-p-/b-/p:text-7>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>1/span>/ul>li classt1>code idmisnested-tags:-b-p-/b-/p:the-p-element-9>a href#the-p-element>p/a>/code>ul>li classt1>code idmisnested-tags:-b-p-/b-/p:the-b-element-12>a href#the-b-element>b/a>/code>ul>li classt3>code idmisnested-tags:-b-p-/b-/p:text-8>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>2/span>/ul>/ul>/ul>/ul>/ul> p>The code idmisnested-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 idmisnested-tags:-b-p-/b-/p:list-of-active-formatting-elements-3>list of active formatting elements/a> and the a href#stack-of-open-elements idmisnested-tags:-b-p-/b-/p:stack-of-open-elements-2>stack of open elements/a>, so that when the 3 is parsed, it is appended to the code idmisnested-tags:-b-p-/b-/p:the-p-element-10>a href#the-p-element>p/a>/code> element:/p> ul classdomTree>li classt1>code idmisnested-tags:-b-p-/b-/p:the-html-element-6>a href#the-html-element>html/a>/code>ul>li classt1>code idmisnested-tags:-b-p-/b-/p:the-head-element-5>a href#the-head-element>head/a>/code>li classt1>code idmisnested-tags:-b-p-/b-/p:the-body-element-7>a href#the-body-element>body/a>/code>ul>li classt1>code idmisnested-tags:-b-p-/b-/p:the-b-element-14>a href#the-b-element>b/a>/code>ul>li classt3>code idmisnested-tags:-b-p-/b-/p:text-9>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>1/span>/ul>li classt1>code idmisnested-tags:-b-p-/b-/p:the-p-element-11>a href#the-p-element>p/a>/code>ul>li classt1>code idmisnested-tags:-b-p-/b-/p:the-b-element-15>a href#the-b-element>b/a>/code>ul>li classt3>code idmisnested-tags:-b-p-/b-/p:text-10>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>2/span>/ul>li classt3>code idmisnested-tags:-b-p-/b-/p:text-11>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>3/span>/ul>/ul>/ul>/ul> h5 idunexpected-markup-in-tables>span classsecno>12.2.9.3/span> Unexpected markup in tablesa href#unexpected-markup-in-tables classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>Error handling in tables is, for historical reasons, especially strange. For example, consider the following markup:/p> pre><table>strong><b>/strong><tr><td>aaa</td></tr>strong>bbb/strong></table>ccc/pre> p>The highlighted code idunexpected-markup-in-tables:the-b-element>a href#the-b-element>b/a>/code> element start tag is not allowed directly inside a table like that, and the parser handles this case by placing the element em>before/em> the table. (This is called i idunexpected-markup-in-tables:foster-parent>a href#foster-parent>foster parenting/a>/i>.) This can be seen by examining the DOM tree as it stands just after the code idunexpected-markup-in-tables:the-table-element>a href#the-table-element>table/a>/code> elements start tag has been seen:/p> ul classdomTree>li classt1>code idunexpected-markup-in-tables:the-html-element>a href#the-html-element>html/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-head-element>a href#the-head-element>head/a>/code>li classt1>code idunexpected-markup-in-tables:the-body-element>a href#the-body-element>body/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-table-element-2>a href#the-table-element>table/a>/code>/ul>/ul>/ul> p>...and then immediately after the code idunexpected-markup-in-tables:the-b-element-2>a href#the-b-element>b/a>/code> element start tag has been seen:/p> ul classdomTree>li classt1>code idunexpected-markup-in-tables:the-html-element-2>a href#the-html-element>html/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-head-element-2>a href#the-head-element>head/a>/code>li classt1>code idunexpected-markup-in-tables:the-body-element-2>a href#the-body-element>body/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-b-element-3>a href#the-b-element>b/a>/code>li classt1>code idunexpected-markup-in-tables:the-table-element-3>a href#the-table-element>table/a>/code>/ul>/ul>/ul> p>At this point, the a href#stack-of-open-elements idunexpected-markup-in-tables:stack-of-open-elements>stack of open elements/a> has on it the elements code idunexpected-markup-in-tables:the-html-element-3>a href#the-html-element>html/a>/code>, code idunexpected-markup-in-tables:the-body-element-3>a href#the-body-element>body/a>/code>, code idunexpected-markup-in-tables:the-table-element-4>a href#the-table-element>table/a>/code>, and code idunexpected-markup-in-tables:the-b-element-4>a href#the-b-element>b/a>/code> (in that order, despite the resulting DOM tree); the a href#list-of-active-formatting-elements idunexpected-markup-in-tables:list-of-active-formatting-elements>list of active formatting elements/a> just has the code idunexpected-markup-in-tables:the-b-element-5>a href#the-b-element>b/a>/code> element in it; and the a href#insertion-mode idunexpected-markup-in-tables:insertion-mode>insertion mode/a> is a href#parsing-main-intable idunexpected-markup-in-tables:parsing-main-intable>in table/a>./p> p>The code idunexpected-markup-in-tables:the-tr-element>a href#the-tr-element>tr/a>/code> start tag causes the code idunexpected-markup-in-tables:the-b-element-6>a href#the-b-element>b/a>/code> element to be popped off the stack and a code idunexpected-markup-in-tables:the-tbody-element>a href#the-tbody-element>tbody/a>/code> start tag to be implied; the code idunexpected-markup-in-tables:the-tbody-element-2>a href#the-tbody-element>tbody/a>/code> and code idunexpected-markup-in-tables:the-tr-element-2>a href#the-tr-element>tr/a>/code> elements are then handled in a rather straight-forward manner, taking the parser through the a href#parsing-main-intbody idunexpected-markup-in-tables:parsing-main-intbody>in table body/a> and a href#parsing-main-intr idunexpected-markup-in-tables:parsing-main-intr>in row/a> insertion modes, after which the DOM looks as follows:/p> ul classdomTree>li classt1>code idunexpected-markup-in-tables:the-html-element-4>a href#the-html-element>html/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-head-element-3>a href#the-head-element>head/a>/code>li classt1>code idunexpected-markup-in-tables:the-body-element-4>a href#the-body-element>body/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-b-element-7>a href#the-b-element>b/a>/code>li classt1>code idunexpected-markup-in-tables:the-table-element-5>a href#the-table-element>table/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-tbody-element-3>a href#the-tbody-element>tbody/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-tr-element-3>a href#the-tr-element>tr/a>/code>/ul>/ul>/ul>/ul>/ul> p>Here, the a href#stack-of-open-elements idunexpected-markup-in-tables:stack-of-open-elements-2>stack of open elements/a> has on it the elements code idunexpected-markup-in-tables:the-html-element-5>a href#the-html-element>html/a>/code>, code idunexpected-markup-in-tables:the-body-element-5>a href#the-body-element>body/a>/code>, code idunexpected-markup-in-tables:the-table-element-6>a href#the-table-element>table/a>/code>, code idunexpected-markup-in-tables:the-tbody-element-4>a href#the-tbody-element>tbody/a>/code>, and code idunexpected-markup-in-tables:the-tr-element-4>a href#the-tr-element>tr/a>/code>; the a href#list-of-active-formatting-elements idunexpected-markup-in-tables:list-of-active-formatting-elements-2>list of active formatting elements/a> still has the code idunexpected-markup-in-tables:the-b-element-8>a href#the-b-element>b/a>/code> element in it; and the a href#insertion-mode idunexpected-markup-in-tables:insertion-mode-2>insertion mode/a> is a href#parsing-main-intr idunexpected-markup-in-tables:parsing-main-intr-2>in row/a>./p> p>The code idunexpected-markup-in-tables:the-td-element>a href#the-td-element>td/a>/code> element start tag token, after putting a code idunexpected-markup-in-tables:the-td-element-2>a href#the-td-element>td/a>/code> element on the tree, puts a a href#concept-parser-marker idunexpected-markup-in-tables:concept-parser-marker>marker/a> on the a href#list-of-active-formatting-elements idunexpected-markup-in-tables:list-of-active-formatting-elements-3>list of active formatting elements/a> (it also switches to the a href#parsing-main-intd idunexpected-markup-in-tables:parsing-main-intd>in cell/a> a href#insertion-mode idunexpected-markup-in-tables:insertion-mode-3>insertion mode/a>)./p> ul classdomTree>li classt1>code idunexpected-markup-in-tables:the-html-element-6>a href#the-html-element>html/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-head-element-4>a href#the-head-element>head/a>/code>li classt1>code idunexpected-markup-in-tables:the-body-element-6>a href#the-body-element>body/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-b-element-9>a href#the-b-element>b/a>/code>li classt1>code idunexpected-markup-in-tables:the-table-element-7>a href#the-table-element>table/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-tbody-element-5>a href#the-tbody-element>tbody/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-tr-element-5>a href#the-tr-element>tr/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-td-element-3>a href#the-td-element>td/a>/code>/ul>/ul>/ul>/ul>/ul>/ul> p>The a href#concept-parser-marker idunexpected-markup-in-tables:concept-parser-marker-2>marker/a> means that when the aaa character tokens are seen, no code idunexpected-markup-in-tables:the-b-element-10>a href#the-b-element>b/a>/code> element is created to hold the resulting code idunexpected-markup-in-tables:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node:/p> ul classdomTree>li classt1>code idunexpected-markup-in-tables:the-html-element-7>a href#the-html-element>html/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-head-element-5>a href#the-head-element>head/a>/code>li classt1>code idunexpected-markup-in-tables:the-body-element-7>a href#the-body-element>body/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-b-element-11>a href#the-b-element>b/a>/code>li classt1>code idunexpected-markup-in-tables:the-table-element-8>a href#the-table-element>table/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-tbody-element-6>a href#the-tbody-element>tbody/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-tr-element-6>a href#the-tr-element>tr/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-td-element-4>a href#the-td-element>td/a>/code>ul>li classt3>code idunexpected-markup-in-tables:text-2>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>aaa/span>/ul>/ul>/ul>/ul>/ul>/ul>/ul> p>The end tags are handled in a straight-forward manner; after handling them, the a href#stack-of-open-elements idunexpected-markup-in-tables:stack-of-open-elements-3>stack of open elements/a> has on it the elements code idunexpected-markup-in-tables:the-html-element-8>a href#the-html-element>html/a>/code>, code idunexpected-markup-in-tables:the-body-element-8>a href#the-body-element>body/a>/code>, code idunexpected-markup-in-tables:the-table-element-9>a href#the-table-element>table/a>/code>, and code idunexpected-markup-in-tables:the-tbody-element-7>a href#the-tbody-element>tbody/a>/code>; the a href#list-of-active-formatting-elements idunexpected-markup-in-tables:list-of-active-formatting-elements-4>list of active formatting elements/a> still has the code idunexpected-markup-in-tables:the-b-element-12>a href#the-b-element>b/a>/code> element in it (the a href#concept-parser-marker idunexpected-markup-in-tables:concept-parser-marker-3>marker/a> having been removed by the td end tag token); and the a href#insertion-mode idunexpected-markup-in-tables:insertion-mode-4>insertion mode/a> is a href#parsing-main-intbody idunexpected-markup-in-tables:parsing-main-intbody-2>in table body/a>./p> p>Thus it is that the bbb character tokens are found. These trigger the a href#parsing-main-intabletext idunexpected-markup-in-tables:parsing-main-intabletext>in table text/a> insertion mode to be used (with the a href#original-insertion-mode idunexpected-markup-in-tables:original-insertion-mode>original insertion mode/a> set to a href#parsing-main-intbody idunexpected-markup-in-tables:parsing-main-intbody-3>in table body/a>). The character tokens are collected, and when the next token (the code idunexpected-markup-in-tables:the-table-element-10>a href#the-table-element>table/a>/code> element end tag) is seen, they are processed as a group. Since they are not all spaces, they are handled as per the anything else rules in the a href#parsing-main-intable idunexpected-markup-in-tables:parsing-main-intable-2>in table/a> insertion mode, which defer to the a href#parsing-main-inbody idunexpected-markup-in-tables:parsing-main-inbody>in body/a> insertion mode but with a href#foster-parent idunexpected-markup-in-tables:foster-parent-2>foster parenting/a>./p> p>When a href#reconstruct-the-active-formatting-elements idunexpected-markup-in-tables:reconstruct-the-active-formatting-elements>the active formatting elements are reconstructed/a>, a code idunexpected-markup-in-tables:the-b-element-13>a href#the-b-element>b/a>/code> element is created and a href#foster-parent idunexpected-markup-in-tables:foster-parent-3>foster parented/a>, and then the bbb code idunexpected-markup-in-tables:text-3>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node is appended to it:/p> ul classdomTree>li classt1>code idunexpected-markup-in-tables:the-html-element-9>a href#the-html-element>html/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-head-element-6>a href#the-head-element>head/a>/code>li classt1>code idunexpected-markup-in-tables:the-body-element-9>a href#the-body-element>body/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-b-element-14>a href#the-b-element>b/a>/code>li classt1>code idunexpected-markup-in-tables:the-b-element-15>a href#the-b-element>b/a>/code>ul>li classt3>code idunexpected-markup-in-tables:text-4>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>bbb/span>/ul>li classt1>code idunexpected-markup-in-tables:the-table-element-11>a href#the-table-element>table/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-tbody-element-8>a href#the-tbody-element>tbody/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-tr-element-7>a href#the-tr-element>tr/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-td-element-5>a href#the-td-element>td/a>/code>ul>li classt3>code idunexpected-markup-in-tables:text-5>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>aaa/span>/ul>/ul>/ul>/ul>/ul>/ul>/ul> p>The a href#stack-of-open-elements idunexpected-markup-in-tables:stack-of-open-elements-4>stack of open elements/a> has on it the elements code idunexpected-markup-in-tables:the-html-element-10>a href#the-html-element>html/a>/code>, code idunexpected-markup-in-tables:the-body-element-10>a href#the-body-element>body/a>/code>, code idunexpected-markup-in-tables:the-table-element-12>a href#the-table-element>table/a>/code>, code idunexpected-markup-in-tables:the-tbody-element-9>a href#the-tbody-element>tbody/a>/code>, and the new code idunexpected-markup-in-tables:the-b-element-16>a href#the-b-element>b/a>/code> (again, note that this doesnt match the resulting tree!); the a href#list-of-active-formatting-elements idunexpected-markup-in-tables:list-of-active-formatting-elements-5>list of active formatting elements/a> has the new code idunexpected-markup-in-tables:the-b-element-17>a href#the-b-element>b/a>/code> element in it; and the a href#insertion-mode idunexpected-markup-in-tables:insertion-mode-5>insertion mode/a> is still a href#parsing-main-intbody idunexpected-markup-in-tables:parsing-main-intbody-4>in table body/a>./p> p>Had the character tokens been only a idunexpected-markup-in-tables:space-characters hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> instead of bbb, then that a idunexpected-markup-in-tables:space-characters-2 hrefhttps://infra.spec.whatwg.org/#ascii-whitespace data-x-internalspace-characters>ASCII whitespace/a> would just be appended to the code idunexpected-markup-in-tables:the-tbody-element-10>a href#the-tbody-element>tbody/a>/code> element./p> p>Finally, the code idunexpected-markup-in-tables:the-table-element-13>a href#the-table-element>table/a>/code> is closed by a table end tag. This pops all the nodes from the a href#stack-of-open-elements idunexpected-markup-in-tables:stack-of-open-elements-5>stack of open elements/a> up to and including the code idunexpected-markup-in-tables:the-table-element-14>a href#the-table-element>table/a>/code> element, but it doesnt affect the a href#list-of-active-formatting-elements idunexpected-markup-in-tables:list-of-active-formatting-elements-6>list of active formatting elements/a>, so the ccc character tokens after the table result in yet another code idunexpected-markup-in-tables:the-b-element-18>a href#the-b-element>b/a>/code> element being created, this time after the table:/p> ul classdomTree>li classt1>code idunexpected-markup-in-tables:the-html-element-11>a href#the-html-element>html/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-head-element-7>a href#the-head-element>head/a>/code>li classt1>code idunexpected-markup-in-tables:the-body-element-11>a href#the-body-element>body/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-b-element-19>a href#the-b-element>b/a>/code>li classt1>code idunexpected-markup-in-tables:the-b-element-20>a href#the-b-element>b/a>/code>ul>li classt3>code idunexpected-markup-in-tables:text-6>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>bbb/span>/ul>li classt1>code idunexpected-markup-in-tables:the-table-element-15>a href#the-table-element>table/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-tbody-element-11>a href#the-tbody-element>tbody/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-tr-element-8>a href#the-tr-element>tr/a>/code>ul>li classt1>code idunexpected-markup-in-tables:the-td-element-6>a href#the-td-element>td/a>/code>ul>li classt3>code idunexpected-markup-in-tables:text-7>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>aaa/span>/ul>/ul>/ul>/ul>li classt1>code idunexpected-markup-in-tables:the-b-element-21>a href#the-b-element>b/a>/code>ul>li classt3>code idunexpected-markup-in-tables:text-8>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>ccc/span>/ul>/ul>/ul>/ul> h5 idscripts-that-modify-the-page-as-it-is-being-parsed>span classsecno>12.2.9.4/span> Scripts that modify the page as it is being parseda href#scripts-that-modify-the-page-as-it-is-being-parsed classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>Consider the following markup, which for this example we will assume is the document with a idscripts-that-modify-the-page-as-it-is-being-parsed:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> code>https://example.com/inner/code>, being rendered as the content of an code idscripts-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 idscripts-that-modify-the-page-as-it-is-being-parsed:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> code>https://example.com/outer/code>:/p> pre><div ida> <script> var div document.getElementById(a); parent.document.body.appendChild(div); </script> <script> alert(document.URL); </script></div><script> alert(document.URL);</script>/pre> p>Up to the first script end tag, before the script is parsed, the result is relatively straightforward:/p> ul classdomTree>li classt1>code idscripts-that-modify-the-page-as-it-is-being-parsed:the-html-element>a href#the-html-element>html/a>/code>ul>li classt1>code idscripts-that-modify-the-page-as-it-is-being-parsed:the-head-element>a href#the-head-element>head/a>/code>li classt1>code idscripts-that-modify-the-page-as-it-is-being-parsed:the-body-element>a href#the-body-element>body/a>/code>ul>li classt1>code idscripts-that-modify-the-page-as-it-is-being-parsed:the-div-element>a href#the-div-element>div/a>/code> span classt2>code idscripts-that-modify-the-page-as-it-is-being-parsed:the-id-attribute classattribute name>a href#the-id-attribute>id/a>/code>code classattribute value>a/code>/span>ul>li classt3>code idscripts-that-modify-the-page-as-it-is-being-parsed:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span> /span>li classt1>code idscripts-that-modify-the-page-as-it-is-being-parsed:the-script-element>a href#the-script-element>script/a>/code>ul>li classt3>code idscripts-that-modify-the-page-as-it-is-being-parsed:text-2>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>var div document.getElementById(a); ⏎ parent.document.body.appendChild(div);/span>/ul>/ul>/ul>/ul>/ul> p>After the script is parsed, though, the code idscripts-that-modify-the-page-as-it-is-being-parsed:the-div-element-2>a href#the-div-element>div/a>/code> element and its child code idscripts-that-modify-the-page-as-it-is-being-parsed:the-script-element-2>a href#the-script-element>script/a>/code> element are gone:/p> ul classdomTree>li classt1>code idscripts-that-modify-the-page-as-it-is-being-parsed:the-html-element-2>a href#the-html-element>html/a>/code>ul>li classt1>code idscripts-that-modify-the-page-as-it-is-being-parsed:the-head-element-2>a href#the-head-element>head/a>/code>li classt1>code idscripts-that-modify-the-page-as-it-is-being-parsed:the-body-element-2>a href#the-body-element>body/a>/code>/ul>/ul> p>They are, at this point, in the code idscripts-that-modify-the-page-as-it-is-being-parsed:document>a href#document>Document/a>/code> of the aforementioned outer a href#browsing-context idscripts-that-modify-the-page-as-it-is-being-parsed:browsing-context>browsing context/a>. However, the a href#stack-of-open-elements idscripts-that-modify-the-page-as-it-is-being-parsed:stack-of-open-elements>stack of open elements/a> em>still contains the code idscripts-that-modify-the-page-as-it-is-being-parsed:the-div-element-3>a href#the-div-element>div/a>/code> element/em>./p> p>Thus, when the second code idscripts-that-modify-the-page-as-it-is-being-parsed:the-script-element-3>a href#the-script-element>script/a>/code> element is parsed, it is inserted em>into the outer code idscripts-that-modify-the-page-as-it-is-being-parsed:document-2>a href#document>Document/a>/code> object/em>./p> p>Those parsed into different code idscripts-that-modify-the-page-as-it-is-being-parsed:document-3>a href#document>Document/a>/code>s than the one the parser was created for do not execute, so the first alert does not show./p> p>Once the code idscripts-that-modify-the-page-as-it-is-being-parsed:the-div-element-4>a href#the-div-element>div/a>/code> elements end tag is parsed, the code idscripts-that-modify-the-page-as-it-is-being-parsed:the-div-element-5>a href#the-div-element>div/a>/code> element is popped off the stack, and so the next code idscripts-that-modify-the-page-as-it-is-being-parsed:the-script-element-4>a href#the-script-element>script/a>/code> element is in the inner code idscripts-that-modify-the-page-as-it-is-being-parsed:document-4>a href#document>Document/a>/code>:/p> ul classdomTree>li classt1>code idscripts-that-modify-the-page-as-it-is-being-parsed:the-html-element-3>a href#the-html-element>html/a>/code>ul>li classt1>code idscripts-that-modify-the-page-as-it-is-being-parsed:the-head-element-3>a href#the-head-element>head/a>/code>li classt1>code idscripts-that-modify-the-page-as-it-is-being-parsed:the-body-element-3>a href#the-body-element>body/a>/code>ul>li classt1>code idscripts-that-modify-the-page-as-it-is-being-parsed:the-script-element-5>a href#the-script-element>script/a>/code>ul>li classt3>code idscripts-that-modify-the-page-as-it-is-being-parsed:text-3>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>alert(document.URL);/span>/ul>/ul>/ul>/ul> p>This script does execute, resulting in an alert that says https://example.com/inner./p> h5 idthe-execution-of-scripts-that-are-moving-across-multiple-documents>span classsecno>12.2.9.5/span> The execution of scripts that are moving across multiple documentsa href#the-execution-of-scripts-that-are-moving-across-multiple-documents classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>Elaborating on the example in the previous section, consider the case where the second code idthe-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 idthe-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 parsers code idthe-execution-of-scripts-that-are-moving-across-multiple-documents:document>a href#document>Document/a>/code> when it was created, that external script is not even downloaded./p> p>In a case where a code idthe-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 idthe-execution-of-scripts-that-are-moving-across-multiple-documents:attr-script-src-2>a href#attr-script-src>src/a>/code> attribute is parsed normally into its parsers code idthe-execution-of-scripts-that-are-moving-across-multiple-documents:document-2>a href#document>Document/a>/code>, but while the external script is being downloaded, the element is moved to another document, the script continues to download, but does not execute./p> p classnote>In general, moving code idthe-execution-of-scripts-that-are-moving-across-multiple-documents:the-script-element-3>a href#the-script-element>script/a>/code> elements between code idthe-execution-of-scripts-that-are-moving-across-multiple-documents:document-3>a href#document>Document/a>/code>s is considered a bad practice./p> h5 idunclosed-formatting-elements>span classsecno>12.2.9.6/span> Unclosed formatting elementsa href#unclosed-formatting-elements classself-link>/a>/h5> p>i>This section is non-normative./i>/p> p>The following markup shows how nested formatting elements (such as code idunclosed-formatting-elements:the-b-element>a href#the-b-element>b/a>/code>) get collected and continue to be applied even as the elements they are contained in are closed, but that excessive duplicates are thrown away./p> pre><!DOCTYPE html><p><b classx><b classx><b><b classx><b classx><b>X<p>X<p><b><b classx><b>X<p></b></b></b></b></b></b>X/pre> p>The resulting DOM tree is as follows:/p> ul classdomTree>li classt10>DOCTYPE: code>html/code>li classt1>code idunclosed-formatting-elements:the-html-element>a href#the-html-element>html/a>/code>ul>li classt1>code idunclosed-formatting-elements:the-head-element>a href#the-head-element>head/a>/code>li classt1>code idunclosed-formatting-elements:the-body-element>a href#the-body-element>body/a>/code>ul>li classt1>code idunclosed-formatting-elements:the-p-element>a href#the-p-element>p/a>/code>ul>li classt1>code idunclosed-formatting-elements:the-b-element-2>a href#the-b-element>b/a>/code> span classt2>code idunclosed-formatting-elements:classes classattribute name>a href#classes>class/a>/code>code classattribute value>x/code>/span>ul>li classt1>code idunclosed-formatting-elements:the-b-element-3>a href#the-b-element>b/a>/code> span classt2>code idunclosed-formatting-elements:classes-2 classattribute name>a href#classes>class/a>/code>code classattribute value>x/code>/span>ul>li classt1>code idunclosed-formatting-elements:the-b-element-4>a href#the-b-element>b/a>/code>ul>li classt1>code idunclosed-formatting-elements:the-b-element-5>a href#the-b-element>b/a>/code> span classt2>code idunclosed-formatting-elements:classes-3 classattribute name>a href#classes>class/a>/code>code classattribute value>x/code>/span>ul>li classt1>code idunclosed-formatting-elements:the-b-element-6>a href#the-b-element>b/a>/code> span classt2>code idunclosed-formatting-elements:classes-4 classattribute name>a href#classes>class/a>/code>code classattribute value>x/code>/span>ul>li classt1>code idunclosed-formatting-elements:the-b-element-7>a href#the-b-element>b/a>/code>ul>li classt3>code idunclosed-formatting-elements:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>X⏎/span>/ul>/ul>/ul>/ul>/ul>/ul>/ul>li classt1>code idunclosed-formatting-elements:the-p-element-2>a href#the-p-element>p/a>/code>ul>li classt1>code idunclosed-formatting-elements:the-b-element-8>a href#the-b-element>b/a>/code> span classt2>code idunclosed-formatting-elements:classes-5 classattribute name>a href#classes>class/a>/code>code classattribute value>x/code>/span>ul>li classt1>code idunclosed-formatting-elements:the-b-element-9>a href#the-b-element>b/a>/code>ul>li classt1>code idunclosed-formatting-elements:the-b-element-10>a href#the-b-element>b/a>/code> span classt2>code idunclosed-formatting-elements:classes-6 classattribute name>a href#classes>class/a>/code>code classattribute value>x/code>/span>ul>li classt1>code idunclosed-formatting-elements:the-b-element-11>a href#the-b-element>b/a>/code> span classt2>code idunclosed-formatting-elements:classes-7 classattribute name>a href#classes>class/a>/code>code classattribute value>x/code>/span>ul>li classt1>code idunclosed-formatting-elements:the-b-element-12>a href#the-b-element>b/a>/code>ul>li classt3>code idunclosed-formatting-elements:text-2>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>X⏎/span>/ul>/ul>/ul>/ul>/ul>/ul>li classt1>code idunclosed-formatting-elements:the-p-element-3>a href#the-p-element>p/a>/code>ul>li classt1>code idunclosed-formatting-elements:the-b-element-13>a href#the-b-element>b/a>/code> span classt2>code idunclosed-formatting-elements:classes-8 classattribute name>a href#classes>class/a>/code>code classattribute value>x/code>/span>ul>li classt1>code idunclosed-formatting-elements:the-b-element-14>a href#the-b-element>b/a>/code>ul>li classt1>code idunclosed-formatting-elements:the-b-element-15>a href#the-b-element>b/a>/code> span classt2>code idunclosed-formatting-elements:classes-9 classattribute name>a href#classes>class/a>/code>code classattribute value>x/code>/span>ul>li classt1>code idunclosed-formatting-elements:the-b-element-16>a href#the-b-element>b/a>/code> span classt2>code idunclosed-formatting-elements:classes-10 classattribute name>a href#classes>class/a>/code>code classattribute value>x/code>/span>ul>li classt1>code idunclosed-formatting-elements:the-b-element-17>a href#the-b-element>b/a>/code>ul>li classt1>code idunclosed-formatting-elements:the-b-element-18>a href#the-b-element>b/a>/code>ul>li classt1>code idunclosed-formatting-elements:the-b-element-19>a href#the-b-element>b/a>/code> span classt2>code idunclosed-formatting-elements:classes-11 classattribute name>a href#classes>class/a>/code>code classattribute value>x/code>/span>ul>li classt1>code idunclosed-formatting-elements:the-b-element-20>a href#the-b-element>b/a>/code>ul>li classt3>code idunclosed-formatting-elements:text-3>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>X⏎/span>/ul>/ul>/ul>/ul>/ul>/ul>/ul>/ul>/ul>li classt1>code idunclosed-formatting-elements:the-p-element-4>a href#the-p-element>p/a>/code>ul>li classt3>code idunclosed-formatting-elements:text-4>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>#text/a>/code>: span>X⏎/span>/ul>/ul>/ul>/ul> p>Note how the second code idunclosed-formatting-elements:the-p-element-5>a href#the-p-element>p/a>/code> element in the markup has no explicit code idunclosed-formatting-elements:the-b-element-21>a href#the-b-element>b/a>/code> elements, but in the resulting DOM, up to three of each kind of formatting element (in this case three code idunclosed-formatting-elements:the-b-element-22>a href#the-b-element>b/a>/code> elements with the class attribute, and two unadorned code idunclosed-formatting-elements:the-b-element-23>a href#the-b-element>b/a>/code> elements) get reconstructed before the elements X./p> p>Also note how this means that in the final paragraph only six code idunclosed-formatting-elements:the-b-element-24>a href#the-b-element>b/a>/code> end tags are needed to completely clear the a href#list-of-active-formatting-elements idunclosed-formatting-elements:list-of-active-formatting-elements>list of active formatting elements/a>, even though nine code idunclosed-formatting-elements:the-b-element-25>a href#the-b-element>b/a>/code> start tags have been seen up to this point./p> h3 idserialising-html-fragments>span classsecno>12.3/span> Serializing HTML fragmentsa href#serialising-html-fragments classself-link>/a>/h3> p>The following steps form the dfn data-export idhtml-fragment-serialisation-algorithm>HTML fragment serialization algorithm/dfn>. The algorithm takes as input a DOM code idserialising-html-fragments:element>a data-x-internalelement hrefhttps://dom.spec.whatwg.org/#interface-element>Element/a>/code>, code idserialising-html-fragments:document>a href#document>Document/a>/code>, or code idserialising-html-fragments:documentfragment>a data-x-internaldocumentfragment hrefhttps://dom.spec.whatwg.org/#interface-documentfragment>DocumentFragment/a>/code> referred to as var>the node/var>, and returns a string./p> p classnote>This algorithm serializes the em>children/em> of the node being serialized, not the node itself./p> ol>li>p>Let var>s/var> be a string, and initialize it to the empty string.li>p>If var>the node/var> is a code idserialising-html-fragments:the-template-element>a href#the-template-element>template/a>/code> element, then let var>the node/var> instead be the code idserialising-html-fragments:the-template-element-2>a href#the-template-element>template/a>/code> elements a href#template-contents idserialising-html-fragments:template-contents>template contents/a> (a code idserialising-html-fragments:documentfragment-2>a data-x-internaldocumentfragment hrefhttps://dom.spec.whatwg.org/#interface-documentfragment>DocumentFragment/a>/code> node).li> p>For each child node of var>the node/var>, in a idserialising-html-fragments:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>, run the following steps: ol>li>p>Let var>current node/var> be the child node being processed.li> p>Append the appropriate string from the following list to var>s/var>:/p> dl classswitch>dt>If var>current node/var> is an code>Element/code>dd> p>If var>current node/var> is an element in the a idserialising-html-fragments:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>, the a idserialising-html-fragments:mathml-namespace hrefhttps://infra.spec.whatwg.org/#mathml-namespace data-x-internalmathml-namespace>MathML namespace/a>, or the a idserialising-html-fragments:svg-namespace hrefhttps://infra.spec.whatwg.org/#svg-namespace data-x-internalsvg-namespace>SVG namespace/a>, then let var>tagname/var> be var>current node/var>s local name. Otherwise, let var>tagname/var> be var>current node/var>s qualified name./p> p>Append a U+003C LESS-THAN SIGN character (<), followed by var>tagname/var>./p> p classnote>For a href#html-elements idserialising-html-fragments:html-elements>HTML elements/a> created by the a href#html-parser idserialising-html-fragments:html-parser>HTML parser/a> or code idserialising-html-fragments:dom-document-createelement>a data-x-internaldom-document-createelement hrefhttps://dom.spec.whatwg.org/#dom-document-createelement>createElement()/a>/code>, var>tagname/var> will be lowercase./p> p>For each attribute that the element has, append a U+0020 SPACE character, the a href#attributes-serialised-name idserialising-html-fragments:attributes-serialised-name>attributes serialized name as described below/a>, a U+003D EQUALS SIGN character (), a U+0022 QUOTATION MARK character (), the attributes value, a href#escapingString idserialising-html-fragments:escapingString>escaped as described below/a> in i>attribute mode/i>, and a second U+0022 QUOTATION MARK character ()./p> p>An dfn idattributes-serialised-name>attributes serialized name/dfn> for the purposes of the previous paragraph must be determined as follows:/p> dl classswitch>dt>If the attribute has no namespacedd> p>The attributes serialized name is the attributes local name./p> p classnote>For attributes on a href#html-elements idserialising-html-fragments:html-elements-2>HTML elements/a> set by the a href#html-parser idserialising-html-fragments:html-parser-2>HTML parser/a> or by code>Element.setAttribute()/code>, the local name will be lowercase./p> dt>If the attribute is in the a idserialising-html-fragments:xml-namespace hrefhttps://infra.spec.whatwg.org/#xml-namespace data-x-internalxml-namespace>XML namespace/a>dd>p>The attributes serialized name is the string code>xml:/code> followed by the attributes local name.dt>If the attribute is in the a idserialising-html-fragments:xmlns-namespace hrefhttps://infra.spec.whatwg.org/#xmlns-namespace data-x-internalxmlns-namespace>XMLNS namespace/a> and the attributes local name is code>xmlns/code>dd>p>The attributes serialized name is the string code>xmlns/code>.dt>If the attribute is in the a idserialising-html-fragments:xmlns-namespace-2 hrefhttps://infra.spec.whatwg.org/#xmlns-namespace data-x-internalxmlns-namespace>XMLNS namespace/a> and the attributes local name is not code>xmlns/code>dd>p>The attributes serialized name is the string code>xmlns:/code> followed by the attributes local name.dt>If the attribute is in the a idserialising-html-fragments:xlink-namespace hrefhttps://infra.spec.whatwg.org/#xlink-namespace data-x-internalxlink-namespace>XLink namespace/a>dd>p>The attributes serialized name is the string code>xlink:/code> followed by the attributes local name.dt>If the attribute is in some other namespacedd>p>The attributes serialized name is the attributes qualified name./dl> p>While the exact order of attributes is UA-defined, and may depend on factors such as the order that the attributes were given in the original markup, the sort order must be stable, such that consecutive invocations of this algorithm serialize an elements attributes in the same order./p> p>Append a U+003E GREATER-THAN SIGN character (>)./p> p>If var>current node/var> is an code idserialising-html-fragments:the-area-element>a href#the-area-element>area/a>/code>, code idserialising-html-fragments:the-base-element>a href#the-base-element>base/a>/code>, code idserialising-html-fragments:basefont>a href#basefont>basefont/a>/code>, code idserialising-html-fragments:bgsound>a href#bgsound>bgsound/a>/code>, code idserialising-html-fragments:the-br-element>a href#the-br-element>br/a>/code>, code idserialising-html-fragments:the-col-element>a href#the-col-element>col/a>/code>, code idserialising-html-fragments:the-embed-element>a href#the-embed-element>embed/a>/code>, code idserialising-html-fragments:frame>a href#frame>frame/a>/code>, code idserialising-html-fragments:the-hr-element>a href#the-hr-element>hr/a>/code>, code idserialising-html-fragments:the-img-element>a href#the-img-element>img/a>/code>, code idserialising-html-fragments:the-input-element>a href#the-input-element>input/a>/code>, code idserialising-html-fragments:keygen>a href#keygen>keygen/a>/code>, code idserialising-html-fragments:the-link-element>a href#the-link-element>link/a>/code>, code idserialising-html-fragments:the-meta-element>a href#the-meta-element>meta/a>/code>, code idserialising-html-fragments:the-param-element>a href#the-param-element>param/a>/code>, code idserialising-html-fragments:the-source-element>a href#the-source-element>source/a>/code>, code idserialising-html-fragments:the-track-element>a href#the-track-element>track/a>/code> or code idserialising-html-fragments:the-wbr-element>a href#the-wbr-element>wbr/a>/code> element, then continue on to the next child node at this point./p> p>Append the value of running the a href#html-fragment-serialisation-algorithm idserialising-html-fragments:html-fragment-serialisation-algorithm>HTML fragment serialization algorithm/a> on the var>current node/var> element (thus recursing into this algorithm for that element), followed by a U+003C LESS-THAN SIGN character (<), a U+002F SOLIDUS character (/), var>tagname/var> again, and finally a U+003E GREATER-THAN SIGN character (>)./p> dt>If var>current node/var> is a code>Text/code> nodedd> p>If the parent of var>current node/var> is a code idserialising-html-fragments:the-style-element>a href#the-style-element>style/a>/code>, code idserialising-html-fragments:the-script-element>a href#the-script-element>script/a>/code>, code idserialising-html-fragments:xmp>a href#xmp>xmp/a>/code>, code idserialising-html-fragments:the-iframe-element>a href#the-iframe-element>iframe/a>/code>, code idserialising-html-fragments:noembed>a href#noembed>noembed/a>/code>, code idserialising-html-fragments:noframes>a href#noframes>noframes/a>/code>, or code idserialising-html-fragments:plaintext>a href#plaintext>plaintext/a>/code> element, or if the parent of var>current node/var> is a code idserialising-html-fragments:the-noscript-element>a href#the-noscript-element>noscript/a>/code> element and a href#concept-n-script idserialising-html-fragments:concept-n-script>scripting is enabled/a> for the node, then append the value of var>current node/var>s code>data/code> IDL attribute literally./p> p>Otherwise, append the value of var>current node/var>s code>data/code> IDL attribute, a href#escapingString idserialising-html-fragments:escapingString-2>escaped as described below/a>./p> dt>If var>current node/var> is a code>Comment/code>dd> p>Append the literal string code><!--/code> (U+003C LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS), followed by the value of var>current node/var>s code>data/code> IDL attribute, followed by the literal string code>-->/code> (U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E GREATER-THAN SIGN)./p> dt>If var>current node/var> is a code>ProcessingInstruction/code>dd> p>Append the literal string code><?/code> (U+003C LESS-THAN SIGN, U+003F QUESTION MARK), followed by the value of var>current node/var>s code>target/code> IDL attribute, followed by a single U+0020 SPACE character, followed by the value of var>current node/var>s code>data/code> IDL attribute, followed by a single U+003E GREATER-THAN SIGN character (>)./p> dt>If var>current node/var> is a code>DocumentType/code>dd> p>Append the literal string code><!DOCTYPE/code> (U+003C LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+0044 LATIN CAPITAL LETTER D, U+004F LATIN CAPITAL LETTER O, U+0043 LATIN CAPITAL LETTER C, U+0054 LATIN CAPITAL LETTER T, U+0059 LATIN CAPITAL LETTER Y, U+0050 LATIN CAPITAL LETTER P, U+0045 LATIN CAPITAL LETTER E), followed by a space (U+0020 SPACE), followed by the value of var>current node/var>s code>name/code> IDL attribute, followed by the literal string code>>/code> (U+003E GREATER-THAN SIGN)./p> /dl> /ol> li>p>The result of the algorithm is the string var>s/var>./ol> p classwarning>It is possible that the output of this algorithm, if parsed with an a href#html-parser idserialising-html-fragments:html-parser-3>HTML parser/a>, will not return the original tree structure. Tree structures that do not roundtrip a serialize and reparse step can also be produced by the a href#html-parser idserialising-html-fragments:html-parser-4>HTML parser/a> itself, although such cases are typically non-conforming./p> div classexample> p>For instance, if a code idserialising-html-fragments:the-textarea-element>a href#the-textarea-element>textarea/a>/code> element to which a code>Comment/code> node has been appended is serialized and the output is then reparsed, the comment will end up being displayed in the text control. Similarly, if, as a result of DOM manipulation, an element contains a comment that contains the literal string code>-->/code>, then when the result of serializing the element is parsed, the comment will be truncated at that point and the rest of the comment will be interpreted as markup. More examples would be making a code idserialising-html-fragments:the-script-element-2>a href#the-script-element>script/a>/code> element contain a code idserialising-html-fragments:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node with the text string code></script>/code>, or having a code idserialising-html-fragments:the-p-element>a href#the-p-element>p/a>/code> element that contains a code idserialising-html-fragments:the-ul-element>a href#the-ul-element>ul/a>/code> element (as the code idserialising-html-fragments:the-ul-element-2>a href#the-ul-element>ul/a>/code> elements a href#syntax-start-tag idserialising-html-fragments:syntax-start-tag>start tag/a> would imply the end tag for the code idserialising-html-fragments:the-p-element-2>a href#the-p-element>p/a>/code>)./p> p>This can enable cross-site scripting attacks. An example of this would be a page that lets the user enter some font family names that are then inserted into a CSS code idserialising-html-fragments:the-style-element-2>a href#the-style-element>style/a>/code> block via the DOM and which then uses the code idserialising-html-fragments:dom-innerhtml>a data-x-internaldom-innerhtml hrefhttps://w3c.github.io/DOM-Parsing/#dom-element-innerhtml>innerHTML/a>/code> IDL attribute to get the HTML serialization of that code idserialising-html-fragments:the-style-element-3>a href#the-style-element>style/a>/code> element: if the user enters code></style><script>attack</script>/code> as a font family name, code idserialising-html-fragments:dom-innerhtml-2>a data-x-internaldom-innerhtml hrefhttps://w3c.github.io/DOM-Parsing/#dom-element-innerhtml>innerHTML/a>/code> will return markup that, if parsed in a different context, would contain a code idserialising-html-fragments:the-script-element-3>a href#the-script-element>script/a>/code> node, even though no code idserialising-html-fragments:the-script-element-4>a href#the-script-element>script/a>/code> node existed in the original DOM./p> /div> div classexample> p>For example, consider the following markup:/p> pre><form idouter><div></form><form idinner><input>/pre> p>This will be parsed into:/p> ul classdomTree>li classt1>code idserialising-html-fragments:the-html-element>a href#the-html-element>html/a>/code>ul>li classt1>code idserialising-html-fragments:the-head-element>a href#the-head-element>head/a>/code>li classt1>code idserialising-html-fragments:the-body-element>a href#the-body-element>body/a>/code>ul>li classt1>code idserialising-html-fragments:the-form-element>a href#the-form-element>form/a>/code> span classt2>code idserialising-html-fragments:the-id-attribute classattribute name>a href#the-id-attribute>id/a>/code>code classattribute value>outer/code>/span>ul>li classt1>code idserialising-html-fragments:the-div-element>a href#the-div-element>div/a>/code>ul>li classt1>code idserialising-html-fragments:the-form-element-2>a href#the-form-element>form/a>/code> span classt2>code idserialising-html-fragments:the-id-attribute-2 classattribute name>a href#the-id-attribute>id/a>/code>code classattribute value>inner/code>/span>ul>li classt1>code idserialising-html-fragments:the-input-element-2>a href#the-input-element>input/a>/code>/ul>/ul>/ul>/ul>/ul>/ul> p>The code idserialising-html-fragments:the-input-element-3>a href#the-input-element>input/a>/code> element will be associated with the inner code idserialising-html-fragments:the-form-element-3>a href#the-form-element>form/a>/code> element. Now, if this tree structure is serialized and reparsed, the code><form idinner>/code> start tag will be ignored, and so the code idserialising-html-fragments:the-input-element-4>a href#the-input-element>input/a>/code> element will be associated with the outer code idserialising-html-fragments:the-form-element-4>a href#the-form-element>form/a>/code> element instead./p> pre><html><head></head><body><form idouter><div>mark><form idinner>/mark><input></form></div></form></body></html>/pre> ul classdomTree>li classt1>code idserialising-html-fragments:the-html-element-2>a href#the-html-element>html/a>/code>ul>li classt1>code idserialising-html-fragments:the-head-element-2>a href#the-head-element>head/a>/code>li classt1>code idserialising-html-fragments:the-body-element-2>a href#the-body-element>body/a>/code>ul>li classt1>code idserialising-html-fragments:the-form-element-5>a href#the-form-element>form/a>/code> span classt2>code idserialising-html-fragments:the-id-attribute-3 classattribute name>a href#the-id-attribute>id/a>/code>code classattribute value>outer/code>/span>ul>li classt1>code idserialising-html-fragments:the-div-element-2>a href#the-div-element>div/a>/code>ul>li classt1>code idserialising-html-fragments:the-input-element-5>a href#the-input-element>input/a>/code>/ul>/ul>/ul>/ul>/ul> /div> div classexample> p>As another example, consider the following markup:/p> pre><a><table><a>/pre> p>This will be parsed into:/p> ul classdomTree>li classt1>code idserialising-html-fragments:the-html-element-3>a href#the-html-element>html/a>/code>ul>li classt1>code idserialising-html-fragments:the-head-element-3>a href#the-head-element>head/a>/code>li classt1>code idserialising-html-fragments:the-body-element-3>a href#the-body-element>body/a>/code>ul>li classt1>code idserialising-html-fragments:the-a-element>a href#the-a-element>a/a>/code>ul>li classt1>code idserialising-html-fragments:the-a-element-2>a href#the-a-element>a/a>/code>li classt1>code idserialising-html-fragments:the-table-element>a href#the-table-element>table/a>/code>/ul>/ul>/ul>/ul> p>That is, the code idserialising-html-fragments:the-a-element-3>a href#the-a-element>a/a>/code> elements are nested, because the second code idserialising-html-fragments:the-a-element-4>a href#the-a-element>a/a>/code> element is a href#foster-parent idserialising-html-fragments:foster-parent>foster parented/a>. After a serialize-reparse roundtrip, the code idserialising-html-fragments:the-a-element-5>a href#the-a-element>a/a>/code> elements and the code idserialising-html-fragments:the-table-element-2>a href#the-table-element>table/a>/code> element would all be siblings, because the second code><a>/code> start tag implicitly closes the first code idserialising-html-fragments:the-a-element-6>a href#the-a-element>a/a>/code> element./p> pre><html><head></head><body><a>mark><a>/mark></a><table></table></a></body></html>/pre> ul classdomTree>li classt1>code idserialising-html-fragments:the-html-element-4>a href#the-html-element>html/a>/code>ul>li classt1>code idserialising-html-fragments:the-head-element-4>a href#the-head-element>head/a>/code>li classt1>code idserialising-html-fragments:the-body-element-4>a href#the-body-element>body/a>/code>ul>li classt1>code idserialising-html-fragments:the-a-element-7>a href#the-a-element>a/a>/code>li classt1>code idserialising-html-fragments:the-a-element-8>a href#the-a-element>a/a>/code>li classt1>code idserialising-html-fragments:the-table-element-3>a href#the-table-element>table/a>/code>/ul>/ul>/ul> /div> p>For historical reasons, this algorithm does not round-trip an initial U+000A LINE FEED (LF) character in code idserialising-html-fragments:the-pre-element>a href#the-pre-element>pre/a>/code>, code idserialising-html-fragments:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code>, or code idserialising-html-fragments:listing>a href#listing>listing/a>/code> elements, even though (in the first two cases) the markup being round-tripped can be conforming. The a href#html-parser idserialising-html-fragments:html-parser-5>HTML parser/a> will drop such a character during parsing, but this algorithm does em>not/em> serialize an extra U+000A LINE FEED (LF) character./p> div classexample> p>For example, consider the following markup:/p> pre><pre>Hello.</pre>/pre> p>When this document is first parsed, the code idserialising-html-fragments:the-pre-element-2>a href#the-pre-element>pre/a>/code> elements a idserialising-html-fragments:child-text-content hrefhttps://dom.spec.whatwg.org/#concept-child-text-content data-x-internalchild-text-content>child text content/a> starts with a single newline character. After a serialize-reparse roundtrip, the code idserialising-html-fragments:the-pre-element-3>a href#the-pre-element>pre/a>/code> elements a idserialising-html-fragments:child-text-content-2 hrefhttps://dom.spec.whatwg.org/#concept-child-text-content data-x-internalchild-text-content>child text content/a> is simply code>Hello./code>./p> /div> p>dfn idescapingString>Escaping a string/dfn> (for the purposes of the algorithm above) consists of running the following steps:/p> ol>li>p>Replace any occurrence of the code>&/code> character by the string code>&/code>.li>p>Replace any occurrences of the U+00A0 NO-BREAK SPACE character by the string code> /code>.li>p>If the algorithm was invoked in the i>attribute mode/i>, replace any occurrences of the code>/code> character by the string code>"/code>.li>p>If the algorithm was em>not/em> invoked in the i>attribute mode/i>, replace any occurrences of the code></code> character by the string code></code>, and any occurrences of the code>>/code> character by the string code>>/code>./ol> h3 idparsing-html-fragments>span classsecno>12.4/span> Parsing HTML fragmentsa href#parsing-html-fragments classself-link>/a>/h3> p>The following steps form the dfn idhtml-fragment-parsing-algorithm>HTML fragment parsing algorithm/dfn>. The algorithm takes as input an code idparsing-html-fragments:element>a data-x-internalelement hrefhttps://dom.spec.whatwg.org/#interface-element>Element/a>/code> node, referred to as the dfn idconcept-frag-parse-context>var>context/var>/dfn> element, which gives the context for the parser, as well as var>input/var>, a string to parse, and returns a list of zero or more nodes./p> p classnote>Parts marked dfn idfragment-case>fragment case/dfn> in algorithms in the parser section are parts that only occur if the parser was created for the purposes of this algorithm. The algorithms have been annotated with such markings for informational purposes only; such markings have no normative weight. If it is possible for a condition described as a a href#fragment-case idparsing-html-fragments:fragment-case>fragment case/a> to occur even when the parser wasnt created for the purposes of handling this algorithm, then that is an error in the specification./p> ol>li> p>Create a new code idparsing-html-fragments:document>a href#document>Document/a>/code> node, and mark it as being an a hrefhttps://dom.spec.whatwg.org/#html-document idparsing-html-fragments:html-documents data-x-internalhtml-documents>HTML document/a>./p> li> p>If the a idparsing-html-fragments:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> of the var idparsing-html-fragments:concept-frag-parse-context>a href#concept-frag-parse-context>context/a>/var> element is in a idparsing-html-fragments:quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>, then let the code idparsing-html-fragments:document-2>a href#document>Document/a>/code> be in a idparsing-html-fragments:quirks-mode-2 hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>. Otherwise, the a idparsing-html-fragments:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> of the var idparsing-html-fragments:concept-frag-parse-context-2>a href#concept-frag-parse-context>context/a>/var> element is in a idparsing-html-fragments:limited-quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-limited-quirks data-x-internallimited-quirks-mode>limited-quirks mode/a>, then let the code idparsing-html-fragments:document-3>a href#document>Document/a>/code> be in a idparsing-html-fragments:limited-quirks-mode-2 hrefhttps://dom.spec.whatwg.org/#concept-document-limited-quirks data-x-internallimited-quirks-mode>limited-quirks mode/a>. Otherwise, leave the code idparsing-html-fragments:document-4>a href#document>Document/a>/code> in a idparsing-html-fragments:no-quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-no-quirks data-x-internalno-quirks-mode>no-quirks mode/a>./p> li> p>Create a new a href#html-parser idparsing-html-fragments:html-parser>HTML parser/a>, and associate it with the just created code idparsing-html-fragments:document-5>a href#document>Document/a>/code> node./p> li> p>Set the state of the a href#html-parser idparsing-html-fragments:html-parser-2>HTML parser/a>s a href#tokenization idparsing-html-fragments:tokenization>tokenization/a> stage as follows, switching on the var idparsing-html-fragments:concept-frag-parse-context-3>a href#concept-frag-parse-context>context/a>/var> element:/p> dl classswitch>dt>code idparsing-html-fragments:the-title-element>a href#the-title-element>title/a>/code>dt>code idparsing-html-fragments:the-textarea-element>a href#the-textarea-element>textarea/a>/code>dd>Switch the tokenizer to the a href#rcdata-state idparsing-html-fragments:rcdata-state>RCDATA state/a>.dt>code idparsing-html-fragments:the-style-element>a href#the-style-element>style/a>/code>dt>code idparsing-html-fragments:xmp>a href#xmp>xmp/a>/code>dt>code idparsing-html-fragments:the-iframe-element>a href#the-iframe-element>iframe/a>/code>dt>code idparsing-html-fragments:noembed>a href#noembed>noembed/a>/code>dt>code idparsing-html-fragments:noframes>a href#noframes>noframes/a>/code>dd>Switch the tokenizer to the a href#rawtext-state idparsing-html-fragments:rawtext-state>RAWTEXT state/a>.dt>code idparsing-html-fragments:the-script-element>a href#the-script-element>script/a>/code>dd>Switch the tokenizer to the a href#script-data-state idparsing-html-fragments:script-data-state>script data state/a>.dt>code idparsing-html-fragments:the-noscript-element>a href#the-noscript-element>noscript/a>/code>dd>If the a href#scripting-flag idparsing-html-fragments:scripting-flag>scripting flag/a> is enabled, switch the tokenizer to the a href#rawtext-state idparsing-html-fragments:rawtext-state-2>RAWTEXT state/a>. Otherwise, leave the tokenizer in the a href#data-state idparsing-html-fragments:data-state>data state/a>.dt>code idparsing-html-fragments:plaintext>a href#plaintext>plaintext/a>/code>dd>Switch the tokenizer to the a href#plaintext-state idparsing-html-fragments:plaintext-state>PLAINTEXT state/a>.dt>Any other elementdd>Leave the tokenizer in the a href#data-state idparsing-html-fragments:data-state-2>data state/a>./dl> p classnote>For performance reasons, an implementation that does not report errors and that uses the actual state machine described in this specification directly could use the PLAINTEXT state instead of the RAWTEXT and script data states where those are mentioned in the list above. Except for rules regarding parse errors, they are equivalent, since there is no a href#appropriate-end-tag-token idparsing-html-fragments:appropriate-end-tag-token>appropriate end tag token/a> in the fragment case, yet they involve far fewer state transitions./p> li> p>Let var>root/var> be a new code idparsing-html-fragments:the-html-element>a href#the-html-element>html/a>/code> element with no attributes./p> li> p>Append the element var>root/var> to the code idparsing-html-fragments:document-6>a href#document>Document/a>/code> node created above./p> li> p>Set up the parsers a href#stack-of-open-elements idparsing-html-fragments:stack-of-open-elements>stack of open elements/a> so that it contains just the single element var>root/var>./p> li> p>If the var idparsing-html-fragments:concept-frag-parse-context-4>a href#concept-frag-parse-context>context/a>/var> element is a code idparsing-html-fragments:the-template-element>a href#the-template-element>template/a>/code> element, push a href#parsing-main-intemplate idparsing-html-fragments:parsing-main-intemplate>in template/a> onto the a href#stack-of-template-insertion-modes idparsing-html-fragments:stack-of-template-insertion-modes>stack of template insertion modes/a> so that it is the new a href#current-template-insertion-mode idparsing-html-fragments:current-template-insertion-mode>current template insertion mode/a>./p> li> p>Create a start tag token whose name is the local name of var idparsing-html-fragments:concept-frag-parse-context-5>a href#concept-frag-parse-context>context/a>/var> and whose attributes are the attributes of var idparsing-html-fragments:concept-frag-parse-context-6>a href#concept-frag-parse-context>context/a>/var>./p> p>Let this start tag token be the start tag token of the var idparsing-html-fragments:concept-frag-parse-context-7>a href#concept-frag-parse-context>context/a>/var> node, e.g. for the purposes of determining if it is an a href#html-integration-point idparsing-html-fragments:html-integration-point>HTML integration point/a>./p> li> p>a href#reset-the-insertion-mode-appropriately idparsing-html-fragments:reset-the-insertion-mode-appropriately>Reset the parsers insertion mode appropriately/a>./p> p classnote>The parser will reference the var idparsing-html-fragments:concept-frag-parse-context-8>a href#concept-frag-parse-context>context/a>/var> element as part of that algorithm./p> li> p>Set the parsers a href#form-element-pointer idparsing-html-fragments:form-element-pointer>code>form/code> element pointer/a> to the nearest node to the var idparsing-html-fragments:concept-frag-parse-context-9>a href#concept-frag-parse-context>context/a>/var> element that is a code idparsing-html-fragments:the-form-element>a href#the-form-element>form/a>/code> element (going straight up the ancestor chain, and including the element itself, if it is a code idparsing-html-fragments:the-form-element-2>a href#the-form-element>form/a>/code> element), if any. (If there is no such code idparsing-html-fragments:the-form-element-3>a href#the-form-element>form/a>/code> element, the a href#form-element-pointer idparsing-html-fragments:form-element-pointer-2>code>form/code> element pointer/a> keeps its initial value, null.)/p> li> p>Place the var>input/var> into the a href#input-stream idparsing-html-fragments:input-stream>input stream/a> for the a href#html-parser idparsing-html-fragments:html-parser-3>HTML parser/a> just created. The encoding a href#concept-encoding-confidence idparsing-html-fragments:concept-encoding-confidence>confidence/a> is i>irrelevant/i>./p> li> p>Start the parser and let it run until it has consumed all the characters just inserted into the input stream./p> li> p>Return the child nodes of var>root/var>, in a idparsing-html-fragments:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>./p> /ol> h3 idnamed-character-references>span classsecno>12.5/span> dfn>Named character references/dfn>a href#named-character-references classself-link>/a>/h3> p>This table lists the character reference names that are supported by HTML, and the code points to which they refer. It is referenced by the previous sections./p> div idnamed-character-references-table> table>thead>tr>th> Name th> Character(s) th> Glyph tbody>tr identity-Aacute>td> code>Aacute;/code> td> U+000C1 td> span classglyph>Á/span> tr identity-Aacute-legacy classimpl>td> code>Aacute/code> td> U+000C1 td> span>Á/span> tr identity-aacute>td> code>aacute;/code> td> U+000E1 td> span classglyph>á/span> tr identity-aacute-legacy classimpl>td> code>aacute/code> td> U+000E1 td> span>á/span> tr identity-Abreve>td> code>Abreve;/code> td> U+00102 td> span classglyph>Ă/span> tr identity-abreve>td> code>abreve;/code> td> U+00103 td> span classglyph>ă/span> tr identity-ac>td> code>ac;/code> td> U+0223E td> span classglyph>∾/span> tr identity-acd>td> code>acd;/code> td> U+0223F td> span classglyph>∿/span> tr identity-acE>td> code>acE;/code> td> U+0223E U+00333 td> span classglyph compound>∾̳/span> tr identity-Acirc>td> code>Acirc;/code> td> U+000C2 td> span classglyph>Â/span> tr identity-Acirc-legacy classimpl>td> code>Acirc/code> td> U+000C2 td> span>Â/span> tr identity-acirc>td> code>acirc;/code> td> U+000E2 td> span classglyph>â/span> tr identity-acirc-legacy classimpl>td> code>acirc/code> td> U+000E2 td> span>â/span> tr identity-acute>td> code>acute;/code> td> U+000B4 td> span classglyph>´/span> tr identity-acute-legacy classimpl>td> code>acute/code> td> U+000B4 td> span>´/span> tr identity-Acy>td> code>Acy;/code> td> U+00410 td> span classglyph>А/span> tr identity-acy>td> code>acy;/code> td> U+00430 td> span classglyph>а/span> tr identity-AElig>td> code>AElig;/code> td> U+000C6 td> span classglyph>Æ/span> tr identity-AElig-legacy classimpl>td> code>AElig/code> td> U+000C6 td> span>Æ/span> tr identity-aelig>td> code>aelig;/code> td> U+000E6 td> span classglyph>æ/span> tr identity-aelig-legacy classimpl>td> code>aelig/code> td> U+000E6 td> span>æ/span> tr identity-af>td> code>af;/code> td> U+02061 td> span classglyph>/span> tr identity-Afr>td> code>Afr;/code> td> U+1D504 td> span classglyph>𝔄/span> tr identity-afr>td> code>afr;/code> td> U+1D51E td> span classglyph>𝔞/span> tr identity-Agrave>td> code>Agrave;/code> td> U+000C0 td> span classglyph>À/span> tr identity-Agrave-legacy classimpl>td> code>Agrave/code> td> U+000C0 td> span>À/span> tr identity-agrave>td> code>agrave;/code> td> U+000E0 td> span classglyph>à/span> tr identity-agrave-legacy classimpl>td> code>agrave/code> td> U+000E0 td> span>à/span> tr identity-alefsym>td> code>alefsym;/code> td> U+02135 td> span classglyph>ℵ/span> tr identity-aleph>td> code>aleph;/code> td> U+02135 td> span classglyph>ℵ/span> tr identity-Alpha>td> code>Alpha;/code> td> U+00391 td> span classglyph>Α/span> tr identity-alpha>td> code>alpha;/code> td> U+003B1 td> span classglyph>α/span> tr identity-Amacr>td> code>Amacr;/code> td> U+00100 td> span classglyph>Ā/span> tr identity-amacr>td> code>amacr;/code> td> U+00101 td> span classglyph>ā/span> tr identity-amalg>td> code>amalg;/code> td> U+02A3F td> span classglyph>⨿/span> tr identity-AMP>td> code>AMP;/code> td> U+00026 td> span classglyph>&/span> tr identity-AMP-legacy classimpl>td> code>AMP/code> td> U+00026 td> span>&/span> tr identity-amp>td> code>amp;/code> td> U+00026 td> span classglyph>&/span> tr identity-amp-legacy classimpl>td> code>amp/code> td> U+00026 td> span>&/span> tr identity-And>td> code>And;/code> td> U+02A53 td> span classglyph>⩓/span> tr identity-and>td> code>and;/code> td> U+02227 td> span classglyph>∧/span> tr identity-andand>td> code>andand;/code> td> U+02A55 td> span classglyph>⩕/span> tr identity-andd>td> code>andd;/code> td> U+02A5C td> span classglyph>⩜/span> tr identity-andslope>td> code>andslope;/code> td> U+02A58 td> span classglyph>⩘/span> tr identity-andv>td> code>andv;/code> td> U+02A5A td> span classglyph>⩚/span> tr identity-ang>td> code>ang;/code> td> U+02220 td> span classglyph>∠/span> tr identity-ange>td> code>ange;/code> td> U+029A4 td> span classglyph>⦤/span> tr identity-angle>td> code>angle;/code> td> U+02220 td> span classglyph>∠/span> tr identity-angmsd>td> code>angmsd;/code> td> U+02221 td> span classglyph>∡/span> tr identity-angmsdaa>td> code>angmsdaa;/code> td> U+029A8 td> span classglyph>⦨/span> tr identity-angmsdab>td> code>angmsdab;/code> td> U+029A9 td> span classglyph>⦩/span> tr identity-angmsdac>td> code>angmsdac;/code> td> U+029AA td> span classglyph>⦪/span> tr identity-angmsdad>td> code>angmsdad;/code> td> U+029AB td> span classglyph>⦫/span> tr identity-angmsdae>td> code>angmsdae;/code> td> U+029AC td> span classglyph>⦬/span> tr identity-angmsdaf>td> code>angmsdaf;/code> td> U+029AD td> span classglyph>⦭/span> tr identity-angmsdag>td> code>angmsdag;/code> td> U+029AE td> span classglyph>⦮/span> tr identity-angmsdah>td> code>angmsdah;/code> td> U+029AF td> span classglyph>⦯/span> tr identity-angrt>td> code>angrt;/code> td> U+0221F td> span classglyph>∟/span> tr identity-angrtvb>td> code>angrtvb;/code> td> U+022BE td> span classglyph>⊾/span> tr identity-angrtvbd>td> code>angrtvbd;/code> td> U+0299D td> span classglyph>⦝/span> tr identity-angsph>td> code>angsph;/code> td> U+02222 td> span classglyph>∢/span> tr identity-angst>td> code>angst;/code> td> U+000C5 td> span classglyph>Å/span> tr identity-angzarr>td> code>angzarr;/code> td> U+0237C td> span classglyph>⍼/span> tr identity-Aogon>td> code>Aogon;/code> td> U+00104 td> span classglyph>Ą/span> tr identity-aogon>td> code>aogon;/code> td> U+00105 td> span classglyph>ą/span> tr identity-Aopf>td> code>Aopf;/code> td> U+1D538 td> span classglyph>𝔸/span> tr identity-aopf>td> code>aopf;/code> td> U+1D552 td> span classglyph>𝕒/span> tr identity-ap>td> code>ap;/code> td> U+02248 td> span classglyph>≈/span> tr identity-apacir>td> code>apacir;/code> td> U+02A6F td> span classglyph>⩯/span> tr identity-apE>td> code>apE;/code> td> U+02A70 td> span classglyph>⩰/span> tr identity-ape>td> code>ape;/code> td> U+0224A td> span classglyph>≊/span> tr identity-apid>td> code>apid;/code> td> U+0224B td> span classglyph>≋/span> tr identity-apos>td> code>apos;/code> td> U+00027 td> span classglyph>/span> tr identity-ApplyFunction>td> code>ApplyFunction;/code> td> U+02061 td> span classglyph>/span> tr identity-approx>td> code>approx;/code> td> U+02248 td> span classglyph>≈/span> tr identity-approxeq>td> code>approxeq;/code> td> U+0224A td> span classglyph>≊/span> tr identity-Aring>td> code>Aring;/code> td> U+000C5 td> span classglyph>Å/span> tr identity-Aring-legacy classimpl>td> code>Aring/code> td> U+000C5 td> span>Å/span> tr identity-aring>td> code>aring;/code> td> U+000E5 td> span classglyph>å/span> tr identity-aring-legacy classimpl>td> code>aring/code> td> U+000E5 td> span>å/span> tr identity-Ascr>td> code>Ascr;/code> td> U+1D49C td> span classglyph>𝒜/span> tr identity-ascr>td> code>ascr;/code> td> U+1D4B6 td> span classglyph>𝒶/span> tr identity-Assign>td> code>Assign;/code> td> U+02254 td> span classglyph>≔/span> tr identity-ast>td> code>ast;/code> td> U+0002A td> span classglyph>*/span> tr identity-asymp>td> code>asymp;/code> td> U+02248 td> span classglyph>≈/span> tr identity-asympeq>td> code>asympeq;/code> td> U+0224D td> span classglyph>≍/span> tr identity-Atilde>td> code>Atilde;/code> td> U+000C3 td> span classglyph>Ã/span> tr identity-Atilde-legacy classimpl>td> code>Atilde/code> td> U+000C3 td> span>Ã/span> tr identity-atilde>td> code>atilde;/code> td> U+000E3 td> span classglyph>ã/span> tr identity-atilde-legacy classimpl>td> code>atilde/code> td> U+000E3 td> span>ã/span> tr identity-Auml>td> code>Auml;/code> td> U+000C4 td> span classglyph>Ä/span> tr identity-Auml-legacy classimpl>td> code>Auml/code> td> U+000C4 td> span>Ä/span> tr identity-auml>td> code>auml;/code> td> U+000E4 td> span classglyph>ä/span> tr identity-auml-legacy classimpl>td> code>auml/code> td> U+000E4 td> span>ä/span> tr identity-awconint>td> code>awconint;/code> td> U+02233 td> span classglyph>∳/span> tr identity-awint>td> code>awint;/code> td> U+02A11 td> span classglyph>⨑/span> tr identity-backcong>td> code>backcong;/code> td> U+0224C td> span classglyph>≌/span> tr identity-backepsilon>td> code>backepsilon;/code> td> U+003F6 td> span classglyph>϶/span> tr identity-backprime>td> code>backprime;/code> td> U+02035 td> span classglyph>‵/span> tr identity-backsim>td> code>backsim;/code> td> U+0223D td> span classglyph>∽/span> tr identity-backsimeq>td> code>backsimeq;/code> td> U+022CD td> span classglyph>⋍/span> tr identity-Backslash>td> code>Backslash;/code> td> U+02216 td> span classglyph>∖/span> tr identity-Barv>td> code>Barv;/code> td> U+02AE7 td> span classglyph>⫧/span> tr identity-barvee>td> code>barvee;/code> td> U+022BD td> span classglyph>⊽/span> tr identity-Barwed>td> code>Barwed;/code> td> U+02306 td> span classglyph>⌆/span> tr identity-barwed>td> code>barwed;/code> td> U+02305 td> span classglyph>⌅/span> tr identity-barwedge>td> code>barwedge;/code> td> U+02305 td> span classglyph>⌅/span> tr identity-bbrk>td> code>bbrk;/code> td> U+023B5 td> span classglyph>⎵/span> tr identity-bbrktbrk>td> code>bbrktbrk;/code> td> U+023B6 td> span classglyph>⎶/span> tr identity-bcong>td> code>bcong;/code> td> U+0224C td> span classglyph>≌/span> tr identity-Bcy>td> code>Bcy;/code> td> U+00411 td> span classglyph>Б/span> tr identity-bcy>td> code>bcy;/code> td> U+00431 td> span classglyph>б/span> tr identity-bdquo>td> code>bdquo;/code> td> U+0201E td> span classglyph>„/span> tr identity-becaus>td> code>becaus;/code> td> U+02235 td> span classglyph>∵/span> tr identity-Because>td> code>Because;/code> td> U+02235 td> span classglyph>∵/span> tr identity-because>td> code>because;/code> td> U+02235 td> span classglyph>∵/span> tr identity-bemptyv>td> code>bemptyv;/code> td> U+029B0 td> span classglyph>⦰/span> tr identity-bepsi>td> code>bepsi;/code> td> U+003F6 td> span classglyph>϶/span> tr identity-bernou>td> code>bernou;/code> td> U+0212C td> span classglyph>ℬ/span> tr identity-Bernoullis>td> code>Bernoullis;/code> td> U+0212C td> span classglyph>ℬ/span> tr identity-Beta>td> code>Beta;/code> td> U+00392 td> span classglyph>Β/span> tr identity-beta>td> code>beta;/code> td> U+003B2 td> span classglyph>β/span> tr identity-beth>td> code>beth;/code> td> U+02136 td> span classglyph>ℶ/span> tr identity-between>td> code>between;/code> td> U+0226C td> span classglyph>≬/span> tr identity-Bfr>td> code>Bfr;/code> td> U+1D505 td> span classglyph>𝔅/span> tr identity-bfr>td> code>bfr;/code> td> U+1D51F td> span classglyph>𝔟/span> tr identity-bigcap>td> code>bigcap;/code> td> U+022C2 td> span classglyph>⋂/span> tr identity-bigcirc>td> code>bigcirc;/code> td> U+025EF td> span classglyph>◯/span> tr identity-bigcup>td> code>bigcup;/code> td> U+022C3 td> span classglyph>⋃/span> tr identity-bigodot>td> code>bigodot;/code> td> U+02A00 td> span classglyph>⨀/span> tr identity-bigoplus>td> code>bigoplus;/code> td> U+02A01 td> span classglyph>⨁/span> tr identity-bigotimes>td> code>bigotimes;/code> td> U+02A02 td> span classglyph>⨂/span> tr identity-bigsqcup>td> code>bigsqcup;/code> td> U+02A06 td> span classglyph>⨆/span> tr identity-bigstar>td> code>bigstar;/code> td> U+02605 td> span classglyph>★/span> tr identity-bigtriangledown>td> code>bigtriangledown;/code> td> U+025BD td> span classglyph>▽/span> tr identity-bigtriangleup>td> code>bigtriangleup;/code> td> U+025B3 td> span classglyph>△/span> tr identity-biguplus>td> code>biguplus;/code> td> U+02A04 td> span classglyph>⨄/span> tr identity-bigvee>td> code>bigvee;/code> td> U+022C1 td> span classglyph>⋁/span> tr identity-bigwedge>td> code>bigwedge;/code> td> U+022C0 td> span classglyph>⋀/span> tr identity-bkarow>td> code>bkarow;/code> td> U+0290D td> span classglyph>⤍/span> tr identity-blacklozenge>td> code>blacklozenge;/code> td> U+029EB td> span classglyph>⧫/span> tr identity-blacksquare>td> code>blacksquare;/code> td> U+025AA td> span classglyph>▪/span> tr identity-blacktriangle>td> code>blacktriangle;/code> td> U+025B4 td> span classglyph>▴/span> tr identity-blacktriangledown>td> code>blacktriangledown;/code> td> U+025BE td> span classglyph>▾/span> tr identity-blacktriangleleft>td> code>blacktriangleleft;/code> td> U+025C2 td> span classglyph>◂/span> tr identity-blacktriangleright>td> code>blacktriangleright;/code> td> U+025B8 td> span classglyph>▸/span> tr identity-blank>td> code>blank;/code> td> U+02423 td> span classglyph>␣/span> tr identity-blk12>td> code>blk12;/code> td> U+02592 td> span classglyph>▒/span> tr identity-blk14>td> code>blk14;/code> td> U+02591 td> span classglyph>░/span> tr identity-blk34>td> code>blk34;/code> td> U+02593 td> span classglyph>▓/span> tr identity-block>td> code>block;/code> td> U+02588 td> span classglyph>█/span> tr identity-bne>td> code>bne;/code> td> U+0003D U+020E5 td> span classglyph compound>⃥/span> tr identity-bnequiv>td> code>bnequiv;/code> td> U+02261 U+020E5 td> span classglyph compound>≡⃥/span> tr identity-bNot>td> code>bNot;/code> td> U+02AED td> span classglyph>⫭/span> tr identity-bnot>td> code>bnot;/code> td> U+02310 td> span classglyph>⌐/span> tr identity-Bopf>td> code>Bopf;/code> td> U+1D539 td> span classglyph>𝔹/span> tr identity-bopf>td> code>bopf;/code> td> U+1D553 td> span classglyph>𝕓/span> tr identity-bot>td> code>bot;/code> td> U+022A5 td> span classglyph>⊥/span> tr identity-bottom>td> code>bottom;/code> td> U+022A5 td> span classglyph>⊥/span> tr identity-bowtie>td> code>bowtie;/code> td> U+022C8 td> span classglyph>⋈/span> tr identity-boxbox>td> code>boxbox;/code> td> U+029C9 td> span classglyph>⧉/span> tr identity-boxDL>td> code>boxDL;/code> td> U+02557 td> span classglyph>╗/span> tr identity-boxDl>td> code>boxDl;/code> td> U+02556 td> span classglyph>╖/span> tr identity-boxdL>td> code>boxdL;/code> td> U+02555 td> span classglyph>╕/span> tr identity-boxdl>td> code>boxdl;/code> td> U+02510 td> span classglyph>┐/span> tr identity-boxDR>td> code>boxDR;/code> td> U+02554 td> span classglyph>╔/span> tr identity-boxDr>td> code>boxDr;/code> td> U+02553 td> span classglyph>╓/span> tr identity-boxdR>td> code>boxdR;/code> td> U+02552 td> span classglyph>╒/span> tr identity-boxdr>td> code>boxdr;/code> td> U+0250C td> span classglyph>┌/span> tr identity-boxH>td> code>boxH;/code> td> U+02550 td> span classglyph>═/span> tr identity-boxh>td> code>boxh;/code> td> U+02500 td> span classglyph>─/span> tr identity-boxHD>td> code>boxHD;/code> td> U+02566 td> span classglyph>╦/span> tr identity-boxHd>td> code>boxHd;/code> td> U+02564 td> span classglyph>╤/span> tr identity-boxhD>td> code>boxhD;/code> td> U+02565 td> span classglyph>╥/span> tr identity-boxhd>td> code>boxhd;/code> td> U+0252C td> span classglyph>┬/span> tr identity-boxHU>td> code>boxHU;/code> td> U+02569 td> span classglyph>╩/span> tr identity-boxHu>td> code>boxHu;/code> td> U+02567 td> span classglyph>╧/span> tr identity-boxhU>td> code>boxhU;/code> td> U+02568 td> span classglyph>╨/span> tr identity-boxhu>td> code>boxhu;/code> td> U+02534 td> span classglyph>┴/span> tr identity-boxminus>td> code>boxminus;/code> td> U+0229F td> span classglyph>⊟/span> tr identity-boxplus>td> code>boxplus;/code> td> U+0229E td> span classglyph>⊞/span> tr identity-boxtimes>td> code>boxtimes;/code> td> U+022A0 td> span classglyph>⊠/span> tr identity-boxUL>td> code>boxUL;/code> td> U+0255D td> span classglyph>╝/span> tr identity-boxUl>td> code>boxUl;/code> td> U+0255C td> span classglyph>╜/span> tr identity-boxuL>td> code>boxuL;/code> td> U+0255B td> span classglyph>╛/span> tr identity-boxul>td> code>boxul;/code> td> U+02518 td> span classglyph>┘/span> tr identity-boxUR>td> code>boxUR;/code> td> U+0255A td> span classglyph>╚/span> tr identity-boxUr>td> code>boxUr;/code> td> U+02559 td> span classglyph>╙/span> tr identity-boxuR>td> code>boxuR;/code> td> U+02558 td> span classglyph>╘/span> tr identity-boxur>td> code>boxur;/code> td> U+02514 td> span classglyph>└/span> tr identity-boxV>td> code>boxV;/code> td> U+02551 td> span classglyph>║/span> tr identity-boxv>td> code>boxv;/code> td> U+02502 td> span classglyph>│/span> tr identity-boxVH>td> code>boxVH;/code> td> U+0256C td> span classglyph>╬/span> tr identity-boxVh>td> code>boxVh;/code> td> U+0256B td> span classglyph>╫/span> tr identity-boxvH>td> code>boxvH;/code> td> U+0256A td> span classglyph>╪/span> tr identity-boxvh>td> code>boxvh;/code> td> U+0253C td> span classglyph>┼/span> tr identity-boxVL>td> code>boxVL;/code> td> U+02563 td> span classglyph>╣/span> tr identity-boxVl>td> code>boxVl;/code> td> U+02562 td> span classglyph>╢/span> tr identity-boxvL>td> code>boxvL;/code> td> U+02561 td> span classglyph>╡/span> tr identity-boxvl>td> code>boxvl;/code> td> U+02524 td> span classglyph>┤/span> tr identity-boxVR>td> code>boxVR;/code> td> U+02560 td> span classglyph>╠/span> tr identity-boxVr>td> code>boxVr;/code> td> U+0255F td> span classglyph>╟/span> tr identity-boxvR>td> code>boxvR;/code> td> U+0255E td> span classglyph>╞/span> tr identity-boxvr>td> code>boxvr;/code> td> U+0251C td> span classglyph>├/span> tr identity-bprime>td> code>bprime;/code> td> U+02035 td> span classglyph>‵/span> tr identity-Breve>td> code>Breve;/code> td> U+002D8 td> span classglyph>˘/span> tr identity-breve>td> code>breve;/code> td> U+002D8 td> span classglyph>˘/span> tr identity-brvbar>td> code>brvbar;/code> td> U+000A6 td> span classglyph>¦/span> tr identity-brvbar-legacy classimpl>td> code>brvbar/code> td> U+000A6 td> span>¦/span> tr identity-Bscr>td> code>Bscr;/code> td> U+0212C td> span classglyph>ℬ/span> tr identity-bscr>td> code>bscr;/code> td> U+1D4B7 td> span classglyph>𝒷/span> tr identity-bsemi>td> code>bsemi;/code> td> U+0204F td> span classglyph>⁏/span> tr identity-bsim>td> code>bsim;/code> td> U+0223D td> span classglyph>∽/span> tr identity-bsime>td> code>bsime;/code> td> U+022CD td> span classglyph>⋍/span> tr identity-bsol>td> code>bsol;/code> td> U+0005C td> span classglyph>\/span> tr identity-bsolb>td> code>bsolb;/code> td> U+029C5 td> span classglyph>⧅/span> tr identity-bsolhsub>td> code>bsolhsub;/code> td> U+027C8 td> span classglyph>⟈/span> tr identity-bull>td> code>bull;/code> td> U+02022 td> span classglyph>•/span> tr identity-bullet>td> code>bullet;/code> td> U+02022 td> span classglyph>•/span> tr identity-bump>td> code>bump;/code> td> U+0224E td> span classglyph>≎/span> tr identity-bumpE>td> code>bumpE;/code> td> U+02AAE td> span classglyph>⪮/span> tr identity-bumpe>td> code>bumpe;/code> td> U+0224F td> span classglyph>≏/span> tr identity-Bumpeq>td> code>Bumpeq;/code> td> U+0224E td> span classglyph>≎/span> tr identity-bumpeq>td> code>bumpeq;/code> td> U+0224F td> span classglyph>≏/span> tr identity-Cacute>td> code>Cacute;/code> td> U+00106 td> span classglyph>Ć/span> tr identity-cacute>td> code>cacute;/code> td> U+00107 td> span classglyph>ć/span> tr identity-Cap>td> code>Cap;/code> td> U+022D2 td> span classglyph>⋒/span> tr identity-cap>td> code>cap;/code> td> U+02229 td> span classglyph>∩/span> tr identity-capand>td> code>capand;/code> td> U+02A44 td> span classglyph>⩄/span> tr identity-capbrcup>td> code>capbrcup;/code> td> U+02A49 td> span classglyph>⩉/span> tr identity-capcap>td> code>capcap;/code> td> U+02A4B td> span classglyph>⩋/span> tr identity-capcup>td> code>capcup;/code> td> U+02A47 td> span classglyph>⩇/span> tr identity-capdot>td> code>capdot;/code> td> U+02A40 td> span classglyph>⩀/span> tr identity-CapitalDifferentialD>td> code>CapitalDifferentialD;/code> td> U+02145 td> span classglyph>ⅅ/span> tr identity-caps>td> code>caps;/code> td> U+02229 U+0FE00 td> span classglyph compound>∩︀/span> tr identity-caret>td> code>caret;/code> td> U+02041 td> span classglyph>⁁/span> tr identity-caron>td> code>caron;/code> td> U+002C7 td> span classglyph>ˇ/span> tr identity-Cayleys>td> code>Cayleys;/code> td> U+0212D td> span classglyph>ℭ/span> tr identity-ccaps>td> code>ccaps;/code> td> U+02A4D td> span classglyph>⩍/span> tr identity-Ccaron>td> code>Ccaron;/code> td> U+0010C td> span classglyph>Č/span> tr identity-ccaron>td> code>ccaron;/code> td> U+0010D td> span classglyph>č/span> tr identity-Ccedil>td> code>Ccedil;/code> td> U+000C7 td> span classglyph>Ç/span> tr identity-Ccedil-legacy classimpl>td> code>Ccedil/code> td> U+000C7 td> span>Ç/span> tr identity-ccedil>td> code>ccedil;/code> td> U+000E7 td> span classglyph>ç/span> tr identity-ccedil-legacy classimpl>td> code>ccedil/code> td> U+000E7 td> span>ç/span> tr identity-Ccirc>td> code>Ccirc;/code> td> U+00108 td> span classglyph>Ĉ/span> tr identity-ccirc>td> code>ccirc;/code> td> U+00109 td> span classglyph>ĉ/span> tr identity-Cconint>td> code>Cconint;/code> td> U+02230 td> span classglyph>∰/span> tr identity-ccups>td> code>ccups;/code> td> U+02A4C td> span classglyph>⩌/span> tr identity-ccupssm>td> code>ccupssm;/code> td> U+02A50 td> span classglyph>⩐/span> tr identity-Cdot>td> code>Cdot;/code> td> U+0010A td> span classglyph>Ċ/span> tr identity-cdot>td> code>cdot;/code> td> U+0010B td> span classglyph>ċ/span> tr identity-cedil>td> code>cedil;/code> td> U+000B8 td> span classglyph>¸/span> tr identity-cedil-legacy classimpl>td> code>cedil/code> td> U+000B8 td> span>¸/span> tr identity-Cedilla>td> code>Cedilla;/code> td> U+000B8 td> span classglyph>¸/span> tr identity-cemptyv>td> code>cemptyv;/code> td> U+029B2 td> span classglyph>⦲/span> tr identity-cent>td> code>cent;/code> td> U+000A2 td> span classglyph>¢/span> tr identity-cent-legacy classimpl>td> code>cent/code> td> U+000A2 td> span>¢/span> tr identity-CenterDot>td> code>CenterDot;/code> td> U+000B7 td> span classglyph>·/span> tr identity-centerdot>td> code>centerdot;/code> td> U+000B7 td> span classglyph>·/span> tr identity-Cfr>td> code>Cfr;/code> td> U+0212D td> span classglyph>ℭ/span> tr identity-cfr>td> code>cfr;/code> td> U+1D520 td> span classglyph>𝔠/span> tr identity-CHcy>td> code>CHcy;/code> td> U+00427 td> span classglyph>Ч/span> tr identity-chcy>td> code>chcy;/code> td> U+00447 td> span classglyph>ч/span> tr identity-check>td> code>check;/code> td> U+02713 td> span classglyph>✓/span> tr identity-checkmark>td> code>checkmark;/code> td> U+02713 td> span classglyph>✓/span> tr identity-Chi>td> code>Chi;/code> td> U+003A7 td> span classglyph>Χ/span> tr identity-chi>td> code>chi;/code> td> U+003C7 td> span classglyph>χ/span> tr identity-cir>td> code>cir;/code> td> U+025CB td> span classglyph>○/span> tr identity-circ>td> code>circ;/code> td> U+002C6 td> span classglyph>ˆ/span> tr identity-circeq>td> code>circeq;/code> td> U+02257 td> span classglyph>≗/span> tr identity-circlearrowleft>td> code>circlearrowleft;/code> td> U+021BA td> span classglyph>↺/span> tr identity-circlearrowright>td> code>circlearrowright;/code> td> U+021BB td> span classglyph>↻/span> tr identity-circledast>td> code>circledast;/code> td> U+0229B td> span classglyph>⊛/span> tr identity-circledcirc>td> code>circledcirc;/code> td> U+0229A td> span classglyph>⊚/span> tr identity-circleddash>td> code>circleddash;/code> td> U+0229D td> span classglyph>⊝/span> tr identity-CircleDot>td> code>CircleDot;/code> td> U+02299 td> span classglyph>⊙/span> tr identity-circledR>td> code>circledR;/code> td> U+000AE td> span classglyph>®/span> tr identity-circledS>td> code>circledS;/code> td> U+024C8 td> span classglyph>Ⓢ/span> tr identity-CircleMinus>td> code>CircleMinus;/code> td> U+02296 td> span classglyph>⊖/span> tr identity-CirclePlus>td> code>CirclePlus;/code> td> U+02295 td> span classglyph>⊕/span> tr identity-CircleTimes>td> code>CircleTimes;/code> td> U+02297 td> span classglyph>⊗/span> tr identity-cirE>td> code>cirE;/code> td> U+029C3 td> span classglyph>⧃/span> tr identity-cire>td> code>cire;/code> td> U+02257 td> span classglyph>≗/span> tr identity-cirfnint>td> code>cirfnint;/code> td> U+02A10 td> span classglyph>⨐/span> tr identity-cirmid>td> code>cirmid;/code> td> U+02AEF td> span classglyph>⫯/span> tr identity-cirscir>td> code>cirscir;/code> td> U+029C2 td> span classglyph>⧂/span> tr identity-ClockwiseContourIntegral>td> code>ClockwiseContourIntegral;/code> td> U+02232 td> span classglyph>∲/span> tr identity-CloseCurlyDoubleQuote>td> code>CloseCurlyDoubleQuote;/code> td> U+0201D td> span classglyph>”/span> tr identity-CloseCurlyQuote>td> code>CloseCurlyQuote;/code> td> U+02019 td> span classglyph>’/span> tr identity-clubs>td> code>clubs;/code> td> U+02663 td> span classglyph>♣/span> tr identity-clubsuit>td> code>clubsuit;/code> td> U+02663 td> span classglyph>♣/span> tr identity-Colon>td> code>Colon;/code> td> U+02237 td> span classglyph>∷/span> tr identity-colon>td> code>colon;/code> td> U+0003A td> span classglyph>:/span> tr identity-Colone>td> code>Colone;/code> td> U+02A74 td> span classglyph>⩴/span> tr identity-colone>td> code>colone;/code> td> U+02254 td> span classglyph>≔/span> tr identity-coloneq>td> code>coloneq;/code> td> U+02254 td> span classglyph>≔/span> tr identity-comma>td> code>comma;/code> td> U+0002C td> span classglyph>,/span> tr identity-commat>td> code>commat;/code> td> U+00040 td> span classglyph>@/span> tr identity-comp>td> code>comp;/code> td> U+02201 td> span classglyph>∁/span> tr identity-compfn>td> code>compfn;/code> td> U+02218 td> span classglyph>∘/span> tr identity-complement>td> code>complement;/code> td> U+02201 td> span classglyph>∁/span> tr identity-complexes>td> code>complexes;/code> td> U+02102 td> span classglyph>ℂ/span> tr identity-cong>td> code>cong;/code> td> U+02245 td> span classglyph>≅/span> tr identity-congdot>td> code>congdot;/code> td> U+02A6D td> span classglyph>⩭/span> tr identity-Congruent>td> code>Congruent;/code> td> U+02261 td> span classglyph>≡/span> tr identity-Conint>td> code>Conint;/code> td> U+0222F td> span classglyph>∯/span> tr identity-conint>td> code>conint;/code> td> U+0222E td> span classglyph>∮/span> tr identity-ContourIntegral>td> code>ContourIntegral;/code> td> U+0222E td> span classglyph>∮/span> tr identity-Copf>td> code>Copf;/code> td> U+02102 td> span classglyph>ℂ/span> tr identity-copf>td> code>copf;/code> td> U+1D554 td> span classglyph>𝕔/span> tr identity-coprod>td> code>coprod;/code> td> U+02210 td> span classglyph>∐/span> tr identity-Coproduct>td> code>Coproduct;/code> td> U+02210 td> span classglyph>∐/span> tr identity-COPY>td> code>COPY;/code> td> U+000A9 td> span classglyph>©/span> tr identity-COPY-legacy classimpl>td> code>COPY/code> td> U+000A9 td> span>©/span> tr identity-copy>td> code>copy;/code> td> U+000A9 td> span classglyph>©/span> tr identity-copy-legacy classimpl>td> code>copy/code> td> U+000A9 td> span>©/span> tr identity-copysr>td> code>copysr;/code> td> U+02117 td> span classglyph>℗/span> tr identity-CounterClockwiseContourIntegral>td> code>CounterClockwiseContourIntegral;/code> td> U+02233 td> span classglyph>∳/span> tr identity-crarr>td> code>crarr;/code> td> U+021B5 td> span classglyph>↵/span> tr identity-Cross>td> code>Cross;/code> td> U+02A2F td> span classglyph>⨯/span> tr identity-cross>td> code>cross;/code> td> U+02717 td> span classglyph>✗/span> tr identity-Cscr>td> code>Cscr;/code> td> U+1D49E td> span classglyph>𝒞/span> tr identity-cscr>td> code>cscr;/code> td> U+1D4B8 td> span classglyph>𝒸/span> tr identity-csub>td> code>csub;/code> td> U+02ACF td> span classglyph>⫏/span> tr identity-csube>td> code>csube;/code> td> U+02AD1 td> span classglyph>⫑/span> tr identity-csup>td> code>csup;/code> td> U+02AD0 td> span classglyph>⫐/span> tr identity-csupe>td> code>csupe;/code> td> U+02AD2 td> span classglyph>⫒/span> tr identity-ctdot>td> code>ctdot;/code> td> U+022EF td> span classglyph>⋯/span> tr identity-cudarrl>td> code>cudarrl;/code> td> U+02938 td> span classglyph>⤸/span> tr identity-cudarrr>td> code>cudarrr;/code> td> U+02935 td> span classglyph>⤵/span> tr identity-cuepr>td> code>cuepr;/code> td> U+022DE td> span classglyph>⋞/span> tr identity-cuesc>td> code>cuesc;/code> td> U+022DF td> span classglyph>⋟/span> tr identity-cularr>td> code>cularr;/code> td> U+021B6 td> span classglyph>↶/span> tr identity-cularrp>td> code>cularrp;/code> td> U+0293D td> span classglyph>⤽/span> tr identity-Cup>td> code>Cup;/code> td> U+022D3 td> span classglyph>⋓/span> tr identity-cup>td> code>cup;/code> td> U+0222A td> span classglyph>∪/span> tr identity-cupbrcap>td> code>cupbrcap;/code> td> U+02A48 td> span classglyph>⩈/span> tr identity-CupCap>td> code>CupCap;/code> td> U+0224D td> span classglyph>≍/span> tr identity-cupcap>td> code>cupcap;/code> td> U+02A46 td> span classglyph>⩆/span> tr identity-cupcup>td> code>cupcup;/code> td> U+02A4A td> span classglyph>⩊/span> tr identity-cupdot>td> code>cupdot;/code> td> U+0228D td> span classglyph>⊍/span> tr identity-cupor>td> code>cupor;/code> td> U+02A45 td> span classglyph>⩅/span> tr identity-cups>td> code>cups;/code> td> U+0222A U+0FE00 td> span classglyph compound>∪︀/span> tr identity-curarr>td> code>curarr;/code> td> U+021B7 td> span classglyph>↷/span> tr identity-curarrm>td> code>curarrm;/code> td> U+0293C td> span classglyph>⤼/span> tr identity-curlyeqprec>td> code>curlyeqprec;/code> td> U+022DE td> span classglyph>⋞/span> tr identity-curlyeqsucc>td> code>curlyeqsucc;/code> td> U+022DF td> span classglyph>⋟/span> tr identity-curlyvee>td> code>curlyvee;/code> td> U+022CE td> span classglyph>⋎/span> tr identity-curlywedge>td> code>curlywedge;/code> td> U+022CF td> span classglyph>⋏/span> tr identity-curren>td> code>curren;/code> td> U+000A4 td> span classglyph>¤/span> tr identity-curren-legacy classimpl>td> code>curren/code> td> U+000A4 td> span>¤/span> tr identity-curvearrowleft>td> code>curvearrowleft;/code> td> U+021B6 td> span classglyph>↶/span> tr identity-curvearrowright>td> code>curvearrowright;/code> td> U+021B7 td> span classglyph>↷/span> tr identity-cuvee>td> code>cuvee;/code> td> U+022CE td> span classglyph>⋎/span> tr identity-cuwed>td> code>cuwed;/code> td> U+022CF td> span classglyph>⋏/span> tr identity-cwconint>td> code>cwconint;/code> td> U+02232 td> span classglyph>∲/span> tr identity-cwint>td> code>cwint;/code> td> U+02231 td> span classglyph>∱/span> tr identity-cylcty>td> code>cylcty;/code> td> U+0232D td> span classglyph>⌭/span> tr identity-Dagger>td> code>Dagger;/code> td> U+02021 td> span classglyph>‡/span> tr identity-dagger>td> code>dagger;/code> td> U+02020 td> span classglyph>†/span> tr identity-daleth>td> code>daleth;/code> td> U+02138 td> span classglyph>ℸ/span> tr identity-Darr>td> code>Darr;/code> td> U+021A1 td> span classglyph>↡/span> tr identity-dArr>td> code>dArr;/code> td> U+021D3 td> span classglyph>⇓/span> tr identity-darr>td> code>darr;/code> td> U+02193 td> span classglyph>↓/span> tr identity-dash>td> code>dash;/code> td> U+02010 td> span classglyph>‐/span> tr identity-Dashv>td> code>Dashv;/code> td> U+02AE4 td> span classglyph>⫤/span> tr identity-dashv>td> code>dashv;/code> td> U+022A3 td> span classglyph>⊣/span> tr identity-dbkarow>td> code>dbkarow;/code> td> U+0290F td> span classglyph>⤏/span> tr identity-dblac>td> code>dblac;/code> td> U+002DD td> span classglyph>˝/span> tr identity-Dcaron>td> code>Dcaron;/code> td> U+0010E td> span classglyph>Ď/span> tr identity-dcaron>td> code>dcaron;/code> td> U+0010F td> span classglyph>ď/span> tr identity-Dcy>td> code>Dcy;/code> td> U+00414 td> span classglyph>Д/span> tr identity-dcy>td> code>dcy;/code> td> U+00434 td> span classglyph>д/span> tr identity-DD>td> code>DD;/code> td> U+02145 td> span classglyph>ⅅ/span> tr identity-dd>td> code>dd;/code> td> U+02146 td> span classglyph>ⅆ/span> tr identity-ddagger>td> code>ddagger;/code> td> U+02021 td> span classglyph>‡/span> tr identity-ddarr>td> code>ddarr;/code> td> U+021CA td> span classglyph>⇊/span> tr identity-DDotrahd>td> code>DDotrahd;/code> td> U+02911 td> span classglyph>⤑/span> tr identity-ddotseq>td> code>ddotseq;/code> td> U+02A77 td> span classglyph>⩷/span> tr identity-deg>td> code>deg;/code> td> U+000B0 td> span classglyph>°/span> tr identity-deg-legacy classimpl>td> code>deg/code> td> U+000B0 td> span>°/span> tr identity-Del>td> code>Del;/code> td> U+02207 td> span classglyph>∇/span> tr identity-Delta>td> code>Delta;/code> td> U+00394 td> span classglyph>Δ/span> tr identity-delta>td> code>delta;/code> td> U+003B4 td> span classglyph>δ/span> tr identity-demptyv>td> code>demptyv;/code> td> U+029B1 td> span classglyph>⦱/span> tr identity-dfisht>td> code>dfisht;/code> td> U+0297F td> span classglyph>⥿/span> tr identity-Dfr>td> code>Dfr;/code> td> U+1D507 td> span classglyph>𝔇/span> tr identity-dfr>td> code>dfr;/code> td> U+1D521 td> span classglyph>𝔡/span> tr identity-dHar>td> code>dHar;/code> td> U+02965 td> span classglyph>⥥/span> tr identity-dharl>td> code>dharl;/code> td> U+021C3 td> span classglyph>⇃/span> tr identity-dharr>td> code>dharr;/code> td> U+021C2 td> span classglyph>⇂/span> tr identity-DiacriticalAcute>td> code>DiacriticalAcute;/code> td> U+000B4 td> span classglyph>´/span> tr identity-DiacriticalDot>td> code>DiacriticalDot;/code> td> U+002D9 td> span classglyph>˙/span> tr identity-DiacriticalDoubleAcute>td> code>DiacriticalDoubleAcute;/code> td> U+002DD td> span classglyph>˝/span> tr identity-DiacriticalGrave>td> code>DiacriticalGrave;/code> td> U+00060 td> span classglyph>`/span> tr identity-DiacriticalTilde>td> code>DiacriticalTilde;/code> td> U+002DC td> span classglyph>˜/span> tr identity-diam>td> code>diam;/code> td> U+022C4 td> span classglyph>⋄/span> tr identity-Diamond>td> code>Diamond;/code> td> U+022C4 td> span classglyph>⋄/span> tr identity-diamond>td> code>diamond;/code> td> U+022C4 td> span classglyph>⋄/span> tr identity-diamondsuit>td> code>diamondsuit;/code> td> U+02666 td> span classglyph>♦/span> tr identity-diams>td> code>diams;/code> td> U+02666 td> span classglyph>♦/span> tr identity-die>td> code>die;/code> td> U+000A8 td> span classglyph>¨/span> tr identity-DifferentialD>td> code>DifferentialD;/code> td> U+02146 td> span classglyph>ⅆ/span> tr identity-digamma>td> code>digamma;/code> td> U+003DD td> span classglyph>ϝ/span> tr identity-disin>td> code>disin;/code> td> U+022F2 td> span classglyph>⋲/span> tr identity-div>td> code>div;/code> td> U+000F7 td> span classglyph>÷/span> tr identity-divide>td> code>divide;/code> td> U+000F7 td> span classglyph>÷/span> tr identity-divide-legacy classimpl>td> code>divide/code> td> U+000F7 td> span>÷/span> tr identity-divideontimes>td> code>divideontimes;/code> td> U+022C7 td> span classglyph>⋇/span> tr identity-divonx>td> code>divonx;/code> td> U+022C7 td> span classglyph>⋇/span> tr identity-DJcy>td> code>DJcy;/code> td> U+00402 td> span classglyph>Ђ/span> tr identity-djcy>td> code>djcy;/code> td> U+00452 td> span classglyph>ђ/span> tr identity-dlcorn>td> code>dlcorn;/code> td> U+0231E td> span classglyph>⌞/span> tr identity-dlcrop>td> code>dlcrop;/code> td> U+0230D td> span classglyph>⌍/span> tr identity-dollar>td> code>dollar;/code> td> U+00024 td> span classglyph>$/span> tr identity-Dopf>td> code>Dopf;/code> td> U+1D53B td> span classglyph>𝔻/span> tr identity-dopf>td> code>dopf;/code> td> U+1D555 td> span classglyph>𝕕/span> tr identity-Dot>td> code>Dot;/code> td> U+000A8 td> span classglyph>¨/span> tr identity-dot>td> code>dot;/code> td> U+002D9 td> span classglyph>˙/span> tr identity-DotDot>td> code>DotDot;/code> td> U+020DC td> span classglyph composition>◌⃜/span> tr identity-doteq>td> code>doteq;/code> td> U+02250 td> span classglyph>≐/span> tr identity-doteqdot>td> code>doteqdot;/code> td> U+02251 td> span classglyph>≑/span> tr identity-DotEqual>td> code>DotEqual;/code> td> U+02250 td> span classglyph>≐/span> tr identity-dotminus>td> code>dotminus;/code> td> U+02238 td> span classglyph>∸/span> tr identity-dotplus>td> code>dotplus;/code> td> U+02214 td> span classglyph>∔/span> tr identity-dotsquare>td> code>dotsquare;/code> td> U+022A1 td> span classglyph>⊡/span> tr identity-doublebarwedge>td> code>doublebarwedge;/code> td> U+02306 td> span classglyph>⌆/span> tr identity-DoubleContourIntegral>td> code>DoubleContourIntegral;/code> td> U+0222F td> span classglyph>∯/span> tr identity-DoubleDot>td> code>DoubleDot;/code> td> U+000A8 td> span classglyph>¨/span> tr identity-DoubleDownArrow>td> code>DoubleDownArrow;/code> td> U+021D3 td> span classglyph>⇓/span> tr identity-DoubleLeftArrow>td> code>DoubleLeftArrow;/code> td> U+021D0 td> span classglyph>⇐/span> tr identity-DoubleLeftRightArrow>td> code>DoubleLeftRightArrow;/code> td> U+021D4 td> span classglyph>⇔/span> tr identity-DoubleLeftTee>td> code>DoubleLeftTee;/code> td> U+02AE4 td> span classglyph>⫤/span> tr identity-DoubleLongLeftArrow>td> code>DoubleLongLeftArrow;/code> td> U+027F8 td> span classglyph>⟸/span> tr identity-DoubleLongLeftRightArrow>td> code>DoubleLongLeftRightArrow;/code> td> U+027FA td> span classglyph>⟺/span> tr identity-DoubleLongRightArrow>td> code>DoubleLongRightArrow;/code> td> U+027F9 td> span classglyph>⟹/span> tr identity-DoubleRightArrow>td> code>DoubleRightArrow;/code> td> U+021D2 td> span classglyph>⇒/span> tr identity-DoubleRightTee>td> code>DoubleRightTee;/code> td> U+022A8 td> span classglyph>⊨/span> tr identity-DoubleUpArrow>td> code>DoubleUpArrow;/code> td> U+021D1 td> span classglyph>⇑/span> tr identity-DoubleUpDownArrow>td> code>DoubleUpDownArrow;/code> td> U+021D5 td> span classglyph>⇕/span> tr identity-DoubleVerticalBar>td> code>DoubleVerticalBar;/code> td> U+02225 td> span classglyph>∥/span> tr identity-DownArrow>td> code>DownArrow;/code> td> U+02193 td> span classglyph>↓/span> tr identity-Downarrow>td> code>Downarrow;/code> td> U+021D3 td> span classglyph>⇓/span> tr identity-downarrow>td> code>downarrow;/code> td> U+02193 td> span classglyph>↓/span> tr identity-DownArrowBar>td> code>DownArrowBar;/code> td> U+02913 td> span classglyph>⤓/span> tr identity-DownArrowUpArrow>td> code>DownArrowUpArrow;/code> td> U+021F5 td> span classglyph>⇵/span> tr identity-DownBreve>td> code>DownBreve;/code> td> U+00311 td> span classglyph composition>◌̑/span> tr identity-downdownarrows>td> code>downdownarrows;/code> td> U+021CA td> span classglyph>⇊/span> tr identity-downharpoonleft>td> code>downharpoonleft;/code> td> U+021C3 td> span classglyph>⇃/span> tr identity-downharpoonright>td> code>downharpoonright;/code> td> U+021C2 td> span classglyph>⇂/span> tr identity-DownLeftRightVector>td> code>DownLeftRightVector;/code> td> U+02950 td> span classglyph>⥐/span> tr identity-DownLeftTeeVector>td> code>DownLeftTeeVector;/code> td> U+0295E td> span classglyph>⥞/span> tr identity-DownLeftVector>td> code>DownLeftVector;/code> td> U+021BD td> span classglyph>↽/span> tr identity-DownLeftVectorBar>td> code>DownLeftVectorBar;/code> td> U+02956 td> span classglyph>⥖/span> tr identity-DownRightTeeVector>td> code>DownRightTeeVector;/code> td> U+0295F td> span classglyph>⥟/span> tr identity-DownRightVector>td> code>DownRightVector;/code> td> U+021C1 td> span classglyph>⇁/span> tr identity-DownRightVectorBar>td> code>DownRightVectorBar;/code> td> U+02957 td> span classglyph>⥗/span> tr identity-DownTee>td> code>DownTee;/code> td> U+022A4 td> span classglyph>⊤/span> tr identity-DownTeeArrow>td> code>DownTeeArrow;/code> td> U+021A7 td> span classglyph>↧/span> tr identity-drbkarow>td> code>drbkarow;/code> td> U+02910 td> span classglyph>⤐/span> tr identity-drcorn>td> code>drcorn;/code> td> U+0231F td> span classglyph>⌟/span> tr identity-drcrop>td> code>drcrop;/code> td> U+0230C td> span classglyph>⌌/span> tr identity-Dscr>td> code>Dscr;/code> td> U+1D49F td> span classglyph>𝒟/span> tr identity-dscr>td> code>dscr;/code> td> U+1D4B9 td> span classglyph>𝒹/span> tr identity-DScy>td> code>DScy;/code> td> U+00405 td> span classglyph>Ѕ/span> tr identity-dscy>td> code>dscy;/code> td> U+00455 td> span classglyph>ѕ/span> tr identity-dsol>td> code>dsol;/code> td> U+029F6 td> span classglyph>⧶/span> tr identity-Dstrok>td> code>Dstrok;/code> td> U+00110 td> span classglyph>Đ/span> tr identity-dstrok>td> code>dstrok;/code> td> U+00111 td> span classglyph>đ/span> tr identity-dtdot>td> code>dtdot;/code> td> U+022F1 td> span classglyph>⋱/span> tr identity-dtri>td> code>dtri;/code> td> U+025BF td> span classglyph>▿/span> tr identity-dtrif>td> code>dtrif;/code> td> U+025BE td> span classglyph>▾/span> tr identity-duarr>td> code>duarr;/code> td> U+021F5 td> span classglyph>⇵/span> tr identity-duhar>td> code>duhar;/code> td> U+0296F td> span classglyph>⥯/span> tr identity-dwangle>td> code>dwangle;/code> td> U+029A6 td> span classglyph>⦦/span> tr identity-DZcy>td> code>DZcy;/code> td> U+0040F td> span classglyph>Џ/span> tr identity-dzcy>td> code>dzcy;/code> td> U+0045F td> span classglyph>џ/span> tr identity-dzigrarr>td> code>dzigrarr;/code> td> U+027FF td> span classglyph>⟿/span> tr identity-Eacute>td> code>Eacute;/code> td> U+000C9 td> span classglyph>É/span> tr identity-Eacute-legacy classimpl>td> code>Eacute/code> td> U+000C9 td> span>É/span> tr identity-eacute>td> code>eacute;/code> td> U+000E9 td> span classglyph>é/span> tr identity-eacute-legacy classimpl>td> code>eacute/code> td> U+000E9 td> span>é/span> tr identity-easter>td> code>easter;/code> td> U+02A6E td> span classglyph>⩮/span> tr identity-Ecaron>td> code>Ecaron;/code> td> U+0011A td> span classglyph>Ě/span> tr identity-ecaron>td> code>ecaron;/code> td> U+0011B td> span classglyph>ě/span> tr identity-ecir>td> code>ecir;/code> td> U+02256 td> span classglyph>≖/span> tr identity-Ecirc>td> code>Ecirc;/code> td> U+000CA td> span classglyph>Ê/span> tr identity-Ecirc-legacy classimpl>td> code>Ecirc/code> td> U+000CA td> span>Ê/span> tr identity-ecirc>td> code>ecirc;/code> td> U+000EA td> span classglyph>ê/span> tr identity-ecirc-legacy classimpl>td> code>ecirc/code> td> U+000EA td> span>ê/span> tr identity-ecolon>td> code>ecolon;/code> td> U+02255 td> span classglyph>≕/span> tr identity-Ecy>td> code>Ecy;/code> td> U+0042D td> span classglyph>Э/span> tr identity-ecy>td> code>ecy;/code> td> U+0044D td> span classglyph>э/span> tr identity-eDDot>td> code>eDDot;/code> td> U+02A77 td> span classglyph>⩷/span> tr identity-Edot>td> code>Edot;/code> td> U+00116 td> span classglyph>Ė/span> tr identity-eDot>td> code>eDot;/code> td> U+02251 td> span classglyph>≑/span> tr identity-edot>td> code>edot;/code> td> U+00117 td> span classglyph>ė/span> tr identity-ee>td> code>ee;/code> td> U+02147 td> span classglyph>ⅇ/span> tr identity-efDot>td> code>efDot;/code> td> U+02252 td> span classglyph>≒/span> tr identity-Efr>td> code>Efr;/code> td> U+1D508 td> span classglyph>𝔈/span> tr identity-efr>td> code>efr;/code> td> U+1D522 td> span classglyph>𝔢/span> tr identity-eg>td> code>eg;/code> td> U+02A9A td> span classglyph>⪚/span> tr identity-Egrave>td> code>Egrave;/code> td> U+000C8 td> span classglyph>È/span> tr identity-Egrave-legacy classimpl>td> code>Egrave/code> td> U+000C8 td> span>È/span> tr identity-egrave>td> code>egrave;/code> td> U+000E8 td> span classglyph>è/span> tr identity-egrave-legacy classimpl>td> code>egrave/code> td> U+000E8 td> span>è/span> tr identity-egs>td> code>egs;/code> td> U+02A96 td> span classglyph>⪖/span> tr identity-egsdot>td> code>egsdot;/code> td> U+02A98 td> span classglyph>⪘/span> tr identity-el>td> code>el;/code> td> U+02A99 td> span classglyph>⪙/span> tr identity-Element>td> code>Element;/code> td> U+02208 td> span classglyph>∈/span> tr identity-elinters>td> code>elinters;/code> td> U+023E7 td> span classglyph>⏧/span> tr identity-ell>td> code>ell;/code> td> U+02113 td> span classglyph>ℓ/span> tr identity-els>td> code>els;/code> td> U+02A95 td> span classglyph>⪕/span> tr identity-elsdot>td> code>elsdot;/code> td> U+02A97 td> span classglyph>⪗/span> tr identity-Emacr>td> code>Emacr;/code> td> U+00112 td> span classglyph>Ē/span> tr identity-emacr>td> code>emacr;/code> td> U+00113 td> span classglyph>ē/span> tr identity-empty>td> code>empty;/code> td> U+02205 td> span classglyph>∅/span> tr identity-emptyset>td> code>emptyset;/code> td> U+02205 td> span classglyph>∅/span> tr identity-EmptySmallSquare>td> code>EmptySmallSquare;/code> td> U+025FB td> span classglyph>◻/span> tr identity-emptyv>td> code>emptyv;/code> td> U+02205 td> span classglyph>∅/span> tr identity-EmptyVerySmallSquare>td> code>EmptyVerySmallSquare;/code> td> U+025AB td> span classglyph>▫/span> tr identity-emsp>td> code>emsp;/code> td> U+02003 td> span classglyph> /span> tr identity-emsp13>td> code>emsp13;/code> td> U+02004 td> span classglyph> /span> tr identity-emsp14>td> code>emsp14;/code> td> U+02005 td> span classglyph> /span> tr identity-ENG>td> code>ENG;/code> td> U+0014A td> span classglyph>Ŋ/span> tr identity-eng>td> code>eng;/code> td> U+0014B td> span classglyph>ŋ/span> tr identity-ensp>td> code>ensp;/code> td> U+02002 td> span classglyph> /span> tr identity-Eogon>td> code>Eogon;/code> td> U+00118 td> span classglyph>Ę/span> tr identity-eogon>td> code>eogon;/code> td> U+00119 td> span classglyph>ę/span> tr identity-Eopf>td> code>Eopf;/code> td> U+1D53C td> span classglyph>𝔼/span> tr identity-eopf>td> code>eopf;/code> td> U+1D556 td> span classglyph>𝕖/span> tr identity-epar>td> code>epar;/code> td> U+022D5 td> span classglyph>⋕/span> tr identity-eparsl>td> code>eparsl;/code> td> U+029E3 td> span classglyph>⧣/span> tr identity-eplus>td> code>eplus;/code> td> U+02A71 td> span classglyph>⩱/span> tr identity-epsi>td> code>epsi;/code> td> U+003B5 td> span classglyph>ε/span> tr identity-Epsilon>td> code>Epsilon;/code> td> U+00395 td> span classglyph>Ε/span> tr identity-epsilon>td> code>epsilon;/code> td> U+003B5 td> span classglyph>ε/span> tr identity-epsiv>td> code>epsiv;/code> td> U+003F5 td> span classglyph>ϵ/span> tr identity-eqcirc>td> code>eqcirc;/code> td> U+02256 td> span classglyph>≖/span> tr identity-eqcolon>td> code>eqcolon;/code> td> U+02255 td> span classglyph>≕/span> tr identity-eqsim>td> code>eqsim;/code> td> U+02242 td> span classglyph>≂/span> tr identity-eqslantgtr>td> code>eqslantgtr;/code> td> U+02A96 td> span classglyph>⪖/span> tr identity-eqslantless>td> code>eqslantless;/code> td> U+02A95 td> span classglyph>⪕/span> tr identity-Equal>td> code>Equal;/code> td> U+02A75 td> span classglyph>⩵/span> tr identity-equals>td> code>equals;/code> td> U+0003D td> span classglyph>/span> tr identity-EqualTilde>td> code>EqualTilde;/code> td> U+02242 td> span classglyph>≂/span> tr identity-equest>td> code>equest;/code> td> U+0225F td> span classglyph>≟/span> tr identity-Equilibrium>td> code>Equilibrium;/code> td> U+021CC td> span classglyph>⇌/span> tr identity-equiv>td> code>equiv;/code> td> U+02261 td> span classglyph>≡/span> tr identity-equivDD>td> code>equivDD;/code> td> U+02A78 td> span classglyph>⩸/span> tr identity-eqvparsl>td> code>eqvparsl;/code> td> U+029E5 td> span classglyph>⧥/span> tr identity-erarr>td> code>erarr;/code> td> U+02971 td> span classglyph>⥱/span> tr identity-erDot>td> code>erDot;/code> td> U+02253 td> span classglyph>≓/span> tr identity-Escr>td> code>Escr;/code> td> U+02130 td> span classglyph>ℰ/span> tr identity-escr>td> code>escr;/code> td> U+0212F td> span classglyph>ℯ/span> tr identity-esdot>td> code>esdot;/code> td> U+02250 td> span classglyph>≐/span> tr identity-Esim>td> code>Esim;/code> td> U+02A73 td> span classglyph>⩳/span> tr identity-esim>td> code>esim;/code> td> U+02242 td> span classglyph>≂/span> tr identity-Eta>td> code>Eta;/code> td> U+00397 td> span classglyph>Η/span> tr identity-eta>td> code>eta;/code> td> U+003B7 td> span classglyph>η/span> tr identity-ETH>td> code>ETH;/code> td> U+000D0 td> span classglyph>Ð/span> tr identity-ETH-legacy classimpl>td> code>ETH/code> td> U+000D0 td> span>Ð/span> tr identity-eth>td> code>eth;/code> td> U+000F0 td> span classglyph>ð/span> tr identity-eth-legacy classimpl>td> code>eth/code> td> U+000F0 td> span>ð/span> tr identity-Euml>td> code>Euml;/code> td> U+000CB td> span classglyph>Ë/span> tr identity-Euml-legacy classimpl>td> code>Euml/code> td> U+000CB td> span>Ë/span> tr identity-euml>td> code>euml;/code> td> U+000EB td> span classglyph>ë/span> tr identity-euml-legacy classimpl>td> code>euml/code> td> U+000EB td> span>ë/span> tr identity-euro>td> code>euro;/code> td> U+020AC td> span classglyph>€/span> tr identity-excl>td> code>excl;/code> td> U+00021 td> span classglyph>!/span> tr identity-exist>td> code>exist;/code> td> U+02203 td> span classglyph>∃/span> tr identity-Exists>td> code>Exists;/code> td> U+02203 td> span classglyph>∃/span> tr identity-expectation>td> code>expectation;/code> td> U+02130 td> span classglyph>ℰ/span> tr identity-ExponentialE>td> code>ExponentialE;/code> td> U+02147 td> span classglyph>ⅇ/span> tr identity-exponentiale>td> code>exponentiale;/code> td> U+02147 td> span classglyph>ⅇ/span> tr identity-fallingdotseq>td> code>fallingdotseq;/code> td> U+02252 td> span classglyph>≒/span> tr identity-Fcy>td> code>Fcy;/code> td> U+00424 td> span classglyph>Ф/span> tr identity-fcy>td> code>fcy;/code> td> U+00444 td> span classglyph>ф/span> tr identity-female>td> code>female;/code> td> U+02640 td> span classglyph>♀/span> tr identity-ffilig>td> code>ffilig;/code> td> U+0FB03 td> span classglyph>ffi/span> tr identity-fflig>td> code>fflig;/code> td> U+0FB00 td> span classglyph>ff/span> tr identity-ffllig>td> code>ffllig;/code> td> U+0FB04 td> span classglyph>ffl/span> tr identity-Ffr>td> code>Ffr;/code> td> U+1D509 td> span classglyph>𝔉/span> tr identity-ffr>td> code>ffr;/code> td> U+1D523 td> span classglyph>𝔣/span> tr identity-filig>td> code>filig;/code> td> U+0FB01 td> span classglyph>fi/span> tr identity-FilledSmallSquare>td> code>FilledSmallSquare;/code> td> U+025FC td> span classglyph>◼/span> tr identity-FilledVerySmallSquare>td> code>FilledVerySmallSquare;/code> td> U+025AA td> span classglyph>▪/span> tr identity-fjlig>td> code>fjlig;/code> td> U+00066 U+0006A td> span classglyph compound>fj/span> tr identity-flat>td> code>flat;/code> td> U+0266D td> span classglyph>♭/span> tr identity-fllig>td> code>fllig;/code> td> U+0FB02 td> span classglyph>fl/span> tr identity-fltns>td> code>fltns;/code> td> U+025B1 td> span classglyph>▱/span> tr identity-fnof>td> code>fnof;/code> td> U+00192 td> span classglyph>ƒ/span> tr identity-Fopf>td> code>Fopf;/code> td> U+1D53D td> span classglyph>𝔽/span> tr identity-fopf>td> code>fopf;/code> td> U+1D557 td> span classglyph>𝕗/span> tr identity-ForAll>td> code>ForAll;/code> td> U+02200 td> span classglyph>∀/span> tr identity-forall>td> code>forall;/code> td> U+02200 td> span classglyph>∀/span> tr identity-fork>td> code>fork;/code> td> U+022D4 td> span classglyph>⋔/span> tr identity-forkv>td> code>forkv;/code> td> U+02AD9 td> span classglyph>⫙/span> tr identity-Fouriertrf>td> code>Fouriertrf;/code> td> U+02131 td> span classglyph>ℱ/span> tr identity-fpartint>td> code>fpartint;/code> td> U+02A0D td> span classglyph>⨍/span> tr identity-frac12>td> code>frac12;/code> td> U+000BD td> span classglyph>½/span> tr identity-frac12-legacy classimpl>td> code>frac12/code> td> U+000BD td> span>½/span> tr identity-frac13>td> code>frac13;/code> td> U+02153 td> span classglyph>⅓/span> tr identity-frac14>td> code>frac14;/code> td> U+000BC td> span classglyph>¼/span> tr identity-frac14-legacy classimpl>td> code>frac14/code> td> U+000BC td> span>¼/span> tr identity-frac15>td> code>frac15;/code> td> U+02155 td> span classglyph>⅕/span> tr identity-frac16>td> code>frac16;/code> td> U+02159 td> span classglyph>⅙/span> tr identity-frac18>td> code>frac18;/code> td> U+0215B td> span classglyph>⅛/span> tr identity-frac23>td> code>frac23;/code> td> U+02154 td> span classglyph>⅔/span> tr identity-frac25>td> code>frac25;/code> td> U+02156 td> span classglyph>⅖/span> tr identity-frac34>td> code>frac34;/code> td> U+000BE td> span classglyph>¾/span> tr identity-frac34-legacy classimpl>td> code>frac34/code> td> U+000BE td> span>¾/span> tr identity-frac35>td> code>frac35;/code> td> U+02157 td> span classglyph>⅗/span> tr identity-frac38>td> code>frac38;/code> td> U+0215C td> span classglyph>⅜/span> tr identity-frac45>td> code>frac45;/code> td> U+02158 td> span classglyph>⅘/span> tr identity-frac56>td> code>frac56;/code> td> U+0215A td> span classglyph>⅚/span> tr identity-frac58>td> code>frac58;/code> td> U+0215D td> span classglyph>⅝/span> tr identity-frac78>td> code>frac78;/code> td> U+0215E td> span classglyph>⅞/span> tr identity-frasl>td> code>frasl;/code> td> U+02044 td> span classglyph>⁄/span> tr identity-frown>td> code>frown;/code> td> U+02322 td> span classglyph>⌢/span> tr identity-Fscr>td> code>Fscr;/code> td> U+02131 td> span classglyph>ℱ/span> tr identity-fscr>td> code>fscr;/code> td> U+1D4BB td> span classglyph>𝒻/span> tr identity-gacute>td> code>gacute;/code> td> U+001F5 td> span classglyph>ǵ/span> tr identity-Gamma>td> code>Gamma;/code> td> U+00393 td> span classglyph>Γ/span> tr identity-gamma>td> code>gamma;/code> td> U+003B3 td> span classglyph>γ/span> tr identity-Gammad>td> code>Gammad;/code> td> U+003DC td> span classglyph>Ϝ/span> tr identity-gammad>td> code>gammad;/code> td> U+003DD td> span classglyph>ϝ/span> tr identity-gap>td> code>gap;/code> td> U+02A86 td> span classglyph>⪆/span> tr identity-Gbreve>td> code>Gbreve;/code> td> U+0011E td> span classglyph>Ğ/span> tr identity-gbreve>td> code>gbreve;/code> td> U+0011F td> span classglyph>ğ/span> tr identity-Gcedil>td> code>Gcedil;/code> td> U+00122 td> span classglyph>Ģ/span> tr identity-Gcirc>td> code>Gcirc;/code> td> U+0011C td> span classglyph>Ĝ/span> tr identity-gcirc>td> code>gcirc;/code> td> U+0011D td> span classglyph>ĝ/span> tr identity-Gcy>td> code>Gcy;/code> td> U+00413 td> span classglyph>Г/span> tr identity-gcy>td> code>gcy;/code> td> U+00433 td> span classglyph>г/span> tr identity-Gdot>td> code>Gdot;/code> td> U+00120 td> span classglyph>Ġ/span> tr identity-gdot>td> code>gdot;/code> td> U+00121 td> span classglyph>ġ/span> tr identity-gE>td> code>gE;/code> td> U+02267 td> span classglyph>≧/span> tr identity-ge>td> code>ge;/code> td> U+02265 td> span classglyph>≥/span> tr identity-gEl>td> code>gEl;/code> td> U+02A8C td> span classglyph>⪌/span> tr identity-gel>td> code>gel;/code> td> U+022DB td> span classglyph>⋛/span> tr identity-geq>td> code>geq;/code> td> U+02265 td> span classglyph>≥/span> tr identity-geqq>td> code>geqq;/code> td> U+02267 td> span classglyph>≧/span> tr identity-geqslant>td> code>geqslant;/code> td> U+02A7E td> span classglyph>⩾/span> tr identity-ges>td> code>ges;/code> td> U+02A7E td> span classglyph>⩾/span> tr identity-gescc>td> code>gescc;/code> td> U+02AA9 td> span classglyph>⪩/span> tr identity-gesdot>td> code>gesdot;/code> td> U+02A80 td> span classglyph>⪀/span> tr identity-gesdoto>td> code>gesdoto;/code> td> U+02A82 td> span classglyph>⪂/span> tr identity-gesdotol>td> code>gesdotol;/code> td> U+02A84 td> span classglyph>⪄/span> tr identity-gesl>td> code>gesl;/code> td> U+022DB U+0FE00 td> span classglyph compound>⋛︀/span> tr identity-gesles>td> code>gesles;/code> td> U+02A94 td> span classglyph>⪔/span> tr identity-Gfr>td> code>Gfr;/code> td> U+1D50A td> span classglyph>𝔊/span> tr identity-gfr>td> code>gfr;/code> td> U+1D524 td> span classglyph>𝔤/span> tr identity-Gg>td> code>Gg;/code> td> U+022D9 td> span classglyph>⋙/span> tr identity-gg>td> code>gg;/code> td> U+0226B td> span classglyph>≫/span> tr identity-ggg>td> code>ggg;/code> td> U+022D9 td> span classglyph>⋙/span> tr identity-gimel>td> code>gimel;/code> td> U+02137 td> span classglyph>ℷ/span> tr identity-GJcy>td> code>GJcy;/code> td> U+00403 td> span classglyph>Ѓ/span> tr identity-gjcy>td> code>gjcy;/code> td> U+00453 td> span classglyph>ѓ/span> tr identity-gl>td> code>gl;/code> td> U+02277 td> span classglyph>≷/span> tr identity-gla>td> code>gla;/code> td> U+02AA5 td> span classglyph>⪥/span> tr identity-glE>td> code>glE;/code> td> U+02A92 td> span classglyph>⪒/span> tr identity-glj>td> code>glj;/code> td> U+02AA4 td> span classglyph>⪤/span> tr identity-gnap>td> code>gnap;/code> td> U+02A8A td> span classglyph>⪊/span> tr identity-gnapprox>td> code>gnapprox;/code> td> U+02A8A td> span classglyph>⪊/span> tr identity-gnE>td> code>gnE;/code> td> U+02269 td> span classglyph>≩/span> tr identity-gne>td> code>gne;/code> td> U+02A88 td> span classglyph>⪈/span> tr identity-gneq>td> code>gneq;/code> td> U+02A88 td> span classglyph>⪈/span> tr identity-gneqq>td> code>gneqq;/code> td> U+02269 td> span classglyph>≩/span> tr identity-gnsim>td> code>gnsim;/code> td> U+022E7 td> span classglyph>⋧/span> tr identity-Gopf>td> code>Gopf;/code> td> U+1D53E td> span classglyph>𝔾/span> tr identity-gopf>td> code>gopf;/code> td> U+1D558 td> span classglyph>𝕘/span> tr identity-grave>td> code>grave;/code> td> U+00060 td> span classglyph>`/span> tr identity-GreaterEqual>td> code>GreaterEqual;/code> td> U+02265 td> span classglyph>≥/span> tr identity-GreaterEqualLess>td> code>GreaterEqualLess;/code> td> U+022DB td> span classglyph>⋛/span> tr identity-GreaterFullEqual>td> code>GreaterFullEqual;/code> td> U+02267 td> span classglyph>≧/span> tr identity-GreaterGreater>td> code>GreaterGreater;/code> td> U+02AA2 td> span classglyph>⪢/span> tr identity-GreaterLess>td> code>GreaterLess;/code> td> U+02277 td> span classglyph>≷/span> tr identity-GreaterSlantEqual>td> code>GreaterSlantEqual;/code> td> U+02A7E td> span classglyph>⩾/span> tr identity-GreaterTilde>td> code>GreaterTilde;/code> td> U+02273 td> span classglyph>≳/span> tr identity-Gscr>td> code>Gscr;/code> td> U+1D4A2 td> span classglyph>𝒢/span> tr identity-gscr>td> code>gscr;/code> td> U+0210A td> span classglyph>ℊ/span> tr identity-gsim>td> code>gsim;/code> td> U+02273 td> span classglyph>≳/span> tr identity-gsime>td> code>gsime;/code> td> U+02A8E td> span classglyph>⪎/span> tr identity-gsiml>td> code>gsiml;/code> td> U+02A90 td> span classglyph>⪐/span> tr identity-GT>td> code>GT;/code> td> U+0003E td> span classglyph>>/span> tr identity-GT-legacy classimpl>td> code>GT/code> td> U+0003E td> span>>/span> tr identity-Gt>td> code>Gt;/code> td> U+0226B td> span classglyph>≫/span> tr identity-gt>td> code>gt;/code> td> U+0003E td> span classglyph>>/span> tr identity-gt-legacy classimpl>td> code>gt/code> td> U+0003E td> span>>/span> tr identity-gtcc>td> code>gtcc;/code> td> U+02AA7 td> span classglyph>⪧/span> tr identity-gtcir>td> code>gtcir;/code> td> U+02A7A td> span classglyph>⩺/span> tr identity-gtdot>td> code>gtdot;/code> td> U+022D7 td> span classglyph>⋗/span> tr identity-gtlPar>td> code>gtlPar;/code> td> U+02995 td> span classglyph>⦕/span> tr identity-gtquest>td> code>gtquest;/code> td> U+02A7C td> span classglyph>⩼/span> tr identity-gtrapprox>td> code>gtrapprox;/code> td> U+02A86 td> span classglyph>⪆/span> tr identity-gtrarr>td> code>gtrarr;/code> td> U+02978 td> span classglyph>⥸/span> tr identity-gtrdot>td> code>gtrdot;/code> td> U+022D7 td> span classglyph>⋗/span> tr identity-gtreqless>td> code>gtreqless;/code> td> U+022DB td> span classglyph>⋛/span> tr identity-gtreqqless>td> code>gtreqqless;/code> td> U+02A8C td> span classglyph>⪌/span> tr identity-gtrless>td> code>gtrless;/code> td> U+02277 td> span classglyph>≷/span> tr identity-gtrsim>td> code>gtrsim;/code> td> U+02273 td> span classglyph>≳/span> tr identity-gvertneqq>td> code>gvertneqq;/code> td> U+02269 U+0FE00 td> span classglyph compound>≩︀/span> tr identity-gvnE>td> code>gvnE;/code> td> U+02269 U+0FE00 td> span classglyph compound>≩︀/span> tr identity-Hacek>td> code>Hacek;/code> td> U+002C7 td> span classglyph>ˇ/span> tr identity-hairsp>td> code>hairsp;/code> td> U+0200A td> span classglyph> /span> tr identity-half>td> code>half;/code> td> U+000BD td> span classglyph>½/span> tr identity-hamilt>td> code>hamilt;/code> td> U+0210B td> span classglyph>ℋ/span> tr identity-HARDcy>td> code>HARDcy;/code> td> U+0042A td> span classglyph>Ъ/span> tr identity-hardcy>td> code>hardcy;/code> td> U+0044A td> span classglyph>ъ/span> tr identity-hArr>td> code>hArr;/code> td> U+021D4 td> span classglyph>⇔/span> tr identity-harr>td> code>harr;/code> td> U+02194 td> span classglyph>↔/span> tr identity-harrcir>td> code>harrcir;/code> td> U+02948 td> span classglyph>⥈/span> tr identity-harrw>td> code>harrw;/code> td> U+021AD td> span classglyph>↭/span> tr identity-Hat>td> code>Hat;/code> td> U+0005E td> span classglyph>^/span> tr identity-hbar>td> code>hbar;/code> td> U+0210F td> span classglyph>ℏ/span> tr identity-Hcirc>td> code>Hcirc;/code> td> U+00124 td> span classglyph>Ĥ/span> tr identity-hcirc>td> code>hcirc;/code> td> U+00125 td> span classglyph>ĥ/span> tr identity-hearts>td> code>hearts;/code> td> U+02665 td> span classglyph>♥/span> tr identity-heartsuit>td> code>heartsuit;/code> td> U+02665 td> span classglyph>♥/span> tr identity-hellip>td> code>hellip;/code> td> U+02026 td> span classglyph>…/span> tr identity-hercon>td> code>hercon;/code> td> U+022B9 td> span classglyph>⊹/span> tr identity-Hfr>td> code>Hfr;/code> td> U+0210C td> span classglyph>ℌ/span> tr identity-hfr>td> code>hfr;/code> td> U+1D525 td> span classglyph>𝔥/span> tr identity-HilbertSpace>td> code>HilbertSpace;/code> td> U+0210B td> span classglyph>ℋ/span> tr identity-hksearow>td> code>hksearow;/code> td> U+02925 td> span classglyph>⤥/span> tr identity-hkswarow>td> code>hkswarow;/code> td> U+02926 td> span classglyph>⤦/span> tr identity-hoarr>td> code>hoarr;/code> td> U+021FF td> span classglyph>⇿/span> tr identity-homtht>td> code>homtht;/code> td> U+0223B td> span classglyph>∻/span> tr identity-hookleftarrow>td> code>hookleftarrow;/code> td> U+021A9 td> span classglyph>↩/span> tr identity-hookrightarrow>td> code>hookrightarrow;/code> td> U+021AA td> span classglyph>↪/span> tr identity-Hopf>td> code>Hopf;/code> td> U+0210D td> span classglyph>ℍ/span> tr identity-hopf>td> code>hopf;/code> td> U+1D559 td> span classglyph>𝕙/span> tr identity-horbar>td> code>horbar;/code> td> U+02015 td> span classglyph>―/span> tr identity-HorizontalLine>td> code>HorizontalLine;/code> td> U+02500 td> span classglyph>─/span> tr identity-Hscr>td> code>Hscr;/code> td> U+0210B td> span classglyph>ℋ/span> tr identity-hscr>td> code>hscr;/code> td> U+1D4BD td> span classglyph>𝒽/span> tr identity-hslash>td> code>hslash;/code> td> U+0210F td> span classglyph>ℏ/span> tr identity-Hstrok>td> code>Hstrok;/code> td> U+00126 td> span classglyph>Ħ/span> tr identity-hstrok>td> code>hstrok;/code> td> U+00127 td> span classglyph>ħ/span> tr identity-HumpDownHump>td> code>HumpDownHump;/code> td> U+0224E td> span classglyph>≎/span> tr identity-HumpEqual>td> code>HumpEqual;/code> td> U+0224F td> span classglyph>≏/span> tr identity-hybull>td> code>hybull;/code> td> U+02043 td> span classglyph>⁃/span> tr identity-hyphen>td> code>hyphen;/code> td> U+02010 td> span classglyph>‐/span> tr identity-Iacute>td> code>Iacute;/code> td> U+000CD td> span classglyph>Í/span> tr identity-Iacute-legacy classimpl>td> code>Iacute/code> td> U+000CD td> span>Í/span> tr identity-iacute>td> code>iacute;/code> td> U+000ED td> span classglyph>í/span> tr identity-iacute-legacy classimpl>td> code>iacute/code> td> U+000ED td> span>í/span> tr identity-ic>td> code>ic;/code> td> U+02063 td> span classglyph>/span> tr identity-Icirc>td> code>Icirc;/code> td> U+000CE td> span classglyph>Î/span> tr identity-Icirc-legacy classimpl>td> code>Icirc/code> td> U+000CE td> span>Î/span> tr identity-icirc>td> code>icirc;/code> td> U+000EE td> span classglyph>î/span> tr identity-icirc-legacy classimpl>td> code>icirc/code> td> U+000EE td> span>î/span> tr identity-Icy>td> code>Icy;/code> td> U+00418 td> span classglyph>И/span> tr identity-icy>td> code>icy;/code> td> U+00438 td> span classglyph>и/span> tr identity-Idot>td> code>Idot;/code> td> U+00130 td> span classglyph>İ/span> tr identity-IEcy>td> code>IEcy;/code> td> U+00415 td> span classglyph>Е/span> tr identity-iecy>td> code>iecy;/code> td> U+00435 td> span classglyph>е/span> tr identity-iexcl>td> code>iexcl;/code> td> U+000A1 td> span classglyph>¡/span> tr identity-iexcl-legacy classimpl>td> code>iexcl/code> td> U+000A1 td> span>¡/span> tr identity-iff>td> code>iff;/code> td> U+021D4 td> span classglyph>⇔/span> tr identity-Ifr>td> code>Ifr;/code> td> U+02111 td> span classglyph>ℑ/span> tr identity-ifr>td> code>ifr;/code> td> U+1D526 td> span classglyph>𝔦/span> tr identity-Igrave>td> code>Igrave;/code> td> U+000CC td> span classglyph>Ì/span> tr identity-Igrave-legacy classimpl>td> code>Igrave/code> td> U+000CC td> span>Ì/span> tr identity-igrave>td> code>igrave;/code> td> U+000EC td> span classglyph>ì/span> tr identity-igrave-legacy classimpl>td> code>igrave/code> td> U+000EC td> span>ì/span> tr identity-ii>td> code>ii;/code> td> U+02148 td> span classglyph>ⅈ/span> tr identity-iiiint>td> code>iiiint;/code> td> U+02A0C td> span classglyph>⨌/span> tr identity-iiint>td> code>iiint;/code> td> U+0222D td> span classglyph>∭/span> tr identity-iinfin>td> code>iinfin;/code> td> U+029DC td> span classglyph>⧜/span> tr identity-iiota>td> code>iiota;/code> td> U+02129 td> span classglyph>℩/span> tr identity-IJlig>td> code>IJlig;/code> td> U+00132 td> span classglyph>IJ/span> tr identity-ijlig>td> code>ijlig;/code> td> U+00133 td> span classglyph>ij/span> tr identity-Im>td> code>Im;/code> td> U+02111 td> span classglyph>ℑ/span> tr identity-Imacr>td> code>Imacr;/code> td> U+0012A td> span classglyph>Ī/span> tr identity-imacr>td> code>imacr;/code> td> U+0012B td> span classglyph>ī/span> tr identity-image>td> code>image;/code> td> U+02111 td> span classglyph>ℑ/span> tr identity-ImaginaryI>td> code>ImaginaryI;/code> td> U+02148 td> span classglyph>ⅈ/span> tr identity-imagline>td> code>imagline;/code> td> U+02110 td> span classglyph>ℐ/span> tr identity-imagpart>td> code>imagpart;/code> td> U+02111 td> span classglyph>ℑ/span> tr identity-imath>td> code>imath;/code> td> U+00131 td> span classglyph>ı/span> tr identity-imof>td> code>imof;/code> td> U+022B7 td> span classglyph>⊷/span> tr identity-imped>td> code>imped;/code> td> U+001B5 td> span classglyph>Ƶ/span> tr identity-Implies>td> code>Implies;/code> td> U+021D2 td> span classglyph>⇒/span> tr identity-in>td> code>in;/code> td> U+02208 td> span classglyph>∈/span> tr identity-incare>td> code>incare;/code> td> U+02105 td> span classglyph>℅/span> tr identity-infin>td> code>infin;/code> td> U+0221E td> span classglyph>∞/span> tr identity-infintie>td> code>infintie;/code> td> U+029DD td> span classglyph>⧝/span> tr identity-inodot>td> code>inodot;/code> td> U+00131 td> span classglyph>ı/span> tr identity-Int>td> code>Int;/code> td> U+0222C td> span classglyph>∬/span> tr identity-int>td> code>int;/code> td> U+0222B td> span classglyph>∫/span> tr identity-intcal>td> code>intcal;/code> td> U+022BA td> span classglyph>⊺/span> tr identity-integers>td> code>integers;/code> td> U+02124 td> span classglyph>ℤ/span> tr identity-Integral>td> code>Integral;/code> td> U+0222B td> span classglyph>∫/span> tr identity-intercal>td> code>intercal;/code> td> U+022BA td> span classglyph>⊺/span> tr identity-Intersection>td> code>Intersection;/code> td> U+022C2 td> span classglyph>⋂/span> tr identity-intlarhk>td> code>intlarhk;/code> td> U+02A17 td> span classglyph>⨗/span> tr identity-intprod>td> code>intprod;/code> td> U+02A3C td> span classglyph>⨼/span> tr identity-InvisibleComma>td> code>InvisibleComma;/code> td> U+02063 td> span classglyph>/span> tr identity-InvisibleTimes>td> code>InvisibleTimes;/code> td> U+02062 td> span classglyph>/span> tr identity-IOcy>td> code>IOcy;/code> td> U+00401 td> span classglyph>Ё/span> tr identity-iocy>td> code>iocy;/code> td> U+00451 td> span classglyph>ё/span> tr identity-Iogon>td> code>Iogon;/code> td> U+0012E td> span classglyph>Į/span> tr identity-iogon>td> code>iogon;/code> td> U+0012F td> span classglyph>į/span> tr identity-Iopf>td> code>Iopf;/code> td> U+1D540 td> span classglyph>𝕀/span> tr identity-iopf>td> code>iopf;/code> td> U+1D55A td> span classglyph>𝕚/span> tr identity-Iota>td> code>Iota;/code> td> U+00399 td> span classglyph>Ι/span> tr identity-iota>td> code>iota;/code> td> U+003B9 td> span classglyph>ι/span> tr identity-iprod>td> code>iprod;/code> td> U+02A3C td> span classglyph>⨼/span> tr identity-iquest>td> code>iquest;/code> td> U+000BF td> span classglyph>¿/span> tr identity-iquest-legacy classimpl>td> code>iquest/code> td> U+000BF td> span>¿/span> tr identity-Iscr>td> code>Iscr;/code> td> U+02110 td> span classglyph>ℐ/span> tr identity-iscr>td> code>iscr;/code> td> U+1D4BE td> span classglyph>𝒾/span> tr identity-isin>td> code>isin;/code> td> U+02208 td> span classglyph>∈/span> tr identity-isindot>td> code>isindot;/code> td> U+022F5 td> span classglyph>⋵/span> tr identity-isinE>td> code>isinE;/code> td> U+022F9 td> span classglyph>⋹/span> tr identity-isins>td> code>isins;/code> td> U+022F4 td> span classglyph>⋴/span> tr identity-isinsv>td> code>isinsv;/code> td> U+022F3 td> span classglyph>⋳/span> tr identity-isinv>td> code>isinv;/code> td> U+02208 td> span classglyph>∈/span> tr identity-it>td> code>it;/code> td> U+02062 td> span classglyph>/span> tr identity-Itilde>td> code>Itilde;/code> td> U+00128 td> span classglyph>Ĩ/span> tr identity-itilde>td> code>itilde;/code> td> U+00129 td> span classglyph>ĩ/span> tr identity-Iukcy>td> code>Iukcy;/code> td> U+00406 td> span classglyph>І/span> tr identity-iukcy>td> code>iukcy;/code> td> U+00456 td> span classglyph>і/span> tr identity-Iuml>td> code>Iuml;/code> td> U+000CF td> span classglyph>Ï/span> tr identity-Iuml-legacy classimpl>td> code>Iuml/code> td> U+000CF td> span>Ï/span> tr identity-iuml>td> code>iuml;/code> td> U+000EF td> span classglyph>ï/span> tr identity-iuml-legacy classimpl>td> code>iuml/code> td> U+000EF td> span>ï/span> tr identity-Jcirc>td> code>Jcirc;/code> td> U+00134 td> span classglyph>Ĵ/span> tr identity-jcirc>td> code>jcirc;/code> td> U+00135 td> span classglyph>ĵ/span> tr identity-Jcy>td> code>Jcy;/code> td> U+00419 td> span classglyph>Й/span> tr identity-jcy>td> code>jcy;/code> td> U+00439 td> span classglyph>й/span> tr identity-Jfr>td> code>Jfr;/code> td> U+1D50D td> span classglyph>𝔍/span> tr identity-jfr>td> code>jfr;/code> td> U+1D527 td> span classglyph>𝔧/span> tr identity-jmath>td> code>jmath;/code> td> U+00237 td> span classglyph>ȷ/span> tr identity-Jopf>td> code>Jopf;/code> td> U+1D541 td> span classglyph>𝕁/span> tr identity-jopf>td> code>jopf;/code> td> U+1D55B td> span classglyph>𝕛/span> tr identity-Jscr>td> code>Jscr;/code> td> U+1D4A5 td> span classglyph>𝒥/span> tr identity-jscr>td> code>jscr;/code> td> U+1D4BF td> span classglyph>𝒿/span> tr identity-Jsercy>td> code>Jsercy;/code> td> U+00408 td> span classglyph>Ј/span> tr identity-jsercy>td> code>jsercy;/code> td> U+00458 td> span classglyph>ј/span> tr identity-Jukcy>td> code>Jukcy;/code> td> U+00404 td> span classglyph>Є/span> tr identity-jukcy>td> code>jukcy;/code> td> U+00454 td> span classglyph>є/span> tr identity-Kappa>td> code>Kappa;/code> td> U+0039A td> span classglyph>Κ/span> tr identity-kappa>td> code>kappa;/code> td> U+003BA td> span classglyph>κ/span> tr identity-kappav>td> code>kappav;/code> td> U+003F0 td> span classglyph>ϰ/span> tr identity-Kcedil>td> code>Kcedil;/code> td> U+00136 td> span classglyph>Ķ/span> tr identity-kcedil>td> code>kcedil;/code> td> U+00137 td> span classglyph>ķ/span> tr identity-Kcy>td> code>Kcy;/code> td> U+0041A td> span classglyph>К/span> tr identity-kcy>td> code>kcy;/code> td> U+0043A td> span classglyph>к/span> tr identity-Kfr>td> code>Kfr;/code> td> U+1D50E td> span classglyph>𝔎/span> tr identity-kfr>td> code>kfr;/code> td> U+1D528 td> span classglyph>𝔨/span> tr identity-kgreen>td> code>kgreen;/code> td> U+00138 td> span classglyph>ĸ/span> tr identity-KHcy>td> code>KHcy;/code> td> U+00425 td> span classglyph>Х/span> tr identity-khcy>td> code>khcy;/code> td> U+00445 td> span classglyph>х/span> tr identity-KJcy>td> code>KJcy;/code> td> U+0040C td> span classglyph>Ќ/span> tr identity-kjcy>td> code>kjcy;/code> td> U+0045C td> span classglyph>ќ/span> tr identity-Kopf>td> code>Kopf;/code> td> U+1D542 td> span classglyph>𝕂/span> tr identity-kopf>td> code>kopf;/code> td> U+1D55C td> span classglyph>𝕜/span> tr identity-Kscr>td> code>Kscr;/code> td> U+1D4A6 td> span classglyph>𝒦/span> tr identity-kscr>td> code>kscr;/code> td> U+1D4C0 td> span classglyph>𝓀/span> tr identity-lAarr>td> code>lAarr;/code> td> U+021DA td> span classglyph>⇚/span> tr identity-Lacute>td> code>Lacute;/code> td> U+00139 td> span classglyph>Ĺ/span> tr identity-lacute>td> code>lacute;/code> td> U+0013A td> span classglyph>ĺ/span> tr identity-laemptyv>td> code>laemptyv;/code> td> U+029B4 td> span classglyph>⦴/span> tr identity-lagran>td> code>lagran;/code> td> U+02112 td> span classglyph>ℒ/span> tr identity-Lambda>td> code>Lambda;/code> td> U+0039B td> span classglyph>Λ/span> tr identity-lambda>td> code>lambda;/code> td> U+003BB td> span classglyph>λ/span> tr identity-Lang>td> code>Lang;/code> td> U+027EA td> span classglyph>⟪/span> tr identity-lang>td> code>lang;/code> td> U+027E8 td> span classglyph>⟨/span> tr identity-langd>td> code>langd;/code> td> U+02991 td> span classglyph>⦑/span> tr identity-langle>td> code>langle;/code> td> U+027E8 td> span classglyph>⟨/span> tr identity-lap>td> code>lap;/code> td> U+02A85 td> span classglyph>⪅/span> tr identity-Laplacetrf>td> code>Laplacetrf;/code> td> U+02112 td> span classglyph>ℒ/span> tr identity-laquo>td> code>laquo;/code> td> U+000AB td> span classglyph>«/span> tr identity-laquo-legacy classimpl>td> code>laquo/code> td> U+000AB td> span>«/span> tr identity-Larr>td> code>Larr;/code> td> U+0219E td> span classglyph>↞/span> tr identity-lArr>td> code>lArr;/code> td> U+021D0 td> span classglyph>⇐/span> tr identity-larr>td> code>larr;/code> td> U+02190 td> span classglyph>←/span> tr identity-larrb>td> code>larrb;/code> td> U+021E4 td> span classglyph>⇤/span> tr identity-larrbfs>td> code>larrbfs;/code> td> U+0291F td> span classglyph>⤟/span> tr identity-larrfs>td> code>larrfs;/code> td> U+0291D td> span classglyph>⤝/span> tr identity-larrhk>td> code>larrhk;/code> td> U+021A9 td> span classglyph>↩/span> tr identity-larrlp>td> code>larrlp;/code> td> U+021AB td> span classglyph>↫/span> tr identity-larrpl>td> code>larrpl;/code> td> U+02939 td> span classglyph>⤹/span> tr identity-larrsim>td> code>larrsim;/code> td> U+02973 td> span classglyph>⥳/span> tr identity-larrtl>td> code>larrtl;/code> td> U+021A2 td> span classglyph>↢/span> tr identity-lat>td> code>lat;/code> td> U+02AAB td> span classglyph>⪫/span> tr identity-lAtail>td> code>lAtail;/code> td> U+0291B td> span classglyph>⤛/span> tr identity-latail>td> code>latail;/code> td> U+02919 td> span classglyph>⤙/span> tr identity-late>td> code>late;/code> td> U+02AAD td> span classglyph>⪭/span> tr identity-lates>td> code>lates;/code> td> U+02AAD U+0FE00 td> span classglyph compound>⪭︀/span> tr identity-lBarr>td> code>lBarr;/code> td> U+0290E td> span classglyph>⤎/span> tr identity-lbarr>td> code>lbarr;/code> td> U+0290C td> span classglyph>⤌/span> tr identity-lbbrk>td> code>lbbrk;/code> td> U+02772 td> span classglyph>❲/span> tr identity-lbrace>td> code>lbrace;/code> td> U+0007B td> span classglyph>{/span> tr identity-lbrack>td> code>lbrack;/code> td> U+0005B td> span classglyph>/span> tr identity-lbrke>td> code>lbrke;/code> td> U+0298B td> span classglyph>⦋/span> tr identity-lbrksld>td> code>lbrksld;/code> td> U+0298F td> span classglyph>⦏/span> tr identity-lbrkslu>td> code>lbrkslu;/code> td> U+0298D td> span classglyph>⦍/span> tr identity-Lcaron>td> code>Lcaron;/code> td> U+0013D td> span classglyph>Ľ/span> tr identity-lcaron>td> code>lcaron;/code> td> U+0013E td> span classglyph>ľ/span> tr identity-Lcedil>td> code>Lcedil;/code> td> U+0013B td> span classglyph>Ļ/span> tr identity-lcedil>td> code>lcedil;/code> td> U+0013C td> span classglyph>ļ/span> tr identity-lceil>td> code>lceil;/code> td> U+02308 td> span classglyph>⌈/span> tr identity-lcub>td> code>lcub;/code> td> U+0007B td> span classglyph>{/span> tr identity-Lcy>td> code>Lcy;/code> td> U+0041B td> span classglyph>Л/span> tr identity-lcy>td> code>lcy;/code> td> U+0043B td> span classglyph>л/span> tr identity-ldca>td> code>ldca;/code> td> U+02936 td> span classglyph>⤶/span> tr identity-ldquo>td> code>ldquo;/code> td> U+0201C td> span classglyph>“/span> tr identity-ldquor>td> code>ldquor;/code> td> U+0201E td> span classglyph>„/span> tr identity-ldrdhar>td> code>ldrdhar;/code> td> U+02967 td> span classglyph>⥧/span> tr identity-ldrushar>td> code>ldrushar;/code> td> U+0294B td> span classglyph>⥋/span> tr identity-ldsh>td> code>ldsh;/code> td> U+021B2 td> span classglyph>↲/span> tr identity-lE>td> code>lE;/code> td> U+02266 td> span classglyph>≦/span> tr identity-le>td> code>le;/code> td> U+02264 td> span classglyph>≤/span> tr identity-LeftAngleBracket>td> code>LeftAngleBracket;/code> td> U+027E8 td> span classglyph>⟨/span> tr identity-LeftArrow>td> code>LeftArrow;/code> td> U+02190 td> span classglyph>←/span> tr identity-Leftarrow>td> code>Leftarrow;/code> td> U+021D0 td> span classglyph>⇐/span> tr identity-leftarrow>td> code>leftarrow;/code> td> U+02190 td> span classglyph>←/span> tr identity-LeftArrowBar>td> code>LeftArrowBar;/code> td> U+021E4 td> span classglyph>⇤/span> tr identity-LeftArrowRightArrow>td> code>LeftArrowRightArrow;/code> td> U+021C6 td> span classglyph>⇆/span> tr identity-leftarrowtail>td> code>leftarrowtail;/code> td> U+021A2 td> span classglyph>↢/span> tr identity-LeftCeiling>td> code>LeftCeiling;/code> td> U+02308 td> span classglyph>⌈/span> tr identity-LeftDoubleBracket>td> code>LeftDoubleBracket;/code> td> U+027E6 td> span classglyph>⟦/span> tr identity-LeftDownTeeVector>td> code>LeftDownTeeVector;/code> td> U+02961 td> span classglyph>⥡/span> tr identity-LeftDownVector>td> code>LeftDownVector;/code> td> U+021C3 td> span classglyph>⇃/span> tr identity-LeftDownVectorBar>td> code>LeftDownVectorBar;/code> td> U+02959 td> span classglyph>⥙/span> tr identity-LeftFloor>td> code>LeftFloor;/code> td> U+0230A td> span classglyph>⌊/span> tr identity-leftharpoondown>td> code>leftharpoondown;/code> td> U+021BD td> span classglyph>↽/span> tr identity-leftharpoonup>td> code>leftharpoonup;/code> td> U+021BC td> span classglyph>↼/span> tr identity-leftleftarrows>td> code>leftleftarrows;/code> td> U+021C7 td> span classglyph>⇇/span> tr identity-LeftRightArrow>td> code>LeftRightArrow;/code> td> U+02194 td> span classglyph>↔/span> tr identity-Leftrightarrow>td> code>Leftrightarrow;/code> td> U+021D4 td> span classglyph>⇔/span> tr identity-leftrightarrow>td> code>leftrightarrow;/code> td> U+02194 td> span classglyph>↔/span> tr identity-leftrightarrows>td> code>leftrightarrows;/code> td> U+021C6 td> span classglyph>⇆/span> tr identity-leftrightharpoons>td> code>leftrightharpoons;/code> td> U+021CB td> span classglyph>⇋/span> tr identity-leftrightsquigarrow>td> code>leftrightsquigarrow;/code> td> U+021AD td> span classglyph>↭/span> tr identity-LeftRightVector>td> code>LeftRightVector;/code> td> U+0294E td> span classglyph>⥎/span> tr identity-LeftTee>td> code>LeftTee;/code> td> U+022A3 td> span classglyph>⊣/span> tr identity-LeftTeeArrow>td> code>LeftTeeArrow;/code> td> U+021A4 td> span classglyph>↤/span> tr identity-LeftTeeVector>td> code>LeftTeeVector;/code> td> U+0295A td> span classglyph>⥚/span> tr identity-leftthreetimes>td> code>leftthreetimes;/code> td> U+022CB td> span classglyph>⋋/span> tr identity-LeftTriangle>td> code>LeftTriangle;/code> td> U+022B2 td> span classglyph>⊲/span> tr identity-LeftTriangleBar>td> code>LeftTriangleBar;/code> td> U+029CF td> span classglyph>⧏/span> tr identity-LeftTriangleEqual>td> code>LeftTriangleEqual;/code> td> U+022B4 td> span classglyph>⊴/span> tr identity-LeftUpDownVector>td> code>LeftUpDownVector;/code> td> U+02951 td> span classglyph>⥑/span> tr identity-LeftUpTeeVector>td> code>LeftUpTeeVector;/code> td> U+02960 td> span classglyph>⥠/span> tr identity-LeftUpVector>td> code>LeftUpVector;/code> td> U+021BF td> span classglyph>↿/span> tr identity-LeftUpVectorBar>td> code>LeftUpVectorBar;/code> td> U+02958 td> span classglyph>⥘/span> tr identity-LeftVector>td> code>LeftVector;/code> td> U+021BC td> span classglyph>↼/span> tr identity-LeftVectorBar>td> code>LeftVectorBar;/code> td> U+02952 td> span classglyph>⥒/span> tr identity-lEg>td> code>lEg;/code> td> U+02A8B td> span classglyph>⪋/span> tr identity-leg>td> code>leg;/code> td> U+022DA td> span classglyph>⋚/span> tr identity-leq>td> code>leq;/code> td> U+02264 td> span classglyph>≤/span> tr identity-leqq>td> code>leqq;/code> td> U+02266 td> span classglyph>≦/span> tr identity-leqslant>td> code>leqslant;/code> td> U+02A7D td> span classglyph>⩽/span> tr identity-les>td> code>les;/code> td> U+02A7D td> span classglyph>⩽/span> tr identity-lescc>td> code>lescc;/code> td> U+02AA8 td> span classglyph>⪨/span> tr identity-lesdot>td> code>lesdot;/code> td> U+02A7F td> span classglyph>⩿/span> tr identity-lesdoto>td> code>lesdoto;/code> td> U+02A81 td> span classglyph>⪁/span> tr identity-lesdotor>td> code>lesdotor;/code> td> U+02A83 td> span classglyph>⪃/span> tr identity-lesg>td> code>lesg;/code> td> U+022DA U+0FE00 td> span classglyph compound>⋚︀/span> tr identity-lesges>td> code>lesges;/code> td> U+02A93 td> span classglyph>⪓/span> tr identity-lessapprox>td> code>lessapprox;/code> td> U+02A85 td> span classglyph>⪅/span> tr identity-lessdot>td> code>lessdot;/code> td> U+022D6 td> span classglyph>⋖/span> tr identity-lesseqgtr>td> code>lesseqgtr;/code> td> U+022DA td> span classglyph>⋚/span> tr identity-lesseqqgtr>td> code>lesseqqgtr;/code> td> U+02A8B td> span classglyph>⪋/span> tr identity-LessEqualGreater>td> code>LessEqualGreater;/code> td> U+022DA td> span classglyph>⋚/span> tr identity-LessFullEqual>td> code>LessFullEqual;/code> td> U+02266 td> span classglyph>≦/span> tr identity-LessGreater>td> code>LessGreater;/code> td> U+02276 td> span classglyph>≶/span> tr identity-lessgtr>td> code>lessgtr;/code> td> U+02276 td> span classglyph>≶/span> tr identity-LessLess>td> code>LessLess;/code> td> U+02AA1 td> span classglyph>⪡/span> tr identity-lesssim>td> code>lesssim;/code> td> U+02272 td> span classglyph>≲/span> tr identity-LessSlantEqual>td> code>LessSlantEqual;/code> td> U+02A7D td> span classglyph>⩽/span> tr identity-LessTilde>td> code>LessTilde;/code> td> U+02272 td> span classglyph>≲/span> tr identity-lfisht>td> code>lfisht;/code> td> U+0297C td> span classglyph>⥼/span> tr identity-lfloor>td> code>lfloor;/code> td> U+0230A td> span classglyph>⌊/span> tr identity-Lfr>td> code>Lfr;/code> td> U+1D50F td> span classglyph>𝔏/span> tr identity-lfr>td> code>lfr;/code> td> U+1D529 td> span classglyph>𝔩/span> tr identity-lg>td> code>lg;/code> td> U+02276 td> span classglyph>≶/span> tr identity-lgE>td> code>lgE;/code> td> U+02A91 td> span classglyph>⪑/span> tr identity-lHar>td> code>lHar;/code> td> U+02962 td> span classglyph>⥢/span> tr identity-lhard>td> code>lhard;/code> td> U+021BD td> span classglyph>↽/span> tr identity-lharu>td> code>lharu;/code> td> U+021BC td> span classglyph>↼/span> tr identity-lharul>td> code>lharul;/code> td> U+0296A td> span classglyph>⥪/span> tr identity-lhblk>td> code>lhblk;/code> td> U+02584 td> span classglyph>▄/span> tr identity-LJcy>td> code>LJcy;/code> td> U+00409 td> span classglyph>Љ/span> tr identity-ljcy>td> code>ljcy;/code> td> U+00459 td> span classglyph>љ/span> tr identity-Ll>td> code>Ll;/code> td> U+022D8 td> span classglyph>⋘/span> tr identity-ll>td> code>ll;/code> td> U+0226A td> span classglyph>≪/span> tr identity-llarr>td> code>llarr;/code> td> U+021C7 td> span classglyph>⇇/span> tr identity-llcorner>td> code>llcorner;/code> td> U+0231E td> span classglyph>⌞/span> tr identity-Lleftarrow>td> code>Lleftarrow;/code> td> U+021DA td> span classglyph>⇚/span> tr identity-llhard>td> code>llhard;/code> td> U+0296B td> span classglyph>⥫/span> tr identity-lltri>td> code>lltri;/code> td> U+025FA td> span classglyph>◺/span> tr identity-Lmidot>td> code>Lmidot;/code> td> U+0013F td> span classglyph>Ŀ/span> tr identity-lmidot>td> code>lmidot;/code> td> U+00140 td> span classglyph>ŀ/span> tr identity-lmoust>td> code>lmoust;/code> td> U+023B0 td> span classglyph>⎰/span> tr identity-lmoustache>td> code>lmoustache;/code> td> U+023B0 td> span classglyph>⎰/span> tr identity-lnap>td> code>lnap;/code> td> U+02A89 td> span classglyph>⪉/span> tr identity-lnapprox>td> code>lnapprox;/code> td> U+02A89 td> span classglyph>⪉/span> tr identity-lnE>td> code>lnE;/code> td> U+02268 td> span classglyph>≨/span> tr identity-lne>td> code>lne;/code> td> U+02A87 td> span classglyph>⪇/span> tr identity-lneq>td> code>lneq;/code> td> U+02A87 td> span classglyph>⪇/span> tr identity-lneqq>td> code>lneqq;/code> td> U+02268 td> span classglyph>≨/span> tr identity-lnsim>td> code>lnsim;/code> td> U+022E6 td> span classglyph>⋦/span> tr identity-loang>td> code>loang;/code> td> U+027EC td> span classglyph>⟬/span> tr identity-loarr>td> code>loarr;/code> td> U+021FD td> span classglyph>⇽/span> tr identity-lobrk>td> code>lobrk;/code> td> U+027E6 td> span classglyph>⟦/span> tr identity-LongLeftArrow>td> code>LongLeftArrow;/code> td> U+027F5 td> span classglyph>⟵/span> tr identity-Longleftarrow>td> code>Longleftarrow;/code> td> U+027F8 td> span classglyph>⟸/span> tr identity-longleftarrow>td> code>longleftarrow;/code> td> U+027F5 td> span classglyph>⟵/span> tr identity-LongLeftRightArrow>td> code>LongLeftRightArrow;/code> td> U+027F7 td> span classglyph>⟷/span> tr identity-Longleftrightarrow>td> code>Longleftrightarrow;/code> td> U+027FA td> span classglyph>⟺/span> tr identity-longleftrightarrow>td> code>longleftrightarrow;/code> td> U+027F7 td> span classglyph>⟷/span> tr identity-longmapsto>td> code>longmapsto;/code> td> U+027FC td> span classglyph>⟼/span> tr identity-LongRightArrow>td> code>LongRightArrow;/code> td> U+027F6 td> span classglyph>⟶/span> tr identity-Longrightarrow>td> code>Longrightarrow;/code> td> U+027F9 td> span classglyph>⟹/span> tr identity-longrightarrow>td> code>longrightarrow;/code> td> U+027F6 td> span classglyph>⟶/span> tr identity-looparrowleft>td> code>looparrowleft;/code> td> U+021AB td> span classglyph>↫/span> tr identity-looparrowright>td> code>looparrowright;/code> td> U+021AC td> span classglyph>↬/span> tr identity-lopar>td> code>lopar;/code> td> U+02985 td> span classglyph>⦅/span> tr identity-Lopf>td> code>Lopf;/code> td> U+1D543 td> span classglyph>𝕃/span> tr identity-lopf>td> code>lopf;/code> td> U+1D55D td> span classglyph>𝕝/span> tr identity-loplus>td> code>loplus;/code> td> U+02A2D td> span classglyph>⨭/span> tr identity-lotimes>td> code>lotimes;/code> td> U+02A34 td> span classglyph>⨴/span> tr identity-lowast>td> code>lowast;/code> td> U+02217 td> span classglyph>∗/span> tr identity-lowbar>td> code>lowbar;/code> td> U+0005F td> span classglyph>_/span> tr identity-LowerLeftArrow>td> code>LowerLeftArrow;/code> td> U+02199 td> span classglyph>↙/span> tr identity-LowerRightArrow>td> code>LowerRightArrow;/code> td> U+02198 td> span classglyph>↘/span> tr identity-loz>td> code>loz;/code> td> U+025CA td> span classglyph>◊/span> tr identity-lozenge>td> code>lozenge;/code> td> U+025CA td> span classglyph>◊/span> tr identity-lozf>td> code>lozf;/code> td> U+029EB td> span classglyph>⧫/span> tr identity-lpar>td> code>lpar;/code> td> U+00028 td> span classglyph>(/span> tr identity-lparlt>td> code>lparlt;/code> td> U+02993 td> span classglyph>⦓/span> tr identity-lrarr>td> code>lrarr;/code> td> U+021C6 td> span classglyph>⇆/span> tr identity-lrcorner>td> code>lrcorner;/code> td> U+0231F td> span classglyph>⌟/span> tr identity-lrhar>td> code>lrhar;/code> td> U+021CB td> span classglyph>⇋/span> tr identity-lrhard>td> code>lrhard;/code> td> U+0296D td> span classglyph>⥭/span> tr identity-lrm>td> code>lrm;/code> td> U+0200E td> span classglyph>/span> tr identity-lrtri>td> code>lrtri;/code> td> U+022BF td> span classglyph>⊿/span> tr identity-lsaquo>td> code>lsaquo;/code> td> U+02039 td> span classglyph>‹/span> tr identity-Lscr>td> code>Lscr;/code> td> U+02112 td> span classglyph>ℒ/span> tr identity-lscr>td> code>lscr;/code> td> U+1D4C1 td> span classglyph>𝓁/span> tr identity-Lsh>td> code>Lsh;/code> td> U+021B0 td> span classglyph>↰/span> tr identity-lsh>td> code>lsh;/code> td> U+021B0 td> span classglyph>↰/span> tr identity-lsim>td> code>lsim;/code> td> U+02272 td> span classglyph>≲/span> tr identity-lsime>td> code>lsime;/code> td> U+02A8D td> span classglyph>⪍/span> tr identity-lsimg>td> code>lsimg;/code> td> U+02A8F td> span classglyph>⪏/span> tr identity-lsqb>td> code>lsqb;/code> td> U+0005B td> span classglyph>/span> tr identity-lsquo>td> code>lsquo;/code> td> U+02018 td> span classglyph>‘/span> tr identity-lsquor>td> code>lsquor;/code> td> U+0201A td> span classglyph>‚/span> tr identity-Lstrok>td> code>Lstrok;/code> td> U+00141 td> span classglyph>Ł/span> tr identity-lstrok>td> code>lstrok;/code> td> U+00142 td> span classglyph>ł/span> tr identity-LT>td> code>LT;/code> td> U+0003C td> span classglyph></span> tr identity-LT-legacy classimpl>td> code>LT/code> td> U+0003C td> span></span> tr identity-Lt>td> code>Lt;/code> td> U+0226A td> span classglyph>≪/span> tr identity-lt>td> code>lt;/code> td> U+0003C td> span classglyph></span> tr identity-lt-legacy classimpl>td> code>lt/code> td> U+0003C td> span></span> tr identity-ltcc>td> code>ltcc;/code> td> U+02AA6 td> span classglyph>⪦/span> tr identity-ltcir>td> code>ltcir;/code> td> U+02A79 td> span classglyph>⩹/span> tr identity-ltdot>td> code>ltdot;/code> td> U+022D6 td> span classglyph>⋖/span> tr identity-lthree>td> code>lthree;/code> td> U+022CB td> span classglyph>⋋/span> tr identity-ltimes>td> code>ltimes;/code> td> U+022C9 td> span classglyph>⋉/span> tr identity-ltlarr>td> code>ltlarr;/code> td> U+02976 td> span classglyph>⥶/span> tr identity-ltquest>td> code>ltquest;/code> td> U+02A7B td> span classglyph>⩻/span> tr identity-ltri>td> code>ltri;/code> td> U+025C3 td> span classglyph>◃/span> tr identity-ltrie>td> code>ltrie;/code> td> U+022B4 td> span classglyph>⊴/span> tr identity-ltrif>td> code>ltrif;/code> td> U+025C2 td> span classglyph>◂/span> tr identity-ltrPar>td> code>ltrPar;/code> td> U+02996 td> span classglyph>⦖/span> tr identity-lurdshar>td> code>lurdshar;/code> td> U+0294A td> span classglyph>⥊/span> tr identity-luruhar>td> code>luruhar;/code> td> U+02966 td> span classglyph>⥦/span> tr identity-lvertneqq>td> code>lvertneqq;/code> td> U+02268 U+0FE00 td> span classglyph compound>≨︀/span> tr identity-lvnE>td> code>lvnE;/code> td> U+02268 U+0FE00 td> span classglyph compound>≨︀/span> tr identity-macr>td> code>macr;/code> td> U+000AF td> span classglyph>¯/span> tr identity-macr-legacy classimpl>td> code>macr/code> td> U+000AF td> span>¯/span> tr identity-male>td> code>male;/code> td> U+02642 td> span classglyph>♂/span> tr identity-malt>td> code>malt;/code> td> U+02720 td> span classglyph>✠/span> tr identity-maltese>td> code>maltese;/code> td> U+02720 td> span classglyph>✠/span> tr identity-Map>td> code>Map;/code> td> U+02905 td> span classglyph>⤅/span> tr identity-map>td> code>map;/code> td> U+021A6 td> span classglyph>↦/span> tr identity-mapsto>td> code>mapsto;/code> td> U+021A6 td> span classglyph>↦/span> tr identity-mapstodown>td> code>mapstodown;/code> td> U+021A7 td> span classglyph>↧/span> tr identity-mapstoleft>td> code>mapstoleft;/code> td> U+021A4 td> span classglyph>↤/span> tr identity-mapstoup>td> code>mapstoup;/code> td> U+021A5 td> span classglyph>↥/span> tr identity-marker>td> code>marker;/code> td> U+025AE td> span classglyph>▮/span> tr identity-mcomma>td> code>mcomma;/code> td> U+02A29 td> span classglyph>⨩/span> tr identity-Mcy>td> code>Mcy;/code> td> U+0041C td> span classglyph>М/span> tr identity-mcy>td> code>mcy;/code> td> U+0043C td> span classglyph>м/span> tr identity-mdash>td> code>mdash;/code> td> U+02014 td> span classglyph>—/span> tr identity-mDDot>td> code>mDDot;/code> td> U+0223A td> span classglyph>∺/span> tr identity-measuredangle>td> code>measuredangle;/code> td> U+02221 td> span classglyph>∡/span> tr identity-MediumSpace>td> code>MediumSpace;/code> td> U+0205F td> span classglyph> /span> tr identity-Mellintrf>td> code>Mellintrf;/code> td> U+02133 td> span classglyph>ℳ/span> tr identity-Mfr>td> code>Mfr;/code> td> U+1D510 td> span classglyph>𝔐/span> tr identity-mfr>td> code>mfr;/code> td> U+1D52A td> span classglyph>𝔪/span> tr identity-mho>td> code>mho;/code> td> U+02127 td> span classglyph>℧/span> tr identity-micro>td> code>micro;/code> td> U+000B5 td> span classglyph>µ/span> tr identity-micro-legacy classimpl>td> code>micro/code> td> U+000B5 td> span>µ/span> tr identity-mid>td> code>mid;/code> td> U+02223 td> span classglyph>∣/span> tr identity-midast>td> code>midast;/code> td> U+0002A td> span classglyph>*/span> tr identity-midcir>td> code>midcir;/code> td> U+02AF0 td> span classglyph>⫰/span> tr identity-middot>td> code>middot;/code> td> U+000B7 td> span classglyph>·/span> tr identity-middot-legacy classimpl>td> code>middot/code> td> U+000B7 td> span>·/span> tr identity-minus>td> code>minus;/code> td> U+02212 td> span classglyph>−/span> tr identity-minusb>td> code>minusb;/code> td> U+0229F td> span classglyph>⊟/span> tr identity-minusd>td> code>minusd;/code> td> U+02238 td> span classglyph>∸/span> tr identity-minusdu>td> code>minusdu;/code> td> U+02A2A td> span classglyph>⨪/span> tr identity-MinusPlus>td> code>MinusPlus;/code> td> U+02213 td> span classglyph>∓/span> tr identity-mlcp>td> code>mlcp;/code> td> U+02ADB td> span classglyph>⫛/span> tr identity-mldr>td> code>mldr;/code> td> U+02026 td> span classglyph>…/span> tr identity-mnplus>td> code>mnplus;/code> td> U+02213 td> span classglyph>∓/span> tr identity-models>td> code>models;/code> td> U+022A7 td> span classglyph>⊧/span> tr identity-Mopf>td> code>Mopf;/code> td> U+1D544 td> span classglyph>𝕄/span> tr identity-mopf>td> code>mopf;/code> td> U+1D55E td> span classglyph>𝕞/span> tr identity-mp>td> code>mp;/code> td> U+02213 td> span classglyph>∓/span> tr identity-Mscr>td> code>Mscr;/code> td> U+02133 td> span classglyph>ℳ/span> tr identity-mscr>td> code>mscr;/code> td> U+1D4C2 td> span classglyph>𝓂/span> tr identity-mstpos>td> code>mstpos;/code> td> U+0223E td> span classglyph>∾/span> tr identity-Mu>td> code>Mu;/code> td> U+0039C td> span classglyph>Μ/span> tr identity-mu>td> code>mu;/code> td> U+003BC td> span classglyph>μ/span> tr identity-multimap>td> code>multimap;/code> td> U+022B8 td> span classglyph>⊸/span> tr identity-mumap>td> code>mumap;/code> td> U+022B8 td> span classglyph>⊸/span> tr identity-nabla>td> code>nabla;/code> td> U+02207 td> span classglyph>∇/span> tr identity-Nacute>td> code>Nacute;/code> td> U+00143 td> span classglyph>Ń/span> tr identity-nacute>td> code>nacute;/code> td> U+00144 td> span classglyph>ń/span> tr identity-nang>td> code>nang;/code> td> U+02220 U+020D2 td> span classglyph compound>∠⃒/span> tr identity-nap>td> code>nap;/code> td> U+02249 td> span classglyph>≉/span> tr identity-napE>td> code>napE;/code> td> U+02A70 U+00338 td> span classglyph compound>⩰̸/span> tr identity-napid>td> code>napid;/code> td> U+0224B U+00338 td> span classglyph compound>≋̸/span> tr identity-napos>td> code>napos;/code> td> U+00149 td> span classglyph>ʼn/span> tr identity-napprox>td> code>napprox;/code> td> U+02249 td> span classglyph>≉/span> tr identity-natur>td> code>natur;/code> td> U+0266E td> span classglyph>♮/span> tr identity-natural>td> code>natural;/code> td> U+0266E td> span classglyph>♮/span> tr identity-naturals>td> code>naturals;/code> td> U+02115 td> span classglyph>ℕ/span> tr identity-nbsp>td> code>nbsp;/code> td> U+000A0 td> span classglyph> /span> tr identity-nbsp-legacy classimpl>td> code>nbsp/code> td> U+000A0 td> span> /span> tr identity-nbump>td> code>nbump;/code> td> U+0224E U+00338 td> span classglyph compound>≎̸/span> tr identity-nbumpe>td> code>nbumpe;/code> td> U+0224F U+00338 td> span classglyph compound>≏̸/span> tr identity-ncap>td> code>ncap;/code> td> U+02A43 td> span classglyph>⩃/span> tr identity-Ncaron>td> code>Ncaron;/code> td> U+00147 td> span classglyph>Ň/span> tr identity-ncaron>td> code>ncaron;/code> td> U+00148 td> span classglyph>ň/span> tr identity-Ncedil>td> code>Ncedil;/code> td> U+00145 td> span classglyph>Ņ/span> tr identity-ncedil>td> code>ncedil;/code> td> U+00146 td> span classglyph>ņ/span> tr identity-ncong>td> code>ncong;/code> td> U+02247 td> span classglyph>≇/span> tr identity-ncongdot>td> code>ncongdot;/code> td> U+02A6D U+00338 td> span classglyph compound>⩭̸/span> tr identity-ncup>td> code>ncup;/code> td> U+02A42 td> span classglyph>⩂/span> tr identity-Ncy>td> code>Ncy;/code> td> U+0041D td> span classglyph>Н/span> tr identity-ncy>td> code>ncy;/code> td> U+0043D td> span classglyph>н/span> tr identity-ndash>td> code>ndash;/code> td> U+02013 td> span classglyph>–/span> tr identity-ne>td> code>ne;/code> td> U+02260 td> span classglyph>≠/span> tr identity-nearhk>td> code>nearhk;/code> td> U+02924 td> span classglyph>⤤/span> tr identity-neArr>td> code>neArr;/code> td> U+021D7 td> span classglyph>⇗/span> tr identity-nearr>td> code>nearr;/code> td> U+02197 td> span classglyph>↗/span> tr identity-nearrow>td> code>nearrow;/code> td> U+02197 td> span classglyph>↗/span> tr identity-nedot>td> code>nedot;/code> td> U+02250 U+00338 td> span classglyph compound>≐̸/span> tr identity-NegativeMediumSpace>td> code>NegativeMediumSpace;/code> td> U+0200B td> span classglyph>/span> tr identity-NegativeThickSpace>td> code>NegativeThickSpace;/code> td> U+0200B td> span classglyph>/span> tr identity-NegativeThinSpace>td> code>NegativeThinSpace;/code> td> U+0200B td> span classglyph>/span> tr identity-NegativeVeryThinSpace>td> code>NegativeVeryThinSpace;/code> td> U+0200B td> span classglyph>/span> tr identity-nequiv>td> code>nequiv;/code> td> U+02262 td> span classglyph>≢/span> tr identity-nesear>td> code>nesear;/code> td> U+02928 td> span classglyph>⤨/span> tr identity-nesim>td> code>nesim;/code> td> U+02242 U+00338 td> span classglyph compound>≂̸/span> tr identity-NestedGreaterGreater>td> code>NestedGreaterGreater;/code> td> U+0226B td> span classglyph>≫/span> tr identity-NestedLessLess>td> code>NestedLessLess;/code> td> U+0226A td> span classglyph>≪/span> tr identity-NewLine>td> code>NewLine;/code> td> U+0000A td> span classglyph control>␊/span> tr identity-nexist>td> code>nexist;/code> td> U+02204 td> span classglyph>∄/span> tr identity-nexists>td> code>nexists;/code> td> U+02204 td> span classglyph>∄/span> tr identity-Nfr>td> code>Nfr;/code> td> U+1D511 td> span classglyph>𝔑/span> tr identity-nfr>td> code>nfr;/code> td> U+1D52B td> span classglyph>𝔫/span> tr identity-ngE>td> code>ngE;/code> td> U+02267 U+00338 td> span classglyph compound>≧̸/span> tr identity-nge>td> code>nge;/code> td> U+02271 td> span classglyph>≱/span> tr identity-ngeq>td> code>ngeq;/code> td> U+02271 td> span classglyph>≱/span> tr identity-ngeqq>td> code>ngeqq;/code> td> U+02267 U+00338 td> span classglyph compound>≧̸/span> tr identity-ngeqslant>td> code>ngeqslant;/code> td> U+02A7E U+00338 td> span classglyph compound>⩾̸/span> tr identity-nges>td> code>nges;/code> td> U+02A7E U+00338 td> span classglyph compound>⩾̸/span> tr identity-nGg>td> code>nGg;/code> td> U+022D9 U+00338 td> span classglyph compound>⋙̸/span> tr identity-ngsim>td> code>ngsim;/code> td> U+02275 td> span classglyph>≵/span> tr identity-nGt>td> code>nGt;/code> td> U+0226B U+020D2 td> span classglyph compound>≫⃒/span> tr identity-ngt>td> code>ngt;/code> td> U+0226F td> span classglyph>≯/span> tr identity-ngtr>td> code>ngtr;/code> td> U+0226F td> span classglyph>≯/span> tr identity-nGtv>td> code>nGtv;/code> td> U+0226B U+00338 td> span classglyph compound>≫̸/span> tr identity-nhArr>td> code>nhArr;/code> td> U+021CE td> span classglyph>⇎/span> tr identity-nharr>td> code>nharr;/code> td> U+021AE td> span classglyph>↮/span> tr identity-nhpar>td> code>nhpar;/code> td> U+02AF2 td> span classglyph>⫲/span> tr identity-ni>td> code>ni;/code> td> U+0220B td> span classglyph>∋/span> tr identity-nis>td> code>nis;/code> td> U+022FC td> span classglyph>⋼/span> tr identity-nisd>td> code>nisd;/code> td> U+022FA td> span classglyph>⋺/span> tr identity-niv>td> code>niv;/code> td> U+0220B td> span classglyph>∋/span> tr identity-NJcy>td> code>NJcy;/code> td> U+0040A td> span classglyph>Њ/span> tr identity-njcy>td> code>njcy;/code> td> U+0045A td> span classglyph>њ/span> tr identity-nlArr>td> code>nlArr;/code> td> U+021CD td> span classglyph>⇍/span> tr identity-nlarr>td> code>nlarr;/code> td> U+0219A td> span classglyph>↚/span> tr identity-nldr>td> code>nldr;/code> td> U+02025 td> span classglyph>‥/span> tr identity-nlE>td> code>nlE;/code> td> U+02266 U+00338 td> span classglyph compound>≦̸/span> tr identity-nle>td> code>nle;/code> td> U+02270 td> span classglyph>≰/span> tr identity-nLeftarrow>td> code>nLeftarrow;/code> td> U+021CD td> span classglyph>⇍/span> tr identity-nleftarrow>td> code>nleftarrow;/code> td> U+0219A td> span classglyph>↚/span> tr identity-nLeftrightarrow>td> code>nLeftrightarrow;/code> td> U+021CE td> span classglyph>⇎/span> tr identity-nleftrightarrow>td> code>nleftrightarrow;/code> td> U+021AE td> span classglyph>↮/span> tr identity-nleq>td> code>nleq;/code> td> U+02270 td> span classglyph>≰/span> tr identity-nleqq>td> code>nleqq;/code> td> U+02266 U+00338 td> span classglyph compound>≦̸/span> tr identity-nleqslant>td> code>nleqslant;/code> td> U+02A7D U+00338 td> span classglyph compound>⩽̸/span> tr identity-nles>td> code>nles;/code> td> U+02A7D U+00338 td> span classglyph compound>⩽̸/span> tr identity-nless>td> code>nless;/code> td> U+0226E td> span classglyph>≮/span> tr identity-nLl>td> code>nLl;/code> td> U+022D8 U+00338 td> span classglyph compound>⋘̸/span> tr identity-nlsim>td> code>nlsim;/code> td> U+02274 td> span classglyph>≴/span> tr identity-nLt>td> code>nLt;/code> td> U+0226A U+020D2 td> span classglyph compound>≪⃒/span> tr identity-nlt>td> code>nlt;/code> td> U+0226E td> span classglyph>≮/span> tr identity-nltri>td> code>nltri;/code> td> U+022EA td> span classglyph>⋪/span> tr identity-nltrie>td> code>nltrie;/code> td> U+022EC td> span classglyph>⋬/span> tr identity-nLtv>td> code>nLtv;/code> td> U+0226A U+00338 td> span classglyph compound>≪̸/span> tr identity-nmid>td> code>nmid;/code> td> U+02224 td> span classglyph>∤/span> tr identity-NoBreak>td> code>NoBreak;/code> td> U+02060 td> span classglyph>/span> tr identity-NonBreakingSpace>td> code>NonBreakingSpace;/code> td> U+000A0 td> span classglyph> /span> tr identity-Nopf>td> code>Nopf;/code> td> U+02115 td> span classglyph>ℕ/span> tr identity-nopf>td> code>nopf;/code> td> U+1D55F td> span classglyph>𝕟/span> tr identity-Not>td> code>Not;/code> td> U+02AEC td> span classglyph>⫬/span> tr identity-not>td> code>not;/code> td> U+000AC td> span classglyph>¬/span> tr identity-not-legacy classimpl>td> code>not/code> td> U+000AC td> span>¬/span> tr identity-NotCongruent>td> code>NotCongruent;/code> td> U+02262 td> span classglyph>≢/span> tr identity-NotCupCap>td> code>NotCupCap;/code> td> U+0226D td> span classglyph>≭/span> tr identity-NotDoubleVerticalBar>td> code>NotDoubleVerticalBar;/code> td> U+02226 td> span classglyph>∦/span> tr identity-NotElement>td> code>NotElement;/code> td> U+02209 td> span classglyph>∉/span> tr identity-NotEqual>td> code>NotEqual;/code> td> U+02260 td> span classglyph>≠/span> tr identity-NotEqualTilde>td> code>NotEqualTilde;/code> td> U+02242 U+00338 td> span classglyph compound>≂̸/span> tr identity-NotExists>td> code>NotExists;/code> td> U+02204 td> span classglyph>∄/span> tr identity-NotGreater>td> code>NotGreater;/code> td> U+0226F td> span classglyph>≯/span> tr identity-NotGreaterEqual>td> code>NotGreaterEqual;/code> td> U+02271 td> span classglyph>≱/span> tr identity-NotGreaterFullEqual>td> code>NotGreaterFullEqual;/code> td> U+02267 U+00338 td> span classglyph compound>≧̸/span> tr identity-NotGreaterGreater>td> code>NotGreaterGreater;/code> td> U+0226B U+00338 td> span classglyph compound>≫̸/span> tr identity-NotGreaterLess>td> code>NotGreaterLess;/code> td> U+02279 td> span classglyph>≹/span> tr identity-NotGreaterSlantEqual>td> code>NotGreaterSlantEqual;/code> td> U+02A7E U+00338 td> span classglyph compound>⩾̸/span> tr identity-NotGreaterTilde>td> code>NotGreaterTilde;/code> td> U+02275 td> span classglyph>≵/span> tr identity-NotHumpDownHump>td> code>NotHumpDownHump;/code> td> U+0224E U+00338 td> span classglyph compound>≎̸/span> tr identity-NotHumpEqual>td> code>NotHumpEqual;/code> td> U+0224F U+00338 td> span classglyph compound>≏̸/span> tr identity-notin>td> code>notin;/code> td> U+02209 td> span classglyph>∉/span> tr identity-notindot>td> code>notindot;/code> td> U+022F5 U+00338 td> span classglyph compound>⋵̸/span> tr identity-notinE>td> code>notinE;/code> td> U+022F9 U+00338 td> span classglyph compound>⋹̸/span> tr identity-notinva>td> code>notinva;/code> td> U+02209 td> span classglyph>∉/span> tr identity-notinvb>td> code>notinvb;/code> td> U+022F7 td> span classglyph>⋷/span> tr identity-notinvc>td> code>notinvc;/code> td> U+022F6 td> span classglyph>⋶/span> tr identity-NotLeftTriangle>td> code>NotLeftTriangle;/code> td> U+022EA td> span classglyph>⋪/span> tr identity-NotLeftTriangleBar>td> code>NotLeftTriangleBar;/code> td> U+029CF U+00338 td> span classglyph compound>⧏̸/span> tr identity-NotLeftTriangleEqual>td> code>NotLeftTriangleEqual;/code> td> U+022EC td> span classglyph>⋬/span> tr identity-NotLess>td> code>NotLess;/code> td> U+0226E td> span classglyph>≮/span> tr identity-NotLessEqual>td> code>NotLessEqual;/code> td> U+02270 td> span classglyph>≰/span> tr identity-NotLessGreater>td> code>NotLessGreater;/code> td> U+02278 td> span classglyph>≸/span> tr identity-NotLessLess>td> code>NotLessLess;/code> td> U+0226A U+00338 td> span classglyph compound>≪̸/span> tr identity-NotLessSlantEqual>td> code>NotLessSlantEqual;/code> td> U+02A7D U+00338 td> span classglyph compound>⩽̸/span> tr identity-NotLessTilde>td> code>NotLessTilde;/code> td> U+02274 td> span classglyph>≴/span> tr identity-NotNestedGreaterGreater>td> code>NotNestedGreaterGreater;/code> td> U+02AA2 U+00338 td> span classglyph compound>⪢̸/span> tr identity-NotNestedLessLess>td> code>NotNestedLessLess;/code> td> U+02AA1 U+00338 td> span classglyph compound>⪡̸/span> tr identity-notni>td> code>notni;/code> td> U+0220C td> span classglyph>∌/span> tr identity-notniva>td> code>notniva;/code> td> U+0220C td> span classglyph>∌/span> tr identity-notnivb>td> code>notnivb;/code> td> U+022FE td> span classglyph>⋾/span> tr identity-notnivc>td> code>notnivc;/code> td> U+022FD td> span classglyph>⋽/span> tr identity-NotPrecedes>td> code>NotPrecedes;/code> td> U+02280 td> span classglyph>⊀/span> tr identity-NotPrecedesEqual>td> code>NotPrecedesEqual;/code> td> U+02AAF U+00338 td> span classglyph compound>⪯̸/span> tr identity-NotPrecedesSlantEqual>td> code>NotPrecedesSlantEqual;/code> td> U+022E0 td> span classglyph>⋠/span> tr identity-NotReverseElement>td> code>NotReverseElement;/code> td> U+0220C td> span classglyph>∌/span> tr identity-NotRightTriangle>td> code>NotRightTriangle;/code> td> U+022EB td> span classglyph>⋫/span> tr identity-NotRightTriangleBar>td> code>NotRightTriangleBar;/code> td> U+029D0 U+00338 td> span classglyph compound>⧐̸/span> tr identity-NotRightTriangleEqual>td> code>NotRightTriangleEqual;/code> td> U+022ED td> span classglyph>⋭/span> tr identity-NotSquareSubset>td> code>NotSquareSubset;/code> td> U+0228F U+00338 td> span classglyph compound>⊏̸/span> tr identity-NotSquareSubsetEqual>td> code>NotSquareSubsetEqual;/code> td> U+022E2 td> span classglyph>⋢/span> tr identity-NotSquareSuperset>td> code>NotSquareSuperset;/code> td> U+02290 U+00338 td> span classglyph compound>⊐̸/span> tr identity-NotSquareSupersetEqual>td> code>NotSquareSupersetEqual;/code> td> U+022E3 td> span classglyph>⋣/span> tr identity-NotSubset>td> code>NotSubset;/code> td> U+02282 U+020D2 td> span classglyph compound>⊂⃒/span> tr identity-NotSubsetEqual>td> code>NotSubsetEqual;/code> td> U+02288 td> span classglyph>⊈/span> tr identity-NotSucceeds>td> code>NotSucceeds;/code> td> U+02281 td> span classglyph>⊁/span> tr identity-NotSucceedsEqual>td> code>NotSucceedsEqual;/code> td> U+02AB0 U+00338 td> span classglyph compound>⪰̸/span> tr identity-NotSucceedsSlantEqual>td> code>NotSucceedsSlantEqual;/code> td> U+022E1 td> span classglyph>⋡/span> tr identity-NotSucceedsTilde>td> code>NotSucceedsTilde;/code> td> U+0227F U+00338 td> span classglyph compound>≿̸/span> tr identity-NotSuperset>td> code>NotSuperset;/code> td> U+02283 U+020D2 td> span classglyph compound>⊃⃒/span> tr identity-NotSupersetEqual>td> code>NotSupersetEqual;/code> td> U+02289 td> span classglyph>⊉/span> tr identity-NotTilde>td> code>NotTilde;/code> td> U+02241 td> span classglyph>≁/span> tr identity-NotTildeEqual>td> code>NotTildeEqual;/code> td> U+02244 td> span classglyph>≄/span> tr identity-NotTildeFullEqual>td> code>NotTildeFullEqual;/code> td> U+02247 td> span classglyph>≇/span> tr identity-NotTildeTilde>td> code>NotTildeTilde;/code> td> U+02249 td> span classglyph>≉/span> tr identity-NotVerticalBar>td> code>NotVerticalBar;/code> td> U+02224 td> span classglyph>∤/span> tr identity-npar>td> code>npar;/code> td> U+02226 td> span classglyph>∦/span> tr identity-nparallel>td> code>nparallel;/code> td> U+02226 td> span classglyph>∦/span> tr identity-nparsl>td> code>nparsl;/code> td> U+02AFD U+020E5 td> span classglyph compound>⫽⃥/span> tr identity-npart>td> code>npart;/code> td> U+02202 U+00338 td> span classglyph compound>∂̸/span> tr identity-npolint>td> code>npolint;/code> td> U+02A14 td> span classglyph>⨔/span> tr identity-npr>td> code>npr;/code> td> U+02280 td> span classglyph>⊀/span> tr identity-nprcue>td> code>nprcue;/code> td> U+022E0 td> span classglyph>⋠/span> tr identity-npre>td> code>npre;/code> td> U+02AAF U+00338 td> span classglyph compound>⪯̸/span> tr identity-nprec>td> code>nprec;/code> td> U+02280 td> span classglyph>⊀/span> tr identity-npreceq>td> code>npreceq;/code> td> U+02AAF U+00338 td> span classglyph compound>⪯̸/span> tr identity-nrArr>td> code>nrArr;/code> td> U+021CF td> span classglyph>⇏/span> tr identity-nrarr>td> code>nrarr;/code> td> U+0219B td> span classglyph>↛/span> tr identity-nrarrc>td> code>nrarrc;/code> td> U+02933 U+00338 td> span classglyph compound>⤳̸/span> tr identity-nrarrw>td> code>nrarrw;/code> td> U+0219D U+00338 td> span classglyph compound>↝̸/span> tr identity-nRightarrow>td> code>nRightarrow;/code> td> U+021CF td> span classglyph>⇏/span> tr identity-nrightarrow>td> code>nrightarrow;/code> td> U+0219B td> span classglyph>↛/span> tr identity-nrtri>td> code>nrtri;/code> td> U+022EB td> span classglyph>⋫/span> tr identity-nrtrie>td> code>nrtrie;/code> td> U+022ED td> span classglyph>⋭/span> tr identity-nsc>td> code>nsc;/code> td> U+02281 td> span classglyph>⊁/span> tr identity-nsccue>td> code>nsccue;/code> td> U+022E1 td> span classglyph>⋡/span> tr identity-nsce>td> code>nsce;/code> td> U+02AB0 U+00338 td> span classglyph compound>⪰̸/span> tr identity-Nscr>td> code>Nscr;/code> td> U+1D4A9 td> span classglyph>𝒩/span> tr identity-nscr>td> code>nscr;/code> td> U+1D4C3 td> span classglyph>𝓃/span> tr identity-nshortmid>td> code>nshortmid;/code> td> U+02224 td> span classglyph>∤/span> tr identity-nshortparallel>td> code>nshortparallel;/code> td> U+02226 td> span classglyph>∦/span> tr identity-nsim>td> code>nsim;/code> td> U+02241 td> span classglyph>≁/span> tr identity-nsime>td> code>nsime;/code> td> U+02244 td> span classglyph>≄/span> tr identity-nsimeq>td> code>nsimeq;/code> td> U+02244 td> span classglyph>≄/span> tr identity-nsmid>td> code>nsmid;/code> td> U+02224 td> span classglyph>∤/span> tr identity-nspar>td> code>nspar;/code> td> U+02226 td> span classglyph>∦/span> tr identity-nsqsube>td> code>nsqsube;/code> td> U+022E2 td> span classglyph>⋢/span> tr identity-nsqsupe>td> code>nsqsupe;/code> td> U+022E3 td> span classglyph>⋣/span> tr identity-nsub>td> code>nsub;/code> td> U+02284 td> span classglyph>⊄/span> tr identity-nsubE>td> code>nsubE;/code> td> U+02AC5 U+00338 td> span classglyph compound>⫅̸/span> tr identity-nsube>td> code>nsube;/code> td> U+02288 td> span classglyph>⊈/span> tr identity-nsubset>td> code>nsubset;/code> td> U+02282 U+020D2 td> span classglyph compound>⊂⃒/span> tr identity-nsubseteq>td> code>nsubseteq;/code> td> U+02288 td> span classglyph>⊈/span> tr identity-nsubseteqq>td> code>nsubseteqq;/code> td> U+02AC5 U+00338 td> span classglyph compound>⫅̸/span> tr identity-nsucc>td> code>nsucc;/code> td> U+02281 td> span classglyph>⊁/span> tr identity-nsucceq>td> code>nsucceq;/code> td> U+02AB0 U+00338 td> span classglyph compound>⪰̸/span> tr identity-nsup>td> code>nsup;/code> td> U+02285 td> span classglyph>⊅/span> tr identity-nsupE>td> code>nsupE;/code> td> U+02AC6 U+00338 td> span classglyph compound>⫆̸/span> tr identity-nsupe>td> code>nsupe;/code> td> U+02289 td> span classglyph>⊉/span> tr identity-nsupset>td> code>nsupset;/code> td> U+02283 U+020D2 td> span classglyph compound>⊃⃒/span> tr identity-nsupseteq>td> code>nsupseteq;/code> td> U+02289 td> span classglyph>⊉/span> tr identity-nsupseteqq>td> code>nsupseteqq;/code> td> U+02AC6 U+00338 td> span classglyph compound>⫆̸/span> tr identity-ntgl>td> code>ntgl;/code> td> U+02279 td> span classglyph>≹/span> tr identity-Ntilde>td> code>Ntilde;/code> td> U+000D1 td> span classglyph>Ñ/span> tr identity-Ntilde-legacy classimpl>td> code>Ntilde/code> td> U+000D1 td> span>Ñ/span> tr identity-ntilde>td> code>ntilde;/code> td> U+000F1 td> span classglyph>ñ/span> tr identity-ntilde-legacy classimpl>td> code>ntilde/code> td> U+000F1 td> span>ñ/span> tr identity-ntlg>td> code>ntlg;/code> td> U+02278 td> span classglyph>≸/span> tr identity-ntriangleleft>td> code>ntriangleleft;/code> td> U+022EA td> span classglyph>⋪/span> tr identity-ntrianglelefteq>td> code>ntrianglelefteq;/code> td> U+022EC td> span classglyph>⋬/span> tr identity-ntriangleright>td> code>ntriangleright;/code> td> U+022EB td> span classglyph>⋫/span> tr identity-ntrianglerighteq>td> code>ntrianglerighteq;/code> td> U+022ED td> span classglyph>⋭/span> tr identity-Nu>td> code>Nu;/code> td> U+0039D td> span classglyph>Ν/span> tr identity-nu>td> code>nu;/code> td> U+003BD td> span classglyph>ν/span> tr identity-num>td> code>num;/code> td> U+00023 td> span classglyph>#/span> tr identity-numero>td> code>numero;/code> td> U+02116 td> span classglyph>№/span> tr identity-numsp>td> code>numsp;/code> td> U+02007 td> span classglyph> /span> tr identity-nvap>td> code>nvap;/code> td> U+0224D U+020D2 td> span classglyph compound>≍⃒/span> tr identity-nVDash>td> code>nVDash;/code> td> U+022AF td> span classglyph>⊯/span> tr identity-nVdash>td> code>nVdash;/code> td> U+022AE td> span classglyph>⊮/span> tr identity-nvDash>td> code>nvDash;/code> td> U+022AD td> span classglyph>⊭/span> tr identity-nvdash>td> code>nvdash;/code> td> U+022AC td> span classglyph>⊬/span> tr identity-nvge>td> code>nvge;/code> td> U+02265 U+020D2 td> span classglyph compound>≥⃒/span> tr identity-nvgt>td> code>nvgt;/code> td> U+0003E U+020D2 td> span classglyph compound>>⃒/span> tr identity-nvHarr>td> code>nvHarr;/code> td> U+02904 td> span classglyph>⤄/span> tr identity-nvinfin>td> code>nvinfin;/code> td> U+029DE td> span classglyph>⧞/span> tr identity-nvlArr>td> code>nvlArr;/code> td> U+02902 td> span classglyph>⤂/span> tr identity-nvle>td> code>nvle;/code> td> U+02264 U+020D2 td> span classglyph compound>≤⃒/span> tr identity-nvlt>td> code>nvlt;/code> td> U+0003C U+020D2 td> span classglyph compound><⃒/span> tr identity-nvltrie>td> code>nvltrie;/code> td> U+022B4 U+020D2 td> span classglyph compound>⊴⃒/span> tr identity-nvrArr>td> code>nvrArr;/code> td> U+02903 td> span classglyph>⤃/span> tr identity-nvrtrie>td> code>nvrtrie;/code> td> U+022B5 U+020D2 td> span classglyph compound>⊵⃒/span> tr identity-nvsim>td> code>nvsim;/code> td> U+0223C U+020D2 td> span classglyph compound>∼⃒/span> tr identity-nwarhk>td> code>nwarhk;/code> td> U+02923 td> span classglyph>⤣/span> tr identity-nwArr>td> code>nwArr;/code> td> U+021D6 td> span classglyph>⇖/span> tr identity-nwarr>td> code>nwarr;/code> td> U+02196 td> span classglyph>↖/span> tr identity-nwarrow>td> code>nwarrow;/code> td> U+02196 td> span classglyph>↖/span> tr identity-nwnear>td> code>nwnear;/code> td> U+02927 td> span classglyph>⤧/span> tr identity-Oacute>td> code>Oacute;/code> td> U+000D3 td> span classglyph>Ó/span> tr identity-Oacute-legacy classimpl>td> code>Oacute/code> td> U+000D3 td> span>Ó/span> tr identity-oacute>td> code>oacute;/code> td> U+000F3 td> span classglyph>ó/span> tr identity-oacute-legacy classimpl>td> code>oacute/code> td> U+000F3 td> span>ó/span> tr identity-oast>td> code>oast;/code> td> U+0229B td> span classglyph>⊛/span> tr identity-ocir>td> code>ocir;/code> td> U+0229A td> span classglyph>⊚/span> tr identity-Ocirc>td> code>Ocirc;/code> td> U+000D4 td> span classglyph>Ô/span> tr identity-Ocirc-legacy classimpl>td> code>Ocirc/code> td> U+000D4 td> span>Ô/span> tr identity-ocirc>td> code>ocirc;/code> td> U+000F4 td> span classglyph>ô/span> tr identity-ocirc-legacy classimpl>td> code>ocirc/code> td> U+000F4 td> span>ô/span> tr identity-Ocy>td> code>Ocy;/code> td> U+0041E td> span classglyph>О/span> tr identity-ocy>td> code>ocy;/code> td> U+0043E td> span classglyph>о/span> tr identity-odash>td> code>odash;/code> td> U+0229D td> span classglyph>⊝/span> tr identity-Odblac>td> code>Odblac;/code> td> U+00150 td> span classglyph>Ő/span> tr identity-odblac>td> code>odblac;/code> td> U+00151 td> span classglyph>ő/span> tr identity-odiv>td> code>odiv;/code> td> U+02A38 td> span classglyph>⨸/span> tr identity-odot>td> code>odot;/code> td> U+02299 td> span classglyph>⊙/span> tr identity-odsold>td> code>odsold;/code> td> U+029BC td> span classglyph>⦼/span> tr identity-OElig>td> code>OElig;/code> td> U+00152 td> span classglyph>Œ/span> tr identity-oelig>td> code>oelig;/code> td> U+00153 td> span classglyph>œ/span> tr identity-ofcir>td> code>ofcir;/code> td> U+029BF td> span classglyph>⦿/span> tr identity-Ofr>td> code>Ofr;/code> td> U+1D512 td> span classglyph>𝔒/span> tr identity-ofr>td> code>ofr;/code> td> U+1D52C td> span classglyph>𝔬/span> tr identity-ogon>td> code>ogon;/code> td> U+002DB td> span classglyph>˛/span> tr identity-Ograve>td> code>Ograve;/code> td> U+000D2 td> span classglyph>Ò/span> tr identity-Ograve-legacy classimpl>td> code>Ograve/code> td> U+000D2 td> span>Ò/span> tr identity-ograve>td> code>ograve;/code> td> U+000F2 td> span classglyph>ò/span> tr identity-ograve-legacy classimpl>td> code>ograve/code> td> U+000F2 td> span>ò/span> tr identity-ogt>td> code>ogt;/code> td> U+029C1 td> span classglyph>⧁/span> tr identity-ohbar>td> code>ohbar;/code> td> U+029B5 td> span classglyph>⦵/span> tr identity-ohm>td> code>ohm;/code> td> U+003A9 td> span classglyph>Ω/span> tr identity-oint>td> code>oint;/code> td> U+0222E td> span classglyph>∮/span> tr identity-olarr>td> code>olarr;/code> td> U+021BA td> span classglyph>↺/span> tr identity-olcir>td> code>olcir;/code> td> U+029BE td> span classglyph>⦾/span> tr identity-olcross>td> code>olcross;/code> td> U+029BB td> span classglyph>⦻/span> tr identity-oline>td> code>oline;/code> td> U+0203E td> span classglyph>‾/span> tr identity-olt>td> code>olt;/code> td> U+029C0 td> span classglyph>⧀/span> tr identity-Omacr>td> code>Omacr;/code> td> U+0014C td> span classglyph>Ō/span> tr identity-omacr>td> code>omacr;/code> td> U+0014D td> span classglyph>ō/span> tr identity-Omega>td> code>Omega;/code> td> U+003A9 td> span classglyph>Ω/span> tr identity-omega>td> code>omega;/code> td> U+003C9 td> span classglyph>ω/span> tr identity-Omicron>td> code>Omicron;/code> td> U+0039F td> span classglyph>Ο/span> tr identity-omicron>td> code>omicron;/code> td> U+003BF td> span classglyph>ο/span> tr identity-omid>td> code>omid;/code> td> U+029B6 td> span classglyph>⦶/span> tr identity-ominus>td> code>ominus;/code> td> U+02296 td> span classglyph>⊖/span> tr identity-Oopf>td> code>Oopf;/code> td> U+1D546 td> span classglyph>𝕆/span> tr identity-oopf>td> code>oopf;/code> td> U+1D560 td> span classglyph>𝕠/span> tr identity-opar>td> code>opar;/code> td> U+029B7 td> span classglyph>⦷/span> tr identity-OpenCurlyDoubleQuote>td> code>OpenCurlyDoubleQuote;/code> td> U+0201C td> span classglyph>“/span> tr identity-OpenCurlyQuote>td> code>OpenCurlyQuote;/code> td> U+02018 td> span classglyph>‘/span> tr identity-operp>td> code>operp;/code> td> U+029B9 td> span classglyph>⦹/span> tr identity-oplus>td> code>oplus;/code> td> U+02295 td> span classglyph>⊕/span> tr identity-Or>td> code>Or;/code> td> U+02A54 td> span classglyph>⩔/span> tr identity-or>td> code>or;/code> td> U+02228 td> span classglyph>∨/span> tr identity-orarr>td> code>orarr;/code> td> U+021BB td> span classglyph>↻/span> tr identity-ord>td> code>ord;/code> td> U+02A5D td> span classglyph>⩝/span> tr identity-order>td> code>order;/code> td> U+02134 td> span classglyph>ℴ/span> tr identity-orderof>td> code>orderof;/code> td> U+02134 td> span classglyph>ℴ/span> tr identity-ordf>td> code>ordf;/code> td> U+000AA td> span classglyph>ª/span> tr identity-ordf-legacy classimpl>td> code>ordf/code> td> U+000AA td> span>ª/span> tr identity-ordm>td> code>ordm;/code> td> U+000BA td> span classglyph>º/span> tr identity-ordm-legacy classimpl>td> code>ordm/code> td> U+000BA td> span>º/span> tr identity-origof>td> code>origof;/code> td> U+022B6 td> span classglyph>⊶/span> tr identity-oror>td> code>oror;/code> td> U+02A56 td> span classglyph>⩖/span> tr identity-orslope>td> code>orslope;/code> td> U+02A57 td> span classglyph>⩗/span> tr identity-orv>td> code>orv;/code> td> U+02A5B td> span classglyph>⩛/span> tr identity-oS>td> code>oS;/code> td> U+024C8 td> span classglyph>Ⓢ/span> tr identity-Oscr>td> code>Oscr;/code> td> U+1D4AA td> span classglyph>𝒪/span> tr identity-oscr>td> code>oscr;/code> td> U+02134 td> span classglyph>ℴ/span> tr identity-Oslash>td> code>Oslash;/code> td> U+000D8 td> span classglyph>Ø/span> tr identity-Oslash-legacy classimpl>td> code>Oslash/code> td> U+000D8 td> span>Ø/span> tr identity-oslash>td> code>oslash;/code> td> U+000F8 td> span classglyph>ø/span> tr identity-oslash-legacy classimpl>td> code>oslash/code> td> U+000F8 td> span>ø/span> tr identity-osol>td> code>osol;/code> td> U+02298 td> span classglyph>⊘/span> tr identity-Otilde>td> code>Otilde;/code> td> U+000D5 td> span classglyph>Õ/span> tr identity-Otilde-legacy classimpl>td> code>Otilde/code> td> U+000D5 td> span>Õ/span> tr identity-otilde>td> code>otilde;/code> td> U+000F5 td> span classglyph>õ/span> tr identity-otilde-legacy classimpl>td> code>otilde/code> td> U+000F5 td> span>õ/span> tr identity-Otimes>td> code>Otimes;/code> td> U+02A37 td> span classglyph>⨷/span> tr identity-otimes>td> code>otimes;/code> td> U+02297 td> span classglyph>⊗/span> tr identity-otimesas>td> code>otimesas;/code> td> U+02A36 td> span classglyph>⨶/span> tr identity-Ouml>td> code>Ouml;/code> td> U+000D6 td> span classglyph>Ö/span> tr identity-Ouml-legacy classimpl>td> code>Ouml/code> td> U+000D6 td> span>Ö/span> tr identity-ouml>td> code>ouml;/code> td> U+000F6 td> span classglyph>ö/span> tr identity-ouml-legacy classimpl>td> code>ouml/code> td> U+000F6 td> span>ö/span> tr identity-ovbar>td> code>ovbar;/code> td> U+0233D td> span classglyph>⌽/span> tr identity-OverBar>td> code>OverBar;/code> td> U+0203E td> span classglyph>‾/span> tr identity-OverBrace>td> code>OverBrace;/code> td> U+023DE td> span classglyph>⏞/span> tr identity-OverBracket>td> code>OverBracket;/code> td> U+023B4 td> span classglyph>⎴/span> tr identity-OverParenthesis>td> code>OverParenthesis;/code> td> U+023DC td> span classglyph>⏜/span> tr identity-par>td> code>par;/code> td> U+02225 td> span classglyph>∥/span> tr identity-para>td> code>para;/code> td> U+000B6 td> span classglyph>¶/span> tr identity-para-legacy classimpl>td> code>para/code> td> U+000B6 td> span>¶/span> tr identity-parallel>td> code>parallel;/code> td> U+02225 td> span classglyph>∥/span> tr identity-parsim>td> code>parsim;/code> td> U+02AF3 td> span classglyph>⫳/span> tr identity-parsl>td> code>parsl;/code> td> U+02AFD td> span classglyph>⫽/span> tr identity-part>td> code>part;/code> td> U+02202 td> span classglyph>∂/span> tr identity-PartialD>td> code>PartialD;/code> td> U+02202 td> span classglyph>∂/span> tr identity-Pcy>td> code>Pcy;/code> td> U+0041F td> span classglyph>П/span> tr identity-pcy>td> code>pcy;/code> td> U+0043F td> span classglyph>п/span> tr identity-percnt>td> code>percnt;/code> td> U+00025 td> span classglyph>%/span> tr identity-period>td> code>period;/code> td> U+0002E td> span classglyph>./span> tr identity-permil>td> code>permil;/code> td> U+02030 td> span classglyph>‰/span> tr identity-perp>td> code>perp;/code> td> U+022A5 td> span classglyph>⊥/span> tr identity-pertenk>td> code>pertenk;/code> td> U+02031 td> span classglyph>‱/span> tr identity-Pfr>td> code>Pfr;/code> td> U+1D513 td> span classglyph>𝔓/span> tr identity-pfr>td> code>pfr;/code> td> U+1D52D td> span classglyph>𝔭/span> tr identity-Phi>td> code>Phi;/code> td> U+003A6 td> span classglyph>Φ/span> tr identity-phi>td> code>phi;/code> td> U+003C6 td> span classglyph>φ/span> tr identity-phiv>td> code>phiv;/code> td> U+003D5 td> span classglyph>ϕ/span> tr identity-phmmat>td> code>phmmat;/code> td> U+02133 td> span classglyph>ℳ/span> tr identity-phone>td> code>phone;/code> td> U+0260E td> span classglyph>☎/span> tr identity-Pi>td> code>Pi;/code> td> U+003A0 td> span classglyph>Π/span> tr identity-pi>td> code>pi;/code> td> U+003C0 td> span classglyph>π/span> tr identity-pitchfork>td> code>pitchfork;/code> td> U+022D4 td> span classglyph>⋔/span> tr identity-piv>td> code>piv;/code> td> U+003D6 td> span classglyph>ϖ/span> tr identity-planck>td> code>planck;/code> td> U+0210F td> span classglyph>ℏ/span> tr identity-planckh>td> code>planckh;/code> td> U+0210E td> span classglyph>ℎ/span> tr identity-plankv>td> code>plankv;/code> td> U+0210F td> span classglyph>ℏ/span> tr identity-plus>td> code>plus;/code> td> U+0002B td> span classglyph>+/span> tr identity-plusacir>td> code>plusacir;/code> td> U+02A23 td> span classglyph>⨣/span> tr identity-plusb>td> code>plusb;/code> td> U+0229E td> span classglyph>⊞/span> tr identity-pluscir>td> code>pluscir;/code> td> U+02A22 td> span classglyph>⨢/span> tr identity-plusdo>td> code>plusdo;/code> td> U+02214 td> span classglyph>∔/span> tr identity-plusdu>td> code>plusdu;/code> td> U+02A25 td> span classglyph>⨥/span> tr identity-pluse>td> code>pluse;/code> td> U+02A72 td> span classglyph>⩲/span> tr identity-PlusMinus>td> code>PlusMinus;/code> td> U+000B1 td> span classglyph>±/span> tr identity-plusmn>td> code>plusmn;/code> td> U+000B1 td> span classglyph>±/span> tr identity-plusmn-legacy classimpl>td> code>plusmn/code> td> U+000B1 td> span>±/span> tr identity-plussim>td> code>plussim;/code> td> U+02A26 td> span classglyph>⨦/span> tr identity-plustwo>td> code>plustwo;/code> td> U+02A27 td> span classglyph>⨧/span> tr identity-pm>td> code>pm;/code> td> U+000B1 td> span classglyph>±/span> tr identity-Poincareplane>td> code>Poincareplane;/code> td> U+0210C td> span classglyph>ℌ/span> tr identity-pointint>td> code>pointint;/code> td> U+02A15 td> span classglyph>⨕/span> tr identity-Popf>td> code>Popf;/code> td> U+02119 td> span classglyph>ℙ/span> tr identity-popf>td> code>popf;/code> td> U+1D561 td> span classglyph>𝕡/span> tr identity-pound>td> code>pound;/code> td> U+000A3 td> span classglyph>£/span> tr identity-pound-legacy classimpl>td> code>pound/code> td> U+000A3 td> span>£/span> tr identity-Pr>td> code>Pr;/code> td> U+02ABB td> span classglyph>⪻/span> tr identity-pr>td> code>pr;/code> td> U+0227A td> span classglyph>≺/span> tr identity-prap>td> code>prap;/code> td> U+02AB7 td> span classglyph>⪷/span> tr identity-prcue>td> code>prcue;/code> td> U+0227C td> span classglyph>≼/span> tr identity-prE>td> code>prE;/code> td> U+02AB3 td> span classglyph>⪳/span> tr identity-pre>td> code>pre;/code> td> U+02AAF td> span classglyph>⪯/span> tr identity-prec>td> code>prec;/code> td> U+0227A td> span classglyph>≺/span> tr identity-precapprox>td> code>precapprox;/code> td> U+02AB7 td> span classglyph>⪷/span> tr identity-preccurlyeq>td> code>preccurlyeq;/code> td> U+0227C td> span classglyph>≼/span> tr identity-Precedes>td> code>Precedes;/code> td> U+0227A td> span classglyph>≺/span> tr identity-PrecedesEqual>td> code>PrecedesEqual;/code> td> U+02AAF td> span classglyph>⪯/span> tr identity-PrecedesSlantEqual>td> code>PrecedesSlantEqual;/code> td> U+0227C td> span classglyph>≼/span> tr identity-PrecedesTilde>td> code>PrecedesTilde;/code> td> U+0227E td> span classglyph>≾/span> tr identity-preceq>td> code>preceq;/code> td> U+02AAF td> span classglyph>⪯/span> tr identity-precnapprox>td> code>precnapprox;/code> td> U+02AB9 td> span classglyph>⪹/span> tr identity-precneqq>td> code>precneqq;/code> td> U+02AB5 td> span classglyph>⪵/span> tr identity-precnsim>td> code>precnsim;/code> td> U+022E8 td> span classglyph>⋨/span> tr identity-precsim>td> code>precsim;/code> td> U+0227E td> span classglyph>≾/span> tr identity-Prime>td> code>Prime;/code> td> U+02033 td> span classglyph>″/span> tr identity-prime>td> code>prime;/code> td> U+02032 td> span classglyph>′/span> tr identity-primes>td> code>primes;/code> td> U+02119 td> span classglyph>ℙ/span> tr identity-prnap>td> code>prnap;/code> td> U+02AB9 td> span classglyph>⪹/span> tr identity-prnE>td> code>prnE;/code> td> U+02AB5 td> span classglyph>⪵/span> tr identity-prnsim>td> code>prnsim;/code> td> U+022E8 td> span classglyph>⋨/span> tr identity-prod>td> code>prod;/code> td> U+0220F td> span classglyph>∏/span> tr identity-Product>td> code>Product;/code> td> U+0220F td> span classglyph>∏/span> tr identity-profalar>td> code>profalar;/code> td> U+0232E td> span classglyph>⌮/span> tr identity-profline>td> code>profline;/code> td> U+02312 td> span classglyph>⌒/span> tr identity-profsurf>td> code>profsurf;/code> td> U+02313 td> span classglyph>⌓/span> tr identity-prop>td> code>prop;/code> td> U+0221D td> span classglyph>∝/span> tr identity-Proportion>td> code>Proportion;/code> td> U+02237 td> span classglyph>∷/span> tr identity-Proportional>td> code>Proportional;/code> td> U+0221D td> span classglyph>∝/span> tr identity-propto>td> code>propto;/code> td> U+0221D td> span classglyph>∝/span> tr identity-prsim>td> code>prsim;/code> td> U+0227E td> span classglyph>≾/span> tr identity-prurel>td> code>prurel;/code> td> U+022B0 td> span classglyph>⊰/span> tr identity-Pscr>td> code>Pscr;/code> td> U+1D4AB td> span classglyph>𝒫/span> tr identity-pscr>td> code>pscr;/code> td> U+1D4C5 td> span classglyph>𝓅/span> tr identity-Psi>td> code>Psi;/code> td> U+003A8 td> span classglyph>Ψ/span> tr identity-psi>td> code>psi;/code> td> U+003C8 td> span classglyph>ψ/span> tr identity-puncsp>td> code>puncsp;/code> td> U+02008 td> span classglyph> /span> tr identity-Qfr>td> code>Qfr;/code> td> U+1D514 td> span classglyph>𝔔/span> tr identity-qfr>td> code>qfr;/code> td> U+1D52E td> span classglyph>𝔮/span> tr identity-qint>td> code>qint;/code> td> U+02A0C td> span classglyph>⨌/span> tr identity-Qopf>td> code>Qopf;/code> td> U+0211A td> span classglyph>ℚ/span> tr identity-qopf>td> code>qopf;/code> td> U+1D562 td> span classglyph>𝕢/span> tr identity-qprime>td> code>qprime;/code> td> U+02057 td> span classglyph>⁗/span> tr identity-Qscr>td> code>Qscr;/code> td> U+1D4AC td> span classglyph>𝒬/span> tr identity-qscr>td> code>qscr;/code> td> U+1D4C6 td> span classglyph>𝓆/span> tr identity-quaternions>td> code>quaternions;/code> td> U+0210D td> span classglyph>ℍ/span> tr identity-quatint>td> code>quatint;/code> td> U+02A16 td> span classglyph>⨖/span> tr identity-quest>td> code>quest;/code> td> U+0003F td> span classglyph>?/span> tr identity-questeq>td> code>questeq;/code> td> U+0225F td> span classglyph>≟/span> tr identity-QUOT>td> code>QUOT;/code> td> U+00022 td> span classglyph>/span> tr identity-QUOT-legacy classimpl>td> code>QUOT/code> td> U+00022 td> span>/span> tr identity-quot>td> code>quot;/code> td> U+00022 td> span classglyph>/span> tr identity-quot-legacy classimpl>td> code>quot/code> td> U+00022 td> span>/span> tr identity-rAarr>td> code>rAarr;/code> td> U+021DB td> span classglyph>⇛/span> tr identity-race>td> code>race;/code> td> U+0223D U+00331 td> span classglyph compound>∽̱/span> tr identity-Racute>td> code>Racute;/code> td> U+00154 td> span classglyph>Ŕ/span> tr identity-racute>td> code>racute;/code> td> U+00155 td> span classglyph>ŕ/span> tr identity-radic>td> code>radic;/code> td> U+0221A td> span classglyph>√/span> tr identity-raemptyv>td> code>raemptyv;/code> td> U+029B3 td> span classglyph>⦳/span> tr identity-Rang>td> code>Rang;/code> td> U+027EB td> span classglyph>⟫/span> tr identity-rang>td> code>rang;/code> td> U+027E9 td> span classglyph>⟩/span> tr identity-rangd>td> code>rangd;/code> td> U+02992 td> span classglyph>⦒/span> tr identity-range>td> code>range;/code> td> U+029A5 td> span classglyph>⦥/span> tr identity-rangle>td> code>rangle;/code> td> U+027E9 td> span classglyph>⟩/span> tr identity-raquo>td> code>raquo;/code> td> U+000BB td> span classglyph>»/span> tr identity-raquo-legacy classimpl>td> code>raquo/code> td> U+000BB td> span>»/span> tr identity-Rarr>td> code>Rarr;/code> td> U+021A0 td> span classglyph>↠/span> tr identity-rArr>td> code>rArr;/code> td> U+021D2 td> span classglyph>⇒/span> tr identity-rarr>td> code>rarr;/code> td> U+02192 td> span classglyph>→/span> tr identity-rarrap>td> code>rarrap;/code> td> U+02975 td> span classglyph>⥵/span> tr identity-rarrb>td> code>rarrb;/code> td> U+021E5 td> span classglyph>⇥/span> tr identity-rarrbfs>td> code>rarrbfs;/code> td> U+02920 td> span classglyph>⤠/span> tr identity-rarrc>td> code>rarrc;/code> td> U+02933 td> span classglyph>⤳/span> tr identity-rarrfs>td> code>rarrfs;/code> td> U+0291E td> span classglyph>⤞/span> tr identity-rarrhk>td> code>rarrhk;/code> td> U+021AA td> span classglyph>↪/span> tr identity-rarrlp>td> code>rarrlp;/code> td> U+021AC td> span classglyph>↬/span> tr identity-rarrpl>td> code>rarrpl;/code> td> U+02945 td> span classglyph>⥅/span> tr identity-rarrsim>td> code>rarrsim;/code> td> U+02974 td> span classglyph>⥴/span> tr identity-Rarrtl>td> code>Rarrtl;/code> td> U+02916 td> span classglyph>⤖/span> tr identity-rarrtl>td> code>rarrtl;/code> td> U+021A3 td> span classglyph>↣/span> tr identity-rarrw>td> code>rarrw;/code> td> U+0219D td> span classglyph>↝/span> tr identity-rAtail>td> code>rAtail;/code> td> U+0291C td> span classglyph>⤜/span> tr identity-ratail>td> code>ratail;/code> td> U+0291A td> span classglyph>⤚/span> tr identity-ratio>td> code>ratio;/code> td> U+02236 td> span classglyph>∶/span> tr identity-rationals>td> code>rationals;/code> td> U+0211A td> span classglyph>ℚ/span> tr identity-RBarr>td> code>RBarr;/code> td> U+02910 td> span classglyph>⤐/span> tr identity-rBarr>td> code>rBarr;/code> td> U+0290F td> span classglyph>⤏/span> tr identity-rbarr>td> code>rbarr;/code> td> U+0290D td> span classglyph>⤍/span> tr identity-rbbrk>td> code>rbbrk;/code> td> U+02773 td> span classglyph>❳/span> tr identity-rbrace>td> code>rbrace;/code> td> U+0007D td> span classglyph>}/span> tr identity-rbrack>td> code>rbrack;/code> td> U+0005D td> span classglyph>/span> tr identity-rbrke>td> code>rbrke;/code> td> U+0298C td> span classglyph>⦌/span> tr identity-rbrksld>td> code>rbrksld;/code> td> U+0298E td> span classglyph>⦎/span> tr identity-rbrkslu>td> code>rbrkslu;/code> td> U+02990 td> span classglyph>⦐/span> tr identity-Rcaron>td> code>Rcaron;/code> td> U+00158 td> span classglyph>Ř/span> tr identity-rcaron>td> code>rcaron;/code> td> U+00159 td> span classglyph>ř/span> tr identity-Rcedil>td> code>Rcedil;/code> td> U+00156 td> span classglyph>Ŗ/span> tr identity-rcedil>td> code>rcedil;/code> td> U+00157 td> span classglyph>ŗ/span> tr identity-rceil>td> code>rceil;/code> td> U+02309 td> span classglyph>⌉/span> tr identity-rcub>td> code>rcub;/code> td> U+0007D td> span classglyph>}/span> tr identity-Rcy>td> code>Rcy;/code> td> U+00420 td> span classglyph>Р/span> tr identity-rcy>td> code>rcy;/code> td> U+00440 td> span classglyph>р/span> tr identity-rdca>td> code>rdca;/code> td> U+02937 td> span classglyph>⤷/span> tr identity-rdldhar>td> code>rdldhar;/code> td> U+02969 td> span classglyph>⥩/span> tr identity-rdquo>td> code>rdquo;/code> td> U+0201D td> span classglyph>”/span> tr identity-rdquor>td> code>rdquor;/code> td> U+0201D td> span classglyph>”/span> tr identity-rdsh>td> code>rdsh;/code> td> U+021B3 td> span classglyph>↳/span> tr identity-Re>td> code>Re;/code> td> U+0211C td> span classglyph>ℜ/span> tr identity-real>td> code>real;/code> td> U+0211C td> span classglyph>ℜ/span> tr identity-realine>td> code>realine;/code> td> U+0211B td> span classglyph>ℛ/span> tr identity-realpart>td> code>realpart;/code> td> U+0211C td> span classglyph>ℜ/span> tr identity-reals>td> code>reals;/code> td> U+0211D td> span classglyph>ℝ/span> tr identity-rect>td> code>rect;/code> td> U+025AD td> span classglyph>▭/span> tr identity-REG>td> code>REG;/code> td> U+000AE td> span classglyph>®/span> tr identity-REG-legacy classimpl>td> code>REG/code> td> U+000AE td> span>®/span> tr identity-reg>td> code>reg;/code> td> U+000AE td> span classglyph>®/span> tr identity-reg-legacy classimpl>td> code>reg/code> td> U+000AE td> span>®/span> tr identity-ReverseElement>td> code>ReverseElement;/code> td> U+0220B td> span classglyph>∋/span> tr identity-ReverseEquilibrium>td> code>ReverseEquilibrium;/code> td> U+021CB td> span classglyph>⇋/span> tr identity-ReverseUpEquilibrium>td> code>ReverseUpEquilibrium;/code> td> U+0296F td> span classglyph>⥯/span> tr identity-rfisht>td> code>rfisht;/code> td> U+0297D td> span classglyph>⥽/span> tr identity-rfloor>td> code>rfloor;/code> td> U+0230B td> span classglyph>⌋/span> tr identity-Rfr>td> code>Rfr;/code> td> U+0211C td> span classglyph>ℜ/span> tr identity-rfr>td> code>rfr;/code> td> U+1D52F td> span classglyph>𝔯/span> tr identity-rHar>td> code>rHar;/code> td> U+02964 td> span classglyph>⥤/span> tr identity-rhard>td> code>rhard;/code> td> U+021C1 td> span classglyph>⇁/span> tr identity-rharu>td> code>rharu;/code> td> U+021C0 td> span classglyph>⇀/span> tr identity-rharul>td> code>rharul;/code> td> U+0296C td> span classglyph>⥬/span> tr identity-Rho>td> code>Rho;/code> td> U+003A1 td> span classglyph>Ρ/span> tr identity-rho>td> code>rho;/code> td> U+003C1 td> span classglyph>ρ/span> tr identity-rhov>td> code>rhov;/code> td> U+003F1 td> span classglyph>ϱ/span> tr identity-RightAngleBracket>td> code>RightAngleBracket;/code> td> U+027E9 td> span classglyph>⟩/span> tr identity-RightArrow>td> code>RightArrow;/code> td> U+02192 td> span classglyph>→/span> tr identity-Rightarrow>td> code>Rightarrow;/code> td> U+021D2 td> span classglyph>⇒/span> tr identity-rightarrow>td> code>rightarrow;/code> td> U+02192 td> span classglyph>→/span> tr identity-RightArrowBar>td> code>RightArrowBar;/code> td> U+021E5 td> span classglyph>⇥/span> tr identity-RightArrowLeftArrow>td> code>RightArrowLeftArrow;/code> td> U+021C4 td> span classglyph>⇄/span> tr identity-rightarrowtail>td> code>rightarrowtail;/code> td> U+021A3 td> span classglyph>↣/span> tr identity-RightCeiling>td> code>RightCeiling;/code> td> U+02309 td> span classglyph>⌉/span> tr identity-RightDoubleBracket>td> code>RightDoubleBracket;/code> td> U+027E7 td> span classglyph>⟧/span> tr identity-RightDownTeeVector>td> code>RightDownTeeVector;/code> td> U+0295D td> span classglyph>⥝/span> tr identity-RightDownVector>td> code>RightDownVector;/code> td> U+021C2 td> span classglyph>⇂/span> tr identity-RightDownVectorBar>td> code>RightDownVectorBar;/code> td> U+02955 td> span classglyph>⥕/span> tr identity-RightFloor>td> code>RightFloor;/code> td> U+0230B td> span classglyph>⌋/span> tr identity-rightharpoondown>td> code>rightharpoondown;/code> td> U+021C1 td> span classglyph>⇁/span> tr identity-rightharpoonup>td> code>rightharpoonup;/code> td> U+021C0 td> span classglyph>⇀/span> tr identity-rightleftarrows>td> code>rightleftarrows;/code> td> U+021C4 td> span classglyph>⇄/span> tr identity-rightleftharpoons>td> code>rightleftharpoons;/code> td> U+021CC td> span classglyph>⇌/span> tr identity-rightrightarrows>td> code>rightrightarrows;/code> td> U+021C9 td> span classglyph>⇉/span> tr identity-rightsquigarrow>td> code>rightsquigarrow;/code> td> U+0219D td> span classglyph>↝/span> tr identity-RightTee>td> code>RightTee;/code> td> U+022A2 td> span classglyph>⊢/span> tr identity-RightTeeArrow>td> code>RightTeeArrow;/code> td> U+021A6 td> span classglyph>↦/span> tr identity-RightTeeVector>td> code>RightTeeVector;/code> td> U+0295B td> span classglyph>⥛/span> tr identity-rightthreetimes>td> code>rightthreetimes;/code> td> U+022CC td> span classglyph>⋌/span> tr identity-RightTriangle>td> code>RightTriangle;/code> td> U+022B3 td> span classglyph>⊳/span> tr identity-RightTriangleBar>td> code>RightTriangleBar;/code> td> U+029D0 td> span classglyph>⧐/span> tr identity-RightTriangleEqual>td> code>RightTriangleEqual;/code> td> U+022B5 td> span classglyph>⊵/span> tr identity-RightUpDownVector>td> code>RightUpDownVector;/code> td> U+0294F td> span classglyph>⥏/span> tr identity-RightUpTeeVector>td> code>RightUpTeeVector;/code> td> U+0295C td> span classglyph>⥜/span> tr identity-RightUpVector>td> code>RightUpVector;/code> td> U+021BE td> span classglyph>↾/span> tr identity-RightUpVectorBar>td> code>RightUpVectorBar;/code> td> U+02954 td> span classglyph>⥔/span> tr identity-RightVector>td> code>RightVector;/code> td> U+021C0 td> span classglyph>⇀/span> tr identity-RightVectorBar>td> code>RightVectorBar;/code> td> U+02953 td> span classglyph>⥓/span> tr identity-ring>td> code>ring;/code> td> U+002DA td> span classglyph>˚/span> tr identity-risingdotseq>td> code>risingdotseq;/code> td> U+02253 td> span classglyph>≓/span> tr identity-rlarr>td> code>rlarr;/code> td> U+021C4 td> span classglyph>⇄/span> tr identity-rlhar>td> code>rlhar;/code> td> U+021CC td> span classglyph>⇌/span> tr identity-rlm>td> code>rlm;/code> td> U+0200F td> span classglyph>/span> tr identity-rmoust>td> code>rmoust;/code> td> U+023B1 td> span classglyph>⎱/span> tr identity-rmoustache>td> code>rmoustache;/code> td> U+023B1 td> span classglyph>⎱/span> tr identity-rnmid>td> code>rnmid;/code> td> U+02AEE td> span classglyph>⫮/span> tr identity-roang>td> code>roang;/code> td> U+027ED td> span classglyph>⟭/span> tr identity-roarr>td> code>roarr;/code> td> U+021FE td> span classglyph>⇾/span> tr identity-robrk>td> code>robrk;/code> td> U+027E7 td> span classglyph>⟧/span> tr identity-ropar>td> code>ropar;/code> td> U+02986 td> span classglyph>⦆/span> tr identity-Ropf>td> code>Ropf;/code> td> U+0211D td> span classglyph>ℝ/span> tr identity-ropf>td> code>ropf;/code> td> U+1D563 td> span classglyph>𝕣/span> tr identity-roplus>td> code>roplus;/code> td> U+02A2E td> span classglyph>⨮/span> tr identity-rotimes>td> code>rotimes;/code> td> U+02A35 td> span classglyph>⨵/span> tr identity-RoundImplies>td> code>RoundImplies;/code> td> U+02970 td> span classglyph>⥰/span> tr identity-rpar>td> code>rpar;/code> td> U+00029 td> span classglyph>)/span> tr identity-rpargt>td> code>rpargt;/code> td> U+02994 td> span classglyph>⦔/span> tr identity-rppolint>td> code>rppolint;/code> td> U+02A12 td> span classglyph>⨒/span> tr identity-rrarr>td> code>rrarr;/code> td> U+021C9 td> span classglyph>⇉/span> tr identity-Rrightarrow>td> code>Rrightarrow;/code> td> U+021DB td> span classglyph>⇛/span> tr identity-rsaquo>td> code>rsaquo;/code> td> U+0203A td> span classglyph>›/span> tr identity-Rscr>td> code>Rscr;/code> td> U+0211B td> span classglyph>ℛ/span> tr identity-rscr>td> code>rscr;/code> td> U+1D4C7 td> span classglyph>𝓇/span> tr identity-Rsh>td> code>Rsh;/code> td> U+021B1 td> span classglyph>↱/span> tr identity-rsh>td> code>rsh;/code> td> U+021B1 td> span classglyph>↱/span> tr identity-rsqb>td> code>rsqb;/code> td> U+0005D td> span classglyph>/span> tr identity-rsquo>td> code>rsquo;/code> td> U+02019 td> span classglyph>’/span> tr identity-rsquor>td> code>rsquor;/code> td> U+02019 td> span classglyph>’/span> tr identity-rthree>td> code>rthree;/code> td> U+022CC td> span classglyph>⋌/span> tr identity-rtimes>td> code>rtimes;/code> td> U+022CA td> span classglyph>⋊/span> tr identity-rtri>td> code>rtri;/code> td> U+025B9 td> span classglyph>▹/span> tr identity-rtrie>td> code>rtrie;/code> td> U+022B5 td> span classglyph>⊵/span> tr identity-rtrif>td> code>rtrif;/code> td> U+025B8 td> span classglyph>▸/span> tr identity-rtriltri>td> code>rtriltri;/code> td> U+029CE td> span classglyph>⧎/span> tr identity-RuleDelayed>td> code>RuleDelayed;/code> td> U+029F4 td> span classglyph>⧴/span> tr identity-ruluhar>td> code>ruluhar;/code> td> U+02968 td> span classglyph>⥨/span> tr identity-rx>td> code>rx;/code> td> U+0211E td> span classglyph>℞/span> tr identity-Sacute>td> code>Sacute;/code> td> U+0015A td> span classglyph>Ś/span> tr identity-sacute>td> code>sacute;/code> td> U+0015B td> span classglyph>ś/span> tr identity-sbquo>td> code>sbquo;/code> td> U+0201A td> span classglyph>‚/span> tr identity-Sc>td> code>Sc;/code> td> U+02ABC td> span classglyph>⪼/span> tr identity-sc>td> code>sc;/code> td> U+0227B td> span classglyph>≻/span> tr identity-scap>td> code>scap;/code> td> U+02AB8 td> span classglyph>⪸/span> tr identity-Scaron>td> code>Scaron;/code> td> U+00160 td> span classglyph>Š/span> tr identity-scaron>td> code>scaron;/code> td> U+00161 td> span classglyph>š/span> tr identity-sccue>td> code>sccue;/code> td> U+0227D td> span classglyph>≽/span> tr identity-scE>td> code>scE;/code> td> U+02AB4 td> span classglyph>⪴/span> tr identity-sce>td> code>sce;/code> td> U+02AB0 td> span classglyph>⪰/span> tr identity-Scedil>td> code>Scedil;/code> td> U+0015E td> span classglyph>Ş/span> tr identity-scedil>td> code>scedil;/code> td> U+0015F td> span classglyph>ş/span> tr identity-Scirc>td> code>Scirc;/code> td> U+0015C td> span classglyph>Ŝ/span> tr identity-scirc>td> code>scirc;/code> td> U+0015D td> span classglyph>ŝ/span> tr identity-scnap>td> code>scnap;/code> td> U+02ABA td> span classglyph>⪺/span> tr identity-scnE>td> code>scnE;/code> td> U+02AB6 td> span classglyph>⪶/span> tr identity-scnsim>td> code>scnsim;/code> td> U+022E9 td> span classglyph>⋩/span> tr identity-scpolint>td> code>scpolint;/code> td> U+02A13 td> span classglyph>⨓/span> tr identity-scsim>td> code>scsim;/code> td> U+0227F td> span classglyph>≿/span> tr identity-Scy>td> code>Scy;/code> td> U+00421 td> span classglyph>С/span> tr identity-scy>td> code>scy;/code> td> U+00441 td> span classglyph>с/span> tr identity-sdot>td> code>sdot;/code> td> U+022C5 td> span classglyph>⋅/span> tr identity-sdotb>td> code>sdotb;/code> td> U+022A1 td> span classglyph>⊡/span> tr identity-sdote>td> code>sdote;/code> td> U+02A66 td> span classglyph>⩦/span> tr identity-searhk>td> code>searhk;/code> td> U+02925 td> span classglyph>⤥/span> tr identity-seArr>td> code>seArr;/code> td> U+021D8 td> span classglyph>⇘/span> tr identity-searr>td> code>searr;/code> td> U+02198 td> span classglyph>↘/span> tr identity-searrow>td> code>searrow;/code> td> U+02198 td> span classglyph>↘/span> tr identity-sect>td> code>sect;/code> td> U+000A7 td> span classglyph>§/span> tr identity-sect-legacy classimpl>td> code>sect/code> td> U+000A7 td> span>§/span> tr identity-semi>td> code>semi;/code> td> U+0003B td> span classglyph>;/span> tr identity-seswar>td> code>seswar;/code> td> U+02929 td> span classglyph>⤩/span> tr identity-setminus>td> code>setminus;/code> td> U+02216 td> span classglyph>∖/span> tr identity-setmn>td> code>setmn;/code> td> U+02216 td> span classglyph>∖/span> tr identity-sext>td> code>sext;/code> td> U+02736 td> span classglyph>✶/span> tr identity-Sfr>td> code>Sfr;/code> td> U+1D516 td> span classglyph>𝔖/span> tr identity-sfr>td> code>sfr;/code> td> U+1D530 td> span classglyph>𝔰/span> tr identity-sfrown>td> code>sfrown;/code> td> U+02322 td> span classglyph>⌢/span> tr identity-sharp>td> code>sharp;/code> td> U+0266F td> span classglyph>♯/span> tr identity-SHCHcy>td> code>SHCHcy;/code> td> U+00429 td> span classglyph>Щ/span> tr identity-shchcy>td> code>shchcy;/code> td> U+00449 td> span classglyph>щ/span> tr identity-SHcy>td> code>SHcy;/code> td> U+00428 td> span classglyph>Ш/span> tr identity-shcy>td> code>shcy;/code> td> U+00448 td> span classglyph>ш/span> tr identity-ShortDownArrow>td> code>ShortDownArrow;/code> td> U+02193 td> span classglyph>↓/span> tr identity-ShortLeftArrow>td> code>ShortLeftArrow;/code> td> U+02190 td> span classglyph>←/span> tr identity-shortmid>td> code>shortmid;/code> td> U+02223 td> span classglyph>∣/span> tr identity-shortparallel>td> code>shortparallel;/code> td> U+02225 td> span classglyph>∥/span> tr identity-ShortRightArrow>td> code>ShortRightArrow;/code> td> U+02192 td> span classglyph>→/span> tr identity-ShortUpArrow>td> code>ShortUpArrow;/code> td> U+02191 td> span classglyph>↑/span> tr identity-shy>td> code>shy;/code> td> U+000AD td> span classglyph>/span> tr identity-shy-legacy classimpl>td> code>shy/code> td> U+000AD td> span>/span> tr identity-Sigma>td> code>Sigma;/code> td> U+003A3 td> span classglyph>Σ/span> tr identity-sigma>td> code>sigma;/code> td> U+003C3 td> span classglyph>σ/span> tr identity-sigmaf>td> code>sigmaf;/code> td> U+003C2 td> span classglyph>ς/span> tr identity-sigmav>td> code>sigmav;/code> td> U+003C2 td> span classglyph>ς/span> tr identity-sim>td> code>sim;/code> td> U+0223C td> span classglyph>∼/span> tr identity-simdot>td> code>simdot;/code> td> U+02A6A td> span classglyph>⩪/span> tr identity-sime>td> code>sime;/code> td> U+02243 td> span classglyph>≃/span> tr identity-simeq>td> code>simeq;/code> td> U+02243 td> span classglyph>≃/span> tr identity-simg>td> code>simg;/code> td> U+02A9E td> span classglyph>⪞/span> tr identity-simgE>td> code>simgE;/code> td> U+02AA0 td> span classglyph>⪠/span> tr identity-siml>td> code>siml;/code> td> U+02A9D td> span classglyph>⪝/span> tr identity-simlE>td> code>simlE;/code> td> U+02A9F td> span classglyph>⪟/span> tr identity-simne>td> code>simne;/code> td> U+02246 td> span classglyph>≆/span> tr identity-simplus>td> code>simplus;/code> td> U+02A24 td> span classglyph>⨤/span> tr identity-simrarr>td> code>simrarr;/code> td> U+02972 td> span classglyph>⥲/span> tr identity-slarr>td> code>slarr;/code> td> U+02190 td> span classglyph>←/span> tr identity-SmallCircle>td> code>SmallCircle;/code> td> U+02218 td> span classglyph>∘/span> tr identity-smallsetminus>td> code>smallsetminus;/code> td> U+02216 td> span classglyph>∖/span> tr identity-smashp>td> code>smashp;/code> td> U+02A33 td> span classglyph>⨳/span> tr identity-smeparsl>td> code>smeparsl;/code> td> U+029E4 td> span classglyph>⧤/span> tr identity-smid>td> code>smid;/code> td> U+02223 td> span classglyph>∣/span> tr identity-smile>td> code>smile;/code> td> U+02323 td> span classglyph>⌣/span> tr identity-smt>td> code>smt;/code> td> U+02AAA td> span classglyph>⪪/span> tr identity-smte>td> code>smte;/code> td> U+02AAC td> span classglyph>⪬/span> tr identity-smtes>td> code>smtes;/code> td> U+02AAC U+0FE00 td> span classglyph compound>⪬︀/span> tr identity-SOFTcy>td> code>SOFTcy;/code> td> U+0042C td> span classglyph>Ь/span> tr identity-softcy>td> code>softcy;/code> td> U+0044C td> span classglyph>ь/span> tr identity-sol>td> code>sol;/code> td> U+0002F td> span classglyph>//span> tr identity-solb>td> code>solb;/code> td> U+029C4 td> span classglyph>⧄/span> tr identity-solbar>td> code>solbar;/code> td> U+0233F td> span classglyph>⌿/span> tr identity-Sopf>td> code>Sopf;/code> td> U+1D54A td> span classglyph>𝕊/span> tr identity-sopf>td> code>sopf;/code> td> U+1D564 td> span classglyph>𝕤/span> tr identity-spades>td> code>spades;/code> td> U+02660 td> span classglyph>♠/span> tr identity-spadesuit>td> code>spadesuit;/code> td> U+02660 td> span classglyph>♠/span> tr identity-spar>td> code>spar;/code> td> U+02225 td> span classglyph>∥/span> tr identity-sqcap>td> code>sqcap;/code> td> U+02293 td> span classglyph>⊓/span> tr identity-sqcaps>td> code>sqcaps;/code> td> U+02293 U+0FE00 td> span classglyph compound>⊓︀/span> tr identity-sqcup>td> code>sqcup;/code> td> U+02294 td> span classglyph>⊔/span> tr identity-sqcups>td> code>sqcups;/code> td> U+02294 U+0FE00 td> span classglyph compound>⊔︀/span> tr identity-Sqrt>td> code>Sqrt;/code> td> U+0221A td> span classglyph>√/span> tr identity-sqsub>td> code>sqsub;/code> td> U+0228F td> span classglyph>⊏/span> tr identity-sqsube>td> code>sqsube;/code> td> U+02291 td> span classglyph>⊑/span> tr identity-sqsubset>td> code>sqsubset;/code> td> U+0228F td> span classglyph>⊏/span> tr identity-sqsubseteq>td> code>sqsubseteq;/code> td> U+02291 td> span classglyph>⊑/span> tr identity-sqsup>td> code>sqsup;/code> td> U+02290 td> span classglyph>⊐/span> tr identity-sqsupe>td> code>sqsupe;/code> td> U+02292 td> span classglyph>⊒/span> tr identity-sqsupset>td> code>sqsupset;/code> td> U+02290 td> span classglyph>⊐/span> tr identity-sqsupseteq>td> code>sqsupseteq;/code> td> U+02292 td> span classglyph>⊒/span> tr identity-squ>td> code>squ;/code> td> U+025A1 td> span classglyph>□/span> tr identity-Square>td> code>Square;/code> td> U+025A1 td> span classglyph>□/span> tr identity-square>td> code>square;/code> td> U+025A1 td> span classglyph>□/span> tr identity-SquareIntersection>td> code>SquareIntersection;/code> td> U+02293 td> span classglyph>⊓/span> tr identity-SquareSubset>td> code>SquareSubset;/code> td> U+0228F td> span classglyph>⊏/span> tr identity-SquareSubsetEqual>td> code>SquareSubsetEqual;/code> td> U+02291 td> span classglyph>⊑/span> tr identity-SquareSuperset>td> code>SquareSuperset;/code> td> U+02290 td> span classglyph>⊐/span> tr identity-SquareSupersetEqual>td> code>SquareSupersetEqual;/code> td> U+02292 td> span classglyph>⊒/span> tr identity-SquareUnion>td> code>SquareUnion;/code> td> U+02294 td> span classglyph>⊔/span> tr identity-squarf>td> code>squarf;/code> td> U+025AA td> span classglyph>▪/span> tr identity-squf>td> code>squf;/code> td> U+025AA td> span classglyph>▪/span> tr identity-srarr>td> code>srarr;/code> td> U+02192 td> span classglyph>→/span> tr identity-Sscr>td> code>Sscr;/code> td> U+1D4AE td> span classglyph>𝒮/span> tr identity-sscr>td> code>sscr;/code> td> U+1D4C8 td> span classglyph>𝓈/span> tr identity-ssetmn>td> code>ssetmn;/code> td> U+02216 td> span classglyph>∖/span> tr identity-ssmile>td> code>ssmile;/code> td> U+02323 td> span classglyph>⌣/span> tr identity-sstarf>td> code>sstarf;/code> td> U+022C6 td> span classglyph>⋆/span> tr identity-Star>td> code>Star;/code> td> U+022C6 td> span classglyph>⋆/span> tr identity-star>td> code>star;/code> td> U+02606 td> span classglyph>☆/span> tr identity-starf>td> code>starf;/code> td> U+02605 td> span classglyph>★/span> tr identity-straightepsilon>td> code>straightepsilon;/code> td> U+003F5 td> span classglyph>ϵ/span> tr identity-straightphi>td> code>straightphi;/code> td> U+003D5 td> span classglyph>ϕ/span> tr identity-strns>td> code>strns;/code> td> U+000AF td> span classglyph>¯/span> tr identity-Sub>td> code>Sub;/code> td> U+022D0 td> span classglyph>⋐/span> tr identity-sub>td> code>sub;/code> td> U+02282 td> span classglyph>⊂/span> tr identity-subdot>td> code>subdot;/code> td> U+02ABD td> span classglyph>⪽/span> tr identity-subE>td> code>subE;/code> td> U+02AC5 td> span classglyph>⫅/span> tr identity-sube>td> code>sube;/code> td> U+02286 td> span classglyph>⊆/span> tr identity-subedot>td> code>subedot;/code> td> U+02AC3 td> span classglyph>⫃/span> tr identity-submult>td> code>submult;/code> td> U+02AC1 td> span classglyph>⫁/span> tr identity-subnE>td> code>subnE;/code> td> U+02ACB td> span classglyph>⫋/span> tr identity-subne>td> code>subne;/code> td> U+0228A td> span classglyph>⊊/span> tr identity-subplus>td> code>subplus;/code> td> U+02ABF td> span classglyph>⪿/span> tr identity-subrarr>td> code>subrarr;/code> td> U+02979 td> span classglyph>⥹/span> tr identity-Subset>td> code>Subset;/code> td> U+022D0 td> span classglyph>⋐/span> tr identity-subset>td> code>subset;/code> td> U+02282 td> span classglyph>⊂/span> tr identity-subseteq>td> code>subseteq;/code> td> U+02286 td> span classglyph>⊆/span> tr identity-subseteqq>td> code>subseteqq;/code> td> U+02AC5 td> span classglyph>⫅/span> tr identity-SubsetEqual>td> code>SubsetEqual;/code> td> U+02286 td> span classglyph>⊆/span> tr identity-subsetneq>td> code>subsetneq;/code> td> U+0228A td> span classglyph>⊊/span> tr identity-subsetneqq>td> code>subsetneqq;/code> td> U+02ACB td> span classglyph>⫋/span> tr identity-subsim>td> code>subsim;/code> td> U+02AC7 td> span classglyph>⫇/span> tr identity-subsub>td> code>subsub;/code> td> U+02AD5 td> span classglyph>⫕/span> tr identity-subsup>td> code>subsup;/code> td> U+02AD3 td> span classglyph>⫓/span> tr identity-succ>td> code>succ;/code> td> U+0227B td> span classglyph>≻/span> tr identity-succapprox>td> code>succapprox;/code> td> U+02AB8 td> span classglyph>⪸/span> tr identity-succcurlyeq>td> code>succcurlyeq;/code> td> U+0227D td> span classglyph>≽/span> tr identity-Succeeds>td> code>Succeeds;/code> td> U+0227B td> span classglyph>≻/span> tr identity-SucceedsEqual>td> code>SucceedsEqual;/code> td> U+02AB0 td> span classglyph>⪰/span> tr identity-SucceedsSlantEqual>td> code>SucceedsSlantEqual;/code> td> U+0227D td> span classglyph>≽/span> tr identity-SucceedsTilde>td> code>SucceedsTilde;/code> td> U+0227F td> span classglyph>≿/span> tr identity-succeq>td> code>succeq;/code> td> U+02AB0 td> span classglyph>⪰/span> tr identity-succnapprox>td> code>succnapprox;/code> td> U+02ABA td> span classglyph>⪺/span> tr identity-succneqq>td> code>succneqq;/code> td> U+02AB6 td> span classglyph>⪶/span> tr identity-succnsim>td> code>succnsim;/code> td> U+022E9 td> span classglyph>⋩/span> tr identity-succsim>td> code>succsim;/code> td> U+0227F td> span classglyph>≿/span> tr identity-SuchThat>td> code>SuchThat;/code> td> U+0220B td> span classglyph>∋/span> tr identity-Sum>td> code>Sum;/code> td> U+02211 td> span classglyph>∑/span> tr identity-sum>td> code>sum;/code> td> U+02211 td> span classglyph>∑/span> tr identity-sung>td> code>sung;/code> td> U+0266A td> span classglyph>♪/span> tr identity-Sup>td> code>Sup;/code> td> U+022D1 td> span classglyph>⋑/span> tr identity-sup>td> code>sup;/code> td> U+02283 td> span classglyph>⊃/span> tr identity-sup1>td> code>sup1;/code> td> U+000B9 td> span classglyph>¹/span> tr identity-sup1-legacy classimpl>td> code>sup1/code> td> U+000B9 td> span>¹/span> tr identity-sup2>td> code>sup2;/code> td> U+000B2 td> span classglyph>²/span> tr identity-sup2-legacy classimpl>td> code>sup2/code> td> U+000B2 td> span>²/span> tr identity-sup3>td> code>sup3;/code> td> U+000B3 td> span classglyph>³/span> tr identity-sup3-legacy classimpl>td> code>sup3/code> td> U+000B3 td> span>³/span> tr identity-supdot>td> code>supdot;/code> td> U+02ABE td> span classglyph>⪾/span> tr identity-supdsub>td> code>supdsub;/code> td> U+02AD8 td> span classglyph>⫘/span> tr identity-supE>td> code>supE;/code> td> U+02AC6 td> span classglyph>⫆/span> tr identity-supe>td> code>supe;/code> td> U+02287 td> span classglyph>⊇/span> tr identity-supedot>td> code>supedot;/code> td> U+02AC4 td> span classglyph>⫄/span> tr identity-Superset>td> code>Superset;/code> td> U+02283 td> span classglyph>⊃/span> tr identity-SupersetEqual>td> code>SupersetEqual;/code> td> U+02287 td> span classglyph>⊇/span> tr identity-suphsol>td> code>suphsol;/code> td> U+027C9 td> span classglyph>⟉/span> tr identity-suphsub>td> code>suphsub;/code> td> U+02AD7 td> span classglyph>⫗/span> tr identity-suplarr>td> code>suplarr;/code> td> U+0297B td> span classglyph>⥻/span> tr identity-supmult>td> code>supmult;/code> td> U+02AC2 td> span classglyph>⫂/span> tr identity-supnE>td> code>supnE;/code> td> U+02ACC td> span classglyph>⫌/span> tr identity-supne>td> code>supne;/code> td> U+0228B td> span classglyph>⊋/span> tr identity-supplus>td> code>supplus;/code> td> U+02AC0 td> span classglyph>⫀/span> tr identity-Supset>td> code>Supset;/code> td> U+022D1 td> span classglyph>⋑/span> tr identity-supset>td> code>supset;/code> td> U+02283 td> span classglyph>⊃/span> tr identity-supseteq>td> code>supseteq;/code> td> U+02287 td> span classglyph>⊇/span> tr identity-supseteqq>td> code>supseteqq;/code> td> U+02AC6 td> span classglyph>⫆/span> tr identity-supsetneq>td> code>supsetneq;/code> td> U+0228B td> span classglyph>⊋/span> tr identity-supsetneqq>td> code>supsetneqq;/code> td> U+02ACC td> span classglyph>⫌/span> tr identity-supsim>td> code>supsim;/code> td> U+02AC8 td> span classglyph>⫈/span> tr identity-supsub>td> code>supsub;/code> td> U+02AD4 td> span classglyph>⫔/span> tr identity-supsup>td> code>supsup;/code> td> U+02AD6 td> span classglyph>⫖/span> tr identity-swarhk>td> code>swarhk;/code> td> U+02926 td> span classglyph>⤦/span> tr identity-swArr>td> code>swArr;/code> td> U+021D9 td> span classglyph>⇙/span> tr identity-swarr>td> code>swarr;/code> td> U+02199 td> span classglyph>↙/span> tr identity-swarrow>td> code>swarrow;/code> td> U+02199 td> span classglyph>↙/span> tr identity-swnwar>td> code>swnwar;/code> td> U+0292A td> span classglyph>⤪/span> tr identity-szlig>td> code>szlig;/code> td> U+000DF td> span classglyph>ß/span> tr identity-szlig-legacy classimpl>td> code>szlig/code> td> U+000DF td> span>ß/span> tr identity-Tab>td> code>Tab;/code> td> U+00009 td> span classglyph control>␉/span> tr identity-target>td> code>target;/code> td> U+02316 td> span classglyph>⌖/span> tr identity-Tau>td> code>Tau;/code> td> U+003A4 td> span classglyph>Τ/span> tr identity-tau>td> code>tau;/code> td> U+003C4 td> span classglyph>τ/span> tr identity-tbrk>td> code>tbrk;/code> td> U+023B4 td> span classglyph>⎴/span> tr identity-Tcaron>td> code>Tcaron;/code> td> U+00164 td> span classglyph>Ť/span> tr identity-tcaron>td> code>tcaron;/code> td> U+00165 td> span classglyph>ť/span> tr identity-Tcedil>td> code>Tcedil;/code> td> U+00162 td> span classglyph>Ţ/span> tr identity-tcedil>td> code>tcedil;/code> td> U+00163 td> span classglyph>ţ/span> tr identity-Tcy>td> code>Tcy;/code> td> U+00422 td> span classglyph>Т/span> tr identity-tcy>td> code>tcy;/code> td> U+00442 td> span classglyph>т/span> tr identity-tdot>td> code>tdot;/code> td> U+020DB td> span classglyph composition>◌⃛/span> tr identity-telrec>td> code>telrec;/code> td> U+02315 td> span classglyph>⌕/span> tr identity-Tfr>td> code>Tfr;/code> td> U+1D517 td> span classglyph>𝔗/span> tr identity-tfr>td> code>tfr;/code> td> U+1D531 td> span classglyph>𝔱/span> tr identity-there4>td> code>there4;/code> td> U+02234 td> span classglyph>∴/span> tr identity-Therefore>td> code>Therefore;/code> td> U+02234 td> span classglyph>∴/span> tr identity-therefore>td> code>therefore;/code> td> U+02234 td> span classglyph>∴/span> tr identity-Theta>td> code>Theta;/code> td> U+00398 td> span classglyph>Θ/span> tr identity-theta>td> code>theta;/code> td> U+003B8 td> span classglyph>θ/span> tr identity-thetasym>td> code>thetasym;/code> td> U+003D1 td> span classglyph>ϑ/span> tr identity-thetav>td> code>thetav;/code> td> U+003D1 td> span classglyph>ϑ/span> tr identity-thickapprox>td> code>thickapprox;/code> td> U+02248 td> span classglyph>≈/span> tr identity-thicksim>td> code>thicksim;/code> td> U+0223C td> span classglyph>∼/span> tr identity-ThickSpace>td> code>ThickSpace;/code> td> U+0205F U+0200A td> span classglyph compound> /span> tr identity-thinsp>td> code>thinsp;/code> td> U+02009 td> span classglyph> /span> tr identity-ThinSpace>td> code>ThinSpace;/code> td> U+02009 td> span classglyph> /span> tr identity-thkap>td> code>thkap;/code> td> U+02248 td> span classglyph>≈/span> tr identity-thksim>td> code>thksim;/code> td> U+0223C td> span classglyph>∼/span> tr identity-THORN>td> code>THORN;/code> td> U+000DE td> span classglyph>Þ/span> tr identity-THORN-legacy classimpl>td> code>THORN/code> td> U+000DE td> span>Þ/span> tr identity-thorn>td> code>thorn;/code> td> U+000FE td> span classglyph>þ/span> tr identity-thorn-legacy classimpl>td> code>thorn/code> td> U+000FE td> span>þ/span> tr identity-Tilde>td> code>Tilde;/code> td> U+0223C td> span classglyph>∼/span> tr identity-tilde>td> code>tilde;/code> td> U+002DC td> span classglyph>˜/span> tr identity-TildeEqual>td> code>TildeEqual;/code> td> U+02243 td> span classglyph>≃/span> tr identity-TildeFullEqual>td> code>TildeFullEqual;/code> td> U+02245 td> span classglyph>≅/span> tr identity-TildeTilde>td> code>TildeTilde;/code> td> U+02248 td> span classglyph>≈/span> tr identity-times>td> code>times;/code> td> U+000D7 td> span classglyph>×/span> tr identity-times-legacy classimpl>td> code>times/code> td> U+000D7 td> span>×/span> tr identity-timesb>td> code>timesb;/code> td> U+022A0 td> span classglyph>⊠/span> tr identity-timesbar>td> code>timesbar;/code> td> U+02A31 td> span classglyph>⨱/span> tr identity-timesd>td> code>timesd;/code> td> U+02A30 td> span classglyph>⨰/span> tr identity-tint>td> code>tint;/code> td> U+0222D td> span classglyph>∭/span> tr identity-toea>td> code>toea;/code> td> U+02928 td> span classglyph>⤨/span> tr identity-top>td> code>top;/code> td> U+022A4 td> span classglyph>⊤/span> tr identity-topbot>td> code>topbot;/code> td> U+02336 td> span classglyph>⌶/span> tr identity-topcir>td> code>topcir;/code> td> U+02AF1 td> span classglyph>⫱/span> tr identity-Topf>td> code>Topf;/code> td> U+1D54B td> span classglyph>𝕋/span> tr identity-topf>td> code>topf;/code> td> U+1D565 td> span classglyph>𝕥/span> tr identity-topfork>td> code>topfork;/code> td> U+02ADA td> span classglyph>⫚/span> tr identity-tosa>td> code>tosa;/code> td> U+02929 td> span classglyph>⤩/span> tr identity-tprime>td> code>tprime;/code> td> U+02034 td> span classglyph>‴/span> tr identity-TRADE>td> code>TRADE;/code> td> U+02122 td> span classglyph>™/span> tr identity-trade>td> code>trade;/code> td> U+02122 td> span classglyph>™/span> tr identity-triangle>td> code>triangle;/code> td> U+025B5 td> span classglyph>▵/span> tr identity-triangledown>td> code>triangledown;/code> td> U+025BF td> span classglyph>▿/span> tr identity-triangleleft>td> code>triangleleft;/code> td> U+025C3 td> span classglyph>◃/span> tr identity-trianglelefteq>td> code>trianglelefteq;/code> td> U+022B4 td> span classglyph>⊴/span> tr identity-triangleq>td> code>triangleq;/code> td> U+0225C td> span classglyph>≜/span> tr identity-triangleright>td> code>triangleright;/code> td> U+025B9 td> span classglyph>▹/span> tr identity-trianglerighteq>td> code>trianglerighteq;/code> td> U+022B5 td> span classglyph>⊵/span> tr identity-tridot>td> code>tridot;/code> td> U+025EC td> span classglyph>◬/span> tr identity-trie>td> code>trie;/code> td> U+0225C td> span classglyph>≜/span> tr identity-triminus>td> code>triminus;/code> td> U+02A3A td> span classglyph>⨺/span> tr identity-TripleDot>td> code>TripleDot;/code> td> U+020DB td> span classglyph composition>◌⃛/span> tr identity-triplus>td> code>triplus;/code> td> U+02A39 td> span classglyph>⨹/span> tr identity-trisb>td> code>trisb;/code> td> U+029CD td> span classglyph>⧍/span> tr identity-tritime>td> code>tritime;/code> td> U+02A3B td> span classglyph>⨻/span> tr identity-trpezium>td> code>trpezium;/code> td> U+023E2 td> span classglyph>⏢/span> tr identity-Tscr>td> code>Tscr;/code> td> U+1D4AF td> span classglyph>𝒯/span> tr identity-tscr>td> code>tscr;/code> td> U+1D4C9 td> span classglyph>𝓉/span> tr identity-TScy>td> code>TScy;/code> td> U+00426 td> span classglyph>Ц/span> tr identity-tscy>td> code>tscy;/code> td> U+00446 td> span classglyph>ц/span> tr identity-TSHcy>td> code>TSHcy;/code> td> U+0040B td> span classglyph>Ћ/span> tr identity-tshcy>td> code>tshcy;/code> td> U+0045B td> span classglyph>ћ/span> tr identity-Tstrok>td> code>Tstrok;/code> td> U+00166 td> span classglyph>Ŧ/span> tr identity-tstrok>td> code>tstrok;/code> td> U+00167 td> span classglyph>ŧ/span> tr identity-twixt>td> code>twixt;/code> td> U+0226C td> span classglyph>≬/span> tr identity-twoheadleftarrow>td> code>twoheadleftarrow;/code> td> U+0219E td> span classglyph>↞/span> tr identity-twoheadrightarrow>td> code>twoheadrightarrow;/code> td> U+021A0 td> span classglyph>↠/span> tr identity-Uacute>td> code>Uacute;/code> td> U+000DA td> span classglyph>Ú/span> tr identity-Uacute-legacy classimpl>td> code>Uacute/code> td> U+000DA td> span>Ú/span> tr identity-uacute>td> code>uacute;/code> td> U+000FA td> span classglyph>ú/span> tr identity-uacute-legacy classimpl>td> code>uacute/code> td> U+000FA td> span>ú/span> tr identity-Uarr>td> code>Uarr;/code> td> U+0219F td> span classglyph>↟/span> tr identity-uArr>td> code>uArr;/code> td> U+021D1 td> span classglyph>⇑/span> tr identity-uarr>td> code>uarr;/code> td> U+02191 td> span classglyph>↑/span> tr identity-Uarrocir>td> code>Uarrocir;/code> td> U+02949 td> span classglyph>⥉/span> tr identity-Ubrcy>td> code>Ubrcy;/code> td> U+0040E td> span classglyph>Ў/span> tr identity-ubrcy>td> code>ubrcy;/code> td> U+0045E td> span classglyph>ў/span> tr identity-Ubreve>td> code>Ubreve;/code> td> U+0016C td> span classglyph>Ŭ/span> tr identity-ubreve>td> code>ubreve;/code> td> U+0016D td> span classglyph>ŭ/span> tr identity-Ucirc>td> code>Ucirc;/code> td> U+000DB td> span classglyph>Û/span> tr identity-Ucirc-legacy classimpl>td> code>Ucirc/code> td> U+000DB td> span>Û/span> tr identity-ucirc>td> code>ucirc;/code> td> U+000FB td> span classglyph>û/span> tr identity-ucirc-legacy classimpl>td> code>ucirc/code> td> U+000FB td> span>û/span> tr identity-Ucy>td> code>Ucy;/code> td> U+00423 td> span classglyph>У/span> tr identity-ucy>td> code>ucy;/code> td> U+00443 td> span classglyph>у/span> tr identity-udarr>td> code>udarr;/code> td> U+021C5 td> span classglyph>⇅/span> tr identity-Udblac>td> code>Udblac;/code> td> U+00170 td> span classglyph>Ű/span> tr identity-udblac>td> code>udblac;/code> td> U+00171 td> span classglyph>ű/span> tr identity-udhar>td> code>udhar;/code> td> U+0296E td> span classglyph>⥮/span> tr identity-ufisht>td> code>ufisht;/code> td> U+0297E td> span classglyph>⥾/span> tr identity-Ufr>td> code>Ufr;/code> td> U+1D518 td> span classglyph>𝔘/span> tr identity-ufr>td> code>ufr;/code> td> U+1D532 td> span classglyph>𝔲/span> tr identity-Ugrave>td> code>Ugrave;/code> td> U+000D9 td> span classglyph>Ù/span> tr identity-Ugrave-legacy classimpl>td> code>Ugrave/code> td> U+000D9 td> span>Ù/span> tr identity-ugrave>td> code>ugrave;/code> td> U+000F9 td> span classglyph>ù/span> tr identity-ugrave-legacy classimpl>td> code>ugrave/code> td> U+000F9 td> span>ù/span> tr identity-uHar>td> code>uHar;/code> td> U+02963 td> span classglyph>⥣/span> tr identity-uharl>td> code>uharl;/code> td> U+021BF td> span classglyph>↿/span> tr identity-uharr>td> code>uharr;/code> td> U+021BE td> span classglyph>↾/span> tr identity-uhblk>td> code>uhblk;/code> td> U+02580 td> span classglyph>▀/span> tr identity-ulcorn>td> code>ulcorn;/code> td> U+0231C td> span classglyph>⌜/span> tr identity-ulcorner>td> code>ulcorner;/code> td> U+0231C td> span classglyph>⌜/span> tr identity-ulcrop>td> code>ulcrop;/code> td> U+0230F td> span classglyph>⌏/span> tr identity-ultri>td> code>ultri;/code> td> U+025F8 td> span classglyph>◸/span> tr identity-Umacr>td> code>Umacr;/code> td> U+0016A td> span classglyph>Ū/span> tr identity-umacr>td> code>umacr;/code> td> U+0016B td> span classglyph>ū/span> tr identity-uml>td> code>uml;/code> td> U+000A8 td> span classglyph>¨/span> tr identity-uml-legacy classimpl>td> code>uml/code> td> U+000A8 td> span>¨/span> tr identity-UnderBar>td> code>UnderBar;/code> td> U+0005F td> span classglyph>_/span> tr identity-UnderBrace>td> code>UnderBrace;/code> td> U+023DF td> span classglyph>⏟/span> tr identity-UnderBracket>td> code>UnderBracket;/code> td> U+023B5 td> span classglyph>⎵/span> tr identity-UnderParenthesis>td> code>UnderParenthesis;/code> td> U+023DD td> span classglyph>⏝/span> tr identity-Union>td> code>Union;/code> td> U+022C3 td> span classglyph>⋃/span> tr identity-UnionPlus>td> code>UnionPlus;/code> td> U+0228E td> span classglyph>⊎/span> tr identity-Uogon>td> code>Uogon;/code> td> U+00172 td> span classglyph>Ų/span> tr identity-uogon>td> code>uogon;/code> td> U+00173 td> span classglyph>ų/span> tr identity-Uopf>td> code>Uopf;/code> td> U+1D54C td> span classglyph>𝕌/span> tr identity-uopf>td> code>uopf;/code> td> U+1D566 td> span classglyph>𝕦/span> tr identity-UpArrow>td> code>UpArrow;/code> td> U+02191 td> span classglyph>↑/span> tr identity-Uparrow>td> code>Uparrow;/code> td> U+021D1 td> span classglyph>⇑/span> tr identity-uparrow>td> code>uparrow;/code> td> U+02191 td> span classglyph>↑/span> tr identity-UpArrowBar>td> code>UpArrowBar;/code> td> U+02912 td> span classglyph>⤒/span> tr identity-UpArrowDownArrow>td> code>UpArrowDownArrow;/code> td> U+021C5 td> span classglyph>⇅/span> tr identity-UpDownArrow>td> code>UpDownArrow;/code> td> U+02195 td> span classglyph>↕/span> tr identity-Updownarrow>td> code>Updownarrow;/code> td> U+021D5 td> span classglyph>⇕/span> tr identity-updownarrow>td> code>updownarrow;/code> td> U+02195 td> span classglyph>↕/span> tr identity-UpEquilibrium>td> code>UpEquilibrium;/code> td> U+0296E td> span classglyph>⥮/span> tr identity-upharpoonleft>td> code>upharpoonleft;/code> td> U+021BF td> span classglyph>↿/span> tr identity-upharpoonright>td> code>upharpoonright;/code> td> U+021BE td> span classglyph>↾/span> tr identity-uplus>td> code>uplus;/code> td> U+0228E td> span classglyph>⊎/span> tr identity-UpperLeftArrow>td> code>UpperLeftArrow;/code> td> U+02196 td> span classglyph>↖/span> tr identity-UpperRightArrow>td> code>UpperRightArrow;/code> td> U+02197 td> span classglyph>↗/span> tr identity-Upsi>td> code>Upsi;/code> td> U+003D2 td> span classglyph>ϒ/span> tr identity-upsi>td> code>upsi;/code> td> U+003C5 td> span classglyph>υ/span> tr identity-upsih>td> code>upsih;/code> td> U+003D2 td> span classglyph>ϒ/span> tr identity-Upsilon>td> code>Upsilon;/code> td> U+003A5 td> span classglyph>Υ/span> tr identity-upsilon>td> code>upsilon;/code> td> U+003C5 td> span classglyph>υ/span> tr identity-UpTee>td> code>UpTee;/code> td> U+022A5 td> span classglyph>⊥/span> tr identity-UpTeeArrow>td> code>UpTeeArrow;/code> td> U+021A5 td> span classglyph>↥/span> tr identity-upuparrows>td> code>upuparrows;/code> td> U+021C8 td> span classglyph>⇈/span> tr identity-urcorn>td> code>urcorn;/code> td> U+0231D td> span classglyph>⌝/span> tr identity-urcorner>td> code>urcorner;/code> td> U+0231D td> span classglyph>⌝/span> tr identity-urcrop>td> code>urcrop;/code> td> U+0230E td> span classglyph>⌎/span> tr identity-Uring>td> code>Uring;/code> td> U+0016E td> span classglyph>Ů/span> tr identity-uring>td> code>uring;/code> td> U+0016F td> span classglyph>ů/span> tr identity-urtri>td> code>urtri;/code> td> U+025F9 td> span classglyph>◹/span> tr identity-Uscr>td> code>Uscr;/code> td> U+1D4B0 td> span classglyph>𝒰/span> tr identity-uscr>td> code>uscr;/code> td> U+1D4CA td> span classglyph>𝓊/span> tr identity-utdot>td> code>utdot;/code> td> U+022F0 td> span classglyph>⋰/span> tr identity-Utilde>td> code>Utilde;/code> td> U+00168 td> span classglyph>Ũ/span> tr identity-utilde>td> code>utilde;/code> td> U+00169 td> span classglyph>ũ/span> tr identity-utri>td> code>utri;/code> td> U+025B5 td> span classglyph>▵/span> tr identity-utrif>td> code>utrif;/code> td> U+025B4 td> span classglyph>▴/span> tr identity-uuarr>td> code>uuarr;/code> td> U+021C8 td> span classglyph>⇈/span> tr identity-Uuml>td> code>Uuml;/code> td> U+000DC td> span classglyph>Ü/span> tr identity-Uuml-legacy classimpl>td> code>Uuml/code> td> U+000DC td> span>Ü/span> tr identity-uuml>td> code>uuml;/code> td> U+000FC td> span classglyph>ü/span> tr identity-uuml-legacy classimpl>td> code>uuml/code> td> U+000FC td> span>ü/span> tr identity-uwangle>td> code>uwangle;/code> td> U+029A7 td> span classglyph>⦧/span> tr identity-vangrt>td> code>vangrt;/code> td> U+0299C td> span classglyph>⦜/span> tr identity-varepsilon>td> code>varepsilon;/code> td> U+003F5 td> span classglyph>ϵ/span> tr identity-varkappa>td> code>varkappa;/code> td> U+003F0 td> span classglyph>ϰ/span> tr identity-varnothing>td> code>varnothing;/code> td> U+02205 td> span classglyph>∅/span> tr identity-varphi>td> code>varphi;/code> td> U+003D5 td> span classglyph>ϕ/span> tr identity-varpi>td> code>varpi;/code> td> U+003D6 td> span classglyph>ϖ/span> tr identity-varpropto>td> code>varpropto;/code> td> U+0221D td> span classglyph>∝/span> tr identity-vArr>td> code>vArr;/code> td> U+021D5 td> span classglyph>⇕/span> tr identity-varr>td> code>varr;/code> td> U+02195 td> span classglyph>↕/span> tr identity-varrho>td> code>varrho;/code> td> U+003F1 td> span classglyph>ϱ/span> tr identity-varsigma>td> code>varsigma;/code> td> U+003C2 td> span classglyph>ς/span> tr identity-varsubsetneq>td> code>varsubsetneq;/code> td> U+0228A U+0FE00 td> span classglyph compound>⊊︀/span> tr identity-varsubsetneqq>td> code>varsubsetneqq;/code> td> U+02ACB U+0FE00 td> span classglyph compound>⫋︀/span> tr identity-varsupsetneq>td> code>varsupsetneq;/code> td> U+0228B U+0FE00 td> span classglyph compound>⊋︀/span> tr identity-varsupsetneqq>td> code>varsupsetneqq;/code> td> U+02ACC U+0FE00 td> span classglyph compound>⫌︀/span> tr identity-vartheta>td> code>vartheta;/code> td> U+003D1 td> span classglyph>ϑ/span> tr identity-vartriangleleft>td> code>vartriangleleft;/code> td> U+022B2 td> span classglyph>⊲/span> tr identity-vartriangleright>td> code>vartriangleright;/code> td> U+022B3 td> span classglyph>⊳/span> tr identity-Vbar>td> code>Vbar;/code> td> U+02AEB td> span classglyph>⫫/span> tr identity-vBar>td> code>vBar;/code> td> U+02AE8 td> span classglyph>⫨/span> tr identity-vBarv>td> code>vBarv;/code> td> U+02AE9 td> span classglyph>⫩/span> tr identity-Vcy>td> code>Vcy;/code> td> U+00412 td> span classglyph>В/span> tr identity-vcy>td> code>vcy;/code> td> U+00432 td> span classglyph>в/span> tr identity-VDash>td> code>VDash;/code> td> U+022AB td> span classglyph>⊫/span> tr identity-Vdash>td> code>Vdash;/code> td> U+022A9 td> span classglyph>⊩/span> tr identity-vDash>td> code>vDash;/code> td> U+022A8 td> span classglyph>⊨/span> tr identity-vdash>td> code>vdash;/code> td> U+022A2 td> span classglyph>⊢/span> tr identity-Vdashl>td> code>Vdashl;/code> td> U+02AE6 td> span classglyph>⫦/span> tr identity-Vee>td> code>Vee;/code> td> U+022C1 td> span classglyph>⋁/span> tr identity-vee>td> code>vee;/code> td> U+02228 td> span classglyph>∨/span> tr identity-veebar>td> code>veebar;/code> td> U+022BB td> span classglyph>⊻/span> tr identity-veeeq>td> code>veeeq;/code> td> U+0225A td> span classglyph>≚/span> tr identity-vellip>td> code>vellip;/code> td> U+022EE td> span classglyph>⋮/span> tr identity-Verbar>td> code>Verbar;/code> td> U+02016 td> span classglyph>‖/span> tr identity-verbar>td> code>verbar;/code> td> U+0007C td> span classglyph>|/span> tr identity-Vert>td> code>Vert;/code> td> U+02016 td> span classglyph>‖/span> tr identity-vert>td> code>vert;/code> td> U+0007C td> span classglyph>|/span> tr identity-VerticalBar>td> code>VerticalBar;/code> td> U+02223 td> span classglyph>∣/span> tr identity-VerticalLine>td> code>VerticalLine;/code> td> U+0007C td> span classglyph>|/span> tr identity-VerticalSeparator>td> code>VerticalSeparator;/code> td> U+02758 td> span classglyph>❘/span> tr identity-VerticalTilde>td> code>VerticalTilde;/code> td> U+02240 td> span classglyph>≀/span> tr identity-VeryThinSpace>td> code>VeryThinSpace;/code> td> U+0200A td> span classglyph> /span> tr identity-Vfr>td> code>Vfr;/code> td> U+1D519 td> span classglyph>𝔙/span> tr identity-vfr>td> code>vfr;/code> td> U+1D533 td> span classglyph>𝔳/span> tr identity-vltri>td> code>vltri;/code> td> U+022B2 td> span classglyph>⊲/span> tr identity-vnsub>td> code>vnsub;/code> td> U+02282 U+020D2 td> span classglyph compound>⊂⃒/span> tr identity-vnsup>td> code>vnsup;/code> td> U+02283 U+020D2 td> span classglyph compound>⊃⃒/span> tr identity-Vopf>td> code>Vopf;/code> td> U+1D54D td> span classglyph>𝕍/span> tr identity-vopf>td> code>vopf;/code> td> U+1D567 td> span classglyph>𝕧/span> tr identity-vprop>td> code>vprop;/code> td> U+0221D td> span classglyph>∝/span> tr identity-vrtri>td> code>vrtri;/code> td> U+022B3 td> span classglyph>⊳/span> tr identity-Vscr>td> code>Vscr;/code> td> U+1D4B1 td> span classglyph>𝒱/span> tr identity-vscr>td> code>vscr;/code> td> U+1D4CB td> span classglyph>𝓋/span> tr identity-vsubnE>td> code>vsubnE;/code> td> U+02ACB U+0FE00 td> span classglyph compound>⫋︀/span> tr identity-vsubne>td> code>vsubne;/code> td> U+0228A U+0FE00 td> span classglyph compound>⊊︀/span> tr identity-vsupnE>td> code>vsupnE;/code> td> U+02ACC U+0FE00 td> span classglyph compound>⫌︀/span> tr identity-vsupne>td> code>vsupne;/code> td> U+0228B U+0FE00 td> span classglyph compound>⊋︀/span> tr identity-Vvdash>td> code>Vvdash;/code> td> U+022AA td> span classglyph>⊪/span> tr identity-vzigzag>td> code>vzigzag;/code> td> U+0299A td> span classglyph>⦚/span> tr identity-Wcirc>td> code>Wcirc;/code> td> U+00174 td> span classglyph>Ŵ/span> tr identity-wcirc>td> code>wcirc;/code> td> U+00175 td> span classglyph>ŵ/span> tr identity-wedbar>td> code>wedbar;/code> td> U+02A5F td> span classglyph>⩟/span> tr identity-Wedge>td> code>Wedge;/code> td> U+022C0 td> span classglyph>⋀/span> tr identity-wedge>td> code>wedge;/code> td> U+02227 td> span classglyph>∧/span> tr identity-wedgeq>td> code>wedgeq;/code> td> U+02259 td> span classglyph>≙/span> tr identity-weierp>td> code>weierp;/code> td> U+02118 td> span classglyph>℘/span> tr identity-Wfr>td> code>Wfr;/code> td> U+1D51A td> span classglyph>𝔚/span> tr identity-wfr>td> code>wfr;/code> td> U+1D534 td> span classglyph>𝔴/span> tr identity-Wopf>td> code>Wopf;/code> td> U+1D54E td> span classglyph>𝕎/span> tr identity-wopf>td> code>wopf;/code> td> U+1D568 td> span classglyph>𝕨/span> tr identity-wp>td> code>wp;/code> td> U+02118 td> span classglyph>℘/span> tr identity-wr>td> code>wr;/code> td> U+02240 td> span classglyph>≀/span> tr identity-wreath>td> code>wreath;/code> td> U+02240 td> span classglyph>≀/span> tr identity-Wscr>td> code>Wscr;/code> td> U+1D4B2 td> span classglyph>𝒲/span> tr identity-wscr>td> code>wscr;/code> td> U+1D4CC td> span classglyph>𝓌/span> tr identity-xcap>td> code>xcap;/code> td> U+022C2 td> span classglyph>⋂/span> tr identity-xcirc>td> code>xcirc;/code> td> U+025EF td> span classglyph>◯/span> tr identity-xcup>td> code>xcup;/code> td> U+022C3 td> span classglyph>⋃/span> tr identity-xdtri>td> code>xdtri;/code> td> U+025BD td> span classglyph>▽/span> tr identity-Xfr>td> code>Xfr;/code> td> U+1D51B td> span classglyph>𝔛/span> tr identity-xfr>td> code>xfr;/code> td> U+1D535 td> span classglyph>𝔵/span> tr identity-xhArr>td> code>xhArr;/code> td> U+027FA td> span classglyph>⟺/span> tr identity-xharr>td> code>xharr;/code> td> U+027F7 td> span classglyph>⟷/span> tr identity-Xi>td> code>Xi;/code> td> U+0039E td> span classglyph>Ξ/span> tr identity-xi>td> code>xi;/code> td> U+003BE td> span classglyph>ξ/span> tr identity-xlArr>td> code>xlArr;/code> td> U+027F8 td> span classglyph>⟸/span> tr identity-xlarr>td> code>xlarr;/code> td> U+027F5 td> span classglyph>⟵/span> tr identity-xmap>td> code>xmap;/code> td> U+027FC td> span classglyph>⟼/span> tr identity-xnis>td> code>xnis;/code> td> U+022FB td> span classglyph>⋻/span> tr identity-xodot>td> code>xodot;/code> td> U+02A00 td> span classglyph>⨀/span> tr identity-Xopf>td> code>Xopf;/code> td> U+1D54F td> span classglyph>𝕏/span> tr identity-xopf>td> code>xopf;/code> td> U+1D569 td> span classglyph>𝕩/span> tr identity-xoplus>td> code>xoplus;/code> td> U+02A01 td> span classglyph>⨁/span> tr identity-xotime>td> code>xotime;/code> td> U+02A02 td> span classglyph>⨂/span> tr identity-xrArr>td> code>xrArr;/code> td> U+027F9 td> span classglyph>⟹/span> tr identity-xrarr>td> code>xrarr;/code> td> U+027F6 td> span classglyph>⟶/span> tr identity-Xscr>td> code>Xscr;/code> td> U+1D4B3 td> span classglyph>𝒳/span> tr identity-xscr>td> code>xscr;/code> td> U+1D4CD td> span classglyph>𝓍/span> tr identity-xsqcup>td> code>xsqcup;/code> td> U+02A06 td> span classglyph>⨆/span> tr identity-xuplus>td> code>xuplus;/code> td> U+02A04 td> span classglyph>⨄/span> tr identity-xutri>td> code>xutri;/code> td> U+025B3 td> span classglyph>△/span> tr identity-xvee>td> code>xvee;/code> td> U+022C1 td> span classglyph>⋁/span> tr identity-xwedge>td> code>xwedge;/code> td> U+022C0 td> span classglyph>⋀/span> tr identity-Yacute>td> code>Yacute;/code> td> U+000DD td> span classglyph>Ý/span> tr identity-Yacute-legacy classimpl>td> code>Yacute/code> td> U+000DD td> span>Ý/span> tr identity-yacute>td> code>yacute;/code> td> U+000FD td> span classglyph>ý/span> tr identity-yacute-legacy classimpl>td> code>yacute/code> td> U+000FD td> span>ý/span> tr identity-YAcy>td> code>YAcy;/code> td> U+0042F td> span classglyph>Я/span> tr identity-yacy>td> code>yacy;/code> td> U+0044F td> span classglyph>я/span> tr identity-Ycirc>td> code>Ycirc;/code> td> U+00176 td> span classglyph>Ŷ/span> tr identity-ycirc>td> code>ycirc;/code> td> U+00177 td> span classglyph>ŷ/span> tr identity-Ycy>td> code>Ycy;/code> td> U+0042B td> span classglyph>Ы/span> tr identity-ycy>td> code>ycy;/code> td> U+0044B td> span classglyph>ы/span> tr identity-yen>td> code>yen;/code> td> U+000A5 td> span classglyph>¥/span> tr identity-yen-legacy classimpl>td> code>yen/code> td> U+000A5 td> span>¥/span> tr identity-Yfr>td> code>Yfr;/code> td> U+1D51C td> span classglyph>𝔜/span> tr identity-yfr>td> code>yfr;/code> td> U+1D536 td> span classglyph>𝔶/span> tr identity-YIcy>td> code>YIcy;/code> td> U+00407 td> span classglyph>Ї/span> tr identity-yicy>td> code>yicy;/code> td> U+00457 td> span classglyph>ї/span> tr identity-Yopf>td> code>Yopf;/code> td> U+1D550 td> span classglyph>𝕐/span> tr identity-yopf>td> code>yopf;/code> td> U+1D56A td> span classglyph>𝕪/span> tr identity-Yscr>td> code>Yscr;/code> td> U+1D4B4 td> span classglyph>𝒴/span> tr identity-yscr>td> code>yscr;/code> td> U+1D4CE td> span classglyph>𝓎/span> tr identity-YUcy>td> code>YUcy;/code> td> U+0042E td> span classglyph>Ю/span> tr identity-yucy>td> code>yucy;/code> td> U+0044E td> span classglyph>ю/span> tr identity-Yuml>td> code>Yuml;/code> td> U+00178 td> span classglyph>Ÿ/span> tr identity-yuml>td> code>yuml;/code> td> U+000FF td> span classglyph>ÿ/span> tr identity-yuml-legacy classimpl>td> code>yuml/code> td> U+000FF td> span>ÿ/span> tr identity-Zacute>td> code>Zacute;/code> td> U+00179 td> span classglyph>Ź/span> tr identity-zacute>td> code>zacute;/code> td> U+0017A td> span classglyph>ź/span> tr identity-Zcaron>td> code>Zcaron;/code> td> U+0017D td> span classglyph>Ž/span> tr identity-zcaron>td> code>zcaron;/code> td> U+0017E td> span classglyph>ž/span> tr identity-Zcy>td> code>Zcy;/code> td> U+00417 td> span classglyph>З/span> tr identity-zcy>td> code>zcy;/code> td> U+00437 td> span classglyph>з/span> tr identity-Zdot>td> code>Zdot;/code> td> U+0017B td> span classglyph>Ż/span> tr identity-zdot>td> code>zdot;/code> td> U+0017C td> span classglyph>ż/span> tr identity-zeetrf>td> code>zeetrf;/code> td> U+02128 td> span classglyph>ℨ/span> tr identity-ZeroWidthSpace>td> code>ZeroWidthSpace;/code> td> U+0200B td> span classglyph>/span> tr identity-Zeta>td> code>Zeta;/code> td> U+00396 td> span classglyph>Ζ/span> tr identity-zeta>td> code>zeta;/code> td> U+003B6 td> span classglyph>ζ/span> tr identity-Zfr>td> code>Zfr;/code> td> U+02128 td> span classglyph>ℨ/span> tr identity-zfr>td> code>zfr;/code> td> U+1D537 td> span classglyph>𝔷/span> tr identity-ZHcy>td> code>ZHcy;/code> td> U+00416 td> span classglyph>Ж/span> tr identity-zhcy>td> code>zhcy;/code> td> U+00436 td> span classglyph>ж/span> tr identity-zigrarr>td> code>zigrarr;/code> td> U+021DD td> span classglyph>⇝/span> tr identity-Zopf>td> code>Zopf;/code> td> U+02124 td> span classglyph>ℤ/span> tr identity-zopf>td> code>zopf;/code> td> U+1D56B td> span classglyph>𝕫/span> tr identity-Zscr>td> code>Zscr;/code> td> U+1D4B5 td> span classglyph>𝒵/span> tr identity-zscr>td> code>zscr;/code> td> U+1D4CF td> span classglyph>𝓏/span> tr identity-zwj>td> code>zwj;/code> td> U+0200D td> span classglyph>/span> tr identity-zwnj>td> code>zwnj;/code> td> U+0200C td> span classglyph>/span> /table> /div> p>This data is also available a href/entities.json>as a JSON file/a>./p> p>i>The glyphs displayed above are non-normative. Refer to the Unicode specifications for formal definitions of the characters listed above./i>/p> p classnote>The character reference names originate from the cite>XML Entity Definitions for Characters/cite> specification, though only the above is considered normative. a href#refsXMLENTITY>XMLENTITY/a>/p> h2 idthe-xhtml-syntax>span classsecno>13/span> dfn idxhtml>The XML syntax/dfn>a href#the-xhtml-syntax classself-link>/a>/h2>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> xhtmlspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>3.2+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>2+/span>/span>span classie yes>span>IE/span> span>9+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini yes>span>Opera Mini/span> span>all+/span>/span>span classsafari yes>span>Safari/span> span>3.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.1+/span>/span>span classopera yes>span>Opera/span> span>9+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featxhtml>caniuse.com/a>/div> p classnote>This section only describes the rules for XML resources. Rules for code idthe-xhtml-syntax:text/html>a href#text/html>text/html/a>/code> resources are discussed in the section above entitled a href#syntax idthe-xhtml-syntax:syntax>The HTML syntax/a>./p> h3 idwriting-xhtml-documents>span classsecno>13.1/span> Writing documents in the XML syntaxa href#writing-xhtml-documents classself-link>/a>/h3> p classnote>The XML syntax for HTML was formerly referred to as XHTML, but this specification does not use that term (among other reasons, because no such term is used for the HTML syntaxes of MathML and SVG)./p> p>The syntax for XML is defined in the XML and Namespaces in XML specifications. a href#refsXML>XML/a> a href#refsXMLNS>XMLNS/a>/p> p>This specification does not define any syntax-level requirements beyond those defined for XML proper./p> p>XML documents may contain a code>DOCTYPE/code> if desired, but this is not required to conform to this specification. This specification does not define a public or system identifier, nor provide a formal DTD./p> p classnote>According to the XML specification, XML processors are not guaranteed to process the external DTD subset referenced in the DOCTYPE. This means, for example, that using a hrefhttps://www.w3.org/TR/xml/#dt-entref>entity references/a> for characters in XML documents is unsafe if they are defined in an external file (except for code></code>, code>>/code>, code>&/code>, code>"/code> and code>'/code>)./p> h3 idparsing-xhtml-documents>span classsecno>13.2/span> Parsing XML documentsa href#parsing-xhtml-documents classself-link>/a>/h3> p>This section describes the relationship between XML and the DOM, with a particular emphasis on how this interacts with HTML./p> p>An dfn idxml-parser data-export>XML parser/dfn>, for the purposes of this specification, is a construct that follows the rules given in the XML specification to map a string of bytes or characters into a code idparsing-xhtml-documents:document>a href#document>Document/a>/code> object./p> p classnote>At the time of writing, no such rules actually exist./p> p>An a href#xml-parser idparsing-xhtml-documents:xml-parser>XML parser/a> is either associated with a code idparsing-xhtml-documents:document-2>a href#document>Document/a>/code> object when it is created, or creates one implicitly./p> p>This code idparsing-xhtml-documents:document-3>a href#document>Document/a>/code> must then be populated with DOM nodes that represent the tree structure of the input passed to the parser, as defined by the XML specification, the Namespaces in XML specification, and the WHATWG DOM standard. When creating DOM nodes representing elements, the a href#create-an-element-for-the-token idparsing-xhtml-documents:create-an-element-for-the-token>create an element for a token/a> algorithm or some equivalent that operates on appropriate XML datastructures must be used, to ensure the proper a hrefhttps://dom.spec.whatwg.org/#concept-element-interface idparsing-xhtml-documents:element-interface data-x-internalelement-interface>element interfaces/a> are created and that a href#custom-element idparsing-xhtml-documents:custom-element>custom elements/a> are set up correctly./p> p>DOM mutation events must not fire for the operations that the a href#xml-parser idparsing-xhtml-documents:xml-parser-2>XML parser/a> performs on the code idparsing-xhtml-documents:document-4>a href#document>Document/a>/code>s tree, but the user agent must act as if elements and attributes were individually appended and set respectively so as to trigger rules in this specification regarding what happens when an element is inserted into a document or has its attributes set, and the WHATWG DOM standards requirements regarding a idparsing-xhtml-documents:mutation-observers hrefhttps://dom.spec.whatwg.org/#mutation-observers data-x-internalmutation-observers>mutation observers/a> 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#refsUIEVENTS>UIEVENTS/a>/p> p>Between the time an elements start tag is parsed and the time either the elements end tag is parsed or the parser detects a well-formedness error, the user agent must act as if the element was in a a href#stack-of-open-elements idparsing-xhtml-documents:stack-of-open-elements>stack of open elements/a>./p> p classnote>This is used, e.g. by the code idparsing-xhtml-documents:the-object-element>a href#the-object-element>object/a>/code> element to avoid instantiating plugins before the code idparsing-xhtml-documents:the-param-element>a href#the-param-element>param/a>/code> element children have been parsed./p> p>This specification provides the following additional information that user agents should use when retrieving an external entity: the public identifiers given in the following list all correspond to a hrefdata:application/xml-dtd;base64,PCFFTlRJVFkgVGFiICImI3g5OyI%2BPCFFTlRJVFkgTmV3TGluZSAiJiN4QTsiPjwhRU5USVRZIGV4Y2wgIiYjeDIxOyI%2BPCFFTlRJVFkgcXVvdCAiJiN4MjI7Ij48IUVOVElUWSBRVU9UICImI3gyMjsiPjwhRU5USVRZIG51bSAiJiN4MjM7Ij48IUVOVElUWSBkb2xsYXIgIiYjeDI0OyI%2BPCFFTlRJVFkgcGVyY250ICImI3gyNTsiPjwhRU5USVRZIGFtcCAiJiN4MjY7I3gyNjsiPjwhRU5USVRZIEFNUCAiJiN4MjY7I3gyNjsiPjwhRU5USVRZIGFwb3MgIiYjeDI3OyI%2BPCFFTlRJVFkgbHBhciAiJiN4Mjg7Ij48IUVOVElUWSBycGFyICImI3gyOTsiPjwhRU5USVRZIGFzdCAiJiN4MkE7Ij48IUVOVElUWSBtaWRhc3QgIiYjeDJBOyI%2BPCFFTlRJVFkgcGx1cyAiJiN4MkI7Ij48IUVOVElUWSBjb21tYSAiJiN4MkM7Ij48IUVOVElUWSBwZXJpb2QgIiYjeDJFOyI%2BPCFFTlRJVFkgc29sICImI3gyRjsiPjwhRU5USVRZIGNvbG9uICImI3gzQTsiPjwhRU5USVRZIHNlbWkgIiYjeDNCOyI%2BPCFFTlRJVFkgbHQgIiYjeDI2OyN4M0M7Ij48IUVOVElUWSBMVCAiJiN4MjY7I3gzQzsiPjwhRU5USVRZIG52bHQgIiYjeDI2OyN4M0M7JiN4MjBEMjsiPjwhRU5USVRZIGVxdWFscyAiJiN4M0Q7Ij48IUVOVElUWSBibmUgIiYjeDNEOyYjeDIwRTU7Ij48IUVOVElUWSBndCAiJiN4M0U7Ij48IUVOVElUWSBHVCAiJiN4M0U7Ij48IUVOVElUWSBudmd0ICImI3gzRTsmI3gyMEQyOyI%2BPCFFTlRJVFkgcXVlc3QgIiYjeDNGOyI%2BPCFFTlRJVFkgY29tbWF0ICImI3g0MDsiPjwhRU5USVRZIGxzcWIgIiYjeDVCOyI%2BPCFFTlRJVFkgbGJyYWNrICImI3g1QjsiPjwhRU5USVRZIGJzb2wgIiYjeDVDOyI%2BPCFFTlRJVFkgcnNxYiAiJiN4NUQ7Ij48IUVOVElUWSByYnJhY2sgIiYjeDVEOyI%2BPCFFTlRJVFkgSGF0ICImI3g1RTsiPjwhRU5USVRZIGxvd2JhciAiJiN4NUY7Ij48IUVOVElUWSBVbmRlckJhciAiJiN4NUY7Ij48IUVOVElUWSBncmF2ZSAiJiN4NjA7Ij48IUVOVElUWSBEaWFjcml0aWNhbEdyYXZlICImI3g2MDsiPjwhRU5USVRZIGZqbGlnICImI3g2NjsmI3g2QTsiPjwhRU5USVRZIGxjdWIgIiYjeDdCOyI%2BPCFFTlRJVFkgbGJyYWNlICImI3g3QjsiPjwhRU5USVRZIHZlcmJhciAiJiN4N0M7Ij48IUVOVElUWSB2ZXJ0ICImI3g3QzsiPjwhRU5USVRZIFZlcnRpY2FsTGluZSAiJiN4N0M7Ij48IUVOVElUWSByY3ViICImI3g3RDsiPjwhRU5USVRZIHJicmFjZSAiJiN4N0Q7Ij48IUVOVElUWSBuYnNwICImI3hBMDsiPjwhRU5USVRZIE5vbkJyZWFraW5nU3BhY2UgIiYjeEEwOyI%2BPCFFTlRJVFkgaWV4Y2wgIiYjeEExOyI%2BPCFFTlRJVFkgY2VudCAiJiN4QTI7Ij48IUVOVElUWSBwb3VuZCAiJiN4QTM7Ij48IUVOVElUWSBjdXJyZW4gIiYjeEE0OyI%2BPCFFTlRJVFkgeWVuICImI3hBNTsiPjwhRU5USVRZIGJydmJhciAiJiN4QTY7Ij48IUVOVElUWSBzZWN0ICImI3hBNzsiPjwhRU5USVRZIERvdCAiJiN4QTg7Ij48IUVOVElUWSBkaWUgIiYjeEE4OyI%2BPCFFTlRJVFkgRG91YmxlRG90ICImI3hBODsiPjwhRU5USVRZIHVtbCAiJiN4QTg7Ij48IUVOVElUWSBjb3B5ICImI3hBOTsiPjwhRU5USVRZIENPUFkgIiYjeEE5OyI%2BPCFFTlRJVFkgb3JkZiAiJiN4QUE7Ij48IUVOVElUWSBsYXF1byAiJiN4QUI7Ij48IUVOVElUWSBub3QgIiYjeEFDOyI%2BPCFFTlRJVFkgc2h5ICImI3hBRDsiPjwhRU5USVRZIHJlZyAiJiN4QUU7Ij48IUVOVElUWSBjaXJjbGVkUiAiJiN4QUU7Ij48IUVOVElUWSBSRUcgIiYjeEFFOyI%2BPCFFTlRJVFkgbWFjciAiJiN4QUY7Ij48IUVOVElUWSBzdHJucyAiJiN4QUY7Ij48IUVOVElUWSBkZWcgIiYjeEIwOyI%2BPCFFTlRJVFkgcGx1c21uICImI3hCMTsiPjwhRU5USVRZIHBtICImI3hCMTsiPjwhRU5USVRZIFBsdXNNaW51cyAiJiN4QjE7Ij48IUVOVElUWSBzdXAyICImI3hCMjsiPjwhRU5USVRZIHN1cDMgIiYjeEIzOyI%2BPCFFTlRJVFkgYWN1dGUgIiYjeEI0OyI%2BPCFFTlRJVFkgRGlhY3JpdGljYWxBY3V0ZSAiJiN4QjQ7Ij48IUVOVElUWSBtaWNybyAiJiN4QjU7Ij48IUVOVElUWSBwYXJhICImI3hCNjsiPjwhRU5USVRZIG1pZGRvdCAiJiN4Qjc7Ij48IUVOVElUWSBjZW50ZXJkb3QgIiYjeEI3OyI%2BPCFFTlRJVFkgQ2VudGVyRG90ICImI3hCNzsiPjwhRU5USVRZIGNlZGlsICImI3hCODsiPjwhRU5USVRZIENlZGlsbGEgIiYjeEI4OyI%2BPCFFTlRJVFkgc3VwMSAiJiN4Qjk7Ij48IUVOVElUWSBvcmRtICImI3hCQTsiPjwhRU5USVRZIHJhcXVvICImI3hCQjsiPjwhRU5USVRZIGZyYWMxNCAiJiN4QkM7Ij48IUVOVElUWSBmcmFjMTIgIiYjeEJEOyI%2BPCFFTlRJVFkgaGFsZiAiJiN4QkQ7Ij48IUVOVElUWSBmcmFjMzQgIiYjeEJFOyI%2BPCFFTlRJVFkgaXF1ZXN0ICImI3hCRjsiPjwhRU5USVRZIEFncmF2ZSAiJiN4QzA7Ij48IUVOVElUWSBBYWN1dGUgIiYjeEMxOyI%2BPCFFTlRJVFkgQWNpcmMgIiYjeEMyOyI%2BPCFFTlRJVFkgQXRpbGRlICImI3hDMzsiPjwhRU5USVRZIEF1bWwgIiYjeEM0OyI%2BPCFFTlRJVFkgQXJpbmcgIiYjeEM1OyI%2BPCFFTlRJVFkgYW5nc3QgIiYjeEM1OyI%2BPCFFTlRJVFkgQUVsaWcgIiYjeEM2OyI%2BPCFFTlRJVFkgQ2NlZGlsICImI3hDNzsiPjwhRU5USVRZIEVncmF2ZSAiJiN4Qzg7Ij48IUVOVElUWSBFYWN1dGUgIiYjeEM5OyI%2BPCFFTlRJVFkgRWNpcmMgIiYjeENBOyI%2BPCFFTlRJVFkgRXVtbCAiJiN4Q0I7Ij48IUVOVElUWSBJZ3JhdmUgIiYjeENDOyI%2BPCFFTlRJVFkgSWFjdXRlICImI3hDRDsiPjwhRU5USVRZIEljaXJjICImI3hDRTsiPjwhRU5USVRZIEl1bWwgIiYjeENGOyI%2BPCFFTlRJVFkgRVRIICImI3hEMDsiPjwhRU5USVRZIE50aWxkZSAiJiN4RDE7Ij48IUVOVElUWSBPZ3JhdmUgIiYjeEQyOyI%2BPCFFTlRJVFkgT2FjdXRlICImI3hEMzsiPjwhRU5USVRZIE9jaXJjICImI3hENDsiPjwhRU5USVRZIE90aWxkZSAiJiN4RDU7Ij48IUVOVElUWSBPdW1sICImI3hENjsiPjwhRU5USVRZIHRpbWVzICImI3hENzsiPjwhRU5USVRZIE9zbGFzaCAiJiN4RDg7Ij48IUVOVElUWSBVZ3JhdmUgIiYjeEQ5OyI%2BPCFFTlRJVFkgVWFjdXRlICImI3hEQTsiPjwhRU5USVRZIFVjaXJjICImI3hEQjsiPjwhRU5USVRZIFV1bWwgIiYjeERDOyI%2BPCFFTlRJVFkgWWFjdXRlICImI3hERDsiPjwhRU5USVRZIFRIT1JOICImI3hERTsiPjwhRU5USVRZIHN6bGlnICImI3hERjsiPjwhRU5USVRZIGFncmF2ZSAiJiN4RTA7Ij48IUVOVElUWSBhYWN1dGUgIiYjeEUxOyI%2BPCFFTlRJVFkgYWNpcmMgIiYjeEUyOyI%2BPCFFTlRJVFkgYXRpbGRlICImI3hFMzsiPjwhRU5USVRZIGF1bWwgIiYjeEU0OyI%2BPCFFTlRJVFkgYXJpbmcgIiYjeEU1OyI%2BPCFFTlRJVFkgYWVsaWcgIiYjeEU2OyI%2BPCFFTlRJVFkgY2NlZGlsICImI3hFNzsiPjwhRU5USVRZIGVncmF2ZSAiJiN4RTg7Ij48IUVOVElUWSBlYWN1dGUgIiYjeEU5OyI%2BPCFFTlRJVFkgZWNpcmMgIiYjeEVBOyI%2BPCFFTlRJVFkgZXVtbCAiJiN4RUI7Ij48IUVOVElUWSBpZ3JhdmUgIiYjeEVDOyI%2BPCFFTlRJVFkgaWFjdXRlICImI3hFRDsiPjwhRU5USVRZIGljaXJjICImI3hFRTsiPjwhRU5USVRZIGl1bWwgIiYjeEVGOyI%2BPCFFTlRJVFkgZXRoICImI3hGMDsiPjwhRU5USVRZIG50aWxkZSAiJiN4RjE7Ij48IUVOVElUWSBvZ3JhdmUgIiYjeEYyOyI%2BPCFFTlRJVFkgb2FjdXRlICImI3hGMzsiPjwhRU5USVRZIG9jaXJjICImI3hGNDsiPjwhRU5USVRZIG90aWxkZSAiJiN4RjU7Ij48IUVOVElUWSBvdW1sICImI3hGNjsiPjwhRU5USVRZIGRpdmlkZSAiJiN4Rjc7Ij48IUVOVElUWSBkaXYgIiYjeEY3OyI%2BPCFFTlRJVFkgb3NsYXNoICImI3hGODsiPjwhRU5USVRZIHVncmF2ZSAiJiN4Rjk7Ij48IUVOVElUWSB1YWN1dGUgIiYjeEZBOyI%2BPCFFTlRJVFkgdWNpcmMgIiYjeEZCOyI%2BPCFFTlRJVFkgdXVtbCAiJiN4RkM7Ij48IUVOVElUWSB5YWN1dGUgIiYjeEZEOyI%2BPCFFTlRJVFkgdGhvcm4gIiYjeEZFOyI%2BPCFFTlRJVFkgeXVtbCAiJiN4RkY7Ij48IUVOVElUWSBBbWFjciAiJiN4MTAwOyI%2BPCFFTlRJVFkgYW1hY3IgIiYjeDEwMTsiPjwhRU5USVRZIEFicmV2ZSAiJiN4MTAyOyI%2BPCFFTlRJVFkgYWJyZXZlICImI3gxMDM7Ij48IUVOVElUWSBBb2dvbiAiJiN4MTA0OyI%2BPCFFTlRJVFkgYW9nb24gIiYjeDEwNTsiPjwhRU5USVRZIENhY3V0ZSAiJiN4MTA2OyI%2BPCFFTlRJVFkgY2FjdXRlICImI3gxMDc7Ij48IUVOVElUWSBDY2lyYyAiJiN4MTA4OyI%2BPCFFTlRJVFkgY2NpcmMgIiYjeDEwOTsiPjwhRU5USVRZIENkb3QgIiYjeDEwQTsiPjwhRU5USVRZIGNkb3QgIiYjeDEwQjsiPjwhRU5USVRZIENjYXJvbiAiJiN4MTBDOyI%2BPCFFTlRJVFkgY2Nhcm9uICImI3gxMEQ7Ij48IUVOVElUWSBEY2Fyb24gIiYjeDEwRTsiPjwhRU5USVRZIGRjYXJvbiAiJiN4MTBGOyI%2BPCFFTlRJVFkgRHN0cm9rICImI3gxMTA7Ij48IUVOVElUWSBkc3Ryb2sgIiYjeDExMTsiPjwhRU5USVRZIEVtYWNyICImI3gxMTI7Ij48IUVOVElUWSBlbWFjciAiJiN4MTEzOyI%2BPCFFTlRJVFkgRWRvdCAiJiN4MTE2OyI%2BPCFFTlRJVFkgZWRvdCAiJiN4MTE3OyI%2BPCFFTlRJVFkgRW9nb24gIiYjeDExODsiPjwhRU5USVRZIGVvZ29uICImI3gxMTk7Ij48IUVOVElUWSBFY2Fyb24gIiYjeDExQTsiPjwhRU5USVRZIGVjYXJvbiAiJiN4MTFCOyI%2BPCFFTlRJVFkgR2NpcmMgIiYjeDExQzsiPjwhRU5USVRZIGdjaXJjICImI3gxMUQ7Ij48IUVOVElUWSBHYnJldmUgIiYjeDExRTsiPjwhRU5USVRZIGdicmV2ZSAiJiN4MTFGOyI%2BPCFFTlRJVFkgR2RvdCAiJiN4MTIwOyI%2BPCFFTlRJVFkgZ2RvdCAiJiN4MTIxOyI%2BPCFFTlRJVFkgR2NlZGlsICImI3gxMjI7Ij48IUVOVElUWSBIY2lyYyAiJiN4MTI0OyI%2BPCFFTlRJVFkgaGNpcmMgIiYjeDEyNTsiPjwhRU5USVRZIEhzdHJvayAiJiN4MTI2OyI%2BPCFFTlRJVFkgaHN0cm9rICImI3gxMjc7Ij48IUVOVElUWSBJdGlsZGUgIiYjeDEyODsiPjwhRU5USVRZIGl0aWxkZSAiJiN4MTI5OyI%2BPCFFTlRJVFkgSW1hY3IgIiYjeDEyQTsiPjwhRU5USVRZIGltYWNyICImI3gxMkI7Ij48IUVOVElUWSBJb2dvbiAiJiN4MTJFOyI%2BPCFFTlRJVFkgaW9nb24gIiYjeDEyRjsiPjwhRU5USVRZIElkb3QgIiYjeDEzMDsiPjwhRU5USVRZIGltYXRoICImI3gxMzE7Ij48IUVOVElUWSBpbm9kb3QgIiYjeDEzMTsiPjwhRU5USVRZIElKbGlnICImI3gxMzI7Ij48IUVOVElUWSBpamxpZyAiJiN4MTMzOyI%2BPCFFTlRJVFkgSmNpcmMgIiYjeDEzNDsiPjwhRU5USVRZIGpjaXJjICImI3gxMzU7Ij48IUVOVElUWSBLY2VkaWwgIiYjeDEzNjsiPjwhRU5USVRZIGtjZWRpbCAiJiN4MTM3OyI%2BPCFFTlRJVFkga2dyZWVuICImI3gxMzg7Ij48IUVOVElUWSBMYWN1dGUgIiYjeDEzOTsiPjwhRU5USVRZIGxhY3V0ZSAiJiN4MTNBOyI%2BPCFFTlRJVFkgTGNlZGlsICImI3gxM0I7Ij48IUVOVElUWSBsY2VkaWwgIiYjeDEzQzsiPjwhRU5USVRZIExjYXJvbiAiJiN4MTNEOyI%2BPCFFTlRJVFkgbGNhcm9uICImI3gxM0U7Ij48IUVOVElUWSBMbWlkb3QgIiYjeDEzRjsiPjwhRU5USVRZIGxtaWRvdCAiJiN4MTQwOyI%2BPCFFTlRJVFkgTHN0cm9rICImI3gxNDE7Ij48IUVOVElUWSBsc3Ryb2sgIiYjeDE0MjsiPjwhRU5USVRZIE5hY3V0ZSAiJiN4MTQzOyI%2BPCFFTlRJVFkgbmFjdXRlICImI3gxNDQ7Ij48IUVOVElUWSBOY2VkaWwgIiYjeDE0NTsiPjwhRU5USVRZIG5jZWRpbCAiJiN4MTQ2OyI%2BPCFFTlRJVFkgTmNhcm9uICImI3gxNDc7Ij48IUVOVElUWSBuY2Fyb24gIiYjeDE0ODsiPjwhRU5USVRZIG5hcG9zICImI3gxNDk7Ij48IUVOVElUWSBFTkcgIiYjeDE0QTsiPjwhRU5USVRZIGVuZyAiJiN4MTRCOyI%2BPCFFTlRJVFkgT21hY3IgIiYjeDE0QzsiPjwhRU5USVRZIG9tYWNyICImI3gxNEQ7Ij48IUVOVElUWSBPZGJsYWMgIiYjeDE1MDsiPjwhRU5USVRZIG9kYmxhYyAiJiN4MTUxOyI%2BPCFFTlRJVFkgT0VsaWcgIiYjeDE1MjsiPjwhRU5USVRZIG9lbGlnICImI3gxNTM7Ij48IUVOVElUWSBSYWN1dGUgIiYjeDE1NDsiPjwhRU5USVRZIHJhY3V0ZSAiJiN4MTU1OyI%2BPCFFTlRJVFkgUmNlZGlsICImI3gxNTY7Ij48IUVOVElUWSByY2VkaWwgIiYjeDE1NzsiPjwhRU5USVRZIFJjYXJvbiAiJiN4MTU4OyI%2BPCFFTlRJVFkgcmNhcm9uICImI3gxNTk7Ij48IUVOVElUWSBTYWN1dGUgIiYjeDE1QTsiPjwhRU5USVRZIHNhY3V0ZSAiJiN4MTVCOyI%2BPCFFTlRJVFkgU2NpcmMgIiYjeDE1QzsiPjwhRU5USVRZIHNjaXJjICImI3gxNUQ7Ij48IUVOVElUWSBTY2VkaWwgIiYjeDE1RTsiPjwhRU5USVRZIHNjZWRpbCAiJiN4MTVGOyI%2BPCFFTlRJVFkgU2Nhcm9uICImI3gxNjA7Ij48IUVOVElUWSBzY2Fyb24gIiYjeDE2MTsiPjwhRU5USVRZIFRjZWRpbCAiJiN4MTYyOyI%2BPCFFTlRJVFkgdGNlZGlsICImI3gxNjM7Ij48IUVOVElUWSBUY2Fyb24gIiYjeDE2NDsiPjwhRU5USVRZIHRjYXJvbiAiJiN4MTY1OyI%2BPCFFTlRJVFkgVHN0cm9rICImI3gxNjY7Ij48IUVOVElUWSB0c3Ryb2sgIiYjeDE2NzsiPjwhRU5USVRZIFV0aWxkZSAiJiN4MTY4OyI%2BPCFFTlRJVFkgdXRpbGRlICImI3gxNjk7Ij48IUVOVElUWSBVbWFjciAiJiN4MTZBOyI%2BPCFFTlRJVFkgdW1hY3IgIiYjeDE2QjsiPjwhRU5USVRZIFVicmV2ZSAiJiN4MTZDOyI%2BPCFFTlRJVFkgdWJyZXZlICImI3gxNkQ7Ij48IUVOVElUWSBVcmluZyAiJiN4MTZFOyI%2BPCFFTlRJVFkgdXJpbmcgIiYjeDE2RjsiPjwhRU5USVRZIFVkYmxhYyAiJiN4MTcwOyI%2BPCFFTlRJVFkgdWRibGFjICImI3gxNzE7Ij48IUVOVElUWSBVb2dvbiAiJiN4MTcyOyI%2BPCFFTlRJVFkgdW9nb24gIiYjeDE3MzsiPjwhRU5USVRZIFdjaXJjICImI3gxNzQ7Ij48IUVOVElUWSB3Y2lyYyAiJiN4MTc1OyI%2BPCFFTlRJVFkgWWNpcmMgIiYjeDE3NjsiPjwhRU5USVRZIHljaXJjICImI3gxNzc7Ij48IUVOVElUWSBZdW1sICImI3gxNzg7Ij48IUVOVElUWSBaYWN1dGUgIiYjeDE3OTsiPjwhRU5USVRZIHphY3V0ZSAiJiN4MTdBOyI%2BPCFFTlRJVFkgWmRvdCAiJiN4MTdCOyI%2BPCFFTlRJVFkgemRvdCAiJiN4MTdDOyI%2BPCFFTlRJVFkgWmNhcm9uICImI3gxN0Q7Ij48IUVOVElUWSB6Y2Fyb24gIiYjeDE3RTsiPjwhRU5USVRZIGZub2YgIiYjeDE5MjsiPjwhRU5USVRZIGltcGVkICImI3gxQjU7Ij48IUVOVElUWSBnYWN1dGUgIiYjeDFGNTsiPjwhRU5USVRZIGptYXRoICImI3gyMzc7Ij48IUVOVElUWSBjaXJjICImI3gyQzY7Ij48IUVOVElUWSBjYXJvbiAiJiN4MkM3OyI%2BPCFFTlRJVFkgSGFjZWsgIiYjeDJDNzsiPjwhRU5USVRZIGJyZXZlICImI3gyRDg7Ij48IUVOVElUWSBCcmV2ZSAiJiN4MkQ4OyI%2BPCFFTlRJVFkgZG90ICImI3gyRDk7Ij48IUVOVElUWSBEaWFjcml0aWNhbERvdCAiJiN4MkQ5OyI%2BPCFFTlRJVFkgcmluZyAiJiN4MkRBOyI%2BPCFFTlRJVFkgb2dvbiAiJiN4MkRCOyI%2BPCFFTlRJVFkgdGlsZGUgIiYjeDJEQzsiPjwhRU5USVRZIERpYWNyaXRpY2FsVGlsZGUgIiYjeDJEQzsiPjwhRU5USVRZIGRibGFjICImI3gyREQ7Ij48IUVOVElUWSBEaWFjcml0aWNhbERvdWJsZUFjdXRlICImI3gyREQ7Ij48IUVOVElUWSBEb3duQnJldmUgIiYjeDMxMTsiPjwhRU5USVRZIEFscGhhICImI3gzOTE7Ij48IUVOVElUWSBCZXRhICImI3gzOTI7Ij48IUVOVElUWSBHYW1tYSAiJiN4MzkzOyI%2BPCFFTlRJVFkgRGVsdGEgIiYjeDM5NDsiPjwhRU5USVRZIEVwc2lsb24gIiYjeDM5NTsiPjwhRU5USVRZIFpldGEgIiYjeDM5NjsiPjwhRU5USVRZIEV0YSAiJiN4Mzk3OyI%2BPCFFTlRJVFkgVGhldGEgIiYjeDM5ODsiPjwhRU5USVRZIElvdGEgIiYjeDM5OTsiPjwhRU5USVRZIEthcHBhICImI3gzOUE7Ij48IUVOVElUWSBMYW1iZGEgIiYjeDM5QjsiPjwhRU5USVRZIE11ICImI3gzOUM7Ij48IUVOVElUWSBOdSAiJiN4MzlEOyI%2BPCFFTlRJVFkgWGkgIiYjeDM5RTsiPjwhRU5USVRZIE9taWNyb24gIiYjeDM5RjsiPjwhRU5USVRZIFBpICImI3gzQTA7Ij48IUVOVElUWSBSaG8gIiYjeDNBMTsiPjwhRU5USVRZIFNpZ21hICImI3gzQTM7Ij48IUVOVElUWSBUYXUgIiYjeDNBNDsiPjwhRU5USVRZIFVwc2lsb24gIiYjeDNBNTsiPjwhRU5USVRZIFBoaSAiJiN4M0E2OyI%2BPCFFTlRJVFkgQ2hpICImI3gzQTc7Ij48IUVOVElUWSBQc2kgIiYjeDNBODsiPjwhRU5USVRZIE9tZWdhICImI3gzQTk7Ij48IUVOVElUWSBvaG0gIiYjeDNBOTsiPjwhRU5USVRZIGFscGhhICImI3gzQjE7Ij48IUVOVElUWSBiZXRhICImI3gzQjI7Ij48IUVOVElUWSBnYW1tYSAiJiN4M0IzOyI%2BPCFFTlRJVFkgZGVsdGEgIiYjeDNCNDsiPjwhRU5USVRZIGVwc2kgIiYjeDNCNTsiPjwhRU5USVRZIGVwc2lsb24gIiYjeDNCNTsiPjwhRU5USVRZIHpldGEgIiYjeDNCNjsiPjwhRU5USVRZIGV0YSAiJiN4M0I3OyI%2BPCFFTlRJVFkgdGhldGEgIiYjeDNCODsiPjwhRU5USVRZIGlvdGEgIiYjeDNCOTsiPjwhRU5USVRZIGthcHBhICImI3gzQkE7Ij48IUVOVElUWSBsYW1iZGEgIiYjeDNCQjsiPjwhRU5USVRZIG11ICImI3gzQkM7Ij48IUVOVElUWSBudSAiJiN4M0JEOyI%2BPCFFTlRJVFkgeGkgIiYjeDNCRTsiPjwhRU5USVRZIG9taWNyb24gIiYjeDNCRjsiPjwhRU5USVRZIHBpICImI3gzQzA7Ij48IUVOVElUWSByaG8gIiYjeDNDMTsiPjwhRU5USVRZIHNpZ21hdiAiJiN4M0MyOyI%2BPCFFTlRJVFkgdmFyc2lnbWEgIiYjeDNDMjsiPjwhRU5USVRZIHNpZ21hZiAiJiN4M0MyOyI%2BPCFFTlRJVFkgc2lnbWEgIiYjeDNDMzsiPjwhRU5USVRZIHRhdSAiJiN4M0M0OyI%2BPCFFTlRJVFkgdXBzaSAiJiN4M0M1OyI%2BPCFFTlRJVFkgdXBzaWxvbiAiJiN4M0M1OyI%2BPCFFTlRJVFkgcGhpICImI3gzQzY7Ij48IUVOVElUWSBjaGkgIiYjeDNDNzsiPjwhRU5USVRZIHBzaSAiJiN4M0M4OyI%2BPCFFTlRJVFkgb21lZ2EgIiYjeDNDOTsiPjwhRU5USVRZIHRoZXRhdiAiJiN4M0QxOyI%2BPCFFTlRJVFkgdmFydGhldGEgIiYjeDNEMTsiPjwhRU5USVRZIHRoZXRhc3ltICImI3gzRDE7Ij48IUVOVElUWSBVcHNpICImI3gzRDI7Ij48IUVOVElUWSB1cHNpaCAiJiN4M0QyOyI%2BPCFFTlRJVFkgc3RyYWlnaHRwaGkgIiYjeDNENTsiPjwhRU5USVRZIHBoaXYgIiYjeDNENTsiPjwhRU5USVRZIHZhcnBoaSAiJiN4M0Q1OyI%2BPCFFTlRJVFkgcGl2ICImI3gzRDY7Ij48IUVOVElUWSB2YXJwaSAiJiN4M0Q2OyI%2BPCFFTlRJVFkgR2FtbWFkICImI3gzREM7Ij48IUVOVElUWSBnYW1tYWQgIiYjeDNERDsiPjwhRU5USVRZIGRpZ2FtbWEgIiYjeDNERDsiPjwhRU5USVRZIGthcHBhdiAiJiN4M0YwOyI%2BPCFFTlRJVFkgdmFya2FwcGEgIiYjeDNGMDsiPjwhRU5USVRZIHJob3YgIiYjeDNGMTsiPjwhRU5USVRZIHZhcnJobyAiJiN4M0YxOyI%2BPCFFTlRJVFkgZXBzaXYgIiYjeDNGNTsiPjwhRU5USVRZIHN0cmFpZ2h0ZXBzaWxvbiAiJiN4M0Y1OyI%2BPCFFTlRJVFkgdmFyZXBzaWxvbiAiJiN4M0Y1OyI%2BPCFFTlRJVFkgYmVwc2kgIiYjeDNGNjsiPjwhRU5USVRZIGJhY2tlcHNpbG9uICImI3gzRjY7Ij48IUVOVElUWSBJT2N5ICImI3g0MDE7Ij48IUVOVElUWSBESmN5ICImI3g0MDI7Ij48IUVOVElUWSBHSmN5ICImI3g0MDM7Ij48IUVOVElUWSBKdWtjeSAiJiN4NDA0OyI%2BPCFFTlRJVFkgRFNjeSAiJiN4NDA1OyI%2BPCFFTlRJVFkgSXVrY3kgIiYjeDQwNjsiPjwhRU5USVRZIFlJY3kgIiYjeDQwNzsiPjwhRU5USVRZIEpzZXJjeSAiJiN4NDA4OyI%2BPCFFTlRJVFkgTEpjeSAiJiN4NDA5OyI%2BPCFFTlRJVFkgTkpjeSAiJiN4NDBBOyI%2BPCFFTlRJVFkgVFNIY3kgIiYjeDQwQjsiPjwhRU5USVRZIEtKY3kgIiYjeDQwQzsiPjwhRU5USVRZIFVicmN5ICImI3g0MEU7Ij48IUVOVElUWSBEWmN5ICImI3g0MEY7Ij48IUVOVElUWSBBY3kgIiYjeDQxMDsiPjwhRU5USVRZIEJjeSAiJiN4NDExOyI%2BPCFFTlRJVFkgVmN5ICImI3g0MTI7Ij48IUVOVElUWSBHY3kgIiYjeDQxMzsiPjwhRU5USVRZIERjeSAiJiN4NDE0OyI%2BPCFFTlRJVFkgSUVjeSAiJiN4NDE1OyI%2BPCFFTlRJVFkgWkhjeSAiJiN4NDE2OyI%2BPCFFTlRJVFkgWmN5ICImI3g0MTc7Ij48IUVOVElUWSBJY3kgIiYjeDQxODsiPjwhRU5USVRZIEpjeSAiJiN4NDE5OyI%2BPCFFTlRJVFkgS2N5ICImI3g0MUE7Ij48IUVOVElUWSBMY3kgIiYjeDQxQjsiPjwhRU5USVRZIE1jeSAiJiN4NDFDOyI%2BPCFFTlRJVFkgTmN5ICImI3g0MUQ7Ij48IUVOVElUWSBPY3kgIiYjeDQxRTsiPjwhRU5USVRZIFBjeSAiJiN4NDFGOyI%2BPCFFTlRJVFkgUmN5ICImI3g0MjA7Ij48IUVOVElUWSBTY3kgIiYjeDQyMTsiPjwhRU5USVRZIFRjeSAiJiN4NDIyOyI%2BPCFFTlRJVFkgVWN5ICImI3g0MjM7Ij48IUVOVElUWSBGY3kgIiYjeDQyNDsiPjwhRU5USVRZIEtIY3kgIiYjeDQyNTsiPjwhRU5USVRZIFRTY3kgIiYjeDQyNjsiPjwhRU5USVRZIENIY3kgIiYjeDQyNzsiPjwhRU5USVRZIFNIY3kgIiYjeDQyODsiPjwhRU5USVRZIFNIQ0hjeSAiJiN4NDI5OyI%2BPCFFTlRJVFkgSEFSRGN5ICImI3g0MkE7Ij48IUVOVElUWSBZY3kgIiYjeDQyQjsiPjwhRU5USVRZIFNPRlRjeSAiJiN4NDJDOyI%2BPCFFTlRJVFkgRWN5ICImI3g0MkQ7Ij48IUVOVElUWSBZVWN5ICImI3g0MkU7Ij48IUVOVElUWSBZQWN5ICImI3g0MkY7Ij48IUVOVElUWSBhY3kgIiYjeDQzMDsiPjwhRU5USVRZIGJjeSAiJiN4NDMxOyI%2BPCFFTlRJVFkgdmN5ICImI3g0MzI7Ij48IUVOVElUWSBnY3kgIiYjeDQzMzsiPjwhRU5USVRZIGRjeSAiJiN4NDM0OyI%2BPCFFTlRJVFkgaWVjeSAiJiN4NDM1OyI%2BPCFFTlRJVFkgemhjeSAiJiN4NDM2OyI%2BPCFFTlRJVFkgemN5ICImI3g0Mzc7Ij48IUVOVElUWSBpY3kgIiYjeDQzODsiPjwhRU5USVRZIGpjeSAiJiN4NDM5OyI%2BPCFFTlRJVFkga2N5ICImI3g0M0E7Ij48IUVOVElUWSBsY3kgIiYjeDQzQjsiPjwhRU5USVRZIG1jeSAiJiN4NDNDOyI%2BPCFFTlRJVFkgbmN5ICImI3g0M0Q7Ij48IUVOVElUWSBvY3kgIiYjeDQzRTsiPjwhRU5USVRZIHBjeSAiJiN4NDNGOyI%2BPCFFTlRJVFkgcmN5ICImI3g0NDA7Ij48IUVOVElUWSBzY3kgIiYjeDQ0MTsiPjwhRU5USVRZIHRjeSAiJiN4NDQyOyI%2BPCFFTlRJVFkgdWN5ICImI3g0NDM7Ij48IUVOVElUWSBmY3kgIiYjeDQ0NDsiPjwhRU5USVRZIGtoY3kgIiYjeDQ0NTsiPjwhRU5USVRZIHRzY3kgIiYjeDQ0NjsiPjwhRU5USVRZIGNoY3kgIiYjeDQ0NzsiPjwhRU5USVRZIHNoY3kgIiYjeDQ0ODsiPjwhRU5USVRZIHNoY2hjeSAiJiN4NDQ5OyI%2BPCFFTlRJVFkgaGFyZGN5ICImI3g0NEE7Ij48IUVOVElUWSB5Y3kgIiYjeDQ0QjsiPjwhRU5USVRZIHNvZnRjeSAiJiN4NDRDOyI%2BPCFFTlRJVFkgZWN5ICImI3g0NEQ7Ij48IUVOVElUWSB5dWN5ICImI3g0NEU7Ij48IUVOVElUWSB5YWN5ICImI3g0NEY7Ij48IUVOVElUWSBpb2N5ICImI3g0NTE7Ij48IUVOVElUWSBkamN5ICImI3g0NTI7Ij48IUVOVElUWSBnamN5ICImI3g0NTM7Ij48IUVOVElUWSBqdWtjeSAiJiN4NDU0OyI%2BPCFFTlRJVFkgZHNjeSAiJiN4NDU1OyI%2BPCFFTlRJVFkgaXVrY3kgIiYjeDQ1NjsiPjwhRU5USVRZIHlpY3kgIiYjeDQ1NzsiPjwhRU5USVRZIGpzZXJjeSAiJiN4NDU4OyI%2BPCFFTlRJVFkgbGpjeSAiJiN4NDU5OyI%2BPCFFTlRJVFkgbmpjeSAiJiN4NDVBOyI%2BPCFFTlRJVFkgdHNoY3kgIiYjeDQ1QjsiPjwhRU5USVRZIGtqY3kgIiYjeDQ1QzsiPjwhRU5USVRZIHVicmN5ICImI3g0NUU7Ij48IUVOVElUWSBkemN5ICImI3g0NUY7Ij48IUVOVElUWSBlbnNwICImI3gyMDAyOyI%2BPCFFTlRJVFkgZW1zcCAiJiN4MjAwMzsiPjwhRU5USVRZIGVtc3AxMyAiJiN4MjAwNDsiPjwhRU5USVRZIGVtc3AxNCAiJiN4MjAwNTsiPjwhRU5USVRZIG51bXNwICImI3gyMDA3OyI%2BPCFFTlRJVFkgcHVuY3NwICImI3gyMDA4OyI%2BPCFFTlRJVFkgdGhpbnNwICImI3gyMDA5OyI%2BPCFFTlRJVFkgVGhpblNwYWNlICImI3gyMDA5OyI%2BPCFFTlRJVFkgaGFpcnNwICImI3gyMDBBOyI%2BPCFFTlRJVFkgVmVyeVRoaW5TcGFjZSAiJiN4MjAwQTsiPjwhRU5USVRZIFplcm9XaWR0aFNwYWNlICImI3gyMDBCOyI%2BPCFFTlRJVFkgTmVnYXRpdmVWZXJ5VGhpblNwYWNlICImI3gyMDBCOyI%2BPCFFTlRJVFkgTmVnYXRpdmVUaGluU3BhY2UgIiYjeDIwMEI7Ij48IUVOVElUWSBOZWdhdGl2ZU1lZGl1bVNwYWNlICImI3gyMDBCOyI%2BPCFFTlRJVFkgTmVnYXRpdmVUaGlja1NwYWNlICImI3gyMDBCOyI%2BPCFFTlRJVFkgenduaiAiJiN4MjAwQzsiPjwhRU5USVRZIHp3aiAiJiN4MjAwRDsiPjwhRU5USVRZIGxybSAiJiN4MjAwRTsiPjwhRU5USVRZIHJsbSAiJiN4MjAwRjsiPjwhRU5USVRZIGh5cGhlbiAiJiN4MjAxMDsiPjwhRU5USVRZIGRhc2ggIiYjeDIwMTA7Ij48IUVOVElUWSBuZGFzaCAiJiN4MjAxMzsiPjwhRU5USVRZIG1kYXNoICImI3gyMDE0OyI%2BPCFFTlRJVFkgaG9yYmFyICImI3gyMDE1OyI%2BPCFFTlRJVFkgVmVyYmFyICImI3gyMDE2OyI%2BPCFFTlRJVFkgVmVydCAiJiN4MjAxNjsiPjwhRU5USVRZIGxzcXVvICImI3gyMDE4OyI%2BPCFFTlRJVFkgT3BlbkN1cmx5UXVvdGUgIiYjeDIwMTg7Ij48IUVOVElUWSByc3F1byAiJiN4MjAxOTsiPjwhRU5USVRZIHJzcXVvciAiJiN4MjAxOTsiPjwhRU5USVRZIENsb3NlQ3VybHlRdW90ZSAiJiN4MjAxOTsiPjwhRU5USVRZIGxzcXVvciAiJiN4MjAxQTsiPjwhRU5USVRZIHNicXVvICImI3gyMDFBOyI%2BPCFFTlRJVFkgbGRxdW8gIiYjeDIwMUM7Ij48IUVOVElUWSBPcGVuQ3VybHlEb3VibGVRdW90ZSAiJiN4MjAxQzsiPjwhRU5USVRZIHJkcXVvICImI3gyMDFEOyI%2BPCFFTlRJVFkgcmRxdW9yICImI3gyMDFEOyI%2BPCFFTlRJVFkgQ2xvc2VDdXJseURvdWJsZVF1b3RlICImI3gyMDFEOyI%2BPCFFTlRJVFkgbGRxdW9yICImI3gyMDFFOyI%2BPCFFTlRJVFkgYmRxdW8gIiYjeDIwMUU7Ij48IUVOVElUWSBkYWdnZXIgIiYjeDIwMjA7Ij48IUVOVElUWSBEYWdnZXIgIiYjeDIwMjE7Ij48IUVOVElUWSBkZGFnZ2VyICImI3gyMDIxOyI%2BPCFFTlRJVFkgYnVsbCAiJiN4MjAyMjsiPjwhRU5USVRZIGJ1bGxldCAiJiN4MjAyMjsiPjwhRU5USVRZIG5sZHIgIiYjeDIwMjU7Ij48IUVOVElUWSBoZWxsaXAgIiYjeDIwMjY7Ij48IUVOVElUWSBtbGRyICImI3gyMDI2OyI%2BPCFFTlRJVFkgcGVybWlsICImI3gyMDMwOyI%2BPCFFTlRJVFkgcGVydGVuayAiJiN4MjAzMTsiPjwhRU5USVRZIHByaW1lICImI3gyMDMyOyI%2BPCFFTlRJVFkgUHJpbWUgIiYjeDIwMzM7Ij48IUVOVElUWSB0cHJpbWUgIiYjeDIwMzQ7Ij48IUVOVElUWSBicHJpbWUgIiYjeDIwMzU7Ij48IUVOVElUWSBiYWNrcHJpbWUgIiYjeDIwMzU7Ij48IUVOVElUWSBsc2FxdW8gIiYjeDIwMzk7Ij48IUVOVElUWSByc2FxdW8gIiYjeDIwM0E7Ij48IUVOVElUWSBvbGluZSAiJiN4MjAzRTsiPjwhRU5USVRZIE92ZXJCYXIgIiYjeDIwM0U7Ij48IUVOVElUWSBjYXJldCAiJiN4MjA0MTsiPjwhRU5USVRZIGh5YnVsbCAiJiN4MjA0MzsiPjwhRU5USVRZIGZyYXNsICImI3gyMDQ0OyI%2BPCFFTlRJVFkgYnNlbWkgIiYjeDIwNEY7Ij48IUVOVElUWSBxcHJpbWUgIiYjeDIwNTc7Ij48IUVOVElUWSBNZWRpdW1TcGFjZSAiJiN4MjA1RjsiPjwhRU5USVRZIFRoaWNrU3BhY2UgIiYjeDIwNUY7JiN4MjAwQTsiPjwhRU5USVRZIE5vQnJlYWsgIiYjeDIwNjA7Ij48IUVOVElUWSBBcHBseUZ1bmN0aW9uICImI3gyMDYxOyI%2BPCFFTlRJVFkgYWYgIiYjeDIwNjE7Ij48IUVOVElUWSBJbnZpc2libGVUaW1lcyAiJiN4MjA2MjsiPjwhRU5USVRZIGl0ICImI3gyMDYyOyI%2BPCFFTlRJVFkgSW52aXNpYmxlQ29tbWEgIiYjeDIwNjM7Ij48IUVOVElUWSBpYyAiJiN4MjA2MzsiPjwhRU5USVRZIGV1cm8gIiYjeDIwQUM7Ij48IUVOVElUWSB0ZG90ICImI3gyMERCOyI%2BPCFFTlRJVFkgVHJpcGxlRG90ICImI3gyMERCOyI%2BPCFFTlRJVFkgRG90RG90ICImI3gyMERDOyI%2BPCFFTlRJVFkgQ29wZiAiJiN4MjEwMjsiPjwhRU5USVRZIGNvbXBsZXhlcyAiJiN4MjEwMjsiPjwhRU5USVRZIGluY2FyZSAiJiN4MjEwNTsiPjwhRU5USVRZIGdzY3IgIiYjeDIxMEE7Ij48IUVOVElUWSBoYW1pbHQgIiYjeDIxMEI7Ij48IUVOVElUWSBIaWxiZXJ0U3BhY2UgIiYjeDIxMEI7Ij48IUVOVElUWSBIc2NyICImI3gyMTBCOyI%2BPCFFTlRJVFkgSGZyICImI3gyMTBDOyI%2BPCFFTlRJVFkgUG9pbmNhcmVwbGFuZSAiJiN4MjEwQzsiPjwhRU5USVRZIHF1YXRlcm5pb25zICImI3gyMTBEOyI%2BPCFFTlRJVFkgSG9wZiAiJiN4MjEwRDsiPjwhRU5USVRZIHBsYW5ja2ggIiYjeDIxMEU7Ij48IUVOVElUWSBwbGFuY2sgIiYjeDIxMEY7Ij48IUVOVElUWSBoYmFyICImI3gyMTBGOyI%2BPCFFTlRJVFkgcGxhbmt2ICImI3gyMTBGOyI%2BPCFFTlRJVFkgaHNsYXNoICImI3gyMTBGOyI%2BPCFFTlRJVFkgSXNjciAiJiN4MjExMDsiPjwhRU5USVRZIGltYWdsaW5lICImI3gyMTEwOyI%2BPCFFTlRJVFkgaW1hZ2UgIiYjeDIxMTE7Ij48IUVOVElUWSBJbSAiJiN4MjExMTsiPjwhRU5USVRZIGltYWdwYXJ0ICImI3gyMTExOyI%2BPCFFTlRJVFkgSWZyICImI3gyMTExOyI%2BPCFFTlRJVFkgTHNjciAiJiN4MjExMjsiPjwhRU5USVRZIGxhZ3JhbiAiJiN4MjExMjsiPjwhRU5USVRZIExhcGxhY2V0cmYgIiYjeDIxMTI7Ij48IUVOVElUWSBlbGwgIiYjeDIxMTM7Ij48IUVOVElUWSBOb3BmICImI3gyMTE1OyI%2BPCFFTlRJVFkgbmF0dXJhbHMgIiYjeDIxMTU7Ij48IUVOVElUWSBudW1lcm8gIiYjeDIxMTY7Ij48IUVOVElUWSBjb3B5c3IgIiYjeDIxMTc7Ij48IUVOVElUWSB3ZWllcnAgIiYjeDIxMTg7Ij48IUVOVElUWSB3cCAiJiN4MjExODsiPjwhRU5USVRZIFBvcGYgIiYjeDIxMTk7Ij48IUVOVElUWSBwcmltZXMgIiYjeDIxMTk7Ij48IUVOVElUWSByYXRpb25hbHMgIiYjeDIxMUE7Ij48IUVOVElUWSBRb3BmICImI3gyMTFBOyI%2BPCFFTlRJVFkgUnNjciAiJiN4MjExQjsiPjwhRU5USVRZIHJlYWxpbmUgIiYjeDIxMUI7Ij48IUVOVElUWSByZWFsICImI3gyMTFDOyI%2BPCFFTlRJVFkgUmUgIiYjeDIxMUM7Ij48IUVOVElUWSByZWFscGFydCAiJiN4MjExQzsiPjwhRU5USVRZIFJmciAiJiN4MjExQzsiPjwhRU5USVRZIHJlYWxzICImI3gyMTFEOyI%2BPCFFTlRJVFkgUm9wZiAiJiN4MjExRDsiPjwhRU5USVRZIHJ4ICImI3gyMTFFOyI%2BPCFFTlRJVFkgdHJhZGUgIiYjeDIxMjI7Ij48IUVOVElUWSBUUkFERSAiJiN4MjEyMjsiPjwhRU5USVRZIGludGVnZXJzICImI3gyMTI0OyI%2BPCFFTlRJVFkgWm9wZiAiJiN4MjEyNDsiPjwhRU5USVRZIG1obyAiJiN4MjEyNzsiPjwhRU5USVRZIFpmciAiJiN4MjEyODsiPjwhRU5USVRZIHplZXRyZiAiJiN4MjEyODsiPjwhRU5USVRZIGlpb3RhICImI3gyMTI5OyI%2BPCFFTlRJVFkgYmVybm91ICImI3gyMTJDOyI%2BPCFFTlRJVFkgQmVybm91bGxpcyAiJiN4MjEyQzsiPjwhRU5USVRZIEJzY3IgIiYjeDIxMkM7Ij48IUVOVElUWSBDZnIgIiYjeDIxMkQ7Ij48IUVOVElUWSBDYXlsZXlzICImI3gyMTJEOyI%2BPCFFTlRJVFkgZXNjciAiJiN4MjEyRjsiPjwhRU5USVRZIEVzY3IgIiYjeDIxMzA7Ij48IUVOVElUWSBleHBlY3RhdGlvbiAiJiN4MjEzMDsiPjwhRU5USVRZIEZzY3IgIiYjeDIxMzE7Ij48IUVOVElUWSBGb3VyaWVydHJmICImI3gyMTMxOyI%2BPCFFTlRJVFkgcGhtbWF0ICImI3gyMTMzOyI%2BPCFFTlRJVFkgTWVsbGludHJmICImI3gyMTMzOyI%2BPCFFTlRJVFkgTXNjciAiJiN4MjEzMzsiPjwhRU5USVRZIG9yZGVyICImI3gyMTM0OyI%2BPCFFTlRJVFkgb3JkZXJvZiAiJiN4MjEzNDsiPjwhRU5USVRZIG9zY3IgIiYjeDIxMzQ7Ij48IUVOVElUWSBhbGVmc3ltICImI3gyMTM1OyI%2BPCFFTlRJVFkgYWxlcGggIiYjeDIxMzU7Ij48IUVOVElUWSBiZXRoICImI3gyMTM2OyI%2BPCFFTlRJVFkgZ2ltZWwgIiYjeDIxMzc7Ij48IUVOVElUWSBkYWxldGggIiYjeDIxMzg7Ij48IUVOVElUWSBDYXBpdGFsRGlmZmVyZW50aWFsRCAiJiN4MjE0NTsiPjwhRU5USVRZIEREICImI3gyMTQ1OyI%2BPCFFTlRJVFkgRGlmZmVyZW50aWFsRCAiJiN4MjE0NjsiPjwhRU5USVRZIGRkICImI3gyMTQ2OyI%2BPCFFTlRJVFkgRXhwb25lbnRpYWxFICImI3gyMTQ3OyI%2BPCFFTlRJVFkgZXhwb25lbnRpYWxlICImI3gyMTQ3OyI%2BPCFFTlRJVFkgZWUgIiYjeDIxNDc7Ij48IUVOVElUWSBJbWFnaW5hcnlJICImI3gyMTQ4OyI%2BPCFFTlRJVFkgaWkgIiYjeDIxNDg7Ij48IUVOVElUWSBmcmFjMTMgIiYjeDIxNTM7Ij48IUVOVElUWSBmcmFjMjMgIiYjeDIxNTQ7Ij48IUVOVElUWSBmcmFjMTUgIiYjeDIxNTU7Ij48IUVOVElUWSBmcmFjMjUgIiYjeDIxNTY7Ij48IUVOVElUWSBmcmFjMzUgIiYjeDIxNTc7Ij48IUVOVElUWSBmcmFjNDUgIiYjeDIxNTg7Ij48IUVOVElUWSBmcmFjMTYgIiYjeDIxNTk7Ij48IUVOVElUWSBmcmFjNTYgIiYjeDIxNUE7Ij48IUVOVElUWSBmcmFjMTggIiYjeDIxNUI7Ij48IUVOVElUWSBmcmFjMzggIiYjeDIxNUM7Ij48IUVOVElUWSBmcmFjNTggIiYjeDIxNUQ7Ij48IUVOVElUWSBmcmFjNzggIiYjeDIxNUU7Ij48IUVOVElUWSBsYXJyICImI3gyMTkwOyI%2BPCFFTlRJVFkgbGVmdGFycm93ICImI3gyMTkwOyI%2BPCFFTlRJVFkgTGVmdEFycm93ICImI3gyMTkwOyI%2BPCFFTlRJVFkgc2xhcnIgIiYjeDIxOTA7Ij48IUVOVElUWSBTaG9ydExlZnRBcnJvdyAiJiN4MjE5MDsiPjwhRU5USVRZIHVhcnIgIiYjeDIxOTE7Ij48IUVOVElUWSB1cGFycm93ICImI3gyMTkxOyI%2BPCFFTlRJVFkgVXBBcnJvdyAiJiN4MjE5MTsiPjwhRU5USVRZIFNob3J0VXBBcnJvdyAiJiN4MjE5MTsiPjwhRU5USVRZIHJhcnIgIiYjeDIxOTI7Ij48IUVOVElUWSByaWdodGFycm93ICImI3gyMTkyOyI%2BPCFFTlRJVFkgUmlnaHRBcnJvdyAiJiN4MjE5MjsiPjwhRU5USVRZIHNyYXJyICImI3gyMTkyOyI%2BPCFFTlRJVFkgU2hvcnRSaWdodEFycm93ICImI3gyMTkyOyI%2BPCFFTlRJVFkgZGFyciAiJiN4MjE5MzsiPjwhRU5USVRZIGRvd25hcnJvdyAiJiN4MjE5MzsiPjwhRU5USVRZIERvd25BcnJvdyAiJiN4MjE5MzsiPjwhRU5USVRZIFNob3J0RG93bkFycm93ICImI3gyMTkzOyI%2BPCFFTlRJVFkgaGFyciAiJiN4MjE5NDsiPjwhRU5USVRZIGxlZnRyaWdodGFycm93ICImI3gyMTk0OyI%2BPCFFTlRJVFkgTGVmdFJpZ2h0QXJyb3cgIiYjeDIxOTQ7Ij48IUVOVElUWSB2YXJyICImI3gyMTk1OyI%2BPCFFTlRJVFkgdXBkb3duYXJyb3cgIiYjeDIxOTU7Ij48IUVOVElUWSBVcERvd25BcnJvdyAiJiN4MjE5NTsiPjwhRU5USVRZIG53YXJyICImI3gyMTk2OyI%2BPCFFTlRJVFkgVXBwZXJMZWZ0QXJyb3cgIiYjeDIxOTY7Ij48IUVOVElUWSBud2Fycm93ICImI3gyMTk2OyI%2BPCFFTlRJVFkgbmVhcnIgIiYjeDIxOTc7Ij48IUVOVElUWSBVcHBlclJpZ2h0QXJyb3cgIiYjeDIxOTc7Ij48IUVOVElUWSBuZWFycm93ICImI3gyMTk3OyI%2BPCFFTlRJVFkgc2VhcnIgIiYjeDIxOTg7Ij48IUVOVElUWSBzZWFycm93ICImI3gyMTk4OyI%2BPCFFTlRJVFkgTG93ZXJSaWdodEFycm93ICImI3gyMTk4OyI%2BPCFFTlRJVFkgc3dhcnIgIiYjeDIxOTk7Ij48IUVOVElUWSBzd2Fycm93ICImI3gyMTk5OyI%2BPCFFTlRJVFkgTG93ZXJMZWZ0QXJyb3cgIiYjeDIxOTk7Ij48IUVOVElUWSBubGFyciAiJiN4MjE5QTsiPjwhRU5USVRZIG5sZWZ0YXJyb3cgIiYjeDIxOUE7Ij48IUVOVElUWSBucmFyciAiJiN4MjE5QjsiPjwhRU5USVRZIG5yaWdodGFycm93ICImI3gyMTlCOyI%2BPCFFTlRJVFkgcmFycncgIiYjeDIxOUQ7Ij48IUVOVElUWSByaWdodHNxdWlnYXJyb3cgIiYjeDIxOUQ7Ij48IUVOVElUWSBucmFycncgIiYjeDIxOUQ7JiN4MzM4OyI%2BPCFFTlRJVFkgTGFyciAiJiN4MjE5RTsiPjwhRU5USVRZIHR3b2hlYWRsZWZ0YXJyb3cgIiYjeDIxOUU7Ij48IUVOVElUWSBVYXJyICImI3gyMTlGOyI%2BPCFFTlRJVFkgUmFyciAiJiN4MjFBMDsiPjwhRU5USVRZIHR3b2hlYWRyaWdodGFycm93ICImI3gyMUEwOyI%2BPCFFTlRJVFkgRGFyciAiJiN4MjFBMTsiPjwhRU5USVRZIGxhcnJ0bCAiJiN4MjFBMjsiPjwhRU5USVRZIGxlZnRhcnJvd3RhaWwgIiYjeDIxQTI7Ij48IUVOVElUWSByYXJydGwgIiYjeDIxQTM7Ij48IUVOVElUWSByaWdodGFycm93dGFpbCAiJiN4MjFBMzsiPjwhRU5USVRZIExlZnRUZWVBcnJvdyAiJiN4MjFBNDsiPjwhRU5USVRZIG1hcHN0b2xlZnQgIiYjeDIxQTQ7Ij48IUVOVElUWSBVcFRlZUFycm93ICImI3gyMUE1OyI%2BPCFFTlRJVFkgbWFwc3RvdXAgIiYjeDIxQTU7Ij48IUVOVElUWSBtYXAgIiYjeDIxQTY7Ij48IUVOVElUWSBSaWdodFRlZUFycm93ICImI3gyMUE2OyI%2BPCFFTlRJVFkgbWFwc3RvICImI3gyMUE2OyI%2BPCFFTlRJVFkgRG93blRlZUFycm93ICImI3gyMUE3OyI%2BPCFFTlRJVFkgbWFwc3RvZG93biAiJiN4MjFBNzsiPjwhRU5USVRZIGxhcnJoayAiJiN4MjFBOTsiPjwhRU5USVRZIGhvb2tsZWZ0YXJyb3cgIiYjeDIxQTk7Ij48IUVOVElUWSByYXJyaGsgIiYjeDIxQUE7Ij48IUVOVElUWSBob29rcmlnaHRhcnJvdyAiJiN4MjFBQTsiPjwhRU5USVRZIGxhcnJscCAiJiN4MjFBQjsiPjwhRU5USVRZIGxvb3BhcnJvd2xlZnQgIiYjeDIxQUI7Ij48IUVOVElUWSByYXJybHAgIiYjeDIxQUM7Ij48IUVOVElUWSBsb29wYXJyb3dyaWdodCAiJiN4MjFBQzsiPjwhRU5USVRZIGhhcnJ3ICImI3gyMUFEOyI%2BPCFFTlRJVFkgbGVmdHJpZ2h0c3F1aWdhcnJvdyAiJiN4MjFBRDsiPjwhRU5USVRZIG5oYXJyICImI3gyMUFFOyI%2BPCFFTlRJVFkgbmxlZnRyaWdodGFycm93ICImI3gyMUFFOyI%2BPCFFTlRJVFkgbHNoICImI3gyMUIwOyI%2BPCFFTlRJVFkgTHNoICImI3gyMUIwOyI%2BPCFFTlRJVFkgcnNoICImI3gyMUIxOyI%2BPCFFTlRJVFkgUnNoICImI3gyMUIxOyI%2BPCFFTlRJVFkgbGRzaCAiJiN4MjFCMjsiPjwhRU5USVRZIHJkc2ggIiYjeDIxQjM7Ij48IUVOVElUWSBjcmFyciAiJiN4MjFCNTsiPjwhRU5USVRZIGN1bGFyciAiJiN4MjFCNjsiPjwhRU5USVRZIGN1cnZlYXJyb3dsZWZ0ICImI3gyMUI2OyI%2BPCFFTlRJVFkgY3VyYXJyICImI3gyMUI3OyI%2BPCFFTlRJVFkgY3VydmVhcnJvd3JpZ2h0ICImI3gyMUI3OyI%2BPCFFTlRJVFkgb2xhcnIgIiYjeDIxQkE7Ij48IUVOVElUWSBjaXJjbGVhcnJvd2xlZnQgIiYjeDIxQkE7Ij48IUVOVElUWSBvcmFyciAiJiN4MjFCQjsiPjwhRU5USVRZIGNpcmNsZWFycm93cmlnaHQgIiYjeDIxQkI7Ij48IUVOVElUWSBsaGFydSAiJiN4MjFCQzsiPjwhRU5USVRZIExlZnRWZWN0b3IgIiYjeDIxQkM7Ij48IUVOVElUWSBsZWZ0aGFycG9vbnVwICImI3gyMUJDOyI%2BPCFFTlRJVFkgbGhhcmQgIiYjeDIxQkQ7Ij48IUVOVElUWSBsZWZ0aGFycG9vbmRvd24gIiYjeDIxQkQ7Ij48IUVOVElUWSBEb3duTGVmdFZlY3RvciAiJiN4MjFCRDsiPjwhRU5USVRZIHVoYXJyICImI3gyMUJFOyI%2BPCFFTlRJVFkgdXBoYXJwb29ucmlnaHQgIiYjeDIxQkU7Ij48IUVOVElUWSBSaWdodFVwVmVjdG9yICImI3gyMUJFOyI%2BPCFFTlRJVFkgdWhhcmwgIiYjeDIxQkY7Ij48IUVOVElUWSB1cGhhcnBvb25sZWZ0ICImI3gyMUJGOyI%2BPCFFTlRJVFkgTGVmdFVwVmVjdG9yICImI3gyMUJGOyI%2BPCFFTlRJVFkgcmhhcnUgIiYjeDIxQzA7Ij48IUVOVElUWSBSaWdodFZlY3RvciAiJiN4MjFDMDsiPjwhRU5USVRZIHJpZ2h0aGFycG9vbnVwICImI3gyMUMwOyI%2BPCFFTlRJVFkgcmhhcmQgIiYjeDIxQzE7Ij48IUVOVElUWSByaWdodGhhcnBvb25kb3duICImI3gyMUMxOyI%2BPCFFTlRJVFkgRG93blJpZ2h0VmVjdG9yICImI3gyMUMxOyI%2BPCFFTlRJVFkgZGhhcnIgIiYjeDIxQzI7Ij48IUVOVElUWSBSaWdodERvd25WZWN0b3IgIiYjeDIxQzI7Ij48IUVOVElUWSBkb3duaGFycG9vbnJpZ2h0ICImI3gyMUMyOyI%2BPCFFTlRJVFkgZGhhcmwgIiYjeDIxQzM7Ij48IUVOVElUWSBMZWZ0RG93blZlY3RvciAiJiN4MjFDMzsiPjwhRU5USVRZIGRvd25oYXJwb29ubGVmdCAiJiN4MjFDMzsiPjwhRU5USVRZIHJsYXJyICImI3gyMUM0OyI%2BPCFFTlRJVFkgcmlnaHRsZWZ0YXJyb3dzICImI3gyMUM0OyI%2BPCFFTlRJVFkgUmlnaHRBcnJvd0xlZnRBcnJvdyAiJiN4MjFDNDsiPjwhRU5USVRZIHVkYXJyICImI3gyMUM1OyI%2BPCFFTlRJVFkgVXBBcnJvd0Rvd25BcnJvdyAiJiN4MjFDNTsiPjwhRU5USVRZIGxyYXJyICImI3gyMUM2OyI%2BPCFFTlRJVFkgbGVmdHJpZ2h0YXJyb3dzICImI3gyMUM2OyI%2BPCFFTlRJVFkgTGVmdEFycm93UmlnaHRBcnJvdyAiJiN4MjFDNjsiPjwhRU5USVRZIGxsYXJyICImI3gyMUM3OyI%2BPCFFTlRJVFkgbGVmdGxlZnRhcnJvd3MgIiYjeDIxQzc7Ij48IUVOVElUWSB1dWFyciAiJiN4MjFDODsiPjwhRU5USVRZIHVwdXBhcnJvd3MgIiYjeDIxQzg7Ij48IUVOVElUWSBycmFyciAiJiN4MjFDOTsiPjwhRU5USVRZIHJpZ2h0cmlnaHRhcnJvd3MgIiYjeDIxQzk7Ij48IUVOVElUWSBkZGFyciAiJiN4MjFDQTsiPjwhRU5USVRZIGRvd25kb3duYXJyb3dzICImI3gyMUNBOyI%2BPCFFTlRJVFkgbHJoYXIgIiYjeDIxQ0I7Ij48IUVOVElUWSBSZXZlcnNlRXF1aWxpYnJpdW0gIiYjeDIxQ0I7Ij48IUVOVElUWSBsZWZ0cmlnaHRoYXJwb29ucyAiJiN4MjFDQjsiPjwhRU5USVRZIHJsaGFyICImI3gyMUNDOyI%2BPCFFTlRJVFkgcmlnaHRsZWZ0aGFycG9vbnMgIiYjeDIxQ0M7Ij48IUVOVElUWSBFcXVpbGlicml1bSAiJiN4MjFDQzsiPjwhRU5USVRZIG5sQXJyICImI3gyMUNEOyI%2BPCFFTlRJVFkgbkxlZnRhcnJvdyAiJiN4MjFDRDsiPjwhRU5USVRZIG5oQXJyICImI3gyMUNFOyI%2BPCFFTlRJVFkgbkxlZnRyaWdodGFycm93ICImI3gyMUNFOyI%2BPCFFTlRJVFkgbnJBcnIgIiYjeDIxQ0Y7Ij48IUVOVElUWSBuUmlnaHRhcnJvdyAiJiN4MjFDRjsiPjwhRU5USVRZIGxBcnIgIiYjeDIxRDA7Ij48IUVOVElUWSBMZWZ0YXJyb3cgIiYjeDIxRDA7Ij48IUVOVElUWSBEb3VibGVMZWZ0QXJyb3cgIiYjeDIxRDA7Ij48IUVOVElUWSB1QXJyICImI3gyMUQxOyI%2BPCFFTlRJVFkgVXBhcnJvdyAiJiN4MjFEMTsiPjwhRU5USVRZIERvdWJsZVVwQXJyb3cgIiYjeDIxRDE7Ij48IUVOVElUWSByQXJyICImI3gyMUQyOyI%2BPCFFTlRJVFkgUmlnaHRhcnJvdyAiJiN4MjFEMjsiPjwhRU5USVRZIEltcGxpZXMgIiYjeDIxRDI7Ij48IUVOVElUWSBEb3VibGVSaWdodEFycm93ICImI3gyMUQyOyI%2BPCFFTlRJVFkgZEFyciAiJiN4MjFEMzsiPjwhRU5USVRZIERvd25hcnJvdyAiJiN4MjFEMzsiPjwhRU5USVRZIERvdWJsZURvd25BcnJvdyAiJiN4MjFEMzsiPjwhRU5USVRZIGhBcnIgIiYjeDIxRDQ7Ij48IUVOVElUWSBMZWZ0cmlnaHRhcnJvdyAiJiN4MjFENDsiPjwhRU5USVRZIERvdWJsZUxlZnRSaWdodEFycm93ICImI3gyMUQ0OyI%2BPCFFTlRJVFkgaWZmICImI3gyMUQ0OyI%2BPCFFTlRJVFkgdkFyciAiJiN4MjFENTsiPjwhRU5USVRZIFVwZG93bmFycm93ICImI3gyMUQ1OyI%2BPCFFTlRJVFkgRG91YmxlVXBEb3duQXJyb3cgIiYjeDIxRDU7Ij48IUVOVElUWSBud0FyciAiJiN4MjFENjsiPjwhRU5USVRZIG5lQXJyICImI3gyMUQ3OyI%2BPCFFTlRJVFkgc2VBcnIgIiYjeDIxRDg7Ij48IUVOVElUWSBzd0FyciAiJiN4MjFEOTsiPjwhRU5USVRZIGxBYXJyICImI3gyMURBOyI%2BPCFFTlRJVFkgTGxlZnRhcnJvdyAiJiN4MjFEQTsiPjwhRU5USVRZIHJBYXJyICImI3gyMURCOyI%2BPCFFTlRJVFkgUnJpZ2h0YXJyb3cgIiYjeDIxREI7Ij48IUVOVElUWSB6aWdyYXJyICImI3gyMUREOyI%2BPCFFTlRJVFkgbGFycmIgIiYjeDIxRTQ7Ij48IUVOVElUWSBMZWZ0QXJyb3dCYXIgIiYjeDIxRTQ7Ij48IUVOVElUWSByYXJyYiAiJiN4MjFFNTsiPjwhRU5USVRZIFJpZ2h0QXJyb3dCYXIgIiYjeDIxRTU7Ij48IUVOVElUWSBkdWFyciAiJiN4MjFGNTsiPjwhRU5USVRZIERvd25BcnJvd1VwQXJyb3cgIiYjeDIxRjU7Ij48IUVOVElUWSBsb2FyciAiJiN4MjFGRDsiPjwhRU5USVRZIHJvYXJyICImI3gyMUZFOyI%2BPCFFTlRJVFkgaG9hcnIgIiYjeDIxRkY7Ij48IUVOVElUWSBmb3JhbGwgIiYjeDIyMDA7Ij48IUVOVElUWSBGb3JBbGwgIiYjeDIyMDA7Ij48IUVOVElUWSBjb21wICImI3gyMjAxOyI%2BPCFFTlRJVFkgY29tcGxlbWVudCAiJiN4MjIwMTsiPjwhRU5USVRZIHBhcnQgIiYjeDIyMDI7Ij48IUVOVElUWSBQYXJ0aWFsRCAiJiN4MjIwMjsiPjwhRU5USVRZIG5wYXJ0ICImI3gyMjAyOyYjeDMzODsiPjwhRU5USVRZIGV4aXN0ICImI3gyMjAzOyI%2BPCFFTlRJVFkgRXhpc3RzICImI3gyMjAzOyI%2BPCFFTlRJVFkgbmV4aXN0ICImI3gyMjA0OyI%2BPCFFTlRJVFkgTm90RXhpc3RzICImI3gyMjA0OyI%2BPCFFTlRJVFkgbmV4aXN0cyAiJiN4MjIwNDsiPjwhRU5USVRZIGVtcHR5ICImI3gyMjA1OyI%2BPCFFTlRJVFkgZW1wdHlzZXQgIiYjeDIyMDU7Ij48IUVOVElUWSBlbXB0eXYgIiYjeDIyMDU7Ij48IUVOVElUWSB2YXJub3RoaW5nICImI3gyMjA1OyI%2BPCFFTlRJVFkgbmFibGEgIiYjeDIyMDc7Ij48IUVOVElUWSBEZWwgIiYjeDIyMDc7Ij48IUVOVElUWSBpc2luICImI3gyMjA4OyI%2BPCFFTlRJVFkgaXNpbnYgIiYjeDIyMDg7Ij48IUVOVElUWSBFbGVtZW50ICImI3gyMjA4OyI%2BPCFFTlRJVFkgaW4gIiYjeDIyMDg7Ij48IUVOVElUWSBub3RpbiAiJiN4MjIwOTsiPjwhRU5USVRZIE5vdEVsZW1lbnQgIiYjeDIyMDk7Ij48IUVOVElUWSBub3RpbnZhICImI3gyMjA5OyI%2BPCFFTlRJVFkgbml2ICImI3gyMjBCOyI%2BPCFFTlRJVFkgUmV2ZXJzZUVsZW1lbnQgIiYjeDIyMEI7Ij48IUVOVElUWSBuaSAiJiN4MjIwQjsiPjwhRU5USVRZIFN1Y2hUaGF0ICImI3gyMjBCOyI%2BPCFFTlRJVFkgbm90bmkgIiYjeDIyMEM7Ij48IUVOVElUWSBub3RuaXZhICImI3gyMjBDOyI%2BPCFFTlRJVFkgTm90UmV2ZXJzZUVsZW1lbnQgIiYjeDIyMEM7Ij48IUVOVElUWSBwcm9kICImI3gyMjBGOyI%2BPCFFTlRJVFkgUHJvZHVjdCAiJiN4MjIwRjsiPjwhRU5USVRZIGNvcHJvZCAiJiN4MjIxMDsiPjwhRU5USVRZIENvcHJvZHVjdCAiJiN4MjIxMDsiPjwhRU5USVRZIHN1bSAiJiN4MjIxMTsiPjwhRU5USVRZIFN1bSAiJiN4MjIxMTsiPjwhRU5USVRZIG1pbnVzICImI3gyMjEyOyI%2BPCFFTlRJVFkgbW5wbHVzICImI3gyMjEzOyI%2BPCFFTlRJVFkgbXAgIiYjeDIyMTM7Ij48IUVOVElUWSBNaW51c1BsdXMgIiYjeDIyMTM7Ij48IUVOVElUWSBwbHVzZG8gIiYjeDIyMTQ7Ij48IUVOVElUWSBkb3RwbHVzICImI3gyMjE0OyI%2BPCFFTlRJVFkgc2V0bW4gIiYjeDIyMTY7Ij48IUVOVElUWSBzZXRtaW51cyAiJiN4MjIxNjsiPjwhRU5USVRZIEJhY2tzbGFzaCAiJiN4MjIxNjsiPjwhRU5USVRZIHNzZXRtbiAiJiN4MjIxNjsiPjwhRU5USVRZIHNtYWxsc2V0bWludXMgIiYjeDIyMTY7Ij48IUVOVElUWSBsb3dhc3QgIiYjeDIyMTc7Ij48IUVOVElUWSBjb21wZm4gIiYjeDIyMTg7Ij48IUVOVElUWSBTbWFsbENpcmNsZSAiJiN4MjIxODsiPjwhRU5USVRZIHJhZGljICImI3gyMjFBOyI%2BPCFFTlRJVFkgU3FydCAiJiN4MjIxQTsiPjwhRU5USVRZIHByb3AgIiYjeDIyMUQ7Ij48IUVOVElUWSBwcm9wdG8gIiYjeDIyMUQ7Ij48IUVOVElUWSBQcm9wb3J0aW9uYWwgIiYjeDIyMUQ7Ij48IUVOVElUWSB2cHJvcCAiJiN4MjIxRDsiPjwhRU5USVRZIHZhcnByb3B0byAiJiN4MjIxRDsiPjwhRU5USVRZIGluZmluICImI3gyMjFFOyI%2BPCFFTlRJVFkgYW5ncnQgIiYjeDIyMUY7Ij48IUVOVElUWSBhbmcgIiYjeDIyMjA7Ij48IUVOVElUWSBhbmdsZSAiJiN4MjIyMDsiPjwhRU5USVRZIG5hbmcgIiYjeDIyMjA7JiN4MjBEMjsiPjwhRU5USVRZIGFuZ21zZCAiJiN4MjIyMTsiPjwhRU5USVRZIG1lYXN1cmVkYW5nbGUgIiYjeDIyMjE7Ij48IUVOVElUWSBhbmdzcGggIiYjeDIyMjI7Ij48IUVOVElUWSBtaWQgIiYjeDIyMjM7Ij48IUVOVElUWSBWZXJ0aWNhbEJhciAiJiN4MjIyMzsiPjwhRU5USVRZIHNtaWQgIiYjeDIyMjM7Ij48IUVOVElUWSBzaG9ydG1pZCAiJiN4MjIyMzsiPjwhRU5USVRZIG5taWQgIiYjeDIyMjQ7Ij48IUVOVElUWSBOb3RWZXJ0aWNhbEJhciAiJiN4MjIyNDsiPjwhRU5USVRZIG5zbWlkICImI3gyMjI0OyI%2BPCFFTlRJVFkgbnNob3J0bWlkICImI3gyMjI0OyI%2BPCFFTlRJVFkgcGFyICImI3gyMjI1OyI%2BPCFFTlRJVFkgcGFyYWxsZWwgIiYjeDIyMjU7Ij48IUVOVElUWSBEb3VibGVWZXJ0aWNhbEJhciAiJiN4MjIyNTsiPjwhRU5USVRZIHNwYXIgIiYjeDIyMjU7Ij48IUVOVElUWSBzaG9ydHBhcmFsbGVsICImI3gyMjI1OyI%2BPCFFTlRJVFkgbnBhciAiJiN4MjIyNjsiPjwhRU5USVRZIG5wYXJhbGxlbCAiJiN4MjIyNjsiPjwhRU5USVRZIE5vdERvdWJsZVZlcnRpY2FsQmFyICImI3gyMjI2OyI%2BPCFFTlRJVFkgbnNwYXIgIiYjeDIyMjY7Ij48IUVOVElUWSBuc2hvcnRwYXJhbGxlbCAiJiN4MjIyNjsiPjwhRU5USVRZIGFuZCAiJiN4MjIyNzsiPjwhRU5USVRZIHdlZGdlICImI3gyMjI3OyI%2BPCFFTlRJVFkgb3IgIiYjeDIyMjg7Ij48IUVOVElUWSB2ZWUgIiYjeDIyMjg7Ij48IUVOVElUWSBjYXAgIiYjeDIyMjk7Ij48IUVOVElUWSBjYXBzICImI3gyMjI5OyYjeEZFMDA7Ij48IUVOVElUWSBjdXAgIiYjeDIyMkE7Ij48IUVOVElUWSBjdXBzICImI3gyMjJBOyYjeEZFMDA7Ij48IUVOVElUWSBpbnQgIiYjeDIyMkI7Ij48IUVOVElUWSBJbnRlZ3JhbCAiJiN4MjIyQjsiPjwhRU5USVRZIEludCAiJiN4MjIyQzsiPjwhRU5USVRZIHRpbnQgIiYjeDIyMkQ7Ij48IUVOVElUWSBpaWludCAiJiN4MjIyRDsiPjwhRU5USVRZIGNvbmludCAiJiN4MjIyRTsiPjwhRU5USVRZIG9pbnQgIiYjeDIyMkU7Ij48IUVOVElUWSBDb250b3VySW50ZWdyYWwgIiYjeDIyMkU7Ij48IUVOVElUWSBDb25pbnQgIiYjeDIyMkY7Ij48IUVOVElUWSBEb3VibGVDb250b3VySW50ZWdyYWwgIiYjeDIyMkY7Ij48IUVOVElUWSBDY29uaW50ICImI3gyMjMwOyI%2BPCFFTlRJVFkgY3dpbnQgIiYjeDIyMzE7Ij48IUVOVElUWSBjd2NvbmludCAiJiN4MjIzMjsiPjwhRU5USVRZIENsb2Nrd2lzZUNvbnRvdXJJbnRlZ3JhbCAiJiN4MjIzMjsiPjwhRU5USVRZIGF3Y29uaW50ICImI3gyMjMzOyI%2BPCFFTlRJVFkgQ291bnRlckNsb2Nrd2lzZUNvbnRvdXJJbnRlZ3JhbCAiJiN4MjIzMzsiPjwhRU5USVRZIHRoZXJlNCAiJiN4MjIzNDsiPjwhRU5USVRZIHRoZXJlZm9yZSAiJiN4MjIzNDsiPjwhRU5USVRZIFRoZXJlZm9yZSAiJiN4MjIzNDsiPjwhRU5USVRZIGJlY2F1cyAiJiN4MjIzNTsiPjwhRU5USVRZIGJlY2F1c2UgIiYjeDIyMzU7Ij48IUVOVElUWSBCZWNhdXNlICImI3gyMjM1OyI%2BPCFFTlRJVFkgcmF0aW8gIiYjeDIyMzY7Ij48IUVOVElUWSBDb2xvbiAiJiN4MjIzNzsiPjwhRU5USVRZIFByb3BvcnRpb24gIiYjeDIyMzc7Ij48IUVOVElUWSBtaW51c2QgIiYjeDIyMzg7Ij48IUVOVElUWSBkb3RtaW51cyAiJiN4MjIzODsiPjwhRU5USVRZIG1ERG90ICImI3gyMjNBOyI%2BPCFFTlRJVFkgaG9tdGh0ICImI3gyMjNCOyI%2BPCFFTlRJVFkgc2ltICImI3gyMjNDOyI%2BPCFFTlRJVFkgVGlsZGUgIiYjeDIyM0M7Ij48IUVOVElUWSB0aGtzaW0gIiYjeDIyM0M7Ij48IUVOVElUWSB0aGlja3NpbSAiJiN4MjIzQzsiPjwhRU5USVRZIG52c2ltICImI3gyMjNDOyYjeDIwRDI7Ij48IUVOVElUWSBic2ltICImI3gyMjNEOyI%2BPCFFTlRJVFkgYmFja3NpbSAiJiN4MjIzRDsiPjwhRU5USVRZIHJhY2UgIiYjeDIyM0Q7JiN4MzMxOyI%2BPCFFTlRJVFkgYWMgIiYjeDIyM0U7Ij48IUVOVElUWSBtc3Rwb3MgIiYjeDIyM0U7Ij48IUVOVElUWSBhY0UgIiYjeDIyM0U7JiN4MzMzOyI%2BPCFFTlRJVFkgYWNkICImI3gyMjNGOyI%2BPCFFTlRJVFkgd3JlYXRoICImI3gyMjQwOyI%2BPCFFTlRJVFkgVmVydGljYWxUaWxkZSAiJiN4MjI0MDsiPjwhRU5USVRZIHdyICImI3gyMjQwOyI%2BPCFFTlRJVFkgbnNpbSAiJiN4MjI0MTsiPjwhRU5USVRZIE5vdFRpbGRlICImI3gyMjQxOyI%2BPCFFTlRJVFkgZXNpbSAiJiN4MjI0MjsiPjwhRU5USVRZIEVxdWFsVGlsZGUgIiYjeDIyNDI7Ij48IUVOVElUWSBlcXNpbSAiJiN4MjI0MjsiPjwhRU5USVRZIE5vdEVxdWFsVGlsZGUgIiYjeDIyNDI7JiN4MzM4OyI%2BPCFFTlRJVFkgbmVzaW0gIiYjeDIyNDI7JiN4MzM4OyI%2BPCFFTlRJVFkgc2ltZSAiJiN4MjI0MzsiPjwhRU5USVRZIFRpbGRlRXF1YWwgIiYjeDIyNDM7Ij48IUVOVElUWSBzaW1lcSAiJiN4MjI0MzsiPjwhRU5USVRZIG5zaW1lICImI3gyMjQ0OyI%2BPCFFTlRJVFkgbnNpbWVxICImI3gyMjQ0OyI%2BPCFFTlRJVFkgTm90VGlsZGVFcXVhbCAiJiN4MjI0NDsiPjwhRU5USVRZIGNvbmcgIiYjeDIyNDU7Ij48IUVOVElUWSBUaWxkZUZ1bGxFcXVhbCAiJiN4MjI0NTsiPjwhRU5USVRZIHNpbW5lICImI3gyMjQ2OyI%2BPCFFTlRJVFkgbmNvbmcgIiYjeDIyNDc7Ij48IUVOVElUWSBOb3RUaWxkZUZ1bGxFcXVhbCAiJiN4MjI0NzsiPjwhRU5USVRZIGFzeW1wICImI3gyMjQ4OyI%2BPCFFTlRJVFkgYXAgIiYjeDIyNDg7Ij48IUVOVElUWSBUaWxkZVRpbGRlICImI3gyMjQ4OyI%2BPCFFTlRJVFkgYXBwcm94ICImI3gyMjQ4OyI%2BPCFFTlRJVFkgdGhrYXAgIiYjeDIyNDg7Ij48IUVOVElUWSB0aGlja2FwcHJveCAiJiN4MjI0ODsiPjwhRU5USVRZIG5hcCAiJiN4MjI0OTsiPjwhRU5USVRZIE5vdFRpbGRlVGlsZGUgIiYjeDIyNDk7Ij48IUVOVElUWSBuYXBwcm94ICImI3gyMjQ5OyI%2BPCFFTlRJVFkgYXBlICImI3gyMjRBOyI%2BPCFFTlRJVFkgYXBwcm94ZXEgIiYjeDIyNEE7Ij48IUVOVElUWSBhcGlkICImI3gyMjRCOyI%2BPCFFTlRJVFkgbmFwaWQgIiYjeDIyNEI7JiN4MzM4OyI%2BPCFFTlRJVFkgYmNvbmcgIiYjeDIyNEM7Ij48IUVOVElUWSBiYWNrY29uZyAiJiN4MjI0QzsiPjwhRU5USVRZIGFzeW1wZXEgIiYjeDIyNEQ7Ij48IUVOVElUWSBDdXBDYXAgIiYjeDIyNEQ7Ij48IUVOVElUWSBudmFwICImI3gyMjREOyYjeDIwRDI7Ij48IUVOVElUWSBidW1wICImI3gyMjRFOyI%2BPCFFTlRJVFkgSHVtcERvd25IdW1wICImI3gyMjRFOyI%2BPCFFTlRJVFkgQnVtcGVxICImI3gyMjRFOyI%2BPCFFTlRJVFkgTm90SHVtcERvd25IdW1wICImI3gyMjRFOyYjeDMzODsiPjwhRU5USVRZIG5idW1wICImI3gyMjRFOyYjeDMzODsiPjwhRU5USVRZIGJ1bXBlICImI3gyMjRGOyI%2BPCFFTlRJVFkgSHVtcEVxdWFsICImI3gyMjRGOyI%2BPCFFTlRJVFkgYnVtcGVxICImI3gyMjRGOyI%2BPCFFTlRJVFkgbmJ1bXBlICImI3gyMjRGOyYjeDMzODsiPjwhRU5USVRZIE5vdEh1bXBFcXVhbCAiJiN4MjI0RjsmI3gzMzg7Ij48IUVOVElUWSBlc2RvdCAiJiN4MjI1MDsiPjwhRU5USVRZIERvdEVxdWFsICImI3gyMjUwOyI%2BPCFFTlRJVFkgZG90ZXEgIiYjeDIyNTA7Ij48IUVOVElUWSBuZWRvdCAiJiN4MjI1MDsmI3gzMzg7Ij48IUVOVElUWSBlRG90ICImI3gyMjUxOyI%2BPCFFTlRJVFkgZG90ZXFkb3QgIiYjeDIyNTE7Ij48IUVOVElUWSBlZkRvdCAiJiN4MjI1MjsiPjwhRU5USVRZIGZhbGxpbmdkb3RzZXEgIiYjeDIyNTI7Ij48IUVOVElUWSBlckRvdCAiJiN4MjI1MzsiPjwhRU5USVRZIHJpc2luZ2RvdHNlcSAiJiN4MjI1MzsiPjwhRU5USVRZIGNvbG9uZSAiJiN4MjI1NDsiPjwhRU5USVRZIGNvbG9uZXEgIiYjeDIyNTQ7Ij48IUVOVElUWSBBc3NpZ24gIiYjeDIyNTQ7Ij48IUVOVElUWSBlY29sb24gIiYjeDIyNTU7Ij48IUVOVElUWSBlcWNvbG9uICImI3gyMjU1OyI%2BPCFFTlRJVFkgZWNpciAiJiN4MjI1NjsiPjwhRU5USVRZIGVxY2lyYyAiJiN4MjI1NjsiPjwhRU5USVRZIGNpcmUgIiYjeDIyNTc7Ij48IUVOVElUWSBjaXJjZXEgIiYjeDIyNTc7Ij48IUVOVElUWSB3ZWRnZXEgIiYjeDIyNTk7Ij48IUVOVElUWSB2ZWVlcSAiJiN4MjI1QTsiPjwhRU5USVRZIHRyaWUgIiYjeDIyNUM7Ij48IUVOVElUWSB0cmlhbmdsZXEgIiYjeDIyNUM7Ij48IUVOVElUWSBlcXVlc3QgIiYjeDIyNUY7Ij48IUVOVElUWSBxdWVzdGVxICImI3gyMjVGOyI%2BPCFFTlRJVFkgbmUgIiYjeDIyNjA7Ij48IUVOVElUWSBOb3RFcXVhbCAiJiN4MjI2MDsiPjwhRU5USVRZIGVxdWl2ICImI3gyMjYxOyI%2BPCFFTlRJVFkgQ29uZ3J1ZW50ICImI3gyMjYxOyI%2BPCFFTlRJVFkgYm5lcXVpdiAiJiN4MjI2MTsmI3gyMEU1OyI%2BPCFFTlRJVFkgbmVxdWl2ICImI3gyMjYyOyI%2BPCFFTlRJVFkgTm90Q29uZ3J1ZW50ICImI3gyMjYyOyI%2BPCFFTlRJVFkgbGUgIiYjeDIyNjQ7Ij48IUVOVElUWSBsZXEgIiYjeDIyNjQ7Ij48IUVOVElUWSBudmxlICImI3gyMjY0OyYjeDIwRDI7Ij48IUVOVElUWSBnZSAiJiN4MjI2NTsiPjwhRU5USVRZIEdyZWF0ZXJFcXVhbCAiJiN4MjI2NTsiPjwhRU5USVRZIGdlcSAiJiN4MjI2NTsiPjwhRU5USVRZIG52Z2UgIiYjeDIyNjU7JiN4MjBEMjsiPjwhRU5USVRZIGxFICImI3gyMjY2OyI%2BPCFFTlRJVFkgTGVzc0Z1bGxFcXVhbCAiJiN4MjI2NjsiPjwhRU5USVRZIGxlcXEgIiYjeDIyNjY7Ij48IUVOVElUWSBubEUgIiYjeDIyNjY7JiN4MzM4OyI%2BPCFFTlRJVFkgbmxlcXEgIiYjeDIyNjY7JiN4MzM4OyI%2BPCFFTlRJVFkgZ0UgIiYjeDIyNjc7Ij48IUVOVElUWSBHcmVhdGVyRnVsbEVxdWFsICImI3gyMjY3OyI%2BPCFFTlRJVFkgZ2VxcSAiJiN4MjI2NzsiPjwhRU5USVRZIG5nRSAiJiN4MjI2NzsmI3gzMzg7Ij48IUVOVElUWSBuZ2VxcSAiJiN4MjI2NzsmI3gzMzg7Ij48IUVOVElUWSBOb3RHcmVhdGVyRnVsbEVxdWFsICImI3gyMjY3OyYjeDMzODsiPjwhRU5USVRZIGxuRSAiJiN4MjI2ODsiPjwhRU5USVRZIGxuZXFxICImI3gyMjY4OyI%2BPCFFTlRJVFkgbHZuRSAiJiN4MjI2ODsmI3hGRTAwOyI%2BPCFFTlRJVFkgbHZlcnRuZXFxICImI3gyMjY4OyYjeEZFMDA7Ij48IUVOVElUWSBnbkUgIiYjeDIyNjk7Ij48IUVOVElUWSBnbmVxcSAiJiN4MjI2OTsiPjwhRU5USVRZIGd2bkUgIiYjeDIyNjk7JiN4RkUwMDsiPjwhRU5USVRZIGd2ZXJ0bmVxcSAiJiN4MjI2OTsmI3hGRTAwOyI%2BPCFFTlRJVFkgTHQgIiYjeDIyNkE7Ij48IUVOVElUWSBOZXN0ZWRMZXNzTGVzcyAiJiN4MjI2QTsiPjwhRU5USVRZIGxsICImI3gyMjZBOyI%2BPCFFTlRJVFkgbkx0diAiJiN4MjI2QTsmI3gzMzg7Ij48IUVOVElUWSBOb3RMZXNzTGVzcyAiJiN4MjI2QTsmI3gzMzg7Ij48IUVOVElUWSBuTHQgIiYjeDIyNkE7JiN4MjBEMjsiPjwhRU5USVRZIEd0ICImI3gyMjZCOyI%2BPCFFTlRJVFkgTmVzdGVkR3JlYXRlckdyZWF0ZXIgIiYjeDIyNkI7Ij48IUVOVElUWSBnZyAiJiN4MjI2QjsiPjwhRU5USVRZIG5HdHYgIiYjeDIyNkI7JiN4MzM4OyI%2BPCFFTlRJVFkgTm90R3JlYXRlckdyZWF0ZXIgIiYjeDIyNkI7JiN4MzM4OyI%2BPCFFTlRJVFkgbkd0ICImI3gyMjZCOyYjeDIwRDI7Ij48IUVOVElUWSB0d2l4dCAiJiN4MjI2QzsiPjwhRU5USVRZIGJldHdlZW4gIiYjeDIyNkM7Ij48IUVOVElUWSBOb3RDdXBDYXAgIiYjeDIyNkQ7Ij48IUVOVElUWSBubHQgIiYjeDIyNkU7Ij48IUVOVElUWSBOb3RMZXNzICImI3gyMjZFOyI%2BPCFFTlRJVFkgbmxlc3MgIiYjeDIyNkU7Ij48IUVOVElUWSBuZ3QgIiYjeDIyNkY7Ij48IUVOVElUWSBOb3RHcmVhdGVyICImI3gyMjZGOyI%2BPCFFTlRJVFkgbmd0ciAiJiN4MjI2RjsiPjwhRU5USVRZIG5sZSAiJiN4MjI3MDsiPjwhRU5USVRZIE5vdExlc3NFcXVhbCAiJiN4MjI3MDsiPjwhRU5USVRZIG5sZXEgIiYjeDIyNzA7Ij48IUVOVElUWSBuZ2UgIiYjeDIyNzE7Ij48IUVOVElUWSBOb3RHcmVhdGVyRXF1YWwgIiYjeDIyNzE7Ij48IUVOVElUWSBuZ2VxICImI3gyMjcxOyI%2BPCFFTlRJVFkgbHNpbSAiJiN4MjI3MjsiPjwhRU5USVRZIExlc3NUaWxkZSAiJiN4MjI3MjsiPjwhRU5USVRZIGxlc3NzaW0gIiYjeDIyNzI7Ij48IUVOVElUWSBnc2ltICImI3gyMjczOyI%2BPCFFTlRJVFkgZ3Ryc2ltICImI3gyMjczOyI%2BPCFFTlRJVFkgR3JlYXRlclRpbGRlICImI3gyMjczOyI%2BPCFFTlRJVFkgbmxzaW0gIiYjeDIyNzQ7Ij48IUVOVElUWSBOb3RMZXNzVGlsZGUgIiYjeDIyNzQ7Ij48IUVOVElUWSBuZ3NpbSAiJiN4MjI3NTsiPjwhRU5USVRZIE5vdEdyZWF0ZXJUaWxkZSAiJiN4MjI3NTsiPjwhRU5USVRZIGxnICImI3gyMjc2OyI%2BPCFFTlRJVFkgbGVzc2d0ciAiJiN4MjI3NjsiPjwhRU5USVRZIExlc3NHcmVhdGVyICImI3gyMjc2OyI%2BPCFFTlRJVFkgZ2wgIiYjeDIyNzc7Ij48IUVOVElUWSBndHJsZXNzICImI3gyMjc3OyI%2BPCFFTlRJVFkgR3JlYXRlckxlc3MgIiYjeDIyNzc7Ij48IUVOVElUWSBudGxnICImI3gyMjc4OyI%2BPCFFTlRJVFkgTm90TGVzc0dyZWF0ZXIgIiYjeDIyNzg7Ij48IUVOVElUWSBudGdsICImI3gyMjc5OyI%2BPCFFTlRJVFkgTm90R3JlYXRlckxlc3MgIiYjeDIyNzk7Ij48IUVOVElUWSBwciAiJiN4MjI3QTsiPjwhRU5USVRZIFByZWNlZGVzICImI3gyMjdBOyI%2BPCFFTlRJVFkgcHJlYyAiJiN4MjI3QTsiPjwhRU5USVRZIHNjICImI3gyMjdCOyI%2BPCFFTlRJVFkgU3VjY2VlZHMgIiYjeDIyN0I7Ij48IUVOVElUWSBzdWNjICImI3gyMjdCOyI%2BPCFFTlRJVFkgcHJjdWUgIiYjeDIyN0M7Ij48IUVOVElUWSBQcmVjZWRlc1NsYW50RXF1YWwgIiYjeDIyN0M7Ij48IUVOVElUWSBwcmVjY3VybHllcSAiJiN4MjI3QzsiPjwhRU5USVRZIHNjY3VlICImI3gyMjdEOyI%2BPCFFTlRJVFkgU3VjY2VlZHNTbGFudEVxdWFsICImI3gyMjdEOyI%2BPCFFTlRJVFkgc3VjY2N1cmx5ZXEgIiYjeDIyN0Q7Ij48IUVOVElUWSBwcnNpbSAiJiN4MjI3RTsiPjwhRU5USVRZIHByZWNzaW0gIiYjeDIyN0U7Ij48IUVOVElUWSBQcmVjZWRlc1RpbGRlICImI3gyMjdFOyI%2BPCFFTlRJVFkgc2NzaW0gIiYjeDIyN0Y7Ij48IUVOVElUWSBzdWNjc2ltICImI3gyMjdGOyI%2BPCFFTlRJVFkgU3VjY2VlZHNUaWxkZSAiJiN4MjI3RjsiPjwhRU5USVRZIE5vdFN1Y2NlZWRzVGlsZGUgIiYjeDIyN0Y7JiN4MzM4OyI%2BPCFFTlRJVFkgbnByICImI3gyMjgwOyI%2BPCFFTlRJVFkgbnByZWMgIiYjeDIyODA7Ij48IUVOVElUWSBOb3RQcmVjZWRlcyAiJiN4MjI4MDsiPjwhRU5USVRZIG5zYyAiJiN4MjI4MTsiPjwhRU5USVRZIG5zdWNjICImI3gyMjgxOyI%2BPCFFTlRJVFkgTm90U3VjY2VlZHMgIiYjeDIyODE7Ij48IUVOVElUWSBzdWIgIiYjeDIyODI7Ij48IUVOVElUWSBzdWJzZXQgIiYjeDIyODI7Ij48IUVOVElUWSB2bnN1YiAiJiN4MjI4MjsmI3gyMEQyOyI%2BPCFFTlRJVFkgbnN1YnNldCAiJiN4MjI4MjsmI3gyMEQyOyI%2BPCFFTlRJVFkgTm90U3Vic2V0ICImI3gyMjgyOyYjeDIwRDI7Ij48IUVOVElUWSBzdXAgIiYjeDIyODM7Ij48IUVOVElUWSBzdXBzZXQgIiYjeDIyODM7Ij48IUVOVElUWSBTdXBlcnNldCAiJiN4MjI4MzsiPjwhRU5USVRZIHZuc3VwICImI3gyMjgzOyYjeDIwRDI7Ij48IUVOVElUWSBuc3Vwc2V0ICImI3gyMjgzOyYjeDIwRDI7Ij48IUVOVElUWSBOb3RTdXBlcnNldCAiJiN4MjI4MzsmI3gyMEQyOyI%2BPCFFTlRJVFkgbnN1YiAiJiN4MjI4NDsiPjwhRU5USVRZIG5zdXAgIiYjeDIyODU7Ij48IUVOVElUWSBzdWJlICImI3gyMjg2OyI%2BPCFFTlRJVFkgU3Vic2V0RXF1YWwgIiYjeDIyODY7Ij48IUVOVElUWSBzdWJzZXRlcSAiJiN4MjI4NjsiPjwhRU5USVRZIHN1cGUgIiYjeDIyODc7Ij48IUVOVElUWSBzdXBzZXRlcSAiJiN4MjI4NzsiPjwhRU5USVRZIFN1cGVyc2V0RXF1YWwgIiYjeDIyODc7Ij48IUVOVElUWSBuc3ViZSAiJiN4MjI4ODsiPjwhRU5USVRZIG5zdWJzZXRlcSAiJiN4MjI4ODsiPjwhRU5USVRZIE5vdFN1YnNldEVxdWFsICImI3gyMjg4OyI%2BPCFFTlRJVFkgbnN1cGUgIiYjeDIyODk7Ij48IUVOVElUWSBuc3Vwc2V0ZXEgIiYjeDIyODk7Ij48IUVOVElUWSBOb3RTdXBlcnNldEVxdWFsICImI3gyMjg5OyI%2BPCFFTlRJVFkgc3VibmUgIiYjeDIyOEE7Ij48IUVOVElUWSBzdWJzZXRuZXEgIiYjeDIyOEE7Ij48IUVOVElUWSB2c3VibmUgIiYjeDIyOEE7JiN4RkUwMDsiPjwhRU5USVRZIHZhcnN1YnNldG5lcSAiJiN4MjI4QTsmI3hGRTAwOyI%2BPCFFTlRJVFkgc3VwbmUgIiYjeDIyOEI7Ij48IUVOVElUWSBzdXBzZXRuZXEgIiYjeDIyOEI7Ij48IUVOVElUWSB2c3VwbmUgIiYjeDIyOEI7JiN4RkUwMDsiPjwhRU5USVRZIHZhcnN1cHNldG5lcSAiJiN4MjI4QjsmI3hGRTAwOyI%2BPCFFTlRJVFkgY3VwZG90ICImI3gyMjhEOyI%2BPCFFTlRJVFkgdXBsdXMgIiYjeDIyOEU7Ij48IUVOVElUWSBVbmlvblBsdXMgIiYjeDIyOEU7Ij48IUVOVElUWSBzcXN1YiAiJiN4MjI4RjsiPjwhRU5USVRZIFNxdWFyZVN1YnNldCAiJiN4MjI4RjsiPjwhRU5USVRZIHNxc3Vic2V0ICImI3gyMjhGOyI%2BPCFFTlRJVFkgTm90U3F1YXJlU3Vic2V0ICImI3gyMjhGOyYjeDMzODsiPjwhRU5USVRZIHNxc3VwICImI3gyMjkwOyI%2BPCFFTlRJVFkgU3F1YXJlU3VwZXJzZXQgIiYjeDIyOTA7Ij48IUVOVElUWSBzcXN1cHNldCAiJiN4MjI5MDsiPjwhRU5USVRZIE5vdFNxdWFyZVN1cGVyc2V0ICImI3gyMjkwOyYjeDMzODsiPjwhRU5USVRZIHNxc3ViZSAiJiN4MjI5MTsiPjwhRU5USVRZIFNxdWFyZVN1YnNldEVxdWFsICImI3gyMjkxOyI%2BPCFFTlRJVFkgc3FzdWJzZXRlcSAiJiN4MjI5MTsiPjwhRU5USVRZIHNxc3VwZSAiJiN4MjI5MjsiPjwhRU5USVRZIFNxdWFyZVN1cGVyc2V0RXF1YWwgIiYjeDIyOTI7Ij48IUVOVElUWSBzcXN1cHNldGVxICImI3gyMjkyOyI%2BPCFFTlRJVFkgc3FjYXAgIiYjeDIyOTM7Ij48IUVOVElUWSBTcXVhcmVJbnRlcnNlY3Rpb24gIiYjeDIyOTM7Ij48IUVOVElUWSBzcWNhcHMgIiYjeDIyOTM7JiN4RkUwMDsiPjwhRU5USVRZIHNxY3VwICImI3gyMjk0OyI%2BPCFFTlRJVFkgU3F1YXJlVW5pb24gIiYjeDIyOTQ7Ij48IUVOVElUWSBzcWN1cHMgIiYjeDIyOTQ7JiN4RkUwMDsiPjwhRU5USVRZIG9wbHVzICImI3gyMjk1OyI%2BPCFFTlRJVFkgQ2lyY2xlUGx1cyAiJiN4MjI5NTsiPjwhRU5USVRZIG9taW51cyAiJiN4MjI5NjsiPjwhRU5USVRZIENpcmNsZU1pbnVzICImI3gyMjk2OyI%2BPCFFTlRJVFkgb3RpbWVzICImI3gyMjk3OyI%2BPCFFTlRJVFkgQ2lyY2xlVGltZXMgIiYjeDIyOTc7Ij48IUVOVElUWSBvc29sICImI3gyMjk4OyI%2BPCFFTlRJVFkgb2RvdCAiJiN4MjI5OTsiPjwhRU5USVRZIENpcmNsZURvdCAiJiN4MjI5OTsiPjwhRU5USVRZIG9jaXIgIiYjeDIyOUE7Ij48IUVOVElUWSBjaXJjbGVkY2lyYyAiJiN4MjI5QTsiPjwhRU5USVRZIG9hc3QgIiYjeDIyOUI7Ij48IUVOVElUWSBjaXJjbGVkYXN0ICImI3gyMjlCOyI%2BPCFFTlRJVFkgb2Rhc2ggIiYjeDIyOUQ7Ij48IUVOVElUWSBjaXJjbGVkZGFzaCAiJiN4MjI5RDsiPjwhRU5USVRZIHBsdXNiICImI3gyMjlFOyI%2BPCFFTlRJVFkgYm94cGx1cyAiJiN4MjI5RTsiPjwhRU5USVRZIG1pbnVzYiAiJiN4MjI5RjsiPjwhRU5USVRZIGJveG1pbnVzICImI3gyMjlGOyI%2BPCFFTlRJVFkgdGltZXNiICImI3gyMkEwOyI%2BPCFFTlRJVFkgYm94dGltZXMgIiYjeDIyQTA7Ij48IUVOVElUWSBzZG90YiAiJiN4MjJBMTsiPjwhRU5USVRZIGRvdHNxdWFyZSAiJiN4MjJBMTsiPjwhRU5USVRZIHZkYXNoICImI3gyMkEyOyI%2BPCFFTlRJVFkgUmlnaHRUZWUgIiYjeDIyQTI7Ij48IUVOVElUWSBkYXNodiAiJiN4MjJBMzsiPjwhRU5USVRZIExlZnRUZWUgIiYjeDIyQTM7Ij48IUVOVElUWSB0b3AgIiYjeDIyQTQ7Ij48IUVOVElUWSBEb3duVGVlICImI3gyMkE0OyI%2BPCFFTlRJVFkgYm90dG9tICImI3gyMkE1OyI%2BPCFFTlRJVFkgYm90ICImI3gyMkE1OyI%2BPCFFTlRJVFkgcGVycCAiJiN4MjJBNTsiPjwhRU5USVRZIFVwVGVlICImI3gyMkE1OyI%2BPCFFTlRJVFkgbW9kZWxzICImI3gyMkE3OyI%2BPCFFTlRJVFkgdkRhc2ggIiYjeDIyQTg7Ij48IUVOVElUWSBEb3VibGVSaWdodFRlZSAiJiN4MjJBODsiPjwhRU5USVRZIFZkYXNoICImI3gyMkE5OyI%2BPCFFTlRJVFkgVnZkYXNoICImI3gyMkFBOyI%2BPCFFTlRJVFkgVkRhc2ggIiYjeDIyQUI7Ij48IUVOVElUWSBudmRhc2ggIiYjeDIyQUM7Ij48IUVOVElUWSBudkRhc2ggIiYjeDIyQUQ7Ij48IUVOVElUWSBuVmRhc2ggIiYjeDIyQUU7Ij48IUVOVElUWSBuVkRhc2ggIiYjeDIyQUY7Ij48IUVOVElUWSBwcnVyZWwgIiYjeDIyQjA7Ij48IUVOVElUWSB2bHRyaSAiJiN4MjJCMjsiPjwhRU5USVRZIHZhcnRyaWFuZ2xlbGVmdCAiJiN4MjJCMjsiPjwhRU5USVRZIExlZnRUcmlhbmdsZSAiJiN4MjJCMjsiPjwhRU5USVRZIHZydHJpICImI3gyMkIzOyI%2BPCFFTlRJVFkgdmFydHJpYW5nbGVyaWdodCAiJiN4MjJCMzsiPjwhRU5USVRZIFJpZ2h0VHJpYW5nbGUgIiYjeDIyQjM7Ij48IUVOVElUWSBsdHJpZSAiJiN4MjJCNDsiPjwhRU5USVRZIHRyaWFuZ2xlbGVmdGVxICImI3gyMkI0OyI%2BPCFFTlRJVFkgTGVmdFRyaWFuZ2xlRXF1YWwgIiYjeDIyQjQ7Ij48IUVOVElUWSBudmx0cmllICImI3gyMkI0OyYjeDIwRDI7Ij48IUVOVElUWSBydHJpZSAiJiN4MjJCNTsiPjwhRU5USVRZIHRyaWFuZ2xlcmlnaHRlcSAiJiN4MjJCNTsiPjwhRU5USVRZIFJpZ2h0VHJpYW5nbGVFcXVhbCAiJiN4MjJCNTsiPjwhRU5USVRZIG52cnRyaWUgIiYjeDIyQjU7JiN4MjBEMjsiPjwhRU5USVRZIG9yaWdvZiAiJiN4MjJCNjsiPjwhRU5USVRZIGltb2YgIiYjeDIyQjc7Ij48IUVOVElUWSBtdW1hcCAiJiN4MjJCODsiPjwhRU5USVRZIG11bHRpbWFwICImI3gyMkI4OyI%2BPCFFTlRJVFkgaGVyY29uICImI3gyMkI5OyI%2BPCFFTlRJVFkgaW50Y2FsICImI3gyMkJBOyI%2BPCFFTlRJVFkgaW50ZXJjYWwgIiYjeDIyQkE7Ij48IUVOVElUWSB2ZWViYXIgIiYjeDIyQkI7Ij48IUVOVElUWSBiYXJ2ZWUgIiYjeDIyQkQ7Ij48IUVOVElUWSBhbmdydHZiICImI3gyMkJFOyI%2BPCFFTlRJVFkgbHJ0cmkgIiYjeDIyQkY7Ij48IUVOVElUWSB4d2VkZ2UgIiYjeDIyQzA7Ij48IUVOVElUWSBXZWRnZSAiJiN4MjJDMDsiPjwhRU5USVRZIGJpZ3dlZGdlICImI3gyMkMwOyI%2BPCFFTlRJVFkgeHZlZSAiJiN4MjJDMTsiPjwhRU5USVRZIFZlZSAiJiN4MjJDMTsiPjwhRU5USVRZIGJpZ3ZlZSAiJiN4MjJDMTsiPjwhRU5USVRZIHhjYXAgIiYjeDIyQzI7Ij48IUVOVElUWSBJbnRlcnNlY3Rpb24gIiYjeDIyQzI7Ij48IUVOVElUWSBiaWdjYXAgIiYjeDIyQzI7Ij48IUVOVElUWSB4Y3VwICImI3gyMkMzOyI%2BPCFFTlRJVFkgVW5pb24gIiYjeDIyQzM7Ij48IUVOVElUWSBiaWdjdXAgIiYjeDIyQzM7Ij48IUVOVElUWSBkaWFtICImI3gyMkM0OyI%2BPCFFTlRJVFkgZGlhbW9uZCAiJiN4MjJDNDsiPjwhRU5USVRZIERpYW1vbmQgIiYjeDIyQzQ7Ij48IUVOVElUWSBzZG90ICImI3gyMkM1OyI%2BPCFFTlRJVFkgc3N0YXJmICImI3gyMkM2OyI%2BPCFFTlRJVFkgU3RhciAiJiN4MjJDNjsiPjwhRU5USVRZIGRpdm9ueCAiJiN4MjJDNzsiPjwhRU5USVRZIGRpdmlkZW9udGltZXMgIiYjeDIyQzc7Ij48IUVOVElUWSBib3d0aWUgIiYjeDIyQzg7Ij48IUVOVElUWSBsdGltZXMgIiYjeDIyQzk7Ij48IUVOVElUWSBydGltZXMgIiYjeDIyQ0E7Ij48IUVOVElUWSBsdGhyZWUgIiYjeDIyQ0I7Ij48IUVOVElUWSBsZWZ0dGhyZWV0aW1lcyAiJiN4MjJDQjsiPjwhRU5USVRZIHJ0aHJlZSAiJiN4MjJDQzsiPjwhRU5USVRZIHJpZ2h0dGhyZWV0aW1lcyAiJiN4MjJDQzsiPjwhRU5USVRZIGJzaW1lICImI3gyMkNEOyI%2BPCFFTlRJVFkgYmFja3NpbWVxICImI3gyMkNEOyI%2BPCFFTlRJVFkgY3V2ZWUgIiYjeDIyQ0U7Ij48IUVOVElUWSBjdXJseXZlZSAiJiN4MjJDRTsiPjwhRU5USVRZIGN1d2VkICImI3gyMkNGOyI%2BPCFFTlRJVFkgY3VybHl3ZWRnZSAiJiN4MjJDRjsiPjwhRU5USVRZIFN1YiAiJiN4MjJEMDsiPjwhRU5USVRZIFN1YnNldCAiJiN4MjJEMDsiPjwhRU5USVRZIFN1cCAiJiN4MjJEMTsiPjwhRU5USVRZIFN1cHNldCAiJiN4MjJEMTsiPjwhRU5USVRZIENhcCAiJiN4MjJEMjsiPjwhRU5USVRZIEN1cCAiJiN4MjJEMzsiPjwhRU5USVRZIGZvcmsgIiYjeDIyRDQ7Ij48IUVOVElUWSBwaXRjaGZvcmsgIiYjeDIyRDQ7Ij48IUVOVElUWSBlcGFyICImI3gyMkQ1OyI%2BPCFFTlRJVFkgbHRkb3QgIiYjeDIyRDY7Ij48IUVOVElUWSBsZXNzZG90ICImI3gyMkQ2OyI%2BPCFFTlRJVFkgZ3Rkb3QgIiYjeDIyRDc7Ij48IUVOVElUWSBndHJkb3QgIiYjeDIyRDc7Ij48IUVOVElUWSBMbCAiJiN4MjJEODsiPjwhRU5USVRZIG5MbCAiJiN4MjJEODsmI3gzMzg7Ij48IUVOVElUWSBHZyAiJiN4MjJEOTsiPjwhRU5USVRZIGdnZyAiJiN4MjJEOTsiPjwhRU5USVRZIG5HZyAiJiN4MjJEOTsmI3gzMzg7Ij48IUVOVElUWSBsZWcgIiYjeDIyREE7Ij48IUVOVElUWSBMZXNzRXF1YWxHcmVhdGVyICImI3gyMkRBOyI%2BPCFFTlRJVFkgbGVzc2VxZ3RyICImI3gyMkRBOyI%2BPCFFTlRJVFkgbGVzZyAiJiN4MjJEQTsmI3hGRTAwOyI%2BPCFFTlRJVFkgZ2VsICImI3gyMkRCOyI%2BPCFFTlRJVFkgZ3RyZXFsZXNzICImI3gyMkRCOyI%2BPCFFTlRJVFkgR3JlYXRlckVxdWFsTGVzcyAiJiN4MjJEQjsiPjwhRU5USVRZIGdlc2wgIiYjeDIyREI7JiN4RkUwMDsiPjwhRU5USVRZIGN1ZXByICImI3gyMkRFOyI%2BPCFFTlRJVFkgY3VybHllcXByZWMgIiYjeDIyREU7Ij48IUVOVElUWSBjdWVzYyAiJiN4MjJERjsiPjwhRU5USVRZIGN1cmx5ZXFzdWNjICImI3gyMkRGOyI%2BPCFFTlRJVFkgbnByY3VlICImI3gyMkUwOyI%2BPCFFTlRJVFkgTm90UHJlY2VkZXNTbGFudEVxdWFsICImI3gyMkUwOyI%2BPCFFTlRJVFkgbnNjY3VlICImI3gyMkUxOyI%2BPCFFTlRJVFkgTm90U3VjY2VlZHNTbGFudEVxdWFsICImI3gyMkUxOyI%2BPCFFTlRJVFkgbnNxc3ViZSAiJiN4MjJFMjsiPjwhRU5USVRZIE5vdFNxdWFyZVN1YnNldEVxdWFsICImI3gyMkUyOyI%2BPCFFTlRJVFkgbnNxc3VwZSAiJiN4MjJFMzsiPjwhRU5USVRZIE5vdFNxdWFyZVN1cGVyc2V0RXF1YWwgIiYjeDIyRTM7Ij48IUVOVElUWSBsbnNpbSAiJiN4MjJFNjsiPjwhRU5USVRZIGduc2ltICImI3gyMkU3OyI%2BPCFFTlRJVFkgcHJuc2ltICImI3gyMkU4OyI%2BPCFFTlRJVFkgcHJlY25zaW0gIiYjeDIyRTg7Ij48IUVOVElUWSBzY25zaW0gIiYjeDIyRTk7Ij48IUVOVElUWSBzdWNjbnNpbSAiJiN4MjJFOTsiPjwhRU5USVRZIG5sdHJpICImI3gyMkVBOyI%2BPCFFTlRJVFkgbnRyaWFuZ2xlbGVmdCAiJiN4MjJFQTsiPjwhRU5USVRZIE5vdExlZnRUcmlhbmdsZSAiJiN4MjJFQTsiPjwhRU5USVRZIG5ydHJpICImI3gyMkVCOyI%2BPCFFTlRJVFkgbnRyaWFuZ2xlcmlnaHQgIiYjeDIyRUI7Ij48IUVOVElUWSBOb3RSaWdodFRyaWFuZ2xlICImI3gyMkVCOyI%2BPCFFTlRJVFkgbmx0cmllICImI3gyMkVDOyI%2BPCFFTlRJVFkgbnRyaWFuZ2xlbGVmdGVxICImI3gyMkVDOyI%2BPCFFTlRJVFkgTm90TGVmdFRyaWFuZ2xlRXF1YWwgIiYjeDIyRUM7Ij48IUVOVElUWSBucnRyaWUgIiYjeDIyRUQ7Ij48IUVOVElUWSBudHJpYW5nbGVyaWdodGVxICImI3gyMkVEOyI%2BPCFFTlRJVFkgTm90UmlnaHRUcmlhbmdsZUVxdWFsICImI3gyMkVEOyI%2BPCFFTlRJVFkgdmVsbGlwICImI3gyMkVFOyI%2BPCFFTlRJVFkgY3Rkb3QgIiYjeDIyRUY7Ij48IUVOVElUWSB1dGRvdCAiJiN4MjJGMDsiPjwhRU5USVRZIGR0ZG90ICImI3gyMkYxOyI%2BPCFFTlRJVFkgZGlzaW4gIiYjeDIyRjI7Ij48IUVOVElUWSBpc2luc3YgIiYjeDIyRjM7Ij48IUVOVElUWSBpc2lucyAiJiN4MjJGNDsiPjwhRU5USVRZIGlzaW5kb3QgIiYjeDIyRjU7Ij48IUVOVElUWSBub3RpbmRvdCAiJiN4MjJGNTsmI3gzMzg7Ij48IUVOVElUWSBub3RpbnZjICImI3gyMkY2OyI%2BPCFFTlRJVFkgbm90aW52YiAiJiN4MjJGNzsiPjwhRU5USVRZIGlzaW5FICImI3gyMkY5OyI%2BPCFFTlRJVFkgbm90aW5FICImI3gyMkY5OyYjeDMzODsiPjwhRU5USVRZIG5pc2QgIiYjeDIyRkE7Ij48IUVOVElUWSB4bmlzICImI3gyMkZCOyI%2BPCFFTlRJVFkgbmlzICImI3gyMkZDOyI%2BPCFFTlRJVFkgbm90bml2YyAiJiN4MjJGRDsiPjwhRU5USVRZIG5vdG5pdmIgIiYjeDIyRkU7Ij48IUVOVElUWSBiYXJ3ZWQgIiYjeDIzMDU7Ij48IUVOVElUWSBiYXJ3ZWRnZSAiJiN4MjMwNTsiPjwhRU5USVRZIEJhcndlZCAiJiN4MjMwNjsiPjwhRU5USVRZIGRvdWJsZWJhcndlZGdlICImI3gyMzA2OyI%2BPCFFTlRJVFkgbGNlaWwgIiYjeDIzMDg7Ij48IUVOVElUWSBMZWZ0Q2VpbGluZyAiJiN4MjMwODsiPjwhRU5USVRZIHJjZWlsICImI3gyMzA5OyI%2BPCFFTlRJVFkgUmlnaHRDZWlsaW5nICImI3gyMzA5OyI%2BPCFFTlRJVFkgbGZsb29yICImI3gyMzBBOyI%2BPCFFTlRJVFkgTGVmdEZsb29yICImI3gyMzBBOyI%2BPCFFTlRJVFkgcmZsb29yICImI3gyMzBCOyI%2BPCFFTlRJVFkgUmlnaHRGbG9vciAiJiN4MjMwQjsiPjwhRU5USVRZIGRyY3JvcCAiJiN4MjMwQzsiPjwhRU5USVRZIGRsY3JvcCAiJiN4MjMwRDsiPjwhRU5USVRZIHVyY3JvcCAiJiN4MjMwRTsiPjwhRU5USVRZIHVsY3JvcCAiJiN4MjMwRjsiPjwhRU5USVRZIGJub3QgIiYjeDIzMTA7Ij48IUVOVElUWSBwcm9mbGluZSAiJiN4MjMxMjsiPjwhRU5USVRZIHByb2ZzdXJmICImI3gyMzEzOyI%2BPCFFTlRJVFkgdGVscmVjICImI3gyMzE1OyI%2BPCFFTlRJVFkgdGFyZ2V0ICImI3gyMzE2OyI%2BPCFFTlRJVFkgdWxjb3JuICImI3gyMzFDOyI%2BPCFFTlRJVFkgdWxjb3JuZXIgIiYjeDIzMUM7Ij48IUVOVElUWSB1cmNvcm4gIiYjeDIzMUQ7Ij48IUVOVElUWSB1cmNvcm5lciAiJiN4MjMxRDsiPjwhRU5USVRZIGRsY29ybiAiJiN4MjMxRTsiPjwhRU5USVRZIGxsY29ybmVyICImI3gyMzFFOyI%2BPCFFTlRJVFkgZHJjb3JuICImI3gyMzFGOyI%2BPCFFTlRJVFkgbHJjb3JuZXIgIiYjeDIzMUY7Ij48IUVOVElUWSBmcm93biAiJiN4MjMyMjsiPjwhRU5USVRZIHNmcm93biAiJiN4MjMyMjsiPjwhRU5USVRZIHNtaWxlICImI3gyMzIzOyI%2BPCFFTlRJVFkgc3NtaWxlICImI3gyMzIzOyI%2BPCFFTlRJVFkgY3lsY3R5ICImI3gyMzJEOyI%2BPCFFTlRJVFkgcHJvZmFsYXIgIiYjeDIzMkU7Ij48IUVOVElUWSB0b3Bib3QgIiYjeDIzMzY7Ij48IUVOVElUWSBvdmJhciAiJiN4MjMzRDsiPjwhRU5USVRZIHNvbGJhciAiJiN4MjMzRjsiPjwhRU5USVRZIGFuZ3phcnIgIiYjeDIzN0M7Ij48IUVOVElUWSBsbW91c3QgIiYjeDIzQjA7Ij48IUVOVElUWSBsbW91c3RhY2hlICImI3gyM0IwOyI%2BPCFFTlRJVFkgcm1vdXN0ICImI3gyM0IxOyI%2BPCFFTlRJVFkgcm1vdXN0YWNoZSAiJiN4MjNCMTsiPjwhRU5USVRZIHRicmsgIiYjeDIzQjQ7Ij48IUVOVElUWSBPdmVyQnJhY2tldCAiJiN4MjNCNDsiPjwhRU5USVRZIGJicmsgIiYjeDIzQjU7Ij48IUVOVElUWSBVbmRlckJyYWNrZXQgIiYjeDIzQjU7Ij48IUVOVElUWSBiYnJrdGJyayAiJiN4MjNCNjsiPjwhRU5USVRZIE92ZXJQYXJlbnRoZXNpcyAiJiN4MjNEQzsiPjwhRU5USVRZIFVuZGVyUGFyZW50aGVzaXMgIiYjeDIzREQ7Ij48IUVOVElUWSBPdmVyQnJhY2UgIiYjeDIzREU7Ij48IUVOVElUWSBVbmRlckJyYWNlICImI3gyM0RGOyI%2BPCFFTlRJVFkgdHJwZXppdW0gIiYjeDIzRTI7Ij48IUVOVElUWSBlbGludGVycyAiJiN4MjNFNzsiPjwhRU5USVRZIGJsYW5rICImI3gyNDIzOyI%2BPCFFTlRJVFkgb1MgIiYjeDI0Qzg7Ij48IUVOVElUWSBjaXJjbGVkUyAiJiN4MjRDODsiPjwhRU5USVRZIGJveGggIiYjeDI1MDA7Ij48IUVOVElUWSBIb3Jpem9udGFsTGluZSAiJiN4MjUwMDsiPjwhRU5USVRZIGJveHYgIiYjeDI1MDI7Ij48IUVOVElUWSBib3hkciAiJiN4MjUwQzsiPjwhRU5USVRZIGJveGRsICImI3gyNTEwOyI%2BPCFFTlRJVFkgYm94dXIgIiYjeDI1MTQ7Ij48IUVOVElUWSBib3h1bCAiJiN4MjUxODsiPjwhRU5USVRZIGJveHZyICImI3gyNTFDOyI%2BPCFFTlRJVFkgYm94dmwgIiYjeDI1MjQ7Ij48IUVOVElUWSBib3hoZCAiJiN4MjUyQzsiPjwhRU5USVRZIGJveGh1ICImI3gyNTM0OyI%2BPCFFTlRJVFkgYm94dmggIiYjeDI1M0M7Ij48IUVOVElUWSBib3hIICImI3gyNTUwOyI%2BPCFFTlRJVFkgYm94ViAiJiN4MjU1MTsiPjwhRU5USVRZIGJveGRSICImI3gyNTUyOyI%2BPCFFTlRJVFkgYm94RHIgIiYjeDI1NTM7Ij48IUVOVElUWSBib3hEUiAiJiN4MjU1NDsiPjwhRU5USVRZIGJveGRMICImI3gyNTU1OyI%2BPCFFTlRJVFkgYm94RGwgIiYjeDI1NTY7Ij48IUVOVElUWSBib3hETCAiJiN4MjU1NzsiPjwhRU5USVRZIGJveHVSICImI3gyNTU4OyI%2BPCFFTlRJVFkgYm94VXIgIiYjeDI1NTk7Ij48IUVOVElUWSBib3hVUiAiJiN4MjU1QTsiPjwhRU5USVRZIGJveHVMICImI3gyNTVCOyI%2BPCFFTlRJVFkgYm94VWwgIiYjeDI1NUM7Ij48IUVOVElUWSBib3hVTCAiJiN4MjU1RDsiPjwhRU5USVRZIGJveHZSICImI3gyNTVFOyI%2BPCFFTlRJVFkgYm94VnIgIiYjeDI1NUY7Ij48IUVOVElUWSBib3hWUiAiJiN4MjU2MDsiPjwhRU5USVRZIGJveHZMICImI3gyNTYxOyI%2BPCFFTlRJVFkgYm94VmwgIiYjeDI1NjI7Ij48IUVOVElUWSBib3hWTCAiJiN4MjU2MzsiPjwhRU5USVRZIGJveEhkICImI3gyNTY0OyI%2BPCFFTlRJVFkgYm94aEQgIiYjeDI1NjU7Ij48IUVOVElUWSBib3hIRCAiJiN4MjU2NjsiPjwhRU5USVRZIGJveEh1ICImI3gyNTY3OyI%2BPCFFTlRJVFkgYm94aFUgIiYjeDI1Njg7Ij48IUVOVElUWSBib3hIVSAiJiN4MjU2OTsiPjwhRU5USVRZIGJveHZIICImI3gyNTZBOyI%2BPCFFTlRJVFkgYm94VmggIiYjeDI1NkI7Ij48IUVOVElUWSBib3hWSCAiJiN4MjU2QzsiPjwhRU5USVRZIHVoYmxrICImI3gyNTgwOyI%2BPCFFTlRJVFkgbGhibGsgIiYjeDI1ODQ7Ij48IUVOVElUWSBibG9jayAiJiN4MjU4ODsiPjwhRU5USVRZIGJsazE0ICImI3gyNTkxOyI%2BPCFFTlRJVFkgYmxrMTIgIiYjeDI1OTI7Ij48IUVOVElUWSBibGszNCAiJiN4MjU5MzsiPjwhRU5USVRZIHNxdSAiJiN4MjVBMTsiPjwhRU5USVRZIHNxdWFyZSAiJiN4MjVBMTsiPjwhRU5USVRZIFNxdWFyZSAiJiN4MjVBMTsiPjwhRU5USVRZIHNxdWYgIiYjeDI1QUE7Ij48IUVOVElUWSBzcXVhcmYgIiYjeDI1QUE7Ij48IUVOVElUWSBibGFja3NxdWFyZSAiJiN4MjVBQTsiPjwhRU5USVRZIEZpbGxlZFZlcnlTbWFsbFNxdWFyZSAiJiN4MjVBQTsiPjwhRU5USVRZIEVtcHR5VmVyeVNtYWxsU3F1YXJlICImI3gyNUFCOyI%2BPCFFTlRJVFkgcmVjdCAiJiN4MjVBRDsiPjwhRU5USVRZIG1hcmtlciAiJiN4MjVBRTsiPjwhRU5USVRZIGZsdG5zICImI3gyNUIxOyI%2BPCFFTlRJVFkgeHV0cmkgIiYjeDI1QjM7Ij48IUVOVElUWSBiaWd0cmlhbmdsZXVwICImI3gyNUIzOyI%2BPCFFTlRJVFkgdXRyaWYgIiYjeDI1QjQ7Ij48IUVOVElUWSBibGFja3RyaWFuZ2xlICImI3gyNUI0OyI%2BPCFFTlRJVFkgdXRyaSAiJiN4MjVCNTsiPjwhRU5USVRZIHRyaWFuZ2xlICImI3gyNUI1OyI%2BPCFFTlRJVFkgcnRyaWYgIiYjeDI1Qjg7Ij48IUVOVElUWSBibGFja3RyaWFuZ2xlcmlnaHQgIiYjeDI1Qjg7Ij48IUVOVElUWSBydHJpICImI3gyNUI5OyI%2BPCFFTlRJVFkgdHJpYW5nbGVyaWdodCAiJiN4MjVCOTsiPjwhRU5USVRZIHhkdHJpICImI3gyNUJEOyI%2BPCFFTlRJVFkgYmlndHJpYW5nbGVkb3duICImI3gyNUJEOyI%2BPCFFTlRJVFkgZHRyaWYgIiYjeDI1QkU7Ij48IUVOVElUWSBibGFja3RyaWFuZ2xlZG93biAiJiN4MjVCRTsiPjwhRU5USVRZIGR0cmkgIiYjeDI1QkY7Ij48IUVOVElUWSB0cmlhbmdsZWRvd24gIiYjeDI1QkY7Ij48IUVOVElUWSBsdHJpZiAiJiN4MjVDMjsiPjwhRU5USVRZIGJsYWNrdHJpYW5nbGVsZWZ0ICImI3gyNUMyOyI%2BPCFFTlRJVFkgbHRyaSAiJiN4MjVDMzsiPjwhRU5USVRZIHRyaWFuZ2xlbGVmdCAiJiN4MjVDMzsiPjwhRU5USVRZIGxveiAiJiN4MjVDQTsiPjwhRU5USVRZIGxvemVuZ2UgIiYjeDI1Q0E7Ij48IUVOVElUWSBjaXIgIiYjeDI1Q0I7Ij48IUVOVElUWSB0cmlkb3QgIiYjeDI1RUM7Ij48IUVOVElUWSB4Y2lyYyAiJiN4MjVFRjsiPjwhRU5USVRZIGJpZ2NpcmMgIiYjeDI1RUY7Ij48IUVOVElUWSB1bHRyaSAiJiN4MjVGODsiPjwhRU5USVRZIHVydHJpICImI3gyNUY5OyI%2BPCFFTlRJVFkgbGx0cmkgIiYjeDI1RkE7Ij48IUVOVElUWSBFbXB0eVNtYWxsU3F1YXJlICImI3gyNUZCOyI%2BPCFFTlRJVFkgRmlsbGVkU21hbGxTcXVhcmUgIiYjeDI1RkM7Ij48IUVOVElUWSBzdGFyZiAiJiN4MjYwNTsiPjwhRU5USVRZIGJpZ3N0YXIgIiYjeDI2MDU7Ij48IUVOVElUWSBzdGFyICImI3gyNjA2OyI%2BPCFFTlRJVFkgcGhvbmUgIiYjeDI2MEU7Ij48IUVOVElUWSBmZW1hbGUgIiYjeDI2NDA7Ij48IUVOVElUWSBtYWxlICImI3gyNjQyOyI%2BPCFFTlRJVFkgc3BhZGVzICImI3gyNjYwOyI%2BPCFFTlRJVFkgc3BhZGVzdWl0ICImI3gyNjYwOyI%2BPCFFTlRJVFkgY2x1YnMgIiYjeDI2NjM7Ij48IUVOVElUWSBjbHVic3VpdCAiJiN4MjY2MzsiPjwhRU5USVRZIGhlYXJ0cyAiJiN4MjY2NTsiPjwhRU5USVRZIGhlYXJ0c3VpdCAiJiN4MjY2NTsiPjwhRU5USVRZIGRpYW1zICImI3gyNjY2OyI%2BPCFFTlRJVFkgZGlhbW9uZHN1aXQgIiYjeDI2NjY7Ij48IUVOVElUWSBzdW5nICImI3gyNjZBOyI%2BPCFFTlRJVFkgZmxhdCAiJiN4MjY2RDsiPjwhRU5USVRZIG5hdHVyICImI3gyNjZFOyI%2BPCFFTlRJVFkgbmF0dXJhbCAiJiN4MjY2RTsiPjwhRU5USVRZIHNoYXJwICImI3gyNjZGOyI%2BPCFFTlRJVFkgY2hlY2sgIiYjeDI3MTM7Ij48IUVOVElUWSBjaGVja21hcmsgIiYjeDI3MTM7Ij48IUVOVElUWSBjcm9zcyAiJiN4MjcxNzsiPjwhRU5USVRZIG1hbHQgIiYjeDI3MjA7Ij48IUVOVElUWSBtYWx0ZXNlICImI3gyNzIwOyI%2BPCFFTlRJVFkgc2V4dCAiJiN4MjczNjsiPjwhRU5USVRZIFZlcnRpY2FsU2VwYXJhdG9yICImI3gyNzU4OyI%2BPCFFTlRJVFkgbGJicmsgIiYjeDI3NzI7Ij48IUVOVElUWSByYmJyayAiJiN4Mjc3MzsiPjwhRU5USVRZIGJzb2xoc3ViICImI3gyN0M4OyI%2BPCFFTlRJVFkgc3VwaHNvbCAiJiN4MjdDOTsiPjwhRU5USVRZIGxvYnJrICImI3gyN0U2OyI%2BPCFFTlRJVFkgTGVmdERvdWJsZUJyYWNrZXQgIiYjeDI3RTY7Ij48IUVOVElUWSByb2JyayAiJiN4MjdFNzsiPjwhRU5USVRZIFJpZ2h0RG91YmxlQnJhY2tldCAiJiN4MjdFNzsiPjwhRU5USVRZIGxhbmcgIiYjeDI3RTg7Ij48IUVOVElUWSBMZWZ0QW5nbGVCcmFja2V0ICImI3gyN0U4OyI%2BPCFFTlRJVFkgbGFuZ2xlICImI3gyN0U4OyI%2BPCFFTlRJVFkgcmFuZyAiJiN4MjdFOTsiPjwhRU5USVRZIFJpZ2h0QW5nbGVCcmFja2V0ICImI3gyN0U5OyI%2BPCFFTlRJVFkgcmFuZ2xlICImI3gyN0U5OyI%2BPCFFTlRJVFkgTGFuZyAiJiN4MjdFQTsiPjwhRU5USVRZIFJhbmcgIiYjeDI3RUI7Ij48IUVOVElUWSBsb2FuZyAiJiN4MjdFQzsiPjwhRU5USVRZIHJvYW5nICImI3gyN0VEOyI%2BPCFFTlRJVFkgeGxhcnIgIiYjeDI3RjU7Ij48IUVOVElUWSBsb25nbGVmdGFycm93ICImI3gyN0Y1OyI%2BPCFFTlRJVFkgTG9uZ0xlZnRBcnJvdyAiJiN4MjdGNTsiPjwhRU5USVRZIHhyYXJyICImI3gyN0Y2OyI%2BPCFFTlRJVFkgbG9uZ3JpZ2h0YXJyb3cgIiYjeDI3RjY7Ij48IUVOVElUWSBMb25nUmlnaHRBcnJvdyAiJiN4MjdGNjsiPjwhRU5USVRZIHhoYXJyICImI3gyN0Y3OyI%2BPCFFTlRJVFkgbG9uZ2xlZnRyaWdodGFycm93ICImI3gyN0Y3OyI%2BPCFFTlRJVFkgTG9uZ0xlZnRSaWdodEFycm93ICImI3gyN0Y3OyI%2BPCFFTlRJVFkgeGxBcnIgIiYjeDI3Rjg7Ij48IUVOVElUWSBMb25nbGVmdGFycm93ICImI3gyN0Y4OyI%2BPCFFTlRJVFkgRG91YmxlTG9uZ0xlZnRBcnJvdyAiJiN4MjdGODsiPjwhRU5USVRZIHhyQXJyICImI3gyN0Y5OyI%2BPCFFTlRJVFkgTG9uZ3JpZ2h0YXJyb3cgIiYjeDI3Rjk7Ij48IUVOVElUWSBEb3VibGVMb25nUmlnaHRBcnJvdyAiJiN4MjdGOTsiPjwhRU5USVRZIHhoQXJyICImI3gyN0ZBOyI%2BPCFFTlRJVFkgTG9uZ2xlZnRyaWdodGFycm93ICImI3gyN0ZBOyI%2BPCFFTlRJVFkgRG91YmxlTG9uZ0xlZnRSaWdodEFycm93ICImI3gyN0ZBOyI%2BPCFFTlRJVFkgeG1hcCAiJiN4MjdGQzsiPjwhRU5USVRZIGxvbmdtYXBzdG8gIiYjeDI3RkM7Ij48IUVOVElUWSBkemlncmFyciAiJiN4MjdGRjsiPjwhRU5USVRZIG52bEFyciAiJiN4MjkwMjsiPjwhRU5USVRZIG52ckFyciAiJiN4MjkwMzsiPjwhRU5USVRZIG52SGFyciAiJiN4MjkwNDsiPjwhRU5USVRZIE1hcCAiJiN4MjkwNTsiPjwhRU5USVRZIGxiYXJyICImI3gyOTBDOyI%2BPCFFTlRJVFkgcmJhcnIgIiYjeDI5MEQ7Ij48IUVOVElUWSBia2Fyb3cgIiYjeDI5MEQ7Ij48IUVOVElUWSBsQmFyciAiJiN4MjkwRTsiPjwhRU5USVRZIHJCYXJyICImI3gyOTBGOyI%2BPCFFTlRJVFkgZGJrYXJvdyAiJiN4MjkwRjsiPjwhRU5USVRZIFJCYXJyICImI3gyOTEwOyI%2BPCFFTlRJVFkgZHJia2Fyb3cgIiYjeDI5MTA7Ij48IUVOVElUWSBERG90cmFoZCAiJiN4MjkxMTsiPjwhRU5USVRZIFVwQXJyb3dCYXIgIiYjeDI5MTI7Ij48IUVOVElUWSBEb3duQXJyb3dCYXIgIiYjeDI5MTM7Ij48IUVOVElUWSBSYXJydGwgIiYjeDI5MTY7Ij48IUVOVElUWSBsYXRhaWwgIiYjeDI5MTk7Ij48IUVOVElUWSByYXRhaWwgIiYjeDI5MUE7Ij48IUVOVElUWSBsQXRhaWwgIiYjeDI5MUI7Ij48IUVOVElUWSByQXRhaWwgIiYjeDI5MUM7Ij48IUVOVElUWSBsYXJyZnMgIiYjeDI5MUQ7Ij48IUVOVElUWSByYXJyZnMgIiYjeDI5MUU7Ij48IUVOVElUWSBsYXJyYmZzICImI3gyOTFGOyI%2BPCFFTlRJVFkgcmFycmJmcyAiJiN4MjkyMDsiPjwhRU5USVRZIG53YXJoayAiJiN4MjkyMzsiPjwhRU5USVRZIG5lYXJoayAiJiN4MjkyNDsiPjwhRU5USVRZIHNlYXJoayAiJiN4MjkyNTsiPjwhRU5USVRZIGhrc2Vhcm93ICImI3gyOTI1OyI%2BPCFFTlRJVFkgc3dhcmhrICImI3gyOTI2OyI%2BPCFFTlRJVFkgaGtzd2Fyb3cgIiYjeDI5MjY7Ij48IUVOVElUWSBud25lYXIgIiYjeDI5Mjc7Ij48IUVOVElUWSBuZXNlYXIgIiYjeDI5Mjg7Ij48IUVOVElUWSB0b2VhICImI3gyOTI4OyI%2BPCFFTlRJVFkgc2Vzd2FyICImI3gyOTI5OyI%2BPCFFTlRJVFkgdG9zYSAiJiN4MjkyOTsiPjwhRU5USVRZIHN3bndhciAiJiN4MjkyQTsiPjwhRU5USVRZIHJhcnJjICImI3gyOTMzOyI%2BPCFFTlRJVFkgbnJhcnJjICImI3gyOTMzOyYjeDMzODsiPjwhRU5USVRZIGN1ZGFycnIgIiYjeDI5MzU7Ij48IUVOVElUWSBsZGNhICImI3gyOTM2OyI%2BPCFFTlRJVFkgcmRjYSAiJiN4MjkzNzsiPjwhRU5USVRZIGN1ZGFycmwgIiYjeDI5Mzg7Ij48IUVOVElUWSBsYXJycGwgIiYjeDI5Mzk7Ij48IUVOVElUWSBjdXJhcnJtICImI3gyOTNDOyI%2BPCFFTlRJVFkgY3VsYXJycCAiJiN4MjkzRDsiPjwhRU5USVRZIHJhcnJwbCAiJiN4Mjk0NTsiPjwhRU5USVRZIGhhcnJjaXIgIiYjeDI5NDg7Ij48IUVOVElUWSBVYXJyb2NpciAiJiN4Mjk0OTsiPjwhRU5USVRZIGx1cmRzaGFyICImI3gyOTRBOyI%2BPCFFTlRJVFkgbGRydXNoYXIgIiYjeDI5NEI7Ij48IUVOVElUWSBMZWZ0UmlnaHRWZWN0b3IgIiYjeDI5NEU7Ij48IUVOVElUWSBSaWdodFVwRG93blZlY3RvciAiJiN4Mjk0RjsiPjwhRU5USVRZIERvd25MZWZ0UmlnaHRWZWN0b3IgIiYjeDI5NTA7Ij48IUVOVElUWSBMZWZ0VXBEb3duVmVjdG9yICImI3gyOTUxOyI%2BPCFFTlRJVFkgTGVmdFZlY3RvckJhciAiJiN4Mjk1MjsiPjwhRU5USVRZIFJpZ2h0VmVjdG9yQmFyICImI3gyOTUzOyI%2BPCFFTlRJVFkgUmlnaHRVcFZlY3RvckJhciAiJiN4Mjk1NDsiPjwhRU5USVRZIFJpZ2h0RG93blZlY3RvckJhciAiJiN4Mjk1NTsiPjwhRU5USVRZIERvd25MZWZ0VmVjdG9yQmFyICImI3gyOTU2OyI%2BPCFFTlRJVFkgRG93blJpZ2h0VmVjdG9yQmFyICImI3gyOTU3OyI%2BPCFFTlRJVFkgTGVmdFVwVmVjdG9yQmFyICImI3gyOTU4OyI%2BPCFFTlRJVFkgTGVmdERvd25WZWN0b3JCYXIgIiYjeDI5NTk7Ij48IUVOVElUWSBMZWZ0VGVlVmVjdG9yICImI3gyOTVBOyI%2BPCFFTlRJVFkgUmlnaHRUZWVWZWN0b3IgIiYjeDI5NUI7Ij48IUVOVElUWSBSaWdodFVwVGVlVmVjdG9yICImI3gyOTVDOyI%2BPCFFTlRJVFkgUmlnaHREb3duVGVlVmVjdG9yICImI3gyOTVEOyI%2BPCFFTlRJVFkgRG93bkxlZnRUZWVWZWN0b3IgIiYjeDI5NUU7Ij48IUVOVElUWSBEb3duUmlnaHRUZWVWZWN0b3IgIiYjeDI5NUY7Ij48IUVOVElUWSBMZWZ0VXBUZWVWZWN0b3IgIiYjeDI5NjA7Ij48IUVOVElUWSBMZWZ0RG93blRlZVZlY3RvciAiJiN4Mjk2MTsiPjwhRU5USVRZIGxIYXIgIiYjeDI5NjI7Ij48IUVOVElUWSB1SGFyICImI3gyOTYzOyI%2BPCFFTlRJVFkgckhhciAiJiN4Mjk2NDsiPjwhRU5USVRZIGRIYXIgIiYjeDI5NjU7Ij48IUVOVElUWSBsdXJ1aGFyICImI3gyOTY2OyI%2BPCFFTlRJVFkgbGRyZGhhciAiJiN4Mjk2NzsiPjwhRU5USVRZIHJ1bHVoYXIgIiYjeDI5Njg7Ij48IUVOVElUWSByZGxkaGFyICImI3gyOTY5OyI%2BPCFFTlRJVFkgbGhhcnVsICImI3gyOTZBOyI%2BPCFFTlRJVFkgbGxoYXJkICImI3gyOTZCOyI%2BPCFFTlRJVFkgcmhhcnVsICImI3gyOTZDOyI%2BPCFFTlRJVFkgbHJoYXJkICImI3gyOTZEOyI%2BPCFFTlRJVFkgdWRoYXIgIiYjeDI5NkU7Ij48IUVOVElUWSBVcEVxdWlsaWJyaXVtICImI3gyOTZFOyI%2BPCFFTlRJVFkgZHVoYXIgIiYjeDI5NkY7Ij48IUVOVElUWSBSZXZlcnNlVXBFcXVpbGlicml1bSAiJiN4Mjk2RjsiPjwhRU5USVRZIFJvdW5kSW1wbGllcyAiJiN4Mjk3MDsiPjwhRU5USVRZIGVyYXJyICImI3gyOTcxOyI%2BPCFFTlRJVFkgc2ltcmFyciAiJiN4Mjk3MjsiPjwhRU5USVRZIGxhcnJzaW0gIiYjeDI5NzM7Ij48IUVOVElUWSByYXJyc2ltICImI3gyOTc0OyI%2BPCFFTlRJVFkgcmFycmFwICImI3gyOTc1OyI%2BPCFFTlRJVFkgbHRsYXJyICImI3gyOTc2OyI%2BPCFFTlRJVFkgZ3RyYXJyICImI3gyOTc4OyI%2BPCFFTlRJVFkgc3VicmFyciAiJiN4Mjk3OTsiPjwhRU5USVRZIHN1cGxhcnIgIiYjeDI5N0I7Ij48IUVOVElUWSBsZmlzaHQgIiYjeDI5N0M7Ij48IUVOVElUWSByZmlzaHQgIiYjeDI5N0Q7Ij48IUVOVElUWSB1ZmlzaHQgIiYjeDI5N0U7Ij48IUVOVElUWSBkZmlzaHQgIiYjeDI5N0Y7Ij48IUVOVElUWSBsb3BhciAiJiN4Mjk4NTsiPjwhRU5USVRZIHJvcGFyICImI3gyOTg2OyI%2BPCFFTlRJVFkgbGJya2UgIiYjeDI5OEI7Ij48IUVOVElUWSByYnJrZSAiJiN4Mjk4QzsiPjwhRU5USVRZIGxicmtzbHUgIiYjeDI5OEQ7Ij48IUVOVElUWSByYnJrc2xkICImI3gyOThFOyI%2BPCFFTlRJVFkgbGJya3NsZCAiJiN4Mjk4RjsiPjwhRU5USVRZIHJicmtzbHUgIiYjeDI5OTA7Ij48IUVOVElUWSBsYW5nZCAiJiN4Mjk5MTsiPjwhRU5USVRZIHJhbmdkICImI3gyOTkyOyI%2BPCFFTlRJVFkgbHBhcmx0ICImI3gyOTkzOyI%2BPCFFTlRJVFkgcnBhcmd0ICImI3gyOTk0OyI%2BPCFFTlRJVFkgZ3RsUGFyICImI3gyOTk1OyI%2BPCFFTlRJVFkgbHRyUGFyICImI3gyOTk2OyI%2BPCFFTlRJVFkgdnppZ3phZyAiJiN4Mjk5QTsiPjwhRU5USVRZIHZhbmdydCAiJiN4Mjk5QzsiPjwhRU5USVRZIGFuZ3J0dmJkICImI3gyOTlEOyI%2BPCFFTlRJVFkgYW5nZSAiJiN4MjlBNDsiPjwhRU5USVRZIHJhbmdlICImI3gyOUE1OyI%2BPCFFTlRJVFkgZHdhbmdsZSAiJiN4MjlBNjsiPjwhRU5USVRZIHV3YW5nbGUgIiYjeDI5QTc7Ij48IUVOVElUWSBhbmdtc2RhYSAiJiN4MjlBODsiPjwhRU5USVRZIGFuZ21zZGFiICImI3gyOUE5OyI%2BPCFFTlRJVFkgYW5nbXNkYWMgIiYjeDI5QUE7Ij48IUVOVElUWSBhbmdtc2RhZCAiJiN4MjlBQjsiPjwhRU5USVRZIGFuZ21zZGFlICImI3gyOUFDOyI%2BPCFFTlRJVFkgYW5nbXNkYWYgIiYjeDI5QUQ7Ij48IUVOVElUWSBhbmdtc2RhZyAiJiN4MjlBRTsiPjwhRU5USVRZIGFuZ21zZGFoICImI3gyOUFGOyI%2BPCFFTlRJVFkgYmVtcHR5diAiJiN4MjlCMDsiPjwhRU5USVRZIGRlbXB0eXYgIiYjeDI5QjE7Ij48IUVOVElUWSBjZW1wdHl2ICImI3gyOUIyOyI%2BPCFFTlRJVFkgcmFlbXB0eXYgIiYjeDI5QjM7Ij48IUVOVElUWSBsYWVtcHR5diAiJiN4MjlCNDsiPjwhRU5USVRZIG9oYmFyICImI3gyOUI1OyI%2BPCFFTlRJVFkgb21pZCAiJiN4MjlCNjsiPjwhRU5USVRZIG9wYXIgIiYjeDI5Qjc7Ij48IUVOVElUWSBvcGVycCAiJiN4MjlCOTsiPjwhRU5USVRZIG9sY3Jvc3MgIiYjeDI5QkI7Ij48IUVOVElUWSBvZHNvbGQgIiYjeDI5QkM7Ij48IUVOVElUWSBvbGNpciAiJiN4MjlCRTsiPjwhRU5USVRZIG9mY2lyICImI3gyOUJGOyI%2BPCFFTlRJVFkgb2x0ICImI3gyOUMwOyI%2BPCFFTlRJVFkgb2d0ICImI3gyOUMxOyI%2BPCFFTlRJVFkgY2lyc2NpciAiJiN4MjlDMjsiPjwhRU5USVRZIGNpckUgIiYjeDI5QzM7Ij48IUVOVElUWSBzb2xiICImI3gyOUM0OyI%2BPCFFTlRJVFkgYnNvbGIgIiYjeDI5QzU7Ij48IUVOVElUWSBib3hib3ggIiYjeDI5Qzk7Ij48IUVOVElUWSB0cmlzYiAiJiN4MjlDRDsiPjwhRU5USVRZIHJ0cmlsdHJpICImI3gyOUNFOyI%2BPCFFTlRJVFkgTGVmdFRyaWFuZ2xlQmFyICImI3gyOUNGOyI%2BPCFFTlRJVFkgTm90TGVmdFRyaWFuZ2xlQmFyICImI3gyOUNGOyYjeDMzODsiPjwhRU5USVRZIFJpZ2h0VHJpYW5nbGVCYXIgIiYjeDI5RDA7Ij48IUVOVElUWSBOb3RSaWdodFRyaWFuZ2xlQmFyICImI3gyOUQwOyYjeDMzODsiPjwhRU5USVRZIGlpbmZpbiAiJiN4MjlEQzsiPjwhRU5USVRZIGluZmludGllICImI3gyOUREOyI%2BPCFFTlRJVFkgbnZpbmZpbiAiJiN4MjlERTsiPjwhRU5USVRZIGVwYXJzbCAiJiN4MjlFMzsiPjwhRU5USVRZIHNtZXBhcnNsICImI3gyOUU0OyI%2BPCFFTlRJVFkgZXF2cGFyc2wgIiYjeDI5RTU7Ij48IUVOVElUWSBsb3pmICImI3gyOUVCOyI%2BPCFFTlRJVFkgYmxhY2tsb3plbmdlICImI3gyOUVCOyI%2BPCFFTlRJVFkgUnVsZURlbGF5ZWQgIiYjeDI5RjQ7Ij48IUVOVElUWSBkc29sICImI3gyOUY2OyI%2BPCFFTlRJVFkgeG9kb3QgIiYjeDJBMDA7Ij48IUVOVElUWSBiaWdvZG90ICImI3gyQTAwOyI%2BPCFFTlRJVFkgeG9wbHVzICImI3gyQTAxOyI%2BPCFFTlRJVFkgYmlnb3BsdXMgIiYjeDJBMDE7Ij48IUVOVElUWSB4b3RpbWUgIiYjeDJBMDI7Ij48IUVOVElUWSBiaWdvdGltZXMgIiYjeDJBMDI7Ij48IUVOVElUWSB4dXBsdXMgIiYjeDJBMDQ7Ij48IUVOVElUWSBiaWd1cGx1cyAiJiN4MkEwNDsiPjwhRU5USVRZIHhzcWN1cCAiJiN4MkEwNjsiPjwhRU5USVRZIGJpZ3NxY3VwICImI3gyQTA2OyI%2BPCFFTlRJVFkgcWludCAiJiN4MkEwQzsiPjwhRU5USVRZIGlpaWludCAiJiN4MkEwQzsiPjwhRU5USVRZIGZwYXJ0aW50ICImI3gyQTBEOyI%2BPCFFTlRJVFkgY2lyZm5pbnQgIiYjeDJBMTA7Ij48IUVOVElUWSBhd2ludCAiJiN4MkExMTsiPjwhRU5USVRZIHJwcG9saW50ICImI3gyQTEyOyI%2BPCFFTlRJVFkgc2Nwb2xpbnQgIiYjeDJBMTM7Ij48IUVOVElUWSBucG9saW50ICImI3gyQTE0OyI%2BPCFFTlRJVFkgcG9pbnRpbnQgIiYjeDJBMTU7Ij48IUVOVElUWSBxdWF0aW50ICImI3gyQTE2OyI%2BPCFFTlRJVFkgaW50bGFyaGsgIiYjeDJBMTc7Ij48IUVOVElUWSBwbHVzY2lyICImI3gyQTIyOyI%2BPCFFTlRJVFkgcGx1c2FjaXIgIiYjeDJBMjM7Ij48IUVOVElUWSBzaW1wbHVzICImI3gyQTI0OyI%2BPCFFTlRJVFkgcGx1c2R1ICImI3gyQTI1OyI%2BPCFFTlRJVFkgcGx1c3NpbSAiJiN4MkEyNjsiPjwhRU5USVRZIHBsdXN0d28gIiYjeDJBMjc7Ij48IUVOVElUWSBtY29tbWEgIiYjeDJBMjk7Ij48IUVOVElUWSBtaW51c2R1ICImI3gyQTJBOyI%2BPCFFTlRJVFkgbG9wbHVzICImI3gyQTJEOyI%2BPCFFTlRJVFkgcm9wbHVzICImI3gyQTJFOyI%2BPCFFTlRJVFkgQ3Jvc3MgIiYjeDJBMkY7Ij48IUVOVElUWSB0aW1lc2QgIiYjeDJBMzA7Ij48IUVOVElUWSB0aW1lc2JhciAiJiN4MkEzMTsiPjwhRU5USVRZIHNtYXNocCAiJiN4MkEzMzsiPjwhRU5USVRZIGxvdGltZXMgIiYjeDJBMzQ7Ij48IUVOVElUWSByb3RpbWVzICImI3gyQTM1OyI%2BPCFFTlRJVFkgb3RpbWVzYXMgIiYjeDJBMzY7Ij48IUVOVElUWSBPdGltZXMgIiYjeDJBMzc7Ij48IUVOVElUWSBvZGl2ICImI3gyQTM4OyI%2BPCFFTlRJVFkgdHJpcGx1cyAiJiN4MkEzOTsiPjwhRU5USVRZIHRyaW1pbnVzICImI3gyQTNBOyI%2BPCFFTlRJVFkgdHJpdGltZSAiJiN4MkEzQjsiPjwhRU5USVRZIGlwcm9kICImI3gyQTNDOyI%2BPCFFTlRJVFkgaW50cHJvZCAiJiN4MkEzQzsiPjwhRU5USVRZIGFtYWxnICImI3gyQTNGOyI%2BPCFFTlRJVFkgY2FwZG90ICImI3gyQTQwOyI%2BPCFFTlRJVFkgbmN1cCAiJiN4MkE0MjsiPjwhRU5USVRZIG5jYXAgIiYjeDJBNDM7Ij48IUVOVElUWSBjYXBhbmQgIiYjeDJBNDQ7Ij48IUVOVElUWSBjdXBvciAiJiN4MkE0NTsiPjwhRU5USVRZIGN1cGNhcCAiJiN4MkE0NjsiPjwhRU5USVRZIGNhcGN1cCAiJiN4MkE0NzsiPjwhRU5USVRZIGN1cGJyY2FwICImI3gyQTQ4OyI%2BPCFFTlRJVFkgY2FwYnJjdXAgIiYjeDJBNDk7Ij48IUVOVElUWSBjdXBjdXAgIiYjeDJBNEE7Ij48IUVOVElUWSBjYXBjYXAgIiYjeDJBNEI7Ij48IUVOVElUWSBjY3VwcyAiJiN4MkE0QzsiPjwhRU5USVRZIGNjYXBzICImI3gyQTREOyI%2BPCFFTlRJVFkgY2N1cHNzbSAiJiN4MkE1MDsiPjwhRU5USVRZIEFuZCAiJiN4MkE1MzsiPjwhRU5USVRZIE9yICImI3gyQTU0OyI%2BPCFFTlRJVFkgYW5kYW5kICImI3gyQTU1OyI%2BPCFFTlRJVFkgb3JvciAiJiN4MkE1NjsiPjwhRU5USVRZIG9yc2xvcGUgIiYjeDJBNTc7Ij48IUVOVElUWSBhbmRzbG9wZSAiJiN4MkE1ODsiPjwhRU5USVRZIGFuZHYgIiYjeDJBNUE7Ij48IUVOVElUWSBvcnYgIiYjeDJBNUI7Ij48IUVOVElUWSBhbmRkICImI3gyQTVDOyI%2BPCFFTlRJVFkgb3JkICImI3gyQTVEOyI%2BPCFFTlRJVFkgd2VkYmFyICImI3gyQTVGOyI%2BPCFFTlRJVFkgc2RvdGUgIiYjeDJBNjY7Ij48IUVOVElUWSBzaW1kb3QgIiYjeDJBNkE7Ij48IUVOVElUWSBjb25nZG90ICImI3gyQTZEOyI%2BPCFFTlRJVFkgbmNvbmdkb3QgIiYjeDJBNkQ7JiN4MzM4OyI%2BPCFFTlRJVFkgZWFzdGVyICImI3gyQTZFOyI%2BPCFFTlRJVFkgYXBhY2lyICImI3gyQTZGOyI%2BPCFFTlRJVFkgYXBFICImI3gyQTcwOyI%2BPCFFTlRJVFkgbmFwRSAiJiN4MkE3MDsmI3gzMzg7Ij48IUVOVElUWSBlcGx1cyAiJiN4MkE3MTsiPjwhRU5USVRZIHBsdXNlICImI3gyQTcyOyI%2BPCFFTlRJVFkgRXNpbSAiJiN4MkE3MzsiPjwhRU5USVRZIENvbG9uZSAiJiN4MkE3NDsiPjwhRU5USVRZIEVxdWFsICImI3gyQTc1OyI%2BPCFFTlRJVFkgZUREb3QgIiYjeDJBNzc7Ij48IUVOVElUWSBkZG90c2VxICImI3gyQTc3OyI%2BPCFFTlRJVFkgZXF1aXZERCAiJiN4MkE3ODsiPjwhRU5USVRZIGx0Y2lyICImI3gyQTc5OyI%2BPCFFTlRJVFkgZ3RjaXIgIiYjeDJBN0E7Ij48IUVOVElUWSBsdHF1ZXN0ICImI3gyQTdCOyI%2BPCFFTlRJVFkgZ3RxdWVzdCAiJiN4MkE3QzsiPjwhRU5USVRZIGxlcyAiJiN4MkE3RDsiPjwhRU5USVRZIExlc3NTbGFudEVxdWFsICImI3gyQTdEOyI%2BPCFFTlRJVFkgbGVxc2xhbnQgIiYjeDJBN0Q7Ij48IUVOVElUWSBubGVzICImI3gyQTdEOyYjeDMzODsiPjwhRU5USVRZIE5vdExlc3NTbGFudEVxdWFsICImI3gyQTdEOyYjeDMzODsiPjwhRU5USVRZIG5sZXFzbGFudCAiJiN4MkE3RDsmI3gzMzg7Ij48IUVOVElUWSBnZXMgIiYjeDJBN0U7Ij48IUVOVElUWSBHcmVhdGVyU2xhbnRFcXVhbCAiJiN4MkE3RTsiPjwhRU5USVRZIGdlcXNsYW50ICImI3gyQTdFOyI%2BPCFFTlRJVFkgbmdlcyAiJiN4MkE3RTsmI3gzMzg7Ij48IUVOVElUWSBOb3RHcmVhdGVyU2xhbnRFcXVhbCAiJiN4MkE3RTsmI3gzMzg7Ij48IUVOVElUWSBuZ2Vxc2xhbnQgIiYjeDJBN0U7JiN4MzM4OyI%2BPCFFTlRJVFkgbGVzZG90ICImI3gyQTdGOyI%2BPCFFTlRJVFkgZ2VzZG90ICImI3gyQTgwOyI%2BPCFFTlRJVFkgbGVzZG90byAiJiN4MkE4MTsiPjwhRU5USVRZIGdlc2RvdG8gIiYjeDJBODI7Ij48IUVOVElUWSBsZXNkb3RvciAiJiN4MkE4MzsiPjwhRU5USVRZIGdlc2RvdG9sICImI3gyQTg0OyI%2BPCFFTlRJVFkgbGFwICImI3gyQTg1OyI%2BPCFFTlRJVFkgbGVzc2FwcHJveCAiJiN4MkE4NTsiPjwhRU5USVRZIGdhcCAiJiN4MkE4NjsiPjwhRU5USVRZIGd0cmFwcHJveCAiJiN4MkE4NjsiPjwhRU5USVRZIGxuZSAiJiN4MkE4NzsiPjwhRU5USVRZIGxuZXEgIiYjeDJBODc7Ij48IUVOVElUWSBnbmUgIiYjeDJBODg7Ij48IUVOVElUWSBnbmVxICImI3gyQTg4OyI%2BPCFFTlRJVFkgbG5hcCAiJiN4MkE4OTsiPjwhRU5USVRZIGxuYXBwcm94ICImI3gyQTg5OyI%2BPCFFTlRJVFkgZ25hcCAiJiN4MkE4QTsiPjwhRU5USVRZIGduYXBwcm94ICImI3gyQThBOyI%2BPCFFTlRJVFkgbEVnICImI3gyQThCOyI%2BPCFFTlRJVFkgbGVzc2VxcWd0ciAiJiN4MkE4QjsiPjwhRU5USVRZIGdFbCAiJiN4MkE4QzsiPjwhRU5USVRZIGd0cmVxcWxlc3MgIiYjeDJBOEM7Ij48IUVOVElUWSBsc2ltZSAiJiN4MkE4RDsiPjwhRU5USVRZIGdzaW1lICImI3gyQThFOyI%2BPCFFTlRJVFkgbHNpbWcgIiYjeDJBOEY7Ij48IUVOVElUWSBnc2ltbCAiJiN4MkE5MDsiPjwhRU5USVRZIGxnRSAiJiN4MkE5MTsiPjwhRU5USVRZIGdsRSAiJiN4MkE5MjsiPjwhRU5USVRZIGxlc2dlcyAiJiN4MkE5MzsiPjwhRU5USVRZIGdlc2xlcyAiJiN4MkE5NDsiPjwhRU5USVRZIGVscyAiJiN4MkE5NTsiPjwhRU5USVRZIGVxc2xhbnRsZXNzICImI3gyQTk1OyI%2BPCFFTlRJVFkgZWdzICImI3gyQTk2OyI%2BPCFFTlRJVFkgZXFzbGFudGd0ciAiJiN4MkE5NjsiPjwhRU5USVRZIGVsc2RvdCAiJiN4MkE5NzsiPjwhRU5USVRZIGVnc2RvdCAiJiN4MkE5ODsiPjwhRU5USVRZIGVsICImI3gyQTk5OyI%2BPCFFTlRJVFkgZWcgIiYjeDJBOUE7Ij48IUVOVElUWSBzaW1sICImI3gyQTlEOyI%2BPCFFTlRJVFkgc2ltZyAiJiN4MkE5RTsiPjwhRU5USVRZIHNpbWxFICImI3gyQTlGOyI%2BPCFFTlRJVFkgc2ltZ0UgIiYjeDJBQTA7Ij48IUVOVElUWSBMZXNzTGVzcyAiJiN4MkFBMTsiPjwhRU5USVRZIE5vdE5lc3RlZExlc3NMZXNzICImI3gyQUExOyYjeDMzODsiPjwhRU5USVRZIEdyZWF0ZXJHcmVhdGVyICImI3gyQUEyOyI%2BPCFFTlRJVFkgTm90TmVzdGVkR3JlYXRlckdyZWF0ZXIgIiYjeDJBQTI7JiN4MzM4OyI%2BPCFFTlRJVFkgZ2xqICImI3gyQUE0OyI%2BPCFFTlRJVFkgZ2xhICImI3gyQUE1OyI%2BPCFFTlRJVFkgbHRjYyAiJiN4MkFBNjsiPjwhRU5USVRZIGd0Y2MgIiYjeDJBQTc7Ij48IUVOVElUWSBsZXNjYyAiJiN4MkFBODsiPjwhRU5USVRZIGdlc2NjICImI3gyQUE5OyI%2BPCFFTlRJVFkgc210ICImI3gyQUFBOyI%2BPCFFTlRJVFkgbGF0ICImI3gyQUFCOyI%2BPCFFTlRJVFkgc210ZSAiJiN4MkFBQzsiPjwhRU5USVRZIHNtdGVzICImI3gyQUFDOyYjeEZFMDA7Ij48IUVOVElUWSBsYXRlICImI3gyQUFEOyI%2BPCFFTlRJVFkgbGF0ZXMgIiYjeDJBQUQ7JiN4RkUwMDsiPjwhRU5USVRZIGJ1bXBFICImI3gyQUFFOyI%2BPCFFTlRJVFkgcHJlICImI3gyQUFGOyI%2BPCFFTlRJVFkgcHJlY2VxICImI3gyQUFGOyI%2BPCFFTlRJVFkgUHJlY2VkZXNFcXVhbCAiJiN4MkFBRjsiPjwhRU5USVRZIG5wcmUgIiYjeDJBQUY7JiN4MzM4OyI%2BPCFFTlRJVFkgbnByZWNlcSAiJiN4MkFBRjsmI3gzMzg7Ij48IUVOVElUWSBOb3RQcmVjZWRlc0VxdWFsICImI3gyQUFGOyYjeDMzODsiPjwhRU5USVRZIHNjZSAiJiN4MkFCMDsiPjwhRU5USVRZIHN1Y2NlcSAiJiN4MkFCMDsiPjwhRU5USVRZIFN1Y2NlZWRzRXF1YWwgIiYjeDJBQjA7Ij48IUVOVElUWSBuc2NlICImI3gyQUIwOyYjeDMzODsiPjwhRU5USVRZIG5zdWNjZXEgIiYjeDJBQjA7JiN4MzM4OyI%2BPCFFTlRJVFkgTm90U3VjY2VlZHNFcXVhbCAiJiN4MkFCMDsmI3gzMzg7Ij48IUVOVElUWSBwckUgIiYjeDJBQjM7Ij48IUVOVElUWSBzY0UgIiYjeDJBQjQ7Ij48IUVOVElUWSBwcm5FICImI3gyQUI1OyI%2BPCFFTlRJVFkgcHJlY25lcXEgIiYjeDJBQjU7Ij48IUVOVElUWSBzY25FICImI3gyQUI2OyI%2BPCFFTlRJVFkgc3VjY25lcXEgIiYjeDJBQjY7Ij48IUVOVElUWSBwcmFwICImI3gyQUI3OyI%2BPCFFTlRJVFkgcHJlY2FwcHJveCAiJiN4MkFCNzsiPjwhRU5USVRZIHNjYXAgIiYjeDJBQjg7Ij48IUVOVElUWSBzdWNjYXBwcm94ICImI3gyQUI4OyI%2BPCFFTlRJVFkgcHJuYXAgIiYjeDJBQjk7Ij48IUVOVElUWSBwcmVjbmFwcHJveCAiJiN4MkFCOTsiPjwhRU5USVRZIHNjbmFwICImI3gyQUJBOyI%2BPCFFTlRJVFkgc3VjY25hcHByb3ggIiYjeDJBQkE7Ij48IUVOVElUWSBQciAiJiN4MkFCQjsiPjwhRU5USVRZIFNjICImI3gyQUJDOyI%2BPCFFTlRJVFkgc3ViZG90ICImI3gyQUJEOyI%2BPCFFTlRJVFkgc3VwZG90ICImI3gyQUJFOyI%2BPCFFTlRJVFkgc3VicGx1cyAiJiN4MkFCRjsiPjwhRU5USVRZIHN1cHBsdXMgIiYjeDJBQzA7Ij48IUVOVElUWSBzdWJtdWx0ICImI3gyQUMxOyI%2BPCFFTlRJVFkgc3VwbXVsdCAiJiN4MkFDMjsiPjwhRU5USVRZIHN1YmVkb3QgIiYjeDJBQzM7Ij48IUVOVElUWSBzdXBlZG90ICImI3gyQUM0OyI%2BPCFFTlRJVFkgc3ViRSAiJiN4MkFDNTsiPjwhRU5USVRZIHN1YnNldGVxcSAiJiN4MkFDNTsiPjwhRU5USVRZIG5zdWJFICImI3gyQUM1OyYjeDMzODsiPjwhRU5USVRZIG5zdWJzZXRlcXEgIiYjeDJBQzU7JiN4MzM4OyI%2BPCFFTlRJVFkgc3VwRSAiJiN4MkFDNjsiPjwhRU5USVRZIHN1cHNldGVxcSAiJiN4MkFDNjsiPjwhRU5USVRZIG5zdXBFICImI3gyQUM2OyYjeDMzODsiPjwhRU5USVRZIG5zdXBzZXRlcXEgIiYjeDJBQzY7JiN4MzM4OyI%2BPCFFTlRJVFkgc3Vic2ltICImI3gyQUM3OyI%2BPCFFTlRJVFkgc3Vwc2ltICImI3gyQUM4OyI%2BPCFFTlRJVFkgc3VibkUgIiYjeDJBQ0I7Ij48IUVOVElUWSBzdWJzZXRuZXFxICImI3gyQUNCOyI%2BPCFFTlRJVFkgdnN1Ym5FICImI3gyQUNCOyYjeEZFMDA7Ij48IUVOVElUWSB2YXJzdWJzZXRuZXFxICImI3gyQUNCOyYjeEZFMDA7Ij48IUVOVElUWSBzdXBuRSAiJiN4MkFDQzsiPjwhRU5USVRZIHN1cHNldG5lcXEgIiYjeDJBQ0M7Ij48IUVOVElUWSB2c3VwbkUgIiYjeDJBQ0M7JiN4RkUwMDsiPjwhRU5USVRZIHZhcnN1cHNldG5lcXEgIiYjeDJBQ0M7JiN4RkUwMDsiPjwhRU5USVRZIGNzdWIgIiYjeDJBQ0Y7Ij48IUVOVElUWSBjc3VwICImI3gyQUQwOyI%2BPCFFTlRJVFkgY3N1YmUgIiYjeDJBRDE7Ij48IUVOVElUWSBjc3VwZSAiJiN4MkFEMjsiPjwhRU5USVRZIHN1YnN1cCAiJiN4MkFEMzsiPjwhRU5USVRZIHN1cHN1YiAiJiN4MkFENDsiPjwhRU5USVRZIHN1YnN1YiAiJiN4MkFENTsiPjwhRU5USVRZIHN1cHN1cCAiJiN4MkFENjsiPjwhRU5USVRZIHN1cGhzdWIgIiYjeDJBRDc7Ij48IUVOVElUWSBzdXBkc3ViICImI3gyQUQ4OyI%2BPCFFTlRJVFkgZm9ya3YgIiYjeDJBRDk7Ij48IUVOVElUWSB0b3Bmb3JrICImI3gyQURBOyI%2BPCFFTlRJVFkgbWxjcCAiJiN4MkFEQjsiPjwhRU5USVRZIERhc2h2ICImI3gyQUU0OyI%2BPCFFTlRJVFkgRG91YmxlTGVmdFRlZSAiJiN4MkFFNDsiPjwhRU5USVRZIFZkYXNobCAiJiN4MkFFNjsiPjwhRU5USVRZIEJhcnYgIiYjeDJBRTc7Ij48IUVOVElUWSB2QmFyICImI3gyQUU4OyI%2BPCFFTlRJVFkgdkJhcnYgIiYjeDJBRTk7Ij48IUVOVElUWSBWYmFyICImI3gyQUVCOyI%2BPCFFTlRJVFkgTm90ICImI3gyQUVDOyI%2BPCFFTlRJVFkgYk5vdCAiJiN4MkFFRDsiPjwhRU5USVRZIHJubWlkICImI3gyQUVFOyI%2BPCFFTlRJVFkgY2lybWlkICImI3gyQUVGOyI%2BPCFFTlRJVFkgbWlkY2lyICImI3gyQUYwOyI%2BPCFFTlRJVFkgdG9wY2lyICImI3gyQUYxOyI%2BPCFFTlRJVFkgbmhwYXIgIiYjeDJBRjI7Ij48IUVOVElUWSBwYXJzaW0gIiYjeDJBRjM7Ij48IUVOVElUWSBwYXJzbCAiJiN4MkFGRDsiPjwhRU5USVRZIG5wYXJzbCAiJiN4MkFGRDsmI3gyMEU1OyI%2BPCFFTlRJVFkgZmZsaWcgIiYjeEZCMDA7Ij48IUVOVElUWSBmaWxpZyAiJiN4RkIwMTsiPjwhRU5USVRZIGZsbGlnICImI3hGQjAyOyI%2BPCFFTlRJVFkgZmZpbGlnICImI3hGQjAzOyI%2BPCFFTlRJVFkgZmZsbGlnICImI3hGQjA0OyI%2BPCFFTlRJVFkgQXNjciAiJiN4MUQ0OUM7Ij48IUVOVElUWSBDc2NyICImI3gxRDQ5RTsiPjwhRU5USVRZIERzY3IgIiYjeDFENDlGOyI%2BPCFFTlRJVFkgR3NjciAiJiN4MUQ0QTI7Ij48IUVOVElUWSBKc2NyICImI3gxRDRBNTsiPjwhRU5USVRZIEtzY3IgIiYjeDFENEE2OyI%2BPCFFTlRJVFkgTnNjciAiJiN4MUQ0QTk7Ij48IUVOVElUWSBPc2NyICImI3gxRDRBQTsiPjwhRU5USVRZIFBzY3IgIiYjeDFENEFCOyI%2BPCFFTlRJVFkgUXNjciAiJiN4MUQ0QUM7Ij48IUVOVElUWSBTc2NyICImI3gxRDRBRTsiPjwhRU5USVRZIFRzY3IgIiYjeDFENEFGOyI%2BPCFFTlRJVFkgVXNjciAiJiN4MUQ0QjA7Ij48IUVOVElUWSBWc2NyICImI3gxRDRCMTsiPjwhRU5USVRZIFdzY3IgIiYjeDFENEIyOyI%2BPCFFTlRJVFkgWHNjciAiJiN4MUQ0QjM7Ij48IUVOVElUWSBZc2NyICImI3gxRDRCNDsiPjwhRU5USVRZIFpzY3IgIiYjeDFENEI1OyI%2BPCFFTlRJVFkgYXNjciAiJiN4MUQ0QjY7Ij48IUVOVElUWSBic2NyICImI3gxRDRCNzsiPjwhRU5USVRZIGNzY3IgIiYjeDFENEI4OyI%2BPCFFTlRJVFkgZHNjciAiJiN4MUQ0Qjk7Ij48IUVOVElUWSBmc2NyICImI3gxRDRCQjsiPjwhRU5USVRZIGhzY3IgIiYjeDFENEJEOyI%2BPCFFTlRJVFkgaXNjciAiJiN4MUQ0QkU7Ij48IUVOVElUWSBqc2NyICImI3gxRDRCRjsiPjwhRU5USVRZIGtzY3IgIiYjeDFENEMwOyI%2BPCFFTlRJVFkgbHNjciAiJiN4MUQ0QzE7Ij48IUVOVElUWSBtc2NyICImI3gxRDRDMjsiPjwhRU5USVRZIG5zY3IgIiYjeDFENEMzOyI%2BPCFFTlRJVFkgcHNjciAiJiN4MUQ0QzU7Ij48IUVOVElUWSBxc2NyICImI3gxRDRDNjsiPjwhRU5USVRZIHJzY3IgIiYjeDFENEM3OyI%2BPCFFTlRJVFkgc3NjciAiJiN4MUQ0Qzg7Ij48IUVOVElUWSB0c2NyICImI3gxRDRDOTsiPjwhRU5USVRZIHVzY3IgIiYjeDFENENBOyI%2BPCFFTlRJVFkgdnNjciAiJiN4MUQ0Q0I7Ij48IUVOVElUWSB3c2NyICImI3gxRDRDQzsiPjwhRU5USVRZIHhzY3IgIiYjeDFENENEOyI%2BPCFFTlRJVFkgeXNjciAiJiN4MUQ0Q0U7Ij48IUVOVElUWSB6c2NyICImI3gxRDRDRjsiPjwhRU5USVRZIEFmciAiJiN4MUQ1MDQ7Ij48IUVOVElUWSBCZnIgIiYjeDFENTA1OyI%2BPCFFTlRJVFkgRGZyICImI3gxRDUwNzsiPjwhRU5USVRZIEVmciAiJiN4MUQ1MDg7Ij48IUVOVElUWSBGZnIgIiYjeDFENTA5OyI%2BPCFFTlRJVFkgR2ZyICImI3gxRDUwQTsiPjwhRU5USVRZIEpmciAiJiN4MUQ1MEQ7Ij48IUVOVElUWSBLZnIgIiYjeDFENTBFOyI%2BPCFFTlRJVFkgTGZyICImI3gxRDUwRjsiPjwhRU5USVRZIE1mciAiJiN4MUQ1MTA7Ij48IUVOVElUWSBOZnIgIiYjeDFENTExOyI%2BPCFFTlRJVFkgT2ZyICImI3gxRDUxMjsiPjwhRU5USVRZIFBmciAiJiN4MUQ1MTM7Ij48IUVOVElUWSBRZnIgIiYjeDFENTE0OyI%2BPCFFTlRJVFkgU2ZyICImI3gxRDUxNjsiPjwhRU5USVRZIFRmciAiJiN4MUQ1MTc7Ij48IUVOVElUWSBVZnIgIiYjeDFENTE4OyI%2BPCFFTlRJVFkgVmZyICImI3gxRDUxOTsiPjwhRU5USVRZIFdmciAiJiN4MUQ1MUE7Ij48IUVOVElUWSBYZnIgIiYjeDFENTFCOyI%2BPCFFTlRJVFkgWWZyICImI3gxRDUxQzsiPjwhRU5USVRZIGFmciAiJiN4MUQ1MUU7Ij48IUVOVElUWSBiZnIgIiYjeDFENTFGOyI%2BPCFFTlRJVFkgY2ZyICImI3gxRDUyMDsiPjwhRU5USVRZIGRmciAiJiN4MUQ1MjE7Ij48IUVOVElUWSBlZnIgIiYjeDFENTIyOyI%2BPCFFTlRJVFkgZmZyICImI3gxRDUyMzsiPjwhRU5USVRZIGdmciAiJiN4MUQ1MjQ7Ij48IUVOVElUWSBoZnIgIiYjeDFENTI1OyI%2BPCFFTlRJVFkgaWZyICImI3gxRDUyNjsiPjwhRU5USVRZIGpmciAiJiN4MUQ1Mjc7Ij48IUVOVElUWSBrZnIgIiYjeDFENTI4OyI%2BPCFFTlRJVFkgbGZyICImI3gxRDUyOTsiPjwhRU5USVRZIG1mciAiJiN4MUQ1MkE7Ij48IUVOVElUWSBuZnIgIiYjeDFENTJCOyI%2BPCFFTlRJVFkgb2ZyICImI3gxRDUyQzsiPjwhRU5USVRZIHBmciAiJiN4MUQ1MkQ7Ij48IUVOVElUWSBxZnIgIiYjeDFENTJFOyI%2BPCFFTlRJVFkgcmZyICImI3gxRDUyRjsiPjwhRU5USVRZIHNmciAiJiN4MUQ1MzA7Ij48IUVOVElUWSB0ZnIgIiYjeDFENTMxOyI%2BPCFFTlRJVFkgdWZyICImI3gxRDUzMjsiPjwhRU5USVRZIHZmciAiJiN4MUQ1MzM7Ij48IUVOVElUWSB3ZnIgIiYjeDFENTM0OyI%2BPCFFTlRJVFkgeGZyICImI3gxRDUzNTsiPjwhRU5USVRZIHlmciAiJiN4MUQ1MzY7Ij48IUVOVElUWSB6ZnIgIiYjeDFENTM3OyI%2BPCFFTlRJVFkgQW9wZiAiJiN4MUQ1Mzg7Ij48IUVOVElUWSBCb3BmICImI3gxRDUzOTsiPjwhRU5USVRZIERvcGYgIiYjeDFENTNCOyI%2BPCFFTlRJVFkgRW9wZiAiJiN4MUQ1M0M7Ij48IUVOVElUWSBGb3BmICImI3gxRDUzRDsiPjwhRU5USVRZIEdvcGYgIiYjeDFENTNFOyI%2BPCFFTlRJVFkgSW9wZiAiJiN4MUQ1NDA7Ij48IUVOVElUWSBKb3BmICImI3gxRDU0MTsiPjwhRU5USVRZIEtvcGYgIiYjeDFENTQyOyI%2BPCFFTlRJVFkgTG9wZiAiJiN4MUQ1NDM7Ij48IUVOVElUWSBNb3BmICImI3gxRDU0NDsiPjwhRU5USVRZIE9vcGYgIiYjeDFENTQ2OyI%2BPCFFTlRJVFkgU29wZiAiJiN4MUQ1NEE7Ij48IUVOVElUWSBUb3BmICImI3gxRDU0QjsiPjwhRU5USVRZIFVvcGYgIiYjeDFENTRDOyI%2BPCFFTlRJVFkgVm9wZiAiJiN4MUQ1NEQ7Ij48IUVOVElUWSBXb3BmICImI3gxRDU0RTsiPjwhRU5USVRZIFhvcGYgIiYjeDFENTRGOyI%2BPCFFTlRJVFkgWW9wZiAiJiN4MUQ1NTA7Ij48IUVOVElUWSBhb3BmICImI3gxRDU1MjsiPjwhRU5USVRZIGJvcGYgIiYjeDFENTUzOyI%2BPCFFTlRJVFkgY29wZiAiJiN4MUQ1NTQ7Ij48IUVOVElUWSBkb3BmICImI3gxRDU1NTsiPjwhRU5USVRZIGVvcGYgIiYjeDFENTU2OyI%2BPCFFTlRJVFkgZm9wZiAiJiN4MUQ1NTc7Ij48IUVOVElUWSBnb3BmICImI3gxRDU1ODsiPjwhRU5USVRZIGhvcGYgIiYjeDFENTU5OyI%2BPCFFTlRJVFkgaW9wZiAiJiN4MUQ1NUE7Ij48IUVOVElUWSBqb3BmICImI3gxRDU1QjsiPjwhRU5USVRZIGtvcGYgIiYjeDFENTVDOyI%2BPCFFTlRJVFkgbG9wZiAiJiN4MUQ1NUQ7Ij48IUVOVElUWSBtb3BmICImI3gxRDU1RTsiPjwhRU5USVRZIG5vcGYgIiYjeDFENTVGOyI%2BPCFFTlRJVFkgb29wZiAiJiN4MUQ1NjA7Ij48IUVOVElUWSBwb3BmICImI3gxRDU2MTsiPjwhRU5USVRZIHFvcGYgIiYjeDFENTYyOyI%2BPCFFTlRJVFkgcm9wZiAiJiN4MUQ1NjM7Ij48IUVOVElUWSBzb3BmICImI3gxRDU2NDsiPjwhRU5USVRZIHRvcGYgIiYjeDFENTY1OyI%2BPCFFTlRJVFkgdW9wZiAiJiN4MUQ1NjY7Ij48IUVOVElUWSB2b3BmICImI3gxRDU2NzsiPjwhRU5USVRZIHdvcGYgIiYjeDFENTY4OyI%2BPCFFTlRJVFkgeG9wZiAiJiN4MUQ1Njk7Ij48IUVOVElUWSB5b3BmICImI3gxRDU2QTsiPjwhRU5USVRZIHpvcGYgIiYjeDFENTZCOyI%2B>the URL given by this link/a>. (This URL is a DTD containing the a hrefhttps://www.w3.org/TR/xml/#sec-entity-decl>entity declarations/a> for the names listed in the a href#named-character-references idparsing-xhtml-documents:named-character-references>named character references/a> section.) a href#refsXML>XML/a>/p> ul classbrief>li>code>-//W3C//DTD XHTML 1.0 Transitional//EN/code>li>code>-//W3C//DTD XHTML 1.1//EN/code>li>code>-//W3C//DTD XHTML 1.0 Strict//EN/code>li>code>-//W3C//DTD XHTML 1.0 Frameset//EN/code>li>code>-//W3C//DTD XHTML Basic 1.0//EN/code>li>code>-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN/code>li>code>-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN/code>li>code>-//W3C//DTD MathML 2.0//EN/code>li>code>-//WAPFORUM//DTD XHTML Mobile 1.0//EN/code>/ul> p>Furthermore, user agents should attempt to retrieve the above external entitys content when one of the above public identifiers is used, and should not attempt to retrieve any other external entitys content./p> p classnote>This is not strictly a a href#willful-violation idparsing-xhtml-documents:willful-violation>violation/a> of the XML specification, but it does contradict the spirit of the XML specifications requirements. This is motivated by a desire for user agents to all handle entities in an interoperable fashion without requiring any network access for handling external subsets. a href#refsXML>XML/a>/p> p>XML parsers can be invoked with dfn idxml-scripting-support-enabled data-export>XML scripting support enabled/dfn> or dfn idxml-scripting-support-disabled data-export>XML scripting support disabled/dfn>. Except where otherwise specified, XML parsers are invoked with a href#xml-scripting-support-enabled idparsing-xhtml-documents:xml-scripting-support-enabled>XML scripting support enabled/a>./p> p idscriptTagXML>When an a href#xml-parser idparsing-xhtml-documents:xml-parser-3>XML parser/a> with a href#xml-scripting-support-enabled idparsing-xhtml-documents:xml-scripting-support-enabled-2>XML scripting support enabled/a> creates a code idparsing-xhtml-documents:the-script-element>a href#the-script-element>script/a>/code> element, it must be marked as being a href#parser-inserted idparsing-xhtml-documents:parser-inserted>parser-inserted/a> and its a href#non-blocking idparsing-xhtml-documents:non-blocking>non-blocking/a> flag must be unset. If the parser was originally created for the a href#xml-fragment-parsing-algorithm idparsing-xhtml-documents:xml-fragment-parsing-algorithm>XML fragment parsing algorithm/a>, then the element must be marked as a href#already-started idparsing-xhtml-documents:already-started>already started/a> also. When the elements end tag is subsequently parsed, the user agent must a href#perform-a-microtask-checkpoint idparsing-xhtml-documents:perform-a-microtask-checkpoint>perform a microtask checkpoint/a>, and then a href#prepare-a-script idparsing-xhtml-documents:prepare-a-script>prepare/a> the code idparsing-xhtml-documents:the-script-element-2>a href#the-script-element>script/a>/code> element. If this causes there to be a a href#pending-parsing-blocking-script idparsing-xhtml-documents:pending-parsing-blocking-script>pending parsing-blocking script/a>, then the user agent must run the following steps:/p> ol>li>p>Block this instance of the a href#xml-parser idparsing-xhtml-documents:xml-parser-4>XML parser/a>, such that the a href#event-loop idparsing-xhtml-documents:event-loop>event loop/a> will not run a href#concept-task idparsing-xhtml-documents:concept-task>tasks/a> that invoke it.li>p>a href#spin-the-event-loop idparsing-xhtml-documents:spin-the-event-loop>Spin the event loop/a> until the parsers code idparsing-xhtml-documents:document-5>a href#document>Document/a>/code> a href#has-no-style-sheet-that-is-blocking-scripts idparsing-xhtml-documents:has-no-style-sheet-that-is-blocking-scripts>has no style sheet that is blocking scripts/a> and the a href#pending-parsing-blocking-script idparsing-xhtml-documents:pending-parsing-blocking-script-2>pending parsing-blocking script/a>s a href#ready-to-be-parser-executed idparsing-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 idparsing-xhtml-documents:xml-parser-5>XML parser/a>, such that a href#concept-task idparsing-xhtml-documents:concept-task-2>tasks/a> that invoke it can again be run.li>p>a href#execute-the-script-block idparsing-xhtml-documents:execute-the-script-block>Execute/a> the a href#pending-parsing-blocking-script idparsing-xhtml-documents:pending-parsing-blocking-script-3>pending parsing-blocking script/a>.li>p>There is no longer a a href#pending-parsing-blocking-script idparsing-xhtml-documents:pending-parsing-blocking-script-4>pending parsing-blocking script/a>./ol> p classnote>Since the code idparsing-xhtml-documents:dom-document-write>a href#dom-document-write>document.write()/a>/code> API is not available for a idparsing-xhtml-documents:xml-documents hrefhttps://dom.spec.whatwg.org/#xml-document data-x-internalxml-documents>XML documents/a>, much of the complexity in the a href#html-parser idparsing-xhtml-documents:html-parser>HTML parser/a> is not needed in the a href#xml-parser idparsing-xhtml-documents:xml-parser-6>XML parser/a>./p> p classnote>When the a href#xml-parser idparsing-xhtml-documents:xml-parser-7>XML parser/a> has a href#xml-scripting-support-disabled idparsing-xhtml-documents:xml-scripting-support-disabled>XML scripting support disabled/a>, none of this happens./p> p idtemplateTagXML>When an a href#xml-parser idparsing-xhtml-documents:xml-parser-8>XML parser/a> would append a node to a code idparsing-xhtml-documents:the-template-element>a href#the-template-element>template/a>/code> element, it must instead append it to the code idparsing-xhtml-documents:the-template-element-2>a href#the-template-element>template/a>/code> elements a href#template-contents idparsing-xhtml-documents:template-contents>template contents/a> (a code idparsing-xhtml-documents:documentfragment>a data-x-internaldocumentfragment hrefhttps://dom.spec.whatwg.org/#interface-documentfragment>DocumentFragment/a>/code> node)./p> p classnote>This is a a href#willful-violation idparsing-xhtml-documents:willful-violation-2>willful violation/a> of the XML specification; unfortunately, XML is not formally extensible in the manner that is needed for code idparsing-xhtml-documents:the-template-element-3>a href#the-template-element>template/a>/code> processing. a href#refsXML>XML/a>/p> p>When an a href#xml-parser idparsing-xhtml-documents:xml-parser-9>XML parser/a> creates a code idparsing-xhtml-documents:node>a data-x-internalnode hrefhttps://dom.spec.whatwg.org/#interface-node>Node/a>/code> object, its a idparsing-xhtml-documents:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> must be set to the a idparsing-xhtml-documents:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> of the node into which the newly created node is to be inserted./p> p>Certain algorithms in this specification dfn idfeed-the-parser>spoon-feed the parser/dfn> characters one string at a time. In such cases, the a href#xml-parser idparsing-xhtml-documents:xml-parser-10>XML parser/a> must act as it would have if faced with a single string consisting of the concatenation of all those characters./p> p>When an a href#xml-parser idparsing-xhtml-documents:xml-parser-11>XML parser/a> reaches the end of its input, it must a href#stop-parsing idparsing-xhtml-documents:stop-parsing>stop parsing/a>, following the same rules as the a href#html-parser idparsing-xhtml-documents:html-parser-2>HTML parser/a>. An a href#xml-parser idparsing-xhtml-documents:xml-parser-12>XML parser/a> can also be a href#abort-a-parser idparsing-xhtml-documents:abort-a-parser>aborted/a>, which must again be done in the same way as for an a href#html-parser idparsing-xhtml-documents:html-parser-3>HTML parser/a>./p> p>For the purposes of conformance checkers, if a resource is determined to be in a href#the-xhtml-syntax idparsing-xhtml-documents:the-xhtml-syntax>the XML syntax/a>, then it is an a hrefhttps://dom.spec.whatwg.org/#xml-document idparsing-xhtml-documents:xml-documents-2 data-x-internalxml-documents>XML document/a>./p> h3 idserialising-xhtml-fragments>span classsecno>13.3/span> Serializing XML fragmentsa href#serialising-xhtml-fragments classself-link>/a>/h3> p>The dfn idxml-fragment-serialisation-algorithm>XML fragment serialization algorithm/dfn> for a code idserialising-xhtml-fragments:document>a href#document>Document/a>/code> or code idserialising-xhtml-fragments:element>a data-x-internalelement hrefhttps://dom.spec.whatwg.org/#interface-element>Element/a>/code> node either returns a fragment of XML that represents that node or throws an exception./p> p>For code idserialising-xhtml-fragments:document-2>a href#document>Document/a>/code>s, the algorithm must return a string in the form of a a hrefhttps://www.w3.org/TR/xml/#sec-well-formed>document entity/a>, if none of the error cases below apply./p> p>For code idserialising-xhtml-fragments:element-2>a data-x-internalelement hrefhttps://dom.spec.whatwg.org/#interface-element>Element/a>/code>s, the algorithm must return a string in the form of an a hrefhttps://www.w3.org/TR/xml/#wf-entities>internal general parsed entity/a>, if none of the error cases below apply./p> p>In both cases, the string returned must be XML namespace-well-formed and must be an isomorphic serialization of all of that nodes a href#relevant-child-nodes idserialising-xhtml-fragments:relevant-child-nodes>relevant child nodes/a>, in a idserialising-xhtml-fragments:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>. User agents may adjust prefixes and namespace declarations in the serialization (and indeed might be forced to do so in some cases to obtain namespace-well-formed XML). User agents may use a combination of regular text and character references to represent code idserialising-xhtml-fragments:text>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> nodes in the DOM./p> p>A nodes dfn idrelevant-child-nodes>relevant child nodes/dfn> are those that apply given the following rules:/p> dl>dt>For code idserialising-xhtml-fragments:the-template-element>a href#the-template-element>template/a>/code> elementsdd>The a href#relevant-child-nodes idserialising-xhtml-fragments:relevant-child-nodes-2>relevant child nodes/a> are the child nodes of the code idserialising-xhtml-fragments:the-template-element-2>a href#the-template-element>template/a>/code> elements a href#template-contents idserialising-xhtml-fragments:template-contents>template contents/a>, if any.dt>For all other nodesdd>The a href#relevant-child-nodes idserialising-xhtml-fragments:relevant-child-nodes-3>relevant child nodes/a> are the child nodes of node itself, if any./dl> p>For code idserialising-xhtml-fragments:element-3>a data-x-internalelement hrefhttps://dom.spec.whatwg.org/#interface-element>Element/a>/code>s, if any of the elements in the serialization are in no namespace, the default namespace in scope for those elements must be explicitly declared as the empty string. (This doesnt apply in the code idserialising-xhtml-fragments:document-3>a href#document>Document/a>/code> case.) a href#refsXML>XML/a> a href#refsXMLNS>XMLNS/a>/p> p>For the purposes of this section, an internal general parsed entity is considered XML namespace-well-formed if a document consisting of an element with no namespace declarations whose contents are the internal general parsed entity would itself be XML namespace-well-formed./p> p>If any of the following error cases are found in the DOM subtree being serialized, then the algorithm must throw an a idserialising-xhtml-fragments:invalidstateerror hrefhttps://heycam.github.io/webidl/#invalidstateerror data-x-internalinvalidstateerror>code>InvalidStateError/code>/a> code idserialising-xhtml-fragments:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> instead of returning a string:/p> ul>li>A code idserialising-xhtml-fragments:document-4>a href#document>Document/a>/code> node with no child element nodes.li>A code idserialising-xhtml-fragments:documenttype>a data-x-internaldocumenttype hrefhttps://dom.spec.whatwg.org/#interface-documenttype>DocumentType/a>/code> node that has an external subset public identifier that contains characters that are not matched by the XML code>PubidChar/code> production. a href#refsXML>XML/a>li>A code idserialising-xhtml-fragments:documenttype-2>a data-x-internaldocumenttype hrefhttps://dom.spec.whatwg.org/#interface-documenttype>DocumentType/a>/code> node that has an external subset system identifier that contains both a U+0022 QUOTATION MARK () and a U+0027 APOSTROPHE () or that contains characters that are not matched by the XML code>Char/code> production. a href#refsXML>XML/a>li>A node with a local name containing a U+003A COLON (:).li>A node with a local name that does not match the XML code idserialising-xhtml-fragments:xml-name>a data-x-internalxml-name hrefhttps://www.w3.org/TR/xml/#NT-Name>Name/a>/code> production. a href#refsXML>XML/a>li>An code idserialising-xhtml-fragments:attr>a data-x-internalattr hrefhttps://dom.spec.whatwg.org/#interface-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 idserialising-xhtml-fragments:element-4>a data-x-internalelement hrefhttps://dom.spec.whatwg.org/#interface-element>Element/a>/code> node with two or more attributes with the same local name and namespace.li>An code idserialising-xhtml-fragments:attr-2>a data-x-internalattr hrefhttps://dom.spec.whatwg.org/#interface-attr>Attr/a>/code> node, code idserialising-xhtml-fragments:text-2>a data-x-internaltext hrefhttps://dom.spec.whatwg.org/#interface-text>Text/a>/code> node, code idserialising-xhtml-fragments:comment-2>a data-x-internalcomment-2 hrefhttps://dom.spec.whatwg.org/#interface-comment>Comment/a>/code> node, or code idserialising-xhtml-fragments:processinginstruction>a data-x-internalprocessinginstruction hrefhttps://dom.spec.whatwg.org/#interface-processinginstruction>ProcessingInstruction/a>/code> node whose data contains characters that are not matched by the XML code>Char/code> production. a href#refsXML>XML/a>li>A code idserialising-xhtml-fragments:comment-2-2>a data-x-internalcomment-2 hrefhttps://dom.spec.whatwg.org/#interface-comment>Comment/a>/code> node whose data contains two adjacent U+002D HYPHEN-MINUS characters (-) or ends with such a character.li>A code idserialising-xhtml-fragments:processinginstruction-2>a data-x-internalprocessinginstruction hrefhttps://dom.spec.whatwg.org/#interface-processinginstruction>ProcessingInstruction/a>/code> node whose target name is an a idserialising-xhtml-fragments:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>xml/code>.li>A code idserialising-xhtml-fragments:processinginstruction-3>a data-x-internalprocessinginstruction hrefhttps://dom.spec.whatwg.org/#interface-processinginstruction>ProcessingInstruction/a>/code> node whose target name contains a U+003A COLON (:).li>A code idserialising-xhtml-fragments:processinginstruction-4>a data-x-internalprocessinginstruction hrefhttps://dom.spec.whatwg.org/#interface-processinginstruction>ProcessingInstruction/a>/code> node whose data contains the string code>?>/code>./ul> p classnote>These are the only ways to make a DOM unserialisable. The DOM enforces all the other XML constraints; for example, trying to append two elements to a code idserialising-xhtml-fragments:document-5>a href#document>Document/a>/code> node will throw a a idserialising-xhtml-fragments:hierarchyrequesterror hrefhttps://heycam.github.io/webidl/#hierarchyrequesterror data-x-internalhierarchyrequesterror>code>HierarchyRequestError/code>/a> code idserialising-xhtml-fragments:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>./p> h3 idparsing-xhtml-fragments>span classsecno>13.4/span> Parsing XML fragmentsa href#parsing-xhtml-fragments classself-link>/a>/h3> p>The dfn idxml-fragment-parsing-algorithm>XML fragment parsing algorithm/dfn> either returns a code idparsing-xhtml-fragments:document>a href#document>Document/a>/code> or throws a a idparsing-xhtml-fragments:syntaxerror hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idparsing-xhtml-fragments:domexception>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code>. Given a string var>input/var> and a context element var idparsing-xhtml-fragments:concept-frag-parse-context>a href#concept-frag-parse-context>context/a>/var>, the algorithm is as follows:/p> ol>li> p>Create a new a href#xml-parser idparsing-xhtml-fragments:xml-parser>XML parser/a>./p> li> p>a href#feed-the-parser idparsing-xhtml-fragments:feed-the-parser>Feed the parser/a> just created the string corresponding to the start tag of the var idparsing-xhtml-fragments:concept-frag-parse-context-2>a href#concept-frag-parse-context>context/a>/var> element, declaring all the namespace prefixes that are in scope on that element in the DOM, as well as declaring the default namespace (if any) that is in scope on that element in the DOM./p> p>A namespace prefix is in scope if the DOM code>lookupNamespaceURI()/code> method on the element would return a non-null value for that prefix./p> p>The default namespace is the namespace for which the DOM code>isDefaultNamespace()/code> method on the element would return true./p> p classnote>No code>DOCTYPE/code> is passed to the parser, and therefore no external subset is referenced, and therefore no entities will be recognized./p> li> p>a href#feed-the-parser idparsing-xhtml-fragments:feed-the-parser-2>Feed the parser/a> just created the string var>input/var>./p> li> p>a href#feed-the-parser idparsing-xhtml-fragments:feed-the-parser-3>Feed the parser/a> just created the string corresponding to the end tag of the var idparsing-xhtml-fragments:concept-frag-parse-context-3>a href#concept-frag-parse-context>context/a>/var> element./p> li> p>If there is an XML well-formedness or XML namespace well-formedness error, then throw a a idparsing-xhtml-fragments:syntaxerror-2 hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idparsing-xhtml-fragments:domexception-2>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps./p> li> p>If the a idparsing-xhtml-fragments:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> of the resulting code idparsing-xhtml-fragments:document-2>a href#document>Document/a>/code> has any sibling nodes, then throw a a idparsing-xhtml-fragments:syntaxerror-3 hrefhttps://heycam.github.io/webidl/#syntaxerror data-x-internalsyntaxerror>code>SyntaxError/code>/a> code idparsing-xhtml-fragments:domexception-3>a data-x-internaldomexception hrefhttps://heycam.github.io/webidl/#dfn-DOMException>DOMException/a>/code> and abort these steps./p> li>p>Return the child nodes of the a idparsing-xhtml-fragments:document-element-2 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> of the resulting code idparsing-xhtml-fragments:document-3>a href#document>Document/a>/code>, in a idparsing-xhtml-fragments:tree-order hrefhttps://dom.spec.whatwg.org/#concept-tree-order data-x-internaltree-order>tree order/a>./ol> h2 idrendering>span classsecno>14/span> Renderinga href#rendering classself-link>/a>/h2> p>i>User agents are not required to present HTML documents in any particular way. However, this section provides a set of suggestions for rendering HTML documents that, if followed, are likely to lead to a user experience that closely resembles the experience intended by the documents authors. So as to avoid confusion regarding the normativity of this section, must has not been used. Instead, the term expected is used to indicate behavior that will lead to this experience. For the purposes of conformance for user agents designated as a href#renderingUA>supporting the suggested default rendering/a>, the term expected in this section has the same conformance implications as must./i>/p> h3 idintroduction-16>span classsecno>14.1/span> Introductiona href#introduction-16 classself-link>/a>/h3> p>In general, user agents are expected to support CSS, and many of the suggestions in this section are expressed in CSS terms. User agents that use other presentation mechanisms can derive their expected behavior by translating from the CSS rules given in this section./p> p>In the absence of style-layer rules to the contrary (e.g. author style sheets), user agents are expected to render an element so that it conveys to the user the meaning that the element a href#represents idintroduction-16:represents>represents/a>, as described by this specification./p> p>The suggestions in this section generally assume a visual output medium with a resolution of 96dpi or greater, but HTML is intended to apply to multiple media (it is a i>media-independent/i> language). User agent implementors are encouraged to adapt the suggestions in this section to their target media./p> hr> p>An element is dfn idbeing-rendered>being rendered/dfn> if it has any associated CSS layout boxes, SVG layout boxes, or some equivalent in other styling languages./p> p classnote>Just being off-screen does not mean the element is not a href#being-rendered idintroduction-16:being-rendered>being rendered/a>. The presence of the code idintroduction-16:the-hidden-attribute>a href#the-hidden-attribute>hidden/a>/code> attribute normally means the element is not a href#being-rendered idintroduction-16:being-rendered-2>being rendered/a>, though this might be overridden by the style sheets./p> hr> p>User agents that do not honor author-level CSS style sheets are nonetheless expected to act as if they applied the CSS rules given in these sections in a manner consistent with this specification and the relevant CSS and Unicode specifications. a href#refsCSS>CSS/a> a href#refsUNICODE>UNICODE/a> a href#refsBIDI>BIDI/a>/p> p classnote>This is especially important for issues relating to the a idintroduction-16:display hrefhttps://drafts.csswg.org/css2/visuren.html#display-prop data-x-internaldisplay>display/a>, a idintroduction-16:unicode-bidi hrefhttps://drafts.csswg.org/css-writing-modes/#unicode-bidi data-x-internalunicode-bidi>unicode-bidi/a>, and a idintroduction-16:direction hrefhttps://drafts.csswg.org/css-writing-modes/#direction data-x-internaldirection>direction/a> properties./p> h3 idthe-css-user-agent-style-sheet-and-presentational-hints>span classsecno>14.2/span> The CSS user agent style sheet and presentational hintsa href#the-css-user-agent-style-sheet-and-presentational-hints classself-link>/a>/h3> p>The CSS rules given in these subsections are, except where otherwise specified, expected to be used as part of the user-agent level style sheet defaults for all documents that contain a href#html-elements idthe-css-user-agent-style-sheet-and-presentational-hints:html-elements>HTML elements/a>./p> p>Some rules are intended for the author-level zero-specificity presentational hints part of the CSS cascade; these are explicitly called out as dfn idpresentational-hints>presentational hints/dfn>./p> hr> p>When the text below says that an attribute var>attribute/var> on an element var>element/var> dfn idmaps-to-the-pixel-length-property>maps to the pixel length property/dfn> (or properties) var>properties/var>, it means that if var>element/var> has an attribute var>attribute/var> set, and parsing that attributes value using the a href#rules-for-parsing-non-negative-integers idthe-css-user-agent-style-sheet-and-presentational-hints:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers/a> doesnt generate an error, then the user agent is expected to use the parsed value as a pixel length for a a href#presentational-hints idthe-css-user-agent-style-sheet-and-presentational-hints:presentational-hints>presentational hint/a> for var>properties/var>./p> p>When the text below says that an attribute var>attribute/var> on an element var>element/var> dfn idmaps-to-the-dimension-property>maps to the dimension property/dfn> (or properties) var>properties/var>, it means that if var>element/var> has an attribute var>attribute/var> set, and parsing that attributes value using the a href#rules-for-parsing-dimension-values idthe-css-user-agent-style-sheet-and-presentational-hints:rules-for-parsing-dimension-values>rules for parsing dimension values/a> doesnt generate an error, then the user agent is expected to use the parsed dimension as the value for a a href#presentational-hints idthe-css-user-agent-style-sheet-and-presentational-hints:presentational-hints-2>presentational hint/a> for var>properties/var>, with the value given as a pixel length if the dimension was a length, and with the value given as a percentage if the dimension was a percentage./p> p>When the text below says that an attribute var>attribute/var> on an element var>element/var> dfn idmaps-to-the-dimension-property-(ignoring-zero)>maps to the dimension property (ignoring zero)/dfn> (or properties) var>properties/var>, it means that if var>element/var> has an attribute var>attribute/var> set, and parsing that attributes value using the a href#rules-for-parsing-non-zero-dimension-values idthe-css-user-agent-style-sheet-and-presentational-hints:rules-for-parsing-non-zero-dimension-values>rules for parsing nonzero dimension values/a> doesnt generate an error, then the user agent is expected to use the parsed dimension as the value for a a href#presentational-hints idthe-css-user-agent-style-sheet-and-presentational-hints:presentational-hints-3>presentational hint/a> for var>properties/var>, with the value given as a pixel length if the dimension was a length, and with the value given as a percentage if the dimension was a percentage./p> p>When a user agent is to dfn idalign-descendants>align descendants/dfn> of a node, the user agent is expected to align only those descendants that have both their a idthe-css-user-agent-style-sheet-and-presentational-hints:margin-inline-start hrefhttps://drafts.csswg.org/css-logical/#propdef-margin-inline-start data-x-internalmargin-inline-start>margin-inline-start/a> and a idthe-css-user-agent-style-sheet-and-presentational-hints:margin-inline-end hrefhttps://drafts.csswg.org/css-logical/#propdef-margin-inline-end data-x-internalmargin-inline-end>margin-inline-end/a> properties computing to a value other than auto, that are over-constrained and that have one of those two margins with a a idthe-css-user-agent-style-sheet-and-presentational-hints:used-value hrefhttps://drafts.csswg.org/css-cascade/#used-value data-x-internalused-value>used value/a> forced to a greater value, and that do not themselves have an applicable code>align/code> attribute. When multiple elements are to a href#align-descendants idthe-css-user-agent-style-sheet-and-presentational-hints:align-descendants>align/a> a particular descendant, the most deeply nested such element is expected to override the others. Aligned elements are expected to be aligned by having the a hrefhttps://drafts.csswg.org/css-cascade/#used-value idthe-css-user-agent-style-sheet-and-presentational-hints:used-value-2 data-x-internalused-value>used values/a> of their margins on the a idthe-css-user-agent-style-sheet-and-presentational-hints:line-left hrefhttps://drafts.csswg.org/css-writing-modes/#line-left data-x-internalline-left>line-left/a> and a idthe-css-user-agent-style-sheet-and-presentational-hints:line-right hrefhttps://drafts.csswg.org/css-writing-modes/#line-right data-x-internalline-right>line-right/a> sides be set accordingly. a href#refsCSSLOGICAL>CSSLOGICAL/a> a href#refsCSSWM>CSSWM/a>/p> h3 idnon-replaced-elements>span classsecno>14.3/span> Non-replaced elementsa href#non-replaced-elements classself-link>/a>/h3> h4 idhidden-elements>span classsecno>14.3.1/span> Hidden elementsa href#hidden-elements classself-link>/a>/h4> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);span idhiddenCSS>hidden/span>, area, base, basefont, datalist, head, link, meta, noembed,noframes, param, rp, script, source, style, template, track, title { display: none;}embedhidden { display: inline; height: 0; width: 0; } inputtypehidden i { display: none !important; }@media (scripting) { noscript { display: none !important; }}/pre> h4 idthe-page>span classsecno>14.3.2/span> The pagea href#the-page classself-link>/a>/h4> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);html, body { display: block; }/pre> p>For each property in the table below, given a code idthe-page:the-body-element>a href#the-body-element>body/a>/code> element, the first attribute that exists a href#maps-to-the-pixel-length-property idthe-page:maps-to-the-pixel-length-property>maps to the pixel length property/a> on the code idthe-page:the-body-element-2>a href#the-body-element>body/a>/code> element. If none of the attributes for a property are found, or if the value of the attribute that was found cannot be parsed successfully, then a default value of 8px is expected to be used for that property instead./p> table>thead>tr>th>Property th>Source tbody>tr>td rowspan3>a idthe-page:margin-top hrefhttps://drafts.csswg.org/css2/box.html#propdef-margin-top data-x-internalmargin-top>margin-top/a> td>The code idthe-page:the-body-element-3>a href#the-body-element>body/a>/code> elements code idthe-page:attr-body-marginheight>a href#attr-body-marginheight>marginheight/a>/code> attribute tr>td>The code idthe-page:the-body-element-4>a href#the-body-element>body/a>/code> elements code idthe-page:attr-body-topmargin>a href#attr-body-topmargin>topmargin/a>/code> attribute tr>td>The code idthe-page:the-body-element-5>a href#the-body-element>body/a>/code> elements a href#container-frame-element idthe-page:container-frame-element>container frame element/a>s code idthe-page:attr-iframe-marginheight>a href#attr-iframe-marginheight>marginheight/a>/code> attribute tbody>tr>td rowspan3>a idthe-page:margin-right hrefhttps://drafts.csswg.org/css2/box.html#propdef-margin-right data-x-internalmargin-right>margin-right/a> td>The code idthe-page:the-body-element-6>a href#the-body-element>body/a>/code> elements code idthe-page:attr-body-marginwidth>a href#attr-body-marginwidth>marginwidth/a>/code> attribute tr>td>The code idthe-page:the-body-element-7>a href#the-body-element>body/a>/code> elements code idthe-page:attr-body-rightmargin>a href#attr-body-rightmargin>rightmargin/a>/code> attribute tr>td>The code idthe-page:the-body-element-8>a href#the-body-element>body/a>/code> elements a href#container-frame-element idthe-page:container-frame-element-2>container frame element/a>s code idthe-page:attr-iframe-marginwidth>a href#attr-iframe-marginwidth>marginwidth/a>/code> attribute tbody>tr>td rowspan3>a idthe-page:margin-bottom hrefhttps://drafts.csswg.org/css2/box.html#propdef-margin-bottom data-x-internalmargin-bottom>margin-bottom/a> td>The code idthe-page:the-body-element-9>a href#the-body-element>body/a>/code> elements code idthe-page:attr-body-marginheight-2>a href#attr-body-marginheight>marginheight/a>/code> attribute tr>td>The code idthe-page:the-body-element-10>a href#the-body-element>body/a>/code> elements code idthe-page:attr-body-bottommargin>a href#attr-body-bottommargin>bottommargin/a>/code> attribute tr>td>The code idthe-page:the-body-element-11>a href#the-body-element>body/a>/code> elements a href#container-frame-element idthe-page:container-frame-element-3>container frame element/a>s code idthe-page:attr-iframe-marginheight-2>a href#attr-iframe-marginheight>marginheight/a>/code> attribute tbody>tr>td rowspan3>a idthe-page:margin-left hrefhttps://drafts.csswg.org/css2/box.html#propdef-margin-left data-x-internalmargin-left>margin-left/a> td>The code idthe-page:the-body-element-12>a href#the-body-element>body/a>/code> elements code idthe-page:attr-body-marginwidth-2>a href#attr-body-marginwidth>marginwidth/a>/code> attribute tr>td>The code idthe-page:the-body-element-13>a href#the-body-element>body/a>/code> elements code idthe-page:attr-body-leftmargin>a href#attr-body-leftmargin>leftmargin/a>/code> attribute tr>td>The code idthe-page:the-body-element-14>a href#the-body-element>body/a>/code> elements a href#container-frame-element idthe-page:container-frame-element-4>container frame element/a>s code idthe-page:attr-iframe-marginwidth-2>a href#attr-iframe-marginwidth>marginwidth/a>/code> attribute /table> p>If the code idthe-page:the-body-element-15>a href#the-body-element>body/a>/code> elements a idthe-page:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#concept-document-bc idthe-page:concept-document-bc>browsing context/a> is a a href#nested-browsing-context idthe-page:nested-browsing-context>nested browsing context/a>, and the a href#browsing-context-container idthe-page:browsing-context-container>browsing context container/a> of that a href#nested-browsing-context idthe-page:nested-browsing-context-2>nested browsing context/a> is a code idthe-page:frame>a href#frame>frame/a>/code> or code idthe-page:the-iframe-element>a href#the-iframe-element>iframe/a>/code> element, then the dfn idcontainer-frame-element>container frame element/dfn> of the code idthe-page:the-body-element-16>a href#the-body-element>body/a>/code> element is that code idthe-page:frame-2>a href#frame>frame/a>/code> or code idthe-page:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code> element. Otherwise, there is no a href#container-frame-element idthe-page:container-frame-element-5>container frame element/a>./p> p classwarning>The above requirements imply that a page can change the margins of another page (including one from another a href#concept-origin idthe-page:concept-origin>origin/a>) using, for example, an code idthe-page:the-iframe-element-3>a href#the-iframe-element>iframe/a>/code>. This is potentially a security risk, as it might in some cases allow an attack to contrive a situation in which a page is rendered not as the author intended, possibly for the purposes of phishing or otherwise misleading the user./p> hr> p>If a code idthe-page:document>a href#document>Document/a>/code> is in a a href#nested-browsing-context idthe-page:nested-browsing-context-3>nested browsing context/a>, it is expected to be positioned and sized to fit inside the a idthe-page:content-box hrefhttps://drafts.csswg.org/css2/box.html#x10 data-x-internalcontent-box>content box/a> of its a href#browsing-context-container idthe-page:browsing-context-container-2>browsing context container/a>. If a a href#browsing-context idthe-page:browsing-context>browsing context/a>s a href#browsing-context-container idthe-page:browsing-context-container-3>browsing context container/a> is not a href#being-rendered idthe-page:being-rendered>being rendered/a>, the a href#browsing-context idthe-page:browsing-context-2>browsing context/a> is expected to have a a idthe-page:viewport hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> with zero width and zero height./p> p>If the code idthe-page:document-2>a href#document>Document/a>/code> is in a a href#nested-browsing-context idthe-page:nested-browsing-context-4>nested browsing context/a>, and the a href#browsing-context-container idthe-page:browsing-context-container-4>browsing context container/a> of that a href#nested-browsing-context idthe-page:nested-browsing-context-5>nested browsing context/a> is a code idthe-page:frame-3>a href#frame>frame/a>/code> or code idthe-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 attributes value is an a idthe-page:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>off/code>, code>noscroll/code>, or code>no/code>, then the user agent is expected to prevent any scroll bars from being shown for the a idthe-page:viewport-2 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> of the a href#nested-browsing-context idthe-page:nested-browsing-context-6>nested browsing context/a>, regardless of the a idthe-page:overflow hrefhttps://drafts.csswg.org/css-overflow-3/#propdef-overflow data-x-internaloverflow>overflow/a> property that applies to that a idthe-page:viewport-3 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>./p> hr> p>When a code idthe-page:the-body-element-17>a href#the-body-element>body/a>/code> element has a code idthe-page:attr-background>a href#attr-background>background/a>/code> attribute set to a non-empty value, the new value is expected to be a href#parse-a-url idthe-page:parse-a-url>parsed/a> relative to the elements a idthe-page:node-document-2 hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, and if this is successful, the user agent is expected to treat the attribute as a a href#presentational-hints idthe-page:presentational-hints>presentational hint/a> setting the elements a idthe-page:background-image hrefhttps://drafts.csswg.org/css-backgrounds/#the-background-image data-x-internalbackground-image>background-image/a> property to the a href#resulting-url-string idthe-page:resulting-url-string>resulting URL string/a>./p> p>When a code idthe-page:the-body-element-18>a href#the-body-element>body/a>/code> element has a code idthe-page:attr-body-bgcolor>a href#attr-body-bgcolor>bgcolor/a>/code> attribute set, the new value is expected to be parsed using the a href#rules-for-parsing-a-legacy-colour-value idthe-page:rules-for-parsing-a-legacy-colour-value>rules for parsing a legacy color value/a>, and if that does not return an error, the user agent is expected to treat the attribute as a a href#presentational-hints idthe-page:presentational-hints-2>presentational hint/a> setting the elements a idthe-page:background-color hrefhttps://drafts.csswg.org/css-backgrounds/#the-background-color data-x-internalbackground-color>background-color/a> property to the resulting color./p> p>When a code idthe-page:the-body-element-19>a href#the-body-element>body/a>/code> element has a code idthe-page:attr-body-text>a href#attr-body-text>text/a>/code> attribute, its value is expected to be parsed using the a href#rules-for-parsing-a-legacy-colour-value idthe-page:rules-for-parsing-a-legacy-colour-value-2>rules for parsing a legacy color value/a>, and if that does not return an error, the user agent is expected to treat the attribute as a a href#presentational-hints idthe-page:presentational-hints-3>presentational hint/a> setting the elements a idthe-page:color hrefhttps://drafts.csswg.org/css-color/#the-color-property data-x-internalcolor>color/a> property to the resulting color./p> p>When a code idthe-page:the-body-element-20>a href#the-body-element>body/a>/code> element has a code idthe-page:attr-body-link>a href#attr-body-link>link/a>/code> attribute, its value is expected to be parsed using the a href#rules-for-parsing-a-legacy-colour-value idthe-page:rules-for-parsing-a-legacy-colour-value-3>rules for parsing a legacy color value/a>, and if that does not return an error, the user agent is expected to treat the attribute as a a href#presentational-hints idthe-page:presentational-hints-4>presentational hint/a> setting the a idthe-page:color-2 hrefhttps://drafts.csswg.org/css-color/#the-color-property data-x-internalcolor>color/a> property of any element in the code idthe-page:document-3>a href#document>Document/a>/code> matching the code idthe-page:selector-link>a href#selector-link>:link/a>/code> a idthe-page:pseudo-class hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> to the resulting color./p> p>When a code idthe-page:the-body-element-21>a href#the-body-element>body/a>/code> element has a code idthe-page:attr-body-vlink>a href#attr-body-vlink>vlink/a>/code> attribute, its value is expected to be parsed using the a href#rules-for-parsing-a-legacy-colour-value idthe-page:rules-for-parsing-a-legacy-colour-value-4>rules for parsing a legacy color value/a>, and if that does not return an error, the user agent is expected to treat the attribute as a a href#presentational-hints idthe-page:presentational-hints-5>presentational hint/a> setting the a idthe-page:color-3 hrefhttps://drafts.csswg.org/css-color/#the-color-property data-x-internalcolor>color/a> property of any element in the code idthe-page:document-4>a href#document>Document/a>/code> matching the code idthe-page:selector-visited>a href#selector-visited>:visited/a>/code> a idthe-page:pseudo-class-2 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> to the resulting color./p> p>When a code idthe-page:the-body-element-22>a href#the-body-element>body/a>/code> element has an code idthe-page:attr-body-alink>a href#attr-body-alink>alink/a>/code> attribute, its value is expected to be parsed using the a href#rules-for-parsing-a-legacy-colour-value idthe-page:rules-for-parsing-a-legacy-colour-value-5>rules for parsing a legacy color value/a>, and if that does not return an error, the user agent is expected to treat the attribute as a a href#presentational-hints idthe-page:presentational-hints-6>presentational hint/a> setting the a idthe-page:color-4 hrefhttps://drafts.csswg.org/css-color/#the-color-property data-x-internalcolor>color/a> property of any element in the code idthe-page:document-5>a href#document>Document/a>/code> matching the code idthe-page:selector-active>a href#selector-active>:active/a>/code> a idthe-page:pseudo-class-3 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> and either the code idthe-page:selector-link-2>a href#selector-link>:link/a>/code> a idthe-page:pseudo-class-4 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> or the code idthe-page:selector-visited-2>a href#selector-visited>:visited/a>/code> a idthe-page:pseudo-class-5 hrefhttps://drafts.csswg.org/selectors/#pseudo-class data-x-internalpseudo-class>pseudo-class/a> to the resulting color./p> h4 idflow-content-3>span classsecno>14.3.3/span> Flow contenta href#flow-content-3 classself-link>/a>/h4> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);address, blockquote, center, dialog, div, figure, figcaption, footer, form,header, hr, legend, listing, main, p, plaintext, pre, xmp { display: block;}blockquote, figure, listing, p, plaintext, pre, xmp { margin-block-start: 1em; margin-block-end: 1em;}blockquote, figure { margin-inline-start: 40px; margin-inline-end: 40px; }address { font-style: italic; }listing, plaintext, pre, xmp { font-family: monospace; white-space: pre;}dialog:not(open) { display: none; }dialog { position: absolute; offset-inline-start: 0; offset-inline-end: 0; width: fit-content; height: fit-content; margin: auto; border: solid; padding: 1em; background: white; color: black;}dialog::backdrop { background: rgba(0,0,0,0.1);}slot { display: contents;}/pre> p>The following rules are also expected to apply, as a href#presentational-hints idflow-content-3:presentational-hints>presentational hints/a>:/p> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);prewrap { white-space: pre-wrap; }/pre> p>In a idflow-content-3:quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>, the following rules are also expected to apply:/p> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);form { margin-block-end: 1em; }/pre> hr> p>The code idflow-content-3:center>a href#center>center/a>/code> element, and the code idflow-content-3:the-div-element>a href#the-div-element>div/a>/code> element when it has an code idflow-content-3:attr-div-align>a href#attr-div-align>align/a>/code> attribute whose value is an a idflow-content-3:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for either the string code>center/code> or the string code>middle/code>, are expected to center text within themselves, as if they had their a idflow-content-3:text-align hrefhttps://drafts.csswg.org/css-text/#text-align-property data-x-internaltext-align>text-align/a> property set to center in a a href#presentational-hints idflow-content-3:presentational-hints-2>presentational hint/a>, and to a href#align-descendants idflow-content-3:align-descendants>align descendants/a> to the center./p> p>The code idflow-content-3:the-div-element-2>a href#the-div-element>div/a>/code> element, when it has an code idflow-content-3:attr-div-align-2>a href#attr-div-align>align/a>/code> attribute whose value is an a idflow-content-3:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>left/code>, is expected to left-align text within itself, as if it had its a idflow-content-3:text-align-2 hrefhttps://drafts.csswg.org/css-text/#text-align-property data-x-internaltext-align>text-align/a> property set to left in a a href#presentational-hints idflow-content-3:presentational-hints-3>presentational hint/a>, and to a href#align-descendants idflow-content-3:align-descendants-2>align descendants/a> to the left./p> p>The code idflow-content-3:the-div-element-3>a href#the-div-element>div/a>/code> element, when it has an code idflow-content-3:attr-div-align-3>a href#attr-div-align>align/a>/code> attribute whose value is an a idflow-content-3:ascii-case-insensitive-3 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>right/code>, is expected to right-align text within itself, as if it had its a idflow-content-3:text-align-3 hrefhttps://drafts.csswg.org/css-text/#text-align-property data-x-internaltext-align>text-align/a> property set to right in a a href#presentational-hints idflow-content-3:presentational-hints-4>presentational hint/a>, and to a href#align-descendants idflow-content-3:align-descendants-3>align descendants/a> to the right./p> p>The code idflow-content-3:the-div-element-4>a href#the-div-element>div/a>/code> element, when it has an code idflow-content-3:attr-div-align-4>a href#attr-div-align>align/a>/code> attribute whose value is an a idflow-content-3:ascii-case-insensitive-4 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>justify/code>, is expected to full-justify text within itself, as if it had its a idflow-content-3:text-align-4 hrefhttps://drafts.csswg.org/css-text/#text-align-property data-x-internaltext-align>text-align/a> property set to justify in a a href#presentational-hints idflow-content-3:presentational-hints-5>presentational hint/a>, and to a href#align-descendants idflow-content-3:align-descendants-4>align descendants/a> to the left./p> h4 idphrasing-content-3>span classsecno>14.3.4/span> Phrasing contenta href#phrasing-content-3 classself-link>/a>/h4> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);cite, dfn, em, i, var { font-style: italic; }b, strong { font-weight: bolder; }code, kbd, samp, tt { font-family: monospace; }big { font-size: larger; }small { font-size: smaller; }sub { vertical-align: sub; }sup { vertical-align: super; }sub, sup { line-height: normal; font-size: smaller; }ruby { display: ruby; }rt { display: ruby-text; }:link { color: #0000EE; }:visited { color: #551A8B; }:link:active, :visited:active { color: #FF0000; }:link, :visited { text-decoration: underline; cursor: pointer; }a:linkrel~help i, a:visitedrel~help i,area:linkrel~help i, area:visitedrel~help i { cursor: help; }:focus { outline: auto; }mark { background: yellow; color: black; } /* this color is just a suggestion and can be changed based on implementation feedback */abbrtitle, acronymtitle { text-decoration: dotted underline; }ins, u { text-decoration: underline; }del, s, strike { text-decoration: line-through; }q::before { content: open-quote; }q::after { content: close-quote; }span idbr-wbr-content>br { display-outside: newline; } /* a href#bidi-rendering>this also has bidi implications/a> */nobr { white-space: nowrap; }wbr { display-outside: break-opportunity; } /* a href#bidi-rendering>this also has bidi implications/a> */nobr wbr { white-space: normal; }/span>/pre> p>The following rules are also expected to apply, as a href#presentational-hints idphrasing-content-3:presentational-hints>presentational hints/a>:/p> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);brclearleft i { clear: left; }brclearright i { clear: right; }brclearall i, brclearboth i { clear: both; }/pre> p>For the purposes of the CSS ruby model, runs of children of code idphrasing-content-3:the-ruby-element>a href#the-ruby-element>ruby/a>/code> elements that are not code idphrasing-content-3:the-rt-element>a href#the-rt-element>rt/a>/code> or code idphrasing-content-3:the-rp-element>a href#the-rp-element>rp/a>/code> elements are expected to be wrapped in anonymous boxes whose a idphrasing-content-3:display hrefhttps://drafts.csswg.org/css2/visuren.html#display-prop data-x-internaldisplay>display/a> property has the value a idphrasing-content-3:ruby-base hrefhttps://drafts.csswg.org/css-ruby/#valdef-display-ruby-base data-x-internalruby-base>ruby-base/a>. a href#refsCSSRUBY>CSSRUBY/a>/p> p>When a particular part of a ruby has more than one annotation, the annotations should be distributed on both sides of the base text so as to minimize the stacking of ruby annotations on one side./p> p classnote>When it becomes possible to do so, the preceding requirement will be updated to be expressed in terms of CSS ruby. (Currently, CSS ruby does not handle nested code idphrasing-content-3:the-ruby-element-2>a href#the-ruby-element>ruby/a>/code> elements or multiple sequential code idphrasing-content-3:the-rt-element-2>a href#the-rt-element>rt/a>/code> elements, which is how this semantic is expressed.)/p> p>User agents that do not support correct ruby rendering are expected to render parentheses around the text of code idphrasing-content-3:the-rt-element-3>a href#the-rt-element>rt/a>/code> elements in the absence of code idphrasing-content-3:the-rp-element-2>a href#the-rp-element>rp/a>/code> elements./p> hr> p>User agents are expected to support the a idphrasing-content-3:clear hrefhttps://drafts.csswg.org/css2/visuren.html#flow-control data-x-internalclear>clear/a> property on inline elements (in order to render code idphrasing-content-3:the-br-element>a href#the-br-element>br/a>/code> elements with code idphrasing-content-3:attr-br-clear>a href#attr-br-clear>clear/a>/code> attributes) in the manner described in the non-normative note to this effect in the CSS specification./p> p>The initial value for the a idphrasing-content-3:color hrefhttps://drafts.csswg.org/css-color/#the-color-property data-x-internalcolor>color/a> property is expected to be black. The initial value for the a idphrasing-content-3:background-color hrefhttps://drafts.csswg.org/css-backgrounds/#the-background-color data-x-internalbackground-color>background-color/a> property is expected to be transparent. The canvass background is expected to be white./p> hr> p>When a code idphrasing-content-3:font>a href#font>font/a>/code> element has a code>color/code> attribute, its value is expected to be parsed using the a href#rules-for-parsing-a-legacy-colour-value idphrasing-content-3:rules-for-parsing-a-legacy-colour-value>rules for parsing a legacy color value/a>, and if that does not return an error, the user agent is expected to treat the attribute as a a href#presentational-hints idphrasing-content-3:presentational-hints-2>presentational hint/a> setting the elements a idphrasing-content-3:color-2 hrefhttps://drafts.csswg.org/css-color/#the-color-property data-x-internalcolor>color/a> property to the resulting color./p> p idthe-font-element-text-decoration-color-quirk>The code idphrasing-content-3:font-2>a href#font>font/a>/code> element is expected to override the color of any text decoration that spans the text of the element to the a idphrasing-content-3:used-value hrefhttps://drafts.csswg.org/css-cascade/#used-value data-x-internalused-value>used value/a> of the elements a idphrasing-content-3:color-3 hrefhttps://drafts.csswg.org/css-color/#the-color-property data-x-internalcolor>color/a> property./p> p>When a code idphrasing-content-3:font-3>a href#font>font/a>/code> element has a code>face/code> attribute, the user agent is expected to treat the attribute as a a href#presentational-hints idphrasing-content-3:presentational-hints-3>presentational hint/a> setting the elements a idphrasing-content-3:font-family hrefhttps://drafts.csswg.org/css-fonts/#font-family-prop data-x-internalfont-family>font-family/a> property to the attributes value./p> p>When a code idphrasing-content-3:font-4>a href#font>font/a>/code> element has a code>size/code> attribute, the user agent is expected to use the following steps, known as the dfn idrules-for-parsing-a-legacy-font-size>rules for parsing a legacy font size/dfn>, to treat the attribute as a a href#presentational-hints idphrasing-content-3:presentational-hints-4>presentational hint/a> setting the elements a idphrasing-content-3:font-size hrefhttps://drafts.csswg.org/css-fonts/#font-size-prop data-x-internalfont-size>font-size/a> property:/p> ol>li>p>Let var>input/var> be the attributes value.li>p>Let var>position/var> be a pointer into var>input/var>, initially pointing at the start of the string.li>p>a idphrasing-content-3:skip-ascii-whitespace hrefhttps://infra.spec.whatwg.org/#skip-ascii-whitespace data-x-internalskip-ascii-whitespace>Skip ASCII whitespace/a> within var>input/var> given var>position/var>.li>p>If var>position/var> is past the end of var>input/var>, there is no a href#presentational-hints idphrasing-content-3:presentational-hints-5>presentational hint/a>. Abort these steps.li>p>If the character at var>position/var> is a U+002B PLUS SIGN character (+), then let var>mode/var> be i>relative-plus/i>, and advance var>position/var> to the next character. Otherwise, if the character at var>position/var> is a U+002D HYPHEN-MINUS character (-), then let var>mode/var> be i>relative-minus/i>, and advance var>position/var> to the next character. Otherwise, let var>mode/var> be i>absolute/i>.li>p>a idphrasing-content-3:collect-a-sequence-of-code-points hrefhttps://infra.spec.whatwg.org/#collect-a-sequence-of-code-points data-x-internalcollect-a-sequence-of-code-points>Collect a sequence of code points/a> that are a idphrasing-content-3:ascii-digits hrefhttps://infra.spec.whatwg.org/#ascii-digit data-x-internalascii-digits>ASCII digits/a> from var>input/var> given var>position/var>, and let the resulting sequence be var>digits/var>.li>p>If var>digits/var> is the empty string, there is no a href#presentational-hints idphrasing-content-3:presentational-hints-6>presentational hint/a>. Abort these steps.li>p>Interpret var>digits/var> as a base-ten integer. Let var>value/var> be the resulting number.li> p>If var>mode/var> is i>relative-plus/i>, then increment var>value/var> by 3. If var>mode/var> is i>relative-minus/i>, then let var>value/var> be the result of subtracting var>value/var> from 3./p> li>p>If var>value/var> is greater than 7, let it be 7.li>p>If var>value/var> is less than 1, let it be 1.li> p>Set a idphrasing-content-3:font-size-2 hrefhttps://drafts.csswg.org/css-fonts/#font-size-prop data-x-internalfont-size>font-size/a> to the keyword corresponding to the value of var>value/var> according to the following table:/p> table>thead>tr>th>var>value/var> th>a idphrasing-content-3:font-size-3 hrefhttps://drafts.csswg.org/css-fonts/#font-size-prop data-x-internalfont-size>font-size/a> keyword th>Notes tbody>tr>td>1 td>x-small td> tr>td>2 td>small td> tr>td>3 td>medium td> tr>td>4 td>large td> tr>td>5 td>x-large td> tr>td>6 td>xx-large td> tr>td>7 td>xxx-large td>i>see below/i> /table> p classtablenote>small>The xxx-large value is a non-CSS value used here to indicate a font size 50% larger than xx-large./small>/p> /ol> h4 idbidi-rendering>span classsecno>14.3.5/span> Bidirectional texta href#bidi-rendering classself-link>/a>/h4> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);dir:dir(ltr), bdi:dir(ltr), inputtypetel i:dir(ltr) { direction: ltr; }dir:dir(rtl), bdi:dir(rtl) { direction: rtl; }address, blockquote, center, div, figure, figcaption, footer, form, header, hr,legend, listing, main, p, plaintext, pre, summary, xmp, article, aside, h1, h2,h3, h4, h5, h6, hgroup, nav, section, table, caption, colgroup, col, thead,tbody, tfoot, tr, td, th, dir, dd, dl, dt, menu, ol, ul, li, bdi, output,dirltr i, dirrtl i, dirauto i { unicode-bidi: isolate; }bdo, bdodir { unicode-bidi: isolate-override; } inputdirauto i:matches(typesearch i, typetel i, typeurl i,typeemail i), textareadirauto i, predirauto i { unicode-bidi: plaintext;}/* see prose for input elements whose type attribute is in the Text state *//* the a href#br-wbr-content>rules setting the content property/a> on code idbidi-rendering:the-br-element>a href#the-br-element>br/a>/code> and code idbidi-rendering:the-wbr-element>a href#the-wbr-element>wbr/a>/code> elements also has bidi implications *//pre> p>When an code idbidi-rendering:the-input-element>a href#the-input-element>input/a>/code> elements code idbidi-rendering:the-dir-attribute>a href#the-dir-attribute>dir/a>/code> attribute is in the a href#attr-dir-auto idbidi-rendering:attr-dir-auto>auto/a> state and its code idbidi-rendering:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#text-(typetext)-state-and-search-state-(typesearch) idbidi-rendering:text-(typetext)-state-and-search-state-(typesearch)>Text/a> state, then the user agent is expected to act as if it had a user-agent-level style sheet rule setting the a idbidi-rendering:unicode-bidi hrefhttps://drafts.csswg.org/css-writing-modes/#unicode-bidi data-x-internalunicode-bidi>unicode-bidi/a> property to plaintext./p> p>Input fields (i.e. code idbidi-rendering:the-textarea-element>a href#the-textarea-element>textarea/a>/code> elements, and code idbidi-rendering:the-input-element-2>a href#the-input-element>input/a>/code> elements when their code idbidi-rendering:attr-input-type-2>a href#attr-input-type>type/a>/code> attribute is in the a href#text-(typetext)-state-and-search-state-(typesearch) idbidi-rendering:text-(typetext)-state-and-search-state-(typesearch)-2>Text/a>, a href#text-(typetext)-state-and-search-state-(typesearch) idbidi-rendering:text-(typetext)-state-and-search-state-(typesearch)-3>Search/a>, a href#telephone-state-(typetel) idbidi-rendering:telephone-state-(typetel)>Telephone/a>, a href#url-state-(typeurl) idbidi-rendering:url-state-(typeurl)>URL/a>, or a href#e-mail-state-(typeemail) idbidi-rendering:e-mail-state-(typeemail)>E-mail/a> state) are expected to present an editing user interface with a directionality that matches the elements a idbidi-rendering:direction hrefhttps://drafts.csswg.org/css-writing-modes/#direction data-x-internaldirection>direction/a> property./p> p>When the documents character encoding is a idbidi-rendering:iso-8859-8 hrefhttps://encoding.spec.whatwg.org/#iso-8859-8 data-x-internaliso-8859-8>ISO-8859-8/a>, the following rules are additionally expected to apply, following those above: a href#refsENCODING>ENCODING/a>/p> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);address, blockquote, center, div, figure, figcaption, footer, form, header, hr,legend, listing, main, p, plaintext, pre, summary, xmp, article, aside, h1, h2,h3, h4, h5, h6, hgroup, nav, section, table, caption, colgroup, col, thead,tbody, tfoot, tr, td, th, dir, dd, dl, dt, menu, ol, ul, li, dirltr i,dirrtl i, dirauto i, *|* { unicode-bidi: bidi-override;}input:not(typesubmit i):not(typereset i):not(typebutton i),textarea { unicode-bidi: normal;}/pre> h4 idquotes>span classsecno>14.3.6/span> Quotesa href#quotes classself-link>/a>/h4> p>This block is automatically generated from the Unicode Common Locale Data Repository. a href#refsCLDR>CLDR/a>/p> p>User agents are expected to use either the block below (which will be regularly updated) or to automatically generate their own copy directly from the source material. The language codes are derived from the CLDR file names. The quotes are derived from the code>delimiter/code> blocks, with fallback handled as specified in the CLDR documentation./p> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);:root { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(af), :not(:lang(af)) > :lang(af) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(agq), :not(:lang(agq)) > :lang(agq) { quotes: \201e \201d \201a \2019 } /* „ ” ‚ ’ */:root:lang(ak), :not(:lang(ak)) > :lang(ak) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(am), :not(:lang(am)) > :lang(am) { quotes: \00ab \00bb \2039 \203a } /* « » ‹ › */:root:lang(ar), :not(:lang(ar)) > :lang(ar) { quotes: \201d \201c \2019 \2018 } /* ” “ ’ ‘ */:root:lang(asa), :not(:lang(asa)) > :lang(asa) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(ast), :not(:lang(ast)) > :lang(ast) { quotes: \00ab \00bb \201c \201d } /* « » “ ” */:root:lang(az), :not(:lang(az)) > :lang(az) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(az-Cyrl), :not(:lang(az-Cyrl)) > :lang(az-Cyrl) { quotes: \00ab \00bb \2039 \203a } /* « » ‹ › */:root:lang(bas), :not(:lang(bas)) > :lang(bas) { quotes: \00ab \00bb \201e \201c } /* « » „ “ */:root:lang(be), :not(:lang(be)) > :lang(be) { quotes: \00ab \00bb \201e \201c } /* « » „ “ */:root:lang(bem), :not(:lang(bem)) > :lang(bem) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(bez), :not(:lang(bez)) > :lang(bez) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(bg), :not(:lang(bg)) > :lang(bg) { quotes: \201e \201c \201e \201c } /* „ “ „ “ */:root:lang(bm), :not(:lang(bm)) > :lang(bm) { quotes: \00ab \00bb \201c \201d } /* « » “ ” */:root:lang(bn), :not(:lang(bn)) > :lang(bn) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(br), :not(:lang(br)) > :lang(br) { quotes: \00ab \00bb \201c \201d } /* « » “ ” */:root:lang(brx), :not(:lang(brx)) > :lang(brx) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(bs), :not(:lang(bs)) > :lang(bs) { quotes: \201e \201d \2018 \2019 } /* „ ” ‘ ’ */:root:lang(bs-Cyrl), :not(:lang(bs-Cyrl)) > :lang(bs-Cyrl) { quotes: \201e \201c \201a \2018 } /* „ “ ‚ ‘ */:root:lang(ca), :not(:lang(ca)) > :lang(ca) { quotes: \00ab \00bb \201c \201d } /* « » “ ” */:root:lang(cgg), :not(:lang(cgg)) > :lang(cgg) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(chr), :not(:lang(chr)) > :lang(chr) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(cs), :not(:lang(cs)) > :lang(cs) { quotes: \201e \201c \201a \2018 } /* „ “ ‚ ‘ */:root:lang(cy), :not(:lang(cy)) > :lang(cy) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(da), :not(:lang(da)) > :lang(da) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(dav), :not(:lang(dav)) > :lang(dav) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(de), :not(:lang(de)) > :lang(de) { quotes: \201e \201c \201a \2018 } /* „ “ ‚ ‘ */:root:lang(dje), :not(:lang(dje)) > :lang(dje) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(dsb), :not(:lang(dsb)) > :lang(dsb) { quotes: \201e \201c \201a \2018 } /* „ “ ‚ ‘ */:root:lang(dua), :not(:lang(dua)) > :lang(dua) { quotes: \00ab \00bb \2018 \2019 } /* « » ‘ ’ */:root:lang(dyo), :not(:lang(dyo)) > :lang(dyo) { quotes: \00ab \00bb \201c \201d } /* « » “ ” */:root:lang(dz), :not(:lang(dz)) > :lang(dz) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(ebu), :not(:lang(ebu)) > :lang(ebu) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(ee), :not(:lang(ee)) > :lang(ee) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(el), :not(:lang(el)) > :lang(el) { quotes: \00ab \00bb \201c \201d } /* « » “ ” */:root:lang(en), :not(:lang(en)) > :lang(en) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(es), :not(:lang(es)) > :lang(es) { quotes: \00ab \00bb \201c \201d } /* « » “ ” */:root:lang(et), :not(:lang(et)) > :lang(et) { quotes: \201e \201c \201a \2018 } /* „ “ ‚ ‘ */:root:lang(eu), :not(:lang(eu)) > :lang(eu) { quotes: \201c \201d \201c \201d } /* “ ” “ ” */:root:lang(ewo), :not(:lang(ewo)) > :lang(ewo) { quotes: \00ab \00bb \201c \201d } /* « » “ ” */:root:lang(fa), :not(:lang(fa)) > :lang(fa) { quotes: \00ab \00bb \2039 \203a } /* « » ‹ › */:root:lang(ff), :not(:lang(ff)) > :lang(ff) { quotes: \201e \201d \201a \2019 } /* „ ” ‚ ’ */:root:lang(fi), :not(:lang(fi)) > :lang(fi) { quotes: \201d \201d \2019 \2019 } /* ” ” ’ ’ */:root:lang(fil), :not(:lang(fil)) > :lang(fil) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(fo), :not(:lang(fo)) > :lang(fo) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(fr), :not(:lang(fr)) > :lang(fr) { quotes: \00ab \00bb \00ab \00bb } /* « » « » */:root:lang(fr-CH), :not(:lang(fr-CH)) > :lang(fr-CH) { quotes: \00ab \00bb \2039 \203a } /* « » ‹ › */:root:lang(ga), :not(:lang(ga)) > :lang(ga) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(gd), :not(:lang(gd)) > :lang(gd) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(gl), :not(:lang(gl)) > :lang(gl) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(gsw), :not(:lang(gsw)) > :lang(gsw) { quotes: \00ab \00bb \2039 \203a } /* « » ‹ › */:root:lang(gu), :not(:lang(gu)) > :lang(gu) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(guz), :not(:lang(guz)) > :lang(guz) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(ha), :not(:lang(ha)) > :lang(ha) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(he), :not(:lang(he)) > :lang(he) { quotes: \201d \201d \2019 \2019 } /* ” ” ’ ’ */:root:lang(hi), :not(:lang(hi)) > :lang(hi) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(hr), :not(:lang(hr)) > :lang(hr) { quotes: \201e \201c \201a \2018 } /* „ “ ‚ ‘ */:root:lang(hsb), :not(:lang(hsb)) > :lang(hsb) { quotes: \201e \201c \201a \2018 } /* „ “ ‚ ‘ */:root:lang(hu), :not(:lang(hu)) > :lang(hu) { quotes: \201e \201d \00bb \00ab } /* „ ” » « */:root:lang(hy), :not(:lang(hy)) > :lang(hy) { quotes: \00ab \00bb \00ab \00bb } /* « » « » */:root:lang(id), :not(:lang(id)) > :lang(id) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(ig), :not(:lang(ig)) > :lang(ig) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(is), :not(:lang(is)) > :lang(is) { quotes: \201e \201c \201a \2018 } /* „ “ ‚ ‘ */:root:lang(it), :not(:lang(it)) > :lang(it) { quotes: \00ab \00bb \201c \201d } /* « » “ ” */:root:lang(ja), :not(:lang(ja)) > :lang(ja) { quotes: \300c \300d \300e \300f } /* 「 」 『 』 */:root:lang(jgo), :not(:lang(jgo)) > :lang(jgo) { quotes: \00ab \00bb \2039 \203a } /* « » ‹ › */:root:lang(jmc), :not(:lang(jmc)) > :lang(jmc) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(ka), :not(:lang(ka)) > :lang(ka) { quotes: \201e \201c \00ab \00bb } /* „ “ « » */:root:lang(kab), :not(:lang(kab)) > :lang(kab) { quotes: \00ab \00bb \201c \201d } /* « » “ ” */:root:lang(kam), :not(:lang(kam)) > :lang(kam) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(kde), :not(:lang(kde)) > :lang(kde) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(kea), :not(:lang(kea)) > :lang(kea) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(khq), :not(:lang(khq)) > :lang(khq) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(ki), :not(:lang(ki)) > :lang(ki) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(kk), :not(:lang(kk)) > :lang(kk) { quotes: \00ab \00bb \201c \201d } /* « » “ ” */:root:lang(kkj), :not(:lang(kkj)) > :lang(kkj) { quotes: \00ab \00bb \2039 \203a } /* « » ‹ › */:root:lang(kln), :not(:lang(kln)) > :lang(kln) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(km), :not(:lang(km)) > :lang(km) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(kn), :not(:lang(kn)) > :lang(kn) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(ko), :not(:lang(ko)) > :lang(ko) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(ksb), :not(:lang(ksb)) > :lang(ksb) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(ksf), :not(:lang(ksf)) > :lang(ksf) { quotes: \00ab \00bb \2018 \2019 } /* « » ‘ ’ */:root:lang(ky), :not(:lang(ky)) > :lang(ky) { quotes: \00ab \00bb \201e \201c } /* « » „ “ */:root:lang(lag), :not(:lang(lag)) > :lang(lag) { quotes: \201d \201d \2019 \2019 } /* ” ” ’ ’ */:root:lang(lb), :not(:lang(lb)) > :lang(lb) { quotes: \201e \201c \201a \2018 } /* „ “ ‚ ‘ */:root:lang(lg), :not(:lang(lg)) > :lang(lg) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(ln), :not(:lang(ln)) > :lang(ln) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(lo), :not(:lang(lo)) > :lang(lo) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(lrc), :not(:lang(lrc)) > :lang(lrc) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(lt), :not(:lang(lt)) > :lang(lt) { quotes: \201e \201c \201e \201c } /* „ “ „ “ */:root:lang(lu), :not(:lang(lu)) > :lang(lu) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(luo), :not(:lang(luo)) > :lang(luo) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(luy), :not(:lang(luy)) > :lang(luy) { quotes: \201e \201c \201a \2018 } /* „ “ ‚ ‘ */:root:lang(lv), :not(:lang(lv)) > :lang(lv) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(mas), :not(:lang(mas)) > :lang(mas) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(mer), :not(:lang(mer)) > :lang(mer) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(mfe), :not(:lang(mfe)) > :lang(mfe) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(mg), :not(:lang(mg)) > :lang(mg) { quotes: \00ab \00bb \201c \201d } /* « » “ ” */:root:lang(mgo), :not(:lang(mgo)) > :lang(mgo) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(mk), :not(:lang(mk)) > :lang(mk) { quotes: \201e \201c \201a \2018 } /* „ “ ‚ ‘ */:root:lang(ml), :not(:lang(ml)) > :lang(ml) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(mn), :not(:lang(mn)) > :lang(mn) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(mr), :not(:lang(mr)) > :lang(mr) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(ms), :not(:lang(ms)) > :lang(ms) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(mt), :not(:lang(mt)) > :lang(mt) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(mua), :not(:lang(mua)) > :lang(mua) { quotes: \00ab \00bb \201c \201d } /* « » “ ” */:root:lang(my), :not(:lang(my)) > :lang(my) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(mzn), :not(:lang(mzn)) > :lang(mzn) { quotes: \00ab \00bb \2039 \203a } /* « » ‹ › */:root:lang(naq), :not(:lang(naq)) > :lang(naq) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(nb), :not(:lang(nb)) > :lang(nb) { quotes: \00ab \00bb \2018 \2019 } /* « » ‘ ’ */:root:lang(nd), :not(:lang(nd)) > :lang(nd) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(ne), :not(:lang(ne)) > :lang(ne) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(nl), :not(:lang(nl)) > :lang(nl) { quotes: \2018 \2019 \201c \201d } /* ‘ ’ “ ” */:root:lang(nmg), :not(:lang(nmg)) > :lang(nmg) { quotes: \201e \201d \00ab \00bb } /* „ ” « » */:root:lang(nn), :not(:lang(nn)) > :lang(nn) { quotes: \00ab \00bb \2018 \2019 } /* « » ‘ ’ */:root:lang(nnh), :not(:lang(nnh)) > :lang(nnh) { quotes: \00ab \00bb \201c \201d } /* « » “ ” */:root:lang(nus), :not(:lang(nus)) > :lang(nus) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(nyn), :not(:lang(nyn)) > :lang(nyn) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(pa), :not(:lang(pa)) > :lang(pa) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(pl), :not(:lang(pl)) > :lang(pl) { quotes: \201e \201d \00ab \00bb } /* „ ” « » */:root:lang(pt), :not(:lang(pt)) > :lang(pt) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(pt-PT), :not(:lang(pt-PT)) > :lang(pt-PT) { quotes: \00ab \00bb \201c \201d } /* « » “ ” */:root:lang(rn), :not(:lang(rn)) > :lang(rn) { quotes: \201d \201d \2019 \2019 } /* ” ” ’ ’ */:root:lang(ro), :not(:lang(ro)) > :lang(ro) { quotes: \201e \201d \00ab \00bb } /* „ ” « » */:root:lang(rof), :not(:lang(rof)) > :lang(rof) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(ru), :not(:lang(ru)) > :lang(ru) { quotes: \00ab \00bb \201e \201c } /* « » „ “ */:root:lang(rw), :not(:lang(rw)) > :lang(rw) { quotes: \00ab \00bb \2018 \2019 } /* « » ‘ ’ */:root:lang(rwk), :not(:lang(rwk)) > :lang(rwk) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(sah), :not(:lang(sah)) > :lang(sah) { quotes: \00ab \00bb \201e \201c } /* « » „ “ */:root:lang(saq), :not(:lang(saq)) > :lang(saq) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(sbp), :not(:lang(sbp)) > :lang(sbp) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(seh), :not(:lang(seh)) > :lang(seh) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(ses), :not(:lang(ses)) > :lang(ses) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(sg), :not(:lang(sg)) > :lang(sg) { quotes: \00ab \00bb \201c \201d } /* « » “ ” */:root:lang(shi), :not(:lang(shi)) > :lang(shi) { quotes: \00ab \00bb \201e \201d } /* « » „ ” */:root:lang(shi-Latn), :not(:lang(shi-Latn)) > :lang(shi-Latn) { quotes: \00ab \00bb \201e \201d } /* « » „ ” */:root:lang(si), :not(:lang(si)) > :lang(si) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(sk), :not(:lang(sk)) > :lang(sk) { quotes: \201e \201c \201a \2018 } /* „ “ ‚ ‘ */:root:lang(sl), :not(:lang(sl)) > :lang(sl) { quotes: \201e \201c \201a \2018 } /* „ “ ‚ ‘ */:root:lang(sn), :not(:lang(sn)) > :lang(sn) { quotes: \201d \201d \2019 \2019 } /* ” ” ’ ’ */:root:lang(so), :not(:lang(so)) > :lang(so) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(sq), :not(:lang(sq)) > :lang(sq) { quotes: \00ab \00bb \201c \201d } /* « » “ ” */:root:lang(sr), :not(:lang(sr)) > :lang(sr) { quotes: \201e \201c \2018 \2018 } /* „ “ ‘ ‘ */:root:lang(sr-Latn), :not(:lang(sr-Latn)) > :lang(sr-Latn) { quotes: \201e \201c \2018 \2018 } /* „ “ ‘ ‘ */:root:lang(sv), :not(:lang(sv)) > :lang(sv) { quotes: \201d \201d \2019 \2019 } /* ” ” ’ ’ */:root:lang(sw), :not(:lang(sw)) > :lang(sw) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(ta), :not(:lang(ta)) > :lang(ta) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(te), :not(:lang(te)) > :lang(te) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(teo), :not(:lang(teo)) > :lang(teo) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(th), :not(:lang(th)) > :lang(th) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(ti-ER), :not(:lang(ti-ER)) > :lang(ti-ER) { quotes: \2018 \2019 \201c \201d } /* ‘ ’ “ ” */:root:lang(tk), :not(:lang(tk)) > :lang(tk) { quotes: \201c \201d \201c \201d } /* “ ” “ ” */:root:lang(to), :not(:lang(to)) > :lang(to) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(tr), :not(:lang(tr)) > :lang(tr) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(twq), :not(:lang(twq)) > :lang(twq) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(tzm), :not(:lang(tzm)) > :lang(tzm) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(uk), :not(:lang(uk)) > :lang(uk) { quotes: \00ab \00bb \201e \201c } /* « » „ “ */:root:lang(ur), :not(:lang(ur)) > :lang(ur) { quotes: \201d \201c \2019 \2018 } /* ” “ ’ ‘ */:root:lang(uz), :not(:lang(uz)) > :lang(uz) { quotes: \201c \201d \2019 \2018 } /* “ ” ’ ‘ */:root:lang(uz-Cyrl), :not(:lang(uz-Cyrl)) > :lang(uz-Cyrl) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(vai), :not(:lang(vai)) > :lang(vai) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(vai-Latn), :not(:lang(vai-Latn)) > :lang(vai-Latn) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(vi), :not(:lang(vi)) > :lang(vi) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(vun), :not(:lang(vun)) > :lang(vun) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(xog), :not(:lang(xog)) > :lang(xog) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(yav), :not(:lang(yav)) > :lang(yav) { quotes: \00ab \00bb \00ab \00bb } /* « » « » */:root:lang(yo), :not(:lang(yo)) > :lang(yo) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(yue), :not(:lang(yue)) > :lang(yue) { quotes: \300c \300d \300e \300f } /* 「 」 『 』 */:root:lang(yue-Hans), :not(:lang(yue-Hans)) > :lang(yue-Hans) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(zgh), :not(:lang(zgh)) > :lang(zgh) { quotes: \00ab \00bb \201e \201d } /* « » „ ” */:root:lang(zh), :not(:lang(zh)) > :lang(zh) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ */:root:lang(zh-Hant), :not(:lang(zh-Hant)) > :lang(zh-Hant) { quotes: \300c \300d \300e \300f } /* 「 」 『 』 */:root:lang(zu), :not(:lang(zu)) > :lang(zu) { quotes: \201c \201d \2018 \2019 } /* “ ” ‘ ’ *//pre> h4 idsections-and-headings>span classsecno>14.3.7/span> Sections and headingsa href#sections-and-headings classself-link>/a>/h4> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);article, aside, h1, h2, h3, h4, h5, h6, hgroup, nav, section { display: block;}h1 { margin-block-start: 0.67em; margin-block-end: 0.67em; font-size: 2.00em; font-weight: bold; }h2 { margin-block-start: 0.83em; margin-block-end: 0.83em; font-size: 1.50em; font-weight: bold; }h3 { margin-block-start: 1.00em; margin-block-end: 1.00em; font-size: 1.17em; font-weight: bold; }h4 { margin-block-start: 1.33em; margin-block-end: 1.33em; font-size: 1.00em; font-weight: bold; }h5 { margin-block-start: 1.67em; margin-block-end: 1.67em; font-size: 0.83em; font-weight: bold; }h6 { margin-block-start: 2.33em; margin-block-end: 2.33em; font-size: 0.67em; font-weight: bold; }/pre> p>In the following CSS block, var>x/var> is shorthand for the following selector: code>:matches(article, aside, nav, section)/code>/p> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);var>x/var> h1 { margin-block-start: 0.83em; margin-block-end: 0.83em; font-size: 1.50em; }var>x/var> var>x/var> h1 { margin-block-start: 1.00em; margin-block-end: 1.00em; font-size: 1.17em; }var>x/var> var>x/var> var>x/var> h1 { margin-block-start: 1.33em; margin-block-end: 1.33em; font-size: 1.00em; }var>x/var> var>x/var> var>x/var> var>x/var> h1 { margin-block-start: 1.67em; margin-block-end: 1.67em; font-size: 0.83em; }var>x/var> var>x/var> var>x/var> var>x/var> var>x/var> h1 { margin-block-start: 2.33em; margin-block-end: 2.33em; font-size: 0.67em; }var>x/var> hgroup > h1 ~ h2 { margin-block-start: 1.00em; margin-block-end: 1.00em; font-size: 1.17em; }var>x/var> var>x/var> hgroup > h1 ~ h2 { margin-block-start: 1.33em; margin-block-end: 1.33em; font-size: 1.00em; }var>x/var> var>x/var> var>x/var> hgroup > h1 ~ h2 { margin-block-start: 1.67em; margin-block-end: 1.67em; font-size: 0.83em; }var>x/var> var>x/var> var>x/var> var>x/var> hgroup > h1 ~ h2 { margin-block-start: 2.33em; margin-block-end: 2.33em; font-size: 0.67em; }var>x/var> hgroup > h1 ~ h3 { margin-block-start: 1.33em; margin-block-end: 1.33em; font-size: 1.00em; }var>x/var> var>x/var> hgroup > h1 ~ h3 { margin-block-start: 1.67em; margin-block-end: 1.67em; font-size: 0.83em; }var>x/var> var>x/var> var>x/var> hgroup > h1 ~ h3 { margin-block-start: 2.33em; margin-block-end: 2.33em; font-size: 0.67em; }var>x/var> hgroup > h1 ~ h4 { margin-block-start: 1.67em; margin-block-end: 1.67em; font-size: 0.83em; }var>x/var> var>x/var> hgroup > h1 ~ h4 { margin-block-start: 2.33em; margin-block-end: 2.33em; font-size: 0.67em; }var>x/var> hgroup > h1 ~ h5 { margin-block-start: 2.33em; margin-block-end: 2.33em; font-size: 0.67em; }/pre> p classnote>The shorthand is used to keep this block at least mildly readable./p> h4 idlists>span classsecno>14.3.8/span> Listsa href#lists classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id17770 titleCSS: i18n comment 20 : list item marker display and position>17770/a>/div> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);dir, dd, dl, dt, menu, ol, ul { display: block; }li { display: list-item; }dir, dl, menu, ol, ul { margin-block-start: 1em; margin-block-end: 1em; }:matches(dir, dl, menu, ol, ul) :matches(dir, dl, menu, ol, ul) { margin-block-start: 0; margin-block-end: 0;}dd { margin-inline-start: 40px; }dir, menu, ol, ul { padding-inline-start: 40px; }ol { list-style-type: decimal; }dir, menu, ul { list-style-type: disc;}:matches(dir, menu, ol, ul) :matches(dir, menu, ul) { list-style-type: circle;}:matches(dir, menu, ol, ul) :matches(dir, menu, ol, ul) :matches(dir, menu, ul) { list-style-type: square;}/pre> p iddecohints>The following rules are also expected to apply, as a href#presentational-hints idlists:presentational-hints>presentational hints/a>:/p> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);oltype1, litype1 { list-style-type: decimal; }oltypea, litypea { list-style-type: lower-alpha; }oltypeA, litypeA { list-style-type: upper-alpha; }oltypei, litypei { list-style-type: lower-roman; }oltypeI, litypeI { list-style-type: upper-roman; }ultypenone i, litypenone i { list-style-type: none; }ultypedisc i, litypedisc i { list-style-type: disc; }ultypecircle i, litypecircle i { list-style-type: circle; }ultypesquare i, litypesquare i { list-style-type: square; }/pre> p idattribute-selector-case-sensitive>In the above stylesheet, the a hrefhttps://drafts.csswg.org/selectors/#attribute-selector idlists:attribute-selector data-x-internalattribute-selector>attribute selectors/a> for the code idlists:the-ol-element>a href#the-ol-element>ol/a>/code> and code idlists:the-li-element>a href#the-li-element>li/a>/code> elements are expected to be treated as a href#case-sensitive idlists:case-sensitive>case-sensitive/a>./p> p>When rendering code idlists:the-li-element-2>a href#the-li-element>li/a>/code> elements, non-CSS user agents are expected to use the a href#ordinal-value idlists:ordinal-value>ordinal value/a> of the code idlists:the-li-element-3>a href#the-li-element>li/a>/code> element to render the counter in the list item marker./p> p idcss-list-rendering classcritical>This specification does not yet define the CSS-specific rules for rendering code idlists:the-li-element-4>a href#the-li-element>li/a>/code> elements, because CSS doesnt yet provide sufficient hooks for this purpose./p> h4 idtables-2>span classsecno>14.3.9/span> Tablesa href#tables-2 classself-link>/a>/h4> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);table { display: table; }caption { display: table-caption; }colgroup, colgrouphidden { display: table-column-group; }col, colhidden { display: table-column; }thead, theadhidden { display: table-header-group; }tbody, tbodyhidden { display: table-row-group; }tfoot, tfoothidden { display: table-footer-group; }tr, trhidden { display: table-row; }td, th, tdhidden, thhidden { display: table-cell; }colgrouphidden, colhidden, theadhidden, tbodyhidden,tfoothidden, trhidden, tdhidden, thhidden { visibility: collapse;}table { box-sizing: border-box; border-spacing: 2px; border-collapse: separate; text-indent: initial;}td, th { padding: 1px; }th { font-weight: bold; }caption { text-align: center; }thead, tbody, tfoot, table > tr { vertical-align: middle; }tr, td, th { vertical-align: inherit; }table, td, th { border-color: gray; }thead, tbody, tfoot, tr { border-color: inherit; }tablerulesnone i, tablerulesgroups i, tablerulesrows i,tablerulescols i, tablerulesall i, tableframevoid i,tableframeabove i, tableframebelow i, tableframehsides i,tableframelhs i, tableframerhs i, tableframevsides i,tableframebox i, tableframeborder i,tablerulesnone i > tr > td, tablerulesnone i > tr > th,tablerulesgroups i > tr > td, tablerulesgroups i > tr > th,tablerulesrows i > tr > td, tablerulesrows i > tr > th,tablerulescols i > tr > td, tablerulescols i > tr > th,tablerulesall i > tr > td, tablerulesall i > tr > th,tablerulesnone i > thead > tr > td, tablerulesnone i > thead > tr > th,tablerulesgroups i > thead > tr > td, tablerulesgroups i > thead > tr > th,tablerulesrows i > thead > tr > td, tablerulesrows i > thead > tr > th,tablerulescols i > thead > tr > td, tablerulescols i > thead > tr > th,tablerulesall i > thead > tr > td, tablerulesall i > thead > tr > th,tablerulesnone i > tbody > tr > td, tablerulesnone i > tbody > tr > th,tablerulesgroups i > tbody > tr > td, tablerulesgroups i > tbody > tr > th,tablerulesrows i > tbody > tr > td, tablerulesrows i > tbody > tr > th,tablerulescols i > tbody > tr > td, tablerulescols i > tbody > tr > th,tablerulesall i > tbody > tr > td, tablerulesall i > tbody > tr > th,tablerulesnone i > tfoot > tr > td, tablerulesnone i > tfoot > tr > th,tablerulesgroups i > tfoot > tr > td, tablerulesgroups i > tfoot > tr > th,tablerulesrows i > tfoot > tr > td, tablerulesrows i > tfoot > tr > th,tablerulescols i > tfoot > tr > td, tablerulescols i > tfoot > tr > th,tablerulesall i > tfoot > tr > td, tablerulesall i > tfoot > tr > th { border-color: black;}/pre> p>The following rules are also expected to apply, as a href#presentational-hints idtables-2:presentational-hints>presentational hints/a>:/p> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);tablealignleft i { float: left; }tablealignright i { float: right; }tablealigncenter i { margin-inline-start: auto; margin-inline-end: auto; }theadalignabsmiddle i, tbodyalignabsmiddle i, tfootalignabsmiddle i,tralignabsmiddle i, tdalignabsmiddle i, thalignabsmiddle i { text-align: center;}captionalignbottom i { caption-side: bottom; }palignleft i, h1alignleft i, h2alignleft i, h3alignleft i,h4alignleft i, h5alignleft i, h6alignleft i { text-align: left;}palignright i, h1alignright i, h2alignright i, h3alignright i,h4alignright i, h5alignright i, h6alignright i { text-align: right;}paligncenter i, h1aligncenter i, h2aligncenter i, h3aligncenter i,h4aligncenter i, h5aligncenter i, h6aligncenter i { text-align: center;}palignjustify i, h1alignjustify i, h2alignjustify i, h3alignjustify i,h4alignjustify i, h5alignjustify i, h6alignjustify i { text-align: justify;}theadvaligntop i, tbodyvaligntop i, tfootvaligntop i,trvaligntop i, tdvaligntop i, thvaligntop i { vertical-align: top;}theadvalignmiddle i, tbodyvalignmiddle i, tfootvalignmiddle i,trvalignmiddle i, tdvalignmiddle i, thvalignmiddle i { vertical-align: middle;}theadvalignbottom i, tbodyvalignbottom i, tfootvalignbottom i,trvalignbottom i, tdvalignbottom i, thvalignbottom i { vertical-align: bottom;}theadvalignbaseline i, tbodyvalignbaseline i, tfootvalignbaseline i,trvalignbaseline i, tdvalignbaseline i, thvalignbaseline i { vertical-align: baseline;}tdnowrap, thnowrap { white-space: nowrap; }tablerulesnone i, tablerulesgroups i, tablerulesrows i,tablerulescols i, tablerulesall i { border-style: hidden; border-collapse: collapse;}tableborder { border-style: outset; } /* a href#magic-border-selector idtables-2:magic-border-selector>only if border is not equivalent to zero/a> */tableframevoid i { border-style: hidden; }tableframeabove i { border-style: outset hidden hidden hidden; }tableframebelow i { border-style: hidden hidden outset hidden; }tableframehsides i { border-style: outset hidden outset hidden; }tableframelhs i { border-style: hidden hidden hidden outset; }tableframerhs i { border-style: hidden outset hidden hidden; }tableframevsides i { border-style: hidden outset; }tableframebox i, tableframeborder i { border-style: outset; }tableborder > tr > td, tableborder > tr > th,tableborder > thead > tr > td, tableborder > thead > tr > th,tableborder > tbody > tr > td, tableborder > tbody > tr > th,tableborder > tfoot > tr > td, tableborder > tfoot > tr > th { /* a href#magic-border-selector idtables-2:magic-border-selector-2>only if border is not equivalent to zero/a> */ border-width: 1px; border-style: inset;}tablerulesnone i > tr > td, tablerulesnone i > tr > th,tablerulesnone i > thead > tr > td, tablerulesnone i > thead > tr > th,tablerulesnone i > tbody > tr > td, tablerulesnone i > tbody > tr > th,tablerulesnone i > tfoot > tr > td, tablerulesnone i > tfoot > tr > th,tablerulesgroups i > tr > td, tablerulesgroups i > tr > th,tablerulesgroups i > thead > tr > td, tablerulesgroups i > thead > tr > th,tablerulesgroups i > tbody > tr > td, tablerulesgroups i > tbody > tr > th,tablerulesgroups i > tfoot > tr > td, tablerulesgroups i > tfoot > tr > th,tablerulesrows i > tr > td, tablerulesrows i > tr > th,tablerulesrows i > thead > tr > td, tablerulesrows i > thead > tr > th,tablerulesrows i > tbody > tr > td, tablerulesrows i > tbody > tr > th,tablerulesrows i > tfoot > tr > td, tablerulesrows i > tfoot > tr > th { border-width: 1px; border-style: none;}tablerulescols i > tr > td, tablerulescols i > tr > th,tablerulescols i > thead > tr > td, tablerulescols i > thead > tr > th,tablerulescols i > tbody > tr > td, tablerulescols i > tbody > tr > th,tablerulescols i > tfoot > tr > td, tablerulescols i > tfoot > tr > th { border-width: 1px; border-block-start-style: none; border-inline-end-style: solid; border-block-end-style: none; border-inline-start-style: solid;}tablerulesall i > tr > td, tablerulesall i > tr > th,tablerulesall i > thead > tr > td, tablerulesall i > thead > tr > th,tablerulesall i > tbody > tr > td, tablerulesall i > tbody > tr > th,tablerulesall i > tfoot > tr > td, tablerulesall i > tfoot > tr > th { border-width: 1px; border-style: solid;}tablerulesgroups i > colgroup { border-inline-start-width: 1px; border-inline-start-style: solid; border-inline-end-width: 1px; border-inline-end-style: solid;}tablerulesgroups i > thead,tablerulesgroups i > tbody,tablerulesgroups i > tfoot { border-block-start-width: 1px; border-block-start-style: solid; border-block-end-width: 1px; border-block-end-style: solid;}tablerulesrows i > tr, tablerulesrows i > thead > tr,tablerulesrows i > tbody > tr, tablerulesrows i > tfoot > tr { border-block-start-width: 1px; border-block-start-style: solid; border-block-end-width: 1px; border-block-end-style: solid;}/pre> p>In a idtables-2:quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>, the following rules are also expected to apply:/p> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);table { font-weight: initial; font-style: initial; font-variant: initial; font-size: initial; line-height: initial; white-space: initial; text-align: initial;}/pre> hr> p>For the purposes of the CSS table model, the code idtables-2:the-col-element>a href#the-col-element>col/a>/code> element is expected to be treated as if it was present as many times as its code idtables-2:attr-col-span>a href#attr-col-span>span/a>/code> attribute a href#rules-for-parsing-non-negative-integers idtables-2:rules-for-parsing-non-negative-integers>specifies/a>./p> p>For the purposes of the CSS table model, the code idtables-2:the-colgroup-element>a href#the-colgroup-element>colgroup/a>/code> element, if it contains no code idtables-2:the-col-element-2>a href#the-col-element>col/a>/code> element, is expected to be treated as if it had as many such children as its code idtables-2:attr-colgroup-span>a href#attr-colgroup-span>span/a>/code> attribute a href#rules-for-parsing-non-negative-integers idtables-2:rules-for-parsing-non-negative-integers-2>specifies/a>./p> p>For the purposes of the CSS table model, the code idtables-2:attr-tdth-colspan>a href#attr-tdth-colspan>colspan/a>/code> and code idtables-2:attr-tdth-rowspan>a href#attr-tdth-rowspan>rowspan/a>/code> attributes on code idtables-2:the-td-element>a href#the-td-element>td/a>/code> and code idtables-2:the-th-element>a href#the-th-element>th/a>/code> elements are expected to a href#rules-for-parsing-non-negative-integers idtables-2:rules-for-parsing-non-negative-integers-3>provide/a> the i>special knowledge/i> regarding cells spanning rows and columns./p> p>In a idtables-2:html-documents hrefhttps://dom.spec.whatwg.org/#html-document data-x-internalhtml-documents>HTML documents/a>, the following rules are also expected to apply:/p> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);:matches(table, thead, tbody, tfoot, tr) > form { display: none !important; }/pre> hr> p>The code idtables-2:the-table-element>a href#the-table-element>table/a>/code> elements code idtables-2:attr-table-cellspacing>a href#attr-table-cellspacing>cellspacing/a>/code> attribute a href#maps-to-the-pixel-length-property idtables-2:maps-to-the-pixel-length-property>maps to the pixel length property/a> a idtables-2:border-spacing hrefhttps://drafts.csswg.org/css-tables/#propdef-border-spacing data-x-internalborder-spacing>border-spacing/a> on the element./p> p>The code idtables-2:the-table-element-2>a href#the-table-element>table/a>/code> elements code idtables-2:attr-table-cellpadding>a href#attr-table-cellpadding>cellpadding/a>/code> attribute a href#maps-to-the-pixel-length-property idtables-2:maps-to-the-pixel-length-property-2>maps to the pixel length properties/a> a idtables-2:padding-top hrefhttps://drafts.csswg.org/css2/box.html#propdef-padding-top data-x-internalpadding-top>padding-top/a>, a idtables-2:padding-right hrefhttps://drafts.csswg.org/css2/box.html#propdef-padding-right data-x-internalpadding-right>padding-right/a>, a idtables-2:padding-bottom hrefhttps://drafts.csswg.org/css2/box.html#propdef-padding-bottom data-x-internalpadding-bottom>padding-bottom/a>, and a idtables-2:padding-left hrefhttps://drafts.csswg.org/css2/box.html#propdef-padding-left data-x-internalpadding-left>padding-left/a> of any code idtables-2:the-td-element-2>a href#the-td-element>td/a>/code> and code idtables-2:the-th-element-2>a href#the-th-element>th/a>/code> elements that have corresponding a href#concept-cell idtables-2:concept-cell>cells/a> in the a href#concept-table idtables-2:concept-table>table/a> corresponding to the code idtables-2:the-table-element-3>a href#the-table-element>table/a>/code> element./p> p>The code idtables-2:the-table-element-4>a href#the-table-element>table/a>/code> elements code idtables-2:attr-table-height>a href#attr-table-height>height/a>/code> attribute a href#maps-to-the-dimension-property-(ignoring-zero) idtables-2:maps-to-the-dimension-property-(ignoring-zero)>maps to the dimension property (ignoring zero)/a> a idtables-2:height hrefhttps://drafts.csswg.org/css2/visudet.html#the-height-property data-x-internalheight>height/a> on the code idtables-2:the-table-element-5>a href#the-table-element>table/a>/code> element./p> p>The code idtables-2:the-table-element-6>a href#the-table-element>table/a>/code> elements code idtables-2:attr-table-width>a href#attr-table-width>width/a>/code> attribute a href#maps-to-the-dimension-property-(ignoring-zero) idtables-2:maps-to-the-dimension-property-(ignoring-zero)-2>maps to the dimension property (ignoring zero)/a> a idtables-2:width hrefhttps://drafts.csswg.org/css2/visudet.html#the-width-property data-x-internalwidth>width/a> on the code idtables-2:the-table-element-7>a href#the-table-element>table/a>/code> element./p> p>The code idtables-2:the-col-element-3>a href#the-col-element>col/a>/code> elements code idtables-2:attr-col-width>a href#attr-col-width>width/a>/code> attribute a href#maps-to-the-dimension-property-(ignoring-zero) idtables-2:maps-to-the-dimension-property-(ignoring-zero)-3>maps to the dimension property (ignoring zero)/a> a idtables-2:width-2 hrefhttps://drafts.csswg.org/css2/visudet.html#the-width-property data-x-internalwidth>width/a> on the code idtables-2:the-col-element-4>a href#the-col-element>col/a>/code> element./p> p>The code idtables-2:the-tr-element>a href#the-tr-element>tr/a>/code> elements code idtables-2:attr-tr-height>a href#attr-tr-height>height/a>/code> attribute a href#maps-to-the-dimension-property-(ignoring-zero) idtables-2:maps-to-the-dimension-property-(ignoring-zero)-4>maps to the dimension property (ignoring zero)/a> a idtables-2:height-2 hrefhttps://drafts.csswg.org/css2/visudet.html#the-height-property data-x-internalheight>height/a> on the code idtables-2:the-tr-element-2>a href#the-tr-element>tr/a>/code> element./p> p>The code idtables-2:the-td-element-3>a href#the-td-element>td/a>/code> and code idtables-2:the-th-element-3>a href#the-th-element>th/a>/code> elements code idtables-2:attr-tdth-height>a href#attr-tdth-height>height/a>/code> attributes a href#maps-to-the-dimension-property-(ignoring-zero) idtables-2:maps-to-the-dimension-property-(ignoring-zero)-5>map to the dimension property (ignoring zero)/a> a idtables-2:height-3 hrefhttps://drafts.csswg.org/css2/visudet.html#the-height-property data-x-internalheight>height/a> on the element./p> p>The code idtables-2:the-td-element-4>a href#the-td-element>td/a>/code> and code idtables-2:the-th-element-4>a href#the-th-element>th/a>/code> elements code idtables-2:attr-tdth-width>a href#attr-tdth-width>width/a>/code> attributes a href#maps-to-the-dimension-property-(ignoring-zero) idtables-2:maps-to-the-dimension-property-(ignoring-zero)-6>map to the dimension property (ignoring zero)/a> a idtables-2:width-3 hrefhttps://drafts.csswg.org/css2/visudet.html#the-width-property data-x-internalwidth>width/a> on the element./p> hr> p>The code idtables-2:the-thead-element>a href#the-thead-element>thead/a>/code>, code idtables-2:the-tbody-element>a href#the-tbody-element>tbody/a>/code>, code idtables-2:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code>, code idtables-2:the-tr-element-3>a href#the-tr-element>tr/a>/code>, code idtables-2:the-td-element-5>a href#the-td-element>td/a>/code>, and code idtables-2:the-th-element-5>a href#the-th-element>th/a>/code> elements, when they have an code>align/code> attribute whose value is an a idtables-2:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for either the string code>center/code> or the string code>middle/code>, are expected to center text within themselves, as if they had their a idtables-2:text-align hrefhttps://drafts.csswg.org/css-text/#text-align-property data-x-internaltext-align>text-align/a> property set to center in a a href#presentational-hints idtables-2:presentational-hints-2>presentational hint/a>, and to a href#align-descendants idtables-2:align-descendants>align descendants/a> to the center./p> p>The code idtables-2:the-thead-element-2>a href#the-thead-element>thead/a>/code>, code idtables-2:the-tbody-element-2>a href#the-tbody-element>tbody/a>/code>, code idtables-2:the-tfoot-element-2>a href#the-tfoot-element>tfoot/a>/code>, code idtables-2:the-tr-element-4>a href#the-tr-element>tr/a>/code>, code idtables-2:the-td-element-6>a href#the-td-element>td/a>/code>, and code idtables-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 idtables-2:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>left/code>, are expected to left-align text within themselves, as if they had their a idtables-2:text-align-2 hrefhttps://drafts.csswg.org/css-text/#text-align-property data-x-internaltext-align>text-align/a> property set to left in a a href#presentational-hints idtables-2:presentational-hints-3>presentational hint/a>, and to a href#align-descendants idtables-2:align-descendants-2>align descendants/a> to the left./p> p>The code idtables-2:the-thead-element-3>a href#the-thead-element>thead/a>/code>, code idtables-2:the-tbody-element-3>a href#the-tbody-element>tbody/a>/code>, code idtables-2:the-tfoot-element-3>a href#the-tfoot-element>tfoot/a>/code>, code idtables-2:the-tr-element-5>a href#the-tr-element>tr/a>/code>, code idtables-2:the-td-element-7>a href#the-td-element>td/a>/code>, and code idtables-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 idtables-2:ascii-case-insensitive-3 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>right/code>, are expected to right-align text within themselves, as if they had their a idtables-2:text-align-3 hrefhttps://drafts.csswg.org/css-text/#text-align-property data-x-internaltext-align>text-align/a> property set to right in a a href#presentational-hints idtables-2:presentational-hints-4>presentational hint/a>, and to a href#align-descendants idtables-2:align-descendants-3>align descendants/a> to the right./p> p>The code idtables-2:the-thead-element-4>a href#the-thead-element>thead/a>/code>, code idtables-2:the-tbody-element-4>a href#the-tbody-element>tbody/a>/code>, code idtables-2:the-tfoot-element-4>a href#the-tfoot-element>tfoot/a>/code>, code idtables-2:the-tr-element-6>a href#the-tr-element>tr/a>/code>, code idtables-2:the-td-element-8>a href#the-td-element>td/a>/code>, and code idtables-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 idtables-2:ascii-case-insensitive-4 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>justify/code>, are expected to full-justify text within themselves, as if they had their a idtables-2:text-align-4 hrefhttps://drafts.csswg.org/css-text/#text-align-property data-x-internaltext-align>text-align/a> property set to justify in a a href#presentational-hints idtables-2:presentational-hints-5>presentational hint/a>, and to a href#align-descendants idtables-2:align-descendants-4>align descendants/a> to the left./p> p>User agents are expected to have a rule in their user agent stylesheet that matches code idtables-2:the-th-element-9>a href#the-th-element>th/a>/code> elements that have a parent node whose a idtables-2:computed-value hrefhttps://drafts.csswg.org/css-cascade/#computed-value data-x-internalcomputed-value>computed value/a> for the a idtables-2:text-align-5 hrefhttps://drafts.csswg.org/css-text/#text-align-property data-x-internaltext-align>text-align/a> property is its initial value, whose declaration block consists of just a single declaration that sets the a idtables-2:text-align-6 hrefhttps://drafts.csswg.org/css-text/#text-align-property data-x-internaltext-align>text-align/a> property to the value center./p> hr> p>When a code idtables-2:the-table-element-8>a href#the-table-element>table/a>/code>, code idtables-2:the-thead-element-5>a href#the-thead-element>thead/a>/code>, code idtables-2:the-tbody-element-5>a href#the-tbody-element>tbody/a>/code>, code idtables-2:the-tfoot-element-5>a href#the-tfoot-element>tfoot/a>/code>, code idtables-2:the-tr-element-7>a href#the-tr-element>tr/a>/code>, code idtables-2:the-td-element-9>a href#the-td-element>td/a>/code>, or code idtables-2:the-th-element-10>a href#the-th-element>th/a>/code> element has a code idtables-2:attr-background>a href#attr-background>background/a>/code> attribute set to a non-empty value, the new value is expected to be a href#parse-a-url idtables-2:parse-a-url>parsed/a> relative to the elements a idtables-2:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>, and if this is successful, the user agent is expected to treat the attribute as a a href#presentational-hints idtables-2:presentational-hints-6>presentational hint/a> setting the elements a idtables-2:background-image hrefhttps://drafts.csswg.org/css-backgrounds/#the-background-image data-x-internalbackground-image>background-image/a> property to the a href#resulting-url-string idtables-2:resulting-url-string>resulting URL string/a>./p> p>When a code idtables-2:the-table-element-9>a href#the-table-element>table/a>/code>, code idtables-2:the-thead-element-6>a href#the-thead-element>thead/a>/code>, code idtables-2:the-tbody-element-6>a href#the-tbody-element>tbody/a>/code>, code idtables-2:the-tfoot-element-6>a href#the-tfoot-element>tfoot/a>/code>, code idtables-2:the-tr-element-8>a href#the-tr-element>tr/a>/code>, code idtables-2:the-td-element-10>a href#the-td-element>td/a>/code>, or code idtables-2:the-th-element-11>a href#the-th-element>th/a>/code> element has a code>bgcolor/code> attribute set, the new value is expected to be parsed using the a href#rules-for-parsing-a-legacy-colour-value idtables-2:rules-for-parsing-a-legacy-colour-value>rules for parsing a legacy color value/a>, and if that does not return an error, the user agent is expected to treat the attribute as a a href#presentational-hints idtables-2:presentational-hints-7>presentational hint/a> setting the elements a idtables-2:background-color hrefhttps://drafts.csswg.org/css-backgrounds/#the-background-color data-x-internalbackground-color>background-color/a> property to the resulting color./p> p>When a code idtables-2:the-table-element-10>a href#the-table-element>table/a>/code> element has a code idtables-2:attr-table-bordercolor>a href#attr-table-bordercolor>bordercolor/a>/code> attribute, its value is expected to be parsed using the a href#rules-for-parsing-a-legacy-colour-value idtables-2:rules-for-parsing-a-legacy-colour-value-2>rules for parsing a legacy color value/a>, and if that does not return an error, the user agent is expected to treat the attribute as a a href#presentational-hints idtables-2:presentational-hints-8>presentational hint/a> setting the elements a idtables-2:border-top-color hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-top-color data-x-internalborder-top-color>border-top-color/a>, a idtables-2:border-right-color hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-right-color data-x-internalborder-right-color>border-right-color/a>, a idtables-2:border-bottom-color hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-bottom-color data-x-internalborder-bottom-color>border-bottom-color/a>, and a idtables-2:border-left-color hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-left-color data-x-internalborder-left-color>border-left-color/a> properties to the resulting color./p> hr> p>The code idtables-2:the-table-element-11>a href#the-table-element>table/a>/code> elements code idtables-2:attr-table-border>a href#attr-table-border>border/a>/code> attribute a href#maps-to-the-pixel-length-property idtables-2:maps-to-the-pixel-length-property-3>maps to the pixel length properties/a> a idtables-2:border-top-width hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-top-width data-x-internalborder-top-width>border-top-width/a>, a idtables-2:border-right-width hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-right-width data-x-internalborder-right-width>border-right-width/a>, a idtables-2:border-bottom-width hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-bottom-width data-x-internalborder-bottom-width>border-bottom-width/a>, a idtables-2:border-left-width hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-left-width data-x-internalborder-left-width>border-left-width/a> on the element. If the attribute is present but parsing the attributes value using the a href#rules-for-parsing-non-negative-integers idtables-2:rules-for-parsing-non-negative-integers-4>rules for parsing non-negative integers/a> generates an error, a default value of 1px is expected to be used for that property instead./p> p>Rules marked dfn idmagic-border-selector>only if border is not equivalent to zero/dfn> in the CSS block above is expected to only be applied if the code idtables-2:attr-table-border-2>a href#attr-table-border>border/a>/code> attribute mentioned in the selectors for the rule is not only present but, when parsed using the a href#rules-for-parsing-non-negative-integers idtables-2:rules-for-parsing-non-negative-integers-5>rules for parsing non-negative integers/a>, is also found to have a value other than zero or to generate an error./p> hr> p>In a idtables-2:quirks-mode-2 hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>, a code idtables-2:the-td-element-11>a href#the-td-element>td/a>/code> element or a code idtables-2:the-th-element-12>a href#the-th-element>th/a>/code> element that has a code idtables-2:attr-tdth-nowrap>a href#attr-tdth-nowrap>nowrap/a>/code> attribute but also has a code idtables-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-non-zero-dimension-values idtables-2:rules-for-parsing-non-zero-dimension-values>rules for parsing nonzero dimension values/a>, is found to be a length (not an error or a number classified as a percentage), is expected to have a a href#presentational-hints idtables-2:presentational-hints-9>presentational hint/a> setting the elements a idtables-2:white-space hrefhttps://drafts.csswg.org/css-text/#white-space-property data-x-internalwhite-space>white-space/a> property to normal, overriding the rule in the CSS block above that sets it to nowrap./p> h4 idmargin-collapsing-quirks>span classsecno>14.3.10/span> Margin collapsing quirksa href#margin-collapsing-quirks classself-link>/a>/h4> p>A node is dfn idconcept-rendering-substantial>substantial/dfn> if it is a text node that is not a href#inter-element-whitespace idmargin-collapsing-quirks:inter-element-whitespace>inter-element whitespace/a>, or if it is an element node./p> p>A node is dfn idconcept-rendering-blank>blank/dfn> if it is an element that contains no a href#concept-rendering-substantial idmargin-collapsing-quirks:concept-rendering-substantial>substantial/a> nodes./p> p>The dfn idconcept-rendering-elements-with-margins>elements with default margins/dfn> are the following elements: code idmargin-collapsing-quirks:the-blockquote-element>a href#the-blockquote-element>blockquote/a>/code>, code idmargin-collapsing-quirks:dir>a href#dir>dir/a>/code>, code idmargin-collapsing-quirks:the-dl-element>a href#the-dl-element>dl/a>/code>, code idmargin-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 idmargin-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 idmargin-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 idmargin-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 idmargin-collapsing-quirks:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-5>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5/a>/code>, code idmargin-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 idmargin-collapsing-quirks:listing>a href#listing>listing/a>/code>, code idmargin-collapsing-quirks:the-menu-element>a href#the-menu-element>menu/a>/code>, code idmargin-collapsing-quirks:the-ol-element>a href#the-ol-element>ol/a>/code>, code idmargin-collapsing-quirks:the-p-element>a href#the-p-element>p/a>/code>, code idmargin-collapsing-quirks:plaintext>a href#plaintext>plaintext/a>/code>, code idmargin-collapsing-quirks:the-pre-element>a href#the-pre-element>pre/a>/code>, code idmargin-collapsing-quirks:the-ul-element>a href#the-ul-element>ul/a>/code>, code idmargin-collapsing-quirks:xmp>a href#xmp>xmp/a>/code>/p> p>In a idmargin-collapsing-quirks:quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>, any a href#concept-rendering-elements-with-margins idmargin-collapsing-quirks:concept-rendering-elements-with-margins>element with default margins/a> that is the a hrefhttps://dom.spec.whatwg.org/#concept-tree-child idmargin-collapsing-quirks:concept-tree-child data-x-internalconcept-tree-child>child/a> of a code idmargin-collapsing-quirks:the-body-element>a href#the-body-element>body/a>/code>, code idmargin-collapsing-quirks:the-td-element>a href#the-td-element>td/a>/code>, or code idmargin-collapsing-quirks:the-th-element>a href#the-th-element>th/a>/code> element and has no a href#concept-rendering-substantial idmargin-collapsing-quirks:concept-rendering-substantial-2>substantial/a> previous siblings is expected to have a user-agent level style sheet rule that sets its a idmargin-collapsing-quirks:margin-block-start hrefhttps://drafts.csswg.org/css-logical/#propdef-margin-block-start data-x-internalmargin-block-start>margin-block-start/a> property to zero./p> p>In a idmargin-collapsing-quirks:quirks-mode-2 hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>, any a href#concept-rendering-elements-with-margins idmargin-collapsing-quirks:concept-rendering-elements-with-margins-2>element with default margins/a> that is the a hrefhttps://dom.spec.whatwg.org/#concept-tree-child idmargin-collapsing-quirks:concept-tree-child-2 data-x-internalconcept-tree-child>child/a> of a code idmargin-collapsing-quirks:the-body-element-2>a href#the-body-element>body/a>/code>, code idmargin-collapsing-quirks:the-td-element-2>a href#the-td-element>td/a>/code>, or code idmargin-collapsing-quirks:the-th-element-2>a href#the-th-element>th/a>/code> element, has no a href#concept-rendering-substantial idmargin-collapsing-quirks:concept-rendering-substantial-3>substantial/a> previous siblings, and is a href#concept-rendering-blank idmargin-collapsing-quirks:concept-rendering-blank>blank/a>, is expected to have a user-agent level style sheet rule that sets its a idmargin-collapsing-quirks:margin-block-end hrefhttps://drafts.csswg.org/css-logical/#propdef-margin-block-end data-x-internalmargin-block-end>margin-block-end/a> property to zero also./p> p>In a idmargin-collapsing-quirks:quirks-mode-3 hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>, any a href#concept-rendering-elements-with-margins idmargin-collapsing-quirks:concept-rendering-elements-with-margins-3>element with default margins/a> that is the a hrefhttps://dom.spec.whatwg.org/#concept-tree-child idmargin-collapsing-quirks:concept-tree-child-3 data-x-internalconcept-tree-child>child/a> of a code idmargin-collapsing-quirks:the-td-element-3>a href#the-td-element>td/a>/code> or code idmargin-collapsing-quirks:the-th-element-3>a href#the-th-element>th/a>/code> element, has no a href#concept-rendering-substantial idmargin-collapsing-quirks:concept-rendering-substantial-4>substantial/a> following siblings, and is a href#concept-rendering-blank idmargin-collapsing-quirks:concept-rendering-blank-2>blank/a>, is expected to have a user-agent level style sheet rule that sets its a idmargin-collapsing-quirks:margin-block-start-2 hrefhttps://drafts.csswg.org/css-logical/#propdef-margin-block-start data-x-internalmargin-block-start>margin-block-start/a> property to zero./p> p>In a idmargin-collapsing-quirks:quirks-mode-4 hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>, any code idmargin-collapsing-quirks:the-p-element-2>a href#the-p-element>p/a>/code> element that is the a hrefhttps://dom.spec.whatwg.org/#concept-tree-child idmargin-collapsing-quirks:concept-tree-child-4 data-x-internalconcept-tree-child>child/a> of a code idmargin-collapsing-quirks:the-td-element-4>a href#the-td-element>td/a>/code> or code idmargin-collapsing-quirks:the-th-element-4>a href#the-th-element>th/a>/code> element and has no a href#concept-rendering-substantial idmargin-collapsing-quirks:concept-rendering-substantial-5>substantial/a> following siblings, is expected to have a user-agent level style sheet rule that sets its a idmargin-collapsing-quirks:margin-block-end-2 hrefhttps://drafts.csswg.org/css-logical/#propdef-margin-block-end data-x-internalmargin-block-end>margin-block-end/a> property to zero./p> h4 idform-controls>span classsecno>14.3.11/span> Form controlsa href#form-controls classself-link>/a>/h4> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);input, select, option, optgroup, button, textarea { text-indent: initial;}input:matches(typeradio i, typecheckbox i, typereset i, typebutton i,typesubmit i, typesearch i), select, button { box-sizing: border-box;}textarea { white-space: pre-wrap; }/pre> p>In a idform-controls:quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>, the following rules are also expected to apply:/p> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);input:not(typeimage i), textarea { box-sizing: border-box; }/pre> p>Each kind of form control is also described in the a href#widgets>Widgets/a> section, which describes the look and feel of the control./p> h4 idthe-hr-element-2>span classsecno>14.3.12/span> The code idthe-hr-element-2:the-hr-element>a href#the-hr-element>hr/a>/code> elementa href#the-hr-element-2 classself-link>/a>/h4> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);hr { color: gray; border-style: inset; border-width: 1px; margin-block-start: 0.5em; margin-inline-end: auto; margin-block-end: 0.5em; margin-inline-start: auto; overflow: hidden;}/pre> p>The following rules are also expected to apply, as a href#presentational-hints idthe-hr-element-2:presentational-hints>presentational hints/a>:/p> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);hralignleft i { margin-left: 0; margin-right: auto; }hralignright i { margin-left: auto; margin-right: 0; }hraligncenter i { margin-left: auto; margin-right: auto; }hrcolor, hrnoshade { border-style: solid; }/pre> p>If an code idthe-hr-element-2:the-hr-element-2>a href#the-hr-element>hr/a>/code> element has either a code idthe-hr-element-2:attr-hr-color>a href#attr-hr-color>color/a>/code> attribute or a code idthe-hr-element-2:attr-hr-noshade>a href#attr-hr-noshade>noshade/a>/code> attribute, and furthermore also has a code idthe-hr-element-2:attr-hr-size>a href#attr-hr-size>size/a>/code> attribute, and parsing that attributes value using the a href#rules-for-parsing-non-negative-integers idthe-hr-element-2:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers/a> doesnt generate an error, then the user agent is expected to use the parsed value divided by two as a pixel length for a href#presentational-hints idthe-hr-element-2:presentational-hints-2>presentational hints/a> for the properties a idthe-hr-element-2:border-top-width hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-top-width data-x-internalborder-top-width>border-top-width/a>, a idthe-hr-element-2:border-right-width hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-right-width data-x-internalborder-right-width>border-right-width/a>, a idthe-hr-element-2:border-bottom-width hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-bottom-width data-x-internalborder-bottom-width>border-bottom-width/a>, and a idthe-hr-element-2:border-left-width hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-left-width data-x-internalborder-left-width>border-left-width/a> on the element./p> p>Otherwise, if an code idthe-hr-element-2:the-hr-element-3>a href#the-hr-element>hr/a>/code> element has neither a code idthe-hr-element-2:attr-hr-color-2>a href#attr-hr-color>color/a>/code> attribute nor a code idthe-hr-element-2:attr-hr-noshade-2>a href#attr-hr-noshade>noshade/a>/code> attribute, but does have a code idthe-hr-element-2:attr-hr-size-2>a href#attr-hr-size>size/a>/code> attribute, and parsing that attributes value using the a href#rules-for-parsing-non-negative-integers idthe-hr-element-2:rules-for-parsing-non-negative-integers-2>rules for parsing non-negative integers/a> doesnt generate an error, then: if the parsed value is one, then the user agent is expected to use the attribute as a a href#presentational-hints idthe-hr-element-2:presentational-hints-3>presentational hint/a> setting the elements a idthe-hr-element-2:border-bottom-width-2 hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-bottom-width data-x-internalborder-bottom-width>border-bottom-width/a> to 0; otherwise, if the parsed value is greater than one, then the user agent is expected to use the parsed value minus two as a pixel length for a href#presentational-hints idthe-hr-element-2:presentational-hints-4>presentational hints/a> for the a idthe-hr-element-2:height hrefhttps://drafts.csswg.org/css2/visudet.html#the-height-property data-x-internalheight>height/a> property on the element./p> p>The code idthe-hr-element-2:attr-hr-width>a href#attr-hr-width>width/a>/code> attribute on an code idthe-hr-element-2:the-hr-element-4>a href#the-hr-element>hr/a>/code> element a href#maps-to-the-dimension-property idthe-hr-element-2:maps-to-the-dimension-property>maps to the dimension property/a> a idthe-hr-element-2:width hrefhttps://drafts.csswg.org/css2/visudet.html#the-width-property data-x-internalwidth>width/a> on the element./p> p>When an code idthe-hr-element-2:the-hr-element-5>a href#the-hr-element>hr/a>/code> element has a code idthe-hr-element-2:attr-hr-color-3>a href#attr-hr-color>color/a>/code> attribute, its value is expected to be parsed using the a href#rules-for-parsing-a-legacy-colour-value idthe-hr-element-2:rules-for-parsing-a-legacy-colour-value>rules for parsing a legacy color value/a>, and if that does not return an error, the user agent is expected to treat the attribute as a a href#presentational-hints idthe-hr-element-2:presentational-hints-5>presentational hint/a> setting the elements a idthe-hr-element-2:color hrefhttps://drafts.csswg.org/css-color/#the-color-property data-x-internalcolor>color/a> property to the resulting color./p> h4 idthe-fieldset-and-legend-elements>span classsecno>14.3.13/span> The code idthe-fieldset-and-legend-elements:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code> and code idthe-fieldset-and-legend-elements:the-legend-element>a href#the-legend-element>legend/a>/code> elementsa href#the-fieldset-and-legend-elements classself-link>/a>/h4> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);fieldset { display: block; margin-inline-start: 2px; margin-inline-end: 2px; border: groove 2px ThreeDFace; padding-block-start: 0.35em; padding-inline-end: 0.625em; padding-block-end: 0.75em; padding-inline-start: 0.625em; min-width: min-content;}legend { padding-inline-start: 2px; padding-inline-end: 2px;}/pre> p>The code idthe-fieldset-and-legend-elements:the-fieldset-element-2>a href#the-fieldset-element>fieldset/a>/code> element is expected to establish a new block formatting context./p> p>If the code idthe-fieldset-and-legend-elements:the-fieldset-element-3>a href#the-fieldset-element>fieldset/a>/code> element has a a hrefhttps://dom.spec.whatwg.org/#concept-tree-child idthe-fieldset-and-legend-elements:concept-tree-child data-x-internalconcept-tree-child>child/a> that matches the conditions in the list below, then the first such child is the code idthe-fieldset-and-legend-elements:the-fieldset-element-4>a href#the-fieldset-element>fieldset/a>/code> elements dfn idrendered-legend>rendered legend/dfn>:/p> ul classbrief>li>The child is a code idthe-fieldset-and-legend-elements:the-legend-element-2>a href#the-legend-element>legend/a>/code> element.li>The child is not a idthe-fieldset-and-legend-elements:out-of-flow hrefhttps://drafts.csswg.org/css2/visuren.html#x24 data-x-internalout-of-flow>out-of-flow/a> (e.g. not absolutely positioned or floated).li>The child is generating a box (e.g. it is not display:none or display:contents)./ul> p>A code idthe-fieldset-and-legend-elements:the-fieldset-element-5>a href#the-fieldset-element>fieldset/a>/code> elements a href#rendered-legend idthe-fieldset-and-legend-elements:rendered-legend>rendered legend/a>, if any, is expected to be rendered over the a idthe-fieldset-and-legend-elements:block-start hrefhttps://drafts.csswg.org/css-writing-modes/#block-start data-x-internalblock-start>block-start/a> a idthe-fieldset-and-legend-elements:border-edge hrefhttps://drafts.csswg.org/css2/box.html#border-edge data-x-internalborder-edge>border edge/a> of the code idthe-fieldset-and-legend-elements:the-fieldset-element-6>a href#the-fieldset-element>fieldset/a>/code> element as a a idthe-fieldset-and-legend-elements:block-box hrefhttps://drafts.csswg.org/css2/visuren.html#x9 data-x-internalblock-box>block box/a> (overriding any explicit a idthe-fieldset-and-legend-elements:display hrefhttps://drafts.csswg.org/css2/visuren.html#display-prop data-x-internaldisplay>display/a> value). In the absence of an explicit a idthe-fieldset-and-legend-elements:inline-size hrefhttps://drafts.csswg.org/css-writing-modes/#inline-size data-x-internalinline-size>inline size/a>, the box should shrink-wrap. The element is expected to establish a new block formatting context. If the code idthe-fieldset-and-legend-elements:the-legend-element-3>a href#the-legend-element>legend/a>/code> element in question has an code idthe-fieldset-and-legend-elements:attr-legend-align>a href#attr-legend-align>align/a>/code> attribute, and its value is an a idthe-fieldset-and-legend-elements:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for one of the strings in the first column of the following table, then the code idthe-fieldset-and-legend-elements:the-legend-element-4>a href#the-legend-element>legend/a>/code> is expected to be rendered aligned in the inline direction over the a idthe-fieldset-and-legend-elements:border-edge-2 hrefhttps://drafts.csswg.org/css2/box.html#border-edge data-x-internalborder-edge>border edge/a> in the position given in the corresponding cell on the same row in the second column. If the attribute is absent or has a value that doesnt match any of the cases in the table, then the position is expected to be on the a idthe-fieldset-and-legend-elements:inline-start hrefhttps://drafts.csswg.org/css-writing-modes/#inline-start data-x-internalinline-start>inline-start/a> side. a href#refsCSSWM>CSSWM/a>/p> table>thead>tr>th>Attribute value th>Alignment position tbody>tr>td>code>left/code> td>On the a idthe-fieldset-and-legend-elements:line-left hrefhttps://drafts.csswg.org/css-writing-modes/#line-left data-x-internalline-left>line-left/a> side tr>td>code>right/code> td>On the a idthe-fieldset-and-legend-elements:line-right hrefhttps://drafts.csswg.org/css-writing-modes/#line-right data-x-internalline-right>line-right/a> side tr>td>code>center/code> td>In the middle /table> h3 idreplaced-elements>span classsecno>14.4/span> Replaced elementsa href#replaced-elements classself-link>/a>/h3> p classnote>The following elements can be a hrefhttps://drafts.csswg.org/css2/conform.html#replaced-element idreplaced-elements:replaced-element data-x-internalreplaced-element>replaced elements/a>: code idreplaced-elements:the-audio-element>a href#the-audio-element>audio/a>/code>, code idreplaced-elements:the-canvas-element>a href#the-canvas-element>canvas/a>/code>, code idreplaced-elements:the-embed-element>a href#the-embed-element>embed/a>/code>, code idreplaced-elements:the-iframe-element>a href#the-iframe-element>iframe/a>/code>, code idreplaced-elements:the-img-element>a href#the-img-element>img/a>/code>, code idreplaced-elements:the-input-element>a href#the-input-element>input/a>/code>, code idreplaced-elements:the-object-element>a href#the-object-element>object/a>/code>, and code idreplaced-elements:the-video-element>a href#the-video-element>video/a>/code>./p> h4 idembedded-content-rendering-rules>span classsecno>14.4.1/span> Embedded contenta href#embedded-content-rendering-rules classself-link>/a>/h4> p>The code idembedded-content-rendering-rules:the-embed-element>a href#the-embed-element>embed/a>/code>, code idembedded-content-rendering-rules:the-iframe-element>a href#the-iframe-element>iframe/a>/code>, and code idembedded-content-rendering-rules:the-video-element>a href#the-video-element>video/a>/code> elements are expected to be treated as a hrefhttps://drafts.csswg.org/css2/conform.html#replaced-element idembedded-content-rendering-rules:replaced-element data-x-internalreplaced-element>replaced elements/a>./p> p>A code idembedded-content-rendering-rules:the-canvas-element>a href#the-canvas-element>canvas/a>/code> element that a href#represents idembedded-content-rendering-rules:represents>represents/a> a href#embedded-content-category idembedded-content-rendering-rules:embedded-content-category>embedded content/a> is expected to be treated as a a idembedded-content-rendering-rules:replaced-element-2 hrefhttps://drafts.csswg.org/css2/conform.html#replaced-element data-x-internalreplaced-element>replaced element/a>; the contents of such elements are the elements bitmap, if any, or else a a href#transparent-black idembedded-content-rendering-rules:transparent-black>transparent black/a> bitmap with the same a idembedded-content-rendering-rules:intrinsic-dimensions hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic data-x-internalintrinsic-dimensions>intrinsic dimensions/a> as the element. Other code idembedded-content-rendering-rules:the-canvas-element-2>a href#the-canvas-element>canvas/a>/code> elements are expected to be treated as ordinary elements in the rendering model./p> p>An code idembedded-content-rendering-rules:the-object-element>a href#the-object-element>object/a>/code> element that a href#represents idembedded-content-rendering-rules:represents-2>represents/a> an image, plugin, or a href#nested-browsing-context idembedded-content-rendering-rules:nested-browsing-context>nested browsing context/a> is expected to be treated as a a idembedded-content-rendering-rules:replaced-element-3 hrefhttps://drafts.csswg.org/css2/conform.html#replaced-element data-x-internalreplaced-element>replaced element/a>. Other code idembedded-content-rendering-rules:the-object-element-2>a href#the-object-element>object/a>/code> elements are expected to be treated as ordinary elements in the rendering model./p> p>The code idembedded-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 idembedded-content-rendering-rules:expose-a-user-interface-to-the-user>exposing a user interface/a>, is expected to be treated as a a idembedded-content-rendering-rules:replaced-element-4 hrefhttps://drafts.csswg.org/css2/conform.html#replaced-element data-x-internalreplaced-element>replaced element/a> about one line high, as wide as is necessary to expose the user agents user interface features. When an code idembedded-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 idembedded-content-rendering-rules:expose-a-user-interface-to-the-user-2>exposing a user interface/a>, the user agent is expected to force its a idembedded-content-rendering-rules:display hrefhttps://drafts.csswg.org/css2/visuren.html#display-prop data-x-internaldisplay>display/a> property to compute to none, irrespective of CSS rules./p> p>Whether a code idembedded-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 idembedded-content-rendering-rules:expose-a-user-interface-to-the-user-3>exposing a user interface/a> is not expected to affect the size of the rendering; controls are expected to be overlaid above the page content without causing any layout changes, and are expected to disappear when the user does not need them./p> p>When a code idembedded-content-rendering-rules:the-video-element-3>a href#the-video-element>video/a>/code> element represents a poster frame or frame of video, the poster frame or frame of video is expected to be rendered at the largest size that maintains the aspect ratio of that poster frame or frame of video without being taller or wider than the code idembedded-content-rendering-rules:the-video-element-4>a href#the-video-element>video/a>/code> element itself, and is expected to be centered in the code idembedded-content-rendering-rules:the-video-element-5>a href#the-video-element>video/a>/code> element./p> p>Any subtitles or captions are expected to be overlayed directly on top of their code idembedded-content-rendering-rules:the-video-element-6>a href#the-video-element>video/a>/code> element, as defined by the relevant rendering rules; for WebVTT, those are the a idembedded-content-rendering-rules:rules-for-updating-the-display-of-webvtt-text-tracks hrefhttps://w3c.github.io/webvtt/#rules-for-updating-the-display-of-webvtt-text-tracks data-x-internalrules-for-updating-the-display-of-webvtt-text-tracks>rules for updating the display of WebVTT text tracks/a>. a href#refsWEBVTT>WEBVTT/a>/p> p>When the user agent starts a href#expose-a-user-interface-to-the-user idembedded-content-rendering-rules:expose-a-user-interface-to-the-user-4>exposing a user interface/a> for a code idembedded-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 idembedded-content-rendering-rules:rules-for-updating-the-text-track-rendering>rules for updating the text track rendering/a> of each of the a href#text-track idembedded-content-rendering-rules:text-track>text tracks/a> in the code idembedded-content-rendering-rules:the-video-element-8>a href#the-video-element>video/a>/code> elements a href#list-of-text-tracks idembedded-content-rendering-rules:list-of-text-tracks>list of text tracks/a> that are a href#text-track-showing idembedded-content-rendering-rules:text-track-showing>showing/a> and whose a href#text-track-kind idembedded-content-rendering-rules:text-track-kind>text track kind/a> is one of code idembedded-content-rendering-rules:dom-texttrack-kind-subtitles>a href#dom-texttrack-kind-subtitles>subtitles/a>/code> or code idembedded-content-rendering-rules:dom-texttrack-kind-captions>a href#dom-texttrack-kind-captions>captions/a>/code> (e.g., for a href#text-track idembedded-content-rendering-rules:text-track-2>text tracks/a> based on WebVTT, the a idembedded-content-rendering-rules:rules-for-updating-the-display-of-webvtt-text-tracks-2 hrefhttps://w3c.github.io/webvtt/#rules-for-updating-the-display-of-webvtt-text-tracks data-x-internalrules-for-updating-the-display-of-webvtt-text-tracks>rules for updating the display of WebVTT text tracks/a>). a href#refsWEBVTT>WEBVTT/a>/p> p classnote>Resizing code idembedded-content-rendering-rules:the-video-element-9>a href#the-video-element>video/a>/code> and code idembedded-content-rendering-rules:the-canvas-element-3>a href#the-canvas-element>canvas/a>/code> elements does not interrupt video playback or clear the canvas./p> hr> p>The following CSS rules are expected to apply:/p> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);iframe { border: 2px inset; }span idvideo-object-fit>video { object-fit: contain; }/span>/pre> h4 idimages-3>span classsecno>14.4.2/span> Imagesa href#images-3 classself-link>/a>/h4> p>User agents are expected to render code idimages-3:the-img-element>a href#the-img-element>img/a>/code> elements and code idimages-3:the-input-element>a href#the-input-element>input/a>/code> elements whose code idimages-3:attr-input-type>a href#attr-input-type>type/a>/code> attributes are in the a href#image-button-state-(typeimage) idimages-3:image-button-state-(typeimage)>Image Button/a> state, according to the first applicable rules from the following list:/p> dl classswitch>dt>If the element a href#represents idimages-3:represents>represents/a> an imagedd>The user agent is expected to treat the element as a a idimages-3:replaced-element hrefhttps://drafts.csswg.org/css2/conform.html#replaced-element data-x-internalreplaced-element>replaced element/a> and render the image according to the rules for doing so defined in CSS.dt> If the element does not a href#represents idimages-3:represents-2>represent/a> an image, but the element already has a idimages-3:intrinsic-dimensions hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic data-x-internalintrinsic-dimensions>intrinsic dimensions/a> (e.g. from the a href#dimension-attributes idimages-3:dimension-attributes>dimension attributes/a> or CSS rules), and either: ul>li>the user agent has reason to believe that the image will become i idimages-3:img-available>a href#img-available>available/a>/i> and be rendered in due course, or li>the element has no code>alt/code> attribute, or li>the code idimages-3:document>a href#document>Document/a>/code> is in a idimages-3:quirks-mode hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a> /ul> dd>The user agent is expected to treat the element as a a idimages-3:replaced-element-2 hrefhttps://drafts.csswg.org/css2/conform.html#replaced-element data-x-internalreplaced-element>replaced element/a> whose content is the text that the element represents, if any, optionally alongside an icon indicating that the image is being obtained (if applicable). For code idimages-3:the-input-element-2>a href#the-input-element>input/a>/code> elements, the element is expected to appear button-like to indicate that the element is a a href#concept-button idimages-3:concept-button>button/a>.dt>If the element is an code idimages-3:the-img-element-2>a href#the-img-element>img/a>/code> element that a href#represents idimages-3:represents-3>represents/a> some text and the user agent does not expect this to changedd>The user agent is expected to treat the element as a non-replaced phrasing element whose content is the text, optionally with an icon indicating that an image is missing, so that the user can request the image be displayed or investigate why it is not rendering. In non-graphical contexts, such an icon should be omitted.dt>If the element is an code idimages-3:the-img-element-3>a href#the-img-element>img/a>/code> element that a href#represents idimages-3:represents-4>represents/a> nothing and the user agent does not expect this to changedd>The user agent is expected to treat the element as an empty inline element. (In the absence of further styles, this will cause the element to essentially not be rendered.)dt>If the element is an code idimages-3:the-input-element-3>a href#the-input-element>input/a>/code> element that does not a href#represents idimages-3:represents-5>represent/a> an image and the user agent does not expect this to changedd>The user agent is expected to treat the element as a a idimages-3:replaced-element-3 hrefhttps://drafts.csswg.org/css2/conform.html#replaced-element data-x-internalreplaced-element>replaced element/a> consisting of a button whose content is the elements alternative text. The a idimages-3:intrinsic-dimensions-2 hrefhttps://drafts.csswg.org/css2/conform.html#intrinsic data-x-internalintrinsic-dimensions>intrinsic dimensions/a> of the button are expected to be about one line in height and whatever width is necessary to render the text on one line./dl> p>The icons mentioned above are expected to be relatively small so as not to disrupt most text but be easily clickable. In a visual environment, for instance, icons could be 16 pixels by 16 pixels square, or 1em by 1em if the images are scalable. In an audio environment, the icon could be a short bleep. The icons are intended to indicate to the user that they can be used to get to whatever options the UA provides for images, and, where appropriate, are expected to provide access to the context menu that would have come up if the user interacted with the actual image./p> hr> p>All animated images with the same a idimages-3:absolute-url hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a> and the same image data are expected to be rendered synchronized to the same timeline as a group, with the timeline starting at the time of the least recent addition to the group./p> p classnote>In other words, when a second image with the same a idimages-3:absolute-url-2 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a> and animated image data is inserted into a document, it jumps to the point in the animation cycle that is currently being displayed by the first image./p> p>When a user agent is to dfn idrestart-the-animation>restart the animation/dfn> for an code idimages-3:the-img-element-4>a href#the-img-element>img/a>/code> element showing an animated image, all animated images with the same a idimages-3:absolute-url-3 hrefhttps://url.spec.whatwg.org/#syntax-url-absolute data-x-internalabsolute-url>absolute URL/a> and the same image data in that code idimages-3:the-img-element-5>a href#the-img-element>img/a>/code> elements a idimages-3:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a> are expected to restart their animation from the beginning./p> hr> p>The following CSS rules are expected to apply when the code idimages-3:document-2>a href#document>Document/a>/code> is in a idimages-3:quirks-mode-2 hrefhttps://dom.spec.whatwg.org/#concept-document-quirks data-x-internalquirks-mode>quirks mode/a>:/p> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);imgalignleft i { margin-right: 3px; }imgalignright i { margin-left: 3px; }/pre> h4 idattributes-for-embedded-content-and-images>span classsecno>14.4.3/span> Attributes for embedded content and imagesa href#attributes-for-embedded-content-and-images classself-link>/a>/h4> p>The following CSS rules are expected to apply as a href#presentational-hints idattributes-for-embedded-content-and-images:presentational-hints>presentational hints/a>:/p> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);iframeframeborder0, iframeframeborderno i { border: none; }embedalignleft i, iframealignleft i, imgalignleft i,inputtypeimage ialignleft i, objectalignleft i { float: left;}embedalignright i, iframealignright i, imgalignright i,inputtypeimage ialignright i, objectalignright i { float: right;}embedaligntop i, iframealigntop i, imgaligntop i,inputtypeimage ialigntop i, objectaligntop i { vertical-align: top;}embedalignbaseline i, iframealignbaseline i, imgalignbaseline i,inputtypeimage ialignbaseline i, objectalignbaseline i { vertical-align: baseline;}embedaligntexttop i, iframealigntexttop i, imgaligntexttop i,inputtypeimage ialigntexttop i, objectaligntexttop i { vertical-align: text-top;}embedalignabsmiddle i, iframealignabsmiddle i, imgalignabsmiddle i,inputtypeimage ialignabsmiddle i, objectalignabsmiddle i,embedalignabscenter i, iframealignabscenter i, imgalignabscenter i,inputtypeimage ialignabscenter i, objectalignabscenter i { vertical-align: middle;}embedalignbottom i, iframealignbottom i, imgalignbottom i,inputtypeimage ialignbottom i, objectalignbottom i { vertical-align: bottom;}/pre> p>When an code idattributes-for-embedded-content-and-images:the-embed-element>a href#the-embed-element>embed/a>/code>, code idattributes-for-embedded-content-and-images:the-iframe-element>a href#the-iframe-element>iframe/a>/code>, code idattributes-for-embedded-content-and-images:the-img-element>a href#the-img-element>img/a>/code>, or code idattributes-for-embedded-content-and-images:the-object-element>a href#the-object-element>object/a>/code> element, or an code idattributes-for-embedded-content-and-images:the-input-element>a href#the-input-element>input/a>/code> element whose code idattributes-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-(typeimage) idattributes-for-embedded-content-and-images:image-button-state-(typeimage)>Image Button/a> state, has an code>align/code> attribute whose value is an a idattributes-for-embedded-content-and-images:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>center/code> or the string code>middle/code>, the user agent is expected to act as if the elements a idattributes-for-embedded-content-and-images:vertical-align hrefhttps://drafts.csswg.org/css2/visudet.html#propdef-vertical-align data-x-internalvertical-align>vertical-align/a> property was set to a value that aligns the vertical middle of the element with the parent elements baseline./p> p>The code>hspace/code> attribute of code idattributes-for-embedded-content-and-images:the-embed-element-2>a href#the-embed-element>embed/a>/code>, code idattributes-for-embedded-content-and-images:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code>, code idattributes-for-embedded-content-and-images:the-img-element-2>a href#the-img-element>img/a>/code>, or code idattributes-for-embedded-content-and-images:the-object-element-2>a href#the-object-element>object/a>/code> elements, and code idattributes-for-embedded-content-and-images:the-input-element-2>a href#the-input-element>input/a>/code> elements with a code idattributes-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-(typeimage) idattributes-for-embedded-content-and-images:image-button-state-(typeimage)-2>Image Button/a> state, a href#maps-to-the-dimension-property idattributes-for-embedded-content-and-images:maps-to-the-dimension-property>maps to the dimension properties/a> a idattributes-for-embedded-content-and-images:margin-left hrefhttps://drafts.csswg.org/css2/box.html#propdef-margin-left data-x-internalmargin-left>margin-left/a> and a idattributes-for-embedded-content-and-images:margin-right hrefhttps://drafts.csswg.org/css2/box.html#propdef-margin-right data-x-internalmargin-right>margin-right/a> on the element./p> p>The code>vspace/code> attribute of code idattributes-for-embedded-content-and-images:the-embed-element-3>a href#the-embed-element>embed/a>/code>, code idattributes-for-embedded-content-and-images:the-iframe-element-3>a href#the-iframe-element>iframe/a>/code>, code idattributes-for-embedded-content-and-images:the-img-element-3>a href#the-img-element>img/a>/code>, or code idattributes-for-embedded-content-and-images:the-object-element-3>a href#the-object-element>object/a>/code> elements, and code idattributes-for-embedded-content-and-images:the-input-element-3>a href#the-input-element>input/a>/code> elements with a code idattributes-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-(typeimage) idattributes-for-embedded-content-and-images:image-button-state-(typeimage)-3>Image Button/a> state, a href#maps-to-the-dimension-property idattributes-for-embedded-content-and-images:maps-to-the-dimension-property-2>maps to the dimension properties/a> a idattributes-for-embedded-content-and-images:margin-top hrefhttps://drafts.csswg.org/css2/box.html#propdef-margin-top data-x-internalmargin-top>margin-top/a> and a idattributes-for-embedded-content-and-images:margin-bottom hrefhttps://drafts.csswg.org/css2/box.html#propdef-margin-bottom data-x-internalmargin-bottom>margin-bottom/a> on the element./p> p>When an code idattributes-for-embedded-content-and-images:the-img-element-4>a href#the-img-element>img/a>/code> element, code idattributes-for-embedded-content-and-images:the-object-element-4>a href#the-object-element>object/a>/code> element, or code idattributes-for-embedded-content-and-images:the-input-element-4>a href#the-input-element>input/a>/code> element with a code idattributes-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-(typeimage) idattributes-for-embedded-content-and-images:image-button-state-(typeimage)-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 idattributes-for-embedded-content-and-images:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers/a>, is found to be a number greater than zero, the user agent is expected to use the parsed value for eight a href#presentational-hints idattributes-for-embedded-content-and-images:presentational-hints-2>presentational hints/a>: four setting the parsed value as a pixel length for the elements a idattributes-for-embedded-content-and-images:border-top-width hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-top-width data-x-internalborder-top-width>border-top-width/a>, a idattributes-for-embedded-content-and-images:border-right-width hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-right-width data-x-internalborder-right-width>border-right-width/a>, a idattributes-for-embedded-content-and-images:border-bottom-width hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-bottom-width data-x-internalborder-bottom-width>border-bottom-width/a>, and a idattributes-for-embedded-content-and-images:border-left-width hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-left-width data-x-internalborder-left-width>border-left-width/a> properties, and four setting the elements a idattributes-for-embedded-content-and-images:border-top-style hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-top-style data-x-internalborder-top-style>border-top-style/a>, a idattributes-for-embedded-content-and-images:border-right-style hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-right-style data-x-internalborder-right-style>border-right-style/a>, a idattributes-for-embedded-content-and-images:border-bottom-style hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-bottom-style data-x-internalborder-bottom-style>border-bottom-style/a>, and a idattributes-for-embedded-content-and-images:border-left-style hrefhttps://drafts.csswg.org/css2/box.html#propdef-border-left-style data-x-internalborder-left-style>border-left-style/a> properties to the value solid./p> p iddimRendering>The code idattributes-for-embedded-content-and-images:attr-dim-width>a href#attr-dim-width>width/a>/code> and code idattributes-for-embedded-content-and-images:attr-dim-height>a href#attr-dim-height>height/a>/code> attributes on code idattributes-for-embedded-content-and-images:the-embed-element-4>a href#the-embed-element>embed/a>/code>, code idattributes-for-embedded-content-and-images:the-iframe-element-4>a href#the-iframe-element>iframe/a>/code>, code idattributes-for-embedded-content-and-images:the-img-element-5>a href#the-img-element>img/a>/code>, code idattributes-for-embedded-content-and-images:the-object-element-5>a href#the-object-element>object/a>/code> or code idattributes-for-embedded-content-and-images:the-video-element>a href#the-video-element>video/a>/code> elements, and code idattributes-for-embedded-content-and-images:the-input-element-5>a href#the-input-element>input/a>/code> elements with a code idattributes-for-embedded-content-and-images:attr-input-type-5>a href#attr-input-type>type/a>/code> attribute in the a href#image-button-state-(typeimage) idattributes-for-embedded-content-and-images:image-button-state-(typeimage)-5>Image Button/a> state and that either represents an image or that the user expects will eventually represent an image, a href#maps-to-the-dimension-property idattributes-for-embedded-content-and-images:maps-to-the-dimension-property-3>map to the dimension properties/a> a idattributes-for-embedded-content-and-images:width hrefhttps://drafts.csswg.org/css2/visudet.html#the-width-property data-x-internalwidth>width/a> and a idattributes-for-embedded-content-and-images:height hrefhttps://drafts.csswg.org/css2/visudet.html#the-height-property data-x-internalheight>height/a> on the element respectively./p> h4 idimage-maps-2>span classsecno>14.4.4/span> Image mapsa href#image-maps-2 classself-link>/a>/h4> p>Shapes on an a href#image-map idimage-maps-2:image-map>image map/a> are expected to act, for the purpose of the CSS cascade, as elements independent of the original code idimage-maps-2:the-area-element>a href#the-area-element>area/a>/code> element that happen to match the same style rules but inherit from the code idimage-maps-2:the-img-element>a href#the-img-element>img/a>/code> or code idimage-maps-2:the-object-element>a href#the-object-element>object/a>/code> element./p> p>For the purposes of the rendering, only the a idimage-maps-2:cursor hrefhttps://drafts.csswg.org/css-ui/#cursor data-x-internalcursor>cursor/a> property is expected to have any effect on the shape./p> p classexample>Thus, for example, if an code idimage-maps-2:the-area-element-2>a href#the-area-element>area/a>/code> element has a code idimage-maps-2:the-style-attribute>a href#the-style-attribute>style/a>/code> attribute that sets the a idimage-maps-2:cursor-2 hrefhttps://drafts.csswg.org/css-ui/#cursor data-x-internalcursor>cursor/a> property to help, then when the user designates that shape, the cursor would change to a Help cursor./p> p classexample>Similarly, if an code idimage-maps-2:the-area-element-3>a href#the-area-element>area/a>/code> element had a CSS rule that set its a idimage-maps-2:cursor-3 hrefhttps://drafts.csswg.org/css-ui/#cursor data-x-internalcursor>cursor/a> property to inherit (or if no rule setting the a idimage-maps-2:cursor-4 hrefhttps://drafts.csswg.org/css-ui/#cursor data-x-internalcursor>cursor/a> property matched the element at all), the shapes cursor would be inherited from the code idimage-maps-2:the-img-element-2>a href#the-img-element>img/a>/code> or code idimage-maps-2:the-object-element-2>a href#the-object-element>object/a>/code> element of the a href#image-map idimage-maps-2:image-map-2>image map/a>, not from the parent of the code idimage-maps-2:the-area-element-4>a href#the-area-element>area/a>/code> element./p> h3 idwidgets>span classsecno>14.5/span> span idbindings>/span>Widgetsa href#widgets classself-link>/a>/h3> h4 idintroduction-17>span classsecno>14.5.1/span> Introductiona href#introduction-17 classself-link>/a>/h4> p>The elements defined in this section can be rendered in a variety of manners, within the guidelines provided below. User agents are encouraged to set the a idintroduction-17:appearance hrefhttps://drafts.csswg.org/css-ui-4/#appearance-switching data-x-internalappearance>appearance/a> CSS property appropriately to achieve platform-native appearances for widgets, and are expected to implement any relevant animations, etc, that are appropriate for the platform./p> h4 idthe-button-element-2>span classsecno>14.5.2/span> The code idthe-button-element-2:the-button-element>a href#the-button-element>button/a>/code> elementa href#the-button-element-2 classself-link>/a>/h4> p>The code idthe-button-element-2:the-button-element-2>a href#the-button-element>button/a>/code> element expected to render as an a idthe-button-element-2:inline-block hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box depicting a button whose contents are the contents of the element./p> h4 idthe-details-and-summary-elements>span classsecno>14.5.3/span> The code idthe-details-and-summary-elements:the-details-element>a href#the-details-element>details/a>/code> and code idthe-details-and-summary-elements:the-summary-element>a href#the-summary-element>summary/a>/code> elementsa href#the-details-and-summary-elements classself-link>/a>/h4> pre classcss>@namespace url(http://www.w3.org/1999/xhtml);summary { display: list-item; counter-increment: list-item 0; list-style: disclosure-closed inside;}detailsopen > summary { list-style-type: disclosure-open;}/pre> p>The code idthe-details-and-summary-elements:the-details-element-2>a href#the-details-element>details/a>/code> element is expected to render as a a idthe-details-and-summary-elements:block-box hrefhttps://drafts.csswg.org/css2/visuren.html#x9 data-x-internalblock-box>block box/a>. The elements shadow tree is expected to take the elements first code idthe-details-and-summary-elements:the-summary-element-2>a href#the-summary-element>summary/a>/code> element child, if any, and place it in a first a idthe-details-and-summary-elements:block-box-2 hrefhttps://drafts.csswg.org/css2/visuren.html#x9 data-x-internalblock-box>block box/a> container, and then take the elements remaining descendants, if any, and place them in a second a idthe-details-and-summary-elements:block-box-3 hrefhttps://drafts.csswg.org/css2/visuren.html#x9 data-x-internalblock-box>block box/a> container./p> p>The first container is expected to allow the user to request the details be shown or hidden./p> p>The second container is expected to be removed from the rendering when the code idthe-details-and-summary-elements:the-details-element-3>a href#the-details-element>details/a>/code> element does not have an code idthe-details-and-summary-elements:attr-details-open>a href#attr-details-open>open/a>/code> attribute./p> h4 idthe-input-element-as-a-text-entry-widget>span classsecno>14.5.4/span> The code idthe-input-element-as-a-text-entry-widget:the-input-element>a href#the-input-element>input/a>/code> element as a text entry widgeta href#the-input-element-as-a-text-entry-widget classself-link>/a>/h4>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id24296 titleTreating text inputs as just an inline-block doesnt handle overflow correctly>24296/a>/div> p>An code idthe-input-element-as-a-text-entry-widget:the-input-element-2>a href#the-input-element>input/a>/code> element whose code idthe-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-(typetext)-state-and-search-state-(typesearch) idthe-input-element-as-a-text-entry-widget:text-(typetext)-state-and-search-state-(typesearch)>Text/a>, a href#text-(typetext)-state-and-search-state-(typesearch) idthe-input-element-as-a-text-entry-widget:text-(typetext)-state-and-search-state-(typesearch)-2>Search/a>, a href#telephone-state-(typetel) idthe-input-element-as-a-text-entry-widget:telephone-state-(typetel)>Telephone/a>, a href#url-state-(typeurl) idthe-input-element-as-a-text-entry-widget:url-state-(typeurl)>URL/a>, or a href#e-mail-state-(typeemail) idthe-input-element-as-a-text-entry-widget:e-mail-state-(typeemail)>E-mail/a> state, is expected to render as an a idthe-input-element-as-a-text-entry-widget:inline-block hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box depicting a text control. Additionally, the a idthe-input-element-as-a-text-entry-widget:line-height hrefhttps://drafts.csswg.org/css2/visudet.html#propdef-line-height data-x-internalline-height>line-height/a> property, if it has a a idthe-input-element-as-a-text-entry-widget:computed-value hrefhttps://drafts.csswg.org/css-cascade/#computed-value data-x-internalcomputed-value>computed value/a> equivalent to a value that is less than 1.0, must have a a idthe-input-element-as-a-text-entry-widget:used-value hrefhttps://drafts.csswg.org/css-cascade/#used-value data-x-internalused-value>used value/a> of 1.0./p> p>An code idthe-input-element-as-a-text-entry-widget:the-input-element-3>a href#the-input-element>input/a>/code> element whose code idthe-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-(typepassword) idthe-input-element-as-a-text-entry-widget:password-state-(typepassword)>Password/a> state is expected to render as an a idthe-input-element-as-a-text-entry-widget:inline-block-2 hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box depicting a text control that obscures data entry./p> p>If these text controls provide a text selection, then, when the user changes the current selection, the user agent is expected to a href#queue-a-task idthe-input-element-as-a-text-entry-widget:queue-a-task>queue a task/a>, using the a href#user-interaction-task-source idthe-input-element-as-a-text-entry-widget:user-interaction-task-source>user interaction task source/a>, to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-input-element-as-a-text-entry-widget:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idthe-input-element-as-a-text-entry-widget:event-select>a href#event-select>select/a>/code> at the element, with the code idthe-input-element-as-a-text-entry-widget:dom-event-bubbles>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true./p> p>If an code idthe-input-element-as-a-text-entry-widget:the-input-element-4>a href#the-input-element>input/a>/code> element whose code idthe-input-element-as-a-text-entry-widget:attr-input-type-3>a href#attr-input-type>type/a>/code> attribute is in one of the above states has a code idthe-input-element-as-a-text-entry-widget:attr-input-size>a href#attr-input-size>size/a>/code> attribute, and parsing that attributes value using the a href#rules-for-parsing-non-negative-integers idthe-input-element-as-a-text-entry-widget:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers/a> doesnt generate an error, then the user agent is expected to use the attribute as a a href#presentational-hints idthe-input-element-as-a-text-entry-widget:presentational-hints>presentational hint/a> for the a idthe-input-element-as-a-text-entry-widget:width hrefhttps://drafts.csswg.org/css2/visudet.html#the-width-property data-x-internalwidth>width/a> property on the element, with the value obtained from applying the a href#converting-a-character-width-to-pixels idthe-input-element-as-a-text-entry-widget:converting-a-character-width-to-pixels>converting a character width to pixels/a> algorithm to the value of the attribute./p> p>If an code idthe-input-element-as-a-text-entry-widget:the-input-element-5>a href#the-input-element>input/a>/code> element whose code idthe-input-element-as-a-text-entry-widget:attr-input-type-4>a href#attr-input-type>type/a>/code> attribute is in one of the above states does em>not/em> have a code idthe-input-element-as-a-text-entry-widget:attr-input-size-2>a href#attr-input-size>size/a>/code> attribute, then the user agent is expected to act as if it had a user-agent-level style sheet rule setting the a idthe-input-element-as-a-text-entry-widget:width-2 hrefhttps://drafts.csswg.org/css2/visudet.html#the-width-property data-x-internalwidth>width/a> property on the element to the value obtained from applying the a href#converting-a-character-width-to-pixels idthe-input-element-as-a-text-entry-widget:converting-a-character-width-to-pixels-2>converting a character width to pixels/a> algorithm to the number 20./p> p>The dfn idconverting-a-character-width-to-pixels>converting a character width to pixels/dfn> algorithm returns span>(var>size/var>-1)×var>avg/var> + var>max/var>/span>, where var>size/var> is the character width to convert, var>avg/var> is the average character width of the primary font for the element for which the algorithm is being run, in pixels, and var>max/var> is the maximum character width of that same font, also in pixels. (The elements a idthe-input-element-as-a-text-entry-widget:letter-spacing hrefhttps://drafts.csswg.org/css-text/#letter-spacing-property data-x-internalletter-spacing>letter-spacing/a> property does not affect the result.)/p> h4 idthe-input-element-as-domain-specific-widgets>span classsecno>14.5.5/span> The code idthe-input-element-as-domain-specific-widgets:the-input-element>a href#the-input-element>input/a>/code> element as domain-specific widgetsa href#the-input-element-as-domain-specific-widgets classself-link>/a>/h4> p>An code idthe-input-element-as-domain-specific-widgets:the-input-element-2>a href#the-input-element>input/a>/code> element whose code idthe-input-element-as-domain-specific-widgets:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#date-state-(typedate) idthe-input-element-as-domain-specific-widgets:date-state-(typedate)>Date/a> state is expected to render as an a idthe-input-element-as-domain-specific-widgets:inline-block hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box depicting a date control./p> p>An code idthe-input-element-as-domain-specific-widgets:the-input-element-3>a href#the-input-element>input/a>/code> element whose code idthe-input-element-as-domain-specific-widgets:attr-input-type-2>a href#attr-input-type>type/a>/code> attribute is in the a href#month-state-(typemonth) idthe-input-element-as-domain-specific-widgets:month-state-(typemonth)>Month/a> state is expected to render as an a idthe-input-element-as-domain-specific-widgets:inline-block-2 hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box depicting a month control./p> p>An code idthe-input-element-as-domain-specific-widgets:the-input-element-4>a href#the-input-element>input/a>/code> element whose code idthe-input-element-as-domain-specific-widgets:attr-input-type-3>a href#attr-input-type>type/a>/code> attribute is in the a href#week-state-(typeweek) idthe-input-element-as-domain-specific-widgets:week-state-(typeweek)>Week/a> state is expected to render as an a idthe-input-element-as-domain-specific-widgets:inline-block-3 hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box depicting a week control./p> p>An code idthe-input-element-as-domain-specific-widgets:the-input-element-5>a href#the-input-element>input/a>/code> element whose code idthe-input-element-as-domain-specific-widgets:attr-input-type-4>a href#attr-input-type>type/a>/code> attribute is in the a href#time-state-(typetime) idthe-input-element-as-domain-specific-widgets:time-state-(typetime)>Time/a> state is expected to render as an a idthe-input-element-as-domain-specific-widgets:inline-block-4 hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box depicting a time control./p> p>An code idthe-input-element-as-domain-specific-widgets:the-input-element-6>a href#the-input-element>input/a>/code> element whose code idthe-input-element-as-domain-specific-widgets:attr-input-type-5>a href#attr-input-type>type/a>/code> attribute is in the a href#local-date-and-time-state-(typedatetime-local) idthe-input-element-as-domain-specific-widgets:local-date-and-time-state-(typedatetime-local)>Local Date and Time/a> state is expected to render as an a idthe-input-element-as-domain-specific-widgets:inline-block-5 hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box depicting a local date and time control./p> p>An code idthe-input-element-as-domain-specific-widgets:the-input-element-7>a href#the-input-element>input/a>/code> element whose code idthe-input-element-as-domain-specific-widgets:attr-input-type-6>a href#attr-input-type>type/a>/code> attribute is in the a href#number-state-(typenumber) idthe-input-element-as-domain-specific-widgets:number-state-(typenumber)>Number/a> state is expected to render as an a idthe-input-element-as-domain-specific-widgets:inline-block-6 hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box depicting a number control./p> p>These controls are all expected to be about one line high, and about as wide as necessary to show the widest possible value./p> h4 idthe-input-element-as-a-range-control>span classsecno>14.5.6/span> The code idthe-input-element-as-a-range-control:the-input-element>a href#the-input-element>input/a>/code> element as a range controla href#the-input-element-as-a-range-control classself-link>/a>/h4> p>An code idthe-input-element-as-a-range-control:the-input-element-2>a href#the-input-element>input/a>/code> element whose code idthe-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-(typerange) idthe-input-element-as-a-range-control:range-state-(typerange)>Range/a> state is expected to render as an a idthe-input-element-as-a-range-control:inline-block hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box depicting a slider control./p> p>When the control is wider than it is tall (or square), the control is expected to be a horizontal slider, with the lowest value on the right if the a idthe-input-element-as-a-range-control:direction hrefhttps://drafts.csswg.org/css-writing-modes/#direction data-x-internaldirection>direction/a> property on this element has a a idthe-input-element-as-a-range-control:computed-value hrefhttps://drafts.csswg.org/css-cascade/#computed-value data-x-internalcomputed-value>computed value/a> of rtl, and on the left otherwise. When the control is taller than it is wide, it is expected to be a vertical slider, with the lowest value on the bottom./p> p>Predefined suggested values (provided by the code idthe-input-element-as-a-range-control:attr-input-list>a href#attr-input-list>list/a>/code> attribute) are expected to be shown as tick marks on the slider, which the slider can snap to./p> p>User agents are expected to use the a idthe-input-element-as-a-range-control:used-value hrefhttps://drafts.csswg.org/css-cascade/#used-value data-x-internalused-value>used value/a> of the a idthe-input-element-as-a-range-control:direction-2 hrefhttps://drafts.csswg.org/css-writing-modes/#direction data-x-internaldirection>direction/a> property on the element to determine the direction in which the slider operates. Typically, a left-to-right (ltr) horizontal control would have the lowest value on the left and the highest value on the right, and vice versa./p> h4 idthe-input-element-as-a-colour-well>span classsecno>14.5.7/span> The code idthe-input-element-as-a-colour-well:the-input-element>a href#the-input-element>input/a>/code> element as a color wella href#the-input-element-as-a-colour-well classself-link>/a>/h4> p>An code idthe-input-element-as-a-colour-well:the-input-element-2>a href#the-input-element>input/a>/code> element whose code idthe-input-element-as-a-colour-well:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#color-state-(typecolor) idthe-input-element-as-a-colour-well:color-state-(typecolor)>Color/a> state is expected to render as an a idthe-input-element-as-a-colour-well:inline-block hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box depicting a color well, which, when activated, provides the user with a color picker (e.g. a color wheel or color palette) from which the color can be changed./p> p>Predefined suggested values (provided by the code idthe-input-element-as-a-colour-well:attr-input-list>a href#attr-input-list>list/a>/code> attribute) are expected to be shown in the color picker interface, not on the color well itself./p> h4 idthe-input-element-as-a-checkbox-and-radio-button-widgets>span classsecno>14.5.8/span> The code idthe-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 widgetsa href#the-input-element-as-a-checkbox-and-radio-button-widgets classself-link>/a>/h4> p>An code idthe-input-element-as-a-checkbox-and-radio-button-widgets:the-input-element-2>a href#the-input-element>input/a>/code> element whose code idthe-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-(typecheckbox) idthe-input-element-as-a-checkbox-and-radio-button-widgets:checkbox-state-(typecheckbox)>Checkbox/a> state is expected to render as an a idthe-input-element-as-a-checkbox-and-radio-button-widgets:inline-block hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box containing a single checkbox control, with no label./p> p>An code idthe-input-element-as-a-checkbox-and-radio-button-widgets:the-input-element-3>a href#the-input-element>input/a>/code> element whose code idthe-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-(typeradio) idthe-input-element-as-a-checkbox-and-radio-button-widgets:radio-button-state-(typeradio)>Radio Button/a> state is expected to render as an a idthe-input-element-as-a-checkbox-and-radio-button-widgets:inline-block-2 hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box containing a single radio button control, with no label./p> h4 idthe-input-element-as-a-file-upload-control>span classsecno>14.5.9/span> The code idthe-input-element-as-a-file-upload-control:the-input-element>a href#the-input-element>input/a>/code> element as a file upload controla href#the-input-element-as-a-file-upload-control classself-link>/a>/h4> p>An code idthe-input-element-as-a-file-upload-control:the-input-element-2>a href#the-input-element>input/a>/code> element whose code idthe-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-(typefile) idthe-input-element-as-a-file-upload-control:file-upload-state-(typefile)>File Upload/a> state is expected to render as an a idthe-input-element-as-a-file-upload-control:inline-block hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box containing a span of text giving the file name(s) of the a href#concept-input-type-file-selected idthe-input-element-as-a-file-upload-control:concept-input-type-file-selected>selected files/a>, if any, followed by a button that, when activated, provides the user with a file picker from which the selection can be changed./p> h4 idthe-input-element-as-a-button>span classsecno>14.5.10/span> The code idthe-input-element-as-a-button:the-input-element>a href#the-input-element>input/a>/code> element as a buttona href#the-input-element-as-a-button classself-link>/a>/h4> p>An code idthe-input-element-as-a-button:the-input-element-2>a href#the-input-element>input/a>/code> element whose code idthe-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-(typesubmit) idthe-input-element-as-a-button:submit-button-state-(typesubmit)>Submit Button/a>, a href#reset-button-state-(typereset) idthe-input-element-as-a-button:reset-button-state-(typereset)>Reset Button/a>, or a href#button-state-(typebutton) idthe-input-element-as-a-button:button-state-(typebutton)>Button/a> state is expected to render as an a idthe-input-element-as-a-button:inline-block hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box depicting a button, about one line high, containing the contents of the elements code idthe-input-element-as-a-button:attr-input-value>a href#attr-input-value>value/a>/code> attribute, if any, or text derived from the elements code idthe-input-element-as-a-button:attr-input-type-2>a href#attr-input-type>type/a>/code> attribute in a user-agent-defined (and probably locale-specific) fashion, if not./p> h4 idthe-marquee-element-2>span classsecno>14.5.11/span> The code idthe-marquee-element-2:the-marquee-element>a href#the-marquee-element>marquee/a>/code> elementa href#the-marquee-element-2 classself-link>/a>/h4> p>The code idthe-marquee-element-2:the-marquee-element-2>a href#the-marquee-element>marquee/a>/code> element, while a href#concept-marquee-on idthe-marquee-element-2:concept-marquee-on>turned on/a>, is expected to render in an animated fashion according to its attributes as follows:/p> dl>dt>If the elements code idthe-marquee-element-2:attr-marquee-behavior>a href#attr-marquee-behavior>behavior/a>/code> attribute is in the a href#attr-marquee-behavior-scroll idthe-marquee-element-2:attr-marquee-behavior-scroll>scroll/a> statedd> p>Slide the contents of the element in the direction described by the code idthe-marquee-element-2:attr-marquee-direction>a href#attr-marquee-direction>direction/a>/code> attribute as defined below, such that it begins off the start side of the code idthe-marquee-element-2:the-marquee-element-3>a href#the-marquee-element>marquee/a>/code>, and ends flush with the inner end side./p> p classexample>For example, if the code idthe-marquee-element-2:attr-marquee-direction-2>a href#attr-marquee-direction>direction/a>/code> attribute is a href#attr-marquee-direction-left idthe-marquee-element-2:attr-marquee-direction-left>left/a> (the default), then the contents would start such that their left edge are off the side of the right edge of the code idthe-marquee-element-2:the-marquee-element-4>a href#the-marquee-element>marquee/a>/code>s a idthe-marquee-element-2:content-area hrefhttps://drafts.csswg.org/css2/box.html#box-content-area data-x-internalcontent-area>content area/a>, and the contents would then slide up to the point where the left edge of the contents are flush with the left inner edge of the code idthe-marquee-element-2:the-marquee-element-5>a href#the-marquee-element>marquee/a>/code>s a idthe-marquee-element-2:content-area-2 hrefhttps://drafts.csswg.org/css2/box.html#box-content-area data-x-internalcontent-area>content area/a>./p> p>Once the animation has ended, the user agent is expected to a href#increment-the-marquee-current-loop-index idthe-marquee-element-2:increment-the-marquee-current-loop-index>increment the marquee current loop index/a>. If the element is still a href#concept-marquee-on idthe-marquee-element-2:concept-marquee-on-2>turned on/a> after this, then the user agent is expected to restart the animation./p> dt>If the elements code idthe-marquee-element-2:attr-marquee-behavior-2>a href#attr-marquee-behavior>behavior/a>/code> attribute is in the a href#attr-marquee-behavior-slide idthe-marquee-element-2:attr-marquee-behavior-slide>slide/a> statedd> p>Slide the contents of the element in the direction described by the code idthe-marquee-element-2:attr-marquee-direction-3>a href#attr-marquee-direction>direction/a>/code> attribute as defined below, such that it begins off the start side of the code idthe-marquee-element-2:the-marquee-element-6>a href#the-marquee-element>marquee/a>/code>, and ends off the end side of the code idthe-marquee-element-2:the-marquee-element-7>a href#the-marquee-element>marquee/a>/code>./p> p classexample>For example, if the code idthe-marquee-element-2:attr-marquee-direction-4>a href#attr-marquee-direction>direction/a>/code> attribute is a href#attr-marquee-direction-left idthe-marquee-element-2:attr-marquee-direction-left-2>left/a> (the default), then the contents would start such that their left edge are off the side of the right edge of the code idthe-marquee-element-2:the-marquee-element-8>a href#the-marquee-element>marquee/a>/code>s a idthe-marquee-element-2:content-area-3 hrefhttps://drafts.csswg.org/css2/box.html#box-content-area data-x-internalcontent-area>content area/a>, and the contents would then slide up to the point where the em>right/em> edge of the contents are flush with the left inner edge of the code idthe-marquee-element-2:the-marquee-element-9>a href#the-marquee-element>marquee/a>/code>s a idthe-marquee-element-2:content-area-4 hrefhttps://drafts.csswg.org/css2/box.html#box-content-area data-x-internalcontent-area>content area/a>./p> p>Once the animation has ended, the user agent is expected to a href#increment-the-marquee-current-loop-index idthe-marquee-element-2:increment-the-marquee-current-loop-index-2>increment the marquee current loop index/a>. If the element is still a href#concept-marquee-on idthe-marquee-element-2:concept-marquee-on-3>turned on/a> after this, then the user agent is expected to restart the animation./p> dt>If the elements code idthe-marquee-element-2:attr-marquee-behavior-3>a href#attr-marquee-behavior>behavior/a>/code> attribute is in the a href#attr-marquee-behavior-alternate idthe-marquee-element-2:attr-marquee-behavior-alternate>alternate/a> statedd> p>When the a href#marquee-current-loop-index idthe-marquee-element-2:marquee-current-loop-index>marquee current loop index/a> is even (or zero), slide the contents of the element in the direction described by the code idthe-marquee-element-2:attr-marquee-direction-5>a href#attr-marquee-direction>direction/a>/code> attribute as defined below, such that it begins flush with the start side of the code idthe-marquee-element-2:the-marquee-element-10>a href#the-marquee-element>marquee/a>/code>, and ends flush with the end side of the code idthe-marquee-element-2:the-marquee-element-11>a href#the-marquee-element>marquee/a>/code>./p> p>When the a href#marquee-current-loop-index idthe-marquee-element-2:marquee-current-loop-index-2>marquee current loop index/a> is odd, slide the contents of the element in the opposite direction than that described by the code idthe-marquee-element-2:attr-marquee-direction-6>a href#attr-marquee-direction>direction/a>/code> attribute as defined below, such that it begins flush with the end side of the code idthe-marquee-element-2:the-marquee-element-12>a href#the-marquee-element>marquee/a>/code>, and ends flush with the start side of the code idthe-marquee-element-2:the-marquee-element-13>a href#the-marquee-element>marquee/a>/code>./p> p classexample>For example, if the code idthe-marquee-element-2:attr-marquee-direction-7>a href#attr-marquee-direction>direction/a>/code> attribute is a href#attr-marquee-direction-left idthe-marquee-element-2:attr-marquee-direction-left-3>left/a> (the default), then the contents would with their right edge flush with the right inner edge of the code idthe-marquee-element-2:the-marquee-element-14>a href#the-marquee-element>marquee/a>/code>s a idthe-marquee-element-2:content-area-5 hrefhttps://drafts.csswg.org/css2/box.html#box-content-area data-x-internalcontent-area>content area/a>, and the contents would then slide up to the point where the em>left/em> edge of the contents are flush with the left inner edge of the code idthe-marquee-element-2:the-marquee-element-15>a href#the-marquee-element>marquee/a>/code>s a idthe-marquee-element-2:content-area-6 hrefhttps://drafts.csswg.org/css2/box.html#box-content-area data-x-internalcontent-area>content area/a>./p> p>Once the animation has ended, the user agent is expected to a href#increment-the-marquee-current-loop-index idthe-marquee-element-2:increment-the-marquee-current-loop-index-3>increment the marquee current loop index/a>. If the element is still a href#concept-marquee-on idthe-marquee-element-2:concept-marquee-on-4>turned on/a> after this, then the user agent is expected to continue the animation./p> /dl> p>The code idthe-marquee-element-2:attr-marquee-direction-8>a href#attr-marquee-direction>direction/a>/code> attribute has the meanings described in the following table:/p> table>thead>tr>th>code idthe-marquee-element-2:attr-marquee-direction-9>a href#attr-marquee-direction>direction/a>/code> attribute state th>Direction of animation th>Start edge th>End edge th>Opposite direction tbody>tr>td>a href#attr-marquee-direction-left idthe-marquee-element-2:attr-marquee-direction-left-4>left/a> td>← Right to left td>Right td>Left td>→ Left to Right tr>td>a href#attr-marquee-direction-right idthe-marquee-element-2:attr-marquee-direction-right>right/a> td>→ Left to Right td>Left td>Right td>← Right to left tr>td>a href#attr-marquee-direction-up idthe-marquee-element-2:attr-marquee-direction-up>up/a> td>↑ Up (Bottom to Top) td>Bottom td>Top td>↓ Down (Top to Bottom) tr>td>a href#attr-marquee-direction-down idthe-marquee-element-2:attr-marquee-direction-down>down/a> td>↓ Down (Top to Bottom) td>Top td>Bottom td>↑ Up (Bottom to Top) /table> p>In any case, the animation should proceed such that there is a delay given by the a href#marquee-scroll-interval idthe-marquee-element-2:marquee-scroll-interval>marquee scroll interval/a> between each frame, and such that the content moves at most the distance given by the a href#marquee-scroll-distance idthe-marquee-element-2:marquee-scroll-distance>marquee scroll distance/a> with each frame./p> p>When a code idthe-marquee-element-2:the-marquee-element-16>a href#the-marquee-element>marquee/a>/code> element has a code>bgcolor/code> attribute set, the value is expected to be parsed using the a href#rules-for-parsing-a-legacy-colour-value idthe-marquee-element-2:rules-for-parsing-a-legacy-colour-value>rules for parsing a legacy color value/a>, and if that does not return an error, the user agent is expected to treat the attribute as a a href#presentational-hints idthe-marquee-element-2:presentational-hints>presentational hint/a> setting the elements a idthe-marquee-element-2:background-color hrefhttps://drafts.csswg.org/css-backgrounds/#the-background-color data-x-internalbackground-color>background-color/a> property to the resulting color./p> p>The code>width/code> and code>height/code> attributes on a code idthe-marquee-element-2:the-marquee-element-17>a href#the-marquee-element>marquee/a>/code> element a href#maps-to-the-dimension-property idthe-marquee-element-2:maps-to-the-dimension-property>map to the dimension properties/a> a idthe-marquee-element-2:width hrefhttps://drafts.csswg.org/css2/visudet.html#the-width-property data-x-internalwidth>width/a> and a idthe-marquee-element-2:height hrefhttps://drafts.csswg.org/css2/visudet.html#the-height-property data-x-internalheight>height/a> on the element respectively./p> p>The a href#intrinsic-height idthe-marquee-element-2:intrinsic-height>intrinsic height/a> of a code idthe-marquee-element-2:the-marquee-element-18>a href#the-marquee-element>marquee/a>/code> element with its code idthe-marquee-element-2:attr-marquee-direction-10>a href#attr-marquee-direction>direction/a>/code> attribute in the a href#attr-marquee-direction-up idthe-marquee-element-2:attr-marquee-direction-up-2>up/a> or a href#attr-marquee-direction-down idthe-marquee-element-2:attr-marquee-direction-down-2>down/a> states is 200 a hrefhttps://drafts.csswg.org/css-values/#px idthe-marquee-element-2:px data-x-internalpx>CSS pixels/a>./p> p>The code>vspace/code> attribute of a code idthe-marquee-element-2:the-marquee-element-19>a href#the-marquee-element>marquee/a>/code> element a href#maps-to-the-dimension-property idthe-marquee-element-2:maps-to-the-dimension-property-2>maps to the dimension properties/a> a idthe-marquee-element-2:margin-top hrefhttps://drafts.csswg.org/css2/box.html#propdef-margin-top data-x-internalmargin-top>margin-top/a> and a idthe-marquee-element-2:margin-bottom hrefhttps://drafts.csswg.org/css2/box.html#propdef-margin-bottom data-x-internalmargin-bottom>margin-bottom/a> on the element. The code>hspace/code> attribute of a code idthe-marquee-element-2:the-marquee-element-20>a href#the-marquee-element>marquee/a>/code> element a href#maps-to-the-dimension-property idthe-marquee-element-2:maps-to-the-dimension-property-3>maps to the dimension properties/a> a idthe-marquee-element-2:margin-left hrefhttps://drafts.csswg.org/css2/box.html#propdef-margin-left data-x-internalmargin-left>margin-left/a> and a idthe-marquee-element-2:margin-right hrefhttps://drafts.csswg.org/css2/box.html#propdef-margin-right data-x-internalmargin-right>margin-right/a> on the element./p> p>The a idthe-marquee-element-2:overflow hrefhttps://drafts.csswg.org/css-overflow-3/#propdef-overflow data-x-internaloverflow>overflow/a> property on the code idthe-marquee-element-2:the-marquee-element-21>a href#the-marquee-element>marquee/a>/code> element is expected to be ignored; overflow is expected to always be hidden./p> h4 idthe-meter-element-2>span classsecno>14.5.12/span> The code idthe-meter-element-2:the-meter-element>a href#the-meter-element>meter/a>/code> elementa href#the-meter-element-2 classself-link>/a>/h4> p>The code idthe-meter-element-2:the-meter-element-2>a href#the-meter-element>meter/a>/code> element is expected to render as an a idthe-meter-element-2:inline-block hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box with a a idthe-meter-element-2:height hrefhttps://drafts.csswg.org/css2/visudet.html#the-height-property data-x-internalheight>height/a> of 1em and a a idthe-meter-element-2:width hrefhttps://drafts.csswg.org/css2/visudet.html#the-width-property data-x-internalwidth>width/a> of 5em, a a idthe-meter-element-2:vertical-align hrefhttps://drafts.csswg.org/css2/visudet.html#propdef-vertical-align data-x-internalvertical-align>vertical-align/a> of -0.2em, and with its contents depicting a gauge./p> p>When the element is wider than it is tall (or square), the depiction is expected to be of a horizontal gauge, with the minimum value on the right if the a idthe-meter-element-2:direction hrefhttps://drafts.csswg.org/css-writing-modes/#direction data-x-internaldirection>direction/a> property on this element has a a idthe-meter-element-2:computed-value hrefhttps://drafts.csswg.org/css-cascade/#computed-value data-x-internalcomputed-value>computed value/a> of rtl, and on the left otherwise. When the element is taller than it is wide, it is expected to depict a vertical gauge, with the minimum value on the bottom./p> p>User agents are expected to use a presentation consistent with platform conventions for gauges, if any./p> p classnote>Requirements for what must be depicted in the gauge are included in the definition of the code idthe-meter-element-2:the-meter-element-3>a href#the-meter-element>meter/a>/code> element./p> h4 idthe-progress-element-2>span classsecno>14.5.13/span> The code idthe-progress-element-2:the-progress-element>a href#the-progress-element>progress/a>/code> elementa href#the-progress-element-2 classself-link>/a>/h4> p>The code idthe-progress-element-2:the-progress-element-2>a href#the-progress-element>progress/a>/code> element is expected to render as an a idthe-progress-element-2:inline-block hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box with a a idthe-progress-element-2:height hrefhttps://drafts.csswg.org/css2/visudet.html#the-height-property data-x-internalheight>height/a> of 1em and a a idthe-progress-element-2:width hrefhttps://drafts.csswg.org/css2/visudet.html#the-width-property data-x-internalwidth>width/a> of 10em, and a a idthe-progress-element-2:vertical-align hrefhttps://drafts.csswg.org/css2/visudet.html#propdef-vertical-align data-x-internalvertical-align>vertical-align/a> of -0.2em./p> p> img classextra width157 src/images/sample-progress.png height103 alt> When the element is wider than it is tall, the element is expected to be depicted as a horizontal progress bar, with the start on the right and the end on the left if the a idthe-progress-element-2:direction hrefhttps://drafts.csswg.org/css-writing-modes/#direction data-x-internaldirection>direction/a> property on this element has a a idthe-progress-element-2:computed-value hrefhttps://drafts.csswg.org/css-cascade/#computed-value data-x-internalcomputed-value>computed value/a> of rtl, and with the start on the left and the end on the right otherwise. When the element is taller than it is wide, it is expected to be depicted as a vertical progress bar, with the lowest value on the bottom. When the element is square, it is expected to be depicted as a direction-independent progress widget (e.g. a circular progress ring)./p> p>User agents are expected to use a presentation consistent with platform conventions for progress bars. In particular, user agents are expected to use different presentations for determinate and indeterminate progress bars. User agents are also expected to vary the presentation based on the dimensions of the element./p> p classexample>For example, on some platforms for showing indeterminate progress there is a spinner progress indicator with square dimensions, which could be used when the element is square, and an indeterminate progress bar, which could be used when the element is wide./p> p classnote>Requirements for how to determine if the progress bar is determinate or indeterminate, and what progress a determinate progress bar is to show, are included in the definition of the code idthe-progress-element-2:the-progress-element-3>a href#the-progress-element>progress/a>/code> element./p> h4 idthe-select-element-2>span classsecno>14.5.14/span> The code idthe-select-element-2:the-select-element>a href#the-select-element>select/a>/code> elementa href#the-select-element-2 classself-link>/a>/h4> p>A code idthe-select-element-2:the-select-element-2>a href#the-select-element>select/a>/code> element whose code idthe-select-element-2:attr-select-multiple>a href#attr-select-multiple>multiple/a>/code> attribute is present is expected to render as a multi-select list box./p> p>A code idthe-select-element-2:the-select-element-3>a href#the-select-element>select/a>/code> element whose code idthe-select-element-2:attr-select-multiple-2>a href#attr-select-multiple>multiple/a>/code> attribute is absent, and whose a href#concept-select-size idthe-select-element-2:concept-select-size>display size/a> is greater than 1, is expected to render as a single-select list box./p> p>When the element renders as a list box, it is expected to render as an a idthe-select-element-2:inline-block hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box whose a idthe-select-element-2:height hrefhttps://drafts.csswg.org/css2/visudet.html#the-height-property data-x-internalheight>height/a> is the height necessary to contain as many rows for items as given by the elements a href#concept-select-size idthe-select-element-2:concept-select-size-2>display size/a>, or four rows if the attribute is absent, and whose a idthe-select-element-2:width hrefhttps://drafts.csswg.org/css2/visudet.html#the-width-property data-x-internalwidth>width/a> is the a href#width-of-the-selects-labels idthe-select-element-2:width-of-the-selects-labels>width of the code>select/code>s labels/a> plus the width of a scrollbar./p> p>A code idthe-select-element-2:the-select-element-4>a href#the-select-element>select/a>/code> element whose code idthe-select-element-2:attr-select-multiple-3>a href#attr-select-multiple>multiple/a>/code> attribute is absent, and whose a href#concept-select-size idthe-select-element-2:concept-select-size-3>display size/a> is 1, is expected to render as a one-line drop down box whose width is the a href#width-of-the-selects-labels idthe-select-element-2:width-of-the-selects-labels-2>width of the code>select/code>s labels/a>./p> p>In either case (list box or drop-down box), the elements items are expected to be the elements a href#concept-select-option-list idthe-select-element-2:concept-select-option-list>list of options/a>, with the elements code idthe-select-element-2:the-optgroup-element>a href#the-optgroup-element>optgroup/a>/code> element a hrefhttps://dom.spec.whatwg.org/#concept-tree-child idthe-select-element-2:concept-tree-child data-x-internalconcept-tree-child>children/a> providing headers for groups of options where applicable./p> p>An code idthe-select-element-2:the-optgroup-element-2>a href#the-optgroup-element>optgroup/a>/code> element is expected to be rendered by displaying the elements code idthe-select-element-2:attr-optgroup-label>a href#attr-optgroup-label>label/a>/code> attribute./p> p>An code idthe-select-element-2:the-option-element>a href#the-option-element>option/a>/code> element is expected to be rendered by displaying the elements a href#concept-option-label idthe-select-element-2:concept-option-label>label/a>, indented under its code idthe-select-element-2:the-optgroup-element-3>a href#the-optgroup-element>optgroup/a>/code> element if it has one./p> p>The dfn idwidth-of-the-selects-labels>width of the code>select/code>s labels/dfn> is the wider of the width necessary to render the widest code idthe-select-element-2:the-optgroup-element-4>a href#the-optgroup-element>optgroup/a>/code>, and the width necessary to render the widest code idthe-select-element-2:the-option-element-2>a href#the-option-element>option/a>/code> element in the elements a href#concept-select-option-list idthe-select-element-2:concept-select-option-list-2>list of options/a> (including its indent, if any)./p> p>If a code idthe-select-element-2:the-select-element-5>a href#the-select-element>select/a>/code> element contains a a href#placeholder-label-option idthe-select-element-2:placeholder-label-option>placeholder label option/a>, the user agent is expected to render that code idthe-select-element-2:the-option-element-3>a href#the-option-element>option/a>/code> in a manner that conveys that it is a label, rather than a valid option of the control. This can include preventing the a href#placeholder-label-option idthe-select-element-2:placeholder-label-option-2>placeholder label option/a> from being explicitly selected by the user. When the a href#placeholder-label-option idthe-select-element-2:placeholder-label-option-3>placeholder label option/a>s a href#concept-option-selectedness idthe-select-element-2:concept-option-selectedness>selectedness/a> is true, the control is expected to be displayed in a fashion that indicates that no valid option is currently selected./p> p>User agents are expected to render the labels in a code idthe-select-element-2:the-select-element-6>a href#the-select-element>select/a>/code> in such a manner that any alignment remains consistent whether the label is being displayed as part of the page or in a menu control./p> h4 idthe-textarea-element-2>span classsecno>14.5.15/span> The code idthe-textarea-element-2:the-textarea-element>a href#the-textarea-element>textarea/a>/code> elementa href#the-textarea-element-2 classself-link>/a>/h4> p>The code idthe-textarea-element-2:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code> element is expected to render as an a idthe-textarea-element-2:inline-block hrefhttps://drafts.csswg.org/css2/visuren.html#value-def-inline-block data-x-internalinline-block>inline-block/a> box depicting a multiline text control. If this multiline text control provides a selection, then, when the user changes the current selection, the user agent is expected to a href#queue-a-task idthe-textarea-element-2:queue-a-task>queue a task/a>, using the a href#user-interaction-task-source idthe-textarea-element-2:user-interaction-task-source>user interaction task source/a>, to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-textarea-element-2:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idthe-textarea-element-2:event-select>a href#event-select>select/a>/code> at the element, with the code idthe-textarea-element-2:dom-event-bubbles>a data-x-internaldom-event-bubbles hrefhttps://dom.spec.whatwg.org/#dom-event-bubbles>bubbles/a>/code> attribute initialized to true./p> p>If the element has a code idthe-textarea-element-2:attr-textarea-cols>a href#attr-textarea-cols>cols/a>/code> attribute, and parsing that attributes value using the a href#rules-for-parsing-non-negative-integers idthe-textarea-element-2:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers/a> doesnt generate an error, then the user agent is expected to use the attribute as a a href#presentational-hints idthe-textarea-element-2:presentational-hints>presentational hint/a> for the a idthe-textarea-element-2:width hrefhttps://drafts.csswg.org/css2/visudet.html#the-width-property data-x-internalwidth>width/a> property on the element, with the value being the a href#textarea-effective-width idthe-textarea-element-2:textarea-effective-width>textarea effective width/a> (as defined below). Otherwise, the user agent is expected to act as if it had a user-agent-level style sheet rule setting the a idthe-textarea-element-2:width-2 hrefhttps://drafts.csswg.org/css2/visudet.html#the-width-property data-x-internalwidth>width/a> property on the element to the a href#textarea-effective-width idthe-textarea-element-2:textarea-effective-width-2>textarea effective width/a>./p> p>The dfn idtextarea-effective-width>textarea effective width/dfn> of a code idthe-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 elements a href#attr-textarea-cols-value idthe-textarea-element-2:attr-textarea-cols-value>character width/a>, var>avg/var> is the average character width of the primary font of the element, in a hrefhttps://drafts.csswg.org/css-values/#px idthe-textarea-element-2:px data-x-internalpx>CSS pixels/a>, and var>sbw/var> is the width of a scroll bar, in a hrefhttps://drafts.csswg.org/css-values/#px idthe-textarea-element-2:px-2 data-x-internalpx>CSS pixels/a>. (The elements a idthe-textarea-element-2:letter-spacing hrefhttps://drafts.csswg.org/css-text/#letter-spacing-property data-x-internalletter-spacing>letter-spacing/a> property does not affect the result.)/p> p>If the element has a code idthe-textarea-element-2:attr-textarea-rows>a href#attr-textarea-rows>rows/a>/code> attribute, and parsing that attributes value using the a href#rules-for-parsing-non-negative-integers idthe-textarea-element-2:rules-for-parsing-non-negative-integers-2>rules for parsing non-negative integers/a> doesnt generate an error, then the user agent is expected to use the attribute as a a href#presentational-hints idthe-textarea-element-2:presentational-hints-2>presentational hint/a> for the a idthe-textarea-element-2:height hrefhttps://drafts.csswg.org/css2/visudet.html#the-height-property data-x-internalheight>height/a> property on the element, with the value being the a href#textarea-effective-height idthe-textarea-element-2:textarea-effective-height>textarea effective height/a> (as defined below). Otherwise, the user agent is expected to act as if it had a user-agent-level style sheet rule setting the a idthe-textarea-element-2:height-2 hrefhttps://drafts.csswg.org/css2/visudet.html#the-height-property data-x-internalheight>height/a> property on the element to the a href#textarea-effective-height idthe-textarea-element-2:textarea-effective-height-2>textarea effective height/a>./p> p>The dfn idtextarea-effective-height>textarea effective height/dfn> of a code idthe-textarea-element-2:the-textarea-element-4>a href#the-textarea-element>textarea/a>/code> element is the height in a hrefhttps://drafts.csswg.org/css-values/#px idthe-textarea-element-2:px-3 data-x-internalpx>CSS pixels/a> of the number of lines specified the elements a href#attr-textarea-rows-value idthe-textarea-element-2:attr-textarea-rows-value>character height/a>, plus the height of a scrollbar in a hrefhttps://drafts.csswg.org/css-values/#px idthe-textarea-element-2:px-4 data-x-internalpx>CSS pixels/a>./p> p>User agents are expected to apply the a idthe-textarea-element-2:white-space hrefhttps://drafts.csswg.org/css-text/#white-space-property data-x-internalwhite-space>white-space/a> CSS property to code idthe-textarea-element-2:the-textarea-element-5>a href#the-textarea-element>textarea/a>/code> elements. For historical reasons, if the element has a code idthe-textarea-element-2:attr-textarea-wrap>a href#attr-textarea-wrap>wrap/a>/code> attribute whose value is an a idthe-textarea-element-2:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>off/code>, then the user agent is expected to treat the attribute as a a href#presentational-hints idthe-textarea-element-2:presentational-hints-3>presentational hint/a> setting the elements a idthe-textarea-element-2:white-space-2 hrefhttps://drafts.csswg.org/css-text/#white-space-property data-x-internalwhite-space>white-space/a> property to pre./p> h3 idframes-and-framesets>span classsecno>14.6/span> Frames and framesetsa href#frames-and-framesets classself-link>/a>/h3> p>User agent are expected to render code idframes-and-framesets:frameset>a href#frameset>frameset/a>/code> elements as a box with the height and width of the a idframes-and-framesets:viewport hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>, with a surface rendered according to the following layout algorithm:/p> ol>li> p>The var>cols/var> and var>rows/var> variables are lists of zero or more pairs consisting of a number and a unit, the unit being one of i>percentage/i>, i>relative/i>, and i>absolute/i>./p> p>Use the a href#rules-for-parsing-a-list-of-dimensions idframes-and-framesets:rules-for-parsing-a-list-of-dimensions>rules for parsing a list of dimensions/a> to parse the value of the elements code>cols/code> attribute, if there is one. Let var>cols/var> be the result, or an empty list if there is no such attribute./p> p>Use the a href#rules-for-parsing-a-list-of-dimensions idframes-and-framesets:rules-for-parsing-a-list-of-dimensions-2>rules for parsing a list of dimensions/a> to parse the value of the elements code>rows/code> attribute, if there is one. Let var>rows/var> be the result, or an empty list if there is no such attribute./p> li> p>For any of the entries in var>cols/var> or var>rows/var> that have the number zero and the unit i>relative/i>, change the entrys number to one./p> li> p>If var>cols/var> has no entries, then add a single entry consisting of the value 1 and the unit i>relative/i> to var>cols/var>./p> p>If var>rows/var> has no entries, then add a single entry consisting of the value 1 and the unit i>relative/i> to var>rows/var>./p> li> p>Invoke the algorithm defined below to a href#convert-a-list-of-dimensions-to-a-list-of-pixel-values idframes-and-framesets:convert-a-list-of-dimensions-to-a-list-of-pixel-values>convert a list of dimensions to a list of pixel values/a> using var>cols/var> as the input list, and the width of the surface that the code idframes-and-framesets:frameset-2>a href#frameset>frameset/a>/code> is being rendered into, in a hrefhttps://drafts.csswg.org/css-values/#px idframes-and-framesets:px data-x-internalpx>CSS pixels/a>, as the input dimension. Let var>sized cols/var> be the resulting list./p> p>Invoke the algorithm defined below to a href#convert-a-list-of-dimensions-to-a-list-of-pixel-values idframes-and-framesets:convert-a-list-of-dimensions-to-a-list-of-pixel-values-2>convert a list of dimensions to a list of pixel values/a> using var>rows/var> as the input list, and the height of the surface that the code idframes-and-framesets:frameset-3>a href#frameset>frameset/a>/code> is being rendered into, in a hrefhttps://drafts.csswg.org/css-values/#px idframes-and-framesets:px-2 data-x-internalpx>CSS pixels/a>, as the input dimension. Let var>sized rows/var> be the resulting list./p> li> p>Split the surface into a grid of var>w/var>×var>h/var> rectangles, where var>w/var> is the number of entries in var>sized cols/var> and var>h/var> is the number of entries in var>sized rows/var>./p> p>Size the columns so that each column in the grid is as many a hrefhttps://drafts.csswg.org/css-values/#px idframes-and-framesets:px-3 data-x-internalpx>CSS pixels/a> wide as the corresponding entry in the var>sized cols/var> list./p> p>Size the rows so that each row in the grid is as many a hrefhttps://drafts.csswg.org/css-values/#px idframes-and-framesets:px-4 data-x-internalpx>CSS pixels/a> high as the corresponding entry in the var>sized rows/var> list./p> li> p>Let var>children/var> be the list of code idframes-and-framesets:frame>a href#frame>frame/a>/code> and code idframes-and-framesets:frameset-4>a href#frameset>frameset/a>/code> elements that are a hrefhttps://dom.spec.whatwg.org/#concept-tree-child idframes-and-framesets:concept-tree-child data-x-internalconcept-tree-child>children/a> of the code idframes-and-framesets:frameset-5>a href#frameset>frameset/a>/code> element for which the algorithm was invoked./p> li> p>For each row of the grid of rectangles created in the previous step, from top to bottom, run these substeps:/p> ol>li> p>For each rectangle in the row, from left to right, run these substeps:/p> ol>li> p>If there are any elements left in var>children/var>, take the first element in the list, and assign it to the rectangle./p> p>If this is a code idframes-and-framesets:frameset-6>a href#frameset>frameset/a>/code> element, then recurse the entire code idframes-and-framesets:frameset-7>a href#frameset>frameset/a>/code> layout algorithm for that code idframes-and-framesets:frameset-8>a href#frameset>frameset/a>/code> element, with the rectangle as the surface./p> p>Otherwise, it is a code idframes-and-framesets:frame-2>a href#frame>frame/a>/code> element; render its a href#nested-browsing-context idframes-and-framesets:nested-browsing-context>nested browsing context/a>, positioned and sized to fit the rectangle./p> li> p>If there are any elements left in var>children/var>, remove the first element from var>children/var>./p> /ol> /ol> li> p>If the code idframes-and-framesets:frameset-9>a href#frameset>frameset/a>/code> element a href#has-a-border idframes-and-framesets:has-a-border>has a border/a>, draw an outer set of borders around the rectangles, using the elements a href#frame-border-colour idframes-and-framesets:frame-border-colour>frame border color/a>./p> p>For each rectangle, if there is an element assigned to that rectangle, and that element a href#has-a-border idframes-and-framesets:has-a-border-2>has a border/a>, draw an inner set of borders around that rectangle, using the elements a href#frame-border-colour idframes-and-framesets:frame-border-colour-2>frame border color/a>./p> p>For each (visible) border that does not abut a rectangle that is assigned a code idframes-and-framesets:frame-3>a href#frame>frame/a>/code> element with a code>noresize/code> attribute (including rectangles in further nested code idframes-and-framesets:frameset-10>a href#frameset>frameset/a>/code> elements), the user agent is expected to allow the user to move the border, resizing the rectangles within, keeping the proportions of any nested code idframes-and-framesets:frameset-11>a href#frameset>frameset/a>/code> grids./p> p>A code idframes-and-framesets:frameset-12>a href#frameset>frameset/a>/code> or code idframes-and-framesets:frame-4>a href#frame>frame/a>/code> element dfn idhas-a-border>has a border/dfn> if the following algorithm returns true:/p> ol>li>p>If the element has a code>frameborder/code> attribute whose value is not the empty string and whose first character is either a U+0031 DIGIT ONE (1) character, a U+0079 LATIN SMALL LETTER Y character (y), or a U+0059 LATIN CAPITAL LETTER Y character (Y), then return true.li>p>Otherwise, if the element has a code>frameborder/code> attribute, return false.li>p>Otherwise, if the element has a parent element that is a code idframes-and-framesets:frameset-13>a href#frameset>frameset/a>/code> element, then return true if em>that/em> element a href#has-a-border idframes-and-framesets:has-a-border-3>has a border/a>, and false if it does not.li>p>Otherwise, return true./ol> p>The dfn idframe-border-colour>frame border color/dfn> of a code idframes-and-framesets:frameset-14>a href#frameset>frameset/a>/code> or code idframes-and-framesets:frame-5>a href#frame>frame/a>/code> element is the color obtained from the following algorithm:/p> ol>li>p>If the element has a code>bordercolor/code> attribute, and applying the a href#rules-for-parsing-a-legacy-colour-value idframes-and-framesets:rules-for-parsing-a-legacy-colour-value>rules for parsing a legacy color value/a> to that attributes value does not result in an error, then return the color so obtained.li>p>Otherwise, if the element has a parent element that is a code idframes-and-framesets:frameset-15>a href#frameset>frameset/a>/code> element, then return the a href#frame-border-colour idframes-and-framesets:frame-border-colour-3>frame border color/a> of that element./p> li>p>Otherwise, return gray./ol> /ol> p>The algorithm to dfn idconvert-a-list-of-dimensions-to-a-list-of-pixel-values>convert a list of dimensions to a list of pixel values/dfn> consists of the following steps:/p> ol>li> p>Let var>input list/var> be the list of numbers and units passed to the algorithm./p> p>Let var>output list/var> be a list of numbers the same length as var>input list/var>, all zero./p> p>Entries in var>output list/var> correspond to the entries in var>input list/var> that have the same position./p> li>p>Let var>input dimension/var> be the size passed to the algorithm./p> li> p>Let var>count percentage/var> be the number of entries in var>input list/var> whose unit is i>percentage/i>./p> p>Let var>total percentage/var> be the sum of all the numbers in var>input list/var> whose unit is i>percentage/i>./p> p>Let var>count relative/var> be the number of entries in var>input list/var> whose unit is i>relative/i>./p> p>Let var>total relative/var> be the sum of all the numbers in var>input list/var> whose unit is i>relative/i>./p> p>Let var>count absolute/var> be the number of entries in var>input list/var> whose unit is i>absolute/i>./p> p>Let var>total absolute/var> be the sum of all the numbers in var>input list/var> whose unit is i>absolute/i>./p> p>Let var>remaining space/var> be the value of var>input dimension/var>./p> li> p>If var>total absolute/var> is greater than var>remaining space/var>, then for each entry in var>input list/var> whose unit is i>absolute/i>, set the corresponding value in var>output list/var> to the number of the entry in var>input list/var> multiplied by var>remaining space/var> and divided by var>total absolute/var>. Then, set var>remaining space/var> to zero./p> p>Otherwise, for each entry in var>input list/var> whose unit is i>absolute/i>, set the corresponding value in var>output list/var> to the number of the entry in var>input list/var>. Then, decrement var>remaining space/var> by var>total absolute/var>./p> li> p>If var>total percentage/var> multiplied by the var>input dimension/var> and divided by 100 is greater than var>remaining space/var>, then for each entry in var>input list/var> whose unit is i>percentage/i>, set the corresponding value in var>output list/var> to the number of the entry in var>input list/var> multiplied by var>remaining space/var> and divided by var>total percentage/var>. Then, set var>remaining space/var> to zero./p> p>Otherwise, for each entry in var>input list/var> whose unit is i>percentage/i>, set the corresponding value in var>output list/var> to the number of the entry in var>input list/var> multiplied by the var>input dimension/var> and divided by 100. Then, decrement var>remaining space/var> by var>total percentage/var> multiplied by the var>input dimension/var> and divided by 100./p> li> p>For each entry in var>input list/var> whose unit is i>relative/i>, set the corresponding value in var>output list/var> to the number of the entry in var>input list/var> multiplied by var>remaining space/var> and divided by var>total relative/var>./p> li>p>Return var>output list/var>./ol> p>User agents working with integer values for frame widths (as opposed to user agents that can lay frames out with subpixel accuracy) are expected to distribute the remainder first to the last entry whose unit is i>relative/i>, then equally (not proportionally) to each entry whose unit is i>percentage/i>, then equally (not proportionally) to each entry whose unit is i>absolute/i>, and finally, failing all else, to the last entry./p> hr> p>The contents of a code idframes-and-framesets:frame-6>a href#frame>frame/a>/code> element that does not have a code idframes-and-framesets:frameset-16>a href#frameset>frameset/a>/code> parent are expected to be rendered as a href#transparent-black idframes-and-framesets:transparent-black>transparent black/a>; the user agent is expected to not render the a href#nested-browsing-context idframes-and-framesets:nested-browsing-context-2>nested browsing context/a> in this case, and that a href#nested-browsing-context idframes-and-framesets:nested-browsing-context-3>nested browsing context/a> is expected to have a a idframes-and-framesets:viewport-2 hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a> with zero width and zero height./p> h3 idinteractive-media>span classsecno>14.7/span> Interactive mediaa href#interactive-media classself-link>/a>/h3> h4 idlinks,-forms,-and-navigation>span classsecno>14.7.1/span> Links, forms, and navigationa href#links,-forms,-and-navigation classself-link>/a>/h4> p>User agents are expected to allow the user to control aspects of a href#hyperlink idlinks,-forms,-and-navigation:hyperlink>hyperlink/a> activation and a href#form-submission-2 idlinks,-forms,-and-navigation:form-submission-2>form submission/a>, such as which a href#browsing-context idlinks,-forms,-and-navigation:browsing-context>browsing context/a> is to be used for the subsequent a href#navigate idlinks,-forms,-and-navigation:navigate>navigation/a>./p> p>User agents are expected to allow users to discover the destination of a href#hyperlink idlinks,-forms,-and-navigation:hyperlink-2>hyperlinks/a> and of a href#the-form-element idlinks,-forms,-and-navigation:the-form-element>forms/a> before triggering their a href#navigate idlinks,-forms,-and-navigation:navigate-2>navigation/a>./p> p>User agents are expected to inform the user of whether a a href#hyperlink idlinks,-forms,-and-navigation:hyperlink-3>hyperlink/a> includes a href#hyperlink-auditing idlinks,-forms,-and-navigation:hyperlink-auditing>hyperlink auditing/a>, and to let them know at a minimum which domains will be contacted as part of such auditing./p> p>User agents may allow users to a href#navigate idlinks,-forms,-and-navigation:navigate-3>navigate/a> a href#browsing-context idlinks,-forms,-and-navigation:browsing-context-2>browsing contexts/a> to the URLs a href#parse-a-url idlinks,-forms,-and-navigation:parse-a-url>indicated/a> by the code>cite/code> attributes on code idlinks,-forms,-and-navigation:the-q-element>a href#the-q-element>q/a>/code>, code idlinks,-forms,-and-navigation:the-blockquote-element>a href#the-blockquote-element>blockquote/a>/code>, code idlinks,-forms,-and-navigation:the-ins-element>a href#the-ins-element>ins/a>/code>, and code idlinks,-forms,-and-navigation:the-del-element>a href#the-del-element>del/a>/code> elements./p> p>User agents may surface a href#hyperlink idlinks,-forms,-and-navigation:hyperlink-4>hyperlinks/a> created by code idlinks,-forms,-and-navigation:the-link-element>a href#the-link-element>link/a>/code> elements in their user interface./p> p classnote>While code idlinks,-forms,-and-navigation:the-link-element-2>a href#the-link-element>link/a>/code> elements that create a href#hyperlink idlinks,-forms,-and-navigation:hyperlink-5>hyperlinks/a> will match the code idlinks,-forms,-and-navigation:selector-link>a href#selector-link>:link/a>/code> or code idlinks,-forms,-and-navigation:selector-visited>a href#selector-visited>:visited/a>/code> a hrefhttps://drafts.csswg.org/selectors/#pseudo-class idlinks,-forms,-and-navigation:pseudo-class data-x-internalpseudo-class>pseudo-classes/a>, will react to clicks if visible, and so forth, this does not extend to any browser interface constructs that expose those same links. Activating a link through the browsers interface, rather than in the page itself, does not trigger code idlinks,-forms,-and-navigation:event-click>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> events and the like./p> h4 idthe-title-attribute-2>span classsecno>14.7.2/span> The code idthe-title-attribute-2:attr-title>a href#attr-title>title/a>/code> attributea href#the-title-attribute-2 classself-link>/a>/h4> p>User agents are expected to expose the a href#advisory-information idthe-title-attribute-2:advisory-information>advisory information/a> of elements upon user request, and to make the user aware of the presence of such information./p> p>On interactive graphical systems where the user can use a pointing device, this could take the form of a tooltip. When the user is unable to use a pointing device, then the user agent is expected to make the content available in some other fashion, e.g. by making the element a i>focusable area/i> and always displaying the a href#advisory-information idthe-title-attribute-2:advisory-information-2>advisory information/a> of the currently a href#focused idthe-title-attribute-2:focused>focused/a> element, or by showing the a href#advisory-information idthe-title-attribute-2:advisory-information-3>advisory information/a> of the elements under the users finger on a touch device as the user pans around the screen./p> p>U+000A LINE FEED (LF) characters are expected to cause line breaks in the tooltip; U+0009 CHARACTER TABULATION (tab) characters are expected to render as a nonzero horizontal shift that lines up the next glyph with the next tab stop, with tab stops occurring at points that are multiples of 8 times the width of a U+0020 SPACE character./p> div classexample> p>For example, a visual user agent could make elements with a code idthe-title-attribute-2:attr-title-2>a href#attr-title>title/a>/code> attribute a href#focusable-area idthe-title-attribute-2:focusable-area>focusable/a>, and could make any a href#focused idthe-title-attribute-2:focused-2>focused/a> element with a code idthe-title-attribute-2:attr-title-3>a href#attr-title>title/a>/code> attribute show its tooltip under the element while the element has focus. This would allow a user to tab around the document to find all the advisory text./p> /div> div classexample> p>As another example, a screen reader could provide an audio cue when reading an element with a tooltip, with an associated key to read the last tooltip for which a cue was played./p> /div> h4 idediting-hosts>span classsecno>14.7.3/span> Editing hostsa href#editing-hosts classself-link>/a>/h4> p>The current text editing caret (i.e. the a idediting-hosts:active-range hrefhttps://w3c.github.io/editing/execCommand.html#active-range data-x-internalactive-range>active range/a>, if it is empty and in an a idediting-hosts:editing-host hrefhttps://w3c.github.io/editing/execCommand.html#editing-host data-x-internalediting-host>editing host/a>), if any, is expected to act like an inline a idediting-hosts:replaced-element hrefhttps://drafts.csswg.org/css2/conform.html#replaced-element data-x-internalreplaced-element>replaced element/a> with the vertical dimensions of the caret and with zero width for the purposes of the CSS rendering model./p> p classnote>This means that even an empty block can have the caret inside it, and that when the caret is in such an element, it prevents a hrefhttps://drafts.csswg.org/css2/box.html#collapsing-margins idediting-hosts:collapsing-margins data-x-internalcollapsing-margins>margins from collapsing/a> through the element./p> h4 idtext-rendered-in-native-user-interfaces>span classsecno>14.7.4/span> Text rendered in native user interfacesa href#text-rendered-in-native-user-interfaces classself-link>/a>/h4> p>User agents are expected to honor the Unicode semantics of text that is exposed in user interfaces, for example supporting the bidirectional algorithm in text shown in dialogs, title bars, pop-up menus, and tooltips. Text from the contents of elements is expected to be rendered in a manner that honors a href#the-directionality idtext-rendered-in-native-user-interfaces:the-directionality>the directionality/a> of the element from which the text was obtained. Text from attributes is expected to be rendered in a manner that honours the a href#directionality-of-the-attribute idtext-rendered-in-native-user-interfaces:directionality-of-the-attribute>directionality of the attribute/a>./p> div classexample> p>Consider the following markup, which has Hebrew text asking for a programming language, the languages being text for which a left-to-right direction is important given the punctuation in some of their names:/p> pre><p dirrtl langhe> <label> span dirrtl langhe>בחר שפת תכנות:/span> <select> <option dirltr>C++</option> <option dirltr>C#</option> <option dirltr>FreePascal</option> <option dirltr>F#</option> </select> </label></p>/pre> p>If the code idtext-rendered-in-native-user-interfaces:the-select-element>a href#the-select-element>select/a>/code> element was rendered as a drop down box, a correct rendering would ensure that the punctuation was the same both in the drop down, and in the box showing the current selection./p> p>img src/images/bidiselect.png width206 alt height105>/p> /div> div classexample> p>The directionality of attributes depends on the attribute and on the elements code idtext-rendered-in-native-user-interfaces:the-dir-attribute>a href#the-dir-attribute>dir/a>/code> attribute, as the following example demonstrates. Consider this markup:/p> pre>bdo dirltr><table> <tr> <th abbr(א dirltr>A <th abbr(א dirrtl>A <th abbr(א dirauto>A</table>/bdo>/pre> p>If the code idtext-rendered-in-native-user-interfaces:attr-th-abbr>a href#attr-th-abbr>abbr/a>/code> attributes are rendered, e.g. in a tooltip or other user interface, the first will have a left parenthesis (because the direction is ltr), the second will have a right parenthesis (because the direction is rtl), and the third will have a right parenthesis (because the direction is determined em>from the attribute value/em> to be rtl)./p> p>However, if instead the attribute was not a a href#directionality-capable-attribute idtext-rendered-in-native-user-interfaces:directionality-capable-attribute>directionality-capable attribute/a>, the results would be different:/p> pre>bdo dirltr><table> <tr> <th data-abbr(א dirltr>A <th data-abbr(א dirrtl>A <th data-abbr(א dirauto>A</table>/bdo>/pre> p>In this case, if the user agent were to expose the code>data-abbr/code> attribute in the user interface (e.g. in a debugging environment), the last case would be rendered with a em>left/em> parenthesis, because the direction would be determined from the elements contents./p> /div> p>A string provided by a script (e.g. the argument to code idtext-rendered-in-native-user-interfaces:dom-alert>a href#dom-alert>window.alert()/a>/code>) is expected to be treated as an independent set of one or more bidirectional algorithm paragraphs when displayed, as defined by the bidirectional algorithm, including, for instance, supporting the paragraph-breaking behavior of U+000A LINE FEED (LF) characters. For the purposes of determining the paragraph level of such text in the bidirectional algorithm, this specification does em>not/em> provide a higher-level override of rules P2 and P3. a href#refsBIDI>BIDI/a>/p> p>When necessary, authors can enforce a particular direction for a given paragraph by starting it with the Unicode U+200E LEFT-TO-RIGHT MARK or U+200F RIGHT-TO-LEFT MARK characters./p> div classexample> p>Thus, the following script:/p> pre>alert(\u05DC\u05DE\u05D3 HTML \u05D4\u05D9\u05D5\u05DD!)/pre> p>...would always result in a message reading bdo dirrtl lang>למד LMTH היום!/bdo> (not bdo dirltr lang>דמל HTML םויה!/bdo>), regardless of the language of the user agent interface or the direction of the page or any of its elements./p> /div> div classexample> p>For a more complex example, consider the following script:/p> pre classbad>/* Warning: this script does not handle right-to-left scripts correctly */var s;if (s prompt(What is your name?)) { alert(s + ! Ok, Fred, + s + , and Wilma will get the car.);}/pre> p>When the user enters kbd>Kitty/kbd>, the user agent would alert samp>Kitty! Ok, Fred, Kitty, and Wilma will get the car./samp>. However, if the user enters kbd dirrtl langar>لا أفهم/kbd>, then the bidirectional algorithm will determine that the direction of the paragraph is right-to-left, and so the output will be the following unintended mess: samp lang>bdo dirrtl>لا أفهم! derF ,kO, لا أفهم, rac eht teg lliw amliW dna./bdo>/samp>/p> p>To force an alert that starts with user-provided text (or other text of unknown directionality) to render left-to-right, the string can be prefixed with a U+200E LEFT-TO-RIGHT MARK character:/p> pre>var s;if (s prompt(What is your name?)) { alert(strong>\u200E/strong> + s + ! Ok, Fred, + s + , and Wilma will get the car.);}/pre> /div> h3 idprint-media>span classsecno>14.8/span> Print mediaa href#print-media classself-link>/a>/h3> p>User agents are expected to allow the user to request the opportunity to dfn idobtain-a-physical-form>obtain a physical form/dfn> (or a representation of a physical form) of a code idprint-media:document>a href#document>Document/a>/code>. For example, selecting the option to print a page or convert it to PDF format. a href#refsPDF>PDF/a>/p> p>When the user actually a href#obtain-a-physical-form idprint-media:obtain-a-physical-form>obtains a physical form/a> (or a representation of a physical form) of a code idprint-media:document-2>a href#document>Document/a>/code>, the user agent is expected to create a new rendering of the code idprint-media:document-3>a href#document>Document/a>/code> for the print media./p> h3 idunstyled-xml-documents>span classsecno>14.9/span> Unstyled XML documentsa href#unstyled-xml-documents classself-link>/a>/h3> p>HTML user agents may, in certain circumstances, find themselves rendering non-HTML documents that use vocabularies for which they lack any built-in knowledge. This section provides for a way for user agents to handle such documents in a somewhat useful manner./p> p>While a code idunstyled-xml-documents:document>a href#document>Document/a>/code> is an a href#unstyled-document idunstyled-xml-documents:unstyled-document>unstyled document/a>, the user agent is expected to render a href#an-unstyled-document-view idunstyled-xml-documents:an-unstyled-document-view>an unstyled document view/a>./p> p>A code idunstyled-xml-documents:document-2>a href#document>Document/a>/code> is an dfn idunstyled-document>unstyled document/dfn> while it matches the following conditions:/p> ul>li>The code idunstyled-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 idunstyled-xml-documents:the-link-element>a href#the-link-element>link/a>/code>, inline elements like code idunstyled-xml-documents:the-style-element>a href#the-style-element>style/a>/code>, or any other mechanism). li>None of the elements in the code idunstyled-xml-documents:document-4>a href#document>Document/a>/code> have any a href#presentational-hints idunstyled-xml-documents:presentational-hints>presentational hints/a>. li>None of the elements in the code idunstyled-xml-documents:document-5>a href#document>Document/a>/code> have any a hrefhttps://drafts.csswg.org/css-style-attr/#style-attribute idunstyled-xml-documents:css-styling-attribute data-x-internalcss-styling-attribute>style attributes/a>. li>None of the elements in the code idunstyled-xml-documents:document-6>a href#document>Document/a>/code> are in any of the following namespaces: a idunstyled-xml-documents:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>, a idunstyled-xml-documents:svg-namespace hrefhttps://infra.spec.whatwg.org/#svg-namespace data-x-internalsvg-namespace>SVG namespace/a>, a idunstyled-xml-documents:mathml-namespace hrefhttps://infra.spec.whatwg.org/#mathml-namespace data-x-internalmathml-namespace>MathML namespace/a> li>The code idunstyled-xml-documents:document-7>a href#document>Document/a>/code> has no i>focusable area/i> (e.g. from XLink) other than the a idunstyled-xml-documents:viewport hrefhttps://drafts.csswg.org/css2/visuren.html#viewport data-x-internalviewport>viewport/a>. li>The code idunstyled-xml-documents:document-8>a href#document>Document/a>/code> has no a href#hyperlink idunstyled-xml-documents:hyperlink>hyperlinks/a> (e.g. from XLink). li>There exists no a href#concept-script idunstyled-xml-documents:concept-script>script/a> whose a href#settings-object idunstyled-xml-documents:settings-object>settings object/a> specifies this code idunstyled-xml-documents:document-9>a href#document>Document/a>/code> as the a href#responsible-document idunstyled-xml-documents:responsible-document>responsible document/a>. li>None of the elements in the code idunstyled-xml-documents:document-10>a href#document>Document/a>/code> have any registered event listeners. /ul> p>dfn idan-unstyled-document-view>An unstyled document view/dfn> is one where the DOM is not rendered according to CSS (which would, since there are no applicable styles in this context, just result in a wall of text), but is instead rendered in a manner that is useful for a developer. This could consist of just showing the code idunstyled-xml-documents:document-11>a href#document>Document/a>/code> objects source, maybe with syntax highlighting, or it could consist of displaying just the DOM tree, or simply a message saying that the page is not a styled document./p> p classnote>If a code idunstyled-xml-documents:document-12>a href#document>Document/a>/code> stops being an a href#unstyled-document idunstyled-xml-documents:unstyled-document-2>unstyled document/a>, then the conditions above stop applying, and thus a user agent following these requirements will switch to using the regular CSS rendering./p> h2 idobsolete>span classsecno>15/span> Obsolete featuresa href#obsolete classself-link>/a>/h2> h3 idobsolete-but-conforming-features>span classsecno>15.1/span> Obsolete but conforming featuresa href#obsolete-but-conforming-features classself-link>/a>/h3> p>Features listed in this section will trigger warnings in conformance checkers./p> p>Authors should not specify a code idobsolete-but-conforming-features:attr-img-border>a href#attr-img-border>border/a>/code> attribute on an code idobsolete-but-conforming-features:the-img-element>a href#the-img-element>img/a>/code> element. If the attribute is present, its value must be the string code>0/code>. CSS should be used instead./p> p>Authors should not specify a code idobsolete-but-conforming-features:attr-script-charset>a href#attr-script-charset>charset/a>/code> attribute on a code idobsolete-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 idobsolete-but-conforming-features:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for code>utf-8/code>. (This has no effect in a document that conforms to the requirements elsewhere in this standard of being encoded as a idobsolete-but-conforming-features:utf-8 hrefhttps://encoding.spec.whatwg.org/#utf-8 data-x-internalutf-8>UTF-8/a>.)/p> p>Authors should not specify a code idobsolete-but-conforming-features:attr-script-language>a href#attr-script-language>language/a>/code> attribute on a code idobsolete-but-conforming-features:the-script-element-2>a href#the-script-element>script/a>/code> element. If the attribute is present, its value must be an a idobsolete-but-conforming-features:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>JavaScript/code> and either the code idobsolete-but-conforming-features:attr-script-type>a href#attr-script-type>type/a>/code> attribute must be omitted or its value must be an a idobsolete-but-conforming-features:ascii-case-insensitive-3 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>text/javascript/code>. The attribute should be entirely omitted instead (with the value code>JavaScript/code>, it has no effect), or replaced with use of the code idobsolete-but-conforming-features:attr-script-type-2>a href#attr-script-type>type/a>/code> attribute./p> p>Authors should not specify a value for the code idobsolete-but-conforming-features:attr-script-type-3>a href#attr-script-type>type/a>/code> attribute on code idobsolete-but-conforming-features:the-script-element-3>a href#the-script-element>script/a>/code> elements that is the empty string or an a idobsolete-but-conforming-features:ascii-case-insensitive-4 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for a a href#javascript-mime-type idobsolete-but-conforming-features:javascript-mime-type>JavaScript MIME type/a>. Instead, they should omit the attribute, which has the same effect./p> p>Authors should not specify a code idobsolete-but-conforming-features:attr-style-type>a href#attr-style-type>type/a>/code> attribute on a code idobsolete-but-conforming-features:the-style-element>a href#the-style-element>style/a>/code> element. If the attribute is present, its value must be an a idobsolete-but-conforming-features:ascii-case-insensitive-5 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for code idobsolete-but-conforming-features:text/css>a href#text/css>text/css/a>/code>./p> p>Authors should not specify the code idobsolete-but-conforming-features:attr-a-name>a href#attr-a-name>name/a>/code> attribute on code idobsolete-but-conforming-features:the-a-element>a href#the-a-element>a/a>/code> elements. If the attribute is present, its value must not be the empty string and must neither be equal to the value of any of the a hrefhttps://dom.spec.whatwg.org/#concept-id idobsolete-but-conforming-features:concept-id data-x-internalconcept-id>IDs/a> in the elements a idobsolete-but-conforming-features:tree hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a> other than the elements own a hrefhttps://dom.spec.whatwg.org/#concept-id idobsolete-but-conforming-features:concept-id-2 data-x-internalconcept-id>ID/a>, if any, nor be equal to the value of any of the other code idobsolete-but-conforming-features:attr-a-name-2>a href#attr-a-name>name/a>/code> attributes on code idobsolete-but-conforming-features:the-a-element-2>a href#the-a-element>a/a>/code> elements in the elements a idobsolete-but-conforming-features:tree-2 hrefhttps://dom.spec.whatwg.org/#concept-tree data-x-internaltree>tree/a>. If this attribute is present and the element has an a hrefhttps://dom.spec.whatwg.org/#concept-id idobsolete-but-conforming-features:concept-id-3 data-x-internalconcept-id>ID/a>, then the attributes value must be equal to the elements a hrefhttps://dom.spec.whatwg.org/#concept-id idobsolete-but-conforming-features:concept-id-4 data-x-internalconcept-id>ID/a>. In earlier versions of the language, this attribute was intended as a way to specify possible targets for a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idobsolete-but-conforming-features:concept-url-fragment data-x-internalconcept-url-fragment>fragments/a> in a hrefhttps://url.spec.whatwg.org/#concept-url idobsolete-but-conforming-features:url data-x-internalurl>URLs/a>. The code idobsolete-but-conforming-features:the-id-attribute>a href#the-id-attribute>id/a>/code> attribute should be used instead./p> p>Authors should not, but may despite requirements to the contrary elsewhere in this specification, specify the code idobsolete-but-conforming-features:attr-input-maxlength>a href#attr-input-maxlength>maxlength/a>/code> and code idobsolete-but-conforming-features:attr-input-size>a href#attr-input-size>size/a>/code> attributes on code idobsolete-but-conforming-features:the-input-element>a href#the-input-element>input/a>/code> elements whose code idobsolete-but-conforming-features:attr-input-type>a href#attr-input-type>type/a>/code> attributes are in the a href#number-state-(typenumber) idobsolete-but-conforming-features:number-state-(typenumber)>Number/a> state. One valid reason for using these attributes regardless is to help legacy user agents that do not support code idobsolete-but-conforming-features:the-input-element-2>a href#the-input-element>input/a>/code> elements with code>typenumber/code> to still render the text control with a useful width./p> h4 idwarnings-for-obsolete-but-conforming-features>span classsecno>15.1.1/span> Warnings for obsolete but conforming featuresa href#warnings-for-obsolete-but-conforming-features classself-link>/a>/h4> p>To ease the transition from HTML4 Transitional documents to the language defined in em>this/em> specification, and to discourage certain features that are only allowed in very few circumstances, conformance checkers must warn the user when the following features are used in a document. These are generally old obsolete features that have no effect, and are allowed only to distinguish between likely mistakes (regular conformance errors) and mere vestigial markup or unusual and discouraged practices (these warnings)./p> p>The following features must be categorized as described above:/p> ul>li>p>The presence of a code idwarnings-for-obsolete-but-conforming-features:attr-img-border>a href#attr-img-border>border/a>/code> attribute on an code idwarnings-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 idwarnings-for-obsolete-but-conforming-features:attr-script-charset>a href#attr-script-charset>charset/a>/code> attribute on a code idwarnings-for-obsolete-but-conforming-features:the-script-element>a href#the-script-element>script/a>/code> element if its value is an a idwarnings-for-obsolete-but-conforming-features:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for code>utf-8/code>.li>p>The presence of a code idwarnings-for-obsolete-but-conforming-features:attr-script-language>a href#attr-script-language>language/a>/code> attribute on a code idwarnings-for-obsolete-but-conforming-features:the-script-element-2>a href#the-script-element>script/a>/code> element if its value is an a idwarnings-for-obsolete-but-conforming-features:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>JavaScript/code> and if there is no code idwarnings-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 idwarnings-for-obsolete-but-conforming-features:ascii-case-insensitive-3 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>text/javascript/code>.li>p>The presence of a code idwarnings-for-obsolete-but-conforming-features:attr-style-type>a href#attr-style-type>type/a>/code> attribute on a code idwarnings-for-obsolete-but-conforming-features:the-script-element-3>a href#the-script-element>script/a>/code> element if its value is an a idwarnings-for-obsolete-but-conforming-features:ascii-case-insensitive-4 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for a a href#javascript-mime-type idwarnings-for-obsolete-but-conforming-features:javascript-mime-type>JavaScript MIME type/a>.li>p>The presence of a code idwarnings-for-obsolete-but-conforming-features:attr-style-type-2>a href#attr-style-type>type/a>/code> attribute on a code idwarnings-for-obsolete-but-conforming-features:the-style-element>a href#the-style-element>style/a>/code> element if its value is an a idwarnings-for-obsolete-but-conforming-features:ascii-case-insensitive-5 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for code idwarnings-for-obsolete-but-conforming-features:text/css>a href#text/css>text/css/a>/code>.li>p>The presence of a code idwarnings-for-obsolete-but-conforming-features:attr-a-name>a href#attr-a-name>name/a>/code> attribute on an code idwarnings-for-obsolete-but-conforming-features:the-a-element>a href#the-a-element>a/a>/code> element, if its value is not the empty string.li>p>The presence of a code idwarnings-for-obsolete-but-conforming-features:attr-input-maxlength>a href#attr-input-maxlength>maxlength/a>/code> attribute on an code idwarnings-for-obsolete-but-conforming-features:the-input-element>a href#the-input-element>input/a>/code> element whose code idwarnings-for-obsolete-but-conforming-features:attr-input-type>a href#attr-input-type>type/a>/code> attribute is in the a href#number-state-(typenumber) idwarnings-for-obsolete-but-conforming-features:number-state-(typenumber)>Number/a> state.li>p>The presence of a code idwarnings-for-obsolete-but-conforming-features:attr-input-size>a href#attr-input-size>size/a>/code> attribute on an code idwarnings-for-obsolete-but-conforming-features:the-input-element-2>a href#the-input-element>input/a>/code> element whose code idwarnings-for-obsolete-but-conforming-features:attr-input-type-2>a href#attr-input-type>type/a>/code> attribute is in the a href#number-state-(typenumber) idwarnings-for-obsolete-but-conforming-features:number-state-(typenumber)-2>Number/a> state./ul> p>Conformance checkers must distinguish between pages that have no conformance errors and have none of these obsolete features, and pages that have no conformance errors but do have some of these obsolete features./p> p classexample>For example, a validator could report some pages as Valid HTML and others as Valid HTML with warnings./p> h3 idnon-conforming-features>span classsecno>15.2/span> Non-conforming featuresa href#non-conforming-features classself-link>/a>/h3> p>Elements in the following list are entirely obsolete, and must not be used by authors:/p> dl>dt>dfn idapplet>code>applet/code>/dfn>dd>p>Use code idnon-conforming-features:the-embed-element>a href#the-embed-element>embed/a>/code> or code idnon-conforming-features:the-object-element>a href#the-object-element>object/a>/code> instead.dt>dfn idacronym>code>acronym/code>/dfn>dd>p>Use code idnon-conforming-features:the-abbr-element>a href#the-abbr-element>abbr/a>/code> instead.dt>dfn idbgsound>code>bgsound/code>/dfn>dd>p>Use code idnon-conforming-features:the-audio-element>a href#the-audio-element>audio/a>/code> instead.dt>dfn iddir>code>dir/code>/dfn>dd>p>Use code idnon-conforming-features:the-ul-element>a href#the-ul-element>ul/a>/code> instead.dt>code idnon-conforming-features:frame>a href#frame>frame/a>/code>dt>code idnon-conforming-features:frameset>a href#frameset>frameset/a>/code>dt>dfn idnoframes>code>noframes/code>/dfn>dd>p>Either use code idnon-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 idisindex>code>isindex/code>/dfn>dd>p>Use an explicit code idnon-conforming-features:the-form-element>a href#the-form-element>form/a>/code> and a href#text-(typetext)-state-and-search-state-(typesearch) idnon-conforming-features:text-(typetext)-state-and-search-state-(typesearch)>text control/a> combination instead.dt>dfn idkeygen>code>keygen/code>/dfn>dd> p>For enterprise device management use cases, use native on-device management capabilities./p> p>For certificate enrollment use cases, use the Web Cryptography API to generate a keypair for the certificate, and then export the certificate and key to allow the user to install them manually. a href#refsWEBCRYPTO>WEBCRYPTO/a>/p> dt>dfn idlisting>code>listing/code>/dfn>dd>p>Use code idnon-conforming-features:the-pre-element>a href#the-pre-element>pre/a>/code> and code idnon-conforming-features:the-code-element>a href#the-code-element>code/a>/code> instead.dt>dfn idmenuitem>code>menuitem/code>/dfn>dd>p>To implement a custom context menu, use script to handle the code idnon-conforming-features:event-contextmenu>a href#event-contextmenu>contextmenu/a>/code> event.dt>dfn idnextid>code>nextid/code>/dfn>dd>p>Use GUIDs instead.dt>dfn idnoembed>code>noembed/code>/dfn>dd>p>Use code idnon-conforming-features:the-object-element-2>a href#the-object-element>object/a>/code> instead of code idnon-conforming-features:the-embed-element-2>a href#the-embed-element>embed/a>/code> when fallback is necessary.dt>dfn idplaintext>code>plaintext/code>/dfn>dd>p>Use the code idnon-conforming-features:text/plain>a data-x-internaltext/plain hrefhttps://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain/a>/code> a idnon-conforming-features:mime-type hrefhttps://mimesniff.spec.whatwg.org/#mime-type data-x-internalmime-type>MIME type/a> instead.dt>dfn idrb>code>rb/code>/dfn>dt>dfn idrtc>code>rtc/code>/dfn>dd>p>Providing the ruby base directly inside the code idnon-conforming-features:the-ruby-element>a href#the-ruby-element>ruby/a>/code> element or using nested code idnon-conforming-features:the-ruby-element-2>a href#the-ruby-element>ruby/a>/code> elements is sufficient.dt>dfn idstrike>code>strike/code>/dfn>dd>p>Use code idnon-conforming-features:the-del-element>a href#the-del-element>del/a>/code> instead if the element is marking an edit, otherwise use code idnon-conforming-features:the-s-element>a href#the-s-element>s/a>/code> instead.dt>dfn idxmp>code>xmp/code>/dfn>dd>p>Use code idnon-conforming-features:the-pre-element-2>a href#the-pre-element>pre/a>/code> and code idnon-conforming-features:the-code-element-2>a href#the-code-element>code/a>/code> instead, and escape code></code> and code>&/code> characters as code></code> and code>&/code> respectively.dt>dfn idbasefont>code>basefont/code>/dfn>dt>dfn idbig>code>big/code>/dfn>dt>dfn idblink>code>blink/code>/dfn>dt>dfn idcenter>code>center/code>/dfn>dt>dfn idfont>code>font/code>/dfn>dt>code idnon-conforming-features:the-marquee-element>a href#the-marquee-element>marquee/a>/code>dt>dfn idmulticol>code>multicol/code>/dfn>dt>dfn idnobr>code>nobr/code>/dfn>dt>dfn idspacer>code>spacer/code>/dfn>dt>dfn idtt>code>tt/code>/dfn>dd> p>Use appropriate elements or CSS instead./p> p>Where the code idnon-conforming-features:tt>a href#tt>tt/a>/code> element would have been used for marking up keyboard input, consider the code idnon-conforming-features:the-kbd-element>a href#the-kbd-element>kbd/a>/code> element; for variables, consider the code idnon-conforming-features:the-var-element>a href#the-var-element>var/a>/code> element; for computer code, consider the code idnon-conforming-features:the-code-element-3>a href#the-code-element>code/a>/code> element; and for computer output, consider the code idnon-conforming-features:the-samp-element>a href#the-samp-element>samp/a>/code> element./p> p>Similarly, if the code idnon-conforming-features:big>a href#big>big/a>/code> element is being used to denote a heading, consider using the code idnon-conforming-features:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code> element; if it is being used for marking up important passages, consider the code idnon-conforming-features:the-strong-element>a href#the-strong-element>strong/a>/code> element; and if it is being used for highlighting text for reference purposes, consider the code idnon-conforming-features:the-mark-element>a href#the-mark-element>mark/a>/code> element./p> p>See also the a href#usage-summary>text-level semantics usage summary/a> for more suggestions with examples./p> /dl> hr> p>The following attributes are obsolete (though the elements are still part of the language), and must not be used by authors:/p> dl>dt>dfn idattr-a-charset>code>charset/code>/dfn> on code idnon-conforming-features:the-a-element>a href#the-a-element>a/a>/code> elementsdt>dfn idattr-link-charset>code>charset/code>/dfn> on code idnon-conforming-features:the-link-element>a href#the-link-element>link/a>/code> elementsdd>p>Use an HTTP `code idnon-conforming-features:content-type>a href#content-type>Content-Type/a>/code>` header on the linked resource instead.dt>dfn idattr-script-charset>code>charset/code>/dfn> on code idnon-conforming-features:the-script-element>a href#the-script-element>script/a>/code> elements (except as noted in the previous section)dd>p>Omit the attribute. Both documents and scripts are required to use a idnon-conforming-features:utf-8 hrefhttps://encoding.spec.whatwg.org/#utf-8 data-x-internalutf-8>UTF-8/a>, so it is redundant to specify it on the code idnon-conforming-features:the-script-element-2>a href#the-script-element>script/a>/code> element since it inherits from the document.dt>dfn idattr-a-coords>code>coords/code>/dfn> on code idnon-conforming-features:the-a-element-2>a href#the-a-element>a/a>/code> elementsdt>dfn idattr-a-shape>code>shape/code>/dfn> on code idnon-conforming-features:the-a-element-3>a href#the-a-element>a/a>/code> elementsdd>p>Use code idnon-conforming-features:the-area-element>a href#the-area-element>area/a>/code> instead of code idnon-conforming-features:the-a-element-4>a href#the-a-element>a/a>/code> for image maps.dt>dfn idattr-a-methods>code>methods/code>/dfn> on code idnon-conforming-features:the-a-element-5>a href#the-a-element>a/a>/code> elementsdt>dfn idattr-link-methods>code>methods/code>/dfn> on code idnon-conforming-features:the-link-element-2>a href#the-link-element>link/a>/code> elementsdd>p>Use the HTTP OPTIONS feature instead.dt>dfn idattr-a-name>code>name/code>/dfn> on code idnon-conforming-features:the-a-element-6>a href#the-a-element>a/a>/code> elements (except as noted in the previous section)dt>dfn idattr-embed-name>code>name/code>/dfn> on code idnon-conforming-features:the-embed-element-3>a href#the-embed-element>embed/a>/code> elementsdt>dfn idattr-img-name>code>name/code>/dfn> on code idnon-conforming-features:the-img-element>a href#the-img-element>img/a>/code> elementsdt>dfn idattr-option-name>code>name/code>/dfn> on code idnon-conforming-features:the-option-element>a href#the-option-element>option/a>/code> elementsdd>p>Use the code idnon-conforming-features:the-id-attribute>a href#the-id-attribute>id/a>/code> attribute instead.dt>dfn idattr-a-rev>code>rev/code>/dfn> on code idnon-conforming-features:the-a-element-7>a href#the-a-element>a/a>/code> elementsdt>dfn idattr-link-rev>code>rev/code>/dfn> on code idnon-conforming-features:the-link-element-3>a href#the-link-element>link/a>/code> elementsdd>p>Use the code idnon-conforming-features:attr-hyperlink-rel>a href#attr-hyperlink-rel>rel/a>/code> attribute instead, with an opposite term. (For example, instead of code>revmade/code>, use code>relauthor/code>.)dt>dfn idattr-a-urn>code>urn/code>/dfn> on code idnon-conforming-features:the-a-element-8>a href#the-a-element>a/a>/code> elementsdt>dfn idattr-link-urn>code>urn/code>/dfn> on code idnon-conforming-features:the-link-element-4>a href#the-link-element>link/a>/code> elementsdd>p>Specify the preferred persistent identifier using the code idnon-conforming-features:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute instead.dt>dfn idattr-form-accept>code>accept/code>/dfn> on code idnon-conforming-features:the-form-element-2>a href#the-form-element>form/a>/code> elementsdd>p>Use the code idnon-conforming-features:attr-input-accept>a href#attr-input-accept>accept/a>/code> attribute directly on the code idnon-conforming-features:the-input-element>a href#the-input-element>input/a>/code> elements instead.dt>dfn idattr-area-hreflang>code>hreflang/code>/dfn> on code idnon-conforming-features:the-area-element-2>a href#the-area-element>area/a>/code> elementsdt>dfn idattr-area-type>code>type/code>/dfn> on code idnon-conforming-features:the-area-element-3>a href#the-area-element>area/a>/code> elementsdd>p>These attributes do not do anything useful, and for historical reasons there are no corresponding IDL attributes on code idnon-conforming-features:the-area-element-4>a href#the-area-element>area/a>/code> elements. Omit them altogether.dt>dfn idattr-area-nohref>code>nohref/code>/dfn> on code idnon-conforming-features:the-area-element-5>a href#the-area-element>area/a>/code> elementsdd>p>Omitting the code idnon-conforming-features:attr-hyperlink-href-2>a href#attr-hyperlink-href>href/a>/code> attribute is sufficient; the code idnon-conforming-features:attr-area-nohref>a href#attr-area-nohref>nohref/a>/code> attribute is unnecessary. Omit it altogether.dt>dfn idattr-head-profile>code>profile/code>/dfn> on code idnon-conforming-features:the-head-element>a href#the-head-element>head/a>/code> elementsdd>p>Unnecessary. Omit it altogether.dt>dfn idattr-html-version>code>version/code>/dfn> on code idnon-conforming-features:the-html-element>a href#the-html-element>html/a>/code> elementsdd>p>Unnecessary. Omit it altogether.dt>dfn idattr-input-ismap>code>ismap/code>/dfn> on code idnon-conforming-features:the-input-element-2>a href#the-input-element>input/a>/code> elementsdd>p>Unnecessary. Omit it altogether. All code idnon-conforming-features:the-input-element-3>a href#the-input-element>input/a>/code> elements with a code idnon-conforming-features:attr-input-type>a href#attr-input-type>type/a>/code> attribute in the a href#image-button-state-(typeimage) idnon-conforming-features:image-button-state-(typeimage)>Image Button/a> state are processed as server-side image maps.dt>dfn idattr-input-usemap>code>usemap/code>/dfn> on code idnon-conforming-features:the-input-element-4>a href#the-input-element>input/a>/code> elementsdd>p>Use code idnon-conforming-features:the-img-element-2>a href#the-img-element>img/a>/code> instead of code idnon-conforming-features:the-input-element-5>a href#the-input-element>input/a>/code> for image maps.dt>dfn idattr-iframe-longdesc>code>longdesc/code>/dfn> on code idnon-conforming-features:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code> elementsdt>dfn idattr-img-longdesc>code>longdesc/code>/dfn> on code idnon-conforming-features:the-img-element-3>a href#the-img-element>img/a>/code> elementsdd>p>Use a regular code idnon-conforming-features:the-a-element-9>a href#the-a-element>a/a>/code> element to link to the description, or (in the case of images) use an a href#image-map idnon-conforming-features:image-map>image map/a> to provide a link from the image to the images description.dt>dfn idattr-img-lowsrc>code>lowsrc/code>/dfn> on code idnon-conforming-features:the-img-element-4>a href#the-img-element>img/a>/code> elementsdd>p>Use a progressive JPEG image (given in the code idnon-conforming-features:attr-img-src>a href#attr-img-src>src/a>/code> attribute), instead of using two separate images.dt>dfn idattr-link-target>code>target/code>/dfn> on code idnon-conforming-features:the-link-element-5>a href#the-link-element>link/a>/code> elementsdd>p>Unnecessary. Omit it altogether.dt>dfn idattr-menu-type>code>type/code>/dfn> on code idnon-conforming-features:the-menu-element>a href#the-menu-element>menu/a>/code> elementsdd>p>To implement a custom context menu, use script to handle the code idnon-conforming-features:event-contextmenu-2>a href#event-contextmenu>contextmenu/a>/code> event. For toolbar menus, omit the attribute.dt>dfn idattr-menu-label>code>label/code>/dfn> on code idnon-conforming-features:the-menu-element-2>a href#the-menu-element>menu/a>/code> elementsdt>dfn idattr-contextmenu>code>contextmenu/code>/dfn> on all elementsdt>dfn idhandler-onshow>code>onshow/code>/dfn> on all elementsdd>p>To implement a custom context menu, use script to handle the code idnon-conforming-features:event-contextmenu-3>a href#event-contextmenu>contextmenu/a>/code> event.dt>dfn idattr-meta-scheme>code>scheme/code>/dfn> on code idnon-conforming-features:the-meta-element>a href#the-meta-element>meta/a>/code> elementsdd>p>Use only one scheme per field, or make the scheme declaration part of the value.dt>dfn idattr-object-archive>code>archive/code>/dfn> on code idnon-conforming-features:the-object-element-3>a href#the-object-element>object/a>/code> elementsdt>dfn idattr-object-classid>code>classid/code>/dfn> on code idnon-conforming-features:the-object-element-4>a href#the-object-element>object/a>/code> elementsdt>dfn idattr-object-code>code>code/code>/dfn> on code idnon-conforming-features:the-object-element-5>a href#the-object-element>object/a>/code> elementsdt>dfn idattr-object-codebase>code>codebase/code>/dfn> on code idnon-conforming-features:the-object-element-6>a href#the-object-element>object/a>/code> elementsdt>dfn idattr-object-codetype>code>codetype/code>/dfn> on code idnon-conforming-features:the-object-element-7>a href#the-object-element>object/a>/code> elementsdd>p>Use the code idnon-conforming-features:attr-object-data>a href#attr-object-data>data/a>/code> and code idnon-conforming-features:attr-object-type>a href#attr-object-type>type/a>/code> attributes to invoke a href#plugin idnon-conforming-features:plugin>plugins/a>. To set parameters with these names in particular, the code idnon-conforming-features:the-param-element>a href#the-param-element>param/a>/code> element can be used.dt>dfn idattr-object-declare>code>declare/code>/dfn> on code idnon-conforming-features:the-object-element-8>a href#the-object-element>object/a>/code> elementsdd>p>Repeat the code idnon-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 idattr-object-standby>code>standby/code>/dfn> on code idnon-conforming-features:the-object-element-10>a href#the-object-element>object/a>/code> elementsdd>p>Optimize the linked resource so that it loads quickly or, at least, incrementally.dt>dfn idattr-param-type>code>type/code>/dfn> on code idnon-conforming-features:the-param-element-2>a href#the-param-element>param/a>/code> elementsdt>dfn idattr-param-valuetype>code>valuetype/code>/dfn> on code idnon-conforming-features:the-param-element-3>a href#the-param-element>param/a>/code> elementsdd>p>Use the code idnon-conforming-features:attr-param-name>a href#attr-param-name>name/a>/code> and code idnon-conforming-features:attr-param-value>a href#attr-param-value>value/a>/code> attributes without declaring value types.dt>dfn idattr-script-language>code>language/code>/dfn> on code idnon-conforming-features:the-script-element-3>a href#the-script-element>script/a>/code> elements (except as noted in the previous section)dd>p>Omit the attribute for JavaScript; for a href#data-block idnon-conforming-features:data-block>data blocks/a>, use the code idnon-conforming-features:attr-script-type>a href#attr-script-type>type/a>/code> attribute instead.dt>dfn idattr-script-event>code>event/code>/dfn> on code idnon-conforming-features:the-script-element-4>a href#the-script-element>script/a>/code> elementsdt>dfn idattr-script-for>code>for/code>/dfn> on code idnon-conforming-features:the-script-element-5>a href#the-script-element>script/a>/code> elementsdd>p>Use DOM events mechanisms to register event listeners. a href#refsDOM>DOM/a>dt>dfn idattr-style-type>code>type/code>/dfn> on code idnon-conforming-features:the-style-element>a href#the-style-element>style/a>/code> elements (except as noted in the previous section)dd>p>Omit the attribute for CSS; for a href#data-block idnon-conforming-features:data-block-2>data blocks/a>, use code idnon-conforming-features:the-script-element-6>a href#the-script-element>script/a>/code> as the container instead of code idnon-conforming-features:the-style-element-2>a href#the-style-element>style/a>/code>.dt>dfn idattr-table-datapagesize>code>datapagesize/code>/dfn> on code idnon-conforming-features:the-table-element>a href#the-table-element>table/a>/code> elementsdd>p>Unnecessary. Omit it altogether.dt>dfn idattr-table-summary>code>summary/code>/dfn> on code idnon-conforming-features:the-table-element-2>a href#the-table-element>table/a>/code> elementsdd>p>Use one of the a href#table-descriptions-techniques>techniques for describing tables/a> given in the code idnon-conforming-features:the-table-element-3>a href#the-table-element>table/a>/code> section instead.dt>dfn idattr-td-abbr>code>abbr/code>/dfn> on code idnon-conforming-features:the-td-element>a href#the-td-element>td/a>/code> elementsdd>p>Use text that begins in an unambiguous and terse manner, and include any more elaborate text after that. The code idnon-conforming-features:attr-title>a href#attr-title>title/a>/code> attribute can also be useful in including more detailed text, so that the cells contents can be made terse. If its a heading, use code idnon-conforming-features:the-th-element>a href#the-th-element>th/a>/code> (which has an code idnon-conforming-features:attr-th-abbr>a href#attr-th-abbr>abbr/a>/code> attribute)./p> dt>dfn idattr-tdth-axis>code>axis/code>/dfn> on code idnon-conforming-features:the-td-element-2>a href#the-td-element>td/a>/code> and code idnon-conforming-features:the-th-element-2>a href#the-th-element>th/a>/code> elementsdd>p>Use the code idnon-conforming-features:attr-th-scope>a href#attr-th-scope>scope/a>/code> attribute on the relevant code idnon-conforming-features:the-th-element-3>a href#the-th-element>th/a>/code>./p> dt>dfn idattr-td-scope>code>scope/code>/dfn> on code idnon-conforming-features:the-td-element-3>a href#the-td-element>td/a>/code> elementsdd>p>Use code idnon-conforming-features:the-th-element-4>a href#the-th-element>th/a>/code> elements for heading cells./p> dt>dfn idattr-datasrc>code>datasrc/code>/dfn> on code idnon-conforming-features:the-a-element-10>a href#the-a-element>a/a>/code>, code idnon-conforming-features:the-button-element>a href#the-button-element>button/a>/code>, code idnon-conforming-features:the-div-element>a href#the-div-element>div/a>/code>, code idnon-conforming-features:frame-2>a href#frame>frame/a>/code>, code idnon-conforming-features:the-iframe-element-3>a href#the-iframe-element>iframe/a>/code>, code idnon-conforming-features:the-img-element-5>a href#the-img-element>img/a>/code>, code idnon-conforming-features:the-input-element-6>a href#the-input-element>input/a>/code>, code idnon-conforming-features:the-label-element>a href#the-label-element>label/a>/code>, code idnon-conforming-features:the-legend-element>a href#the-legend-element>legend/a>/code>, code idnon-conforming-features:the-marquee-element-2>a href#the-marquee-element>marquee/a>/code>, code idnon-conforming-features:the-object-element-11>a href#the-object-element>object/a>/code>, code idnon-conforming-features:the-option-element-2>a href#the-option-element>option/a>/code>, code idnon-conforming-features:the-select-element>a href#the-select-element>select/a>/code>, code idnon-conforming-features:the-span-element>a href#the-span-element>span/a>/code>, code idnon-conforming-features:the-table-element-4>a href#the-table-element>table/a>/code>, and code idnon-conforming-features:the-textarea-element>a href#the-textarea-element>textarea/a>/code> elementsdt>dfn idattr-datafld>code>datafld/code>/dfn> on code idnon-conforming-features:the-a-element-11>a href#the-a-element>a/a>/code>, code idnon-conforming-features:the-button-element-2>a href#the-button-element>button/a>/code>, code idnon-conforming-features:the-div-element-2>a href#the-div-element>div/a>/code>, code idnon-conforming-features:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code>, code idnon-conforming-features:frame-3>a href#frame>frame/a>/code>, code idnon-conforming-features:the-iframe-element-4>a href#the-iframe-element>iframe/a>/code>, code idnon-conforming-features:the-img-element-6>a href#the-img-element>img/a>/code>, code idnon-conforming-features:the-input-element-7>a href#the-input-element>input/a>/code>, code idnon-conforming-features:the-label-element-2>a href#the-label-element>label/a>/code>, code idnon-conforming-features:the-legend-element-2>a href#the-legend-element>legend/a>/code>, code idnon-conforming-features:the-marquee-element-3>a href#the-marquee-element>marquee/a>/code>, code idnon-conforming-features:the-object-element-12>a href#the-object-element>object/a>/code>, code idnon-conforming-features:the-param-element-4>a href#the-param-element>param/a>/code>, code idnon-conforming-features:the-select-element-2>a href#the-select-element>select/a>/code>, code idnon-conforming-features:the-span-element-2>a href#the-span-element>span/a>/code>, and code idnon-conforming-features:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code> elementsdt>dfn idattr-dataformatas>code>dataformatas/code>/dfn> on code idnon-conforming-features:the-button-element-3>a href#the-button-element>button/a>/code>, code idnon-conforming-features:the-div-element-3>a href#the-div-element>div/a>/code>, code idnon-conforming-features:the-input-element-8>a href#the-input-element>input/a>/code>, code idnon-conforming-features:the-label-element-3>a href#the-label-element>label/a>/code>, code idnon-conforming-features:the-legend-element-3>a href#the-legend-element>legend/a>/code>, code idnon-conforming-features:the-marquee-element-4>a href#the-marquee-element>marquee/a>/code>, code idnon-conforming-features:the-object-element-13>a href#the-object-element>object/a>/code>, code idnon-conforming-features:the-option-element-3>a href#the-option-element>option/a>/code>, code idnon-conforming-features:the-select-element-3>a href#the-select-element>select/a>/code>, code idnon-conforming-features:the-span-element-3>a href#the-span-element>span/a>/code>, and code idnon-conforming-features:the-table-element-5>a href#the-table-element>table/a>/code> elementsdd>p>Use script and a mechanism such as code idnon-conforming-features:xmlhttprequest>a data-x-internalxmlhttprequest hrefhttps://xhr.spec.whatwg.org/#xmlhttprequest>XMLHttpRequest/a>/code> to populate the page dynamically. a href#refsXHR>XHR/a>dt>dfn idattr-dropzone>code>dropzone/code>/dfn> on all elementsdd>p>Use script to handle the code idnon-conforming-features:event-dnd-dragenter>a href#event-dnd-dragenter>dragenter/a>/code> and code idnon-conforming-features:event-dnd-dragover>a href#event-dnd-dragover>dragover/a>/code> events instead.dt>dfn idattr-body-alink>code>alink/code>/dfn> on code idnon-conforming-features:the-body-element>a href#the-body-element>body/a>/code> elementsdt>dfn idattr-body-bgcolor>code>bgcolor/code>/dfn> on code idnon-conforming-features:the-body-element-2>a href#the-body-element>body/a>/code> elementsdt>dfn idattr-body-bottommargin>code>bottommargin/code>/dfn> on code idnon-conforming-features:the-body-element-3>a href#the-body-element>body/a>/code> elementsdt>dfn idattr-body-leftmargin>code>leftmargin/code>/dfn> on code idnon-conforming-features:the-body-element-4>a href#the-body-element>body/a>/code> elementsdt>dfn idattr-body-link>code>link/code>/dfn> on code idnon-conforming-features:the-body-element-5>a href#the-body-element>body/a>/code> elementsdt>dfn idattr-body-marginheight>code>marginheight/code>/dfn> on code idnon-conforming-features:the-body-element-6>a href#the-body-element>body/a>/code> elementsdt>dfn idattr-body-marginwidth>code>marginwidth/code>/dfn> on code idnon-conforming-features:the-body-element-7>a href#the-body-element>body/a>/code> elementsdt>dfn idattr-body-rightmargin>code>rightmargin/code>/dfn> on code idnon-conforming-features:the-body-element-8>a href#the-body-element>body/a>/code> elementsdt>dfn idattr-body-text>code>text/code>/dfn> on code idnon-conforming-features:the-body-element-9>a href#the-body-element>body/a>/code> elementsdt>dfn idattr-body-topmargin>code>margintop/code>/dfn> on code idnon-conforming-features:the-body-element-10>a href#the-body-element>body/a>/code> elementsdt>dfn idattr-body-vlink>code>vlink/code>/dfn> on code idnon-conforming-features:the-body-element-11>a href#the-body-element>body/a>/code> elementsdt>dfn idattr-br-clear>code>clear/code>/dfn> on code idnon-conforming-features:the-br-element>a href#the-br-element>br/a>/code> elementsdt>dfn idattr-caption-align>code>align/code>/dfn> on code idnon-conforming-features:the-caption-element>a href#the-caption-element>caption/a>/code> elementsdt>dfn idattr-col-align>code>align/code>/dfn> on code idnon-conforming-features:the-col-element>a href#the-col-element>col/a>/code> elementsdt>dfn idattr-col-char>code>char/code>/dfn> on code idnon-conforming-features:the-col-element-2>a href#the-col-element>col/a>/code> elementsdt>dfn idattr-col-charoff>code>charoff/code>/dfn> on code idnon-conforming-features:the-col-element-3>a href#the-col-element>col/a>/code> elementsdt>dfn idattr-col-valign>code>valign/code>/dfn> on code idnon-conforming-features:the-col-element-4>a href#the-col-element>col/a>/code> elementsdt>dfn idattr-col-width>code>width/code>/dfn> on code idnon-conforming-features:the-col-element-5>a href#the-col-element>col/a>/code> elementsdt>dfn idattr-div-align>code>align/code>/dfn> on code idnon-conforming-features:the-div-element-4>a href#the-div-element>div/a>/code> elementsdt>dfn idattr-dl-compact>code>compact/code>/dfn> on code idnon-conforming-features:the-dl-element>a href#the-dl-element>dl/a>/code> elementsdt>dfn idattr-embed-align>code>align/code>/dfn> on code idnon-conforming-features:the-embed-element-4>a href#the-embed-element>embed/a>/code> elementsdt>dfn idattr-embed-hspace>code>hspace/code>/dfn> on code idnon-conforming-features:the-embed-element-5>a href#the-embed-element>embed/a>/code> elementsdt>dfn idattr-embed-vspace>code>vspace/code>/dfn> on code idnon-conforming-features:the-embed-element-6>a href#the-embed-element>embed/a>/code> elementsdt>dfn idattr-hr-align>code>align/code>/dfn> on code idnon-conforming-features:the-hr-element>a href#the-hr-element>hr/a>/code> elementsdt>dfn idattr-hr-color>code>color/code>/dfn> on code idnon-conforming-features:the-hr-element-2>a href#the-hr-element>hr/a>/code> elementsdt>dfn idattr-hr-noshade>code>noshade/code>/dfn> on code idnon-conforming-features:the-hr-element-3>a href#the-hr-element>hr/a>/code> elementsdt>dfn idattr-hr-size>code>size/code>/dfn> on code idnon-conforming-features:the-hr-element-4>a href#the-hr-element>hr/a>/code> elementsdt>dfn idattr-hr-width>code>width/code>/dfn> on code idnon-conforming-features:the-hr-element-5>a href#the-hr-element>hr/a>/code> elementsdt>dfn idattr-hx-align>code>align/code>/dfn> on code idnon-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 idnon-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> elementsdt>dfn idattr-iframe-align>code>align/code>/dfn> on code idnon-conforming-features:the-iframe-element-5>a href#the-iframe-element>iframe/a>/code> elementsdt>dfn idattr-iframe-allowtransparency>code>allowtransparency/code>/dfn> on code idnon-conforming-features:the-iframe-element-6>a href#the-iframe-element>iframe/a>/code> elementsdt>dfn idattr-iframe-frameborder>code>frameborder/code>/dfn> on code idnon-conforming-features:the-iframe-element-7>a href#the-iframe-element>iframe/a>/code> elementsdt>dfn idattr-iframe-framespacing>code>framespacing/code>/dfn> on code idnon-conforming-features:the-iframe-element-8>a href#the-iframe-element>iframe/a>/code> elementsdt>dfn idattr-iframe-hspace>code>hspace/code>/dfn> on code idnon-conforming-features:the-iframe-element-9>a href#the-iframe-element>iframe/a>/code> elementsdt>dfn idattr-iframe-marginheight>code>marginheight/code>/dfn> on code idnon-conforming-features:the-iframe-element-10>a href#the-iframe-element>iframe/a>/code> elementsdt>dfn idattr-iframe-marginwidth>code>marginwidth/code>/dfn> on code idnon-conforming-features:the-iframe-element-11>a href#the-iframe-element>iframe/a>/code> elementsdt>dfn idattr-iframe-scrolling>code>scrolling/code>/dfn> on code idnon-conforming-features:the-iframe-element-12>a href#the-iframe-element>iframe/a>/code> elementsdt>dfn idattr-iframe-vspace>code>vspace/code>/dfn> on code idnon-conforming-features:the-iframe-element-13>a href#the-iframe-element>iframe/a>/code> elementsdt>dfn idattr-input-align>code>align/code>/dfn> on code idnon-conforming-features:the-input-element-9>a href#the-input-element>input/a>/code> elementsdt>dfn idattr-input-border>code>border/code>/dfn> on code idnon-conforming-features:the-input-element-10>a href#the-input-element>input/a>/code> elementsdt>dfn idattr-input-hspace>code>hspace/code>/dfn> on code idnon-conforming-features:the-input-element-11>a href#the-input-element>input/a>/code> elementsdt>dfn idattr-input-vspace>code>vspace/code>/dfn> on code idnon-conforming-features:the-input-element-12>a href#the-input-element>input/a>/code> elementsdt>dfn idattr-img-align>code>align/code>/dfn> on code idnon-conforming-features:the-img-element-7>a href#the-img-element>img/a>/code> elementsdt>dfn idattr-img-border>code>border/code>/dfn> on code idnon-conforming-features:the-img-element-8>a href#the-img-element>img/a>/code> elements (except as noted in the previous section)dt>dfn idattr-img-hspace>code>hspace/code>/dfn> on code idnon-conforming-features:the-img-element-9>a href#the-img-element>img/a>/code> elementsdt>dfn idattr-img-vspace>code>vspace/code>/dfn> on code idnon-conforming-features:the-img-element-10>a href#the-img-element>img/a>/code> elementsdt>dfn idattr-legend-align>code>align/code>/dfn> on code idnon-conforming-features:the-legend-element-4>a href#the-legend-element>legend/a>/code> elementsdt>dfn idattr-li-type>code>type/code>/dfn> on code idnon-conforming-features:the-li-element>a href#the-li-element>li/a>/code> elementsdt>dfn idattr-menu-compact>code>compact/code>/dfn> on code idnon-conforming-features:the-menu-element-3>a href#the-menu-element>menu/a>/code> elementsdt>dfn idattr-object-align>code>align/code>/dfn> on code idnon-conforming-features:the-object-element-14>a href#the-object-element>object/a>/code> elementsdt>dfn idattr-object-border>code>border/code>/dfn> on code idnon-conforming-features:the-object-element-15>a href#the-object-element>object/a>/code> elementsdt>dfn idattr-object-hspace>code>hspace/code>/dfn> on code idnon-conforming-features:the-object-element-16>a href#the-object-element>object/a>/code> elementsdt>dfn idattr-object-vspace>code>vspace/code>/dfn> on code idnon-conforming-features:the-object-element-17>a href#the-object-element>object/a>/code> elementsdt>dfn idattr-ol-compact>code>compact/code>/dfn> on code idnon-conforming-features:the-ol-element>a href#the-ol-element>ol/a>/code> elementsdt>dfn idattr-p-align>code>align/code>/dfn> on code idnon-conforming-features:the-p-element>a href#the-p-element>p/a>/code> elementsdt>dfn idattr-pre-width>code>width/code>/dfn> on code idnon-conforming-features:the-pre-element-3>a href#the-pre-element>pre/a>/code> elementsdt>dfn idattr-table-align>code>align/code>/dfn> on code idnon-conforming-features:the-table-element-6>a href#the-table-element>table/a>/code> elementsdt>dfn idattr-table-bgcolor>code>bgcolor/code>/dfn> on code idnon-conforming-features:the-table-element-7>a href#the-table-element>table/a>/code> elementsdt>dfn idattr-table-border>code>border/code>/dfn> on code idnon-conforming-features:the-table-element-8>a href#the-table-element>table/a>/code> elementsdt>dfn idattr-table-bordercolor>code>bordercolor/code>/dfn> on code idnon-conforming-features:the-table-element-9>a href#the-table-element>table/a>/code> elementsdt>dfn idattr-table-cellpadding>code>cellpadding/code>/dfn> on code idnon-conforming-features:the-table-element-10>a href#the-table-element>table/a>/code> elementsdt>dfn idattr-table-cellspacing>code>cellspacing/code>/dfn> on code idnon-conforming-features:the-table-element-11>a href#the-table-element>table/a>/code> elementsdt>dfn idattr-table-frame>code>frame/code>/dfn> on code idnon-conforming-features:the-table-element-12>a href#the-table-element>table/a>/code> elementsdt>dfn idattr-table-height>code>height/code>/dfn> on code idnon-conforming-features:the-table-element-13>a href#the-table-element>table/a>/code> elementsdt>dfn idattr-table-rules>code>rules/code>/dfn> on code idnon-conforming-features:the-table-element-14>a href#the-table-element>table/a>/code> elementsdt>dfn idattr-table-width>code>width/code>/dfn> on code idnon-conforming-features:the-table-element-15>a href#the-table-element>table/a>/code> elementsdt>dfn idattr-tbody-align>code>align/code>/dfn> on code idnon-conforming-features:the-tbody-element>a href#the-tbody-element>tbody/a>/code>, code idnon-conforming-features:the-thead-element>a href#the-thead-element>thead/a>/code>, and code idnon-conforming-features:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code> elementsdt>dfn idattr-tbody-char>code>char/code>/dfn> on code idnon-conforming-features:the-tbody-element-2>a href#the-tbody-element>tbody/a>/code>, code idnon-conforming-features:the-thead-element-2>a href#the-thead-element>thead/a>/code>, and code idnon-conforming-features:the-tfoot-element-2>a href#the-tfoot-element>tfoot/a>/code> elementsdt>dfn idattr-tbody-charoff>code>charoff/code>/dfn> on code idnon-conforming-features:the-tbody-element-3>a href#the-tbody-element>tbody/a>/code>, code idnon-conforming-features:the-thead-element-3>a href#the-thead-element>thead/a>/code>, and code idnon-conforming-features:the-tfoot-element-3>a href#the-tfoot-element>tfoot/a>/code> elementsdt>dfn idattr-tbody-valign>code>valign/code>/dfn> on code idnon-conforming-features:the-tbody-element-4>a href#the-tbody-element>tbody/a>/code>, code idnon-conforming-features:the-thead-element-4>a href#the-thead-element>thead/a>/code>, and code idnon-conforming-features:the-tfoot-element-4>a href#the-tfoot-element>tfoot/a>/code> elementsdt>dfn idattr-tdth-align>code>align/code>/dfn> on code idnon-conforming-features:the-td-element-4>a href#the-td-element>td/a>/code> and code idnon-conforming-features:the-th-element-5>a href#the-th-element>th/a>/code> elementsdt>dfn idattr-tdth-bgcolor>code>bgcolor/code>/dfn> on code idnon-conforming-features:the-td-element-5>a href#the-td-element>td/a>/code> and code idnon-conforming-features:the-th-element-6>a href#the-th-element>th/a>/code> elementsdt>dfn idattr-tdth-char>code>char/code>/dfn> on code idnon-conforming-features:the-td-element-6>a href#the-td-element>td/a>/code> and code idnon-conforming-features:the-th-element-7>a href#the-th-element>th/a>/code> elementsdt>dfn idattr-tdth-charoff>code>charoff/code>/dfn> on code idnon-conforming-features:the-td-element-7>a href#the-td-element>td/a>/code> and code idnon-conforming-features:the-th-element-8>a href#the-th-element>th/a>/code> elementsdt>dfn idattr-tdth-height>code>height/code>/dfn> on code idnon-conforming-features:the-td-element-8>a href#the-td-element>td/a>/code> and code idnon-conforming-features:the-th-element-9>a href#the-th-element>th/a>/code> elementsdt>dfn idattr-tdth-nowrap>code>nowrap/code>/dfn> on code idnon-conforming-features:the-td-element-9>a href#the-td-element>td/a>/code> and code idnon-conforming-features:the-th-element-10>a href#the-th-element>th/a>/code> elementsdt>dfn idattr-tdth-valign>code>valign/code>/dfn> on code idnon-conforming-features:the-td-element-10>a href#the-td-element>td/a>/code> and code idnon-conforming-features:the-th-element-11>a href#the-th-element>th/a>/code> elementsdt>dfn idattr-tdth-width>code>width/code>/dfn> on code idnon-conforming-features:the-td-element-11>a href#the-td-element>td/a>/code> and code idnon-conforming-features:the-th-element-12>a href#the-th-element>th/a>/code> elementsdt>dfn idattr-tr-align>code>align/code>/dfn> on code idnon-conforming-features:the-tr-element>a href#the-tr-element>tr/a>/code> elementsdt>dfn idattr-tr-bgcolor>code>bgcolor/code>/dfn> on code idnon-conforming-features:the-tr-element-2>a href#the-tr-element>tr/a>/code> elementsdt>dfn idattr-tr-char>code>char/code>/dfn> on code idnon-conforming-features:the-tr-element-3>a href#the-tr-element>tr/a>/code> elementsdt>dfn idattr-tr-charoff>code>charoff/code>/dfn> on code idnon-conforming-features:the-tr-element-4>a href#the-tr-element>tr/a>/code> elementsdt>dfn idattr-tr-height>code>height/code>/dfn> on code idnon-conforming-features:the-tr-element-5>a href#the-tr-element>tr/a>/code> elementsdt>dfn idattr-tr-valign>code>valign/code>/dfn> on code idnon-conforming-features:the-tr-element-6>a href#the-tr-element>tr/a>/code> elementsdt>dfn idattr-ul-compact>code>compact/code>/dfn> on code idnon-conforming-features:the-ul-element-2>a href#the-ul-element>ul/a>/code> elementsdt>dfn idattr-ul-type>code>type/code>/dfn> on code idnon-conforming-features:the-ul-element-3>a href#the-ul-element>ul/a>/code> elementsdt>dfn idattr-background>code>background/code>/dfn> on code idnon-conforming-features:the-body-element-12>a href#the-body-element>body/a>/code>, code idnon-conforming-features:the-table-element-16>a href#the-table-element>table/a>/code>, code idnon-conforming-features:the-thead-element-5>a href#the-thead-element>thead/a>/code>, code idnon-conforming-features:the-tbody-element-5>a href#the-tbody-element>tbody/a>/code>, code idnon-conforming-features:the-tfoot-element-5>a href#the-tfoot-element>tfoot/a>/code>, code idnon-conforming-features:the-tr-element-7>a href#the-tr-element>tr/a>/code>, code idnon-conforming-features:the-td-element-12>a href#the-td-element>td/a>/code>, and code idnon-conforming-features:the-th-element-13>a href#the-th-element>th/a>/code> elementsdd>p>Use CSS instead./dl> h3 idrequirements-for-implementations>span classsecno>15.3/span> Requirements for implementationsa href#requirements-for-implementations classself-link>/a>/h3> h4 idthe-marquee-element>span classsecno>15.3.1/span> The dfn>code>marquee/code>/dfn> elementa href#the-marquee-element classself-link>/a>/h4> p>The code idthe-marquee-element:the-marquee-element>a href#the-marquee-element>marquee/a>/code> element is a presentational element that animates content. CSS transitions and animations are a more appropriate mechanism. a href#refsCSSANIMATIONS>CSSANIMATIONS/a> a href#refsCSSTRANSITIONS>CSSTRANSITIONS/a>/p> p>The a href#task-source idthe-marquee-element:task-source>task source/a> for tasks mentioned in this section is the a href#dom-manipulation-task-source idthe-marquee-element:dom-manipulation-task-source>DOM manipulation task source/a>./p> p>The code idthe-marquee-element:the-marquee-element-2>a href#the-marquee-element>marquee/a>/code> element must implement the code idthe-marquee-element:htmlmarqueeelement>a href#htmlmarqueeelement>HTMLMarqueeElement/a>/code> interface./p> pre classidl>ExposedWindow, a href#htmlconstructor idthe-marquee-element:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlmarqueeelement>HTMLMarqueeElement/dfn> : a href#htmlelement idthe-marquee-element:htmlelement>HTMLElement/a> { a href#cereactions idthe-marquee-element:cereactions>CEReactions/a> attribute DOMString a href#dom-marquee-behavior idthe-marquee-element:dom-marquee-behavior>behavior/a>; a href#cereactions idthe-marquee-element:cereactions-2>CEReactions/a> attribute DOMString a href#dom-marquee-bgcolor idthe-marquee-element:dom-marquee-bgcolor>bgColor/a>; a href#cereactions idthe-marquee-element:cereactions-3>CEReactions/a> attribute DOMString a href#dom-marquee-direction idthe-marquee-element:dom-marquee-direction>direction/a>; a href#cereactions idthe-marquee-element:cereactions-4>CEReactions/a> attribute DOMString a href#dom-marquee-height idthe-marquee-element:dom-marquee-height>height/a>; a href#cereactions idthe-marquee-element:cereactions-5>CEReactions/a> attribute unsigned long a href#dom-marquee-hspace idthe-marquee-element:dom-marquee-hspace>hspace/a>; a href#cereactions idthe-marquee-element:cereactions-6>CEReactions/a> attribute long a href#dom-marquee-loop idthe-marquee-element:dom-marquee-loop>loop/a>; a href#cereactions idthe-marquee-element:cereactions-7>CEReactions/a> attribute unsigned long a href#dom-marquee-scrollamount idthe-marquee-element:dom-marquee-scrollamount>scrollAmount/a>; a href#cereactions idthe-marquee-element:cereactions-8>CEReactions/a> attribute unsigned long a href#dom-marquee-scrolldelay idthe-marquee-element:dom-marquee-scrolldelay>scrollDelay/a>; a href#cereactions idthe-marquee-element:cereactions-9>CEReactions/a> attribute boolean a href#dom-marquee-truespeed idthe-marquee-element:dom-marquee-truespeed>trueSpeed/a>; a href#cereactions idthe-marquee-element:cereactions-10>CEReactions/a> attribute unsigned long a href#dom-marquee-vspace idthe-marquee-element:dom-marquee-vspace>vspace/a>; a href#cereactions idthe-marquee-element:cereactions-11>CEReactions/a> attribute DOMString a href#dom-marquee-width idthe-marquee-element:dom-marquee-width>width/a>; attribute a href#eventhandler idthe-marquee-element:eventhandler>EventHandler/a> a href#handler-marquee-onbounce idthe-marquee-element:handler-marquee-onbounce>onbounce/a>; attribute a href#eventhandler idthe-marquee-element:eventhandler-2>EventHandler/a> a href#handler-marquee-onfinish idthe-marquee-element:handler-marquee-onfinish>onfinish/a>; attribute a href#eventhandler idthe-marquee-element:eventhandler-3>EventHandler/a> a href#handler-marquee-onstart idthe-marquee-element:handler-marquee-onstart>onstart/a>; void a href#dom-marquee-start idthe-marquee-element:dom-marquee-start>start/a>(); void a href#dom-marquee-stop idthe-marquee-element:dom-marquee-stop>stop/a>();};/pre> p>A code idthe-marquee-element:the-marquee-element-3>a href#the-marquee-element>marquee/a>/code> element can be dfn idconcept-marquee-on>turned on/dfn> or dfn idconcept-marquee-off>turned off/dfn>. When it is created, it is a href#concept-marquee-on idthe-marquee-element:concept-marquee-on>turned on/a>./p> p>When the dfn iddom-marquee-start>code>start()/code>/dfn> method is called, the code idthe-marquee-element:the-marquee-element-4>a href#the-marquee-element>marquee/a>/code> element must be a href#concept-marquee-on idthe-marquee-element:concept-marquee-on-2>turned on/a>./p> p>When the dfn iddom-marquee-stop>code>stop()/code>/dfn> method is called, the code idthe-marquee-element:the-marquee-element-5>a href#the-marquee-element>marquee/a>/code> element must be a href#concept-marquee-off idthe-marquee-element:concept-marquee-off>turned off/a>./p> p>When a code idthe-marquee-element:the-marquee-element-6>a href#the-marquee-element>marquee/a>/code> element is created, the user agent must a href#queue-a-task idthe-marquee-element:queue-a-task>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-marquee-element:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code>start/code> at the element./p> hr> p>The dfn idattr-marquee-behavior>code>behavior/code>/dfn> content attribute on code idthe-marquee-element:the-marquee-element-7>a href#the-marquee-element>marquee/a>/code> elements is an a href#enumerated-attribute idthe-marquee-element:enumerated-attribute>enumerated attribute/a> with the following keywords (all non-conforming):/p> table>thead>tr>th>Keyword th>State tbody>tr>td>code>scroll/code> td>dfn idattr-marquee-behavior-scroll>scroll/dfn> tr>td>code>slide/code> td>dfn idattr-marquee-behavior-slide>slide/dfn> tr>td>code>alternate/code> td>dfn idattr-marquee-behavior-alternate>alternate/dfn> /table> p>The i idthe-marquee-element:missing-value-default>a href#missing-value-default>missing value default/a>/i> is the a href#attr-marquee-behavior-scroll idthe-marquee-element:attr-marquee-behavior-scroll>scroll/a> state./p> hr> p>The dfn idattr-marquee-direction>code>direction/code>/dfn> content attribute on code idthe-marquee-element:the-marquee-element-8>a href#the-marquee-element>marquee/a>/code> elements is an a href#enumerated-attribute idthe-marquee-element:enumerated-attribute-2>enumerated attribute/a> with the following keywords (all non-conforming):/p> table>thead>tr>th>Keyword th>State tbody>tr>td>code>left/code> td>dfn idattr-marquee-direction-left>left/dfn> tr>td>code>right/code> td>dfn idattr-marquee-direction-right>right/dfn> tr>td>code>up/code> td>dfn idattr-marquee-direction-up>up/dfn> tr>td>code>down/code> td>dfn idattr-marquee-direction-down>down/dfn> /table> p>The i idthe-marquee-element:missing-value-default-2>a href#missing-value-default>missing value default/a>/i> is the a href#attr-marquee-direction-left idthe-marquee-element:attr-marquee-direction-left>left/a> state./p> hr> p>The dfn idattr-marquee-truespeed>code>truespeed/code>/dfn> content attribute on code idthe-marquee-element:the-marquee-element-9>a href#the-marquee-element>marquee/a>/code> elements is a a href#boolean-attribute idthe-marquee-element:boolean-attribute>boolean attribute/a>./p> hr> p>A code idthe-marquee-element:the-marquee-element-10>a href#the-marquee-element>marquee/a>/code> element has a dfn idmarquee-scroll-interval>marquee scroll interval/dfn>, which is obtained as follows:/p> ol>li>p>If the element has a code>scrolldelay/code> attribute, and parsing its value using the a href#rules-for-parsing-non-negative-integers idthe-marquee-element:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers/a> does not return an error, then let var>delay/var> be the parsed value. Otherwise, let var>delay/var> be 85.li>p>If the element does not have a code idthe-marquee-element:attr-marquee-truespeed>a href#attr-marquee-truespeed>truespeed/a>/code> attribute, and the var>delay/var> value is less than 60, then let var>delay/var> be 60 instead.li>p>The a href#marquee-scroll-interval idthe-marquee-element:marquee-scroll-interval>marquee scroll interval/a> is var>delay/var>, interpreted in milliseconds./ol> hr> p>A code idthe-marquee-element:the-marquee-element-11>a href#the-marquee-element>marquee/a>/code> element has a dfn idmarquee-scroll-distance>marquee scroll distance/dfn>, which, if the element has a code>scrollamount/code> attribute, and parsing its value using the a href#rules-for-parsing-non-negative-integers idthe-marquee-element:rules-for-parsing-non-negative-integers-2>rules for parsing non-negative integers/a> does not return an error, is the parsed value interpreted in a hrefhttps://drafts.csswg.org/css-values/#px idthe-marquee-element:px data-x-internalpx>CSS pixels/a>, and otherwise is 6 a hrefhttps://drafts.csswg.org/css-values/#px idthe-marquee-element:px-2 data-x-internalpx>CSS pixels/a>./p> hr> p>A code idthe-marquee-element:the-marquee-element-12>a href#the-marquee-element>marquee/a>/code> element has a dfn idmarquee-loop-count>marquee loop count/dfn>, which, if the element has a dfn idattr-marquee-loop>code>loop/code>/dfn> attribute, and parsing its value using the a href#rules-for-parsing-integers idthe-marquee-element:rules-for-parsing-integers>rules for parsing integers/a> does not return an error or a number less than 1, is the parsed value, and otherwise is −1./p> p>The dfn iddom-marquee-loop>code>loop/code>/dfn> IDL attribute, on getting, must return the elements a href#marquee-loop-count idthe-marquee-element:marquee-loop-count>marquee loop count/a>; and on setting, if the new value is different than the elements a href#marquee-loop-count idthe-marquee-element:marquee-loop-count-2>marquee loop count/a> and either greater than zero or equal to −1, must set the elements code idthe-marquee-element:attr-marquee-loop>a href#attr-marquee-loop>loop/a>/code> content attribute (adding it if necessary) to the a href#valid-integer idthe-marquee-element:valid-integer>valid integer/a> that represents the new value. (Other values are ignored.)/p> p>A code idthe-marquee-element:the-marquee-element-13>a href#the-marquee-element>marquee/a>/code> element also has a dfn idmarquee-current-loop-index>marquee current loop index/dfn>, which is zero when the element is created./p> p>The rendering layer will occasionally dfn idincrement-the-marquee-current-loop-index>increment the marquee current loop index/dfn>, which must cause the following steps to be run:/p> ol>li>p>If the a href#marquee-loop-count idthe-marquee-element:marquee-loop-count-3>marquee loop count/a> is −1, then abort these steps./p> li>p>Increment the a href#marquee-current-loop-index idthe-marquee-element:marquee-current-loop-index>marquee current loop index/a> by one.li> p>If the a href#marquee-current-loop-index idthe-marquee-element:marquee-current-loop-index-2>marquee current loop index/a> is now equal to or greater than the elements a href#marquee-loop-count idthe-marquee-element:marquee-loop-count-4>marquee loop count/a>, a href#concept-marquee-off idthe-marquee-element:concept-marquee-off-2>turn off/a> the code idthe-marquee-element:the-marquee-element-14>a href#the-marquee-element>marquee/a>/code> element and a href#queue-a-task idthe-marquee-element:queue-a-task-2>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-marquee-element:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code>finish/code> at the code idthe-marquee-element:the-marquee-element-15>a href#the-marquee-element>marquee/a>/code> element./p> p>Otherwise, if the code idthe-marquee-element:attr-marquee-behavior>a href#attr-marquee-behavior>behavior/a>/code> attribute is in the a href#attr-marquee-behavior-alternate idthe-marquee-element:attr-marquee-behavior-alternate>alternate/a> state, then a href#queue-a-task idthe-marquee-element:queue-a-task-3>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-marquee-element:concept-event-fire-3 data-x-internalconcept-event-fire>fire an event/a> named code>bounce/code> at the code idthe-marquee-element:the-marquee-element-16>a href#the-marquee-element>marquee/a>/code> element./p> p>Otherwise, a href#queue-a-task idthe-marquee-element:queue-a-task-4>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idthe-marquee-element:concept-event-fire-4 data-x-internalconcept-event-fire>fire an event/a> named code>start/code> at the code idthe-marquee-element:the-marquee-element-17>a href#the-marquee-element>marquee/a>/code> element./p> /ol> hr> p>The following are the a href#event-handlers idthe-marquee-element:event-handlers>event handlers/a> (and their corresponding a href#event-handler-event-type idthe-marquee-element:event-handler-event-type>event handler event types/a>) that must be supported, as a href#event-handler-content-attributes idthe-marquee-element:event-handler-content-attributes>event handler content attributes/a> and a href#event-handler-idl-attributes idthe-marquee-element:event-handler-idl-attributes>event handler IDL attributes/a>, by code idthe-marquee-element:the-marquee-element-18>a href#the-marquee-element>marquee/a>/code> elements:/p> table>thead>tr>th>a href#event-handlers idthe-marquee-element:event-handlers-2>Event handler/a> th>a href#event-handler-event-type idthe-marquee-element:event-handler-event-type-2>Event handler event type/a> tbody>tr>td>dfn idhandler-marquee-onbounce>code>onbounce/code>/dfn> td> code>bounce/code> tr>td>dfn idhandler-marquee-onfinish>code>onfinish/code>/dfn> td> code>finish/code> tr>td>dfn idhandler-marquee-onstart>code>onstart/code>/dfn> td> code>start/code> /table> hr> p>The dfn iddom-marquee-behavior>code>behavior/code>/dfn>, dfn iddom-marquee-direction>code>direction/code>/dfn>, dfn iddom-marquee-height>code>height/code>/dfn>, dfn iddom-marquee-hspace>code>hspace/code>/dfn>, dfn iddom-marquee-vspace>code>vspace/code>/dfn>, and dfn iddom-marquee-width>code>width/code>/dfn> IDL attributes must a href#reflect idthe-marquee-element:reflect>reflect/a> the respective content attributes of the same name./p> p>The dfn iddom-marquee-bgcolor>code>bgColor/code>/dfn> IDL attribute must a href#reflect idthe-marquee-element:reflect-2>reflect/a> the code>bgcolor/code> content attribute./p> p>The dfn iddom-marquee-scrollamount>code>scrollAmount/code>/dfn> IDL attribute must a href#reflect idthe-marquee-element:reflect-3>reflect/a> the code>scrollamount/code> content attribute. The default value is 6./p> p>The dfn iddom-marquee-scrolldelay>code>scrollDelay/code>/dfn> IDL attribute must a href#reflect idthe-marquee-element:reflect-4>reflect/a> the code>scrolldelay/code> content attribute. The default value is 85./p> p>The dfn iddom-marquee-truespeed>code>trueSpeed/code>/dfn> IDL attribute must a href#reflect idthe-marquee-element:reflect-5>reflect/a> the code idthe-marquee-element:attr-marquee-truespeed-2>a href#attr-marquee-truespeed>truespeed/a>/code> content attribute./p> h4 idframes>span classsecno>15.3.2/span> Framesa href#frames classself-link>/a>/h4> p>The dfn idframeset data-dfn-typeelement data-export>code>frameset/code>/dfn> element acts as a href#the-body-element-2 idframes:the-body-element-2>the body element/a> in documents that use frames./p> p>The code idframes:frameset>a href#frameset>frameset/a>/code> element must implement the code idframes:htmlframesetelement>a href#htmlframesetelement>HTMLFrameSetElement/a>/code> interface./p> pre classidl>ExposedWindow, a href#htmlconstructor idframes:htmlconstructor>HTMLConstructor/a>interface dfn idhtmlframesetelement>HTMLFrameSetElement/dfn> : a href#htmlelement idframes:htmlelement>HTMLElement/a> { a href#cereactions idframes:cereactions>CEReactions/a> attribute DOMString a href#dom-frameset-cols idframes:dom-frameset-cols>cols/a>; a href#cereactions idframes:cereactions-2>CEReactions/a> attribute DOMString a href#dom-frameset-rows idframes:dom-frameset-rows>rows/a>;};a href#htmlframesetelement idframes:htmlframesetelement-2>HTMLFrameSetElement/a> implements a href#windoweventhandlers idframes:windoweventhandlers>WindowEventHandlers/a>;/pre> p>The dfn iddom-frameset-cols>code>cols/code>/dfn> and dfn iddom-frameset-rows>code>rows/code>/dfn> IDL attributes of the code idframes:frameset-2>a href#frameset>frameset/a>/code> element must a href#reflect idframes:reflect>reflect/a> the respective content attributes of the same name./p> p>The code idframes:frameset-3>a href#frameset>frameset/a>/code> element exposes as a href#event-handler-content-attributes idframes:event-handler-content-attributes>event handler content attributes/a> a number of the a href#event-handlers idframes:event-handlers>event handlers/a> of the code idframes:window>a href#window>Window/a>/code> object. It also mirrors their a href#event-handler-idl-attributes idframes:event-handler-idl-attributes>event handler IDL attributes/a>./p> p>The code idframes:handler-onblur>a href#handler-onblur>onblur/a>/code>, code idframes:handler-onerror>a href#handler-onerror>onerror/a>/code>, code idframes:handler-onfocus>a href#handler-onfocus>onfocus/a>/code>, code idframes:handler-onload>a href#handler-onload>onload/a>/code>, code idframes:handler-onresize>a href#handler-onresize>onresize/a>/code>, and code idframes:handler-onscroll>a href#handler-onscroll>onscroll/a>/code> a href#event-handlers idframes:event-handlers-2>event handlers/a> of the code idframes:window-2>a href#window>Window/a>/code> object, exposed on the code idframes:frameset-4>a href#frameset>frameset/a>/code> element, replace the generic a href#event-handlers idframes:event-handlers-3>event handlers/a> with the same names normally supported by a href#html-elements idframes:html-elements>HTML elements/a>./p> hr> p>The dfn idframe data-dfn-typeelement data-export>code>frame/code>/dfn> element defines a a href#nested-browsing-context idframes:nested-browsing-context>nested browsing context/a> similar to the code idframes:the-iframe-element>a href#the-iframe-element>iframe/a>/code> element, but rendered within a code idframes:frameset-5>a href#frameset>frameset/a>/code> element./p> p>A code idframes:frame>a href#frame>frame/a>/code> element is said to be an dfn idactive-frame-element>active code>frame/code> element/dfn> when it is a idframes:in-a-document hrefhttps://dom.spec.whatwg.org/#in-a-document data-x-internalin-a-document>in a document/a>./p> p>When a code idframes:frame-2>a href#frame>frame/a>/code> element is created as an a href#active-frame-element idframes:active-frame-element>active code>frame/code> element/a>, or becomes an a href#active-frame-element idframes:active-frame-element-2>active code>frame/code> element/a> after not having been one, the user agent must a href#creating-a-new-browsing-context idframes:creating-a-new-browsing-context>create a new browsing context/a>, set the elements a href#nested-browsing-context idframes:nested-browsing-context-2>nested browsing context/a> to the newly-created a href#browsing-context idframes:browsing-context>browsing context/a>, and then a href#process-the-frame-attributes idframes:process-the-frame-attributes>process the code>frame/code> attributes/a> for the first time. If the element has a code>name/code> attribute, the a href#browsing-context-name idframes:browsing-context-name>browsing context name/a> must be set to the value of this attribute; otherwise, the a href#browsing-context-name idframes:browsing-context-name-2>browsing context name/a> must be set to the empty string./p> p>When a code idframes:frame-3>a href#frame>frame/a>/code> element stops being an a href#active-frame-element idframes:active-frame-element-3>active code>frame/code> element/a>, the user agent must a href#a-browsing-context-is-discarded idframes:a-browsing-context-is-discarded>discard/a> the elements a href#nested-browsing-context idframes:nested-browsing-context-3>nested browsing context/a>, and then set the elements a href#nested-browsing-context idframes:nested-browsing-context-4>nested browsing context/a> to null./p> p>Whenever a code idframes:frame-4>a href#frame>frame/a>/code> element with a non-null a href#nested-browsing-context idframes:nested-browsing-context-5>nested browsing context/a> has its code>src/code> attribute set, changed, or removed, the user agent must a href#process-the-frame-attributes idframes:process-the-frame-attributes-2>process the code>frame/code> attributes/a>./p> p>When the user agent is to dfn idprocess-the-frame-attributes>process the code>frame/code> attributes/dfn>, it must run the first appropriate steps from the following list:/p> dl classswitch>dt>If the element has no code>src/code> attribute specified, and the user agent is processing the code idframes:frame-5>a href#frame>frame/a>/code>s attributes for the first timedd> p>a href#queue-a-task idframes:queue-a-task>Queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idframes:concept-event-fire data-x-internalconcept-event-fire>fire an event/a> named code idframes:event-load>a href#event-load>load/a>/code> at the code idframes:frame-6>a href#frame>frame/a>/code> element./p> dt>Otherwisedd>p>Run the a href#otherwise-steps-for-iframe-or-frame-elements idframes:otherwise-steps-for-iframe-or-frame-elements>otherwise steps for code>iframe/code> or code>frame/code> elements/a>./dl> p>Any a href#navigate idframes:navigate>navigation/a> required of the user agent in the a href#process-the-frame-attributes idframes:process-the-frame-attributes-3>process the code>frame/code> attributes/a> algorithm must use the code idframes:frame-7>a href#frame>frame/a>/code> elements a idframes:node-document hrefhttps://dom.spec.whatwg.org/#concept-node-document data-x-internalnode-document>node document/a>s a href#browsing-context idframes:browsing-context-2>browsing context/a> as the a href#source-browsing-context idframes:source-browsing-context>source browsing context/a>./p> p>Furthermore, if the a href#active-document idframes:active-document>active document/a> of the elements a href#nested-browsing-context idframes:nested-browsing-context-6>nested browsing context/a> before such a a href#navigate idframes:navigate-2>navigation/a> was not a href#completely-loaded idframes:completely-loaded>completely loaded/a> at the time of the new a href#navigate idframes:navigate-3>navigation/a>, then the a href#navigate idframes:navigate-4>navigation/a> must be completed with a href#replacement-enabled idframes:replacement-enabled>replacement enabled/a>./p> p>Similarly, if the a href#nested-browsing-context idframes:nested-browsing-context-7>nested browsing context/a>s a href#session-history idframes:session-history>session history/a> contained only one code idframes:document>a href#document>Document/a>/code> when the a href#process-the-frame-attributes idframes:process-the-frame-attributes-4>process the code>frame/code> attributes/a> algorithm was invoked, and that was the code idframes:about:blank>a href#about:blank>about:blank/a>/code> code idframes:document-2>a href#document>Document/a>/code> created when the a href#nested-browsing-context idframes:nested-browsing-context-8>nested browsing context/a> was created, then any a href#navigate idframes:navigate-5>navigation/a> required of the user agent in that algorithm must be completed with a href#replacement-enabled idframes:replacement-enabled-2>replacement enabled/a>./p> p>When a code idframes:document-3>a href#document>Document/a>/code> in a code idframes:frame-8>a href#frame>frame/a>/code> is marked as a href#completely-loaded idframes:completely-loaded-2>completely loaded/a>, the user agent must a href#queue-a-task idframes:queue-a-task-2>queue a task/a> to a hrefhttps://dom.spec.whatwg.org/#concept-event-fire idframes:concept-event-fire-2 data-x-internalconcept-event-fire>fire an event/a> named code idframes:event-load-2>a href#event-load>load/a>/code> at the code idframes:frame-9>a href#frame>frame/a>/code> element./p> p>The a href#task-source idframes:task-source>task source/a> for the a href#concept-task idframes:concept-task>tasks/a> above is the a href#dom-manipulation-task-source idframes:dom-manipulation-task-source>DOM manipulation task source/a>./p> p>When a code idframes:frame-10>a href#frame>frame/a>/code> element has a non-null a href#nested-browsing-context idframes:nested-browsing-context-9>nested browsing context/a>, and its a href#nested-browsing-context idframes:nested-browsing-context-10>nested browsing context/a>s a href#active-document idframes:active-document-2>active document/a> is not a href#ready-for-post-load-tasks idframes:ready-for-post-load-tasks>ready for post-load tasks/a>, and when anything is a href#delay-the-load-event idframes:delay-the-load-event>delaying the load event/a> of the code idframes:frame-11>a href#frame>frame/a>/code> elements a href#browsing-context idframes:browsing-context-3>browsing context/a>s a href#active-document idframes:active-document-3>active document/a>, and when the code idframes:frame-12>a href#frame>frame/a>/code> elements a href#browsing-context idframes:browsing-context-4>browsing context/a> is in the a href#delaying-load-events-mode idframes:delaying-load-events-mode>delaying code>load/code> events mode/a>, the code idframes:frame-13>a href#frame>frame/a>/code> must a href#delay-the-load-event idframes:delay-the-load-event-2>delay the load event/a> of its document./p> p>Whenever the code>name/code> attribute is set and the code idframes:frame-14>a href#frame>frame/a>/code> elements a href#nested-browsing-context idframes:nested-browsing-context-11>nested browsing context/a> is non-null, the a href#nested-browsing-context idframes:nested-browsing-context-12>nested browsing context/a>s a href#browsing-context-name idframes:browsing-context-name-3>name/a> must be changed to the new value. If the attribute is removed, the a href#browsing-context-name idframes:browsing-context-name-4>browsing context name/a> must be set to the empty string./p> p>The code idframes:frame-15>a href#frame>frame/a>/code> element must implement the code idframes:htmlframeelement>a href#htmlframeelement>HTMLFrameElement/a>/code> interface./p> pre classidl>ExposedWindow, a href#htmlconstructor idframes:htmlconstructor-2>HTMLConstructor/a>interface dfn idhtmlframeelement>HTMLFrameElement/dfn> : a href#htmlelement idframes:htmlelement-2>HTMLElement/a> { a href#cereactions idframes:cereactions-3>CEReactions/a> attribute DOMString a href#dom-frame-name idframes:dom-frame-name>name/a>; a href#cereactions idframes:cereactions-4>CEReactions/a> attribute DOMString a href#dom-frame-scrolling idframes:dom-frame-scrolling>scrolling/a>; a href#cereactions idframes:cereactions-5>CEReactions/a> attribute USVString a href#dom-frame-src idframes:dom-frame-src>src/a>; a href#cereactions idframes:cereactions-6>CEReactions/a> attribute DOMString a href#dom-frame-frameborder idframes:dom-frame-frameborder>frameBorder/a>; a href#cereactions idframes:cereactions-7>CEReactions/a> attribute USVString a href#dom-frame-longdesc idframes:dom-frame-longdesc>longDesc/a>; a href#cereactions idframes:cereactions-8>CEReactions/a> attribute boolean a href#dom-frame-noresize idframes:dom-frame-noresize>noResize/a>; readonly attribute a href#document idframes:document-4>Document/a>? a href#dom-frame-contentdocument idframes:dom-frame-contentdocument>contentDocument/a>; readonly attribute a href#windowproxy idframes:windowproxy>WindowProxy/a>? a href#dom-frame-contentwindow idframes:dom-frame-contentwindow>contentWindow/a>; a href#cereactions idframes:cereactions-9>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-frame-marginheight idframes:dom-frame-marginheight>marginHeight/a>; a href#cereactions idframes:cereactions-10>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-frame-marginwidth idframes:dom-frame-marginwidth>marginWidth/a>;};/pre> p>The dfn iddom-frame-name>code>name/code>/dfn>, dfn iddom-frame-scrolling>code>scrolling/code>/dfn>, and dfn iddom-frame-src>code>src/code>/dfn> IDL attributes of the code idframes:frame-16>a href#frame>frame/a>/code> element must a href#reflect idframes:reflect-2>reflect/a> the respective content attributes of the same name. For the purposes of reflection, the code idframes:frame-17>a href#frame>frame/a>/code> elements code>src/code> content attribute is defined as containing a a idframes:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>./p> p>The dfn iddom-frame-frameborder>code>frameBorder/code>/dfn> IDL attribute of the code idframes:frame-18>a href#frame>frame/a>/code> element must a href#reflect idframes:reflect-3>reflect/a> the elements code>frameborder/code> content attribute./p> p>The dfn iddom-frame-longdesc>code>longDesc/code>/dfn> IDL attribute of the code idframes:frame-19>a href#frame>frame/a>/code> element must a href#reflect idframes:reflect-4>reflect/a> the elements code>longdesc/code> content attribute, which for the purposes of reflection is defined as containing a a idframes:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>./p> p>The dfn iddom-frame-noresize>code>noResize/code>/dfn> IDL attribute of the code idframes:frame-20>a href#frame>frame/a>/code> element must a href#reflect idframes:reflect-5>reflect/a> the elements code>noresize/code> content attribute./p> p>The dfn iddom-frame-contentdocument>code>contentDocument/code>/dfn> IDL attribute, on getting, must return the code idframes:frame-21>a href#frame>frame/a>/code> elements a href#concept-bcc-content-document idframes:concept-bcc-content-document>content document/a>./p> p>The dfn iddom-frame-contentwindow>code>contentWindow/code>/dfn> IDL attribute must return the code idframes:windowproxy-2>a href#windowproxy>WindowProxy/a>/code> object of the code idframes:frame-22>a href#frame>frame/a>/code> elements a href#nested-browsing-context idframes:nested-browsing-context-13>nested browsing context/a>, if the elements a href#nested-browsing-context idframes:nested-browsing-context-14>nested browsing context/a> is non-null, or return null otherwise./p> p>The dfn iddom-frame-marginheight>code>marginHeight/code>/dfn> IDL attribute of the code idframes:frame-23>a href#frame>frame/a>/code> element must a href#reflect idframes:reflect-6>reflect/a> the elements code>marginheight/code> content attribute./p> p>The dfn iddom-frame-marginwidth>code>marginWidth/code>/dfn> IDL attribute of the code idframes:frame-24>a href#frame>frame/a>/code> element must a href#reflect idframes:reflect-7>reflect/a> the elements code>marginwidth/code> content attribute./p> h4 idother-elements,-attributes-and-apis>span classsecno>15.3.3/span> Other elements, attributes and APIsa href#other-elements,-attributes-and-apis classself-link>/a>/h4> p>User agents must treat code idother-elements,-attributes-and-apis:acronym>a href#acronym>acronym/a>/code> elements in a manner equivalent to code idother-elements,-attributes-and-apis:the-abbr-element>a href#the-abbr-element>abbr/a>/code> elements in terms of semantics and for purposes of rendering./p> hr> pre classidl>partial interface a href#htmlanchorelement idHTMLAnchorElement-partial>HTMLAnchorElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions>CEReactions/a> attribute DOMString a href#dom-a-coords idother-elements,-attributes-and-apis:dom-a-coords>coords/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-2>CEReactions/a> attribute DOMString a href#dom-a-charset idother-elements,-attributes-and-apis:dom-a-charset>charset/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-3>CEReactions/a> attribute DOMString a href#dom-a-name idother-elements,-attributes-and-apis:dom-a-name>name/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-4>CEReactions/a> attribute DOMString a href#dom-a-rev idother-elements,-attributes-and-apis:dom-a-rev>rev/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-5>CEReactions/a> attribute DOMString a href#dom-a-shape idother-elements,-attributes-and-apis:dom-a-shape>shape/a>;};/pre> p>The dfn iddom-a-coords>code>coords/code>/dfn>, dfn iddom-a-charset>code>charset/code>/dfn>, dfn iddom-a-name>code>name/code>/dfn>, dfn iddom-a-rev>code>rev/code>/dfn>, and dfn iddom-a-shape>code>shape/code>/dfn> IDL attributes of the code idother-elements,-attributes-and-apis:the-a-element>a href#the-a-element>a/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect>reflect/a> the respective content attributes of the same name./p> hr> pre classidl>partial interface a href#htmlareaelement idHTMLAreaElement-partial>HTMLAreaElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-6>CEReactions/a> attribute boolean a href#dom-area-nohref idother-elements,-attributes-and-apis:dom-area-nohref>noHref/a>;};/pre> p>The dfn iddom-area-nohref>code>noHref/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-area-element>a href#the-area-element>area/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-2>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-area-nohref>a href#attr-area-nohref>nohref/a>/code> content attribute./p> hr> pre classidl>partial interface a href#htmlbodyelement idHTMLBodyElement-partial>HTMLBodyElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-7>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-body-text idother-elements,-attributes-and-apis:dom-body-text>text/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-8>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-body-link idother-elements,-attributes-and-apis:dom-body-link>link/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-9>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-body-vlink idother-elements,-attributes-and-apis:dom-body-vlink>vLink/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-10>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-body-alink idother-elements,-attributes-and-apis:dom-body-alink>aLink/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-11>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-body-bgcolor idother-elements,-attributes-and-apis:dom-body-bgcolor>bgColor/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-12>CEReactions/a> attribute DOMString a href#dom-body-background idother-elements,-attributes-and-apis:dom-body-background>background/a>;};/pre> p>The dfn iddom-body-text>code>text/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-body-element>a href#the-body-element>body/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-3>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-body-text>a href#attr-body-text>text/a>/code> content attribute./p> p>The dfn iddom-body-link>code>link/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-body-element-2>a href#the-body-element>body/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-4>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-body-link>a href#attr-body-link>link/a>/code> content attribute./p> p>The dfn iddom-body-alink>code>aLink/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-body-element-3>a href#the-body-element>body/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-5>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-body-alink>a href#attr-body-alink>alink/a>/code> content attribute./p> p>The dfn iddom-body-vlink>code>vLink/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-body-element-4>a href#the-body-element>body/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-6>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-body-vlink>a href#attr-body-vlink>vlink/a>/code> content attribute./p> p>The dfn iddom-body-bgcolor>code>bgColor/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-body-element-5>a href#the-body-element>body/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-7>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-body-bgcolor>a href#attr-body-bgcolor>bgcolor/a>/code> content attribute./p> p>The dfn iddom-body-background>code>background/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-body-element-6>a href#the-body-element>body/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-8>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-background>a href#attr-background>background/a>/code> content attribute. (The code idother-elements,-attributes-and-apis:attr-background-2>a href#attr-background>background/a>/code> content is em>not/em> defined to contain a a idother-elements,-attributes-and-apis:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>, despite rules regarding its handling in the rendering section above.)/p> hr> pre classidl>partial interface a href#htmlbrelement idHTMLBRElement-partial>HTMLBRElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-13>CEReactions/a> attribute DOMString a href#dom-br-clear idother-elements,-attributes-and-apis:dom-br-clear>clear/a>;};/pre> p>The dfn iddom-br-clear>code>clear/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-br-element>a href#the-br-element>br/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-9>reflect/a> the content attribute of the same name./p> hr> pre classidl>partial interface a href#htmltablecaptionelement idHTMLTableCaptionElement-partial>HTMLTableCaptionElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-14>CEReactions/a> attribute DOMString a href#dom-caption-align idother-elements,-attributes-and-apis:dom-caption-align>align/a>;};/pre> p>The dfn iddom-caption-align>code>align/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-caption-element>a href#the-caption-element>caption/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-10>reflect/a> the content attribute of the same name./p> hr> pre classidl>partial interface a href#htmltablecolelement idHTMLTableColElement-partial>HTMLTableColElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-15>CEReactions/a> attribute DOMString a href#dom-col-align idother-elements,-attributes-and-apis:dom-col-align>align/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-16>CEReactions/a> attribute DOMString a href#dom-col-ch idother-elements,-attributes-and-apis:dom-col-ch>ch/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-17>CEReactions/a> attribute DOMString a href#dom-col-choff idother-elements,-attributes-and-apis:dom-col-choff>chOff/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-18>CEReactions/a> attribute DOMString a href#dom-col-valign idother-elements,-attributes-and-apis:dom-col-valign>vAlign/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-19>CEReactions/a> attribute DOMString a href#dom-col-width idother-elements,-attributes-and-apis:dom-col-width>width/a>;};/pre> p>The dfn iddom-col-align>code>align/code>/dfn> and dfn iddom-col-width>code>width/code>/dfn> IDL attributes of the code idother-elements,-attributes-and-apis:the-col-element>a href#the-col-element>col/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-11>reflect/a> the respective content attributes of the same name./p> p>The dfn iddom-col-ch>code>ch/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-col-element-2>a href#the-col-element>col/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-12>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-col-char>a href#attr-col-char>char/a>/code> content attribute./p> p>The dfn iddom-col-choff>code>chOff/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-col-element-3>a href#the-col-element>col/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-13>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-col-charoff>a href#attr-col-charoff>charoff/a>/code> content attribute./p> p>The dfn iddom-col-valign>code>vAlign/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-col-element-4>a href#the-col-element>col/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-14>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-col-valign>a href#attr-col-valign>valign/a>/code> content attribute./p> hr> p>User agents must treat code idother-elements,-attributes-and-apis:dir>a href#dir>dir/a>/code> elements in a manner equivalent to code idother-elements,-attributes-and-apis:the-ul-element>a href#the-ul-element>ul/a>/code> elements in terms of semantics and for purposes of rendering./p> p>The code idother-elements,-attributes-and-apis:dir-2>a href#dir>dir/a>/code> element must implement the code idother-elements,-attributes-and-apis:htmldirectoryelement>a href#htmldirectoryelement>HTMLDirectoryElement/a>/code> interface./p> pre classidl>ExposedWindow, a href#htmlconstructor idother-elements,-attributes-and-apis:htmlconstructor>HTMLConstructor/a>interface dfn idhtmldirectoryelement>HTMLDirectoryElement/dfn> : a href#htmlelement idother-elements,-attributes-and-apis:htmlelement>HTMLElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-20>CEReactions/a> attribute boolean a href#dom-dir-compact idother-elements,-attributes-and-apis:dom-dir-compact>compact/a>;};/pre> p>The dfn iddom-dir-compact>code>compact/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:dir-3>a href#dir>dir/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-15>reflect/a> the content attribute of the same name./p> hr> pre classidl>partial interface a href#htmldivelement idHTMLDivElement-partial>HTMLDivElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-21>CEReactions/a> attribute DOMString a href#dom-div-align idother-elements,-attributes-and-apis:dom-div-align>align/a>;};/pre> p>The dfn iddom-div-align>code>align/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-div-element>a href#the-div-element>div/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-16>reflect/a> the content attribute of the same name./p> hr> pre classidl>partial interface a href#htmldlistelement idHTMLDListElement-partial>HTMLDListElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-22>CEReactions/a> attribute boolean a href#dom-dl-compact idother-elements,-attributes-and-apis:dom-dl-compact>compact/a>;};/pre> p>The dfn iddom-dl-compact>code>compact/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-dl-element>a href#the-dl-element>dl/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-17>reflect/a> the content attribute of the same name./p> hr> pre classidl>partial interface a href#htmlembedelement idHTMLEmbedElement-partial>HTMLEmbedElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-23>CEReactions/a> attribute DOMString a href#dom-embed-align idother-elements,-attributes-and-apis:dom-embed-align>align/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-24>CEReactions/a> attribute DOMString a href#dom-embed-name idother-elements,-attributes-and-apis:dom-embed-name>name/a>;};/pre> p>The dfn iddom-embed-name>code>name/code>/dfn> and dfn iddom-embed-align>code>align/code>/dfn> IDL attributes of the code idother-elements,-attributes-and-apis:the-embed-element>a href#the-embed-element>embed/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-18>reflect/a> the respective content attributes of the same name./p> hr> p>The code idother-elements,-attributes-and-apis:font>a href#font>font/a>/code> element must implement the code idother-elements,-attributes-and-apis:htmlfontelement>a href#htmlfontelement>HTMLFontElement/a>/code> interface./p> pre classidl>ExposedWindow, a href#htmlconstructor idother-elements,-attributes-and-apis:htmlconstructor-2>HTMLConstructor/a>interface dfn idhtmlfontelement>HTMLFontElement/dfn> : a href#htmlelement idother-elements,-attributes-and-apis:htmlelement-2>HTMLElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-25>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-font-color idother-elements,-attributes-and-apis:dom-font-color>color/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-26>CEReactions/a> attribute DOMString a href#dom-font-face idother-elements,-attributes-and-apis:dom-font-face>face/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-27>CEReactions/a> attribute DOMString a href#dom-font-size idother-elements,-attributes-and-apis:dom-font-size>size/a>; };/pre> p>The dfn iddom-font-color>code>color/code>/dfn>, dfn iddom-font-face>code>face/code>/dfn>, and dfn iddom-font-size>code>size/code>/dfn> IDL attributes of the code idother-elements,-attributes-and-apis:font-2>a href#font>font/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-19>reflect/a> the respective content attributes of the same name./p> hr> pre classidl>partial interface a href#htmlheadingelement idHTMLHeadingElement-partial>HTMLHeadingElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-28>CEReactions/a> attribute DOMString a href#dom-hx-align idother-elements,-attributes-and-apis:dom-hx-align>align/a>;};/pre> p>The dfn iddom-hx-align>code>align/code>/dfn> IDL attribute of the code idother-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 idother-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 idother-elements,-attributes-and-apis:reflect-20>reflect/a> the content attribute of the same name./p> hr> p classnote>The dfn iddom-head-profile>code>profile/code>/dfn> IDL attribute on code idother-elements,-attributes-and-apis:the-head-element>a href#the-head-element>head/a>/code> elements (with the code idother-elements,-attributes-and-apis:htmlheadelement>a href#htmlheadelement>HTMLHeadElement/a>/code> interface) is intentionally omitted. Unless so required by a href#other-applicable-specifications idother-elements,-attributes-and-apis:other-applicable-specifications>another applicable specification/a>, implementations would therefore not support this attribute. (It is mentioned here as it was defined in a previous version of the DOM specifications.)/p> hr> pre classidl>partial interface a href#htmlhrelement idHTMLHRElement-partial>HTMLHRElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-29>CEReactions/a> attribute DOMString a href#dom-hr-align idother-elements,-attributes-and-apis:dom-hr-align>align/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-30>CEReactions/a> attribute DOMString a href#dom-hr-color idother-elements,-attributes-and-apis:dom-hr-color>color/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-31>CEReactions/a> attribute boolean a href#dom-hr-noshade idother-elements,-attributes-and-apis:dom-hr-noshade>noShade/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-32>CEReactions/a> attribute DOMString a href#dom-hr-size idother-elements,-attributes-and-apis:dom-hr-size>size/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-33>CEReactions/a> attribute DOMString a href#dom-hr-width idother-elements,-attributes-and-apis:dom-hr-width>width/a>;};/pre> p>The dfn iddom-hr-align>code>align/code>/dfn>, dfn iddom-hr-color>code>color/code>/dfn>, dfn iddom-hr-size>code>size/code>/dfn>, and dfn iddom-hr-width>code>width/code>/dfn> IDL attributes of the code idother-elements,-attributes-and-apis:the-hr-element>a href#the-hr-element>hr/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-21>reflect/a> the respective content attributes of the same name./p> p>The dfn iddom-hr-noshade>code>noShade/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-hr-element-2>a href#the-hr-element>hr/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-22>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-hr-noshade>a href#attr-hr-noshade>noshade/a>/code> content attribute./p> hr> pre classidl>partial interface a href#htmlhtmlelement idHTMLHtmlElement-partial>HTMLHtmlElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-34>CEReactions/a> attribute DOMString a href#dom-html-version idother-elements,-attributes-and-apis:dom-html-version>version/a>;};/pre> p>The dfn iddom-html-version>code>version/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-html-element>a href#the-html-element>html/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-23>reflect/a> the content attribute of the same name./p> hr> pre classidl>partial interface a href#htmliframeelement idHTMLIFrameElement-partial>HTMLIFrameElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-35>CEReactions/a> attribute DOMString a href#dom-iframe-align idother-elements,-attributes-and-apis:dom-iframe-align>align/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-36>CEReactions/a> attribute DOMString a href#dom-iframe-scrolling idother-elements,-attributes-and-apis:dom-iframe-scrolling>scrolling/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-37>CEReactions/a> attribute DOMString a href#dom-iframe-frameborder idother-elements,-attributes-and-apis:dom-iframe-frameborder>frameBorder/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-38>CEReactions/a> attribute USVString a href#dom-iframe-longdesc idother-elements,-attributes-and-apis:dom-iframe-longdesc>longDesc/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-39>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-iframe-marginheight idother-elements,-attributes-and-apis:dom-iframe-marginheight>marginHeight/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-40>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-iframe-marginwidth idother-elements,-attributes-and-apis:dom-iframe-marginwidth>marginWidth/a>;};/pre> p>The dfn iddom-iframe-align>code>align/code>/dfn> and dfn iddom-iframe-scrolling>code>scrolling/code>/dfn> IDL attributes of the code idother-elements,-attributes-and-apis:the-iframe-element>a href#the-iframe-element>iframe/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-24>reflect/a> the respective content attributes of the same name./p> p>The dfn iddom-iframe-frameborder>code>frameBorder/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-25>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-iframe-frameborder>a href#attr-iframe-frameborder>frameborder/a>/code> content attribute./p> p>The dfn iddom-iframe-longdesc>code>longDesc/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-iframe-element-3>a href#the-iframe-element>iframe/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-26>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-iframe-longdesc>a href#attr-iframe-longdesc>longdesc/a>/code> content attribute, which for the purposes of reflection is defined as containing a a idother-elements,-attributes-and-apis:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>./p> p>The dfn iddom-iframe-marginheight>code>marginHeight/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-iframe-element-4>a href#the-iframe-element>iframe/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-27>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-iframe-marginheight>a href#attr-iframe-marginheight>marginheight/a>/code> content attribute./p> p>The dfn iddom-iframe-marginwidth>code>marginWidth/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-iframe-element-5>a href#the-iframe-element>iframe/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-28>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-iframe-marginwidth>a href#attr-iframe-marginwidth>marginwidth/a>/code> content attribute./p> hr> pre classidl>partial interface a href#htmlimageelement idHTMLImageElement-partial>HTMLImageElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-41>CEReactions/a> attribute DOMString a href#dom-img-name idother-elements,-attributes-and-apis:dom-img-name>name/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-42>CEReactions/a> attribute USVString a href#dom-img-lowsrc idother-elements,-attributes-and-apis:dom-img-lowsrc>lowsrc/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-43>CEReactions/a> attribute DOMString a href#dom-img-align idother-elements,-attributes-and-apis:dom-img-align>align/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-44>CEReactions/a> attribute unsigned long a href#dom-img-hspace idother-elements,-attributes-and-apis:dom-img-hspace>hspace/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-45>CEReactions/a> attribute unsigned long a href#dom-img-vspace idother-elements,-attributes-and-apis:dom-img-vspace>vspace/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-46>CEReactions/a> attribute USVString a href#dom-img-longdesc idother-elements,-attributes-and-apis:dom-img-longdesc>longDesc/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-47>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-img-border idother-elements,-attributes-and-apis:dom-img-border>border/a>;};/pre> p>The dfn iddom-img-name>code>name/code>/dfn>, dfn iddom-img-align>code>align/code>/dfn>, dfn iddom-img-border>code>border/code>/dfn>, dfn iddom-img-hspace>code>hspace/code>/dfn>, and dfn iddom-img-vspace>code>vspace/code>/dfn> IDL attributes of the code idother-elements,-attributes-and-apis:the-img-element>a href#the-img-element>img/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-29>reflect/a> the respective content attributes of the same name./p> p>The dfn iddom-img-longdesc>code>longDesc/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-img-element-2>a href#the-img-element>img/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-30>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-img-longdesc>a href#attr-img-longdesc>longdesc/a>/code> content attribute, which for the purposes of reflection is defined as containing a a idother-elements,-attributes-and-apis:url-3 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>./p> p>The dfn iddom-img-lowsrc>code>lowsrc/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-img-element-3>a href#the-img-element>img/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-31>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-img-lowsrc>a href#attr-img-lowsrc>lowsrc/a>/code> content attribute, which for the purposes of reflection is defined as containing a a idother-elements,-attributes-and-apis:url-4 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>./p> hr> pre classidl>partial interface a href#htmlinputelement idHTMLInputElement-partial>HTMLInputElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-48>CEReactions/a> attribute DOMString a href#dom-input-align idother-elements,-attributes-and-apis:dom-input-align>align/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-49>CEReactions/a> attribute DOMString a href#dom-input-usemap idother-elements,-attributes-and-apis:dom-input-usemap>useMap/a>;};/pre> p>The dfn iddom-input-align>code>align/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-input-element>a href#the-input-element>input/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-32>reflect/a> the content attribute of the same name./p> p>The dfn iddom-input-usemap>code>useMap/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-input-element-2>a href#the-input-element>input/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-33>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-input-usemap>a href#attr-input-usemap>usemap/a>/code> content attribute./p> hr> pre classidl>partial interface a href#htmllegendelement idHTMLLegendElement-partial>HTMLLegendElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-50>CEReactions/a> attribute DOMString a href#dom-legend-align idother-elements,-attributes-and-apis:dom-legend-align>align/a>;};/pre> p>The dfn iddom-legend-align>code>align/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-legend-element>a href#the-legend-element>legend/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-34>reflect/a> the content attribute of the same name./p> hr> pre classidl>partial interface a href#htmllielement idHTMLLIElement-partial>HTMLLIElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-51>CEReactions/a> attribute DOMString a href#dom-li-type idother-elements,-attributes-and-apis:dom-li-type>type/a>;};/pre> p>The dfn iddom-li-type>code>type/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-li-element>a href#the-li-element>li/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-35>reflect/a> the content attribute of the same name./p> hr> pre classidl>partial interface a href#htmllinkelement idHTMLLinkElement-partial>HTMLLinkElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-52>CEReactions/a> attribute DOMString a href#dom-link-charset idother-elements,-attributes-and-apis:dom-link-charset>charset/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-53>CEReactions/a> attribute DOMString a href#dom-link-rev idother-elements,-attributes-and-apis:dom-link-rev>rev/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-54>CEReactions/a> attribute DOMString a href#dom-link-target idother-elements,-attributes-and-apis:dom-link-target>target/a>;};/pre> p>The dfn iddom-link-charset>code>charset/code>/dfn>, dfn iddom-link-rev>code>rev/code>/dfn>, and dfn iddom-link-target>code>target/code>/dfn> IDL attributes of the code idother-elements,-attributes-and-apis:the-link-element>a href#the-link-element>link/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-36>reflect/a> the respective content attributes of the same name./p> hr> p>User agents must treat code idother-elements,-attributes-and-apis:listing>a href#listing>listing/a>/code> elements in a manner equivalent to code idother-elements,-attributes-and-apis:the-pre-element>a href#the-pre-element>pre/a>/code> elements in terms of semantics and for purposes of rendering./p> hr> pre classidl>partial interface a href#htmlmenuelement idHTMLMenuElement-partial>HTMLMenuElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-55>CEReactions/a> attribute boolean a href#dom-menu-compact idother-elements,-attributes-and-apis:dom-menu-compact>compact/a>;};/pre> p>The dfn iddom-menu-compact>code>compact/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-menu-element>a href#the-menu-element>menu/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-37>reflect/a> the content attribute of the same name./p> hr> pre classidl>partial interface a href#htmlmetaelement idHTMLMetaElement-partial>HTMLMetaElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-56>CEReactions/a> attribute DOMString a href#dom-meta-scheme idother-elements,-attributes-and-apis:dom-meta-scheme>scheme/a>;};/pre> p>User agents may treat the code idother-elements,-attributes-and-apis:attr-meta-scheme>a href#attr-meta-scheme>scheme/a>/code> content attribute on the code idother-elements,-attributes-and-apis:the-meta-element>a href#the-meta-element>meta/a>/code> element as an extension of the elements code idother-elements,-attributes-and-apis:attr-meta-name>a href#attr-meta-name>name/a>/code> content attribute when processing a code idother-elements,-attributes-and-apis:the-meta-element-2>a href#the-meta-element>meta/a>/code> element with a code idother-elements,-attributes-and-apis:attr-meta-name-2>a href#attr-meta-name>name/a>/code> attribute whose value is one that the user agent recognizes as supporting the code idother-elements,-attributes-and-apis:attr-meta-scheme-2>a href#attr-meta-scheme>scheme/a>/code> attribute./p> p>User agents are encouraged to ignore the code idother-elements,-attributes-and-apis:attr-meta-scheme-3>a href#attr-meta-scheme>scheme/a>/code> attribute and instead process the value given to the metadata name as if it had been specified for each expected value of the code idother-elements,-attributes-and-apis:attr-meta-scheme-4>a href#attr-meta-scheme>scheme/a>/code> attribute./p> div classexample> p>For example, if the user agent acts on code idother-elements,-attributes-and-apis:the-meta-element-3>a href#the-meta-element>meta/a>/code> elements with code idother-elements,-attributes-and-apis:attr-meta-name-3>a href#attr-meta-name>name/a>/code> attributes having the value eGMS.subject.keyword, and knows that the code idother-elements,-attributes-and-apis:attr-meta-scheme-5>a href#attr-meta-scheme>scheme/a>/code> attribute is used with this metadata name, then it could take the code idother-elements,-attributes-and-apis:attr-meta-scheme-6>a href#attr-meta-scheme>scheme/a>/code> attribute into account, acting as if it was an extension of the code idother-elements,-attributes-and-apis:attr-meta-name-4>a href#attr-meta-name>name/a>/code> attribute. Thus the following two code idother-elements,-attributes-and-apis:the-meta-element-4>a href#the-meta-element>meta/a>/code> elements could be treated as two elements giving values for two different metadata names, one consisting of a combination of eGMS.subject.keyword and LGCL, and the other consisting of a combination of eGMS.subject.keyword and ORLY:/p> pre classbad><!-- this markup is invalid --><meta nameeGMS.subject.keyword schemeLGCL contentAbandoned vehicles><meta nameeGMS.subject.keyword schemeORLY contentMah car: kthxbye>/pre> p>The suggested processing of this markup, however, would be equivalent to the following:/p> pre><meta nameeGMS.subject.keyword contentAbandoned vehicles><meta nameeGMS.subject.keyword contentMah car: kthxbye>/pre> /div> p>The dfn iddom-meta-scheme>code>scheme/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-meta-element-5>a href#the-meta-element>meta/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-38>reflect/a> the content attribute of the same name./p> hr> pre classidl>partial interface a href#htmlobjectelement idHTMLObjectElement-partial>HTMLObjectElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-57>CEReactions/a> attribute DOMString a href#dom-object-align idother-elements,-attributes-and-apis:dom-object-align>align/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-58>CEReactions/a> attribute DOMString a href#dom-object-archive idother-elements,-attributes-and-apis:dom-object-archive>archive/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-59>CEReactions/a> attribute DOMString a href#dom-object-code idother-elements,-attributes-and-apis:dom-object-code>code/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-60>CEReactions/a> attribute boolean a href#dom-object-declare idother-elements,-attributes-and-apis:dom-object-declare>declare/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-61>CEReactions/a> attribute unsigned long a href#dom-object-hspace idother-elements,-attributes-and-apis:dom-object-hspace>hspace/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-62>CEReactions/a> attribute DOMString a href#dom-object-standby idother-elements,-attributes-and-apis:dom-object-standby>standby/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-63>CEReactions/a> attribute unsigned long a href#dom-object-vspace idother-elements,-attributes-and-apis:dom-object-vspace>vspace/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-64>CEReactions/a> attribute DOMString a href#dom-object-codebase idother-elements,-attributes-and-apis:dom-object-codebase>codeBase/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-65>CEReactions/a> attribute DOMString a href#dom-object-codetype idother-elements,-attributes-and-apis:dom-object-codetype>codeType/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-66>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-object-border idother-elements,-attributes-and-apis:dom-object-border>border/a>;};/pre> p>The dfn iddom-object-align>code>align/code>/dfn>, dfn iddom-object-archive>code>archive/code>/dfn>, dfn iddom-object-border>code>border/code>/dfn>, dfn iddom-object-code>code>code/code>/dfn>, dfn iddom-object-declare>code>declare/code>/dfn>, dfn iddom-object-hspace>code>hspace/code>/dfn>, dfn iddom-object-standby>code>standby/code>/dfn>, and dfn iddom-object-vspace>code>vspace/code>/dfn> IDL attributes of the code idother-elements,-attributes-and-apis:the-object-element>a href#the-object-element>object/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-39>reflect/a> the respective content attributes of the same name./p> p>The dfn iddom-object-codebase>code>codeBase/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-object-element-2>a href#the-object-element>object/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-40>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-object-codebase>a href#attr-object-codebase>codebase/a>/code> content attribute, which for the purposes of reflection is defined as containing a a idother-elements,-attributes-and-apis:url-5 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a>./p> p>The dfn iddom-object-codetype>code>codeType/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-object-element-3>a href#the-object-element>object/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-41>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-object-codetype>a href#attr-object-codetype>codetype/a>/code> content attribute./p> hr> pre classidl>partial interface a href#htmlolistelement idHTMLOListElement-partial>HTMLOListElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-67>CEReactions/a> attribute boolean a href#dom-ol-compact idother-elements,-attributes-and-apis:dom-ol-compact>compact/a>;};/pre> p>The dfn iddom-ol-compact>code>compact/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-ol-element>a href#the-ol-element>ol/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-42>reflect/a> the content attribute of the same name./p> hr> pre classidl>partial interface a href#htmlparagraphelement idHTMLParagraphElement-partial>HTMLParagraphElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-68>CEReactions/a> attribute DOMString a href#dom-p-align idother-elements,-attributes-and-apis:dom-p-align>align/a>;};/pre> p>The dfn iddom-p-align>code>align/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-p-element>a href#the-p-element>p/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-43>reflect/a> the content attribute of the same name./p> hr> pre classidl>partial interface a href#htmlparamelement idHTMLParamElement-partial>HTMLParamElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-69>CEReactions/a> attribute DOMString a href#dom-param-type idother-elements,-attributes-and-apis:dom-param-type>type/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-70>CEReactions/a> attribute DOMString a href#dom-param-valuetype idother-elements,-attributes-and-apis:dom-param-valuetype>valueType/a>;};/pre> p>The dfn iddom-param-type>code>type/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-param-element>a href#the-param-element>param/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-44>reflect/a> the content attribute of the same name./p> p>The dfn iddom-param-valuetype>code>valueType/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-param-element-2>a href#the-param-element>param/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-45>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-param-valuetype>a href#attr-param-valuetype>valuetype/a>/code> content attribute./p> hr> p>User agents must treat code idother-elements,-attributes-and-apis:plaintext>a href#plaintext>plaintext/a>/code> elements in a manner equivalent to code idother-elements,-attributes-and-apis:the-pre-element-2>a href#the-pre-element>pre/a>/code> elements in terms of semantics and for purposes of rendering. (The parser has special behavior for this element, though.)/p> hr> pre classidl>partial interface a href#htmlpreelement idHTMLPreElement-partial>HTMLPreElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-71>CEReactions/a> attribute long a href#dom-pre-width idother-elements,-attributes-and-apis:dom-pre-width>width/a>;};/pre> p>The dfn iddom-pre-width>code>width/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-pre-element-3>a href#the-pre-element>pre/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-46>reflect/a> the content attribute of the same name./p> hr> pre classidl>partial interface a href#htmlstyleelement idHTMLStyleElement-partial>HTMLStyleElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-72>CEReactions/a> attribute DOMString a href#dom-style-type idother-elements,-attributes-and-apis:dom-style-type>type/a>;};/pre> p>The dfn iddom-style-type>code>type/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-style-element>a href#the-style-element>style/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-47>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-style-type>a href#attr-style-type>type/a>/code> content attribute./p> hr> pre classidl>partial interface a href#htmlscriptelement idHTMLScriptElement-partial>HTMLScriptElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-73>CEReactions/a> attribute DOMString a href#dom-script-charset idother-elements,-attributes-and-apis:dom-script-charset>charset/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-74>CEReactions/a> attribute DOMString a href#dom-script-event idother-elements,-attributes-and-apis:dom-script-event>event/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-75>CEReactions/a> attribute DOMString a href#dom-script-htmlfor idother-elements,-attributes-and-apis:dom-script-htmlfor>htmlFor/a>;};/pre> p>The dfn iddom-script-charset>code>charset/code>/dfn> and dfn iddom-script-event>code>event/code>/dfn> IDL attributes of the code idother-elements,-attributes-and-apis:the-script-element>a href#the-script-element>script/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-48>reflect/a> the respective content attributes of the same name./p> p>The dfn iddom-script-htmlfor>code>htmlFor/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-script-element-2>a href#the-script-element>script/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-49>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-script-for>a href#attr-script-for>for/a>/code> content attribute./p> hr> pre classidl>partial interface a href#htmltableelement idHTMLTableElement-partial>HTMLTableElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-76>CEReactions/a> attribute DOMString a href#dom-table-align idother-elements,-attributes-and-apis:dom-table-align>align/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-77>CEReactions/a> attribute DOMString a href#dom-table-border idother-elements,-attributes-and-apis:dom-table-border>border/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-78>CEReactions/a> attribute DOMString a href#dom-table-frame idother-elements,-attributes-and-apis:dom-table-frame>frame/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-79>CEReactions/a> attribute DOMString a href#dom-table-rules idother-elements,-attributes-and-apis:dom-table-rules>rules/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-80>CEReactions/a> attribute DOMString a href#dom-table-summary idother-elements,-attributes-and-apis:dom-table-summary>summary/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-81>CEReactions/a> attribute DOMString a href#dom-table-width idother-elements,-attributes-and-apis:dom-table-width>width/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-82>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-table-bgcolor idother-elements,-attributes-and-apis:dom-table-bgcolor>bgColor/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-83>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-table-cellpadding idother-elements,-attributes-and-apis:dom-table-cellpadding>cellPadding/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-84>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-table-cellspacing idother-elements,-attributes-and-apis:dom-table-cellspacing>cellSpacing/a>;};/pre> p>The dfn iddom-table-align>code>align/code>/dfn>, dfn iddom-table-border>code>border/code>/dfn>, dfn iddom-table-frame>code>frame/code>/dfn>, dfn iddom-table-summary>code>summary/code>/dfn>, dfn iddom-table-rules>code>rules/code>/dfn>, and dfn iddom-table-width>code>width/code>/dfn>, IDL attributes of the code idother-elements,-attributes-and-apis:the-table-element>a href#the-table-element>table/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-50>reflect/a> the respective content attributes of the same name./p> p>The dfn iddom-table-bgcolor>code>bgColor/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-table-element-2>a href#the-table-element>table/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-51>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-table-bgcolor>a href#attr-table-bgcolor>bgcolor/a>/code> content attribute./p> p>The dfn iddom-table-cellpadding>code>cellPadding/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-table-element-3>a href#the-table-element>table/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-52>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-table-cellpadding>a href#attr-table-cellpadding>cellpadding/a>/code> content attribute./p> p>The dfn iddom-table-cellspacing>code>cellSpacing/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-table-element-4>a href#the-table-element>table/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-53>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-table-cellspacing>a href#attr-table-cellspacing>cellspacing/a>/code> content attribute./p> hr> pre classidl>partial interface a href#htmltablesectionelement idHTMLTableSectionElement-partial>HTMLTableSectionElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-85>CEReactions/a> attribute DOMString a href#dom-tbody-align idother-elements,-attributes-and-apis:dom-tbody-align>align/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-86>CEReactions/a> attribute DOMString a href#dom-tbody-ch idother-elements,-attributes-and-apis:dom-tbody-ch>ch/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-87>CEReactions/a> attribute DOMString a href#dom-tbody-choff idother-elements,-attributes-and-apis:dom-tbody-choff>chOff/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-88>CEReactions/a> attribute DOMString a href#dom-tbody-valign idother-elements,-attributes-and-apis:dom-tbody-valign>vAlign/a>;};/pre> p>The dfn iddom-tbody-align>code>align/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-tbody-element>a href#the-tbody-element>tbody/a>/code>, code idother-elements,-attributes-and-apis:the-thead-element>a href#the-thead-element>thead/a>/code>, and code idother-elements,-attributes-and-apis:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code> elements must a href#reflect idother-elements,-attributes-and-apis:reflect-54>reflect/a> the content attribute of the same name./p> p>The dfn iddom-tbody-ch>code>ch/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-tbody-element-2>a href#the-tbody-element>tbody/a>/code>, code idother-elements,-attributes-and-apis:the-thead-element-2>a href#the-thead-element>thead/a>/code>, and code idother-elements,-attributes-and-apis:the-tfoot-element-2>a href#the-tfoot-element>tfoot/a>/code> elements must a href#reflect idother-elements,-attributes-and-apis:reflect-55>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-tbody-char>a href#attr-tbody-char>char/a>/code> content attributes./p> p>The dfn iddom-tbody-choff>code>chOff/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-tbody-element-3>a href#the-tbody-element>tbody/a>/code>, code idother-elements,-attributes-and-apis:the-thead-element-3>a href#the-thead-element>thead/a>/code>, and code idother-elements,-attributes-and-apis:the-tfoot-element-3>a href#the-tfoot-element>tfoot/a>/code> elements must a href#reflect idother-elements,-attributes-and-apis:reflect-56>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-tbody-charoff>a href#attr-tbody-charoff>charoff/a>/code> content attributes./p> p>The dfn iddom-tbody-valign>code>vAlign/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-tbody-element-4>a href#the-tbody-element>tbody/a>/code>, code idother-elements,-attributes-and-apis:the-thead-element-4>a href#the-thead-element>thead/a>/code>, and code idother-elements,-attributes-and-apis:the-tfoot-element-4>a href#the-tfoot-element>tfoot/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-57>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-tbody-valign>a href#attr-tbody-valign>valign/a>/code> content attributes./p> hr> pre classidl>partial interface a href#htmltablecellelement idHTMLTableCellElement-partial>HTMLTableCellElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-89>CEReactions/a> attribute DOMString a href#dom-tdth-align idother-elements,-attributes-and-apis:dom-tdth-align>align/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-90>CEReactions/a> attribute DOMString a href#dom-tdth-axis idother-elements,-attributes-and-apis:dom-tdth-axis>axis/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-91>CEReactions/a> attribute DOMString a href#dom-tdth-height idother-elements,-attributes-and-apis:dom-tdth-height>height/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-92>CEReactions/a> attribute DOMString a href#dom-tdth-width idother-elements,-attributes-and-apis:dom-tdth-width>width/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-93>CEReactions/a> attribute DOMString a href#dom-tdth-ch idother-elements,-attributes-and-apis:dom-tdth-ch>ch/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-94>CEReactions/a> attribute DOMString a href#dom-tdth-choff idother-elements,-attributes-and-apis:dom-tdth-choff>chOff/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-95>CEReactions/a> attribute boolean a href#dom-tdth-nowrap idother-elements,-attributes-and-apis:dom-tdth-nowrap>noWrap/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-96>CEReactions/a> attribute DOMString a href#dom-tdth-valign idother-elements,-attributes-and-apis:dom-tdth-valign>vAlign/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-97>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-tdth-bgcolor idother-elements,-attributes-and-apis:dom-tdth-bgcolor>bgColor/a>;};/pre> p>The dfn iddom-tdth-align>code>align/code>/dfn>, dfn iddom-tdth-axis>code>axis/code>/dfn>, dfn iddom-tdth-height>code>height/code>/dfn>, and dfn iddom-tdth-width>code>width/code>/dfn> IDL attributes of the code idother-elements,-attributes-and-apis:the-td-element>a href#the-td-element>td/a>/code> and code idother-elements,-attributes-and-apis:the-th-element>a href#the-th-element>th/a>/code> elements must a href#reflect idother-elements,-attributes-and-apis:reflect-58>reflect/a> the respective content attributes of the same name./p> p>The dfn iddom-tdth-ch>code>ch/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-td-element-2>a href#the-td-element>td/a>/code> and code idother-elements,-attributes-and-apis:the-th-element-2>a href#the-th-element>th/a>/code> elements must a href#reflect idother-elements,-attributes-and-apis:reflect-59>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-tdth-char>a href#attr-tdth-char>char/a>/code> content attributes./p> p>The dfn iddom-tdth-choff>code>chOff/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-td-element-3>a href#the-td-element>td/a>/code> and code idother-elements,-attributes-and-apis:the-th-element-3>a href#the-th-element>th/a>/code> elements must a href#reflect idother-elements,-attributes-and-apis:reflect-60>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-tdth-charoff>a href#attr-tdth-charoff>charoff/a>/code> content attributes./p> p>The dfn iddom-tdth-nowrap>code>noWrap/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-td-element-4>a href#the-td-element>td/a>/code> and code idother-elements,-attributes-and-apis:the-th-element-4>a href#the-th-element>th/a>/code> elements must a href#reflect idother-elements,-attributes-and-apis:reflect-61>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-tdth-nowrap>a href#attr-tdth-nowrap>nowrap/a>/code> content attributes./p> p>The dfn iddom-tdth-valign>code>vAlign/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-td-element-5>a href#the-td-element>td/a>/code> and code idother-elements,-attributes-and-apis:the-th-element-5>a href#the-th-element>th/a>/code> elements must a href#reflect idother-elements,-attributes-and-apis:reflect-62>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-tdth-valign>a href#attr-tdth-valign>valign/a>/code> content attributes./p> p>The dfn iddom-tdth-bgcolor>code>bgColor/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-td-element-6>a href#the-td-element>td/a>/code> and code idother-elements,-attributes-and-apis:the-th-element-6>a href#the-th-element>th/a>/code> elements must a href#reflect idother-elements,-attributes-and-apis:reflect-63>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-tdth-bgcolor>a href#attr-tdth-bgcolor>bgcolor/a>/code> content attributes./p> hr> pre classidl>partial interface a href#htmltablerowelement idHTMLTableRowElement-partial>HTMLTableRowElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-98>CEReactions/a> attribute DOMString a href#dom-tr-align idother-elements,-attributes-and-apis:dom-tr-align>align/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-99>CEReactions/a> attribute DOMString a href#dom-tr-ch idother-elements,-attributes-and-apis:dom-tr-ch>ch/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-100>CEReactions/a> attribute DOMString a href#dom-tr-choff idother-elements,-attributes-and-apis:dom-tr-choff>chOff/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-101>CEReactions/a> attribute DOMString a href#dom-tr-valign idother-elements,-attributes-and-apis:dom-tr-valign>vAlign/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-102>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-tr-bgcolor idother-elements,-attributes-and-apis:dom-tr-bgcolor>bgColor/a>;};/pre> p>The dfn iddom-tr-align>code>align/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-tr-element>a href#the-tr-element>tr/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-64>reflect/a> the content attribute of the same name./p> p>The dfn iddom-tr-ch>code>ch/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-tr-element-2>a href#the-tr-element>tr/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-65>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-tr-char>a href#attr-tr-char>char/a>/code> content attribute./p> p>The dfn iddom-tr-choff>code>chOff/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-tr-element-3>a href#the-tr-element>tr/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-66>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-tr-charoff>a href#attr-tr-charoff>charoff/a>/code> content attribute./p> p>The dfn iddom-tr-valign>code>vAlign/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-tr-element-4>a href#the-tr-element>tr/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-67>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-tr-valign>a href#attr-tr-valign>valign/a>/code> content attribute./p> p>The dfn iddom-tr-bgcolor>code>bgColor/code>/dfn> IDL attribute of the code idother-elements,-attributes-and-apis:the-tr-element-5>a href#the-tr-element>tr/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-68>reflect/a> the elements code idother-elements,-attributes-and-apis:attr-tr-bgcolor>a href#attr-tr-bgcolor>bgcolor/a>/code> content attribute./p> hr> pre classidl>partial interface a href#htmlulistelement idHTMLUListElement-partial>HTMLUListElement/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-103>CEReactions/a> attribute boolean a href#dom-ul-compact idother-elements,-attributes-and-apis:dom-ul-compact>compact/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-104>CEReactions/a> attribute DOMString a href#dom-ul-type idother-elements,-attributes-and-apis:dom-ul-type>type/a>;};/pre> p>The dfn iddom-ul-compact>code>compact/code>/dfn> and dfn iddom-ul-type>code>type/code>/dfn> IDL attributes of the code idother-elements,-attributes-and-apis:the-ul-element-2>a href#the-ul-element>ul/a>/code> element must a href#reflect idother-elements,-attributes-and-apis:reflect-69>reflect/a> the respective content attributes of the same name./p> hr> p>User agents must treat code idother-elements,-attributes-and-apis:xmp>a href#xmp>xmp/a>/code> elements in a manner equivalent to code idother-elements,-attributes-and-apis:the-pre-element-4>a href#the-pre-element>pre/a>/code> elements in terms of semantics and for purposes of rendering. (The parser has special behavior for this element though.)/p> hr> pre classidl>partial interface a href#document idDocument-partial>Document/a> { a href#cereactions idother-elements,-attributes-and-apis:cereactions-105>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-document-fgcolor idother-elements,-attributes-and-apis:dom-document-fgcolor>fgColor/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-106>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-document-linkcolor idother-elements,-attributes-and-apis:dom-document-linkcolor>linkColor/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-107>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-document-vlinkcolor idother-elements,-attributes-and-apis:dom-document-vlinkcolor>vlinkColor/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-108>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-document-alinkcolor idother-elements,-attributes-and-apis:dom-document-alinkcolor>alinkColor/a>; a href#cereactions idother-elements,-attributes-and-apis:cereactions-109>CEReactions/a> attribute TreatNullAsEmptyString DOMString a href#dom-document-bgcolor idother-elements,-attributes-and-apis:dom-document-bgcolor>bgColor/a>; SameObject readonly attribute a idother-elements,-attributes-and-apis:htmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> a href#dom-document-anchors idother-elements,-attributes-and-apis:dom-document-anchors>anchors/a>; SameObject readonly attribute a idother-elements,-attributes-and-apis:htmlcollection-2 hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection data-x-internalhtmlcollection>HTMLCollection/a> a href#dom-document-applets idother-elements,-attributes-and-apis:dom-document-applets>applets/a>; void a href#dom-document-clear idother-elements,-attributes-and-apis:dom-document-clear>clear/a>(); void a href#dom-document-captureevents idother-elements,-attributes-and-apis:dom-document-captureevents>captureEvents/a>(); void a href#dom-document-releaseevents idother-elements,-attributes-and-apis:dom-document-releaseevents>releaseEvents/a>(); SameObject readonly attribute a href#htmlallcollection idother-elements,-attributes-and-apis:htmlallcollection>HTMLAllCollection/a> a href#dom-document-all idother-elements,-attributes-and-apis:dom-document-all>all/a>;};/pre> p>The attributes of the code idother-elements,-attributes-and-apis:document>a href#document>Document/a>/code> object listed in the first column of the following table must a href#reflect idother-elements,-attributes-and-apis:reflect-70>reflect/a> the content attribute on a href#the-body-element-2 idother-elements,-attributes-and-apis:the-body-element-2-2>the body element/a> with the name given in the corresponding cell in the second column on the same row, if a href#the-body-element-2 idother-elements,-attributes-and-apis:the-body-element-2-3>the body element/a> is a code idother-elements,-attributes-and-apis:the-body-element-7>a href#the-body-element>body/a>/code> element (as opposed to a code idother-elements,-attributes-and-apis:frameset>a href#frameset>frameset/a>/code> element). When there is no a href#the-body-element-2 idother-elements,-attributes-and-apis:the-body-element-2-4>body element/a> or if it is a code idother-elements,-attributes-and-apis:frameset-2>a href#frameset>frameset/a>/code> element, the attributes must instead return the empty string on getting and do nothing on setting./p> table>thead>tr>th> IDL attribute th> Content attribute tbody>tr>td>dfn iddom-document-fgcolor>code>fgColor/code>/dfn> td>code idother-elements,-attributes-and-apis:attr-body-text-2>a href#attr-body-text>text/a>/code> tr>td>dfn iddom-document-linkcolor>code>linkColor/code>/dfn> td>code idother-elements,-attributes-and-apis:attr-body-link-2>a href#attr-body-link>link/a>/code> tr>td>dfn iddom-document-vlinkcolor>code>vlinkColor/code>/dfn> td>code idother-elements,-attributes-and-apis:attr-body-vlink-2>a href#attr-body-vlink>vlink/a>/code> tr>td>dfn iddom-document-alinkcolor>code>alinkColor/code>/dfn> td>code idother-elements,-attributes-and-apis:attr-body-alink-2>a href#attr-body-alink>alink/a>/code> tr>td>dfn iddom-document-bgcolor>code>bgColor/code>/dfn> td>code idother-elements,-attributes-and-apis:attr-body-bgcolor-2>a href#attr-body-bgcolor>bgcolor/a>/code> /table> hr> p>The dfn iddom-document-anchors>code>anchors/code>/dfn> attribute must return an code idother-elements,-attributes-and-apis:htmlcollection-3>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> rooted at the code idother-elements,-attributes-and-apis:document-2>a href#document>Document/a>/code> node, whose filter matches only code idother-elements,-attributes-and-apis:the-a-element-2>a href#the-a-element>a/a>/code> elements with code idother-elements,-attributes-and-apis:attr-a-name>a href#attr-a-name>name/a>/code> attributes./p> p>The dfn iddom-document-applets>code>applets/code>/dfn> attribute must return an code idother-elements,-attributes-and-apis:htmlcollection-4>a data-x-internalhtmlcollection hrefhttps://dom.spec.whatwg.org/#interface-htmlcollection>HTMLCollection/a>/code> rooted at the code idother-elements,-attributes-and-apis:document-3>a href#document>Document/a>/code> node, whose filter matches nothing. (It exists for historical reasons.)/p> p>The dfn iddom-document-clear>code>clear()/code>/dfn>, dfn iddom-document-captureevents>code>captureEvents()/code>/dfn>, and dfn iddom-document-releaseevents>code>releaseEvents()/code>/dfn> methods must do nothing./p> hr> p>The dfn iddom-document-all>code>all/code>/dfn> attribute must return an code idother-elements,-attributes-and-apis:htmlallcollection-2>a href#htmlallcollection>HTMLAllCollection/a>/code> rooted at the code idother-elements,-attributes-and-apis:document-4>a href#document>Document/a>/code> node, whose filter matches all elements./p> hr> pre classidl>partial interface a href#window idWindow-partial>Window/a> { void a href#dom-window-captureevents idother-elements,-attributes-and-apis:dom-window-captureevents>captureEvents/a>(); void a href#dom-window-releaseevents idother-elements,-attributes-and-apis:dom-window-releaseevents>releaseEvents/a>(); Replaceable, SameObject readonly attribute a href#external idother-elements,-attributes-and-apis:external>External/a> a href#dom-external idother-elements,-attributes-and-apis:dom-external>external/a>;};/pre> p>The dfn iddom-window-captureevents>code>captureEvents()/code>/dfn> and dfn iddom-window-releaseevents>code>releaseEvents()/code>/dfn> methods must do nothing./p> p>The dfn iddom-external>code>external/code>/dfn> attribute of the code idother-elements,-attributes-and-apis:window>a href#window>Window/a>/code> interface must return an instance of the code idother-elements,-attributes-and-apis:external-2>a href#external>External/a>/code> interface:/p> pre classidl>ExposedWindow, NoInterfaceObjectinterface dfn idexternal>External/dfn> { void a href#dom-external-addsearchprovider idother-elements,-attributes-and-apis:dom-external-addsearchprovider>AddSearchProvider/a>(); void a href#dom-external-issearchproviderinstalled idother-elements,-attributes-and-apis:dom-external-issearchproviderinstalled>IsSearchProviderInstalled/a>();};/pre> p>The dfn iddom-external-addsearchprovider>code>AddSearchProvider()/code>/dfn> and dfn iddom-external-issearchproviderinstalled>code>IsSearchProviderInstalled()/code>/dfn> methods must do nothing./p> h2 idiana>span classsecno>16/span> IANA considerationsa href#iana classself-link>/a>/h2> h3 idtext/html>span classsecno>16.1/span> dfn>code>text/html/code>/dfn>a href#text/html classself-link>/a>/h3> p>This registration is for community review and will be submitted to the IESG for review, approval, and registration with IANA./p> dl>dt>Type name:dd>textdt>Subtype name:dd>htmldt>Required parameters:dd>No required parametersdt>Optional parameters:dd> dl>dt>code>charset/code>dd> p>The code>charset/code> parameter may be provided to specify the a idtext/html:documents-character-encoding hrefhttps://dom.spec.whatwg.org/#concept-document-encoding data-x-internaldocuments-character-encoding>documents character encoding/a>, overriding any a href#character-encoding-declaration idtext/html:character-encoding-declaration>character encoding declarations/a> in the document other than a Byte Order Mark (BOM). The parameters value must be an a idtext/html:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a> match for the string code>utf-8/code>. a href#refsENCODING>ENCODING/a>/p> /dl> dt>Encoding considerations:dd> 8bit (see the section on a href#character-encoding-declaration idtext/html:character-encoding-declaration-2>character encoding declarations/a>) dt>Security considerations:dd> p>Entire novels have been written about the security considerations that apply to HTML documents. Many are listed in this document, to which the reader is referred for more details. Some general concerns bear mentioning here, however:/p> p>HTML is scripted language, and has a large number of APIs (some of which are described in this document). Script can expose the user to potential risks of information leakage, credential leakage, cross-site scripting attacks, cross-site request forgeries, and a host of other problems. While the designs in this specification are intended to be safe if implemented correctly, a full implementation is a massive undertaking and, as with any software, user agents are likely to have security bugs./p> p>Even without scripting, there are specific features in HTML which, for historical reasons, are required for broad compatibility with legacy content but that expose the user to unfortunate security problems. In particular, the code idtext/html:the-img-element>a href#the-img-element>img/a>/code> element can be used in conjunction with some other features as a way to effect a port scan from the users location on the Internet. This can expose local network topologies that the attacker would otherwise not be able to determine./p> p>HTML relies on a compartmentalization scheme sometimes known as the i>same-origin policy/i>. An a href#concept-origin idtext/html:concept-origin>origin/a> in most cases consists of all the pages served from the same host, on the same port, using the same protocol./p> p>It is critical, therefore, to ensure that any untrusted content that forms part of a site be hosted on a different a href#concept-origin idtext/html:concept-origin-2>origin/a> than any sensitive content on that site. Untrusted content can easily spoof any other page on the same origin, read data from that origin, cause scripts in that origin to execute, submit forms to and from that origin even if they are protected from cross-site request forgery attacks by unique tokens, and make use of any third-party resources exposed to or rights granted to that origin./p> dt>Interoperability considerations:dd> Rules for processing both conforming and non-conforming content are defined in this specification. dt>Published specification:dd idauthors-using-html> This document is the relevant specification. Labeling a resource with the code idtext/html:text/html>a href#text/html>text/html/a>/code> type asserts that the resource is an a hrefhttps://dom.spec.whatwg.org/#html-document idtext/html:html-documents data-x-internalhtml-documents>HTML document/a> using a href#syntax idtext/html:syntax>the HTML syntax/a>. dt>Applications that use this media type:dd> Web browsers, tools for processing Web content, HTML authoring tools, search engines, validators. dt>Additional information:dd> dl>dt>Magic number(s):dd>No sequence of bytes can uniquely identify an HTML document. More information on detecting HTML documents is available in the WHATWG MIME Sniffing standard. a href#refsMIMESNIFF>MIMESNIFF/a>dt>File extension(s):dd>code>html/code> and code>htm/code> are commonly, but certainly not exclusively, used as the extension for HTML documents.dt>Macintosh file type code(s):dd>code>TEXT/code>/dl> dt>Person & email address to contact for further information:dd>Ian Hickson <ian@hixie.ch>dt>Intended usage:dd>Commondt>Restrictions on usage:dd>No restrictions apply.dt>Author:dd>Ian Hickson <ian@hixie.ch>dt>Change controller:dd>W3C/dl> p>a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idtext/html:concept-url-fragment data-x-internalconcept-url-fragment>Fragments/a> used with code idtext/html:text/html-2>a href#text/html>text/html/a>/code> resources either refer to a href#the-indicated-part-of-the-document idtext/html:the-indicated-part-of-the-document>the indicated part of the document/a> or provide state information for in-page scripts./p> h3 idmultipart/x-mixed-replace>span classsecno>16.2/span> dfn>code>multipart/x-mixed-replace/code>/dfn>a href#multipart/x-mixed-replace classself-link>/a>/h3> p>This registration is for community review and will be submitted to the IESG for review, approval, and registration with IANA./p> dl>dt>Type name:dd>multipartdt>Subtype name:dd>x-mixed-replacedt>Required parameters:dd> ul classbrief>li>code>boundary/code> (defined in RFC2046) a href#refsRFC2046>RFC2046/a> /ul> dt>Optional parameters:dd>No optional parameters.dt>Encoding considerations:dd>binarydt>Security considerations:dd> Subresources of a code idmultipart/x-mixed-replace:multipart/x-mixed-replace>a href#multipart/x-mixed-replace>multipart/x-mixed-replace/a>/code> resource can be of any type, including types with non-trivial security implications such as code idmultipart/x-mixed-replace:text/html>a href#text/html>text/html/a>/code>. dt>Interoperability considerations:dd> None. dt>Published specification:dd> This specification describes processing rules for Web browsers. Conformance requirements for generating resources with this type are the same as for code idmultipart/x-mixed-replace:multipart/mixed>a href#multipart/mixed>multipart/mixed/a>/code>. a href#refsRFC2046>RFC2046/a> dt>Applications that use this media type:dd> This type is intended to be used in resources generated by Web servers, for consumption by Web browsers. dt>Additional information:dd> dl>dt>Magic number(s):dd>No sequence of bytes can uniquely identify a code idmultipart/x-mixed-replace:multipart/x-mixed-replace-2>a href#multipart/x-mixed-replace>multipart/x-mixed-replace/a>/code> resource.dt>File extension(s):dd>No specific file extensions are recommended for this type.dt>Macintosh file type code(s):dd>No specific Macintosh file type codes are recommended for this type./dl> dt>Person & email address to contact for further information:dd>Ian Hickson <ian@hixie.ch>dt>Intended usage:dd>Commondt>Restrictions on usage:dd>No restrictions apply.dt>Author:dd>Ian Hickson <ian@hixie.ch>dt>Change controller:dd>W3C/dl> p>a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idmultipart/x-mixed-replace:concept-url-fragment data-x-internalconcept-url-fragment>Fragments/a> used with code idmultipart/x-mixed-replace:multipart/x-mixed-replace-3>a href#multipart/x-mixed-replace>multipart/x-mixed-replace/a>/code> resources apply to each body part as defined by the type used by that body part./p> h3 idapplication/xhtml+xml>span classsecno>16.3/span> dfn>code>application/xhtml+xml/code>/dfn>a href#application/xhtml+xml classself-link>/a>/h3> p>This registration is for community review and will be submitted to the IESG for review, approval, and registration with IANA./p> dl>dt>Type name:dd>applicationdt>Subtype name:dd>xhtml+xmldt>Required parameters:dd>Same as for code idapplication/xhtml+xml:application/xml>a href#application/xml>application/xml/a>/code> a href#refsRFC7303>RFC7303/a>dt>Optional parameters:dd>Same as for code idapplication/xhtml+xml:application/xml-2>a href#application/xml>application/xml/a>/code> a href#refsRFC7303>RFC7303/a>dt>Encoding considerations:dd>Same as for code idapplication/xhtml+xml:application/xml-3>a href#application/xml>application/xml/a>/code> a href#refsRFC7303>RFC7303/a>dt>Security considerations:dd>Same as for code idapplication/xhtml+xml:application/xml-4>a href#application/xml>application/xml/a>/code> a href#refsRFC7303>RFC7303/a>dt>Interoperability considerations:dd>Same as for code idapplication/xhtml+xml:application/xml-5>a href#application/xml>application/xml/a>/code> a href#refsRFC7303>RFC7303/a>dt idauthors-using-xhtml>Published specification:dd>Labeling a resource with the code idapplication/xhtml+xml:application/xhtml+xml>a href#application/xhtml+xml>application/xhtml+xml/a>/code> type asserts that the resource is an XML document that likely has a a idapplication/xhtml+xml:document-element hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> from the a idapplication/xhtml+xml:html-namespace-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>. Thus, the relevant specifications are the XML specification, the Namespaces in XML specification, and this specification. a href#refsXML>XML/a> a href#refsXMLNS>XMLNS/a>dt>Applications that use this media type:dd>Same as for code idapplication/xhtml+xml:application/xml-6>a href#application/xml>application/xml/a>/code> a href#refsRFC7303>RFC7303/a>dt>Additional information:dd> dl>dt>Magic number(s):dd>Same as for code idapplication/xhtml+xml:application/xml-7>a href#application/xml>application/xml/a>/code> a href#refsRFC7303>RFC7303/a>dt>File extension(s):dd>code>xhtml/code> and code>xht/code> are sometimes used as extensions for XML resources that have a a idapplication/xhtml+xml:document-element-2 hrefhttps://dom.spec.whatwg.org/#document-element data-x-internaldocument-element>document element/a> from the a idapplication/xhtml+xml:html-namespace-2-2 hrefhttps://infra.spec.whatwg.org/#html-namespace data-x-internalhtml-namespace-2>HTML namespace/a>.dt>Macintosh file type code(s):dd>code>TEXT/code>/dl> dt>Person & email address to contact for further information:dd>Ian Hickson <ian@hixie.ch>dt>Intended usage:dd>Commondt>Restrictions on usage:dd>No restrictions apply.dt>Author:dd>Ian Hickson <ian@hixie.ch>dt>Change controller:dd>W3C/dl> p>a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idapplication/xhtml+xml:concept-url-fragment data-x-internalconcept-url-fragment>Fragments/a> used with code idapplication/xhtml+xml:application/xhtml+xml-2>a href#application/xhtml+xml>application/xhtml+xml/a>/code> resources have the same semantics as with any a idapplication/xhtml+xml:xml-mime-type hrefhttps://mimesniff.spec.whatwg.org/#xml-mime-type data-x-internalxml-mime-type>XML MIME type/a>. a href#refsRFC7303>RFC7303/a>/p> h3 idtext/cache-manifest>span classsecno>16.4/span> dfn>code>text/cache-manifest/code>/dfn>a href#text/cache-manifest classself-link>/a>/h3> p>This registration is for community review and will be submitted to the IESG for review, approval, and registration with IANA./p> dl>dt>Type name:dd>textdt>Subtype name:dd>cache-manifestdt>Required parameters:dd>No parametersdt>Optional parameters:dd> dl>dt>code>charset/code>dd> p>The code>charset/code> parameter may be provided. The parameters value must be code>utf-8/code>. This parameter serves no purpose; it is only allowed for compatibility with legacy servers./p> /dl> dt>Encoding considerations:dd>8bit (always UTF-8)dt>Security considerations:dd> p>Cache manifests themselves pose no immediate risk unless sensitive information is included within the manifest. Implementations, however, are required to follow specific rules when populating a cache based on a cache manifest, to ensure that certain origin-based restrictions are honored. Failure to correctly implement these rules can result in information leakage, cross-site scripting attacks, and the like./p> dt>Interoperability considerations:dd> Rules for processing both conforming and non-conforming content are defined in this specification. dt>Published specification:dd> This document is the relevant specification. dt>Applications that use this media type:dd> Web browsers. dt>Additional information:dd> dl>dt>Magic number(s):dd>Cache manifests begin with the string code>CACHE MANIFEST/code>, followed by either a U+0020 SPACE character, a U+0009 CHARACTER TABULATION (tab) character, a U+000A LINE FEED (LF) character, or a U+000D CARRIAGE RETURN (CR) character.dt>File extension(s):dd>code>appcache/code>dt>Macintosh file type code(s):dd>No specific Macintosh file type codes are recommended for this type./dl> dt>Person & email address to contact for further information:dd>Ian Hickson <ian@hixie.ch>dt>Intended usage:dd>Commondt>Restrictions on usage:dd>No restrictions apply.dt>Author:dd>Ian Hickson <ian@hixie.ch>dt>Change controller:dd>W3C/dl> p>a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idtext/cache-manifest:concept-url-fragment data-x-internalconcept-url-fragment>Fragments/a> have no meaning with code idtext/cache-manifest:text/cache-manifest>a href#text/cache-manifest>text/cache-manifest/a>/code> resources./p> h3 idtext/ping>span classsecno>16.5/span> dfn>code>text/ping/code>/dfn>a href#text/ping classself-link>/a>/h3> p>This registration is for community review and will be submitted to the IESG for review, approval, and registration with IANA./p> dl>dt>Type name:dd>textdt>Subtype name:dd>pingdt>Required parameters:dd>No parametersdt>Optional parameters:dd> dl>dt>code>charset/code>dd> p>The code>charset/code> parameter may be provided. The parameters value must be code>utf-8/code>. This parameter serves no purpose; it is only allowed for compatibility with legacy servers./p> /dl> dt>Encoding considerations:dd>Not applicable.dt>Security considerations:dd> p>If used exclusively in the fashion described in the context of a href#hyperlink-auditing idtext/ping:hyperlink-auditing>hyperlink auditing/a>, this type introduces no new security concerns./p> dt>Interoperability considerations:dd> Rules applicable to this type are defined in this specification. dt>Published specification:dd> This document is the relevant specification. dt>Applications that use this media type:dd> Web browsers. dt>Additional information:dd> dl>dt>Magic number(s):dd>code idtext/ping:text/ping>a href#text/ping>text/ping/a>/code> resources always consist of the four bytes 0x50 0x49 0x4E 0x47 (`code>PING/code>`).dt>File extension(s):dd>No specific file extension is recommended for this type.dt>Macintosh file type code(s):dd>No specific Macintosh file type codes are recommended for this type./dl> dt>Person & email address to contact for further information:dd>Ian Hickson <ian@hixie.ch>dt>Intended usage:dd>Commondt>Restrictions on usage:dd>Only intended for use with HTTP POST requests generated as part of a Web browsers processing of the code idtext/ping:ping>a href#ping>ping/a>/code> attribute.dt>Author:dd>Ian Hickson <ian@hixie.ch>dt>Change controller:dd>W3C/dl> p>a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idtext/ping:concept-url-fragment data-x-internalconcept-url-fragment>Fragments/a> have no meaning with code idtext/ping:text/ping-2>a href#text/ping>text/ping/a>/code> resources./p> h3 idapplication/microdata+json>span classsecno>16.6/span> dfn>code>application/microdata+json/code>/dfn>a href#application/microdata+json classself-link>/a>/h3> p>This registration is for community review and will be submitted to the IESG for review, approval, and registration with IANA./p> dl>dt>Type name:dd>applicationdt>Subtype name:dd>microdata+jsondt>Required parameters:dd>Same as for code idapplication/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 idapplication/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 idapplication/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 idapplication/microdata+json:application/json-4>a href#application/json>application/json/a>/code> a href#refsJSON>JSON/a>dt>Published specification:dd> Labeling a resource with the code idapplication/microdata+json:application/microdata+json>a href#application/microdata+json>application/microdata+json/a>/code> type asserts that the resource is a JSON text that consists of an object with a single entry called code>items/code> consisting of an array of entries, each of which consists of an object with an entry called code>id/code> whose value is a string, an entry called code>type/code> whose value is another string, and an entry called code>properties/code> whose value is an object whose entries each have a value consisting of an array of either objects or strings, the objects being of the same form as the objects in the aforementioned code>items/code> entry. Thus, the relevant specifications are the JSON specification and this specification. a href#refsJSON>JSON/a> dt>Applications that use this media type:dd> p>Applications that transfer data intended for use with HTMLs microdata feature, especially in the context of drag-and-drop, are the primary application class for this type./p> dt>Additional information:dd> dl>dt>Magic number(s):dd>Same as for code idapplication/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 idapplication/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 idapplication/microdata+json:application/json-7>a href#application/json>application/json/a>/code> a href#refsJSON>JSON/a>/dl> dt>Person & email address to contact for further information:dd>Ian Hickson <ian@hixie.ch>dt>Intended usage:dd>Commondt>Restrictions on usage:dd>No restrictions apply.dt>Author:dd>Ian Hickson <ian@hixie.ch>dt>Change controller:dd>W3C/dl> p>a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idapplication/microdata+json:concept-url-fragment data-x-internalconcept-url-fragment>Fragments/a> used with code idapplication/microdata+json:application/microdata+json-2>a href#application/microdata+json>application/microdata+json/a>/code> resources have the same semantics as when used with code idapplication/microdata+json:application/json-8>a href#application/json>application/json/a>/code> (namely, at the time of writing, no semantics at all). a href#refsJSON>JSON/a>/p> h3 idtext/event-stream>span classsecno>16.7/span> dfn>code>text/event-stream/code>/dfn>a href#text/event-stream classself-link>/a>/h3> p>This registration is for community review and will be submitted to the IESG for review, approval, and registration with IANA./p> dl>dt>Type name:dd>textdt>Subtype name:dd>event-streamdt>Required parameters:dd>No parametersdt>Optional parameters:dd> dl>dt>code>charset/code>dd> p>The code>charset/code> parameter may be provided. The parameters value must be code>utf-8/code>. This parameter serves no purpose; it is only allowed for compatibility with legacy servers./p> /dl> dt>Encoding considerations:dd>8bit (always UTF-8)dt>Security considerations:dd> p>An event stream from an origin distinct from the origin of the content consuming the event stream can result in information leakage. To avoid this, user agents are required to apply CORS semantics. a href#refsFETCH>FETCH/a>/p> p>Event streams can overwhelm a user agent; a user agent is expected to apply suitable restrictions to avoid depleting local resources because of an overabundance of information from an event stream./p> p>Servers can be overwhelmed if a situation develops in which the server is causing clients to reconnect rapidly. Servers should use a 5xx status code to indicate capacity problems, as this will prevent conforming clients from reconnecting automatically./p> dt>Interoperability considerations:dd> Rules for processing both conforming and non-conforming content are defined in this specification. dt>Published specification:dd> This document is the relevant specification. dt>Applications that use this media type:dd> Web browsers and tools using Web services. dt>Additional information:dd> dl>dt>Magic number(s):dd>No sequence of bytes can uniquely identify an event stream.dt>File extension(s):dd>No specific file extensions are recommended for this type.dt>Macintosh file type code(s):dd>No specific Macintosh file type codes are recommended for this type./dl> dt>Person & email address to contact for further information:dd>Ian Hickson <ian@hixie.ch>dt>Intended usage:dd>Commondt>Restrictions on usage:dd>This format is only expected to be used by dynamic open-ended streams served using HTTP or a similar protocol. Finite resources are not expected to be labeled with this type.dt>Author:dd>Ian Hickson <ian@hixie.ch>dt>Change controller:dd>W3C/dl> p>a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idtext/event-stream:concept-url-fragment data-x-internalconcept-url-fragment>Fragments/a> have no meaning with code idtext/event-stream:text/event-stream>a href#text/event-stream>text/event-stream/a>/code> resources./p> h3 idping-from>span classsecno>16.8/span> `dfn>code>Ping-From/code>/dfn>`a href#ping-from classself-link>/a>/h3> p>This section describes a header for registration in the Permanent Message Header Field Registry. a href#refsRFC3864>RFC3864/a>/p> dl>dt>Header field name:dd>Ping-Fromdt>Applicable protocol:dd>httpdt>Status:dd>standarddt>Author/Change controller:dd>W3Cdt>Specification document(s):dd> This document is the relevant specification. dt>Related information:dd>None./dl> h3 idping-to>span classsecno>16.9/span> `dfn>code>Ping-To/code>/dfn>`a href#ping-to classself-link>/a>/h3> p>This section describes a header for registration in the Permanent Message Header Field Registry. a href#refsRFC3864>RFC3864/a>/p> dl>dt>Header field name:dd>Ping-Todt>Applicable protocol:dd>httpdt>Status:dd>standarddt>Author/Change controller:dd>W3Cdt>Specification document(s):dd> This document is the relevant specification. dt>Related information:dd>None./dl> h3 idrefresh>span classsecno>16.10/span> `dfn>code>Refresh/code>/dfn>`a href#refresh classself-link>/a>/h3> p>This section describes a header for registration in the Permanent Message Header Field Registry. a href#refsRFC3864>RFC3864/a>/p> dl>dt>Header field name:dd>Refreshdt>Applicable protocol:dd>httpdt>Status:dd>standarddt>Author/Change controller:dd>WHATWGdt>Specification document(s):dd> This document is the relevant specification. dt>Related information:dd>None./dl> h3 idlast-event-id>span classsecno>16.11/span> `dfn>code>Last-Event-ID/code>/dfn>`a href#last-event-id classself-link>/a>/h3> p>This section describes a header for registration in the Permanent Message Header Field Registry. a href#refsRFC3864>RFC3864/a>/p> dl>dt>Header field name:dd>Last-Event-IDdt>Applicable protocol:dd>httpdt>Status:dd>standarddt>Author/Change controller:dd>W3Cdt>Specification document(s):dd> This document is the relevant specification. dt>Related information:dd>None./dl> h3 idweb+-scheme-prefix>span classsecno>16.12/span> dfn>code>web+/code> scheme prefix/dfn>a href#web+-scheme-prefix classself-link>/a>/h3>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classbugs>strong>Spec bugs:/strong> a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id18496 titleRegistries (IANA): Change the IANA sections to refer to the new registration system and not IANA>18496/a>, a hrefhttps://www.w3.org/Bugs/Public/show_bug.cgi?id18671 titleFind a solution to the problem of the IANA scheme registry being so incomplete (especially given web+)>18671/a>/div> p>This section describes a convention for use with the IANA URI scheme registry. It does not itself register a specific scheme. a href#refsRFC7595>RFC7595/a>/p> dl>dt>Scheme name:dd> Schemes starting with the four characters code>web+/code> followed by one or more letters in the range code>a/code>-code>z/code>. dt>Status:dd>Permanentdt>Scheme syntax:dd>Scheme-specific.dt>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 scheme name:dd>Scheme-specific.dt>Interoperability considerations:dd>The scheme is expected to be used in the context of Web applications.dt>Security considerations:dd> Any Web page is able to register a handler for all code>web+/code> schemes. As such, these schemes must not be used for features intended to be core platform features (e.g. network transfer protocols like HTTP or FTP). Similarly, such schemes must not store confidential information in their URLs, such as usernames, passwords, personal information, or confidential project names. dt>Contact:dd>Ian Hickson <ian@hixie.ch>dt>Change controller:dd>Ian Hickson <ian@hixie.ch>dt>References:dd> cite>Custom scheme handlers/cite>, HTML Living Standard: a href#custom-handlers>https://html.spec.whatwg.org/#custom-handlers/a> /dl> h2 idindex classno-num>Indexa href#index classself-link>/a>/h2> p>The following sections only cover conforming elements and features./p> h3 idelements-3 classno-num>Elementsa href#elements-3 classself-link>/a>/h3> p>i>This section is non-normative./i>/p> table>caption>List of elements/caption>thead>tr>th> Element th> Description th> Categories th> Parents† th> Children th> Attributes th> Interface tbody>tr>th>code idelements-3:the-a-element>a href#the-a-element>a/a>/code>td>Hyperlinktd>a href#flow-content-2 idelements-3:flow-content-2>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2>phrasing/a>*; a href#interactive-content-2 idelements-3:interactive-content-2>interactive/a>; a href#palpable-content-2 idelements-3:palpable-content-2>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-2>phrasing/a>td>a href#transparent idelements-3:transparent>transparent/a>*td>a href#global-attributes idelements-3:global-attributes>globals/a>; code idelements-3:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code>; code idelements-3:attr-hyperlink-target>a href#attr-hyperlink-target>target/a>/code>; code idelements-3:attr-hyperlink-download>a href#attr-hyperlink-download>download/a>/code>; code idelements-3:ping>a href#ping>ping/a>/code>; code idelements-3:attr-hyperlink-rel>a href#attr-hyperlink-rel>rel/a>/code>; code idelements-3:attr-hyperlink-hreflang>a href#attr-hyperlink-hreflang>hreflang/a>/code>; code idelements-3:attr-hyperlink-type>a href#attr-hyperlink-type>type/a>/code>; code idelements-3:attr-hyperlink-referrerpolicy>a href#attr-hyperlink-referrerpolicy>referrerpolicy/a>/code>td>code idelements-3:htmlanchorelement>a href#htmlanchorelement>HTMLAnchorElement/a>/code>tr>th>code idelements-3:the-abbr-element>a href#the-abbr-element>abbr/a>/code>td>Abbreviationtd>a href#flow-content-2 idelements-3:flow-content-2-2>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-3>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-2>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-4>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-5>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-2>globals/a>td>code idelements-3:htmlelement>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-address-element>a href#the-address-element>address/a>/code>td>Contact information for a page or code idelements-3:the-article-element>a href#the-article-element>article/a>/code> elementtd>a href#flow-content-2 idelements-3:flow-content-2-3>flow/a>; a href#palpable-content-2 idelements-3:palpable-content-2-3>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-4>flow/a>td>a href#flow-content-2 idelements-3:flow-content-2-5>flow/a>*td>a href#global-attributes idelements-3:global-attributes-3>globals/a>td>code idelements-3:htmlelement-2>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-area-element>a href#the-area-element>area/a>/code>td>Hyperlink or dead area on an image maptd>a href#flow-content-2 idelements-3:flow-content-2-6>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-6>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-7>phrasing/a>*td>emptytd>a href#global-attributes idelements-3:global-attributes-4>globals/a>; code idelements-3:attr-area-alt>a href#attr-area-alt>alt/a>/code>; code idelements-3:attr-area-coords>a href#attr-area-coords>coords/a>/code>; code idelements-3:attr-area-shape>a href#attr-area-shape>shape/a>/code>; code idelements-3:attr-hyperlink-href-2>a href#attr-hyperlink-href>href/a>/code>; code idelements-3:attr-hyperlink-target-2>a href#attr-hyperlink-target>target/a>/code>; code idelements-3:attr-hyperlink-download-2>a href#attr-hyperlink-download>download/a>/code>; code idelements-3:ping-2>a href#ping>ping/a>/code>; code idelements-3:attr-hyperlink-rel-2>a href#attr-hyperlink-rel>rel/a>/code>; code idelements-3:attr-hyperlink-referrerpolicy-2>a href#attr-hyperlink-referrerpolicy>referrerpolicy/a>/code>td>code idelements-3:htmlareaelement>a href#htmlareaelement>HTMLAreaElement/a>/code>tr>th>code idelements-3:the-article-element-2>a href#the-article-element>article/a>/code>td>Self-contained syndicatable or reusable compositiontd>a href#flow-content-2 idelements-3:flow-content-2-7>flow/a>; a href#sectioning-content-2 idelements-3:sectioning-content-2>sectioning/a>; a href#palpable-content-2 idelements-3:palpable-content-2-4>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-8>flow/a>td>a href#flow-content-2 idelements-3:flow-content-2-9>flow/a>td>a href#global-attributes idelements-3:global-attributes-5>globals/a>td>code idelements-3:htmlelement-3>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-aside-element>a href#the-aside-element>aside/a>/code>td>Sidebar for tangentially related contenttd>a href#flow-content-2 idelements-3:flow-content-2-10>flow/a>; a href#sectioning-content-2 idelements-3:sectioning-content-2-2>sectioning/a>; a href#palpable-content-2 idelements-3:palpable-content-2-5>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-11>flow/a>td>a href#flow-content-2 idelements-3:flow-content-2-12>flow/a>td>a href#global-attributes idelements-3:global-attributes-6>globals/a>td>code idelements-3:htmlelement-4>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-audio-element>a href#the-audio-element>audio/a>/code>td>Audio playertd>a href#flow-content-2 idelements-3:flow-content-2-13>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-8>phrasing/a>; a href#embedded-content-category idelements-3:embedded-content-category>embedded/a>; a href#interactive-content-2 idelements-3:interactive-content-2-2>interactive/a>; a href#palpable-content-2 idelements-3:palpable-content-2-6>palpable/a>*td>a href#phrasing-content-2 idelements-3:phrasing-content-2-9>phrasing/a>td>code idelements-3:the-source-element>a href#the-source-element>source/a>/code>*; code idelements-3:the-track-element>a href#the-track-element>track/a>/code>*; a href#transparent idelements-3:transparent-2>transparent/a>*td>a href#global-attributes idelements-3:global-attributes-7>globals/a>; code idelements-3:attr-media-src>a href#attr-media-src>src/a>/code>; code idelements-3:attr-media-crossorigin>a href#attr-media-crossorigin>crossorigin/a>/code>; code idelements-3:attr-media-preload>a href#attr-media-preload>preload/a>/code>; code idelements-3:attr-media-autoplay>a href#attr-media-autoplay>autoplay/a>/code>; code idelements-3:attr-media-loop>a href#attr-media-loop>loop/a>/code>; code idelements-3:attr-media-muted>a href#attr-media-muted>muted/a>/code>; code idelements-3:attr-media-controls>a href#attr-media-controls>controls/a>/code>td>code idelements-3:htmlaudioelement>a href#htmlaudioelement>HTMLAudioElement/a>/code>tr>th>code idelements-3:the-b-element>a href#the-b-element>b/a>/code>td>Keywordstd>a href#flow-content-2 idelements-3:flow-content-2-14>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-10>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-7>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-11>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-12>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-8>globals/a>td>code idelements-3:htmlelement-5>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-base-element>a href#the-base-element>base/a>/code>td>Base URL and default target a href#browsing-context idelements-3:browsing-context>browsing context/a> for a href#attr-hyperlink-target idelements-3:attr-hyperlink-target-3>hyperlinks/a> and a href#attr-fs-target idelements-3:attr-fs-target>forms/a>td>a href#metadata-content-2 idelements-3:metadata-content-2>metadata/a>td>code idelements-3:the-head-element>a href#the-head-element>head/a>/code>td>emptytd>a href#global-attributes idelements-3:global-attributes-9>globals/a>; code idelements-3:attr-base-href>a href#attr-base-href>href/a>/code>; code idelements-3:attr-base-target>a href#attr-base-target>target/a>/code>td>code idelements-3:htmlbaseelement>a href#htmlbaseelement>HTMLBaseElement/a>/code>tr>th>code idelements-3:the-bdi-element>a href#the-bdi-element>bdi/a>/code>td>Text directionality isolationtd>a href#flow-content-2 idelements-3:flow-content-2-15>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-13>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-8>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-14>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-15>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-10>globals/a>td>code idelements-3:htmlelement-6>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-bdo-element>a href#the-bdo-element>bdo/a>/code>td>Text directionality formattingtd>a href#flow-content-2 idelements-3:flow-content-2-16>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-16>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-9>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-17>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-18>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-11>globals/a>td>code idelements-3:htmlelement-7>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-blockquote-element>a href#the-blockquote-element>blockquote/a>/code>td>A section quoted from another sourcetd>a href#flow-content-2 idelements-3:flow-content-2-17>flow/a>; a href#sectioning-root idelements-3:sectioning-root>sectioning root/a>; a href#palpable-content-2 idelements-3:palpable-content-2-10>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-18>flow/a>td>a href#flow-content-2 idelements-3:flow-content-2-19>flow/a>td>a href#global-attributes idelements-3:global-attributes-12>globals/a>; code idelements-3:attr-blockquote-cite>a href#attr-blockquote-cite>cite/a>/code>td>code idelements-3:htmlquoteelement>a href#htmlquoteelement>HTMLQuoteElement/a>/code>tr>th>code idelements-3:the-body-element>a href#the-body-element>body/a>/code>td>Document bodytd>a href#sectioning-root idelements-3:sectioning-root-2>sectioning root/a>td>code idelements-3:the-html-element>a href#the-html-element>html/a>/code>td>a href#flow-content-2 idelements-3:flow-content-2-20>flow/a>td>a href#global-attributes idelements-3:global-attributes-13>globals/a>; code idelements-3:handler-window-onafterprint>a href#handler-window-onafterprint>onafterprint/a>/code>; code idelements-3:handler-window-onbeforeprint>a href#handler-window-onbeforeprint>onbeforeprint/a>/code>; code idelements-3:handler-window-onbeforeunload>a href#handler-window-onbeforeunload>onbeforeunload/a>/code>; code idelements-3:handler-window-onhashchange>a href#handler-window-onhashchange>onhashchange/a>/code>; code idelements-3:handler-window-onlanguagechange>a href#handler-window-onlanguagechange>onlanguagechange/a>/code>; code idelements-3:handler-window-onmessage>a href#handler-window-onmessage>onmessage/a>/code>; code idelements-3:handler-window-onmessageerror>a href#handler-window-onmessageerror>onmessageerror/a>/code>; code idelements-3:handler-window-onoffline>a href#handler-window-onoffline>onoffline/a>/code>; code idelements-3:handler-window-ononline>a href#handler-window-ononline>ononline/a>/code>; code idelements-3:handler-window-onpagehide>a href#handler-window-onpagehide>onpagehide/a>/code>; code idelements-3:handler-window-onpageshow>a href#handler-window-onpageshow>onpageshow/a>/code>; code idelements-3:handler-window-onpopstate>a href#handler-window-onpopstate>onpopstate/a>/code>; code idelements-3:handler-window-onrejectionhandled>a href#handler-window-onrejectionhandled>onrejectionhandled/a>/code>; code idelements-3:handler-window-onstorage>a href#handler-window-onstorage>onstorage/a>/code>; code idelements-3:handler-window-onunhandledrejection>a href#handler-window-onunhandledrejection>onunhandledrejection/a>/code>; code idelements-3:handler-window-onunload>a href#handler-window-onunload>onunload/a>/code>td>code idelements-3:htmlbodyelement>a href#htmlbodyelement>HTMLBodyElement/a>/code>tr>th>code idelements-3:the-br-element>a href#the-br-element>br/a>/code>td>Line break, e.g. in poem or postal addresstd>a href#flow-content-2 idelements-3:flow-content-2-21>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-19>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-20>phrasing/a>td>emptytd>a href#global-attributes idelements-3:global-attributes-14>globals/a>td>code idelements-3:htmlbrelement>a href#htmlbrelement>HTMLBRElement/a>/code>tr>th>code idelements-3:the-button-element>a href#the-button-element>button/a>/code>td>Button controltd>a href#flow-content-2 idelements-3:flow-content-2-22>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-21>phrasing/a>; a href#interactive-content-2 idelements-3:interactive-content-2-3>interactive/a>; a href#category-listed idelements-3:category-listed>listed/a>; a href#category-label idelements-3:category-label>labelable/a>; a href#category-submit idelements-3:category-submit>submittable/a>; a href#form-associated-element idelements-3:form-associated-element>form-associated/a>; a href#palpable-content-2 idelements-3:palpable-content-2-11>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-22>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-23>phrasing/a>*td>a href#global-attributes idelements-3:global-attributes-15>globals/a>; code idelements-3:attr-fe-autofocus>a href#attr-fe-autofocus>autofocus/a>/code>; code idelements-3:attr-fe-disabled>a href#attr-fe-disabled>disabled/a>/code>; code idelements-3:attr-fae-form>a href#attr-fae-form>form/a>/code>; code idelements-3:attr-fs-formaction>a href#attr-fs-formaction>formaction/a>/code>; code idelements-3:attr-fs-formenctype>a href#attr-fs-formenctype>formenctype/a>/code>; code idelements-3:attr-fs-formmethod>a href#attr-fs-formmethod>formmethod/a>/code>; code idelements-3:attr-fs-formnovalidate>a href#attr-fs-formnovalidate>formnovalidate/a>/code>; code idelements-3:attr-fs-formtarget>a href#attr-fs-formtarget>formtarget/a>/code>; code idelements-3:attr-fe-name>a href#attr-fe-name>name/a>/code>; code idelements-3:attr-button-type>a href#attr-button-type>type/a>/code>; code idelements-3:attr-button-value>a href#attr-button-value>value/a>/code>td>code idelements-3:htmlbuttonelement>a href#htmlbuttonelement>HTMLButtonElement/a>/code>tr>th>code idelements-3:the-canvas-element>a href#the-canvas-element>canvas/a>/code>td>Scriptable bitmap canvastd>a href#flow-content-2 idelements-3:flow-content-2-23>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-24>phrasing/a>; a href#embedded-content-category idelements-3:embedded-content-category-2>embedded/a>; a href#palpable-content-2 idelements-3:palpable-content-2-12>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-25>phrasing/a>td>a href#transparent idelements-3:transparent-3>transparent/a>td>a href#global-attributes idelements-3:global-attributes-16>globals/a>; code idelements-3:attr-canvas-width>a href#attr-canvas-width>width/a>/code>; code idelements-3:attr-canvas-height>a href#attr-canvas-height>height/a>/code>td>code idelements-3:htmlcanvaselement>a href#htmlcanvaselement>HTMLCanvasElement/a>/code>tr>th>code idelements-3:the-caption-element>a href#the-caption-element>caption/a>/code>td>Table captiontd>nonetd>code idelements-3:the-table-element>a href#the-table-element>table/a>/code>td>a href#flow-content-2 idelements-3:flow-content-2-24>flow/a>*td>a href#global-attributes idelements-3:global-attributes-17>globals/a>td>code idelements-3:htmltablecaptionelement>a href#htmltablecaptionelement>HTMLTableCaptionElement/a>/code>tr>th>code idelements-3:the-cite-element>a href#the-cite-element>cite/a>/code>td>Title of a worktd>a href#flow-content-2 idelements-3:flow-content-2-25>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-26>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-13>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-27>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-28>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-18>globals/a>td>code idelements-3:htmlelement-8>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-code-element>a href#the-code-element>code/a>/code>td>Computer codetd>a href#flow-content-2 idelements-3:flow-content-2-26>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-29>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-14>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-30>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-31>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-19>globals/a>td>code idelements-3:htmlelement-9>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-col-element>a href#the-col-element>col/a>/code>td>Table columntd>nonetd>code idelements-3:the-colgroup-element>a href#the-colgroup-element>colgroup/a>/code>td>emptytd>a href#global-attributes idelements-3:global-attributes-20>globals/a>; code idelements-3:attr-col-span>a href#attr-col-span>span/a>/code>td>code idelements-3:htmltablecolelement>a href#htmltablecolelement>HTMLTableColElement/a>/code>tr>th>code idelements-3:the-colgroup-element-2>a href#the-colgroup-element>colgroup/a>/code>td>Group of columns in a tabletd>nonetd>code idelements-3:the-table-element-2>a href#the-table-element>table/a>/code>td>code idelements-3:the-col-element-2>a href#the-col-element>col/a>/code>*; code idelements-3:the-template-element>a href#the-template-element>template/a>/code>*td>a href#global-attributes idelements-3:global-attributes-21>globals/a>; code idelements-3:attr-colgroup-span>a href#attr-colgroup-span>span/a>/code>td>code idelements-3:htmltablecolelement-2>a href#htmltablecolelement>HTMLTableColElement/a>/code>tr>th>code idelements-3:the-data-element>a href#the-data-element>data/a>/code>td>Machine-readable equivalenttd>a href#flow-content-2 idelements-3:flow-content-2-27>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-32>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-15>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-33>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-34>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-22>globals/a>; code idelements-3:attr-data-value>a href#attr-data-value>value/a>/code>td>code idelements-3:htmldataelement>a href#htmldataelement>HTMLDataElement/a>/code>tr>th>code idelements-3:the-datalist-element>a href#the-datalist-element>datalist/a>/code>td>Container for options for a href#attr-input-list idelements-3:attr-input-list>combo box control/a>td>a href#flow-content-2 idelements-3:flow-content-2-28>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-35>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-36>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-37>phrasing/a>*; code idelements-3:the-option-element>a href#the-option-element>option/a>/code>*; a href#script-supporting-elements-2 idelements-3:script-supporting-elements-2>script-supporting elements/a>*td>a href#global-attributes idelements-3:global-attributes-23>globals/a>td>code idelements-3:htmldatalistelement>a href#htmldatalistelement>HTMLDataListElement/a>/code>tr>th>code idelements-3:the-dd-element>a href#the-dd-element>dd/a>/code>td>Content for corresponding code idelements-3:the-dt-element>a href#the-dt-element>dt/a>/code> element(s)td>nonetd>code idelements-3:the-dl-element>a href#the-dl-element>dl/a>/code>; code idelements-3:the-div-element>a href#the-div-element>div/a>/code>*td>a href#flow-content-2 idelements-3:flow-content-2-29>flow/a>td>a href#global-attributes idelements-3:global-attributes-24>globals/a>td>code idelements-3:htmlelement-10>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-del-element>a href#the-del-element>del/a>/code>td>A removal from the documenttd>a href#flow-content-2 idelements-3:flow-content-2-30>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-38>phrasing/a>*td>a href#phrasing-content-2 idelements-3:phrasing-content-2-39>phrasing/a>td>a href#transparent idelements-3:transparent-4>transparent/a>td>a href#global-attributes idelements-3:global-attributes-25>globals/a>; code idelements-3:attr-mod-cite>a href#attr-mod-cite>cite/a>/code>; code idelements-3:attr-mod-datetime>a href#attr-mod-datetime>datetime/a>/code>td>code idelements-3:htmlmodelement>a href#htmlmodelement>HTMLModElement/a>/code>tr>th>code idelements-3:the-details-element>a href#the-details-element>details/a>/code>td>Disclosure control for hiding detailstd>a href#flow-content-2 idelements-3:flow-content-2-31>flow/a>; a href#sectioning-root idelements-3:sectioning-root-3>sectioning root/a>; a href#interactive-content-2 idelements-3:interactive-content-2-4>interactive/a>; a href#palpable-content-2 idelements-3:palpable-content-2-16>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-32>flow/a>td>code idelements-3:the-summary-element>a href#the-summary-element>summary/a>/code>*; a href#flow-content-2 idelements-3:flow-content-2-33>flow/a>td>a href#global-attributes idelements-3:global-attributes-26>globals/a>; code idelements-3:attr-details-open>a href#attr-details-open>open/a>/code>td>code idelements-3:htmldetailselement>a href#htmldetailselement>HTMLDetailsElement/a>/code>tr>th>code idelements-3:the-dfn-element>a href#the-dfn-element>dfn/a>/code>td>Defining instancetd>a href#flow-content-2 idelements-3:flow-content-2-34>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-40>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-17>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-41>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-42>phrasing/a>*td>a href#global-attributes idelements-3:global-attributes-27>globals/a>td>code idelements-3:htmlelement-11>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-dialog-element>a href#the-dialog-element>dialog/a>/code>td>Dialog box or windowtd>a href#flow-content-2 idelements-3:flow-content-2-35>flow/a>; a href#sectioning-root idelements-3:sectioning-root-4>sectioning root/a>td>a href#flow-content-2 idelements-3:flow-content-2-36>flow/a>td>a href#flow-content-2 idelements-3:flow-content-2-37>flow/a>td>a href#global-attributes idelements-3:global-attributes-28>globals/a>; code idelements-3:attr-dialog-open>a href#attr-dialog-open>open/a>/code>td>code idelements-3:htmldialogelement>a href#htmldialogelement>HTMLDialogElement/a>/code>tr>th>code idelements-3:the-div-element-2>a href#the-div-element>div/a>/code>td>Generic flow container, or container for name-value groups in code idelements-3:the-dl-element-2>a href#the-dl-element>dl/a>/code> elementstd>a href#flow-content-2 idelements-3:flow-content-2-38>flow/a>; a href#palpable-content-2 idelements-3:palpable-content-2-18>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-39>flow/a>; code idelements-3:the-dl-element-3>a href#the-dl-element>dl/a>/code>td>a href#flow-content-2 idelements-3:flow-content-2-40>flow/a>td>a href#global-attributes idelements-3:global-attributes-29>globals/a>td>code idelements-3:htmldivelement>a href#htmldivelement>HTMLDivElement/a>/code>tr>th>code idelements-3:the-dl-element-4>a href#the-dl-element>dl/a>/code>td>Association list consisting of zero or more name-value groupstd>a href#flow-content-2 idelements-3:flow-content-2-41>flow/a>; a href#palpable-content-2 idelements-3:palpable-content-2-19>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-42>flow/a>td>code idelements-3:the-dt-element-2>a href#the-dt-element>dt/a>/code>*; code idelements-3:the-dd-element-2>a href#the-dd-element>dd/a>/code>*; code idelements-3:the-div-element-3>a href#the-div-element>div/a>/code>*; a href#script-supporting-elements-2 idelements-3:script-supporting-elements-2-2>script-supporting elements/a>td>a href#global-attributes idelements-3:global-attributes-30>globals/a>td>code idelements-3:htmldlistelement>a href#htmldlistelement>HTMLDListElement/a>/code>tr>th>code idelements-3:the-dt-element-3>a href#the-dt-element>dt/a>/code>td>Legend for corresponding code idelements-3:the-dd-element-3>a href#the-dd-element>dd/a>/code> element(s)td>nonetd>code idelements-3:the-dl-element-5>a href#the-dl-element>dl/a>/code>; code idelements-3:the-div-element-4>a href#the-div-element>div/a>/code>*td>a href#flow-content-2 idelements-3:flow-content-2-43>flow/a>*td>a href#global-attributes idelements-3:global-attributes-31>globals/a>td>code idelements-3:htmlelement-12>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-em-element>a href#the-em-element>em/a>/code>td>Stress emphasistd>a href#flow-content-2 idelements-3:flow-content-2-44>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-43>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-20>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-44>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-45>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-32>globals/a>td>code idelements-3:htmlelement-13>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-embed-element>a href#the-embed-element>embed/a>/code>td>a href#plugin idelements-3:plugin>Plugin/a>td>a href#flow-content-2 idelements-3:flow-content-2-45>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-46>phrasing/a>; a href#embedded-content-category idelements-3:embedded-content-category-3>embedded/a>; a href#interactive-content-2 idelements-3:interactive-content-2-5>interactive/a>; a href#palpable-content-2 idelements-3:palpable-content-2-21>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-47>phrasing/a>td>emptytd>a href#global-attributes idelements-3:global-attributes-33>globals/a>; code idelements-3:attr-embed-src>a href#attr-embed-src>src/a>/code>; code idelements-3:attr-embed-type>a href#attr-embed-type>type/a>/code>; code idelements-3:attr-dim-width>a href#attr-dim-width>width/a>/code>; code idelements-3:attr-dim-height>a href#attr-dim-height>height/a>/code>; any*td>code idelements-3:htmlembedelement>a href#htmlembedelement>HTMLEmbedElement/a>/code>tr>th>code idelements-3:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code>td>Group of form controlstd>a href#flow-content-2 idelements-3:flow-content-2-46>flow/a>; a href#sectioning-root idelements-3:sectioning-root-5>sectioning root/a>; a href#category-listed idelements-3:category-listed-2>listed/a>; a href#form-associated-element idelements-3:form-associated-element-2>form-associated/a>; a href#palpable-content-2 idelements-3:palpable-content-2-22>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-47>flow/a>td>code idelements-3:the-legend-element>a href#the-legend-element>legend/a>/code>*; a href#flow-content-2 idelements-3:flow-content-2-48>flow/a>td>a href#global-attributes idelements-3:global-attributes-34>globals/a>; code idelements-3:attr-fieldset-disabled>a href#attr-fieldset-disabled>disabled/a>/code>; code idelements-3:attr-fae-form-2>a href#attr-fae-form>form/a>/code>; code idelements-3:attr-fe-name-2>a href#attr-fe-name>name/a>/code>td>code idelements-3:htmlfieldsetelement>a href#htmlfieldsetelement>HTMLFieldSetElement/a>/code>tr>th>code idelements-3:the-figcaption-element>a href#the-figcaption-element>figcaption/a>/code>td>Caption for code idelements-3:the-figure-element>a href#the-figure-element>figure/a>/code>td>nonetd>code idelements-3:the-figure-element-2>a href#the-figure-element>figure/a>/code>td>a href#flow-content-2 idelements-3:flow-content-2-49>flow/a>td>a href#global-attributes idelements-3:global-attributes-35>globals/a>td>code idelements-3:htmlelement-14>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-figure-element-3>a href#the-figure-element>figure/a>/code>td>Figure with optional captiontd>a href#flow-content-2 idelements-3:flow-content-2-50>flow/a>; a href#sectioning-root idelements-3:sectioning-root-6>sectioning root/a>; a href#palpable-content-2 idelements-3:palpable-content-2-23>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-51>flow/a>td>code idelements-3:the-figcaption-element-2>a href#the-figcaption-element>figcaption/a>/code>*; a href#flow-content-2 idelements-3:flow-content-2-52>flow/a>td>a href#global-attributes idelements-3:global-attributes-36>globals/a>td>code idelements-3:htmlelement-15>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-footer-element>a href#the-footer-element>footer/a>/code>td>Footer for a page or sectiontd>a href#flow-content-2 idelements-3:flow-content-2-53>flow/a>; a href#palpable-content-2 idelements-3:palpable-content-2-24>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-54>flow/a>td>a href#flow-content-2 idelements-3:flow-content-2-55>flow/a>*td>a href#global-attributes idelements-3:global-attributes-37>globals/a>td>code idelements-3:htmlelement-16>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-form-element>a href#the-form-element>form/a>/code>td>User-submittable formtd>a href#flow-content-2 idelements-3:flow-content-2-56>flow/a>; a href#palpable-content-2 idelements-3:palpable-content-2-25>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-57>flow/a>td>a href#flow-content-2 idelements-3:flow-content-2-58>flow/a>*td>a href#global-attributes idelements-3:global-attributes-38>globals/a>; code idelements-3:attr-form-accept-charset>a href#attr-form-accept-charset>accept-charset/a>/code>; code idelements-3:attr-fs-action>a href#attr-fs-action>action/a>/code>; code idelements-3:attr-form-autocomplete>a href#attr-form-autocomplete>autocomplete/a>/code>; code idelements-3:attr-fs-enctype>a href#attr-fs-enctype>enctype/a>/code>; code idelements-3:attr-fs-method>a href#attr-fs-method>method/a>/code>; code idelements-3:attr-form-name>a href#attr-form-name>name/a>/code>; code idelements-3:attr-fs-novalidate>a href#attr-fs-novalidate>novalidate/a>/code>; code idelements-3:attr-fs-target-2>a href#attr-fs-target>target/a>/code>td>code idelements-3:htmlformelement>a href#htmlformelement>HTMLFormElement/a>/code>tr>th>code idelements-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 idelements-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 idelements-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 idelements-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 idelements-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 idelements-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 headingtd>a href#flow-content-2 idelements-3:flow-content-2-59>flow/a>; a href#heading-content-2 idelements-3:heading-content-2>heading/a>; a href#palpable-content-2 idelements-3:palpable-content-2-26>palpable/a>td>code idelements-3:the-hgroup-element>a href#the-hgroup-element>hgroup/a>/code>; a href#flow-content-2 idelements-3:flow-content-2-60>flow/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-48>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-39>globals/a>td>code idelements-3:htmlheadingelement>a href#htmlheadingelement>HTMLHeadingElement/a>/code>tr>th>code idelements-3:the-head-element-2>a href#the-head-element>head/a>/code>td>Container for document metadatatd>nonetd>code idelements-3:the-html-element-2>a href#the-html-element>html/a>/code>td>a href#metadata-content-2 idelements-3:metadata-content-2-2>metadata content/a>*td>a href#global-attributes idelements-3:global-attributes-40>globals/a>td>code idelements-3:htmlheadelement>a href#htmlheadelement>HTMLHeadElement/a>/code>tr>th>code idelements-3:the-header-element>a href#the-header-element>header/a>/code>td>Introductory or navigational aids for a page or sectiontd>a href#flow-content-2 idelements-3:flow-content-2-61>flow/a>; a href#palpable-content-2 idelements-3:palpable-content-2-27>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-62>flow/a>td>a href#flow-content-2 idelements-3:flow-content-2-63>flow/a>*td>a href#global-attributes idelements-3:global-attributes-41>globals/a>td>code idelements-3:htmlelement-17>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-hgroup-element-2>a href#the-hgroup-element>hgroup/a>/code>td>heading grouptd>a href#flow-content-2 idelements-3:flow-content-2-64>flow/a>; a href#heading-content-2 idelements-3:heading-content-2-2>heading/a>; a href#palpable-content-2 idelements-3:palpable-content-2-28>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-65>flow/a>td>One or more code idelements-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 idelements-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 idelements-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 idelements-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 idelements-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 idelements-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 idelements-3:the-template-element-2>a href#the-template-element>template/a>/code>td>a href#global-attributes idelements-3:global-attributes-42>globals/a>td>code idelements-3:htmlelement-18>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-hr-element>a href#the-hr-element>hr/a>/code>td>Thematic breaktd>a href#flow-content-2 idelements-3:flow-content-2-66>flow/a>td>a href#flow-content-2 idelements-3:flow-content-2-67>flow/a>td>emptytd>a href#global-attributes idelements-3:global-attributes-43>globals/a>td>code idelements-3:htmlhrelement>a href#htmlhrelement>HTMLHRElement/a>/code>tr>th>code idelements-3:the-html-element-3>a href#the-html-element>html/a>/code>td>Root elementtd>nonetd>none*td>code idelements-3:the-head-element-3>a href#the-head-element>head/a>/code>*; code idelements-3:the-body-element-2>a href#the-body-element>body/a>/code>*td>a href#global-attributes idelements-3:global-attributes-44>globals/a>; code idelements-3:attr-html-manifest>a href#attr-html-manifest>manifest/a>/code>td>code idelements-3:htmlhtmlelement>a href#htmlhtmlelement>HTMLHtmlElement/a>/code>tr>th>code idelements-3:the-i-element>a href#the-i-element>i/a>/code>td>Alternate voicetd>a href#flow-content-2 idelements-3:flow-content-2-68>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-49>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-29>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-50>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-51>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-45>globals/a>td>code idelements-3:htmlelement-19>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-iframe-element>a href#the-iframe-element>iframe/a>/code>td>a href#nested-browsing-context idelements-3:nested-browsing-context>Nested browsing context/a>td>a href#flow-content-2 idelements-3:flow-content-2-69>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-52>phrasing/a>; a href#embedded-content-category idelements-3:embedded-content-category-4>embedded/a>; a href#interactive-content-2 idelements-3:interactive-content-2-6>interactive/a>; a href#palpable-content-2 idelements-3:palpable-content-2-30>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-53>phrasing/a>td>emptytd>a href#global-attributes idelements-3:global-attributes-46>globals/a>; code idelements-3:attr-iframe-src>a href#attr-iframe-src>src/a>/code>; code idelements-3:attr-iframe-srcdoc>a href#attr-iframe-srcdoc>srcdoc/a>/code>; code idelements-3:attr-iframe-name>a href#attr-iframe-name>name/a>/code>; code idelements-3:attr-iframe-sandbox>a href#attr-iframe-sandbox>sandbox/a>/code>; code idelements-3:attr-iframe-allowfullscreen>a href#attr-iframe-allowfullscreen>allowfullscreen/a>/code>; code idelements-3:attr-iframe-allowpaymentrequest>a href#attr-iframe-allowpaymentrequest>allowpaymentrequest/a>/code>; code idelements-3:attr-iframe-allowusermedia>a href#attr-iframe-allowusermedia>allowusermedia/a>/code>; code idelements-3:attr-dim-width-2>a href#attr-dim-width>width/a>/code>; code idelements-3:attr-dim-height-2>a href#attr-dim-height>height/a>/code>; code idelements-3:attr-iframe-referrerpolicy>a href#attr-iframe-referrerpolicy>referrerpolicy/a>/code>td>code idelements-3:htmliframeelement>a href#htmliframeelement>HTMLIFrameElement/a>/code>tr>th>code idelements-3:the-img-element>a href#the-img-element>img/a>/code>td>Imagetd>a href#flow-content-2 idelements-3:flow-content-2-70>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-54>phrasing/a>; a href#embedded-content-category idelements-3:embedded-content-category-5>embedded/a>; a href#interactive-content-2 idelements-3:interactive-content-2-7>interactive/a>*; a href#form-associated-element idelements-3:form-associated-element-3>form-associated/a>; a href#palpable-content-2 idelements-3:palpable-content-2-31>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-55>phrasing/a>; code idelements-3:the-picture-element>a href#the-picture-element>picture/a>/code>td>emptytd>a href#global-attributes idelements-3:global-attributes-47>globals/a>; code idelements-3:attr-img-alt>a href#attr-img-alt>alt/a>/code>; code idelements-3:attr-img-src>a href#attr-img-src>src/a>/code>; code idelements-3:attr-img-srcset>a href#attr-img-srcset>srcset/a>/code>; code idelements-3:attr-img-crossorigin>a href#attr-img-crossorigin>crossorigin/a>/code>; code idelements-3:attr-hyperlink-usemap>a href#attr-hyperlink-usemap>usemap/a>/code>; code idelements-3:attr-img-ismap>a href#attr-img-ismap>ismap/a>/code>; code idelements-3:attr-dim-width-3>a href#attr-dim-width>width/a>/code>; code idelements-3:attr-dim-height-3>a href#attr-dim-height>height/a>/code>; code idelements-3:attr-img-referrerpolicy>a href#attr-img-referrerpolicy>referrerpolicy/a>/code>td>code idelements-3:htmlimageelement>a href#htmlimageelement>HTMLImageElement/a>/code>tr>th>code idelements-3:the-input-element>a href#the-input-element>input/a>/code>td>Form controltd>a href#flow-content-2 idelements-3:flow-content-2-71>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-56>phrasing/a>; a href#interactive-content-2 idelements-3:interactive-content-2-8>interactive/a>*; a href#category-listed idelements-3:category-listed-3>listed/a>; a href#category-label idelements-3:category-label-2>labelable/a>; a href#category-submit idelements-3:category-submit-2>submittable/a>; a href#category-reset idelements-3:category-reset>resettable/a>; a href#form-associated-element idelements-3:form-associated-element-4>form-associated/a>; a href#palpable-content-2 idelements-3:palpable-content-2-32>palpable/a>*td>a href#phrasing-content-2 idelements-3:phrasing-content-2-57>phrasing/a>td>emptytd>a href#global-attributes idelements-3:global-attributes-48>globals/a>; code idelements-3:attr-input-accept>a href#attr-input-accept>accept/a>/code>; code idelements-3:attr-input-alt>a href#attr-input-alt>alt/a>/code>; code idelements-3:attr-fe-autocomplete>a href#attr-fe-autocomplete>autocomplete/a>/code>; code idelements-3:attr-fe-autofocus-2>a href#attr-fe-autofocus>autofocus/a>/code>; code idelements-3:attr-input-checked>a href#attr-input-checked>checked/a>/code>; code idelements-3:attr-fe-dirname>a href#attr-fe-dirname>dirname/a>/code>; code idelements-3:attr-fe-disabled-2>a href#attr-fe-disabled>disabled/a>/code>; code idelements-3:attr-fae-form-3>a href#attr-fae-form>form/a>/code>; code idelements-3:attr-fs-formaction-2>a href#attr-fs-formaction>formaction/a>/code>; code idelements-3:attr-fs-formenctype-2>a href#attr-fs-formenctype>formenctype/a>/code>; code idelements-3:attr-fs-formmethod-2>a href#attr-fs-formmethod>formmethod/a>/code>; code idelements-3:attr-fs-formnovalidate-2>a href#attr-fs-formnovalidate>formnovalidate/a>/code>; code idelements-3:attr-fs-formtarget-2>a href#attr-fs-formtarget>formtarget/a>/code>; code idelements-3:attr-dim-height-4>a href#attr-dim-height>height/a>/code>; code idelements-3:attr-fe-inputmode>a href#attr-fe-inputmode>inputmode/a>/code>; code idelements-3:attr-input-list-2>a href#attr-input-list>list/a>/code>; code idelements-3:attr-input-max>a href#attr-input-max>max/a>/code>; code idelements-3:attr-input-maxlength>a href#attr-input-maxlength>maxlength/a>/code>; code idelements-3:attr-input-min>a href#attr-input-min>min/a>/code>; code idelements-3:attr-input-minlength>a href#attr-input-minlength>minlength/a>/code>; code idelements-3:attr-input-multiple>a href#attr-input-multiple>multiple/a>/code>; code idelements-3:attr-fe-name-3>a href#attr-fe-name>name/a>/code>; code idelements-3:attr-input-pattern>a href#attr-input-pattern>pattern/a>/code>; code idelements-3:attr-input-placeholder>a href#attr-input-placeholder>placeholder/a>/code>; code idelements-3:attr-input-readonly>a href#attr-input-readonly>readonly/a>/code>; code idelements-3:attr-input-required>a href#attr-input-required>required/a>/code>; code idelements-3:attr-input-size>a href#attr-input-size>size/a>/code>; code idelements-3:attr-input-src>a href#attr-input-src>src/a>/code>; code idelements-3:attr-input-step>a href#attr-input-step>step/a>/code>; code idelements-3:attr-input-type>a href#attr-input-type>type/a>/code>; code idelements-3:attr-input-value>a href#attr-input-value>value/a>/code>; code idelements-3:attr-dim-width-4>a href#attr-dim-width>width/a>/code>td>code idelements-3:htmlinputelement>a href#htmlinputelement>HTMLInputElement/a>/code>tr>th>code idelements-3:the-ins-element>a href#the-ins-element>ins/a>/code>td>An addition to the documenttd>a href#flow-content-2 idelements-3:flow-content-2-72>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-58>phrasing/a>*; a href#palpable-content-2 idelements-3:palpable-content-2-33>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-59>phrasing/a>td>a href#transparent idelements-3:transparent-5>transparent/a>td>a href#global-attributes idelements-3:global-attributes-49>globals/a>; code idelements-3:attr-mod-cite-2>a href#attr-mod-cite>cite/a>/code>; code idelements-3:attr-mod-datetime-2>a href#attr-mod-datetime>datetime/a>/code>td>code idelements-3:htmlmodelement-2>a href#htmlmodelement>HTMLModElement/a>/code>tr>th>code idelements-3:the-kbd-element>a href#the-kbd-element>kbd/a>/code>td>User inputtd>a href#flow-content-2 idelements-3:flow-content-2-73>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-60>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-34>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-61>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-62>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-50>globals/a>td>code idelements-3:htmlelement-20>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-label-element>a href#the-label-element>label/a>/code>td>Caption for a form controltd>a href#flow-content-2 idelements-3:flow-content-2-74>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-63>phrasing/a>; a href#interactive-content-2 idelements-3:interactive-content-2-9>interactive/a>; a href#palpable-content-2 idelements-3:palpable-content-2-35>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-64>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-65>phrasing/a>*td>a href#global-attributes idelements-3:global-attributes-51>globals/a>; code idelements-3:attr-label-for>a href#attr-label-for>for/a>/code>td>code idelements-3:htmllabelelement>a href#htmllabelelement>HTMLLabelElement/a>/code>tr>th>code idelements-3:the-legend-element-2>a href#the-legend-element>legend/a>/code>td>Caption for code idelements-3:the-fieldset-element-2>a href#the-fieldset-element>fieldset/a>/code>td>nonetd>code idelements-3:the-fieldset-element-3>a href#the-fieldset-element>fieldset/a>/code>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-66>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-52>globals/a>td>code idelements-3:htmllegendelement>a href#htmllegendelement>HTMLLegendElement/a>/code>tr>th>code idelements-3:the-li-element>a href#the-li-element>li/a>/code>td>List itemtd>nonetd>code idelements-3:the-ol-element>a href#the-ol-element>ol/a>/code>; code idelements-3:the-ul-element>a href#the-ul-element>ul/a>/code>; code idelements-3:the-menu-element>a href#the-menu-element>menu/a>/code>*td>a href#flow-content-2 idelements-3:flow-content-2-75>flow/a>td>a href#global-attributes idelements-3:global-attributes-53>globals/a>; code idelements-3:attr-li-value>a href#attr-li-value>value/a>/code>*td>code idelements-3:htmllielement>a href#htmllielement>HTMLLIElement/a>/code>tr>th>code idelements-3:the-link-element>a href#the-link-element>link/a>/code>td>Link metadatatd>a href#metadata-content-2 idelements-3:metadata-content-2-3>metadata/a>; a href#flow-content-2 idelements-3:flow-content-2-76>flow/a>*; a href#phrasing-content-2 idelements-3:phrasing-content-2-67>phrasing/a>*td>code idelements-3:the-head-element-4>a href#the-head-element>head/a>/code>; code idelements-3:the-noscript-element>a href#the-noscript-element>noscript/a>/code>*; a href#phrasing-content-2 idelements-3:phrasing-content-2-68>phrasing/a>*td>emptytd>a href#global-attributes idelements-3:global-attributes-54>globals/a>; code idelements-3:attr-link-href>a href#attr-link-href>href/a>/code>; code idelements-3:attr-link-crossorigin>a href#attr-link-crossorigin>crossorigin/a>/code>; code idelements-3:attr-link-rel>a href#attr-link-rel>rel/a>/code>; code idelements-3:attr-link-as>a href#attr-link-as>as/a>/code>; code idelements-3:attr-link-media>a href#attr-link-media>media/a>/code>; code idelements-3:attr-link-hreflang>a href#attr-link-hreflang>hreflang/a>/code>; code idelements-3:attr-link-type>a href#attr-link-type>type/a>/code>; code idelements-3:attr-link-sizes>a href#attr-link-sizes>sizes/a>/code>; code idelements-3:attr-link-referrerpolicy>a href#attr-link-referrerpolicy>referrerpolicy/a>/code>; code idelements-3:attr-link-nonce>a href#attr-link-nonce>nonce/a>/code>; code idelements-3:attr-link-integrity>a href#attr-link-integrity>integrity/a>/code>td>code idelements-3:htmllinkelement>a href#htmllinkelement>HTMLLinkElement/a>/code>tr>th>code idelements-3:the-main-element>a href#the-main-element>main/a>/code>td>Container for the dominant contents of another elementtd>a href#flow-content-2 idelements-3:flow-content-2-77>flow/a>; a href#palpable-content-2 idelements-3:palpable-content-2-36>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-78>flow/a>td>a href#flow-content-2 idelements-3:flow-content-2-79>flow/a>td>a href#global-attributes idelements-3:global-attributes-55>globals/a>td>code idelements-3:htmlelement-21>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-map-element>a href#the-map-element>map/a>/code>td>a href#image-map idelements-3:image-map>Image map/a>td>a href#flow-content-2 idelements-3:flow-content-2-80>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-69>phrasing/a>*; a href#palpable-content-2 idelements-3:palpable-content-2-37>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-70>phrasing/a>td>a href#transparent idelements-3:transparent-6>transparent/a>; code idelements-3:the-area-element-2>a href#the-area-element>area/a>/code>*td>a href#global-attributes idelements-3:global-attributes-56>globals/a>; code idelements-3:attr-map-name>a href#attr-map-name>name/a>/code>td>code idelements-3:htmlmapelement>a href#htmlmapelement>HTMLMapElement/a>/code>tr>th>code idelements-3:the-mark-element>a href#the-mark-element>mark/a>/code>td>Highlighttd>a href#flow-content-2 idelements-3:flow-content-2-81>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-71>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-38>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-72>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-73>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-57>globals/a>td>code idelements-3:htmlelement-22>a href#htmlelement>HTMLElement/a>/code>tr>th>a idelements-3:mathml-math hrefhttps://www.w3.org/Math/draft-spec/chapter2.html#interf.toplevel data-x-internalmathml-math>MathML code>math/code>/a>td>MathML roottd>a href#flow-content-2 idelements-3:flow-content-2-82>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-74>phrasing/a>; a href#embedded-content-category idelements-3:embedded-content-category-6>embedded/a>; a href#palpable-content-2 idelements-3:palpable-content-2-39>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-75>phrasing/a>td>per a href#refsMATHML>MATHML/a>td>per a href#refsMATHML>MATHML/a>td>code idelements-3:element>a data-x-internalelement hrefhttps://dom.spec.whatwg.org/#interface-element>Element/a>/code>tr>th>code idelements-3:the-menu-element-2>a href#the-menu-element>menu/a>/code>td>Menu of commandstd>a href#flow-content-2 idelements-3:flow-content-2-83>flow/a>; a href#palpable-content-2 idelements-3:palpable-content-2-40>palpable/a>*td>a href#flow-content-2 idelements-3:flow-content-2-84>flow/a>td>code idelements-3:the-li-element-2>a href#the-li-element>li/a>/code>; a href#script-supporting-elements-2 idelements-3:script-supporting-elements-2-3>script-supporting elements/a>td>a href#global-attributes idelements-3:global-attributes-58>globals/a>td>code idelements-3:htmlmenuelement>a href#htmlmenuelement>HTMLMenuElement/a>/code>tr>th>code idelements-3:the-meta-element>a href#the-meta-element>meta/a>/code>td>Text metadatatd>a href#metadata-content-2 idelements-3:metadata-content-2-4>metadata/a>; a href#flow-content-2 idelements-3:flow-content-2-85>flow/a>*; a href#phrasing-content-2 idelements-3:phrasing-content-2-76>phrasing/a>*td>code idelements-3:the-head-element-5>a href#the-head-element>head/a>/code>; code idelements-3:the-noscript-element-2>a href#the-noscript-element>noscript/a>/code>*; a href#phrasing-content-2 idelements-3:phrasing-content-2-77>phrasing/a>*td>emptytd>a href#global-attributes idelements-3:global-attributes-59>globals/a>; code idelements-3:attr-meta-name>a href#attr-meta-name>name/a>/code>; code idelements-3:attr-meta-http-equiv>a href#attr-meta-http-equiv>http-equiv/a>/code>; code idelements-3:attr-meta-content>a href#attr-meta-content>content/a>/code>; code idelements-3:attr-meta-charset>a href#attr-meta-charset>charset/a>/code>td>code idelements-3:htmlmetaelement>a href#htmlmetaelement>HTMLMetaElement/a>/code>tr>th>code idelements-3:the-meter-element>a href#the-meter-element>meter/a>/code>td>Gaugetd>a href#flow-content-2 idelements-3:flow-content-2-86>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-78>phrasing/a>; a href#category-label idelements-3:category-label-3>labelable/a>; a href#palpable-content-2 idelements-3:palpable-content-2-41>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-79>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-80>phrasing/a>*td>a href#global-attributes idelements-3:global-attributes-60>globals/a>; code idelements-3:attr-meter-value>a href#attr-meter-value>value/a>/code>; code idelements-3:attr-meter-min>a href#attr-meter-min>min/a>/code>; code idelements-3:attr-meter-max>a href#attr-meter-max>max/a>/code>; code idelements-3:attr-meter-low>a href#attr-meter-low>low/a>/code>; code idelements-3:attr-meter-high>a href#attr-meter-high>high/a>/code>; code idelements-3:attr-meter-optimum>a href#attr-meter-optimum>optimum/a>/code>td>code idelements-3:htmlmeterelement>a href#htmlmeterelement>HTMLMeterElement/a>/code>tr>th>code idelements-3:the-nav-element>a href#the-nav-element>nav/a>/code>td>Section with navigational linkstd>a href#flow-content-2 idelements-3:flow-content-2-87>flow/a>; a href#sectioning-content-2 idelements-3:sectioning-content-2-3>sectioning/a>; a href#palpable-content-2 idelements-3:palpable-content-2-42>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-88>flow/a>td>a href#flow-content-2 idelements-3:flow-content-2-89>flow/a>td>a href#global-attributes idelements-3:global-attributes-61>globals/a>td>code idelements-3:htmlelement-23>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-noscript-element-3>a href#the-noscript-element>noscript/a>/code>td>Fallback content for scripttd>a href#metadata-content-2 idelements-3:metadata-content-2-5>metadata/a>; a href#flow-content-2 idelements-3:flow-content-2-90>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-81>phrasing/a>td>code idelements-3:the-head-element-6>a href#the-head-element>head/a>/code>*; a href#phrasing-content-2 idelements-3:phrasing-content-2-82>phrasing/a>*td>varies*td>a href#global-attributes idelements-3:global-attributes-62>globals/a>td>code idelements-3:htmlelement-24>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-object-element>a href#the-object-element>object/a>/code>td>Image, a href#nested-browsing-context idelements-3:nested-browsing-context-2>nested browsing context/a>, or a href#plugin idelements-3:plugin-2>plugin/a>td>a href#flow-content-2 idelements-3:flow-content-2-91>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-83>phrasing/a>; a href#embedded-content-category idelements-3:embedded-content-category-7>embedded/a>; a href#interactive-content-2 idelements-3:interactive-content-2-10>interactive/a>*; a href#category-listed idelements-3:category-listed-4>listed/a>; a href#category-submit idelements-3:category-submit-3>submittable/a>; a href#form-associated-element idelements-3:form-associated-element-5>form-associated/a>; a href#palpable-content-2 idelements-3:palpable-content-2-43>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-84>phrasing/a>td>code idelements-3:the-param-element>a href#the-param-element>param/a>/code>*; a href#transparent idelements-3:transparent-7>transparent/a>td>a href#global-attributes idelements-3:global-attributes-63>globals/a>; code idelements-3:attr-object-data>a href#attr-object-data>data/a>/code>; code idelements-3:attr-object-type>a href#attr-object-type>type/a>/code>; code idelements-3:attr-object-typemustmatch>a href#attr-object-typemustmatch>typemustmatch/a>/code>; code idelements-3:attr-object-name>a href#attr-object-name>name/a>/code>; code idelements-3:attr-hyperlink-usemap-2>a href#attr-hyperlink-usemap>usemap/a>/code>; code idelements-3:attr-fae-form-4>a href#attr-fae-form>form/a>/code>; code idelements-3:attr-dim-width-5>a href#attr-dim-width>width/a>/code>; code idelements-3:attr-dim-height-5>a href#attr-dim-height>height/a>/code>td>code idelements-3:htmlobjectelement>a href#htmlobjectelement>HTMLObjectElement/a>/code>tr>th>code idelements-3:the-ol-element-2>a href#the-ol-element>ol/a>/code>td>Ordered listtd>a href#flow-content-2 idelements-3:flow-content-2-92>flow/a>; a href#palpable-content-2 idelements-3:palpable-content-2-44>palpable/a>*td>a href#flow-content-2 idelements-3:flow-content-2-93>flow/a>td>code idelements-3:the-li-element-3>a href#the-li-element>li/a>/code>; a href#script-supporting-elements-2 idelements-3:script-supporting-elements-2-4>script-supporting elements/a>td>a href#global-attributes idelements-3:global-attributes-64>globals/a>; code idelements-3:attr-ol-reversed>a href#attr-ol-reversed>reversed/a>/code>; code idelements-3:attr-ol-start>a href#attr-ol-start>start/a>/code>; code idelements-3:attr-ol-type>a href#attr-ol-type>type/a>/code>td>code idelements-3:htmlolistelement>a href#htmlolistelement>HTMLOListElement/a>/code>tr>th>code idelements-3:the-optgroup-element>a href#the-optgroup-element>optgroup/a>/code>td>Group of options in a list boxtd>nonetd>code idelements-3:the-select-element>a href#the-select-element>select/a>/code>td>code idelements-3:the-option-element-2>a href#the-option-element>option/a>/code>; a href#script-supporting-elements-2 idelements-3:script-supporting-elements-2-5>script-supporting elements/a>td>a href#global-attributes idelements-3:global-attributes-65>globals/a>; code idelements-3:attr-optgroup-disabled>a href#attr-optgroup-disabled>disabled/a>/code>; code idelements-3:attr-optgroup-label>a href#attr-optgroup-label>label/a>/code>td>code idelements-3:htmloptgroupelement>a href#htmloptgroupelement>HTMLOptGroupElement/a>/code>tr>th>code idelements-3:the-option-element-3>a href#the-option-element>option/a>/code>td>Option in a list box or combo box controltd>nonetd>code idelements-3:the-select-element-2>a href#the-select-element>select/a>/code>; code idelements-3:the-datalist-element-2>a href#the-datalist-element>datalist/a>/code>; code idelements-3:the-optgroup-element-2>a href#the-optgroup-element>optgroup/a>/code>td>a href#text-content idelements-3:text-content>text/a>*td>a href#global-attributes idelements-3:global-attributes-66>globals/a>; code idelements-3:attr-option-disabled>a href#attr-option-disabled>disabled/a>/code>; code idelements-3:attr-option-label>a href#attr-option-label>label/a>/code>; code idelements-3:attr-option-selected>a href#attr-option-selected>selected/a>/code>; code idelements-3:attr-option-value>a href#attr-option-value>value/a>/code>td>code idelements-3:htmloptionelement>a href#htmloptionelement>HTMLOptionElement/a>/code>tr>th>code idelements-3:the-output-element>a href#the-output-element>output/a>/code>td>Calculated output valuetd>a href#flow-content-2 idelements-3:flow-content-2-94>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-85>phrasing/a>; a href#category-listed idelements-3:category-listed-5>listed/a>; a href#category-label idelements-3:category-label-4>labelable/a>; a href#category-reset idelements-3:category-reset-2>resettable/a>; a href#form-associated-element idelements-3:form-associated-element-6>form-associated/a>; a href#palpable-content-2 idelements-3:palpable-content-2-45>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-86>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-87>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-67>globals/a>; code idelements-3:attr-output-for>a href#attr-output-for>for/a>/code>; code idelements-3:attr-fae-form-5>a href#attr-fae-form>form/a>/code>; code idelements-3:attr-fe-name-4>a href#attr-fe-name>name/a>/code>td>code idelements-3:htmloutputelement>a href#htmloutputelement>HTMLOutputElement/a>/code>tr>th>code idelements-3:the-p-element>a href#the-p-element>p/a>/code>td>Paragraphtd>a href#flow-content-2 idelements-3:flow-content-2-95>flow/a>; a href#palpable-content-2 idelements-3:palpable-content-2-46>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-96>flow/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-88>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-68>globals/a>td>code idelements-3:htmlparagraphelement>a href#htmlparagraphelement>HTMLParagraphElement/a>/code>tr>th>code idelements-3:the-param-element-2>a href#the-param-element>param/a>/code>td>Parameter for code idelements-3:the-object-element-2>a href#the-object-element>object/a>/code>td>nonetd>code idelements-3:the-object-element-3>a href#the-object-element>object/a>/code>td>emptytd>a href#global-attributes idelements-3:global-attributes-69>globals/a>; code idelements-3:attr-param-name>a href#attr-param-name>name/a>/code>; code idelements-3:attr-param-value>a href#attr-param-value>value/a>/code>td>code idelements-3:htmlparamelement>a href#htmlparamelement>HTMLParamElement/a>/code>tr>th>code idelements-3:the-picture-element-2>a href#the-picture-element>picture/a>/code>td>Imagetd>a href#flow-content-2 idelements-3:flow-content-2-97>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-89>phrasing/a>; a href#embedded-content-category idelements-3:embedded-content-category-8>embedded/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-90>phrasing/a>td>code idelements-3:the-source-element-2>a href#the-source-element>source/a>/code>*; one code idelements-3:the-img-element-2>a href#the-img-element>img/a>/code>; a href#script-supporting-elements-2 idelements-3:script-supporting-elements-2-6>script-supporting elements/a>td>a href#global-attributes idelements-3:global-attributes-70>globals/a>td>code idelements-3:htmlpictureelement>a href#htmlpictureelement>HTMLPictureElement/a>/code>tr>th>code idelements-3:the-pre-element>a href#the-pre-element>pre/a>/code>td>Block of preformatted texttd>a href#flow-content-2 idelements-3:flow-content-2-98>flow/a>; a href#palpable-content-2 idelements-3:palpable-content-2-47>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-99>flow/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-91>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-71>globals/a>td>code idelements-3:htmlpreelement>a href#htmlpreelement>HTMLPreElement/a>/code>tr>th>code idelements-3:the-progress-element>a href#the-progress-element>progress/a>/code>td>Progress bartd>a href#flow-content-2 idelements-3:flow-content-2-100>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-92>phrasing/a>; a href#category-label idelements-3:category-label-5>labelable/a>; a href#palpable-content-2 idelements-3:palpable-content-2-48>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-93>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-94>phrasing/a>*td>a href#global-attributes idelements-3:global-attributes-72>globals/a>; code idelements-3:attr-progress-value>a href#attr-progress-value>value/a>/code>; code idelements-3:attr-progress-max>a href#attr-progress-max>max/a>/code>td>code idelements-3:htmlprogresselement>a href#htmlprogresselement>HTMLProgressElement/a>/code>tr>th>code idelements-3:the-q-element>a href#the-q-element>q/a>/code>td>Quotationtd>a href#flow-content-2 idelements-3:flow-content-2-101>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-95>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-49>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-96>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-97>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-73>globals/a>; code idelements-3:attr-q-cite>a href#attr-q-cite>cite/a>/code>td>code idelements-3:htmlquoteelement-2>a href#htmlquoteelement>HTMLQuoteElement/a>/code>tr>th>code idelements-3:the-rp-element>a href#the-rp-element>rp/a>/code>td>Parenthesis for ruby annotation texttd>nonetd>code idelements-3:the-ruby-element>a href#the-ruby-element>ruby/a>/code>td>a href#text-content idelements-3:text-content-2>text/a>td>a href#global-attributes idelements-3:global-attributes-74>globals/a>td>code idelements-3:htmlelement-25>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-rt-element>a href#the-rt-element>rt/a>/code>td>Ruby annotation texttd>nonetd>code idelements-3:the-ruby-element-2>a href#the-ruby-element>ruby/a>/code>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-98>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-75>globals/a>td>code idelements-3:htmlelement-26>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-ruby-element-3>a href#the-ruby-element>ruby/a>/code>td>Ruby annotation(s)td>a href#flow-content-2 idelements-3:flow-content-2-102>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-99>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-50>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-100>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-101>phrasing/a>; code idelements-3:the-rt-element-2>a href#the-rt-element>rt/a>/code>; code idelements-3:the-rp-element-2>a href#the-rp-element>rp/a>/code>*td>a href#global-attributes idelements-3:global-attributes-76>globals/a>td>code idelements-3:htmlelement-27>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-s-element>a href#the-s-element>s/a>/code>td>Inaccurate texttd>a href#flow-content-2 idelements-3:flow-content-2-103>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-102>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-51>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-103>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-104>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-77>globals/a>td>code idelements-3:htmlelement-28>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-samp-element>a href#the-samp-element>samp/a>/code>td>Computer outputtd>a href#flow-content-2 idelements-3:flow-content-2-104>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-105>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-52>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-106>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-107>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-78>globals/a>td>code idelements-3:htmlelement-29>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-script-element>a href#the-script-element>script/a>/code>td>Embedded scripttd>a href#metadata-content-2 idelements-3:metadata-content-2-6>metadata/a>; a href#flow-content-2 idelements-3:flow-content-2-105>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-108>phrasing/a>; a href#script-supporting-elements-2 idelements-3:script-supporting-elements-2-7>script-supporting/a>td>code idelements-3:the-head-element-7>a href#the-head-element>head/a>/code>; a href#phrasing-content-2 idelements-3:phrasing-content-2-109>phrasing/a>; a href#script-supporting-elements-2 idelements-3:script-supporting-elements-2-8>script-supporting/a>td>script, data, or script documentation*td>a href#global-attributes idelements-3:global-attributes-79>globals/a>; code idelements-3:attr-script-src>a href#attr-script-src>src/a>/code>; code idelements-3:attr-script-type>a href#attr-script-type>type/a>/code>; code idelements-3:attr-script-async>a href#attr-script-async>async/a>/code>; code idelements-3:attr-script-defer>a href#attr-script-defer>defer/a>/code>; code idelements-3:attr-script-crossorigin>a href#attr-script-crossorigin>crossorigin/a>/code>; code idelements-3:attr-script-nonce>a href#attr-script-nonce>nonce/a>/code>; code idelements-3:attr-script-integrity>a href#attr-script-integrity>integrity/a>/code>td>code idelements-3:htmlscriptelement>a href#htmlscriptelement>HTMLScriptElement/a>/code>tr>th>code idelements-3:the-section-element>a href#the-section-element>section/a>/code>td>Generic document or application sectiontd>a href#flow-content-2 idelements-3:flow-content-2-106>flow/a>; a href#sectioning-content-2 idelements-3:sectioning-content-2-4>sectioning/a>; a href#palpable-content-2 idelements-3:palpable-content-2-53>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-107>flow/a>td>a href#flow-content-2 idelements-3:flow-content-2-108>flow/a>td>a href#global-attributes idelements-3:global-attributes-80>globals/a>td>code idelements-3:htmlelement-30>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-select-element-3>a href#the-select-element>select/a>/code>td>List box controltd>a href#flow-content-2 idelements-3:flow-content-2-109>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-110>phrasing/a>; a href#interactive-content-2 idelements-3:interactive-content-2-11>interactive/a>; a href#category-listed idelements-3:category-listed-6>listed/a>; a href#category-label idelements-3:category-label-6>labelable/a>; a href#category-submit idelements-3:category-submit-4>submittable/a>; a href#category-reset idelements-3:category-reset-3>resettable/a>; a href#form-associated-element idelements-3:form-associated-element-7>form-associated/a>; a href#palpable-content-2 idelements-3:palpable-content-2-54>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-111>phrasing/a>td>code idelements-3:the-option-element-4>a href#the-option-element>option/a>/code>; code idelements-3:the-optgroup-element-3>a href#the-optgroup-element>optgroup/a>/code>; a href#script-supporting-elements-2 idelements-3:script-supporting-elements-2-9>script-supporting elements/a>td>a href#global-attributes idelements-3:global-attributes-81>globals/a>; code idelements-3:attr-fe-autocomplete-2>a href#attr-fe-autocomplete>autocomplete/a>/code>; code idelements-3:attr-fe-autofocus-3>a href#attr-fe-autofocus>autofocus/a>/code>; code idelements-3:attr-fe-disabled-3>a href#attr-fe-disabled>disabled/a>/code>; code idelements-3:attr-fae-form-6>a href#attr-fae-form>form/a>/code>; code idelements-3:attr-select-multiple>a href#attr-select-multiple>multiple/a>/code>; code idelements-3:attr-fe-name-5>a href#attr-fe-name>name/a>/code>; code idelements-3:attr-select-required>a href#attr-select-required>required/a>/code>; code idelements-3:attr-select-size>a href#attr-select-size>size/a>/code>td>code idelements-3:htmlselectelement>a href#htmlselectelement>HTMLSelectElement/a>/code>tr>th>code idelements-3:the-slot-element>a href#the-slot-element>slot/a>/code>td>Shadow tree slottd>a href#flow-content-2 idelements-3:flow-content-2-110>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-112>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-113>phrasing/a>td>a href#transparent idelements-3:transparent-8>transparent/a>td>a href#global-attributes idelements-3:global-attributes-82>globals/a>; code idelements-3:attr-slot-name>a href#attr-slot-name>name/a>/code>td>code idelements-3:htmlslotelement>a href#htmlslotelement>HTMLSlotElement/a>/code>tr>th>code idelements-3:the-small-element>a href#the-small-element>small/a>/code>td>Side commenttd>a href#flow-content-2 idelements-3:flow-content-2-111>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-114>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-55>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-115>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-116>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-83>globals/a>td>code idelements-3:htmlelement-31>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-source-element-3>a href#the-source-element>source/a>/code>td>Image source for code idelements-3:the-img-element-3>a href#the-img-element>img/a>/code> or media source for code idelements-3:the-video-element>a href#the-video-element>video/a>/code> or code idelements-3:the-audio-element-2>a href#the-audio-element>audio/a>/code>td>nonetd>code idelements-3:the-picture-element-3>a href#the-picture-element>picture/a>/code>; code idelements-3:the-video-element-2>a href#the-video-element>video/a>/code>; code idelements-3:the-audio-element-3>a href#the-audio-element>audio/a>/code>td>emptytd>a href#global-attributes idelements-3:global-attributes-84>globals/a>; code idelements-3:attr-source-src>a href#attr-source-src>src/a>/code>; code idelements-3:attr-source-type>a href#attr-source-type>type/a>/code> code idelements-3:attr-source-srcset>a href#attr-source-srcset>srcset/a>/code>; code idelements-3:attr-source-sizes>a href#attr-source-sizes>sizes/a>/code>; code idelements-3:attr-source-media>a href#attr-source-media>media/a>/code>td>code idelements-3:htmlsourceelement>a href#htmlsourceelement>HTMLSourceElement/a>/code>tr>th>code idelements-3:the-span-element>a href#the-span-element>span/a>/code>td>Generic phrasing containertd>a href#flow-content-2 idelements-3:flow-content-2-112>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-117>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-56>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-118>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-119>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-85>globals/a>td>code idelements-3:htmlspanelement>a href#htmlspanelement>HTMLSpanElement/a>/code>tr>th>code idelements-3:the-strong-element>a href#the-strong-element>strong/a>/code>td>Importancetd>a href#flow-content-2 idelements-3:flow-content-2-113>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-120>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-57>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-121>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-122>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-86>globals/a>td>code idelements-3:htmlelement-32>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-style-element>a href#the-style-element>style/a>/code>td>Embedded styling informationtd>a href#metadata-content-2 idelements-3:metadata-content-2-7>metadata/a>td>code idelements-3:the-head-element-8>a href#the-head-element>head/a>/code>; code idelements-3:the-noscript-element-4>a href#the-noscript-element>noscript/a>/code>*td>text*td>a href#global-attributes idelements-3:global-attributes-87>globals/a>; code idelements-3:attr-style-media>a href#attr-style-media>media/a>/code>; code idelements-3:attr-style-nonce>a href#attr-style-nonce>nonce/a>/code>td>code idelements-3:htmlstyleelement>a href#htmlstyleelement>HTMLStyleElement/a>/code>tr>th>code idelements-3:the-sub-and-sup-elements>a href#the-sub-and-sup-elements>sub/a>/code>td>Subscripttd>a href#flow-content-2 idelements-3:flow-content-2-114>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-123>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-58>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-124>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-125>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-88>globals/a>td>code idelements-3:htmlelement-33>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-summary-element-2>a href#the-summary-element>summary/a>/code>td>Caption for code idelements-3:the-details-element-2>a href#the-details-element>details/a>/code>td>nonetd>code idelements-3:the-details-element-3>a href#the-details-element>details/a>/code>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-126>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-89>globals/a>td>code idelements-3:htmlelement-34>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-sub-and-sup-elements-2>a href#the-sub-and-sup-elements>sup/a>/code>td>Superscripttd>a href#flow-content-2 idelements-3:flow-content-2-115>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-127>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-59>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-128>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-129>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-90>globals/a>td>code idelements-3:htmlelement-35>a href#htmlelement>HTMLElement/a>/code>tr>th>a idelements-3:svg-svg hrefhttps://www.w3.org/TR/SVG11/struct.html#SVGElement data-x-internalsvg-svg>SVG code>svg/code>/a>td>SVG roottd>a href#flow-content-2 idelements-3:flow-content-2-116>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-130>phrasing/a>; a href#embedded-content-category idelements-3:embedded-content-category-9>embedded/a>; a href#palpable-content-2 idelements-3:palpable-content-2-60>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-131>phrasing/a>td>per a href#refsSVG>SVG/a>td>per a href#refsSVG>SVG/a>td>code idelements-3:svgsvgelement>a data-x-internalsvgsvgelement hrefhttps://www.w3.org/TR/SVG11/struct.html#InterfaceSVGSVGElement>SVGSVGElement/a>/code>tr>th>code idelements-3:the-table-element-3>a href#the-table-element>table/a>/code>td>Tabletd>a href#flow-content-2 idelements-3:flow-content-2-117>flow/a>; a href#palpable-content-2 idelements-3:palpable-content-2-61>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-118>flow/a>td>code idelements-3:the-caption-element-2>a href#the-caption-element>caption/a>/code>*; code idelements-3:the-colgroup-element-3>a href#the-colgroup-element>colgroup/a>/code>*; code idelements-3:the-thead-element>a href#the-thead-element>thead/a>/code>*; code idelements-3:the-tbody-element>a href#the-tbody-element>tbody/a>/code>*; code idelements-3:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code>*; code idelements-3:the-tr-element>a href#the-tr-element>tr/a>/code>*; a href#script-supporting-elements-2 idelements-3:script-supporting-elements-2-10>script-supporting elements/a>td>a href#global-attributes idelements-3:global-attributes-91>globals/a>td>code idelements-3:htmltableelement>a href#htmltableelement>HTMLTableElement/a>/code>tr>th>code idelements-3:the-tbody-element-2>a href#the-tbody-element>tbody/a>/code>td>Group of rows in a tabletd>nonetd>code idelements-3:the-table-element-4>a href#the-table-element>table/a>/code>td>code idelements-3:the-tr-element-2>a href#the-tr-element>tr/a>/code>; a href#script-supporting-elements-2 idelements-3:script-supporting-elements-2-11>script-supporting elements/a>td>a href#global-attributes idelements-3:global-attributes-92>globals/a>td>code idelements-3:htmltablesectionelement>a href#htmltablesectionelement>HTMLTableSectionElement/a>/code>tr>th>code idelements-3:the-td-element>a href#the-td-element>td/a>/code>td>Table celltd>a href#sectioning-root idelements-3:sectioning-root-7>sectioning root/a>td>code idelements-3:the-tr-element-3>a href#the-tr-element>tr/a>/code>td>a href#flow-content-2 idelements-3:flow-content-2-119>flow/a>td>a href#global-attributes idelements-3:global-attributes-93>globals/a>; code idelements-3:attr-tdth-colspan>a href#attr-tdth-colspan>colspan/a>/code>; code idelements-3:attr-tdth-rowspan>a href#attr-tdth-rowspan>rowspan/a>/code>; code idelements-3:attr-tdth-headers>a href#attr-tdth-headers>headers/a>/code>td>code idelements-3:htmltablecellelement>a href#htmltablecellelement>HTMLTableCellElement/a>/code>tr>th>code idelements-3:the-template-element-3>a href#the-template-element>template/a>/code>td>Templatetd>a href#metadata-content-2 idelements-3:metadata-content-2-8>metadata/a>; a href#flow-content-2 idelements-3:flow-content-2-120>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-132>phrasing/a>; a href#script-supporting-elements-2 idelements-3:script-supporting-elements-2-12>script-supporting/a>td>a href#metadata-content-2 idelements-3:metadata-content-2-9>metadata/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-133>phrasing/a>; a href#script-supporting-elements-2 idelements-3:script-supporting-elements-2-13>script-supporting/a>; code idelements-3:the-colgroup-element-4>a href#the-colgroup-element>colgroup/a>/code>*td>emptytd>a href#global-attributes idelements-3:global-attributes-94>globals/a>td>code idelements-3:htmltemplateelement>a href#htmltemplateelement>HTMLTemplateElement/a>/code>tr>th>code idelements-3:the-textarea-element>a href#the-textarea-element>textarea/a>/code>td>Multiline text controlstd>a href#flow-content-2 idelements-3:flow-content-2-121>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-134>phrasing/a>; a href#interactive-content-2 idelements-3:interactive-content-2-12>interactive/a>; a href#category-listed idelements-3:category-listed-7>listed/a>; a href#category-label idelements-3:category-label-7>labelable/a>; a href#category-submit idelements-3:category-submit-5>submittable/a>; a href#category-reset idelements-3:category-reset-4>resettable/a>; a href#form-associated-element idelements-3:form-associated-element-8>form-associated/a>; a href#palpable-content-2 idelements-3:palpable-content-2-62>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-135>phrasing/a>td>a href#text-content idelements-3:text-content-3>text/a>td>a href#global-attributes idelements-3:global-attributes-95>globals/a>; code idelements-3:attr-fe-autofocus-4>a href#attr-fe-autofocus>autofocus/a>/code>; code idelements-3:attr-textarea-cols>a href#attr-textarea-cols>cols/a>/code>; code idelements-3:attr-fe-dirname-2>a href#attr-fe-dirname>dirname/a>/code>; code idelements-3:attr-fe-disabled-4>a href#attr-fe-disabled>disabled/a>/code>; code idelements-3:attr-fae-form-7>a href#attr-fae-form>form/a>/code>; code idelements-3:attr-fe-inputmode-2>a href#attr-fe-inputmode>inputmode/a>/code>; code idelements-3:attr-textarea-maxlength>a href#attr-textarea-maxlength>maxlength/a>/code>; code idelements-3:attr-textarea-minlength>a href#attr-textarea-minlength>minlength/a>/code>; code idelements-3:attr-fe-name-6>a href#attr-fe-name>name/a>/code>; code idelements-3:attr-textarea-placeholder>a href#attr-textarea-placeholder>placeholder/a>/code>; code idelements-3:attr-textarea-readonly>a href#attr-textarea-readonly>readonly/a>/code>; code idelements-3:attr-textarea-required>a href#attr-textarea-required>required/a>/code>; code idelements-3:attr-textarea-rows>a href#attr-textarea-rows>rows/a>/code>; code idelements-3:attr-textarea-wrap>a href#attr-textarea-wrap>wrap/a>/code>td>code idelements-3:htmltextareaelement>a href#htmltextareaelement>HTMLTextAreaElement/a>/code>tr>th>code idelements-3:the-tfoot-element-2>a href#the-tfoot-element>tfoot/a>/code>td>Group of footer rows in a tabletd>nonetd>code idelements-3:the-table-element-5>a href#the-table-element>table/a>/code>td>code idelements-3:the-tr-element-4>a href#the-tr-element>tr/a>/code>; a href#script-supporting-elements-2 idelements-3:script-supporting-elements-2-14>script-supporting elements/a>td>a href#global-attributes idelements-3:global-attributes-96>globals/a>td>code idelements-3:htmltablesectionelement-2>a href#htmltablesectionelement>HTMLTableSectionElement/a>/code>tr>th>code idelements-3:the-th-element>a href#the-th-element>th/a>/code>td>Table header celltd>a href#interactive-content-2 idelements-3:interactive-content-2-13>interactive/a>*td>code idelements-3:the-tr-element-5>a href#the-tr-element>tr/a>/code>td>a href#flow-content-2 idelements-3:flow-content-2-122>flow/a>*td>a href#global-attributes idelements-3:global-attributes-97>globals/a>; code idelements-3:attr-tdth-colspan-2>a href#attr-tdth-colspan>colspan/a>/code>; code idelements-3:attr-tdth-rowspan-2>a href#attr-tdth-rowspan>rowspan/a>/code>; code idelements-3:attr-tdth-headers-2>a href#attr-tdth-headers>headers/a>/code>; code idelements-3:attr-th-scope>a href#attr-th-scope>scope/a>/code>; code idelements-3:attr-th-abbr>a href#attr-th-abbr>abbr/a>/code>td>code idelements-3:htmltablecellelement-2>a href#htmltablecellelement>HTMLTableCellElement/a>/code>tr>th>code idelements-3:the-thead-element-2>a href#the-thead-element>thead/a>/code>td>Group of heading rows in a tabletd>nonetd>code idelements-3:the-table-element-6>a href#the-table-element>table/a>/code>td>code idelements-3:the-tr-element-6>a href#the-tr-element>tr/a>/code>; a href#script-supporting-elements-2 idelements-3:script-supporting-elements-2-15>script-supporting elements/a>td>a href#global-attributes idelements-3:global-attributes-98>globals/a>td>code idelements-3:htmltablesectionelement-3>a href#htmltablesectionelement>HTMLTableSectionElement/a>/code>tr>th>code idelements-3:the-time-element>a href#the-time-element>time/a>/code>td>Machine-readable equivalent of date- or time-related datatd>a href#flow-content-2 idelements-3:flow-content-2-123>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-136>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-63>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-137>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-138>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-99>globals/a>; code idelements-3:attr-time-datetime>a href#attr-time-datetime>datetime/a>/code>td>code idelements-3:htmltimeelement>a href#htmltimeelement>HTMLTimeElement/a>/code>tr>th>code idelements-3:the-title-element>a href#the-title-element>title/a>/code>td>Document titletd>a href#metadata-content-2 idelements-3:metadata-content-2-10>metadata/a>td>code idelements-3:the-head-element-9>a href#the-head-element>head/a>/code>td>a href#text-content idelements-3:text-content-4>text/a>*td>a href#global-attributes idelements-3:global-attributes-100>globals/a>td>code idelements-3:htmltitleelement>a href#htmltitleelement>HTMLTitleElement/a>/code>tr>th>code idelements-3:the-tr-element-7>a href#the-tr-element>tr/a>/code>td>Table rowtd>nonetd>code idelements-3:the-table-element-7>a href#the-table-element>table/a>/code>; code idelements-3:the-thead-element-3>a href#the-thead-element>thead/a>/code>; code idelements-3:the-tbody-element-3>a href#the-tbody-element>tbody/a>/code>; code idelements-3:the-tfoot-element-3>a href#the-tfoot-element>tfoot/a>/code>td>code idelements-3:the-th-element-2>a href#the-th-element>th/a>/code>*; code idelements-3:the-td-element-2>a href#the-td-element>td/a>/code>; a href#script-supporting-elements-2 idelements-3:script-supporting-elements-2-16>script-supporting elements/a>td>a href#global-attributes idelements-3:global-attributes-101>globals/a>td>code idelements-3:htmltablerowelement>a href#htmltablerowelement>HTMLTableRowElement/a>/code>tr>th>code idelements-3:the-track-element-2>a href#the-track-element>track/a>/code>td>Timed text tracktd>nonetd>code idelements-3:the-audio-element-4>a href#the-audio-element>audio/a>/code>; code idelements-3:the-video-element-3>a href#the-video-element>video/a>/code>td>emptytd>a href#global-attributes idelements-3:global-attributes-102>globals/a>; code idelements-3:attr-track-default>a href#attr-track-default>default/a>/code>; code idelements-3:attr-track-kind>a href#attr-track-kind>kind/a>/code>; code idelements-3:attr-track-label>a href#attr-track-label>label/a>/code>; code idelements-3:attr-track-src>a href#attr-track-src>src/a>/code>; code idelements-3:attr-track-srclang>a href#attr-track-srclang>srclang/a>/code>td>code idelements-3:htmltrackelement>a href#htmltrackelement>HTMLTrackElement/a>/code>tr>th>code idelements-3:the-u-element>a href#the-u-element>u/a>/code>td>Keywordstd>a href#flow-content-2 idelements-3:flow-content-2-124>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-139>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-64>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-140>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-141>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-103>globals/a>td>code idelements-3:htmlelement-36>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-ul-element-2>a href#the-ul-element>ul/a>/code>td>Listtd>a href#flow-content-2 idelements-3:flow-content-2-125>flow/a>; a href#palpable-content-2 idelements-3:palpable-content-2-65>palpable/a>*td>a href#flow-content-2 idelements-3:flow-content-2-126>flow/a>td>code idelements-3:the-li-element-4>a href#the-li-element>li/a>/code>; a href#script-supporting-elements-2 idelements-3:script-supporting-elements-2-17>script-supporting elements/a>td>a href#global-attributes idelements-3:global-attributes-104>globals/a>td>code idelements-3:htmlulistelement>a href#htmlulistelement>HTMLUListElement/a>/code>tr>th>code idelements-3:the-var-element>a href#the-var-element>var/a>/code>td>Variabletd>a href#flow-content-2 idelements-3:flow-content-2-127>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-142>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-66>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-143>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-144>phrasing/a>td>a href#global-attributes idelements-3:global-attributes-105>globals/a>td>code idelements-3:htmlelement-37>a href#htmlelement>HTMLElement/a>/code>tr>th>code idelements-3:the-video-element-4>a href#the-video-element>video/a>/code>td>Video playertd>a href#flow-content-2 idelements-3:flow-content-2-128>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-145>phrasing/a>; a href#embedded-content-category idelements-3:embedded-content-category-10>embedded/a>; a href#interactive-content-2 idelements-3:interactive-content-2-14>interactive/a>; a href#palpable-content-2 idelements-3:palpable-content-2-67>palpable/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-146>phrasing/a>td>code idelements-3:the-source-element-4>a href#the-source-element>source/a>/code>*; code idelements-3:the-track-element-3>a href#the-track-element>track/a>/code>*; a href#transparent idelements-3:transparent-9>transparent/a>*td>a href#global-attributes idelements-3:global-attributes-106>globals/a>; code idelements-3:attr-media-src-2>a href#attr-media-src>src/a>/code>; code idelements-3:attr-media-crossorigin-2>a href#attr-media-crossorigin>crossorigin/a>/code>; code idelements-3:attr-video-poster>a href#attr-video-poster>poster/a>/code>; code idelements-3:attr-media-preload-2>a href#attr-media-preload>preload/a>/code>; code idelements-3:attr-media-autoplay-2>a href#attr-media-autoplay>autoplay/a>/code>; code idelements-3:attr-video-playsinline>a href#attr-video-playsinline>playsinline/a>/code>; code idelements-3:attr-media-loop-2>a href#attr-media-loop>loop/a>/code>; code idelements-3:attr-media-muted-2>a href#attr-media-muted>muted/a>/code>; code idelements-3:attr-media-controls-2>a href#attr-media-controls>controls/a>/code>; code idelements-3:attr-dim-width-6>a href#attr-dim-width>width/a>/code>; code idelements-3:attr-dim-height-6>a href#attr-dim-height>height/a>/code>td>code idelements-3:htmlvideoelement>a href#htmlvideoelement>HTMLVideoElement/a>/code>tr>th>code idelements-3:the-wbr-element>a href#the-wbr-element>wbr/a>/code>td>Line breaking opportunitytd>a href#flow-content-2 idelements-3:flow-content-2-129>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-147>phrasing/a>td>a href#phrasing-content-2 idelements-3:phrasing-content-2-148>phrasing/a>td>emptytd>a href#global-attributes idelements-3:global-attributes-107>globals/a>td>code idelements-3:htmlelement-38>a href#htmlelement>HTMLElement/a>/code>tr>th>a href#autonomous-custom-element idelements-3:autonomous-custom-element>autonomous custom elements/a>td>Author-defined elementstd>a href#flow-content-2 idelements-3:flow-content-2-130>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-149>phrasing/a>; a href#palpable-content-2 idelements-3:palpable-content-2-68>palpable/a>td>a href#flow-content-2 idelements-3:flow-content-2-131>flow/a>; a href#phrasing-content-2 idelements-3:phrasing-content-2-150>phrasing/a>td>a href#transparent idelements-3:transparent-10>transparent/a>td>a href#global-attributes idelements-3:global-attributes-108>globals/a>; any, as decided by the elements authortd>Supplied by the elements author (inherits from code idelements-3:htmlelement-39>a href#htmlelement>HTMLElement/a>/code>)/table> p classtablenote>small>An asterisk (*) in a cell indicates that the actual rules are more complicated than indicated in the table above./small>/p> p classtablenote>small>† Categories in the Parents column refer to parents that list the given categories in their content model, not to elements that themselves are in those categories. For example, the code idelements-3:the-a-element-2>a href#the-a-element>a/a>/code> elements Parents column says phrasing, so any element whose content model contains the phrasing category could be a parent of an code idelements-3:the-a-element-3>a href#the-a-element>a/a>/code> element. Since the flow category includes all the phrasing elements, that means the code idelements-3:the-th-element-3>a href#the-th-element>th/a>/code> element could be a parent to an code idelements-3:the-a-element-4>a href#the-a-element>a/a>/code> element./small>/p> h3 idelement-content-categories classno-num>Element content categoriesa href#element-content-categories classself-link>/a>/h3> p>i>This section is non-normative./i>/p> table>caption>List of element content categories/caption>thead>tr>th> Category th> Elements th> Elements with exceptions tbody>tr>td> a href#metadata-content-2 idelement-content-categories:metadata-content-2>Metadata content/a> td> code idelement-content-categories:the-base-element>a href#the-base-element>base/a>/code>; code idelement-content-categories:the-link-element>a href#the-link-element>link/a>/code>; code idelement-content-categories:the-meta-element>a href#the-meta-element>meta/a>/code>; code idelement-content-categories:the-noscript-element>a href#the-noscript-element>noscript/a>/code>; code idelement-content-categories:the-script-element>a href#the-script-element>script/a>/code>; code idelement-content-categories:the-style-element>a href#the-style-element>style/a>/code>; code idelement-content-categories:the-template-element>a href#the-template-element>template/a>/code>; code idelement-content-categories:the-title-element>a href#the-title-element>title/a>/code> td> — tr>td> a href#flow-content-2 idelement-content-categories:flow-content-2>Flow content/a> td> code idelement-content-categories:the-a-element>a href#the-a-element>a/a>/code>; code idelement-content-categories:the-abbr-element>a href#the-abbr-element>abbr/a>/code>; code idelement-content-categories:the-address-element>a href#the-address-element>address/a>/code>; code idelement-content-categories:the-article-element>a href#the-article-element>article/a>/code>; code idelement-content-categories:the-aside-element>a href#the-aside-element>aside/a>/code>; code idelement-content-categories:the-audio-element>a href#the-audio-element>audio/a>/code>; code idelement-content-categories:the-b-element>a href#the-b-element>b/a>/code>; code idelement-content-categories:the-bdi-element>a href#the-bdi-element>bdi/a>/code>; code idelement-content-categories:the-bdo-element>a href#the-bdo-element>bdo/a>/code>; code idelement-content-categories:the-blockquote-element>a href#the-blockquote-element>blockquote/a>/code>; code idelement-content-categories:the-br-element>a href#the-br-element>br/a>/code>; code idelement-content-categories:the-button-element>a href#the-button-element>button/a>/code>; code idelement-content-categories:the-canvas-element>a href#the-canvas-element>canvas/a>/code>; code idelement-content-categories:the-cite-element>a href#the-cite-element>cite/a>/code>; code idelement-content-categories:the-code-element>a href#the-code-element>code/a>/code>; code idelement-content-categories:the-data-element>a href#the-data-element>data/a>/code>; code idelement-content-categories:the-datalist-element>a href#the-datalist-element>datalist/a>/code>; code idelement-content-categories:the-del-element>a href#the-del-element>del/a>/code>; code idelement-content-categories:the-details-element>a href#the-details-element>details/a>/code>; code idelement-content-categories:the-dfn-element>a href#the-dfn-element>dfn/a>/code>; code idelement-content-categories:the-dialog-element>a href#the-dialog-element>dialog/a>/code>; code idelement-content-categories:the-div-element>a href#the-div-element>div/a>/code>; code idelement-content-categories:the-dl-element>a href#the-dl-element>dl/a>/code>; code idelement-content-categories:the-em-element>a href#the-em-element>em/a>/code>; code idelement-content-categories:the-embed-element>a href#the-embed-element>embed/a>/code>; code idelement-content-categories:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code>; code idelement-content-categories:the-figure-element>a href#the-figure-element>figure/a>/code>; code idelement-content-categories:the-footer-element>a href#the-footer-element>footer/a>/code>; code idelement-content-categories:the-form-element>a href#the-form-element>form/a>/code>; code idelement-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code>; code idelement-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2/a>/code>; code idelement-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3/a>/code>; code idelement-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4/a>/code>; code idelement-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-5>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5/a>/code>; code idelement-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-6>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6/a>/code>; code idelement-content-categories:the-header-element>a href#the-header-element>header/a>/code>; code idelement-content-categories:the-hgroup-element>a href#the-hgroup-element>hgroup/a>/code>; code idelement-content-categories:the-hr-element>a href#the-hr-element>hr/a>/code>; code idelement-content-categories:the-i-element>a href#the-i-element>i/a>/code>; code idelement-content-categories:the-iframe-element>a href#the-iframe-element>iframe/a>/code>; code idelement-content-categories:the-img-element>a href#the-img-element>img/a>/code>; code idelement-content-categories:the-input-element>a href#the-input-element>input/a>/code>; code idelement-content-categories:the-ins-element>a href#the-ins-element>ins/a>/code>; code idelement-content-categories:the-kbd-element>a href#the-kbd-element>kbd/a>/code>; code idelement-content-categories:the-label-element>a href#the-label-element>label/a>/code>; code idelement-content-categories:the-main-element>a href#the-main-element>main/a>/code>; code idelement-content-categories:the-map-element>a href#the-map-element>map/a>/code>; code idelement-content-categories:the-mark-element>a href#the-mark-element>mark/a>/code>; a idelement-content-categories:mathml-math hrefhttps://www.w3.org/Math/draft-spec/chapter2.html#interf.toplevel data-x-internalmathml-math>MathML code>math/code>/a>; code idelement-content-categories:the-menu-element>a href#the-menu-element>menu/a>/code>; code idelement-content-categories:the-meter-element>a href#the-meter-element>meter/a>/code>; code idelement-content-categories:the-nav-element>a href#the-nav-element>nav/a>/code>; code idelement-content-categories:the-noscript-element-2>a href#the-noscript-element>noscript/a>/code>; code idelement-content-categories:the-object-element>a href#the-object-element>object/a>/code>; code idelement-content-categories:the-ol-element>a href#the-ol-element>ol/a>/code>; code idelement-content-categories:the-output-element>a href#the-output-element>output/a>/code>; code idelement-content-categories:the-p-element>a href#the-p-element>p/a>/code>; code idelement-content-categories:the-picture-element>a href#the-picture-element>picture/a>/code>; code idelement-content-categories:the-pre-element>a href#the-pre-element>pre/a>/code>; code idelement-content-categories:the-progress-element>a href#the-progress-element>progress/a>/code>; code idelement-content-categories:the-q-element>a href#the-q-element>q/a>/code>; code idelement-content-categories:the-ruby-element>a href#the-ruby-element>ruby/a>/code>; code idelement-content-categories:the-s-element>a href#the-s-element>s/a>/code>; code idelement-content-categories:the-samp-element>a href#the-samp-element>samp/a>/code>; code idelement-content-categories:the-script-element-2>a href#the-script-element>script/a>/code>; code idelement-content-categories:the-section-element>a href#the-section-element>section/a>/code>; code idelement-content-categories:the-select-element>a href#the-select-element>select/a>/code>; code idelement-content-categories:the-slot-element>a href#the-slot-element>slot/a>/code>; code idelement-content-categories:the-small-element>a href#the-small-element>small/a>/code>; code idelement-content-categories:the-span-element>a href#the-span-element>span/a>/code>; code idelement-content-categories:the-strong-element>a href#the-strong-element>strong/a>/code>; code idelement-content-categories:the-sub-and-sup-elements>a href#the-sub-and-sup-elements>sub/a>/code>; code idelement-content-categories:the-sub-and-sup-elements-2>a href#the-sub-and-sup-elements>sup/a>/code>; a idelement-content-categories:svg-svg hrefhttps://www.w3.org/TR/SVG11/struct.html#SVGElement data-x-internalsvg-svg>SVG code>svg/code>/a>; code idelement-content-categories:the-table-element>a href#the-table-element>table/a>/code>; code idelement-content-categories:the-template-element-2>a href#the-template-element>template/a>/code>; code idelement-content-categories:the-textarea-element>a href#the-textarea-element>textarea/a>/code>; code idelement-content-categories:the-time-element>a href#the-time-element>time/a>/code>; code idelement-content-categories:the-u-element>a href#the-u-element>u/a>/code>; code idelement-content-categories:the-ul-element>a href#the-ul-element>ul/a>/code>; code idelement-content-categories:the-var-element>a href#the-var-element>var/a>/code>; code idelement-content-categories:the-video-element>a href#the-video-element>video/a>/code>; code idelement-content-categories:the-wbr-element>a href#the-wbr-element>wbr/a>/code>; a href#autonomous-custom-element idelement-content-categories:autonomous-custom-element>autonomous custom elements/a>; a href#text-content idelement-content-categories:text-content>Text/a> td> code idelement-content-categories:the-area-element>a href#the-area-element>area/a>/code> (if it is a descendant of a code idelement-content-categories:the-map-element-2>a href#the-map-element>map/a>/code> element); code idelement-content-categories:the-link-element-2>a href#the-link-element>link/a>/code> (if it is a href#allowed-in-the-body idelement-content-categories:allowed-in-the-body>allowed in the body/a>); code idelement-content-categories:the-meta-element-2>a href#the-meta-element>meta/a>/code> (if the code idelement-content-categories:names:-the-itemprop-attribute>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute is present) tr>td> a href#sectioning-content-2 idelement-content-categories:sectioning-content-2>Sectioning content/a> td> code idelement-content-categories:the-article-element-2>a href#the-article-element>article/a>/code>; code idelement-content-categories:the-aside-element-2>a href#the-aside-element>aside/a>/code>; code idelement-content-categories:the-nav-element-2>a href#the-nav-element>nav/a>/code>; code idelement-content-categories:the-section-element-2>a href#the-section-element>section/a>/code> td> — tr>td> a href#heading-content-2 idelement-content-categories:heading-content-2>Heading content/a> td> code idelement-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-7>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code>; code idelement-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-8>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2/a>/code>; code idelement-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-9>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3/a>/code>; code idelement-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-10>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4/a>/code>; code idelement-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-11>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5/a>/code>; code idelement-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-12>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6/a>/code>; code idelement-content-categories:the-hgroup-element-2>a href#the-hgroup-element>hgroup/a>/code> td> — tr>td> a href#phrasing-content-2 idelement-content-categories:phrasing-content-2>Phrasing content/a> td> code idelement-content-categories:the-a-element-2>a href#the-a-element>a/a>/code>; code idelement-content-categories:the-abbr-element-2>a href#the-abbr-element>abbr/a>/code>; code idelement-content-categories:the-audio-element-2>a href#the-audio-element>audio/a>/code>; code idelement-content-categories:the-b-element-2>a href#the-b-element>b/a>/code>; code idelement-content-categories:the-bdi-element-2>a href#the-bdi-element>bdi/a>/code>; code idelement-content-categories:the-bdo-element-2>a href#the-bdo-element>bdo/a>/code>; code idelement-content-categories:the-br-element-2>a href#the-br-element>br/a>/code>; code idelement-content-categories:the-button-element-2>a href#the-button-element>button/a>/code>; code idelement-content-categories:the-canvas-element-2>a href#the-canvas-element>canvas/a>/code>; code idelement-content-categories:the-cite-element-2>a href#the-cite-element>cite/a>/code>; code idelement-content-categories:the-code-element-2>a href#the-code-element>code/a>/code>; code idelement-content-categories:the-data-element-2>a href#the-data-element>data/a>/code>; code idelement-content-categories:the-datalist-element-2>a href#the-datalist-element>datalist/a>/code>; code idelement-content-categories:the-del-element-2>a href#the-del-element>del/a>/code>; code idelement-content-categories:the-dfn-element-2>a href#the-dfn-element>dfn/a>/code>; code idelement-content-categories:the-em-element-2>a href#the-em-element>em/a>/code>; code idelement-content-categories:the-embed-element-2>a href#the-embed-element>embed/a>/code>; code idelement-content-categories:the-i-element-2>a href#the-i-element>i/a>/code>; code idelement-content-categories:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code>; code idelement-content-categories:the-img-element-2>a href#the-img-element>img/a>/code>; code idelement-content-categories:the-input-element-2>a href#the-input-element>input/a>/code>; code idelement-content-categories:the-ins-element-2>a href#the-ins-element>ins/a>/code>; code idelement-content-categories:the-kbd-element-2>a href#the-kbd-element>kbd/a>/code>; code idelement-content-categories:the-label-element-2>a href#the-label-element>label/a>/code>; code idelement-content-categories:the-map-element-3>a href#the-map-element>map/a>/code>; code idelement-content-categories:the-mark-element-2>a href#the-mark-element>mark/a>/code>; a idelement-content-categories:mathml-math-2 hrefhttps://www.w3.org/Math/draft-spec/chapter2.html#interf.toplevel data-x-internalmathml-math>MathML code>math/code>/a>; code idelement-content-categories:the-meter-element-2>a href#the-meter-element>meter/a>/code>; code idelement-content-categories:the-noscript-element-3>a href#the-noscript-element>noscript/a>/code>; code idelement-content-categories:the-object-element-2>a href#the-object-element>object/a>/code>; code idelement-content-categories:the-output-element-2>a href#the-output-element>output/a>/code>; code idelement-content-categories:the-picture-element-2>a href#the-picture-element>picture/a>/code>; code idelement-content-categories:the-progress-element-2>a href#the-progress-element>progress/a>/code>; code idelement-content-categories:the-q-element-2>a href#the-q-element>q/a>/code>; code idelement-content-categories:the-ruby-element-2>a href#the-ruby-element>ruby/a>/code>; code idelement-content-categories:the-s-element-2>a href#the-s-element>s/a>/code>; code idelement-content-categories:the-samp-element-2>a href#the-samp-element>samp/a>/code>; code idelement-content-categories:the-script-element-3>a href#the-script-element>script/a>/code>; code idelement-content-categories:the-select-element-2>a href#the-select-element>select/a>/code>; code idelement-content-categories:the-slot-element-2>a href#the-slot-element>slot/a>/code>; code idelement-content-categories:the-small-element-2>a href#the-small-element>small/a>/code>; code idelement-content-categories:the-span-element-2>a href#the-span-element>span/a>/code>; code idelement-content-categories:the-strong-element-2>a href#the-strong-element>strong/a>/code>; code idelement-content-categories:the-sub-and-sup-elements-3>a href#the-sub-and-sup-elements>sub/a>/code>; code idelement-content-categories:the-sub-and-sup-elements-4>a href#the-sub-and-sup-elements>sup/a>/code>; a idelement-content-categories:svg-svg-2 hrefhttps://www.w3.org/TR/SVG11/struct.html#SVGElement data-x-internalsvg-svg>SVG code>svg/code>/a>; code idelement-content-categories:the-template-element-3>a href#the-template-element>template/a>/code>; code idelement-content-categories:the-textarea-element-2>a href#the-textarea-element>textarea/a>/code>; code idelement-content-categories:the-time-element-2>a href#the-time-element>time/a>/code>; code idelement-content-categories:the-u-element-2>a href#the-u-element>u/a>/code>; code idelement-content-categories:the-var-element-2>a href#the-var-element>var/a>/code>; code idelement-content-categories:the-video-element-2>a href#the-video-element>video/a>/code>; code idelement-content-categories:the-wbr-element-2>a href#the-wbr-element>wbr/a>/code>; a href#autonomous-custom-element idelement-content-categories:autonomous-custom-element-2>autonomous custom elements/a>; a href#text-content idelement-content-categories:text-content-2>Text/a> td> code idelement-content-categories:the-area-element-2>a href#the-area-element>area/a>/code> (if it is a descendant of a code idelement-content-categories:the-map-element-4>a href#the-map-element>map/a>/code> element); code idelement-content-categories:the-link-element-3>a href#the-link-element>link/a>/code> (if it is a href#allowed-in-the-body idelement-content-categories:allowed-in-the-body-2>allowed in the body/a>); code idelement-content-categories:the-meta-element-3>a href#the-meta-element>meta/a>/code> (if the code idelement-content-categories:names:-the-itemprop-attribute-2>a href#names:-the-itemprop-attribute>itemprop/a>/code> attribute is present) tr>td> a href#embedded-content-category idelement-content-categories:embedded-content-category>Embedded content/a> td> code idelement-content-categories:the-audio-element-3>a href#the-audio-element>audio/a>/code>; code idelement-content-categories:the-canvas-element-3>a href#the-canvas-element>canvas/a>/code>; code idelement-content-categories:the-embed-element-3>a href#the-embed-element>embed/a>/code>; code idelement-content-categories:the-iframe-element-3>a href#the-iframe-element>iframe/a>/code>; code idelement-content-categories:the-img-element-3>a href#the-img-element>img/a>/code>; a idelement-content-categories:mathml-math-3 hrefhttps://www.w3.org/Math/draft-spec/chapter2.html#interf.toplevel data-x-internalmathml-math>MathML code>math/code>/a>; code idelement-content-categories:the-object-element-3>a href#the-object-element>object/a>/code>; code idelement-content-categories:the-picture-element-3>a href#the-picture-element>picture/a>/code>; a idelement-content-categories:svg-svg-3 hrefhttps://www.w3.org/TR/SVG11/struct.html#SVGElement data-x-internalsvg-svg>SVG code>svg/code>/a>; code idelement-content-categories:the-video-element-3>a href#the-video-element>video/a>/code> td> — tr>td> a href#interactive-content-2 idelement-content-categories:interactive-content-2>Interactive content/a>* td> code idelement-content-categories:the-button-element-3>a href#the-button-element>button/a>/code>; code idelement-content-categories:the-details-element-2>a href#the-details-element>details/a>/code>; code idelement-content-categories:the-embed-element-4>a href#the-embed-element>embed/a>/code>; code idelement-content-categories:the-iframe-element-4>a href#the-iframe-element>iframe/a>/code>; code idelement-content-categories:the-label-element-3>a href#the-label-element>label/a>/code>; code idelement-content-categories:the-select-element-3>a href#the-select-element>select/a>/code>; code idelement-content-categories:the-textarea-element-3>a href#the-textarea-element>textarea/a>/code> td> code idelement-content-categories:the-a-element-3>a href#the-a-element>a/a>/code> (if the code idelement-content-categories:attr-hyperlink-href>a href#attr-hyperlink-href>href/a>/code> attribute is present); code idelement-content-categories:the-audio-element-4>a href#the-audio-element>audio/a>/code> (if the code idelement-content-categories:attr-media-controls>a href#attr-media-controls>controls/a>/code> attribute is present); code idelement-content-categories:the-img-element-4>a href#the-img-element>img/a>/code> (if the code idelement-content-categories:attr-hyperlink-usemap>a href#attr-hyperlink-usemap>usemap/a>/code> attribute is present); code idelement-content-categories:the-input-element-3>a href#the-input-element>input/a>/code> (if the code idelement-content-categories:attr-input-type>a href#attr-input-type>type/a>/code> attribute is em>not/em> in the a href#hidden-state-(typehidden) idelement-content-categories:hidden-state-(typehidden)>Hidden/a> state); code idelement-content-categories:the-object-element-4>a href#the-object-element>object/a>/code> (if the code idelement-content-categories:attr-hyperlink-usemap-2>a href#attr-hyperlink-usemap>usemap/a>/code> attribute is present); code idelement-content-categories:the-video-element-4>a href#the-video-element>video/a>/code> (if the code idelement-content-categories:attr-media-controls-2>a href#attr-media-controls>controls/a>/code> attribute is present) tr>td> a href#sectioning-root idelement-content-categories:sectioning-root>Sectioning roots/a> td> code idelement-content-categories:the-blockquote-element-2>a href#the-blockquote-element>blockquote/a>/code>; code idelement-content-categories:the-body-element>a href#the-body-element>body/a>/code>; code idelement-content-categories:the-details-element-3>a href#the-details-element>details/a>/code>; code idelement-content-categories:the-dialog-element-2>a href#the-dialog-element>dialog/a>/code>; code idelement-content-categories:the-fieldset-element-2>a href#the-fieldset-element>fieldset/a>/code>; code idelement-content-categories:the-figure-element-2>a href#the-figure-element>figure/a>/code>; code idelement-content-categories:the-td-element>a href#the-td-element>td/a>/code> td> — tr>td> a href#form-associated-element idelement-content-categories:form-associated-element>Form-associated elements/a> td> code idelement-content-categories:the-button-element-4>a href#the-button-element>button/a>/code>; code idelement-content-categories:the-fieldset-element-3>a href#the-fieldset-element>fieldset/a>/code>; code idelement-content-categories:the-input-element-4>a href#the-input-element>input/a>/code>; code idelement-content-categories:the-label-element-4>a href#the-label-element>label/a>/code>; code idelement-content-categories:the-object-element-5>a href#the-object-element>object/a>/code>; code idelement-content-categories:the-output-element-3>a href#the-output-element>output/a>/code>; code idelement-content-categories:the-select-element-4>a href#the-select-element>select/a>/code>; code idelement-content-categories:the-textarea-element-4>a href#the-textarea-element>textarea/a>/code>; code idelement-content-categories:the-img-element-5>a href#the-img-element>img/a>/code> td> — tr>td> a href#category-listed idelement-content-categories:category-listed>Listed elements/a> td> code idelement-content-categories:the-button-element-5>a href#the-button-element>button/a>/code>; code idelement-content-categories:the-fieldset-element-4>a href#the-fieldset-element>fieldset/a>/code>; code idelement-content-categories:the-input-element-5>a href#the-input-element>input/a>/code>; code idelement-content-categories:the-object-element-6>a href#the-object-element>object/a>/code>; code idelement-content-categories:the-output-element-4>a href#the-output-element>output/a>/code>; code idelement-content-categories:the-select-element-5>a href#the-select-element>select/a>/code>; code idelement-content-categories:the-textarea-element-5>a href#the-textarea-element>textarea/a>/code> td> — tr>td> a href#category-submit idelement-content-categories:category-submit>Submittable elements/a> td> code idelement-content-categories:the-button-element-6>a href#the-button-element>button/a>/code>; code idelement-content-categories:the-input-element-6>a href#the-input-element>input/a>/code>; code idelement-content-categories:the-object-element-7>a href#the-object-element>object/a>/code>; code idelement-content-categories:the-select-element-6>a href#the-select-element>select/a>/code>; code idelement-content-categories:the-textarea-element-6>a href#the-textarea-element>textarea/a>/code> td> — tr>td> a href#category-reset idelement-content-categories:category-reset>Resettable elements/a> td> code idelement-content-categories:the-input-element-7>a href#the-input-element>input/a>/code>; code idelement-content-categories:the-output-element-5>a href#the-output-element>output/a>/code>; code idelement-content-categories:the-select-element-7>a href#the-select-element>select/a>/code>; code idelement-content-categories:the-textarea-element-7>a href#the-textarea-element>textarea/a>/code> td> — tr>td> a href#category-label idelement-content-categories:category-label>Labelable elements/a> td> code idelement-content-categories:the-button-element-7>a href#the-button-element>button/a>/code>; code idelement-content-categories:the-input-element-8>a href#the-input-element>input/a>/code>; code idelement-content-categories:the-meter-element-3>a href#the-meter-element>meter/a>/code>; code idelement-content-categories:the-output-element-6>a href#the-output-element>output/a>/code>; code idelement-content-categories:the-progress-element-3>a href#the-progress-element>progress/a>/code>; code idelement-content-categories:the-select-element-8>a href#the-select-element>select/a>/code>; code idelement-content-categories:the-textarea-element-8>a href#the-textarea-element>textarea/a>/code> td> — tr>td> a href#palpable-content-2 idelement-content-categories:palpable-content-2>Palpable content/a> td> code idelement-content-categories:the-a-element-4>a href#the-a-element>a/a>/code>; code idelement-content-categories:the-abbr-element-3>a href#the-abbr-element>abbr/a>/code>; code idelement-content-categories:the-address-element-2>a href#the-address-element>address/a>/code>; code idelement-content-categories:the-article-element-3>a href#the-article-element>article/a>/code>; code idelement-content-categories:the-aside-element-3>a href#the-aside-element>aside/a>/code>; code idelement-content-categories:the-b-element-3>a href#the-b-element>b/a>/code>; code idelement-content-categories:the-bdi-element-3>a href#the-bdi-element>bdi/a>/code>; code idelement-content-categories:the-bdo-element-3>a href#the-bdo-element>bdo/a>/code>; code idelement-content-categories:the-blockquote-element-3>a href#the-blockquote-element>blockquote/a>/code>; code idelement-content-categories:the-button-element-8>a href#the-button-element>button/a>/code>; code idelement-content-categories:the-canvas-element-4>a href#the-canvas-element>canvas/a>/code>; code idelement-content-categories:the-cite-element-3>a href#the-cite-element>cite/a>/code>; code idelement-content-categories:the-code-element-3>a href#the-code-element>code/a>/code>; code idelement-content-categories:the-data-element-3>a href#the-data-element>data/a>/code>; code idelement-content-categories:the-details-element-4>a href#the-details-element>details/a>/code>; code idelement-content-categories:the-dfn-element-3>a href#the-dfn-element>dfn/a>/code>; code idelement-content-categories:the-div-element-2>a href#the-div-element>div/a>/code>; code idelement-content-categories:the-em-element-3>a href#the-em-element>em/a>/code>; code idelement-content-categories:the-embed-element-5>a href#the-embed-element>embed/a>/code>; code idelement-content-categories:the-fieldset-element-5>a href#the-fieldset-element>fieldset/a>/code>; code idelement-content-categories:the-figure-element-3>a href#the-figure-element>figure/a>/code>; code idelement-content-categories:the-footer-element-2>a href#the-footer-element>footer/a>/code>; code idelement-content-categories:the-form-element-2>a href#the-form-element>form/a>/code>; code idelement-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-13>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code>; code idelement-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-14>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2/a>/code>; code idelement-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-15>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3/a>/code>; code idelement-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-16>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4/a>/code>; code idelement-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-17>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5/a>/code>; code idelement-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-18>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6/a>/code>; code idelement-content-categories:the-header-element-2>a href#the-header-element>header/a>/code>; code idelement-content-categories:the-hgroup-element-3>a href#the-hgroup-element>hgroup/a>/code>; code idelement-content-categories:the-i-element-3>a href#the-i-element>i/a>/code>; code idelement-content-categories:the-iframe-element-5>a href#the-iframe-element>iframe/a>/code>; code idelement-content-categories:the-img-element-6>a href#the-img-element>img/a>/code>; code idelement-content-categories:the-ins-element-3>a href#the-ins-element>ins/a>/code>; code idelement-content-categories:the-kbd-element-3>a href#the-kbd-element>kbd/a>/code>; code idelement-content-categories:the-label-element-5>a href#the-label-element>label/a>/code>; code idelement-content-categories:the-main-element-2>a href#the-main-element>main/a>/code>; code idelement-content-categories:the-map-element-5>a href#the-map-element>map/a>/code>; code idelement-content-categories:the-mark-element-3>a href#the-mark-element>mark/a>/code>; a idelement-content-categories:mathml-math-4 hrefhttps://www.w3.org/Math/draft-spec/chapter2.html#interf.toplevel data-x-internalmathml-math>MathML code>math/code>/a>; code idelement-content-categories:the-meter-element-4>a href#the-meter-element>meter/a>/code>; code idelement-content-categories:the-nav-element-3>a href#the-nav-element>nav/a>/code>; code idelement-content-categories:the-object-element-8>a href#the-object-element>object/a>/code>; code idelement-content-categories:the-output-element-7>a href#the-output-element>output/a>/code>; code idelement-content-categories:the-p-element-2>a href#the-p-element>p/a>/code>; code idelement-content-categories:the-pre-element-2>a href#the-pre-element>pre/a>/code>; code idelement-content-categories:the-progress-element-4>a href#the-progress-element>progress/a>/code>; code idelement-content-categories:the-q-element-3>a href#the-q-element>q/a>/code>; code idelement-content-categories:the-ruby-element-3>a href#the-ruby-element>ruby/a>/code>; code idelement-content-categories:the-s-element-3>a href#the-s-element>s/a>/code>; code idelement-content-categories:the-samp-element-3>a href#the-samp-element>samp/a>/code>; code idelement-content-categories:the-section-element-3>a href#the-section-element>section/a>/code>; code idelement-content-categories:the-select-element-9>a href#the-select-element>select/a>/code>; code idelement-content-categories:the-small-element-3>a href#the-small-element>small/a>/code>; code idelement-content-categories:the-span-element-3>a href#the-span-element>span/a>/code>; code idelement-content-categories:the-strong-element-3>a href#the-strong-element>strong/a>/code>; code idelement-content-categories:the-sub-and-sup-elements-5>a href#the-sub-and-sup-elements>sub/a>/code>; code idelement-content-categories:the-sub-and-sup-elements-6>a href#the-sub-and-sup-elements>sup/a>/code>; a idelement-content-categories:svg-svg-4 hrefhttps://www.w3.org/TR/SVG11/struct.html#SVGElement data-x-internalsvg-svg>SVG code>svg/code>/a>; code idelement-content-categories:the-table-element-2>a href#the-table-element>table/a>/code>; code idelement-content-categories:the-textarea-element-9>a href#the-textarea-element>textarea/a>/code>; code idelement-content-categories:the-time-element-3>a href#the-time-element>time/a>/code>; code idelement-content-categories:the-u-element-3>a href#the-u-element>u/a>/code>; code idelement-content-categories:the-var-element-3>a href#the-var-element>var/a>/code>; code idelement-content-categories:the-video-element-5>a href#the-video-element>video/a>/code>; a href#autonomous-custom-element idelement-content-categories:autonomous-custom-element-3>autonomous custom elements/a> td> code idelement-content-categories:the-audio-element-5>a href#the-audio-element>audio/a>/code> (if the code idelement-content-categories:attr-media-controls-3>a href#attr-media-controls>controls/a>/code> attribute is present); code idelement-content-categories:the-dl-element-2>a href#the-dl-element>dl/a>/code> (if the elements children include at least one name-value group); code idelement-content-categories:the-input-element-9>a href#the-input-element>input/a>/code> (if the code idelement-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-(typehidden) idelement-content-categories:hidden-state-(typehidden)-2>Hidden/a> state); code idelement-content-categories:the-menu-element-2>a href#the-menu-element>menu/a>/code> (if the elements children include at least one code idelement-content-categories:the-li-element>a href#the-li-element>li/a>/code> element); code idelement-content-categories:the-ol-element-2>a href#the-ol-element>ol/a>/code> (if the elements children include at least one code idelement-content-categories:the-li-element-2>a href#the-li-element>li/a>/code> element); code idelement-content-categories:the-ul-element-2>a href#the-ul-element>ul/a>/code> (if the elements children include at least one code idelement-content-categories:the-li-element-3>a href#the-li-element>li/a>/code> element); a href#text-content idelement-content-categories:text-content-3>Text/a> that is not a href#inter-element-whitespace idelement-content-categories:inter-element-whitespace>inter-element whitespace/a> tr>td> a href#script-supporting-elements-2 idelement-content-categories:script-supporting-elements-2>Script-supporting elements/a> td> code idelement-content-categories:the-script-element-4>a href#the-script-element>script/a>/code>; code idelement-content-categories:the-template-element-4>a href#the-template-element>template/a>/code> td> — /table> p classtablenote>small>* The code idelement-content-categories:attr-tabindex>a href#attr-tabindex>tabindex/a>/code> attribute can also make any element into a href#interactive-content-2 idelement-content-categories:interactive-content-2-2>interactive content/a>./small>/p> h3 idattributes-3 classno-num>Attributesa href#attributes-3 classself-link>/a>/h3> p>i>This section is non-normative./i>/p> table idattributes-1>caption>List of attributes (excluding event handler content attributes)/caption>thead>tr>th> Attribute th> Element(s) th> Description th> Value tbody>tr>th> code>abbr/code> td> code idattributes-3:attr-th-abbr>a href#attr-th-abbr>th/a>/code> td> Alternative label to use for the header cell when referencing the cell in other contexts td> a href#attribute-text>Text/a>* tr>th> code>accept/code> td> code idattributes-3:attr-input-accept>a href#attr-input-accept>input/a>/code> td> Hint for expected file type in a href#file-upload-state-(typefile) idattributes-3:file-upload-state-(typefile)>file upload controls/a> td> a href#set-of-comma-separated-tokens idattributes-3:set-of-comma-separated-tokens>Set of comma-separated tokens/a>* consisting of a hrefhttps://mimesniff.spec.whatwg.org/#valid-mime-type idattributes-3:valid-mime-type data-x-internalvalid-mime-type>valid MIME types with no parameters/a> or code>audio/*/code>, code>video/*/code>, or code>image/*/code> tr>th> code>accept-charset/code> td> code idattributes-3:attr-form-accept-charset>a href#attr-form-accept-charset>form/a>/code> td> Character encodings to use for a href#form-submission-2 idattributes-3:form-submission-2>form submission/a> td> a href#ordered-set-of-unique-space-separated-tokens idattributes-3:ordered-set-of-unique-space-separated-tokens>Ordered set of unique space-separated tokens/a>, a idattributes-3:ascii-case-insensitive hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a>, consisting of a hrefhttps://encoding.spec.whatwg.org/#label idattributes-3:encoding-label data-x-internalencoding-label>labels/a> of a href#ascii-compatible-encoding idattributes-3:ascii-compatible-encoding>ASCII-compatible encodings/a>* tr>th> code>accesskey/code> td> a href#the-accesskey-attribute idattributes-3:the-accesskey-attribute>HTML elements/a> td> Keyboard shortcut to activate or focus element td> a href#ordered-set-of-unique-space-separated-tokens idattributes-3:ordered-set-of-unique-space-separated-tokens-2>Ordered set of unique space-separated tokens/a>, a href#case-sensitive idattributes-3:case-sensitive>case-sensitive/a>, consisting of one code point in length tr>th> code>action/code> td> code idattributes-3:attr-fs-action>a href#attr-fs-action>form/a>/code> td> a idattributes-3:url hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> to use for a href#form-submission-2 idattributes-3:form-submission-2-2>form submission/a> td> a href#valid-non-empty-url-potentially-surrounded-by-spaces idattributes-3:valid-non-empty-url-potentially-surrounded-by-spaces>Valid non-empty URL potentially surrounded by spaces/a> tr>th> code>allowfullscreen/code> td> code idattributes-3:attr-iframe-allowfullscreen>a href#attr-iframe-allowfullscreen>iframe/a>/code> td> Whether to allow the code idattributes-3:the-iframe-element>a href#the-iframe-element>iframe/a>/code>s contents to use code idattributes-3:dom-element-requestfullscreen>a data-x-internaldom-element-requestfullscreen hrefhttps://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen>requestFullscreen()/a>/code> td> a href#boolean-attribute idattributes-3:boolean-attribute>Boolean attribute/a> tr>th> code>allowpaymentrequest/code> td> code idattributes-3:attr-iframe-allowpaymentrequest>a href#attr-iframe-allowpaymentrequest>iframe/a>/code> td> Whether the code idattributes-3:the-iframe-element-2>a href#the-iframe-element>iframe/a>/code>s contents are allowed to use the code idattributes-3:paymentrequest>a data-x-internalpaymentrequest hrefhttps://w3c.github.io/payment-request/#dom-paymentrequest>PaymentRequest/a>/code> interface to make payment requests td> a href#boolean-attribute idattributes-3:boolean-attribute-2>Boolean attribute/a> tr>th> code>allowusermedia/code> td> code idattributes-3:attr-iframe-allowusermedia>a href#attr-iframe-allowusermedia>iframe/a>/code> td> Whether to allow the code idattributes-3:the-iframe-element-3>a href#the-iframe-element>iframe/a>/code>s contents to use code idattributes-3:dom-mediadevices-getusermedia>a data-x-internaldom-mediadevices-getusermedia hrefhttps://w3c.github.io/mediacapture-main/#dom-mediadevices-getusermedia>getUserMedia()/a>/code> td> a href#boolean-attribute idattributes-3:boolean-attribute-3>Boolean attribute/a> tr>th> code>alt/code> td> code idattributes-3:attr-area-alt>a href#attr-area-alt>area/a>/code>; code idattributes-3:attr-img-alt>a href#attr-img-alt>img/a>/code>; code idattributes-3:attr-input-alt>a href#attr-input-alt>input/a>/code> td> Replacement text for use when images are not available td> a href#attribute-text>Text/a>* tr>th> code>as/code> td> code idattributes-3:attr-link-as>a href#attr-link-as>link/a>/code> td> a hrefhttps://fetch.spec.whatwg.org/#concept-potential-destination idattributes-3:concept-potential-destination data-x-internalconcept-potential-destination>Potential destination/a> for a preload request (for code idattributes-3:attr-link-rel>a href#attr-link-rel>rel/a>/code>code idattributes-3:link-type-preload>a href#link-type-preload>preload/a>/code> and code idattributes-3:attr-link-rel-2>a href#attr-link-rel>rel/a>/code>code idattributes-3:link-type-modulepreload>a href#link-type-modulepreload>modulepreload/a>/code>) td> a hrefhttps://fetch.spec.whatwg.org/#concept-potential-destination idattributes-3:concept-potential-destination-2 data-x-internalconcept-potential-destination>Potential destination/a>, for code idattributes-3:attr-link-rel-3>a href#attr-link-rel>rel/a>/code>code idattributes-3:link-type-preload-2>a href#link-type-preload>preload/a>/code>; a hrefhttps://fetch.spec.whatwg.org/#request-destination-script-like idattributes-3:concept-script-like-destination data-x-internalconcept-script-like-destination>script-like destination/a>, for code idattributes-3:attr-link-rel-4>a href#attr-link-rel>rel/a>/code>code idattributes-3:link-type-modulepreload-2>a href#link-type-modulepreload>modulepreload/a>/code> tr>th> code>async/code> td> code idattributes-3:attr-script-async>a href#attr-script-async>script/a>/code> td> Execute script when available, without blocking td> a href#boolean-attribute idattributes-3:boolean-attribute-4>Boolean attribute/a> tr>th> code>autocomplete/code> td> code idattributes-3:attr-form-autocomplete>a href#attr-form-autocomplete>form/a>/code> td> Default setting for autofill feature for controls in the form td> code>on/code>; code>off/code> tr>th> code>autocomplete/code> td> code idattributes-3:attr-fe-autocomplete>a href#attr-fe-autocomplete>input/a>/code>; code idattributes-3:attr-fe-autocomplete-2>a href#attr-fe-autocomplete>select/a>/code>; code idattributes-3:attr-fe-autocomplete-3>a href#attr-fe-autocomplete>textarea/a>/code> td> Hint for form autofill feature td> a href#autofill-field idattributes-3:autofill-field>Autofill field/a> name and related tokens* tr>th> code>autofocus/code> td> code idattributes-3:attr-fe-autofocus>a href#attr-fe-autofocus>button/a>/code>; code idattributes-3:attr-fe-autofocus-2>a href#attr-fe-autofocus>input/a>/code>; code idattributes-3:attr-fe-autofocus-3>a href#attr-fe-autofocus>select/a>/code>; code idattributes-3:attr-fe-autofocus-4>a href#attr-fe-autofocus>textarea/a>/code> td> Automatically focus the form control when the page is loaded td> a href#boolean-attribute idattributes-3:boolean-attribute-5>Boolean attribute/a> tr>th> code>autoplay/code> td> code idattributes-3:attr-media-autoplay>a href#attr-media-autoplay>audio/a>/code>; code idattributes-3:attr-media-autoplay-2>a href#attr-media-autoplay>video/a>/code> td> Hint that the a href#media-resource idattributes-3:media-resource>media resource/a> can be started automatically when the page is loaded td> a href#boolean-attribute idattributes-3:boolean-attribute-6>Boolean attribute/a> tr>th> code>charset/code> td> code idattributes-3:attr-meta-charset>a href#attr-meta-charset>meta/a>/code> td> a href#character-encoding-declaration idattributes-3:character-encoding-declaration>Character encoding declaration/a> td> code>utf-8/code> tr>th> code>checked/code> td> code idattributes-3:attr-input-checked>a href#attr-input-checked>input/a>/code> td> Whether the control is checked td> a href#boolean-attribute idattributes-3:boolean-attribute-7>Boolean attribute/a> tr>th> code>cite/code> td> code idattributes-3:attr-blockquote-cite>a href#attr-blockquote-cite>blockquote/a>/code>; code idattributes-3:attr-mod-cite>a href#attr-mod-cite>del/a>/code>; code idattributes-3:attr-mod-cite-2>a href#attr-mod-cite>ins/a>/code>; code idattributes-3:attr-q-cite>a href#attr-q-cite>q/a>/code> td> Link to the source of the quotation or more information about the edit td> a href#valid-url-potentially-surrounded-by-spaces idattributes-3:valid-url-potentially-surrounded-by-spaces>Valid URL potentially surrounded by spaces/a> tr>th> code>class/code> td> a href#classes idattributes-3:classes>HTML elements/a> td> Classes to which the element belongs td> a href#set-of-space-separated-tokens idattributes-3:set-of-space-separated-tokens>Set of space-separated tokens/a> tr>th> code>color/code> td> code idattributes-3:attr-link-color>a href#attr-link-color>link/a>/code> td> Color to use when customizing a sites icon (for code idattributes-3:attr-link-rel-5>a href#attr-link-rel>rel/a>/code>code>mask-icon/code>) td> CSS a idattributes-3:color hrefhttps://drafts.csswg.org/css-color/#typedef-color data-x-internalcolor><color>/a> tr>th> code>cols/code> td> code idattributes-3:attr-textarea-cols>a href#attr-textarea-cols>textarea/a>/code> td> Maximum number of characters per line td> a href#valid-non-negative-integer idattributes-3:valid-non-negative-integer>Valid non-negative integer/a> greater than zero tr>th> code>colspan/code> td> code idattributes-3:attr-tdth-colspan>a href#attr-tdth-colspan>td/a>/code>; code idattributes-3:attr-tdth-colspan-2>a href#attr-tdth-colspan>th/a>/code> td> Number of columns that the cell is to span td> a href#valid-non-negative-integer idattributes-3:valid-non-negative-integer-2>Valid non-negative integer/a> greater than zero tr>th> code>content/code> td> code idattributes-3:attr-meta-content>a href#attr-meta-content>meta/a>/code> td> Value of the element td> a href#attribute-text>Text/a>* tr>th> code>contenteditable/code> td> a href#attr-contenteditable idattributes-3:attr-contenteditable>HTML elements/a> td> Whether the element is editable td> code>true/code>; code>false/code> tr>th> code>controls/code> td> code idattributes-3:attr-media-controls>a href#attr-media-controls>audio/a>/code>; code idattributes-3:attr-media-controls-2>a href#attr-media-controls>video/a>/code> td> Show user agent controls td> a href#boolean-attribute idattributes-3:boolean-attribute-8>Boolean attribute/a> tr>th> code>coords/code> td> code idattributes-3:attr-area-coords>a href#attr-area-coords>area/a>/code> td> Coordinates for the shape to be created in an a href#image-map idattributes-3:image-map>image map/a> td> a href#valid-list-of-floating-point-numbers idattributes-3:valid-list-of-floating-point-numbers>Valid list of floating-point numbers/a>* tr>th> code>crossorigin/code> td> code idattributes-3:attr-media-crossorigin>a href#attr-media-crossorigin>audio/a>/code>; code idattributes-3:attr-img-crossorigin>a href#attr-img-crossorigin>img/a>/code>; code idattributes-3:attr-link-crossorigin>a href#attr-link-crossorigin>link/a>/code>; code idattributes-3:attr-script-crossorigin>a href#attr-script-crossorigin>script/a>/code>; code idattributes-3:attr-media-crossorigin-2>a href#attr-media-crossorigin>video/a>/code> td> How the element handles crossorigin requests td> code idattributes-3:attr-crossorigin-anonymous-keyword>a href#attr-crossorigin-anonymous-keyword>anonymous/a>/code>; code idattributes-3:attr-crossorigin-use-credentials-keyword>a href#attr-crossorigin-use-credentials-keyword>use-credentials/a>/code> tr>th> code>data/code> td> code idattributes-3:attr-object-data>a href#attr-object-data>object/a>/code> td> Address of the resource td> a href#valid-non-empty-url-potentially-surrounded-by-spaces idattributes-3:valid-non-empty-url-potentially-surrounded-by-spaces-2>Valid non-empty URL potentially surrounded by spaces/a> tr>th> code>datetime/code> td> code idattributes-3:attr-mod-datetime>a href#attr-mod-datetime>del/a>/code>; code idattributes-3:attr-mod-datetime-2>a href#attr-mod-datetime>ins/a>/code> td> Date and (optionally) time of the change td> a href#valid-date-string-with-optional-time idattributes-3:valid-date-string-with-optional-time>Valid date string with optional time/a> tr>th> code>datetime/code> td> code idattributes-3:attr-time-datetime>a href#attr-time-datetime>time/a>/code> td> Machine-readable value td> a href#valid-month-string idattributes-3:valid-month-string>Valid month string/a>, a href#valid-date-string idattributes-3:valid-date-string>valid date string/a>, a href#valid-yearless-date-string idattributes-3:valid-yearless-date-string>valid yearless date string/a>, a href#valid-time-string idattributes-3:valid-time-string>valid time string/a>, a href#valid-local-date-and-time-string idattributes-3:valid-local-date-and-time-string>valid local date and time string/a>, a href#valid-time-zone-offset-string idattributes-3:valid-time-zone-offset-string>valid time-zone offset string/a>, a href#valid-global-date-and-time-string idattributes-3:valid-global-date-and-time-string>valid global date and time string/a>, a href#valid-week-string idattributes-3:valid-week-string>valid week string/a>, a href#valid-non-negative-integer idattributes-3:valid-non-negative-integer-3>valid non-negative integer/a>, or a href#valid-duration-string idattributes-3:valid-duration-string>valid duration string/a> tr>th> code>default/code> td> code idattributes-3:attr-track-default>a href#attr-track-default>track/a>/code> td> Enable the track if no other a href#text-track idattributes-3:text-track>text track/a> is more suitable td> a href#boolean-attribute idattributes-3:boolean-attribute-9>Boolean attribute/a> tr>th> code>defer/code> td> code idattributes-3:attr-script-defer>a href#attr-script-defer>script/a>/code> td> Defer script execution td> a href#boolean-attribute idattributes-3:boolean-attribute-10>Boolean attribute/a> tr>th> code>dir/code> td> a href#the-dir-attribute idattributes-3:the-dir-attribute>HTML elements/a> td> a href#the-directionality idattributes-3:the-directionality>The text directionality/a> of the element td> code idattributes-3:attr-dir-ltr>a href#attr-dir-ltr>ltr/a>/code>; code idattributes-3:attr-dir-rtl>a href#attr-dir-rtl>rtl/a>/code>; code idattributes-3:attr-dir-auto>a href#attr-dir-auto>auto/a>/code> tr>th> code>dir/code> td> code idattributes-3:the-bdo-element>a href#the-bdo-element>bdo/a>/code> td> a href#the-directionality idattributes-3:the-directionality-2>The text directionality/a> of the element td> code idattributes-3:attr-dir-ltr-2>a href#attr-dir-ltr>ltr/a>/code>; code idattributes-3:attr-dir-rtl-2>a href#attr-dir-rtl>rtl/a>/code> tr>th> code>dirname/code> td> code idattributes-3:attr-fe-dirname>a href#attr-fe-dirname>input/a>/code>; code idattributes-3:attr-fe-dirname-2>a href#attr-fe-dirname>textarea/a>/code> td> Name of form control to use for sending the elements a href#the-directionality idattributes-3:the-directionality-3>directionality/a> in a href#form-submission-2 idattributes-3:form-submission-2-3>form submission/a> td> a href#attribute-text>Text/a>* tr>th> code>disabled/code> td> code idattributes-3:attr-fe-disabled>a href#attr-fe-disabled>button/a>/code>; code idattributes-3:attr-fieldset-disabled>a href#attr-fieldset-disabled>fieldset/a>/code>; code idattributes-3:attr-fe-disabled-2>a href#attr-fe-disabled>input/a>/code>; code idattributes-3:attr-optgroup-disabled>a href#attr-optgroup-disabled>optgroup/a>/code>; code idattributes-3:attr-option-disabled>a href#attr-option-disabled>option/a>/code>; code idattributes-3:attr-fe-disabled-3>a href#attr-fe-disabled>select/a>/code>; code idattributes-3:attr-fe-disabled-4>a href#attr-fe-disabled>textarea/a>/code> td> Whether the form control is disabled td> a href#boolean-attribute idattributes-3:boolean-attribute-11>Boolean attribute/a> tr>th> code>download/code> td> code idattributes-3:attr-hyperlink-download>a href#attr-hyperlink-download>a/a>/code>; code idattributes-3:attr-hyperlink-download-2>a href#attr-hyperlink-download>area/a>/code> td> Whether to download the resource instead of navigating to it, and its file name if so td> Text tr>th> code>draggable/code> td> a href#the-draggable-attribute idattributes-3:the-draggable-attribute>HTML elements/a> td> Whether the element is draggable td> code>true/code>; code>false/code> tr>th> code>enctype/code> td> code idattributes-3:attr-fs-enctype>a href#attr-fs-enctype>form/a>/code> td> Form data set encoding type to use for a href#form-submission-2 idattributes-3:form-submission-2-4>form submission/a> td> code idattributes-3:attr-fs-enctype-urlencoded>a href#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded/a>/code>; code idattributes-3:attr-fs-enctype-formdata>a href#attr-fs-enctype-formdata>multipart/form-data/a>/code>; code idattributes-3:attr-fs-enctype-text>a href#attr-fs-enctype-text>text/plain/a>/code> tr>th> code>for/code> td> code idattributes-3:attr-label-for>a href#attr-label-for>label/a>/code> td> Associate the label with form control td> a hrefhttps://dom.spec.whatwg.org/#concept-id idattributes-3:concept-id data-x-internalconcept-id>ID/a>* tr>th> code>for/code> td> code idattributes-3:attr-output-for>a href#attr-output-for>output/a>/code> td> Specifies controls from which the output was calculated td> a href#unordered-set-of-unique-space-separated-tokens idattributes-3:unordered-set-of-unique-space-separated-tokens>Unordered set of unique space-separated tokens/a>, a href#case-sensitive idattributes-3:case-sensitive-2>case-sensitive/a>, consisting of IDs* tr>th> code>form/code> td> code idattributes-3:attr-fae-form>a href#attr-fae-form>button/a>/code>; code idattributes-3:attr-fae-form-2>a href#attr-fae-form>fieldset/a>/code>; code idattributes-3:attr-fae-form-3>a href#attr-fae-form>input/a>/code>; code idattributes-3:attr-fae-form-4>a href#attr-fae-form>object/a>/code>; code idattributes-3:attr-fae-form-5>a href#attr-fae-form>output/a>/code>; code idattributes-3:attr-fae-form-6>a href#attr-fae-form>select/a>/code>; code idattributes-3:attr-fae-form-7>a href#attr-fae-form>textarea/a>/code> td> Associates the control with a code idattributes-3:the-form-element>a href#the-form-element>form/a>/code> element td> a hrefhttps://dom.spec.whatwg.org/#concept-id idattributes-3:concept-id-2 data-x-internalconcept-id>ID/a>* tr>th> code>formaction/code> td> code idattributes-3:attr-fs-formaction>a href#attr-fs-formaction>button/a>/code>; code idattributes-3:attr-fs-formaction-2>a href#attr-fs-formaction>input/a>/code> td> a idattributes-3:url-2 hrefhttps://url.spec.whatwg.org/#concept-url data-x-internalurl>URL/a> to use for a href#form-submission-2 idattributes-3:form-submission-2-5>form submission/a> td> a href#valid-non-empty-url-potentially-surrounded-by-spaces idattributes-3:valid-non-empty-url-potentially-surrounded-by-spaces-3>Valid non-empty URL potentially surrounded by spaces/a> tr>th> code>formenctype/code> td> code idattributes-3:attr-fs-formenctype>a href#attr-fs-formenctype>button/a>/code>; code idattributes-3:attr-fs-formenctype-2>a href#attr-fs-formenctype>input/a>/code> td> Form data set encoding type to use for a href#form-submission-2 idattributes-3:form-submission-2-6>form submission/a> td> code idattributes-3:attr-fs-enctype-urlencoded-2>a href#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded/a>/code>; code idattributes-3:attr-fs-enctype-formdata-2>a href#attr-fs-enctype-formdata>multipart/form-data/a>/code>; code idattributes-3:attr-fs-enctype-text-2>a href#attr-fs-enctype-text>text/plain/a>/code> tr>th> code>formmethod/code> td> code idattributes-3:attr-fs-formmethod>a href#attr-fs-formmethod>button/a>/code>; code idattributes-3:attr-fs-formmethod-2>a href#attr-fs-formmethod>input/a>/code> td> HTTP method to use for a href#form-submission-2 idattributes-3:form-submission-2-7>form submission/a> td> code>GET/code>; code>POST/code> tr>th> code>formnovalidate/code> td> code idattributes-3:attr-fs-formnovalidate>a href#attr-fs-formnovalidate>button/a>/code>; code idattributes-3:attr-fs-formnovalidate-2>a href#attr-fs-formnovalidate>input/a>/code> td> Bypass form control validation for a href#form-submission-2 idattributes-3:form-submission-2-8>form submission/a> td> a href#boolean-attribute idattributes-3:boolean-attribute-12>Boolean attribute/a> tr>th> code>formtarget/code> td> code idattributes-3:attr-fs-formtarget>a href#attr-fs-formtarget>button/a>/code>; code idattributes-3:attr-fs-formtarget-2>a href#attr-fs-formtarget>input/a>/code> td> a href#browsing-context idattributes-3:browsing-context>Browsing context/a> for a href#form-submission-2 idattributes-3:form-submission-2-9>form submission/a> td> a href#valid-browsing-context-name-or-keyword idattributes-3:valid-browsing-context-name-or-keyword>Valid browsing context name or keyword/a> tr>th> code>headers/code> td> code idattributes-3:attr-tdth-headers>a href#attr-tdth-headers>td/a>/code>; code idattributes-3:attr-tdth-headers-2>a href#attr-tdth-headers>th/a>/code> td> The header cells for this cell td> a href#unordered-set-of-unique-space-separated-tokens idattributes-3:unordered-set-of-unique-space-separated-tokens-2>Unordered set of unique space-separated tokens/a>, a href#case-sensitive idattributes-3:case-sensitive-3>case-sensitive/a>, consisting of IDs* tr>th> code>height/code> td> code idattributes-3:attr-canvas-height>a href#attr-canvas-height>canvas/a>/code>; code idattributes-3:attr-dim-height>a href#attr-dim-height>embed/a>/code>; code idattributes-3:attr-dim-height-2>a href#attr-dim-height>iframe/a>/code>; code idattributes-3:attr-dim-height-3>a href#attr-dim-height>img/a>/code>; code idattributes-3:attr-dim-height-4>a href#attr-dim-height>input/a>/code>; code idattributes-3:attr-dim-height-5>a href#attr-dim-height>object/a>/code>; code idattributes-3:attr-dim-height-6>a href#attr-dim-height>video/a>/code> td> Vertical dimension td> a href#valid-non-negative-integer idattributes-3:valid-non-negative-integer-4>Valid non-negative integer/a> tr>th> code>hidden/code> td> a href#the-hidden-attribute idattributes-3:the-hidden-attribute>HTML elements/a> td> Whether the element is relevant td> a href#boolean-attribute idattributes-3:boolean-attribute-13>Boolean attribute/a> tr>th> code>high/code> td> code idattributes-3:attr-meter-high>a href#attr-meter-high>meter/a>/code> td> Low limit of high range td> a href#valid-floating-point-number idattributes-3:valid-floating-point-number>Valid floating-point number/a>* tr>th> code>href/code> td> code idattributes-3:attr-hyperlink-href>a href#attr-hyperlink-href>a/a>/code>; code idattributes-3:attr-hyperlink-href-2>a href#attr-hyperlink-href>area/a>/code> td> Address of the a href#hyperlink idattributes-3:hyperlink>hyperlink/a> td> a href#valid-url-potentially-surrounded-by-spaces idattributes-3:valid-url-potentially-surrounded-by-spaces-2>Valid URL potentially surrounded by spaces/a> tr>th> code>href/code> td> code idattributes-3:attr-link-href>a href#attr-link-href>link/a>/code> td> Address of the a href#hyperlink idattributes-3:hyperlink-2>hyperlink/a> td> a href#valid-non-empty-url-potentially-surrounded-by-spaces idattributes-3:valid-non-empty-url-potentially-surrounded-by-spaces-4>Valid non-empty URL potentially surrounded by spaces/a> tr>th> code>href/code> td> code idattributes-3:attr-base-href>a href#attr-base-href>base/a>/code> td> a href#document-base-url idattributes-3:document-base-url>Document base URL/a> td> a href#valid-url-potentially-surrounded-by-spaces idattributes-3:valid-url-potentially-surrounded-by-spaces-3>Valid URL potentially surrounded by spaces/a> tr>th> code>hreflang/code> td> code idattributes-3:attr-hyperlink-hreflang>a href#attr-hyperlink-hreflang>a/a>/code>; code idattributes-3:attr-link-hreflang>a href#attr-link-hreflang>link/a>/code> td> Language of the linked resource td> Valid BCP 47 language tag tr>th> code>http-equiv/code> td> code idattributes-3:attr-meta-http-equiv>a href#attr-meta-http-equiv>meta/a>/code> td> Pragma directive td> a href#attribute-text>Text/a>* tr>th> code>id/code> td> a href#the-id-attribute idattributes-3:the-id-attribute>HTML elements/a> td> The elements a hrefhttps://dom.spec.whatwg.org/#concept-id idattributes-3:concept-id-3 data-x-internalconcept-id>ID/a> td> a href#attribute-text>Text/a>* tr>th> code>inputmode/code> td> code idattributes-3:attr-fe-inputmode>a href#attr-fe-inputmode>input/a>/code>; code idattributes-3:attr-fe-inputmode-2>a href#attr-fe-inputmode>textarea/a>/code> td> Hint for selecting an input modality td> code idattributes-3:attr-fe-inputmode-keyword-verbatim>a href#attr-fe-inputmode-keyword-verbatim>verbatim/a>/code>; code idattributes-3:attr-fe-inputmode-keyword-latin>a href#attr-fe-inputmode-keyword-latin>latin/a>/code>; code idattributes-3:attr-fe-inputmode-keyword-latin-name>a href#attr-fe-inputmode-keyword-latin-name>latin-name/a>/code>; code idattributes-3:attr-fe-inputmode-keyword-latin-prose>a href#attr-fe-inputmode-keyword-latin-prose>latin-prose/a>/code>; code idattributes-3:attr-fe-inputmode-keyword-full-width-latin>a href#attr-fe-inputmode-keyword-full-width-latin>full-width-latin/a>/code>; code idattributes-3:attr-fe-inputmode-keyword-kana>a href#attr-fe-inputmode-keyword-kana>kana/a>/code>; code idattributes-3:attr-fe-inputmode-keyword-kana-name>a href#attr-fe-inputmode-keyword-kana-name>kana-name/a>/code>; code idattributes-3:attr-fe-inputmode-keyword-katakana>a href#attr-fe-inputmode-keyword-katakana>katakana/a>/code>; code idattributes-3:attr-fe-inputmode-keyword-numeric>a href#attr-fe-inputmode-keyword-numeric>numeric/a>/code>; code idattributes-3:attr-fe-inputmode-keyword-tel>a href#attr-fe-inputmode-keyword-tel>tel/a>/code>; code idattributes-3:attr-fe-inputmode-keyword-email>a href#attr-fe-inputmode-keyword-email>email/a>/code>; code idattributes-3:attr-fe-inputmode-keyword-url>a href#attr-fe-inputmode-keyword-url>url/a>/code> tr>th> code>integrity/code> td> code idattributes-3:attr-link-integrity>a href#attr-link-integrity>link/a>/code>; code idattributes-3:attr-script-integrity>a href#attr-script-integrity>script/a>/code> td> Integrity metadata used in cite>Subresource Integrity/cite> checks a href#refsSRI>SRI/a> td> a href#attribute-text>Text/a> tr>th> code>is/code> td> a href#attr-is idattributes-3:attr-is>HTML elements/a> td> Creates a a href#customized-built-in-element idattributes-3:customized-built-in-element>customized built-in element/a> td> a href#valid-custom-element-name idattributes-3:valid-custom-element-name>Valid custom element name/a> of a defined a href#customized-built-in-element idattributes-3:customized-built-in-element-2>customized built-in element/a> tr>th> code>ismap/code> td> code idattributes-3:attr-img-ismap>a href#attr-img-ismap>img/a>/code> td> Whether the image is a server-side image map td> a href#boolean-attribute idattributes-3:boolean-attribute-14>Boolean attribute/a> tr>th> code>itemid/code> td> a href#attr-itemid idattributes-3:attr-itemid>HTML elements/a> td> a href#global-identifier idattributes-3:global-identifier>Global identifier/a> for a microdata item td> a href#valid-url-potentially-surrounded-by-spaces idattributes-3:valid-url-potentially-surrounded-by-spaces-4>Valid URL potentially surrounded by spaces/a> tr>th> code>itemprop/code> td> a href#names:-the-itemprop-attribute idattributes-3:names:-the-itemprop-attribute>HTML elements/a> td> a href#property-names idattributes-3:property-names>Property names/a> of a microdata item td> a href#unordered-set-of-unique-space-separated-tokens idattributes-3:unordered-set-of-unique-space-separated-tokens-3>Unordered set of unique space-separated tokens/a>, a href#case-sensitive idattributes-3:case-sensitive-4>case-sensitive/a>, consisting of a hrefhttps://url.spec.whatwg.org/#syntax-url-absolute idattributes-3:absolute-url data-x-internalabsolute-url>valid absolute URLs/a>, a href#defined-property-name idattributes-3:defined-property-name>defined property names/a>, or text* tr>th> code>itemref/code> td> a href#attr-itemref idattributes-3:attr-itemref>HTML elements/a> td> a href#referenced idattributes-3:referenced>Referenced/a> elements td> a href#unordered-set-of-unique-space-separated-tokens idattributes-3:unordered-set-of-unique-space-separated-tokens-4>Unordered set of unique space-separated tokens/a>, a href#case-sensitive idattributes-3:case-sensitive-5>case-sensitive/a>, consisting of IDs* tr>th> code>itemscope/code> td> a href#attr-itemscope idattributes-3:attr-itemscope>HTML elements/a> td> Introduces a microdata item td> a href#boolean-attribute idattributes-3:boolean-attribute-15>Boolean attribute/a> tr>th> code>itemtype/code> td> a href#attr-itemtype idattributes-3:attr-itemtype>HTML elements/a> td> a href#item-types idattributes-3:item-types>Item types/a> of a microdata item td> a href#unordered-set-of-unique-space-separated-tokens idattributes-3:unordered-set-of-unique-space-separated-tokens-5>Unordered set of unique space-separated tokens/a>, a href#case-sensitive idattributes-3:case-sensitive-6>case-sensitive/a>, consisting of a hrefhttps://url.spec.whatwg.org/#syntax-url-absolute idattributes-3:absolute-url-2 data-x-internalabsolute-url>valid absolute URL/a>* tr>th> code>kind/code> td> code idattributes-3:attr-track-kind>a href#attr-track-kind>track/a>/code> td> The type of text track td> code idattributes-3:attr-track-kind-keyword-subtitles>a href#attr-track-kind-keyword-subtitles>subtitles/a>/code>; code idattributes-3:attr-track-kind-keyword-captions>a href#attr-track-kind-keyword-captions>captions/a>/code>; code idattributes-3:attr-track-kind-keyword-descriptions>a href#attr-track-kind-keyword-descriptions>descriptions/a>/code>; code idattributes-3:attr-track-kind-keyword-chapters>a href#attr-track-kind-keyword-chapters>chapters/a>/code>; code idattributes-3:attr-track-kind-keyword-metadata>a href#attr-track-kind-keyword-metadata>metadata/a>/code> tr>th> code>label/code> td> code idattributes-3:attr-optgroup-label>a href#attr-optgroup-label>optgroup/a>/code>; code idattributes-3:attr-option-label>a href#attr-option-label>option/a>/code>; code idattributes-3:attr-track-label>a href#attr-track-label>track/a>/code> td> User-visible label td> a href#attribute-text>Text/a> tr>th> code>lang/code> td> a href#attr-lang idattributes-3:attr-lang>HTML elements/a> td> a href#language idattributes-3:language>Language/a> of the element td> Valid BCP 47 language tag or the empty string tr>th> code>list/code> td> code idattributes-3:attr-input-list>a href#attr-input-list>input/a>/code> td> List of autocomplete options td> a hrefhttps://dom.spec.whatwg.org/#concept-id idattributes-3:concept-id-4 data-x-internalconcept-id>ID/a>* tr>th> code>loop/code> td> code idattributes-3:attr-media-loop>a href#attr-media-loop>audio/a>/code>; code idattributes-3:attr-media-loop-2>a href#attr-media-loop>video/a>/code> td> Whether to loop the a href#media-resource idattributes-3:media-resource-2>media resource/a> td> a href#boolean-attribute idattributes-3:boolean-attribute-16>Boolean attribute/a> tr>th> code>low/code> td> code idattributes-3:attr-meter-low>a href#attr-meter-low>meter/a>/code> td> High limit of low range td> a href#valid-floating-point-number idattributes-3:valid-floating-point-number-2>Valid floating-point number/a>* tr>th> code>manifest/code> td> code idattributes-3:attr-html-manifest>a href#attr-html-manifest>html/a>/code> td> a href#concept-appcache-manifest idattributes-3:concept-appcache-manifest>Application cache manifest/a> td> a href#valid-non-empty-url-potentially-surrounded-by-spaces idattributes-3:valid-non-empty-url-potentially-surrounded-by-spaces-5>Valid non-empty URL potentially surrounded by spaces/a> tr>th> code>max/code> td> code idattributes-3:attr-input-max>a href#attr-input-max>input/a>/code> td> Maximum value td> Varies* tr>th> code>max/code> td> code idattributes-3:attr-meter-max>a href#attr-meter-max>meter/a>/code>; code idattributes-3:attr-progress-max>a href#attr-progress-max>progress/a>/code> td> Upper bound of range td> a href#valid-floating-point-number idattributes-3:valid-floating-point-number-3>Valid floating-point number/a>* tr>th> code>maxlength/code> td> code idattributes-3:attr-input-maxlength>a href#attr-input-maxlength>input/a>/code>; code idattributes-3:attr-textarea-maxlength>a href#attr-textarea-maxlength>textarea/a>/code> td> Maximum length of value td> a href#valid-non-negative-integer idattributes-3:valid-non-negative-integer-5>Valid non-negative integer/a> tr>th> code>media/code> td> code idattributes-3:attr-link-media>a href#attr-link-media>link/a>/code>; code idattributes-3:attr-source-media>a href#attr-source-media>source/a>/code>; code idattributes-3:attr-style-media>a href#attr-style-media>style/a>/code> td> Applicable media td> a href#valid-media-query-list idattributes-3:valid-media-query-list>Valid media query list/a> tr>th> code>method/code> td> code idattributes-3:attr-fs-method>a href#attr-fs-method>form/a>/code> td> HTTP method to use for a href#form-submission-2 idattributes-3:form-submission-2-10>form submission/a> td> code idattributes-3:attr-fs-method-get-keyword>a href#attr-fs-method-get-keyword>GET/a>/code>; code idattributes-3:attr-fs-method-post-keyword>a href#attr-fs-method-post-keyword>POST/a>/code>; code idattributes-3:attr-fs-method-dialog-keyword>a href#attr-fs-method-dialog-keyword>dialog/a>/code> tr>th> code>min/code> td> code idattributes-3:attr-input-min>a href#attr-input-min>input/a>/code> td> Minimum value td> Varies* tr>th> code>min/code> td> code idattributes-3:attr-meter-min>a href#attr-meter-min>meter/a>/code> td> Lower bound of range td> a href#valid-floating-point-number idattributes-3:valid-floating-point-number-4>Valid floating-point number/a>* tr>th> code>minlength/code> td> code idattributes-3:attr-input-minlength>a href#attr-input-minlength>input/a>/code>; code idattributes-3:attr-textarea-minlength>a href#attr-textarea-minlength>textarea/a>/code> td> Minimum length of value td> a href#valid-non-negative-integer idattributes-3:valid-non-negative-integer-6>Valid non-negative integer/a> tr>th> code>multiple/code> td> code idattributes-3:attr-input-multiple>a href#attr-input-multiple>input/a>/code>; code idattributes-3:attr-select-multiple>a href#attr-select-multiple>select/a>/code> td> Whether to allow multiple values td> a href#boolean-attribute idattributes-3:boolean-attribute-17>Boolean attribute/a> tr>th> code>muted/code> td> code idattributes-3:attr-media-muted>a href#attr-media-muted>audio/a>/code>; code idattributes-3:attr-media-muted-2>a href#attr-media-muted>video/a>/code> td> Whether to mute the a href#media-resource idattributes-3:media-resource-3>media resource/a> by default td> a href#boolean-attribute idattributes-3:boolean-attribute-18>Boolean attribute/a> tr>th> code>name/code> td> code idattributes-3:attr-fe-name>a href#attr-fe-name>button/a>/code>; code idattributes-3:attr-fe-name-2>a href#attr-fe-name>fieldset/a>/code>; code idattributes-3:attr-fe-name-3>a href#attr-fe-name>input/a>/code>; code idattributes-3:attr-fe-name-4>a href#attr-fe-name>output/a>/code>; code idattributes-3:attr-fe-name-5>a href#attr-fe-name>select/a>/code>; code idattributes-3:attr-fe-name-6>a href#attr-fe-name>textarea/a>/code> td> Name of form control to use for a href#form-submission-2 idattributes-3:form-submission-2-11>form submission/a> and in the code idattributes-3:dom-form-elements>a href#dom-form-elements>form.elements/a>/code> API td> a href#attribute-text>Text/a>* tr>th> code>name/code> td> code idattributes-3:attr-form-name>a href#attr-form-name>form/a>/code> td> Name of form to use in the code idattributes-3:dom-document-forms>a href#dom-document-forms>document.forms/a>/code> API td> a href#attribute-text>Text/a>* tr>th> code>name/code> td> code idattributes-3:attr-iframe-name>a href#attr-iframe-name>iframe/a>/code>; code idattributes-3:attr-object-name>a href#attr-object-name>object/a>/code> td> Name of a href#nested-browsing-context idattributes-3:nested-browsing-context>nested browsing context/a> td> a href#valid-browsing-context-name-or-keyword idattributes-3:valid-browsing-context-name-or-keyword-2>Valid browsing context name or keyword/a> tr>th> code>name/code> td> code idattributes-3:attr-map-name>a href#attr-map-name>map/a>/code> td> Name of a href#image-map idattributes-3:image-map-2>image map/a> to a href#referenced idattributes-3:referenced-2>reference/a> from the code idattributes-3:attr-hyperlink-usemap>a href#attr-hyperlink-usemap>usemap/a>/code> attribute td> a href#attribute-text>Text/a>* tr>th> code>name/code> td> code idattributes-3:attr-meta-name>a href#attr-meta-name>meta/a>/code> td> Metadata name td> a href#attribute-text>Text/a>* tr>th> code>name/code> td> code idattributes-3:attr-param-name>a href#attr-param-name>param/a>/code> td> Name of parameter td> a href#attribute-text>Text/a> tr>th> code>name/code> td> code idattributes-3:attr-slot-name>a href#attr-slot-name>slot/a>/code> td> Name of shadow tree slot td> a href#attribute-text>Text/a> tr>th> code>nomodule/code> td> code idattributes-3:attr-script-nomodule>a href#attr-script-nomodule>script/a>/code> td> Prevents execution in user agents that support a href#module-script idattributes-3:module-script>module scripts/a> td> a href#boolean-attribute idattributes-3:boolean-attribute-19>Boolean attribute/a> tr>th> code>nonce/code> td> code idattributes-3:attr-link-nonce>a href#attr-link-nonce>link/a>/code>; code idattributes-3:attr-script-nonce>a href#attr-script-nonce>script/a>/code>; code idattributes-3:attr-style-nonce>a href#attr-style-nonce>style/a>/code> td> Cryptographic nonce used in cite>Content Security Policy/cite> checks a href#refsCSP>CSP/a> td> a href#attribute-text>Text/a> tr>th> code>novalidate/code> td> code idattributes-3:attr-fs-novalidate>a href#attr-fs-novalidate>form/a>/code> td> Bypass form control validation for a href#form-submission-2 idattributes-3:form-submission-2-12>form submission/a> td> a href#boolean-attribute idattributes-3:boolean-attribute-20>Boolean attribute/a> tr>th> code>open/code> td> code idattributes-3:attr-details-open>a href#attr-details-open>details/a>/code> td> Whether the details are visible td> a href#boolean-attribute idattributes-3:boolean-attribute-21>Boolean attribute/a> tr>th> code>open/code> td> code idattributes-3:attr-dialog-open>a href#attr-dialog-open>dialog/a>/code> td> Whether the dialog box is showing td> a href#boolean-attribute idattributes-3:boolean-attribute-22>Boolean attribute/a> tr>th> code>optimum/code> td> code idattributes-3:attr-meter-optimum>a href#attr-meter-optimum>meter/a>/code> td> Optimum value in gauge td> a href#valid-floating-point-number idattributes-3:valid-floating-point-number-5>Valid floating-point number/a>* tr>th> code>pattern/code> td> code idattributes-3:attr-input-pattern>a href#attr-input-pattern>input/a>/code> td> Pattern to be matched by the form controls value td> Regular expression matching the JavaScript i idattributes-3:js-prod-pattern>a data-x-internaljs-prod-pattern hrefhttps://tc39.github.io/ecma262/#prod-Pattern>Pattern/a>/i> production tr>th> code>ping/code> td> code idattributes-3:ping>a href#ping>a/a>/code>; code idattributes-3:ping-2>a href#ping>area/a>/code> td> a hrefhttps://url.spec.whatwg.org/#concept-url idattributes-3:url-3 data-x-internalurl>URLs/a> to ping td> a href#set-of-space-separated-tokens idattributes-3:set-of-space-separated-tokens-2>Set of space-separated tokens/a> consisting of a href#valid-non-empty-url idattributes-3:valid-non-empty-url>valid non-empty URLs/a> tr>th> code>placeholder/code> td> code idattributes-3:attr-input-placeholder>a href#attr-input-placeholder>input/a>/code>; code idattributes-3:attr-textarea-placeholder>a href#attr-textarea-placeholder>textarea/a>/code> td> User-visible label to be placed within the form control td> a href#attribute-text>Text/a>* tr>th> code>playsinline/code> td> code idattributes-3:attr-video-playsinline>a href#attr-video-playsinline>video/a>/code> td> Encourage the user agent to display video content within the elements playback area td> a href#boolean-attribute idattributes-3:boolean-attribute-23>Boolean attribute/a> tr>th> code>poster/code> td> code idattributes-3:attr-video-poster>a href#attr-video-poster>video/a>/code> td> Poster frame to show prior to video playback td> a href#valid-non-empty-url-potentially-surrounded-by-spaces idattributes-3:valid-non-empty-url-potentially-surrounded-by-spaces-6>Valid non-empty URL potentially surrounded by spaces/a> tr>th> code>preload/code> td> code idattributes-3:attr-media-preload>a href#attr-media-preload>audio/a>/code>; code idattributes-3:attr-media-preload-2>a href#attr-media-preload>video/a>/code> td> Hints how much buffering the a href#media-resource idattributes-3:media-resource-4>media resource/a> will likely need td> code idattributes-3:attr-media-preload-none>a href#attr-media-preload-none>none/a>/code>; code idattributes-3:attr-media-preload-metadata>a href#attr-media-preload-metadata>metadata/a>/code>; code idattributes-3:attr-media-preload-auto>a href#attr-media-preload-auto>auto/a>/code> tr>th> code>readonly/code> td> code idattributes-3:attr-input-readonly>a href#attr-input-readonly>input/a>/code>; code idattributes-3:attr-textarea-readonly>a href#attr-textarea-readonly>textarea/a>/code> td> Whether to allow the value to be edited by the user td> a href#boolean-attribute idattributes-3:boolean-attribute-24>Boolean attribute/a> tr>th> code>referrerpolicy/code> td> code idattributes-3:attr-hyperlink-referrerpolicy>a href#attr-hyperlink-referrerpolicy>a/a>/code>; code idattributes-3:attr-hyperlink-referrerpolicy-2>a href#attr-hyperlink-referrerpolicy>area/a>/code>; code idattributes-3:attr-iframe-referrerpolicy>a href#attr-iframe-referrerpolicy>iframe/a>/code>; code idattributes-3:attr-img-referrerpolicy>a href#attr-img-referrerpolicy>img/a>/code>; code idattributes-3:attr-link-referrerpolicy>a href#attr-link-referrerpolicy>link/a>/code> td> a idattributes-3:referrer-policy hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>Referrer policy/a> for a hrefhttps://fetch.spec.whatwg.org/#concept-fetch idattributes-3:concept-fetch data-x-internalconcept-fetch>fetches/a> initiated by the element td> a idattributes-3:referrer-policy-2 hrefhttps://w3c.github.io/webappsec-referrer-policy/#referrer-policy data-x-internalreferrer-policy>Referrer policy/a> tr>th> code>rel/code> td> code idattributes-3:attr-hyperlink-rel>a href#attr-hyperlink-rel>a/a>/code>; code idattributes-3:attr-hyperlink-rel-2>a href#attr-hyperlink-rel>area/a>/code> td> Relationship between the location in the document containing the a href#hyperlink idattributes-3:hyperlink-3>hyperlink/a> and the destination resource td> a href#set-of-space-separated-tokens idattributes-3:set-of-space-separated-tokens-3>Set of space-separated tokens/a>* tr>th> code>rel/code> td> code idattributes-3:attr-link-rel-6>a href#attr-link-rel>link/a>/code> td> Relationship between the document containing the a href#hyperlink idattributes-3:hyperlink-4>hyperlink/a> and the destination resource td> a href#set-of-space-separated-tokens idattributes-3:set-of-space-separated-tokens-4>Set of space-separated tokens/a>* tr>th> code>required/code> td> code idattributes-3:attr-input-required>a href#attr-input-required>input/a>/code>; code idattributes-3:attr-select-required>a href#attr-select-required>select/a>/code>; code idattributes-3:attr-textarea-required>a href#attr-textarea-required>textarea/a>/code> td> Whether the control is required for a href#form-submission-2 idattributes-3:form-submission-2-13>form submission/a> td> a href#boolean-attribute idattributes-3:boolean-attribute-25>Boolean attribute/a> tr>th> code>reversed/code> td> code idattributes-3:attr-ol-reversed>a href#attr-ol-reversed>ol/a>/code> td> Number the list backwards td> a href#boolean-attribute idattributes-3:boolean-attribute-26>Boolean attribute/a> tr>th> code>rows/code> td> code idattributes-3:attr-textarea-rows>a href#attr-textarea-rows>textarea/a>/code> td> Number of lines to show td> a href#valid-non-negative-integer idattributes-3:valid-non-negative-integer-7>Valid non-negative integer/a> greater than zero tr>th> code>rowspan/code> td> code idattributes-3:attr-tdth-rowspan>a href#attr-tdth-rowspan>td/a>/code>; code idattributes-3:attr-tdth-rowspan-2>a href#attr-tdth-rowspan>th/a>/code> td> Number of rows that the cell is to span td> a href#valid-non-negative-integer idattributes-3:valid-non-negative-integer-8>Valid non-negative integer/a> tr>th> code>sandbox/code> td> code idattributes-3:attr-iframe-sandbox>a href#attr-iframe-sandbox>iframe/a>/code> td> Security rules for nested content td> a href#unordered-set-of-unique-space-separated-tokens idattributes-3:unordered-set-of-unique-space-separated-tokens-6>Unordered set of unique space-separated tokens/a>, a idattributes-3:ascii-case-insensitive-2 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a>, consisting of code idattributes-3:attr-iframe-sandbox-allow-forms>a href#attr-iframe-sandbox-allow-forms>allow-forms/a>/code>, code idattributes-3:attr-iframe-sandbox-allow-modals>a href#attr-iframe-sandbox-allow-modals>allow-modals/a>/code>, code idattributes-3:attr-iframe-sandbox-allow-orientation-lock>a href#attr-iframe-sandbox-allow-orientation-lock>allow-orientation-lock/a>/code>, code idattributes-3:attr-iframe-sandbox-allow-pointer-lock>a href#attr-iframe-sandbox-allow-pointer-lock>allow-pointer-lock/a>/code>, code idattributes-3:attr-iframe-sandbox-allow-popups>a href#attr-iframe-sandbox-allow-popups>allow-popups/a>/code>, code idattributes-3:attr-iframe-sandbox-allow-popups-to-escape-sandbox>a href#attr-iframe-sandbox-allow-popups-to-escape-sandbox>allow-popups-to-escape-sandbox/a>/code>, code idattributes-3:attr-iframe-sandbox-allow-presentation>a href#attr-iframe-sandbox-allow-presentation>allow-presentation/a>/code>, code idattributes-3:attr-iframe-sandbox-allow-same-origin>a href#attr-iframe-sandbox-allow-same-origin>allow-same-origin/a>/code>, code idattributes-3:attr-iframe-sandbox-allow-scripts>a href#attr-iframe-sandbox-allow-scripts>allow-scripts/a>/code> and code idattributes-3:attr-iframe-sandbox-allow-top-navigation>a href#attr-iframe-sandbox-allow-top-navigation>allow-top-navigation/a>/code> tr>th> code>scope/code> td> code idattributes-3:attr-th-scope>a href#attr-th-scope>th/a>/code> td> Specifies which cells the header cell applies to td> code idattributes-3:attr-th-scope-row>a href#attr-th-scope-row>row/a>/code>; code idattributes-3:attr-th-scope-col>a href#attr-th-scope-col>col/a>/code>; code idattributes-3:attr-th-scope-rowgroup>a href#attr-th-scope-rowgroup>rowgroup/a>/code>; code idattributes-3:attr-th-scope-colgroup>a href#attr-th-scope-colgroup>colgroup/a>/code> tr>th> code>scope/code> td> code idattributes-3:attr-link-scope>a href#attr-link-scope>link/a>/code> td> a idattributes-3:scope-url hrefhttps://w3c.github.io/ServiceWorker/#dfn-scope-url data-x-internalscope-url>Scope url/a> for a a idattributes-3:service-worker-registration hrefhttps://w3c.github.io/ServiceWorker/#dfn-service-worker-registration data-x-internalservice-worker-registration>service worker registration/a> (for code idattributes-3:attr-link-rel-7>a href#attr-link-rel>rel/a>/code>code idattributes-3:link-type-serviceworker>a href#link-type-serviceworker>serviceworker/a>/code>) td>a href#valid-url-potentially-surrounded-by-spaces idattributes-3:valid-url-potentially-surrounded-by-spaces-5>Valid URL potentially surrounded by spaces/a> tr>th> code>selected/code> td> code idattributes-3:attr-option-selected>a href#attr-option-selected>option/a>/code> td> Whether the option is selected by default td> a href#boolean-attribute idattributes-3:boolean-attribute-27>Boolean attribute/a> tr>th> code>shape/code> td> code idattributes-3:attr-area-shape>a href#attr-area-shape>area/a>/code> td> The kind of shape to be created in an a href#image-map idattributes-3:image-map-3>image map/a> td> code idattributes-3:attr-area-shape-keyword-circle>a href#attr-area-shape-keyword-circle>circle/a>/code>; code idattributes-3:attr-area-shape-keyword-default>a href#attr-area-shape-keyword-default>default/a>/code>; code idattributes-3:attr-area-shape-keyword-poly>a href#attr-area-shape-keyword-poly>poly/a>/code>; code idattributes-3:attr-area-shape-keyword-rect>a href#attr-area-shape-keyword-rect>rect/a>/code> tr>th> code>size/code> td> code idattributes-3:attr-input-size>a href#attr-input-size>input/a>/code>; code idattributes-3:attr-select-size>a href#attr-select-size>select/a>/code> td> Size of the control td> a href#valid-non-negative-integer idattributes-3:valid-non-negative-integer-9>Valid non-negative integer/a> greater than zero tr>th> code>sizes/code> td> code idattributes-3:attr-link-sizes>a href#attr-link-sizes>link/a>/code> td> Sizes of the icons (for code idattributes-3:attr-link-rel-8>a href#attr-link-rel>rel/a>/code>code idattributes-3:rel-icon>a href#rel-icon>icon/a>/code>) td> a href#unordered-set-of-unique-space-separated-tokens idattributes-3:unordered-set-of-unique-space-separated-tokens-7>Unordered set of unique space-separated tokens/a>, a idattributes-3:ascii-case-insensitive-3 hrefhttps://infra.spec.whatwg.org/#ascii-case-insensitive data-x-internalascii-case-insensitive>ASCII case-insensitive/a>, consisting of sizes* tr>th> code>sizes/code> td> code idattributes-3:attr-img-sizes>a href#attr-img-sizes>img/a>/code>; code idattributes-3:attr-source-sizes>a href#attr-source-sizes>source/a>/code> td> Image sizes for different page layouts td> a href#valid-source-size-list idattributes-3:valid-source-size-list>Valid source size list/a> tr>th> code>slot/code> td> a href#the-id-attribute idattributes-3:the-id-attribute-2>HTML elements/a> td> The elements desired slot td> a href#attribute-text>Text/a> tr>th> code>span/code> td> code idattributes-3:attr-col-span>a href#attr-col-span>col/a>/code>; code idattributes-3:attr-colgroup-span>a href#attr-colgroup-span>colgroup/a>/code> td> Number of columns spanned by the element td> a href#valid-non-negative-integer idattributes-3:valid-non-negative-integer-10>Valid non-negative integer/a> greater than zero tr>th> code>spellcheck/code> td> a href#attr-spellcheck idattributes-3:attr-spellcheck>HTML elements/a> td> Whether the element is to have its spelling and grammar checked td> code>true/code>; code>false/code> tr>th> code>src/code> td> code idattributes-3:attr-media-src>a href#attr-media-src>audio/a>/code>; code idattributes-3:attr-embed-src>a href#attr-embed-src>embed/a>/code>; code idattributes-3:attr-iframe-src>a href#attr-iframe-src>iframe/a>/code>; code idattributes-3:attr-img-src>a href#attr-img-src>img/a>/code>; code idattributes-3:attr-input-src>a href#attr-input-src>input/a>/code>; code idattributes-3:attr-script-src>a href#attr-script-src>script/a>/code>; code idattributes-3:attr-source-src>a href#attr-source-src>source/a>/code>; code idattributes-3:attr-track-src>a href#attr-track-src>track/a>/code>; code idattributes-3:attr-media-src-2>a href#attr-media-src>video/a>/code> td> Address of the resource td> a href#valid-non-empty-url-potentially-surrounded-by-spaces idattributes-3:valid-non-empty-url-potentially-surrounded-by-spaces-7>Valid non-empty URL potentially surrounded by spaces/a> tr>th> code>srcdoc/code> td> code idattributes-3:attr-iframe-srcdoc>a href#attr-iframe-srcdoc>iframe/a>/code> td> A document to render in the code idattributes-3:the-iframe-element-4>a href#the-iframe-element>iframe/a>/code> td> The source of a href#an-iframe-srcdoc-document idattributes-3:an-iframe-srcdoc-document>an code>iframe/code> code>srcdoc/code> document/a>* tr>th> code>srclang/code> td> code idattributes-3:attr-track-srclang>a href#attr-track-srclang>track/a>/code> td> Language of the text track td> Valid BCP 47 language tag tr>th> code>srcset/code> td> code idattributes-3:attr-img-srcset>a href#attr-img-srcset>img/a>/code>; code idattributes-3:attr-source-srcset>a href#attr-source-srcset>source/a>/code> td> Images to use in different situations (e.g. high-resolution displays, small monitors, etc) td> Comma-separated list of a href#image-candidate-string idattributes-3:image-candidate-string>image candidate strings/a> tr>th> code>start/code> td> code idattributes-3:attr-ol-start>a href#attr-ol-start>ol/a>/code> td> a href#concept-ol-start idattributes-3:concept-ol-start>Starting value/a> of the list td> a href#valid-integer idattributes-3:valid-integer>Valid integer/a> tr>th> code>step/code> td> code idattributes-3:attr-input-step>a href#attr-input-step>input/a>/code> td> Granularity to be matched by the form controls value td> a href#valid-floating-point-number idattributes-3:valid-floating-point-number-6>Valid floating-point number/a> greater than zero, or code>any/code> tr>th> code>style/code> td> a href#the-style-attribute idattributes-3:the-style-attribute>HTML elements/a> td> Presentational and formatting instructions td> CSS declarations* tr>th> code>tabindex/code> td> a href#attr-tabindex idattributes-3:attr-tabindex>HTML elements/a> td> Whether the element is focusable, and the relative order of the element for the purposes of sequential focus navigation td> a href#valid-integer idattributes-3:valid-integer-2>Valid integer/a> tr>th> code>target/code> td> code idattributes-3:attr-hyperlink-target>a href#attr-hyperlink-target>a/a>/code>; code idattributes-3:attr-hyperlink-target-2>a href#attr-hyperlink-target>area/a>/code> td> a href#browsing-context idattributes-3:browsing-context-2>Browsing context/a> for a href#hyperlink idattributes-3:hyperlink-5>hyperlink/a> a href#navigate idattributes-3:navigate>navigation/a> td> a href#valid-browsing-context-name-or-keyword idattributes-3:valid-browsing-context-name-or-keyword-3>Valid browsing context name or keyword/a> tr>th> code>target/code> td> code idattributes-3:attr-base-target>a href#attr-base-target>base/a>/code> td> Default a href#browsing-context idattributes-3:browsing-context-3>browsing context/a> for a href#hyperlink idattributes-3:hyperlink-6>hyperlink/a> a href#navigate idattributes-3:navigate-2>navigation/a> and a href#form-submission-2 idattributes-3:form-submission-2-14>form submission/a> td> a href#valid-browsing-context-name-or-keyword idattributes-3:valid-browsing-context-name-or-keyword-4>Valid browsing context name or keyword/a> tr>th> code>target/code> td> code idattributes-3:attr-fs-target>a href#attr-fs-target>form/a>/code> td> a href#browsing-context idattributes-3:browsing-context-4>Browsing context/a> for a href#form-submission-2 idattributes-3:form-submission-2-15>form submission/a> td> a href#valid-browsing-context-name-or-keyword idattributes-3:valid-browsing-context-name-or-keyword-5>Valid browsing context name or keyword/a> tr>th> code>title/code> td> a href#attr-title idattributes-3:attr-title>HTML elements/a> td> Advisory information for the element td> a href#attribute-text>Text/a> tr>th> code>title/code> td> code idattributes-3:attr-abbr-title>a href#attr-abbr-title>abbr/a>/code>; code idattributes-3:attr-dfn-title>a href#attr-dfn-title>dfn/a>/code> td> Full term or expansion of abbreviation td> a href#attribute-text>Text/a> tr>th> code>title/code> td> code idattributes-3:attr-input-title>a href#attr-input-title>input/a>/code> td> Description of pattern (when used with code idattributes-3:attr-input-pattern-2>a href#attr-input-pattern>pattern/a>/code> attribute) td> a href#attribute-text>Text/a> tr>th> code>title/code> td> code idattributes-3:attr-link-title>a href#attr-link-title>link/a>/code> td> Title of the link td> a href#attribute-text>Text/a> tr>th> code>title/code> td> code idattributes-3:attr-link-title-2>a href#attr-link-title>link/a>/code>; code idattributes-3:attr-style-title>a href#attr-style-title>style/a>/code> td> a idattributes-3:css-style-sheet-set-name hrefhttps://drafts.csswg.org/cssom/#css-style-sheet-set-name data-x-internalcss-style-sheet-set-name>CSS style sheet set name/a> td> a href#attribute-text>Text/a> tr>th> code>translate/code> td> a href#attr-translate idattributes-3:attr-translate>HTML elements/a> td> Whether the element is to be translated when the page is localized td> code>yes/code>; code>no/code> tr>th> code>type/code> td> code idattributes-3:attr-hyperlink-type>a href#attr-hyperlink-type>a/a>/code>; code idattributes-3:attr-link-type>a href#attr-link-type>link/a>/code> td> Hint for the type of the referenced resource td> a idattributes-3:valid-mime-type-2 hrefhttps://mimesniff.spec.whatwg.org/#valid-mime-type data-x-internalvalid-mime-type>Valid MIME type/a> tr>th> code>type/code> td> code idattributes-3:attr-button-type>a href#attr-button-type>button/a>/code> td> Type of button td> code idattributes-3:attr-button-type-submit>a href#attr-button-type-submit>submit/a>/code>; code idattributes-3:attr-button-type-reset>a href#attr-button-type-reset>reset/a>/code>; code idattributes-3:attr-button-type-button>a href#attr-button-type-button>button/a>/code> tr>th> code>type/code> td> code idattributes-3:attr-embed-type>a href#attr-embed-type>embed/a>/code>; code idattributes-3:attr-object-type>a href#attr-object-type>object/a>/code>; code idattributes-3:attr-source-type>a href#attr-source-type>source/a>/code> td> Type of embedded resource td> a idattributes-3:valid-mime-type-3 hrefhttps://mimesniff.spec.whatwg.org/#valid-mime-type data-x-internalvalid-mime-type>Valid MIME type/a> tr>th> code>type/code> td> code idattributes-3:attr-input-type>a href#attr-input-type>input/a>/code> td> Type of form control td> a href#attr-input-type idattributes-3:attr-input-type-2>code>input/code> type keyword/a> tr>th> code>type/code> td> code idattributes-3:attr-ol-type>a href#attr-ol-type>ol/a>/code> td> Kind of list marker td> code idattributes-3:attr-ol-type-keyword-decimal>a href#attr-ol-type-keyword-decimal>1/a>/code>; code idattributes-3:attr-ol-type-keyword-lower-alpha>a href#attr-ol-type-keyword-lower-alpha>a/a>/code>; code idattributes-3:attr-ol-type-keyword-upper-alpha>a href#attr-ol-type-keyword-upper-alpha>A/a>/code>; code idattributes-3:attr-ol-type-keyword-lower-roman>a href#attr-ol-type-keyword-lower-roman>i/a>/code>; code idattributes-3:attr-ol-type-keyword-upper-roman>a href#attr-ol-type-keyword-upper-roman>I/a>/code> tr>th> code>type/code> td> code idattributes-3:attr-script-type>a href#attr-script-type>script/a>/code> td> Type of script td> code>module/code>; a a idattributes-3:valid-mime-type-4 hrefhttps://mimesniff.spec.whatwg.org/#valid-mime-type data-x-internalvalid-mime-type>valid MIME type/a> that is not a a href#javascript-mime-type idattributes-3:javascript-mime-type>JavaScript MIME type/a> tr>th> code>typemustmatch/code> td> code idattributes-3:attr-object-typemustmatch>a href#attr-object-typemustmatch>object/a>/code> td> Whether the code idattributes-3:attr-object-type-2>a href#attr-object-type>type/a>/code> attribute and the a href#content-type idattributes-3:content-type>Content-Type/a> value need to match for the resource to be used td> a href#boolean-attribute idattributes-3:boolean-attribute-28>Boolean attribute/a> tr>th> code>updateviacache/code> td> code idattributes-3:attr-link-updateviacache>a href#attr-link-updateviacache>link/a>/code> td> a idattributes-3:update-via-cache-mode hrefhttps://w3c.github.io/ServiceWorker/#dfn-update-via-cache data-x-internalupdate-via-cache-mode>Update via cache mode/a> for a a idattributes-3:service-worker-registration-2 hrefhttps://w3c.github.io/ServiceWorker/#dfn-service-worker-registration data-x-internalservice-worker-registration>service worker registration/a> (for code idattributes-3:attr-link-rel-9>a href#attr-link-rel>rel/a>/code>code idattributes-3:link-type-serviceworker-2>a href#link-type-serviceworker>serviceworker/a>/code>) td> a idattributes-3:update-via-cache-mode-2 hrefhttps://w3c.github.io/ServiceWorker/#dfn-update-via-cache data-x-internalupdate-via-cache-mode>Update via cache mode/a> tr>th> code>usemap/code> td> code idattributes-3:attr-hyperlink-usemap-2>a href#attr-hyperlink-usemap>img/a>/code>; code idattributes-3:attr-hyperlink-usemap-3>a href#attr-hyperlink-usemap>object/a>/code> td> Name of a href#image-map idattributes-3:image-map-4>image map/a> to use td> a href#valid-hash-name-reference idattributes-3:valid-hash-name-reference>Valid hash-name reference/a>* tr>th> code>value/code> td> code idattributes-3:attr-button-value>a href#attr-button-value>button/a>/code>; code idattributes-3:attr-option-value>a href#attr-option-value>option/a>/code> td> Value to be used for a href#form-submission-2 idattributes-3:form-submission-2-16>form submission/a> td> a href#attribute-text>Text/a> tr>th> code>value/code> td> code idattributes-3:attr-data-value>a href#attr-data-value>data/a>/code> td> Machine-readable value td> a href#attribute-text>Text/a>* tr>th> code>value/code> td> code idattributes-3:attr-input-value>a href#attr-input-value>input/a>/code> td> Value of the form control td> Varies* tr>th> code>value/code> td> code idattributes-3:attr-li-value>a href#attr-li-value>li/a>/code> td> a href#ordinal-value idattributes-3:ordinal-value>Ordinal value/a> of the list item td> a href#valid-integer idattributes-3:valid-integer-3>Valid integer/a> tr>th> code>value/code> td> code idattributes-3:attr-meter-value>a href#attr-meter-value>meter/a>/code>; code idattributes-3:attr-progress-value>a href#attr-progress-value>progress/a>/code> td> Current value of the element td> a href#valid-floating-point-number idattributes-3:valid-floating-point-number-7>Valid floating-point number/a> tr>th> code>value/code> td> code idattributes-3:attr-param-value>a href#attr-param-value>param/a>/code> td> Value of parameter td> a href#attribute-text>Text/a> tr>th> code>width/code> td> code idattributes-3:attr-canvas-width>a href#attr-canvas-width>canvas/a>/code>; code idattributes-3:attr-dim-width>a href#attr-dim-width>embed/a>/code>; code idattributes-3:attr-dim-width-2>a href#attr-dim-width>iframe/a>/code>; code idattributes-3:attr-dim-width-3>a href#attr-dim-width>img/a>/code>; code idattributes-3:attr-dim-width-4>a href#attr-dim-width>input/a>/code>; code idattributes-3:attr-dim-width-5>a href#attr-dim-width>object/a>/code>; code idattributes-3:attr-dim-width-6>a href#attr-dim-width>video/a>/code> td> Horizontal dimension td> a href#valid-non-negative-integer idattributes-3:valid-non-negative-integer-11>Valid non-negative integer/a> tr>th> code>workertype/code> td> code idattributes-3:attr-link-workertype>a href#attr-link-workertype>link/a>/code> td> a idattributes-3:service-worker-type hrefhttps://w3c.github.io/ServiceWorker/#dfn-type data-x-internalservice-worker-type>Service worker type/a> for a a idattributes-3:service-worker-registration-3 hrefhttps://w3c.github.io/ServiceWorker/#dfn-service-worker-registration data-x-internalservice-worker-registration>service worker registration/a> (for code idattributes-3:attr-link-rel-10>a href#attr-link-rel>rel/a>/code>code idattributes-3:link-type-serviceworker-3>a href#link-type-serviceworker>serviceworker/a>/code>) td> code>classic/code>; code>module/code> tr>th> code>wrap/code> td> code idattributes-3:attr-textarea-wrap>a href#attr-textarea-wrap>textarea/a>/code> td> How the value of the form control is to be wrapped for a href#form-submission-2 idattributes-3:form-submission-2-17>form submission/a> td> code idattributes-3:attr-textarea-wrap-soft>a href#attr-textarea-wrap-soft>soft/a>/code>; code idattributes-3:attr-textarea-wrap-hard>a href#attr-textarea-wrap-hard>hard/a>/code> /table> p classtablenote>small>An asterisk (*) in a cell indicates that the actual rules are more complicated than indicated in the table above./small>/p> hr> table idix-event-handlers>caption>List of event handler content attributes/caption>thead>tr>th> Attribute th> Element(s) th> Description th> Value tbody>tr>th idix-handler-onabort> code>onabort/code> td> a href#handler-onabort idattributes-3:handler-onabort>HTML elements/a> td> code idattributes-3:event-abort>a href#event-abort>abort/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes>Event handler content attribute/a> tr>th idix-handler-onauxclick> code>onauxclick/code> td> a href#handler-onauxclick idattributes-3:handler-onauxclick>HTML elements/a> td> code idattributes-3:event-auxclick>a data-x-internalevent-auxclick hrefhttps://w3c.github.io/uievents/#event-type-auxclick>auxclick/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-2>Event handler content attribute/a> tr>th idix-handler-window-onafterprint> code>onafterprint/code> td> code idattributes-3:handler-window-onafterprint>a href#handler-window-onafterprint>body/a>/code> td> code idattributes-3:event-afterprint>a href#event-afterprint>afterprint/a>/code> event handler for code idattributes-3:window>a href#window>Window/a>/code> object td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-3>Event handler content attribute/a> tr>th idix-handler-window-onbeforeprint> code>onbeforeprint/code> td> code idattributes-3:handler-window-onbeforeprint>a href#handler-window-onbeforeprint>body/a>/code> td> code idattributes-3:event-beforeprint>a href#event-beforeprint>beforeprint/a>/code> event handler for code idattributes-3:window-2>a href#window>Window/a>/code> object td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-4>Event handler content attribute/a> tr>th idix-handler-window-onbeforeunload> code>onbeforeunload/code> td> code idattributes-3:handler-window-onbeforeunload>a href#handler-window-onbeforeunload>body/a>/code> td> code idattributes-3:event-beforeunload>a href#event-beforeunload>beforeunload/a>/code> event handler for code idattributes-3:window-3>a href#window>Window/a>/code> object td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-5>Event handler content attribute/a> tr>th idix-handler-onblur> code>onblur/code> td> a href#handler-onblur idattributes-3:handler-onblur>HTML elements/a> td> code idattributes-3:event-blur>a href#event-blur>blur/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-6>Event handler content attribute/a> tr>th idix-handler-oncancel> code>oncancel/code> td> a href#handler-oncancel idattributes-3:handler-oncancel>HTML elements/a> td> code idattributes-3:event-cancel>a href#event-cancel>cancel/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-7>Event handler content attribute/a> tr>th idix-handler-oncanplay> code>oncanplay/code> td> a href#handler-oncanplay idattributes-3:handler-oncanplay>HTML elements/a> td> code idattributes-3:event-media-canplay>a href#event-media-canplay>canplay/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-8>Event handler content attribute/a> tr>th idix-handler-oncanplaythrough> code>oncanplaythrough/code> td> a href#handler-oncanplaythrough idattributes-3:handler-oncanplaythrough>HTML elements/a> td> code idattributes-3:event-media-canplaythrough>a href#event-media-canplaythrough>canplaythrough/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-9>Event handler content attribute/a> tr>th idix-handler-onchange> code>onchange/code> td> a href#handler-onchange idattributes-3:handler-onchange>HTML elements/a> td> code idattributes-3:event-change>a href#event-change>change/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-10>Event handler content attribute/a> tr>th idix-handler-onclick> code>onclick/code> td> a href#handler-onclick idattributes-3:handler-onclick>HTML elements/a> td> code idattributes-3:event-click>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-11>Event handler content attribute/a> tr>th idix-handler-onclose> code>onclose/code> td> a href#handler-onclose idattributes-3:handler-onclose>HTML elements/a> td> code idattributes-3:event-close>a href#event-close>close/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-12>Event handler content attribute/a> tr>th idix-handler-oncontextmenu> code>oncontextmenu/code> td> a href#handler-oncontextmenu idattributes-3:handler-oncontextmenu>HTML elements/a> td> code idattributes-3:event-contextmenu>a href#event-contextmenu>contextmenu/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-13>Event handler content attribute/a> tr>th idix-handler-oncopy> code>oncopy/code> td> a href#handler-oncopy idattributes-3:handler-oncopy>HTML elements/a> td> code idattributes-3:event-copy>a href#event-copy>copy/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-14>Event handler content attribute/a> tr>th idix-handler-oncuechange> code>oncuechange/code> td> a href#handler-oncuechange idattributes-3:handler-oncuechange>HTML elements/a> td> code idattributes-3:event-media-cuechange>a href#event-media-cuechange>cuechange/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-15>Event handler content attribute/a> tr>th idix-handler-oncut> code>oncut/code> td> a href#handler-oncut idattributes-3:handler-oncut>HTML elements/a> td> code idattributes-3:event-cut>a href#event-cut>cut/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-16>Event handler content attribute/a> tr>th idix-handler-ondblclick> code>ondblclick/code> td> a href#handler-ondblclick idattributes-3:handler-ondblclick>HTML elements/a> td> code idattributes-3:event-dblclick>a data-x-internalevent-dblclick hrefhttps://w3c.github.io/uievents/#event-type-dblclick>dblclick/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-17>Event handler content attribute/a> tr>th idix-handler-ondrag> code>ondrag/code> td> a href#handler-ondrag idattributes-3:handler-ondrag>HTML elements/a> td> code idattributes-3:event-dnd-drag>a href#event-dnd-drag>drag/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-18>Event handler content attribute/a> tr>th idix-handler-ondragend> code>ondragend/code> td> a href#handler-ondragend idattributes-3:handler-ondragend>HTML elements/a> td> code idattributes-3:event-dnd-dragend>a href#event-dnd-dragend>dragend/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-19>Event handler content attribute/a> tr>th idix-handler-ondragenter> code>ondragenter/code> td> a href#handler-ondragenter idattributes-3:handler-ondragenter>HTML elements/a> td> code idattributes-3:event-dnd-dragenter>a href#event-dnd-dragenter>dragenter/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-20>Event handler content attribute/a> tr>th idix-handler-ondragexit> code>ondragexit/code> td> a href#handler-ondragexit idattributes-3:handler-ondragexit>HTML elements/a> td> code idattributes-3:event-dnd-dragexit>a href#event-dnd-dragexit>dragexit/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-21>Event handler content attribute/a> tr>th idix-handler-ondragleave> code>ondragleave/code> td> a href#handler-ondragleave idattributes-3:handler-ondragleave>HTML elements/a> td> code idattributes-3:event-dnd-dragleave>a href#event-dnd-dragleave>dragleave/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-22>Event handler content attribute/a> tr>th idix-handler-ondragover> code>ondragover/code> td> a href#handler-ondragover idattributes-3:handler-ondragover>HTML elements/a> td> code idattributes-3:event-dnd-dragover>a href#event-dnd-dragover>dragover/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-23>Event handler content attribute/a> tr>th idix-handler-ondragstart> code>ondragstart/code> td> a href#handler-ondragstart idattributes-3:handler-ondragstart>HTML elements/a> td> code idattributes-3:event-dnd-dragstart>a href#event-dnd-dragstart>dragstart/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-24>Event handler content attribute/a> tr>th idix-handler-ondrop> code>ondrop/code> td> a href#handler-ondrop idattributes-3:handler-ondrop>HTML elements/a> td> code idattributes-3:event-dnd-drop>a href#event-dnd-drop>drop/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-25>Event handler content attribute/a> tr>th idix-handler-ondurationchange> code>ondurationchange/code> td> a href#handler-ondurationchange idattributes-3:handler-ondurationchange>HTML elements/a> td> code idattributes-3:event-media-durationchange>a href#event-media-durationchange>durationchange/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-26>Event handler content attribute/a> tr>th idix-handler-onemptied> code>onemptied/code> td> a href#handler-onemptied idattributes-3:handler-onemptied>HTML elements/a> td> code idattributes-3:event-media-emptied>a href#event-media-emptied>emptied/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-27>Event handler content attribute/a> tr>th idix-handler-onended> code>onended/code> td> a href#handler-onended idattributes-3:handler-onended>HTML elements/a> td> code idattributes-3:event-media-ended>a href#event-media-ended>ended/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-28>Event handler content attribute/a> tr>th idix-handler-onerror> code>onerror/code> td> a href#handler-onerror idattributes-3:handler-onerror>HTML elements/a> td> code idattributes-3:event-error>a href#event-error>error/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-29>Event handler content attribute/a> tr>th idix-handler-onfocus> code>onfocus/code> td> a href#handler-onfocus idattributes-3:handler-onfocus>HTML elements/a> td> code idattributes-3:event-focus>a href#event-focus>focus/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-30>Event handler content attribute/a> tr>th idix-handler-window-onhashchange> code>onhashchange/code> td> code idattributes-3:handler-window-onhashchange>a href#handler-window-onhashchange>body/a>/code> td> code idattributes-3:event-hashchange>a href#event-hashchange>hashchange/a>/code> event handler for code idattributes-3:window-4>a href#window>Window/a>/code> object td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-31>Event handler content attribute/a> tr>th idix-handler-oninput> code>oninput/code> td> a href#handler-oninput idattributes-3:handler-oninput>HTML elements/a> td> code idattributes-3:event-input>a href#event-input>input/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-32>Event handler content attribute/a> tr>th idix-handler-oninvalid> code>oninvalid/code> td> a href#handler-oninvalid idattributes-3:handler-oninvalid>HTML elements/a> td> code idattributes-3:event-invalid>a href#event-invalid>invalid/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-33>Event handler content attribute/a> tr>th idix-handler-onkeydown> code>onkeydown/code> td> a href#handler-onkeydown idattributes-3:handler-onkeydown>HTML elements/a> td> code idattributes-3:event-keydown>a data-x-internalevent-keydown hrefhttps://w3c.github.io/uievents/#event-type-keydown>keydown/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-34>Event handler content attribute/a> tr>th idix-handler-onkeypress> code>onkeypress/code> td> a href#handler-onkeypress idattributes-3:handler-onkeypress>HTML elements/a> td> code idattributes-3:event-keypress>a data-x-internalevent-keypress hrefhttps://w3c.github.io/uievents/#event-type-keypress>keypress/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-35>Event handler content attribute/a> tr>th idix-handler-onkeyup> code>onkeyup/code> td> a href#handler-onkeyup idattributes-3:handler-onkeyup>HTML elements/a> td> code idattributes-3:event-keyup>a data-x-internalevent-keyup hrefhttps://w3c.github.io/uievents/#event-type-keyup>keyup/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-36>Event handler content attribute/a> tr>th idix-handler-window-onlanguagechange> code>onlanguagechange/code> td> code idattributes-3:handler-window-onlanguagechange>a href#handler-window-onlanguagechange>body/a>/code> td> code idattributes-3:event-languagechange>a href#event-languagechange>languagechange/a>/code> event handler for code idattributes-3:window-5>a href#window>Window/a>/code> object td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-37>Event handler content attribute/a> tr>th idix-handler-onload> code>onload/code> td> a href#handler-onload idattributes-3:handler-onload>HTML elements/a> td> code idattributes-3:event-load>a href#event-load>load/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-38>Event handler content attribute/a> tr>th idix-handler-onloadeddata> code>onloadeddata/code> td> a href#handler-onloadeddata idattributes-3:handler-onloadeddata>HTML elements/a> td> code idattributes-3:event-media-loadeddata>a href#event-media-loadeddata>loadeddata/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-39>Event handler content attribute/a> tr>th idix-handler-onloadedmetadata> code>onloadedmetadata/code> td> a href#handler-onloadedmetadata idattributes-3:handler-onloadedmetadata>HTML elements/a> td> code idattributes-3:event-media-loadedmetadata>a href#event-media-loadedmetadata>loadedmetadata/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-40>Event handler content attribute/a> tr>th idix-handler-onloadend> code>onloadend/code> td> a href#handler-onloadend idattributes-3:handler-onloadend>HTML elements/a> td> code idattributes-3:event-loadend>a href#event-loadend>loadend/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-41>Event handler content attribute/a> tr>th idix-handler-onloadstart> code>onloadstart/code> td> a href#handler-onloadstart idattributes-3:handler-onloadstart>HTML elements/a> td> code idattributes-3:event-media-loadstart>a href#event-media-loadstart>loadstart/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-42>Event handler content attribute/a> tr>th idix-handler-window-onmessage> code>onmessage/code> td> code idattributes-3:handler-window-onmessage>a href#handler-window-onmessage>body/a>/code> td> code idattributes-3:event-message>a href#event-message>message/a>/code> event handler for code idattributes-3:window-6>a href#window>Window/a>/code> object td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-43>Event handler content attribute/a> tr>th idix-handler-window-onmessageerror> code>onmessageerror/code> td> code idattributes-3:handler-window-onmessageerror>a href#handler-window-onmessageerror>body/a>/code> td> code idattributes-3:event-messageerror>a href#event-messageerror>messageerror/a>/code> event handler for code idattributes-3:window-7>a href#window>Window/a>/code> object td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-44>Event handler content attribute/a> tr>th idix-handler-onmousedown> code>onmousedown/code> td> a href#handler-onmousedown idattributes-3:handler-onmousedown>HTML elements/a> td> code idattributes-3:event-mousedown>a data-x-internalevent-mousedown hrefhttps://w3c.github.io/uievents/#event-type-mousedown>mousedown/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-45>Event handler content attribute/a> tr>th idix-handler-onmouseenter> code>onmouseenter/code> td> a href#handler-onmouseenter idattributes-3:handler-onmouseenter>HTML elements/a> td> code idattributes-3:event-mouseenter>a data-x-internalevent-mouseenter hrefhttps://w3c.github.io/uievents/#event-type-mouseenter>mouseenter/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-46>Event handler content attribute/a> tr>th idix-handler-onmouseleave> code>onmouseleave/code> td> a href#handler-onmouseleave idattributes-3:handler-onmouseleave>HTML elements/a> td> code idattributes-3:event-mouseleave>a data-x-internalevent-mouseleave hrefhttps://w3c.github.io/uievents/#event-type-mouseleave>mouseleave/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-47>Event handler content attribute/a> tr>th idix-handler-onmousemove> code>onmousemove/code> td> a href#handler-onmousemove idattributes-3:handler-onmousemove>HTML elements/a> td> code idattributes-3:event-mousemove>a data-x-internalevent-mousemove hrefhttps://w3c.github.io/uievents/#event-type-mousemove>mousemove/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-48>Event handler content attribute/a> tr>th idix-handler-onmouseout> code>onmouseout/code> td> a href#handler-onmouseout idattributes-3:handler-onmouseout>HTML elements/a> td> code idattributes-3:event-mouseout>a data-x-internalevent-mouseout hrefhttps://w3c.github.io/uievents/#event-type-mouseout>mouseout/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-49>Event handler content attribute/a> tr>th idix-handler-onmouseover> code>onmouseover/code> td> a href#handler-onmouseover idattributes-3:handler-onmouseover>HTML elements/a> td> code idattributes-3:event-mouseover>a data-x-internalevent-mouseover hrefhttps://w3c.github.io/uievents/#event-type-mouseover>mouseover/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-50>Event handler content attribute/a> tr>th idix-handler-onmouseup> code>onmouseup/code> td> a href#handler-onmouseup idattributes-3:handler-onmouseup>HTML elements/a> td> code idattributes-3:event-mouseup>a data-x-internalevent-mouseup hrefhttps://w3c.github.io/uievents/#event-type-mouseup>mouseup/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-51>Event handler content attribute/a> tr>th idix-handler-onwheel> code>onwheel/code> td> a href#handler-onwheel idattributes-3:handler-onwheel>HTML elements/a> td> code idattributes-3:event-wheel>a data-x-internalevent-wheel hrefhttps://w3c.github.io/uievents/#event-type-wheel>wheel/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-52>Event handler content attribute/a> tr>th idix-handler-window-onoffline> code>onoffline/code> td> code idattributes-3:handler-window-onoffline>a href#handler-window-onoffline>body/a>/code> td> code idattributes-3:event-offline>a href#event-offline>offline/a>/code> event handler for code idattributes-3:window-8>a href#window>Window/a>/code> object td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-53>Event handler content attribute/a> tr>th idix-handler-window-ononline> code>ononline/code> td> code idattributes-3:handler-window-ononline>a href#handler-window-ononline>body/a>/code> td> code idattributes-3:event-online>a href#event-online>online/a>/code> event handler for code idattributes-3:window-9>a href#window>Window/a>/code> object td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-54>Event handler content attribute/a> tr>th idix-handler-window-onpagehide> code>onpagehide/code> td> code idattributes-3:handler-window-onpagehide>a href#handler-window-onpagehide>body/a>/code> td> code idattributes-3:event-pagehide>a href#event-pagehide>pagehide/a>/code> event handler for code idattributes-3:window-10>a href#window>Window/a>/code> object td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-55>Event handler content attribute/a> tr>th idix-handler-window-onpageshow> code>onpageshow/code> td> code idattributes-3:handler-window-onpageshow>a href#handler-window-onpageshow>body/a>/code> td> code idattributes-3:event-pageshow>a href#event-pageshow>pageshow/a>/code> event handler for code idattributes-3:window-11>a href#window>Window/a>/code> object td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-56>Event handler content attribute/a> tr>th idix-handler-onpaste> code>onpaste/code> td> a href#handler-onpaste idattributes-3:handler-onpaste>HTML elements/a> td> code idattributes-3:event-paste>a href#event-paste>paste/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-57>Event handler content attribute/a> tr>th idix-handler-onpause> code>onpause/code> td> a href#handler-onpause idattributes-3:handler-onpause>HTML elements/a> td> code idattributes-3:event-media-pause>a href#event-media-pause>pause/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-58>Event handler content attribute/a> tr>th idix-handler-onplay> code>onplay/code> td> a href#handler-onplay idattributes-3:handler-onplay>HTML elements/a> td> code idattributes-3:event-media-play>a href#event-media-play>play/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-59>Event handler content attribute/a> tr>th idix-handler-onplaying> code>onplaying/code> td> a href#handler-onplaying idattributes-3:handler-onplaying>HTML elements/a> td> code idattributes-3:event-media-playing>a href#event-media-playing>playing/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-60>Event handler content attribute/a> tr>th idix-handler-window-onpopstate> code>onpopstate/code> td> code idattributes-3:handler-window-onpopstate>a href#handler-window-onpopstate>body/a>/code> td> code idattributes-3:event-popstate>a href#event-popstate>popstate/a>/code> event handler for code idattributes-3:window-12>a href#window>Window/a>/code> object td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-61>Event handler content attribute/a> tr>th idix-handler-onprogress> code>onprogress/code> td> a href#handler-onprogress idattributes-3:handler-onprogress>HTML elements/a> td> code idattributes-3:event-media-progress>a href#event-media-progress>progress/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-62>Event handler content attribute/a> tr>th idix-handler-onratechange> code>onratechange/code> td> a href#handler-onratechange idattributes-3:handler-onratechange>HTML elements/a> td> code idattributes-3:event-media-ratechange>a href#event-media-ratechange>ratechange/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-63>Event handler content attribute/a> tr>th idix-handler-onreset> code>onreset/code> td> a href#handler-onreset idattributes-3:handler-onreset>HTML elements/a> td> code idattributes-3:event-reset>a href#event-reset>reset/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-64>Event handler content attribute/a> tr>th idix-handler-onresize> code>onresize/code> td> a href#handler-onresize idattributes-3:handler-onresize>HTML elements/a> td> code idattributes-3:event-resize>a data-x-internalevent-resize hrefhttps://drafts.csswg.org/cssom-view/#eventdef-window-resize>resize/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-65>Event handler content attribute/a> tr>th idix-handler-window-onrejectionhandled> code>onrejectionhandled/code> td> code idattributes-3:handler-window-onrejectionhandled>a href#handler-window-onrejectionhandled>body/a>/code> td> code idattributes-3:event-rejectionhandled>a href#event-rejectionhandled>rejectionhandled/a>/code> event handler for code idattributes-3:window-13>a href#window>Window/a>/code> object td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-66>Event handler content attribute/a> tr>th idix-handler-onscroll> code>onscroll/code> td> a href#handler-onscroll idattributes-3:handler-onscroll>HTML elements/a> td> code idattributes-3:event-scroll>a data-x-internalevent-scroll hrefhttps://drafts.csswg.org/cssom-view/#eventdef-document-scroll>scroll/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-67>Event handler content attribute/a> tr>th idix-handler-onsecuritypolicyviolation> code>onsecuritypolicyviolation/code> td> a href#handler-onsecuritypolicyviolation idattributes-3:handler-onsecuritypolicyviolation>HTML elements/a> td> code idattributes-3:event-securitypolicyviolation>a href#event-securitypolicyviolation>securitypolicyviolation/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-68>Event handler content attribute/a> tr>th idix-handler-onseeked> code>onseeked/code> td> a href#handler-onseeked idattributes-3:handler-onseeked>HTML elements/a> td> code idattributes-3:event-media-seeked>a href#event-media-seeked>seeked/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-69>Event handler content attribute/a> tr>th idix-handler-onseeking> code>onseeking/code> td> a href#handler-onseeking idattributes-3:handler-onseeking>HTML elements/a> td> code idattributes-3:event-media-seeking>a href#event-media-seeking>seeking/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-70>Event handler content attribute/a> tr>th idix-handler-onselect> code>onselect/code> td> a href#handler-onselect idattributes-3:handler-onselect>HTML elements/a> td> code idattributes-3:event-select>a href#event-select>select/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-71>Event handler content attribute/a> tr>th idix-handler-onstalled> code>onstalled/code> td> a href#handler-onstalled idattributes-3:handler-onstalled>HTML elements/a> td> code idattributes-3:event-media-stalled>a href#event-media-stalled>stalled/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-72>Event handler content attribute/a> tr>th idix-handler-window-onstorage> code>onstorage/code> td> code idattributes-3:handler-window-onstorage>a href#handler-window-onstorage>body/a>/code> td> code idattributes-3:event-storage>a href#event-storage>storage/a>/code> event handler for code idattributes-3:window-14>a href#window>Window/a>/code> object td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-73>Event handler content attribute/a> tr>th idix-handler-onsubmit> code>onsubmit/code> td> a href#handler-onsubmit idattributes-3:handler-onsubmit>HTML elements/a> td> code idattributes-3:event-submit>a href#event-submit>submit/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-74>Event handler content attribute/a> tr>th idix-handler-onsuspend> code>onsuspend/code> td> a href#handler-onsuspend idattributes-3:handler-onsuspend>HTML elements/a> td> code idattributes-3:event-media-suspend>a href#event-media-suspend>suspend/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-75>Event handler content attribute/a> tr>th idix-handler-ontimeupdate> code>ontimeupdate/code> td> a href#handler-ontimeupdate idattributes-3:handler-ontimeupdate>HTML elements/a> td> code idattributes-3:event-media-timeupdate>a href#event-media-timeupdate>timeupdate/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-76>Event handler content attribute/a> tr>th idix-handler-ontoggle> code>ontoggle/code> td> a href#handler-ontoggle idattributes-3:handler-ontoggle>HTML elements/a> td> code idattributes-3:event-toggle>a href#event-toggle>toggle/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-77>Event handler content attribute/a> tr>th idix-handler-window-onunhandledrejection> code>onunhandledrejection/code> td> code idattributes-3:handler-window-onunhandledrejection>a href#handler-window-onunhandledrejection>body/a>/code> td> code idattributes-3:event-unhandledrejection>a href#event-unhandledrejection>unhandledrejection/a>/code> event handler for code idattributes-3:window-15>a href#window>Window/a>/code> object td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-78>Event handler content attribute/a> tr>th idix-handler-window-onunload> code>onunload/code> td> code idattributes-3:handler-window-onunload>a href#handler-window-onunload>body/a>/code> td> code idattributes-3:event-unload>a href#event-unload>unload/a>/code> event handler for code idattributes-3:window-16>a href#window>Window/a>/code> object td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-79>Event handler content attribute/a> tr>th idix-handler-onvolumechange> code>onvolumechange/code> td> a href#handler-onvolumechange idattributes-3:handler-onvolumechange>HTML elements/a> td> code idattributes-3:event-media-volumechange>a href#event-media-volumechange>volumechange/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-80>Event handler content attribute/a> tr>th idix-handler-onwaiting> code>onwaiting/code> td> a href#handler-onwaiting idattributes-3:handler-onwaiting>HTML elements/a> td> code idattributes-3:event-media-waiting>a href#event-media-waiting>waiting/a>/code> event handler td> a href#event-handler-content-attributes idattributes-3:event-handler-content-attributes-81>Event handler content attribute/a> /table> h3 idelement-interfaces classno-num>Element Interfacesa href#element-interfaces classself-link>/a>/h3> p>i>This section is non-normative./i>/p> table>caption>List of interfaces for elements/caption>thead>tr>th> Element(s) th> Interface(s) tbody>tr>td> code idelement-interfaces:the-a-element>a href#the-a-element>a/a>/code> td> code idelement-interfaces:htmlanchorelement>a href#htmlanchorelement>HTMLAnchorElement/a>/code> : code idelement-interfaces:htmlelement>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-abbr-element>a href#the-abbr-element>abbr/a>/code> td> code idelement-interfaces:htmlelement-2>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-address-element>a href#the-address-element>address/a>/code> td> code idelement-interfaces:htmlelement-3>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-area-element>a href#the-area-element>area/a>/code> td> code idelement-interfaces:htmlareaelement>a href#htmlareaelement>HTMLAreaElement/a>/code> : code idelement-interfaces:htmlelement-4>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-article-element>a href#the-article-element>article/a>/code> td> code idelement-interfaces:htmlelement-5>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-aside-element>a href#the-aside-element>aside/a>/code> td> code idelement-interfaces:htmlelement-6>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-audio-element>a href#the-audio-element>audio/a>/code> td> code idelement-interfaces:htmlaudioelement>a href#htmlaudioelement>HTMLAudioElement/a>/code> : code idelement-interfaces:htmlmediaelement>a href#htmlmediaelement>HTMLMediaElement/a>/code> : code idelement-interfaces:htmlelement-7>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-b-element>a href#the-b-element>b/a>/code> td> code idelement-interfaces:htmlelement-8>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-base-element>a href#the-base-element>base/a>/code> td> code idelement-interfaces:htmlbaseelement>a href#htmlbaseelement>HTMLBaseElement/a>/code> : code idelement-interfaces:htmlelement-9>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-bdi-element>a href#the-bdi-element>bdi/a>/code> td> code idelement-interfaces:htmlelement-10>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-bdo-element>a href#the-bdo-element>bdo/a>/code> td> code idelement-interfaces:htmlelement-11>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-blockquote-element>a href#the-blockquote-element>blockquote/a>/code> td> code idelement-interfaces:htmlquoteelement>a href#htmlquoteelement>HTMLQuoteElement/a>/code> : code idelement-interfaces:htmlelement-12>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-body-element>a href#the-body-element>body/a>/code> td> code idelement-interfaces:htmlbodyelement>a href#htmlbodyelement>HTMLBodyElement/a>/code> : code idelement-interfaces:htmlelement-13>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-br-element>a href#the-br-element>br/a>/code> td> code idelement-interfaces:htmlbrelement>a href#htmlbrelement>HTMLBRElement/a>/code> : code idelement-interfaces:htmlelement-14>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-button-element>a href#the-button-element>button/a>/code> td> code idelement-interfaces:htmlbuttonelement>a href#htmlbuttonelement>HTMLButtonElement/a>/code> : code idelement-interfaces:htmlelement-15>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-canvas-element>a href#the-canvas-element>canvas/a>/code> td> code idelement-interfaces:htmlcanvaselement>a href#htmlcanvaselement>HTMLCanvasElement/a>/code> : code idelement-interfaces:htmlelement-16>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-caption-element>a href#the-caption-element>caption/a>/code> td> code idelement-interfaces:htmltablecaptionelement>a href#htmltablecaptionelement>HTMLTableCaptionElement/a>/code> : code idelement-interfaces:htmlelement-17>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-cite-element>a href#the-cite-element>cite/a>/code> td> code idelement-interfaces:htmlelement-18>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-code-element>a href#the-code-element>code/a>/code> td> code idelement-interfaces:htmlelement-19>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-col-element>a href#the-col-element>col/a>/code> td> code idelement-interfaces:htmltablecolelement>a href#htmltablecolelement>HTMLTableColElement/a>/code> : code idelement-interfaces:htmlelement-20>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-colgroup-element>a href#the-colgroup-element>colgroup/a>/code> td> code idelement-interfaces:htmltablecolelement-2>a href#htmltablecolelement>HTMLTableColElement/a>/code> : code idelement-interfaces:htmlelement-21>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-data-element>a href#the-data-element>data/a>/code> td> code idelement-interfaces:htmldataelement>a href#htmldataelement>HTMLDataElement/a>/code> : code idelement-interfaces:htmlelement-22>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-datalist-element>a href#the-datalist-element>datalist/a>/code> td> code idelement-interfaces:htmldatalistelement>a href#htmldatalistelement>HTMLDataListElement/a>/code> : code idelement-interfaces:htmlelement-23>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-dd-element>a href#the-dd-element>dd/a>/code> td> code idelement-interfaces:htmlelement-24>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-del-element>a href#the-del-element>del/a>/code> td> code idelement-interfaces:htmlmodelement>a href#htmlmodelement>HTMLModElement/a>/code> : code idelement-interfaces:htmlelement-25>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-details-element>a href#the-details-element>details/a>/code> td> code idelement-interfaces:htmldetailselement>a href#htmldetailselement>HTMLDetailsElement/a>/code> : code idelement-interfaces:htmlelement-26>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-dfn-element>a href#the-dfn-element>dfn/a>/code> td> code idelement-interfaces:htmlelement-27>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-dialog-element>a href#the-dialog-element>dialog/a>/code> td> code idelement-interfaces:htmldialogelement>a href#htmldialogelement>HTMLDialogElement/a>/code> : code idelement-interfaces:htmlelement-28>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-div-element>a href#the-div-element>div/a>/code> td> code idelement-interfaces:htmldivelement>a href#htmldivelement>HTMLDivElement/a>/code> : code idelement-interfaces:htmlelement-29>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-dl-element>a href#the-dl-element>dl/a>/code> td> code idelement-interfaces:htmldlistelement>a href#htmldlistelement>HTMLDListElement/a>/code> : code idelement-interfaces:htmlelement-30>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-dt-element>a href#the-dt-element>dt/a>/code> td> code idelement-interfaces:htmlelement-31>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-em-element>a href#the-em-element>em/a>/code> td> code idelement-interfaces:htmlelement-32>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-embed-element>a href#the-embed-element>embed/a>/code> td> code idelement-interfaces:htmlembedelement>a href#htmlembedelement>HTMLEmbedElement/a>/code> : code idelement-interfaces:htmlelement-33>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-fieldset-element>a href#the-fieldset-element>fieldset/a>/code> td> code idelement-interfaces:htmlfieldsetelement>a href#htmlfieldsetelement>HTMLFieldSetElement/a>/code> : code idelement-interfaces:htmlelement-34>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-figcaption-element>a href#the-figcaption-element>figcaption/a>/code> td> code idelement-interfaces:htmlelement-35>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-figure-element>a href#the-figure-element>figure/a>/code> td> code idelement-interfaces:htmlelement-36>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-footer-element>a href#the-footer-element>footer/a>/code> td> code idelement-interfaces:htmlelement-37>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-form-element>a href#the-form-element>form/a>/code> td> code idelement-interfaces:htmlformelement>a href#htmlformelement>HTMLFormElement/a>/code> : code idelement-interfaces:htmlelement-38>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1/a>/code> td> code idelement-interfaces:htmlheadingelement>a href#htmlheadingelement>HTMLHeadingElement/a>/code> : code idelement-interfaces:htmlelement-39>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2/a>/code> td> code idelement-interfaces:htmlheadingelement-2>a href#htmlheadingelement>HTMLHeadingElement/a>/code> : code idelement-interfaces:htmlelement-40>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3/a>/code> td> code idelement-interfaces:htmlheadingelement-3>a href#htmlheadingelement>HTMLHeadingElement/a>/code> : code idelement-interfaces:htmlelement-41>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4/a>/code> td> code idelement-interfaces:htmlheadingelement-4>a href#htmlheadingelement>HTMLHeadingElement/a>/code> : code idelement-interfaces:htmlelement-42>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-5>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5/a>/code> td> code idelement-interfaces:htmlheadingelement-5>a href#htmlheadingelement>HTMLHeadingElement/a>/code> : code idelement-interfaces:htmlelement-43>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-6>a href#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6/a>/code> td> code idelement-interfaces:htmlheadingelement-6>a href#htmlheadingelement>HTMLHeadingElement/a>/code> : code idelement-interfaces:htmlelement-44>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-head-element>a href#the-head-element>head/a>/code> td> code idelement-interfaces:htmlheadelement>a href#htmlheadelement>HTMLHeadElement/a>/code> : code idelement-interfaces:htmlelement-45>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-header-element>a href#the-header-element>header/a>/code> td> code idelement-interfaces:htmlelement-46>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-hgroup-element>a href#the-hgroup-element>hgroup/a>/code> td> code idelement-interfaces:htmlelement-47>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-hr-element>a href#the-hr-element>hr/a>/code> td> code idelement-interfaces:htmlhrelement>a href#htmlhrelement>HTMLHRElement/a>/code> : code idelement-interfaces:htmlelement-48>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-html-element>a href#the-html-element>html/a>/code> td> code idelement-interfaces:htmlhtmlelement>a href#htmlhtmlelement>HTMLHtmlElement/a>/code> : code idelement-interfaces:htmlelement-49>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-i-element>a href#the-i-element>i/a>/code> td> code idelement-interfaces:htmlelement-50>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-iframe-element>a href#the-iframe-element>iframe/a>/code> td> code idelement-interfaces:htmliframeelement>a href#htmliframeelement>HTMLIFrameElement/a>/code> : code idelement-interfaces:htmlelement-51>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-img-element>a href#the-img-element>img/a>/code> td> code idelement-interfaces:htmlimageelement>a href#htmlimageelement>HTMLImageElement/a>/code> : code idelement-interfaces:htmlelement-52>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-input-element>a href#the-input-element>input/a>/code> td> code idelement-interfaces:htmlinputelement>a href#htmlinputelement>HTMLInputElement/a>/code> : code idelement-interfaces:htmlelement-53>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-ins-element>a href#the-ins-element>ins/a>/code> td> code idelement-interfaces:htmlmodelement-2>a href#htmlmodelement>HTMLModElement/a>/code> : code idelement-interfaces:htmlelement-54>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-kbd-element>a href#the-kbd-element>kbd/a>/code> td> code idelement-interfaces:htmlelement-55>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-label-element>a href#the-label-element>label/a>/code> td> code idelement-interfaces:htmllabelelement>a href#htmllabelelement>HTMLLabelElement/a>/code> : code idelement-interfaces:htmlelement-56>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-legend-element>a href#the-legend-element>legend/a>/code> td> code idelement-interfaces:htmllegendelement>a href#htmllegendelement>HTMLLegendElement/a>/code> : code idelement-interfaces:htmlelement-57>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-li-element>a href#the-li-element>li/a>/code> td> code idelement-interfaces:htmllielement>a href#htmllielement>HTMLLIElement/a>/code> : code idelement-interfaces:htmlelement-58>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-link-element>a href#the-link-element>link/a>/code> td> code idelement-interfaces:htmllinkelement>a href#htmllinkelement>HTMLLinkElement/a>/code> : code idelement-interfaces:htmlelement-59>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-main-element>a href#the-main-element>main/a>/code> td> code idelement-interfaces:htmlelement-60>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-map-element>a href#the-map-element>map/a>/code> td> code idelement-interfaces:htmlmapelement>a href#htmlmapelement>HTMLMapElement/a>/code> : code idelement-interfaces:htmlelement-61>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-mark-element>a href#the-mark-element>mark/a>/code> td> code idelement-interfaces:htmlelement-62>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-menu-element>a href#the-menu-element>menu/a>/code> td> code idelement-interfaces:htmlmenuelement>a href#htmlmenuelement>HTMLMenuElement/a>/code> : code idelement-interfaces:htmlelement-63>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-meta-element>a href#the-meta-element>meta/a>/code> td> code idelement-interfaces:htmlmetaelement>a href#htmlmetaelement>HTMLMetaElement/a>/code> : code idelement-interfaces:htmlelement-64>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-meter-element>a href#the-meter-element>meter/a>/code> td> code idelement-interfaces:htmlmeterelement>a href#htmlmeterelement>HTMLMeterElement/a>/code> : code idelement-interfaces:htmlelement-65>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-nav-element>a href#the-nav-element>nav/a>/code> td> code idelement-interfaces:htmlelement-66>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-noscript-element>a href#the-noscript-element>noscript/a>/code> td> code idelement-interfaces:htmlelement-67>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-object-element>a href#the-object-element>object/a>/code> td> code idelement-interfaces:htmlobjectelement>a href#htmlobjectelement>HTMLObjectElement/a>/code> : code idelement-interfaces:htmlelement-68>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-ol-element>a href#the-ol-element>ol/a>/code> td> code idelement-interfaces:htmlolistelement>a href#htmlolistelement>HTMLOListElement/a>/code> : code idelement-interfaces:htmlelement-69>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-optgroup-element>a href#the-optgroup-element>optgroup/a>/code> td> code idelement-interfaces:htmloptgroupelement>a href#htmloptgroupelement>HTMLOptGroupElement/a>/code> : code idelement-interfaces:htmlelement-70>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-option-element>a href#the-option-element>option/a>/code> td> code idelement-interfaces:htmloptionelement>a href#htmloptionelement>HTMLOptionElement/a>/code> : code idelement-interfaces:htmlelement-71>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-output-element>a href#the-output-element>output/a>/code> td> code idelement-interfaces:htmloutputelement>a href#htmloutputelement>HTMLOutputElement/a>/code> : code idelement-interfaces:htmlelement-72>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-p-element>a href#the-p-element>p/a>/code> td> code idelement-interfaces:htmlparagraphelement>a href#htmlparagraphelement>HTMLParagraphElement/a>/code> : code idelement-interfaces:htmlelement-73>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-param-element>a href#the-param-element>param/a>/code> td> code idelement-interfaces:htmlparamelement>a href#htmlparamelement>HTMLParamElement/a>/code> : code idelement-interfaces:htmlelement-74>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-picture-element>a href#the-picture-element>picture/a>/code> td> code idelement-interfaces:htmlpictureelement>a href#htmlpictureelement>HTMLPictureElement/a>/code> : code idelement-interfaces:htmlelement-75>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-pre-element>a href#the-pre-element>pre/a>/code> td> code idelement-interfaces:htmlpreelement>a href#htmlpreelement>HTMLPreElement/a>/code> : code idelement-interfaces:htmlelement-76>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-progress-element>a href#the-progress-element>progress/a>/code> td> code idelement-interfaces:htmlprogresselement>a href#htmlprogresselement>HTMLProgressElement/a>/code> : code idelement-interfaces:htmlelement-77>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-q-element>a href#the-q-element>q/a>/code> td> code idelement-interfaces:htmlquoteelement-2>a href#htmlquoteelement>HTMLQuoteElement/a>/code> : code idelement-interfaces:htmlelement-78>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-rp-element>a href#the-rp-element>rp/a>/code> td> code idelement-interfaces:htmlelement-79>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-rt-element>a href#the-rt-element>rt/a>/code> td> code idelement-interfaces:htmlelement-80>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-ruby-element>a href#the-ruby-element>ruby/a>/code> td> code idelement-interfaces:htmlelement-81>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-s-element>a href#the-s-element>s/a>/code> td> code idelement-interfaces:htmlelement-82>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-samp-element>a href#the-samp-element>samp/a>/code> td> code idelement-interfaces:htmlelement-83>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-script-element>a href#the-script-element>script/a>/code> td> code idelement-interfaces:htmlscriptelement>a href#htmlscriptelement>HTMLScriptElement/a>/code> : code idelement-interfaces:htmlelement-84>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-section-element>a href#the-section-element>section/a>/code> td> code idelement-interfaces:htmlelement-85>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-select-element>a href#the-select-element>select/a>/code> td> code idelement-interfaces:htmlselectelement>a href#htmlselectelement>HTMLSelectElement/a>/code> : code idelement-interfaces:htmlelement-86>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-slot-element>a href#the-slot-element>slot/a>/code> td> code idelement-interfaces:htmlslotelement>a href#htmlslotelement>HTMLSlotElement/a>/code> : code idelement-interfaces:htmlelement-87>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-small-element>a href#the-small-element>small/a>/code> td> code idelement-interfaces:htmlelement-88>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-source-element>a href#the-source-element>source/a>/code> td> code idelement-interfaces:htmlsourceelement>a href#htmlsourceelement>HTMLSourceElement/a>/code> : code idelement-interfaces:htmlelement-89>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-span-element>a href#the-span-element>span/a>/code> td> code idelement-interfaces:htmlspanelement>a href#htmlspanelement>HTMLSpanElement/a>/code> : code idelement-interfaces:htmlelement-90>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-strong-element>a href#the-strong-element>strong/a>/code> td> code idelement-interfaces:htmlelement-91>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-style-element>a href#the-style-element>style/a>/code> td> code idelement-interfaces:htmlstyleelement>a href#htmlstyleelement>HTMLStyleElement/a>/code> : code idelement-interfaces:htmlelement-92>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-sub-and-sup-elements>a href#the-sub-and-sup-elements>sub/a>/code> td> code idelement-interfaces:htmlelement-93>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-summary-element>a href#the-summary-element>summary/a>/code> td> code idelement-interfaces:htmlelement-94>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-sub-and-sup-elements-2>a href#the-sub-and-sup-elements>sup/a>/code> td> code idelement-interfaces:htmlelement-95>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-table-element>a href#the-table-element>table/a>/code> td> code idelement-interfaces:htmltableelement>a href#htmltableelement>HTMLTableElement/a>/code> : code idelement-interfaces:htmlelement-96>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-tbody-element>a href#the-tbody-element>tbody/a>/code> td> code idelement-interfaces:htmltablesectionelement>a href#htmltablesectionelement>HTMLTableSectionElement/a>/code> : code idelement-interfaces:htmlelement-97>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-td-element>a href#the-td-element>td/a>/code> td> code idelement-interfaces:htmltablecellelement>a href#htmltablecellelement>HTMLTableCellElement/a>/code> : code idelement-interfaces:htmlelement-98>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-template-element>a href#the-template-element>template/a>/code> td> code idelement-interfaces:htmltemplateelement>a href#htmltemplateelement>HTMLTemplateElement/a>/code> : code idelement-interfaces:htmlelement-99>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-textarea-element>a href#the-textarea-element>textarea/a>/code> td> code idelement-interfaces:htmltextareaelement>a href#htmltextareaelement>HTMLTextAreaElement/a>/code> : code idelement-interfaces:htmlelement-100>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-tfoot-element>a href#the-tfoot-element>tfoot/a>/code> td> code idelement-interfaces:htmltablesectionelement-2>a href#htmltablesectionelement>HTMLTableSectionElement/a>/code> : code idelement-interfaces:htmlelement-101>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-th-element>a href#the-th-element>th/a>/code> td> code idelement-interfaces:htmltablecellelement-2>a href#htmltablecellelement>HTMLTableCellElement/a>/code> : code idelement-interfaces:htmlelement-102>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-thead-element>a href#the-thead-element>thead/a>/code> td> code idelement-interfaces:htmltablesectionelement-3>a href#htmltablesectionelement>HTMLTableSectionElement/a>/code> : code idelement-interfaces:htmlelement-103>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-time-element>a href#the-time-element>time/a>/code> td> code idelement-interfaces:htmltimeelement>a href#htmltimeelement>HTMLTimeElement/a>/code> : code idelement-interfaces:htmlelement-104>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-title-element>a href#the-title-element>title/a>/code> td> code idelement-interfaces:htmltitleelement>a href#htmltitleelement>HTMLTitleElement/a>/code> : code idelement-interfaces:htmlelement-105>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-tr-element>a href#the-tr-element>tr/a>/code> td> code idelement-interfaces:htmltablerowelement>a href#htmltablerowelement>HTMLTableRowElement/a>/code> : code idelement-interfaces:htmlelement-106>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-track-element>a href#the-track-element>track/a>/code> td> code idelement-interfaces:htmltrackelement>a href#htmltrackelement>HTMLTrackElement/a>/code> : code idelement-interfaces:htmlelement-107>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-u-element>a href#the-u-element>u/a>/code> td> code idelement-interfaces:htmlelement-108>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-ul-element>a href#the-ul-element>ul/a>/code> td> code idelement-interfaces:htmlulistelement>a href#htmlulistelement>HTMLUListElement/a>/code> : code idelement-interfaces:htmlelement-109>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-var-element>a href#the-var-element>var/a>/code> td> code idelement-interfaces:htmlelement-110>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-video-element>a href#the-video-element>video/a>/code> td> code idelement-interfaces:htmlvideoelement>a href#htmlvideoelement>HTMLVideoElement/a>/code> : code idelement-interfaces:htmlmediaelement-2>a href#htmlmediaelement>HTMLMediaElement/a>/code> : code idelement-interfaces:htmlelement-111>a href#htmlelement>HTMLElement/a>/code> tr>td> code idelement-interfaces:the-wbr-element>a href#the-wbr-element>wbr/a>/code> td> code idelement-interfaces:htmlelement-112>a href#htmlelement>HTMLElement/a>/code> tr>td> a href#custom-element idelement-interfaces:custom-element>custom elements/a> td> supplied by the elements author (inherits from code idelement-interfaces:htmlelement-113>a href#htmlelement>HTMLElement/a>/code>) /table> h3 idall-interfaces classno-num>All Interfacesa href#all-interfaces classself-link>/a>/h3> p>i>This section is non-normative./i>/p> ul classbrief>li>code idall-interfaces:abstractworker>a href#abstractworker>AbstractWorker/a>/code> li>code idall-interfaces:applicationcache>a href#applicationcache>ApplicationCache/a>/code> li>code idall-interfaces:audiotrack>a href#audiotrack>AudioTrack/a>/code> li>code idall-interfaces:audiotracklist>a href#audiotracklist>AudioTrackList/a>/code> li>code idall-interfaces:barprop>a href#barprop>BarProp/a>/code> li>code idall-interfaces:beforeunloadevent>a href#beforeunloadevent>BeforeUnloadEvent/a>/code> li>code idall-interfaces:broadcastchannel>a href#broadcastchannel>BroadcastChannel/a>/code> li>code idall-interfaces:canvascompositing>a href#canvascompositing>CanvasCompositing/a>/code> li>code idall-interfaces:canvasdrawimage>a href#canvasdrawimage>CanvasDrawImage/a>/code> li>code idall-interfaces:canvasdrawpath>a href#canvasdrawpath>CanvasDrawPath/a>/code> li>code idall-interfaces:canvasfillstrokestyles>a href#canvasfillstrokestyles>CanvasFillStrokeStyles/a>/code> li>code idall-interfaces:canvasfilters>a href#canvasfilters>CanvasFilters/a>/code> li>code idall-interfaces:canvasgradient>a href#canvasgradient>CanvasGradient/a>/code> li>code idall-interfaces:canvasimagedata>a href#canvasimagedata>CanvasImageData/a>/code> li>code idall-interfaces:canvasimagesmoothing>a href#canvasimagesmoothing>CanvasImageSmoothing/a>/code> li>code idall-interfaces:canvaspath>a href#canvaspath>CanvasPath/a>/code> li>code idall-interfaces:canvaspathdrawingstyles>a href#canvaspathdrawingstyles>CanvasPathDrawingStyles/a>/code> li>code idall-interfaces:canvaspattern>a href#canvaspattern>CanvasPattern/a>/code> li>code idall-interfaces:canvasrect>a href#canvasrect>CanvasRect/a>/code> li>code idall-interfaces:canvasrenderingcontext2d>a href#canvasrenderingcontext2d>CanvasRenderingContext2D/a>/code> li>code idall-interfaces:canvasshadowstyles>a href#canvasshadowstyles>CanvasShadowStyles/a>/code> li>code idall-interfaces:canvasstate>a href#canvasstate>CanvasState/a>/code> li>code idall-interfaces:canvastext>a href#canvastext>CanvasText/a>/code> li>code idall-interfaces:canvastextdrawingstyles>a href#canvastextdrawingstyles>CanvasTextDrawingStyles/a>/code> li>code idall-interfaces:canvastransform>a href#canvastransform>CanvasTransform/a>/code> li>code idall-interfaces:canvasuserinterface>a href#canvasuserinterface>CanvasUserInterface/a>/code> li>code idall-interfaces:closeevent>a href#closeevent>CloseEvent/a>/code> li>code idall-interfaces:customelementregistry>a href#customelementregistry>CustomElementRegistry/a>/code> li>code idall-interfaces:domstringlist>a href#domstringlist>DOMStringList/a>/code> li>code idall-interfaces:domstringmap>a href#domstringmap>DOMStringMap/a>/code> li>code idall-interfaces:datatransfer>a href#datatransfer>DataTransfer/a>/code> li>code idall-interfaces:datatransferitem>a href#datatransferitem>DataTransferItem/a>/code> li>code idall-interfaces:datatransferitemlist>a href#datatransferitemlist>DataTransferItemList/a>/code> li>code idall-interfaces:dedicatedworkerglobalscope>a href#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope/a>/code> li>code idall-interfaces:document>a href#document>Document/a>/code>, a href#document>partial 1/a> a href#Document-partial>1/a> li>code idall-interfaces:documentandelementeventhandlers>a href#documentandelementeventhandlers>DocumentAndElementEventHandlers/a>/code> li>code idall-interfaces:dragevent>a href#dragevent>DragEvent/a>/code> li>code idall-interfaces:elementcontenteditable>a href#elementcontenteditable>ElementContentEditable/a>/code> li>code idall-interfaces:errorevent>a href#errorevent>ErrorEvent/a>/code> li>code idall-interfaces:eventsource>a href#eventsource>EventSource/a>/code> li>code idall-interfaces:external>a href#external>External/a>/code> li>code idall-interfaces:globaleventhandlers>a href#globaleventhandlers>GlobalEventHandlers/a>/code> li>code idall-interfaces:htmlallcollection>a href#htmlallcollection>HTMLAllCollection/a>/code> li>code idall-interfaces:htmlanchorelement>a href#htmlanchorelement>HTMLAnchorElement/a>/code>, a href#HTMLAnchorElement-partial>partial/a> li>code idall-interfaces:htmlareaelement>a href#htmlareaelement>HTMLAreaElement/a>/code>, a href#HTMLAreaElement-partial>partial/a> li>code idall-interfaces:htmlaudioelement>a href#htmlaudioelement>HTMLAudioElement/a>/code> li>code idall-interfaces:htmlbrelement>a href#htmlbrelement>HTMLBRElement/a>/code>, a href#HTMLBRElement-partial>partial/a> li>code idall-interfaces:htmlbaseelement>a href#htmlbaseelement>HTMLBaseElement/a>/code> li>code idall-interfaces:htmlbodyelement>a href#htmlbodyelement>HTMLBodyElement/a>/code>, a href#HTMLBodyElement-partial>partial/a> li>code idall-interfaces:htmlbuttonelement>a href#htmlbuttonelement>HTMLButtonElement/a>/code> li>code idall-interfaces:htmlcanvaselement>a href#htmlcanvaselement>HTMLCanvasElement/a>/code> li>code idall-interfaces:htmldlistelement>a href#htmldlistelement>HTMLDListElement/a>/code>, a href#HTMLDListElement-partial>partial/a> li>code idall-interfaces:htmldataelement>a href#htmldataelement>HTMLDataElement/a>/code> li>code idall-interfaces:htmldatalistelement>a href#htmldatalistelement>HTMLDataListElement/a>/code> li>code idall-interfaces:htmldetailselement>a href#htmldetailselement>HTMLDetailsElement/a>/code> li>code idall-interfaces:htmldialogelement>a href#htmldialogelement>HTMLDialogElement/a>/code> li>code idall-interfaces:htmldirectoryelement>a href#htmldirectoryelement>HTMLDirectoryElement/a>/code> li>code idall-interfaces:htmldivelement>a href#htmldivelement>HTMLDivElement/a>/code>, a href#HTMLDivElement-partial>partial/a> li>code idall-interfaces:htmlelement>a href#htmlelement>HTMLElement/a>/code> li>code idall-interfaces:htmlembedelement>a href#htmlembedelement>HTMLEmbedElement/a>/code>, a href#HTMLEmbedElement-partial>partial/a> li>code idall-interfaces:htmlfieldsetelement>a href#htmlfieldsetelement>HTMLFieldSetElement/a>/code> li>code idall-interfaces:htmlfontelement>a href#htmlfontelement>HTMLFontElement/a>/code> li>code idall-interfaces:htmlformcontrolscollection>a href#htmlformcontrolscollection>HTMLFormControlsCollection/a>/code> li>code idall-interfaces:htmlformelement>a href#htmlformelement>HTMLFormElement/a>/code> li>code idall-interfaces:htmlframeelement>a href#htmlframeelement>HTMLFrameElement/a>/code> li>code idall-interfaces:htmlframesetelement>a href#htmlframesetelement>HTMLFrameSetElement/a>/code> li>code idall-interfaces:htmlhrelement>a href#htmlhrelement>HTMLHRElement/a>/code>, a href#HTMLHRElement-partial>partial/a> li>code idall-interfaces:htmlheadelement>a href#htmlheadelement>HTMLHeadElement/a>/code> li>code idall-interfaces:htmlheadingelement>a href#htmlheadingelement>HTMLHeadingElement/a>/code>, a href#HTMLHeadingElement-partial>partial/a> li>code idall-interfaces:htmlhtmlelement>a href#htmlhtmlelement>HTMLHtmlElement/a>/code>, a href#HTMLHtmlElement-partial>partial/a> li>code idall-interfaces:htmlhyperlinkelementutils>a href#htmlhyperlinkelementutils>HTMLHyperlinkElementUtils/a>/code> li>code idall-interfaces:htmliframeelement>a href#htmliframeelement>HTMLIFrameElement/a>/code>, a href#HTMLIFrameElement-partial>partial/a> li>code idall-interfaces:htmlimageelement>a href#htmlimageelement>HTMLImageElement/a>/code>, a href#HTMLImageElement-partial>partial/a> li>code idall-interfaces:htmlinputelement>a href#htmlinputelement>HTMLInputElement/a>/code>, a href#HTMLInputElement-partial>partial/a> li>code idall-interfaces:htmllielement>a href#htmllielement>HTMLLIElement/a>/code>, a href#HTMLLIElement-partial>partial/a> li>code idall-interfaces:htmllabelelement>a href#htmllabelelement>HTMLLabelElement/a>/code> li>code idall-interfaces:htmllegendelement>a href#htmllegendelement>HTMLLegendElement/a>/code>, a href#HTMLLegendElement-partial>partial/a> li>code idall-interfaces:htmllinkelement>a href#htmllinkelement>HTMLLinkElement/a>/code>, a href#HTMLLinkElement-partial>partial/a> li>code idall-interfaces:htmlmapelement>a href#htmlmapelement>HTMLMapElement/a>/code> li>code idall-interfaces:htmlmarqueeelement>a href#htmlmarqueeelement>HTMLMarqueeElement/a>/code> li>code idall-interfaces:htmlmediaelement>a href#htmlmediaelement>HTMLMediaElement/a>/code> li>code idall-interfaces:htmlmenuelement>a href#htmlmenuelement>HTMLMenuElement/a>/code>, a href#HTMLMenuElement-partial>partial/a> li>code idall-interfaces:htmlmetaelement>a href#htmlmetaelement>HTMLMetaElement/a>/code>, a href#HTMLMetaElement-partial>partial/a> li>code idall-interfaces:htmlmeterelement>a href#htmlmeterelement>HTMLMeterElement/a>/code> li>code idall-interfaces:htmlmodelement>a href#htmlmodelement>HTMLModElement/a>/code> li>code idall-interfaces:htmlolistelement>a href#htmlolistelement>HTMLOListElement/a>/code>, a href#HTMLOListElement-partial>partial/a> li>code idall-interfaces:htmlobjectelement>a href#htmlobjectelement>HTMLObjectElement/a>/code>, a href#HTMLObjectElement-partial>partial/a> li>code idall-interfaces:htmloptgroupelement>a href#htmloptgroupelement>HTMLOptGroupElement/a>/code> li>code idall-interfaces:htmloptionelement>a href#htmloptionelement>HTMLOptionElement/a>/code> li>code idall-interfaces:htmloptionscollection>a href#htmloptionscollection>HTMLOptionsCollection/a>/code> li>code idall-interfaces:htmloutputelement>a href#htmloutputelement>HTMLOutputElement/a>/code> li>code idall-interfaces:htmlparagraphelement>a href#htmlparagraphelement>HTMLParagraphElement/a>/code>, a href#HTMLParagraphElement-partial>partial/a> li>code idall-interfaces:htmlparamelement>a href#htmlparamelement>HTMLParamElement/a>/code>, a href#HTMLParamElement-partial>partial/a> li>code idall-interfaces:htmlpictureelement>a href#htmlpictureelement>HTMLPictureElement/a>/code> li>code idall-interfaces:htmlpreelement>a href#htmlpreelement>HTMLPreElement/a>/code>, a href#HTMLPreElement-partial>partial/a> li>code idall-interfaces:htmlprogresselement>a href#htmlprogresselement>HTMLProgressElement/a>/code> li>code idall-interfaces:htmlquoteelement>a href#htmlquoteelement>HTMLQuoteElement/a>/code> li>code idall-interfaces:htmlscriptelement>a href#htmlscriptelement>HTMLScriptElement/a>/code>, a href#HTMLScriptElement-partial>partial/a> li>code idall-interfaces:htmlselectelement>a href#htmlselectelement>HTMLSelectElement/a>/code> li>code idall-interfaces:htmlslotelement>a href#htmlslotelement>HTMLSlotElement/a>/code> li>code idall-interfaces:htmlsourceelement>a href#htmlsourceelement>HTMLSourceElement/a>/code> li>code idall-interfaces:htmlspanelement>a href#htmlspanelement>HTMLSpanElement/a>/code> li>code idall-interfaces:htmlstyleelement>a href#htmlstyleelement>HTMLStyleElement/a>/code>, a href#HTMLStyleElement-partial>partial/a> li>code idall-interfaces:htmltablecaptionelement>a href#htmltablecaptionelement>HTMLTableCaptionElement/a>/code>, a href#HTMLTableCaptionElement-partial>partial/a> li>code idall-interfaces:htmltablecellelement>a href#htmltablecellelement>HTMLTableCellElement/a>/code>, a href#HTMLTableCellElement-partial>partial/a> li>code idall-interfaces:htmltablecolelement>a href#htmltablecolelement>HTMLTableColElement/a>/code>, a href#HTMLTableColElement-partial>partial/a> li>code idall-interfaces:htmltableelement>a href#htmltableelement>HTMLTableElement/a>/code>, a href#HTMLTableElement-partial>partial/a> li>code idall-interfaces:htmltablerowelement>a href#htmltablerowelement>HTMLTableRowElement/a>/code>, a href#HTMLTableRowElement-partial>partial/a> li>code idall-interfaces:htmltablesectionelement>a href#htmltablesectionelement>HTMLTableSectionElement/a>/code>, a href#HTMLTableSectionElement-partial>partial/a> li>code idall-interfaces:htmltemplateelement>a href#htmltemplateelement>HTMLTemplateElement/a>/code> li>code idall-interfaces:htmltextareaelement>a href#htmltextareaelement>HTMLTextAreaElement/a>/code> li>code idall-interfaces:htmltimeelement>a href#htmltimeelement>HTMLTimeElement/a>/code> li>code idall-interfaces:htmltitleelement>a href#htmltitleelement>HTMLTitleElement/a>/code> li>code idall-interfaces:htmltrackelement>a href#htmltrackelement>HTMLTrackElement/a>/code> li>code idall-interfaces:htmlulistelement>a href#htmlulistelement>HTMLUListElement/a>/code>, a href#HTMLUListElement-partial>partial/a> li>code idall-interfaces:htmlunknownelement>a href#htmlunknownelement>HTMLUnknownElement/a>/code> li>code idall-interfaces:htmlvideoelement>a href#htmlvideoelement>HTMLVideoElement/a>/code> li>code idall-interfaces:hashchangeevent>a href#hashchangeevent>HashChangeEvent/a>/code> li>code idall-interfaces:history-3>a href#history-3>History/a>/code> li>code idall-interfaces:imagebitmap>a href#imagebitmap>ImageBitmap/a>/code> li>code idall-interfaces:imagebitmaprenderingcontext>a href#imagebitmaprenderingcontext>ImageBitmapRenderingContext/a>/code> li>code idall-interfaces:imagedata>a href#imagedata>ImageData/a>/code> li>code idall-interfaces:location>a href#location>Location/a>/code> li>code idall-interfaces:mediaerror>a href#mediaerror>MediaError/a>/code> li>code idall-interfaces:messagechannel>a href#messagechannel>MessageChannel/a>/code> li>code idall-interfaces:messageevent>a href#messageevent>MessageEvent/a>/code> li>code idall-interfaces:messageport>a href#messageport>MessagePort/a>/code> li>code idall-interfaces:mimetype>a href#mimetype>MimeType/a>/code> li>code idall-interfaces:mimetypearray>a href#mimetypearray>MimeTypeArray/a>/code> li>code idall-interfaces:navigator>a href#navigator>Navigator/a>/code> li>code idall-interfaces:navigatorconcurrenthardware>a href#navigatorconcurrenthardware>NavigatorConcurrentHardware/a>/code> li>code idall-interfaces:navigatorcontentutils>a href#navigatorcontentutils>NavigatorContentUtils/a>/code> li>code idall-interfaces:navigatorcookies>a href#navigatorcookies>NavigatorCookies/a>/code> li>code idall-interfaces:navigatorid>a href#navigatorid>NavigatorID/a>/code>, a href#NavigatorID-partial>partial/a> li>code idall-interfaces:navigatorlanguage>a href#navigatorlanguage>NavigatorLanguage/a>/code> li>code idall-interfaces:navigatoronline>a href#navigatoronline>NavigatorOnLine/a>/code> li>code idall-interfaces:navigatorplugins>a href#navigatorplugins>NavigatorPlugins/a>/code> li>code idall-interfaces:offscreencanvas>a href#offscreencanvas>OffscreenCanvas/a>/code> li>code idall-interfaces:offscreencanvasrenderingcontext2d>a href#offscreencanvasrenderingcontext2d>OffscreenCanvasRenderingContext2D/a>/code> li>code idall-interfaces:pagetransitionevent>a href#pagetransitionevent>PageTransitionEvent/a>/code> li>code idall-interfaces:path2d>a href#path2d>Path2D/a>/code> li>code idall-interfaces:plugin>a href#plugin>Plugin/a>/code> li>code idall-interfaces:pluginarray>a href#pluginarray>PluginArray/a>/code> li>code idall-interfaces:popstateevent>a href#popstateevent>PopStateEvent/a>/code> li>code idall-interfaces:promiserejectionevent>a href#promiserejectionevent>PromiseRejectionEvent/a>/code> li>code idall-interfaces:radionodelist>a href#radionodelist>RadioNodeList/a>/code> li>code idall-interfaces:sharedworker>a href#sharedworker>SharedWorker/a>/code> li>code idall-interfaces:sharedworkerglobalscope>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> li>code idall-interfaces:storage-2>a href#storage-2>Storage/a>/code> li>code idall-interfaces:storageevent>a href#storageevent>StorageEvent/a>/code> li>code idall-interfaces:textmetrics>a href#textmetrics>TextMetrics/a>/code> li>code idall-interfaces:texttrack>a href#texttrack>TextTrack/a>/code> li>code idall-interfaces:texttrackcue>a href#texttrackcue>TextTrackCue/a>/code> li>code idall-interfaces:texttrackcuelist>a href#texttrackcuelist>TextTrackCueList/a>/code> li>code idall-interfaces:texttracklist>a href#texttracklist>TextTrackList/a>/code> li>code idall-interfaces:timeranges>a href#timeranges>TimeRanges/a>/code> li>code idall-interfaces:trackevent>a href#trackevent>TrackEvent/a>/code> li>code idall-interfaces:validitystate>a href#validitystate>ValidityState/a>/code> li>code idall-interfaces:videotrack>a href#videotrack>VideoTrack/a>/code> li>code idall-interfaces:videotracklist>a href#videotracklist>VideoTrackList/a>/code> li>code idall-interfaces:websocket>a href#websocket>WebSocket/a>/code> li>code idall-interfaces:window>a href#window>Window/a>/code>, a href#Window-partial>partial/a> li>code idall-interfaces:windoweventhandlers>a href#windoweventhandlers>WindowEventHandlers/a>/code> li>code idall-interfaces:windowlocalstorage>a href#windowlocalstorage>WindowLocalStorage/a>/code> li>code idall-interfaces:windoworworkerglobalscope>a href#windoworworkerglobalscope>WindowOrWorkerGlobalScope/a>/code> li>code idall-interfaces:windowsessionstorage>a href#windowsessionstorage>WindowSessionStorage/a>/code> li>code idall-interfaces:worker>a href#worker>Worker/a>/code> li>code idall-interfaces:workerglobalscope>a href#workerglobalscope>WorkerGlobalScope/a>/code> li>code idall-interfaces:workerlocation>a href#workerlocation>WorkerLocation/a>/code> li>code idall-interfaces:workernavigator>a href#workernavigator>WorkerNavigator/a>/code> /ul> h3 idevents-2 classno-num>Eventsa href#events-2 classself-link>/a>/h3> p>i>This section is non-normative./i>/p> table>caption>List of events/caption>thead>tr>th> Event th> Interface th> Interesting targets th> Description tbody>tr>td> dfn data-dfn-forWindow idevent-abort data-dfn-typeevent data-export>code>abort/code>/dfn> td> code idevents-2:event>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> code idevents-2:window>a href#window>Window/a>/code> td> Fired at the code idevents-2:window-2>a href#window>Window/a>/code> when the download was aborted by the user tr>td> dfn data-dfn-forDocument idevent-domcontentloaded data-dfn-typeevent data-export>code>DOMContentLoaded/code>/dfn> td> code idevents-2:event-2>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> code idevents-2:document>a href#document>Document/a>/code> td> Fired at the code idevents-2:document-2>a href#document>Document/a>/code> once the parser has finished tr>td> dfn data-dfn-forWindow idevent-afterprint data-dfn-typeevent data-export>code>afterprint/code>/dfn> td> code idevents-2:event-3>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> code idevents-2:window-3>a href#window>Window/a>/code> td> Fired at the code idevents-2:window-4>a href#window>Window/a>/code> after printing tr>td> dfn data-dfn-forWindow idevent-beforeprint data-dfn-typeevent data-export>code>beforeprint/code>/dfn> td> code idevents-2:event-4>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> code idevents-2:window-5>a href#window>Window/a>/code> td> Fired at the code idevents-2:window-6>a href#window>Window/a>/code> before printing tr>td> dfn data-dfn-forWindow idevent-beforeunload data-dfn-typeevent data-export>code>beforeunload/code>/dfn> td> code idevents-2:beforeunloadevent>a href#beforeunloadevent>BeforeUnloadEvent/a>/code> td> code idevents-2:window-7>a href#window>Window/a>/code> td> Fired at the code idevents-2:window-8>a href#window>Window/a>/code> when the page is about to be unloaded, in case the page would like to show a warning prompt tr>td> dfn data-dfn-forWindow,HTMLElement idevent-blur data-dfn-typeevent data-export>code>blur/code>/dfn> td> code idevents-2:event-5>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> code idevents-2:window-9>a href#window>Window/a>/code>, elements td> Fired at nodes when they stop being a href#focused idevents-2:focused>focused/a> tr>td> dfn data-dfn-forHTMLElement idevent-cancel data-dfn-typeevent data-export>code>cancel/code>/dfn> td> code idevents-2:event-6>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> code idevents-2:the-dialog-element>a href#the-dialog-element>dialog/a>/code> elements td> Fired at code idevents-2:the-dialog-element-2>a href#the-dialog-element>dialog/a>/code> elements when they are canceled by the user (e.g. by pressing the Escape key) tr>td> dfn data-dfn-forHTMLElement idevent-change data-dfn-typeevent data-export>code idevent-input-change>change/code>/dfn> td> code idevents-2:event-7>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> Form controls td> Fired at controls when the user commits a value change (see also the code idevents-2:event-input>a href#event-input>input/a>/code> event) tr>td> code idevents-2:event-click>a data-x-internalevent-click hrefhttps://w3c.github.io/uievents/#event-type-click>click/a>/code> td> code idevents-2:mouseevent>a data-x-internalmouseevent hrefhttps://w3c.github.io/uievents/#mouseevent>MouseEvent/a>/code> td> Elements td> Normally a mouse event; also synthetically fired at an element before its a idevents-2:activation-behaviour hrefhttps://dom.spec.whatwg.org/#eventtarget-activation-behavior data-x-internalactivation-behaviour>activation behavior/a> is run, when an element is activated from a non-pointer input device (e.g. a keyboard) tr>td> dfn data-dfn-forHTMLElement,WebSocket idevent-close data-dfn-typeevent data-export>code>close/code>/dfn> td> code idevents-2:event-8>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> code idevents-2:the-dialog-element-3>a href#the-dialog-element>dialog/a>/code> elements, code idevents-2:websocket>a href#websocket>WebSocket/a>/code> td> Fired at code idevents-2:the-dialog-element-4>a href#the-dialog-element>dialog/a>/code> elements when they are closed, and at code idevents-2:websocket-2>a href#websocket>WebSocket/a>/code> elements when the connection is terminated tr>td> dfn data-dfn-forSharedWorkerGlobalScope idevent-workerglobalscope-connect data-dfn-typeevent data-export>code>connect/code>/dfn> td> code idevents-2:messageevent>a href#messageevent>MessageEvent/a>/code> td> code idevents-2:sharedworkerglobalscope>a href#sharedworkerglobalscope>SharedWorkerGlobalScope/a>/code> td> Fired at a shared workers global scope when a new client connects tr>td> dfn data-dfn-forHTMLElement idevent-contextmenu data-dfn-typeevent data-export>code>contextmenu/code>/dfn> td> code idevents-2:mouseevent-2>a data-x-internalmouseevent hrefhttps://w3c.github.io/uievents/#mouseevent>MouseEvent/a>/code> td> Elements td> Fired at elements when the user requests their context menu tr>td> dfn data-dfn-forHTMLElement idevent-copy data-dfn-typeevent data-export>code>copy/code>/dfn> td> code idevents-2:event-9>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> Elements td> Fired at elements when the user copies data to the clipboard tr>td> dfn data-dfn-forHTMLElement idevent-cut data-dfn-typeevent data-export>code>cut/code>/dfn> td> code idevents-2:event-10>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> Elements td> Fired at elements when the user copies the selected data on the clipboard and removes the selection from the document tr>td> dfn data-dfn-forWindow,WorkerGlobalScope,HTMLElement,WebSocket,ApplicationCache,EventSource,Worker,SharedWorker,AbstractWorker idevent-error data-dfn-typeevent data-export>code>error/code>/dfn> td> code idevents-2:event-11>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> or code idevents-2:errorevent>a href#errorevent>ErrorEvent/a>/code> td> Global scope objects, code idevents-2:worker>a href#worker>Worker/a>/code> objects, elements, networking-related objects td> Fired when unexpected errors occur (e.g. networking errors, script errors, decoding errors) tr>td> dfn data-dfn-forWindow,HTMLElement idevent-focus data-dfn-typeevent data-export>code>focus/code>/dfn> td> code idevents-2:event-12>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> code idevents-2:window-10>a href#window>Window/a>/code>, elements td> Fired at nodes a href#gains-focus idevents-2:gains-focus>gaining focus/a> tr>td> dfn data-dfn-forWindow idevent-hashchange data-dfn-typeevent data-export>code>hashchange/code>/dfn> td> code idevents-2:hashchangeevent>a href#hashchangeevent>HashChangeEvent/a>/code> td> code idevents-2:window-11>a href#window>Window/a>/code> td> Fired at the code idevents-2:window-12>a href#window>Window/a>/code> when the a hrefhttps://url.spec.whatwg.org/#concept-url-fragment idevents-2:concept-url-fragment data-x-internalconcept-url-fragment>fragment/a> part of the documents a hrefhttps://dom.spec.whatwg.org/#concept-document-url idevents-2:the-documents-address data-x-internalthe-documents-address>URL/a> changes tr>td> dfn data-dfn-forHTMLElement idevent-input data-dfn-typeevent data-export>code idevent-input-input>input/code>/dfn>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> input-eventspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>15+/span>/span>span classios_saf yes>span>iOS Safari/span> span>5.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>3.6+/span>/span>span classie yes>span>IE/span> span>10+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>5.1+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.3+/span>/span>span classopera yes>span>Opera/span> span>12.1+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featinput-event>caniuse.com/a>/div> td> code idevents-2:event-13>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> Form controls td> Fired at controls when the user changes the value (see also the code idevents-2:event-change>a href#event-change>change/a>/code> event) tr>td> dfn data-dfn-forHTMLElement idevent-invalid data-dfn-typeevent data-export>code>invalid/code>/dfn> td> code idevents-2:event-14>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> Form controls td> Fired at controls during form validation if they do not satisfy their constraints tr>td> dfn data-dfn-forWindow,WorkerGlobalScope idevent-languagechange data-dfn-typeevent data-export>code>languagechange/code>/dfn> td> code idevents-2:event-15>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> Global scope objects td> Fired at the global scope object when the users preferred languages change tr>td> dfn data-dfn-forWindow,HTMLElement idevent-load data-dfn-typeevent data-export>code>load/code>/dfn> td> code idevents-2:event-16>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> code idevents-2:window-13>a href#window>Window/a>/code>, elements td> Fired at the code idevents-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 idevents-2:the-img-element>a href#the-img-element>img/a>/code>, code idevents-2:the-embed-element>a href#the-embed-element>embed/a>/code>) when its resource has finished loading tr>td> dfn data-dfn-forHTMLElement idevent-loadend data-dfn-typeevent data-export>code>loadend/code>/dfn> td> code idevents-2:event-17>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> or code idevents-2:progressevent>a data-x-internalprogressevent hrefhttps://xhr.spec.whatwg.org/#interface-progressevent>ProgressEvent/a>/code> td> code idevents-2:the-img-element-2>a href#the-img-element>img/a>/code> elements td> Fired at code idevents-2:the-img-element-3>a href#the-img-element>img/a>/code> elements after a successful load tr>td> dfn data-dfn-forHTMLElement idevent-loadstart data-dfn-typeevent data-export>code>loadstart/code>/dfn> td> code idevents-2:progressevent-2>a data-x-internalprogressevent hrefhttps://xhr.spec.whatwg.org/#interface-progressevent>ProgressEvent/a>/code> td> code idevents-2:the-img-element-4>a href#the-img-element>img/a>/code> elements td> Fired at code idevents-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 idevents-2:event-media-loadstart>media element events/a>) tr>td> dfn data-dfn-forWindow,EventSource,WebSocket,MessagePort,BroadcastChannel,DedicatedWorkerGlobalScope,Worker,ServiceWorkerContainer idevent-message data-dfn-typeevent data-export>code>message/code>/dfn> td> code idevents-2:messageevent-2>a href#messageevent>MessageEvent/a>/code> td> code idevents-2:window-15>a href#window>Window/a>/code>, code idevents-2:eventsource>a href#eventsource>EventSource/a>/code>, code idevents-2:websocket-3>a href#websocket>WebSocket/a>/code>, code idevents-2:messageport>a href#messageport>MessagePort/a>/code>, code idevents-2:broadcastchannel>a href#broadcastchannel>BroadcastChannel/a>/code>, code idevents-2:dedicatedworkerglobalscope>a href#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope/a>/code>, code idevents-2:worker-2>a href#worker>Worker/a>/code>, code idevents-2:serviceworkercontainer>a data-x-internalserviceworkercontainer hrefhttps://w3c.github.io/ServiceWorker/#serviceworkercontainer>ServiceWorkerContainer/a>/code> td> Fired at an object when it receives a message tr>td> dfn data-dfn-forWindow,MessagePort,BroadcastChannel,DedicatedWorkerGlobalScope,Worker,ServiceWorkerContainer idevent-messageerror data-dfn-typeevent data-export>code>messageerror/code>/dfn> td> code idevents-2:messageevent-3>a href#messageevent>MessageEvent/a>/code> td> code idevents-2:window-16>a href#window>Window/a>/code>, code idevents-2:messageport-2>a href#messageport>MessagePort/a>/code>, code idevents-2:broadcastchannel-2>a href#broadcastchannel>BroadcastChannel/a>/code>, code idevents-2:dedicatedworkerglobalscope-2>a href#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope/a>/code>, code idevents-2:worker-3>a href#worker>Worker/a>/code>, code idevents-2:serviceworkercontainer-2>a data-x-internalserviceworkercontainer hrefhttps://w3c.github.io/ServiceWorker/#serviceworkercontainer>ServiceWorkerContainer/a>/code> td> Fired at an object when it receives a message that cannot be deserialized tr>td> dfn data-dfn-forWindow,WorkerGlobalScope idevent-offline data-dfn-typeevent data-export>code>offline/code>/dfn> td> code idevents-2:event-18>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> Global scope objects td> Fired at the global scope object when the network connections fails tr>td> dfn data-dfn-forWindow,WorkerGlobalScope idevent-online data-dfn-typeevent data-export>code>online/code>/dfn> td> code idevents-2:event-19>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> Global scope objects td> Fired at the global scope object when the network connections returns tr>td> dfn data-dfn-forEventSource,WebSocket idevent-open data-dfn-typeevent data-export>code>open/code>/dfn> td> code idevents-2:event-20>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> code idevents-2:eventsource-2>a href#eventsource>EventSource/a>/code>, code idevents-2:websocket-4>a href#websocket>WebSocket/a>/code> td> Fired at networking-related objects when a connection is established tr>td> dfn data-dfn-forWindow idevent-pagehide data-dfn-typeevent data-export>code>pagehide/code>/dfn> td> code idevents-2:pagetransitionevent>a href#pagetransitionevent>PageTransitionEvent/a>/code> td> code idevents-2:window-17>a href#window>Window/a>/code> td> Fired at the code idevents-2:window-18>a href#window>Window/a>/code> when the pages entry in the a href#session-history idevents-2:session-history>session history/a> stops being the a href#current-entry idevents-2:current-entry>current entry/a> tr>td> dfn data-dfn-forWindow idevent-pageshow data-dfn-typeevent data-export>code>pageshow/code>/dfn>div classstatus>input onclicktoggleStatus(this) value⋰ typebutton>p classsupport>strong>Support:/strong> page-transition-eventsspan classand_chr yes>span>Chrome for Android/span> span>61+/span>/span>span classchrome yes>span>Chrome/span> span>4+/span>/span>span classios_saf yes>span>iOS Safari/span> span>5.0+/span>/span>span classand_uc yes>span>UC Browser for Android/span> span>11.4+/span>/span>span classfirefox yes>span>Firefox/span> span>2+/span>/span>span classie yes>span>IE/span> span>11+/span>/span>span classsamsung yes>span>Samsung Internet/span> span>4+/span>/span>span classop_mini no>span>Opera Mini/span> span>None/span>/span>span classsafari yes>span>Safari/span> span>5+/span>/span>span classedge yes>span>Edge/span> span>12+/span>/span>span classandroid yes>span>Android Browser/span> span>2.3+/span>/span>span classopera yes>span>Opera/span> span>15+/span>/span>p classcaniuse>Source: a hrefhttps://caniuse.com/#featpage-transition-events>caniuse.com/a>/div> td> code idevents-2:pagetransitionevent-2>a href#pagetransitionevent>PageTransitionEvent/a>/code> td> code idevents-2:window-19>a href#window>Window/a>/code> td> Fired at the code idevents-2:window-20>a href#window>Window/a>/code> when the pages entry in the a href#session-history idevents-2:session-history-2>session history/a> becomes the a href#current-entry idevents-2:current-entry-2>current entry/a> tr>td> dfn data-dfn-forHTMLElement idevent-paste data-dfn-typeevent data-export>code>paste/code>/dfn> td> code idevents-2:event-21>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> Elements td> Fired at elements when the user will insert the clipboard data in the most suitable format (if any) supported for the given context tr>td> dfn data-dfn-forWindow idevent-popstate data-dfn-typeevent data-export>code>popstate/code>/dfn> td> code idevents-2:popstateevent>a href#popstateevent>PopStateEvent/a>/code> td> code idevents-2:window-21>a href#window>Window/a>/code> td> Fired at the code idevents-2:window-22>a href#window>Window/a>/code> when the user navigates the a href#session-history idevents-2:session-history-3>session history/a> tr>td> dfn data-dfn-forHTMLElement idevent-progress data-dfn-typeevent data-export>code>progress/code>/dfn> td> code idevents-2:progressevent-3>a data-x-internalprogressevent hrefhttps://xhr.spec.whatwg.org/#interface-progressevent>ProgressEvent/a>/code> td> code idevents-2:the-img-element-6>a href#the-img-element>img/a>/code> elements td> Fired at code idevents-2:the-img-element-7>a href#the-img-element>img/a>/code> elements during a a href#cors-same-origin idevents-2:cors-same-origin>CORS-same-origin/a> image load (see also a href#event-media-progress idevents-2:event-media-progress>media element events/a>) tr>td> dfn data-dfn-forDocument idevent-readystatechange data-dfn-typeevent data-export>code>readystatechange/code>/dfn> td> code idevents-2:event-22>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> code idevents-2:document-3>a href#document>Document/a>/code> td> Fired at the code idevents-2:document-4>a href#document>Document/a>/code> when it finishes parsing and again when all its subresources have finished loading tr>td> dfn data-dfn-forWindow,WorkerGlobalScope idevent-rejectionhandled data-dfn-typeevent data-export>code>rejectionhandled/code>/dfn> td> code idevents-2:promiserejectionevent>a href#promiserejectionevent>PromiseRejectionEvent/a>/code> td> Global scope objects td> Fired at global scope objects when a previously-unhandled promise rejection becomes handled tr>td> dfn data-dfn-forHTMLElement idevent-reset data-dfn-typeevent data-export>code>reset/code>/dfn> td> code idevents-2:event-23>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> code idevents-2:the-form-element>a href#the-form-element>form/a>/code> elements td> Fired at a code idevents-2:the-form-element-2>a href#the-form-element>form/a>/code> element when it is a href#concept-form-reset idevents-2:concept-form-reset>reset/a> tr>td> dfn data-dfn-forHTMLElement idevent-securitypolicyviolation data-dfn-typeevent data-export>code>securitypolicyviolation/code>/dfn> td> code idevents-2:event-24>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> Elements td> Fired at elements when a Content Security Policy violation is generated a href#refsCSP>CSP/a> tr>td> dfn data-dfn-forHTMLElement idevent-select data-dfn-typeevent data-export>code>select/code>/dfn> td> code idevents-2:event-25>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> Form controls td> Fired at form controls when their text selection is adjusted (whether by an API or by the user) tr>td> dfn data-dfn-forWindow idevent-storage data-dfn-typeevent data-export>code>storage/code>/dfn> td> code idevents-2:storageevent>a href#storageevent>StorageEvent/a>/code> td> code idevents-2:window-23>a href#window>Window/a>/code> td> Fired at code idevents-2:window-24>a href#window>Window/a>/code> event when the corresponding code idevents-2:dom-localstorage>a href#dom-localstorage>localStorage/a>/code> or code idevents-2:dom-sessionstorage>a href#dom-sessionstorage>sessionStorage/a>/code> storage areas change tr>td> dfn data-dfn-forHTMLElement idevent-submit data-dfn-typeevent data-export>code>submit/code>/dfn> td> code idevents-2:event-26>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> code idevents-2:the-form-element-3>a href#the-form-element>form/a>/code> elements td> Fired at a code idevents-2:the-form-element-4>a href#the-form-element>form/a>/code> element when it is a href#concept-form-submit idevents-2:concept-form-submit>submitted/a> tr>td> dfn data-dfn-forHTMLElement idevent-toggle data-dfn-typeevent data-export>code>toggle/code>/dfn> td> code idevents-2:event-27>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> code idevents-2:the-details-element>a href#the-details-element>details/a>/code> element td> Fired at code idevents-2:the-details-element-2>a href#the-details-element>details/a>/code> elements when they open or close tr>td> dfn data-dfn-forWindow,WorkerGlobalScope idevent-unhandledrejection data-dfn-typeevent data-export>code>unhandledrejection/code>/dfn> td> code idevents-2:promiserejectionevent-2>a href#promiserejectionevent>PromiseRejectionEvent/a>/code> td> Global scope objects td> Fired at global scope objects when a promise rejection goes unhandled tr>td> dfn data-dfn-forWindow idevent-unload data-dfn-typeevent data-export>code>unload/code>/dfn> td> code idevents-2:event-28>a data-x-internalevent hrefhttps://dom.spec.whatwg.org/#interface-event>Event/a>/code> td> code idevents-2:window-25>a href#window>Window/a>/code> td> Fired at the code idevents-2:window-26>a href#window>Window/a>/code> object when the page is going away /table> p classnote>See also a href#mediaevents>media element events/a>, a href#appcacheevents>application cache events/a>, and a href#dndevents>drag-and-drop events/a>./p> h3 idmime-types-2 classno-num>MIME Typesa href#mime-types-2 classself-link>/a>/h3> p>i>This section is non-normative./i>/p> p>The following MIME types are mentioned in this specification:/p> dl>dt>dfn idapplication/atom+xml>code>application/atom+xml/code>/dfn>dd>Atom a href#refsATOM>ATOM/a>dt>dfn idapplication/ecmascript>code>application/ecmascript/code>/dfn>dd>JavaScript (legacy type) a href#refsJAVASCRIPT>JAVASCRIPT/a> dt>dfn idapplication/javascript>code>application/javascript/code>/dfn>dd>JavaScript (legacy type) a href#refsJAVASCRIPT>JAVASCRIPT/a> dt>dfn idapplication/json>code>application/json/code>/dfn>dd>JSON a href#refsJSON>JSON/a>dt>dfn idapplication/x-ecmascript>code>application/x-ecmascript/code>/dfn>dd>JavaScript (legacy type) a href#refsJAVASCRIPT>JAVASCRIPT/a> dt>dfn idapplication/x-javascript>code>application/x-javascript/code>/dfn>dd>JavaScript (legacy type) a href#refsJAVASCRIPT>JAVASCRIPT/a> dt>dfn idapplication/octet-stream>a hrefhttps://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 idmime-types-2:application/microdata+json>a href#application/microdata+json>application/microdata+json/a>/code>dd>Microdata as JSON dt>dfn idapplication/rss+xml>code>application/rss+xml/code>/dfn>dd>RSS dt>code idmime-types-2:application/x-www-form-urlencoded>a data-x-internalapplication/x-www-form-urlencoded hrefhttps://url.spec.whatwg.org/#concept-urlencoded>application/x-www-form-urlencoded/a>/code>dd>Form submissiondt>code idmime-types-2:application/xhtml+xml>a href#application/xhtml+xml>application/xhtml+xml/a>/code>dd>HTMLdt>dfn idapplication/xml>code>application/xml/code>/dfn>dd>XML a href#refsXML>XML/a> a href#refsRFC7303>RFC7303/a>dt>dfn idimage/gif>code>image/gif/code>/dfn>dd>GIF images a href#refsGIF>GIF/a>dt>dfn idimage/jpeg>code>image/jpeg/code>/dfn>dd>JPEG images a href#refsJPEG>JPEG/a>dt>dfn idimage/png>code>image/png/code>/dfn>dd>PNG images a href#refsPNG>PNG/a>dt>dfn idimage/svg+xml>code>image/svg+xml/code>/dfn>dd>SVG images a href#refsSVG>SVG/a>dt>dfn idmultipart/form-data>code>multipart/form-data/code>/dfn>dd>Form submission a href#refsRFC7578>RFC7578/a>dt>dfn idmultipart/mixed>code>multipart/mixed/code>/dfn>dd>Generic mixed content a href#refsRFC2046>RFC2046/a>dt>code idmime-types-2:multipart/x-mixed-replace>a href#multipart/x-mixed-replace>multipart/x-mixed-replace/a>/code>dd>Streaming server pushdt>code idmime-types-2:text/cache-manifest>a href#text/cache-manifest>text/cache-manifest/a>/code>dd>Offline application cache manifestsdt>dfn idtext/css>code>text/css/code>/dfn>dd>CSS a href#refsCSS>CSS/a>dt>dfn idtext/ecmascript>code>text/ecmascript/code>/dfn>dd>JavaScript (legacy type) a href#refsJAVASCRIPT>JAVASCRIPT/a> dt>code idmime-types-2:text/event-stream>a href#text/event-stream>text/event-stream/a>/code>dd>Server-sent event streamsdt>dfn idtext/javascript>code>text/javascript/code>/dfn>dd>JavaScript a href#refsJAVASCRIPT>JAVASCRIPT/a> dt>dfn idtext/javascript1.0>code>text/javascript1.0/code>/dfn>dd>JavaScript (legacy type) a href#refsJAVASCRIPT>JAVASCRIPT/a> dt>dfn idtext/javascript1.1>code>text/javascript1.1/code>/dfn>dd>JavaScript (legacy type) a href#refsJAVASCRIPT>JAVASCRIPT/a> dt>dfn idtext/javascript1.2>code>text/javascript1.2/code>/dfn>dd>JavaScript (legacy type) a href#refsJAVASCRIPT>JAVASCRIPT/a> dt>dfn idtext/javascript1.3>code>text/javascript1.3/code>/dfn>dd>JavaScript (legacy type) a href#refsJAVASCRIPT>JAVASCRIPT/a> dt>dfn idtext/javascript1.4>code>text/javascript1.4/code>/dfn>dd>JavaScript (legacy type) a href#refsJAVASCRIPT>JAVASCRIPT/a> dt>dfn idtext/javascript1.5>code>text/javascript1.5/code>/dfn>dd>JavaScript (legacy type) a href#refsJAVASCRIPT>JAVASCRIPT/a> dt>dfn idtext/jscript>code>text/jscript/code>/dfn>dd>JavaScript (legacy type) a href#refsJAVASCRIPT>JAVASCRIPT/a> dt>dfn idtext/json>code>text/json/code>/dfn>dd>JSON (legacy type)dt>dfn idtext/livescript>code>text/livescript/code>/dfn>dd>JavaScript (legacy type) a href#refsJAVASCRIPT>JAVASCRIPT/a> dt>dfn idtext/plain>a hrefhttps://tools.ietf.org/html/rfc2046#section-4.1.3>code>text/plain/code>/a>/dfn>dd>Generic plain text a href#refsRFC2046>RFC2046/a> a href#refsRFC3676>RFC3676/a>dt>code idmime-types-2:text/html>a href#text/html>text/html/a>/code>dd>HTMLdt>code idmime-types-2:text/ping>a href#text/ping>text/ping/a>/code>dd>Hyperlink auditingdt>dfn idtext/uri-list>code>text/uri-list/code>/dfn>dd>List of URLs a href#refsRFC2483>RFC2483/a> dt>dfn idtext/vcard>code>text/vcard/code>/dfn>dd>vCard a href#refsRFC6350>RFC6350/a> dt>dfn idtext/vtt>code>text/vtt/code>/dfn>dd>WebVTT a href#refsWEBVTT>WEBVTT/a>dt>dfn idtext/x-ecmascript>code>text/x-ecmascript/code>/dfn>dd>JavaScript (legacy type) a href#refsJAVASCRIPT>JAVASCRIPT/a> dt>dfn idtext/x-javascript>code>text/x-javascript/code>/dfn>dd>JavaScript (legacy type) a href#refsJAVASCRIPT>JAVASCRIPT/a> dt>dfn idtext/xml>code>text/xml/code>/dfn>dd>XML a href#refsXML>XML/a> a href#refsRFC7303>RFC7303/a>dt>dfn idvideo/mp4>a hrefhttps://tools.ietf.org/html/rfc4337#section-3>code>video/mp4/code>/a>/dfn>dd>MPEG-4 video a href#refsRFC4337>RFC4337/a>dt>dfn idvideo/mpeg>code>video/mpeg/code>/dfn>dd>MPEG video a href#refsRFC2046>RFC2046/a>/dl> h2 idreferences classno-num>Referencesa href#references classself-link>/a>/h2> p>All references are normative unless marked Non-normative./p> dl idref-list>dt idrefsABNF>ABNFdd>cite>a hrefhttps://tools.ietf.org/html/std68>Augmented BNF for Syntax Specifications: ABNF/a>/cite>, D. Crocker, P. Overell. IETF.dt idrefsABOUT>ABOUTdd>cite>a hrefhttps://tools.ietf.org/html/rfc6694>The about URI scheme/a>/cite>, S. Moonesamy. IETF.dt idrefsAPNG>APNGdd>(Non-normative) cite>a hrefhttps://wiki.mozilla.org/APNG_Specification>APNG Specification/a>/cite>. S. Parmenter, V. Vukicevic, A. Smith. Mozilla.dt idrefsARIA>ARIAdd>cite>a hrefhttps://w3c.github.io/aria/aria/aria.html>Accessible Rich Internet Applications (WAI-ARIA)/a>/cite>, J. Diggs, J. Craig, S. McCarron, M. Cooper. W3C.dt idrefsARIAHTML>ARIAHTMLdd>cite>a hrefhttps://w3c.github.io/html-aria/>ARIA in HTML/a>/cite>, S. Faulkner. W3C.dt idrefsATAG>ATAGdd>(Non-normative) cite>a hrefhttps://www.w3.org/TR/ATAG20/>Authoring Tool Accessibility Guidelines (ATAG) 2.0/a>/cite>, J. Richards, J. Spellman, J. Treviranus. W3C.dt idrefsATOM>ATOMdd>(Non-normative) cite>a hrefhttps://tools.ietf.org/html/rfc4287>The Atom Syndication Format/a>/cite>, M. Nottingham, R. Sayre. IETF.dt idrefsBATTERY>BATTERYdd>(Non-normative) cite>a hrefhttps://w3c.github.io/battery/>Battery Status API/a>/cite>, A. Kostiainen, M. Lamouri. W3C.dt idrefsBCP47>BCP47dd>cite>a hrefhttps://tools.ietf.org/html/bcp47>Tags for Identifying Languages; Matching of Language Tags/a>/cite>, A. Phillips, M. Davis. IETF.dt idrefsBEZIER>BEZIERdd>cite>Courbes à poles/cite>, P. de Casteljau. INPI, 1959.dt idrefsBIDI>BIDIdd>cite>a hrefhttps://www.unicode.org/reports/tr9/>UAX #9: Unicode Bidirectional Algorithm/a>/cite>, M. Davis. Unicode Consortium.dt idrefsBOCU1>BOCU1dd>(Non-normative) cite>a hrefhttps://www.unicode.org/notes/tn6/>UTN #6: BOCU-1: MIME-Compatible Unicode Compression/a>/cite>, M. Scherer, M. Davis. Unicode Consortium.dt idrefsCESU8>CESU8dd>(Non-normative) cite>a hrefhttps://www.unicode.org/reports/tr26/>UTR #26: Compatibility Encoding Scheme For UTF-16: 8-BIT (CESU-8)/a>/cite>, T. Phipps. Unicode Consortium.dt idrefsCHARMOD>CHARMODdd>(Non-normative) cite>a hrefhttps://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 idrefsCLDR>CLDRdd>cite>a hrefhttp://cldr.unicode.org/>Unicode Common Locale Data Repository/a>/cite>. Unicode.dt idrefsCOMPOSITE>COMPOSITEdd>cite>a hrefhttps://drafts.fxtf.org/compositing/>Compositing and Blending/a>/cite>, R. Cabanier, N. Andronikos. W3C.dt idrefsCOMPUTABLE>COMPUTABLEdd>(Non-normative) cite>a hrefhttp://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 idrefsCOOKIES>COOKIESdd>cite>a hrefhttps://tools.ietf.org/html/rfc6265>HTTP State Management Mechanism/a>/cite>, A. Barth. IETF.dt idrefsCSP>CSPdd>cite>a hrefhttps://w3c.github.io/webappsec-csp/>Content Security Policy/a>/cite>, M. West, D. Veditz. W3C.dt idrefsCSS>CSSdd>cite>a hrefhttps://drafts.csswg.org/css2/>Cascading Style Sheets Level 2 Revision 2/a>/cite>, B. Bos, T. Çelik, I. Hickson, H. Lie. W3C.dt idrefsCSSANIMATIONS>CSSANIMATIONSdd>cite>a hrefhttps://drafts.csswg.org/css-animations/>CSS Animations/a>/cite>, D. Jackson, D. Hyatt, C. Marrin, S. Galineau, L. Baron. W3C.dt idrefsCSSATTR>CSSATTRdd>cite>a hrefhttps://drafts.csswg.org/css-style-attr/>CSS Style Attributes/a>/cite>, T. Çelik, E. Etemad. W3C.dt idrefsCSSBG>CSSBGdd>cite>a hrefhttps://drafts.csswg.org/css-backgrounds/>CSS Backgrounds and Borders /a>/cite>, B. Bos, E. Etemad, B. Kemper. W3C.dt idrefsCSSCASCADE>CSSCASCADEdd>cite>a hrefhttps://drafts.csswg.org/css-cascade/>CSS Cascading and Inheritance/a>/cite>, E. Etemad, T. Atkins. W3C.dt idrefsCSSCOLOR>CSSCOLORdd>cite>a hrefhttps://drafts.csswg.org/css-color/>CSS Color Module/a>/cite>, T. Çelik, C. Lilley, L. Baron. W3C.dt idrefsCSSDISPLAY>CSSDISPLAYdd>cite>a hrefhttps://drafts.csswg.org/css-font-loading/>CSS Display/a>/cite>, T. Atkins, E. Etemad. W3C.dt idrefsCSSFONTLOAD>CSSFONTLOADdd>cite>a hrefhttps://drafts.csswg.org/css-font-loading/>CSS Font Loading/a>/cite>, T. Atkins, J. Daggett. W3C.dt idrefsCSSFONTS>CSSFONTSdd>cite>a hrefhttps://drafts.csswg.org/css-fonts/>CSS Fonts/a>/cite>, J. Daggett. W3C.dt idrefsCSSGC>CSSGCdd>cite>a hrefhttps://drafts.csswg.org/css-content/>CSS Generated Content/a>/cite>, H. Lie, E. Etemad, I. Hickson. W3C.dt idrefsCSSIMAGES>CSSIMAGESdd>cite>a hrefhttps://drafts.csswg.org/css-images/>CSS Image Values and Replaced Content Module/a>/cite>, E. Etemad, T. Atkins. W3C.dt idrefsCSSLISTS>CSSLISTSdd>cite>a hrefhttps://drafts.csswg.org/css-lists/>CSS Lists and Counters/a>/cite>, T. Atkins. W3C.dt idrefsCSSLOGICAL>CSSLOGICALdd>cite>a hrefhttps://drafts.csswg.org/css-logical/>CSS Logical Properties/a>/cite>, R. Atanassov, E. Etemad. W3C.dt idrefsCSSOM>CSSOMdd>cite>a hrefhttps://drafts.csswg.org/cssom/>Cascading Style Sheets Object Model (CSSOM)/a>/cite>, S. Pieters, G. Adams. W3C.dt idrefsCSSOMVIEW>CSSOMVIEWdd>cite>a hrefhttps://drafts.csswg.org/cssom-view/>CSSOM View Module/a>/cite>, S. Pieters, G. Adams. W3C.dt idrefsCSSOVERFLOW>CSSOVERFLOWdd>cite>a hrefhttps://drafts.csswg.org/css-overflow-3/>CSS Overflow Module/a>/cite>, L. Baron, F. Rivoal. W3C.dt idrefsCSSPOSITION>CSSPOSITIONdd>cite>a hrefhttps://drafts.csswg.org/css-position/>CSS Positioned Layout/a>/cite>, R. Atanassov, A. Eicholz. W3C.dt idrefsCSSRUBY>CSSRUBYdd>cite>a hrefhttps://drafts.csswg.org/css-ruby/>CSS3 Ruby Module/a>/cite>, R. Ishida. W3C.dt idrefsCSSTRANSITIONS>CSSTRANSITIONSdd>(Non-normative) cite>a hrefhttps://drafts.csswg.org/css-transitions/>CSS Transitions/a>/cite>, D. Jackson, D. Hyatt, C. Marrin, L. Baron. W3C.dt idrefsCSSUI>CSSUIdd>cite>a hrefhttps://drafts.csswg.org/css-ui/>CSS3 Basic User Interface Module/a>/cite>, T. Çelik. W3C.dt idrefsCSSSYNTAX>CSSSYNTAXdd>cite>a hrefhttps://drafts.csswg.org/css-syntax/>CSS Syntax/a>/cite>, T. Atkins, S. Sapin. W3C.dt idrefsCSSTABLE>CSSTABLEdd>cite>a hrefhttps://drafts.csswg.org/css-tables/>CSS Table/a>/cite>, F. Remy, G. Whitworth. W3C.dt idrefsCSSTEXT>CSSTEXTdd>cite>a hrefhttps://drafts.csswg.org/css-text/>CSS Text/a>/cite>, E. Etemad, K. Ishii. W3C.dt idrefsCSSVALUES>CSSVALUESdd>cite>a hrefhttps://drafts.csswg.org/css-values/>CSS3 Values and Units/a>/cite>, H. Lie, T. Atkins, E. Etemad. W3C.dt idrefsCSSWM>CSSWMdd>cite>a hrefhttps://drafts.csswg.org/css-writing-modes/>CSS Writing Modes/a>/cite>, E. Etemad, K. Ishii. W3C.dt idrefsDASH>DASHdd>cite>a hrefhttps://www.iso.org/standard/65274.html>Dynamic adaptive streaming over HTTP (DASH)/a>/cite>. ISO.dt idrefsDOM>DOMdd>cite>a hrefhttps://dom.spec.whatwg.org/>DOM/a>/cite>, A. van Kesteren, A. Gregor, Ms2ger. WHATWG.dt idrefsDOMPARSING>DOMPARSINGdd>cite>a hrefhttps://w3c.github.io/DOM-Parsing/>DOM Parsing and Serialization/a>/cite>, T. Leithead. W3C.dt idrefsDOT>DOTdd>(Non-normative) cite>a hrefhttp://www.graphviz.org/content/dot-language>The DOT Language/a>/cite>. Graphviz.dt idrefsE163>E163dd>cite>Recommendation E.163 — Numbering Plan for The International Telephone Service/cite>, CCITT Blue Book, Fascicle II.2, pp. 128-134, November 1988.dt idrefsENCODING>ENCODINGdd>cite>a hrefhttps://encoding.spec.whatwg.org/>Encoding/a>/cite>, A. van Kesteren, J. Bell. WHATWG.dt idrefsEXECCOMMAND>EXECCOMMANDdd>cite>a hrefhttps://w3c.github.io/editing/execCommand.html>execCommand/a>/cite>, J. Wilm, A. Gregor. W3C Editing APIs CG.dt idrefsEXIF>EXIFdd>(Non-normative) cite>a hrefhttps://www.jeita.or.jp/cgi-bin/standard_e/list.cgi?cateid1&subcateid4>Exchangeable image file format/a>/cite>. JEITA.dt idrefsFETCH>FETCHdd>cite>a hrefhttps://fetch.spec.whatwg.org/>Fetch/a>/cite>, A. van Kesteren. WHATWG.dt idrefsFILEAPI>FILEAPIdd>cite>a hrefhttps://w3c.github.io/FileAPI/>File API/a>/cite>, A. Ranganathan. W3C.dt idrefsFILTERS>FILTERSdd>cite>a hrefhttps://drafts.fxtf.org/filter-effects/>Filter Effects/a>/cite>, D. Jackson, E. Dahlström, D. Schulze. W3C.dt idrefsFULLSCREEN>FULLSCREENdd>cite>a hrefhttps://fullscreen.spec.whatwg.org/>Fullscreen/a>/cite>, A. van Kesteren, T. Çelik. WHATWG.dt idrefsGEOMETRY>GEOMETRYdd>cite>a hrefhttps://drafts.fxtf.org/geometry/>Geometry Interfaces Module/a>/cite>. S. Pieters, D. Schulze, R. Cabanier. W3C.dt idrefsGIF>GIFdd>(Non-normative) cite>a hrefhttps://www.w3.org/Graphics/GIF/spec-gif89a.txt>Graphics Interchange Format/a>/cite>. CompuServe.dt idrefsGRAPHICS>GRAPHICSdd>(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 idrefsGREGORIAN>GREGORIANdd>(Non-normative) cite>Inter Gravissimas/cite>, A. Lilius, C. Clavius. Gregory XIII Papal Bull, February 1582.dt idrefsHRT>HRTdd>cite>a hrefhttps://w3c.github.io/hr-time/>High Resolution Time/a>/cite>, I. Grigorik, J. Simonsen, J. Mann. W3C.dt idrefsHTMLAAM>HTMLAAMdd>cite>a hrefhttps://w3c.github.io/aria/html-aam/html-aam.html>HTML Accessibility API Mappings 1.0/a>/cite>, S. Faulkner, J. Kiss, A. Surkov. W3C.dt idrefsHTTP>HTTPdd>cite>a hrefhttps://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 hrefhttps://tools.ietf.org/html/rfc7231>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content/a>/cite>, R. Fielding, J. Reschke. IETF.dd>cite>a hrefhttps://tools.ietf.org/html/rfc7232>Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests/a>/cite>, R. Fielding, J. Reschke. IETF.dd>cite>a hrefhttps://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 hrefhttps://tools.ietf.org/html/rfc7234>Hypertext Transfer Protocol (HTTP/1.1): Caching/a>/cite>, R. Fielding, M. Nottingham, J. Reschke. IETF.dd>cite>a hrefhttps://tools.ietf.org/html/rfc7235>Hypertext Transfer Protocol (HTTP/1.1): Authentication/a>/cite>, R. Fielding, J. Reschke. IETF.dt idrefsIANAPERMHEADERS>IANAPERMHEADERSdd>cite>a hrefhttps://www.iana.org/assignments/message-headers/message-headers.xhtml#perm-headers>Permanent Message Header Field Names/a>/cite>. IANA.dt idrefsINDEXEDDB>INDEXEDDBdd>cite>a hrefhttps://w3c.github.io/IndexedDB/>Indexed Database API/a>/cite>, A. Alabbas, J. Bell. W3C.dt idrefsINBAND>INBANDdd>cite>a hrefhttps://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 idrefsINFRA>INFRAdd>cite>a hrefhttps://infra.spec.whatwg.org/>Infra/a>/cite>, A. van Kesteren, D. Denicola. WHATWG.dt idrefsINTERSECTIONOBSERVER>INTERSECTIONOBSERVERdd>cite>a hrefhttps://w3c.github.io/IntersectionObserver/>Intersection Observer/a>/cite>, S. Zager. W3C.dt idrefsISO3166>ISO3166dd>cite>a hrefhttps://www.iso.org/iso-3166-country-codes.html>ISO 3166: Codes for the representation of names of countries and their subdivisions/a>/cite>. ISO.dt idrefsISO4217>ISO4217dd>cite>a hrefhttps://www.iso.org/iso-4217-currency-codes.html>ISO 4217: Codes for the representation of currencies and funds/a>/cite>. ISO.dt idrefsISO8601>ISO8601dd>(Non-normative) cite>a hrefhttp://isotc.iso.org/livelink/livelink/4021199/ISO_8601_2004_E.zip?funcdoc.Fetch&nodeid4021199>ISO8601: Data elements and interchange formats — Information interchange — Representation of dates and times/a>/cite>. ISO.dt idrefsJAVASCRIPT>JAVASCRIPTdd>cite>a hrefhttps://tc39.github.io/ecma262/>ECMAScript Language Specification/a>/cite>. Ecma International.dt idrefsJLREQ>JLREQdd>cite>a hrefhttps://www.w3.org/TR/jlreq/>Requirements for Japanese Text Layout/a>/cite>. W3C.dt idrefsJPEG>JPEGdd>cite>a hrefhttps://www.w3.org/Graphics/JPEG/jfif3.pdf>JPEG File Interchange Format/a>/cite>, E. Hamilton.dt idrefsJSIMPORT>JSIMPORTdd>cite>a hrefhttps://tc39.github.io/proposal-dynamic-import/>import()/a>/cite>. Ecma International.dt idrefsJSINTL>JSINTLdd>cite>a hrefhttps://tc39.github.io/ecma402/>ECMAScript Internationalization API Specification/a>/cite>. Ecma International.dt idrefsJSON>JSONdd>cite>a hrefhttps://tools.ietf.org/html/rfc7159>The JavaScript Object Notation (JSON) Data Interchange Format/a>/cite>, T. Bray. IETF.dt idrefsMAILTO>MAILTOdd>(Non-normative) cite>a hrefhttps://tools.ietf.org/html/rfc6068>The mailto URI scheme/a>/cite>, M. Duerst, L. Masinter, J. Zawinski. IETF.dt idrefsMATHML>MATHMLdd>cite>a hrefhttps://www.w3.org/Math/draft-spec/>Mathematical Markup Language (MathML)/a>/cite>, D. Carlisle, P. Ion, R. Miner. W3C.dt idrefsMEDIAFRAG>MEDIAFRAGdd>cite>a hrefhttps://www.w3.org/TR/media-frags/>Media Fragments URI/a>/cite>, R. Troncy, E. Mannens, S. Pfeiffer, D. Van Deursen. W3C.dt idrefsMEDIASOURCE>MEDIASOURCEdd>cite>a hrefhttps://w3c.github.io/media-source/>Media Source Extensions/a>/cite>, A. Colwell, A. Bateman, M. Watson. W3C.dt idrefsMEDIASTREAM>MEDIASTREAMdd>cite>a hrefhttps://w3c.github.io/mediacapture-main/getusermedia.html>Media Capture and Streams/a>/cite>, D. Burnett, A. Bergkvist, C. Jennings, A. Narayanan. W3C.dt idrefsMFREL>MFRELdd>cite>a hrefhttp://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions>Microformats Wiki: existing rel values/a>/cite>. Microformats.dt idrefsMIMESNIFF>MIMESNIFFdd>cite>a hrefhttps://mimesniff.spec.whatwg.org/>MIME Sniffing/a>/cite>, G. Hemsley. WHATWG.dt idrefsMIX>MIXdd>cite>a hrefhttps://w3c.github.io/webappsec-mixed-content/>Mixed Content/a>/cite>, M. West. W3C.dt idrefsMNG>MNGdd>cite>a hrefhttp://www.libpng.org/pub/mng/spec/>MNG (Multiple-image Network Graphics) Format/a>/cite>. G. Randers-Pehrson.dt idrefsMPEG2>MPEG2dd>cite>ISO/IEC 13818-1: Information technology — Generic coding of moving pictures and associated audio information: Systems/cite>. ISO/IEC.dt idrefsMPEG4>MPEG4dd>cite>ISO/IEC 14496-12: ISO base media file format/cite>. ISO/IEC.dt idrefsMQ>MQdd>cite>a hrefhttps://drafts.csswg.org/mediaqueries/>Media Queries/a>/cite>, H. Lie, T. Çelik, D. Glazman, A. van Kesteren. W3C.dt idrefsNPAPI>NPAPIdd>(Non-normative) cite>a hrefhttps://developer.mozilla.org/en-US/docs/Plugins/Guide>Gecko Plugin API Reference/a>/cite>. Mozilla.dt idrefsOGGSKELETONHEADERS>OGGSKELETONHEADERSdd>cite>a hrefhttps://wiki.xiph.org/SkeletonHeaders>SkeletonHeaders/a>/cite>. Xiph.Org.dt idrefsOPENSEARCH>OPENSEARCHdd>cite>a hrefhttp://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 idrefsORIGIN>ORIGINdd>(Non-normative) cite>a hrefhttps://tools.ietf.org/html/rfc6454>The Web Origin Concept/a>/cite>, A. Barth. IETF.dt idrefsPAGEVIS>PAGEVISdd>(Non-normative) cite>a hrefhttps://w3c.github.io/web-performance/specs/PageVisibility/Overview.html>Page Visibility/a>/cite>, J. Mann, A. Jain. W3C.dt idrefsPAYMENTREQUEST>PAYMENTREQUESTdd>cite>a hrefhttps://w3c.github.io/browser-payment-api/>Payment Request API/a>/cite>, A. Bateman, Z. Koch, R. McElmurry. W3C.dt idrefsPDF>PDFdd>(Non-normative) cite>a hrefhttps://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf>Document management — Portable document format — Part 1: PDF/a>/cite>. ISO.dt idrefsPINGBACK>PINGBACKdd>cite>a hrefhttps://www.hixie.ch/specs/pingback/pingback>Pingback 1.0/a>/cite>, S. Langridge, I. Hickson.dt idrefsPNG>PNGdd>cite>a hrefhttps://www.w3.org/TR/PNG/>Portable Network Graphics (PNG) Specification/a>/cite>, D. Duce. W3C.dt idrefsPOINTEREVENTS>POINTEREVENTSdd>cite>a hrefhttps://w3c.github.io/pointerevents/>Pointer Events/a>/cite>, J. Rossi, M. Brubeck, R. Byers, P. H. Lauke. W3C.dt idrefsPOINTERLOCK>POINTERLOCKdd>cite>a hrefhttps://w3c.github.io/pointerlock/>Pointer Lock/a>/cite>, V. Scheib. W3C.dt idrefsPPUTF8>PPUTF8dd>(Non-normative) cite>a hrefhttps://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 idrefsPRELOAD>PRELOADdd>cite>a hrefhttps://w3c.github.io/preload/>Preload/a>/cite>, I. Grigorik. W3C.dt idrefsPRESENTATION>PRESENTATIONdd>cite>a hrefhttps://w3c.github.io/presentation-api/>Presentation API/a>/cite>, M. Foltz, D. Röttsches. W3C.dt idrefsPSL>PSLdd>cite>a hrefhttps://publicsuffix.org/>Public Suffix List/a>/cite>. Mozilla Foundation.dt idrefsREFERRERPOLICY>REFERRERPOLICYdd>cite>a hrefhttps://w3c.github.io/webappsec-referrer-policy/>Referrer Policy/a>/cite>, J. Eisinger, E. Stark. W3C.dt idrefsRESOURCEHINTS>RESOURCEHINTSdd>cite>a hrefhttps://w3c.github.io/resource-hints/>Resource Hints/a>/cite>, I. Grigorik. W3C.dt idrefsRFC1034>RFC1034dd>cite>a hrefhttps://tools.ietf.org/html/rfc1034>Domain Names - Concepts and Facilities/a>/cite>, P. Mockapetris. IETF, November 1987.dt idrefsRFC1123>RFC1123dd>cite>a hrefhttps://tools.ietf.org/html/rfc1123>Requirements for Internet Hosts -- Application and Support/a>/cite>, R. Braden. IETF, October 1989.dt idrefsRFC2046>RFC2046dd>cite>a hrefhttps://tools.ietf.org/html/rfc2046>Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types/a>/cite>, N. Freed, N. Borenstein. IETF.dt idrefsRFC2397>RFC2397dd>cite>a hrefhttps://tools.ietf.org/html/rfc2397>The data URL scheme/a>/cite>, L. Masinter. IETF.dt idrefsRFC5545>RFC5545dd>cite>a hrefhttps://tools.ietf.org/html/rfc5545>Internet Calendaring and Scheduling Core Object Specification (iCalendar)/a>/cite>, B. Desruisseaux. IETF.dt idrefsRFC2483>RFC2483dd>cite>a hrefhttps://tools.ietf.org/html/rfc2483>URI Resolution Services Necessary for URN Resolution/a>/cite>, M. Mealling, R. Daniel. IETF.dt idrefsRFC3676>RFC3676dd>cite>a hrefhttps://tools.ietf.org/html/rfc3676>The Text/Plain Format and DelSp Parameters/a>/cite>, R. Gellens. IETF.dt idrefsRFC3864>RFC3864dd>cite>a hrefhttps://tools.ietf.org/html/rfc3864>Registration Procedures for Message Header Fields/a>/cite>, G. Klyne, M. Nottingham, J. Mogul. IETF.dt idrefsRFC4329>RFC4329dd>(Non-normative) cite>a hrefhttps://tools.ietf.org/html/rfc4329>Scripting Media Types/a>/cite>, B. Höhrmann. IETF.dt idrefsRFC4337>RFC4337dd>(Non-normative) cite>a hrefhttps://tools.ietf.org/html/rfc4337>MIME Type Registration for MPEG-4/a>/cite>, Y. Lim, D. Singer. IETF.dt idrefsRFC7595>RFC7595dd>cite>a hrefhttps://tools.ietf.org/html/rfc7595>Guidelines and Registration Procedures for URI Schemes/a>/cite>, D. Thaler, T. Hansen, T. Hardie. IETF.dt idrefsRFC5322>RFC5322dd>cite>a hrefhttps://tools.ietf.org/html/rfc5322>Internet Message Format/a>/cite>, P. Resnick. IETF.dt idrefsRFC6381>RFC6381dd>cite>a hrefhttps://tools.ietf.org/html/rfc6381>The Codecs and Profiles Parameters for Bucket Media Types/a>/cite>, R. Gellens, D. Singer, P. Frojdh. IETF.dt idrefsRFC6266>RFC6266dd>cite>a hrefhttps://tools.ietf.org/html/rfc6266>Use of the Content-Disposition Header Field in the Hypertext Transfer Protocol (HTTP)/a>/cite>, J. Reschke. IETF.dt idrefsRFC6350>RFC6350dd>cite>a hrefhttps://tools.ietf.org/html/rfc6350>vCard Format Specification/a>/cite>, S. Perreault. IETF.dt idrefsRFC6596>RFC6596dd>cite>a hrefhttps://tools.ietf.org/html/rfc6596>The Canonical Link Relation/a>/cite>, M. Ohye, J. Kupke. IETF.dt idrefsRFC7303>RFC7303dd>cite>a hrefhttps://tools.ietf.org/html/rfc7303>XML Media Types/a>/cite>, H. Thompson, C. Lilley. IETF.dt idrefsRFC7578>RFC7578dd>cite>a hrefhttps://tools.ietf.org/html/rfc7578>Returning Values from Forms: multipart/form-data/a>/cite>, L. Masinter. IETF.dt idrefsSCREENORIENTATION>SCREENORIENTATIONdd>cite>a hrefhttps://w3c.github.io/screen-orientation/>Screen Orientation API/a>/cite>, M. Lamouri, M. Cáceres. W3C.dt idrefsSCSU>SCSUdd>(Non-normative) cite>a hrefhttps://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 idrefsSECURE-CONTEXTS>SECURE-CONTEXTSdd>cite>a hrefhttps://w3c.github.io/webappsec-secure-contexts/>Secure Contexts/a>/cite>, M. West. W3C.dt idrefsSELECTION>SELECTIONdd>cite>a hrefhttps://w3c.github.io/selection-api/>Selection API/a>/cite>, R. Niwa. W3C.dt idrefsSELECTORS>SELECTORSdd>cite>a hrefhttps://drafts.csswg.org/selectors/>Selectors/a>/cite>, E. Etemad, T. Çelik, D. Glazman, I. Hickson, P. Linss, J. Williams. W3C.dt idrefsSMS>SMSdd>(Non-normative) cite>a hrefhttps://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 idrefsSRGB>SRGBdd>cite langen-GB>a hrefhttps://webstore.iec.ch/publication/6169>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 idrefsSRI>SRIdd>cite>a hrefhttps://w3c.github.io/webappsec-subresource-integrity/>Subresource Integrity/a>/cite>, D. Akhawe, F. Braun, F. Marier, J. Weinberger. W3C.dt idrefsSVG>SVGdd>cite>a hrefhttps://www.w3.org/TR/SVG11/>Scalable Vector Graphics (SVG) 1.1 (Second Edition)/a>/cite>, E. Dahlström, P. Dengler, A. Grasso, C. Lilley, C. McCormack, D. Schepers, J. Watt, J. Ferraiolo, J. Fujisawa, D. Jackson. W3C.dt idrefsSVGTINY12>SVGTINY12dd>cite>a hrefhttps://www.w3.org/TR/SVGTiny12/>Scalable Vector Graphics (SVG) Tiny 1.2/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 idrefsSVG2>SVG2dd>(Non-normative) cite>a hrefhttps://svgwg.org/svg2-draft/>Scalable Vector Graphics (SVG) 2/a>/cite>, N. Andronikos, R. Atanassov, T. Bah, A. Bellamy-Royds, B. Birtles, B. Brinza, C. Concolato, E. Dahlström, C. Lilley, C. McCormack, D. Schepers, D. Schulze, R. Schwerdtfeger, S. Takagi, J. Watt. W3C.dt idrefsSW>SWdd>cite>a hrefhttps://w3c.github.io/ServiceWorker/>Service Workers/a>/cite>, A. Russell, J. Song, J. Archibald. W3C.dt idrefsTOR>TORdd>(Non-normative) cite>a hrefhttps://www.torproject.org/>Tor/a>/cite>.dt idrefsTOUCH>TOUCHdd>cite>a hrefhttps://w3c.github.io/touch-events/>Touch Events/a>/cite>, D. Schepers, S. Moon, M. Brubeck, A. Barstow, R. Byers. W3C.dt idrefsTZDATABASE>TZDATABASEdd>(Non-normative) cite>a hrefhttps://www.iana.org/time-zones>Time Zone Database/a>/cite>. IANA.dt idrefsUAAG>UAAGdd>(Non-normative) cite>a hrefhttps://www.w3.org/TR/UAAG20/>User Agent Accessibility Guidelines (UAAG) 2.0/a>/cite>, J. Allan, K. Ford, J. Richards, J. Spellman. W3C.dt idrefsUIEVENTS>UIEVENTSdd>cite>a hrefhttps://w3c.github.io/uievents/>UI Events Specification/a>/cite>, G. Kacmarcik, T. Leithead. W3C.dt idrefsUNICODE>UNICODEdd>cite>a hrefhttps://www.unicode.org/versions/>The Unicode Standard/a>/cite>. Unicode Consortium.dt idrefsUNIVCHARDET>UNIVCHARDETdd>(Non-normative) cite>a hrefhttps://www-archive.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 idrefsURL>URLdd>cite>a hrefhttps://url.spec.whatwg.org/>URL/a>/cite>, A. van Kesteren. WHATWG.dt idrefsURN>URNdd>cite>a hrefhttps://tools.ietf.org/html/rfc2141>URN Syntax/a>/cite>, R. Moats. IETF.dt idrefsUTF7>UTF7dd>(Non-normative) cite>a hrefhttps://tools.ietf.org/html/rfc2152>UTF-7: A Mail-Safe Transformation Format of Unicode/a>/cite>, D. Goldsmith, M. Davis. IETF.dt idrefsUTF8DET>UTF8DETdd>(Non-normative) cite>a hrefhttps://www.w3.org/International/questions/qa-forms-utf-8>Multilingual form encoding/a>/cite>, M. Dürst. W3C.dt idrefsUTR36>UTR36dd>(Non-normative) cite>a hrefhttps://www.unicode.org/reports/tr36/>UTR #36: Unicode Security Considerations/a>/cite>, M. Davis, M. Suignard. Unicode Consortium.dt idrefsWCAG>WCAGdd>(Non-normative) cite>a hrefhttps://www.w3.org/TR/WCAG20/>Web Content Accessibility Guidelines (WCAG) 2.0/a>/cite>, B. Caldwell, M. Cooper, L. Reid, G. Vanderheiden. W3C.dt idrefsWEBCRYPTO>WEBCRYPTOdd>(Non-normative) cite>a hrefhttps://w3c.github.io/webcrypto/Overview.html>Web Cryptography API/a>/cite>, M. Watson. W3C.dt idrefsWEBGL>WEBGLdd>cite>a hrefhttps://www.khronos.org/registry/webgl/specs/latest/>WebGL Specification/a>/cite>, D. Jackson. Khronos Group.dt idrefsWEBIDL>WEBIDLdd>cite>a hrefhttps://heycam.github.io/webidl/>Web IDL/a>/cite>, C. McCormack. W3C.dt idrefsWEBLINK>WEBLINKdd>cite>a hrefhttps://tools.ietf.org/html/rfc5988>Web Linking/a>/cite>, M. Nottingham. IETF.dt idrefsWEBMCG>WEBMCGdd>cite>a hrefhttps://www.webmproject.org/docs/container/>WebM Container Guidelines/a>/cite>. The WebM Project.dt idrefsWEBVTT>WEBVTTdd>cite>a hrefhttps://w3c.github.io/webvtt/>WebVTT/a>/cite>, S. Pieters. W3C.dt idrefsWHATWGWIKI>WHATWGWIKIdd>cite>a hrefhttps://wiki.whatwg.org/>The WHATWG Wiki/a>/cite>. WHATWG.dt idrefsWORKLETS>WORKLETSdd>cite>a hrefhttps://drafts.css-houdini.org/worklets/>Worklets/a>/cite>. I. Kilpatrick. W3C.dt idrefsWSP>WSPdd>cite>a hrefhttps://tools.ietf.org/html/rfc6455>The WebSocket protocol/a>/cite>, I. Fette, A. Melnikov. IETF.dt idrefsX121>X121dd>cite>Recommendation X.121 — International Numbering Plan for Public Data Networks/cite>, CCITT Blue Book, Fascicle VIII.3, pp. 317-332.dt idrefsXFN>XFNdd>cite>a hrefhttps://gmpg.org/xfn/11>XFN 1.1 profile/a>/cite>, T. Çelik, M. Mullenweg, E. Meyer. GMPG.dt idrefsXHR>XHRdd>cite>a hrefhttps://xhr.spec.whatwg.org/>code>XMLHttpRequest/code>/a>/cite>, A. van Kesteren. WHATWG.dt idrefsXKCD1288>XKCD1288dd>(Non-normative) cite>a hrefhttps://xkcd.com/1288/>Substitutions/a>/cite>, Randall Munroe. xkcd.dt idrefsXML>XMLdd>cite>a hrefhttps://www.w3.org/TR/xml/>Extensible Markup Language/a>/cite>, T. Bray, J. Paoli, C. Sperberg-McQueen, E. Maler, F. Yergeau. W3C.dt idrefsXMLENTITY>XMLENTITYdd>(Non-normative) cite>a hrefhttps://www.w3.org/2003/entities/2007doc/>XML Entity Definitions for Characters/a>/cite>, D. Carlisle, P. Ion. W3C.dt idrefsXMLNS>XMLNSdd>cite>a hrefhttps://www.w3.org/TR/xml-names/>Namespaces in XML/a>/cite>, T. Bray, D. Hollander, A. Layman, R. Tobin. W3C.dt idrefsXMLSSPI>XMLSSPIdd>cite>a hrefhttps://www.w3.org/TR/xml-stylesheet/>Associating Style Sheets with XML documents/a>/cite>, J. Clark, S. Pieters, H. Thompson. W3C.dt idrefsXPATH10>XPATH10dd>cite>a hrefhttps://www.w3.org/TR/1999/REC-xpath-19991116/>XML Path Language (XPath) Version 1.0/a>/cite>, J. Clark, S. DeRose. W3C.dt idrefsXSLT10>XSLT10dd>(Non-normative) cite>a hrefhttps://www.w3.org/TR/1999/REC-xslt-19991116>XSL Transformations (XSLT) Version 1.0/a>/cite>, J. Clark. W3C.dt idrefsXSLTP>XSLTPdd>(Non-normative) cite>a hrefhttps://wiki.whatwg.org/wiki/DOM_XSLTProcessor>DOM XSLTProcessor/a>/cite>, WHATWG Wiki. WHATWG./dl> h2 idacknowledgments classno-num>Acknowledgmentsa href#acknowledgments classself-link>/a>/h2> p>Thanks to Tim Berners-Lee for inventing HTML, without which none of this would exist./p> p>Thanks to Aankhen, Aaron Boodman, Aaron Leventhal, Abhishek Gupta, Adam Barth, Adam de Boor, Adam Hepton, Adam Klein, Adam Roben, Addison Phillips, Adele Peterson, Adrian Bateman, Adrian Roselli, Adrian Sutton, Agustín Fernández, Aharon (Vladimir) Lanin, Ajai Tirumali, Akatsuki Kitamura, Alan Plum, Alastair Campbell, Alejandro G. Castro, Aleksey Shvayka, Alex Bishop, Alex Nicolaou, Alex Rousskov, Alexander Farkas, Alexander J. Vincent, Alexandre Morgaut, Alexey Feldgendler, Алексей Проскуряков (Alexey Proskuryakov), Alexis Deveria, Alfred Agrell, Ali Juma, Alice Boxhall, Allan Clements, Allen Wirfs-Brock, Alex Komoroske, Alex Russell, Alphan Chen, Ami Fischman, Amos Jeffries, Anders Carlsson, André Bargull, André E. Veltstra, Andrea Rendine, Andreas, Andreas Kling, Andrei Popescu, Andres Gomez, Andres Rios, Andrew Barfield, Andrew Clover, Andrew Gove, Andrew Grieve, Andrew Oakley, Andrew Sidwell, Andrew Simons, Andrew Smith, Andrew W. Hagen, Andrey V. Lukyanov, Andry Rendy, Andy Earnshaw, Andy Heydon, Andy Palay, Anjana Vakil, Anna Belle Leiserson, Anthony Boyd, Anthony Bryan, Anthony Hickson, Anthony Ramine, Anthony Ricaud, Anton Vayvod, Antti Koivisto, Arkadiusz Michalski, Arne Thomassen, Aron Spohr, Arphen Lin, Arthur Stolyar, Arun Patole, Aryeh Gregor, Asbjørn Ulsberg, Ashley Gullen, Ashley Sheridan, Atsushi Takayama, Aurelien Levy, Ave Wrigley, Avi Drissman, Axel Dahmen, Ben Boyle, Ben Godfrey, Ben Kelly, Ben Lerner, Ben Leslie, Ben Meadowcroft, Ben Millard, Benjamin Carl Wiley Sittler, Benjamin Hawkes-Lewis, Benoit Ren, Bert Bos, Bijan Parsia, Bil Corry, Bill Mason, Bill McCoy, Billy Wong, Billy Woods, Bjartur Thorlacius, Björn Höhrmann, Blake Frantz, Bob Lund, Bob Owen, Bobby Holley, Boris Zbarsky, Brad Fults, Brad Neuberg, Brad Spencer, Bradley Meck, Brady Eidson, Brandon Jones, Brendan Eich, Brenton Simpson, Brett Wilson, Brett Zamir, Brian Blakely, Brian Campbell, Brian Korver, Brian Kuhn, Brian M. Dube, Brian Ryner, Brian Smith, Brian Wilson, Bryan Sullivan, Bruce Bailey, Bruce DArcus, Bruce Lawson, Bruce Miller, Bugs Nash, C. Scott Ananian, C. Williams, Cameron McCormack, Cameron Zemek, Cao Yipeng, Carlos Amengual, Carlos Gabriel Cardona, Carlos Perelló Marín, Casey Leask, Cătălin Mariș, Chao Cai, 윤석찬 (Channy Yun), Charl van Niekerk, Charlene Wright, Charles Iliya Krempeaux, Charles McCathie Nevile, Charlie Reis, Chris Apers, Chris Cressman, Chris Dumez, Chris Evans, Chris Harrelson, Chris Markiewicz, Chris Morris, Chris Pearce, Chris Peterson, Chris Rebert, Chris Weber, Chris Wilson, Christian Biesinger, Christian Johansen, Christian Schmidt, Christoph Päper, Christophe Dumez, Christopher Aillon, Christopher Ferris, Chriswa, Clark Buehler, Cole Robison, Colin Fine, Collin Jackson, Corey Farwell, Corprew Reed, Craig Cockburn, Csaba Gabor, Csaba Marton, Cynthia Shelly, Daksh Shah, Dan Callahan, Dan Ehrenberg, Dan Yoder, Dane Foster, Daniel Barclay, Daniel Bratell, Daniel Brooks, Daniel Brumbaugh Keeney, Daniel Buchner, Daniel Cheng, Daniel Davis, Daniel Glazman, Daniel Peng, Daniel Schattenkirchner, Daniel Spång, Daniel Steinberg, Daniel Trebbien, Danny Sullivan, Darin Adler, Darin Fisher, Darxus, Dave Camp, Dave Hodder, Dave Lampton, Dave Singer, Dave Townsend, David Baron, David Bloom, David Bruant, David Carlisle, David E. Cleary, David Egan Evans, David Fink, David Flanagan, David Gerard, David Grogan, David Håsäther, David Hyatt, David I. Lehn, David John Burrowes, David Kendal, David Matja, David Remahl, David Resseguie, David Smith, David Vest, David Woolley, David Zbarsky, Dave Methvin, DeWitt Clinton, Dean Edridge, Dean Edwards, Dean Jackson, Debi Orton, Delan Azabani, Derek Featherstone, Devarshi Pant, Devdatta, Diego Ferreiro Val, Diego Ponce de León, Dimitri Glazkov, Dimitry Golubovsky, Dirk Pranke, Dirk Schulze, Dirkjan Ochtman, Divya Manian, Dmitry Titov, dolphinling, Dominic Cooney, Dominic Farolino, Dominique Hazaël-Massieux, Don Brutzman, Doron Rosenberg, Doug Kramer, Doug Simpkinson, Drew Wilson, Edgar Chen, Edmund Lai, Eduard Pascual, Eduardo Vela, Edward Welbourne, Edward Z. Yang, Ehsan Akhgari, Eira Monstad, Eitan Adler, Eli Friedman, Eli Grey, Eliot Graff, Elisabeth Robson, Elizabeth Castro, Elliott Sprehn, Elliotte Harold, Emilio Cobos Álvarez, Emily Stark, Eric Carlson, Eric Casler, Eric Lawrence, Eric Rescorla, Eric Semling, Erik Arvidsson, Erik Charlebois, Erik Rose, espretto, Evan Jacobs, Evan Martin, Evan Prodromou, Evan Stade, Evert, Evgeny Kapun, Ezequiel Garzón, fantasai, Felix Sanz, Felix Sasaki, Fernando Altomare Serboncini, Forbes Lindesay, Francesco Schwarz, Francis Brosnan Blazquez, Franck Shift Quélain, François Marier, Frank Barchard, Frank Liberato, Fredrik Söderquist, 鵜飼文敏 (Fumitoshi Ukai), Futomi Hatano, Gavin Carothers, Gavin Kistner, Gareth Rees, Garrett Smith, Gary Kacmarcik, Gary Katsevman, Geoff Richards, Geoffrey Garen, Geoffrey Sneddon, Georg Neis, George Lund, Gianmarco Armellin, Giovanni Campagna, Giuseppe Pascale, Glenn Adams, Glenn Maynard, Graham Klyne, Greg Botten, Greg Houston, Greg Wilkins, Gregg Tavares, Gregory J. Rosmaita, Grey, Guilherme Johansson Tramontina, guest271314, Gytis Jakutonis, Håkon Wium Lie, Habib Virji, Hajime Morrita, Hallvord Reiar Michaelsen Steen, Hans S. Tømmerhalt, Hans Stimer, Harald Alvestrand, Hayato Ito, Henri Sivonen, Henrik Lied, Henry Lewis, Henry Mason, Henry Story, Hermann Donfack Zeufack, Hiroshige Hayashizaki, Hongchan Choi, Hugh Bellamy, Hugh Guiney, Hugh Winkler, Ian Bicking, Ian Clelland, Ian Davis, Ian Fette, Ian Kilpatrick, Ido Green, Ignacio Javier, Igor Oliveira, Ingvar Stepanyan, isonmad, Iurii Kucherov, Ivan Enderlin, Ivan Nikulin, Ivo Emanuel Gonçalves, J. King, J.C. Jones, Jackson Ray Hamilton, Jacob Davies, Jacques Distler, Jake Archibald, Jake Verbaten, Jakub Łopuszański, Jakub Wilk, James Craig, James Graham, James Greene, James Justin Harrell, James Kozianski, James M Snell, James Perrett, James Robinson, Jamie Lokier, Jan Miksovsky, Janusz Majnert, Jan-Klaas Kollhof, Jared Jacobs, Jason Duell, Jason Kersey, Jason Lustig, Jason Orendorff, Jason White, Jasper Bryant-Greene, Jasper St. Pierre, Jatinder Mann, Jean-Yves Avenard, Jed Hartman, Jeff Balogh, Jeff Cutsinger, Jeff JeffH Hodges, Jeff Schiller, Jeff Walden, Jeffrey Yasskin, Jeffrey Zeldman, 胡慧鋒 (Jennifer Braithwaite), Jellybean Stonerfish, Jennifer Apacible, Jens Bannmann, Jens Fendler, Jens Oliver Meiert, Jens Widell, Jer Noble, Jeremey Hustman, Jeremy Keith, Jeremy Orlow, Jeroen van der Meer, Jerry Smith, Jesse Renée Beach, Jessica Jong, jfkthame, Jian Li, Jihye Hong, Jim Jewett, Jim Ley, Jim Meehan, Jim Michaels, Jinjiang (勾三股四), Jirka Kosek, Jjgod Jiang, João Eiras, Jochen Eisinger, Joe Clark, Joe Gregorio, Joel Spolsky, Joel Verhagen, Johan Herland, John Boyer, John Bussjaeger, John Carpenter, John Daggett, John Fallows, John Foliot, John Harding, John Keiser, John Snyders, John Stockton, John-Mark Bell, Johnny Stenback, Jon Coppeard, Jon Ferraiolo, Jon Gibbins, Jon Perlow, Jonas Sicking, Jonathan Cook, Jonathan Neal, Jonathan Oddy, Jonathan Rees, Jonathan Watt, Jonathan Worent, Jonny Axelsson, Jordan Tucker, Jorgen Horstink, Joris van der Wel, Jorunn Danielsen Newth, Joseph Kesselman, Joseph Mansfield, Joseph Pecoraro, Josh Aas, Josh Hart, Josh Juran, Josh Levenberg, Josh Matthews, Joshua Bell, Joshua Randall, Jukka K. Korpela, Jules Clément-Ripoche, Julian Reschke, Julio Lopez, Jun Yang (harttle), Jungkee Song, Jürgen Jeka, Justin Lebar, Justin Novosad, Justin Rogers, Justin Schuh, Justin Sinclair, Juuso Lapinlampi, Ka-Sing Chou, Kagami Sascha Rosylight, Kai Hendry, Kamishetty Sreeja, 呂康豪 (KangHao Lu), Karl Dubost, Karl Tomlinson, Kartikaya Gupta, Kat Graff, Kathy Walton, Keith Rollin, Keith Yeung, Kelly Ford, Kelly Norton, Kenji Baheux, Kevin Benson, Kevin Cole, Kevin Gadd, Kevin Venkiteswaran, Kinuko Yasuda, Koji Ishii, Kornél Pál, Kornel Lesinski, 上野 康平 (UENO, Kouhei), Kris Northfield, Kristof Zelechovski, Krzysztof Maczyński, 黒澤剛志 (Kurosawa Takeshi), Kyle Barnhart, Kyle Hofmann, Kyle Huey, Léonard Bouchet, Léonie Watson, Lachlan Hunt, Larry Masinter, Larry Page, Lars Gunther, Lars Solberg, Laura Carlson, Laura Granka, Laura L. Carlson, Laura Wisewell, Laurens Holst, Lawrence Forooghian, Lee Kowalkowski, Leif Halvard Silli, Leif Kornstaedt, Lenny Domnitser, Leonard Rosenthol, Leons Petrazickis, Lobotom Dysmon, Logan, Loune, Lucas Gadani, Łukasz Pilorz, Luke Kenneth Casson Leighton, Maciej Stachowiak, Magne Andersson, Magnus Kristiansen, Maik Merten, Majid Valipour, Malcolm Rowe, Manish Goregaokar, Manish Tripathi, Marc Hoyois, Marc-André Choquette, Marc-André Lafortune, Marco Zehe, Marcus Bointon, Marijn Kruisselbrink, Mark Amery, Mark Birbeck, Mark Davis, Mark Miller, Mark Nottingham, Mark Pilgrim, Mark Rowe, Mark Schenk, Mark Vickers, Mark Wilton-Jones, Markus Stange, Martijn Wargers, Martin Atkins, Martin Chaov, Martin Dürst, Martin Honnen, Martin Janecke, Martin Kutschker, Martin Nilsson, Martin Thomson, Masataka Yakura, Masatoshi Kimura, Mason Mize, Mathias Bynens, Mathieu Henri, Matias Larsson, Matt Brubeck, Matt Di Pasquale, Matt Falkenhagen, Matt Schmidt, Matt Wright, Matthew Gregan, Matthew Mastracci, Matthew Noorenberghe, Matthew Raymond, Matthew Thomas, Mattias Waldau, Max Romantschuk, Menachem Salomon, Menno van Slooten, Micah Dubinko, Michael Ratt Iannarelli, Michael A. Nachbaur, Michael A. Puls II, Michael Carter, Michael Daskalov, Michael Day, Michael Dyck, Michael Enright, Michael Gratton, Michael Kohler, Michael McKelvey, Michael Nordman, Michael Powers, Michael Rakowski, Michael(tm) Smith, Michael Walmsley, Michal Zalewski, Michel Buffa, Michel Fortin, Michelangelo De Simone, Michiel van der Blonk, Mihai Şucan, Mihai Parparita, Mike Brown, Mike Dierken, Mike Dixon, Mike Hearn, Mike Pennisi, Mike Schinkel, Mike Shaver, Mikko Rantalainen, Mingye Wang, Mohamed Zergaoui, Mohammad Al Houssami, Momdo Nakamura, Morten Stenshorne, Mounir Lamouri, Ms2ger, Mukilan Thiyagarajan, Nadia Heninger, NARUSE Yui, Navid Zolghadr, Neil Deakin, Neil Rashbrook, Neil Soiffer, Nicholas Shanks, Nicholas Stimpson, Nicholas Zakas, Nickolay Ponomarev, Nicolas Gallagher, Nikki Bee, Noah Mendelsohn, Noah Slater, Noel Gordon, Nolan Waite, NoozNooz42, Norbert Lindenberg, Ojan Vafai, Olaf Hoffmann, Olav Junker Kjær, Oldřich Vetešník, Oli Studholme, Oliver Hunt, Oliver Rigby, Olivier Gendrin, Olli Pettay, Ori Avtalion, oSand, Pablo Flouret, Patrick Dark, Patrick Garies, Patrick H. Lauke, Patrik Persson, Paul Adenot, Paul Lewis, Paul Norman, Per-Erik Brodin, 一丝 (percyley), Perry Smith, Peter Beverloo, Peter Karlsson, Peter Kasting, Peter Moulder, Peter Occil, Peter Stark, Peter Van der Beken, Peter van der Zee, Peter-Paul Koch, Phil Pickering, Philip Taylor, Philip TAYLOR, Philippe De Ryck, Pooja Sanklecha, Prashant Hiremath, Prashanth Chandra, Prateek Rungta, Pravir Gupta, Prayag Verma, 李普君 (Pujun Li), Rachid Finge, Rafael Weinstein, Rafał Miłecki, Raj Doshi, Rajas Moonka, Ralf Stoltze, Ralph Giles, Raphael Champeimont, Rebecca Star, Remci Mizkur, Remco, Remy Sharp, Rene Saarsoo, Rene Stach, Ric Hardacre, Rich Clark, Rich Doughty, Richa Rupela, Richard Gibson, Richard Ishida, Rigo Wenning, Rikkert Koppes, Rimantas Liubertas, Riona Macnamara, Rob Buis, Rob Ennals, Rob Jellinghaus, Rob S, Robert Blaut, Robert Collins, Robert Kieffer, Robert Millan, Robert OCallahan, Robert Sayre, Robin Berjon, Robin Schaufler, Rodger Combs, Roland Steiner, Roma Matusevich, Roman Ivanov, Roy Fielding, Rune Lillesveen, Russell Bicknell, Ruud Steltenpool, Ryan King, Ryan Sleevi, Ryo Kato, Ryosuke Niwa, S. Mike Dierken, Salvatore Loreto, Sam Dutton, Sam Kuper, Sam Ruby, Sam Weinig, Samikshya Chand, Samuel Bronson, Samy Kamkar, Sander van Lambalgen, Sanjoy Pal, Sarven Capadisli, Scott Beardsley, Scott González, Scott Hess, Scott Miles, Sean Fraser, Sean Hayes, Sean Hogan, Sean Knapp, Sebastian Markbåge, Sebastian Schnitzenbaumer, Sendil Kumar N, Seth Call, Seth Dillingham, Shannon Moeller, Shanti Rao, Shaun Inman, Shiino Yuki, 贺师俊 (HE Shi-Jun), Shiki Okasaka, Shivani Sharma, Shubheksha Jalan, Sierk Bornemann, Sigbjørn Finne, Sigbjørn Vik, Silver Ghost, Silvia Pfeiffer, Šime Vidas, Simon Fraser, Simon Montagu, Simon Sapin, Simon Spiegel, skeww, Smylers, Srirama Chandra Sekhar Mogali, Stanton McCandlish, Stefan Håkansson, Stefan Haustein, Stefan Santesson, Stefan Schumacher, Stefan Weiss, Steffen Meschkat, Stephen Ma, Stephen White, Steve Comstock, Steve Faulkner, Steve Orvell, Steve Runyon, Steven Bennett, Steven Garrity, Steven Tate, Stewart Brodie, Stuart Ballard, Stuart Langridge, Stuart Parmenter, Subramanian Peruvemba, Sudhanshu Jaiswal, sudokus999, Sunava Dutta, Susan Borgrink, Susan Lesch, Sylvain Pasche, T. J. Crowder, Tab Atkins-Bittner, Taiju Tsuiki, Takashi Toyoshima, Takayoshi Kochi, Takeshi Yoshino, span langtr>Tantek Çelik/span>, 田村健人 (TAMURA Kent), Taylor Hunt, Ted Mielczarek, Terrence Wood, Tetsuharu OHZEKI, Theresa OConnor, Thijs van der Vossen, Thomas Broyer, Thomas Koetter, Thomas OConnor, Tim Altman, Tim Johansson, Tim Perry, TJ VanToll, Tobias Schneider, Tobie Langel, Toby Inkster, Todd Moody, Tom Baker, Tom Pike, Tom Schuster, Tommy Thorsen, Tony Ross, Tooru Fujisawa, Travis Leithead, Trevor Rowbotham, Trevor Saunders, triple-underscore, Tyler Close, Valentin Gosu, Vardhan Gupta, Veli Şenol, Victor Carbune, Victor Costan, Vipul Snehadeep Chawathe, Vitya Muhachev, Vlad Levin, Vladimir Katardjiev, Vladimir Vukićević, Vyacheslav Aristov, voracity, Walter Steiner, Wakaba, Wayne Carr, Wayne Pollock, Wellington Fernando de Macedo, Weston Ruter, Wilhelm Joys Andersen, Will Levine, Will Ray, William Chen, William Swanson, Willy Martin Aguirre Rodriguez, Wladimir Palant, Wojciech Mach, Wolfram Kriesing, Xan Gregg, xenotheme, XhmikosR, Xida Chen, Xidorn Quan, Xue Fuqiao, Yang Chen, Yay295, Ye-Kui Wang, Yehuda Katz, Yi-An Huang, Yngve Nysaeter Pettersen, Yoav Weiss, Yonathan Randolph, Yuzo Fujishima, Zhenbin Xu, 张智强 (Zhiqiang Zhang), Zoltan Herczeg, and Øistein E. Andersen, for their useful comments, both large and small, that have led to changes to this specification over the years./p> p>Thanks also to everyone who has ever posted about HTML to their blogs, public mailing lists, or forums, including all the contributors to the a hrefhttps://www.w3.org/html/wg/lists/>various W3C HTML WG lists/a> and the a hrefhttps://whatwg.org/mailing-list>various WHATWG lists/a>. p>Special thanks to Richard Williamson for creating the first implementation of code idacknowledgments:the-canvas-element>a href#the-canvas-element>canvas/a>/code> in Safari, from which the canvas feature was designed./p> p>Special thanks also to the Microsoft employees who first implemented the event-based drag-and-drop mechanism, code idacknowledgments:attr-contenteditable>a href#attr-contenteditable>contenteditable/a>/code>, and other features first widely deployed by the Windows Internet Explorer browser./p> p>Special thanks and $10,000 to David Hyatt who came up with a broken implementation of the a href#adoptionAgency>adoption agency algorithm/a> that the editor had to reverse engineer and fix before using it in the parsing section./p> p>Thanks to the participants of the microdata usability study for allowing us to use their mistakes as a guide for designing the microdata feature./p> p>Thanks to the many sources that provided inspiration for the examples used in the specification./p> p>Thanks also to the Microsoft blogging community for some ideas, to the attendees of the W3C Workshop on Web Applications and Compound Documents for inspiration, to the #mrt crew, the #mrt.no crew, and the #whatwg crew, and to Pillar and Hedral for their ideas and support./p> p>Thanks to Igor Zhbanov for generating PDF versions of the specification./p> p>Special thanks to the a hrefhttps://www.w3.org/community/respimg/>RICG/a> for developing the code idacknowledgments:the-picture-element>a href#the-picture-element>picture/a>/code> element and related features; in particular thanks to Adrian Bateman, Bruce Lawson, David Newton, Ilya Grigorik, John Schoenick, Leon de Rijke, Mat Marquis, Marcos Cáceres, Tab Atkins, Theresa OConnor, and Yoav Weiss for their contributions./p> p>Special thanks to the a hrefhttps://www.w3.org/WebPlatform/WG/>WPWG/a> for incubating the a href#custom-elements>custom elements/a> feature. In particular, thanks to David Hyatt and Ian Hickson for their influence through the XBL specifications, Dimitri Glazkov for the first draft of the custom elements specification, and to Alex Komoroske, Alex Russell, Andres Rios, Boris Zbarsky, Brian Kardell, Daniel Buchner, Dominic Cooney, Erik Arvidsson, Elliott Sprehn, Hajime Morrita, Hayato Ito, Jan Miksovsky, Jonas Sicking, Olli Pettay, Rafael Weinstein, Roland Steiner, Ryosuke Niwa, Scott Miles, Steve Faulkner, Steve Orvell, Tab Atkins, Theresa OConnor, Tim Perry, and William Chen for their contributions./p> p>Part of the revision history of the code idacknowledgments:the-picture-element-2>a href#the-picture-element>picture/a>/code> element and related features can be found in the a hrefhttps://github.com/ResponsiveImagesCG/picture-element>code>ResponsiveImagesCG/picture-element/code> repository/a>./p> p>Part of the revision history of the code idacknowledgments:meta-theme-color>a href#meta-theme-color>theme-color/a>/code> metadata name can be found in the a hrefhttps://github.com/whatwg/meta-theme-color>code>whatwg/meta-theme-color/code> repository/a>./p> p itemtypehttp://n.whatwg.org/work itemscope>Part of the revision history of the a href#custom-elements>custom elements/a> feature can be found in the a hrefhttps://github.com/w3c/webcomponents>code>w3c/webcomponents/code> repository/a>, which is available under the a itemproplicense hrefhttps://www.w3.org/Consortium/Legal/2015/copyright-software-and-document>W3C Permissive Document License/a>./p> p>Part of the revision history of the code idacknowledgments:dom-innertext>a href#dom-innertext>innerText/a>/code> IDL attribute can be found in the a hrefhttps://github.com/rocallahan/innerText-spec>code>rocallahan/innerText-spec/code> repository/a>./p> p>For about ten years starting in 2003, this specification was almost entirely written by Ian Hickson (Google, ian@hixie.ch). More recently, Simon Pieters (no affiliation, Opera until 2017-09-15, zcorpan@gmail.com), Anne van Kesteren (Mozilla, annevk@annevk.nl), Philip Jägenstedt (Google, philip@foolip.org), and Domenic Denicola (Google, d@domenic.me), all previously long-time contributors, have joined Ian in editing the text directly./p> div itemtypehttp://n.whatwg.org/work itemscope> p>The image in the introduction is based on a itempropwork hrefhttps://www.flickr.com/photos/wonderlane/2986252088/>a photo/a> by a itemprophttps://creativecommons.org/ns#attributionURL hrefhttps://www.flickr.com/photos/wonderlane/>Wonderlane/a>. (a itemproplicense hrefhttps://creativecommons.org/licenses/by/2.0/>CC BY 2.0/a>) /div> div itemtypehttp://n.whatwg.org/work itemscope> p>The image of the wolf in the embedded content introduction is based on a itempropwork hrefhttps://commons.wikimedia.org/wiki/File:WolfRunningInSnow.jpg>a photo/a> by a itemprophttp://creativecommons.org/ns#attributionURL hrefhttps://commons.wikimedia.org/wiki/File:WolfRunningInSnow.jpg>Barry ONeill/a>. (a itemproplicense hrefhttps://en.wikipedia.org/wiki/Public_domain>Public domain/a>) /div> div itemtypehttp://n.whatwg.org/work itemscope> p>The image of the kettlebell swing in the embedded content introduction is based on a itempropwork hrefhttps://pixabay.com/en/functional-mobility-articular-606568/>a photo/a> by a itemprophttp://creativecommons.org/ns#attributionURL hrefhttps://pixabay.com/en/users/506563-506563/>kokkarina/a>. (a itemproplicense hrefhttps://creativecommons.org/publicdomain/zero/1.0/>CC0 1.0/a>) /div> div itemtypehttp://n.whatwg.org/work itemscope> p>The Blue Robot Player sprite used in the canvas demo is based on a itempropwork hrefhttps://johncolburn.deviantart.com/art/Blue-Robot-Player-Sprite-323813997>a work/a> by a itemprophttps://creativecommons.org/ns#attributionURL hrefhttps://johncolburn.deviantart.com/>JohnColburn/a>. (a itemproplicense hrefhttps://creativecommons.org/licenses/by-sa/3.0/>CC BY-SA 3.0/a>)/p> /div> div itemtypehttp://n.whatwg.org/work itemscope> p>The photograph of robot 148 climbing the tower at the FIRST Robotics Competition 2013 Silicon Valley Regional is based on a itempropwork hrefhttps://www.flickr.com/photos/lenore-m/8631391979/>a work/a> by a itemprophttps://creativecommons.org/ns#attributionURL hrefhttps://www.flickr.com/photos/lenore-m/>Lenore Edman/a>. (a itemproplicense hrefhttps://creativecommons.org/licenses/by/2.0/>CC BY 2.0/a>)/p> /div> div itemtypehttp://n.whatwg.org/work itemscope> p>The diagram showing how code idacknowledgments:attr-script-async>a href#attr-script-async>async/a>/code> and code idacknowledgments:attr-script-defer>a href#attr-script-defer>defer/a>/code> impact code idacknowledgments:the-script-element>a href#the-script-element>script/a>/code> loading is based on a similar diagram from a itempropwork hrefhttps://peter.sh/experiments/asynchronous-and-deferred-javascript-execution-explained/>a blog post/a> by a itemprophttps://creativecommons.org/ns#attributionURL hrefhttps://peter.sh/about/>Peter Beverloo/a>. (a itemproplicense hrefhttps://creativecommons.org/publicdomain/zero/1.0/>CC0 1.0/a>)/p> /div> div itemtypehttp://n.whatwg.org/work itemscope> p>The image decoding demo used to demonstrate module-based workers draws on some example code from a itempropwork hrefhttps://www.html5rocks.com/en/tutorials/canvas/imagefilters/>a tutorial/a> by a itemprophttps://creativecommons.org/ns#attributionURL hrefhttps://www.fhtr.net/>Ilmari Heikkinen/a>. (a itemproplicense hrefhttps://creativecommons.org/licenses/by/3.0/>CC BY 3.0/a>)/p> /div> div itemtypehttp://n.whatwg.org/work itemscope> p>The code><flag-icon>/code> example was inspired by a itempropwork hrefhttps://github.com/stevenrskelton/flag-icon>a custom element/a> by a itemprophttps://creativecommons.org/ns#attributionURL hrefhttp://stevenskelton.ca/>Steven Skelton/a>. (a itemproplicense hrefhttps://opensource.org/licenses/MIT>MIT/a>)/p> /div> p>Parts of this specification are © Copyright 2004-2014 Apple Inc., Mozilla Foundation, and Opera Software ASA. You are granted a license to use, reproduce and create derivative works of this document./p>
View on OTX
|
View on ThreatMiner
Please enable JavaScript to view the
comments powered by Disqus.
Data with thanks to
AlienVault OTX
,
VirusTotal
,
Malwr
and
others
. [
Sitemap
]